diff --git a/DEPS b/DEPS index 6c26d1d..7488f229 100644 --- a/DEPS +++ b/DEPS
@@ -43,7 +43,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'd71ff17b88337c131cecdbc00f093763e897f321', + 'v8_revision': 'e60c0f1d3d0d2dc9f42c3d6a339f491ace1f6d3d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java index a291c51..6293113 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java
@@ -9,6 +9,7 @@ import android.text.TextUtils; import android.view.View; +import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.R; import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer; @@ -36,7 +37,8 @@ /** * Creates the UsbChooserDialog. */ - private UsbChooserDialog(long nativeUsbChooserDialogPtr) { + @VisibleForTesting + UsbChooserDialog(long nativeUsbChooserDialogPtr) { mNativeUsbChooserDialogPtr = nativeUsbChooserDialogPtr; } @@ -48,7 +50,8 @@ * @param securityLevel The security level of the connection to the site wanting to connect to * the USB device. For valid values see SecurityStateModel::SecurityLevel. */ - private void show(Context context, String origin, int securityLevel) { + @VisibleForTesting + void show(Context context, String origin, int securityLevel) { // Emphasize the origin. Profile profile = Profile.getLastUsedProfile(); SpannableString originSpannableString = new SpannableString(origin); @@ -117,8 +120,9 @@ mItemChooserDialog.setIdleState(); } + @VisibleForTesting @CalledByNative - private void addDevice(String deviceId, String deviceName) { + void addDevice(String deviceId, String deviceName) { mItemChooserDialog.addItemToList( new ItemChooserDialog.ItemChooserRow(deviceId, deviceName)); } @@ -135,7 +139,10 @@ mItemChooserDialog.dismiss(); } - private native void nativeOnItemSelected(long nativeUsbChooserDialogAndroid, String deviceId); - private native void nativeOnDialogCancelled(long nativeUsbChooserDialogAndroid); - private native void nativeLoadUsbHelpPage(long nativeUsbChooserDialogAndroid); + @VisibleForTesting + native void nativeOnItemSelected(long nativeUsbChooserDialogAndroid, String deviceId); + @VisibleForTesting + native void nativeOnDialogCancelled(long nativeUsbChooserDialogAndroid); + @VisibleForTesting + native void nativeLoadUsbHelpPage(long nativeUsbChooserDialogAndroid); }
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index d5127d3..1aabf0b 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -943,6 +943,7 @@ "javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java", "javatests/src/org/chromium/chrome/browser/TabsTest.java", "javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java", + "javatests/src/org/chromium/chrome/browser/UsbChooserDialogTest.java", "javatests/src/org/chromium/chrome/browser/accessibility/FontSizePrefsTest.java", "javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java", "javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/UsbChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/UsbChooserDialogTest.java new file mode 100644 index 0000000..0c2e193 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/UsbChooserDialogTest.java
@@ -0,0 +1,185 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser; + +import android.app.Dialog; +import android.test.suitebuilder.annotation.SmallTest; +import android.view.View; +import android.widget.Button; +import android.widget.ListView; + +import org.chromium.base.ThreadUtils; +import org.chromium.chrome.R; +import org.chromium.chrome.test.ChromeActivityTestCaseBase; +import org.chromium.components.security_state.ConnectionSecurityLevel; +import org.chromium.content.browser.test.util.Criteria; +import org.chromium.content.browser.test.util.CriteriaHelper; +import org.chromium.content.browser.test.util.TouchCommon; +import org.chromium.ui.widget.TextViewWithClickableSpans; + +import java.util.concurrent.Callable; + +/** + * Tests for the UsbChooserDialog class. + */ +public class UsbChooserDialogTest extends ChromeActivityTestCaseBase<ChromeActivity> { + /** + * Works like the UsbChooserDialog class, but records calls to native methods instead of + * calling back to C++. + */ + static class UsbChooserDialogWithFakeNatives extends UsbChooserDialog { + String mSelectedDeviceId = ""; + + UsbChooserDialogWithFakeNatives() { + super(42 /* nativeUsbChooserDialogPtr */); + } + + @Override + void nativeOnItemSelected(long nativeUsbChooserDialogAndroid, String deviceId) { + mSelectedDeviceId = deviceId; + } + + @Override + void nativeOnDialogCancelled(long nativeUsbChooserDialogAndroid) {} + + @Override + void nativeLoadUsbHelpPage(long nativeUsbChooserDialogAndroid) {} + } + + private UsbChooserDialogWithFakeNatives mChooserDialog; + + public UsbChooserDialogTest() { + super(ChromeActivity.class); + } + + // ChromeActivityTestCaseBase: + + @Override + protected void setUp() throws Exception { + super.setUp(); + mChooserDialog = createDialog(); + } + + @Override + public void startMainActivity() throws InterruptedException { + startMainActivityOnBlankPage(); + } + + private UsbChooserDialogWithFakeNatives createDialog() { + return ThreadUtils.runOnUiThreadBlockingNoException( + new Callable<UsbChooserDialogWithFakeNatives>() { + @Override + public UsbChooserDialogWithFakeNatives call() { + UsbChooserDialogWithFakeNatives dialog = + new UsbChooserDialogWithFakeNatives(); + dialog.show(getActivity(), "https://origin.example.com/", + ConnectionSecurityLevel.SECURE); + return dialog; + } + }); + } + + private static void selectItem(final UsbChooserDialogWithFakeNatives chooserDialog, + int position) throws InterruptedException { + final Dialog dialog = chooserDialog.mItemChooserDialog.getDialogForTesting(); + final ListView items = (ListView) dialog.findViewById(R.id.items); + final Button button = (Button) dialog.findViewById(R.id.positive); + + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return items.getChildAt(0) != null; + } + }); + + // The actual index for the first item displayed on screen. + int firstVisiblePosition = items.getFirstVisiblePosition(); + TouchCommon.singleClickView(items.getChildAt(position - firstVisiblePosition)); + + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return button.isEnabled(); + } + }); + + TouchCommon.singleClickView(button); + + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return !chooserDialog.mSelectedDeviceId.equals(""); + } + }); + } + + /** + * The messages include <link> ... </link> or <link1> ... </link1>, <link2> ... </link2> + * sections that are used to create clickable spans. For testing the messages, this function + * returns the raw string without the tags. + */ + private static String removeLinkTags(String message) { + return message.replaceAll("</?link1>", "").replaceAll( + "</?link2>", "").replaceAll("</?link>", ""); + } + + @SmallTest + public void testCancel() throws InterruptedException { + Dialog dialog = mChooserDialog.mItemChooserDialog.getDialogForTesting(); + assertTrue(dialog.isShowing()); + + final ListView items = (ListView) dialog.findViewById(R.id.items); + final Button button = (Button) dialog.findViewById(R.id.positive); + + // The 'Connect' button should be disabled and the list view should be hidden. + assertFalse(button.isEnabled()); + assertEquals(View.GONE, items.getVisibility()); + + dialog.dismiss(); + + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return mChooserDialog.mSelectedDeviceId.equals(""); + } + }); + } + + @SmallTest + public void testSelectItem() throws InterruptedException { + Dialog dialog = mChooserDialog.mItemChooserDialog.getDialogForTesting(); + + TextViewWithClickableSpans statusView = + (TextViewWithClickableSpans) dialog.findViewById(R.id.status); + final ListView items = (ListView) dialog.findViewById(R.id.items); + final Button button = (Button) dialog.findViewById(R.id.positive); + final int position = 1; + + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + mChooserDialog.addDevice("device_id_0", "device_name_0"); + mChooserDialog.addDevice("device_id_1", "device_name_1"); + mChooserDialog.addDevice("device_id_2", "device_name_2"); + // Show the desired position at the top of the ListView (in case + // not all the items can fit on small devices' screens). + items.setSelection(position); + } + }); + + // After adding items to the dialog, the help message should be showing, + // the 'Connect' button should still be disabled (since nothing's selected), + // and the list view should show. + assertEquals(removeLinkTags(getActivity().getString( + R.string.usb_chooser_dialog_footnote_text)), + statusView.getText().toString()); + assertFalse(button.isEnabled()); + assertEquals(View.VISIBLE, items.getVisibility()); + + selectItem(mChooserDialog, position); + + assertEquals("device_id_1", mChooserDialog.mSelectedDeviceId); + } +}
diff --git a/chrome/browser/interstitials/security_interstitial_page.cc b/chrome/browser/interstitials/security_interstitial_page.cc index 6a12c74..2a470ad 100644 --- a/chrome/browser/interstitials/security_interstitial_page.cc +++ b/chrome/browser/interstitials/security_interstitial_page.cc
@@ -113,6 +113,6 @@ } void SecurityInterstitialPage::set_metrics_helper( - scoped_ptr<security_interstitials::MetricsHelper> metrics_helper) { + std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) { controller_->set_metrics_helper(std::move(metrics_helper)); }
diff --git a/chrome/browser/interstitials/security_interstitial_page.h b/chrome/browser/interstitials/security_interstitial_page.h index 9f6f290..94dd738 100644 --- a/chrome/browser/interstitials/security_interstitial_page.h +++ b/chrome/browser/interstitials/security_interstitial_page.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ +#include <memory> + #include "base/macros.h" #include "base/strings/string16.h" #include "content/public/browser/interstitial_page_delegate.h" @@ -70,7 +72,7 @@ void OpenExtendedReportingPrivacyPolicy(); security_interstitials::MetricsHelper* metrics_helper(); void set_metrics_helper( - scoped_ptr<security_interstitials::MetricsHelper> metrics_helper); + std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); private: // The WebContents with which this interstitial page is @@ -84,7 +86,7 @@ // Whether the interstitial should create a view. bool create_view_; // For subclasses that don't have their own ChromeControllerClients yet. - scoped_ptr<ChromeControllerClient> controller_; + std::unique_ptr<ChromeControllerClient> controller_; DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); };
diff --git a/components/autofill/core/browser/test_autofill_driver.h b/components/autofill/core/browser/test_autofill_driver.h index 132196c..0d6b5af 100644 --- a/components/autofill/core/browser/test_autofill_driver.h +++ b/components/autofill/core/browser/test_autofill_driver.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_DRIVER_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_DRIVER_H_ +#include <memory> + #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -54,7 +56,7 @@ void SetURLRequestContext(net::URLRequestContextGetter* url_request_context); private: - scoped_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; + std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; net::URLRequestContextGetter* url_request_context_; DISALLOW_COPY_AND_ASSIGN(TestAutofillDriver);
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc index 2f792af..8ed2e0e 100644 --- a/components/domain_reliability/uploader.cc +++ b/components/domain_reliability/uploader.cc
@@ -164,11 +164,11 @@ DomainReliabilityUploader::~DomainReliabilityUploader() {} // static -scoped_ptr<DomainReliabilityUploader> DomainReliabilityUploader::Create( +std::unique_ptr<DomainReliabilityUploader> DomainReliabilityUploader::Create( MockableTime* time, const scoped_refptr<net::URLRequestContextGetter>& url_request_context_getter) { - return scoped_ptr<DomainReliabilityUploader>( + return std::unique_ptr<DomainReliabilityUploader>( new DomainReliabilityUploaderImpl(time, url_request_context_getter)); }
diff --git a/components/domain_reliability/uploader.h b/components/domain_reliability/uploader.h index e3221252..700a4f8 100644 --- a/components/domain_reliability/uploader.h +++ b/components/domain_reliability/uploader.h
@@ -6,6 +6,7 @@ #define COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ #include <map> +#include <memory> #include "base/callback_forward.h" #include "base/memory/ref_counted.h" @@ -50,10 +51,10 @@ // Creates an uploader that uses the given |url_request_context_getter| to // get a URLRequestContext to use for uploads. (See test_util.h for a mock // version.) - static scoped_ptr<DomainReliabilityUploader> Create( + static std::unique_ptr<DomainReliabilityUploader> Create( MockableTime* time, - const scoped_refptr< - net::URLRequestContextGetter>& url_request_context_getter); + const scoped_refptr<net::URLRequestContextGetter>& + url_request_context_getter); // Uploads |report_json| to |upload_url| and calls |callback| when the upload // has either completed or failed.
diff --git a/components/ntp_snippets/ntp_snippet.cc b/components/ntp_snippets/ntp_snippet.cc index 94616db..d21e4913 100644 --- a/components/ntp_snippets/ntp_snippet.cc +++ b/components/ntp_snippets/ntp_snippet.cc
@@ -29,7 +29,7 @@ NTPSnippet::~NTPSnippet() {} // static -scoped_ptr<NTPSnippet> NTPSnippet::CreateFromDictionary( +std::unique_ptr<NTPSnippet> NTPSnippet::CreateFromDictionary( const base::DictionaryValue& dict) { // Need at least the url. std::string url_str; @@ -39,7 +39,7 @@ if (!url.is_valid()) return nullptr; - scoped_ptr<NTPSnippet> snippet(new NTPSnippet(url)); + std::unique_ptr<NTPSnippet> snippet(new NTPSnippet(url)); std::string site_title; if (dict.GetString(kSiteTitle, &site_title)) @@ -83,8 +83,8 @@ return snippet; } -scoped_ptr<base::DictionaryValue> NTPSnippet::ToDictionary() const { - scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); +std::unique_ptr<base::DictionaryValue> NTPSnippet::ToDictionary() const { + std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); dict->SetString(kUrl, url_.spec()); if (!site_title_.empty())
diff --git a/components/ntp_snippets/ntp_snippet.h b/components/ntp_snippets/ntp_snippet.h index daa1d52..ead67b8 100644 --- a/components/ntp_snippets/ntp_snippet.h +++ b/components/ntp_snippets/ntp_snippet.h
@@ -5,6 +5,7 @@ #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ +#include <memory> #include <string> #include "base/macros.h" @@ -30,10 +31,10 @@ // dictionary doesn't contain at least a url. The keys in the dictionary are // expected to be the same as the property name, with exceptions documented in // the property comment. - static scoped_ptr<NTPSnippet> CreateFromDictionary( + static std::unique_ptr<NTPSnippet> CreateFromDictionary( const base::DictionaryValue& dict); - scoped_ptr<base::DictionaryValue> ToDictionary() const; + std::unique_ptr<base::DictionaryValue> ToDictionary() const; // URL of the page described by this snippet. const GURL& url() const { return url_; }
diff --git a/components/password_manager/core/common/credential_manager_types.h b/components/password_manager/core/common/credential_manager_types.h index 98503f9b..dbe84fd 100644 --- a/components/password_manager/core/common/credential_manager_types.h +++ b/components/password_manager/core/common/credential_manager_types.h
@@ -7,6 +7,7 @@ #include <stddef.h> +#include <memory> #include <string> #include "base/compiler_specific.h" @@ -63,8 +64,9 @@ }; // Create a new autofill::PasswordForm object based on |info|, valid in the -// context of |origin|. Returns an empty scoped_ptr for CREDENTIAL_TYPE_EMPTY. -scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( +// context of |origin|. Returns an empty std::unique_ptr for +// CREDENTIAL_TYPE_EMPTY. +std::unique_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( const CredentialInfo& info, const GURL& origin);
diff --git a/content/browser/notifications/notification_database_data_conversions.cc b/content/browser/notifications/notification_database_data_conversions.cc index 5da5aae7..11cdd48 100644 --- a/content/browser/notifications/notification_database_data_conversions.cc +++ b/content/browser/notifications/notification_database_data_conversions.cc
@@ -6,6 +6,8 @@ #include <stddef.h> +#include <memory> + #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -84,7 +86,7 @@ std::string* output) { DCHECK(output); - scoped_ptr<NotificationDatabaseDataProto::NotificationData> payload( + std::unique_ptr<NotificationDatabaseDataProto::NotificationData> payload( new NotificationDatabaseDataProto::NotificationData()); const PlatformNotificationData& notification_data = input.notification_data;
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 604738b5..32f552ed7 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -440,11 +440,11 @@ BrowserThread::GetMessageLoopProxyForThread( BrowserThread::FILE).get()); - base::FilePath path = in_memory ? base::FilePath() : context->GetPath(); scoped_refptr<DOMStorageContextWrapper> dom_storage_context = - new DOMStorageContextWrapper(BrowserContext::GetMojoUserIdFor(context), - path, relative_partition_path, - context->GetSpecialStoragePolicy()); + new DOMStorageContextWrapper( + BrowserContext::GetMojoUserIdFor(context), + in_memory ? base::FilePath() : context->GetPath(), + relative_partition_path, context->GetSpecialStoragePolicy()); // BrowserMainLoop may not be initialized in unit tests. Tests will // need to inject their own task runner into the IndexedDBContext. @@ -456,6 +456,8 @@ ->task_runner() .get() : NULL; + + base::FilePath path = in_memory ? base::FilePath() : partition_path; scoped_refptr<IndexedDBContextImpl> indexed_db_context = new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(),
diff --git a/content/child/request_info.h b/content/child/request_info.h index d808225..a5e026f 100644 --- a/content/child/request_info.h +++ b/content/child/request_info.h
@@ -7,6 +7,7 @@ #include <stdint.h> +#include <memory> #include <string> #include "base/macros.h" @@ -121,7 +122,7 @@ blink::WebURLRequest::ExtraData* extra_data; // Optional, the specific task queue to execute loading tasks on. - scoped_ptr<blink::WebTaskRunner> loading_web_task_runner; + std::unique_ptr<blink::WebTaskRunner> loading_web_task_runner; // PlzNavigate: the stream URL to request during navigations to get access to // the ResourceBody that has already been fetched by the browser process.
diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc index 9ff307e..9aa1e16b4b 100644 --- a/content/child/service_worker/service_worker_provider_context.cc +++ b/content/child/service_worker/service_worker_provider_context.cc
@@ -21,16 +21,16 @@ public: virtual ~Delegate(){}; virtual void AssociateRegistration( - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration, - scoped_ptr<ServiceWorkerHandleReference> installing, - scoped_ptr<ServiceWorkerHandleReference> waiting, - scoped_ptr<ServiceWorkerHandleReference> active) = 0; + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, + std::unique_ptr<ServiceWorkerHandleReference> installing, + std::unique_ptr<ServiceWorkerHandleReference> waiting, + std::unique_ptr<ServiceWorkerHandleReference> active) = 0; virtual void DisassociateRegistration() = 0; virtual void GetAssociatedRegistration( ServiceWorkerRegistrationObjectInfo* info, ServiceWorkerVersionAttributes* attrs) = 0; virtual void SetController( - scoped_ptr<ServiceWorkerHandleReference> controller) = 0; + std::unique_ptr<ServiceWorkerHandleReference> controller) = 0; virtual ServiceWorkerHandleReference* controller() = 0; }; @@ -44,10 +44,10 @@ ~ControlleeDelegate() override {} void AssociateRegistration( - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration, - scoped_ptr<ServiceWorkerHandleReference> installing, - scoped_ptr<ServiceWorkerHandleReference> waiting, - scoped_ptr<ServiceWorkerHandleReference> active) override { + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, + std::unique_ptr<ServiceWorkerHandleReference> installing, + std::unique_ptr<ServiceWorkerHandleReference> waiting, + std::unique_ptr<ServiceWorkerHandleReference> active) override { DCHECK(!registration_); registration_ = std::move(registration); } @@ -58,7 +58,7 @@ } void SetController( - scoped_ptr<ServiceWorkerHandleReference> controller) override { + std::unique_ptr<ServiceWorkerHandleReference> controller) override { DCHECK(registration_); DCHECK(!controller || controller->handle_id() != kInvalidServiceWorkerHandleId); @@ -76,8 +76,8 @@ } private: - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration_; - scoped_ptr<ServiceWorkerHandleReference> controller_; + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration_; + std::unique_ptr<ServiceWorkerHandleReference> controller_; DISALLOW_COPY_AND_ASSIGN(ControlleeDelegate); }; @@ -91,10 +91,10 @@ ~ControllerDelegate() override {} void AssociateRegistration( - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration, - scoped_ptr<ServiceWorkerHandleReference> installing, - scoped_ptr<ServiceWorkerHandleReference> waiting, - scoped_ptr<ServiceWorkerHandleReference> active) override { + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, + std::unique_ptr<ServiceWorkerHandleReference> installing, + std::unique_ptr<ServiceWorkerHandleReference> waiting, + std::unique_ptr<ServiceWorkerHandleReference> active) override { DCHECK(!registration_); registration_ = std::move(registration); installing_ = std::move(installing); @@ -108,7 +108,7 @@ } void SetController( - scoped_ptr<ServiceWorkerHandleReference> controller) override { + std::unique_ptr<ServiceWorkerHandleReference> controller) override { NOTREACHED(); } @@ -131,10 +131,10 @@ } private: - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration_; - scoped_ptr<ServiceWorkerHandleReference> installing_; - scoped_ptr<ServiceWorkerHandleReference> waiting_; - scoped_ptr<ServiceWorkerHandleReference> active_; + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration_; + std::unique_ptr<ServiceWorkerHandleReference> installing_; + std::unique_ptr<ServiceWorkerHandleReference> waiting_; + std::unique_ptr<ServiceWorkerHandleReference> active_; DISALLOW_COPY_AND_ASSIGN(ControllerDelegate); }; @@ -166,10 +166,10 @@ } void ServiceWorkerProviderContext::OnAssociateRegistration( - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration, - scoped_ptr<ServiceWorkerHandleReference> installing, - scoped_ptr<ServiceWorkerHandleReference> waiting, - scoped_ptr<ServiceWorkerHandleReference> active) { + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, + std::unique_ptr<ServiceWorkerHandleReference> installing, + std::unique_ptr<ServiceWorkerHandleReference> waiting, + std::unique_ptr<ServiceWorkerHandleReference> active) { DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); delegate_->AssociateRegistration(std::move(registration), std::move(installing), std::move(waiting), @@ -182,7 +182,7 @@ } void ServiceWorkerProviderContext::OnSetControllerServiceWorker( - scoped_ptr<ServiceWorkerHandleReference> controller) { + std::unique_ptr<ServiceWorkerHandleReference> controller) { DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); delegate_->SetController(std::move(controller)); }
diff --git a/content/child/service_worker/service_worker_provider_context.h b/content/child/service_worker/service_worker_provider_context.h index 06561a4..85e259a 100644 --- a/content/child/service_worker/service_worker_provider_context.h +++ b/content/child/service_worker/service_worker_provider_context.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ +#include <memory> #include <set> #include <vector> @@ -51,13 +52,13 @@ // Called from ServiceWorkerDispatcher. void OnAssociateRegistration( - scoped_ptr<ServiceWorkerRegistrationHandleReference> registration, - scoped_ptr<ServiceWorkerHandleReference> installing, - scoped_ptr<ServiceWorkerHandleReference> waiting, - scoped_ptr<ServiceWorkerHandleReference> active); + std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, + std::unique_ptr<ServiceWorkerHandleReference> installing, + std::unique_ptr<ServiceWorkerHandleReference> waiting, + std::unique_ptr<ServiceWorkerHandleReference> active); void OnDisassociateRegistration(); void OnSetControllerServiceWorker( - scoped_ptr<ServiceWorkerHandleReference> controller); + std::unique_ptr<ServiceWorkerHandleReference> controller); // Called on the worker thread. Used for initializing // ServiceWorkerGlobalScope. @@ -85,7 +86,7 @@ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; scoped_refptr<ThreadSafeSender> thread_safe_sender_; - scoped_ptr<Delegate> delegate_; + std::unique_ptr<Delegate> delegate_; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); };
diff --git a/content/child/webblobregistry_impl.cc b/content/child/webblobregistry_impl.cc index 0c33552..3850ce5 100644 --- a/content/child/webblobregistry_impl.cc +++ b/content/child/webblobregistry_impl.cc
@@ -9,7 +9,6 @@ #include "base/guid.h" #include "base/location.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/shared_memory.h" #include "base/message_loop/message_loop.h" #include "base/numerics/safe_conversions.h" @@ -60,7 +59,7 @@ void WebBlobRegistryImpl::registerBlobData(const blink::WebString& uuid, const blink::WebBlobData& data) { TRACE_EVENT0("Blob", "Registry::RegisterBlob"); - scoped_ptr<Builder> builder(createBuilder(uuid, data.contentType())); + std::unique_ptr<Builder> builder(createBuilder(uuid, data.contentType())); // This is temporary until we move to createBuilder() as our blob creation // method. @@ -148,7 +147,7 @@ // writing it directly to the IPC channel. size_t shared_memory_size = std::min(length, storage::kBlobStorageMaxSharedMemoryBytes); - scoped_ptr<base::SharedMemory> shared_memory( + std::unique_ptr<base::SharedMemory> shared_memory( ChildThreadImpl::AllocateSharedMemory(shared_memory_size, sender_.get())); CHECK(shared_memory.get()); @@ -247,7 +246,7 @@ /* static */ void WebBlobRegistryImpl::StartBlobAsyncConstruction( const std::string& uuid, - scoped_ptr<BlobConsolidation> consolidation, + std::unique_ptr<BlobConsolidation> consolidation, scoped_refptr<ThreadSafeSender> sender, scoped_refptr<base::SingleThreadTaskRunner> main_runner) { BlobTransportController::GetInstance()->InitiateBlobTransfer(
diff --git a/content/child/webblobregistry_impl.h b/content/child/webblobregistry_impl.h index 7898202ed..3f590ad 100644 --- a/content/child/webblobregistry_impl.h +++ b/content/child/webblobregistry_impl.h
@@ -8,6 +8,7 @@ #include <stddef.h> #include <stdint.h> +#include <memory> #include <string> #include <vector> @@ -91,7 +92,7 @@ private: const std::string uuid_; const std::string content_type_; - scoped_ptr<BlobConsolidation> consolidation_; + std::unique_ptr<BlobConsolidation> consolidation_; scoped_refptr<ThreadSafeSender> sender_; scoped_refptr<base::SingleThreadTaskRunner> io_runner_; scoped_refptr<base::SingleThreadTaskRunner> main_runner_; @@ -100,7 +101,7 @@ // Method called on the IO thread. static void StartBlobAsyncConstruction( const std::string& uuid, - scoped_ptr<BlobConsolidation> consolidation, + std::unique_ptr<BlobConsolidation> consolidation, scoped_refptr<ThreadSafeSender> sender, scoped_refptr<base::SingleThreadTaskRunner> main_runner);
diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h index 9e6cb60c..6e6c2e4 100644 --- a/content/public/browser/navigation_controller.h +++ b/content/public/browser/navigation_controller.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include <map> +#include <memory> #include <string> #include <vector> @@ -110,7 +111,7 @@ // Creates a navigation entry and translates the virtual url to a real one. // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. // Extra headers are separated by \n. - CONTENT_EXPORT static scoped_ptr<NavigationEntry> CreateNavigationEntry( + CONTENT_EXPORT static std::unique_ptr<NavigationEntry> CreateNavigationEntry( const GURL& url, const Referrer& referrer, ui::PageTransition transition, @@ -239,9 +240,10 @@ // indicates where the restor comes from. This takes ownership of the // NavigationEntrys in |entries| and clears it out. This is used for session // restore. - virtual void Restore(int selected_navigation, - RestoreType type, - std::vector<scoped_ptr<NavigationEntry>>* entries) = 0; + virtual void Restore( + int selected_navigation, + RestoreType type, + std::vector<std::unique_ptr<NavigationEntry>>* entries) = 0; // Entries ------------------------------------------------------------------- @@ -330,7 +332,7 @@ // represented as an entry, but should go away when the user navigates away // from them. // Note that adding a transient entry does not change the active contents. - virtual void SetTransientEntry(scoped_ptr<NavigationEntry> entry) = 0; + virtual void SetTransientEntry(std::unique_ptr<NavigationEntry> entry) = 0; // New navigations -----------------------------------------------------------
diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc index 8816ecba..a8f5520 100644 --- a/content/renderer/manifest/manifest_parser.cc +++ b/content/renderer/manifest/manifest_parser.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include "base/json/json_reader.h" +#include "base/memory/ptr_util.h" #include "base/strings/nullable_string16.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" @@ -108,7 +109,7 @@ std::string error_msg; int error_line = 0; int error_column = 0; - scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( + std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( data_, base::JSON_PARSE_RFC, nullptr, &error_msg, &error_line, &error_column); @@ -149,7 +150,7 @@ return manifest_; } -const std::vector<scoped_ptr<ManifestParser::ErrorInfo>>& +const std::vector<std::unique_ptr<ManifestParser::ErrorInfo>>& ManifestParser::errors() const { return errors_; } @@ -460,6 +461,6 @@ int error_line, int error_column) { errors_.push_back( - make_scoped_ptr(new ErrorInfo(error_msg, error_line, error_column))); + base::WrapUnique(new ErrorInfo(error_msg, error_line, error_column))); } } // namespace content
diff --git a/content/renderer/manifest/manifest_parser.h b/content/renderer/manifest/manifest_parser.h index 5f683a0..86f24a5 100644 --- a/content/renderer/manifest/manifest_parser.h +++ b/content/renderer/manifest/manifest_parser.h
@@ -7,6 +7,8 @@ #include <stdint.h> +#include <memory> + #include "base/macros.h" #include "base/strings/nullable_string16.h" #include "base/strings/string_piece.h" @@ -46,7 +48,7 @@ void Parse(); const Manifest& manifest() const; - const std::vector<scoped_ptr<ErrorInfo>>& errors() const; + const std::vector<std::unique_ptr<ErrorInfo>>& errors() const; bool failed() const; private: @@ -203,7 +205,7 @@ bool failed_; Manifest manifest_; - std::vector<scoped_ptr<ErrorInfo>> errors_; + std::vector<std::unique_ptr<ErrorInfo>> errors_; DISALLOW_COPY_AND_ASSIGN(ManifestParser); };
diff --git a/content/renderer/manifest/manifest_parser_unittest.cc b/content/renderer/manifest/manifest_parser_unittest.cc index cc5d1fe..9a8569d 100644 --- a/content/renderer/manifest/manifest_parser_unittest.cc +++ b/content/renderer/manifest/manifest_parser_unittest.cc
@@ -6,6 +6,8 @@ #include <stdint.h> +#include <memory> + #include "base/macros.h" #include "base/strings/string_util.h" #include "content/public/common/manifest.h" @@ -32,7 +34,7 @@ ManifestParser parser(data, document_url, manifest_url); parser.Parse(); errors_.clear(); - for (const scoped_ptr<ManifestParser::ErrorInfo>& error_info : + for (const std::unique_ptr<ManifestParser::ErrorInfo>& error_info : parser.errors()) { errors_.push_back(error_info->error_msg); }
diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc index 89d3b91..c9bc9fad 100644 --- a/content/renderer/p2p/port_allocator.cc +++ b/content/renderer/p2p/port_allocator.cc
@@ -5,6 +5,8 @@ #include "content/renderer/p2p/port_allocator.h" #include <stdint.h> + +#include <memory> #include <utility> #include "base/command_line.h" @@ -16,7 +18,7 @@ P2PPortAllocator::P2PPortAllocator( const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, - scoped_ptr<rtc::NetworkManager> network_manager, + std::unique_ptr<rtc::NetworkManager> network_manager, rtc::PacketSocketFactory* socket_factory, const Config& config, const GURL& origin,
diff --git a/content/renderer/p2p/port_allocator.h b/content/renderer/p2p/port_allocator.h index 480ad5c0..945b5f8 100644 --- a/content/renderer/p2p/port_allocator.h +++ b/content/renderer/p2p/port_allocator.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ #define CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ +#include <memory> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" @@ -38,7 +40,7 @@ P2PPortAllocator( const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, - scoped_ptr<rtc::NetworkManager> network_manager, + std::unique_ptr<rtc::NetworkManager> network_manager, rtc::PacketSocketFactory* socket_factory, const Config& config, const GURL& origin, @@ -46,7 +48,7 @@ ~P2PPortAllocator() override; private: - scoped_ptr<rtc::NetworkManager> network_manager_; + std::unique_ptr<rtc::NetworkManager> network_manager_; scoped_refptr<P2PSocketDispatcher> socket_dispatcher_; Config config_; GURL origin_;
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc index b1f001c7..30ac9cb9 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
@@ -83,7 +83,7 @@ blink::WebURLRequest& request) override { ServiceWorkerNetworkProvider* provider = GetNetworkProviderFromDataSource(data_source); - scoped_ptr<RequestExtraData> extra_data(new RequestExtraData); + std::unique_ptr<RequestExtraData> extra_data(new RequestExtraData); extra_data->set_service_worker_provider_id(provider->provider_id()); request.setExtraData(extra_data.release()); // Explicitly set the SkipServiceWorker flag for subresources here if the @@ -239,7 +239,7 @@ blink::WebDataSource* data_source) { // Create a content::ServiceWorkerNetworkProvider for this data source so // we can observe its requests. - scoped_ptr<ServiceWorkerNetworkProvider> provider( + std::unique_ptr<ServiceWorkerNetworkProvider> provider( new ServiceWorkerNetworkProvider( route_id_, SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER));
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.h b/content/renderer/shared_worker/embedded_shared_worker_stub.h index 876a0b2..8442dd6 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.h +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ #define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ +#include <memory> #include <vector> #include "base/macros.h" @@ -95,7 +96,7 @@ bool running_ = false; GURL url_; blink::WebSharedWorker* impl_ = nullptr; - scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; + std::unique_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList; PendingChannelList pending_channels_;
diff --git a/content/shell/browser/layout_test/test_info_extractor.cc b/content/shell/browser/layout_test/test_info_extractor.cc index a3759403..f2b751d 100644 --- a/content/shell/browser/layout_test/test_info_extractor.cc +++ b/content/shell/browser/layout_test/test_info_extractor.cc
@@ -8,6 +8,7 @@ #include "base/base_paths.h" #include "base/files/file_util.h" +#include "base/memory/ptr_util.h" #include "base/path_service.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -41,7 +42,7 @@ } #endif // defined(OS_ANDROID) -scoped_ptr<TestInfo> GetTestInfoFromLayoutTestName( +std::unique_ptr<TestInfo> GetTestInfoFromLayoutTestName( const std::string& test_name) { // A test name is formated like file:///path/to/test'--pixel-test'pixelhash std::string path_or_url = test_name; @@ -63,8 +64,8 @@ GURL test_url; #if defined(OS_ANDROID) if (GetTestUrlForAndroid(path_or_url, &test_url)) { - return make_scoped_ptr(new TestInfo(test_url, enable_pixel_dumping, - expected_pixel_hash, base::FilePath())); + return base::WrapUnique(new TestInfo( + test_url, enable_pixel_dumping, expected_pixel_hash, base::FilePath())); } #endif @@ -98,9 +99,9 @@ current_working_directory = local_path.DirName(); else base::GetCurrentDirectory(¤t_working_directory); - return make_scoped_ptr(new TestInfo(test_url, enable_pixel_dumping, - expected_pixel_hash, - current_working_directory)); + return base::WrapUnique(new TestInfo(test_url, enable_pixel_dumping, + expected_pixel_hash, + current_working_directory)); } } // namespace @@ -121,7 +122,7 @@ TestInfoExtractor::~TestInfoExtractor() {} -scoped_ptr<TestInfo> TestInfoExtractor::GetNextTest() { +std::unique_ptr<TestInfo> TestInfoExtractor::GetNextTest() { if (cmdline_position_ >= cmdline_args_.size()) return nullptr;
diff --git a/content/shell/browser/layout_test/test_info_extractor.h b/content/shell/browser/layout_test/test_info_extractor.h index 1988eac..560e5c0 100644 --- a/content/shell/browser/layout_test/test_info_extractor.h +++ b/content/shell/browser/layout_test/test_info_extractor.h
@@ -7,6 +7,7 @@ #include <stddef.h> +#include <memory> #include <string> #include "base/command_line.h" @@ -34,7 +35,7 @@ explicit TestInfoExtractor(const base::CommandLine::StringVector& cmd_args); ~TestInfoExtractor(); - scoped_ptr<TestInfo> GetNextTest(); + std::unique_ptr<TestInfo> GetNextTest(); private: base::CommandLine::StringVector cmdline_args_;
diff --git a/device/usb/webusb_descriptors.h b/device/usb/webusb_descriptors.h index a13440c..c88b1f9 100644 --- a/device/usb/webusb_descriptors.h +++ b/device/usb/webusb_descriptors.h
@@ -6,6 +6,8 @@ #define DEVICE_USB_WEBUSB_DESCRIPTORS_H_ #include <stdint.h> + +#include <memory> #include <vector> #include "base/callback_forward.h" @@ -64,8 +66,9 @@ void ReadWebUsbDescriptors( scoped_refptr<UsbDeviceHandle> device_handle, - const base::Callback<void(scoped_ptr<WebUsbAllowedOrigins> allowed_origins, - const GURL& landing_page)>& callback); + const base::Callback< + void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, + const GURL& landing_page)>& callback); // Check if the origin is allowed. bool FindInWebUsbAllowedOrigins(
diff --git a/extensions/renderer/dom_activity_logger.cc b/extensions/renderer/dom_activity_logger.cc index 086f63e4..9205523 100644 --- a/extensions/renderer/dom_activity_logger.cc +++ b/extensions/renderer/dom_activity_logger.cc
@@ -28,11 +28,11 @@ const v8::Local<v8::Value>& v8_value, base::ListValue* list) { DCHECK(list); - scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); + std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); ActivityLogConverterStrategy strategy; converter->SetFunctionAllowed(true); converter->SetStrategy(&strategy); - scoped_ptr<base::Value> value(converter->FromV8Value( + std::unique_ptr<base::Value> value(converter->FromV8Value( v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); if (value.get()) @@ -63,11 +63,8 @@ void DOMActivityLogger::logGetter(const WebString& api_name, const WebURL& url, const WebString& title) { - SendDomActionMessage(api_name.utf8(), - url, - title, - DomActionType::GETTER, - scoped_ptr<base::ListValue>(new base::ListValue())); + SendDomActionMessage(api_name.utf8(), url, title, DomActionType::GETTER, + std::unique_ptr<base::ListValue>(new base::ListValue())); } void DOMActivityLogger::logSetter(const WebString& api_name, @@ -82,7 +79,7 @@ const v8::Local<v8::Value>& old_value, const WebURL& url, const WebString& title) { - scoped_ptr<base::ListValue> args(new base::ListValue); + std::unique_ptr<base::ListValue> args(new base::ListValue); std::string api_name_utf8 = api_name.utf8(); AppendV8Value(api_name_utf8, new_value, args.get()); if (!old_value.IsEmpty()) @@ -96,7 +93,7 @@ const v8::Local<v8::Value>* argv, const WebURL& url, const WebString& title) { - scoped_ptr<base::ListValue> args(new base::ListValue); + std::unique_ptr<base::ListValue> args(new base::ListValue); std::string api_name_utf8 = api_name.utf8(); for (int i = 0; i < argc; ++i) AppendV8Value(api_name_utf8, argv[i], args.get()); @@ -109,7 +106,7 @@ const WebString* argv, const WebURL& url, const WebString& title) { - scoped_ptr<base::ListValue> args(new base::ListValue); + std::unique_ptr<base::ListValue> args(new base::ListValue); std::string event_name_utf8 = event_name.utf8(); for (int i = 0; i < argc; ++i) args->Append(new base::StringValue(argv[i])); @@ -117,11 +114,12 @@ std::move(args)); } -void DOMActivityLogger::SendDomActionMessage(const std::string& api_call, - const GURL& url, - const base::string16& url_title, - DomActionType::Type call_type, - scoped_ptr<base::ListValue> args) { +void DOMActivityLogger::SendDomActionMessage( + const std::string& api_call, + const GURL& url, + const base::string16& url_title, + DomActionType::Type call_type, + std::unique_ptr<base::ListValue> args) { ExtensionHostMsg_DOMAction_Params params; params.api_call = api_call; params.url = url;
diff --git a/extensions/renderer/dom_activity_logger.h b/extensions/renderer/dom_activity_logger.h index c9979e5..3956c48 100644 --- a/extensions/renderer/dom_activity_logger.h +++ b/extensions/renderer/dom_activity_logger.h
@@ -5,6 +5,7 @@ #ifndef EXTENSIONS_RENDERER_DOM_ACTIVITY_LOGGER_H_ #define EXTENSIONS_RENDERER_DOM_ACTIVITY_LOGGER_H_ +#include <memory> #include <string> #include "base/macros.h" @@ -76,7 +77,7 @@ const GURL& url, const base::string16& url_title, DomActionType::Type call_type, - scoped_ptr<base::ListValue> args); + std::unique_ptr<base::ListValue> args); // The id of the extension with which this logger is associated. std::string extension_id_;
diff --git a/gin/converter_unittest.cc b/gin/converter_unittest.cc index ec543c2..a198f40 100644 --- a/gin/converter_unittest.cc +++ b/gin/converter_unittest.cc
@@ -9,7 +9,6 @@ #include <stdint.h> #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "gin/public/isolate_holder.h" #include "gin/test/v8_test.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc index c05cd1e4..5252400 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc
@@ -7,6 +7,8 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> + +#include <memory> #include <utility> #include "base/logging.h" @@ -96,7 +98,7 @@ } void IsolateHolder::EnableIdleTasks( - scoped_ptr<V8IdleTaskRunner> idle_task_runner) { + std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { DCHECK(isolate_data_.get()); isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); }
diff --git a/gin/modules/module_registry.cc b/gin/modules/module_registry.cc index deec187..209eb06 100644 --- a/gin/modules/module_registry.cc +++ b/gin/modules/module_registry.cc
@@ -56,7 +56,7 @@ const char kModuleRegistryKey[] = "ModuleRegistry"; struct ModuleRegistryData : public base::SupportsUserData::Data { - scoped_ptr<ModuleRegistry> registry; + std::unique_ptr<ModuleRegistry> registry; }; void Define(const v8::FunctionCallbackInfo<Value>& info) { @@ -76,7 +76,7 @@ if (!args.GetNext(&factory)) return args.ThrowError(); - scoped_ptr<PendingModule> pending(new PendingModule); + std::unique_ptr<PendingModule> pending(new PendingModule); pending->id = id; pending->dependencies = dependencies; pending->factory.Reset(args.isolate(), factory); @@ -158,7 +158,7 @@ } void ModuleRegistry::AddPendingModule(Isolate* isolate, - scoped_ptr<PendingModule> pending) { + std::unique_ptr<PendingModule> pending) { const std::string pending_id = pending->id; const std::vector<std::string> pending_dependencies = pending->dependencies; AttemptToLoad(isolate, std::move(pending)); @@ -227,7 +227,8 @@ return num_missing_dependencies == 0; } -bool ModuleRegistry::Load(Isolate* isolate, scoped_ptr<PendingModule> pending) { +bool ModuleRegistry::Load(Isolate* isolate, + std::unique_ptr<PendingModule> pending) { if (!pending->id.empty() && available_modules_.count(pending->id)) return true; // We've already loaded this module. @@ -253,7 +254,7 @@ } bool ModuleRegistry::AttemptToLoad(Isolate* isolate, - scoped_ptr<PendingModule> pending) { + std::unique_ptr<PendingModule> pending) { if (!CheckDependencies(pending.get())) { pending_modules_.push_back(pending.release()); return false; @@ -276,7 +277,7 @@ PendingModuleVector pending_modules; pending_modules.swap(pending_modules_); for (size_t i = 0; i < pending_modules.size(); ++i) { - scoped_ptr<PendingModule> pending(pending_modules[i]); + std::unique_ptr<PendingModule> pending(pending_modules[i]); pending_modules[i] = NULL; if (AttemptToLoad(isolate, std::move(pending))) keep_trying = true;
diff --git a/gin/modules/module_registry.h b/gin/modules/module_registry.h index 0f67137a..9bbfd6e0 100644 --- a/gin/modules/module_registry.h +++ b/gin/modules/module_registry.h
@@ -7,13 +7,13 @@ #include <list> #include <map> +#include <memory> #include <set> #include <string> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/observer_list.h" #include "gin/gin_export.h" @@ -59,7 +59,7 @@ // The caller must have already entered our context. void AddPendingModule(v8::Isolate* isolate, - scoped_ptr<PendingModule> pending); + std::unique_ptr<PendingModule> pending); void LoadModule(v8::Isolate* isolate, const std::string& id, @@ -82,13 +82,14 @@ explicit ModuleRegistry(v8::Isolate* isolate); - bool Load(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); + bool Load(v8::Isolate* isolate, std::unique_ptr<PendingModule> pending); bool RegisterModule(v8::Isolate* isolate, const std::string& id, v8::Local<v8::Value> module); bool CheckDependencies(PendingModule* pending); - bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); + bool AttemptToLoad(v8::Isolate* isolate, + std::unique_ptr<PendingModule> pending); v8::Local<v8::Value> GetModule(v8::Isolate* isolate, const std::string& id);
diff --git a/gin/modules/module_registry_unittest.cc b/gin/modules/module_registry_unittest.cc index e337c2d..3921539 100644 --- a/gin/modules/module_registry_unittest.cc +++ b/gin/modules/module_registry_unittest.cc
@@ -6,6 +6,8 @@ #include <stdint.h> +#include <memory> + #include "base/bind.h" #include "base/macros.h" #include "gin/modules/module_registry_observer.h" @@ -28,7 +30,7 @@ } ModuleRunnerDelegate delegate; - scoped_ptr<ShellRunner> runner; + std::unique_ptr<ShellRunner> runner; Runner::Scope scope; };
diff --git a/gin/modules/timer_unittest.cc b/gin/modules/timer_unittest.cc index 612275e..1739e576 100644 --- a/gin/modules/timer_unittest.cc +++ b/gin/modules/timer_unittest.cc
@@ -4,7 +4,8 @@ #include "gin/modules/timer.h" -#include "base/memory/scoped_ptr.h" +#include <memory> + #include "base/message_loop/message_loop.h" #include "gin/handle.h" #include "gin/object_template_builder.h" @@ -71,7 +72,7 @@ } ShellRunnerDelegate delegate; - scoped_ptr<ShellRunner> runner; + std::unique_ptr<ShellRunner> runner; Runner::Scope scope; Handle<TimerModule> timer_module; Handle<Result> result;
diff --git a/gin/per_isolate_data.cc b/gin/per_isolate_data.cc index a610158..4ae4085 100644 --- a/gin/per_isolate_data.cc +++ b/gin/per_isolate_data.cc
@@ -114,7 +114,7 @@ } void PerIsolateData::EnableIdleTasks( - scoped_ptr<V8IdleTaskRunner> idle_task_runner) { + std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { idle_task_runner_ = std::move(idle_task_runner); }
diff --git a/gin/per_isolate_data.h b/gin/per_isolate_data.h index a1ef474..9b804aa 100644 --- a/gin/per_isolate_data.h +++ b/gin/per_isolate_data.h
@@ -6,10 +6,10 @@ #define GIN_PER_ISOLATE_DATA_H_ #include <map> +#include <memory> #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "gin/gin_export.h" #include "gin/public/v8_idle_task_runner.h" #include "gin/public/wrapper_info.h" @@ -65,7 +65,7 @@ WrappableBase* base); NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base); - void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner); + void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner); v8::Isolate* isolate() { return isolate_; } v8::ArrayBuffer::Allocator* allocator() { return allocator_; } @@ -93,7 +93,7 @@ IndexedPropertyInterceptorMap indexed_interceptors_; NamedPropertyInterceptorMap named_interceptors_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - scoped_ptr<V8IdleTaskRunner> idle_task_runner_; + std::unique_ptr<V8IdleTaskRunner> idle_task_runner_; DISALLOW_COPY_AND_ASSIGN(PerIsolateData); };
diff --git a/gin/public/context_holder.h b/gin/public/context_holder.h index 176af17..f0efc9b6 100644 --- a/gin/public/context_holder.h +++ b/gin/public/context_holder.h
@@ -6,9 +6,9 @@ #define GIN_PUBLIC_CONTEXT_HOLDER_H_ #include <list> +#include <memory> #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "gin/gin_export.h" #include "v8/include/v8.h" @@ -42,7 +42,7 @@ private: v8::Isolate* isolate_; v8::UniquePersistent<v8::Context> context_; - scoped_ptr<PerContextData> data_; + std::unique_ptr<PerContextData> data_; DISALLOW_COPY_AND_ASSIGN(ContextHolder); };
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h index cb51c2f..7cf3d94a 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h
@@ -5,8 +5,9 @@ #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_ #define GIN_PUBLIC_ISOLATE_HOLDER_H_ +#include <memory> + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "gin/gin_export.h" #include "gin/public/v8_idle_task_runner.h" #include "v8/include/v8.h" @@ -74,7 +75,7 @@ // This method returns if v8::Locker is needed to access isolate. AccessMode access_mode() const { return access_mode_; } - void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner); + void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner); // This method returns V8IsolateMemoryDumpProvider of this isolate, used for // testing. @@ -85,9 +86,9 @@ private: v8::Isolate* isolate_; - scoped_ptr<PerIsolateData> isolate_data_; - scoped_ptr<RunMicrotasksObserver> task_observer_; - scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; + std::unique_ptr<PerIsolateData> isolate_data_; + std::unique_ptr<RunMicrotasksObserver> task_observer_; + std::unique_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; AccessMode access_mode_; DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
diff --git a/gin/test/v8_test.h b/gin/test/v8_test.h index 3cb68d5..635281b1 100644 --- a/gin/test/v8_test.h +++ b/gin/test/v8_test.h
@@ -5,9 +5,10 @@ #ifndef GIN_TEST_V8_TEST_H_ #define GIN_TEST_V8_TEST_H_ +#include <memory> + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" @@ -28,7 +29,7 @@ protected: base::MessageLoop message_loop_; - scoped_ptr<IsolateHolder> instance_; + std::unique_ptr<IsolateHolder> instance_; v8::Persistent<v8::Context> context_; private:
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index bb31951..117723ea 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -7,13 +7,14 @@ #include <stddef.h> #include <stdint.h> +#include <memory> + #include "base/debug/alias.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/memory_mapped_file.h" #include "base/lazy_instance.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/strings/sys_string_conversions.h" @@ -111,7 +112,8 @@ base::MemoryMappedFile::Region region, base::MemoryMappedFile** mmapped_file_out) { DCHECK(*mmapped_file_out == NULL); - scoped_ptr<base::MemoryMappedFile> mmapped_file(new base::MemoryMappedFile()); + std::unique_ptr<base::MemoryMappedFile> mmapped_file( + new base::MemoryMappedFile()); if (mmapped_file->Initialize(base::File(platform_file), region)) { *mmapped_file_out = mmapped_file.release(); return true;
diff --git a/gin/v8_isolate_memory_dump_provider_unittest.cc b/gin/v8_isolate_memory_dump_provider_unittest.cc index 3979a324..a1b730a 100644 --- a/gin/v8_isolate_memory_dump_provider_unittest.cc +++ b/gin/v8_isolate_memory_dump_provider_unittest.cc
@@ -4,6 +4,8 @@ #include "gin/v8_isolate_memory_dump_provider.h" +#include <memory> + #include "base/trace_event/process_memory_dump.h" #include "gin/public/isolate_holder.h" #include "gin/test/v8_test.h" @@ -21,7 +23,7 @@ v8::V8::SetFlagsFromString(track_objects_flag, static_cast<int>(strlen(track_objects_flag))); - scoped_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( + std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( new base::trace_event::ProcessMemoryDump(nullptr)); base::trace_event::MemoryDumpArgs dump_args = { base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
diff --git a/net/cert/ct_log_verifier_unittest.cc b/net/cert/ct_log_verifier_unittest.cc index 3b620b5..9221f06 100644 --- a/net/cert/ct_log_verifier_unittest.cc +++ b/net/cert/ct_log_verifier_unittest.cc
@@ -6,6 +6,7 @@ #include <stdint.h> +#include <memory> #include <string> #include "base/strings/string_number_conversions.h" @@ -409,7 +410,7 @@ SHA256HashValue sha256; memset(sha256.data, 0, sizeof(sha256.data)); - scoped_ptr<crypto::SecureHash> hash( + std::unique_ptr<crypto::SecureHash> hash( crypto::SecureHash::Create(crypto::SecureHash::SHA256)); hash->Update(kLeafPrefix, 1); hash->Update(leaf.data(), leaf.size());
diff --git a/net/http/http_auth_preferences.h b/net/http/http_auth_preferences.h index eabd1383..4f3a68be 100644 --- a/net/http/http_auth_preferences.h +++ b/net/http/http_auth_preferences.h
@@ -5,6 +5,7 @@ #ifndef NET_HTTP_HTTP_AUTH_PREFERENCES_H_ #define NET_HTTP_HTTP_AUTH_PREFERENCES_H_ +#include <memory> #include <set> #include <string> #include <vector> @@ -76,7 +77,7 @@ // sorts of problems for, for example, active Negotiate transactions. const std::string gssapi_library_name_; #endif - scoped_ptr<URLSecurityManager> security_manager_; + std::unique_ptr<URLSecurityManager> security_manager_; DISALLOW_COPY_AND_ASSIGN(HttpAuthPreferences); };
diff --git a/net/quic/quic_stream_sequencer_buffer_test.cc b/net/quic/quic_stream_sequencer_buffer_test.cc index c925d3e..dd845a3 100644 --- a/net/quic/quic_stream_sequencer_buffer_test.cc +++ b/net/quic/quic_stream_sequencer_buffer_test.cc
@@ -507,7 +507,8 @@ EXPECT_EQ(2u, helper_->frame_arrival_time_map()->size()); // Read all data out. - std::unique_ptr<char[]> dest1{new char[max_capacity_bytes_]{0}}; + std::unique_ptr<char[]> dest1{new char[max_capacity_bytes_]}; + dest1[0] = 0; const iovec iov1{dest1.get(), max_capacity_bytes_}; EXPECT_EQ(max_capacity_bytes_ - 512 + 256, buffer_->Readv(&iov1, 1)); EXPECT_EQ(max_capacity_bytes_ + 256, buffer_->BytesConsumed());
diff --git a/url/gurl.h b/url/gurl.h index c55959b..103f1d8 100644 --- a/url/gurl.h +++ b/url/gurl.h
@@ -8,9 +8,9 @@ #include <stddef.h> #include <iosfwd> +#include <memory> #include <string> -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/strings/string_piece.h" #include "url/third_party/mozilla/url_parse.h" @@ -437,7 +437,7 @@ url::Parsed parsed_; // Used for nested schemes [currently only filesystem:]. - scoped_ptr<GURL> inner_url_; + std::unique_ptr<GURL> inner_url_; }; // Stream operator so GURL can be used in assertion statements.
diff --git a/url/run_all_unittests.cc b/url/run_all_unittests.cc index 82f58a7..088c5c0a 100644 --- a/url/run_all_unittests.cc +++ b/url/run_all_unittests.cc
@@ -2,6 +2,8 @@ // 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/message_loop/message_loop.h" #include "base/test/launcher/unit_test_launcher.h" @@ -29,7 +31,7 @@ #if !defined(OS_IOS) mojo::edk::Init(); base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); - scoped_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support; + std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support; ipc_support.reset( new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner())); #endif