Convert //components/[o-t]* from scoped_ptr to std::unique_ptr
BUG=554298
[email protected]
[email protected]
Review URL: https://codereview.chromium.org/1921923002
Cr-Commit-Position: refs/heads/master@{#389637}
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm b/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
index bb0991430..8f47b451 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
@@ -6,7 +6,8 @@
#import <UIKit/UIKit.h>
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -58,7 +59,7 @@
}
protected:
- scoped_ptr<ClipboardRecentContentIOS> clipboard_content_;
+ std::unique_ptr<ClipboardRecentContentIOS> clipboard_content_;
};
TEST_F(ClipboardRecentContentIOSTest, SchemeFiltering) {
diff --git a/components/ownership/mock_owner_key_util.cc b/components/ownership/mock_owner_key_util.cc
index e00ef1c..32ed743 100644
--- a/components/ownership/mock_owner_key_util.cc
+++ b/components/ownership/mock_owner_key_util.cc
@@ -52,7 +52,8 @@
CHECK(key.ExportPublicKey(&public_key_));
}
-void MockOwnerKeyUtil::SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key) {
+void MockOwnerKeyUtil::SetPrivateKey(
+ std::unique_ptr<crypto::RSAPrivateKey> key) {
crypto::EnsureNSSInit();
CHECK(key->ExportPublicKey(&public_key_));
diff --git a/components/ownership/mock_owner_key_util.h b/components/ownership/mock_owner_key_util.h
index 2ccd4b21..86c3798 100644
--- a/components/ownership/mock_owner_key_util.h
+++ b/components/ownership/mock_owner_key_util.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <vector>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/ownership/owner_key_util.h"
#include "components/ownership/ownership_export.h"
@@ -46,7 +46,7 @@
void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key);
// Sets the private key (also configures the public key).
- void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key);
+ void SetPrivateKey(std::unique_ptr<crypto::RSAPrivateKey> key);
private:
~MockOwnerKeyUtil() override;
diff --git a/components/ownership/owner_key_util.h b/components/ownership/owner_key_util.h
index 3a108d26..07cd1b4c 100644
--- a/components/ownership/owner_key_util.h
+++ b/components/ownership/owner_key_util.h
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/ownership/ownership_export.h"
#include "crypto/scoped_nss_types.h"
diff --git a/components/ownership/owner_settings_service.cc b/components/ownership/owner_settings_service.cc
index 4990594..e760cb5 100644
--- a/components/ownership/owner_settings_service.cc
+++ b/components/ownership/owner_settings_service.cc
@@ -25,19 +25,19 @@
namespace {
-using ScopedSGNContext =
- scoped_ptr<SGNContext,
- crypto::NSSDestroyer1<SGNContext, SGN_DestroyContext, PR_TRUE>>;
+using ScopedSGNContext = std::unique_ptr<
+ SGNContext,
+ crypto::NSSDestroyer1<SGNContext, SGN_DestroyContext, PR_TRUE>>;
-scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
- scoped_ptr<em::PolicyData> policy,
+std::unique_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
+ std::unique_ptr<em::PolicyData> policy,
SECKEYPrivateKey* private_key) {
// Assemble the policy.
- scoped_ptr<em::PolicyFetchResponse> policy_response(
+ std::unique_ptr<em::PolicyFetchResponse> policy_response(
new em::PolicyFetchResponse());
if (!policy->SerializeToString(policy_response->mutable_policy_data())) {
LOG(ERROR) << "Failed to encode policy payload.";
- return scoped_ptr<em::PolicyFetchResponse>(nullptr);
+ return nullptr;
}
ScopedSGNContext sign_context(
@@ -102,7 +102,7 @@
bool OwnerSettingsService::AssembleAndSignPolicyAsync(
base::TaskRunner* task_runner,
- scoped_ptr<em::PolicyData> policy,
+ std::unique_ptr<em::PolicyData> policy,
const AssembleAndSignPolicyAsyncCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!task_runner || !IsOwner())
diff --git a/components/ownership/owner_settings_service.h b/components/ownership/owner_settings_service.h
index 3c406d9..e26642d 100644
--- a/components/ownership/owner_settings_service.h
+++ b/components/ownership/owner_settings_service.h
@@ -5,13 +5,13 @@
#ifndef COMPONENTS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
#define COMPONENTS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
@@ -52,7 +52,8 @@
};
typedef base::Callback<void(
- scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response)>
+ std::unique_ptr<enterprise_management::PolicyFetchResponse>
+ policy_response)>
AssembleAndSignPolicyAsyncCallback;
typedef base::Callback<void(bool is_owner)> IsOwnerCallback;
@@ -82,7 +83,7 @@
// the original thread via |callback|.
bool AssembleAndSignPolicyAsync(
base::TaskRunner* task_runner,
- scoped_ptr<enterprise_management::PolicyData> policy,
+ std::unique_ptr<enterprise_management::PolicyData> policy,
const AssembleAndSignPolicyAsyncCallback& callback);
// Checks whether |setting| is handled by OwnerSettingsService.
@@ -106,7 +107,7 @@
// TODO (ygorshenin@, crbug.com/230018): that this is a temporary
// solution and should be removed.
virtual bool CommitTentativeDeviceSettings(
- scoped_ptr<enterprise_management::PolicyData> policy) = 0;
+ std::unique_ptr<enterprise_management::PolicyData> policy) = 0;
bool SetBoolean(const std::string& setting, bool value);
bool SetInteger(const std::string& setting, int value);
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index 73045235..540646e 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -10,7 +10,7 @@
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/metrics/user_metrics.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
@@ -366,7 +366,7 @@
}
void PageLoadTracker::AddObserver(
- scoped_ptr<PageLoadMetricsObserver> observer) {
+ std::unique_ptr<PageLoadMetricsObserver> observer) {
observers_.push_back(std::move(observer));
}
@@ -459,14 +459,14 @@
// static
MetricsWebContentsObserver::MetricsWebContentsObserver(
content::WebContents* web_contents,
- scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface)
+ std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface)
: content::WebContentsObserver(web_contents),
in_foreground_(false),
embedder_interface_(std::move(embedder_interface)) {}
MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents(
content::WebContents* web_contents,
- scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface) {
+ std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface) {
DCHECK(web_contents);
MetricsWebContentsObserver* metrics = FromWebContents(web_contents);
@@ -502,7 +502,7 @@
if (embedder_interface_->IsPrerendering(web_contents()))
return;
- scoped_ptr<PageLoadTracker> last_aborted =
+ std::unique_ptr<PageLoadTracker> last_aborted =
NotifyAbortedProvisionalLoadsNewNavigation(navigation_handle);
int chain_size_same_url = 0;
@@ -527,7 +527,7 @@
// committed_load_ or navigation_handle beyond the scope of the constructor.
provisional_loads_.insert(std::make_pair(
navigation_handle,
- make_scoped_ptr(new PageLoadTracker(
+ base::WrapUnique(new PageLoadTracker(
in_foreground_, embedder_interface_.get(), committed_load_.get(),
navigation_handle, chain_size, chain_size_same_url))));
}
@@ -537,7 +537,7 @@
if (!navigation_handle->IsInMainFrame())
return;
- scoped_ptr<PageLoadTracker> finished_nav(
+ std::unique_ptr<PageLoadTracker> finished_nav(
std::move(provisional_loads_[navigation_handle]));
provisional_loads_.erase(navigation_handle);
@@ -673,7 +673,7 @@
aborted_provisional_loads_.clear();
}
-scoped_ptr<PageLoadTracker>
+std::unique_ptr<PageLoadTracker>
MetricsWebContentsObserver::NotifyAbortedProvisionalLoadsNewNavigation(
content::NavigationHandle* new_navigation) {
// If there are multiple aborted loads that can be attributed to this one,
@@ -684,7 +684,7 @@
if (aborted_provisional_loads_.size() > 1)
RecordInternalError(ERR_NAVIGATION_SIGNALS_MULIPLE_ABORTED_LOADS);
- scoped_ptr<PageLoadTracker> last_aborted_load =
+ std::unique_ptr<PageLoadTracker> last_aborted_load =
std::move(aborted_provisional_loads_.back());
aborted_provisional_loads_.pop_back();
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.h b/components/page_load_metrics/browser/metrics_web_contents_observer.h
index 356eab2..f6f9e28f 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h
@@ -6,6 +6,7 @@
#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_
#include <map>
+#include <memory>
#include <vector>
#include "base/macros.h"
@@ -138,7 +139,7 @@
UserAbortType abort_type() const { return abort_type_; }
base::TimeTicks abort_time() const { return abort_time_; }
- void AddObserver(scoped_ptr<PageLoadMetricsObserver> observer);
+ void AddObserver(std::unique_ptr<PageLoadMetricsObserver> observer);
// If the user performs some abort-like action while we are tracking this page
// load, notify the tracker. Note that we may not classify this as an abort if
@@ -216,7 +217,7 @@
// Interface to chrome features. Must outlive the class.
PageLoadMetricsEmbedderInterface* const embedder_interface_;
- std::vector<scoped_ptr<PageLoadMetricsObserver>> observers_;
+ std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_;
DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
};
@@ -231,10 +232,10 @@
// Note that the returned metrics is owned by the web contents.
static MetricsWebContentsObserver* CreateForWebContents(
content::WebContents* web_contents,
- scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface);
+ std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface);
MetricsWebContentsObserver(
content::WebContents* web_contents,
- scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface);
+ std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface);
~MetricsWebContentsObserver() override;
// content::WebContentsObserver implementation:
@@ -263,7 +264,7 @@
// used for more consistent attribution tracking for aborted provisional
// loads. This method returns the provisional load that was likely aborted by
// this navigation, to help instantiate the new PageLoadTracker.
- scoped_ptr<PageLoadTracker> NotifyAbortedProvisionalLoadsNewNavigation(
+ std::unique_ptr<PageLoadTracker> NotifyAbortedProvisionalLoadsNewNavigation(
content::NavigationHandle* new_navigation);
void OnTimingUpdated(content::RenderFrameHost*,
@@ -275,13 +276,13 @@
// The PageLoadTrackers must be deleted before the |embedded_interface_|,
// because they hold a pointer to the |embedder_interface_|.
- scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_;
+ std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_;
// This map tracks all of the navigations ongoing that are not committed
// yet. Once a navigation is committed, it moves from the map to
// committed_load_. Note that a PageLoadTrackers NavigationHandle is only
// valid until commit time, when we remove it from the map.
- std::map<content::NavigationHandle*, scoped_ptr<PageLoadTracker>>
+ std::map<content::NavigationHandle*, std::unique_ptr<PageLoadTracker>>
provisional_loads_;
// Tracks aborted provisional loads for a little bit longer than usual (one
@@ -289,9 +290,9 @@
// navigation failed. This is because most provisional loads are destroyed and
// vanish before we get signal about what caused the abort (new navigation,
// stop button, etc.).
- std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_;
+ std::vector<std::unique_ptr<PageLoadTracker>> aborted_provisional_loads_;
- scoped_ptr<PageLoadTracker> committed_load_;
+ std::unique_ptr<PageLoadTracker> committed_load_;
DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver);
};
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
index de1fc26..dda00a4 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
@@ -4,10 +4,11 @@
#include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
+#include <memory>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/process/kill.h"
#include "base/test/histogram_tester.h"
#include "base/time/time.h"
@@ -65,7 +66,7 @@
is_prerendering_ = is_prerendering;
}
void RegisterObservers(PageLoadTracker* tracker) override {
- tracker->AddObserver(make_scoped_ptr(new TestPageLoadMetricsObserver(
+ tracker->AddObserver(base::WrapUnique(new TestPageLoadMetricsObserver(
&observed_timings_, &observed_committed_urls_)));
}
const std::vector<PageLoadTiming>& observed_timings() const {
@@ -110,7 +111,7 @@
void AttachObserver() {
embedder_interface_ = new TestPageLoadMetricsEmbedderInterface();
observer_.reset(new MetricsWebContentsObserver(
- web_contents(), make_scoped_ptr(embedder_interface_)));
+ web_contents(), base::WrapUnique(embedder_interface_)));
observer_->WasShown();
}
@@ -157,7 +158,7 @@
protected:
base::HistogramTester histogram_tester_;
TestPageLoadMetricsEmbedderInterface* embedder_interface_;
- scoped_ptr<MetricsWebContentsObserver> observer_;
+ std::unique_ptr<MetricsWebContentsObserver> observer_;
private:
int num_errors_;
diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer.cc b/components/page_load_metrics/renderer/metrics_render_frame_observer.cc
index 311d857..aa14692 100644
--- a/components/page_load_metrics/renderer/metrics_render_frame_observer.cc
+++ b/components/page_load_metrics/renderer/metrics_render_frame_observer.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "components/page_load_metrics/renderer/page_timing_metrics_sender.h"
@@ -136,8 +137,8 @@
return timing;
}
-scoped_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const {
- return make_scoped_ptr(new base::OneShotTimer);
+std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const {
+ return base::WrapUnique(new base::OneShotTimer);
}
bool MetricsRenderFrameObserver::HasNoRenderFrame() const {
diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer.h b/components/page_load_metrics/renderer/metrics_render_frame_observer.h
index 243e9ef..7940298 100644
--- a/components/page_load_metrics/renderer/metrics_render_frame_observer.h
+++ b/components/page_load_metrics/renderer/metrics_render_frame_observer.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBSERVER_H_
#define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBSERVER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
@@ -35,12 +36,12 @@
private:
// Will be null when we're not actively sending metrics.
- scoped_ptr<PageTimingMetricsSender> page_timing_metrics_sender_;
+ std::unique_ptr<PageTimingMetricsSender> page_timing_metrics_sender_;
void SendMetrics();
virtual bool ShouldSendMetrics() const;
virtual PageLoadTiming GetTiming() const;
- virtual scoped_ptr<base::Timer> CreateTimer() const;
+ virtual std::unique_ptr<base::Timer> CreateTimer() const;
virtual bool HasNoRenderFrame() const;
DISALLOW_COPY_AND_ASSIGN(MetricsRenderFrameObserver);
diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc b/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc
index 049059c..e01ac94 100644
--- a/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc
+++ b/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc
@@ -4,9 +4,10 @@
#include "components/page_load_metrics/renderer/metrics_render_frame_observer.h"
+#include <memory>
#include <utility>
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/timer/mock_timer.h"
#include "components/page_load_metrics/common/page_load_metrics_messages.h"
@@ -45,7 +46,7 @@
ON_CALL(*this, HasNoRenderFrame()).WillByDefault(Return(false));
}
- scoped_ptr<base::Timer> CreateTimer() const override {
+ std::unique_ptr<base::Timer> CreateTimer() const override {
if (!mock_timer_)
ADD_FAILURE() << "CreateTimer() called, but no MockTimer available.";
return std::move(mock_timer_);
@@ -59,7 +60,7 @@
return true;
}
- void set_mock_timer(scoped_ptr<base::Timer> timer) {
+ void set_mock_timer(std::unique_ptr<base::Timer> timer) {
ASSERT_EQ(nullptr, mock_timer_);
mock_timer_ = std::move(timer);
}
@@ -71,7 +72,7 @@
private:
StrictMock<MockIPCInterceptor> interceptor_;
- mutable scoped_ptr<base::Timer> mock_timer_;
+ mutable std::unique_ptr<base::Timer> mock_timer_;
};
typedef testing::Test MetricsRenderFrameObserverTest;
@@ -79,7 +80,7 @@
TEST_F(MetricsRenderFrameObserverTest, NoMetrics) {
NiceMock<MockMetricsRenderFrameObserver> observer;
base::MockTimer* mock_timer = new base::MockTimer(false, false);
- observer.set_mock_timer(make_scoped_ptr(mock_timer));
+ observer.set_mock_timer(base::WrapUnique(mock_timer));
observer.DidCommitProvisionalLoad(true, false);
EXPECT_CALL(observer, GetTiming()).WillRepeatedly(Return(PageLoadTiming()));
@@ -93,7 +94,7 @@
NiceMock<MockMetricsRenderFrameObserver> observer;
base::MockTimer* mock_timer = new base::MockTimer(false, false);
- observer.set_mock_timer(make_scoped_ptr(mock_timer));
+ observer.set_mock_timer(base::WrapUnique(mock_timer));
observer.DidCommitProvisionalLoad(true, false);
PageLoadTiming timing;
@@ -116,7 +117,7 @@
NiceMock<MockMetricsRenderFrameObserver> observer;
base::MockTimer* mock_timer = new base::MockTimer(false, false);
- observer.set_mock_timer(make_scoped_ptr(mock_timer));
+ observer.set_mock_timer(base::WrapUnique(mock_timer));
observer.DidCommitProvisionalLoad(true, false);
PageLoadTiming timing;
@@ -163,7 +164,7 @@
NiceMock<MockMetricsRenderFrameObserver> observer;
base::MockTimer* mock_timer = new base::MockTimer(false, false);
- observer.set_mock_timer(make_scoped_ptr(mock_timer));
+ observer.set_mock_timer(base::WrapUnique(mock_timer));
observer.DidCommitProvisionalLoad(true, false);
PageLoadTiming timing;
@@ -193,7 +194,7 @@
timing_2.load_event_start = load_event_2;
base::MockTimer* mock_timer2 = new base::MockTimer(false, false);
- observer.set_mock_timer(make_scoped_ptr(mock_timer2));
+ observer.set_mock_timer(base::WrapUnique(mock_timer2));
observer.DidCommitProvisionalLoad(true, false);
EXPECT_CALL(*observer.ipc_interceptor(),
OnTimingUpdated(timing, PageLoadMetadata()));
diff --git a/components/page_load_metrics/renderer/page_timing_metrics_sender.cc b/components/page_load_metrics/renderer/page_timing_metrics_sender.cc
index c37c819..2a649191 100644
--- a/components/page_load_metrics/renderer/page_timing_metrics_sender.cc
+++ b/components/page_load_metrics/renderer/page_timing_metrics_sender.cc
@@ -18,9 +18,10 @@
const int kTimerDelayMillis = 1000;
} // namespace
-PageTimingMetricsSender::PageTimingMetricsSender(IPC::Sender* ipc_sender,
- int routing_id,
- scoped_ptr<base::Timer> timer)
+PageTimingMetricsSender::PageTimingMetricsSender(
+ IPC::Sender* ipc_sender,
+ int routing_id,
+ std::unique_ptr<base::Timer> timer)
: ipc_sender_(ipc_sender),
routing_id_(routing_id),
timer_(std::move(timer)),
diff --git a/components/page_load_metrics/renderer/page_timing_metrics_sender.h b/components/page_load_metrics/renderer/page_timing_metrics_sender.h
index d5ef91faa..37d16fbc 100644
--- a/components/page_load_metrics/renderer/page_timing_metrics_sender.h
+++ b/components/page_load_metrics/renderer/page_timing_metrics_sender.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_
#define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
@@ -27,7 +28,7 @@
public:
PageTimingMetricsSender(IPC::Sender* ipc_sender,
int routing_id,
- scoped_ptr<base::Timer> timer);
+ std::unique_ptr<base::Timer> timer);
~PageTimingMetricsSender();
void DidObserveLoadingBehavior(blink::WebLoadingBehaviorFlag behavior);
@@ -42,7 +43,7 @@
IPC::Sender* const ipc_sender_;
const int routing_id_;
- scoped_ptr<base::Timer> timer_;
+ std::unique_ptr<base::Timer> timer_;
PageLoadTiming last_timing_;
// The the sender keep track of metadata as it comes in, because the sender is
diff --git a/components/page_load_metrics/renderer/page_timing_metrics_sender_unittest.cc b/components/page_load_metrics/renderer/page_timing_metrics_sender_unittest.cc
index 09d6a18..6a3f9b25 100644
--- a/components/page_load_metrics/renderer/page_timing_metrics_sender_unittest.cc
+++ b/components/page_load_metrics/renderer/page_timing_metrics_sender_unittest.cc
@@ -39,7 +39,7 @@
: PageTimingMetricsSender(
ipc_sender,
MSG_ROUTING_NONE,
- scoped_ptr<base::Timer>(new base::MockTimer(false, false))) {}
+ std::unique_ptr<base::Timer>(new base::MockTimer(false, false))) {}
base::MockTimer* mock_timer() const {
return reinterpret_cast<base::MockTimer*>(timer());
diff --git a/components/pairing/bluetooth_controller_pairing_controller.cc b/components/pairing/bluetooth_controller_pairing_controller.cc
index 285cdab..dd2ea54 100644
--- a/components/pairing/bluetooth_controller_pairing_controller.cc
+++ b/components/pairing/bluetooth_controller_pairing_controller.cc
@@ -132,7 +132,7 @@
}
void BluetoothControllerPairingController::OnStartDiscoverySession(
- scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
+ std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) {
DCHECK(thread_checker_.CalledOnValidThread());
discovery_session_ = std::move(discovery_session);
ChangeStage(STAGE_DEVICES_DISCOVERY);
diff --git a/components/pairing/bluetooth_controller_pairing_controller.h b/components/pairing/bluetooth_controller_pairing_controller.h
index 177211d7..15d0833 100644
--- a/components/pairing/bluetooth_controller_pairing_controller.h
+++ b/components/pairing/bluetooth_controller_pairing_controller.h
@@ -7,10 +7,10 @@
#include <stdint.h>
+#include <memory>
#include <set>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "components/pairing/controller_pairing_controller.h"
@@ -46,7 +46,7 @@
void OnSetPowered();
void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
void OnStartDiscoverySession(
- scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
+ std::unique_ptr<device::BluetoothDiscoverySession> discovery_session);
void OnConnect();
void OnConnectToService(scoped_refptr<device::BluetoothSocket> socket);
void OnSendComplete(int bytes_sent);
@@ -108,14 +108,14 @@
Stage current_stage_;
scoped_refptr<device::BluetoothAdapter> adapter_;
- scoped_ptr<device::BluetoothDiscoverySession> discovery_session_;
+ std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_;
scoped_refptr<device::BluetoothSocket> socket_;
std::string controller_device_id_;
std::string confirmation_code_;
std::set<std::string> discovered_devices_;
- scoped_ptr<ProtoDecoder> proto_decoder_;
+ std::unique_ptr<ProtoDecoder> proto_decoder_;
base::ThreadChecker thread_checker_;
base::ObserverList<ControllerPairingController::Observer> observers_;
diff --git a/components/pairing/bluetooth_host_pairing_controller.h b/components/pairing/bluetooth_host_pairing_controller.h
index 2831152..e5ebac84 100644
--- a/components/pairing/bluetooth_host_pairing_controller.h
+++ b/components/pairing/bluetooth_host_pairing_controller.h
@@ -7,6 +7,8 @@
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -114,7 +116,7 @@
scoped_refptr<device::BluetoothAdapter> adapter_;
scoped_refptr<device::BluetoothSocket> service_socket_;
scoped_refptr<device::BluetoothSocket> controller_socket_;
- scoped_ptr<ProtoDecoder> proto_decoder_;
+ std::unique_ptr<ProtoDecoder> proto_decoder_;
base::ThreadChecker thread_checker_;
base::ObserverList<Observer> observers_;
diff --git a/components/pairing/proto_decoder.h b/components/pairing/proto_decoder.h
index 1091995f..ab82377 100644
--- a/components/pairing/proto_decoder.h
+++ b/components/pairing/proto_decoder.h
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/pairing/message_buffer.h"
namespace net {
diff --git a/components/pairing/shark_connection_listener.h b/components/pairing/shark_connection_listener.h
index c0b3836b..8cc225d3 100644
--- a/components/pairing/shark_connection_listener.h
+++ b/components/pairing/shark_connection_listener.h
@@ -5,11 +5,11 @@
#ifndef COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_
#define COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/pairing/host_pairing_controller.h"
namespace pairing_chromeos {
@@ -19,8 +19,8 @@
// as an argument.
class SharkConnectionListener : public HostPairingController::Observer {
public:
- typedef base::Callback<void(scoped_ptr<HostPairingController>)>
- OnConnectedCallback;
+ using OnConnectedCallback =
+ base::Callback<void(std::unique_ptr<HostPairingController>)>;
explicit SharkConnectionListener(OnConnectedCallback callback);
~SharkConnectionListener() override;
@@ -32,7 +32,7 @@
void PairingStageChanged(Stage new_stage) override;
OnConnectedCallback callback_;
- scoped_ptr<HostPairingController> controller_;
+ std::unique_ptr<HostPairingController> controller_;
DISALLOW_COPY_AND_ASSIGN(SharkConnectionListener);
};
diff --git a/components/plugins/renderer/loadable_plugin_placeholder.cc b/components/plugins/renderer/loadable_plugin_placeholder.cc
index a63bb806..d772515 100644
--- a/components/plugins/renderer/loadable_plugin_placeholder.cc
+++ b/components/plugins/renderer/loadable_plugin_placeholder.cc
@@ -4,6 +4,8 @@
#include "components/plugins/renderer/loadable_plugin_placeholder.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/json/string_escape.h"
@@ -309,7 +311,7 @@
blink::WebElement element = plugin()->container()->element();
element.setAttribute("placeholderReady", "true");
- scoped_ptr<content::V8ValueConverter> converter(
+ std::unique_ptr<content::V8ValueConverter> converter(
content::V8ValueConverter::create());
base::StringValue value("placeholderReady");
blink::WebSerializedScriptValue message_data =
diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h
index 64bc7ad..3b5d504 100644
--- a/components/plugins/renderer/webview_plugin.h
+++ b/components/plugins/renderer/webview_plugin.h
@@ -6,8 +6,8 @@
#define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
#include <list>
+#include <memory>
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
@@ -174,7 +174,7 @@
blink::WebURLResponse response_;
std::list<std::string> data_;
- scoped_ptr<blink::WebURLError> error_;
+ std::unique_ptr<blink::WebURLError> error_;
blink::WebString old_title_;
bool finished_loading_;
bool focused_;
diff --git a/components/power/origin_power_map.cc b/components/power/origin_power_map.cc
index 69d9fbd3..c4b895f 100644
--- a/components/power/origin_power_map.cc
+++ b/components/power/origin_power_map.cc
@@ -49,7 +49,7 @@
return percent_map;
}
-scoped_ptr<OriginPowerMap::Subscription>
+std::unique_ptr<OriginPowerMap::Subscription>
OriginPowerMap::AddPowerConsumptionUpdatedCallback(
const base::Closure& callback) {
return callback_list_.Add(callback);
diff --git a/components/power/origin_power_map.h b/components/power/origin_power_map.h
index c02b2b4..514e5b2 100644
--- a/components/power/origin_power_map.h
+++ b/components/power/origin_power_map.h
@@ -6,10 +6,10 @@
#define COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
#include <map>
+#include <memory>
#include "base/callback_list.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
#include "url/gurl.h"
@@ -38,7 +38,7 @@
PercentOriginMap GetPercentOriginMap();
// Adds a callback for the completion of a round of updates to |origin_map_|.
- scoped_ptr<Subscription> AddPowerConsumptionUpdatedCallback(
+ std::unique_ptr<Subscription> AddPowerConsumptionUpdatedCallback(
const base::Closure& callback);
// Notifies observers to let them know that the origin power map has finished
diff --git a/components/precache/content/precache_manager.h b/components/precache/content/precache_manager.h
index 7136713..dde145a 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <list>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -16,7 +17,6 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/history/core/browser/history_types.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -149,7 +149,7 @@
// The PrecacheFetcher used to precache resources. Should only be used on the
// UI thread.
- scoped_ptr<PrecacheFetcher> precache_fetcher_;
+ std::unique_ptr<PrecacheFetcher> precache_fetcher_;
// The callback that will be run if precaching finishes without being
// canceled.
@@ -157,7 +157,7 @@
// The PrecacheDatabase for tracking precache metrics. Should only be used on
// the DB thread.
- scoped_ptr<PrecacheDatabase> precache_database_;
+ std::unique_ptr<PrecacheDatabase> precache_database_;
// Flag indicating whether or not precaching is currently in progress.
bool is_precaching_;
diff --git a/components/precache/content/precache_manager_unittest.cc b/components/precache/content/precache_manager_unittest.cc
index b44ef3e..8ea92aa9 100644
--- a/components/precache/content/precache_manager_unittest.cc
+++ b/components/precache/content/precache_manager_unittest.cc
@@ -52,11 +52,13 @@
class TestURLFetcherCallback {
public:
- scoped_ptr<net::FakeURLFetcher> CreateURLFetcher(
- const GURL& url, net::URLFetcherDelegate* delegate,
- const std::string& response_data, net::HttpStatusCode response_code,
+ std::unique_ptr<net::FakeURLFetcher> CreateURLFetcher(
+ const GURL& url,
+ net::URLFetcherDelegate* delegate,
+ const std::string& response_data,
+ net::HttpStatusCode response_code,
net::URLRequestStatus::Status status) {
- scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
url, delegate, response_data, response_code, status));
requested_urls_.insert(url);
diff --git a/components/precache/core/fetcher_pool.h b/components/precache/core/fetcher_pool.h
index 67e9a97..1a9cd1cd 100644
--- a/components/precache/core/fetcher_pool.h
+++ b/components/precache/core/fetcher_pool.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_
#define COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_
+#include <memory>
#include <unordered_map>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
namespace precache {
@@ -42,7 +42,7 @@
// Takes ownership and adds the given |element| to the pool.
// The element will live until its deletion.
- void Add(scoped_ptr<T> element) {
+ void Add(std::unique_ptr<T> element) {
DCHECK(IsAvailable()) << "FetcherPool size exceeded. "
"Did you check IsAvailable?";
DCHECK(element) << "The element cannot be null.";
@@ -69,7 +69,7 @@
private:
const size_t max_size_;
- std::unordered_map<const T*, scoped_ptr<T>> elements_;
+ std::unordered_map<const T*, std::unique_ptr<T>> elements_;
DISALLOW_COPY_AND_ASSIGN(FetcherPool);
};
diff --git a/components/precache/core/fetcher_pool_unittest.cc b/components/precache/core/fetcher_pool_unittest.cc
index 19dfc4b..a15388e 100644
--- a/components/precache/core/fetcher_pool_unittest.cc
+++ b/components/precache/core/fetcher_pool_unittest.cc
@@ -8,10 +8,10 @@
#include <array>
#include <functional>
#include <list>
+#include <memory>
#include <string>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -48,7 +48,7 @@
// It also tests IsAvailable.
base::MessageLoop loop;
MockURLFetcherDelegate delegate;
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
URLFetcher* url_fetcher_ptr = url_fetcher.get();
@@ -73,7 +73,7 @@
const size_t kSize = 42;
base::MessageLoop loop;
MockURLFetcherDelegate delegate;
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
URLFetcher* url_fetcher_ptr = url_fetcher.get();
@@ -100,7 +100,7 @@
EXPECT_CALL(delegate, OnURLFetchComplete(_)).Times(0);
int num_requests_in_flight = 0;
for (const auto& url : urls) {
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL(url), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
num_requests_in_flight++;
@@ -130,7 +130,7 @@
std::string urls[] = {"http://a.com", "http://b.com", "http://c.com"};
EXPECT_CALL(delegate, OnURLFetchComplete(_)).Times(0);
for (const auto& url : urls) {
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL(url), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
url_fetcher->Start();
@@ -150,7 +150,7 @@
TEST(FetcherPoolTest, AddTooManyURLFetchers) {
MockURLFetcherDelegate delegate;
FetcherPool<URLFetcher> pool(0);
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://queso.es"), &delegate, "irrelevant",
HTTP_OK, URLRequestStatus::SUCCESS));
EXPECT_DEBUG_DEATH(pool.Add(std::move(url_fetcher)),
@@ -159,7 +159,7 @@
TEST(FetcherPoolTest, AddNullURLFetcher) {
FetcherPool<URLFetcher> pool(1);
- scoped_ptr<URLFetcher> null_ptr;
+ std::unique_ptr<URLFetcher> null_ptr;
EXPECT_DEBUG_DEATH(pool.Add(std::move(null_ptr)), "cannot be null");
}
@@ -185,7 +185,7 @@
std::function<void()> start_next_batch = [&pending_urls, &pool, &delegate]() {
while (!pending_urls.empty() && pool.IsAvailable()) {
// Called CreateAndStartUrlFetcher in the documentation.
- scoped_ptr<URLFetcher> fetcher(
+ std::unique_ptr<URLFetcher> fetcher(
new FakeURLFetcher(GURL(pending_urls.front()), &delegate,
"irrelevant", HTTP_OK, URLRequestStatus::SUCCESS));
fetcher->Start();
diff --git a/components/precache/core/precache_database.h b/components/precache/core/precache_database.h
index 0f567b8..94d04510 100644
--- a/components/precache/core/precache_database.h
+++ b/components/precache/core/precache_database.h
@@ -7,13 +7,13 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "components/precache/core/precache_url_table.h"
@@ -90,7 +90,7 @@
// posted.
void MaybePostFlush();
- scoped_ptr<sql::Connection> db_;
+ std::unique_ptr<sql::Connection> db_;
// Table that keeps track of URLs that are in the cache because of precaching,
// and wouldn't be in the cache otherwise. If |buffered_writes_| is non-empty,
diff --git a/components/precache/core/precache_database_unittest.cc b/components/precache/core/precache_database_unittest.cc
index 36e2584..3f9253c 100644
--- a/components/precache/core/precache_database_unittest.cc
+++ b/components/precache/core/precache_database_unittest.cc
@@ -7,11 +7,11 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include "base/containers/hash_tables.h"
#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 "base/metrics/histogram_base.h"
#include "base/test/histogram_tester.h"
@@ -108,7 +108,7 @@
// to be set properly.
base::MessageLoopForUI loop_;
- scoped_ptr<PrecacheDatabase> precache_database_;
+ std::unique_ptr<PrecacheDatabase> precache_database_;
base::HistogramTester histograms_;
base::HistogramTester::CountsMap expected_histogram_counts_;
diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc
index bb5f67f..e7a5a0b 100644
--- a/components/precache/core/precache_fetcher.cc
+++ b/components/precache/core/precache_fetcher.cc
@@ -16,6 +16,7 @@
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "components/precache/core/precache_switches.h"
#include "components/precache/core/proto/precache.pb.h"
@@ -178,7 +179,7 @@
net::URLFetcher::Create(url_, net::URLFetcher::GET, this);
cache_url_fetcher_->SetRequestContext(request_context_);
cache_url_fetcher_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | kNoTracking);
- scoped_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter);
+ std::unique_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter);
cache_url_fetcher_->SaveResponseWithWriter(std::move(null_writer));
cache_url_fetcher_->Start();
}
@@ -195,7 +196,7 @@
network_url_fetcher_->SetLoadFlags(net::LOAD_VALIDATE_CACHE | kNoTracking);
// We don't need a copy of the response body for resource requests. The
// request is issued only to populate the browser cache.
- scoped_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter);
+ std::unique_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter);
network_url_fetcher_->SaveResponseWithWriter(std::move(null_writer));
} else {
// Config and manifest requests do not need to be revalidated. It's okay if
@@ -321,7 +322,7 @@
// Fetch the precache configuration settings from the server.
DCHECK(pool_.IsEmpty()) << "All parallel requests should be available";
VLOG(3) << "Fetching " << config_url;
- pool_.Add(scoped_ptr<Fetcher>(new Fetcher(
+ pool_.Add(base::WrapUnique(new Fetcher(
request_context_.get(), config_url,
base::Bind(&PrecacheFetcher::OnConfigFetchComplete,
base::Unretained(this)),
@@ -334,7 +335,7 @@
std::min(config_->max_bytes_per_resource(),
config_->max_bytes_total() - total_response_bytes_);
VLOG(3) << "Fetching " << resource_urls_to_fetch_.front();
- pool_.Add(scoped_ptr<Fetcher>(
+ pool_.Add(base::WrapUnique(
new Fetcher(request_context_.get(), resource_urls_to_fetch_.front(),
base::Bind(&PrecacheFetcher::OnResourceFetchComplete,
base::Unretained(this)),
@@ -354,7 +355,7 @@
<< "There are no available parallel requests to fetch the next manifest. "
"Did you forget to call Delete?";
VLOG(3) << "Fetching " << manifest_urls_to_fetch_.front();
- pool_.Add(scoped_ptr<Fetcher>(new Fetcher(
+ pool_.Add(base::WrapUnique(new Fetcher(
request_context_.get(), manifest_urls_to_fetch_.front(),
base::Bind(&PrecacheFetcher::OnManifestFetchComplete,
base::Unretained(this)),
diff --git a/components/precache/core/precache_fetcher.h b/components/precache/core/precache_fetcher.h
index b2fa352..324ab08 100644
--- a/components/precache/core/precache_fetcher.h
+++ b/components/precache/core/precache_fetcher.h
@@ -9,13 +9,13 @@
#include <algorithm>
#include <list>
+#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/time/time.h"
#include "components/precache/core/fetcher_pool.h"
#include "net/url_request/url_fetcher.h"
@@ -68,7 +68,7 @@
// }
//
// private:
-// scoped_ptr<PrecacheFetcher> fetcher_;
+// std::unique_ptr<PrecacheFetcher> fetcher_;
// };
class PrecacheFetcher {
public:
@@ -145,7 +145,7 @@
// Non-owning pointer. Should not be NULL.
PrecacheDelegate* precache_delegate_;
- scoped_ptr<PrecacheConfigurationSettings> config_;
+ std::unique_ptr<PrecacheConfigurationSettings> config_;
// Tally of the total number of bytes contained in URL fetches, including
// config, manifests, and resources. This the number of bytes as they would be
@@ -223,8 +223,8 @@
FetchStage fetch_stage_;
// The cache_url_fetcher_ is kept alive until Fetcher destruction for testing.
- scoped_ptr<net::URLFetcher> cache_url_fetcher_;
- scoped_ptr<net::URLFetcher> network_url_fetcher_;
+ std::unique_ptr<net::URLFetcher> cache_url_fetcher_;
+ std::unique_ptr<net::URLFetcher> network_url_fetcher_;
int64_t response_bytes_;
int64_t network_response_bytes_;
diff --git a/components/precache/core/precache_fetcher_unittest.cc b/components/precache/core/precache_fetcher_unittest.cc
index 2ab96df6..3b8d3561 100644
--- a/components/precache/core/precache_fetcher_unittest.cc
+++ b/components/precache/core/precache_fetcher_unittest.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <cstring>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -15,8 +16,8 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/histogram_tester.h"
@@ -64,11 +65,13 @@
public:
TestURLFetcherCallback() : total_response_bytes_(0) {}
- scoped_ptr<net::FakeURLFetcher> CreateURLFetcher(
- const GURL& url, net::URLFetcherDelegate* delegate,
- const std::string& response_data, net::HttpStatusCode response_code,
+ std::unique_ptr<net::FakeURLFetcher> CreateURLFetcher(
+ const GURL& url,
+ net::URLFetcherDelegate* delegate,
+ const std::string& response_data,
+ net::HttpStatusCode response_code,
net::URLRequestStatus::Status status) {
- scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
url, delegate, response_data, response_code, status));
total_response_bytes_ += response_data.size();
@@ -111,12 +114,13 @@
net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* delegate);
- scoped_ptr<net::URLFetcher> CreateURLFetcher(
+ std::unique_ptr<net::URLFetcher> CreateURLFetcher(
int id,
const GURL& url,
net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* delegate) override {
- return make_scoped_ptr(DoCreateURLFetcher(id, url, request_type, delegate));
+ return base::WrapUnique(
+ DoCreateURLFetcher(id, url, request_type, delegate));
}
// The method to mock out, instead of CreateURLFetcher. This is necessary
diff --git a/components/proxy_config/pref_proxy_config_tracker.h b/components/proxy_config/pref_proxy_config_tracker.h
index 0142f8d..d51abc8a 100644
--- a/components/proxy_config/pref_proxy_config_tracker.h
+++ b/components/proxy_config/pref_proxy_config_tracker.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_H_
#define COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/proxy_config/proxy_config_export.h"
namespace net {
@@ -29,8 +30,9 @@
// |base_service|, which can be NULL. This |base_service| provides the proxy
// settings of the OS (except of ChromeOS). This must be called on the
// UI thread.
- virtual scoped_ptr<net::ProxyConfigService> CreateTrackingProxyConfigService(
- scoped_ptr<net::ProxyConfigService> base_service) = 0;
+ virtual std::unique_ptr<net::ProxyConfigService>
+ CreateTrackingProxyConfigService(
+ std::unique_ptr<net::ProxyConfigService> base_service) = 0;
// Releases the PrefService passed upon construction and the |base_service|
// passed to CreateTrackingProxyConfigService. This must be called on the UI
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.cc b/components/proxy_config/pref_proxy_config_tracker_impl.cc
index 378923e..af9ce21 100644
--- a/components/proxy_config/pref_proxy_config_tracker_impl.cc
+++ b/components/proxy_config/pref_proxy_config_tracker_impl.cc
@@ -210,9 +210,9 @@
DCHECK(pref_service_ == NULL);
}
-scoped_ptr<net::ProxyConfigService>
+std::unique_ptr<net::ProxyConfigService>
PrefProxyConfigTrackerImpl::CreateTrackingProxyConfigService(
- scoped_ptr<net::ProxyConfigService> base_service) {
+ std::unique_ptr<net::ProxyConfigService> base_service) {
proxy_config_service_impl_ =
new ProxyConfigServiceImpl(base_service.release());
VLOG(1) << this << ": set chrome proxy config service to "
@@ -220,7 +220,7 @@
if (proxy_config_service_impl_ && update_pending_)
OnProxyConfigChanged(config_state_, pref_config_);
- return scoped_ptr<net::ProxyConfigService>(proxy_config_service_impl_);
+ return std::unique_ptr<net::ProxyConfigService>(proxy_config_service_impl_);
}
void PrefProxyConfigTrackerImpl::DetachFromPrefService() {
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.h b/components/proxy_config/pref_proxy_config_tracker_impl.h
index 2f14ed73..ec42a7922 100644
--- a/components/proxy_config/pref_proxy_config_tracker_impl.h
+++ b/components/proxy_config/pref_proxy_config_tracker_impl.h
@@ -5,9 +5,10 @@
#ifndef COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_
#define COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_
+#include <memory>
+
#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/prefs/pref_change_registrar.h"
@@ -60,7 +61,7 @@
// Makes sure that the observer registration with the base service is set up.
void RegisterObserver();
- scoped_ptr<net::ProxyConfigService> base_service_;
+ std::unique_ptr<net::ProxyConfigService> base_service_;
base::ObserverList<net::ProxyConfigService::Observer, true> observers_;
// Tracks configuration state of |pref_config_|. |pref_config_| is valid only
@@ -94,8 +95,8 @@
~PrefProxyConfigTrackerImpl() override;
// PrefProxyConfigTracker implementation:
- scoped_ptr<net::ProxyConfigService> CreateTrackingProxyConfigService(
- scoped_ptr<net::ProxyConfigService> base_service) override;
+ std::unique_ptr<net::ProxyConfigService> CreateTrackingProxyConfigService(
+ std::unique_ptr<net::ProxyConfigService> base_service) override;
// Notifies the tracker that the pref service passed upon construction is
// about to go away. This must be called from the UI thread.
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc b/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc
index f28d61a4..cad3553 100644
--- a/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc
+++ b/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc
@@ -4,6 +4,7 @@
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include <memory>
#include <string>
#include "base/command_line.h"
@@ -85,7 +86,7 @@
pref_service_.get(), base::ThreadTaskRunnerHandle::Get()));
proxy_config_service_ =
proxy_config_tracker_->CreateTrackingProxyConfigService(
- scoped_ptr<net::ProxyConfigService>(delegate_service_));
+ std::unique_ptr<net::ProxyConfigService>(delegate_service_));
// SetProxyConfigServiceImpl triggers update of initial prefs proxy
// config by tracker to chrome proxy config service, so flush all pending
// tasks so that tests start fresh.
@@ -100,13 +101,13 @@
}
base::MessageLoop loop_;
- scoped_ptr<TestingPrefServiceSimple> pref_service_;
+ std::unique_ptr<TestingPrefServiceSimple> pref_service_;
TestProxyConfigService* delegate_service_; // weak
- scoped_ptr<net::ProxyConfigService> proxy_config_service_;
+ std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
net::ProxyConfig fixed_config_;
private:
- scoped_ptr<PrefProxyConfigTrackerImpl> proxy_config_tracker_;
+ std::unique_ptr<PrefProxyConfigTrackerImpl> proxy_config_tracker_;
};
TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) {
diff --git a/components/proxy_config/proxy_config_dictionary.h b/components/proxy_config/proxy_config_dictionary.h
index f95ba74..1faa121a 100644
--- a/components/proxy_config/proxy_config_dictionary.h
+++ b/components/proxy_config/proxy_config_dictionary.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_
#define COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/proxy_config/proxy_config_export.h"
#include "components/proxy_config/proxy_prefs.h"
@@ -67,7 +67,7 @@
const std::string& proxy_server,
const std::string& bypass_list);
- scoped_ptr<base::DictionaryValue> dict_;
+ std::unique_ptr<base::DictionaryValue> dict_;
DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary);
};
diff --git a/components/proxy_config/proxy_config_dictionary_unittest.cc b/components/proxy_config/proxy_config_dictionary_unittest.cc
index ca73ab0..33f5364c 100644
--- a/components/proxy_config/proxy_config_dictionary_unittest.cc
+++ b/components/proxy_config/proxy_config_dictionary_unittest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/proxy_config/proxy_config_dictionary.h"
+
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "components/proxy_config/proxy_config_dictionary.h"
#include "testing/gtest/include/gtest/gtest.h"
struct ProxyConfigHolder {
@@ -17,7 +18,7 @@
};
TEST(ProxyConfigDictionaryTest, CreateDirect) {
- scoped_ptr<base::DictionaryValue> dict_value(
+ std::unique_ptr<base::DictionaryValue> dict_value(
ProxyConfigDictionary::CreateDirect());
ProxyConfigDictionary dict(dict_value.get());
ProxyConfigHolder h;
@@ -30,7 +31,7 @@
}
TEST(ProxyConfigDictionaryTest, CreateAutoDetect) {
- scoped_ptr<base::DictionaryValue> dict_value(
+ std::unique_ptr<base::DictionaryValue> dict_value(
ProxyConfigDictionary::CreateAutoDetect());
ProxyConfigDictionary dict(dict_value.get());
ProxyConfigHolder h;
@@ -43,7 +44,7 @@
}
TEST(ProxyConfigDictionaryTest, CreatePacScript) {
- scoped_ptr<base::DictionaryValue> dict_value(
+ std::unique_ptr<base::DictionaryValue> dict_value(
ProxyConfigDictionary::CreatePacScript("pac", false));
ProxyConfigDictionary dict(dict_value.get());
ProxyConfigHolder h;
@@ -57,7 +58,7 @@
}
TEST(ProxyConfigDictionaryTest, CreateFixedServers) {
- scoped_ptr<base::DictionaryValue> dict_value(
+ std::unique_ptr<base::DictionaryValue> dict_value(
ProxyConfigDictionary::CreateFixedServers("http://1.2.3.4",
"http://foo"));
ProxyConfigDictionary dict(dict_value.get());
@@ -73,7 +74,7 @@
}
TEST(ProxyConfigDictionaryTest, CreateSystem) {
- scoped_ptr<base::DictionaryValue> dict_value(
+ std::unique_ptr<base::DictionaryValue> dict_value(
ProxyConfigDictionary::CreateSystem());
ProxyConfigDictionary dict(dict_value.get());
ProxyConfigHolder h;
diff --git a/components/query_parser/snippet.cc b/components/query_parser/snippet.cc
index f704409c..f540be5 100644
--- a/components/query_parser/snippet.cc
+++ b/components/query_parser/snippet.cc
@@ -7,9 +7,9 @@
#include <stdint.h>
#include <algorithm>
+#include <memory>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -226,8 +226,9 @@
document.size(), &status);
// Locale does not matter because there's no per-locale customization
// for character iterator.
- scoped_ptr<icu::BreakIterator> bi(icu::BreakIterator::createCharacterInstance(
- icu::Locale::getDefault(), status));
+ std::unique_ptr<icu::BreakIterator> bi(
+ icu::BreakIterator::createCharacterInstance(icu::Locale::getDefault(),
+ status));
bi->setText(document_utext, status);
DCHECK(U_SUCCESS(status));
diff --git a/components/quirks/quirks_client.cc b/components/quirks/quirks_client.cc
index 93775e8..383c9112 100644
--- a/components/quirks/quirks_client.cc
+++ b/components/quirks/quirks_client.cc
@@ -153,7 +153,7 @@
bool QuirksClient::ParseResult(const std::string& result, std::string* data) {
std::string data64;
const base::DictionaryValue* dict;
- scoped_ptr<base::Value> json = base::JSONReader::Read(result);
+ std::unique_ptr<base::Value> json = base::JSONReader::Read(result);
if (!json || !json->GetAsDictionary(&dict) ||
!dict->GetString("icc", &data64)) {
VLOG(1) << "Failed to parse JSON icc data";
diff --git a/components/quirks/quirks_client.h b/components/quirks/quirks_client.h
index 5219a5c..86c7ada 100644
--- a/components/quirks/quirks_client.h
+++ b/components/quirks/quirks_client.h
@@ -5,9 +5,10 @@
#ifndef COMPONENTS_QUIRKS_QUIRKS_CLIENT_H_
#define COMPONENTS_QUIRKS_QUIRKS_CLIENT_H_
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "net/base/backoff_entry.h"
@@ -62,7 +63,7 @@
base::ThreadChecker thread_checker_;
// This fetcher is used to download icc file.
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
// Pending retry.
base::OneShotTimer request_scheduled_;
diff --git a/components/quirks/quirks_manager.cc b/components/quirks/quirks_manager.cc
index db97631..7f35bc6f 100644
--- a/components/quirks/quirks_manager.cc
+++ b/components/quirks/quirks_manager.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
@@ -78,7 +79,7 @@
// QuirksManager
QuirksManager::QuirksManager(
- scoped_ptr<Delegate> delegate,
+ std::unique_ptr<Delegate> delegate,
scoped_refptr<base::SequencedWorkerPool> blocking_pool,
PrefService* local_state,
scoped_refptr<net::URLRequestContextGetter> url_context_getter)
@@ -96,7 +97,7 @@
// static
void QuirksManager::Initialize(
- scoped_ptr<Delegate> delegate,
+ std::unique_ptr<Delegate> delegate,
scoped_refptr<base::SequencedWorkerPool> blocking_pool,
PrefService* local_state,
scoped_refptr<net::URLRequestContextGetter> url_context_getter) {
@@ -131,7 +132,7 @@
clients_.clear();
}
- for (const scoped_ptr<QuirksClient>& client : clients_)
+ for (const std::unique_ptr<QuirksClient>& client : clients_)
client->StartDownload();
}
@@ -156,14 +157,14 @@
DCHECK(thread_checker_.CalledOnValidThread());
SetLastServerCheck(client->product_id(), base::Time::Now());
auto it = std::find_if(clients_.begin(), clients_.end(),
- [client](const scoped_ptr<QuirksClient>& c) {
+ [client](const std::unique_ptr<QuirksClient>& c) {
return c.get() == client;
});
CHECK(it != clients_.end());
clients_.erase(it);
}
-scoped_ptr<net::URLFetcher> QuirksManager::CreateURLFetcher(
+std::unique_ptr<net::URLFetcher> QuirksManager::CreateURLFetcher(
const GURL& url,
net::URLFetcherDelegate* delegate) {
if (!fake_quirks_fetcher_creator_.is_null())
@@ -244,7 +245,7 @@
DCHECK(thread_checker_.CalledOnValidThread());
QuirksClient* client =
new QuirksClient(product_id, on_request_finished, this);
- clients_.insert(make_scoped_ptr(client));
+ clients_.insert(base::WrapUnique(client));
if (!waiting_for_login_)
client->StartDownload();
else
diff --git a/components/quirks/quirks_manager.h b/components/quirks/quirks_manager.h
index ea5bbce0..1cfd91c 100644
--- a/components/quirks/quirks_manager.h
+++ b/components/quirks/quirks_manager.h
@@ -5,12 +5,12 @@
#ifndef COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_
#define COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_
+#include <memory>
#include <set>
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
@@ -54,9 +54,8 @@
public:
// Passed function to create a URLFetcher for tests.
// Same parameters as URLFetcher::Create().
- using FakeQuirksFetcherCreator =
- base::Callback<scoped_ptr<net::URLFetcher>(const GURL&,
- net::URLFetcherDelegate*)>;
+ using FakeQuirksFetcherCreator = base::Callback<
+ std::unique_ptr<net::URLFetcher>(const GURL&, net::URLFetcherDelegate*)>;
// Callback after getting days since OOBE on blocking pool.
// Parameter is returned number of days.
@@ -89,7 +88,7 @@
};
static void Initialize(
- scoped_ptr<Delegate> delegate,
+ std::unique_ptr<Delegate> delegate,
scoped_refptr<base::SequencedWorkerPool> blocking_pool,
PrefService* local_state,
scoped_refptr<net::URLRequestContextGetter> url_context_getter);
@@ -109,7 +108,7 @@
void ClientFinished(QuirksClient* client);
// Creates a real URLFetcher for OS, and a fake one for tests.
- scoped_ptr<net::URLFetcher> CreateURLFetcher(
+ std::unique_ptr<net::URLFetcher> CreateURLFetcher(
const GURL& url,
net::URLFetcherDelegate* delegate);
@@ -128,7 +127,7 @@
}
private:
- QuirksManager(scoped_ptr<Delegate> delegate,
+ QuirksManager(std::unique_ptr<Delegate> delegate,
scoped_refptr<base::SequencedWorkerPool> blocking_pool,
PrefService* local_state,
scoped_refptr<net::URLRequestContextGetter> url_context_getter);
@@ -157,7 +156,7 @@
void SetLastServerCheck(int64_t product_id, const base::Time& last_check);
// Set of active clients, each created to download a different Quirks file.
- std::set<scoped_ptr<QuirksClient>> clients_;
+ std::set<std::unique_ptr<QuirksClient>> clients_;
// Don't start downloads before first session login.
bool waiting_for_login_;
@@ -166,7 +165,7 @@
base::ThreadChecker thread_checker_;
// These objects provide resources from the browser.
- scoped_ptr<Delegate> delegate_; // Impl runs from chrome/browser.
+ std::unique_ptr<Delegate> delegate_; // Impl runs from chrome/browser.
scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
PrefService* local_state_; // For local prefs.
scoped_refptr<net::URLRequestContextGetter> url_context_getter_;
diff --git a/components/rappor/log_uploader.cc b/components/rappor/log_uploader.cc
index 247ddc1..7f2f0f79 100644
--- a/components/rappor/log_uploader.cc
+++ b/components/rappor/log_uploader.cc
@@ -143,7 +143,7 @@
// Note however that |source| is aliased to the fetcher, so we should be
// careful not to delete it too early.
DCHECK_EQ(current_fetch_.get(), source);
- scoped_ptr<net::URLFetcher> fetch(std::move(current_fetch_));
+ std::unique_ptr<net::URLFetcher> fetch(std::move(current_fetch_));
const net::URLRequestStatus& request_status = source->GetStatus();
diff --git a/components/rappor/log_uploader.h b/components/rappor/log_uploader.h
index e1eba5b3..a6dc8ba 100644
--- a/components/rappor/log_uploader.h
+++ b/components/rappor/log_uploader.h
@@ -5,12 +5,12 @@
#ifndef COMPONENTS_RAPPOR_LOG_UPLOADER_H_
#define COMPONENTS_RAPPOR_LOG_UPLOADER_H_
+#include <memory>
#include <queue>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "components/rappor/log_uploader_interface.h"
@@ -90,7 +90,7 @@
bool is_running_;
// The outstanding transmission that appears as a URL Fetch operation.
- scoped_ptr<net::URLFetcher> current_fetch_;
+ std::unique_ptr<net::URLFetcher> current_fetch_;
// The logs that still need to be uploaded.
std::queue<std::string> queued_logs_;
diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc
index 02853afb..f8bbdd6 100644
--- a/components/rappor/rappor_service.cc
+++ b/components/rappor/rappor_service.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/metrics_hashes.h"
#include "base/stl_util.h"
@@ -68,7 +69,7 @@
}
void RapporService::AddDailyObserver(
- scoped_ptr<metrics::DailyEvent::Observer> observer) {
+ std::unique_ptr<metrics::DailyEvent::Observer> observer) {
daily_event_.AddObserver(std::move(observer));
}
@@ -82,11 +83,9 @@
return;
}
DVLOG(1) << "RapporService reporting to " << server_url.spec();
- InitializeInternal(make_scoped_ptr(new LogUploader(server_url,
- kMimeType,
- request_context)),
- internal::LoadCohort(pref_service_),
- internal::LoadSecret(pref_service_));
+ InitializeInternal(
+ base::WrapUnique(new LogUploader(server_url, kMimeType, request_context)),
+ internal::LoadCohort(pref_service_), internal::LoadSecret(pref_service_));
}
void RapporService::Update(int recording_groups, bool may_upload) {
@@ -124,7 +123,7 @@
}
void RapporService::InitializeInternal(
- scoped_ptr<LogUploaderInterface> uploader,
+ std::unique_ptr<LogUploaderInterface> uploader,
int32_t cohort,
const std::string& secret) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -249,15 +248,15 @@
return new_metric;
}
-scoped_ptr<Sample> RapporService::CreateSample(RapporType type) {
+std::unique_ptr<Sample> RapporService::CreateSample(RapporType type) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(IsInitialized());
- return scoped_ptr<Sample>(
+ return base::WrapUnique(
new Sample(cohort_, internal::kRapporParametersForType[type]));
}
void RapporService::RecordSampleObj(const std::string& metric_name,
- scoped_ptr<Sample> sample) {
+ std::unique_ptr<Sample> sample) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!RecordingAllowed(sample->parameters()))
return;
diff --git a/components/rappor/rappor_service.h b/components/rappor/rappor_service.h
index 87599b3..ac1a435 100644
--- a/components/rappor/rappor_service.h
+++ b/components/rappor/rappor_service.h
@@ -8,11 +8,11 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
@@ -47,7 +47,8 @@
virtual ~RapporService();
// Add an observer for collecting daily metrics.
- void AddDailyObserver(scoped_ptr<metrics::DailyEvent::Observer> observer);
+ void AddDailyObserver(
+ std::unique_ptr<metrics::DailyEvent::Observer> observer);
// Initializes the rappor service, including loading the cohort and secret
// preferences from disk.
@@ -63,7 +64,7 @@
void Update(int recording_groups, bool may_upload);
// Constructs a Sample object for the caller to record fields in.
- virtual scoped_ptr<Sample> CreateSample(RapporType);
+ virtual std::unique_ptr<Sample> CreateSample(RapporType);
// Records a Sample of rappor metric specified by |metric_name|.
//
@@ -71,7 +72,8 @@
// to RecordSample.
//
// example:
- // scoped_ptr<Sample> sample = rappor_service->CreateSample(MY_METRIC_TYPE);
+ // std::unique_ptr<Sample> sample =
+ // rappor_service->CreateSample(MY_METRIC_TYPE);
// sample->SetStringField("Field1", "some string");
// sample->SetFlagsValue("Field2", SOME|FLAGS);
// rappor_service->RecordSample("MyMetric", std::move(sample));
@@ -80,7 +82,7 @@
// "MyMetric.Field2", and they will both be generated from the same sample,
// to allow for correllations to be computed.
virtual void RecordSampleObj(const std::string& metric_name,
- scoped_ptr<Sample> sample);
+ std::unique_ptr<Sample> sample);
// Records a sample of the rappor metric specified by |metric_name|.
// Creates and initializes the metric, if it doesn't yet exist.
@@ -94,7 +96,7 @@
protected:
// Initializes the state of the RapporService.
- void InitializeInternal(scoped_ptr<LogUploaderInterface> uploader,
+ void InitializeInternal(std::unique_ptr<LogUploaderInterface> uploader,
int32_t cohort,
const std::string& secret);
@@ -153,7 +155,7 @@
metrics::DailyEvent daily_event_;
// A private LogUploader instance for sending reports to the server.
- scoped_ptr<LogUploaderInterface> uploader_;
+ std::unique_ptr<LogUploaderInterface> uploader_;
// The set of recording groups that metrics are being recorded, e.g.
// UMA_RECORDING_GROUP | SAFEBROWSING_RECORDING_GROUP
diff --git a/components/rappor/rappor_service_unittest.cc b/components/rappor/rappor_service_unittest.cc
index 711722d..2c1e8b6c 100644
--- a/components/rappor/rappor_service_unittest.cc
+++ b/components/rappor/rappor_service_unittest.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <memory>
#include <utility>
#include "base/base64.h"
@@ -121,7 +123,7 @@
// Check that Sample objects record correctly.
TEST(RapporServiceTest, RecordSample) {
TestRapporService rappor_service;
- scoped_ptr<Sample> sample =
+ std::unique_ptr<Sample> sample =
rappor_service.CreateSample(SAFEBROWSING_RAPPOR_TYPE);
sample->SetStringField("Url", "example.com");
sample->SetFlagsField("Flags1", 0xbcd, 12);
diff --git a/components/rappor/sampler.cc b/components/rappor/sampler.cc
index 9ad0da9..b6a8098 100644
--- a/components/rappor/sampler.cc
+++ b/components/rappor/sampler.cc
@@ -19,7 +19,7 @@
Sampler::~Sampler() {}
void Sampler::AddSample(const std::string& metric_name,
- scoped_ptr<Sample> sample) {
+ std::unique_ptr<Sample> sample) {
++sample_counts_[metric_name];
// Replace the previous sample with a 1 in sample_count_ chance so that each
// sample has equal probability of being reported.
diff --git a/components/rappor/sampler.h b/components/rappor/sampler.h
index dac87416b..8059de4 100644
--- a/components/rappor/sampler.h
+++ b/components/rappor/sampler.h
@@ -6,11 +6,11 @@
#define COMPONENTS_RAPPOR_SAMPLER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/rappor/rappor_parameters.h"
#include "components/rappor/sample.h"
@@ -30,7 +30,8 @@
// Store this sample for metric name, randomly selecting a sample if
// others have already been recorded.
- void AddSample(const std::string& metric_name, scoped_ptr<Sample> sample);
+ void AddSample(const std::string& metric_name,
+ std::unique_ptr<Sample> sample);
// Generate randomized reports for all stored samples and store them
// in |reports|, then discard the samples.
@@ -41,7 +42,7 @@
std::map<std::string, int> sample_counts_;
// Stores a Sample for each metric, by metric name.
- base::ScopedPtrHashMap<std::string, scoped_ptr<Sample>> samples_;
+ base::ScopedPtrHashMap<std::string, std::unique_ptr<Sample>> samples_;
DISALLOW_COPY_AND_ASSIGN(Sampler);
};
diff --git a/components/rappor/sampler_unittest.cc b/components/rappor/sampler_unittest.cc
index 5458d16..9953c190 100644
--- a/components/rappor/sampler_unittest.cc
+++ b/components/rappor/sampler_unittest.cc
@@ -4,6 +4,7 @@
#include "components/rappor/sampler.h"
+#include <memory>
#include <utility>
#include "base/metrics/metrics_hashes.h"
@@ -22,8 +23,8 @@
class TestSamplerFactory {
public:
- static scoped_ptr<Sample> CreateSample() {
- return scoped_ptr<Sample>(new Sample(0, kTestRapporParameters));
+ static std::unique_ptr<Sample> CreateSample() {
+ return std::unique_ptr<Sample>(new Sample(0, kTestRapporParameters));
}
};
@@ -33,11 +34,11 @@
TEST(RapporSamplerTest, TestExport) {
Sampler sampler;
- scoped_ptr<Sample> sample1 = TestSamplerFactory::CreateSample();
+ std::unique_ptr<Sample> sample1 = TestSamplerFactory::CreateSample();
sample1->SetStringField("Foo", "Junk");
sampler.AddSample("Metric1", std::move(sample1));
- scoped_ptr<Sample> sample2 = TestSamplerFactory::CreateSample();
+ std::unique_ptr<Sample> sample2 = TestSamplerFactory::CreateSample();
sample2->SetStringField("Foo", "Junk2");
sampler.AddSample("Metric1", std::move(sample2));
@@ -59,7 +60,7 @@
TEST(RapporSamplerTest, TestNoNoise) {
Sampler sampler;
- scoped_ptr<Sample> sample1 = TestSamplerFactory::CreateSample();
+ std::unique_ptr<Sample> sample1 = TestSamplerFactory::CreateSample();
sample1->SetFlagsField("Foo", 0xde, 8, NO_NOISE);
sample1->SetUInt64Field("Bar", 0x0011223344aabbccdd, NO_NOISE);
sampler.AddSample("Metric1", std::move(sample1));
diff --git a/components/rappor/test_rappor_service.cc b/components/rappor/test_rappor_service.cc
index fb24202..edd51c3f 100644
--- a/components/rappor/test_rappor_service.cc
+++ b/components/rappor/test_rappor_service.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "components/rappor/byte_vector_utils.h"
#include "components/rappor/proto/rappor_metric.pb.h"
#include "components/rappor/rappor_parameters.h"
@@ -57,22 +58,21 @@
is_incognito_(false) {
RegisterPrefs(test_prefs_.registry());
test_uploader_ = new TestLogUploader();
- InitializeInternal(make_scoped_ptr(test_uploader_),
- 0,
+ InitializeInternal(base::WrapUnique(test_uploader_), 0,
HmacByteVectorGenerator::GenerateEntropyInput());
Update(UMA_RAPPOR_GROUP | SAFEBROWSING_RAPPOR_GROUP, true);
}
TestRapporService::~TestRapporService() {}
-scoped_ptr<Sample> TestRapporService::CreateSample(RapporType type) {
- scoped_ptr<TestSample> test_sample(new TestSample(type));
+std::unique_ptr<Sample> TestRapporService::CreateSample(RapporType type) {
+ std::unique_ptr<TestSample> test_sample(new TestSample(type));
return std::move(test_sample);
}
// Intercepts the sample being recorded and saves it in a test structure.
void TestRapporService::RecordSampleObj(const std::string& metric_name,
- scoped_ptr<Sample> sample) {
+ std::unique_ptr<Sample> sample) {
TestSample* test_sample = static_cast<TestSample*>(sample.get());
// Erase the previous sample if we logged one.
shadows_.erase(metric_name);
diff --git a/components/rappor/test_rappor_service.h b/components/rappor/test_rappor_service.h
index 56e85db..01a850c 100644
--- a/components/rappor/test_rappor_service.h
+++ b/components/rappor/test_rappor_service.h
@@ -58,9 +58,9 @@
~TestRapporService() override;
// RapporService:
- scoped_ptr<Sample> CreateSample(RapporType type) override;
+ std::unique_ptr<Sample> CreateSample(RapporType type) override;
void RecordSampleObj(const std::string& metric_name,
- scoped_ptr<Sample> sample) override;
+ std::unique_ptr<Sample> sample) override;
void RecordSample(const std::string& metric_name,
RapporType type,
const std::string& sample) override;
diff --git a/components/renderer_context_menu/context_menu_delegate.h b/components/renderer_context_menu/context_menu_delegate.h
index 9ce0495..bbb5c25 100644
--- a/components/renderer_context_menu/context_menu_delegate.h
+++ b/components/renderer_context_menu/context_menu_delegate.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_
#define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
class RenderViewContextMenuBase;
@@ -26,12 +27,12 @@
// Builds and returns a context menu for a context specified by |params|.
// The returned value can be used to display the context menu.
- virtual scoped_ptr<RenderViewContextMenuBase> BuildMenu(
+ virtual std::unique_ptr<RenderViewContextMenuBase> BuildMenu(
content::WebContents* web_contents,
const content::ContextMenuParams& params) = 0;
// Displays the context menu.
- virtual void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) = 0;
+ virtual void ShowMenu(std::unique_ptr<RenderViewContextMenuBase> menu) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(ContextMenuDelegate);
diff --git a/components/renderer_context_menu/render_view_context_menu_base.h b/components/renderer_context_menu/render_view_context_menu_base.h
index 1b0d83921..604b644 100644
--- a/components/renderer_context_menu/render_view_context_menu_base.h
+++ b/components/renderer_context_menu/render_view_context_menu_base.h
@@ -6,12 +6,13 @@
#define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_
#include <stddef.h>
+
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
@@ -120,7 +121,7 @@
content_type_.reset(content_type);
}
- void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) {
+ void set_toolkit_delegate(std::unique_ptr<ToolkitDelegate> delegate) {
toolkit_delegate_ = std::move(delegate);
}
@@ -188,7 +189,7 @@
// should be notified of menu closing without execution.
bool command_executed_;
- scoped_ptr<ContextMenuContentType> content_type_;
+ std::unique_ptr<ContextMenuContentType> content_type_;
private:
bool AppendCustomItems();
@@ -196,7 +197,7 @@
// The RenderFrameHost's IDs.
const int render_process_id_;
- scoped_ptr<ToolkitDelegate> toolkit_delegate_;
+ std::unique_ptr<ToolkitDelegate> toolkit_delegate_;
ScopedVector<ui::SimpleMenuModel> custom_submenus_;
diff --git a/components/renderer_context_menu/render_view_context_menu_observer.h b/components/renderer_context_menu/render_view_context_menu_observer.h
index 586f978..ccd052b 100644
--- a/components/renderer_context_menu/render_view_context_menu_observer.h
+++ b/components/renderer_context_menu/render_view_context_menu_observer.h
@@ -59,12 +59,13 @@
// }
//
// 4. Add this observer class to the RenderViewContextMenu class. (It is good
-// to use scoped_ptr<> so Chrome can create its instances only when it needs.)
+// to use std::unique_ptr<> so Chrome can create its instances only when it
+// needs.)
//
// class RenderViewContextMenu {
// ...
// private:
-// scoped_ptr<MyMenuObserver> my_menu_observer_;
+// std::unique_ptr<MyMenuObserver> my_menu_observer_;
// };
//
// 5. Create its instance in InitMenu() and add it to the observer list of the
diff --git a/components/renderer_context_menu/views/toolkit_delegate_views.h b/components/renderer_context_menu/views/toolkit_delegate_views.h
index b570958..a5153d6 100644
--- a/components/renderer_context_menu/views/toolkit_delegate_views.h
+++ b/components/renderer_context_menu/views/toolkit_delegate_views.h
@@ -5,6 +5,8 @@
#ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_TOOLKIT_DELEGATE_VIEWS_H_
#define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_TOOLKIT_DELEGATE_VIEWS_H_
+#include <memory>
+
#include "base/macros.h"
#include "components/renderer_context_menu/render_view_context_menu_base.h"
#include "ui/base/ui_base_types.h"
@@ -42,8 +44,8 @@
bool hidden,
const base::string16& title) override;
- scoped_ptr<views::MenuModelAdapter> menu_adapter_;
- scoped_ptr<views::MenuRunner> menu_runner_;
+ std::unique_ptr<views::MenuModelAdapter> menu_adapter_;
+ std::unique_ptr<views::MenuRunner> menu_runner_;
// Weak. Owned by menu_runner_;
views::MenuItemView* menu_view_;
diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc
index 32ae5ef..65685a4a9f 100644
--- a/components/resource_provider/public/cpp/resource_loader.cc
+++ b/components/resource_provider/public/cpp/resource_loader.cc
@@ -51,7 +51,7 @@
base::File ResourceLoader::ReleaseFile(const std::string& path) {
CHECK(resource_map_.count(path));
- scoped_ptr<base::File> file_wrapper(std::move(resource_map_[path]));
+ std::unique_ptr<base::File> file_wrapper(std::move(resource_map_[path]));
resource_map_.erase(path);
return std::move(*file_wrapper);
}
diff --git a/components/resource_provider/public/cpp/resource_loader.h b/components/resource_provider/public/cpp/resource_loader.h
index 533ec21..9153b47b 100644
--- a/components/resource_provider/public/cpp/resource_loader.h
+++ b/components/resource_provider/public/cpp/resource_loader.h
@@ -6,12 +6,12 @@
#define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/resource_provider/public/interfaces/resource_provider.mojom.h"
#include "mojo/platform_handle/platform_handle.h"
#include "mojo/public/cpp/bindings/array.h"
@@ -49,7 +49,7 @@
bool loaded() const { return loaded_; }
private:
- using ResourceMap = std::map<std::string, scoped_ptr<base::File>>;
+ using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>;
// Callback when resources have loaded.
void OnGotResources(const std::vector<std::string>& paths,
diff --git a/components/resource_provider/resource_provider_test_app.cc b/components/resource_provider/resource_provider_test_app.cc
index 8cab63f8..cab29de 100644
--- a/components/resource_provider/resource_provider_test_app.cc
+++ b/components/resource_provider/resource_provider_test_app.cc
@@ -23,7 +23,7 @@
std::string ReadFile(base::File* file) {
const size_t kBufferSize = 1 << 16;
- scoped_ptr<char[]> buffer(new char[kBufferSize]);
+ std::unique_ptr<char[]> buffer(new char[kBufferSize]);
const int read = file->ReadAtCurrentPos(buffer.get(), kBufferSize);
if (read == -1)
return std::string();
@@ -108,7 +108,7 @@
}
private:
- scoped_ptr<Test> test_;
+ std::unique_ptr<Test> test_;
mojo::BindingSet<test::mojom::Test> bindings_;
DISALLOW_COPY_AND_ASSIGN(TestApp);
diff --git a/components/rlz/rlz_tracker.cc b/components/rlz/rlz_tracker.cc
index 32284b8..d18edb7 100644
--- a/components/rlz/rlz_tracker.cc
+++ b/components/rlz/rlz_tracker.cc
@@ -172,7 +172,7 @@
}
// static
-void RLZTracker::SetRlzDelegate(scoped_ptr<RLZTrackerDelegate> delegate) {
+void RLZTracker::SetRlzDelegate(std::unique_ptr<RLZTrackerDelegate> delegate) {
RLZTracker* tracker = GetInstance();
if (!tracker->delegate_) {
// RLZTracker::SetRlzDelegate is called at Profile creation time which can
@@ -182,7 +182,7 @@
}
}
-void RLZTracker::SetDelegate(scoped_ptr<RLZTrackerDelegate> delegate) {
+void RLZTracker::SetDelegate(std::unique_ptr<RLZTrackerDelegate> delegate) {
DCHECK(delegate);
DCHECK(!delegate_);
delegate_ = std::move(delegate);
diff --git a/components/rlz/rlz_tracker.h b/components/rlz/rlz_tracker.h
index aa7a4d0..0721173 100644
--- a/components/rlz/rlz_tracker.h
+++ b/components/rlz/rlz_tracker.h
@@ -6,10 +6,10 @@
#define COMPONENTS_RLZ_RLZ_TRACKER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/strings/string16.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -39,7 +39,7 @@
public:
// Sets the RLZTrackerDelegate that should be used by the global RLZTracker
// instance. Must be called before calling any other method of RLZTracker.
- static void SetRlzDelegate(scoped_ptr<RLZTrackerDelegate> delegate);
+ static void SetRlzDelegate(std::unique_ptr<RLZTrackerDelegate> delegate);
// Initializes the RLZ library services for use in chrome. Schedules a delayed
// task that performs the ping and registers some events when 'first-run' is
@@ -128,7 +128,7 @@
friend class base::RefCountedThreadSafe<RLZTracker>;
// Implementation called from SetRlzDelegate() static method.
- void SetDelegate(scoped_ptr<RLZTrackerDelegate> delegate);
+ void SetDelegate(std::unique_ptr<RLZTrackerDelegate> delegate);
// Implementation called from InitRlzDelayed() static method.
bool Init(bool first_run,
@@ -200,7 +200,7 @@
static RLZTracker* tracker_;
// Delegate abstracting embedder specific knowledge. Must not be null.
- scoped_ptr<RLZTrackerDelegate> delegate_;
+ std::unique_ptr<RLZTrackerDelegate> delegate_;
// Configuation data for RLZ tracker. Set by call to Init().
bool first_run_;
diff --git a/components/rlz/rlz_tracker_unittest.cc b/components/rlz/rlz_tracker_unittest.cc
index a9d2950..31dc27df 100644
--- a/components/rlz/rlz_tracker_unittest.cc
+++ b/components/rlz/rlz_tracker_unittest.cc
@@ -4,9 +4,11 @@
#include "components/rlz/rlz_tracker.h"
+#include <memory>
+
#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/strings/utf_string_conversions.h"
#include "base/test/sequenced_worker_pool_owner.h"
@@ -257,7 +259,7 @@
base::MessageLoop message_loop_;
TestRLZTrackerDelegate* delegate_;
- scoped_ptr<TestRLZTracker> tracker_;
+ std::unique_ptr<TestRLZTracker> tracker_;
RlzLibTestNoMachineStateHelper m_rlz_test_helper_;
};
@@ -267,7 +269,7 @@
delegate_ = new TestRLZTrackerDelegate;
tracker_.reset(new TestRLZTracker());
- RLZTracker::SetRlzDelegate(make_scoped_ptr(delegate_));
+ RLZTracker::SetRlzDelegate(base::WrapUnique(delegate_));
// Make sure a non-organic brand code is set in the registry or the RLZTracker
// is pretty much a no-op.
diff --git a/components/safe_json/json_sanitizer.cc b/components/safe_json/json_sanitizer.cc
index 3cffc52..3ad634d 100644
--- a/components/safe_json/json_sanitizer.cc
+++ b/components/safe_json/json_sanitizer.cc
@@ -34,7 +34,7 @@
friend std::default_delete<OopJsonSanitizer>;
~OopJsonSanitizer() {}
- void OnParseSuccess(scoped_ptr<base::Value> value);
+ void OnParseSuccess(std::unique_ptr<base::Value> value);
void OnParseError(const std::string& error);
StringCallback success_callback_;
@@ -54,9 +54,9 @@
base::Unretained(this)));
}
-void OopJsonSanitizer::OnParseSuccess(scoped_ptr<base::Value> value) {
+void OopJsonSanitizer::OnParseSuccess(std::unique_ptr<base::Value> value) {
// Self-destruct at the end of this method.
- scoped_ptr<OopJsonSanitizer> deleter(this);
+ std::unique_ptr<OopJsonSanitizer> deleter(this);
// A valid JSON document may only have a dictionary or list as its top-level
// type, but the JSON parser also accepts other types, so we filter them out.
diff --git a/components/safe_json/json_sanitizer.h b/components/safe_json/json_sanitizer.h
index 072cd75d..a1c9fc3b 100644
--- a/components/safe_json/json_sanitizer.h
+++ b/components/safe_json/json_sanitizer.h
@@ -10,7 +10,6 @@
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#if defined(OS_ANDROID)
diff --git a/components/safe_json/json_sanitizer_unittest.cc b/components/safe_json/json_sanitizer_unittest.cc
index 6571eb6..7caa099 100644
--- a/components/safe_json/json_sanitizer_unittest.cc
+++ b/components/safe_json/json_sanitizer_unittest.cc
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/safe_json/json_sanitizer.h"
+
+#include <memory>
+
#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "build/build_config.h"
-#include "components/safe_json/json_sanitizer.h"
#include "components/safe_json/safe_json_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -54,20 +56,20 @@
std::string error_;
State state_;
- scoped_ptr<base::RunLoop> run_loop_;
+ std::unique_ptr<base::RunLoop> run_loop_;
};
void JsonSanitizerTest::CheckSuccess(const std::string& json) {
SCOPED_TRACE(json);
Sanitize(json);
- scoped_ptr<base::Value> parsed = base::JSONReader::Read(json);
+ std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
ASSERT_TRUE(parsed);
EXPECT_EQ(State::STATE_SUCCESS, state_) << "Error: " << error_;
// The JSON parser should accept the result.
int error_code;
std::string error;
- scoped_ptr<base::Value> reparsed = base::JSONReader::ReadAndReturnError(
+ std::unique_ptr<base::Value> reparsed = base::JSONReader::ReadAndReturnError(
result_, base::JSON_PARSE_RFC, &error_code, &error);
EXPECT_TRUE(reparsed)
<< "Invalid result: " << error;
diff --git a/components/safe_json/safe_json_parser.h b/components/safe_json/safe_json_parser.h
index 962dfa6..6b66ba43 100644
--- a/components/safe_json/safe_json_parser.h
+++ b/components/safe_json/safe_json_parser.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_H_
#define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
class Value;
@@ -23,7 +23,7 @@
// deletes itself.
class SafeJsonParser {
public:
- using SuccessCallback = base::Callback<void(scoped_ptr<base::Value>)>;
+ using SuccessCallback = base::Callback<void(std::unique_ptr<base::Value>)>;
using ErrorCallback = base::Callback<void(const std::string&)>;
using Factory = SafeJsonParser* (*)(const std::string& unsafe_json,
diff --git a/components/safe_json/safe_json_parser_android.cc b/components/safe_json/safe_json_parser_android.cc
index 3bfe628d..0994ef5 100644
--- a/components/safe_json/safe_json_parser_android.cc
+++ b/components/safe_json/safe_json_parser_android.cc
@@ -35,11 +35,11 @@
void SafeJsonParserAndroid::OnSanitizationSuccess(
const std::string& sanitized_json) {
// Self-destruct at the end of this method.
- scoped_ptr<SafeJsonParserAndroid> deleter(this);
+ std::unique_ptr<SafeJsonParserAndroid> deleter(this);
int error_code;
std::string error;
- scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
+ std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
sanitized_json, base::JSON_PARSE_RFC, &error_code, &error);
if (!value) {
diff --git a/components/safe_json/safe_json_parser_impl.h b/components/safe_json/safe_json_parser_impl.h
index 7b96c79..5f29bc03 100644
--- a/components/safe_json/safe_json_parser_impl.h
+++ b/components/safe_json/safe_json_parser_impl.h
@@ -5,11 +5,11 @@
#ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_
#define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/safe_json/safe_json_parser.h"
#include "content/public/browser/utility_process_host_client.h"
@@ -54,7 +54,7 @@
ErrorCallback error_callback_;
scoped_refptr<base::SequencedTaskRunner> caller_task_runner_;
- scoped_ptr<base::Value> parsed_json_;
+ std::unique_ptr<base::Value> parsed_json_;
std::string error_;
DISALLOW_COPY_AND_ASSIGN(SafeJsonParserImpl);
diff --git a/components/safe_json/safe_json_parser_message_filter.cc b/components/safe_json/safe_json_parser_message_filter.cc
index 8e898e52..26cbaf48 100644
--- a/components/safe_json/safe_json_parser_message_filter.cc
+++ b/components/safe_json/safe_json_parser_message_filter.cc
@@ -4,6 +4,7 @@
#include "components/safe_json/safe_json_parser_message_filter.h"
+#include <memory>
#include <utility>
#include "base/json/json_reader.h"
@@ -42,7 +43,7 @@
void SafeJsonParserMessageFilter::OnParseJSON(const std::string& json) {
int error_code;
std::string error;
- scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
+ std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
json, base::JSON_PARSE_RFC, &error_code, &error);
if (value) {
base::ListValue wrapper;
diff --git a/components/safe_json/testing_json_parser.cc b/components/safe_json/testing_json_parser.cc
index f7c8119..ec24bc90 100644
--- a/components/safe_json/testing_json_parser.cc
+++ b/components/safe_json/testing_json_parser.cc
@@ -4,11 +4,12 @@
#include "components/safe_json/testing_json_parser.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/json/json_reader.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/values.h"
@@ -45,7 +46,7 @@
void TestingJsonParser::Start() {
int error_code;
std::string error;
- scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
+ std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
unsafe_json_, base::JSON_PARSE_RFC, &error_code, &error);
// Run the callback asynchronously. Post the delete task first, so that the
diff --git a/components/safe_json/testing_json_parser_unittest.cc b/components/safe_json/testing_json_parser_unittest.cc
index 20ad641..1e944a9 100644
--- a/components/safe_json/testing_json_parser_unittest.cc
+++ b/components/safe_json/testing_json_parser_unittest.cc
@@ -4,6 +4,8 @@
#include "components/safe_json/testing_json_parser.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/callback.h"
#include "base/message_loop/message_loop.h"
@@ -34,7 +36,7 @@
private:
static void SuccessCallback(TestingJsonParserTest* test,
base::Closure quit_closure,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
test->did_success_ = true;
quit_closure.Run();
diff --git a/components/search/search_android_unittest.cc b/components/search/search_android_unittest.cc
index a778e7d..063ec1a 100644
--- a/components/search/search_android_unittest.cc
+++ b/components/search/search_android_unittest.cc
@@ -5,7 +5,6 @@
#include "components/search/search.h"
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/statistics_recorder.h"
#include "components/search/search.h"
diff --git a/components/search/search_unittest.cc b/components/search/search_unittest.cc
index e8cf6c09..622ecd5 100644
--- a/components/search/search_unittest.cc
+++ b/components/search/search_unittest.cc
@@ -4,7 +4,8 @@
#include "components/search/search.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/metrics/field_trial.h"
#include "base/metrics/statistics_recorder.h"
#include "build/build_config.h"
@@ -22,7 +23,7 @@
}
private:
- scoped_ptr<base::FieldTrialList> field_trial_list_;
+ std::unique_ptr<base::FieldTrialList> field_trial_list_;
};
TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoEmptyAndValid) {
diff --git a/components/security_interstitials/core/bad_clock_ui.h b/components/security_interstitials/core/bad_clock_ui.h
index 3d41343b..35a0250 100644
--- a/components/security_interstitials/core/bad_clock_ui.h
+++ b/components/security_interstitials/core/bad_clock_ui.h
@@ -6,7 +6,6 @@
#define COMPONENTS_SECURITY_INTERSTITIALS_CORE_BAD_CLOCK_UI_H_
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/security_interstitials/core/controller_client.h"
diff --git a/components/security_interstitials/core/controller_client.cc b/components/security_interstitials/core/controller_client.cc
index c4eb2f1..a17f3f1 100644
--- a/components/security_interstitials/core/controller_client.cc
+++ b/components/security_interstitials/core/controller_client.cc
@@ -30,7 +30,7 @@
}
void ControllerClient::set_metrics_helper(
- scoped_ptr<MetricsHelper> metrics_helper) {
+ std::unique_ptr<MetricsHelper> metrics_helper) {
metrics_helper_ = std::move(metrics_helper);
}
diff --git a/components/security_interstitials/core/controller_client.h b/components/security_interstitials/core/controller_client.h
index 03af2e7..2aced84c 100644
--- a/components/security_interstitials/core/controller_client.h
+++ b/components/security_interstitials/core/controller_client.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_
#define COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
class GURL;
class PrefService;
@@ -76,7 +76,7 @@
virtual void Reload() = 0;
MetricsHelper* metrics_helper() const;
- void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper);
+ void set_metrics_helper(std::unique_ptr<MetricsHelper> metrics_helper);
virtual void OpenUrlInCurrentTab(const GURL& url) = 0;
@@ -86,7 +86,7 @@
virtual const std::string GetExtendedReportingPrefName() = 0;
private:
- scoped_ptr<MetricsHelper> metrics_helper_;
+ std::unique_ptr<MetricsHelper> metrics_helper_;
DISALLOW_COPY_AND_ASSIGN(ControllerClient);
};
diff --git a/components/security_interstitials/core/metrics_helper.cc b/components/security_interstitials/core/metrics_helper.cc
index d55a37c..ee1724c2 100644
--- a/components/security_interstitials/core/metrics_helper.cc
+++ b/components/security_interstitials/core/metrics_helper.cc
@@ -4,6 +4,7 @@
#include "components/security_interstitials/core/metrics_helper.h"
+#include <memory>
#include <utility>
#include "base/metrics/histogram.h"
@@ -166,7 +167,7 @@
if (!rappor_service_ || (decision != PROCEED && decision != DONT_PROCEED))
return;
- scoped_ptr<rappor::Sample> sample =
+ std::unique_ptr<rappor::Sample> sample =
rappor_service_->CreateSample(settings_.rappor_report_type);
// This will populate, for example, "intersitial.malware.domain" or
diff --git a/components/session_manager/core/session_manager.h b/components/session_manager/core/session_manager.h
index 9da9c455..c1fdc864 100644
--- a/components/session_manager/core/session_manager.h
+++ b/components/session_manager/core/session_manager.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
#define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/session_manager/session_manager_export.h"
namespace session_manager {
@@ -73,7 +74,7 @@
static SessionManager* instance;
SessionState session_state_;
- scoped_ptr<SessionManagerDelegate> delegate_;
+ std::unique_ptr<SessionManagerDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(SessionManager);
};
diff --git a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc
index c15e72b..612b9db 100644
--- a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc
+++ b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc
@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/ssl_config/ssl_config_service_manager.h"
-
+#include <memory>
#include <utility>
#include "base/feature_list.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/prefs/testing_pref_service.h"
#include "components/ssl_config/ssl_config_prefs.h"
+#include "components/ssl_config/ssl_config_service_manager.h"
#include "components/ssl_config/ssl_config_switches.h"
#include "net/ssl/ssl_config.h"
#include "net/ssl/ssl_config_service.h"
@@ -37,7 +36,7 @@
TestingPrefServiceSimple local_state;
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -55,7 +54,7 @@
TestingPrefServiceSimple local_state;
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -91,7 +90,7 @@
TestingPrefServiceSimple local_state;
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -129,7 +128,7 @@
TestingPrefServiceSimple local_state;
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -165,7 +164,7 @@
new base::StringValue("ssl3"));
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -187,7 +186,7 @@
new base::StringValue("tls1"));
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
ASSERT_TRUE(config_manager.get());
@@ -204,7 +203,7 @@
TEST_F(SSLConfigServiceManagerPrefTest, TLSFallbackFeature) {
// Toggle the feature.
base::FeatureList::ClearInstanceForTesting();
- scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
feature_list->InitializeFromCommandLine("SSLVersionFallbackTLSv1.1",
std::string());
base::FeatureList::SetInstance(std::move(feature_list));
@@ -212,7 +211,7 @@
TestingPrefServiceSimple local_state;
SSLConfigServiceManager::RegisterPrefs(local_state.registry());
- scoped_ptr<SSLConfigServiceManager> config_manager(
+ std::unique_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(
&local_state, base::ThreadTaskRunnerHandle::Get()));
scoped_refptr<SSLConfigService> config_service(config_manager->Get());
diff --git a/components/ssl_errors/error_classification_unittest.cc b/components/ssl_errors/error_classification_unittest.cc
index 770da986..a4bb9eb 100644
--- a/components/ssl_errors/error_classification_unittest.cc
+++ b/components/ssl_errors/error_classification_unittest.cc
@@ -5,6 +5,7 @@
#include "components/ssl_errors/error_classification.h"
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h"
#include "base/time/default_clock.h"
#include "base/time/default_tick_clock.h"
@@ -189,8 +190,8 @@
TestingPrefServiceSimple pref_service;
network_time::NetworkTimeTracker::RegisterPrefs(pref_service.registry());
network_time::NetworkTimeTracker network_time_tracker(
- make_scoped_ptr(new base::DefaultClock()),
- make_scoped_ptr(new base::DefaultTickClock()), &pref_service);
+ base::WrapUnique(new base::DefaultClock()),
+ base::WrapUnique(new base::DefaultTickClock()), &pref_service);
EXPECT_EQ(
ssl_errors::ClockState::CLOCK_STATE_UNKNOWN,
ssl_errors::GetClockState(base::Time::Now(), &network_time_tracker));
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.cc b/components/startup_metric_utils/browser/startup_metric_utils.cc
index 8f1ea3c4..d2d6444 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.cc
+++ b/components/startup_metric_utils/browser/startup_metric_utils.cc
@@ -6,11 +6,12 @@
#include <stddef.h>
+#include <memory>
+
#include "base/containers/hash_tables.h"
#include "base/environment.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/process/process_info.h"
@@ -350,7 +351,7 @@
// Returns the time of main entry recorded from RecordExeMainEntryTime.
base::TimeTicks ExeMainEntryPointTicks() {
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string ticks_string;
int64_t time_int = 0;
if (env->GetVar(kChromeMainTicksEnvVar, &ticks_string) &&
@@ -537,7 +538,7 @@
void RecordExeMainEntryPointTime(const base::Time& time) {
const std::string exe_load_ticks =
base::Int64ToString(StartupTimeToTimeTicks(time).ToInternalValue());
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
env->SetVar(kChromeMainTicksEnvVar, exe_load_ticks);
}
diff --git a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
index 5778d02..bed524ad 100644
--- a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
+++ b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
@@ -6,7 +6,6 @@
#include "base/callback.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
diff --git a/components/sync_bookmarks/bookmark_change_processor.cc b/components/sync_bookmarks/bookmark_change_processor.cc
index 4645f70..385a1958 100644
--- a/components/sync_bookmarks/bookmark_change_processor.cc
+++ b/components/sync_bookmarks/bookmark_change_processor.cc
@@ -871,12 +871,12 @@
}
// static
-scoped_ptr<BookmarkNode::MetaInfoMap>
+std::unique_ptr<BookmarkNode::MetaInfoMap>
BookmarkChangeProcessor::GetBookmarkMetaInfo(
const syncer::BaseNode* sync_node) {
const sync_pb::BookmarkSpecifics& specifics =
sync_node->GetBookmarkSpecifics();
- scoped_ptr<BookmarkNode::MetaInfoMap> meta_info_map(
+ std::unique_ptr<BookmarkNode::MetaInfoMap> meta_info_map(
new BookmarkNode::MetaInfoMap);
for (int i = 0; i < specifics.meta_info_size(); ++i) {
(*meta_info_map)[specifics.meta_info(i).key()] =
diff --git a/components/sync_bookmarks/bookmark_change_processor.h b/components/sync_bookmarks/bookmark_change_processor.h
index dff812b..ea7ea17 100644
--- a/components/sync_bookmarks/bookmark_change_processor.h
+++ b/components/sync_bookmarks/bookmark_change_processor.h
@@ -187,8 +187,8 @@
};
// Retrieves the meta info from the given sync node.
- static scoped_ptr<bookmarks::BookmarkNode::MetaInfoMap> GetBookmarkMetaInfo(
- const syncer::BaseNode* sync_node);
+ static std::unique_ptr<bookmarks::BookmarkNode::MetaInfoMap>
+ GetBookmarkMetaInfo(const syncer::BaseNode* sync_node);
// Sets the meta info of the given sync node from the given bookmark node.
static void SetSyncNodeMetaInfo(const bookmarks::BookmarkNode* node,
diff --git a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc b/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
index ad96743..f9bba73 100644
--- a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
+++ b/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
@@ -4,10 +4,12 @@
#include "components/sync_bookmarks/bookmark_data_type_controller.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
@@ -88,7 +90,7 @@
void CreateBookmarkModel(BookmarkLoadPolicy bookmark_load_policy) {
bookmark_model_.reset(new BookmarkModel(
- make_scoped_ptr(new bookmarks::TestBookmarkClient())));
+ base::WrapUnique(new bookmarks::TestBookmarkClient())));
if (bookmark_load_policy == LOAD_MODEL) {
TestingPrefServiceSimple prefs;
bookmark_model_->Load(&prefs, base::FilePath(),
@@ -135,9 +137,9 @@
base::MessageLoop message_loop_;
scoped_refptr<BookmarkDataTypeController> bookmark_dtc_;
- scoped_ptr<SyncApiComponentFactoryMock> profile_sync_factory_;
- scoped_ptr<BookmarkModel> bookmark_model_;
- scoped_ptr<HistoryMock> history_service_;
+ std::unique_ptr<SyncApiComponentFactoryMock> profile_sync_factory_;
+ std::unique_ptr<BookmarkModel> bookmark_model_;
+ std::unique_ptr<HistoryMock> history_service_;
sync_driver::FakeSyncService service_;
ModelAssociatorMock* model_associator_;
ChangeProcessorMock* change_processor_;
diff --git a/components/sync_bookmarks/bookmark_model_associator.cc b/components/sync_bookmarks/bookmark_model_associator.cc
index d5d445f..fbf7130 100644
--- a/components/sync_bookmarks/bookmark_model_associator.cc
+++ b/components/sync_bookmarks/bookmark_model_associator.cc
@@ -4,6 +4,8 @@
#include "components/sync_bookmarks/bookmark_model_associator.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/containers/hash_tables.h"
@@ -454,7 +456,7 @@
if (error.IsSet())
return error;
- scoped_ptr<ScopedAssociationUpdater> association_updater(
+ std::unique_ptr<ScopedAssociationUpdater> association_updater(
new ScopedAssociationUpdater(bookmark_model_));
DisassociateModels();
diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc
index 4762ea8..2a4601d 100644
--- a/components/test/run_all_unittests.cc
+++ b/components/test/run_all_unittests.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/statistics_recorder.h"
#include "base/path_service.h"
#include "base/test/launcher/unit_test_launcher.h"
@@ -133,7 +134,7 @@
private:
#if !defined(OS_IOS)
- scoped_ptr<content::TestContentClientInitializer> content_initializer_;
+ std::unique_ptr<content::TestContentClientInitializer> content_initializer_;
#endif
DISALLOW_COPY_AND_ASSIGN(ComponentsUnitTestEventListener);
diff --git a/components/test_runner/app_banner_client.cc b/components/test_runner/app_banner_client.cc
index de85dc88..06ff8b3 100644
--- a/components/test_runner/app_banner_client.cc
+++ b/components/test_runner/app_banner_client.cc
@@ -5,7 +5,6 @@
#include "components/test_runner/app_banner_client.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerPromptResult.h"
namespace test_runner {
diff --git a/components/test_runner/event_sender.h b/components/test_runner/event_sender.h
index 6b54977..692f48e 100644
--- a/components/test_runner/event_sender.h
+++ b/components/test_runner/event_sender.h
@@ -7,13 +7,13 @@
#include <stdint.h>
+#include <memory>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "third_party/WebKit/public/platform/WebDragData.h"
@@ -265,7 +265,7 @@
bool touch_cancelable_;
std::vector<blink::WebTouchPoint> touch_points_;
- scoped_ptr<blink::WebContextMenuData> last_context_menu_data_;
+ std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_;
blink::WebDragData current_drag_data_;
diff --git a/components/test_runner/mock_credential_manager_client.h b/components/test_runner/mock_credential_manager_client.h
index 34c2974..5996536 100644
--- a/components/test_runner/mock_credential_manager_client.h
+++ b/components/test_runner/mock_credential_manager_client.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_TEST_RUNNER_MOCK_CREDENTIAL_MANAGER_CLIENT_H_
#define COMPONENTS_TEST_RUNNER_MOCK_CREDENTIAL_MANAGER_CLIENT_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerClient.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
#include "third_party/WebKit/public/platform/WebVector.h"
@@ -38,7 +39,7 @@
RequestCallbacks* callbacks) override;
private:
- scoped_ptr<blink::WebCredential> credential_;
+ std::unique_ptr<blink::WebCredential> credential_;
blink::WebCredentialManagerError error_;
DISALLOW_COPY_AND_ASSIGN(MockCredentialManagerClient);
diff --git a/components/test_runner/pixel_dump.cc b/components/test_runner/pixel_dump.cc
index b2bd91a..0046edea 100644
--- a/components/test_runner/pixel_dump.cc
+++ b/components/test_runner/pixel_dump.cc
@@ -4,11 +4,12 @@
#include "components/test_runner/pixel_dump.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "components/test_runner/layout_test_runtime_flags.h"
@@ -84,7 +85,7 @@
canvas->drawIRect(rect, paint);
}
-void CapturePixelsForPrinting(scoped_ptr<PixelsDumpRequest> dump_request) {
+void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) {
dump_request->web_view->updateAllLifecyclePhases();
blink::WebSize page_size_in_pixels = dump_request->web_view->size();
@@ -132,7 +133,7 @@
delete this;
}
-void DidCapturePixelsAsync(scoped_ptr<PixelsDumpRequest> dump_request,
+void DidCapturePixelsAsync(std::unique_ptr<PixelsDumpRequest> dump_request,
const SkBitmap& bitmap) {
SkCanvas canvas(bitmap);
DrawSelectionRect(*dump_request, &canvas);
@@ -150,7 +151,7 @@
DCHECK(!callback.is_null());
DCHECK(!layout_test_runtime_flags.dump_drag_image());
- scoped_ptr<PixelsDumpRequest> pixels_request(
+ std::unique_ptr<PixelsDumpRequest> pixels_request(
new PixelsDumpRequest(web_view, layout_test_runtime_flags, callback));
if (layout_test_runtime_flags.is_printing()) {
diff --git a/components/test_runner/test_interfaces.h b/components/test_runner/test_interfaces.h
index af1a030a..6b534a0 100644
--- a/components/test_runner/test_interfaces.h
+++ b/components/test_runner/test_interfaces.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_TEST_RUNNER_TEST_INTERFACES_H_
#define COMPONENTS_TEST_RUNNER_TEST_INTERFACES_H_
+#include <memory>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/test_runner/mock_web_theme_engine.h"
#include "third_party/WebKit/public/platform/WebNonCopyable.h"
@@ -54,12 +54,12 @@
private:
base::WeakPtr<GamepadController> gamepad_controller_;
- scoped_ptr<TestRunner> test_runner_;
+ std::unique_ptr<TestRunner> test_runner_;
WebTestDelegate* delegate_;
AppBannerClient* app_banner_client_;
std::vector<WebTestProxyBase*> window_list_;
- scoped_ptr<MockWebThemeEngine> theme_engine_;
+ std::unique_ptr<MockWebThemeEngine> theme_engine_;
DISALLOW_COPY_AND_ASSIGN(TestInterfaces);
};
diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc
index 5b8a0fd..5a83df49 100644
--- a/components/test_runner/test_plugin.cc
+++ b/components/test_runner/test_plugin.cc
@@ -6,10 +6,12 @@
#include <stddef.h>
#include <stdint.h>
+
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/shared_memory.h"
#include "base/strings/stringprintf.h"
#include "cc/blink/web_layer_impl.h"
@@ -106,13 +108,13 @@
class DeferredDeleteTask : public blink::WebTaskRunner::Task {
public:
- DeferredDeleteTask(scoped_ptr<TestPlugin> plugin)
+ DeferredDeleteTask(std::unique_ptr<TestPlugin> plugin)
: plugin_(std::move(plugin)) {}
void run() override {}
private:
- scoped_ptr<TestPlugin> plugin_;
+ std::unique_ptr<TestPlugin> plugin_;
};
} // namespace
@@ -184,7 +186,7 @@
DCHECK(!container->element().document().isNull());
blink::WebURL url = container->element().document().url();
blink::Platform::GraphicsInfo gl_info;
- context_provider_ = make_scoped_ptr(
+ context_provider_ = base::WrapUnique(
blink::Platform::current()->createOffscreenGraphicsContext3DProvider(
attrs, url, nullptr, &gl_info));
context_ = context_provider_ ? context_provider_->context3d() : nullptr;
@@ -194,7 +196,7 @@
return false;
layer_ = cc::TextureLayer::CreateForMailbox(this);
- web_layer_ = make_scoped_ptr(new cc_blink::WebLayerImpl(layer_));
+ web_layer_ = base::WrapUnique(new cc_blink::WebLayerImpl(layer_));
container_->setWebLayer(web_layer_.get());
if (re_request_touch_events_) {
container_->requestTouchEventType(
@@ -224,7 +226,7 @@
blink::Platform::current()->mainThread()->getWebTaskRunner()->postTask(
blink::WebTraceLocation(__FUNCTION__, __FILE__),
- new DeferredDeleteTask(make_scoped_ptr(this)));
+ new DeferredDeleteTask(base::WrapUnique(this)));
}
blink::WebPluginContainer* TestPlugin::container() const {
@@ -277,7 +279,7 @@
gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
texture_mailbox_ = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D);
} else {
- scoped_ptr<cc::SharedBitmap> bitmap =
+ std::unique_ptr<cc::SharedBitmap> bitmap =
delegate_->GetSharedBitmapManager()->AllocateSharedBitmap(
gfx::Rect(rect_).size());
if (!bitmap) {
@@ -301,13 +303,13 @@
static void IgnoreReleaseCallback(const gpu::SyncToken& sync_token, bool lost) {
}
-static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap,
+static void ReleaseSharedMemory(std::unique_ptr<cc::SharedBitmap> bitmap,
const gpu::SyncToken& sync_token,
bool lost) {}
bool TestPlugin::PrepareTextureMailbox(
cc::TextureMailbox* mailbox,
- scoped_ptr<cc::SingleReleaseCallback>* release_callback,
+ std::unique_ptr<cc::SingleReleaseCallback>* release_callback,
bool use_shared_memory) {
if (!mailbox_changed_)
return false;
diff --git a/components/test_runner/test_plugin.h b/components/test_runner/test_plugin.h
index 7a96bafd..6299b153 100644
--- a/components/test_runner/test_plugin.h
+++ b/components/test_runner/test_plugin.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_
#define COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "cc/layers/texture_layer.h"
#include "cc/layers/texture_layer_client.h"
#include "third_party/WebKit/public/platform/WebExternalTextureLayer.h"
@@ -99,7 +99,7 @@
// cc::TextureLayerClient methods:
bool PrepareTextureMailbox(
cc::TextureMailbox* mailbox,
- scoped_ptr<cc::SingleReleaseCallback>* release_callback,
+ std::unique_ptr<cc::SingleReleaseCallback>* release_callback,
bool use_shared_memory) override;
private:
@@ -158,17 +158,17 @@
blink::WebPluginContainer* container_;
blink::WebRect rect_;
- scoped_ptr<blink::WebGraphicsContext3DProvider> context_provider_;
+ std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_;
blink::WebGraphicsContext3D* context_;
gpu::gles2::GLES2Interface* gl_;
GLuint color_texture_;
cc::TextureMailbox texture_mailbox_;
- scoped_ptr<cc::SharedBitmap> shared_bitmap_;
+ std::unique_ptr<cc::SharedBitmap> shared_bitmap_;
bool mailbox_changed_;
GLuint framebuffer_;
Scene scene_;
scoped_refptr<cc::TextureLayer> layer_;
- scoped_ptr<blink::WebLayer> web_layer_;
+ std::unique_ptr<blink::WebLayer> web_layer_;
blink::WebPluginContainer::TouchEventRequestType touch_event_request_;
// Requests touch events from the WebPluginContainerImpl multiple times to
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 5fd5a1b3..f97ed57 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -78,7 +78,7 @@
WebString V8StringToWebString(v8::Local<v8::String> v8_str) {
int length = v8_str->Utf8Length() + 1;
- scoped_ptr<char[]> chars(new char[length]);
+ std::unique_ptr<char[]> chars(new char[length]);
v8_str->WriteUtf8(chars.get(), length);
return WebString::fromUTF8(chars.get());
}
diff --git a/components/test_runner/test_runner.h b/components/test_runner/test_runner.h
index 8ea7370..2bf0bfc 100644
--- a/components/test_runner/test_runner.h
+++ b/components/test_runner/test_runner.h
@@ -8,12 +8,12 @@
#include <stdint.h>
#include <deque>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/test_runner/layout_test_runtime_flags.h"
#include "components/test_runner/test_runner_export.h"
@@ -750,7 +750,7 @@
blink::WebFrame* top_loading_frame_;
// WebContentSettingsClient mock object.
- scoped_ptr<MockContentSettingsClient> mock_content_settings_client_;
+ std::unique_ptr<MockContentSettingsClient> mock_content_settings_client_;
bool pointer_locked_;
enum {
@@ -760,11 +760,11 @@
} pointer_lock_planned_result_;
bool use_mock_theme_;
- scoped_ptr<MockCredentialManagerClient> credential_manager_client_;
- scoped_ptr<MockScreenOrientationClient> mock_screen_orientation_client_;
- scoped_ptr<MockWebSpeechRecognizer> speech_recognizer_;
- scoped_ptr<MockWebUserMediaClient> user_media_client_;
- scoped_ptr<SpellCheckClient> spellcheck_;
+ std::unique_ptr<MockCredentialManagerClient> credential_manager_client_;
+ std::unique_ptr<MockScreenOrientationClient> mock_screen_orientation_client_;
+ std::unique_ptr<MockWebSpeechRecognizer> speech_recognizer_;
+ std::unique_ptr<MockWebUserMediaClient> user_media_client_;
+ std::unique_ptr<SpellCheckClient> spellcheck_;
// Number of currently active color choosers.
int chooser_count_;
diff --git a/components/test_runner/tracked_dictionary.cc b/components/test_runner/tracked_dictionary.cc
index 5b78ea0..2903f6156 100644
--- a/components/test_runner/tracked_dictionary.cc
+++ b/components/test_runner/tracked_dictionary.cc
@@ -6,6 +6,8 @@
#include <utility>
+#include "base/memory/ptr_util.h"
+
namespace test_runner {
TrackedDictionary::TrackedDictionary() {}
@@ -25,7 +27,7 @@
}
void TrackedDictionary::Set(const std::string& path,
- scoped_ptr<base::Value> new_value) {
+ std::unique_ptr<base::Value> new_value) {
// Is this truly a *new* value?
const base::Value* old_value;
if (current_values_.Get(path, &old_value)) {
@@ -38,12 +40,12 @@
}
void TrackedDictionary::SetBoolean(const std::string& path, bool new_value) {
- Set(path, make_scoped_ptr(new base::FundamentalValue(new_value)));
+ Set(path, base::WrapUnique(new base::FundamentalValue(new_value)));
}
void TrackedDictionary::SetString(const std::string& path,
const std::string& new_value) {
- Set(path, make_scoped_ptr(new base::StringValue(new_value)));
+ Set(path, base::WrapUnique(new base::StringValue(new_value)));
}
} // namespace test_runner
diff --git a/components/test_runner/tracked_dictionary.h b/components/test_runner/tracked_dictionary.h
index 7b7182d..b9b8f5ec 100644
--- a/components/test_runner/tracked_dictionary.h
+++ b/components/test_runner/tracked_dictionary.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_TEST_RUNNER_TRACKED_DICTIONARY_H_
#define COMPONENTS_TEST_RUNNER_TRACKED_DICTIONARY_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/test_runner/test_runner_export.h"
@@ -40,7 +40,7 @@
void ApplyUntrackedChanges(const base::DictionaryValue& new_changes);
// Sets a value in |current_values| and tracks the change in |changed_values|.
- void Set(const std::string& path, scoped_ptr<base::Value> new_value);
+ void Set(const std::string& path, std::unique_ptr<base::Value> new_value);
// Type-specific setter for convenience.
void SetBoolean(const std::string& path, bool new_value);
diff --git a/components/test_runner/web_frame_test_client.cc b/components/test_runner/web_frame_test_client.cc
index 7f183aa..0af3bab 100644
--- a/components/test_runner/web_frame_test_client.cc
+++ b/components/test_runner/web_frame_test_client.cc
@@ -4,8 +4,9 @@
#include "components/test_runner/web_frame_test_client.h"
+#include <memory>
+
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -759,7 +760,7 @@
const blink::WebString& sink_id,
const blink::WebSecurityOrigin& security_origin,
blink::WebSetSinkIdCallbacks* web_callbacks) {
- scoped_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks);
+ std::unique_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks);
std::string device_id = sink_id.utf8();
if (device_id == "valid" || device_id.empty())
callback->onSuccess();
diff --git a/components/test_runner/web_frame_test_proxy.h b/components/test_runner/web_frame_test_proxy.h
index d2b6ec1..00174c18 100644
--- a/components/test_runner/web_frame_test_proxy.h
+++ b/components/test_runner/web_frame_test_proxy.h
@@ -5,11 +5,11 @@
#ifndef COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_
#define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_
+#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/test_runner/test_runner_export.h"
#include "components/test_runner/web_frame_test_client.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -20,7 +20,7 @@
class TEST_RUNNER_EXPORT WebFrameTestProxyBase {
public:
- void set_test_client(scoped_ptr<WebFrameTestClient> client) {
+ void set_test_client(std::unique_ptr<WebFrameTestClient> client) {
DCHECK(client);
DCHECK(!test_client_);
test_client_ = std::move(client);
@@ -32,7 +32,7 @@
blink::WebFrameClient* test_client() { return test_client_.get(); }
private:
- scoped_ptr<WebFrameTestClient> test_client_;
+ std::unique_ptr<WebFrameTestClient> test_client_;
DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxyBase);
};
diff --git a/components/test_runner/web_test_interfaces.cc b/components/test_runner/web_test_interfaces.cc
index 6fdce47..374636a 100644
--- a/components/test_runner/web_test_interfaces.cc
+++ b/components/test_runner/web_test_interfaces.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "components/test_runner/app_banner_client.h"
#include "components/test_runner/mock_web_audio_device.h"
#include "components/test_runner/mock_web_media_stream_center.h"
@@ -80,24 +81,24 @@
return new MockWebAudioDevice(sample_rate);
}
-scoped_ptr<blink::WebAppBannerClient>
+std::unique_ptr<blink::WebAppBannerClient>
WebTestInterfaces::CreateAppBannerClient() {
- scoped_ptr<AppBannerClient> client(new AppBannerClient);
+ std::unique_ptr<AppBannerClient> client(new AppBannerClient);
interfaces_->SetAppBannerClient(client.get());
return std::move(client);
}
-scoped_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient(
+std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient(
WebTestProxyBase* web_test_proxy_base) {
- return make_scoped_ptr(new WebFrameTestClient(interfaces_->GetTestRunner(),
- interfaces_->GetDelegate(),
- web_test_proxy_base));
+ return base::WrapUnique(new WebFrameTestClient(interfaces_->GetTestRunner(),
+ interfaces_->GetDelegate(),
+ web_test_proxy_base));
}
-scoped_ptr<WebViewTestClient> WebTestInterfaces::CreateWebViewTestClient(
+std::unique_ptr<WebViewTestClient> WebTestInterfaces::CreateWebViewTestClient(
WebTestProxyBase* web_test_proxy_base) {
- return make_scoped_ptr(new WebViewTestClient(interfaces_->GetTestRunner(),
- web_test_proxy_base));
+ return base::WrapUnique(
+ new WebViewTestClient(interfaces_->GetTestRunner(), web_test_proxy_base));
}
std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() {
diff --git a/components/test_runner/web_test_interfaces.h b/components/test_runner/web_test_interfaces.h
index a1a6c0af..4a0d5a7 100644
--- a/components/test_runner/web_test_interfaces.h
+++ b/components/test_runner/web_test_interfaces.h
@@ -5,10 +5,10 @@
#ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_
#define COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_
+#include <memory>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/test_runner/test_runner_export.h"
namespace blink {
@@ -62,7 +62,7 @@
blink::WebAudioDevice* CreateAudioDevice(double sample_rate);
- scoped_ptr<blink::WebAppBannerClient> CreateAppBannerClient();
+ std::unique_ptr<blink::WebAppBannerClient> CreateAppBannerClient();
TestInterfaces* GetTestInterfaces();
@@ -70,21 +70,21 @@
// forwarding javascript console output to the test harness). The caller
// should guarantee that the returned object won't be used beyond the lifetime
// of WebTestInterfaces and/or the lifetime of |web_test_proxy_base|.
- scoped_ptr<WebFrameTestClient> CreateWebFrameTestClient(
+ std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient(
WebTestProxyBase* web_test_proxy_base);
// Creates a WebViewClient implementation providing test behavior (i.e.
// providing a mocked speech recognizer). The caller should guarantee that
// the returned pointer won't be used beyond the lifetime of WebTestInterfaces
// and/or the lifetime of |web_test_proxy_base|.
- scoped_ptr<WebViewTestClient> CreateWebViewTestClient(
+ std::unique_ptr<WebViewTestClient> CreateWebViewTestClient(
WebTestProxyBase* web_test_proxy_base);
// Gets a list of currently opened windows created by the current test.
std::vector<blink::WebView*> GetWindowList();
private:
- scoped_ptr<TestInterfaces> interfaces_;
+ std::unique_ptr<TestInterfaces> interfaces_;
DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces);
};
diff --git a/components/test_runner/web_test_proxy.h b/components/test_runner/web_test_proxy.h
index 53870f3..c8d5c64 100644
--- a/components/test_runner/web_test_proxy.h
+++ b/components/test_runner/web_test_proxy.h
@@ -5,12 +5,12 @@
#ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_
#define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_
+#include <memory>
#include <string>
#include <utility>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "components/test_runner/test_runner_export.h"
#include "components/test_runner/web_view_test_client.h"
@@ -69,7 +69,8 @@
web_view_ = view;
}
- void set_view_test_client(scoped_ptr<WebViewTestClient> view_test_client) {
+ void set_view_test_client(
+ std::unique_ptr<WebViewTestClient> view_test_client) {
DCHECK(view_test_client);
DCHECK(!view_test_client_);
view_test_client_ = std::move(view_test_client);
@@ -108,10 +109,10 @@
WebTestDelegate* delegate_;
blink::WebView* web_view_;
blink::WebWidget* web_widget_;
- scoped_ptr<WebViewTestClient> view_test_client_;
- scoped_ptr<AccessibilityController> accessibility_controller_;
- scoped_ptr<EventSender> event_sender_;
- scoped_ptr<TextInputController> text_input_controller_;
+ std::unique_ptr<WebViewTestClient> view_test_client_;
+ std::unique_ptr<AccessibilityController> accessibility_controller_;
+ std::unique_ptr<EventSender> event_sender_;
+ std::unique_ptr<TextInputController> text_input_controller_;
DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase);
};
diff --git a/components/timers/alarm_timer_chromeos.cc b/components/timers/alarm_timer_chromeos.cc
index 0cb25fa..1bdcd8a4 100644
--- a/components/timers/alarm_timer_chromeos.cc
+++ b/components/timers/alarm_timer_chromeos.cc
@@ -145,7 +145,7 @@
base::Closure on_timer_fired_callback_for_test_;
// Manages watching file descriptors.
- scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> fd_watcher_;
+ std::unique_ptr<base::MessageLoopForIO::FileDescriptorWatcher> fd_watcher_;
// The sequence numbers of the last Reset() call handled respectively on
// |origin_task_runner_| and on the MessageLoopForIO used for watching the
@@ -426,7 +426,8 @@
// Take ownership of the pending user task, which is going to be cleared by
// the Stop() or Reset() functions below.
- scoped_ptr<base::PendingTask> pending_user_task(std::move(pending_task_));
+ std::unique_ptr<base::PendingTask> pending_user_task(
+ std::move(pending_task_));
// Re-schedule or stop the timer as requested.
if (base::Timer::is_repeating())
diff --git a/components/timers/alarm_timer_chromeos.h b/components/timers/alarm_timer_chromeos.h
index 5c61f52..313c9f9 100644
--- a/components/timers/alarm_timer_chromeos.h
+++ b/components/timers/alarm_timer_chromeos.h
@@ -5,10 +5,11 @@
#ifndef COMPONENTS_TIMERS_ALARM_TIMER_CHROMEOS_H_
#define COMPONENTS_TIMERS_ALARM_TIMER_CHROMEOS_H_
+#include <memory>
+
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -68,7 +69,7 @@
// Keeps track of the user task we want to run. A new one is constructed
// every time Reset() is called.
- scoped_ptr<base::PendingTask> pending_task_;
+ std::unique_ptr<base::PendingTask> pending_task_;
// Tracks whether the timer has the ability to wake the system up from
// suspend. This is a runtime check because we won't know if the system
@@ -83,7 +84,7 @@
// Observes |origin_message_loop_| and informs this class if it will be
// destroyed.
class MessageLoopObserver;
- scoped_ptr<MessageLoopObserver> message_loop_observer_;
+ std::unique_ptr<MessageLoopObserver> message_loop_observer_;
base::WeakPtrFactory<AlarmTimer> weak_factory_;
diff --git a/components/timers/alarm_timer_unittest.cc b/components/timers/alarm_timer_unittest.cc
index 14c55a9..69ac9d36 100644
--- a/components/timers/alarm_timer_unittest.cc
+++ b/components/timers/alarm_timer_unittest.cc
@@ -4,6 +4,8 @@
#include <sys/timerfd.h>
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/macros.h"
@@ -57,7 +59,7 @@
bool* did_run_;
const base::TimeDelta delay_;
- scoped_ptr<timers::OneShotAlarmTimer> timer_;
+ std::unique_ptr<timers::OneShotAlarmTimer> timer_;
DISALLOW_COPY_AND_ASSIGN(OneShotAlarmTimerTester);
};
@@ -85,7 +87,7 @@
bool* did_run_;
const base::TimeDelta delay_;
- scoped_ptr<timers::OneShotAlarmTimer> timer_;
+ std::unique_ptr<timers::OneShotAlarmTimer> timer_;
DISALLOW_COPY_AND_ASSIGN(OneShotSelfDeletingAlarmTimerTester);
};
@@ -116,7 +118,7 @@
bool* did_run_;
const base::TimeDelta delay_;
int counter_;
- scoped_ptr<timers::RepeatingAlarmTimer> timer_;
+ std::unique_ptr<timers::RepeatingAlarmTimer> timer_;
DISALLOW_COPY_AND_ASSIGN(RepeatingAlarmTimerTester);
};
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc
index b0b790a..ac05a180 100644
--- a/components/tracing/child_trace_message_filter.cc
+++ b/components/tracing/child_trace_message_filter.cc
@@ -4,6 +4,8 @@
#include "components/tracing/child_trace_message_filter.h"
+#include <memory>
+
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/statistics_recorder.h"
@@ -255,12 +257,13 @@
if (!existing_histogram)
return;
- scoped_ptr<base::HistogramSamples> samples =
+ std::unique_ptr<base::HistogramSamples> samples =
existing_histogram->SnapshotSamples();
if (!samples)
return;
- scoped_ptr<base::SampleCountIterator> sample_iterator = samples->Iterator();
+ std::unique_ptr<base::SampleCountIterator> sample_iterator =
+ samples->Iterator();
if (!sample_iterator)
return;
diff --git a/components/tracing/child_trace_message_filter_browsertest.cc b/components/tracing/child_trace_message_filter_browsertest.cc
index 0d88db6..f7709d88 100644
--- a/components/tracing/child_trace_message_filter_browsertest.cc
+++ b/components/tracing/child_trace_message_filter_browsertest.cc
@@ -4,6 +4,7 @@
#include <stdint.h>
+#include <memory>
#include <tuple>
#include "base/callback.h"
@@ -162,7 +163,7 @@
}
scoped_refptr<ChildTraceMessageFilter> ctmf_;
- scoped_ptr<MockDumpProvider> mock_dump_provider_;
+ std::unique_ptr<MockDumpProvider> mock_dump_provider_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::trace_event::MemoryDumpCallback callback_;
uint32_t wait_for_ipc_message_type_;
diff --git a/components/tracing/child_trace_message_filter_unittest.cc b/components/tracing/child_trace_message_filter_unittest.cc
index 75d1ad8..3c4a768 100644
--- a/components/tracing/child_trace_message_filter_unittest.cc
+++ b/components/tracing/child_trace_message_filter_unittest.cc
@@ -4,8 +4,9 @@
#include "components/tracing/child_trace_message_filter.h"
+#include <memory>
+
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "components/tracing/tracing_messages.h"
#include "ipc/ipc_message.h"
@@ -26,7 +27,7 @@
return true;
}
- scoped_ptr<IPC::Message> last_message_;
+ std::unique_ptr<IPC::Message> last_message_;
};
class ChildTraceMessageFilterTest : public testing::Test {
diff --git a/components/tracing/process_metrics_memory_dump_provider.cc b/components/tracing/process_metrics_memory_dump_provider.cc
index e299a79..65575600 100644
--- a/components/tracing/process_metrics_memory_dump_provider.cc
+++ b/components/tracing/process_metrics_memory_dump_provider.cc
@@ -14,6 +14,7 @@
#include "base/format_macros.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/process/process_metrics.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -28,8 +29,9 @@
namespace {
base::LazyInstance<
- std::map<base::ProcessId, scoped_ptr<ProcessMetricsMemoryDumpProvider>>>::
- Leaky g_dump_providers_map = LAZY_INSTANCE_INITIALIZER;
+ std::map<base::ProcessId,
+ std::unique_ptr<ProcessMetricsMemoryDumpProvider>>>::Leaky
+ g_dump_providers_map = LAZY_INSTANCE_INITIALIZER;
#if defined(OS_LINUX) || defined(OS_ANDROID)
const char kClearPeakRssCommand[] = "5";
@@ -155,19 +157,21 @@
}
#endif // defined(OS_LINUX) || defined(OS_ANDROID)
-scoped_ptr<base::ProcessMetrics> CreateProcessMetrics(base::ProcessId process) {
+std::unique_ptr<base::ProcessMetrics> CreateProcessMetrics(
+ base::ProcessId process) {
if (process == base::kNullProcessId)
- return make_scoped_ptr(base::ProcessMetrics::CreateCurrentProcessMetrics());
+ return base::WrapUnique(
+ base::ProcessMetrics::CreateCurrentProcessMetrics());
#if defined(OS_LINUX) || defined(OS_ANDROID)
// Just pass ProcessId instead of handle since they are the same in linux and
// android.
- return make_scoped_ptr(base::ProcessMetrics::CreateProcessMetrics(process));
+ return base::WrapUnique(base::ProcessMetrics::CreateProcessMetrics(process));
#else
// Creating process metrics for child processes in mac or windows requires
// additional information like ProcessHandle or port provider. This is a non
// needed use case.
NOTREACHED();
- return scoped_ptr<base::ProcessMetrics>();
+ return std::unique_ptr<base::ProcessMetrics>();
#endif // defined(OS_LINUX) || defined(OS_ANDROID)
}
@@ -205,7 +209,7 @@
// static
void ProcessMetricsMemoryDumpProvider::RegisterForProcess(
base::ProcessId process) {
- scoped_ptr<ProcessMetricsMemoryDumpProvider> metrics_provider(
+ std::unique_ptr<ProcessMetricsMemoryDumpProvider> metrics_provider(
new ProcessMetricsMemoryDumpProvider(process));
base::trace_event::MemoryDumpProvider::Options options;
options.target_pid = process;
diff --git a/components/tracing/process_metrics_memory_dump_provider.h b/components/tracing/process_metrics_memory_dump_provider.h
index b002d10..72f702a 100644
--- a/components/tracing/process_metrics_memory_dump_provider.h
+++ b/components/tracing/process_metrics_memory_dump_provider.h
@@ -5,9 +5,10 @@
#ifndef COMPONENTS_TRACING_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_
#define COMPONENTS_TRACING_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_
+#include <memory>
+
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/process/process_handle.h"
#include "base/trace_event/memory_dump_provider.h"
#include "build/build_config.h"
@@ -52,7 +53,7 @@
#endif
base::ProcessId process_;
- scoped_ptr<base::ProcessMetrics> process_metrics_;
+ std::unique_ptr<base::ProcessMetrics> process_metrics_;
// The peak may not be resettable on all the processes if the linux kernel is
// older than http://bit.ly/reset_rss or only on child processes if yama LSM
diff --git a/components/tracing/process_metrics_memory_dump_provider_unittest.cc b/components/tracing/process_metrics_memory_dump_provider_unittest.cc
index 62e8fd6..db1425e 100644
--- a/components/tracing/process_metrics_memory_dump_provider_unittest.cc
+++ b/components/tracing/process_metrics_memory_dump_provider_unittest.cc
@@ -6,6 +6,8 @@
#include <stdint.h>
+#include <memory>
+
#include "base/files/file_util.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/process_memory_maps.h"
@@ -122,11 +124,11 @@
TEST(ProcessMetricsMemoryDumpProviderTest, DumpRSS) {
const base::trace_event::MemoryDumpArgs high_detail_args = {
base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
- scoped_ptr<ProcessMetricsMemoryDumpProvider> pmtdp(
+ std::unique_ptr<ProcessMetricsMemoryDumpProvider> pmtdp(
new ProcessMetricsMemoryDumpProvider(base::kNullProcessId));
- scoped_ptr<base::trace_event::ProcessMemoryDump> pmd_before(
+ std::unique_ptr<base::trace_event::ProcessMemoryDump> pmd_before(
new base::trace_event::ProcessMemoryDump(nullptr));
- scoped_ptr<base::trace_event::ProcessMemoryDump> pmd_after(
+ std::unique_ptr<base::trace_event::ProcessMemoryDump> pmd_after(
new base::trace_event::ProcessMemoryDump(nullptr));
ProcessMetricsMemoryDumpProvider::rss_bytes_for_testing = 1024;
@@ -164,7 +166,7 @@
const base::trace_event::MemoryDumpArgs dump_args = {
base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
- scoped_ptr<ProcessMetricsMemoryDumpProvider> pmmdp(
+ std::unique_ptr<ProcessMetricsMemoryDumpProvider> pmmdp(
new ProcessMetricsMemoryDumpProvider(base::kNullProcessId));
// Emulate an empty /proc/self/smaps.
diff --git a/components/tracing/trace_config_file.cc b/components/tracing/trace_config_file.cc
index a19b66f5..f6a852e 100644
--- a/components/tracing/trace_config_file.cc
+++ b/components/tracing/trace_config_file.cc
@@ -6,13 +6,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -97,11 +97,11 @@
}
bool TraceConfigFile::ParseTraceConfigFileContent(const std::string& content) {
- scoped_ptr<base::Value> value(base::JSONReader::Read(content));
+ std::unique_ptr<base::Value> value(base::JSONReader::Read(content));
if (!value || !value->IsType(base::Value::TYPE_DICTIONARY))
return false;
- scoped_ptr<base::DictionaryValue> dict(
+ std::unique_ptr<base::DictionaryValue> dict(
static_cast<base::DictionaryValue*>(value.release()));
base::DictionaryValue* trace_config_dict = NULL;