Permalink
Browse files

Deprecate scoped_ptr part 3.

With this CL, scoped_ptr is replaced with std::unique_ptr mainly in the
following directories.
 - src/chrome/
 - src/client/
 - src/composer/
 - src/converter/
 - src/handwriting/
 - src/mac/
 - src/prediction/
 - src/renderer/
 - src/rewriter/
 - src/session/

BUG=#219
TEST=unittest
REF_BUG=9164610
REF_CL=85037361,85040383,85120717,85123903,85124773,85125239,85125883,85128985,85135671,85140884
  • Loading branch information...
1 parent 3cbfeb2 commit 1ed31197ff736715ce51f0f852625e7fee2d2632 Noriyuki Takahashi committed with yukawa Oct 25, 2015
Showing with 1,000 additions and 923 deletions.
  1. +1 −2 src/chrome/nacl/dictionary_downloader.cc
  2. +2 −2 src/chrome/nacl/dictionary_downloader.h
  3. +9 −8 src/chrome/nacl/nacl_net_test_module.cc
  4. +11 −10 src/chrome/nacl/nacl_session_handler.cc
  5. +0 −1 src/chrome/nacl/url_loader_util.cc
  6. +3 −2 src/client/client.cc
  7. +5 −4 src/client/client.h
  8. +3 −2 src/client/client_scenario_test_main.cc
  9. +3 −2 src/client/client_stress_test_main.cc
  10. +6 −5 src/client/client_test.cc
  11. +2 −2 src/composer/composer.h
  12. +2 −2 src/composer/composer_main.cc
  13. +7 −6 src/composer/composer_test.cc
  14. +11 −8 src/composer/internal/char_chunk_test.cc
  15. +3 −1 src/composer/internal/composition.cc
  16. +11 −11 src/composer/internal/composition_test.cc
  17. +7 −7 src/composer/internal/typing_model.cc
  18. +3 −2 src/composer/internal/typing_model.h
  19. +4 −3 src/composer/table.cc
  20. +3 −2 src/composer/table.h
  21. +18 −18 src/converter/candidate_filter_test.cc
  22. +3 −3 src/converter/connector.h
  23. +2 −2 src/converter/connector_test.cc
  24. +3 −3 src/converter/converter.h
  25. +4 −3 src/converter/converter_main.cc
  26. +2 −1 src/converter/converter_mock_test.cc
  27. +3 −3 src/converter/converter_regression_test.cc
  28. +47 −48 src/converter/converter_test.cc
  29. +2 −2 src/converter/immutable_converter.cc
  30. +22 −23 src/converter/immutable_converter_test.cc
  31. +2 −2 src/converter/lattice.h
  32. +2 −2 src/converter/nbest_generator.h
  33. +17 −18 src/converter/nbest_generator_test.cc
  34. +4 −5 src/converter/pos_id_printer_test.cc
  35. +2 −2 src/converter/quality_regression_main.cc
  36. +5 −3 src/converter/quality_regression_test.cc
  37. +3 −3 src/converter/quality_regression_util.h
  38. +4 −4 src/converter/segments.h
  39. +6 −3 src/handwriting/zinnia_handwriting.cc
  40. +4 −4 src/handwriting/zinnia_handwriting.h
  41. +2 −3 src/handwriting/zinnia_handwriting_test.cc
  42. +3 −1 src/mac/main.mm
  43. +1 −1 src/mozc_version_template.txt
  44. +69 −67 src/prediction/dictionary_predictor_test.cc
  45. +3 −3 src/prediction/predictor.h
  46. +21 −20 src/prediction/predictor_test.cc
  47. +3 −2 src/prediction/suggestion_filter.h
  48. +6 −3 src/prediction/user_history_predictor.cc
  49. +5 −5 src/prediction/user_history_predictor.h
  50. +40 −38 src/prediction/user_history_predictor_test.cc
  51. +7 −5 src/renderer/mac/CandidateController.h
  52. +10 −5 src/renderer/mac/mac_server.h
  53. +6 −5 src/renderer/renderer_client.cc
  54. +7 −4 src/renderer/renderer_client.h
  55. +7 −3 src/renderer/renderer_server.h
  56. +5 −3 src/renderer/renderer_server_test.cc
  57. +6 −4 src/renderer/win32/candidate_window.h
  58. +3 −2 src/renderer/win32/indicator_window.h
  59. +6 −4 src/renderer/win32/infolist_window.h
  60. +3 −1 src/renderer/win32/win32_renderer_client.cc
  61. +5 −4 src/renderer/win32/win32_renderer_util.h
  62. +4 −3 src/renderer/win32/win32_renderer_util_test.cc
  63. +3 −1 src/renderer/win32/win32_server.h
  64. +9 −8 src/renderer/win32/window_manager.h
  65. +13 −13 src/rewriter/calculator_rewriter_test.cc
  66. +3 −2 src/rewriter/collocation_rewriter.cc
  67. +2 −3 src/rewriter/collocation_rewriter.h
  68. +3 −1 src/rewriter/collocation_rewriter_test.cc
  69. +3 −1 src/rewriter/correction_rewriter_test.cc
  70. +2 −2 src/rewriter/date_rewriter_test.cc
  71. +5 −4 src/rewriter/dictionary_generator.h
  72. +1 −2 src/rewriter/emoji_rewriter.h
  73. +2 −1 src/rewriter/emoji_rewriter_test.cc
  74. +2 −1 src/rewriter/emoticon_rewriter.cc
  75. +2 −2 src/rewriter/focus_candidate_rewriter_test.cc
  76. +7 −6 src/rewriter/language_aware_rewriter_test.cc
  77. +25 −25 src/rewriter/number_rewriter_test.cc
  78. +5 −5 src/rewriter/rewriter_test.cc
  79. +3 −2 src/rewriter/single_kanji_rewriter.cc
  80. +6 −7 src/rewriter/single_kanji_rewriter_test.cc
  81. +2 −2 src/rewriter/symbol_rewriter.h
  82. +4 −5 src/rewriter/symbol_rewriter_test.cc
  83. +23 −24 src/rewriter/transliteration_rewriter_test.cc
  84. +3 −3 src/rewriter/unicode_rewriter_test.cc
  85. +12 −11 src/rewriter/usage_rewriter_test.cc
  86. +3 −3 src/rewriter/user_boundary_history_rewriter.h
  87. +2 −1 src/rewriter/user_segment_history_rewriter.h
  88. +35 −36 src/rewriter/user_segment_history_rewriter_test.cc
  89. +8 −8 src/rewriter/variants_rewriter_test.cc
  90. +3 −2 src/rewriter/zipcode_rewriter_test.cc
  91. +2 −2 src/session/generic_storage_manager.cc
  92. +4 −3 src/session/generic_storage_manager.h
  93. +6 −5 src/session/internal/candidate_list.h
  94. +4 −4 src/session/internal/candidate_list_test.cc
  95. +5 −3 src/session/internal/ime_context.h
  96. +3 −3 src/session/internal/ime_context_test.cc
  97. +2 −2 src/session/internal/keymap.cc
  98. +5 −4 src/session/internal/keymap_test.cc
  99. +2 −2 src/session/key_info_util.cc
  100. +2 −1 src/session/session.cc
  101. +3 −3 src/session/session.h
  102. +6 −5 src/session/session_client_main.cc
  103. +4 −4 src/session/session_converter.h
  104. +2 −1 src/session/session_converter_stress_test.cc
  105. +8 −9 src/session/session_converter_test.cc
  106. +8 −8 src/session/session_handler.h
  107. +8 −9 src/session/session_handler_scenario_test.cc
  108. +3 −3 src/session/session_handler_stress_test.cc
  109. +14 −13 src/session/session_handler_test.cc
  110. +4 −3 src/session/session_handler_test_util.h
  111. +5 −4 src/session/session_regression_test.cc
  112. +6 −3 src/session/session_server.h
  113. +4 −4 src/session/session_server_test.cc
  114. +211 −212 src/session/session_test.cc
  115. +7 −7 src/session/session_usage_observer_test.cc
  116. +3 −3 src/session/session_watch_dog.cc
  117. +5 −2 src/session/session_watch_dog.h
