Permalink
Browse files

Deprecate scoped_ptr part 1.

With this CL, scoped_ptr is replaced with std::unique_ptr mainly in the
following directories.
 - src/engine/
 - src/usage_stats/

BUG=#219
TEST=unittest
REF_BUG=9164610
REF_CL=84942345,84942768,84943699
  • Loading branch information...
yukawa committed Oct 25, 2015
1 parent 6a027e9 commit d56d5db9353d89e7010ac03a9add9220f0f221c6
View
@@ -30,8 +30,9 @@
#ifndef MOZC_ENGINE_ENGINE_H_
#define MOZC_ENGINE_ENGINE_H_
+#include <memory>
+
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "dictionary/dictionary_interface.h"
#include "dictionary/pos_group.h"
#include "dictionary/user_dictionary.h"
@@ -76,24 +77,24 @@ class Engine : public EngineInterface {
}
private:
- scoped_ptr<dictionary::SuppressionDictionary> suppression_dictionary_;
- scoped_ptr<const Connector> connector_;
- scoped_ptr<const Segmenter> segmenter_;
- scoped_ptr<dictionary::UserDictionary> user_dictionary_;
- scoped_ptr<dictionary::DictionaryInterface> suffix_dictionary_;
- scoped_ptr<dictionary::DictionaryInterface> dictionary_;
- scoped_ptr<const dictionary::PosGroup> pos_group_;
- scoped_ptr<ImmutableConverterInterface> immutable_converter_;
- scoped_ptr<const SuggestionFilter> suggestion_filter_;
+ std::unique_ptr<dictionary::SuppressionDictionary> suppression_dictionary_;
+ std::unique_ptr<const Connector> connector_;
+ std::unique_ptr<const Segmenter> segmenter_;
+ std::unique_ptr<dictionary::UserDictionary> user_dictionary_;
+ std::unique_ptr<dictionary::DictionaryInterface> suffix_dictionary_;
+ std::unique_ptr<dictionary::DictionaryInterface> dictionary_;
+ std::unique_ptr<const dictionary::PosGroup> pos_group_;
+ std::unique_ptr<ImmutableConverterInterface> immutable_converter_;
+ std::unique_ptr<const SuggestionFilter> suggestion_filter_;
// TODO(noriyukit): Currently predictor and rewriter are created by this class
// but owned by converter_. Since this class creates these two, it'd be better
// if Engine class owns these two instances.
PredictorInterface *predictor_;
RewriterInterface *rewriter_;
- scoped_ptr<ConverterInterface> converter_;
- scoped_ptr<UserDataManagerInterface> user_data_manager_;
+ std::unique_ptr<ConverterInterface> converter_;
+ std::unique_ptr<UserDataManagerInterface> user_data_manager_;
DISALLOW_COPY_AND_ASSIGN(Engine);
};
@@ -29,14 +29,16 @@
#include "engine/engine_factory.h"
+#include <memory>
+
#include "engine/engine_interface.h"
#include "prediction/predictor_interface.h"
#include "testing/base/public/gunit.h"
namespace mozc {
TEST(EngineFactoryTest, MobilePredictorOnAndroid) {
- scoped_ptr<EngineInterface> engine(EngineFactory::Create());
+ std::unique_ptr<EngineInterface> engine(EngineFactory::Create());
PredictorInterface *predictor = engine->GetPredictor();
#ifdef OS_ANDROID
EXPECT_EQ("MobilePredictor", predictor->GetPredictorName());
@@ -30,8 +30,9 @@
#ifndef MOZC_ENGINE_MOCK_CONVERTER_ENGINE_H_
#define MOZC_ENGINE_MOCK_CONVERTER_ENGINE_H_
+#include <memory>
+
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "engine/engine_interface.h"
namespace mozc {
@@ -58,8 +59,8 @@ class MockConverterEngine : public EngineInterface {
ConverterMock* mutable_converter_mock();
private:
- scoped_ptr<ConverterMock> converter_mock_;
- scoped_ptr<UserDataManagerMock> user_data_manager_mock_;
+ std::unique_ptr<ConverterMock> converter_mock_;
+ std::unique_ptr<UserDataManagerMock> user_data_manager_mock_;
DISALLOW_COPY_AND_ASSIGN(MockConverterEngine);
};
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=17
-BUILD=2146
+BUILD=2147
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.
@@ -36,6 +36,7 @@
#include "base/logging.h"
#include "base/scheduler.h"
#include "base/scheduler_stub.h"
+#include "base/scoped_ptr.h"
#include "base/system_util.h"
#include "base/util.h"
#include "config/stats_config_util.h"
@@ -33,7 +33,6 @@
#include <string>
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "base/system_util.h"
#include "config/stats_config_util.h"
#include "config/stats_config_util_mock.h"
@@ -30,8 +30,9 @@
#ifndef MOZC_USAGE_STATS_USAGE_STATS_TESTING_UTIL_H_
#define MOZC_USAGE_STATS_USAGE_STATS_TESTING_UTIL_H_
+#include <memory>
+
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "testing/base/public/gunit.h"
namespace mozc {
@@ -106,7 +107,7 @@ class scoped_usage_stats_enabler {
~scoped_usage_stats_enabler();
private:
- scoped_ptr<mozc::config::StatsConfigUtilMock> stats_config_util_;
+ std::unique_ptr<mozc::config::StatsConfigUtilMock> stats_config_util_;
DISALLOW_COPY_AND_ASSIGN(scoped_usage_stats_enabler);
};
@@ -30,6 +30,7 @@
#include "usage_stats/usage_stats_updater.h"
#include <algorithm>
+#include <memory>
#include <set>
#include <sstream>
#include <vector>
@@ -41,7 +42,6 @@
#include "base/mac_util.h"
#include "base/number_util.h"
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "base/system_util.h"
#include "base/util.h"
#include "base/win_util.h"
@@ -93,7 +93,7 @@ bool IMEActivationKeyCustomized() {
for (size_t i = 0; i < arraysize(kKeyMaps); ++i) {
const char *keymap_file =
keymap::KeyMapManager::GetKeyMapFileName(kKeyMaps[i]);
- scoped_ptr<istream> ifs(ConfigFileStream::LegacyOpen(keymap_file));
+ std::unique_ptr<istream> ifs(ConfigFileStream::LegacyOpen(keymap_file));
if (ifs.get() == NULL) {
LOG(ERROR) << "can not open default keymap table " << i;
continue;
@@ -32,7 +32,6 @@
#include <string>
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "base/system_util.h"
#include "base/util.h"
#include "config/config_handler.h"

0 comments on commit d56d5db

Please sign in to comment.