Convert //components/update_client from scoped_ptr to std::unique_ptr
BUG=554298
[email protected]
Review URL: https://codereview.chromium.org/1911083002
Cr-Commit-Position: refs/heads/master@{#389160}
diff --git a/components/update_client/action.cc b/components/update_client/action.cc
index de795e6..19ff099 100644
--- a/components/update_client/action.cc
+++ b/components/update_client/action.cc
@@ -123,7 +123,7 @@
CrxUpdateItem* item = FindUpdateItemById(id);
DCHECK(item);
- scoped_ptr<Action> update_action(
+ std::unique_ptr<Action> update_action(
CanTryDiffUpdate(item, update_context_->config)
? ActionUpdateDiff::Create()
: ActionUpdateFull::Create());
@@ -147,7 +147,7 @@
// to be injected at the call site of update_client::UpdateClient::Update.
const int wait_sec = update_context_->config->UpdateDelay();
- scoped_ptr<ActionWait> action_wait(
+ std::unique_ptr<ActionWait> action_wait(
new ActionWait(base::TimeDelta::FromSeconds(wait_sec)));
base::ThreadTaskRunnerHandle::Get()->PostTask(
diff --git a/components/update_client/action_update.cc b/components/update_client/action_update.cc
index c8045a2..f10aefb 100644
--- a/components/update_client/action_update.cc
+++ b/components/update_client/action_update.cc
@@ -185,13 +185,13 @@
DCHECK(thread_checker_.CalledOnValidThread());
}
-scoped_ptr<Action> ActionUpdateDiff::Create() {
- return scoped_ptr<Action>(new ActionUpdateDiff);
+std::unique_ptr<Action> ActionUpdateDiff::Create() {
+ return std::unique_ptr<Action>(new ActionUpdateDiff);
}
void ActionUpdateDiff::TryUpdateFull() {
DCHECK(thread_checker_.CalledOnValidThread());
- scoped_ptr<Action> update_action(ActionUpdateFull::Create());
+ std::unique_ptr<Action> update_action(ActionUpdateFull::Create());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&Action::Run, base::Unretained(update_action.get()),
@@ -286,8 +286,8 @@
DCHECK(thread_checker_.CalledOnValidThread());
}
-scoped_ptr<Action> ActionUpdateFull::Create() {
- return scoped_ptr<Action>(new ActionUpdateFull);
+std::unique_ptr<Action> ActionUpdateFull::Create() {
+ return std::unique_ptr<Action>(new ActionUpdateFull);
}
bool ActionUpdateFull::IsBackgroundDownload(const CrxUpdateItem* item) {
diff --git a/components/update_client/action_update.h b/components/update_client/action_update.h
index b65ca645..d9e789a 100644
--- a/components/update_client/action_update.h
+++ b/components/update_client/action_update.h
@@ -6,11 +6,11 @@
#define COMPONENTS_UPDATE_CLIENT_ACTION_UPDATE_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/version.h"
#include "components/update_client/action.h"
@@ -85,7 +85,7 @@
int extended_error);
// Downloads updates for one CRX id only.
- scoped_ptr<CrxDownloader> crx_downloader_;
+ std::unique_ptr<CrxDownloader> crx_downloader_;
// Unpacks one CRX.
scoped_refptr<ComponentUnpacker> unpacker_;
@@ -95,7 +95,7 @@
class ActionUpdateDiff : public ActionUpdate {
public:
- static scoped_ptr<Action> Create();
+ static std::unique_ptr<Action> Create();
private:
ActionUpdateDiff();
@@ -123,7 +123,7 @@
class ActionUpdateFull : public ActionUpdate {
public:
- static scoped_ptr<Action> Create();
+ static std::unique_ptr<Action> Create();
private:
ActionUpdateFull();
diff --git a/components/update_client/action_update_check.cc b/components/update_client/action_update_check.cc
index 13455f5..9883524 100644
--- a/components/update_client/action_update_check.cc
+++ b/components/update_client/action_update_check.cc
@@ -37,7 +37,7 @@
} // namespace
ActionUpdateCheck::ActionUpdateCheck(
- scoped_ptr<UpdateChecker> update_checker,
+ std::unique_ptr<UpdateChecker> update_checker,
const base::Version& browser_version,
const std::string& extra_request_parameters)
: update_checker_(std::move(update_checker)),
@@ -61,7 +61,7 @@
update_context_->update_items.reserve(crx_components.size());
for (size_t i = 0; i != crx_components.size(); ++i) {
- scoped_ptr<CrxUpdateItem> item(new CrxUpdateItem);
+ std::unique_ptr<CrxUpdateItem> item(new CrxUpdateItem);
const CrxComponent& crx_component = crx_components[i];
item->id = GetCrxComponentID(crx_component);
diff --git a/components/update_client/action_update_check.h b/components/update_client/action_update_check.h
index 67fc4d1..726f076ba 100644
--- a/components/update_client/action_update_check.h
+++ b/components/update_client/action_update_check.h
@@ -6,11 +6,11 @@
#define COMPONENTS_UPDATE_CLIENT_ACTION_UPDATE_CHECK_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/version.h"
#include "components/update_client/action.h"
@@ -27,7 +27,7 @@
// Implements an update check for the CRXs in an update context.
class ActionUpdateCheck : public Action, private ActionImpl {
public:
- ActionUpdateCheck(scoped_ptr<UpdateChecker> update_checker,
+ ActionUpdateCheck(std::unique_ptr<UpdateChecker> update_checker,
const base::Version& browser_version,
const std::string& extra_request_parameters);
@@ -43,7 +43,7 @@
void OnUpdateCheckSucceeded(const UpdateResponse::Results& results);
void OnUpdateCheckFailed(int error);
- scoped_ptr<UpdateChecker> update_checker_;
+ std::unique_ptr<UpdateChecker> update_checker_;
const base::Version browser_version_;
const std::string extra_request_parameters_;
diff --git a/components/update_client/background_downloader_win.cc b/components/update_client/background_downloader_win.cc
index ea0b0ab..20d75c3 100644
--- a/components/update_client/background_downloader_win.cc
+++ b/components/update_client/background_downloader_win.cc
@@ -418,7 +418,7 @@
} // namespace
BackgroundDownloader::BackgroundDownloader(
- scoped_ptr<CrxDownloader> successor,
+ std::unique_ptr<CrxDownloader> successor,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: CrxDownloader(task_runner, std::move(successor)),
diff --git a/components/update_client/background_downloader_win.h b/components/update_client/background_downloader_win.h
index f0d5ecd..243461e 100644
--- a/components/update_client/background_downloader_win.h
+++ b/components/update_client/background_downloader_win.h
@@ -39,7 +39,7 @@
protected:
friend class CrxDownloader;
BackgroundDownloader(
- scoped_ptr<CrxDownloader> successor,
+ std::unique_ptr<CrxDownloader> successor,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner);
~BackgroundDownloader() override;
@@ -122,7 +122,7 @@
// The timer has thread affinity. This member is initialized and destroyed
// on the main task runner.
- scoped_ptr<base::OneShotTimer> timer_;
+ std::unique_ptr<base::OneShotTimer> timer_;
DWORD git_cookie_bits_manager_;
DWORD git_cookie_job_;
diff --git a/components/update_client/component_patcher.cc b/components/update_client/component_patcher.cc
index 9105fda0..7ceedce 100644
--- a/components/update_client/component_patcher.cc
+++ b/components/update_client/component_patcher.cc
@@ -31,7 +31,7 @@
return NULL;
JSONFileValueDeserializer deserializer(commands);
- scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL);
+ std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL);
return (root.get() && root->IsType(base::Value::TYPE_LIST))
? static_cast<base::ListValue*>(root.release())
diff --git a/components/update_client/component_patcher.h b/components/update_client/component_patcher.h
index 23c16c8f..0d11ad2 100644
--- a/components/update_client/component_patcher.h
+++ b/components/update_client/component_patcher.h
@@ -27,10 +27,11 @@
#ifndef COMPONENTS_UPDATE_CLIENT_COMPONENT_PATCHER_H_
#define COMPONENTS_UPDATE_CLIENT_COMPONENT_PATCHER_H_
+#include <memory>
+
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/update_client/component_unpacker.h"
@@ -89,7 +90,7 @@
scoped_refptr<CrxInstaller> installer_;
scoped_refptr<OutOfProcessPatcher> out_of_process_patcher_;
ComponentUnpacker::Callback callback_;
- scoped_ptr<base::ListValue> commands_;
+ std::unique_ptr<base::ListValue> commands_;
base::ValueVector::const_iterator next_command_;
scoped_refptr<DeltaUpdateOp> current_operation_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
diff --git a/components/update_client/component_patcher_unittest.cc b/components/update_client/component_patcher_unittest.cc
index d7ce117..074e4a23 100644
--- a/components/update_client/component_patcher_unittest.cc
+++ b/components/update_client/component_patcher_unittest.cc
@@ -81,7 +81,8 @@
test_file("binary_output.bin"),
input_dir_.path().Append(FILE_PATH_LITERAL("binary_output.bin"))));
- scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> command_args(
+ new base::DictionaryValue());
command_args->SetString("output", "output.bin");
command_args->SetString("sha256", binary_output_hash);
command_args->SetString("op", "create");
@@ -108,7 +109,8 @@
test_file("binary_output.bin"),
installed_dir_.path().Append(FILE_PATH_LITERAL("binary_output.bin"))));
- scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> command_args(
+ new base::DictionaryValue());
command_args->SetString("output", "output.bin");
command_args->SetString("sha256", binary_output_hash);
command_args->SetString("op", "copy");
@@ -139,7 +141,8 @@
input_dir_.path().Append(FILE_PATH_LITERAL(
"binary_courgette_patch.bin"))));
- scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> command_args(
+ new base::DictionaryValue());
command_args->SetString("output", "output.bin");
command_args->SetString("sha256", binary_output_hash);
command_args->SetString("op", "courgette");
@@ -172,7 +175,8 @@
test_file("binary_bsdiff_patch.bin"),
input_dir_.path().Append(FILE_PATH_LITERAL("binary_bsdiff_patch.bin"))));
- scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> command_args(
+ new base::DictionaryValue());
command_args->SetString("output", "output.bin");
command_args->SetString("sha256", binary_output_hash);
command_args->SetString("op", "courgette");
diff --git a/components/update_client/component_patcher_unittest.h b/components/update_client/component_patcher_unittest.h
index 8b3a797..a3b70f2 100644
--- a/components/update_client/component_patcher_unittest.h
+++ b/components/update_client/component_patcher_unittest.h
@@ -5,9 +5,10 @@
#ifndef COMPONENTS_UPDATE_CLIENT_COMPONENT_PATCHER_UNITTEST_H_
#define COMPONENTS_UPDATE_CLIENT_COMPONENT_PATCHER_UNITTEST_H_
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "courgette/courgette.h"
#include "courgette/third_party/bsdiff.h"
diff --git a/components/update_client/component_unpacker.cc b/components/update_client/component_unpacker.cc
index 91c9b77..dc21319 100644
--- a/components/update_client/component_unpacker.cc
+++ b/components/update_client/component_unpacker.cc
@@ -55,20 +55,20 @@
// TODO(cpu): add a specific attribute check to a component json that the
// extension unpacker will reject, so that a component cannot be installed
// as an extension.
-scoped_ptr<base::DictionaryValue> ReadManifest(
+std::unique_ptr<base::DictionaryValue> ReadManifest(
const base::FilePath& unpack_path) {
base::FilePath manifest =
unpack_path.Append(FILE_PATH_LITERAL("manifest.json"));
if (!base::PathExists(manifest))
- return scoped_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>();
JSONFileValueDeserializer deserializer(manifest);
std::string error;
- scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error);
+ std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error);
if (!root.get())
- return scoped_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>();
if (!root->IsType(base::Value::TYPE_DICTIONARY))
- return scoped_ptr<base::DictionaryValue>();
- return scoped_ptr<base::DictionaryValue>(
+ return std::unique_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>(
static_cast<base::DictionaryValue*>(root.release()));
}
@@ -106,7 +106,7 @@
// the public key hash matches the expected hash. If they do we fully
// trust this CRX.
uint8_t hash[crypto::kSHA256Length] = {};
- scoped_ptr<SecureHash> sha256(SecureHash::Create(SecureHash::SHA256));
+ std::unique_ptr<SecureHash> sha256(SecureHash::Create(SecureHash::SHA256));
sha256->Update(public_key_bytes.data(), public_key_bytes.size());
sha256->Finish(hash, arraysize(hash));
@@ -188,7 +188,7 @@
error_ = kFingerprintWriteFailed;
return;
}
- scoped_ptr<base::DictionaryValue> manifest(ReadManifest(unpack_path_));
+ std::unique_ptr<base::DictionaryValue> manifest(ReadManifest(unpack_path_));
if (!manifest.get()) {
error_ = kBadManifest;
return;
diff --git a/components/update_client/component_unpacker.h b/components/update_client/component_unpacker.h
index c1c6c9e..66a44d3 100644
--- a/components/update_client/component_unpacker.h
+++ b/components/update_client/component_unpacker.h
@@ -6,6 +6,8 @@
#define COMPONENTS_UPDATE_CLIENT_COMPONENT_UNPACKER_H_
#include <stdint.h>
+
+#include <memory>
#include <string>
#include <vector>
@@ -14,7 +16,6 @@
#include "base/json/json_file_value_serializer.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
namespace update_client {
@@ -24,7 +25,7 @@
class OutOfProcessPatcher;
// Deserializes the CRX manifest. The top level must be a dictionary.
-scoped_ptr<base::DictionaryValue> ReadManifest(
+std::unique_ptr<base::DictionaryValue> ReadManifest(
const base::FilePath& unpack_path);
// In charge of unpacking the component CRX package and verifying that it is
diff --git a/components/update_client/configurator.h b/components/update_client/configurator.h
index 63745c03..7f55b9b7 100644
--- a/components/update_client/configurator.h
+++ b/components/update_client/configurator.h
@@ -5,11 +5,11 @@
#ifndef COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_
#define COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
class GURL;
class PrefService;
diff --git a/components/update_client/crx_downloader.cc b/components/update_client/crx_downloader.cc
index 352a539..f77eadba 100644
--- a/components/update_client/crx_downloader.cc
+++ b/components/update_client/crx_downloader.cc
@@ -36,16 +36,16 @@
// On Windows, the first downloader in the chain is a background downloader,
// which uses the BITS service.
-scoped_ptr<CrxDownloader> CrxDownloader::Create(
+std::unique_ptr<CrxDownloader> CrxDownloader::Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- scoped_ptr<CrxDownloader> url_fetcher_downloader(
- scoped_ptr<CrxDownloader>(new UrlFetcherDownloader(
- scoped_ptr<CrxDownloader>(), context_getter, task_runner)));
+ std::unique_ptr<CrxDownloader> url_fetcher_downloader(
+ std::unique_ptr<CrxDownloader>(new UrlFetcherDownloader(
+ std::unique_ptr<CrxDownloader>(), context_getter, task_runner)));
#if defined(OS_WIN)
if (is_background_download) {
- return scoped_ptr<CrxDownloader>(new BackgroundDownloader(
+ return std::unique_ptr<CrxDownloader>(new BackgroundDownloader(
std::move(url_fetcher_downloader), context_getter, task_runner));
}
#endif
@@ -55,7 +55,7 @@
CrxDownloader::CrxDownloader(
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- scoped_ptr<CrxDownloader> successor)
+ std::unique_ptr<CrxDownloader> successor)
: task_runner_(task_runner),
main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
successor_(std::move(successor)) {}
diff --git a/components/update_client/crx_downloader.h b/components/update_client/crx_downloader.h
index f7caa8bf..5d5537d 100644
--- a/components/update_client/crx_downloader.h
+++ b/components/update_client/crx_downloader.h
@@ -6,6 +6,8 @@
#define COMPONENTS_UPDATE_CLIENT_CRX_DOWNLOADER_H_
#include <stdint.h>
+
+#include <memory>
#include <string>
#include <vector>
@@ -13,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/thread_checker.h"
#include "url/gurl.h"
@@ -96,7 +97,7 @@
// bytes is not guaranteed to monotonically increment over time.
using ProgressCallback = base::Callback<void(const Result& result)>;
- using Factory = scoped_ptr<CrxDownloader> (*)(
+ using Factory = std::unique_ptr<CrxDownloader> (*)(
bool,
net::URLRequestContextGetter*,
const scoped_refptr<base::SequencedTaskRunner>&);
@@ -106,7 +107,7 @@
// background downloader be used, if the platform supports it.
// |task_runner| should be a task runner able to run blocking
// code such as file IO operations.
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner);
@@ -130,7 +131,7 @@
protected:
CrxDownloader(const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- scoped_ptr<CrxDownloader> successor);
+ std::unique_ptr<CrxDownloader> successor);
// Handles the fallback in the case of multiple urls and routing of the
// download to the following successor in the chain. Derived classes must call
@@ -181,7 +182,7 @@
// The SHA256 hash of the download payload in hexadecimal format.
std::string expected_hash_;
- scoped_ptr<CrxDownloader> successor_;
+ std::unique_ptr<CrxDownloader> successor_;
DownloadCallback download_callback_;
ProgressCallback progress_callback_;
diff --git a/components/update_client/crx_downloader_unittest.cc b/components/update_client/crx_downloader_unittest.cc
index 7b1a184..a0560fd1 100644
--- a/components/update_client/crx_downloader_unittest.cc
+++ b/components/update_client/crx_downloader_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/update_client/crx_downloader.h"
+
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
-#include "components/update_client/crx_downloader.h"
#include "net/base/net_errors.h"
#include "net/url_request/test_url_request_interceptor.h"
#include "net/url_request/url_request_test_util.h"
@@ -59,9 +61,9 @@
void DownloadProgress(int crx_context, const CrxDownloader::Result& result);
protected:
- scoped_ptr<CrxDownloader> crx_downloader_;
+ std::unique_ptr<CrxDownloader> crx_downloader_;
- scoped_ptr<GetInterceptor> get_interceptor_;
+ std::unique_ptr<GetInterceptor> get_interceptor_;
CrxDownloader::DownloadCallback callback_;
CrxDownloader::ProgressCallback progress_callback_;
diff --git a/components/update_client/ping_manager.cc b/components/update_client/ping_manager.cc
index 2d665933..59ee875 100644
--- a/components/update_client/ping_manager.cc
+++ b/components/update_client/ping_manager.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -184,7 +184,7 @@
int retry_after_sec);
const scoped_refptr<Configurator> config_;
- scoped_ptr<RequestSender> request_sender_;
+ std::unique_ptr<RequestSender> request_sender_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(PingSender);
@@ -231,7 +231,7 @@
}
bool PingManager::SendPing(const CrxUpdateItem* item) {
- scoped_ptr<PingSender> ping_sender(new PingSender(config_));
+ std::unique_ptr<PingSender> ping_sender(new PingSender(config_));
if (!ping_sender->SendPing(item))
return false;
diff --git a/components/update_client/ping_manager_unittest.cc b/components/update_client/ping_manager_unittest.cc
index e25dc94..f78349a 100644
--- a/components/update_client/ping_manager_unittest.cc
+++ b/components/update_client/ping_manager_unittest.cc
@@ -2,15 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/update_client/ping_manager.h"
+
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
#include "base/version.h"
#include "components/update_client/crx_update_item.h"
-#include "components/update_client/ping_manager.h"
#include "components/update_client/test_configurator.h"
#include "components/update_client/url_request_post_interceptor.h"
#include "net/url_request/url_request_test_util.h"
@@ -33,7 +34,7 @@
protected:
scoped_refptr<TestConfigurator> config_;
- scoped_ptr<PingManager> ping_manager_;
+ std::unique_ptr<PingManager> ping_manager_;
private:
base::MessageLoopForIO loop_;
@@ -59,7 +60,7 @@
// Test is flaky: http://crbug.com/349547
TEST_F(ComponentUpdaterPingManagerTest, DISABLED_PingManagerTest) {
- scoped_ptr<InterceptorFactory> interceptor_factory(
+ std::unique_ptr<InterceptorFactory> interceptor_factory(
new InterceptorFactory(base::ThreadTaskRunnerHandle::Get()));
URLRequestPostInterceptor* interceptor =
interceptor_factory->CreateInterceptor();
diff --git a/components/update_client/request_sender.h b/components/update_client/request_sender.h
index b5daaa2e..f1ec16e 100644
--- a/components/update_client/request_sender.h
+++ b/components/update_client/request_sender.h
@@ -7,13 +7,13 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
@@ -100,8 +100,8 @@
std::string public_key_;
std::vector<GURL>::const_iterator cur_url_;
- scoped_ptr<net::URLFetcher> url_fetcher_;
- scoped_ptr<client_update_protocol::Ecdsa> signer_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<client_update_protocol::Ecdsa> signer_;
DISALLOW_COPY_AND_ASSIGN(RequestSender);
};
diff --git a/components/update_client/request_sender_unittest.cc b/components/update_client/request_sender_unittest.cc
index 5582132..a7c5550 100644
--- a/components/update_client/request_sender_unittest.cc
+++ b/components/update_client/request_sender_unittest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/update_client/request_sender.h"
+
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
-#include "components/update_client/request_sender.h"
#include "components/update_client/test_configurator.h"
#include "components/update_client/url_request_post_interceptor.h"
#include "net/url_request/url_fetcher.h"
@@ -55,8 +57,8 @@
void RunThreadsUntilIdle();
scoped_refptr<TestConfigurator> config_;
- scoped_ptr<RequestSender> request_sender_;
- scoped_ptr<InterceptorFactory> interceptor_factory_;
+ std::unique_ptr<RequestSender> request_sender_;
+ std::unique_ptr<InterceptorFactory> interceptor_factory_;
URLRequestPostInterceptor* post_interceptor_1_; // Owned by the factory.
URLRequestPostInterceptor* post_interceptor_2_; // Owned by the factory.
diff --git a/components/update_client/task.h b/components/update_client/task.h
index 0a5b7f3..929ae7e8 100644
--- a/components/update_client/task.h
+++ b/components/update_client/task.h
@@ -5,11 +5,11 @@
#ifndef COMPONENTS_UPDATE_CLIENT_TASK_H_
#define COMPONENTS_UPDATE_CLIENT_TASK_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
#include "components/update_client/update_client.h"
namespace update_client {
diff --git a/components/update_client/update_checker.cc b/components/update_client/update_checker.cc
index 7f40a0c..102d659 100644
--- a/components/update_client/update_checker.cc
+++ b/components/update_client/update_checker.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
@@ -116,16 +116,17 @@
const UpdateCheckCallback& update_check_callback) override;
private:
- void OnRequestSenderComplete(scoped_ptr<std::vector<std::string>> ids_checked,
- int error,
- const std::string& response,
- int retry_after_sec);
+ void OnRequestSenderComplete(
+ std::unique_ptr<std::vector<std::string>> ids_checked,
+ int error,
+ const std::string& response,
+ int retry_after_sec);
base::ThreadChecker thread_checker_;
const scoped_refptr<Configurator> config_;
PersistedData* metadata_;
UpdateCheckCallback update_check_callback_;
- scoped_ptr<RequestSender> request_sender_;
+ std::unique_ptr<RequestSender> request_sender_;
DISALLOW_COPY_AND_ASSIGN(UpdateCheckerImpl);
};
@@ -199,10 +200,11 @@
} // namespace
-scoped_ptr<UpdateChecker> UpdateChecker::Create(
+std::unique_ptr<UpdateChecker> UpdateChecker::Create(
const scoped_refptr<Configurator>& config,
PersistedData* persistent) {
- return scoped_ptr<UpdateChecker>(new UpdateCheckerImpl(config, persistent));
+ return std::unique_ptr<UpdateChecker>(
+ new UpdateCheckerImpl(config, persistent));
}
} // namespace update_client
diff --git a/components/update_client/update_checker.h b/components/update_client/update_checker.h
index 2af7e7a0..2705018 100644
--- a/components/update_client/update_checker.h
+++ b/components/update_client/update_checker.h
@@ -5,13 +5,13 @@
#ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_
#define COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/update_client/update_response.h"
#include "url/gurl.h"
@@ -30,9 +30,9 @@
const UpdateResponse::Results& results,
int retry_after_sec)>;
- using Factory =
- scoped_ptr<UpdateChecker> (*)(const scoped_refptr<Configurator>& config,
- PersistedData* persistent);
+ using Factory = std::unique_ptr<UpdateChecker> (*)(
+ const scoped_refptr<Configurator>& config,
+ PersistedData* persistent);
virtual ~UpdateChecker() {}
@@ -44,7 +44,7 @@
const std::string& additional_attributes,
const UpdateCheckCallback& update_check_callback) = 0;
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* persistent);
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc
index 7fd0972..cb170839a 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/update_client/update_checker.h"
+
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
@@ -16,7 +19,6 @@
#include "components/update_client/crx_update_item.h"
#include "components/update_client/persisted_data.h"
#include "components/update_client/test_configurator.h"
-#include "components/update_client/update_checker.h"
#include "components/update_client/url_request_post_interceptor.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -64,9 +66,9 @@
std::unique_ptr<TestingPrefServiceSimple> pref_;
std::unique_ptr<PersistedData> metadata_;
- scoped_ptr<UpdateChecker> update_checker_;
+ std::unique_ptr<UpdateChecker> update_checker_;
- scoped_ptr<InterceptorFactory> interceptor_factory_;
+ std::unique_ptr<InterceptorFactory> interceptor_factory_;
URLRequestPostInterceptor* post_interceptor_; // Owned by the factory.
int error_;
diff --git a/components/update_client/update_client.cc b/components/update_client/update_client.cc
index 8e1fdf2..f23c17a 100644
--- a/components/update_client/update_client.cc
+++ b/components/update_client/update_client.cc
@@ -70,7 +70,7 @@
// including any thread objects that might execute callbacks bound to it.
UpdateClientImpl::UpdateClientImpl(
const scoped_refptr<Configurator>& config,
- scoped_ptr<PingManager> ping_manager,
+ std::unique_ptr<PingManager> ping_manager,
UpdateChecker::Factory update_checker_factory,
CrxDownloader::Factory crx_downloader_factory)
: is_stopped_(false),
@@ -110,8 +110,8 @@
// argument is available when the task completes, along with the task itself.
const auto callback =
base::Bind(&UpdateClientImpl::OnTaskComplete, this, completion_callback);
- scoped_ptr<TaskUpdate> task(new TaskUpdate(update_engine_.get(), true, ids,
- crx_data_callback, callback));
+ std::unique_ptr<TaskUpdate> task(new TaskUpdate(
+ update_engine_.get(), true, ids, crx_data_callback, callback));
// Install tasks are run concurrently and never queued up.
RunTask(std::move(task));
@@ -124,8 +124,8 @@
const auto callback =
base::Bind(&UpdateClientImpl::OnTaskComplete, this, completion_callback);
- scoped_ptr<TaskUpdate> task(new TaskUpdate(update_engine_.get(), false, ids,
- crx_data_callback, callback));
+ std::unique_ptr<TaskUpdate> task(new TaskUpdate(
+ update_engine_.get(), false, ids, crx_data_callback, callback));
// If no other tasks are running at the moment, run this update task.
// Otherwise, queue the task up.
@@ -136,7 +136,7 @@
}
}
-void UpdateClientImpl::RunTask(scoped_ptr<Task> task) {
+void UpdateClientImpl::RunTask(std::unique_ptr<Task> task) {
DCHECK(thread_checker_.CalledOnValidThread());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&Task::Run, base::Unretained(task.get())));
@@ -167,7 +167,7 @@
// Pick up a task from the queue if the queue has pending tasks and no other
// task is running.
if (tasks_.empty() && !task_queue_.empty()) {
- RunTask(scoped_ptr<Task>(task_queue_.front()));
+ RunTask(std::unique_ptr<Task>(task_queue_.front()));
task_queue_.pop();
}
}
@@ -250,7 +250,7 @@
scoped_refptr<UpdateClient> UpdateClientFactory(
const scoped_refptr<Configurator>& config) {
- scoped_ptr<PingManager> ping_manager(new PingManager(config));
+ std::unique_ptr<PingManager> ping_manager(new PingManager(config));
return new UpdateClientImpl(config, std::move(ping_manager),
&UpdateChecker::Create, &CrxDownloader::Create);
}
diff --git a/components/update_client/update_client.h b/components/update_client/update_client.h
index 16df41c9..0c0e42d 100644
--- a/components/update_client/update_client.h
+++ b/components/update_client/update_client.h
@@ -6,12 +6,13 @@
#define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_
#include <stdint.h>
+
+#include <memory>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/version.h"
// The UpdateClient class is a facade with a simple interface. The interface
@@ -48,7 +49,7 @@
// of this code has already implemented the observer interface as needed, and
// can provide an installer, as described below.
//
-// scoped_ptr<UpdateClient> update_client(UpdateClientFactory(...));
+// std::unique_ptr<UpdateClient> update_client(UpdateClientFactory(...));
// update_client->AddObserver(&observer);
// std::vector<std::string> ids;
// ids.push_back(...));
diff --git a/components/update_client/update_client_internal.h b/components/update_client/update_client_internal.h
index 6df2b99..47e9af61 100644
--- a/components/update_client/update_client_internal.h
+++ b/components/update_client/update_client_internal.h
@@ -5,8 +5,7 @@
#ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
#define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
-#include "components/update_client/update_client.h"
-
+#include <memory>
#include <queue>
#include <set>
#include <string>
@@ -14,11 +13,11 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "components/update_client/crx_downloader.h"
#include "components/update_client/update_checker.h"
+#include "components/update_client/update_client.h"
namespace base {
class SequencedTaskRunner;
@@ -36,7 +35,7 @@
class UpdateClientImpl : public UpdateClient {
public:
UpdateClientImpl(const scoped_refptr<Configurator>& config,
- scoped_ptr<PingManager> ping_manager,
+ std::unique_ptr<PingManager> ping_manager,
UpdateChecker::Factory update_checker_factory,
CrxDownloader::Factory crx_downloader_factory);
@@ -60,7 +59,7 @@
private:
~UpdateClientImpl() override;
- void RunTask(scoped_ptr<Task> task);
+ void RunTask(std::unique_ptr<Task> task);
void OnTaskComplete(const CompletionCallback& completion_callback,
Task* task,
int error);
@@ -88,8 +87,8 @@
std::set<Task*> tasks_;
// TODO(sorin): try to make the ping manager an observer of the service.
- scoped_ptr<PingManager> ping_manager_;
- scoped_ptr<UpdateEngine> update_engine_;
+ std::unique_ptr<PingManager> ping_manager_;
+ std::unique_ptr<UpdateEngine> update_engine_;
base::ObserverList<Observer> observer_list_;
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc
index 1bdfa2f1..e5bbfb7 100644
--- a/components/update_client/update_client_unittest.cc
+++ b/components/update_client/update_client_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -10,8 +11,8 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
@@ -159,7 +160,7 @@
base::RunLoop runloop_;
base::Closure quit_closure_;
- scoped_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
+ std::unique_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
scoped_refptr<update_client::Configurator> config_;
std::unique_ptr<TestingPrefServiceSimple> pref_;
@@ -225,10 +226,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -244,11 +245,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -266,7 +267,7 @@
~FakePingManager() override { EXPECT_TRUE(items().empty()); }
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -332,10 +333,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -386,11 +387,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -443,7 +444,7 @@
}
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -518,10 +519,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -599,11 +600,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -681,7 +682,7 @@
}
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -766,10 +767,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -847,11 +848,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -929,7 +930,7 @@
}
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -1017,10 +1018,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -1120,11 +1121,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -1202,7 +1203,7 @@
}
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -1309,10 +1310,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -1362,11 +1363,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -1419,7 +1420,7 @@
}
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -1493,10 +1494,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -1596,11 +1597,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -1694,7 +1695,7 @@
}
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -1783,10 +1784,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -1802,11 +1803,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -1824,7 +1825,7 @@
~FakePingManager() override { EXPECT_TRUE(items().empty()); }
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -1883,10 +1884,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -1936,11 +1937,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -1997,7 +1998,7 @@
}
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -2070,10 +2071,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -2089,11 +2090,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -2111,7 +2112,7 @@
~FakePingManager() override { EXPECT_TRUE(items().empty()); }
};
- scoped_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<FakePingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -2164,10 +2165,10 @@
};
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -2180,11 +2181,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -2196,7 +2197,7 @@
};
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
- config(), make_scoped_ptr(new FakePingManagerImpl(config())),
+ config(), base::WrapUnique(new FakePingManagerImpl(config())),
&FakeUpdateChecker::Create, &FakeCrxDownloader::Create));
std::vector<std::string> empty_id_list;
@@ -2210,7 +2211,7 @@
TEST_F(UpdateClientTest, SendUninstallPing) {
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
return nullptr;
@@ -2226,7 +2227,7 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
@@ -2255,7 +2256,7 @@
}
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
@@ -2308,10 +2309,10 @@
class FakeUpdateChecker : public UpdateChecker {
public:
- static scoped_ptr<UpdateChecker> Create(
+ static std::unique_ptr<UpdateChecker> Create(
const scoped_refptr<Configurator>& config,
PersistedData* metadata) {
- return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
+ return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker());
}
bool CheckForUpdates(
@@ -2338,11 +2339,11 @@
class FakeCrxDownloader : public CrxDownloader {
public:
- static scoped_ptr<CrxDownloader> Create(
+ static std::unique_ptr<CrxDownloader> Create(
bool is_background_download,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- return scoped_ptr<CrxDownloader>(new FakeCrxDownloader());
+ return std::unique_ptr<CrxDownloader>(new FakeCrxDownloader());
}
private:
@@ -2360,7 +2361,7 @@
~FakePingManager() override { EXPECT_TRUE(items().empty()); }
};
- scoped_ptr<PingManager> ping_manager(new FakePingManager(config()));
+ std::unique_ptr<PingManager> ping_manager(new FakePingManager(config()));
scoped_refptr<UpdateClient> update_client(new UpdateClientImpl(
config(), std::move(ping_manager), &FakeUpdateChecker::Create,
&FakeCrxDownloader::Create));
diff --git a/components/update_client/update_engine.cc b/components/update_client/update_engine.cc
index b9959a23..b4a2515 100644
--- a/components/update_client/update_engine.cc
+++ b/components/update_client/update_engine.cc
@@ -93,13 +93,13 @@
return;
}
- scoped_ptr<UpdateContext> update_context(new UpdateContext(
+ std::unique_ptr<UpdateContext> update_context(new UpdateContext(
config_, is_foreground, ids, crx_data_callback,
notify_observers_callback_, callback, update_checker_factory_,
crx_downloader_factory_, ping_manager_));
CrxUpdateItem update_item;
- scoped_ptr<ActionUpdateCheck> update_check_action(new ActionUpdateCheck(
+ std::unique_ptr<ActionUpdateCheck> update_check_action(new ActionUpdateCheck(
(*update_context->update_checker_factory)(config_, metadata_.get()),
config_->GetBrowserVersion(), config_->ExtraRequestParams()));
diff --git a/components/update_client/update_engine.h b/components/update_client/update_engine.h
index 33e5f2e..a82864c 100644
--- a/components/update_client/update_engine.h
+++ b/components/update_client/update_engine.h
@@ -6,6 +6,7 @@
#define COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_
#include <list>
+#include <memory>
#include <queue>
#include <set>
#include <string>
@@ -14,7 +15,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "components/update_client/action.h"
#include "components/update_client/component_patcher_operation.h"
@@ -140,7 +140,7 @@
PingManager* ping_manager; // Not owned by this class.
- scoped_ptr<Action> current_action;
+ std::unique_ptr<Action> current_action;
// TODO(sorin): use a map instead of vector.
std::vector<CrxUpdateItem*> update_items;
diff --git a/components/update_client/update_response.cc b/components/update_client/update_response.cc
index 3d8d14d5..e89a774 100644
--- a/components/update_client/update_response.cc
+++ b/components/update_client/update_response.cc
@@ -7,8 +7,8 @@
#include <stddef.h>
#include <algorithm>
+#include <memory>
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
diff --git a/components/update_client/url_fetcher_downloader.cc b/components/update_client/url_fetcher_downloader.cc
index 3a47c88..6a74d88 100644
--- a/components/update_client/url_fetcher_downloader.cc
+++ b/components/update_client/url_fetcher_downloader.cc
@@ -20,7 +20,7 @@
namespace update_client {
UrlFetcherDownloader::UrlFetcherDownloader(
- scoped_ptr<CrxDownloader> successor,
+ std::unique_ptr<CrxDownloader> successor,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: CrxDownloader(task_runner, std::move(successor)),
diff --git a/components/update_client/url_fetcher_downloader.h b/components/update_client/url_fetcher_downloader.h
index e75a3016..4f2fbde 100644
--- a/components/update_client/url_fetcher_downloader.h
+++ b/components/update_client/url_fetcher_downloader.h
@@ -7,9 +7,10 @@
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "components/update_client/crx_downloader.h"
@@ -32,7 +33,7 @@
protected:
friend class CrxDownloader;
UrlFetcherDownloader(
- scoped_ptr<CrxDownloader> successor,
+ std::unique_ptr<CrxDownloader> successor,
net::URLRequestContextGetter* context_getter,
const scoped_refptr<base::SequencedTaskRunner>& task_runner);
~UrlFetcherDownloader() override;
@@ -46,7 +47,7 @@
void OnURLFetchDownloadProgress(const net::URLFetcher* source,
int64_t current,
int64_t total) override;
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
net::URLRequestContextGetter* context_getter_;
base::Time download_start_time_;
diff --git a/components/update_client/url_request_post_interceptor.cc b/components/update_client/url_request_post_interceptor.cc
index caf179a..38501606 100644
--- a/components/update_client/url_request_post_interceptor.cc
+++ b/components/update_client/url_request_post_interceptor.cc
@@ -4,9 +4,10 @@
#include "components/update_client/url_request_post_interceptor.h"
+#include <memory>
+
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "components/update_client/test_configurator.h"
#include "net/base/upload_bytes_element_reader.h"
@@ -147,7 +148,7 @@
void Register() {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
- scheme_, hostname_, scoped_ptr<net::URLRequestInterceptor>(this));
+ scheme_, hostname_, std::unique_ptr<net::URLRequestInterceptor>(this));
}
void Unregister() {
diff --git a/components/update_client/utils.cc b/components/update_client/utils.cc
index 236c270..90bbc119 100644
--- a/components/update_client/utils.cc
+++ b/components/update_client/utils.cc
@@ -129,12 +129,12 @@
return request;
}
-scoped_ptr<net::URLFetcher> SendProtocolRequest(
+std::unique_ptr<net::URLFetcher> SendProtocolRequest(
const GURL& url,
const std::string& protocol_request,
net::URLFetcherDelegate* url_fetcher_delegate,
net::URLRequestContextGetter* url_request_context_getter) {
- scoped_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
+ std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
0, url, net::URLFetcher::POST, url_fetcher_delegate);
if (!url_fetcher.get())
return url_fetcher;
@@ -221,7 +221,7 @@
return false;
uint8_t actual_hash[crypto::kSHA256Length] = {0};
- scoped_ptr<crypto::SecureHash> hasher(
+ std::unique_ptr<crypto::SecureHash> hasher(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
hasher->Update(mmfile.data(), mmfile.length());
hasher->Finish(actual_hash, sizeof(actual_hash));
diff --git a/components/update_client/utils.h b/components/update_client/utils.h
index ce0efea..2306cf2a 100644
--- a/components/update_client/utils.h
+++ b/components/update_client/utils.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_
#define COMPONENTS_UPDATE_CLIENT_UTILS_H_
+#include <memory>
#include <string>
#include <vector>
-#include "base/memory/scoped_ptr.h"
class GURL;
@@ -61,7 +61,7 @@
// Sends a protocol request to the the service endpoint specified by |url|.
// The body of the request is provided by |protocol_request| and it is
// expected to contain XML data. The caller owns the returned object.
-scoped_ptr<net::URLFetcher> SendProtocolRequest(
+std::unique_ptr<net::URLFetcher> SendProtocolRequest(
const GURL& url,
const std::string& protocol_request,
net::URLFetcherDelegate* url_fetcher_delegate,