@@ -33,9 +33,8 @@
#include "base/logging.h"
#include "base/mutex.h"
-#include "base/port.h"
#include "base/pepper_file_util.h"
-#include "base/scoped_ptr.h"
+#include "base/port.h"
#include "base/util.h"
#include "chrome/nacl/url_loader_util.h"
#include "net/http_client_pepper.h"
@@ -30,10 +30,10 @@
#ifndef MOZC_CHROME_NACL_DICTIONARY_DOWNLOADER_H_
#define MOZC_CHROME_NACL_DICTIONARY_DOWNLOADER_H_
+#include <memory>
#include <string>
#include "base/port.h"
-#include "base/scoped_ptr.h"
namespace mozc {
namespace chrome {
@@ -67,7 +67,7 @@ class DictionaryDownloader {
private:
class Impl;
- scoped_ptr<Impl> impl_;
+ std::unique_ptr<Impl> impl_;
DISALLOW_COPY_AND_ASSIGN(DictionaryDownloader);
};
@@ -27,12 +27,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include <memory>
#include <string>
-#include "base/port.h"
-#include "base/util.h"
#include "base/number_util.h"
#include "base/pepper_file_util.h"
+#include "base/port.h"
+#include "base/util.h"
#include "chrome/nacl/dictionary_downloader.h"
#include "net/http_client.h"
#include "testing/base/public/gunit.h"
@@ -93,7 +94,7 @@ TEST_F(DictionaryDownloaderTest, HTTPClientRetryTest) {
TEST_F(DictionaryDownloaderTest, SimpleTest) {
SetRetryTestCounter(0);
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
downloader.reset(new DictionaryDownloader(base_url_, "/test01"));
downloader->StartDownload();
while (downloader->GetStatus() != DictionaryDownloader::DOWNLOAD_FINISHED) {
@@ -114,7 +115,7 @@ TEST_F(DictionaryDownloaderTest, SimpleTest) {
TEST_F(DictionaryDownloaderTest, LargeDataTest) {
SetRetryTestCounter(0);
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
downloader.reset(new DictionaryDownloader(
base_url_ + "?data=0123456789&times=1000000",
"/large_data"));
@@ -131,7 +132,7 @@ TEST_F(DictionaryDownloaderTest, LargeDataTest) {
TEST_F(DictionaryDownloaderTest, RetryTest) {
SetRetryTestCounter(-1);
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
downloader.reset(new DictionaryDownloader(base_url_, "/test01"));
downloader->StartDownload();
while (downloader->GetStatus() != DictionaryDownloader::DOWNLOAD_ERROR) {
@@ -159,7 +160,7 @@ TEST_F(DictionaryDownloaderTest, RetryTest) {
TEST_F(DictionaryDownloaderTest, DelayTest) {
SetRetryTestCounter(0);
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
downloader.reset(new DictionaryDownloader(base_url_, "/test01"));
downloader->SetOption(1000, 0, 0, 0, 0);
downloader->StartDownload();
@@ -174,7 +175,7 @@ TEST_F(DictionaryDownloaderTest, DelayTest) {
TEST_F(DictionaryDownloaderTest, RetryIntervalTest) {
SetRetryTestCounter(-3);
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
downloader.reset(new DictionaryDownloader(base_url_, "/test01"));
downloader->SetOption(0, 0, 1000, 0, 3);
downloader->StartDownload();
@@ -198,7 +199,7 @@ TEST_F(DictionaryDownloaderTest, RetryIntervalTest) {
}
TEST_F(DictionaryDownloaderTest, RetryIntervalBackOffTest) {
- scoped_ptr<DictionaryDownloader> downloader;
+ std::unique_ptr<DictionaryDownloader> downloader;
SetRetryTestCounter(-3);
downloader.reset(new DictionaryDownloader(base_url_, "/test01"));
downloader->SetOption(0, 0, 1000, 1, 3);
@@ -34,6 +34,7 @@
#include <ppapi/cpp/var.h>
#include <ppapi/utility/completion_callback_factory.h>
+#include <memory>
#include <queue>
#include <string>
@@ -239,7 +240,7 @@ class MozcSessionHandlerThread : public Thread {
while (true) {
bool stopped = false;
- scoped_ptr<Json::Value> message;
+ std::unique_ptr<Json::Value> message;
message.reset(message_queue_->take(&stopped));
if (stopped) {
LOG(ERROR) << " message_queue_ stopped";
@@ -302,7 +303,7 @@ class MozcSessionHandlerThread : public Thread {
LOG(ERROR) << "PepperFileUtil::ReadBinaryFile error";
return false;
}
- scoped_ptr<mozc::packed::PackedDataManager>
+ std::unique_ptr<mozc::packed::PackedDataManager>
data_manager(new mozc::packed::PackedDataManager());
if (!data_manager->InitWithZippedData(buffer)) {
LOG(ERROR) << "InitWithZippedData error";
@@ -340,7 +341,7 @@ class MozcSessionHandlerThread : public Thread {
const string data_file_name = "./zipped_data_oss";
#endif // GOOGLE_JAPANESE_INPUT_BUILD
CHECK(HTTPClient::Get(data_file_name, option, &output));
- scoped_ptr<mozc::packed::PackedDataManager>
+ std::unique_ptr<mozc::packed::PackedDataManager>
data_manager(new mozc::packed::PackedDataManager());
CHECK(data_manager->InitWithZippedData(output));
mozc::packed::RegisterPackedDataManager(data_manager.release());
@@ -405,12 +406,12 @@ class MozcSessionHandlerThread : public Thread {
pp::Instance *instance_;
BlockingQueue<Json::Value *> *message_queue_;
pp::CompletionCallbackFactory<MozcSessionHandlerThread> factory_;
- scoped_ptr<EngineInterface> engine_;
- scoped_ptr<SessionHandlerInterface> handler_;
- scoped_ptr<const UserPOSInterface> user_pos_;
+ std::unique_ptr<EngineInterface> engine_;
+ std::unique_ptr<SessionHandlerInterface> handler_;
+ std::unique_ptr<const UserPOSInterface> user_pos_;
#ifdef GOOGLE_JAPANESE_INPUT_BUILD
- scoped_ptr<SessionUsageObserver> usage_observer_;
- scoped_ptr<chrome::nacl::DictionaryDownloader> downloader_;
+ std::unique_ptr<SessionUsageObserver> usage_observer_;
+ std::unique_ptr<chrome::nacl::DictionaryDownloader> downloader_;
string big_dictionary_version_;
#endif // GOOGLE_JAPANESE_INPUT_BUILD
DISALLOW_COPY_AND_ASSIGN(MozcSessionHandlerThread);
@@ -425,7 +426,7 @@ class NaclSessionHandlerInstance : public pp::Instance {
private:
void CheckStatusAndStartMozcSessionHandlerThread();
- scoped_ptr<MozcSessionHandlerThread> mozc_thread_;
+ std::unique_ptr<MozcSessionHandlerThread> mozc_thread_;
BlockingQueue<Json::Value *> message_queue_;
DISALLOW_COPY_AND_ASSIGN(NaclSessionHandlerInstance);
@@ -442,7 +443,7 @@ void NaclSessionHandlerInstance::HandleMessage(const pp::Var &var_message) {
return;
}
- scoped_ptr<Json::Value> message(new Json::Value);
+ std::unique_ptr<Json::Value> message(new Json::Value);
if (Json::Reader().parse(var_message.AsString(), *message.get())) {
message_queue_.put(message.release());
}
@@ -44,7 +44,6 @@
#include "base/logging.h"
#include "base/port.h"
-#include "base/scoped_ptr.h"
using std::unique_ptr;
@@ -39,6 +39,7 @@
#endif // OS_WIN
#include <cstddef>
+#include <memory>
#include "base/const.h"
#include "base/file_stream.h"
@@ -553,7 +554,7 @@ bool Client::PingServer() const {
input.set_type(commands::Input::NO_OPERATION);
// Call IPC
- scoped_ptr<IPCClientInterface> client(
+ std::unique_ptr<IPCClientInterface> client(
client_factory_->NewClient(kServerAddress,
server_launcher_->server_program()));
@@ -624,7 +625,7 @@ bool Client::Call(const commands::Input &input,
input.SerializeToString(&request);
// Call IPC
- scoped_ptr<IPCClientInterface> client(
+ std::unique_ptr<IPCClientInterface> client(
client_factory_->NewClient(kServerAddress,
server_launcher_->server_program()));
View
@@ -32,10 +32,11 @@
#ifndef MOZC_CLIENT_CLIENT_H_
#define MOZC_CLIENT_CLIENT_H_
+#include <memory>
#include <string>
#include <vector>
+
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "client/client_interface.h"
#include "protocol/commands.pb.h"
#include "testing/base/public/gunit_prod.h"
@@ -242,9 +243,9 @@ class Client : public ClientInterface {
uint64 id_;
IPCClientFactoryInterface *client_factory_;
- scoped_ptr<ServerLauncherInterface> server_launcher_;
- scoped_ptr<char[]> result_;
- scoped_ptr<config::Config> preferences_;
+ std::unique_ptr<ServerLauncherInterface> server_launcher_;
+ std::unique_ptr<char[]> result_;
+ std::unique_ptr<config::Config> preferences_;
int timeout_;
ServerStatus server_status_;
uint32 server_protocol_version_;
@@ -32,6 +32,7 @@
// events specified by FLAGS_input file or interactive standard input. Input
// file format is same as one of session/session_client_main.
+#include <memory>
#include <string>
#include <vector>
@@ -100,7 +101,7 @@ int Loop(istream *input) {
CHECK(client.EnsureSession()) << "EnsureSession failed";
CHECK(client.NoOperation()) << "Server is not responding";
- scoped_ptr<mozc::renderer::RendererClient> renderer_client;
+ std::unique_ptr<mozc::renderer::RendererClient> renderer_client;
mozc::commands::RendererCommand renderer_command;
if (FLAGS_test_renderer) {
@@ -175,7 +176,7 @@ int main(int argc, char **argv) {
mozc::SystemUtil::SetUserProfileDirectory(FLAGS_profile_dir);
}
- scoped_ptr<mozc::InputFileStream> input_file;
+ std::unique_ptr<mozc::InputFileStream> input_file;
istream *input = NULL;
if (!FLAGS_input.empty()) {
@@ -36,11 +36,12 @@
#include <unistd.h>
#endif // OS_WIN
+#include <memory>
+
#include "base/file_stream.h"
#include "base/flags.h"
#include "base/logging.h"
#include "base/port.h"
-#include "base/scoped_ptr.h"
#include "base/util.h"
#include "protocol/renderer_command.pb.h"
#include "renderer/renderer_client.h"
@@ -73,7 +74,7 @@ int main(int argc, char **argv) {
CHECK(client.EnsureSession()) << "EnsureSession failed";
CHECK(client.NoOperation()) << "Server is not respoinding";
- scoped_ptr<mozc::renderer::RendererClient> renderer_client;
+ std::unique_ptr<mozc::renderer::RendererClient> renderer_client;
mozc::commands::RendererCommand renderer_command;
if (FLAGS_test_renderer) {
@@ -30,6 +30,7 @@
#include "client/client.h"
#include <map>
+#include <memory>
#include <string>
#include "base/logging.h"
@@ -220,8 +221,8 @@ class ClientTest : public testing::Test {
return client_->EnsureConnection();
}
- scoped_ptr<IPCClientFactoryMock> client_factory_;
- scoped_ptr<Client> client_;
+ std::unique_ptr<IPCClientFactoryMock> client_factory_;
+ std::unique_ptr<Client> client_;
TestServerLauncher *server_launcher_;
int version_diff_;
@@ -771,9 +772,9 @@ class SessionPlaybackTest : public testing::Test {
ipc_client_factory_->SetMockResponse(response);
}
- scoped_ptr<IPCClientFactoryMock> ipc_client_factory_;
- scoped_ptr<IPCClientMock> ipc_client_;
- scoped_ptr<Client> client_;
+ std::unique_ptr<IPCClientFactoryMock> ipc_client_factory_;
+ std::unique_ptr<IPCClientMock> ipc_client_;
+ std::unique_ptr<Client> client_;
SessionPlaybackTestServerLauncher *server_launcher_;
private:
@@ -32,13 +32,13 @@
#ifndef MOZC_COMPOSER_COMPOSER_H_
#define MOZC_COMPOSER_COMPOSER_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/port.h"
#include "base/protobuf/repeated_field.h"
-#include "base/scoped_ptr.h"
#include "composer/internal/typing_corrector.h"
#include "composer/internal/transliterators.h"
#include "composer/type_corrected_query.h"
@@ -260,7 +260,7 @@ class Composer {
commands::Context::InputFieldType input_field_type_;
size_t shifted_sequence_count_;
- scoped_ptr<CompositionInterface> composition_;
+ std::unique_ptr<CompositionInterface> composition_;
TypingCorrector typing_corrector_;
@@ -30,10 +30,10 @@
#include "composer/composer.h"
#include <iostream> // NOLINT
+#include <memory>
#include <string>
#include "base/flags.h"
-#include "base/scoped_ptr.h"
#include "composer/composition_interface.h"
#include "composer/table.h"
#include "protocol/commands.pb.h"
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
mozc::composer::Table table;
table.LoadFromFile(FLAGS_table.c_str());
- scoped_ptr<mozc::composer::Composer> composer(
+ std::unique_ptr<mozc::composer::Composer> composer(
new mozc::composer::Composer(&table, &Request::default_instance()));
string command;
@@ -29,6 +29,7 @@
#include "composer/composer.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -148,9 +149,9 @@ class ComposerTest : public testing::Test {
ConfigHandler::SetConfig(config);
}
- scoped_ptr<Composer> composer_;
- scoped_ptr<Table> table_;
- scoped_ptr<Request> default_request_;
+ std::unique_ptr<Composer> composer_;
+ std::unique_ptr<Table> table_;
+ std::unique_ptr<Request> default_request_;
private:
DISALLOW_COPY_AND_ASSIGN(ComposerTest);
@@ -3341,9 +3342,9 @@ class TypingCorrectionTest : public ::testing::Test {
return queries.empty();
}
- scoped_ptr<Request> request_;
- scoped_ptr<Composer> composer_;
- scoped_ptr<Table> table_;
+ std::unique_ptr<Request> request_;
+ std::unique_ptr<Composer> composer_;
+ std::unique_ptr<Table> table_;
Config config_backup_;
};
Oops, something went wrong.

0 comments on commit 1ed3119

Please sign in to comment.