diff --git a/DEPS b/DEPS index 9595b633..a0ea7a0 100644 --- a/DEPS +++ b/DEPS
@@ -39,7 +39,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '875e13ca0990e32da9db639743a913efe77f7e89', + 'skia_revision': '452ba88066b51931696fc3d0a2a1c0f8809a4143', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other.
diff --git a/chrome/VERSION b/chrome/VERSION index c0c34e2..3e10bce 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=53 MINOR=0 -BUILD=2773 +BUILD=2774 PATCH=0
diff --git a/chrome/browser/ui/cocoa/certificate_viewer_mac.h b/chrome/browser/ui/cocoa/certificate_viewer_mac.h index ea228f0a..c921327 100644 --- a/chrome/browser/ui/cocoa/certificate_viewer_mac.h +++ b/chrome/browser/ui/cocoa/certificate_viewer_mac.h
@@ -28,8 +28,6 @@ std::unique_ptr<ConstrainedWindowMac> constrainedWindow_; base::scoped_nsobject<NSWindow> overlayWindow_; BOOL closePending_; - // A copy of the sheet's frame used to restore on show. - NSRect oldSheetFrame_; // A copy of the overlay window's size used to restore on show. NSSize oldOverlaySize_; // A copy of the sheet's |autoresizesSubviews| flag to restore on show.
diff --git a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm index 1a079cac..42ff57d1 100644 --- a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm +++ b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm
@@ -165,33 +165,15 @@ - (void)hideSheet { NSWindow* sheetWindow = [overlayWindow_ attachedSheet]; [sheetWindow setAlphaValue:0.0]; + [sheetWindow setIgnoresMouseEvents:YES]; oldResizesSubviews_ = [[sheetWindow contentView] autoresizesSubviews]; [[sheetWindow contentView] setAutoresizesSubviews:NO]; - - oldSheetFrame_ = [sheetWindow frame]; - NSRect overlayFrame = [overlayWindow_ frame]; - oldSheetFrame_.origin.x -= NSMinX(overlayFrame); - oldSheetFrame_.origin.y -= NSMinY(overlayFrame); - oldOverlaySize_ = [overlayWindow_ frame].size; - [sheetWindow setFrame:ui::kWindowSizeDeterminedLater display:NO]; } - (void)unhideSheet { NSWindow* sheetWindow = [overlayWindow_ attachedSheet]; - NSRect overlayFrame = [overlayWindow_ frame]; - - // If the overlay frame's size has changed, the position offsets need to be - // calculated. Since the certificate is horizontally centered, so the x - // offset is calculated by halving the width difference. In addition, - // because the certificate is located directly below the toolbar, the y - // offset is just the difference in height. - CGFloat yOffset = (NSHeight(overlayFrame) - oldOverlaySize_.height); - CGFloat xOffset = (NSWidth(overlayFrame) - oldOverlaySize_.width) / 2; - - oldSheetFrame_.origin.x += NSMinX(overlayFrame) + xOffset; - oldSheetFrame_.origin.y += NSMinY(overlayFrame) + yOffset; - [sheetWindow setFrame:oldSheetFrame_ display:NO]; + [sheetWindow setIgnoresMouseEvents:NO]; [[sheetWindow contentView] setAutoresizesSubviews:oldResizesSubviews_]; [[overlayWindow_ attachedSheet] setAlphaValue:1.0];
diff --git a/chrome/browser/ui/cocoa/certificate_viewer_mac_browsertest.mm b/chrome/browser/ui/cocoa/certificate_viewer_mac_browsertest.mm index fd42510..f524756 100644 --- a/chrome/browser/ui/cocoa/certificate_viewer_mac_browsertest.mm +++ b/chrome/browser/ui/cocoa/certificate_viewer_mac_browsertest.mm
@@ -20,21 +20,38 @@ using web_modal::WebContentsModalDialogManager; -typedef InProcessBrowserTest SSLCertificateViewerCocoaTest; +typedef InProcessBrowserTest SSLCertificateViewerMacTest; namespace { + scoped_refptr<net::X509Certificate> GetSampleCertificate() { return net::ImportCertFromFile(net::GetTestCertsDirectory(), "mit.davidben.der"); } + +void CheckCertificateViewerVisibility(NSWindow* overlay_window, + NSWindow* dialog_sheet, + bool visible) { + CGFloat alpha = visible ? 1.0 : 0.0; + BOOL ignore_events = visible ? NO : YES; + + SCOPED_TRACE(testing::Message() << "visible=" << visible); + // The overlay window underneath the certificate viewer should block mouse + // events only if the certificate viewer is visible. + EXPECT_EQ(ignore_events, [overlay_window ignoresMouseEvents]); + // Check certificate viewer sheet visibility and if it accepts mouse events. + EXPECT_EQ(alpha, [dialog_sheet alphaValue]); + EXPECT_EQ(ignore_events, [dialog_sheet ignoresMouseEvents]); +} + } // namespace -IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, Basic) { +IN_PROC_BROWSER_TEST_F(SSLCertificateViewerMacTest, Basic) { scoped_refptr<net::X509Certificate> cert = GetSampleCertificate(); ASSERT_TRUE(cert.get()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); + NSWindow* window = web_contents->GetTopLevelNativeWindow(); WebContentsModalDialogManager* web_contents_modal_dialog_manager = WebContentsModalDialogManager::FromWebContents(web_contents); EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); @@ -52,29 +69,41 @@ } // Test that switching to another tab correctly hides the sheet. -IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, HideShow) { +IN_PROC_BROWSER_TEST_F(SSLCertificateViewerMacTest, HideShow) { scoped_refptr<net::X509Certificate> cert = GetSampleCertificate(); ASSERT_TRUE(cert.get()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - SSLCertificateViewerCocoa* viewer = - [[SSLCertificateViewerCocoa alloc] initWithCertificate:cert.get()]; - [viewer displayForWebContents:web_contents]; + NSWindow* window = web_contents->GetTopLevelNativeWindow(); + WebContentsModalDialogManager* web_contents_modal_dialog_manager = + WebContentsModalDialogManager::FromWebContents(web_contents); + // Account for any child windows that might be present before the certificate + // viewer is open. + NSUInteger num_child_windows = [[window childWindows] count]; + ShowCertificateViewer(web_contents, window, cert.get()); content::RunAllPendingInMessageLoop(); + EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive()); - NSWindow* sheetWindow = [[viewer overlayWindow] attachedSheet]; - NSRect sheetFrame = [sheetWindow frame]; - EXPECT_EQ(1.0, [sheetWindow alphaValue]); + EXPECT_EQ(num_child_windows + 1, [[window childWindows] count]); + // Assume the last child is the overlay window that was added. + NSWindow* overlay_window = [[window childWindows] lastObject]; + NSWindow* dialog_sheet = [overlay_window attachedSheet]; + EXPECT_TRUE(dialog_sheet); + NSRect sheet_frame = [dialog_sheet frame]; - // Switch to another tab and verify that the sheet is hidden. + // Verify the certificate viewer is showing and accepts mouse events. + CheckCertificateViewerVisibility(overlay_window, dialog_sheet, true); + + // Switch to another tab and verify that |overlay_window| and |dialog_sheet| + // are not blocking mouse events, and |dialog_sheet| is hidden. AddBlankTabAndShow(browser()); - EXPECT_EQ(0.0, [sheetWindow alphaValue]); - EXPECT_NSEQ(ui::kWindowSizeDeterminedLater, [sheetWindow frame]); + CheckCertificateViewerVisibility(overlay_window, dialog_sheet, false); + EXPECT_NSEQ(sheet_frame, [dialog_sheet frame]); // Switch back and verify that the sheet is shown. chrome::SelectNumberedTab(browser(), 0); - EXPECT_EQ(1.0, [sheetWindow alphaValue]); - EXPECT_NSEQ(sheetFrame, [sheetWindow frame]); + content::RunAllPendingInMessageLoop(); + CheckCertificateViewerVisibility(overlay_window, dialog_sheet, true); }
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index e75fb92..81f5748 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -353,8 +353,7 @@ GetPasswordStore(web_contents()); password_manager::PasswordFormManager* form_manager = passwords_data_.form_manager(); - for (const autofill::PasswordForm* form : - form_manager->blacklisted_matches()) { + for (const auto& form : form_manager->blacklisted_matches()) { password_store->RemoveLogin(*form); }
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 56b519f..6e00d1e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi
@@ -600,6 +600,12 @@ 'test/ppapi/ppapi_browsertest.cc', 'test/ppapi/ppapi_filechooser_browsertest.cc', ], + # Tests for Mac only (Cocoa and mac_views_browser=1). + 'chrome_browser_tests_mac_sources': [ + 'browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm', + 'browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc', + 'browser/ui/cocoa/certificate_viewer_mac_browsertest.mm', + ], # Tests corresponding to the files in chrome_browser_ui_cocoa_sources. # Built on Mac, except when mac_views_browser==1. 'chrome_browser_tests_cocoa_sources': [ @@ -610,7 +616,6 @@ 'browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm', 'browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm', 'browser/ui/cocoa/browser_window_controller_browsertest.mm', - 'browser/ui/cocoa/certificate_viewer_mac_browsertest.mm', 'browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm', 'browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm', 'browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm', @@ -2554,10 +2559,7 @@ '../components/components.gyp:breakpad_stubs', '../third_party/ocmock/ocmock.gyp:ocmock', ], - 'sources': [ - 'browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm', - 'browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc', - ], + 'sources': [ '<@(chrome_browser_tests_mac_sources)' ], 'sources!': [ # TODO(groby): This test depends on hunspell and we cannot run it on # Mac, which does not use hunspell by default.
diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc index ddce3ad..2743a9a 100644 --- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
@@ -72,6 +72,19 @@ render_thread_->sink().ClearMessages(); } + void ExpectFormClassifierVoteReceived( + const base::string16& expected_generation_element) { + const IPC::Message* message = + render_thread_->sink().GetFirstMessageMatching( + AutofillHostMsg_SaveGenerationFieldDetectedByClassifier::ID); + ASSERT_TRUE(message); + std::tuple<autofill::PasswordForm, base::string16> actual_parameters; + AutofillHostMsg_SaveGenerationFieldDetectedByClassifier::Read( + message, &actual_parameters); + EXPECT_EQ(expected_generation_element, std::get<1>(actual_parameters)); + render_thread_->sink().ClearMessages(); + } + void ShowGenerationPopUpManually(const char* element_id) { FocusField(element_id); AutofillMsg_UserTriggeredGeneratePassword msg(0); @@ -647,4 +660,14 @@ } } +TEST_F(PasswordGenerationAgentTest, FormClassifierVotesSignupForm) { + LoadHTMLWithUserGesture(kAccountCreationFormHTML); + ExpectFormClassifierVoteReceived(base::ASCIIToUTF16("first_password")); +} + +TEST_F(PasswordGenerationAgentTest, FormClassifierVotesSigninForm) { + LoadHTMLWithUserGesture(kSigninFormHTML); + ExpectFormClassifierVoteReceived(base::string16()); +} + } // namespace autofill
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 4621bd65..4d6fc6af 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1294,10 +1294,10 @@ # "//components/crash/content/app:breakpad_stubs", "//third_party/ocmock", ] - sources += [ - "../browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm", - "../browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc", - ] + sources += + rebase_path(chrome_tests_gypi_values.chrome_browser_tests_mac_sources, + ".", + "//chrome") sources -= [ # TODO(groby): This test depends on hunspell and we cannot run it on # Mac, which does not use hunspell by default.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 9621e07..367da77c 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -8469.0.0 \ No newline at end of file +8473.0.0 \ No newline at end of file
diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h index 397cb5ff..09f446a 100644 --- a/components/autofill/content/common/autofill_messages.h +++ b/components/autofill/content/common/autofill_messages.h
@@ -333,6 +333,12 @@ IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordNoLongerGenerated, autofill::PasswordForm) +// Sends the outcome of HTML parsing based form classifier that detects the +// forms where password generation should be available. +IPC_MESSAGE_ROUTED2(AutofillHostMsg_SaveGenerationFieldDetectedByClassifier, + autofill::PasswordForm, + base::string16 /* generation field */) + // Instruct the browser to show a popup with suggestions filled from data // associated with |key|. The popup will use |text_direction| for displaying // text.
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc index 33c30aa..0aee606 100644 --- a/components/autofill/content/renderer/password_generation_agent.cc +++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -10,6 +10,7 @@ #include "base/logging.h" #include "components/autofill/content/common/autofill_messages.h" #include "components/autofill/content/renderer/form_autofill_util.h" +#include "components/autofill/content/renderer/form_classifier.h" #include "components/autofill/content/renderer/password_autofill_agent.h" #include "components/autofill/content/renderer/password_form_conversion_utils.h" #include "components/autofill/core/common/autofill_switches.h" @@ -194,6 +195,15 @@ FindPossibleGenerationForm(); } +void PasswordGenerationAgent::RunFormClassifierAndSaveVote( + const blink::WebFormElement& web_form, + const PasswordForm& form) { + base::string16 generation_field; + ClassifyFormAndFindGenerationField(web_form, &generation_field); + Send(new AutofillHostMsg_SaveGenerationFieldDetectedByClassifier( + routing_id(), form, generation_field)); +} + void PasswordGenerationAgent::FindPossibleGenerationForm() { if (!enabled_ || !render_frame()) return; @@ -232,6 +242,7 @@ if (GetAccountCreationPasswordFields( form_util::ExtractAutofillableElementsInForm(forms[i]), &passwords)) { + RunFormClassifierAndSaveVote(forms[i], *password_form); AccountCreationFormData ac_form_data( make_linked_ptr(password_form.release()), passwords); possible_account_creation_forms_.push_back(ac_form_data);
diff --git a/components/autofill/content/renderer/password_generation_agent.h b/components/autofill/content/renderer/password_generation_agent.h index d5ae1ee5..9e1bda3 100644 --- a/components/autofill/content/renderer/password_generation_agent.h +++ b/components/autofill/content/renderer/password_generation_agent.h
@@ -107,6 +107,10 @@ // generation popup at this field. void OnUserTriggeredGeneratePassword(); + // Runs HTML parsing based classifier and saves its outcome to proto. + void RunFormClassifierAndSaveVote(const blink::WebFormElement& web_form, + const PasswordForm& form); + // Creates a password form to presave a generated password. It copies behavior // of CreatePasswordFormFromWebForm/FromUnownedInputElements, but takes // |password_value| from |generation_element_| and empties |username_value|.
diff --git a/components/autofill/core/browser/autofill_field.h b/components/autofill/core/browser/autofill_field.h index 94f8c9d..52137e1a 100644 --- a/components/autofill/core/browser/autofill_field.h +++ b/components/autofill/core/browser/autofill_field.h
@@ -92,6 +92,15 @@ return generation_type_; } + void set_form_classifier_outcome( + AutofillUploadContents::Field::FormClassifierOutcome outcome) { + form_classifier_outcome_ = outcome; + } + AutofillUploadContents::Field::FormClassifierOutcome form_classifier_outcome() + const { + return form_classifier_outcome_; + } + // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, // and |app_locale| as hints when filling exceptional cases like phone number // values and <select> fields. Returns |true| if the field has been filled, @@ -163,6 +172,9 @@ // The type of password generation event, if it happened. AutofillUploadContents::Field::PasswordGenerationType generation_type_; + // The outcome of HTML parsing based form classifier. + AutofillUploadContents::Field::FormClassifierOutcome form_classifier_outcome_; + DISALLOW_COPY_AND_ASSIGN(AutofillField); };
diff --git a/components/autofill/core/browser/proto/server.proto b/components/autofill/core/browser/proto/server.proto index 7dec36bd..46bbfdb 100644 --- a/components/autofill/core/browser/proto/server.proto +++ b/components/autofill/core/browser/proto/server.proto
@@ -34,7 +34,7 @@ // This message contains information about the field types in a single form. // It is sent by the toolbar to contribute to the field type statistics. -// Next available id: 18 +// Next available id: 19 message AutofillUploadContents { required string client_version = 1; required fixed64 form_signature = 2; @@ -83,6 +83,14 @@ } // The type of password generation, if it happened. optional PasswordGenerationType generation_type = 17; + + enum FormClassifierOutcome { + NO_OUTCOME = 0; + NON_GENERATION_ELEMENT = 1; + GENERATION_ELEMENT = 2; + } + // The outcome of HTML parsing based form classifier. + optional FormClassifierOutcome form_classifier_outcome = 18; } // Signature of the form action host (e.g. Hash64Bit("example.com")). optional fixed64 action_signature = 13;
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc index 95a951d..1b2911e 100644 --- a/components/browser_sync/browser/profile_sync_service.cc +++ b/components/browser_sync/browser/profile_sync_service.cc
@@ -360,8 +360,6 @@ StopImpl(CLEAR_DATA); } - TrySyncDatatypePrefRecovery(); - #if defined(OS_CHROMEOS) std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken(); if (bootstrap_token.empty()) { @@ -383,37 +381,6 @@ startup_controller_->TryStart(); } -void ProfileSyncService::TrySyncDatatypePrefRecovery() { - DCHECK(!IsBackendInitialized()); - if (!IsFirstSetupComplete()) - return; - - // There was a bug where OnUserChoseDatatypes was not properly called on - // configuration (see crbug.com/154940). We detect this by checking whether - // kSyncKeepEverythingSynced has a default value. If so, and sync setup has - // completed, it means sync was not properly configured, so we manually - // set kSyncKeepEverythingSynced. - PrefService* const pref_service = sync_client_->GetPrefService(); - if (!pref_service) - return; - if (GetPreferredDataTypes().Size() > 1) - return; - - const PrefService::Preference* keep_everything_synced = - pref_service->FindPreference( - sync_driver::prefs::kSyncKeepEverythingSynced); - // This will be false if the preference was properly set or if it's controlled - // by policy. - if (!keep_everything_synced->IsDefaultValue()) - return; - - // kSyncKeepEverythingSynced was not properly set. Set it and the preferred - // types now, before we configure. - UMA_HISTOGRAM_COUNTS("Sync.DatatypePrefRecovery", 1); - sync_prefs_.SetKeepEverythingSynced(true); - syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); -} - void ProfileSyncService::StartSyncingWithServer() { DCHECK(thread_checker_.CalledOnValidThread()); @@ -651,9 +618,6 @@ if (sync_prefs_.SyncHasAuthError()) { sync_prefs_.SetSyncAuthError(false); - UMA_HISTOGRAM_ENUMERATION("Sync.SyncAuthError", - AUTH_ERROR_FIXED, - AUTH_ERROR_LIMIT); } if (HasSyncingBackend())
diff --git a/components/browser_sync/browser/profile_sync_service.h b/components/browser_sync/browser/profile_sync_service.h index 3fecc3197..2108ecb 100644 --- a/components/browser_sync/browser/profile_sync_service.h +++ b/components/browser_sync/browser/profile_sync_service.h
@@ -679,11 +679,6 @@ // Update the last auth error and notify observers of error state. void UpdateAuthErrorState(const GoogleServiceAuthError& error); - // Detects and attempts to recover from a previous improper datatype - // configuration where Keep Everything Synced and the preferred types were - // not correctly set. - void TrySyncDatatypePrefRecovery(); - // Puts the backend's sync scheduler into NORMAL mode. // Called when configuration is complete. void StartSyncingWithServer();
diff --git a/components/password_manager/content/browser/bad_message.h b/components/password_manager/content/browser/bad_message.h index 90e9ab6..20fee3f5 100644 --- a/components/password_manager/content/browser/bad_message.h +++ b/components/password_manager/content/browser/bad_message.h
@@ -26,6 +26,7 @@ CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION = 5, CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED = 6, CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD = 7, + CPMD_BAD_ORIGIN_SAVE_GENERATION_FIELD_DETECTED_BY_CLASSIFIER = 8, // Please add new elements here. The naming convention is abbreviated class // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc index c53e176..15b406fe 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.cc +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -162,6 +162,8 @@ IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) IPC_MESSAGE_HANDLER(AutofillHostMsg_PresaveGeneratedPassword, OnPresaveGeneratedPassword) + IPC_MESSAGE_HANDLER(AutofillHostMsg_SaveGenerationFieldDetectedByClassifier, + OnSaveGenerationFieldDetectedByClassifier) IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, OnPasswordNoLongerGenerated) IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, @@ -261,6 +263,18 @@ false); } +void ContentPasswordManagerDriver::OnSaveGenerationFieldDetectedByClassifier( + const autofill::PasswordForm& password_form, + const base::string16& generation_field) { + if (!CheckChildProcessSecurityPolicy( + password_form.origin, + BadMessageReason:: + CPMD_BAD_ORIGIN_SAVE_GENERATION_FIELD_DETECTED_BY_CLASSIFIER)) + return; + GetPasswordManager()->SaveGenerationFieldDetectedByClassifier( + password_form, generation_field); +} + bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( const GURL& url, BadMessageReason reason) {
diff --git a/components/password_manager/content/browser/content_password_manager_driver.h b/components/password_manager/content/browser/content_password_manager_driver.h index a1e1014..0315a01e 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.h +++ b/components/password_manager/content/browser/content_password_manager_driver.h
@@ -92,6 +92,9 @@ void OnPresaveGeneratedPassword(const autofill::PasswordForm& password_form); void OnPasswordNoLongerGenerated(const autofill::PasswordForm& password_form); void OnFocusedPasswordFormFound(const autofill::PasswordForm& password_form); + void OnSaveGenerationFieldDetectedByClassifier( + const autofill::PasswordForm& password_form, + const base::string16& generation_field); private: bool CheckChildProcessSecurityPolicy(const GURL& url,
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index 934f291..05d4f85 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -158,6 +158,7 @@ has_generated_password_(false), is_manual_generation_(false), generation_popup_was_shown_(false), + form_classifier_outcome_(kNoOutcome), password_overridden_(false), retry_password_form_password_update_(false), generation_available_(false), @@ -277,7 +278,8 @@ DCHECK(!client_->IsOffTheRecord()); // Configure the form about to be saved for blacklist status. - blacklisted_matches_.push_back(new autofill::PasswordForm(observed_form_)); + blacklisted_matches_.push_back( + base::WrapUnique(new autofill::PasswordForm(observed_form_))); blacklisted_matches_.back()->preferred = false; blacklisted_matches_.back()->blacklisted_by_user = true; blacklisted_matches_.back()->other_possible_usernames.clear(); @@ -461,7 +463,7 @@ [](PasswordForm* form) { return !form->blacklisted_by_user; }); for (auto it = begin_blacklisted; it != logins_result.end(); ++it) { if (IsBlacklistMatch(**it)) { - blacklisted_matches_.push_back(*it); + blacklisted_matches_.push_back(base::WrapUnique(*it)); *it = nullptr; } } @@ -910,6 +912,8 @@ if (generation_popup_was_shown_) AddGeneratedVote(&form_structure); + if (form_classifier_outcome_ != kNoOutcome) + AddFormClassifierVote(&form_structure); // Force uploading as these events are relatively rare and we want to make // sure to receive them. @@ -990,6 +994,8 @@ if (generation_popup_was_shown_) AddGeneratedVote(&form_structure); + if (form_classifier_outcome_ != kNoOutcome) + AddFormClassifierVote(&form_structure); // Force uploading as these events are relatively rare and we want to make // sure to receive them. It also makes testing easier if these requests @@ -1038,6 +1044,24 @@ } } +void PasswordFormManager::AddFormClassifierVote( + autofill::FormStructure* form_structure) { + DCHECK(form_structure); + DCHECK(form_classifier_outcome_ != kNoOutcome); + + for (size_t i = 0; i < form_structure->field_count(); ++i) { + autofill::AutofillField* field = form_structure->field(i); + if (form_classifier_outcome_ == kFoundGenerationElement && + field->name == generation_element_detected_by_classifier_) { + field->set_form_classifier_outcome( + autofill::AutofillUploadContents::Field::GENERATION_ELEMENT); + } else { + field->set_form_classifier_outcome( + autofill::AutofillUploadContents::Field::NON_GENERATION_ELEMENT); + } + } +} + void PasswordFormManager::CreatePendingCredentials() { DCHECK(provisionally_saved_form_); base::string16 password_to_save(PasswordToSave(*provisionally_saved_form_)); @@ -1462,4 +1486,11 @@ presaved_form_.reset(); } +void PasswordFormManager::SaveGenerationFieldDetectedByClassifier( + const base::string16& generation_field) { + form_classifier_outcome_ = + generation_field.empty() ? kNoGenerationElement : kFoundGenerationElement; + generation_element_detected_by_classifier_ = generation_field; +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h index cfe2176d..25c4f2b 100644 --- a/components/password_manager/core/browser/password_form_manager.h +++ b/components/password_manager/core/browser/password_form_manager.h
@@ -219,7 +219,8 @@ return preferred_match_; } - const ScopedVector<autofill::PasswordForm>& blacklisted_matches() const { + const std::vector<std::unique_ptr<autofill::PasswordForm>>& + blacklisted_matches() const { return blacklisted_matches_; } @@ -271,6 +272,10 @@ // Called after successful login on the form with a generated password. void ReplacePresavedPasswordWithPendingCredentials(PasswordStore* store); + // Saves the outcome of HTML parsing based form classifier to upload proto. + void SaveGenerationFieldDetectedByClassifier( + const base::string16& generation_field); + private: // ManagerAction - What does the manager do with this form? Either it // fills it, or it doesn't. If it doesn't fill it, that's either @@ -325,6 +330,13 @@ kFormTypeMax }; + // The outcome of the form classifier. + enum FormClassifierOutcome { + kNoOutcome, + kNoGenerationElement, + kFoundGenerationElement + }; + // The maximum number of combinations of the three preceding enums. // This is used when recording the actions taken by the form in UMA. static const int kMaxNumActionsTaken = @@ -431,6 +443,9 @@ // Adds a vote on password generation usage to |form_structure|. void AddGeneratedVote(autofill::FormStructure* form_structure); + // Adds a vote from HTML parsing based form classifier to |form_structure|. + void AddFormClassifierVote(autofill::FormStructure* form_structure); + // Create pending credentials from provisionally saved form and forms received // from password store. void CreatePendingCredentials(); @@ -481,7 +496,7 @@ // Set of blacklisted forms from the PasswordStore that best match the current // form. - ScopedVector<autofill::PasswordForm> blacklisted_matches_; + std::vector<std::unique_ptr<autofill::PasswordForm>> blacklisted_matches_; // The PasswordForm from the page or dialog managed by |this|. const autofill::PasswordForm observed_form_; @@ -526,6 +541,13 @@ // Whether generation popup was shown at least once. bool generation_popup_was_shown_; + // The outcome of HTML parsing based form classifier. + FormClassifierOutcome form_classifier_outcome_; + + // If |form_classifier_outcome_| == kFoundGenerationElement, the field + // contains the name of the detected generation element. + base::string16 generation_element_detected_by_classifier_; + // Whether the saved password was overridden. bool password_overridden_;
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index f232999..7da6df8 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -144,6 +144,23 @@ return true; } +MATCHER_P2(CheckUploadedFormClassifierVote, + found_generation_element, + generation_element, + "Wrong form classifier votes") { + for (const autofill::AutofillField* field : arg) { + if (found_generation_element && field->name == generation_element) { + EXPECT_EQ(field->form_classifier_outcome(), + autofill::AutofillUploadContents::Field::GENERATION_ELEMENT); + } else { + EXPECT_EQ( + field->form_classifier_outcome(), + autofill::AutofillUploadContents::Field::NON_GENERATION_ELEMENT); + } + } + return true; +} + void ClearVector(ScopedVector<PasswordForm>* results) { results->clear(); } @@ -2957,6 +2974,46 @@ GeneratedVoteUploadTest(true, true, false); } +TEST_F(PasswordFormManagerTest, FormClassifierVoteUpload) { + const bool kFalseTrue[] = {false, true}; + for (bool found_generation_element : kFalseTrue) { + SCOPED_TRACE(testing::Message() << "found_generation_element=" + << found_generation_element); + PasswordForm form(*observed_form()); + form.form_data = saved_match()->form_data; + + // Create submitted form. + PasswordForm submitted_form(form); + submitted_form.preferred = true; + submitted_form.username_value = saved_match()->username_value; + submitted_form.password_value = saved_match()->password_value; + + PasswordFormManager form_manager(password_manager(), client(), + client()->driver(), form, false); + base::string16 generation_element = form.password_element; + if (found_generation_element) + form_manager.SaveGenerationFieldDetectedByClassifier(generation_element); + else + form_manager.SaveGenerationFieldDetectedByClassifier(base::string16()); + + ScopedVector<PasswordForm> result; + form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); + form_manager.OnGetPasswordStoreResults(std::move(result)); + + autofill::FormStructure form_structure(submitted_form.form_data); + + EXPECT_CALL( + *client()->mock_driver()->mock_autofill_download_manager(), + StartUploadRequest(CheckUploadedFormClassifierVote( + found_generation_element, generation_element), + false, _, _, true)); + + form_manager.ProvisionallySave( + submitted_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); + form_manager.Save(); + } +} + TEST_F(PasswordFormManagerTest, TestSavingAPIFormsWithSamePassword) { // Turn |observed_form| and |saved_match| to API created forms. observed_form()->username_element.clear();
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index 766212c..990424c8 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc
@@ -231,6 +231,16 @@ manager->FetchDataFromPasswordStore(); } +void PasswordManager::SaveGenerationFieldDetectedByClassifier( + const autofill::PasswordForm& form, + const base::string16& generation_field) { + if (!client_->IsSavingAndFillingEnabledForCurrentPage()) + return; + PasswordFormManager* form_manager = GetMatchingPendingManager(form); + if (form_manager) + form_manager->SaveGenerationFieldDetectedByClassifier(generation_field); +} + void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { bool is_saving_and_filling_enabled = client_->IsSavingAndFillingEnabledForCurrentPage();
diff --git a/components/password_manager/core/browser/password_manager.h b/components/password_manager/core/browser/password_manager.h index 761fbbcd..1a276427 100644 --- a/components/password_manager/core/browser/password_manager.h +++ b/components/password_manager/core/browser/password_manager.h
@@ -115,6 +115,11 @@ const base::string16& generation_element, bool is_manually_triggered); + // Saves the outcome of HTML parsing based form classifier to uploaded proto. + void SaveGenerationFieldDetectedByClassifier( + const autofill::PasswordForm& form, + const base::string16& generation_field); + // TODO(isherman): This should not be public, but is currently being used by // the LoginPrompt code. // When a form is submitted, we prepare to save the password but wait
diff --git a/components/sync_driver/device_info_sync_service.cc b/components/sync_driver/device_info_sync_service.cc index 879d4d8..22b8d8fa 100644 --- a/components/sync_driver/device_info_sync_service.cc +++ b/components/sync_driver/device_info_sync_service.cc
@@ -10,7 +10,6 @@ #include <utility> #include "base/memory/ptr_util.h" -#include "base/metrics/histogram_macros.h" #include "base/time/time.h" #include "components/sync_driver/device_info_util.h" #include "components/sync_driver/local_device_info_provider.h" @@ -31,38 +30,6 @@ using syncer::SyncErrorFactory; using syncer::SyncMergeResult; -namespace { - -// TODO(pavely): Remove histogram once device_id mismatch is understood -// (crbug/481596). -// When signin_scoped_device_id from pref doesn't match the one in -// DeviceInfoSpecfics record histogram telling if sync or pref copy was empty. -// This will indicate how often such mismatch happens and what was the state -// before. -enum DeviceIdMismatchForHistogram { - DEVICE_ID_MISMATCH_BOTH_NONEMPTY = 0, - DEVICE_ID_MISMATCH_SYNC_EMPTY, - DEVICE_ID_MISMATCH_PREF_EMPTY, - DEVICE_ID_MISMATCH_COUNT, -}; - -void RecordDeviceIdChangedHistogram(const std::string& device_id_from_sync, - const std::string& device_id_from_pref) { - DCHECK(device_id_from_sync != device_id_from_pref); - DeviceIdMismatchForHistogram device_id_mismatch_for_histogram = - DEVICE_ID_MISMATCH_BOTH_NONEMPTY; - if (device_id_from_sync.empty()) { - device_id_mismatch_for_histogram = DEVICE_ID_MISMATCH_SYNC_EMPTY; - } else if (device_id_from_pref.empty()) { - device_id_mismatch_for_histogram = DEVICE_ID_MISMATCH_PREF_EMPTY; - } - UMA_HISTOGRAM_ENUMERATION("Sync.DeviceIdMismatchDetails", - device_id_mismatch_for_histogram, - DEVICE_ID_MISMATCH_COUNT); -} - -} // namespace - DeviceInfoSyncService::DeviceInfoSyncService( LocalDeviceInfoProvider* local_device_info_provider) : local_device_info_provider_(local_device_info_provider) { @@ -114,15 +81,6 @@ std::unique_ptr<DeviceInfo> synced_local_device_info = base::WrapUnique(CreateDeviceInfo(*iter)); - // TODO(pavely): Remove histogram once device_id mismatch is understood - // (crbug/481596). - if (synced_local_device_info->signin_scoped_device_id() != - local_device_info->signin_scoped_device_id()) { - RecordDeviceIdChangedHistogram( - synced_local_device_info->signin_scoped_device_id(), - local_device_info->signin_scoped_device_id()); - } - pulse_delay = DeviceInfoUtil::CalculatePulseDelay( GetLastUpdateTime(*iter), Time::Now()); // Store the synced device info for the local device only if
diff --git a/components/sync_driver/glue/sync_backend_host_core.cc b/components/sync_driver/glue/sync_backend_host_core.cc index 0871e277..a36b4b7 100644 --- a/components/sync_driver/glue/sync_backend_host_core.cc +++ b/components/sync_driver/glue/sync_backend_host_core.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/files/file_util.h" #include "base/location.h" -#include "base/metrics/histogram.h" #include "base/single_thread_task_runner.h" #include "components/data_use_measurement/core/data_use_user_data.h" #include "components/invalidation/public/invalidation_util.h" @@ -47,15 +46,6 @@ namespace { -// Enums for UMAs. -enum SyncBackendInitState { - SETUP_COMPLETED_FOUND_RESTORED_TYPES = 0, - SETUP_COMPLETED_NO_RESTORED_TYPES, - FIRST_SETUP_NO_RESTORED_TYPES, - FIRST_SETUP_RESTORED_TYPES, - SYNC_BACKEND_INIT_STATE_COUNT -}; - void BindFetcherToDataTracker(net::URLFetcher* fetcher) { data_use_measurement::DataUseUserData::AttachToFetcher( fetcher, data_use_measurement::DataUseUserData::SYNC); @@ -188,22 +178,6 @@ js_backend_ = js_backend; debug_info_listener_ = debug_info_listener; - // Track whether or not sync DB and preferences were in sync. - SyncBackendInitState backend_init_state; - if (has_sync_setup_completed_ && !restored_types.Empty()) { - backend_init_state = SETUP_COMPLETED_FOUND_RESTORED_TYPES; - } else if (has_sync_setup_completed_ && restored_types.Empty()) { - backend_init_state = SETUP_COMPLETED_NO_RESTORED_TYPES; - } else if (!has_sync_setup_completed_ && restored_types.Empty()) { - backend_init_state = FIRST_SETUP_NO_RESTORED_TYPES; - } else { // (!has_sync_setup_completed_ && !restored_types.Empty()) - backend_init_state = FIRST_SETUP_RESTORED_TYPES; - } - - UMA_HISTOGRAM_ENUMERATION("Sync.BackendInitializeRestoreState", - backend_init_state, - SYNC_BACKEND_INIT_STATE_COUNT); - // Before proceeding any further, we need to download the control types and // purge any partial data (ie. data downloaded for a type that was on its way // to being initially synced, but didn't quite make it.). The following
diff --git a/components/sync_sessions/favicon_cache.cc b/components/sync_sessions/favicon_cache.cc index 3edd698b..51e9494d 100644 --- a/components/sync_sessions/favicon_cache.cc +++ b/components/sync_sessions/favicon_cache.cc
@@ -280,8 +280,6 @@ // they'll be re-added and the appropriate synced favicons will be evicted. // TODO(zea): implement a smarter ordering of the which favicons to drop. int available_favicons = max_sync_favicon_limit_ - initial_sync_data.size(); - UMA_HISTOGRAM_BOOLEAN("Sync.FaviconsAvailableAtMerge", - available_favicons > 0); for (std::set<GURL>::const_iterator iter = unsynced_favicon_urls.begin(); iter != unsynced_favicon_urls.end(); ++iter) { if (available_favicons > 0) { @@ -298,7 +296,6 @@ merge_result.set_num_items_deleted(merge_result.num_items_deleted() + 1); } } - UMA_HISTOGRAM_COUNTS_10000("Sync.FaviconCount", synced_favicons_.size()); merge_result.set_num_items_after_association(synced_favicons_.size()); if (type == syncer::FAVICON_IMAGES) { @@ -621,11 +618,6 @@ // TODO(zea): support multiple favicon urls per page. page_favicon_map_[page_url] = favicon_url; - if (!favicon_info->last_visit_time.is_null()) { - UMA_HISTOGRAM_COUNTS_10000( - "Sync.FaviconVisitPeriod", - (now - favicon_info->last_visit_time).InHours()); - } favicon_info->received_local_update = true; UpdateFaviconVisitTime(favicon_url, now);
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc index 1eda60b..e61f9e8 100644 --- a/content/browser/service_worker/service_worker_register_job.cc +++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -492,8 +492,13 @@ // "9. If registration.waitingWorker is not null, then:..." if (registration()->waiting_version()) { - // "1. Run the [[UpdateState]] algorithm passing registration.waitingWorker - // and "redundant" as the arguments." + // 1. Set redundantWorker to registration’s waiting worker. + // 2. Terminate redundantWorker. + registration()->waiting_version()->StopWorker( + base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); + // TODO(falken): Move this further down. The spec says to set status to + // 'redundant' after promoting the new version to .waiting attribute and + // 'installed' status. registration()->waiting_version()->SetStatus( ServiceWorkerVersion::REDUNDANT); }
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 621f6cf..2dfb353 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -547,11 +547,6 @@ TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::Request", request, "Handled", was_handled); custom_requests_.Remove(request_id); - if (is_redundant()) { - // The stop should be already scheduled, but try to stop immediately, in - // order to release worker resources soon. - StopWorkerIfIdle(); - } return true; } @@ -603,8 +598,6 @@ void ServiceWorkerVersion::RemoveStreamingURLRequestJob( const ServiceWorkerURLRequestJob* request_job) { streaming_url_request_jobs_.erase(request_job); - if (is_redundant()) - StopWorkerIfIdle(); } void ServiceWorkerVersion::AddListener(Listener* listener) {
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn index c608f0fb..7cf0883 100644 --- a/ipc/BUILD.gn +++ b/ipc/BUILD.gn
@@ -133,9 +133,6 @@ ] deps = [ "//base", - - # TODO(viettrungluu): Needed for base/lazy_instance.h, which is suspect. - "//base/third_party/dynamic_annotations", "//mojo/public/cpp/bindings", ]
diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp index 5f81d9e..ccc3cc3 100644 --- a/ipc/ipc.gyp +++ b/ipc/ipc.gyp
@@ -18,8 +18,6 @@ }, 'dependencies': [ '../base/base.gyp:base', - # TODO(viettrungluu): Needed for base/lazy_instance.h, which is suspect. - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../mojo/mojo_public.gyp:mojo_cpp_system', ], @@ -180,9 +178,6 @@ }, 'dependencies': [ '../base/base.gyp:base_win64', - # TODO(viettrungluu): Needed for base/lazy_instance.h, which is - # suspect. - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', '../crypto/crypto.gyp:crypto_nacl_win64', '../mojo/mojo_public.gyp:mojo_cpp_bindings_win64', '../mojo/mojo_public.gyp:mojo_cpp_system_win64',
diff --git a/ipc/mojo/BUILD.gn b/ipc/mojo/BUILD.gn index 1ac5a01..fd6bbb5e 100644 --- a/ipc/mojo/BUILD.gn +++ b/ipc/mojo/BUILD.gn
@@ -32,7 +32,6 @@ deps = [ ":mojom", "//base", - "//base/third_party/dynamic_annotations", "//ipc", "//mojo/public/c/system", "//mojo/public/cpp/bindings", @@ -51,7 +50,6 @@ ":mojom", "//base", "//base/test:test_support", - "//base/third_party/dynamic_annotations", "//ipc", "//ipc:test_support", "//mojo/edk/system", @@ -72,7 +70,6 @@ ":mojom", "//base", "//base/test:test_support", - "//base/third_party/dynamic_annotations", "//ipc", "//ipc:test_support", "//mojo/edk/system",
diff --git a/ipc/mojo/ipc_mojo.gyp b/ipc/mojo/ipc_mojo.gyp index 34ac67a4..73881770 100644 --- a/ipc/mojo/ipc_mojo.gyp +++ b/ipc/mojo/ipc_mojo.gyp
@@ -21,7 +21,6 @@ 'dependencies': [ '../ipc.gyp:ipc', '../../base/base.gyp:base', - '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', ],
diff --git a/media/gpu/v4l2_slice_video_decode_accelerator.cc b/media/gpu/v4l2_slice_video_decode_accelerator.cc index 276c39a..d56e655 100644 --- a/media/gpu/v4l2_slice_video_decode_accelerator.cc +++ b/media/gpu/v4l2_slice_video_decode_accelerator.cc
@@ -1838,17 +1838,12 @@ DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); - if (!decoder_input_queue_.empty()) { - // We are not done with pending inputs, so queue an empty buffer, - // which - when reached - will trigger flush sequence. - decoder_input_queue_.push( - linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( - decode_client_, decode_task_runner_, nullptr, kFlushBufferId))); - return; - } + // Queue an empty buffer which - when reached - will trigger flush sequence. + decoder_input_queue_.push( + linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( + decode_client_, decode_task_runner_, nullptr, kFlushBufferId))); - // No more inputs pending, so just finish flushing here. - InitiateFlush(); + ScheduleDecodeBufferTaskIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::InitiateFlush() {
diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn index 9a8b7d0..8b57be3 100644 --- a/mojo/common/BUILD.gn +++ b/mojo/common/BUILD.gn
@@ -43,10 +43,6 @@ "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", ] - - deps = [ - "//base/third_party/dynamic_annotations", - ] } # GYP version: mojo/mojo_base.gyp:mojo_url_type_converters @@ -62,7 +58,6 @@ deps = [ "//base", - "//base/third_party/dynamic_annotations", "//url", ] }
diff --git a/mojo/edk/system/BUILD.gn b/mojo/edk/system/BUILD.gn index 0b2f15f8..e0e80459 100644 --- a/mojo/edk/system/BUILD.gn +++ b/mojo/edk/system/BUILD.gn
@@ -88,7 +88,6 @@ deps = [ "//base", - "//base/third_party/dynamic_annotations", ] if (!is_nacl) {
diff --git a/mojo/message_pump/BUILD.gn b/mojo/message_pump/BUILD.gn index b7240fa..e1ae4af2 100644 --- a/mojo/message_pump/BUILD.gn +++ b/mojo/message_pump/BUILD.gn
@@ -21,8 +21,4 @@ "//base", "//mojo/public/cpp/system", ] - - deps = [ - "//base/third_party/dynamic_annotations", - ] }
diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp index cd800cdb..f7e1572 100644 --- a/mojo/mojo_base.gyp +++ b/mojo/mojo_base.gyp
@@ -44,12 +44,8 @@ ], 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../mojo/mojo_public.gyp:mojo_public_system', ], - 'export_dependent_settings': [ - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - ], 'sources': [ 'common/common_type_converters.cc', 'common/common_type_converters.h', @@ -81,13 +77,9 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../url/url.gyp:url_lib', '../mojo/mojo_public.gyp:mojo_public_system', ], - 'export_dependent_settings': [ - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - ], 'sources': [ 'common/url_type_converters.cc', 'common/url_type_converters.h', @@ -160,7 +152,6 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'mojo_common_lib', 'mojo_edk.gyp:mojo_system_impl', 'mojo_jni_headers',
diff --git a/mojo/mojo_edk.gyp b/mojo/mojo_edk.gyp index 318a817..bd99c42 100644 --- a/mojo/mojo_edk.gyp +++ b/mojo/mojo_edk.gyp
@@ -26,7 +26,6 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../crypto/crypto.gyp:crypto', ], 'sources': [ @@ -39,7 +38,6 @@ 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../crypto/crypto.gyp:crypto', 'mojo_public.gyp:mojo_public_system', 'mojo_system_ports', @@ -187,7 +185,6 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base_win64', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', '../crypto/crypto.gyp:crypto_nacl_win64', ], 'sources': [ @@ -205,7 +202,6 @@ 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base_win64', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', '../crypto/crypto.gyp:crypto_nacl_win64', 'mojo_public.gyp:mojo_public_system_win64', 'mojo_system_ports_win64',
diff --git a/mojo/mojo_edk_nacl.gyp b/mojo/mojo_edk_nacl.gyp index ef3de42..ac562d5 100644 --- a/mojo/mojo_edk_nacl.gyp +++ b/mojo/mojo_edk_nacl.gyp
@@ -31,7 +31,6 @@ 'dependencies': [ '../base/base_nacl.gyp:base_nacl', '../base/base_nacl.gyp:base_nacl_nonsfi', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'mojo_public.gyp:mojo_public_system', ], 'defines': [
diff --git a/mojo/mojo_public.gyp b/mojo/mojo_public.gyp index 52671c093..c52d21f 100644 --- a/mojo/mojo_public.gyp +++ b/mojo/mojo_public.gyp
@@ -74,12 +74,8 @@ ], 'dependencies': [ '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'mojo_cpp_system', ], - 'export_dependent_settings': [ - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - ], 'sources': [ 'message_pump/handle_watcher.cc', 'message_pump/handle_watcher.h',
diff --git a/mojo/mojo_public_nacl.gyp b/mojo/mojo_public_nacl.gyp index cb0d7fb..c235c05 100644 --- a/mojo/mojo_public_nacl.gyp +++ b/mojo/mojo_public_nacl.gyp
@@ -52,7 +52,6 @@ 'dependencies': [ '../base/base_nacl.gyp:base_nacl', '../base/base_nacl.gyp:base_nacl_nonsfi', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../mojo/mojo_public.gyp:mojo_interface_bindings_cpp_sources', 'mojo_cpp_system_nacl', ],
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 259581a..fa649549 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc
@@ -302,13 +302,12 @@ } void SpdyHttpStream::OnRequestHeadersSent() { - if (!request_callback_.is_null()) - DoRequestCallback(OK); - - // TODO(akalin): Do this immediately after sending the request - // headers. - if (HasUploadData()) + if (HasUploadData()) { ReadAndSendRequestBodyData(); + } else { + if (!request_callback_.is_null()) + DoRequestCallback(OK); + } } SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated( @@ -436,9 +435,16 @@ void SpdyHttpStream::ReadAndSendRequestBodyData() { CHECK(HasUploadData()); CHECK_EQ(request_body_buf_size_, 0); - - if (request_info_->upload_data_stream->IsEOF()) + if (request_info_->upload_data_stream->IsEOF()) { + // This callback does not happen to be called, because it is called + // in OnRequestBodyReadCompleted() function when eof happens, and then it + // is cleared. But better to be paranoid and handle this just in case. + // Generally, this eof check just makes sure it is really the eof and then + // doloop exists. + if (!request_callback_.is_null()) + DoRequestCallback(OK); return; + } // Read the data from the request body stream. const int rv = request_info_->upload_data_stream @@ -458,9 +464,12 @@ CHECK_GE(status, 0); request_body_buf_size_ = status; const bool eof = request_info_->upload_data_stream->IsEOF(); - // Only the final fame may have a length of 0. + // Only the final frame may have a length of 0. if (eof) { CHECK_GE(request_body_buf_size_, 0); + // Call the cb only after all data is sent. + if (!request_callback_.is_null()) + DoRequestCallback(OK); } else { CHECK_GT(request_body_buf_size_, 0); } @@ -533,7 +542,6 @@ void SpdyHttpStream::DoRequestCallback(int rv) { CHECK_NE(rv, ERR_IO_PENDING); CHECK(!request_callback_.is_null()); - // Since Run may result in being called back, reset request_callback_ in // advance. base::ResetAndReturn(&request_callback_).Run(rv);
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index 8724853..e1c8726 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -390,6 +390,64 @@ EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key)); } +// This unittest tests the request callback is properly called and handled. +TEST_P(SpdyHttpStreamTest, SendChunkedPostLastEmpty) { + std::unique_ptr<SpdySerializedFrame> req( + spdy_util_.ConstructChunkedSpdyPost(NULL, 0)); + std::unique_ptr<SpdySerializedFrame> chunk( + spdy_util_.ConstructSpdyBodyFrame(1, nullptr, 0, true)); + MockWrite writes[] = { + CreateMockWrite(*req, 0), // request + CreateMockWrite(*chunk, 1), + }; + + std::unique_ptr<SpdySerializedFrame> resp( + spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); + MockRead reads[] = { + CreateMockRead(*resp, 2), + CreateMockRead(*chunk, 3), + MockRead(SYNCHRONOUS, 0, 4) // EOF + }; + + HostPortPair host_port_pair("www.example.org", 80); + SpdySessionKey key(host_port_pair, ProxyServer::Direct(), + PRIVACY_MODE_DISABLED); + InitSession(reads, arraysize(reads), writes, arraysize(writes), key); + EXPECT_EQ(spdy_util_.spdy_version(), session_->GetProtocolVersion()); + + ChunkedUploadDataStream upload_stream(0); + upload_stream.AppendData(nullptr, 0, true); + + HttpRequestInfo request; + request.method = "POST"; + request.url = GURL("http://www.example.org/"); + request.upload_data_stream = &upload_stream; + + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); + + TestCompletionCallback callback; + HttpResponseInfo response; + HttpRequestHeaders headers; + BoundNetLog net_log; + SpdyHttpStream http_stream(session_, true); + ASSERT_EQ(OK, http_stream.InitializeStream(&request, DEFAULT_PRIORITY, + net_log, CompletionCallback())); + EXPECT_EQ(ERR_IO_PENDING, + http_stream.SendRequest(headers, &response, callback.callback())); + EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); + + EXPECT_EQ(OK, callback.WaitForResult()); + + EXPECT_EQ(static_cast<int64_t>(req->size() + chunk->size()), + http_stream.GetTotalSentBytes()); + EXPECT_EQ(static_cast<int64_t>(resp->size() + chunk->size()), + http_stream.GetTotalReceivedBytes()); + + // Because the server closed the connection, there shouldn't be a session + // in the pool anymore. + EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key)); +} + TEST_P(SpdyHttpStreamTest, ConnectionClosedDuringChunkedPost) { BufferedSpdyFramer framer(spdy_util_.spdy_version()); @@ -437,7 +495,7 @@ http_stream.SendRequest(headers, &response, callback.callback())); EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); - EXPECT_EQ(OK, callback.WaitForResult()); + EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); EXPECT_EQ(static_cast<int64_t>(req->size() + body->size()), http_stream.GetTotalSentBytes()); @@ -520,8 +578,7 @@ // Complete the initial request write and the first chunk. base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(callback.have_result()); - EXPECT_EQ(OK, callback.WaitForResult()); + ASSERT_FALSE(callback.have_result()); // Now append the final two chunks which will enqueue two more writes. upload_stream.AppendData(kUploadData1, kUploadData1Size, false); @@ -529,6 +586,8 @@ // Finish writing all the chunks and do all reads. base::RunLoop().RunUntilIdle(); + ASSERT_TRUE(callback.have_result()); + EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_EQ(static_cast<int64_t>(req->size() + chunk1->size() + chunk2->size() + chunk3->size()), @@ -620,8 +679,7 @@ // Complete the initial request write and the first chunk. base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(callback.have_result()); - EXPECT_EQ(OK, callback.WaitForResult()); + ASSERT_FALSE(callback.have_result()); EXPECT_EQ(static_cast<int64_t>(req->size() + chunk1->size()), http_stream->GetTotalSentBytes()); @@ -632,6 +690,8 @@ // Finish writing the final frame, and perform all reads. base::RunLoop().RunUntilIdle(); + ASSERT_TRUE(callback.have_result()); + EXPECT_EQ(OK, callback.WaitForResult()); // Check response headers. ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); @@ -835,8 +895,7 @@ // Complete the initial request write and first chunk. base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(callback.have_result()); - EXPECT_EQ(OK, callback.WaitForResult()); + ASSERT_FALSE(callback.have_result()); EXPECT_EQ(static_cast<int64_t>(req->size()), http_stream->GetTotalSentBytes()); @@ -844,6 +903,9 @@ upload_stream.AppendData(kUploadData, kUploadDataSize, true); + ASSERT_TRUE(callback.have_result()); + EXPECT_EQ(OK, callback.WaitForResult()); + // Verify that the window size has decreased. ASSERT_TRUE(http_stream->stream() != NULL); EXPECT_NE(static_cast<int>(
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 85b17e5..cf86f69 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -280,7 +280,7 @@ session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); } - void WaitForHeaders() { output_.rv = callback_.WaitForResult(); } + void WaitForCallbackToComplete() { output_.rv = callback_.WaitForResult(); } // Most tests will want to call this function. In particular, the MockReads // should end with an empty read, and that read needs to be processed to @@ -2051,8 +2051,7 @@ ASSERT_TRUE(helper.StartDefaultTest()); - helper.WaitForHeaders(); - EXPECT_EQ(OK, helper.output().rv); + base::RunLoop().RunUntilIdle(); // Process the request headers, SYN_REPLY, and response body. // The request body is still in flight. @@ -2061,6 +2060,8 @@ // Finish sending the request body. upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, true); + helper.WaitForCallbackToComplete(); + EXPECT_EQ(OK, helper.output().rv); std::string response_body; EXPECT_EQ(OK, ReadTransaction(helper.trans(), &response_body));
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index b3d4217b..6a0fae6 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1377,8 +1377,6 @@ crbug.com/592185 fast/repaint/fixed-right-in-page-scale.html [ Failure Pass ] -crbug.com/592409 inspector-protocol/debugger/stepping-with-blackboxed-ranges.html [ Failure ] - crbug.com/594595 [ Linux ] http/tests/security/mixedContent/websocket/insecure-websocket-in-secure-page-worker-allowed.html [ Timeout Pass ] crbug.com/617799 crbug.com/619630 compositing/squashing/iframe-inside-squashed-layer.html [ NeedsRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-expected.txt deleted file mode 100644 index 2b18d47..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -EXPECTED (video.currentTime == '0') OK -EVENT(canplaythrough) -EXPECTED (video.currentTime == '0') OK -EVENT(play) -EXPECTED (video.currentTime > '0') OK -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-set-expected.txt deleted file mode 100644 index 44c8ffd5..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time - -EVENT(canplaythrough) -EXPECTED (video.currentTime == '0') OK -RUN(video.currentTime = video.duration - 0.2) -EVENT(seeked) -EXPECTED (video.currentTime.toFixed(2) == '5.82') OK -RUN(video.play()) - -EVENT(ended) -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set.html b/third_party/WebKit/LayoutTests/media/video-currentTime-set.html index d8689ad..614144b 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-set.html
@@ -1,32 +1,25 @@ -<html> -<body> +<!DOCTYPE html> +<title>Test that setting currentTime changes the time, and that "ended" event is fired in a reasonable amount of time.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); - <video controls></video> - - <p>Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time</p> - - <script src=media-file.js></script> - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> - <script src=video-test.js></script> - <script> - waitForEventOnce('canplaythrough', - function () { - waitForEventAndEnd('ended'); - - testExpected("video.currentTime", 0); - run("video.currentTime = video.duration - 0.2"); + video.oncanplaythrough = t.step_func(function () { + video.oncanplaythrough = null; + video.onended = t.step_func_done(); + assert_equals(video.currentTime, 0); + video.currentTime = video.duration - 0.2; }); - waitForEvent('seeked', - function () { - testExpected("video.currentTime.toFixed(2)", (video.duration - 0.2).toFixed(2)); - run("video.play()"); - consoleWrite(""); + video.onseeked = t.step_func(function () { + assert_equals(video.currentTime.toFixed(2), (video.duration - 0.2).toFixed(2)); + video.play(); }); video.src = findMediaFile("video", "content/test"); - </script> - -</body> -</html> +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set2-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-set2-expected.txt deleted file mode 100644 index e473fad..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set2-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -EVENT(canplaythrough) -TEST(video.currentTime = -Infinity) THROWS("TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.") OK -TEST(video.currentTime = Infinity) THROWS("TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.") OK -TEST(video.currentTime = NaN) THROWS("TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.") OK -EXPECTED (video.currentTime.toFixed(1) == '1.5') OK -EXPECTED (video.currentTime.toFixed(1) == '3.1') OK -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html b/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html index f55a9c2..350c058 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-set2.html
@@ -1,20 +1,24 @@ -<video controls></video> -<script src=media-file.js></script> -<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> -<script src=video-test.js></script> +<!DOCTYPE html> +<title>Test that setting currentTime changes the time, and setting invalid values throw exceptions.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> <script> - waitForEvent('canplaythrough', - function () { - testException("video.currentTime = -Infinity", '"TypeError: Failed to set the \'currentTime\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); - testException("video.currentTime = Infinity", '"TypeError: Failed to set the \'currentTime\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); - testException("video.currentTime = NaN", '"TypeError: Failed to set the \'currentTime\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); +async_test(function(t) { + var video = document.querySelector("video"); + + video.oncanplaythrough = t.step_func_done(function () { + assert_throws(new TypeError, function() { video.currentTime = -Infinity; }); + assert_throws(new TypeError, function() { video.currentTime = Infinity; }); + assert_throws(new TypeError, function() { video.currentTime = NaN; }); video.currentTime = 1.5; - testExpected("video.currentTime.toFixed(1)", 1.5); + assert_equals(video.currentTime, 1.5); video.play(); video.currentTime = 3.1; - testExpected("video.currentTime.toFixed(1)", 3.1); - endTest(); + assert_equals(video.currentTime, 3.1); }); + video.src = findMediaFile("video", "content/test"); -</script> +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime.html b/third_party/WebKit/LayoutTests/media/video-currentTime.html index df46d6a..b8b190c9 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime.html
@@ -1,17 +1,23 @@ -<video controls></video> -<script src=media-file.js></script> -<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> -<script src=video-test.js></script> +<!DOCTYPE html> +<title>Test media current time values.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> <script> - testExpected("video.currentTime", 0) - waitForEvent('canplaythrough', function() { testExpected("video.currentTime", 0); } ); - video.addEventListener('canplaythrough', function() { video.play(); setTimeout(testCurrentTime, 500) }); - waitForEvent('play'); - function testCurrentTime() - { - testExpected("video.currentTime", 0, '>') - endTest(); - } +async_test(function(t) { + var video = document.querySelector("video"); + assert_equals(video.currentTime, 0); + + video.oncanplaythrough = t.step_func(function() { + assert_equals(video.currentTime, 0); + video.play(); + + setTimeout(t.step_func_done(function() { + assert_greater_than(video.currentTime, 0); + }), 500); + }); + video.src = findMediaFile("video", "content/test"); -</script> +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html b/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html deleted file mode 100644 index 1e33bb7..0000000 --- a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html +++ /dev/null
@@ -1,37 +0,0 @@ -<!DOCTYPE html> -<script src='../resources/testharness.js'></script> -<script src='../resources/testharnessreport.js'></script> -<script src='resources/shadow-dom.js'></script> -<div id='d1'> - <template data-mode='open' data-expose-as='d1_shadow'> - <slot name='d1-s1'></slot> - </template> - <div id='d2' slot='d1-s1'></div> -</div> -<script> -'use strict'; -convertTemplatesToShadowRootsWithin(d1); -removeWhiteSpaceOnlyTextNodes(d1); - -async_test((test) => { - - const d1_s1 = d1_shadow.querySelector('slot'); - - assert_array_equals(d1_s1.assignedNodes(), [d2]); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); - - d1_s1.addEventListener('slotchange', (e) => { - test.step(() => { - assert_equals(e.target, d1_s1); - assert_array_equals(d1_s1.assignedNodes(), [d2, d3]); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2, d3]); - test.done(); - }); - }); - - const d3 = document.createElement('div'); - d3.setAttribute('id', 'd3'); - d3.setAttribute('slot', 'd1-s1'); - d1.appendChild(d3); -}, "slotchange event caused by appending a host child"); -</script>
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-node-removed.html b/third_party/WebKit/LayoutTests/shadow-dom/slotchange-node-removed.html deleted file mode 100644 index 6c92e64..0000000 --- a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-node-removed.html +++ /dev/null
@@ -1,34 +0,0 @@ -<!DOCTYPE html> -<script src='../resources/testharness.js'></script> -<script src='../resources/testharnessreport.js'></script> -<script src='resources/shadow-dom.js'></script> -<div id='d1'> - <template data-mode='open' data-expose-as='d1_shadow'> - <slot name='d1-s1'></slot> - </template> - <div id='d2' slot='d1-s1'></div> -</div> -<script> -'use strict'; -convertTemplatesToShadowRootsWithin(d1); -removeWhiteSpaceOnlyTextNodes(d1); - -async_test((test) => { - - const d1_s1 = d1_shadow.querySelector('slot'); - - assert_array_equals(d1_s1.assignedNodes(), [d2]); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); - - d1_s1.addEventListener('slotchange', (e) => { - test.step(() => { - assert_equals(e.target, d1_s1); - assert_array_equals(d1_s1.assignedNodes(), []); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), []); - test.done(); - }); - }); - - d2.remove(); -}, "slotchange event caused by removing a node"); -</script>
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-slotname-renamed.html b/third_party/WebKit/LayoutTests/shadow-dom/slotchange-slotname-renamed.html deleted file mode 100644 index 933c54d..0000000 --- a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-slotname-renamed.html +++ /dev/null
@@ -1,37 +0,0 @@ -<!DOCTYPE html> -<script src='../resources/testharness.js'></script> -<script src='../resources/testharnessreport.js'></script> -<script src='resources/shadow-dom.js'></script> -<!-- This is a micro benchmark to catch an unintentional regression. - If the reason of a regression is clear, it is okay. - We do not have to optimize the result of the benchmark. --> -<div id='d1'> - <template data-mode='open' data-expose-as='d1_shadow'> - <slot name='d1-s1'></slot> - </template> - <div id='d2' slot='d1-s1'></div> -</div> -<script> -'use strict'; -convertTemplatesToShadowRootsWithin(d1); -removeWhiteSpaceOnlyTextNodes(d1); - -async_test((test) => { - - const d1_s1 = d1_shadow.querySelector('slot'); - - assert_array_equals(d1_s1.assignedNodes(), [d2]); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); - - d1_s1.addEventListener('slotchange', (e) => { - test.step(() => { - assert_equals(e.target, d1_s1); - assert_array_equals(d1_s1.assignedNodes(), []); - assert_array_equals(d1_s1.assignedNodes({'flatten': true}), []); - test.done(); - }); - }); - - d2.setAttribute('slot', 'non-exist'); -}, "slotchange event caused by renaming slot name"); -</script>
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html b/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html new file mode 100644 index 0000000..6dcd9a9a --- /dev/null +++ b/third_party/WebKit/LayoutTests/shadow-dom/slotchange.html
@@ -0,0 +1,268 @@ +<!DOCTYPE html> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="resources/shadow-dom.js"></script> + +<div id="test1"> + <div id="host1"> + <template data-mode="open"> + <slot id="s1" name="slot1"></slot> + </template> + <div id="c1" slot="slot1"></div> + </div> +</div> + +<script> +function doneIfSlotChange(slots, test) { + let fired = new Set(); + for (let slot of slots) { + slot.addEventListener('slotchange', test.step_func((e) => { + assert_false(fired.has(slot.id)); + fired.add(slot.id); + if (fired.size == slots.length) { + test.done(); + } + })) + } +} + +async_test((test) => { + let n = createTestTree(test1); + removeWhiteSpaceOnlyTextNodes(n.test1); + + doneIfSlotChange([n.s1], test); + + let d1 = document.createElement('div'); + d1.setAttribute('slot', 'slot1'); + n.host1.appendChild(d1); +}, 'slotchange event: Append a child to a host.'); + +async_test((test) => { + let n = createTestTree(test1); + removeWhiteSpaceOnlyTextNodes(n.test1); + + doneIfSlotChange([n.s1], test); + + n.c1.remove(); +}, 'slotchange event: Remove a child from a host.'); + +async_test((test) => { + let n = createTestTree(test1); + removeWhiteSpaceOnlyTextNodes(n.test1); + + n.c1.remove(); + + doneIfSlotChange([n.s1], test); +}, 'slotchange event: Remove a child before adding an event listener.'); + +async_test((test) => { + let n = createTestTree(test1); + removeWhiteSpaceOnlyTextNodes(n.test1); + + doneIfSlotChange([n.s1], test); + + n.c1.setAttribute('slot', 'slot-none'); +}, 'slotchange event: Change slot= attribute to make it un-assigned.'); + +async_test((test) => { + let n = createTestTree(test1); + removeWhiteSpaceOnlyTextNodes(n.test1); + + doneIfSlotChange([n.s1], test); + + n.s1.setAttribute('name', 'slot-none'); +}, 'slotchange event: Change slot\'s name= attribute so that none is assigned.'); +</script> + +<div id="test2"> + <div id="host1"> + <template data-mode="open"> + <slot id="s1" name="slot1"></slot> + </template> + <div id="c2" slot="slot2"></div> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test2); + removeWhiteSpaceOnlyTextNodes(n.test2); + + doneIfSlotChange([n.s1], test); + + n.c2.setAttribute('slot', 'slot1'); +}, 'slotchange event: Change slot= attribute to make it assigned.'); + +async_test((test) => { + let n = createTestTree(test2); + removeWhiteSpaceOnlyTextNodes(n.test2); + + doneIfSlotChange([n.s1], test); + + n.s1.setAttribute('name', 'slot2'); +}, 'slotchange event: Change slot\'s name= attribute so that a node is assigned to the slot.'); +</script> + +<div id="test_fallback"> + <div id="host1"> + <template data-mode="open"> + <slot id="s1"></slot> + </template> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test_fallback); + removeWhiteSpaceOnlyTextNodes(n.test_fallback); + + doneIfSlotChange([n.s1], test); + + n.s1.appendChild(document.createElement('div')); +}, 'slotchange event: Add a fallback content.'); +</script> + +<div id="test_fallback2"> + <div id="host1"> + <template data-mode="open"> + <slot id="s1"> + <div id="f1"></div> + </slot> + </template> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test_fallback2); + removeWhiteSpaceOnlyTextNodes(n.test_fallback2); + + doneIfSlotChange([n.s1], test); + + n.f1.remove(); +}, 'slotchange event: Remove a fallback content.'); +</script> + +<div id="test_fallback3"> + <div id="host1"> + <template data-mode="open"> + <slot id="s2"> + <slot id="s1"> + <div id="f1"></div> + </slot> + </slot> + </template> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test_fallback3); + removeWhiteSpaceOnlyTextNodes(n.test_fallback3); + + doneIfSlotChange([n.s1, n.s2], test); + + n.s1.appendChild(document.createElement('div')); +}, 'slotchange event: Add a fallback content to nested slots.'); + +async_test((test) => { + let n = createTestTree(test_fallback3); + removeWhiteSpaceOnlyTextNodes(n.test_fallback3); + + doneIfSlotChange([n.s1, n.s2], test); + + n.f1.remove(); +}, 'slotchange event: Remove a fallback content from nested slots.'); +</script> + +<div id="test3"> + <div id="host1"> + <template id="shadowroot" data-mode="open"> + <slot id="s1" name="slot1"></slot> + </template> + <div id="c1" slot="slot1"></div> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test3); + removeWhiteSpaceOnlyTextNodes(n.test3); + + doneIfSlotChange([n.s1], test); + + let slot = document.createElement('slot'); + slot.setAttribute('name', 'slot1'); + n.shadowroot.insertBefore(slot, n.s1); +}, "slotchange event: Insert a slot before an existing slot."); +</script> + +<div id="test4"> + <div id="host1"> + <template id="shadowroot" data-mode="open"> + <slot id="s1" name="slot1"></slot> + <slot id="s2" name="slot1"></slot> + </template> + <div id="c1" slot="slot1"></div> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test4); + removeWhiteSpaceOnlyTextNodes(n.test4); + + doneIfSlotChange([n.s2], test); + + n.s1.remove(); +}, "slotchange event: Remove a preceding slot."); +</script> + +<div id="test5"> + <div id="host1"> + <template data-mode="open"> + <div id="host2"> + <template data-mode="open"> + <slot id="s2" name="slot2"></slot> + </template> + <slot id="s1" name="slot1" slot="slot2"></slot> + </div> + </template> + <div id="c1" slot="slot1"></div> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test5); + removeWhiteSpaceOnlyTextNodes(n.test5); + + doneIfSlotChange([n.s1, n.s2], test); + + n.c1.remove(); +}, "slotchange event: A slot is assigned to another slot."); +</script> + +<div id="test6"> + <div id="host1"> + <template data-mode="open"> + <div id="host2"> + <template data-mode="open"> + <slot id="s2" name="slot2"></slot> + </template> + <slot id="s1" name="slot1" slot="slot2"></slot> + </div> + </template> + </div> +</div> + +<script> +async_test((test) => { + let n = createTestTree(test6); + removeWhiteSpaceOnlyTextNodes(n.test6); + + doneIfSlotChange([n.s2], test); + + n.s1.remove(); +}, "slotchange event: Even if distributed nodes do not change, slotchange should be fired if assigned nodes are changed."); +</script>
diff --git a/third_party/WebKit/PerformanceTests/DOM/select-single-remove.html b/third_party/WebKit/PerformanceTests/DOM/select-single-remove.html index 5fb13d7..158c62d 100644 --- a/third_party/WebKit/PerformanceTests/DOM/select-single-remove.html +++ b/third_party/WebKit/PerformanceTests/DOM/select-single-remove.html
@@ -16,8 +16,10 @@ description: 'Measures performance of removing option elements from a single-selection select element.', run: () => { - for (var i = 0; i < childCount; ++i) + for (var i = 0; i < childCount; ++i) { + nodes[i].selected = false; container.appendChild(nodes[i]); + } container.offsetLeft; for (var i = 0; i < childCount; ++i) container.removeChild(nodes[i]);
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h index c3335ddc..2ad759d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h +++ b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h
@@ -33,6 +33,7 @@ #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h index ee01896..ef7959d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h +++ b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
@@ -33,8 +33,10 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "public/platform/WebCallbacks.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/TypeTraits.h" + #include <memory> namespace blink { @@ -48,7 +50,7 @@ // called trivial WebType holder is used. For example, // CallbackPromiseAdapter<bool, void> is a subclass of // WebCallbacks<bool, void>. -// - If a WebType is std::unique_ptr<T>, its corresponding type parameter on +// - If a WebType is OwnPtr<T>, its corresponding type parameter on // WebCallbacks is std::unique_ptr<T>, because WebCallbacks must be exposed to // Chromium. // @@ -62,9 +64,9 @@ // Example: // class MyClass { // public: -// using WebType = std::unique_ptr<WebMyClass>; +// using WebType = OwnPtr<WebMyClass>; // static PassRefPtr<MyClass> take(ScriptPromiseResolver* resolver, -// std::unique_ptr<WebMyClass> webInstance) +// PassOwnPtr<WebMyClass> webInstance) // { // return MyClass::create(webInstance); // } @@ -80,20 +82,20 @@ // } // ... // }; -// std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>, const WebMyErrorClass&>> -// callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>( +// OwnPtr<WebCallbacks<std::unique_ptr<WebMyClass>, const WebMyErrorClass&>> +// callbacks = adoptPtr(new CallbackPromiseAdapter<MyClass, MyErrorClass>( // resolver)); // ... // -// std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = -// wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); +// OwnPtr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = +// adoptPtr(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); // ... // // // In order to implement the above exceptions, we have template classes below. // OnSuccess and OnError provide onSuccess and onError implementation, and there // are utility templates that provide -// - std::unique_ptr - WebPassOwnPtr translation ([Web]PassType[Impl], adopt, pass), +// - OwnPtr - WebPassOwnPtr translation ([Web]PassType[Impl], adopt, pass), // - trivial WebType holder (TrivialWebTypeHolder). namespace internal { @@ -123,24 +125,24 @@ using Type = T; }; template <typename T> - struct PassTypeImpl<std::unique_ptr<T>> { - using Type = std::unique_ptr<T>; + struct PassTypeImpl<OwnPtr<T>> { + using Type = PassOwnPtr<T>; }; template <typename T> struct WebPassTypeImpl { using Type = T; }; template <typename T> - struct WebPassTypeImpl<std::unique_ptr<T>> { + struct WebPassTypeImpl<OwnPtr<T>> { using Type = std::unique_ptr<T>; }; template <typename T> using PassType = typename PassTypeImpl<T>::Type; template <typename T> using WebPassType = typename WebPassTypeImpl<T>::Type; template <typename T> static T& adopt(T& x) { return x; } template <typename T> - static std::unique_ptr<T> adopt(std::unique_ptr<T>& x) { return std::move(x); } + static PassOwnPtr<T> adopt(std::unique_ptr<T>& x) { return adoptPtr(x.release()); } template <typename T> static PassType<T> pass(T& x) { return x; } - template <typename T> static std::unique_ptr<T> pass(std::unique_ptr<T>& x) { return std::move(x); } + template <typename T> static PassOwnPtr<T> pass(OwnPtr<T>& x) { return std::move(x); } template <typename S, typename T> class Base : public WebCallbacks<WebPassType<typename S::WebType>, WebPassType<typename T::WebType>> {
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h index 23eab6a..0798125 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h +++ b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
@@ -37,9 +37,8 @@ #include "bindings/core/v8/WrapperTypeInfo.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" -#include <memory> #include <v8.h> namespace blink { @@ -53,7 +52,7 @@ DOMDataStore(v8::Isolate* isolate, bool isMainWorld) : m_isMainWorld(isMainWorld) // We never use |m_wrapperMap| when it's the main world. - , m_wrapperMap(wrapUnique( + , m_wrapperMap(adoptPtr( isMainWorld ? nullptr : new DOMWrapperMap<ScriptWrappable>(isolate))) { } @@ -217,7 +216,7 @@ } bool m_isMainWorld; - std::unique_ptr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap; + OwnPtr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap; }; template<>
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp index 40a6326e..ee0a071 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -40,9 +40,7 @@ #include "bindings/core/v8/WrapperTypeInfo.h" #include "core/dom/ExecutionContext.h" #include "wtf/HashTraits.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -71,9 +69,9 @@ template<typename T> class DOMObjectHolder : public DOMObjectHolderBase { public: - static std::unique_ptr<DOMObjectHolder<T>> create(v8::Isolate* isolate, T* object, v8::Local<v8::Value> wrapper) + static PassOwnPtr<DOMObjectHolder<T>> create(v8::Isolate* isolate, T* object, v8::Local<v8::Value> wrapper) { - return wrapUnique(new DOMObjectHolder(isolate, object, wrapper)); + return adoptPtr(new DOMObjectHolder(isolate, object, wrapper)); } private: @@ -96,7 +94,7 @@ DOMWrapperWorld::DOMWrapperWorld(v8::Isolate* isolate, int worldId, int extensionGroup) : m_worldId(worldId) , m_extensionGroup(extensionGroup) - , m_domDataStore(wrapUnique(new DOMDataStore(isolate, isMainWorld()))) + , m_domDataStore(adoptPtr(new DOMDataStore(isolate, isMainWorld()))) { } @@ -307,7 +305,7 @@ template void DOMWrapperWorld::registerDOMObjectHolder(v8::Isolate*, ScriptFunction*, v8::Local<v8::Value>); -void DOMWrapperWorld::registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase> holderBase) +void DOMWrapperWorld::registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase> holderBase) { ASSERT(!m_domObjectHolders.contains(holderBase.get())); holderBase->setWorld(this);
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h index ae73701..6fa14ed 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
@@ -37,7 +37,6 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" -#include <memory> #include <v8.h> namespace blink { @@ -124,15 +123,15 @@ DOMWrapperWorld(v8::Isolate*, int worldId, int extensionGroup); static void weakCallbackForDOMObjectHolder(const v8::WeakCallbackInfo<DOMObjectHolderBase>&); - void registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase>); + void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); void unregisterDOMObjectHolder(DOMObjectHolderBase*); static unsigned isolatedWorldCount; const int m_worldId; const int m_extensionGroup; - std::unique_ptr<DOMDataStore> m_domDataStore; - HashSet<std::unique_ptr<DOMObjectHolderBase>> m_domObjectHolders; + OwnPtr<DOMDataStore> m_domDataStore; + HashSet<OwnPtr<DOMObjectHolderBase>> m_domObjectHolders; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h b/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h index 1dffc3e..b7f1914 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h +++ b/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h
@@ -11,8 +11,6 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "core/html/parser/HTMLTokenizer.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -28,9 +26,9 @@ // For unit testing. DocumentWriteEvaluator(const String& pathName, const String& hostName, const String& protocol, const String& userAgent); - static std::unique_ptr<DocumentWriteEvaluator> create(const Document& document) + static PassOwnPtr<DocumentWriteEvaluator> create(const Document& document) { - return wrapUnique(new DocumentWriteEvaluator(document)); + return adoptPtr(new DocumentWriteEvaluator(document)); } virtual ~DocumentWriteEvaluator();
diff --git a/third_party/WebKit/Source/bindings/core/v8/Microtask.h b/third_party/WebKit/Source/bindings/core/v8/Microtask.h index c27774f..2a686dc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Microtask.h +++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.h
@@ -35,6 +35,7 @@ #include "public/platform/WebTaskRunner.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" +#include "wtf/PassOwnPtr.h" #include <v8.h> namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp index b06ec4f..2661227 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
@@ -19,8 +19,6 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -28,9 +26,9 @@ class RejectedPromises::Message final { public: - static std::unique_ptr<Message> create(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) + static PassOwnPtr<Message> create(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) { - return wrapUnique(new Message(scriptState, promise, exception, errorMessage, std::move(location), corsStatus)); + return adoptPtr(new Message(scriptState, promise, exception, errorMessage, std::move(location), corsStatus)); } bool isCollected() @@ -147,7 +145,7 @@ } private: - Message(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) + Message(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) : m_scriptState(scriptState) , m_promise(scriptState->isolate(), promise) , m_exception(scriptState->isolate(), exception) @@ -177,7 +175,7 @@ ScopedPersistent<v8::Value> m_exception; String m_errorMessage; String m_resourceName; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; unsigned m_consoleMessageId; bool m_collected; bool m_shouldLogToConsole; @@ -192,7 +190,7 @@ { } -void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) +void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) { m_queue.append(Message::create(scriptState, data.GetPromise(), data.GetValue(), errorMessage, std::move(location), corsStatus)); } @@ -209,19 +207,19 @@ // Then look it up in the reported errors. for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { - std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); + OwnPtr<Message>& message = m_reportedAsErrors.at(i); if (!message->isCollected() && message->hasPromise(data.GetPromise())) { message->makePromiseStrong(); - Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::revokeNow, this, passed(std::move(message)))); + Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, bind(&RejectedPromises::revokeNow, this, passed(std::move(message)))); m_reportedAsErrors.remove(i); return; } } } -std::unique_ptr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQueue() +PassOwnPtr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQueue() { - return wrapUnique(new MessageQueue()); + return adoptPtr(new MessageQueue()); } void RejectedPromises::dispose() @@ -229,7 +227,7 @@ if (m_queue.isEmpty()) return; - std::unique_ptr<MessageQueue> queue = createMessageQueue(); + OwnPtr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); processQueueNow(std::move(queue)); } @@ -239,12 +237,12 @@ if (m_queue.isEmpty()) return; - std::unique_ptr<MessageQueue> queue = createMessageQueue(); + OwnPtr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); - Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::processQueueNow, PassRefPtr<RejectedPromises>(this), passed(std::move(queue)))); + Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, bind(&RejectedPromises::processQueueNow, PassRefPtr<RejectedPromises>(this), passed(std::move(queue)))); } -void RejectedPromises::processQueueNow(std::unique_ptr<MessageQueue> queue) +void RejectedPromises::processQueueNow(PassOwnPtr<MessageQueue> queue) { // Remove collected handlers. for (size_t i = 0; i < m_reportedAsErrors.size();) { @@ -255,7 +253,7 @@ } while (!queue->isEmpty()) { - std::unique_ptr<Message> message = queue->takeFirst(); + OwnPtr<Message> message = queue->takeFirst(); if (message->isCollected()) continue; if (!message->hasHandler()) { @@ -268,7 +266,7 @@ } } -void RejectedPromises::revokeNow(std::unique_ptr<Message> message) +void RejectedPromises::revokeNow(PassOwnPtr<Message> message) { message->revoke(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h index add3226..5fd0239f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
@@ -11,7 +11,6 @@ #include "wtf/Forward.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> namespace v8 { class PromiseRejectMessage; @@ -32,7 +31,7 @@ ~RejectedPromises(); void dispose(); - void rejectedWithNoHandler(ScriptState*, v8::PromiseRejectMessage, const String& errorMessage, std::unique_ptr<SourceLocation>, AccessControlStatus); + void rejectedWithNoHandler(ScriptState*, v8::PromiseRejectMessage, const String& errorMessage, PassOwnPtr<SourceLocation>, AccessControlStatus); void handlerAdded(v8::PromiseRejectMessage); void processQueue(); @@ -42,14 +41,14 @@ RejectedPromises(); - using MessageQueue = Deque<std::unique_ptr<Message>>; - std::unique_ptr<MessageQueue> createMessageQueue(); + using MessageQueue = Deque<OwnPtr<Message>>; + PassOwnPtr<MessageQueue> createMessageQueue(); - void processQueueNow(std::unique_ptr<MessageQueue>); - void revokeNow(std::unique_ptr<Message>); + void processQueueNow(PassOwnPtr<MessageQueue>); + void revokeNow(PassOwnPtr<Message>); MessageQueue m_queue; - Vector<std::unique_ptr<Message>> m_reportedAsErrors; + Vector<OwnPtr<Message>> m_reportedAsErrors; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h index c1d44ec..83b87cd 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
@@ -33,7 +33,6 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> #include <v8.h> namespace blink { @@ -93,7 +92,7 @@ m_handle.Reset(isolate, handle); } - // Note: This is clear in the std::unique_ptr sense, not the v8::Handle sense. + // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. void clear() { m_handle.Reset();
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp index 7c23a8f1..ad130a9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
@@ -9,8 +9,6 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8HiddenValue.h" #include "core/dom/ExecutionContext.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -83,7 +81,7 @@ v8::HandleScope handleScope(m_isolate); size_t i = 0; while (i < m_wrappers.size()) { - const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; + const OwnPtr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; if (persistent->isEmpty()) { // wrapper has died. // Since v8 GC can run during the iteration and clear the reference, @@ -131,7 +129,7 @@ v8::Local<v8::Context> context = scriptState->context(); size_t i = 0; while (i < m_wrappers.size()) { - const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; + const OwnPtr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; if (persistent->isEmpty()) { // wrapper has died. // Since v8 GC can run during the iteration and clear the reference, @@ -146,7 +144,7 @@ ++i; } v8::Local<v8::Object> wrapper = holder(m_isolate, context->Global()); - std::unique_ptr<ScopedPersistent<v8::Object>> weakPersistent = wrapUnique(new ScopedPersistent<v8::Object>); + OwnPtr<ScopedPersistent<v8::Object>> weakPersistent = adoptPtr(new ScopedPersistent<v8::Object>); weakPersistent->set(m_isolate, wrapper); weakPersistent->setWeak(weakPersistent.get(), &clearHandle); m_wrappers.append(std::move(weakPersistent));
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h index 4b0a07f2..2aa2cdc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h
@@ -11,9 +11,9 @@ #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" #include "wtf/Compiler.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> #include <v8.h> namespace blink { @@ -63,7 +63,7 @@ NEVER_INLINE void resetBase(); private: - typedef Vector<std::unique_ptr<ScopedPersistent<v8::Object>>> WeakPersistentSet; + typedef Vector<OwnPtr<ScopedPersistent<v8::Object>>> WeakPersistentSet; void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>); v8::Local<v8::Object> ensureHolderWrapper(ScriptState*);
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp index 1cc2e7f..b39a29e3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -18,9 +18,10 @@ #include "core/testing/GarbageCollectedScriptWrappable.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> #include <v8.h> using namespace blink; @@ -143,7 +144,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; RefPtr<ScriptState> m_otherScriptState; };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp index e1f7e55..10a1cf5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
@@ -11,7 +11,6 @@ #include "core/dom/Document.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> namespace blink { @@ -63,7 +62,7 @@ v8::MicrotasksScope::PerformCheckpoint(isolate()); } - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; ScriptState* getScriptState() const { return ScriptState::forMainWorld(&m_pageHolder->frame()); } ExecutionContext* getExecutionContext() const { return &m_pageHolder->document(); } v8::Isolate* isolate() const { return getScriptState()->isolate(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h index 58d48a9..b5555e2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h
@@ -9,7 +9,6 @@ #include "bindings/core/v8/V8PerContextData.h" #include "core/CoreExport.h" #include "wtf/RefCounted.h" -#include <memory> #include <v8-debug.h> #include <v8.h> @@ -116,11 +115,11 @@ // This RefPtr doesn't cause a cycle because all persistent handles that DOMWrapperWorld holds are weak. RefPtr<DOMWrapperWorld> m_world; - // This std::unique_ptr causes a cycle: - // V8PerContextData --(Persistent)--> v8::Context --(RefPtr)--> ScriptState --(std::unique_ptr)--> V8PerContextData - // So you must explicitly clear the std::unique_ptr by calling disposePerContextData() + // This OwnPtr causes a cycle: + // V8PerContextData --(Persistent)--> v8::Context --(RefPtr)--> ScriptState --(OwnPtr)--> V8PerContextData + // So you must explicitly clear the OwnPtr by calling disposePerContextData() // once you no longer need V8PerContextData. Otherwise, the v8::Context will leak. - std::unique_ptr<V8PerContextData> m_perContextData; + OwnPtr<V8PerContextData> m_perContextData; #if ENABLE(ASSERT) bool m_globalObjectDetached;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index d286f91..642cb5c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -18,9 +18,7 @@ #include "platform/TraceEvent.h" #include "public/platform/WebScheduler.h" #include "wtf/Deque.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextEncodingRegistry.h" -#include <memory> namespace blink { @@ -181,7 +179,7 @@ , m_queueTailPosition(0) , m_bookmarkPosition(0) , m_lengthOfBOM(0) - , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) + , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) { } @@ -389,7 +387,7 @@ // m_queueLeadPosition references with a mutex. size_t m_lengthOfBOM; // Used by both threads; guarded by m_mutex. - std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; + OwnPtr<WebTaskRunner> m_loadingTaskRunner; }; size_t ScriptStreamer::s_smallScriptThreshold = 30 * 1024; @@ -502,7 +500,7 @@ const char* data = 0; size_t length = resource->resourceBuffer()->getSomeData(data, static_cast<size_t>(0)); - std::unique_ptr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding())); + OwnPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding())); lengthOfBOM = decoder->checkForBOM(data, length); // Maybe the encoding changed because we saw the BOM; get the encoding @@ -535,10 +533,10 @@ ASSERT(!m_source); m_stream = new SourceStream(m_loadingTaskRunner.get()); // m_source takes ownership of m_stream. - m_source = wrapUnique(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding)); + m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding)); ScriptState::Scope scope(m_scriptState.get()); - std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(wrapUnique(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions))); + OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(adoptPtr(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions))); if (!scriptStreamingTask) { // V8 cannot stream the script. suppressStreaming(); @@ -591,7 +589,7 @@ , m_scriptURLString(m_resource->url().copy().getString()) , m_scriptResourceIdentifier(m_resource->identifier()) , m_encoding(v8::ScriptCompiler::StreamedSource::TWO_BYTE) // Unfortunately there's no dummy encoding value in the enum; let's use one we don't stream. - , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) + , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) { }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h index ac2e4e1..bf02e5b7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h
@@ -9,7 +9,7 @@ #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" -#include <memory> + #include <v8.h> namespace blink { @@ -120,7 +120,7 @@ bool m_detached; SourceStream* m_stream; - std::unique_ptr<v8::ScriptCompiler::StreamedSource> m_source; + OwnPtr<v8::ScriptCompiler::StreamedSource> m_source; bool m_loadingFinished; // Whether loading from the network is done. // Whether the V8 side processing is done. Will be used by the main thread // and the streamer thread; guarded by m_mutex. @@ -151,7 +151,7 @@ // Encoding of the streamed script. Saved for sanity checking purposes. v8::ScriptCompiler::StreamedSource::Encoding m_encoding; - std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; + OwnPtr<WebTaskRunner> m_loadingTaskRunner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index f2227688..755bc90 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -18,7 +18,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> namespace blink { @@ -85,7 +84,7 @@ } WebTaskRunner* m_loadingTaskRunner; // NOT OWNED - std::unique_ptr<Settings> m_settings; + OwnPtr<Settings> m_settings; // The Resource and PendingScript where we stream from. These don't really // fetch any data outside the test; the test controls the data by calling // ScriptResource::appendData.
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp index 0eec3d3..f6f1fed2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp
@@ -10,8 +10,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -74,11 +72,11 @@ WebThread& ScriptStreamerThread::platformThread() { if (!isRunning()) - m_thread = wrapUnique(Platform::current()->createThread("ScriptStreamerThread")); + m_thread = adoptPtr(Platform::current()->createThread("ScriptStreamerThread")); return *m_thread; } -void ScriptStreamerThread::runScriptStreamingTask(std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task, ScriptStreamer* streamer) +void ScriptStreamerThread::runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask> task, ScriptStreamer* streamer) { TRACE_EVENT1("v8,devtools.timeline", "v8.parseOnBackground", "data", InspectorParseScriptEvent::data(streamer->scriptResourceIdentifier(), streamer->scriptURLString())); // Running the task can and will block: SourceStream::GetSomeData will get
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h index 9eb13bc..65a5dfbc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h
@@ -9,7 +9,9 @@ #include "platform/TaskSynchronizer.h" #include "public/platform/WebThread.h" #include "wtf/Functional.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" + #include <v8.h> namespace blink { @@ -35,7 +37,7 @@ void taskDone(); - static void runScriptStreamingTask(std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask>, ScriptStreamer*); + static void runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask>, ScriptStreamer*); private: ScriptStreamerThread() @@ -50,7 +52,7 @@ // At the moment, we only use one thread, so we can only stream one script // at a time. FIXME: Use a thread pool and stream multiple scripts. - std::unique_ptr<WebThread> m_thread; + OwnPtr<WebThread> m_thread; bool m_runningTask; mutable Mutex m_mutex; // Guards m_runningTask. };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp index e6e90663..bafbf8f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
@@ -29,7 +29,6 @@ #include "wtf/DateMath.h" #include "wtf/text/StringHash.h" #include "wtf/text/StringUTF8Adaptor.h" -#include <memory> // FIXME: consider crashing in debug mode on deserialization errors // NOTE: be sure to change wireFormatVersion as necessary! @@ -1107,7 +1106,7 @@ m_writer.writeTransferredImageBitmap(index); } else { greyObject(object); - std::unique_ptr<uint8_t[]> pixelData = imageBitmap->copyBitmapData(PremultiplyAlpha); + OwnPtr<uint8_t[]> pixelData = imageBitmap->copyBitmapData(PremultiplyAlpha); m_writer.writeImageBitmap(imageBitmap->width(), imageBitmap->height(), pixelData.get(), imageBitmap->width() * imageBitmap->height() * 4); } return nullptr;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp index 23b013f..5f6683a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
@@ -27,11 +27,23 @@ m_tracingInProgress = true; } -void ScriptWrappableVisitor::TraceEpilogue() +void ScriptWrappableVisitor::EnterFinalPause() { ActiveScriptWrappable::traceActiveScriptWrappables(m_isolate, this); - AdvanceTracing(0, AdvanceTracingActions(ForceCompletionAction::FORCE_COMPLETION)); +} +void ScriptWrappableVisitor::TraceEpilogue() +{ + performCleanup(); +} + +void ScriptWrappableVisitor::AbortTracing() +{ + performCleanup(); +} + +void ScriptWrappableVisitor::performCleanup() +{ for (auto header : m_headersToUnmark) { header->unmarkWrapperHeader(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h index 1d89194..be5c990 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
@@ -57,6 +57,8 @@ void RegisterV8Reference(const std::pair<void*, void*>& internalFields); bool AdvanceTracing(double deadlineInMs, v8::EmbedderHeapTracer::AdvanceTracingActions) override; void TraceEpilogue() override; + void AbortTracing() override; + void EnterFinalPause() override; template <typename T> void markWrapper(const v8::Persistent<T>* handle) const @@ -82,6 +84,7 @@ bool markWrapperHeader(const ScriptWrappable*) const override; bool markWrapperHeader(const void* garbageCollected) const override; bool m_tracingInProgress = false; + void performCleanup(); /** * Collection of ScriptWrappables we need to trace from. We assume it is * safe to hold on to the raw pointers because:
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp index b2c7ce23..407a22ef 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -52,11 +52,9 @@ #include "platform/heap/Handle.h" #include "wtf/Assertions.h" #include "wtf/ByteOrder.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -178,7 +176,7 @@ } } - std::unique_ptr<ImageBitmapContentsArray> contents = wrapUnique(new ImageBitmapContentsArray); + OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContentsArray); HeapHashSet<Member<ImageBitmap>> visited; for (size_t i = 0; i < imageBitmaps.size(); ++i) { if (visited.contains(imageBitmaps[i])) @@ -223,7 +221,7 @@ } } - std::unique_ptr<ArrayBufferContentsArray> contents = wrapUnique(new ArrayBufferContentsArray(arrayBuffers.size())); + OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); HeapHashSet<Member<DOMArrayBufferBase>> visited; for (size_t i = 0; i < arrayBuffers.size(); ++i) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h index 5fbefc2..c3261ae 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -36,10 +36,14 @@ #include "core/CoreExport.h" #include "wtf/HashMap.h" #include "wtf/ThreadSafeRefCounted.h" -#include "wtf/typed_arrays/ArrayBufferContents.h" -#include <memory> #include <v8.h> +namespace WTF { + +class ArrayBufferContents; + +} + namespace blink { class BlobDataHandle; @@ -127,8 +131,8 @@ private: String m_data; - std::unique_ptr<ArrayBufferContentsArray> m_arrayBufferContentsArray; - std::unique_ptr<ImageBitmapContentsArray> m_imageBitmapContentsArray; + OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; + OwnPtr<ImageBitmapContentsArray> m_imageBitmapContentsArray; BlobDataHandleMap m_blobDataHandles; intptr_t m_externallyAllocatedMemory;
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp index 61a7f42..4195437 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
@@ -15,8 +15,6 @@ #include "platform/ScriptForbiddenScope.h" #include "platform/TracedValue.h" #include "platform/v8_inspector/public/V8Debugger.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -40,7 +38,7 @@ } // static -std::unique_ptr<SourceLocation> SourceLocation::capture(const String& url, unsigned lineNumber, unsigned columnNumber) +PassOwnPtr<SourceLocation> SourceLocation::capture(const String& url, unsigned lineNumber, unsigned columnNumber) { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(false); if (stackTrace && !stackTrace->isEmpty()) @@ -49,7 +47,7 @@ } // static -std::unique_ptr<SourceLocation> SourceLocation::capture(ExecutionContext* executionContext) +PassOwnPtr<SourceLocation> SourceLocation::capture(ExecutionContext* executionContext) { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(false); if (stackTrace && !stackTrace->isEmpty()) @@ -69,7 +67,7 @@ } // static -std::unique_ptr<SourceLocation> SourceLocation::fromMessage(v8::Isolate* isolate, v8::Local<v8::Message> message, ExecutionContext* executionContext) +PassOwnPtr<SourceLocation> SourceLocation::fromMessage(v8::Isolate* isolate, v8::Local<v8::Message> message, ExecutionContext* executionContext) { v8::Local<v8::StackTrace> stack = message->GetStackTrace(); std::unique_ptr<V8StackTrace> stackTrace = nullptr; @@ -100,23 +98,23 @@ } // static -std::unique_ptr<SourceLocation> SourceLocation::create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId) +PassOwnPtr<SourceLocation> SourceLocation::create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId) { - return wrapUnique(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); + return adoptPtr(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); } // static -std::unique_ptr<SourceLocation> SourceLocation::createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace> stackTrace, int scriptId) +PassOwnPtr<SourceLocation> SourceLocation::createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace> stackTrace, int scriptId) { // Retrieve the data before passing the ownership to SourceLocation. const String& url = stackTrace->topSourceURL(); unsigned lineNumber = stackTrace->topLineNumber(); unsigned columnNumber = stackTrace->topColumnNumber(); - return wrapUnique(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); + return adoptPtr(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); } // static -std::unique_ptr<SourceLocation> SourceLocation::fromFunction(v8::Local<v8::Function> function) +PassOwnPtr<SourceLocation> SourceLocation::fromFunction(v8::Local<v8::Function> function) { if (!function.IsEmpty()) return SourceLocation::create(toCoreStringWithUndefinedOrNullCheck(function->GetScriptOrigin().ResourceName()), function->GetScriptLineNumber() + 1, function->GetScriptColumnNumber() + 1, nullptr, function->ScriptId()); @@ -124,7 +122,7 @@ } // static -std::unique_ptr<SourceLocation> SourceLocation::captureWithFullStackTrace() +PassOwnPtr<SourceLocation> SourceLocation::captureWithFullStackTrace() { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(true); if (stackTrace && !stackTrace->isEmpty()) @@ -160,14 +158,14 @@ value->endArray(); } -std::unique_ptr<SourceLocation> SourceLocation::clone() const +PassOwnPtr<SourceLocation> SourceLocation::clone() const { - return wrapUnique(new SourceLocation(m_url, m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->clone() : nullptr, m_scriptId)); + return adoptPtr(new SourceLocation(m_url, m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->clone() : nullptr, m_scriptId)); } -std::unique_ptr<SourceLocation> SourceLocation::isolatedCopy() const +PassOwnPtr<SourceLocation> SourceLocation::isolatedCopy() const { - return wrapUnique(new SourceLocation(m_url.isolatedCopy(), m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->isolatedCopy() : nullptr, m_scriptId)); + return adoptPtr(new SourceLocation(m_url.isolatedCopy(), m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->isolatedCopy() : nullptr, m_scriptId)); } std::unique_ptr<protocol::Runtime::StackTrace> SourceLocation::buildInspectorObject() const
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h index 5581621..d5b6baf 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h +++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h
@@ -9,8 +9,8 @@ #include "platform/CrossThreadCopier.h" #include "platform/v8_inspector/public/V8StackTrace.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -23,19 +23,19 @@ class CORE_EXPORT SourceLocation { public: // Zero lineNumber and columnNumber mean unknown. Captures current stack trace. - static std::unique_ptr<SourceLocation> capture(const String& url, unsigned lineNumber, unsigned columnNumber); + static PassOwnPtr<SourceLocation> capture(const String& url, unsigned lineNumber, unsigned columnNumber); // Shortcut when location is unknown. Tries to capture call stack or parsing location if available. - static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr); + static PassOwnPtr<SourceLocation> capture(ExecutionContext* = nullptr); - static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v8::Message>, ExecutionContext*); + static PassOwnPtr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v8::Message>, ExecutionContext*); - static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>); + static PassOwnPtr<SourceLocation> fromFunction(v8::Local<v8::Function>); // Forces full stack trace. - static std::unique_ptr<SourceLocation> captureWithFullStackTrace(); + static PassOwnPtr<SourceLocation> captureWithFullStackTrace(); - static std::unique_ptr<SourceLocation> create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId = 0); + static PassOwnPtr<SourceLocation> create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId = 0); ~SourceLocation(); bool isUnknown() const { return m_url.isNull() && !m_scriptId && !m_lineNumber; } @@ -44,8 +44,8 @@ unsigned columnNumber() const { return m_columnNumber; } int scriptId() const { return m_scriptId; } - std::unique_ptr<SourceLocation> clone() const; - std::unique_ptr<SourceLocation> isolatedCopy() const; // Safe to pass between threads. + PassOwnPtr<SourceLocation> clone() const; + PassOwnPtr<SourceLocation> isolatedCopy() const; // Safe to pass between threads. // No-op when stack trace is unknown. void toTracedValue(TracedValue*, const char* name) const; @@ -58,7 +58,7 @@ private: SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId); - static std::unique_ptr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace>, int scriptId); + static PassOwnPtr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace>, int scriptId); String m_url; unsigned m_lineNumber; @@ -68,9 +68,9 @@ }; template <> -struct CrossThreadCopier<std::unique_ptr<SourceLocation>> { - using Type = std::unique_ptr<SourceLocation>; - static Type copy(std::unique_ptr<SourceLocation> location) +struct CrossThreadCopier<PassOwnPtr<SourceLocation>> { + using Type = PassOwnPtr<SourceLocation>; + static Type copy(PassOwnPtr<SourceLocation> location) { return location ? location->isolatedCopy() : nullptr; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp index 518a119..91dcdd93 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp
@@ -30,14 +30,11 @@ #include "bindings/core/v8/V0CustomElementBinding.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { -std::unique_ptr<V0CustomElementBinding> V0CustomElementBinding::create(v8::Isolate* isolate, v8::Local<v8::Object> prototype) +PassOwnPtr<V0CustomElementBinding> V0CustomElementBinding::create(v8::Isolate* isolate, v8::Local<v8::Object> prototype) { - return wrapUnique(new V0CustomElementBinding(isolate, prototype)); + return adoptPtr(new V0CustomElementBinding(isolate, prototype)); } V0CustomElementBinding::V0CustomElementBinding(v8::Isolate* isolate, v8::Local<v8::Object> prototype)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h index ff26119d..2f5ef1c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h
@@ -33,7 +33,7 @@ #include "bindings/core/v8/ScopedPersistent.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/PassOwnPtr.h" #include <v8.h> namespace blink { @@ -41,7 +41,7 @@ class V0CustomElementBinding { USING_FAST_MALLOC(V0CustomElementBinding); public: - static std::unique_ptr<V0CustomElementBinding> create(v8::Isolate*, v8::Local<v8::Object> prototype); + static PassOwnPtr<V0CustomElementBinding> create(v8::Isolate*, v8::Local<v8::Object> prototype); ~V0CustomElementBinding(); private:
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h index 564634a..bc2810b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h
@@ -9,6 +9,8 @@ #include "bindings/core/v8/ScriptState.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" + #include <v8.h> namespace blink { @@ -45,7 +47,7 @@ ~V8TestingScope(); private: - std::unique_ptr<DummyPageHolder> m_holder; + OwnPtr<DummyPageHolder> m_holder; v8::HandleScope m_handleScope; v8::Local<v8::Context> m_context; v8::Context::Scope m_contextScope;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp index ffeb8a0..26b67a52 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp
@@ -8,12 +8,11 @@ #include "platform/weborigin/KURL.h" #include "wtf/HashMap.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { -typedef HashMap<String, std::unique_ptr<V8DOMActivityLogger>> DOMActivityLoggerMapForMainWorld; -typedef HashMap<int, std::unique_ptr<V8DOMActivityLogger>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld; +typedef HashMap<String, OwnPtr<V8DOMActivityLogger>> DOMActivityLoggerMapForMainWorld; +typedef HashMap<int, OwnPtr<V8DOMActivityLogger>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld; static DOMActivityLoggerMapForMainWorld& domActivityLoggersForMainWorld() { @@ -29,7 +28,7 @@ return map; } -void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extensionId, std::unique_ptr<V8DOMActivityLogger> logger) +void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extensionId, PassOwnPtr<V8DOMActivityLogger> logger) { if (worldId) domActivityLoggersForIsolatedWorld().set(worldId, std::move(logger));
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h index 5c79314..de76eca 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h
@@ -32,8 +32,8 @@ #define V8DOMActivityLogger_h #include "core/CoreExport.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> #include <v8.h> namespace blink { @@ -61,7 +61,7 @@ // extensions and their activity loggers in the main world, we require an // extension ID. Otherwise, extension activities may be logged under // a wrong extension ID. - static void setActivityLogger(int worldId, const String&, std::unique_ptr<V8DOMActivityLogger>); + static void setActivityLogger(int worldId, const String&, PassOwnPtr<V8DOMActivityLogger>); static V8DOMActivityLogger* activityLogger(int worldId, const String& extensionId); static V8DOMActivityLogger* activityLogger(int worldId, const KURL&);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h b/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h index d86fa3a..b9bb81f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h
@@ -9,8 +9,7 @@ #include "bindings/core/v8/ScriptPromiseProperties.h" #include "core/CoreExport.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" #include <v8.h> namespace blink { @@ -62,7 +61,7 @@ USING_FAST_MALLOC(V8HiddenValue); WTF_MAKE_NONCOPYABLE(V8HiddenValue); public: - static std::unique_ptr<V8HiddenValue> create() { return wrapUnique(new V8HiddenValue()); } + static PassOwnPtr<V8HiddenValue> create() { return adoptPtr(new V8HiddenValue()); } #define V8_DECLARE_METHOD(name) static v8::Local<v8::String> name(v8::Isolate* isolate); V8_HIDDEN_VALUES(V8_DECLARE_METHOD);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h index 6aebe28d..d4718d4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h
@@ -33,8 +33,7 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -42,14 +41,14 @@ USING_FAST_MALLOC(V8IdleTaskAdapter); WTF_MAKE_NONCOPYABLE(V8IdleTaskAdapter); public: - V8IdleTaskAdapter(v8::IdleTask* task) : m_task(wrapUnique(task)) { } + V8IdleTaskAdapter(v8::IdleTask* task) : m_task(adoptPtr(task)) { } ~V8IdleTaskAdapter() override { } void run(double delaySeconds) override { m_task->Run(delaySeconds); } private: - std::unique_ptr<v8::IdleTask> m_task; + OwnPtr<v8::IdleTask> m_task; }; class V8IdleTaskRunner : public gin::V8IdleTaskRunner {
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 0c28189..1cd98091 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -58,11 +58,9 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/AddressSanitizer.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferContents.h" -#include <memory> #include <v8-debug.h> #include <v8-profiler.h> @@ -125,7 +123,7 @@ return; ExecutionContext* context = scriptState->getExecutionContext(); - std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); + OwnPtr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); AccessControlStatus accessControlStatus = NotSharableCrossOrigin; if (message->IsOpaque()) @@ -204,7 +202,7 @@ String errorMessage; AccessControlStatus corsStatus = NotSharableCrossOrigin; - std::unique_ptr<SourceLocation> location; + OwnPtr<SourceLocation> location; v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception); if (!message.IsEmpty()) { @@ -364,7 +362,7 @@ if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) { WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); - V8PerIsolateData::enableIdleTasks(isolate, wrapUnique(new V8IdleTaskRunner(scheduler))); + V8PerIsolateData::enableIdleTasks(isolate, adoptPtr(new V8IdleTaskRunner(scheduler))); } isolate->SetPromiseRejectCallback(promiseRejectHandlerInMainThread); @@ -373,7 +371,7 @@ profiler->SetWrapperClassInfoProvider(WrapperTypeInfo::NodeClassId, &RetainedDOMInfo::createRetainedDOMInfo); ASSERT(ThreadState::mainThreadState()); - ThreadState::mainThreadState()->addInterruptor(wrapUnique(new V8IsolateInterruptor(isolate))); + ThreadState::mainThreadState()->addInterruptor(adoptPtr(new V8IsolateInterruptor(isolate))); if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { ThreadState::mainThreadState()->registerTraceDOMWrappers(isolate, V8GCController::traceDOMWrappers, @@ -384,7 +382,7 @@ nullptr); } - V8PerIsolateData::from(isolate)->setThreadDebugger(wrapUnique(new MainThreadDebugger(isolate))); + V8PerIsolateData::from(isolate)->setThreadDebugger(adoptPtr(new MainThreadDebugger(isolate))); } void V8Initializer::shutdownMainThread() @@ -419,7 +417,7 @@ perIsolateData->setReportingException(true); ExecutionContext* context = scriptState->getExecutionContext(); - std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); + OwnPtr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); ErrorEvent* event = ErrorEvent::create(toCoreStringWithNullCheck(message->Get()), std::move(location), &scriptState->world()); AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp index d34f3786..4bf774c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
@@ -34,9 +34,8 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8ObjectConstructor.h" #include "core/inspector/InstanceCounters.h" -#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" -#include <memory> + #include <stdlib.h> namespace blink { @@ -45,7 +44,7 @@ : m_isolate(context->GetIsolate()) , m_wrapperBoilerplates(m_isolate) , m_constructorMap(m_isolate) - , m_contextHolder(wrapUnique(new gin::ContextHolder(m_isolate))) + , m_contextHolder(adoptPtr(new gin::ContextHolder(m_isolate))) , m_context(m_isolate, context) , m_activityLogger(0) , m_compiledPrivateScript(m_isolate) @@ -68,9 +67,9 @@ InstanceCounters::decrementCounter(InstanceCounters::V8PerContextDataCounter); } -std::unique_ptr<V8PerContextData> V8PerContextData::create(v8::Local<v8::Context> context) +PassOwnPtr<V8PerContextData> V8PerContextData::create(v8::Local<v8::Context> context) { - return wrapUnique(new V8PerContextData(context)); + return adoptPtr(new V8PerContextData(context)); } V8PerContextData* V8PerContextData::from(v8::Local<v8::Context> context) @@ -146,7 +145,7 @@ return prototypeValue.As<v8::Object>(); } -void V8PerContextData::addCustomElementBinding(std::unique_ptr<V0CustomElementBinding> binding) +void V8PerContextData::addCustomElementBinding(PassOwnPtr<V0CustomElementBinding> binding) { m_customElementBindings.append(std::move(binding)); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h index 7352b64d..0b97318 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
@@ -40,10 +40,10 @@ #include "gin/public/gin_embedders.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" -#include <memory> #include <v8.h> namespace blink { @@ -59,7 +59,7 @@ USING_FAST_MALLOC(V8PerContextData); WTF_MAKE_NONCOPYABLE(V8PerContextData); public: - static std::unique_ptr<V8PerContextData> create(v8::Local<v8::Context>); + static PassOwnPtr<V8PerContextData> create(v8::Local<v8::Context>); static V8PerContextData* from(v8::Local<v8::Context>); @@ -84,7 +84,7 @@ v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); - void addCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); + void addCustomElementBinding(PassOwnPtr<V0CustomElementBinding>); V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogger = activityLogger; } @@ -108,12 +108,12 @@ typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> ConstructorMap; ConstructorMap m_constructorMap; - std::unique_ptr<gin::ContextHolder> m_contextHolder; + OwnPtr<gin::ContextHolder> m_contextHolder; ScopedPersistent<v8::Context> m_context; ScopedPersistent<v8::Value> m_errorPrototype; - typedef Vector<std::unique_ptr<V0CustomElementBinding>> V0CustomElementBindingList; + typedef Vector<OwnPtr<V0CustomElementBinding>> V0CustomElementBindingList; V0CustomElementBindingList m_customElementBindings; // This is owned by a static hash map in V8DOMActivityLogger.
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp index baeb5c3..9596c370 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -37,7 +37,6 @@ #include "platform/ScriptForbiddenScope.h" #include "public/platform/Platform.h" #include "wtf/LeakAnnotations.h" -#include "wtf/PtrUtil.h" #include <memory> namespace blink { @@ -55,8 +54,8 @@ } V8PerIsolateData::V8PerIsolateData() - : m_isolateHolder(wrapUnique(new gin::IsolateHolder())) - , m_stringCache(wrapUnique(new StringCache(isolate()))) + : m_isolateHolder(adoptPtr(new gin::IsolateHolder())) + , m_stringCache(adoptPtr(new StringCache(isolate()))) , m_hiddenValue(V8HiddenValue::create()) , m_privateProperty(V8PrivateProperty::create()) , m_constructorMode(ConstructorMode::CreateNewObject) @@ -91,9 +90,9 @@ return isolate; } -void V8PerIsolateData::enableIdleTasks(v8::Isolate* isolate, std::unique_ptr<gin::V8IdleTaskRunner> taskRunner) +void V8PerIsolateData::enableIdleTasks(v8::Isolate* isolate, PassOwnPtr<gin::V8IdleTaskRunner> taskRunner) { - from(isolate)->m_isolateHolder->EnableIdleTasks(std::unique_ptr<gin::V8IdleTaskRunner>(taskRunner.release())); + from(isolate)->m_isolateHolder->EnableIdleTasks(std::unique_ptr<gin::V8IdleTaskRunner>(taskRunner.leakPtr())); } void V8PerIsolateData::useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeature feature) @@ -347,14 +346,14 @@ return v8::Local<v8::Object>::Cast(value)->FindInstanceInPrototypeChain(templ); } -void V8PerIsolateData::addEndOfScopeTask(std::unique_ptr<EndOfScopeTask> task) +void V8PerIsolateData::addEndOfScopeTask(PassOwnPtr<EndOfScopeTask> task) { m_endOfScopeTasks.append(std::move(task)); } void V8PerIsolateData::runEndOfScopeTasks() { - Vector<std::unique_ptr<EndOfScopeTask>> tasks; + Vector<OwnPtr<EndOfScopeTask>> tasks; tasks.swap(m_endOfScopeTasks); for (const auto& task : tasks) task->run(); @@ -366,7 +365,7 @@ m_endOfScopeTasks.clear(); } -void V8PerIsolateData::setThreadDebugger(std::unique_ptr<ThreadDebugger> threadDebugger) +void V8PerIsolateData::setThreadDebugger(PassOwnPtr<ThreadDebugger> threadDebugger) { ASSERT(!m_threadDebugger); m_threadDebugger = std::move(threadDebugger);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h index 009e4db..35f921e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
@@ -37,8 +37,8 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> #include <v8.h> namespace blink { @@ -101,7 +101,7 @@ static void destroy(v8::Isolate*); static v8::Isolate* mainThreadIsolate(); - static void enableIdleTasks(v8::Isolate*, std::unique_ptr<gin::V8IdleTaskRunner>); + static void enableIdleTasks(v8::Isolate*, PassOwnPtr<gin::V8IdleTaskRunner>); v8::Isolate* isolate() { return m_isolateHolder->isolate(); } @@ -136,11 +136,11 @@ // to C++ from script, after executing a script task (e.g. callback, // event) or microtasks (e.g. promise). This is explicitly needed for // Indexed DB transactions per spec, but should in general be avoided. - void addEndOfScopeTask(std::unique_ptr<EndOfScopeTask>); + void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); void runEndOfScopeTasks(); void clearEndOfScopeTasks(); - void setThreadDebugger(std::unique_ptr<ThreadDebugger>); + void setThreadDebugger(PassOwnPtr<ThreadDebugger>); ThreadDebugger* threadDebugger(); using ActiveScriptWrappableSet = HeapHashSet<WeakMember<ActiveScriptWrappable>>; @@ -162,7 +162,7 @@ bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, V8FunctionTemplateMap&); v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Local<v8::Value>, V8FunctionTemplateMap&); - std::unique_ptr<gin::IsolateHolder> m_isolateHolder; + OwnPtr<gin::IsolateHolder> m_isolateHolder; // m_interfaceTemplateMapFor{,Non}MainWorld holds function templates for // the inerface objects. @@ -173,8 +173,8 @@ V8FunctionTemplateMap m_operationTemplateMapForMainWorld; V8FunctionTemplateMap m_operationTemplateMapForNonMainWorld; - std::unique_ptr<StringCache> m_stringCache; - std::unique_ptr<V8HiddenValue> m_hiddenValue; + OwnPtr<StringCache> m_stringCache; + OwnPtr<V8HiddenValue> m_hiddenValue; std::unique_ptr<V8PrivateProperty> m_privateProperty; ScopedPersistent<v8::Value> m_liveRoot; RefPtr<ScriptState> m_scriptRegexpScriptState; @@ -188,8 +188,8 @@ bool m_isHandlingRecursionLevelError; bool m_isReportingException; - Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; - std::unique_ptr<ThreadDebugger> m_threadDebugger; + Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; + OwnPtr<ThreadDebugger> m_threadDebugger; Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp index b0da31f..c5f51b2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
@@ -38,7 +38,7 @@ #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8PerContextData.h" #include "core/dom/ExecutionContext.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -123,7 +123,7 @@ { } -bool V8V0CustomElementLifecycleCallbacks::setBinding(std::unique_ptr<V0CustomElementBinding> binding) +bool V8V0CustomElementLifecycleCallbacks::setBinding(PassOwnPtr<V0CustomElementBinding> binding) { V8PerContextData* perContextData = creationContextData(); if (!perContextData)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h index b610dff6..6acc290 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h
@@ -35,8 +35,8 @@ #include "bindings/core/v8/ScriptState.h" #include "core/dom/ContextLifecycleObserver.h" #include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> #include <v8.h> namespace blink { @@ -52,7 +52,7 @@ ~V8V0CustomElementLifecycleCallbacks() override; - bool setBinding(std::unique_ptr<V0CustomElementBinding>); + bool setBinding(PassOwnPtr<V0CustomElementBinding>); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp index 319fe22..849eeed1 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp
@@ -62,6 +62,7 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" #include "wtf/StringExtras.h" #include "wtf/text/CString.h" #include <algorithm>
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp index af04d355..8223a91e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
@@ -51,7 +51,6 @@ #include "core/workers/WorkerThread.h" #include "platform/heap/ThreadState.h" #include "public/platform/Platform.h" -#include <memory> #include <v8.h> namespace blink { @@ -80,7 +79,7 @@ bool hadException; String errorMessage; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; ScriptValue exception; Member<ErrorEvent> m_errorEventFromImportedScript;
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h index e2c8914..4da92c9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h +++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h
@@ -38,6 +38,7 @@ #include "core/CoreExport.h" #include "platform/text/CompressibleString.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/TextPosition.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp index 045d989..fc4c3d7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp
@@ -43,10 +43,9 @@ #include "core/html/HTMLAllCollection.h" #include "core/html/HTMLCollection.h" #include "core/html/HTMLIFrameElement.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -77,7 +76,7 @@ return; } // Wrap up the arguments and call the function. - std::unique_ptr<v8::Local<v8::Value>[]> params = wrapArrayUnique(new v8::Local<v8::Value>[info.Length()]); + OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]); for (int i = 0; i < info.Length(); i++) params[i] = info[i];
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp index b277398..4439850f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -34,8 +34,8 @@ #include "bindings/core/v8/V8HTMLEmbedElement.h" #include "bindings/core/v8/V8HTMLObjectElement.h" #include "core/frame/UseCounter.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -146,7 +146,7 @@ if (instance.IsEmpty()) return; - std::unique_ptr<v8::Local<v8::Value>[] > arguments = wrapArrayUnique(new v8::Local<v8::Value>[info.Length()]); + WTF::OwnPtr<v8::Local<v8::Value>[] > arguments = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]); for (int i = 0; i < info.Length(); ++i) arguments[i] = info[i];
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp index 730dd279..f85adae9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
@@ -62,6 +62,7 @@ #include "core/loader/FrameLoaderClient.h" #include "platform/LayoutTestSupport.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp index 0c6a6d58..d65e406 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
@@ -14,8 +14,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebRTCCertificate.h" #include "public/platform/WebRTCCertificateGenerator.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -445,7 +443,7 @@ if (!readWebCoreString(&pemCertificate)) return false; - std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUnique( + OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr( Platform::current()->createRTCCertificateGenerator()); std::unique_ptr<WebRTCCertificate> certificate(
diff --git a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl index 56f373113..cef5ab8 100644 --- a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
@@ -3,10 +3,8 @@ #include "{{namespace}}Names.h" -#include "wtf/PtrUtil.h" #include "wtf/StaticConstructors.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { namespace {{namespace}}Names { @@ -24,9 +22,9 @@ {% endfor %} -std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() +PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() { - std::unique_ptr<const {{namespace}}QualifiedName*[]> tags = wrapArrayUnique(new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]); + OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]); for (size_t i = 0; i < {{namespace}}TagsCount; i++) tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage) + i; return tags; @@ -42,9 +40,9 @@ {% endfor %} {% if namespace != 'HTML' %} -std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs() +PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() { - std::unique_ptr<const QualifiedName*[]> attrs = wrapArrayUnique(new const QualifiedName*[{{namespace}}AttrsCount]); + OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName*[{{namespace}}AttrsCount]); for (size_t i = 0; i < {{namespace}}AttrsCount; i++) attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; return attrs;
diff --git a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl index d9368d2..21de2b62 100644 --- a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl
@@ -8,7 +8,7 @@ #include "core/CoreExport.h" {% endif %} #include "core/dom/QualifiedName.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -32,12 +32,12 @@ {% if tags %} const unsigned {{namespace}}TagsCount = {{tags|count}}; -{{symbol_export}}std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags(); +{{symbol_export}}PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags(); {% endif %} const unsigned {{namespace}}AttrsCount = {{attrs|count}}; {% if namespace != 'HTML' %} -std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs(); +PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs(); {% endif %} void init();
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp index 9cd519a2b..14cbc42 100644 --- a/third_party/WebKit/Source/core/animation/Animation.cpp +++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -45,7 +45,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -294,7 +293,7 @@ createCompositorPlayer(); if (maybeStartAnimationOnCompositor()) - m_compositorState = wrapUnique(new CompositorState(*this)); + m_compositorState = adoptPtr(new CompositorState(*this)); else cancelIncompatibleAnimationsOnCompositor(); }
diff --git a/third_party/WebKit/Source/core/animation/Animation.h b/third_party/WebKit/Source/core/animation/Animation.h index 24d45f9..5cfc053 100644 --- a/third_party/WebKit/Source/core/animation/Animation.h +++ b/third_party/WebKit/Source/core/animation/Animation.h
@@ -45,7 +45,6 @@ #include "platform/animation/CompositorAnimationPlayerClient.h" #include "platform/heap/Handle.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -295,11 +294,11 @@ // This mirrors the known compositor state. It is created when a compositor // animation is started. Updated once the start time is known and each time // modifications are pushed to the compositor. - std::unique_ptr<CompositorState> m_compositorState; + OwnPtr<CompositorState> m_compositorState; bool m_compositorPending; int m_compositorGroup; - std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; + OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; bool m_currentTimePending; bool m_stateIsBeingUpdated;
diff --git a/third_party/WebKit/Source/core/animation/AnimationClock.h b/third_party/WebKit/Source/core/animation/AnimationClock.h index b1416eb..0b05963 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClock.h +++ b/third_party/WebKit/Source/core/animation/AnimationClock.h
@@ -35,6 +35,7 @@ #include "wtf/Allocator.h" #include "wtf/CurrentTime.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp index fa657ca..9eaddbc 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
@@ -31,6 +31,7 @@ #include "core/animation/AnimationClock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp index ef7b9bf7..e272e35 100644 --- a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp
@@ -9,7 +9,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/animation/TimingFunction.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -53,7 +52,7 @@ ThreadHeap::collectAllGarbage(); } - std::unique_ptr<DummyPageHolder> pageHolder; + OwnPtr<DummyPageHolder> pageHolder; Persistent<Document> document; TrackExceptionState exceptionState; };
diff --git a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp index c7ddd8b..bdccc72d 100644 --- a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
@@ -13,7 +13,6 @@ #include "core/animation/animatable/AnimatableDouble.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -80,7 +79,7 @@ return toLegacyStyleInterpolation(interpolation).currentValue().get(); } - std::unique_ptr<DummyPageHolder> pageHolder; + OwnPtr<DummyPageHolder> pageHolder; Persistent<Document> document; Persistent<AnimationTimeline> timeline; Persistent<Element> element;
diff --git a/third_party/WebKit/Source/core/animation/AnimationTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTest.cpp index 0b8a59e..15b7bae8 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTest.cpp
@@ -40,7 +40,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/weborigin/KURL.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -89,7 +88,7 @@ Persistent<AnimationTimeline> timeline; Persistent<Animation> animation; TrackExceptionState exceptionState; - std::unique_ptr<DummyPageHolder> pageHolder; + OwnPtr<DummyPageHolder> pageHolder; }; TEST_F(AnimationAnimationTest, InitialState)
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp b/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp index e753bba..f3820aca 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp
@@ -41,7 +41,6 @@ #include "platform/animation/CompositorAnimationTimeline.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "wtf/PtrUtil.h" #include <algorithm> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimeline.h b/third_party/WebKit/Source/core/animation/AnimationTimeline.h index caddbf3..4dc8e86 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimeline.h +++ b/third_party/WebKit/Source/core/animation/AnimationTimeline.h
@@ -41,7 +41,6 @@ #include "platform/heap/Handle.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -124,7 +123,7 @@ Member<PlatformTiming> m_timing; double m_lastCurrentTimeInternal; - std::unique_ptr<CompositorAnimationTimeline> m_compositorTimeline; + OwnPtr<CompositorAnimationTimeline> m_compositorTimeline; class AnimationTimelineTiming final : public PlatformTiming { public:
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp index e3912b3..7e39d16 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp
@@ -42,7 +42,6 @@ #include "platform/weborigin/KURL.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -88,7 +87,7 @@ timeline->scheduleNextService(); } - std::unique_ptr<DummyPageHolder> pageHolder; + OwnPtr<DummyPageHolder> pageHolder; Persistent<Document> document; Persistent<Element> element; Persistent<AnimationTimeline> timeline;
diff --git a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp index 5501da5b..8a1975bf 100644 --- a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
@@ -9,7 +9,6 @@ #include "core/css/CSSBasicShapeValues.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/BasicShapes.h" -#include <memory> namespace blink { @@ -73,25 +72,25 @@ namespace { -std::unique_ptr<InterpolableValue> unwrap(InterpolationValue&& value) +PassOwnPtr<InterpolableValue> unwrap(InterpolationValue&& value) { ASSERT(value.interpolableValue); return std::move(value.interpolableValue); } -std::unique_ptr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate) +PassOwnPtr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate) { if (coordinate) return unwrap(CSSPositionAxisListInterpolationType::convertPositionAxisCSSValue(*coordinate)); return unwrap(CSSLengthInterpolationType::maybeConvertLength(Length(50, Percent), 1)); } -std::unique_ptr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom) +PassOwnPtr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom) { return unwrap(CSSLengthInterpolationType::maybeConvertLength(coordinate.computedLength(), zoom)); } -std::unique_ptr<InterpolableValue> createNeutralInterpolableCoordinate() +PassOwnPtr<InterpolableValue> createNeutralInterpolableCoordinate() { return CSSLengthInterpolationType::createNeutralInterpolableValue(); } @@ -103,21 +102,21 @@ CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData)); } -std::unique_ptr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius) +PassOwnPtr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius) { if (!radius || radius->isValueID()) return nullptr; return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*radius)); } -std::unique_ptr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom) +PassOwnPtr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom) { if (radius.type() != BasicShapeRadius::Value) return nullptr; return unwrap(CSSLengthInterpolationType::maybeConvertLength(radius.value(), zoom)); } -std::unique_ptr<InterpolableValue> createNeutralInterpolableRadius() +PassOwnPtr<InterpolableValue> createNeutralInterpolableRadius() { return CSSLengthInterpolationType::createNeutralInterpolableValue(); } @@ -127,24 +126,24 @@ return BasicShapeRadius(CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData, ValueRangeNonNegative)); } -std::unique_ptr<InterpolableValue> convertCSSLength(const CSSValue* length) +PassOwnPtr<InterpolableValue> convertCSSLength(const CSSValue* length) { if (!length) return CSSLengthInterpolationType::createNeutralInterpolableValue(); return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*length)); } -std::unique_ptr<InterpolableValue> convertLength(const Length& length, double zoom) +PassOwnPtr<InterpolableValue> convertLength(const Length& length, double zoom) { return unwrap(CSSLengthInterpolationType::maybeConvertLength(length, zoom)); } -std::unique_ptr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair) +PassOwnPtr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair) { return convertCSSLength(pair ? &pair->first() : nullptr); } -std::unique_ptr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair) +PassOwnPtr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair) { return convertCSSLength(pair ? &pair->second() : nullptr); } @@ -167,11 +166,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, convertCSSCoordinate(circle.centerX())); list->set(CircleCenterYIndex, convertCSSCoordinate(circle.centerY())); - std::unique_ptr<InterpolableValue> radius; + OwnPtr<InterpolableValue> radius; if (!(radius = convertCSSRadius(circle.radius()))) return nullptr; list->set(CircleRadiusIndex, std::move(radius)); @@ -181,11 +180,11 @@ InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, convertCoordinate(circle.centerX(), zoom)); list->set(CircleCenterYIndex, convertCoordinate(circle.centerY(), zoom)); - std::unique_ptr<InterpolableValue> radius; + OwnPtr<InterpolableValue> radius; if (!(radius = convertRadius(circle.radius(), zoom))) return nullptr; list->set(CircleRadiusIndex, std::move(radius)); @@ -193,9 +192,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeCircleType)); } -std::unique_ptr<InterpolableValue> createNeutralValue() +PassOwnPtr<InterpolableValue> createNeutralValue() { - std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, createNeutralInterpolableCoordinate()); list->set(CircleCenterYIndex, createNeutralInterpolableCoordinate()); list->set(CircleRadiusIndex, createNeutralInterpolableRadius()); @@ -226,11 +225,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, convertCSSCoordinate(ellipse.centerX())); list->set(EllipseCenterYIndex, convertCSSCoordinate(ellipse.centerY())); - std::unique_ptr<InterpolableValue> radius; + OwnPtr<InterpolableValue> radius; if (!(radius = convertCSSRadius(ellipse.radiusX()))) return nullptr; list->set(EllipseRadiusXIndex, std::move(radius)); @@ -243,11 +242,11 @@ InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, convertCoordinate(ellipse.centerX(), zoom)); list->set(EllipseCenterYIndex, convertCoordinate(ellipse.centerY(), zoom)); - std::unique_ptr<InterpolableValue> radius; + OwnPtr<InterpolableValue> radius; if (!(radius = convertRadius(ellipse.radiusX(), zoom))) return nullptr; list->set(EllipseRadiusXIndex, std::move(radius)); @@ -258,9 +257,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeEllipseType)); } -std::unique_ptr<InterpolableValue> createNeutralValue() +PassOwnPtr<InterpolableValue> createNeutralValue() { - std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, createNeutralInterpolableCoordinate()); list->set(EllipseCenterYIndex, createNeutralInterpolableCoordinate()); list->set(EllipseRadiusXIndex, createNeutralInterpolableRadius()); @@ -301,7 +300,7 @@ InterpolationValue convertCSSValue(const CSSBasicShapeInsetValue& inset) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, convertCSSLength(inset.top())); list->set(InsetRightIndex, convertCSSLength(inset.right())); list->set(InsetBottomIndex, convertCSSLength(inset.bottom())); @@ -320,7 +319,7 @@ InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, convertLength(inset.top(), zoom)); list->set(InsetRightIndex, convertLength(inset.right(), zoom)); list->set(InsetBottomIndex, convertLength(inset.bottom(), zoom)); @@ -337,9 +336,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeInsetType)); } -std::unique_ptr<InterpolableValue> createNeutralValue() +PassOwnPtr<InterpolableValue> createNeutralValue() { - std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); list->set(InsetRightIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); list->set(InsetBottomIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); @@ -379,7 +378,7 @@ InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon) { size_t size = polygon.values().size(); - std::unique_ptr<InterpolableList> list = InterpolableList::create(size); + OwnPtr<InterpolableList> list = InterpolableList::create(size); for (size_t i = 0; i < size; i++) list->set(i, convertCSSLength(polygon.values()[i].get())); return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size)); @@ -388,15 +387,15 @@ InterpolationValue convertBasicShape(const BasicShapePolygon& polygon, double zoom) { size_t size = polygon.values().size(); - std::unique_ptr<InterpolableList> list = InterpolableList::create(size); + OwnPtr<InterpolableList> list = InterpolableList::create(size); for (size_t i = 0; i < size; i++) list->set(i, convertLength(polygon.values()[i], zoom)); return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size)); } -std::unique_ptr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue) +PassOwnPtr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size()); + OwnPtr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size()); for (size_t i = 0; i < nonInterpolableValue.size(); i++) list->set(i, CSSLengthInterpolationType::createNeutralInterpolableValue()); return std::move(list); @@ -454,7 +453,7 @@ } } -std::unique_ptr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue) +PassOwnPtr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue) { const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNonInterpolableValue(untypedNonInterpolableValue); switch (nonInterpolableValue.type()) {
diff --git a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h index c1d8431..6dfcf411 100644 --- a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h
@@ -6,7 +6,6 @@ #define BasicShapeInterpolationFunctions_h #include "core/animation/InterpolationValue.h" -#include <memory> namespace blink { @@ -18,7 +17,7 @@ InterpolationValue maybeConvertCSSValue(const CSSValue&); InterpolationValue maybeConvertBasicShape(const BasicShape*, double zoom); -std::unique_ptr<InterpolableValue> createNeutralValue(const NonInterpolableValue&); +PassOwnPtr<InterpolableValue> createNeutralValue(const NonInterpolableValue&); bool shapesAreCompatible(const NonInterpolableValue&, const NonInterpolableValue&); PassRefPtr<BasicShape> createBasicShape(const InterpolableValue&, const NonInterpolableValue&, const CSSToLengthConversionData&);
diff --git a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp index 4ac573a..71790836 100644 --- a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp
@@ -10,8 +10,6 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/BasicShapes.h" #include "core/style/DataEquivalency.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -19,9 +17,9 @@ class UnderlyingCompatibilityChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingCompatibilityChecker> create(PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) + static PassOwnPtr<UnderlyingCompatibilityChecker> create(PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) { - return wrapUnique(new UnderlyingCompatibilityChecker(underlyingNonInterpolableValue)); + return adoptPtr(new UnderlyingCompatibilityChecker(underlyingNonInterpolableValue)); } private: @@ -39,9 +37,9 @@ class InheritedShapeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedShapeChecker> create(CSSPropertyID property, PassRefPtr<BasicShape> inheritedShape) + static PassOwnPtr<InheritedShapeChecker> create(CSSPropertyID property, PassRefPtr<BasicShape> inheritedShape) { - return wrapUnique(new InheritedShapeChecker(property, inheritedShape)); + return adoptPtr(new InheritedShapeChecker(property, inheritedShape)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp index 3ff1615..e3247cc 100644 --- a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp
@@ -8,8 +8,6 @@ #include "core/animation/CSSLengthInterpolationType.h" #include "core/css/CSSQuadValue.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -86,9 +84,9 @@ class UnderlyingSideNumbersChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingSideNumbersChecker> create(const SideNumbers& underlyingSideNumbers) + static PassOwnPtr<UnderlyingSideNumbersChecker> create(const SideNumbers& underlyingSideNumbers) { - return wrapUnique(new UnderlyingSideNumbersChecker(underlyingSideNumbers)); + return adoptPtr(new UnderlyingSideNumbersChecker(underlyingSideNumbers)); } static SideNumbers getUnderlyingSideNumbers(const InterpolationValue& underlying) @@ -111,9 +109,9 @@ class InheritedSideNumbersChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedSideNumbersChecker> create(CSSPropertyID property, const SideNumbers& inheritedSideNumbers) + static PassOwnPtr<InheritedSideNumbersChecker> create(CSSPropertyID property, const SideNumbers& inheritedSideNumbers) { - return wrapUnique(new InheritedSideNumbersChecker(property, inheritedSideNumbers)); + return adoptPtr(new InheritedSideNumbersChecker(property, inheritedSideNumbers)); } private: @@ -133,7 +131,7 @@ InterpolationValue convertBorderImageLengthBox(const BorderImageLengthBox& box, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); const BorderImageLength* sides[SideIndexCount] = {}; sides[SideTop] = &box.top(); @@ -193,7 +191,7 @@ return nullptr; const CSSQuadValue& quad = toCSSQuadValue(value); - std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); const CSSPrimitiveValue* sides[SideIndexCount] = {}; sides[SideTop] = quad.top();
diff --git a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp index f3d3a35..898dd59 100644 --- a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp
@@ -7,8 +7,6 @@ #include "core/animation/CSSLengthInterpolationType.h" #include "core/css/CSSQuadValue.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -65,9 +63,9 @@ class ParentAutosChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentAutosChecker> create(const ClipAutos& parentAutos) + static PassOwnPtr<ParentAutosChecker> create(const ClipAutos& parentAutos) { - return wrapUnique(new ParentAutosChecker(parentAutos)); + return adoptPtr(new ParentAutosChecker(parentAutos)); } private: @@ -113,9 +111,9 @@ public: ~UnderlyingAutosChecker() final {} - static std::unique_ptr<UnderlyingAutosChecker> create(const ClipAutos& underlyingAutos) + static PassOwnPtr<UnderlyingAutosChecker> create(const ClipAutos& underlyingAutos) { - return wrapUnique(new UnderlyingAutosChecker(underlyingAutos)); + return adoptPtr(new UnderlyingAutosChecker(underlyingAutos)); } static ClipAutos getUnderlyingAutos(const InterpolationValue& underlying) @@ -146,7 +144,7 @@ ClipComponentIndexCount, }; -static std::unique_ptr<InterpolableValue> convertClipComponent(const Length& length, double zoom) +static PassOwnPtr<InterpolableValue> convertClipComponent(const Length& length, double zoom) { if (length.isAuto()) return InterpolableList::create(0); @@ -155,7 +153,7 @@ static InterpolationValue createClipValue(const LengthBox& clip, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); list->set(ClipTop, convertClipComponent(clip.top(), zoom)); list->set(ClipRight, convertClipComponent(clip.right(), zoom)); list->set(ClipBottom, convertClipComponent(clip.bottom(), zoom)); @@ -196,7 +194,7 @@ return value.getValueID() == CSSValueAuto; } -static std::unique_ptr<InterpolableValue> convertClipComponent(const CSSPrimitiveValue& length) +static PassOwnPtr<InterpolableValue> convertClipComponent(const CSSPrimitiveValue& length) { if (isCSSAuto(length)) return InterpolableList::create(0); @@ -208,7 +206,7 @@ if (!value.isQuadValue()) return nullptr; const CSSQuadValue& quad = toCSSQuadValue(value); - std::unique_ptr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); list->set(ClipTop, convertClipComponent(*quad.top())); list->set(ClipRight, convertClipComponent(*quad.right())); list->set(ClipBottom, convertClipComponent(*quad.bottom()));
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp index 06264b1..19c50847 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
@@ -8,8 +8,6 @@ #include "core/css/CSSColorValue.h" #include "core/css/resolver/StyleResolverState.h" #include "core/layout/LayoutTheme.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -25,18 +23,18 @@ InterpolableColorIndexCount, }; -static std::unique_ptr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index) +static PassOwnPtr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index) { ASSERT(index < InterpolableColorIndexCount); - std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); for (int i = 0; i < InterpolableColorIndexCount; i++) list->set(i, InterpolableNumber::create(i == index)); return std::move(list); } -std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color) +PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); list->set(Red, InterpolableNumber::create(color.red() * color.alpha())); list->set(Green, InterpolableNumber::create(color.green() * color.alpha())); list->set(Blue, InterpolableNumber::create(color.blue() * color.alpha())); @@ -48,7 +46,7 @@ return std::move(list); } -std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) +PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) { switch (keyword) { case CSSValueCurrentcolor: @@ -67,14 +65,14 @@ } } -std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color) +PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color) { if (color.isCurrentColor()) return createInterpolableColorForIndex(Currentcolor); return createInterpolableColor(color.getColor()); } -std::unique_ptr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value) +PassOwnPtr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value) { if (value.isColorValue()) return createInterpolableColor(toCSSColorValue(value).value()); @@ -137,9 +135,9 @@ class ParentColorChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color) + static PassOwnPtr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color) { - return wrapUnique(new ParentColorChecker(property, color)); + return adoptPtr(new ParentColorChecker(property, color)); } private: @@ -189,10 +187,10 @@ if (cssProperty() == CSSPropertyColor && value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueCurrentcolor) return maybeConvertInherit(state, conversionCheckers); - std::unique_ptr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value); + OwnPtr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value); if (!interpolableColor) return nullptr; - std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); + OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, interpolableColor->clone()); colorPair->set(Visited, std::move(interpolableColor)); return InterpolationValue(std::move(colorPair)); @@ -200,7 +198,7 @@ InterpolationValue CSSColorInterpolationType::convertStyleColorPair(const StyleColor& unvisitedColor, const StyleColor& visitedColor) const { - std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); + OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, createInterpolableColor(unvisitedColor)); colorPair->set(Visited, createInterpolableColor(visitedColor)); return InterpolationValue(std::move(colorPair));
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h index 23c64f43..02f60d8 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h
@@ -8,7 +8,6 @@ #include "core/CSSValueKeywords.h" #include "core/animation/CSSInterpolationType.h" #include "platform/graphics/Color.h" -#include <memory> namespace blink { @@ -23,10 +22,10 @@ InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironment&) const final; void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final; - static std::unique_ptr<InterpolableValue> createInterpolableColor(const Color&); - static std::unique_ptr<InterpolableValue> createInterpolableColor(CSSValueID); - static std::unique_ptr<InterpolableValue> createInterpolableColor(const StyleColor&); - static std::unique_ptr<InterpolableValue> maybeCreateInterpolableColor(const CSSValue&); + static PassOwnPtr<InterpolableValue> createInterpolableColor(const Color&); + static PassOwnPtr<InterpolableValue> createInterpolableColor(CSSValueID); + static PassOwnPtr<InterpolableValue> createInterpolableColor(const StyleColor&); + static PassOwnPtr<InterpolableValue> maybeCreateInterpolableColor(const CSSValue&); static Color resolveInterpolableColor(const InterpolableValue& interpolableColor, const StyleResolverState&, bool isVisited = false, bool isTextDecoration = false); private:
diff --git a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp index 7e28a0e..7ddefa2 100644 --- a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp
@@ -9,8 +9,6 @@ #include "core/animation/ListInterpolationFunctions.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -18,9 +16,9 @@ class UnderlyingFilterListChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingFilterListChecker> create(PassRefPtr<NonInterpolableList> nonInterpolableList) + static PassOwnPtr<UnderlyingFilterListChecker> create(PassRefPtr<NonInterpolableList> nonInterpolableList) { - return wrapUnique(new UnderlyingFilterListChecker(nonInterpolableList)); + return adoptPtr(new UnderlyingFilterListChecker(nonInterpolableList)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -45,9 +43,9 @@ class InheritedFilterListChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedFilterListChecker> create(CSSPropertyID property, const FilterOperations& filterOperations) + static PassOwnPtr<InheritedFilterListChecker> create(CSSPropertyID property, const FilterOperations& filterOperations) { - return wrapUnique(new InheritedFilterListChecker(property, filterOperations)); + return adoptPtr(new InheritedFilterListChecker(property, filterOperations)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue&) const final @@ -69,7 +67,7 @@ InterpolationValue convertFilterList(const FilterOperations& filterOperations, double zoom) { size_t length = filterOperations.size(); - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue filterResult = FilterInterpolationFunctions::maybeConvertFilter(*filterOperations.operations()[i], zoom); @@ -113,7 +111,7 @@ const CSSValueList& list = toCSSValueList(value); size_t length = list.length(); - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue itemResult = FilterInterpolationFunctions::maybeConvertCSSFilter(list.item(i)); @@ -153,7 +151,7 @@ size_t longerLength = toNonInterpolableList(*longer.nonInterpolableValue).length(); InterpolableList& shorterInterpolableList = toInterpolableList(*shorter.interpolableValue); const NonInterpolableList& longerNonInterpolableList = toNonInterpolableList(*longer.nonInterpolableValue); - std::unique_ptr<InterpolableList> extendedInterpolableList = InterpolableList::create(longerLength); + OwnPtr<InterpolableList> extendedInterpolableList = InterpolableList::create(longerLength); for (size_t i = 0; i < longerLength; i++) { if (i < shorterLength) extendedInterpolableList->set(i, std::move(shorterInterpolableList.getMutable(i))); @@ -190,7 +188,7 @@ if (length <= underlyingLength) return; - std::unique_ptr<InterpolableList> extendedInterpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> extendedInterpolableList = InterpolableList::create(length); for (size_t i = 0; i < length; i++) { if (i < underlyingLength) extendedInterpolableList->set(i, std::move(underlyingInterpolableList.getMutable(i)));
diff --git a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp index 5499639..b409ffc 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp
@@ -9,8 +9,6 @@ #include "core/css/resolver/StyleResolverState.h" #include "platform/LengthFunctions.h" #include "platform/fonts/FontDescription.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -18,9 +16,9 @@ class IsMonospaceChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<IsMonospaceChecker> create(bool isMonospace) + static PassOwnPtr<IsMonospaceChecker> create(bool isMonospace) { - return wrapUnique(new IsMonospaceChecker(isMonospace)); + return adoptPtr(new IsMonospaceChecker(isMonospace)); } private: IsMonospaceChecker(bool isMonospace) @@ -37,9 +35,9 @@ class InheritedFontSizeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedFontSizeChecker> create(const FontDescription::Size& inheritedFontSize) + static PassOwnPtr<InheritedFontSizeChecker> create(const FontDescription::Size& inheritedFontSize) { - return wrapUnique(new InheritedFontSizeChecker(inheritedFontSize)); + return adoptPtr(new InheritedFontSizeChecker(inheritedFontSize)); } private: @@ -99,7 +97,7 @@ InterpolationValue CSSFontSizeInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { - std::unique_ptr<InterpolableValue> result = CSSLengthInterpolationType::maybeConvertCSSValue(value).interpolableValue; + OwnPtr<InterpolableValue> result = CSSLengthInterpolationType::maybeConvertCSSValue(value).interpolableValue; if (result) return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp index 9fa8de3..cbc644c 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
@@ -6,8 +6,6 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -59,9 +57,9 @@ class ParentFontWeightChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentFontWeightChecker> create(FontWeight fontWeight) + static PassOwnPtr<ParentFontWeightChecker> create(FontWeight fontWeight) { - return wrapUnique(new ParentFontWeightChecker(fontWeight)); + return adoptPtr(new ParentFontWeightChecker(fontWeight)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp index 415a388..60a9a0a3 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp
@@ -9,8 +9,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/StyleImage.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -115,9 +113,9 @@ public: ~UnderlyingImageChecker() final {} - static std::unique_ptr<UnderlyingImageChecker> create(const InterpolationValue& underlying) + static PassOwnPtr<UnderlyingImageChecker> create(const InterpolationValue& underlying) { - return wrapUnique(new UnderlyingImageChecker(underlying)); + return adoptPtr(new UnderlyingImageChecker(underlying)); } private: @@ -153,9 +151,9 @@ public: ~ParentImageChecker() final {} - static std::unique_ptr<ParentImageChecker> create(CSSPropertyID property, StyleImage* inheritedImage) + static PassOwnPtr<ParentImageChecker> create(CSSPropertyID property, StyleImage* inheritedImage) { - return wrapUnique(new ParentImageChecker(property, inheritedImage)); + return adoptPtr(new ParentImageChecker(property, inheritedImage)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp index 90c0168b..d18b6ee 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp
@@ -10,8 +10,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -19,9 +17,9 @@ public: ~UnderlyingImageListChecker() final {} - static std::unique_ptr<UnderlyingImageListChecker> create(const InterpolationValue& underlying) + static PassOwnPtr<UnderlyingImageListChecker> create(const InterpolationValue& underlying) { - return wrapUnique(new UnderlyingImageListChecker(underlying)); + return adoptPtr(new UnderlyingImageListChecker(underlying)); } private: @@ -64,9 +62,9 @@ public: ~ParentImageListChecker() final {} - static std::unique_ptr<ParentImageListChecker> create(CSSPropertyID property, const StyleImageList& inheritedImageList) + static PassOwnPtr<ParentImageListChecker> create(CSSPropertyID property, const StyleImageList& inheritedImageList) { - return wrapUnique(new ParentImageListChecker(property, inheritedImageList)); + return adoptPtr(new ParentImageListChecker(property, inheritedImageList)); } private: @@ -110,7 +108,7 @@ const CSSValueList& valueList = tempList ? *tempList : toCSSValueList(value); const size_t length = valueList.length(); - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue component = CSSImageInterpolationType::maybeConvertCSSValue(valueList.item(i), false);
diff --git a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp index 1a6aff64..76890c03 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp
@@ -8,8 +8,6 @@ #include "core/animation/ImageSlicePropertyFunctions.h" #include "core/css/CSSBorderImageSliceValue.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -84,9 +82,9 @@ class UnderlyingSliceTypesChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingSliceTypesChecker> create(const SliceTypes& underlyingTypes) + static PassOwnPtr<UnderlyingSliceTypesChecker> create(const SliceTypes& underlyingTypes) { - return wrapUnique(new UnderlyingSliceTypesChecker(underlyingTypes)); + return adoptPtr(new UnderlyingSliceTypesChecker(underlyingTypes)); } static SliceTypes getUnderlyingSliceTypes(const InterpolationValue& underlying) @@ -109,9 +107,9 @@ class InheritedSliceTypesChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedSliceTypesChecker> create(CSSPropertyID property, const SliceTypes& inheritedTypes) + static PassOwnPtr<InheritedSliceTypesChecker> create(CSSPropertyID property, const SliceTypes& inheritedTypes) { - return wrapUnique(new InheritedSliceTypesChecker(property, inheritedTypes)); + return adoptPtr(new InheritedSliceTypesChecker(property, inheritedTypes)); } private: @@ -131,7 +129,7 @@ InterpolationValue convertImageSlice(const ImageSlice& slice, double zoom) { - std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); const Length* sides[SideIndexCount] = {}; sides[SideTop] = &slice.slices.top(); sides[SideRight] = &slice.slices.right(); @@ -178,7 +176,7 @@ return nullptr; const CSSBorderImageSliceValue& slice = toCSSBorderImageSliceValue(value); - std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); + OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); const CSSPrimitiveValue* sides[SideIndexCount]; sides[SideTop] = slice.slices().top(); sides[SideRight] = slice.slices().right();
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp index a5041dc..0778f77 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -10,16 +10,14 @@ #include "core/css/resolver/CSSVariableResolver.h" #include "core/css/resolver/StyleResolverState.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class ResolvedVariableChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue) + static PassOwnPtr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue) { - return wrapUnique(new ResolvedVariableChecker(property, variableReference, resolvedValue)); + return adoptPtr(new ResolvedVariableChecker(property, variableReference, resolvedValue)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp index 15ed438..8296f3ff 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
@@ -9,8 +9,6 @@ #include "core/css/CSSCalculationValue.h" #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -54,16 +52,16 @@ return LengthPropertyFunctions::isZoomedLength(cssProperty()) ? style.effectiveZoom() : 1; } -std::unique_ptr<InterpolableValue> CSSLengthInterpolationType::createInterpolablePixels(double pixels) +PassOwnPtr<InterpolableValue> CSSLengthInterpolationType::createInterpolablePixels(double pixels) { - std::unique_ptr<InterpolableList> interpolableList = createNeutralInterpolableValue(); + OwnPtr<InterpolableList> interpolableList = createNeutralInterpolableValue(); interpolableList->set(CSSPrimitiveValue::UnitTypePixels, InterpolableNumber::create(pixels)); return std::move(interpolableList); } InterpolationValue CSSLengthInterpolationType::createInterpolablePercent(double percent) { - std::unique_ptr<InterpolableList> interpolableList = createNeutralInterpolableValue(); + OwnPtr<InterpolableList> interpolableList = createNeutralInterpolableValue(); interpolableList->set(CSSPrimitiveValue::UnitTypePercentage, InterpolableNumber::create(percent)); return InterpolationValue(std::move(interpolableList), CSSLengthNonInterpolableValue::create(true)); } @@ -74,17 +72,17 @@ return nullptr; PixelsAndPercent pixelsAndPercent = length.getPixelsAndPercent(); - std::unique_ptr<InterpolableList> values = createNeutralInterpolableValue(); + OwnPtr<InterpolableList> values = createNeutralInterpolableValue(); values->set(CSSPrimitiveValue::UnitTypePixels, InterpolableNumber::create(pixelsAndPercent.pixels / zoom)); values->set(CSSPrimitiveValue::UnitTypePercentage, InterpolableNumber::create(pixelsAndPercent.percent)); return InterpolationValue(std::move(values), CSSLengthNonInterpolableValue::create(length.hasPercent())); } -std::unique_ptr<InterpolableList> CSSLengthInterpolationType::createNeutralInterpolableValue() +PassOwnPtr<InterpolableList> CSSLengthInterpolationType::createNeutralInterpolableValue() { const size_t length = CSSPrimitiveValue::LengthUnitTypeCount; - std::unique_ptr<InterpolableList> values = InterpolableList::create(length); + OwnPtr<InterpolableList> values = InterpolableList::create(length); for (size_t i = 0; i < length; i++) values->set(i, InterpolableNumber::create(0)); return values; @@ -104,7 +102,7 @@ } void CSSLengthInterpolationType::composite( - std::unique_ptr<InterpolableValue>& underlyingInterpolableValue, + OwnPtr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, @@ -138,7 +136,7 @@ CSSLengthArray lengthArray; primitiveValue.accumulateLengthArray(lengthArray); - std::unique_ptr<InterpolableList> values = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); + OwnPtr<InterpolableList> values = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) values->set(i, InterpolableNumber::create(lengthArray.values[i])); @@ -148,9 +146,9 @@ class ParentLengthChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentLengthChecker> create(CSSPropertyID property, const Length& length) + static PassOwnPtr<ParentLengthChecker> create(CSSPropertyID property, const Length& length) { - return wrapUnique(new ParentLengthChecker(property, length)); + return adoptPtr(new ParentLengthChecker(property, length)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h index 2537a204..84f9b94 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h
@@ -7,7 +7,6 @@ #include "core/animation/CSSInterpolationType.h" #include "core/animation/LengthPropertyFunctions.h" -#include <memory> namespace blink { @@ -23,14 +22,14 @@ void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final; static Length resolveInterpolableLength(const InterpolableValue&, const NonInterpolableValue*, const CSSToLengthConversionData&, ValueRange = ValueRangeAll); - static std::unique_ptr<InterpolableValue> createInterpolablePixels(double pixels); + static PassOwnPtr<InterpolableValue> createInterpolablePixels(double pixels); static InterpolationValue createInterpolablePercent(double percent); static InterpolationValue maybeConvertCSSValue(const CSSValue&); static InterpolationValue maybeConvertLength(const Length&, float zoom); - static std::unique_ptr<InterpolableList> createNeutralInterpolableValue(); + static PassOwnPtr<InterpolableList> createNeutralInterpolableValue(); static PairwiseInterpolationValue staticMergeSingleConversions(InterpolationValue&& start, InterpolationValue&& end); static bool nonInterpolableValuesAreCompatible(const NonInterpolableValue*, const NonInterpolableValue*); - static void composite(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + static void composite(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static void subtractFromOneHundredPercent(InterpolationValue& result); private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp index e9822d6..8e38df9 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
@@ -11,8 +11,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -57,9 +55,9 @@ public: ~ParentLengthListChecker() final {} - static std::unique_ptr<ParentLengthListChecker> create(CSSPropertyID property, const Vector<Length>& inheritedLengthList) + static PassOwnPtr<ParentLengthListChecker> create(CSSPropertyID property, const Vector<Length>& inheritedLengthList) { - return wrapUnique(new ParentLengthListChecker(property, inheritedLengthList)); + return adoptPtr(new ParentLengthListChecker(property, inheritedLengthList)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp index 3a55984..4f50495 100644 --- a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp
@@ -6,8 +6,6 @@ #include "core/css/resolver/StyleBuilderConverter.h" #include "core/style/StyleMotionRotation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -39,9 +37,9 @@ class UnderlyingRotationTypeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingRotationTypeChecker> create(MotionRotationType underlyingRotationType) + static PassOwnPtr<UnderlyingRotationTypeChecker> create(MotionRotationType underlyingRotationType) { - return wrapUnique(new UnderlyingRotationTypeChecker(underlyingRotationType)); + return adoptPtr(new UnderlyingRotationTypeChecker(underlyingRotationType)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -59,9 +57,9 @@ class InheritedRotationTypeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedRotationTypeChecker> create(MotionRotationType inheritedRotationType) + static PassOwnPtr<InheritedRotationTypeChecker> create(MotionRotationType inheritedRotationType) { - return wrapUnique(new InheritedRotationTypeChecker(inheritedRotationType)); + return adoptPtr(new InheritedRotationTypeChecker(inheritedRotationType)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp index b2df15d..1d759e0 100644 --- a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp
@@ -7,16 +7,14 @@ #include "core/animation/NumberPropertyFunctions.h" #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class ParentNumberChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentNumberChecker> create(CSSPropertyID property, double number) + static PassOwnPtr<ParentNumberChecker> create(CSSPropertyID property, double number) { - return wrapUnique(new ParentNumberChecker(property, number)); + return adoptPtr(new ParentNumberChecker(property, number)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp index 63b49383..33fb0e1 100644 --- a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp
@@ -7,8 +7,6 @@ #include "core/animation/CSSColorInterpolationType.h" #include "core/animation/PaintPropertyFunctions.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -27,13 +25,13 @@ class ParentPaintChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentPaintChecker> create(CSSPropertyID property, const StyleColor& color) + static PassOwnPtr<ParentPaintChecker> create(CSSPropertyID property, const StyleColor& color) { - return wrapUnique(new ParentPaintChecker(property, color)); + return adoptPtr(new ParentPaintChecker(property, color)); } - static std::unique_ptr<ParentPaintChecker> create(CSSPropertyID property) + static PassOwnPtr<ParentPaintChecker> create(CSSPropertyID property) { - return wrapUnique(new ParentPaintChecker(property)); + return adoptPtr(new ParentPaintChecker(property)); } private: @@ -75,7 +73,7 @@ InterpolationValue CSSPaintInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const { - std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(value); + OwnPtr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(value); if (!interpolableColor) return nullptr; return InterpolationValue(std::move(interpolableColor));
diff --git a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp index f406ced..03c87db 100644 --- a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp
@@ -7,15 +7,13 @@ #include "core/animation/PathInterpolationFunctions.h" #include "core/css/CSSPathValue.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { void CSSPathInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { ASSERT(cssProperty() == CSSPropertyD); - std::unique_ptr<SVGPathByteStream> pathByteStream = PathInterpolationFunctions::appliedValue(interpolableValue, nonInterpolableValue); + OwnPtr<SVGPathByteStream> pathByteStream = PathInterpolationFunctions::appliedValue(interpolableValue, nonInterpolableValue); if (pathByteStream->isEmpty()) { environment.state().style()->setD(nullptr); return; @@ -40,9 +38,9 @@ class ParentPathChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentPathChecker> create(PassRefPtr<StylePath> stylePath) + static PassOwnPtr<ParentPathChecker> create(PassRefPtr<StylePath> stylePath) { - return wrapUnique(new ParentPathChecker(stylePath)); + return adoptPtr(new ParentPathChecker(stylePath)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp index d9eb7a8..c060bcad 100644 --- a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp
@@ -7,8 +7,6 @@ #include "core/css/resolver/StyleBuilderConverter.h" #include "platform/transforms/RotateTransformOperation.h" #include "platform/transforms/Rotation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -92,9 +90,9 @@ class InheritedRotationChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedRotationChecker> create(const Rotation& inheritedRotation) + static PassOwnPtr<InheritedRotationChecker> create(const Rotation& inheritedRotation) { - return wrapUnique(new InheritedRotationChecker(inheritedRotation)); + return adoptPtr(new InheritedRotationChecker(inheritedRotation)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp index 8ff23f43..1c4bb4e 100644 --- a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp
@@ -7,8 +7,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -39,9 +37,9 @@ array[2] = z; } - std::unique_ptr<InterpolableValue> createInterpolableValue() const + PassOwnPtr<InterpolableValue> createInterpolableValue() const { - std::unique_ptr<InterpolableList> result = InterpolableList::create(3); + OwnPtr<InterpolableList> result = InterpolableList::create(3); for (size_t i = 0; i < 3; i++) result->set(i, InterpolableNumber::create(array[i])); return std::move(result); @@ -61,9 +59,9 @@ class ParentScaleChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentScaleChecker> create(const Scale& scale) + static PassOwnPtr<ParentScaleChecker> create(const Scale& scale) { - return wrapUnique(new ParentScaleChecker(scale)); + return adoptPtr(new ParentScaleChecker(scale)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp index eff2bd9..1a08cd58 100644 --- a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp
@@ -11,8 +11,6 @@ #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowList.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -43,9 +41,9 @@ class ParentShadowListChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentShadowListChecker> create(CSSPropertyID property, PassRefPtr<ShadowList> shadowList) + static PassOwnPtr<ParentShadowListChecker> create(CSSPropertyID property, PassRefPtr<ShadowList> shadowList) { - return wrapUnique(new ParentShadowListChecker(property, shadowList)); + return adoptPtr(new ParentShadowListChecker(property, shadowList)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp index 019fe08..4cf925d 100644 --- a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp
@@ -9,8 +9,6 @@ #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/ComputedStyle.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -65,9 +63,9 @@ class UnderlyingIndentModeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingIndentModeChecker> create(const IndentMode& mode) + static PassOwnPtr<UnderlyingIndentModeChecker> create(const IndentMode& mode) { - return wrapUnique(new UnderlyingIndentModeChecker(mode)); + return adoptPtr(new UnderlyingIndentModeChecker(mode)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -85,9 +83,9 @@ class InheritedIndentModeChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedIndentModeChecker> create(const IndentMode& mode) + static PassOwnPtr<InheritedIndentModeChecker> create(const IndentMode& mode) { - return wrapUnique(new InheritedIndentModeChecker(mode)); + return adoptPtr(new InheritedIndentModeChecker(mode)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue&) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp index f938343..b44eb40 100644 --- a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
@@ -12,8 +12,6 @@ #include "core/css/resolver/TransformBuilder.h" #include "platform/transforms/TransformOperations.h" #include "platform/transforms/TranslateTransformOperation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -109,9 +107,9 @@ class InheritedTransformChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<InheritedTransformChecker> create(const TransformOperations& inheritedTransform) + static PassOwnPtr<InheritedTransformChecker> create(const TransformOperations& inheritedTransform) { - return wrapUnique(new InheritedTransformChecker(inheritedTransform)); + return adoptPtr(new InheritedTransformChecker(inheritedTransform)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final @@ -162,7 +160,7 @@ primitiveValue.accumulateLengthArray(lengthArray); } } - std::unique_ptr<InterpolationType::ConversionChecker> lengthUnitsChecker = LengthUnitsChecker::maybeCreate(std::move(lengthArray), state); + OwnPtr<InterpolationType::ConversionChecker> lengthUnitsChecker = LengthUnitsChecker::maybeCreate(std::move(lengthArray), state); if (lengthUnitsChecker) conversionCheckers.append(std::move(lengthUnitsChecker));
diff --git a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp index 87e1460..a544cb2 100644 --- a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp
@@ -8,8 +8,6 @@ #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" #include "platform/transforms/TranslateTransformOperation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -19,9 +17,9 @@ public: ~ParentTranslateChecker() {} - static std::unique_ptr<ParentTranslateChecker> create(PassRefPtr<TranslateTransformOperation> parentTranslate) + static PassOwnPtr<ParentTranslateChecker> create(PassRefPtr<TranslateTransformOperation> parentTranslate) { - return wrapUnique(new ParentTranslateChecker(parentTranslate)); + return adoptPtr(new ParentTranslateChecker(parentTranslate)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final @@ -51,7 +49,7 @@ InterpolationValue createNeutralValue() { - std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); result->set(TranslateX, CSSLengthInterpolationType::createNeutralInterpolableValue()); result->set(TranslateY, CSSLengthInterpolationType::createNeutralInterpolableValue()); result->set(TranslateZ, CSSLengthInterpolationType::createNeutralInterpolableValue()); @@ -63,7 +61,7 @@ if (!translate) return createNeutralValue(); - std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); result->set(TranslateX, CSSLengthInterpolationType::maybeConvertLength(translate->x(), zoom).interpolableValue); result->set(TranslateY, CSSLengthInterpolationType::maybeConvertLength(translate->y(), zoom).interpolableValue); result->set(TranslateZ, CSSLengthInterpolationType::maybeConvertLength(Length(translate->z(), Fixed), zoom).interpolableValue); @@ -98,7 +96,7 @@ if (list.length() < 1 || list.length() > 3) return nullptr; - std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); for (size_t i = 0; i < TranslateComponentIndexCount; i++) { InterpolationValue component = nullptr; if (i < list.length()) {
diff --git a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp index 40fc30ea..f620da1 100644 --- a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp
@@ -6,8 +6,6 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -58,9 +56,9 @@ public: ~UnderlyingVisibilityChecker() final {} - static std::unique_ptr<UnderlyingVisibilityChecker> create(EVisibility visibility) + static PassOwnPtr<UnderlyingVisibilityChecker> create(EVisibility visibility) { - return wrapUnique(new UnderlyingVisibilityChecker(visibility)); + return adoptPtr(new UnderlyingVisibilityChecker(visibility)); } private: @@ -80,9 +78,9 @@ class ParentVisibilityChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<ParentVisibilityChecker> create(EVisibility visibility) + static PassOwnPtr<ParentVisibilityChecker> create(EVisibility visibility) { - return wrapUnique(new ParentVisibilityChecker(visibility)); + return adoptPtr(new ParentVisibilityChecker(visibility)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp index a4bd613..31e504c 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -53,10 +53,9 @@ #include "platform/geometry/FloatBox.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "wtf/PtrUtil.h" + #include <algorithm> #include <cmath> -#include <memory> namespace blink { @@ -333,14 +332,14 @@ const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect); - Vector<std::unique_ptr<CompositorAnimation>> animations; + Vector<OwnPtr<CompositorAnimation>> animations; getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, animationPlaybackRate); ASSERT(!animations.isEmpty()); for (auto& compositorAnimation : animations) { int id = compositorAnimation->id(); CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); ASSERT(compositorPlayer); - compositorPlayer->addAnimation(compositorAnimation.release()); + compositorPlayer->addAnimation(compositorAnimation.leakPtr()); startedAnimationIds.append(id); } ASSERT(!startedAnimationIds.isEmpty()); @@ -511,7 +510,7 @@ void addKeyframeToCurve(CompositorFilterAnimationCurve& curve, Keyframe::PropertySpecificKeyframe* keyframe, const AnimatableValue* value, const TimingFunction* keyframeTimingFunction) { - std::unique_ptr<CompositorFilterOperations> ops = CompositorFilterOperations::create(); + OwnPtr<CompositorFilterOperations> ops = CompositorFilterOperations::create(); toCompositorFilterOperations(toAnimatableFilterOperations(value)->operations(), ops.get()); CompositorFilterKeyframe filterKeyframe(keyframe->offset(), std::move(ops)); @@ -528,7 +527,7 @@ void addKeyframeToCurve(CompositorTransformAnimationCurve& curve, Keyframe::PropertySpecificKeyframe* keyframe, const AnimatableValue* value, const TimingFunction* keyframeTimingFunction) { - std::unique_ptr<CompositorTransformOperations> ops = CompositorTransformOperations::create(); + OwnPtr<CompositorTransformOperations> ops = CompositorTransformOperations::create(); toCompositorTransformOperations(toAnimatableTransform(value)->transformOperations(), ops.get()); CompositorTransformKeyframe transformKeyframe(keyframe->offset(), std::move(ops)); @@ -556,7 +555,7 @@ } // namespace -void CompositorAnimations::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations, double animationPlaybackRate) +void CompositorAnimations::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<OwnPtr<CompositorAnimation>>& animations, double animationPlaybackRate) { ASSERT(animations.isEmpty()); CompositorTiming compositorTiming; @@ -577,11 +576,11 @@ getKeyframeValuesForProperty(&effect, property, scale, values); CompositorTargetProperty::Type targetProperty; - std::unique_ptr<CompositorAnimationCurve> curve; + OwnPtr<CompositorAnimationCurve> curve; switch (property.cssProperty()) { case CSSPropertyOpacity: { targetProperty = CompositorTargetProperty::OPACITY; - std::unique_ptr<CompositorFloatAnimationCurve> floatCurve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> floatCurve = CompositorFloatAnimationCurve::create(); addKeyframesToCurve(*floatCurve, values); setTimingFunctionOnCurve(*floatCurve, timing.timingFunction.get()); curve = std::move(floatCurve); @@ -590,7 +589,7 @@ case CSSPropertyWebkitFilter: case CSSPropertyBackdropFilter: { targetProperty = CompositorTargetProperty::FILTER; - std::unique_ptr<CompositorFilterAnimationCurve> filterCurve = CompositorFilterAnimationCurve::create(); + OwnPtr<CompositorFilterAnimationCurve> filterCurve = CompositorFilterAnimationCurve::create(); addKeyframesToCurve(*filterCurve, values); setTimingFunctionOnCurve(*filterCurve, timing.timingFunction.get()); curve = std::move(filterCurve); @@ -601,7 +600,7 @@ case CSSPropertyTranslate: case CSSPropertyTransform: { targetProperty = CompositorTargetProperty::TRANSFORM; - std::unique_ptr<CompositorTransformAnimationCurve> transformCurve = CompositorTransformAnimationCurve::create(); + OwnPtr<CompositorTransformAnimationCurve> transformCurve = CompositorTransformAnimationCurve::create(); addKeyframesToCurve(*transformCurve, values); setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get()); curve = std::move(transformCurve); @@ -613,7 +612,7 @@ } ASSERT(curve.get()); - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*curve, targetProperty, group, 0); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*curve, targetProperty, group, 0); if (!std::isnan(startTime)) animation->setStartTime(startTime);
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.h b/third_party/WebKit/Source/core/animation/CompositorAnimations.h index 4770aa2..7aa79b6 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.h +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.h
@@ -37,7 +37,6 @@ #include "platform/animation/TimingFunction.h" #include "wtf/Allocator.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -77,7 +76,7 @@ static bool convertTimingForCompositor(const Timing&, double timeOffset, CompositorTiming& out, double animationPlaybackRate); - static void getAnimationOnCompositor(const Timing&, int group, double startTime, double timeOffset, const KeyframeEffectModelBase&, Vector<std::unique_ptr<CompositorAnimation>>& animations, double animationPlaybackRate); + static void getAnimationOnCompositor(const Timing&, int group, double startTime, double timeOffset, const KeyframeEffectModelBase&, Vector<OwnPtr<CompositorAnimation>>& animations, double animationPlaybackRate); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp index dad1ada..bd1ef13 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
@@ -53,10 +53,10 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashFunctions.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -69,15 +69,15 @@ Timing m_timing; CompositorAnimations::CompositorTiming m_compositorTiming; - std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector2; + OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; - std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector5; + OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; Persistent<Document> m_document; Persistent<Element> m_element; Persistent<AnimationTimeline> m_timeline; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; void SetUp() override { @@ -116,11 +116,11 @@ { return CompositorAnimations::isCandidateForAnimationOnCompositor(timing, *m_element.get(), nullptr, effect, 1); } - void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations) + void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<OwnPtr<CompositorAnimation>>& animations) { getAnimationOnCompositor(timing, effect, animations, 1); } - void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations, double playerPlaybackRate) + void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<OwnPtr<CompositorAnimation>>& animations, double playerPlaybackRate) { CompositorAnimations::getAnimationOnCompositor(timing, 0, std::numeric_limits<double>::quiet_NaN(), 0, effect, animations, playerPlaybackRate); } @@ -180,7 +180,7 @@ return keyframe; } - std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(size_t n) + PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(size_t n) { Vector<double> values; for (size_t i = 0; i < n; i++) { @@ -189,9 +189,9 @@ return createCompositableFloatKeyframeVector(values); } - std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(Vector<double>& values) + PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(Vector<double>& values) { - std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new AnimatableValueKeyframeVector); + OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableValueKeyframeVector); for (size_t i = 0; i < values.size(); i++) { double offset = 1.0 / (values.size() - 1) * i; RefPtr<AnimatableDouble> value = AnimatableDouble::create(values[i]); @@ -200,9 +200,9 @@ return frames; } - std::unique_ptr<AnimatableValueKeyframeVector> createCompositableTransformKeyframeVector(const Vector<TransformOperations>& values) + PassOwnPtr<AnimatableValueKeyframeVector> createCompositableTransformKeyframeVector(const Vector<TransformOperations>& values) { - std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new AnimatableValueKeyframeVector); + OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableValueKeyframeVector); for (size_t i = 0; i < values.size(); ++i) { double offset = 1.0f / (values.size() - 1) * i; RefPtr<AnimatableTransform> value = AnimatableTransform::create(values[i], 1); @@ -247,15 +247,15 @@ m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); } - std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect, double playerPlaybackRate) + PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect, double playerPlaybackRate) { - Vector<std::unique_ptr<CompositorAnimation>> result; + Vector<OwnPtr<CompositorAnimation>> result; getAnimationOnCompositor(m_timing, effect, result, playerPlaybackRate); DCHECK_EQ(1U, result.size()); return std::move(result[0]); } - std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect) + PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect) { return convertToCompositorAnimation(effect, 1.0); } @@ -348,7 +348,7 @@ transformVector.last().operations().append(TranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); transformVector.append(TransformOperations()); transformVector.last().operations().append(TranslateTransformOperation::create(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D)); - std::unique_ptr<AnimatableValueKeyframeVector> frames = createCompositableTransformKeyframeVector(transformVector); + OwnPtr<AnimatableValueKeyframeVector> frames = createCompositableTransformKeyframeVector(transformVector); FloatBox bounds; EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::create(*frames), 0, 1)); EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); @@ -646,14 +646,14 @@ createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0).get(), 0), createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0).get(), 1.0)); - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -677,8 +677,8 @@ const double duration = 10.0; m_timing.iterationDuration = duration; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -699,14 +699,14 @@ m_timing.direction = Timing::PlaybackDirectionAlternate; m_timing.playbackRate = 2.0; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDirection()); EXPECT_EQ(2.0, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -741,13 +741,13 @@ m_timing.iterationDuration = 1.75; m_timing.startDelay = startDelay; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(-startDelay, animation->timeOffset()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -774,14 +774,14 @@ m_timing.iterationCount = 10; m_timing.direction = Timing::PlaybackDirectionAlternate; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(10.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -822,14 +822,14 @@ m_timing.iterationCount = 10; m_timing.direction = Timing::PlaybackDirectionAlternateReverse; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(10.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -867,14 +867,14 @@ m_timing.startDelay = negativeStartDelay; m_timing.direction = Timing::PlaybackDirectionAlternateReverse; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(-negativeStartDelay, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -892,14 +892,14 @@ m_timing.playbackRate = playbackRate; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect, playerPlaybackRate); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect, playerPlaybackRate); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()); EXPECT_EQ(playbackRate * playerPlaybackRate, animation->playbackRate()); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -914,7 +914,7 @@ m_timing.fillMode = Timing::FillModeNone; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode()); } @@ -927,7 +927,7 @@ m_timing.fillMode = Timing::FillModeAuto; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); @@ -945,9 +945,9 @@ m_timing.timingFunction = m_cubicCustomTimingFunction; - std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); - std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size());
diff --git a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp index 32cf30f..3c307d2d1 100644 --- a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp +++ b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
@@ -14,7 +14,6 @@ #include "core/dom/ExceptionCode.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/EffectModel.h b/third_party/WebKit/Source/core/animation/EffectModel.h index cdf0cb6..9bf46e3 100644 --- a/third_party/WebKit/Source/core/animation/EffectModel.h +++ b/third_party/WebKit/Source/core/animation/EffectModel.h
@@ -37,6 +37,7 @@ #include "core/animation/PropertyHandle.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp index 47d19883aa..8d5b166 100644 --- a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp
@@ -12,7 +12,6 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowData.h" #include "platform/graphics/filters/FilterOperations.h" -#include <memory> namespace blink { @@ -196,7 +195,7 @@ return result; } -std::unique_ptr<InterpolableValue> FilterInterpolationFunctions::createNoneValue(const NonInterpolableValue& untypedNonInterpolableValue) +PassOwnPtr<InterpolableValue> FilterInterpolationFunctions::createNoneValue(const NonInterpolableValue& untypedNonInterpolableValue) { switch (toFilterNonInterpolableValue(untypedNonInterpolableValue).type()) { case FilterOperation::GRAYSCALE:
diff --git a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h index 38f18a09..0f9c6c96 100644 --- a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h
@@ -7,7 +7,6 @@ #include "core/animation/InterpolationValue.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ InterpolationValue maybeConvertCSSFilter(const CSSValue&); InterpolationValue maybeConvertFilter(const FilterOperation&, double zoom); -std::unique_ptr<InterpolableValue> createNoneValue(const NonInterpolableValue&); +PassOwnPtr<InterpolableValue> createNoneValue(const NonInterpolableValue&); bool filtersAreCompatible(const NonInterpolableValue&, const NonInterpolableValue&); FilterOperation* createFilter(const InterpolableValue&, const NonInterpolableValue&, const StyleResolverState&);
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp index de958c4b..084ecf8 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp
@@ -4,8 +4,6 @@ #include "core/animation/InterpolableValue.h" -#include <memory> - namespace blink { bool InterpolableNumber::equals(const InterpolableValue& other) const @@ -64,9 +62,9 @@ } } -std::unique_ptr<InterpolableValue> InterpolableList::cloneAndZero() const +PassOwnPtr<InterpolableValue> InterpolableList::cloneAndZero() const { - std::unique_ptr<InterpolableList> result = InterpolableList::create(m_size); + OwnPtr<InterpolableList> result = InterpolableList::create(m_size); for (size_t i = 0; i < m_size; i++) result->set(i, m_values[i]->cloneAndZero()); return std::move(result);
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.h b/third_party/WebKit/Source/core/animation/InterpolableValue.h index d1720e841..a3d30a8d 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValue.h +++ b/third_party/WebKit/Source/core/animation/InterpolableValue.h
@@ -8,9 +8,9 @@ #include "core/CoreExport.h" #include "core/animation/animatable/AnimatableValue.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -26,8 +26,8 @@ virtual bool isAnimatableValue() const { return false; } virtual bool equals(const InterpolableValue&) const = 0; - virtual std::unique_ptr<InterpolableValue> clone() const = 0; - virtual std::unique_ptr<InterpolableValue> cloneAndZero() const = 0; + virtual PassOwnPtr<InterpolableValue> clone() const = 0; + virtual PassOwnPtr<InterpolableValue> cloneAndZero() const = 0; virtual void scale(double scale) = 0; virtual void scaleAndAdd(double scale, const InterpolableValue& other) = 0; @@ -49,16 +49,16 @@ class CORE_EXPORT InterpolableNumber final : public InterpolableValue { public: - static std::unique_ptr<InterpolableNumber> create(double value) + static PassOwnPtr<InterpolableNumber> create(double value) { - return wrapUnique(new InterpolableNumber(value)); + return adoptPtr(new InterpolableNumber(value)); } bool isNumber() const final { return true; } double value() const { return m_value; } bool equals(const InterpolableValue& other) const final; - std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } - std::unique_ptr<InterpolableValue> cloneAndZero() const final { return create(0); } + PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } + PassOwnPtr<InterpolableValue> cloneAndZero() const final { return create(0); } void scale(double scale) final; void scaleAndAdd(double scale, const InterpolableValue& other) final; void set(double value) { m_value = value; } @@ -76,16 +76,16 @@ class CORE_EXPORT InterpolableBool final : public InterpolableValue { public: - static std::unique_ptr<InterpolableBool> create(bool value) + static PassOwnPtr<InterpolableBool> create(bool value) { - return wrapUnique(new InterpolableBool(value)); + return adoptPtr(new InterpolableBool(value)); } bool isBool() const final { return true; } bool value() const { return m_value; } bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); return false; } - std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } - std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } + PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } + PassOwnPtr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } void scale(double scale) final { ASSERT_NOT_REACHED(); } void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSERT_NOT_REACHED(); } @@ -110,18 +110,18 @@ // has its own copy constructor. So just delete operator= here. InterpolableList& operator=(const InterpolableList&) = delete; - static std::unique_ptr<InterpolableList> create(const InterpolableList &other) + static PassOwnPtr<InterpolableList> create(const InterpolableList &other) { - return wrapUnique(new InterpolableList(other)); + return adoptPtr(new InterpolableList(other)); } - static std::unique_ptr<InterpolableList> create(size_t size) + static PassOwnPtr<InterpolableList> create(size_t size) { - return wrapUnique(new InterpolableList(size)); + return adoptPtr(new InterpolableList(size)); } bool isList() const final { return true; } - void set(size_t position, std::unique_ptr<InterpolableValue> value) + void set(size_t position, PassOwnPtr<InterpolableValue> value) { ASSERT(position < m_size); m_values[position] = std::move(value); @@ -131,15 +131,15 @@ ASSERT(position < m_size); return m_values[position].get(); } - std::unique_ptr<InterpolableValue>& getMutable(size_t position) + OwnPtr<InterpolableValue>& getMutable(size_t position) { ASSERT(position < m_size); return m_values[position]; } size_t length() const { return m_size; } bool equals(const InterpolableValue& other) const final; - std::unique_ptr<InterpolableValue> clone() const final { return create(*this); } - std::unique_ptr<InterpolableValue> cloneAndZero() const final; + PassOwnPtr<InterpolableValue> clone() const final { return create(*this); } + PassOwnPtr<InterpolableValue> cloneAndZero() const final; void scale(double scale) final; void scaleAndAdd(double scale, const InterpolableValue& other) final; @@ -160,22 +160,22 @@ } size_t m_size; - Vector<std::unique_ptr<InterpolableValue>> m_values; + Vector<OwnPtr<InterpolableValue>> m_values; }; // FIXME: Remove this when we can. class InterpolableAnimatableValue : public InterpolableValue { public: - static std::unique_ptr<InterpolableAnimatableValue> create(PassRefPtr<AnimatableValue> value) + static PassOwnPtr<InterpolableAnimatableValue> create(PassRefPtr<AnimatableValue> value) { - return wrapUnique(new InterpolableAnimatableValue(value)); + return adoptPtr(new InterpolableAnimatableValue(value)); } bool isAnimatableValue() const final { return true; } AnimatableValue* value() const { return m_value.get(); } bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); return false; } - std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } - std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } + PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } + PassOwnPtr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } void scale(double scale) final { ASSERT_NOT_REACHED(); } void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp index 3b96588..b65d8255fc 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
@@ -7,7 +7,6 @@ #include "core/animation/Interpolation.h" #include "core/animation/PropertyHandle.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -15,7 +14,7 @@ class SampleInterpolation : public Interpolation { public: - static PassRefPtr<Interpolation> create(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) + static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) { return adoptRef(new SampleInterpolation(std::move(start), std::move(end))); } @@ -25,7 +24,7 @@ return PropertyHandle(CSSPropertyBackgroundColor); } private: - SampleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) + SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) : Interpolation(std::move(start), std::move(end)) { } @@ -59,7 +58,7 @@ base.scaleAndAdd(scale, add); } - PassRefPtr<Interpolation> interpolateLists(std::unique_ptr<InterpolableList> listA, std::unique_ptr<InterpolableList> listB, double progress) + PassRefPtr<Interpolation> interpolateLists(PassOwnPtr<InterpolableList> listA, PassOwnPtr<InterpolableList> listB, double progress) { RefPtr<Interpolation> i = SampleInterpolation::create(std::move(listA), std::move(listB)); i->interpolate(0, progress); @@ -89,12 +88,12 @@ TEST_F(AnimationInterpolableValueTest, SimpleList) { - std::unique_ptr<InterpolableList> listA = InterpolableList::create(3); + OwnPtr<InterpolableList> listA = InterpolableList::create(3); listA->set(0, InterpolableNumber::create(0)); listA->set(1, InterpolableNumber::create(42)); listA->set(2, InterpolableNumber::create(20.5)); - std::unique_ptr<InterpolableList> listB = InterpolableList::create(3); + OwnPtr<InterpolableList> listB = InterpolableList::create(3); listB->set(0, InterpolableNumber::create(100)); listB->set(1, InterpolableNumber::create(-200)); listB->set(2, InterpolableNumber::create(300)); @@ -108,16 +107,16 @@ TEST_F(AnimationInterpolableValueTest, NestedList) { - std::unique_ptr<InterpolableList> listA = InterpolableList::create(3); + OwnPtr<InterpolableList> listA = InterpolableList::create(3); listA->set(0, InterpolableNumber::create(0)); - std::unique_ptr<InterpolableList> subListA = InterpolableList::create(1); + OwnPtr<InterpolableList> subListA = InterpolableList::create(1); subListA->set(0, InterpolableNumber::create(100)); listA->set(1, std::move(subListA)); listA->set(2, InterpolableBool::create(false)); - std::unique_ptr<InterpolableList> listB = InterpolableList::create(3); + OwnPtr<InterpolableList> listB = InterpolableList::create(3); listB->set(0, InterpolableNumber::create(100)); - std::unique_ptr<InterpolableList> subListB = InterpolableList::create(1); + OwnPtr<InterpolableList> subListB = InterpolableList::create(1); subListB->set(0, InterpolableNumber::create(50)); listB->set(1, std::move(subListB)); listB->set(2, InterpolableBool::create(true)); @@ -131,7 +130,7 @@ TEST_F(AnimationInterpolableValueTest, ScaleAndAddNumbers) { - std::unique_ptr<InterpolableNumber> base = InterpolableNumber::create(10); + OwnPtr<InterpolableNumber> base = InterpolableNumber::create(10); scaleAndAdd(*base, 2, *InterpolableNumber::create(1)); EXPECT_FLOAT_EQ(21, base->value()); @@ -146,11 +145,11 @@ TEST_F(AnimationInterpolableValueTest, ScaleAndAddLists) { - std::unique_ptr<InterpolableList> baseList = InterpolableList::create(3); + OwnPtr<InterpolableList> baseList = InterpolableList::create(3); baseList->set(0, InterpolableNumber::create(5)); baseList->set(1, InterpolableNumber::create(10)); baseList->set(2, InterpolableNumber::create(15)); - std::unique_ptr<InterpolableList> addList = InterpolableList::create(3); + OwnPtr<InterpolableList> addList = InterpolableList::create(3); addList->set(0, InterpolableNumber::create(1)); addList->set(1, InterpolableNumber::create(2)); addList->set(2, InterpolableNumber::create(3));
diff --git a/third_party/WebKit/Source/core/animation/Interpolation.cpp b/third_party/WebKit/Source/core/animation/Interpolation.cpp index 87da640..2a6012c 100644 --- a/third_party/WebKit/Source/core/animation/Interpolation.cpp +++ b/third_party/WebKit/Source/core/animation/Interpolation.cpp
@@ -4,8 +4,6 @@ #include "core/animation/Interpolation.h" -#include <memory> - namespace blink { namespace { @@ -35,7 +33,7 @@ } // namespace -Interpolation::Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) +Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) : m_start(std::move(start)) , m_end(std::move(end)) , m_cachedFraction(0)
diff --git a/third_party/WebKit/Source/core/animation/Interpolation.h b/third_party/WebKit/Source/core/animation/Interpolation.h index 6131a985..e613163 100644 --- a/third_party/WebKit/Source/core/animation/Interpolation.h +++ b/third_party/WebKit/Source/core/animation/Interpolation.h
@@ -9,7 +9,6 @@ #include "core/animation/InterpolableValue.h" #include "wtf/Forward.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { @@ -31,14 +30,14 @@ virtual bool dependsOnUnderlyingValue() const { return false; } protected: - const std::unique_ptr<InterpolableValue> m_start; - const std::unique_ptr<InterpolableValue> m_end; + const OwnPtr<InterpolableValue> m_start; + const OwnPtr<InterpolableValue> m_end; mutable double m_cachedFraction; mutable int m_cachedIteration; - mutable std::unique_ptr<InterpolableValue> m_cachedValue; + mutable OwnPtr<InterpolableValue> m_cachedValue; - Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end); + Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end); private: InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.get(); }
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffect.h b/third_party/WebKit/Source/core/animation/InterpolationEffect.h index 43f3550..a99f8eb 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationEffect.h +++ b/third_party/WebKit/Source/core/animation/InterpolationEffect.h
@@ -10,6 +10,7 @@ #include "core/animation/Keyframe.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/TimingFunction.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp index 1d59730..0c4e9c4 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp
@@ -5,7 +5,6 @@ #include "core/animation/InterpolationEffect.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -13,7 +12,7 @@ class SampleInterpolation : public Interpolation { public: - static PassRefPtr<Interpolation> create(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) + static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) { return adoptRef(new SampleInterpolation(std::move(start), std::move(end))); } @@ -23,7 +22,7 @@ return PropertyHandle(CSSPropertyBackgroundColor); } private: - SampleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) + SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) : Interpolation(std::move(start), std::move(end)) { }
diff --git a/third_party/WebKit/Source/core/animation/InterpolationType.h b/third_party/WebKit/Source/core/animation/InterpolationType.h index 07f61ad..68ddba1 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationType.h +++ b/third_party/WebKit/Source/core/animation/InterpolationType.h
@@ -13,7 +13,6 @@ #include "core/animation/UnderlyingValueOwner.h" #include "platform/heap/Handle.h" #include "wtf/Allocator.h" -#include <memory> namespace blink { @@ -47,7 +46,7 @@ { } const InterpolationType* m_type; }; - using ConversionCheckers = Vector<std::unique_ptr<ConversionChecker>>; + using ConversionCheckers = Vector<OwnPtr<ConversionChecker>>; virtual PairwiseInterpolationValue maybeConvertPairwise(const PropertySpecificKeyframe& startKeyframe, const PropertySpecificKeyframe& endKeyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const {
diff --git a/third_party/WebKit/Source/core/animation/InterpolationValue.h b/third_party/WebKit/Source/core/animation/InterpolationValue.h index 10acf58c..f3d2d84 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/InterpolationValue.h
@@ -8,7 +8,6 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/NonInterpolableValue.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -17,7 +16,7 @@ struct InterpolationValue { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - explicit InterpolationValue(std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + explicit InterpolationValue(PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) : interpolableValue(std::move(interpolableValue)) , nonInterpolableValue(nonInterpolableValue) { } @@ -48,7 +47,7 @@ nonInterpolableValue.clear(); } - std::unique_ptr<InterpolableValue> interpolableValue; + OwnPtr<InterpolableValue> interpolableValue; RefPtr<NonInterpolableValue> nonInterpolableValue; };
diff --git a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp index 7f1b47cf0..816d580 100644 --- a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp +++ b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp
@@ -7,7 +7,6 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/animation/StringKeyframe.h" #include "core/css/resolver/StyleResolverState.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ // We defer the interpolation to ensureValidInterpolation() if m_cachedPairConversion is null. } -std::unique_ptr<PairwisePrimitiveInterpolation> InvalidatableInterpolation::maybeConvertPairwise(const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const +PassOwnPtr<PairwisePrimitiveInterpolation> InvalidatableInterpolation::maybeConvertPairwise(const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const { ASSERT(m_currentFraction != 0 && m_currentFraction != 1); for (const auto& interpolationType : m_interpolationTypes) { @@ -44,7 +43,7 @@ return nullptr; } -std::unique_ptr<TypedInterpolationValue> InvalidatableInterpolation::convertSingleKeyframe(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const +PassOwnPtr<TypedInterpolationValue> InvalidatableInterpolation::convertSingleKeyframe(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const { if (keyframe.isNeutral() && !underlyingValueOwner) return nullptr; @@ -69,7 +68,7 @@ } } -std::unique_ptr<TypedInterpolationValue> InvalidatableInterpolation::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const +PassOwnPtr<TypedInterpolationValue> InvalidatableInterpolation::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const { for (const auto& interpolationType : m_interpolationTypes) { InterpolationValue result = interpolationType->maybeConvertUnderlyingValue(environment); @@ -126,7 +125,7 @@ } else if (m_currentFraction == 1) { m_cachedValue = convertSingleKeyframe(*m_endKeyframe, environment, underlyingValueOwner); } else { - std::unique_ptr<PairwisePrimitiveInterpolation> pairwiseConversion = maybeConvertPairwise(environment, underlyingValueOwner); + OwnPtr<PairwisePrimitiveInterpolation> pairwiseConversion = maybeConvertPairwise(environment, underlyingValueOwner); if (pairwiseConversion) { m_cachedValue = pairwiseConversion->initialValue(); m_cachedPairConversion = std::move(pairwiseConversion);
diff --git a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h index 7292583..fd977dd 100644 --- a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h +++ b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h
@@ -10,7 +10,6 @@ #include "core/animation/PropertyInterpolationTypesMapping.h" #include "core/animation/StyleInterpolation.h" #include "core/animation/TypedInterpolationValue.h" -#include <memory> namespace blink { @@ -52,13 +51,13 @@ using ConversionCheckers = InterpolationType::ConversionCheckers; - std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const; + PassOwnPtr<TypedInterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const; const TypedInterpolationValue* ensureValidInterpolation(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; void clearCache() const; bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; bool isNeutralKeyframeActive() const; - std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; - std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&) const; + PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; + PassOwnPtr<TypedInterpolationValue> convertSingleKeyframe(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&) const; void addConversionCheckers(const InterpolationType&, ConversionCheckers&) const; void setFlagIfInheritUsed(InterpolationEnvironment&) const; double underlyingFraction() const; @@ -69,9 +68,9 @@ RefPtr<PropertySpecificKeyframe> m_endKeyframe; double m_currentFraction; mutable bool m_isCached; - mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion; + mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; mutable ConversionCheckers m_conversionCheckers; - mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue; + mutable OwnPtr<TypedInterpolationValue> m_cachedValue; }; DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInvalidatableInterpolation(), value.isInvalidatableInterpolation());
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp index 30e6198..2c483b5 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp
@@ -39,7 +39,6 @@ #include "platform/animation/AnimationUtilities.h" #include "platform/geometry/FloatBox.h" #include "platform/transforms/TransformationMatrix.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringHash.h" namespace blink { @@ -172,7 +171,7 @@ if (m_keyframeGroups) return; - m_keyframeGroups = wrapUnique(new KeyframeGroupMap); + m_keyframeGroups = adoptPtr(new KeyframeGroupMap); RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; for (const auto& keyframe : normalizedKeyframes(getFrames())) { if (keyframe->offset() == 0) @@ -182,7 +181,7 @@ KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(property); PropertySpecificKeyframeGroup* group; if (groupIter == m_keyframeGroups->end()) - group = m_keyframeGroups->add(property, wrapUnique(new PropertySpecificKeyframeGroup)).storedValue->value.get(); + group = m_keyframeGroups->add(property, adoptPtr(new PropertySpecificKeyframeGroup)).storedValue->value.get(); else group = groupIter->value.get();
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h index 28502f05..cd2d332 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h
@@ -44,7 +44,6 @@ #include "wtf/HashSet.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -84,7 +83,7 @@ return m_keyframeGroups->get(property)->keyframes(); } - using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpecificKeyframeGroup>>; + using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyframeGroup>>; const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const { ensureKeyframeGroups(); @@ -141,7 +140,7 @@ // The spec describes filtering the normalized keyframes at sampling time // to get the 'property-specific keyframes'. For efficiency, we cache the // property-specific lists. - mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups; + mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; mutable InterpolationEffect m_interpolationEffect; mutable int m_lastIteration; mutable double m_lastFraction;
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp index 00f2c28..a93c4ec 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
@@ -17,7 +17,6 @@ #include "core/dom/Document.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> namespace blink { @@ -36,7 +35,7 @@ Document& document() const { return pageHolder->document(); } - std::unique_ptr<DummyPageHolder> pageHolder; + OwnPtr<DummyPageHolder> pageHolder; Persistent<Element> element; TrackExceptionState exceptionState; };
diff --git a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h index cf7f0241..3307373 100644 --- a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h +++ b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h
@@ -7,7 +7,6 @@ #include "core/animation/StyleInterpolation.h" #include "core/css/resolver/AnimatedStyleBuilder.h" -#include <memory> namespace blink { @@ -30,7 +29,7 @@ } private: - LegacyStyleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, CSSPropertyID id) + LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) : StyleInterpolation(std::move(start), std::move(end), id) { }
diff --git a/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h b/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h index 67fbe70..65570c4 100644 --- a/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h +++ b/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h
@@ -8,14 +8,12 @@ #include "core/animation/InterpolationType.h" #include "core/css/CSSPrimitiveValue.h" #include "core/css/resolver/StyleResolverState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class LengthUnitsChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& lengthArray, const StyleResolverState& state) + static PassOwnPtr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& lengthArray, const StyleResolverState& state) { bool create = false; size_t lastIndex = 0; @@ -28,7 +26,7 @@ } if (!create) return nullptr; - return wrapUnique(new LengthUnitsChecker(std::move(lengthArray), lastIndex)); + return adoptPtr(new LengthUnitsChecker(std::move(lengthArray), lastIndex)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp index 20566719..32c42ff 100644 --- a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp
@@ -7,7 +7,6 @@ #include "core/animation/UnderlyingValueOwner.h" #include "core/css/CSSValueList.h" #include "wtf/MathExtras.h" -#include <memory> namespace blink { @@ -54,7 +53,7 @@ } if (startLength == 0) { - std::unique_ptr<InterpolableValue> startInterpolableValue = end.interpolableValue->cloneAndZero(); + OwnPtr<InterpolableValue> startInterpolableValue = end.interpolableValue->cloneAndZero(); return PairwiseInterpolationValue( std::move(startInterpolableValue), std::move(end.interpolableValue), @@ -62,7 +61,7 @@ } if (endLength == 0) { - std::unique_ptr<InterpolableValue> endInterpolableValue = start.interpolableValue->cloneAndZero(); + OwnPtr<InterpolableValue> endInterpolableValue = start.interpolableValue->cloneAndZero(); return PairwiseInterpolationValue( std::move(start.interpolableValue), std::move(endInterpolableValue), @@ -70,8 +69,8 @@ } size_t finalLength = lowestCommonMultiple(startLength, endLength); - std::unique_ptr<InterpolableList> resultStartInterpolableList = InterpolableList::create(finalLength); - std::unique_ptr<InterpolableList> resultEndInterpolableList = InterpolableList::create(finalLength); + OwnPtr<InterpolableList> resultStartInterpolableList = InterpolableList::create(finalLength); + OwnPtr<InterpolableList> resultEndInterpolableList = InterpolableList::create(finalLength); Vector<RefPtr<NonInterpolableValue>> resultNonInterpolableValues(finalLength); InterpolableList& startInterpolableList = toInterpolableList(*start.interpolableValue); @@ -105,7 +104,7 @@ if (currentLength == length) return; ASSERT(currentLength < length); - std::unique_ptr<InterpolableList> newInterpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> newInterpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> newNonInterpolableValues(length); for (size_t i = length; i-- > 0;) { newInterpolableList->set(i, i < currentLength ? std::move(interpolableList.getMutable(i)) : interpolableList.get(i % currentLength)->clone());
diff --git a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h index 57764dc..b80dd09f 100644 --- a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h
@@ -8,7 +8,6 @@ #include "core/animation/InterpolationValue.h" #include "core/animation/PairwiseInterpolationValue.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -29,7 +28,7 @@ static bool equalValues(const InterpolationValue&, const InterpolationValue&, EqualNonInterpolableValuesCallback); using NonInterpolableValuesAreCompatibleCallback = bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); - using CompositeItemCallback = void (*)(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + using CompositeItemCallback = void (*)(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationType&, const InterpolationValue&, NonInterpolableValuesAreCompatibleCallback, CompositeItemCallback); }; @@ -70,7 +69,7 @@ { if (length == 0) return createEmptyList(); - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue item = createItem(i);
diff --git a/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h b/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h index bc63e054..6f1d96c2 100644 --- a/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h
@@ -8,7 +8,6 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/NonInterpolableValue.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -16,7 +15,7 @@ struct PairwiseInterpolationValue { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - PairwiseInterpolationValue(std::unique_ptr<InterpolableValue> startInterpolableValue, std::unique_ptr<InterpolableValue> endInterpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + PairwiseInterpolationValue(PassOwnPtr<InterpolableValue> startInterpolableValue, PassOwnPtr<InterpolableValue> endInterpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) : startInterpolableValue(std::move(startInterpolableValue)) , endInterpolableValue(std::move(endInterpolableValue)) , nonInterpolableValue(std::move(nonInterpolableValue)) @@ -32,8 +31,8 @@ operator bool() const { return startInterpolableValue.get(); } - std::unique_ptr<InterpolableValue> startInterpolableValue; - std::unique_ptr<InterpolableValue> endInterpolableValue; + OwnPtr<InterpolableValue> startInterpolableValue; + OwnPtr<InterpolableValue> endInterpolableValue; RefPtr<NonInterpolableValue> nonInterpolableValue; };
diff --git a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp index 206964f2..c69d7ec 100644 --- a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp
@@ -12,8 +12,6 @@ #include "core/svg/SVGPathByteStreamBuilder.h" #include "core/svg/SVGPathByteStreamSource.h" #include "core/svg/SVGPathParser.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -53,7 +51,7 @@ SVGPathByteStreamSource pathSource(byteStream); size_t length = 0; PathCoordinates currentCoordinates; - Vector<std::unique_ptr<InterpolableValue>> interpolablePathSegs; + Vector<OwnPtr<InterpolableValue>> interpolablePathSegs; Vector<SVGPathSegType> pathSegTypes; while (pathSource.hasMoreData()) { @@ -63,11 +61,11 @@ length++; } - std::unique_ptr<InterpolableList> pathArgs = InterpolableList::create(length); + OwnPtr<InterpolableList> pathArgs = InterpolableList::create(length); for (size_t i = 0; i < interpolablePathSegs.size(); i++) pathArgs->set(i, std::move(interpolablePathSegs[i])); - std::unique_ptr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); result->set(PathArgsIndex, std::move(pathArgs)); result->set(PathNeutralIndex, InterpolableNumber::create(0)); @@ -79,7 +77,7 @@ if (stylePath) return convertValue(stylePath->byteStream()); - std::unique_ptr<SVGPathByteStream> emptyPath = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> emptyPath = SVGPathByteStream::create(); return convertValue(*emptyPath); } @@ -87,9 +85,9 @@ public: ~UnderlyingPathSegTypesChecker() final {} - static std::unique_ptr<UnderlyingPathSegTypesChecker> create(const InterpolationValue& underlying) + static PassOwnPtr<UnderlyingPathSegTypesChecker> create(const InterpolationValue& underlying) { - return wrapUnique(new UnderlyingPathSegTypesChecker(getPathSegTypes(underlying))); + return adoptPtr(new UnderlyingPathSegTypesChecker(getPathSegTypes(underlying))); } private: @@ -113,7 +111,7 @@ InterpolationValue PathInterpolationFunctions::maybeConvertNeutral(const InterpolationValue& underlying, InterpolationType::ConversionCheckers& conversionCheckers) { conversionCheckers.append(UnderlyingPathSegTypesChecker::create(underlying)); - std::unique_ptr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); result->set(PathArgsIndex, toInterpolableList(*underlying.interpolableValue).get(PathArgsIndex)->cloneAndZero()); result->set(PathNeutralIndex, InterpolableNumber::create(1)); return InterpolationValue(std::move(result), underlying.nonInterpolableValue.get()); @@ -159,9 +157,9 @@ underlyingValueOwner.mutableValue().nonInterpolableValue = value.nonInterpolableValue.get(); } -std::unique_ptr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) +PassOwnPtr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) { - std::unique_ptr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); InterpolatedSVGPathSource source( toInterpolableList(*toInterpolableList(interpolableValue).get(PathArgsIndex)), toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes());
diff --git a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h index 662e13104..188aeb4 100644 --- a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h
@@ -7,7 +7,6 @@ #include "core/animation/InterpolationType.h" #include "core/svg/SVGPathByteStream.h" -#include <memory> namespace blink { @@ -15,7 +14,7 @@ class PathInterpolationFunctions { public: - static std::unique_ptr<SVGPathByteStream> appliedValue(const InterpolableValue&, const NonInterpolableValue*); + static PassOwnPtr<SVGPathByteStream> appliedValue(const InterpolableValue&, const NonInterpolableValue*); static void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationType&, const InterpolationValue&);
diff --git a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h index 5a74b4be..cc07984 100644 --- a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h +++ b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h
@@ -8,10 +8,8 @@ #include "core/animation/TypedInterpolationValue.h" #include "platform/animation/AnimationUtilities.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include <cmath> -#include <memory> namespace blink { @@ -25,7 +23,7 @@ public: virtual ~PrimitiveInterpolation() { } - virtual void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const = 0; + virtual void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const = 0; virtual double interpolateUnderlyingFraction(double start, double end, double fraction) const = 0; virtual bool isFlip() const { return false; } @@ -38,20 +36,20 @@ public: ~PairwisePrimitiveInterpolation() override { } - static std::unique_ptr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + static PassOwnPtr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) { - return wrapUnique(new PairwisePrimitiveInterpolation(type, std::move(start), std::move(end), nonInterpolableValue)); + return adoptPtr(new PairwisePrimitiveInterpolation(type, std::move(start), std::move(end), nonInterpolableValue)); } const InterpolationType& type() const { return m_type; } - std::unique_ptr<TypedInterpolationValue> initialValue() const + PassOwnPtr<TypedInterpolationValue> initialValue() const { return TypedInterpolationValue::create(m_type, m_start->clone(), m_nonInterpolableValue); } private: - PairwisePrimitiveInterpolation(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + PairwisePrimitiveInterpolation(const InterpolationType& type, PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) : m_type(type) , m_start(std::move(start)) , m_end(std::move(end)) @@ -61,7 +59,7 @@ ASSERT(m_end); } - void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final + void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const final { ASSERT(result); ASSERT(&result->type() == &m_type); @@ -72,8 +70,8 @@ double interpolateUnderlyingFraction(double start, double end, double fraction) const final { return blend(start, end, fraction); } const InterpolationType& m_type; - std::unique_ptr<InterpolableValue> m_start; - std::unique_ptr<InterpolableValue> m_end; + OwnPtr<InterpolableValue> m_start; + OwnPtr<InterpolableValue> m_end; RefPtr<NonInterpolableValue> m_nonInterpolableValue; }; @@ -82,19 +80,19 @@ public: ~FlipPrimitiveInterpolation() override { } - static std::unique_ptr<FlipPrimitiveInterpolation> create(std::unique_ptr<TypedInterpolationValue> start, std::unique_ptr<TypedInterpolationValue> end) + static PassOwnPtr<FlipPrimitiveInterpolation> create(PassOwnPtr<TypedInterpolationValue> start, PassOwnPtr<TypedInterpolationValue> end) { - return wrapUnique(new FlipPrimitiveInterpolation(std::move(start), std::move(end))); + return adoptPtr(new FlipPrimitiveInterpolation(std::move(start), std::move(end))); } private: - FlipPrimitiveInterpolation(std::unique_ptr<TypedInterpolationValue> start, std::unique_ptr<TypedInterpolationValue> end) + FlipPrimitiveInterpolation(PassOwnPtr<TypedInterpolationValue> start, PassOwnPtr<TypedInterpolationValue> end) : m_start(std::move(start)) , m_end(std::move(end)) , m_lastFraction(std::numeric_limits<double>::quiet_NaN()) { } - void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final + void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const final { // TODO(alancutter): Remove this optimisation once Oilpan is default. if (!std::isnan(m_lastFraction) && (fraction < 0.5) == (m_lastFraction < 0.5)) @@ -108,8 +106,8 @@ bool isFlip() const final { return true; } - std::unique_ptr<TypedInterpolationValue> m_start; - std::unique_ptr<TypedInterpolationValue> m_end; + OwnPtr<TypedInterpolationValue> m_start; + OwnPtr<TypedInterpolationValue> m_end; mutable double m_lastFraction; };
diff --git a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp index 7071a27c..2e830b0 100644 --- a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp +++ b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp
@@ -48,20 +48,18 @@ #include "core/animation/SVGRectInterpolationType.h" #include "core/animation/SVGTransformListInterpolationType.h" #include "core/animation/SVGValueInterpolationType.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { const InterpolationTypes& PropertyInterpolationTypesMapping::get(const PropertyHandle& property) { - using ApplicableTypesMap = HashMap<PropertyHandle, std::unique_ptr<const InterpolationTypes>>; + using ApplicableTypesMap = HashMap<PropertyHandle, OwnPtr<const InterpolationTypes>>; DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); auto entry = applicableTypesMap.find(property); if (entry != applicableTypesMap.end()) return *entry->value.get(); - std::unique_ptr<InterpolationTypes> applicableTypes = wrapUnique(new InterpolationTypes()); + OwnPtr<InterpolationTypes> applicableTypes = adoptPtr(new InterpolationTypes()); if (property.isCSSProperty() || property.isPresentationAttribute()) { CSSPropertyID cssProperty = property.isCSSProperty() ? property.cssProperty() : property.presentationAttribute(); @@ -117,7 +115,7 @@ case CSSPropertyWordSpacing: case CSSPropertyX: case CSSPropertyY: - applicableTypes->append(wrapUnique(new CSSLengthInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSLengthInterpolationType(cssProperty))); break; case CSSPropertyFlexGrow: case CSSPropertyFlexShrink: @@ -133,11 +131,11 @@ case CSSPropertyColumnCount: case CSSPropertyWidows: case CSSPropertyZIndex: - applicableTypes->append(wrapUnique(new CSSNumberInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSNumberInterpolationType(cssProperty))); break; case CSSPropertyLineHeight: - applicableTypes->append(wrapUnique(new CSSLengthInterpolationType(cssProperty))); - applicableTypes->append(wrapUnique(new CSSNumberInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSLengthInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSNumberInterpolationType(cssProperty))); break; case CSSPropertyBackgroundColor: case CSSPropertyBorderBottomColor: @@ -152,118 +150,118 @@ case CSSPropertyTextDecorationColor: case CSSPropertyColumnRuleColor: case CSSPropertyWebkitTextStrokeColor: - applicableTypes->append(wrapUnique(new CSSColorInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSColorInterpolationType(cssProperty))); break; case CSSPropertyFill: case CSSPropertyStroke: - applicableTypes->append(wrapUnique(new CSSPaintInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSPaintInterpolationType(cssProperty))); break; case CSSPropertyD: - applicableTypes->append(wrapUnique(new CSSPathInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSPathInterpolationType(cssProperty))); break; case CSSPropertyBoxShadow: case CSSPropertyTextShadow: - applicableTypes->append(wrapUnique(new CSSShadowListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSShadowListInterpolationType(cssProperty))); break; case CSSPropertyBorderImageSource: case CSSPropertyListStyleImage: case CSSPropertyWebkitMaskBoxImageSource: - applicableTypes->append(wrapUnique(new CSSImageInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSImageInterpolationType(cssProperty))); break; case CSSPropertyBackgroundImage: case CSSPropertyWebkitMaskImage: - applicableTypes->append(wrapUnique(new CSSImageListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSImageListInterpolationType(cssProperty))); break; case CSSPropertyStrokeDasharray: - applicableTypes->append(wrapUnique(new CSSLengthListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSLengthListInterpolationType(cssProperty))); break; case CSSPropertyFontWeight: - applicableTypes->append(wrapUnique(new CSSFontWeightInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSFontWeightInterpolationType(cssProperty))); break; case CSSPropertyVisibility: - applicableTypes->append(wrapUnique(new CSSVisibilityInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSVisibilityInterpolationType(cssProperty))); break; case CSSPropertyClip: - applicableTypes->append(wrapUnique(new CSSClipInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSClipInterpolationType(cssProperty))); break; case CSSPropertyMotionRotation: - applicableTypes->append(wrapUnique(new CSSMotionRotationInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSMotionRotationInterpolationType(cssProperty))); break; case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: case CSSPropertyWebkitMaskPositionX: case CSSPropertyWebkitMaskPositionY: - applicableTypes->append(wrapUnique(new CSSPositionAxisListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSPositionAxisListInterpolationType(cssProperty))); break; case CSSPropertyPerspectiveOrigin: case CSSPropertyObjectPosition: - applicableTypes->append(wrapUnique(new CSSPositionInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSPositionInterpolationType(cssProperty))); break; case CSSPropertyBorderBottomLeftRadius: case CSSPropertyBorderBottomRightRadius: case CSSPropertyBorderTopLeftRadius: case CSSPropertyBorderTopRightRadius: - applicableTypes->append(wrapUnique(new CSSLengthPairInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSLengthPairInterpolationType(cssProperty))); break; case CSSPropertyTranslate: - applicableTypes->append(wrapUnique(new CSSTranslateInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSTranslateInterpolationType(cssProperty))); break; case CSSPropertyTransformOrigin: - applicableTypes->append(wrapUnique(new CSSTransformOriginInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSTransformOriginInterpolationType(cssProperty))); break; case CSSPropertyBackgroundSize: case CSSPropertyWebkitMaskSize: - applicableTypes->append(wrapUnique(new CSSSizeListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSSizeListInterpolationType(cssProperty))); break; case CSSPropertyBorderImageOutset: case CSSPropertyBorderImageWidth: case CSSPropertyWebkitMaskBoxImageOutset: case CSSPropertyWebkitMaskBoxImageWidth: - applicableTypes->append(wrapUnique(new CSSBorderImageLengthBoxInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSBorderImageLengthBoxInterpolationType(cssProperty))); break; case CSSPropertyScale: - applicableTypes->append(wrapUnique(new CSSScaleInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSScaleInterpolationType(cssProperty))); break; case CSSPropertyFontSize: - applicableTypes->append(wrapUnique(new CSSFontSizeInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSFontSizeInterpolationType(cssProperty))); break; case CSSPropertyTextIndent: - applicableTypes->append(wrapUnique(new CSSTextIndentInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSTextIndentInterpolationType(cssProperty))); break; case CSSPropertyBorderImageSlice: case CSSPropertyWebkitMaskBoxImageSlice: - applicableTypes->append(wrapUnique(new CSSImageSliceInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSImageSliceInterpolationType(cssProperty))); break; case CSSPropertyWebkitClipPath: case CSSPropertyShapeOutside: - applicableTypes->append(wrapUnique(new CSSBasicShapeInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSBasicShapeInterpolationType(cssProperty))); break; case CSSPropertyRotate: - applicableTypes->append(wrapUnique(new CSSRotateInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSRotateInterpolationType(cssProperty))); break; case CSSPropertyBackdropFilter: case CSSPropertyWebkitFilter: - applicableTypes->append(wrapUnique(new CSSFilterListInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSFilterListInterpolationType(cssProperty))); break; case CSSPropertyTransform: - applicableTypes->append(wrapUnique(new CSSTransformInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSTransformInterpolationType(cssProperty))); break; default: ASSERT(!CSSPropertyMetadata::isInterpolableProperty(cssProperty)); } - applicableTypes->append(wrapUnique(new CSSValueInterpolationType(cssProperty))); + applicableTypes->append(adoptPtr(new CSSValueInterpolationType(cssProperty))); } else { const QualifiedName& attribute = property.svgAttribute(); if (attribute == SVGNames::orientAttr) { - applicableTypes->append(wrapUnique(new SVGAngleInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGAngleInterpolationType(attribute))); } else if (attribute == SVGNames::numOctavesAttr || attribute == SVGNames::targetXAttr || attribute == SVGNames::targetYAttr) { - applicableTypes->append(wrapUnique(new SVGIntegerInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGIntegerInterpolationType(attribute))); } else if (attribute == SVGNames::orderAttr) { - applicableTypes->append(wrapUnique(new SVGIntegerOptionalIntegerInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGIntegerOptionalIntegerInterpolationType(attribute))); } else if (attribute == SVGNames::cxAttr || attribute == SVGNames::cyAttr || attribute == SVGNames::fxAttr @@ -283,15 +281,15 @@ || attribute == SVGNames::x2Attr || attribute == SVGNames::y1Attr || attribute == SVGNames::y2Attr) { - applicableTypes->append(wrapUnique(new SVGLengthInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attribute))); } else if (attribute == SVGNames::dxAttr || attribute == SVGNames::dyAttr) { - applicableTypes->append(wrapUnique(new SVGNumberInterpolationType(attribute))); - applicableTypes->append(wrapUnique(new SVGLengthListInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGNumberInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType(attribute))); } else if (attribute == SVGNames::xAttr || attribute == SVGNames::yAttr) { - applicableTypes->append(wrapUnique(new SVGLengthInterpolationType(attribute))); - applicableTypes->append(wrapUnique(new SVGLengthListInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType(attribute))); } else if (attribute == SVGNames::amplitudeAttr || attribute == SVGNames::azimuthAttr || attribute == SVGNames::biasAttr @@ -317,27 +315,27 @@ || attribute == SVGNames::specularExponentAttr || attribute == SVGNames::surfaceScaleAttr || attribute == SVGNames::zAttr) { - applicableTypes->append(wrapUnique(new SVGNumberInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGNumberInterpolationType(attribute))); } else if (attribute == SVGNames::kernelMatrixAttr || attribute == SVGNames::rotateAttr || attribute == SVGNames::tableValuesAttr || attribute == SVGNames::valuesAttr) { - applicableTypes->append(wrapUnique(new SVGNumberListInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGNumberListInterpolationType(attribute))); } else if (attribute == SVGNames::baseFrequencyAttr || attribute == SVGNames::kernelUnitLengthAttr || attribute == SVGNames::radiusAttr || attribute == SVGNames::stdDeviationAttr) { - applicableTypes->append(wrapUnique(new SVGNumberOptionalNumberInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGNumberOptionalNumberInterpolationType(attribute))); } else if (attribute == SVGNames::dAttr) { - applicableTypes->append(wrapUnique(new SVGPathInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGPathInterpolationType(attribute))); } else if (attribute == SVGNames::pointsAttr) { - applicableTypes->append(wrapUnique(new SVGPointListInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGPointListInterpolationType(attribute))); } else if (attribute == SVGNames::viewBoxAttr) { - applicableTypes->append(wrapUnique(new SVGRectInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGRectInterpolationType(attribute))); } else if (attribute == SVGNames::gradientTransformAttr || attribute == SVGNames::patternTransformAttr || attribute == SVGNames::transformAttr) { - applicableTypes->append(wrapUnique(new SVGTransformListInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGTransformListInterpolationType(attribute))); } else if (attribute == HTMLNames::classAttr || attribute == SVGNames::clipPathUnitsAttr || attribute == SVGNames::edgeModeAttr @@ -371,7 +369,7 @@ ASSERT_NOT_REACHED(); } - applicableTypes->append(wrapUnique(new SVGValueInterpolationType(attribute))); + applicableTypes->append(adoptPtr(new SVGValueInterpolationType(attribute))); } auto addResult = applicableTypesMap.add(property, std::move(applicableTypes));
diff --git a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h index 7e2736d..cd3d6cf2 100644 --- a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h +++ b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h
@@ -6,14 +6,13 @@ #define PropertyInterpolationTypesMapping_h #include "wtf/Vector.h" -#include <memory> namespace blink { class InterpolationType; class PropertyHandle; -using InterpolationTypes = Vector<std::unique_ptr<const InterpolationType>>; +using InterpolationTypes = Vector<OwnPtr<const InterpolationType>>; namespace PropertyInterpolationTypesMapping {
diff --git a/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp index f48cd4d..e67c712 100644 --- a/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp
@@ -6,13 +6,12 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/svg/SVGIntegerOptionalInteger.h" -#include <memory> namespace blink { InterpolationValue SVGIntegerOptionalIntegerInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(0)); result->set(1, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -24,7 +23,7 @@ return nullptr; const SVGIntegerOptionalInteger& integerOptionalInteger = toSVGIntegerOptionalInteger(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(integerOptionalInteger.firstInteger()->value())); result->set(1, InterpolableNumber::create(integerOptionalInteger.secondInteger()->value())); return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp index 74131a55..275bc83 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
@@ -10,7 +10,6 @@ #include "core/svg/SVGElement.h" #include "core/svg/SVGLength.h" #include "core/svg/SVGLengthContext.h" -#include <memory> namespace blink { @@ -76,9 +75,9 @@ } // namespace -std::unique_ptr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() +PassOwnPtr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() { - std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); + OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(0)); @@ -93,7 +92,7 @@ double values[numLengthInterpolatedUnits] = { }; values[unitType] = value; - std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); + OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(values[i]));
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h index 783d150..2890bcad 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h
@@ -7,7 +7,6 @@ #include "core/animation/SVGInterpolationType.h" #include "core/svg/SVGLength.h" -#include <memory> namespace blink { @@ -22,7 +21,7 @@ , m_negativeValuesForbidden(SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(attribute)) { } - static std::unique_ptr<InterpolableValue> neutralInterpolableValue(); + static PassOwnPtr<InterpolableValue> neutralInterpolableValue(); static InterpolationValue convertSVGLength(const SVGLength&); static SVGLength* resolveInterpolableSVGLength(const InterpolableValue&, const SVGLengthContext&, SVGLengthMode, bool negativeValuesForbidden);
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp index 8685a8d..e70381b 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp
@@ -8,7 +8,6 @@ #include "core/animation/SVGLengthInterpolationType.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGLengthList.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ if (underlyingLength == 0) return nullptr; - std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); + OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, SVGLengthInterpolationType::neutralInterpolableValue()); return InterpolationValue(std::move(result)); @@ -32,7 +31,7 @@ return nullptr; const SVGLengthList& lengthList = toSVGLengthList(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(lengthList.length()); + OwnPtr<InterpolableList> result = InterpolableList::create(lengthList.length()); for (size_t i = 0; i < lengthList.length(); i++) { InterpolationValue component = SVGLengthInterpolationType::convertSVGLength(*lengthList.at(i)); result->set(i, std::move(component.interpolableValue));
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp index c3f26cf..4eaa1e74 100644 --- a/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp
@@ -7,7 +7,6 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGNumberList.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ if (underlyingLength == 0) return nullptr; - std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); + OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -31,7 +30,7 @@ return nullptr; const SVGNumberList& numberList = toSVGNumberList(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(numberList.length()); + OwnPtr<InterpolableList> result = InterpolableList::create(numberList.length()); for (size_t i = 0; i < numberList.length(); i++) result->set(i, InterpolableNumber::create(numberList.at(i)->value())); return InterpolationValue(std::move(result)); @@ -46,14 +45,14 @@ return InterpolationType::maybeMergeSingles(std::move(start), std::move(end)); } -static void padWithZeroes(std::unique_ptr<InterpolableValue>& listPointer, size_t paddedLength) +static void padWithZeroes(OwnPtr<InterpolableValue>& listPointer, size_t paddedLength) { InterpolableList& list = toInterpolableList(*listPointer); if (list.length() >= paddedLength) return; - std::unique_ptr<InterpolableList> result = InterpolableList::create(paddedLength); + OwnPtr<InterpolableList> result = InterpolableList::create(paddedLength); size_t i = 0; for (; i < list.length(); i++) result->set(i, std::move(list.getMutable(i)));
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp index 2413ec3d..b4fcff91 100644 --- a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
@@ -6,13 +6,12 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/svg/SVGNumberOptionalNumber.h" -#include <memory> namespace blink { InterpolationValue SVGNumberOptionalNumberInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(0)); result->set(1, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -24,7 +23,7 @@ return nullptr; const SVGNumberOptionalNumber& numberOptionalNumber = toSVGNumberOptionalNumber(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(numberOptionalNumber.firstNumber()->value())); result->set(1, InterpolableNumber::create(numberOptionalNumber.secondNumber()->value())); return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp index 2242b51..f317954 100644 --- a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp
@@ -4,12 +4,10 @@ #include "core/animation/SVGPathSegInterpolationFunctions.h" -#include <memory> - namespace blink { -std::unique_ptr<InterpolableNumber> consumeControlAxis(double value, bool isAbsolute, double currentValue) +PassOwnPtr<InterpolableNumber> consumeControlAxis(double value, bool isAbsolute, double currentValue) { return InterpolableNumber::create(isAbsolute ? value : currentValue + value); } @@ -20,7 +18,7 @@ return isAbsolute ? value : value - currentValue; } -std::unique_ptr<InterpolableNumber> consumeCoordinateAxis(double value, bool isAbsolute, double& currentValue) +PassOwnPtr<InterpolableNumber> consumeCoordinateAxis(double value, bool isAbsolute, double& currentValue) { if (isAbsolute) currentValue = value; @@ -36,7 +34,7 @@ return isAbsolute ? currentValue : currentValue - previousValue; } -std::unique_ptr<InterpolableValue> consumeClosePath(const PathSegmentData&, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeClosePath(const PathSegmentData&, PathCoordinates& coordinates) { coordinates.currentX = coordinates.initialX; coordinates.currentY = coordinates.initialY; @@ -53,10 +51,10 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeSingleCoordinate(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeSingleCoordinate(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); result->set(1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); @@ -87,10 +85,10 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeCurvetoCubic(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeCurvetoCubic(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - std::unique_ptr<InterpolableList> result = InterpolableList::create(6); + OwnPtr<InterpolableList> result = InterpolableList::create(6); result->set(0, consumeControlAxis(segment.x1(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y1(), isAbsolute, coordinates.currentY)); result->set(2, consumeControlAxis(segment.x2(), isAbsolute, coordinates.currentX)); @@ -115,10 +113,10 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeCurvetoQuadratic(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeCurvetoQuadratic(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - std::unique_ptr<InterpolableList> result = InterpolableList::create(4); + OwnPtr<InterpolableList> result = InterpolableList::create(4); result->set(0, consumeControlAxis(segment.x1(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y1(), isAbsolute, coordinates.currentY)); result->set(2, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); @@ -139,10 +137,10 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeArc(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeArc(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - std::unique_ptr<InterpolableList> result = InterpolableList::create(7); + OwnPtr<InterpolableList> result = InterpolableList::create(7); result->set(0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); result->set(1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); result->set(2, InterpolableNumber::create(segment.r1())); @@ -169,7 +167,7 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeLinetoHorizontal(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeLinetoHorizontal(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); return consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX); @@ -184,7 +182,7 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeLinetoVertical(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeLinetoVertical(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); return consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY); @@ -199,10 +197,10 @@ return segment; } -std::unique_ptr<InterpolableValue> consumeCurvetoCubicSmooth(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> consumeCurvetoCubicSmooth(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - std::unique_ptr<InterpolableList> result = InterpolableList::create(4); + OwnPtr<InterpolableList> result = InterpolableList::create(4); result->set(0, consumeControlAxis(segment.x2(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y2(), isAbsolute, coordinates.currentY)); result->set(2, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); @@ -223,7 +221,7 @@ return segment; } -std::unique_ptr<InterpolableValue> SVGPathSegInterpolationFunctions::consumePathSeg(const PathSegmentData& segment, PathCoordinates& coordinates) +PassOwnPtr<InterpolableValue> SVGPathSegInterpolationFunctions::consumePathSeg(const PathSegmentData& segment, PathCoordinates& coordinates) { switch (segment.command) { case PathSegClosePath:
diff --git a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h index 776ccbe6..bc6f0de 100644 --- a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h
@@ -7,7 +7,6 @@ #include "core/animation/InterpolableValue.h" #include "core/svg/SVGPathData.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ class SVGPathSegInterpolationFunctions { STATIC_ONLY(SVGPathSegInterpolationFunctions); public: - static std::unique_ptr<InterpolableValue> consumePathSeg(const PathSegmentData&, PathCoordinates& currentCoordinates); + static PassOwnPtr<InterpolableValue> consumePathSeg(const PathSegmentData&, PathCoordinates& currentCoordinates); static PathSegmentData consumeInterpolablePathSeg(const InterpolableValue&, SVGPathSegType, PathCoordinates& currentCoordinates); };
diff --git a/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp index 13934d0..534cd47 100644 --- a/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp
@@ -8,7 +8,6 @@ #include "core/animation/StringKeyframe.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGPointList.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ if (underlyingLength == 0) return nullptr; - std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); + OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -32,7 +31,7 @@ return nullptr; const SVGPointList& pointList = toSVGPointList(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(pointList.length() * 2); + OwnPtr<InterpolableList> result = InterpolableList::create(pointList.length() * 2); for (size_t i = 0; i < pointList.length(); i++) { const SVGPoint& point = *pointList.at(i); result->set(2 * i, InterpolableNumber::create(point.x()));
diff --git a/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp index 9eca8ae..76ae445 100644 --- a/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp
@@ -7,7 +7,6 @@ #include "core/animation/StringKeyframe.h" #include "core/svg/SVGRect.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ InterpolationValue SVGRectInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - std::unique_ptr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); for (size_t i = 0; i < RectComponentIndexCount; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -33,7 +32,7 @@ return nullptr; const SVGRect& rect = toSVGRect(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); + OwnPtr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); result->set(RectX, InterpolableNumber::create(rect.x())); result->set(RectY, InterpolableNumber::create(rect.y())); result->set(RectWidth, InterpolableNumber::create(rect.width()));
diff --git a/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp index e0ce0ed54..fd392aa 100644 --- a/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp
@@ -10,8 +10,6 @@ #include "core/animation/StringKeyframe.h" #include "core/svg/SVGTransform.h" #include "core/svg/SVGTransformList.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -42,10 +40,10 @@ namespace { -std::unique_ptr<InterpolableValue> translateToInterpolableValue(SVGTransform* transform) +PassOwnPtr<InterpolableValue> translateToInterpolableValue(SVGTransform* transform) { FloatPoint translate = transform->translate(); - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(translate.x())); result->set(1, InterpolableNumber::create(translate.y())); return std::move(result); @@ -62,10 +60,10 @@ return transform; } -std::unique_ptr<InterpolableValue> scaleToInterpolableValue(SVGTransform* transform) +PassOwnPtr<InterpolableValue> scaleToInterpolableValue(SVGTransform* transform) { FloatSize scale = transform->scale(); - std::unique_ptr<InterpolableList> result = InterpolableList::create(2); + OwnPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(scale.width())); result->set(1, InterpolableNumber::create(scale.height())); return std::move(result); @@ -82,10 +80,10 @@ return transform; } -std::unique_ptr<InterpolableValue> rotateToInterpolableValue(SVGTransform* transform) +PassOwnPtr<InterpolableValue> rotateToInterpolableValue(SVGTransform* transform) { FloatPoint rotationCenter = transform->rotationCenter(); - std::unique_ptr<InterpolableList> result = InterpolableList::create(3); + OwnPtr<InterpolableList> result = InterpolableList::create(3); result->set(0, InterpolableNumber::create(transform->angle())); result->set(1, InterpolableNumber::create(rotationCenter.x())); result->set(2, InterpolableNumber::create(rotationCenter.y())); @@ -104,7 +102,7 @@ return transform; } -std::unique_ptr<InterpolableValue> skewXToInterpolableValue(SVGTransform* transform) +PassOwnPtr<InterpolableValue> skewXToInterpolableValue(SVGTransform* transform) { return InterpolableNumber::create(transform->angle()); } @@ -116,7 +114,7 @@ return transform; } -std::unique_ptr<InterpolableValue> skewYToInterpolableValue(SVGTransform* transform) +PassOwnPtr<InterpolableValue> skewYToInterpolableValue(SVGTransform* transform) { return InterpolableNumber::create(transform->angle()); } @@ -128,7 +126,7 @@ return transform; } -std::unique_ptr<InterpolableValue> toInterpolableValue(SVGTransform* transform, SVGTransformType transformType) +PassOwnPtr<InterpolableValue> toInterpolableValue(SVGTransform* transform, SVGTransformType transformType) { switch (transformType) { case SVG_TRANSFORM_TRANSLATE: @@ -184,9 +182,9 @@ class SVGTransformListChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<SVGTransformListChecker> create(const InterpolationValue& underlying) + static PassOwnPtr<SVGTransformListChecker> create(const InterpolationValue& underlying) { - return wrapUnique(new SVGTransformListChecker(underlying)); + return adoptPtr(new SVGTransformListChecker(underlying)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -216,7 +214,7 @@ return nullptr; const SVGTransformList& svgList = toSVGTransformList(svgValue); - std::unique_ptr<InterpolableList> result = InterpolableList::create(svgList.length()); + OwnPtr<InterpolableList> result = InterpolableList::create(svgList.length()); Vector<SVGTransformType> transformTypes; for (size_t i = 0; i < svgList.length(); i++) { @@ -235,7 +233,7 @@ InterpolationValue SVGTransformListInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { Vector<SVGTransformType> types; - Vector<std::unique_ptr<InterpolableValue>> interpolableParts; + Vector<OwnPtr<InterpolableValue>> interpolableParts; if (keyframe.composite() == EffectModel::CompositeAdd) { if (underlying) { @@ -256,7 +254,7 @@ interpolableParts.append(std::move(value.interpolableValue)); } - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(types.size()); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(types.size()); size_t interpolableListIndex = 0; for (auto& part : interpolableParts) { InterpolableList& list = toInterpolableList(*part);
diff --git a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp index cf7c772..697f1bda 100644 --- a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp
@@ -12,7 +12,6 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowData.h" #include "platform/geometry/FloatPoint.h" -#include <memory> namespace blink { @@ -63,7 +62,7 @@ InterpolationValue ShadowInterpolationFunctions::convertShadowData(const ShadowData& shadowData, double zoom) { - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); interpolableList->set(ShadowX, CSSLengthInterpolationType::createInterpolablePixels(shadowData.x() / zoom)); interpolableList->set(ShadowY, CSSLengthInterpolationType::createInterpolablePixels(shadowData.y() / zoom)); interpolableList->set(ShadowBlur, CSSLengthInterpolationType::createInterpolablePixels(shadowData.blur() / zoom)); @@ -86,7 +85,7 @@ return nullptr; } - std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); + OwnPtr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); static_assert(ShadowX == 0, "Enum ordering check."); static_assert(ShadowY == 1, "Enum ordering check."); static_assert(ShadowBlur == 2, "Enum ordering check."); @@ -110,7 +109,7 @@ } if (shadow.color) { - std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(*shadow.color); + OwnPtr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(*shadow.color); if (!interpolableColor) return nullptr; interpolableList->set(ShadowColor, std::move(interpolableColor)); @@ -121,12 +120,12 @@ return InterpolationValue(std::move(interpolableList), ShadowNonInterpolableValue::create(style)); } -std::unique_ptr<InterpolableValue> ShadowInterpolationFunctions::createNeutralInterpolableValue() +PassOwnPtr<InterpolableValue> ShadowInterpolationFunctions::createNeutralInterpolableValue() { return convertShadowData(ShadowData(FloatPoint(0, 0), 0, 0, Normal, StyleColor(Color::transparent)), 1).interpolableValue; } -void ShadowInterpolationFunctions::composite(std::unique_ptr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) +void ShadowInterpolationFunctions::composite(OwnPtr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) { ASSERT(nonInterpolableValuesAreCompatible(underlyingNonInterpolableValue.get(), nonInterpolableValue)); InterpolableList& underlyingInterpolableList = toInterpolableList(*underlyingInterpolableValue);
diff --git a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h index 56e72167..584aa2a0 100644 --- a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h
@@ -7,7 +7,6 @@ #include "core/animation/InterpolationValue.h" #include "core/animation/PairwiseInterpolationValue.h" -#include <memory> namespace blink { @@ -19,10 +18,10 @@ public: static InterpolationValue convertShadowData(const ShadowData&, double zoom); static InterpolationValue maybeConvertCSSValue(const CSSValue&); - static std::unique_ptr<InterpolableValue> createNeutralInterpolableValue(); + static PassOwnPtr<InterpolableValue> createNeutralInterpolableValue(); static bool nonInterpolableValuesAreCompatible(const NonInterpolableValue*, const NonInterpolableValue*); static PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end); - static void composite(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + static void composite(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static ShadowData createShadowData(const InterpolableValue&, const NonInterpolableValue*, const StyleResolverState&); };
diff --git a/third_party/WebKit/Source/core/animation/StyleInterpolation.h b/third_party/WebKit/Source/core/animation/StyleInterpolation.h index 3317039..74b67746 100644 --- a/third_party/WebKit/Source/core/animation/StyleInterpolation.h +++ b/third_party/WebKit/Source/core/animation/StyleInterpolation.h
@@ -9,7 +9,6 @@ #include "core/CoreExport.h" #include "core/animation/Interpolation.h" #include "core/animation/PropertyHandle.h" -#include <memory> namespace blink { @@ -48,7 +47,7 @@ protected: CSSPropertyID m_id; - StyleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, CSSPropertyID id) + StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) : Interpolation(std::move(start), std::move(end)) , m_id(id) {
diff --git a/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h b/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h index 28dd675a..993ddf9d 100644 --- a/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h
@@ -6,8 +6,6 @@ #define TypedInterpolationValue_h #include "core/animation/InterpolationValue.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -16,12 +14,12 @@ // Represents an interpolated value between an adjacent pair of PropertySpecificKeyframes. class TypedInterpolationValue { public: - static std::unique_ptr<TypedInterpolationValue> create(const InterpolationType& type, std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + static PassOwnPtr<TypedInterpolationValue> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) { - return wrapUnique(new TypedInterpolationValue(type, std::move(interpolableValue), nonInterpolableValue)); + return adoptPtr(new TypedInterpolationValue(type, std::move(interpolableValue), nonInterpolableValue)); } - std::unique_ptr<TypedInterpolationValue> clone() const + PassOwnPtr<TypedInterpolationValue> clone() const { InterpolationValue copy = m_value.clone(); return create(m_type, std::move(copy.interpolableValue), copy.nonInterpolableValue.release()); @@ -35,7 +33,7 @@ InterpolationValue& mutableValue() { return m_value; } private: - TypedInterpolationValue(const InterpolationType& type, std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + TypedInterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue) : m_type(type) , m_value(std::move(interpolableValue), nonInterpolableValue) {
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h b/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h index 12870d52..78ef68b 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h +++ b/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h
@@ -7,16 +7,14 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/InterpolationType.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class UnderlyingLengthChecker : public InterpolationType::ConversionChecker { public: - static std::unique_ptr<UnderlyingLengthChecker> create(size_t underlyingLength) + static PassOwnPtr<UnderlyingLengthChecker> create(size_t underlyingLength) { - return wrapUnique(new UnderlyingLengthChecker(underlyingLength)); + return adoptPtr(new UnderlyingLengthChecker(underlyingLength)); } static size_t getUnderlyingLength(const InterpolationValue& underlying)
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp index f109581..68a7a91 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp +++ b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp
@@ -4,8 +4,6 @@ #include "core/animation/UnderlyingValueOwner.h" -#include <memory> - namespace blink { struct NullValueWrapper { @@ -44,7 +42,7 @@ m_value = &m_valueOwner; } -void UnderlyingValueOwner::set(std::unique_ptr<TypedInterpolationValue> value) +void UnderlyingValueOwner::set(PassOwnPtr<TypedInterpolationValue> value) { if (value) set(value->type(), std::move(value->mutableValue()));
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h index ddd115e..5644eb8a 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h +++ b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h
@@ -8,13 +8,12 @@ #include "core/animation/TypedInterpolationValue.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { // Handles memory management of underlying InterpolationValues in applyStack() // Ensures we perform copy on write if we are not the owner of an underlying InterpolationValue. -// This functions similar to a DataRef except on std::unique_ptr'd objects. +// This functions similar to a DataRef except on OwnPtr'd objects. class UnderlyingValueOwner { WTF_MAKE_NONCOPYABLE(UnderlyingValueOwner); STACK_ALLOCATED(); @@ -43,7 +42,7 @@ void set(std::nullptr_t); void set(const InterpolationType&, const InterpolationValue&); void set(const InterpolationType&, InterpolationValue&&); - void set(std::unique_ptr<TypedInterpolationValue>); + void set(PassOwnPtr<TypedInterpolationValue>); void set(const TypedInterpolationValue*); InterpolationValue& mutableValue();
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp index 872acf3..deb2889 100644 --- a/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp +++ b/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp
@@ -8,7 +8,6 @@ #include "core/svg/SVGPathBlender.h" #include "core/svg/SVGPathByteStreamBuilder.h" #include "core/svg/SVGPathByteStreamSource.h" -#include <memory> namespace blink { @@ -44,7 +43,7 @@ if (usesDefaultInterpolationWith(value)) return defaultInterpolateTo(this, value, fraction); - std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*byteStream); SVGPathByteStreamSource fromSource(path()->byteStream());
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h index 9396d38..c1dceb5 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h
@@ -8,21 +8,19 @@ #include "core/animation/Timing.h" #include "core/animation/css/CSSTimingData.h" #include "core/style/ComputedStyleConstants.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class CSSAnimationData final : public CSSTimingData { public: - static std::unique_ptr<CSSAnimationData> create() + static PassOwnPtr<CSSAnimationData> create() { - return wrapUnique(new CSSAnimationData); + return adoptPtr(new CSSAnimationData); } - static std::unique_ptr<CSSAnimationData> create(const CSSAnimationData& animationData) + static PassOwnPtr<CSSAnimationData> create(const CSSAnimationData& animationData) { - return wrapUnique(new CSSAnimationData(animationData)); + return adoptPtr(new CSSAnimationData(animationData)); } bool animationsMatchForStyleRecalc(const CSSAnimationData& other) const;
diff --git a/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h b/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h index 261eb7a..0e00f35 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h +++ b/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h
@@ -7,9 +7,7 @@ #include "core/CSSPropertyNames.h" #include "core/animation/css/CSSTimingData.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -52,14 +50,14 @@ String propertyString; }; - static std::unique_ptr<CSSTransitionData> create() + static PassOwnPtr<CSSTransitionData> create() { - return wrapUnique(new CSSTransitionData); + return adoptPtr(new CSSTransitionData); } - static std::unique_ptr<CSSTransitionData> create(const CSSTransitionData& transitionData) + static PassOwnPtr<CSSTransitionData> create(const CSSTransitionData& transitionData) { - return wrapUnique(new CSSTransitionData(transitionData)); + return adoptPtr(new CSSTransitionData(transitionData)); } bool transitionsMatchForStyleRecalc(const CSSTransitionData& other) const;
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp index 4beaad3..c31ff3a 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -43,7 +43,6 @@ #include "platform/MIMETypeRegistry.h" #include "platform/clipboard/ClipboardMimeTypes.h" #include "platform/clipboard/ClipboardUtilities.h" -#include <memory> namespace blink { @@ -244,7 +243,7 @@ setDragImage(0, node, loc); } -std::unique_ptr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* frame) const +PassOwnPtr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* frame) const { if (m_dragImageElement) { loc = m_dragLoc;
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.h b/third_party/WebKit/Source/core/clipboard/DataTransfer.h index cf06853..99e53aa 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.h +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.h
@@ -32,7 +32,6 @@ #include "platform/geometry/IntPoint.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -84,7 +83,7 @@ void setDragImageResource(ImageResource*, const IntPoint&); void setDragImageElement(Node*, const IntPoint&); - std::unique_ptr<DragImage> createDragImage(IntPoint& dragLocation, LocalFrame*) const; + PassOwnPtr<DragImage> createDragImage(IntPoint& dragLocation, LocalFrame*) const; void declareAndWriteDragImage(Element*, const KURL&, const String& title); void writeURL(Node*, const KURL&, const String&); void writeSelection(const FrameSelection&);
diff --git a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp index ed3fa292..635465b74 100644 --- a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp +++ b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp
@@ -12,7 +12,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -35,7 +34,7 @@ void checkElements(ElementResult expected[], unsigned expectedCount) const; private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h b/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h index e2e064a..2bc8565 100644 --- a/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h +++ b/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h
@@ -6,7 +6,7 @@ #define BinaryDataFontFaceSource_h #include "core/css/CSSFontFaceSource.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -22,7 +22,7 @@ private: PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; - std::unique_ptr<FontCustomPlatformData> m_customPlatformData; + OwnPtr<FontCustomPlatformData> m_customPlatformData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp index ffbff60..b1de7219 100644 --- a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp
@@ -33,6 +33,7 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolver.h" #include "wtf/MathExtras.h" +#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" static const int maxExpressionDepth = 100;
diff --git a/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp b/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp index de4d0c27..f8105054 100644 --- a/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp +++ b/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp
@@ -31,7 +31,6 @@ #include "core/css/parser/CSSParser.h" #include "core/frame/UseCounter.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -75,7 +74,7 @@ int StyleRuleKeyframes::findKeyframeIndex(const String& key) const { - std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key); + OwnPtr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key); if (!keys) return -1; for (size_t i = m_keyframes.size(); i--; ) {
diff --git a/third_party/WebKit/Source/core/css/CSSMatrix.h b/third_party/WebKit/Source/core/css/CSSMatrix.h index f43eb5c2..7adb5835 100644 --- a/third_party/WebKit/Source/core/css/CSSMatrix.h +++ b/third_party/WebKit/Source/core/css/CSSMatrix.h
@@ -29,7 +29,6 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -153,10 +152,10 @@ CSSMatrix(const String&, ExceptionState&); // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr + // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - std::unique_ptr<TransformationMatrix> m_matrix; + OwnPtr<TransformationMatrix> m_matrix; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/CSSPathValue.cpp b/third_party/WebKit/Source/core/css/CSSPathValue.cpp index 2cb4e3a..ff88f62 100644 --- a/third_party/WebKit/Source/core/css/CSSPathValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSPathValue.cpp
@@ -6,7 +6,6 @@ #include "core/style/StylePath.h" #include "core/svg/SVGPathUtilities.h" -#include <memory> namespace blink { @@ -15,7 +14,7 @@ return new CSSPathValue(stylePath); } -CSSPathValue* CSSPathValue::create(std::unique_ptr<SVGPathByteStream> pathByteStream) +CSSPathValue* CSSPathValue::create(PassOwnPtr<SVGPathByteStream> pathByteStream) { return CSSPathValue::create(StylePath::create(std::move(pathByteStream))); } @@ -31,7 +30,7 @@ CSSPathValue* createPathValue() { - std::unique_ptr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); // Need to be registered as LSan ignored, as it will be reachable and // separately referred to by emptyPathValue() callers. LEAK_SANITIZER_IGNORE_OBJECT(pathByteStream.get());
diff --git a/third_party/WebKit/Source/core/css/CSSPathValue.h b/third_party/WebKit/Source/core/css/CSSPathValue.h index 0d9a1f06..99e3e799 100644 --- a/third_party/WebKit/Source/core/css/CSSPathValue.h +++ b/third_party/WebKit/Source/core/css/CSSPathValue.h
@@ -10,7 +10,6 @@ #include "core/svg/SVGPathByteStream.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ class CSSPathValue : public CSSValue { public: static CSSPathValue* create(PassRefPtr<StylePath>); - static CSSPathValue* create(std::unique_ptr<SVGPathByteStream>); + static CSSPathValue* create(PassOwnPtr<SVGPathByteStream>); static CSSPathValue& emptyPathValue();
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.cpp b/third_party/WebKit/Source/core/css/CSSSelector.cpp index 3a40cb6d..9662a27 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelector.cpp
@@ -34,7 +34,6 @@ #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" #include <algorithm> -#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -767,7 +766,7 @@ m_data.m_rareData->m_argument = value; } -void CSSSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList) +void CSSSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList) { createRareData(); m_data.m_rareData->m_selectorList = std::move(selectorList);
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.h b/third_party/WebKit/Source/core/css/CSSSelector.h index 766005b..65dab52 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.h +++ b/third_party/WebKit/Source/core/css/CSSSelector.h
@@ -25,8 +25,9 @@ #include "core/CoreExport.h" #include "core/dom/QualifiedName.h" #include "core/style/ComputedStyleConstants.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { class CSSSelectorList; @@ -251,7 +252,7 @@ void setValue(const AtomicString&, bool matchLowerCase); void setAttribute(const QualifiedName&, AttributeMatchType); void setArgument(const AtomicString&); - void setSelectorList(std::unique_ptr<CSSSelectorList>); + void setSelectorList(PassOwnPtr<CSSSelectorList>); void setNth(int a, int b); bool matchNth(int count) const; @@ -337,7 +338,7 @@ } m_bits; QualifiedName m_attribute; // used for attribute selector AtomicString m_argument; // Used for :contains, :lang, :nth-* - std::unique_ptr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not + OwnPtr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not private: RareData(const AtomicString& value);
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorList.cpp b/third_party/WebKit/Source/core/css/CSSSelectorList.cpp index 01544222..541104d 100644 --- a/third_party/WebKit/Source/core/css/CSSSelectorList.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelectorList.cpp
@@ -29,7 +29,6 @@ #include "core/css/parser/CSSParserSelector.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace { // CSSSelector is one of the top types that consume renderer memory, @@ -53,7 +52,7 @@ return list; } -CSSSelectorList CSSSelectorList::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector) +CSSSelectorList CSSSelectorList::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector) { size_t flattenedSize = 0; for (size_t i = 0; i < selectorVector.size(); ++i) { @@ -69,7 +68,7 @@ CSSParserSelector* current = selectorVector[i].get(); while (current) { // Move item from the parser selector vector into m_selectorArray without invoking destructor (Ugh.) - CSSSelector* currentSelector = current->releaseSelector().release(); + CSSSelector* currentSelector = current->releaseSelector().leakPtr(); memcpy(&list.m_selectorArray[arrayIndex], currentSelector, sizeof(CSSSelector)); WTF::Partitions::fastFree(currentSelector);
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorList.h b/third_party/WebKit/Source/core/css/CSSSelectorList.h index 534ef70..c0edf57f 100644 --- a/third_party/WebKit/Source/core/css/CSSSelectorList.h +++ b/third_party/WebKit/Source/core/css/CSSSelectorList.h
@@ -28,7 +28,6 @@ #include "core/CoreExport.h" #include "core/css/CSSSelector.h" -#include <memory> namespace blink { @@ -58,7 +57,7 @@ deleteSelectorsIfNeeded(); } - static CSSSelectorList adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector); + static CSSSelectorList adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector); CSSSelectorList copy() const; bool isValid() const { return !!m_selectorArray; }
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp index 0cb68c1..d78d6625 100644 --- a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp +++ b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
@@ -31,10 +31,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -59,7 +57,7 @@ Document* document() { return &m_page->document(); } Persistent<MemoryCache> m_originalMemoryCache; - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(CSSStyleSheetResourceTest, PruneCanCauseEviction) @@ -85,8 +83,8 @@ CSSImageValue::create(String("image"), imageURL), CSSImageValue::create(String("image"), imageURL), CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number)); - Vector<std::unique_ptr<CSSParserSelector>> selectors; - selectors.append(wrapUnique(new CSSParserSelector())); + Vector<OwnPtr<CSSParserSelector>> selectors; + selectors.append(adoptPtr(new CSSParserSelector())); selectors[0]->setMatch(CSSSelector::Id); selectors[0]->setValue("foo"); CSSProperty property(CSSPropertyBackground, *crossfade);
diff --git a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp index 14bced50..0e53520 100644 --- a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp +++ b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
@@ -10,7 +10,6 @@ #include "core/layout/LayoutObject.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ // Check that when dragging the div in the document below, you only get a // single element style recalc. - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag { background-color: green }</style>" "<div>" @@ -45,7 +44,7 @@ // Check that when dragging the div in the document below, you get a // single element style recalc. - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag .drag { background-color: green }</style>" "<div>" @@ -71,7 +70,7 @@ // Check that when dragging the div in the document below, you get a // single element style recalc. - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag + .drag { background-color: green }</style>" "<div>"
diff --git a/third_party/WebKit/Source/core/css/MediaList.cpp b/third_party/WebKit/Source/core/css/MediaList.cpp index cfa531b..7892ee2 100644 --- a/third_party/WebKit/Source/core/css/MediaList.cpp +++ b/third_party/WebKit/Source/core/css/MediaList.cpp
@@ -25,7 +25,6 @@ #include "core/css/MediaQueryExp.h" #include "core/css/parser/MediaQueryParser.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -160,7 +159,7 @@ DEFINE_TRACE(MediaQuerySet) { - // We don't support tracing of vectors of OwnPtrs (ie. std::unique_ptr<Vector<std::unique_ptr<MediaQuery>>>). + // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<MediaQuery>>>). // Since this is a transitional object we are just ifdef'ing it out when oilpan is not enabled. visitor->trace(m_queries); }
diff --git a/third_party/WebKit/Source/core/css/MediaQuery.cpp b/third_party/WebKit/Source/core/css/MediaQuery.cpp index 6ba95d1..f440b1c 100644 --- a/third_party/WebKit/Source/core/css/MediaQuery.cpp +++ b/third_party/WebKit/Source/core/css/MediaQuery.cpp
@@ -33,7 +33,6 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "wtf/NonCopyingSort.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -135,7 +134,7 @@ DEFINE_TRACE(MediaQuery) { - // We don't support tracing of vectors of OwnPtrs (ie. std::unique_ptr<Vector<std::unique_ptr<MediaQuery>>>). + // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<MediaQuery>>>). // Since this is a transitional object we are just ifdef'ing it out when oilpan is not enabled. visitor->trace(m_expressions); }
diff --git a/third_party/WebKit/Source/core/css/MediaQuery.h b/third_party/WebKit/Source/core/css/MediaQuery.h index c2202388..18719e7 100644 --- a/third_party/WebKit/Source/core/css/MediaQuery.h +++ b/third_party/WebKit/Source/core/css/MediaQuery.h
@@ -31,6 +31,7 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp index 16382b1..2c8b1b2 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
@@ -10,8 +10,8 @@ #include "core/frame/FrameView.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -174,7 +174,7 @@ TEST(MediaQueryEvaluatorTest, Dynamic) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); pageHolder->frameView().setMediaType(MediaTypeNames::screen); MediaQueryEvaluator mediaQueryEvaluator(&pageHolder->frame()); @@ -185,7 +185,7 @@ TEST(MediaQueryEvaluatorTest, DynamicNoView) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); LocalFrame* frame = &pageHolder->frame(); pageHolder.reset(); ASSERT_EQ(nullptr, frame->view());
diff --git a/third_party/WebKit/Source/core/css/MediaQueryExp.h b/third_party/WebKit/Source/core/css/MediaQueryExp.h index 91b0fd3..266a3eb 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryExp.h +++ b/third_party/WebKit/Source/core/css/MediaQueryExp.h
@@ -35,6 +35,7 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValue.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp index 14f8b1f..b201c81 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp
@@ -8,13 +8,12 @@ #include "core/css/MediaList.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(MediaQueryMatcherTest, LostFrame) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); MediaQueryMatcher* matcher = MediaQueryMatcher::create(pageHolder->document()); MediaQuerySet* querySet = MediaQuerySet::create(MediaTypeNames::all); ASSERT_TRUE(matcher->evaluate(querySet));
diff --git a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp index 76dd83b..5ac3543 100644 --- a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp
@@ -6,6 +6,7 @@ #include "core/css/MediaList.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h index 7016c24..14c2f4f 100644 --- a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h +++ b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -28,6 +28,7 @@ #include "core/css/CSSStyleDeclaration.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/SelectorFilter.cpp b/third_party/WebKit/Source/core/css/SelectorFilter.cpp index deb464e4..73107df 100644 --- a/third_party/WebKit/Source/core/css/SelectorFilter.cpp +++ b/third_party/WebKit/Source/core/css/SelectorFilter.cpp
@@ -30,7 +30,6 @@ #include "core/css/CSSSelector.h" #include "core/dom/Document.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -87,7 +86,7 @@ if (m_parentStack.isEmpty()) { ASSERT(parent == parent.document().documentElement()); ASSERT(!m_ancestorIdentifierFilter); - m_ancestorIdentifierFilter = wrapUnique(new IdentifierFilter); + m_ancestorIdentifierFilter = adoptPtr(new IdentifierFilter); pushParentStackFrame(parent); return; }
diff --git a/third_party/WebKit/Source/core/css/SelectorFilter.h b/third_party/WebKit/Source/core/css/SelectorFilter.h index 6119434b..91adbfd 100644 --- a/third_party/WebKit/Source/core/css/SelectorFilter.h +++ b/third_party/WebKit/Source/core/css/SelectorFilter.h
@@ -32,7 +32,6 @@ #include "core/dom/Element.h" #include "wtf/BloomFilter.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -75,7 +74,7 @@ // With 100 unique strings in the filter, 2^12 slot table has false positive rate of ~0.2%. using IdentifierFilter = BloomFilter<12>; - std::unique_ptr<IdentifierFilter> m_ancestorIdentifierFilter; + OwnPtr<IdentifierFilter> m_ancestorIdentifierFilter; }; template <unsigned maximumIdentifierCount>
diff --git a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp index 77423a3ad..db237ad 100644 --- a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp +++ b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
@@ -7,11 +7,10 @@ #include "core/css/StylePropertySet.h" #include "core/css/parser/CSSParser.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { -StyleRuleKeyframe::StyleRuleKeyframe(std::unique_ptr<Vector<double>> keys, StylePropertySet* properties) +StyleRuleKeyframe::StyleRuleKeyframe(PassOwnPtr<Vector<double>> keys, StylePropertySet* properties) : StyleRuleBase(Keyframe) , m_properties(properties) , m_keys(*keys) @@ -37,7 +36,7 @@ { ASSERT(!keyText.isNull()); - std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(keyText); + OwnPtr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(keyText); if (!keys || keys->isEmpty()) return false;
diff --git a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h index 34cb9ac..8d5c3cb 100644 --- a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h +++ b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h
@@ -6,7 +6,6 @@ #define StyleRuleKeyframe_h #include "core/css/StyleRule.h" -#include <memory> namespace blink { @@ -15,7 +14,7 @@ class StyleRuleKeyframe final : public StyleRuleBase { public: - static StyleRuleKeyframe* create(std::unique_ptr<Vector<double>> keys, StylePropertySet* properties) + static StyleRuleKeyframe* create(PassOwnPtr<Vector<double>> keys, StylePropertySet* properties) { return new StyleRuleKeyframe(std::move(keys), properties); } @@ -35,7 +34,7 @@ DECLARE_TRACE_AFTER_DISPATCH(); private: - StyleRuleKeyframe(std::unique_ptr<Vector<double>>, StylePropertySet*); + StyleRuleKeyframe(PassOwnPtr<Vector<double>>, StylePropertySet*); Member<StylePropertySet> m_properties; Vector<double> m_keys;
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp index ac63595..4de332a5 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp
@@ -7,7 +7,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "wtf/MathExtras.h" #include <cmath> -#include <memory> namespace blink { @@ -33,7 +32,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::perspective(double length) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); if (length != 0) matrix->setM34(-1 / length); return new CSSMatrixTransformComponent(std::move(matrix), PerspectiveType); @@ -41,21 +40,21 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::rotate(double angle) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->rotate(angle); return new CSSMatrixTransformComponent(std::move(matrix), RotationType); } CSSMatrixTransformComponent* CSSMatrixTransformComponent::rotate3d(double angle, double x, double y, double z) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->rotate3d(x, y, z, angle); return new CSSMatrixTransformComponent(std::move(matrix), Rotation3DType); } CSSMatrixTransformComponent* CSSMatrixTransformComponent::scale(double x, double y) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM11(x); matrix->setM22(y); return new CSSMatrixTransformComponent(std::move(matrix), ScaleType); @@ -63,7 +62,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::scale3d(double x, double y, double z) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM11(x); matrix->setM22(y); matrix->setM33(z); @@ -75,7 +74,7 @@ double tanAx = std::tan(deg2rad(ax)); double tanAy = std::tan(deg2rad(ay)); - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM12(tanAy); matrix->setM21(tanAx); return new CSSMatrixTransformComponent(std::move(matrix), SkewType); @@ -83,7 +82,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::translate(double x, double y) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM41(x); matrix->setM42(y); return new CSSMatrixTransformComponent(std::move(matrix), TranslationType); @@ -91,7 +90,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::translate3d(double x, double y, double z) { - std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); + OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM41(x); matrix->setM42(y); matrix->setM43(z);
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h index d0c5e80..fcc05ab 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h
@@ -7,7 +7,6 @@ #include "core/css/cssom/TransformComponent.h" #include "platform/transforms/TransformationMatrix.h" -#include <memory> namespace blink { @@ -92,17 +91,17 @@ , m_is2D(false) { } - CSSMatrixTransformComponent(std::unique_ptr<const TransformationMatrix> matrix, TransformComponentType fromType) + CSSMatrixTransformComponent(PassOwnPtr<const TransformationMatrix> matrix, TransformComponentType fromType) : TransformComponent() , m_matrix(std::move(matrix)) , m_is2D(is2DComponentType(fromType)) { } // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr + // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - std::unique_ptr<const TransformationMatrix> m_matrix; + OwnPtr<const TransformationMatrix> m_matrix; bool m_is2D; };
diff --git a/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp b/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp index a6d9269..042b125 100644 --- a/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp +++ b/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp
@@ -9,7 +9,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -24,7 +23,7 @@ CSSComputedStyleDeclaration* declaration() const { return m_declaration.get(); } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; Persistent<CSSComputedStyleDeclaration> m_declaration; };
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp index a035222..925ad85 100644 --- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp +++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp
@@ -35,9 +35,7 @@ #include "core/inspector/InspectorTraceEvents.h" #include "platform/TracedValue.h" #include "wtf/Compiler.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -170,28 +168,28 @@ HashSet<AtomicString>& InvalidationSet::ensureClassSet() { if (!m_classes) - m_classes = wrapUnique(new HashSet<AtomicString>); + m_classes = adoptPtr(new HashSet<AtomicString>); return *m_classes; } HashSet<AtomicString>& InvalidationSet::ensureIdSet() { if (!m_ids) - m_ids = wrapUnique(new HashSet<AtomicString>); + m_ids = adoptPtr(new HashSet<AtomicString>); return *m_ids; } HashSet<AtomicString>& InvalidationSet::ensureTagNameSet() { if (!m_tagNames) - m_tagNames = wrapUnique(new HashSet<AtomicString>); + m_tagNames = adoptPtr(new HashSet<AtomicString>); return *m_tagNames; } HashSet<AtomicString>& InvalidationSet::ensureAttributeSet() { if (!m_attributes) - m_attributes = wrapUnique(new HashSet<AtomicString>); + m_attributes = adoptPtr(new HashSet<AtomicString>); return *m_attributes; } @@ -290,7 +288,7 @@ #ifndef NDEBUG void InvalidationSet::show() const { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->beginArray("InvalidationSet"); toTracedValue(value.get()); value->endArray();
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h index 61932a2..35f8a42 100644 --- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h +++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h
@@ -40,7 +40,6 @@ #include "wtf/RefPtr.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -147,10 +146,10 @@ HashSet<AtomicString>& ensureAttributeSet(); // FIXME: optimize this if it becomes a memory issue. - std::unique_ptr<HashSet<AtomicString>> m_classes; - std::unique_ptr<HashSet<AtomicString>> m_ids; - std::unique_ptr<HashSet<AtomicString>> m_tagNames; - std::unique_ptr<HashSet<AtomicString>> m_attributes; + OwnPtr<HashSet<AtomicString>> m_classes; + OwnPtr<HashSet<AtomicString>> m_ids; + OwnPtr<HashSet<AtomicString>> m_tagNames; + OwnPtr<HashSet<AtomicString>> m_attributes; unsigned m_type : 1;
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp index b5d291e..a6a9e97 100644 --- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp +++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -14,7 +14,6 @@ #include "core/html/HTMLSlotElement.h" #include "core/inspector/InspectorTraceEvents.h" #include "core/layout/LayoutObject.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -101,7 +100,7 @@ { PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&element, nullptr); if (addResult.isNewEntry) - addResult.storedValue->value = wrapUnique(new PendingInvalidations()); + addResult.storedValue->value = adoptPtr(new PendingInvalidations()); return *addResult.storedValue->value; }
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h index 4ce06cb..1123158 100644 --- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h +++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h
@@ -8,7 +8,6 @@ #include "core/css/invalidation/PendingInvalidations.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -129,7 +128,7 @@ RecursionData* m_data; }; - using PendingInvalidationMap = HeapHashMap<Member<Element>, std::unique_ptr<PendingInvalidations>>; + using PendingInvalidationMap = HeapHashMap<Member<Element>, OwnPtr<PendingInvalidations>>; PendingInvalidations& ensurePendingInvalidations(Element&);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp index fd94660..a8061e5 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
@@ -18,7 +18,6 @@ #include "core/css/parser/CSSTokenizer.h" #include "core/css/parser/CSSVariableParser.h" #include "core/layout/LayoutTheme.h" -#include <memory> namespace blink { @@ -115,7 +114,7 @@ return CSSParserImpl::parseInlineStyleDeclaration(styleString, element); } -std::unique_ptr<Vector<double>> CSSParser::parseKeyframeKeyList(const String& keyList) +PassOwnPtr<Vector<double>> CSSParser::parseKeyframeKeyList(const String& keyList) { return CSSParserImpl::parseKeyframeKeyList(keyList); }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.h b/third_party/WebKit/Source/core/css/parser/CSSParser.h index 706dd562..341a2d58 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParser.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParser.h
@@ -10,7 +10,6 @@ #include "core/css/CSSValue.h" #include "core/css/parser/CSSParserMode.h" #include "platform/graphics/Color.h" -#include <memory> namespace blink { @@ -48,7 +47,7 @@ static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, Element*); - static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); + static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); static StyleRuleKeyframe* parseKeyframeRule(const CSSParserContext&, const String&); static bool parseSupportsCondition(const String&);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp index afe156f..f9c9e8d 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
@@ -28,9 +28,7 @@ #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" #include "platform/TraceEvent.h" -#include "wtf/PtrUtil.h" #include <bitset> -#include <memory> namespace blink { @@ -206,7 +204,7 @@ if (!range.atEnd()) return CSSSelectorList(); // Parse error; extra tokens in @page selector - std::unique_ptr<CSSParserSelector> selector; + OwnPtr<CSSParserSelector> selector; if (!typeSelector.isNull() && pseudo.isNull()) { selector = CSSParserSelector::create(QualifiedName(nullAtom, typeSelector, styleSheet->defaultNamespace())); } else { @@ -223,7 +221,7 @@ } selector->setForPage(); - Vector<std::unique_ptr<CSSParserSelector>> selectorVector; + Vector<OwnPtr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(selector)); CSSSelectorList selectorList = CSSSelectorList::adoptSelectorVector(selectorVector); return selectorList; @@ -251,7 +249,7 @@ return createStylePropertySet(parser.m_parsedProperties, HTMLStandardMode); } -std::unique_ptr<Vector<double>> CSSParserImpl::parseKeyframeKeyList(const String& keyList) +PassOwnPtr<Vector<double>> CSSParserImpl::parseKeyframeKeyList(const String& keyList) { return consumeKeyframeKeyList(CSSTokenizer::Scope(keyList).tokenRange()); } @@ -648,7 +646,7 @@ StyleRuleKeyframe* CSSParserImpl::consumeKeyframeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange block) { - std::unique_ptr<Vector<double>> keyList = consumeKeyframeKeyList(prelude); + OwnPtr<Vector<double>> keyList = consumeKeyframeKeyList(prelude); if (!keyList) return nullptr; @@ -805,9 +803,9 @@ CSSPropertyParser::parseValue(unresolvedProperty, important, range, m_context, m_parsedProperties, ruleType); } -std::unique_ptr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenRange range) +PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenRange range) { - std::unique_ptr<Vector<double>> result = wrapUnique(new Vector<double>); + OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); while (true) { range.consumeWhitespace(); const CSSParserToken& token = range.consumeIncludingWhitespace();
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h index 0bcd515..3d8fbea 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h
@@ -13,7 +13,6 @@ #include "platform/heap/Handle.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -67,7 +66,7 @@ static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); - static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); + static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); bool supportsDeclaration(CSSParserTokenRange&); @@ -109,7 +108,7 @@ void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRule::RuleType); void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyName, bool important); - static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange); + static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange); // FIXME: Can we build StylePropertySets directly? // FIXME: Investigate using a smaller inline buffer
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp index 93b8731..f3263ea 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp
@@ -21,18 +21,16 @@ #include "core/css/parser/CSSParserSelector.h" #include "core/css/CSSSelectorList.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { CSSParserSelector::CSSParserSelector() - : m_selector(wrapUnique(new CSSSelector())) + : m_selector(adoptPtr(new CSSSelector())) { } CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName, bool isImplicit) - : m_selector(wrapUnique(new CSSSelector(tagQName, isImplicit))) + : m_selector(adoptPtr(new CSSSelector(tagQName, isImplicit))) { } @@ -40,10 +38,10 @@ { if (!m_tagHistory) return; - Vector<std::unique_ptr<CSSParserSelector>, 16> toDelete; - std::unique_ptr<CSSParserSelector> selector = std::move(m_tagHistory); + Vector<OwnPtr<CSSParserSelector>, 16> toDelete; + OwnPtr<CSSParserSelector> selector = std::move(m_tagHistory); while (true) { - std::unique_ptr<CSSParserSelector> next = std::move(selector->m_tagHistory); + OwnPtr<CSSParserSelector> next = std::move(selector->m_tagHistory); toDelete.append(std::move(selector)); if (!next) break; @@ -51,13 +49,13 @@ } } -void CSSParserSelector::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector) +void CSSParserSelector::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector) { CSSSelectorList* selectorList = new CSSSelectorList(CSSSelectorList::adoptSelectorVector(selectorVector)); - m_selector->setSelectorList(wrapUnique(selectorList)); + m_selector->setSelectorList(adoptPtr(selectorList)); } -void CSSParserSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList) +void CSSParserSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList) { m_selector->setSelectorList(std::move(selectorList)); } @@ -82,7 +80,7 @@ return false; } -void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, std::unique_ptr<CSSParserSelector> selector) +void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, PassOwnPtr<CSSParserSelector> selector) { CSSParserSelector* end = this; while (end->tagHistory()) @@ -91,7 +89,7 @@ end->setTagHistory(std::move(selector)); } -std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory() +PassOwnPtr<CSSParserSelector> CSSParserSelector::releaseTagHistory() { setRelation(CSSSelector::SubSelector); return std::move(m_tagHistory); @@ -99,11 +97,11 @@ void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool isImplicit) { - std::unique_ptr<CSSParserSelector> second = CSSParserSelector::create(); + OwnPtr<CSSParserSelector> second = CSSParserSelector::create(); second->m_selector = std::move(m_selector); second->m_tagHistory = std::move(m_tagHistory); m_tagHistory = std::move(second); - m_selector = wrapUnique(new CSSSelector(tagQName, isImplicit)); + m_selector = adoptPtr(new CSSSelector(tagQName, isImplicit)); } bool CSSParserSelector::isHostPseudoSelector() const
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h index 1d3cf2e..8be43de 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h
@@ -23,8 +23,6 @@ #include "core/CoreExport.h" #include "core/css/CSSSelector.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -34,12 +32,12 @@ CSSParserSelector(); explicit CSSParserSelector(const QualifiedName&, bool isImplicit = false); - static std::unique_ptr<CSSParserSelector> create() { return wrapUnique(new CSSParserSelector); } - static std::unique_ptr<CSSParserSelector> create(const QualifiedName& name, bool isImplicit = false) { return wrapUnique(new CSSParserSelector(name, isImplicit)); } + static PassOwnPtr<CSSParserSelector> create() { return adoptPtr(new CSSParserSelector); } + static PassOwnPtr<CSSParserSelector> create(const QualifiedName& name, bool isImplicit = false) { return adoptPtr(new CSSParserSelector(name, isImplicit)); } ~CSSParserSelector(); - std::unique_ptr<CSSSelector> releaseSelector() { return std::move(m_selector); } + PassOwnPtr<CSSSelector> releaseSelector() { return std::move(m_selector); } CSSSelector::RelationType relation() const { return m_selector->relation(); } void setValue(const AtomicString& value, bool matchLowerCase = false) { m_selector->setValue(value, matchLowerCase); } @@ -54,8 +52,8 @@ void updatePseudoType(const AtomicString& value, bool hasArguments = false) const { m_selector->updatePseudoType(value, hasArguments); } - void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector); - void setSelectorList(std::unique_ptr<CSSSelectorList>); + void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector); + void setSelectorList(PassOwnPtr<CSSSelectorList>); bool isHostPseudoSelector() const; @@ -68,15 +66,15 @@ bool isSimple() const; CSSParserSelector* tagHistory() const { return m_tagHistory.get(); } - void setTagHistory(std::unique_ptr<CSSParserSelector> selector) { m_tagHistory = std::move(selector); } + void setTagHistory(PassOwnPtr<CSSParserSelector> selector) { m_tagHistory = std::move(selector); } void clearTagHistory() { m_tagHistory.reset(); } - void appendTagHistory(CSSSelector::RelationType, std::unique_ptr<CSSParserSelector>); - std::unique_ptr<CSSParserSelector> releaseTagHistory(); + void appendTagHistory(CSSSelector::RelationType, PassOwnPtr<CSSParserSelector>); + PassOwnPtr<CSSParserSelector> releaseTagHistory(); void prependTagSelector(const QualifiedName&, bool tagIsImplicit = false); private: - std::unique_ptr<CSSSelector> m_selector; - std::unique_ptr<CSSParserSelector> m_tagHistory; + OwnPtr<CSSSelector> m_selector; + OwnPtr<CSSParserSelector> m_tagHistory; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index 94b727a..cdfe75ff 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -47,7 +47,6 @@ #include "core/layout/LayoutTheme.h" #include "core/svg/SVGPathUtilities.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -1515,7 +1514,7 @@ return nullptr; String pathString = functionArgs.consumeIncludingWhitespace().value().toString(); - std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::NoError || !functionArgs.atEnd()) return nullptr;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp index 806f0fc..8fac603 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -8,8 +8,6 @@ #include "core/css/StyleSheetContents.h" #include "core/frame/UseCounter.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -106,8 +104,8 @@ CSSSelectorList CSSSelectorParser::consumeComplexSelectorList(CSSParserTokenRange& range) { - Vector<std::unique_ptr<CSSParserSelector>> selectorList; - std::unique_ptr<CSSParserSelector> selector = consumeComplexSelector(range); + Vector<OwnPtr<CSSParserSelector>> selectorList; + OwnPtr<CSSParserSelector> selector = consumeComplexSelector(range); if (!selector) return CSSSelectorList(); selectorList.append(std::move(selector)); @@ -127,8 +125,8 @@ CSSSelectorList CSSSelectorParser::consumeCompoundSelectorList(CSSParserTokenRange& range) { - Vector<std::unique_ptr<CSSParserSelector>> selectorList; - std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range); + Vector<OwnPtr<CSSParserSelector>> selectorList; + OwnPtr<CSSParserSelector> selector = consumeCompoundSelector(range); range.consumeWhitespace(); if (!selector) return CSSSelectorList(); @@ -173,9 +171,9 @@ } // namespace -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeComplexSelector(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeComplexSelector(CSSParserTokenRange& range) { - std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range); + OwnPtr<CSSParserSelector> selector = consumeCompoundSelector(range); if (!selector) return nullptr; @@ -186,7 +184,7 @@ previousCompoundFlags |= extractCompoundFlags(*simple, m_context.mode()); while (CSSSelector::RelationType combinator = consumeCombinator(range)) { - std::unique_ptr<CSSParserSelector> nextSelector = consumeCompoundSelector(range); + OwnPtr<CSSParserSelector> nextSelector = consumeCompoundSelector(range); if (!nextSelector) return combinator == CSSSelector::Descendant ? std::move(selector) : nullptr; if (previousCompoundFlags & HasPseudoElementForRightmostCompound) @@ -288,9 +286,9 @@ } // namespace -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) { - std::unique_ptr<CSSParserSelector> compoundSelector; + OwnPtr<CSSParserSelector> compoundSelector; AtomicString namespacePrefix; AtomicString elementName; @@ -305,7 +303,7 @@ if (m_context.isHTMLDocument()) elementName = elementName.lower(); - while (std::unique_ptr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) { + while (OwnPtr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) { // TODO(rune@opera.com): crbug.com/578131 // The UASheetMode check is a work-around to allow this selector in mediaControls(New).css: // video::-webkit-media-text-track-region-container.scrolling @@ -336,10 +334,10 @@ return splitCompoundAtImplicitShadowCrossingCombinator(std::move(compoundSelector)); } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector(CSSParserTokenRange& range) { const CSSParserToken& token = range.peek(); - std::unique_ptr<CSSParserSelector> selector; + OwnPtr<CSSParserSelector> selector; if (token.type() == HashToken) selector = consumeId(range); else if (token.type() == DelimiterToken && token.delimiter() == '.') @@ -393,33 +391,33 @@ return true; } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeId(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeId(CSSParserTokenRange& range) { ASSERT(range.peek().type() == HashToken); if (range.peek().getHashTokenType() != HashTokenId) return nullptr; - std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); + OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(CSSSelector::Id); AtomicString value = range.consume().value().toAtomicString(); selector->setValue(value, isQuirksModeBehavior(m_context.matchMode())); return selector; } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeClass(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeClass(CSSParserTokenRange& range) { ASSERT(range.peek().type() == DelimiterToken); ASSERT(range.peek().delimiter() == '.'); range.consume(); if (range.peek().type() != IdentToken) return nullptr; - std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); + OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(CSSSelector::Class); AtomicString value = range.consume().value().toAtomicString(); selector->setValue(value, isQuirksModeBehavior(m_context.matchMode())); return selector; } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeAttribute(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeAttribute(CSSParserTokenRange& range) { ASSERT(range.peek().type() == LeftBracketToken); CSSParserTokenRange block = range.consumeBlock(); @@ -442,7 +440,7 @@ ? QualifiedName(nullAtom, attributeName, nullAtom) : QualifiedName(namespacePrefix, attributeName, namespaceURI); - std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); + OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); if (block.atEnd()) { selector->setAttribute(qualifiedName, CSSSelector::CaseSensitive); @@ -463,7 +461,7 @@ return selector; } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTokenRange& range) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTokenRange& range) { ASSERT(range.peek().type() == ColonToken); range.consume(); @@ -478,7 +476,7 @@ if (token.type() != IdentToken && token.type() != FunctionToken) return nullptr; - std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); + OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(colons == 1 ? CSSSelector::PseudoClass : CSSSelector::PseudoElement); String value = token.value().toString(); @@ -508,7 +506,7 @@ { DisallowPseudoElementsScope scope(this); - std::unique_ptr<CSSSelectorList> selectorList = wrapUnique(new CSSSelectorList()); + OwnPtr<CSSSelectorList> selectorList = adoptPtr(new CSSSelectorList()); *selectorList = consumeCompoundSelectorList(block); if (!selectorList->isValid() || !block.atEnd()) return nullptr; @@ -517,11 +515,11 @@ } case CSSSelector::PseudoNot: { - std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); + OwnPtr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); block.consumeWhitespace(); if (!innerSelector || !innerSelector->isSimple() || !block.atEnd()) return nullptr; - Vector<std::unique_ptr<CSSParserSelector>> selectorVector; + Vector<OwnPtr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(innerSelector)); selector->adoptSelectorVector(selectorVector); return selector; @@ -530,11 +528,11 @@ { DisallowPseudoElementsScope scope(this); - std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); + OwnPtr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); block.consumeWhitespace(); if (!innerSelector || !block.atEnd() || !RuntimeEnabledFeatures::shadowDOMV1Enabled()) return nullptr; - Vector<std::unique_ptr<CSSParserSelector>> selectorVector; + Vector<OwnPtr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(innerSelector)); selector->adoptSelectorVector(selectorVector); return selector; @@ -765,13 +763,13 @@ compoundSelector->prependTagSelector(tag, determinedPrefix == nullAtom && determinedElementName == starAtom && !explicitForHost); } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(PassOwnPtr<CSSParserSelector> compoundSelector, PassOwnPtr<CSSParserSelector> simpleSelector) { compoundSelector->appendTagHistory(CSSSelector::SubSelector, std::move(simpleSelector)); return compoundSelector; } -std::unique_ptr<CSSParserSelector> CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector) +PassOwnPtr<CSSParserSelector> CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator(PassOwnPtr<CSSParserSelector> compoundSelector) { // The tagHistory is a linked list that stores combinator separated compound selectors // from right-to-left. Yet, within a single compound selector, stores the simple selectors @@ -798,7 +796,7 @@ if (!splitAfter || !splitAfter->tagHistory()) return compoundSelector; - std::unique_ptr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); + OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, std::move(compoundSelector)); return secondCompound; }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h index 496d3fe..8d3c0a1 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h
@@ -8,7 +8,6 @@ #include "core/CoreExport.h" #include "core/css/parser/CSSParserSelector.h" #include "core/css/parser/CSSParserTokenRange.h" -#include <memory> namespace blink { @@ -32,18 +31,18 @@ CSSSelectorList consumeComplexSelectorList(CSSParserTokenRange&); CSSSelectorList consumeCompoundSelectorList(CSSParserTokenRange&); - std::unique_ptr<CSSParserSelector> consumeComplexSelector(CSSParserTokenRange&); - std::unique_ptr<CSSParserSelector> consumeCompoundSelector(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeComplexSelector(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeCompoundSelector(CSSParserTokenRange&); // This doesn't include element names, since they're handled specially - std::unique_ptr<CSSParserSelector> consumeSimpleSelector(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeSimpleSelector(CSSParserTokenRange&); bool consumeName(CSSParserTokenRange&, AtomicString& name, AtomicString& namespacePrefix); // These will return nullptr when the selector is invalid - std::unique_ptr<CSSParserSelector> consumeId(CSSParserTokenRange&); - std::unique_ptr<CSSParserSelector> consumeClass(CSSParserTokenRange&); - std::unique_ptr<CSSParserSelector> consumePseudo(CSSParserTokenRange&); - std::unique_ptr<CSSParserSelector> consumeAttribute(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeId(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeClass(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumePseudo(CSSParserTokenRange&); + PassOwnPtr<CSSParserSelector> consumeAttribute(CSSParserTokenRange&); CSSSelector::RelationType consumeCombinator(CSSParserTokenRange&); CSSSelector::MatchType consumeAttributeMatch(CSSParserTokenRange&); @@ -52,8 +51,8 @@ const AtomicString& defaultNamespace() const; const AtomicString& determineNamespace(const AtomicString& prefix); void prependTypeSelectorIfNeeded(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*); - static std::unique_ptr<CSSParserSelector> addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector); - static std::unique_ptr<CSSParserSelector> splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector); + static PassOwnPtr<CSSParserSelector> addSimpleSelectorToCompound(PassOwnPtr<CSSParserSelector> compoundSelector, PassOwnPtr<CSSParserSelector> simpleSelector); + static PassOwnPtr<CSSParserSelector> splitCompoundAtImplicitShadowCrossingCombinator(PassOwnPtr<CSSParserSelector> compoundSelector); const CSSParserContext& m_context; Member<StyleSheetContents> m_styleSheet; // FIXME: Should be const
diff --git a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp index f888c48d..abb997d 100644 --- a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp
@@ -7,6 +7,7 @@ #include "core/css/parser/CSSTokenizer.h" #include "core/css/parser/MediaQueryParser.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp index 6a7591a2..3206d150 100644 --- a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp +++ b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
@@ -11,7 +11,6 @@ #include "core/style/ComputedStyle.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -27,7 +26,7 @@ Settings& settings() { return *document().settings(); } private: - std::unique_ptr<DummyPageHolder> m_dummy; + OwnPtr<DummyPageHolder> m_dummy; }; using BuilderFunc = void (*)(FontBuilder&);
diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h index 58f4e0b..adf8f418 100644 --- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h +++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h
@@ -32,6 +32,8 @@ #include "core/dom/TreeScope.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp index b33285e..e049800 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -66,20 +66,18 @@ #include "core/css/resolver/TransformBuilder.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" -#include "core/style/ComputedStyle.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/ContentData.h" #include "core/style/CounterContent.h" +#include "core/style/ComputedStyle.h" +#include "core/style/ComputedStyleConstants.h" #include "core/style/QuotesData.h" #include "core/style/SVGComputedStyle.h" #include "core/style/StyleGeneratedImage.h" #include "core/style/StyleVariableData.h" #include "platform/fonts/FontDescription.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -709,7 +707,7 @@ CSSValueID listStyleIdent = counterValue->listStyle(); if (listStyleIdent != CSSValueNone) listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc); - std::unique_ptr<CounterContent> counter = wrapUnique(new CounterContent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counterValue->separator()))); + OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counterValue->separator()))); nextContent = ContentData::create(std::move(counter)); } else if (item->isPrimitiveValue()) { QuoteType quoteType;
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h index f8171170..547e58a 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h
@@ -36,7 +36,6 @@ #include "core/style/CachedUAStyle.h" #include "core/style/ComputedStyle.h" #include "core/style/StyleInheritedData.h" -#include <memory> namespace blink { @@ -181,7 +180,7 @@ FontBuilder m_fontBuilder; - std::unique_ptr<CachedUAStyle> m_cachedUAStyle; + OwnPtr<CachedUAStyle> m_cachedUAStyle; ElementStyleResources m_elementStyleResources;
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp index f9c2973..1e1902b 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp
@@ -30,8 +30,6 @@ #include "core/css/resolver/StyleResolverStats.h" -#include <memory> - namespace blink { void StyleResolverStats::reset() @@ -65,9 +63,9 @@ return allCountersEnabled; } -std::unique_ptr<TracedValue> StyleResolverStats::toTracedValue() const +PassOwnPtr<TracedValue> StyleResolverStats::toTracedValue() const { - std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); + OwnPtr<TracedValue> tracedValue = TracedValue::create(); tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); tracedValue->setInteger("sharedStyleFound", sharedStyleFound);
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h index 59c630bf..8e0f820 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h
@@ -33,22 +33,21 @@ #include "platform/TraceEvent.h" #include "platform/TracedValue.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { class StyleResolverStats { USING_FAST_MALLOC(StyleResolverStats); public: - static std::unique_ptr<StyleResolverStats> create() + static PassOwnPtr<StyleResolverStats> create() { - return wrapUnique(new StyleResolverStats); + return adoptPtr(new StyleResolverStats); } void reset(); bool allCountersEnabled() const; - std::unique_ptr<TracedValue> toTracedValue() const; + PassOwnPtr<TracedValue> toTracedValue() const; unsigned sharedStyleLookups; unsigned sharedStyleCandidates;
diff --git a/third_party/WebKit/Source/core/dom/AXObjectCache.cpp b/third_party/WebKit/Source/core/dom/AXObjectCache.cpp index 0051d5e..373e1b73 100644 --- a/third_party/WebKit/Source/core/dom/AXObjectCache.cpp +++ b/third_party/WebKit/Source/core/dom/AXObjectCache.cpp
@@ -28,9 +28,6 @@ #include "core/dom/AXObjectCache.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { AXObjectCache::AXObjectCacheCreateFunction AXObjectCache::m_createFunction = nullptr; @@ -55,9 +52,9 @@ { } -std::unique_ptr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document) +PassOwnPtr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document) { - return wrapUnique(new ScopedAXObjectCache(document)); + return adoptPtr(new ScopedAXObjectCache(document)); } ScopedAXObjectCache::ScopedAXObjectCache(Document& document)
diff --git a/third_party/WebKit/Source/core/dom/AXObjectCache.h b/third_party/WebKit/Source/core/dom/AXObjectCache.h index 21c25416..be51633 100644 --- a/third_party/WebKit/Source/core/dom/AXObjectCache.h +++ b/third_party/WebKit/Source/core/dom/AXObjectCache.h
@@ -28,7 +28,6 @@ #include "core/CoreExport.h" #include "core/dom/Document.h" -#include <memory> typedef unsigned AXID; @@ -155,7 +154,7 @@ USING_FAST_MALLOC(ScopedAXObjectCache); WTF_MAKE_NONCOPYABLE(ScopedAXObjectCache); public: - static std::unique_ptr<ScopedAXObjectCache> create(Document&); + static PassOwnPtr<ScopedAXObjectCache> create(Document&); ~ScopedAXObjectCache(); AXObjectCache* get();
diff --git a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp index 196d623..3faad02 100644 --- a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp +++ b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
@@ -34,7 +34,6 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -62,8 +61,8 @@ MockActiveDOMObject& activeDOMObject() { return *m_activeDOMObject; } private: - std::unique_ptr<DummyPageHolder> m_srcPageHolder; - std::unique_ptr<DummyPageHolder> m_destPageHolder; + OwnPtr<DummyPageHolder> m_srcPageHolder; + OwnPtr<DummyPageHolder> m_destPageHolder; Persistent<MockActiveDOMObject> m_activeDOMObject; };
diff --git a/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h b/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h index f3cf08b..f4a258d 100644 --- a/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h +++ b/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h
@@ -29,6 +29,8 @@ #include "core/dom/ExecutionContextTask.h" #include "platform/v8_inspector/public/ConsoleTypes.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp b/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp index d4e47193..fe7fcd4 100644 --- a/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp +++ b/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp
@@ -10,7 +10,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -26,7 +25,7 @@ static void clearAddedRemoved(CSSSelectorWatch&); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void CSSSelectorWatchTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/ChildListMutationScope.h b/third_party/WebKit/Source/core/dom/ChildListMutationScope.h index 6865b41..6aab53f9 100644 --- a/third_party/WebKit/Source/core/dom/ChildListMutationScope.h +++ b/third_party/WebKit/Source/core/dom/ChildListMutationScope.h
@@ -36,6 +36,7 @@ #include "core/dom/Node.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp index cd02b73..3a0a614 100644 --- a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp +++ b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp
@@ -4,14 +4,13 @@ #include "core/dom/CompositorProxiedPropertySet.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { -std::unique_ptr<CompositorProxiedPropertySet> CompositorProxiedPropertySet::create() +PassOwnPtr<CompositorProxiedPropertySet> CompositorProxiedPropertySet::create() { - return wrapUnique(new CompositorProxiedPropertySet); + return adoptPtr(new CompositorProxiedPropertySet); } CompositorProxiedPropertySet::CompositorProxiedPropertySet()
diff --git a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h index 73fd68e..874b6ea 100644 --- a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h +++ b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h
@@ -9,7 +9,6 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -18,7 +17,7 @@ WTF_MAKE_NONCOPYABLE(CompositorProxiedPropertySet); USING_FAST_MALLOC(CompositorProxiedPropertySet); public: - static std::unique_ptr<CompositorProxiedPropertySet> create(); + static PassOwnPtr<CompositorProxiedPropertySet> create(); virtual ~CompositorProxiedPropertySet(); bool isEmpty() const;
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.h b/third_party/WebKit/Source/core/dom/ContainerNode.h index fa76665..b85b102a 100644 --- a/third_party/WebKit/Source/core/dom/ContainerNode.h +++ b/third_party/WebKit/Source/core/dom/ContainerNode.h
@@ -28,6 +28,7 @@ #include "core/CoreExport.h" #include "core/dom/Node.h" #include "core/html/CollectionType.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp index 05d936e..ee2f3e42 100644 --- a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp +++ b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp
@@ -29,15 +29,13 @@ #include "core/dom/Document.h" #include "core/page/Page.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { -std::unique_ptr<ContextFeaturesClient> ContextFeaturesClient::empty() +PassOwnPtr<ContextFeaturesClient> ContextFeaturesClient::empty() { - return wrapUnique(new ContextFeaturesClient()); + return adoptPtr(new ContextFeaturesClient()); } const char* ContextFeatures::supplementName() @@ -66,7 +64,7 @@ return document->contextFeatures().isEnabled(document, MutationEvents, true); } -void provideContextFeaturesTo(Page& page, std::unique_ptr<ContextFeaturesClient> client) +void provideContextFeaturesTo(Page& page, PassOwnPtr<ContextFeaturesClient> client) { Supplement<Page>::provideTo(page, ContextFeatures::supplementName(), ContextFeatures::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/core/dom/ContextFeatures.h b/third_party/WebKit/Source/core/dom/ContextFeatures.h index 16ea195..78766a60 100644 --- a/third_party/WebKit/Source/core/dom/ContextFeatures.h +++ b/third_party/WebKit/Source/core/dom/ContextFeatures.h
@@ -30,7 +30,6 @@ #include "core/CoreExport.h" #include "core/page/Page.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -49,7 +48,7 @@ static const char* supplementName(); static ContextFeatures& defaultSwitch(); - static ContextFeatures* create(std::unique_ptr<ContextFeaturesClient>); + static ContextFeatures* create(PassOwnPtr<ContextFeaturesClient>); static bool pagePopupEnabled(Document*); static bool mutationEventsEnabled(Document*); @@ -58,27 +57,27 @@ void urlDidChange(Document*); private: - explicit ContextFeatures(std::unique_ptr<ContextFeaturesClient> client) + explicit ContextFeatures(PassOwnPtr<ContextFeaturesClient> client) : m_client(std::move(client)) { } - std::unique_ptr<ContextFeaturesClient> m_client; + OwnPtr<ContextFeaturesClient> m_client; }; class ContextFeaturesClient { USING_FAST_MALLOC(ContextFeaturesClient); public: - static std::unique_ptr<ContextFeaturesClient> empty(); + static PassOwnPtr<ContextFeaturesClient> empty(); virtual ~ContextFeaturesClient() { } virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool defaultValue) { return defaultValue; } virtual void urlDidChange(Document*) { } }; -CORE_EXPORT void provideContextFeaturesTo(Page&, std::unique_ptr<ContextFeaturesClient>); +CORE_EXPORT void provideContextFeaturesTo(Page&, PassOwnPtr<ContextFeaturesClient>); void provideContextFeaturesToDocumentFrom(Document&, Page&); -inline ContextFeatures* ContextFeatures::create(std::unique_ptr<ContextFeaturesClient> client) +inline ContextFeatures* ContextFeatures::create(PassOwnPtr<ContextFeaturesClient> client) { return new ContextFeatures(std::move(client)); }
diff --git a/third_party/WebKit/Source/core/dom/CrossThreadTask.h b/third_party/WebKit/Source/core/dom/CrossThreadTask.h index fb744cf..5c9a094 100644 --- a/third_party/WebKit/Source/core/dom/CrossThreadTask.h +++ b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
@@ -34,6 +34,7 @@ #include "core/dom/ExecutionContext.h" #include "core/dom/ExecutionContextTask.h" #include "platform/ThreadSafeFunctional.h" +#include "wtf/PassOwnPtr.h" #include <type_traits> namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h index 890990b..3a57ab5 100644 --- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h +++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
@@ -9,7 +9,6 @@ #include "core/dom/DOMTypedArray.h" #include "platform/heap/Handle.h" #include "platform/transforms/TransformationMatrix.h" -#include <memory> namespace blink { @@ -63,10 +62,10 @@ protected: // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr + // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - std::unique_ptr<TransformationMatrix> m_matrix; + OwnPtr<TransformationMatrix> m_matrix; bool m_is2D; };
diff --git a/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h b/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h index b244846..8ad8552 100644 --- a/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h +++ b/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h
@@ -27,6 +27,7 @@ #define DatasetDOMStringMap_h #include "core/dom/DOMStringMap.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp index 616dcdd..b0f5d56c 100644 --- a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp +++ b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -28,7 +28,6 @@ #include "core/dom/Document.h" #include "core/dom/DocumentEncodingData.h" #include "core/html/parser/TextResourceDecoder.h" -#include <memory> namespace blink { @@ -42,7 +41,7 @@ { } -void DecodedDataDocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) +void DecodedDataDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) { // If the decoder is explicitly unset rather than having ownership // transferred away by takeDecoder(), we need to make sure it's recreated @@ -56,7 +55,7 @@ return m_decoder.get(); } -std::unique_ptr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder() +PassOwnPtr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder() { return std::move(m_decoder); }
diff --git a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h index 4d80cf9..a2dbce68 100644 --- a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h +++ b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h
@@ -27,7 +27,7 @@ #define DecodedDataDocumentParser_h #include "core/dom/DocumentParser.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { class TextResourceDecoder; @@ -42,10 +42,10 @@ void appendBytes(const char* bytes, size_t length) override; virtual void flush(); bool needsDecoder() const final { return m_needsDecoder; } - void setDecoder(std::unique_ptr<TextResourceDecoder>) override; + void setDecoder(PassOwnPtr<TextResourceDecoder>) override; TextResourceDecoder* decoder() final; - std::unique_ptr<TextResourceDecoder> takeDecoder(); + PassOwnPtr<TextResourceDecoder> takeDecoder(); protected: explicit DecodedDataDocumentParser(Document&); @@ -55,7 +55,7 @@ void updateDocument(String& decodedData); bool m_needsDecoder; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 0e123a4..fffbbe5 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -238,7 +238,6 @@ #include "wtf/TemporaryChange.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextEncodingRegistry.h" -#include <memory> using namespace WTF; using namespace Unicode; @@ -521,7 +520,7 @@ SelectorQueryCache& Document::selectorQueryCache() { if (!m_selectorQueryCache) - m_selectorQueryCache = wrapUnique(new SelectorQueryCache()); + m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); return *m_selectorQueryCache; } @@ -2888,7 +2887,7 @@ return domWindow(); } -void Document::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void Document::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) { ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)); addConsoleMessage(consoleMessage); @@ -3941,12 +3940,12 @@ const OriginAccessEntry& Document::accessEntryFromURL() { if (!m_accessEntryFromURL) { - m_accessEntryFromURL = wrapUnique(new OriginAccessEntry(url().protocol(), url().host(), OriginAccessEntry::AllowRegisterableDomains)); + m_accessEntryFromURL = adoptPtr(new OriginAccessEntry(url().protocol(), url().host(), OriginAccessEntry::AllowRegisterableDomains)); } return *m_accessEntryFromURL; } -void Document::registerEventFactory(std::unique_ptr<EventFactoryBase> eventFactory) +void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) { DCHECK(!eventFactories().contains(eventFactory.get())); eventFactories().add(std::move(eventFactory)); @@ -4378,7 +4377,7 @@ && m_titleElement->textContent().containsOnlyLatin1()) { CString originalBytes = m_titleElement->textContent().latin1(); - std::unique_ptr<TextCodec> codec = newTextCodec(newData.encoding()); + OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalBytes.length(), DataEOF); m_titleElement->setTextContent(correctlyDecodedTitle); } @@ -4594,7 +4593,7 @@ m_currentScriptStack.removeLast(); } -void Document::setTransformSource(std::unique_ptr<TransformSource> source) +void Document::setTransformSource(PassOwnPtr<TransformSource> source) { m_transformSource = std::move(source); }
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h index 15ac304..19878dc0 100644 --- a/third_party/WebKit/Source/core/dom/Document.h +++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -55,8 +55,9 @@ #include "public/platform/WebFocusType.h" #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -671,7 +672,7 @@ void setWindowAttributeEventListener(const AtomicString& eventType, EventListener*); EventListener* getWindowAttributeEventListener(const AtomicString& eventType); - static void registerEventFactory(std::unique_ptr<EventFactoryBase>); + static void registerEventFactory(PassOwnPtr<EventFactoryBase>); static Event* createEvent(ExecutionContext*, const String& eventType, ExceptionState&); // keep track of what types of event listeners are registered, so we don't @@ -812,7 +813,7 @@ void pushCurrentScript(Element*); void popCurrentScript(); - void setTransformSource(std::unique_ptr<TransformSource>); + void setTransformSource(PassOwnPtr<TransformSource>); TransformSource* transformSource() const { return m_transformSource.get(); } void incDOMTreeVersion() { DCHECK(m_lifecycle.stateAllowsTreeMutations()); m_domTreeVersion = ++s_globalTreeVersion; } @@ -949,7 +950,7 @@ void cancelIdleCallback(int id); EventTarget* errorEventTarget() final; - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) final; + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) final; void initDNSPrefetch(); @@ -1177,7 +1178,7 @@ void setHoverNode(Node*); - using EventFactorySet = HashSet<std::unique_ptr<EventFactoryBase>>; + using EventFactorySet = HashSet<OwnPtr<EventFactoryBase>>; static EventFactorySet& eventFactories(); void setNthIndexCache(NthIndexCache* nthIndexCache) { DCHECK(!m_nthIndexCache || !nthIndexCache); m_nthIndexCache = nthIndexCache; } @@ -1210,7 +1211,7 @@ KURL m_baseURLOverride; // An alternative base URL that takes precedence over m_baseURL (but not m_baseElementURL). KURL m_baseElementURL; // The URL set by the <base> element. KURL m_cookieURL; // The URL to use for cookie access. - std::unique_ptr<OriginAccessEntry> m_accessEntryFromURL; + OwnPtr<OriginAccessEntry> m_accessEntryFromURL; AtomicString m_baseTarget; @@ -1229,7 +1230,7 @@ CompatibilityMode m_compatibilityMode; bool m_compatibilityModeLocked; // This is cheaper than making setCompatibilityMode virtual. - std::unique_ptr<CancellableTaskFactory> m_executeScriptsWaitingForResourcesTask; + OwnPtr<CancellableTaskFactory> m_executeScriptsWaitingForResourcesTask; bool m_hasAutofocused; Timer<Document> m_clearFocusedElementTimer; @@ -1296,7 +1297,7 @@ HeapVector<Member<Element>> m_currentScriptStack; - std::unique_ptr<TransformSource> m_transformSource; + OwnPtr<TransformSource> m_transformSource; String m_xmlEncoding; String m_xmlVersion; @@ -1322,7 +1323,7 @@ bool m_hasAnnotatedRegions; bool m_annotatedRegionsDirty; - std::unique_ptr<SelectorQueryCache> m_selectorQueryCache; + OwnPtr<SelectorQueryCache> m_selectorQueryCache; // It is safe to keep a raw, untraced pointer to this stack-allocated // cache object: it is set upon the cache object being allocated on @@ -1366,7 +1367,7 @@ Member<ScriptedAnimationController> m_scriptedAnimationController; Member<ScriptedIdleTaskController> m_scriptedIdleTaskController; - std::unique_ptr<MainThreadTaskRunner> m_taskRunner; + OwnPtr<MainThreadTaskRunner> m_taskRunner; Member<TextAutosizer> m_textAutosizer; Member<V0CustomElementRegistrationContext> m_registrationContext; @@ -1377,7 +1378,7 @@ Member<ElementDataCache> m_elementDataCache; - using LocaleIdentifierToLocaleMap = HashMap<AtomicString, std::unique_ptr<Locale>>; + using LocaleIdentifierToLocaleMap = HashMap<AtomicString, OwnPtr<Locale>>; LocaleIdentifierToLocaleMap m_localeCache; Member<AnimationTimeline> m_timeline;
diff --git a/third_party/WebKit/Source/core/dom/DocumentParser.cpp b/third_party/WebKit/Source/core/dom/DocumentParser.cpp index 64f22f2..0faa590 100644 --- a/third_party/WebKit/Source/core/dom/DocumentParser.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentParser.cpp
@@ -29,7 +29,6 @@ #include "core/dom/DocumentParserClient.h" #include "core/html/parser/TextResourceDecoder.h" #include "wtf/Assertions.h" -#include <memory> namespace blink { @@ -51,7 +50,7 @@ visitor->trace(m_clients); } -void DocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder>) +void DocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder>) { ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/core/dom/DocumentParser.h b/third_party/WebKit/Source/core/dom/DocumentParser.h index 9d6dfee..3362c21e 100644 --- a/third_party/WebKit/Source/core/dom/DocumentParser.h +++ b/third_party/WebKit/Source/core/dom/DocumentParser.h
@@ -26,7 +26,6 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -52,7 +51,7 @@ // The below functions are used by DocumentWriter (the loader). virtual void appendBytes(const char* bytes, size_t length) = 0; virtual bool needsDecoder() const { return false; } - virtual void setDecoder(std::unique_ptr<TextResourceDecoder>); + virtual void setDecoder(PassOwnPtr<TextResourceDecoder>); virtual TextResourceDecoder* decoder(); virtual void setHasAppendedData() { }
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp index 51a3622..2f4daa137 100644 --- a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
@@ -13,7 +13,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -37,7 +36,7 @@ void setHtmlInnerHTML(const String&); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void DocumentStatisticsCollectorTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp index f4cab42..d1559700 100644 --- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -40,7 +40,6 @@ #include "platform/weborigin/SecurityOrigin.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -59,7 +58,7 @@ void setHtmlInnerHTML(const char*); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void DocumentTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 5a811b2..6efc5c6 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -139,7 +139,6 @@ #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextPosition.h" -#include <memory> namespace blink { @@ -1051,14 +1050,14 @@ const AtomicString& Element::computedRole() { document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); - std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); + OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); return cache->get()->computedRoleForNode(this); } String Element::computedName() { document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); - std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); + OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); return cache->get()->computedNameForNode(this); }
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h index c3bb62e..f43a032 100644 --- a/third_party/WebKit/Source/core/dom/ElementRareData.h +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -38,7 +38,7 @@ #include "core/style/StyleInheritedData.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -158,7 +158,7 @@ Member<AttrNodeList> m_attrNodeList; Member<InlineCSSStyleDeclaration> m_cssomWrapper; Member<InlineStylePropertyMap> m_cssomMapWrapper; - std::unique_ptr<CompositorProxiedPropertySet> m_proxiedProperties; + OwnPtr<CompositorProxiedPropertySet> m_proxiedProperties; Member<ElementAnimations> m_elementAnimations; Member<NodeIntersectionObserverData> m_intersectionObserverData;
diff --git a/third_party/WebKit/Source/core/dom/ElementTest.cpp b/third_party/WebKit/Source/core/dom/ElementTest.cpp index 3ac914f..be8af0d 100644 --- a/third_party/WebKit/Source/core/dom/ElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/ElementTest.cpp
@@ -9,13 +9,12 @@ #include "core/html/HTMLHtmlElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(ElementTest, SupportsFocus) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); DCHECK(isHTMLHtmlElement(document.documentElement())); document.setDesignMode("on");
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp index 4a49825c..e061090 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp +++ b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
@@ -37,22 +37,20 @@ #include "core/inspector/InspectorInstrumentation.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class ExecutionContext::PendingException { WTF_MAKE_NONCOPYABLE(PendingException); public: - PendingException(const String& errorMessage, std::unique_ptr<SourceLocation> location) + PendingException(const String& errorMessage, PassOwnPtr<SourceLocation> location) : m_errorMessage(errorMessage) , m_location(std::move(location)) { } String m_errorMessage; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; }; ExecutionContext::ExecutionContext() @@ -90,7 +88,7 @@ notifyStoppingActiveDOMObjects(); } -void ExecutionContext::postSuspendableTask(std::unique_ptr<SuspendableTask> task) +void ExecutionContext::postSuspendableTask(PassOwnPtr<SuspendableTask> task) { m_suspendedTasks.append(std::move(task)); if (!m_activeDOMObjectsAreSuspended) @@ -99,9 +97,9 @@ void ExecutionContext::notifyContextDestroyed() { - Deque<std::unique_ptr<SuspendableTask>> suspendedTasks; + Deque<OwnPtr<SuspendableTask>> suspendedTasks; suspendedTasks.swap(m_suspendedTasks); - for (Deque<std::unique_ptr<SuspendableTask>>::iterator it = suspendedTasks.begin(); it != suspendedTasks.end(); ++it) + for (Deque<OwnPtr<SuspendableTask>>::iterator it = suspendedTasks.begin(); it != suspendedTasks.end(); ++it) (*it)->contextDestroyed(); ContextLifecycleNotifier::notifyContextDestroyed(); } @@ -144,8 +142,8 @@ { if (m_inDispatchErrorEvent) { if (!m_pendingExceptions) - m_pendingExceptions = wrapUnique(new Vector<std::unique_ptr<PendingException>>()); - m_pendingExceptions->append(wrapUnique(new PendingException(errorEvent->messageForConsole(), errorEvent->location()->clone()))); + m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>()); + m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->messageForConsole(), errorEvent->location()->clone()))); return; } @@ -183,7 +181,7 @@ { m_isRunSuspendableTasksScheduled = false; while (!m_activeDOMObjectsAreSuspended && m_suspendedTasks.size()) { - std::unique_ptr<SuspendableTask> task = m_suspendedTasks.takeFirst(); + OwnPtr<SuspendableTask> task = m_suspendedTasks.takeFirst(); task->run(); } }
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.h b/third_party/WebKit/Source/core/dom/ExecutionContext.h index 92d1d2ce..cd3c1fe 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContext.h +++ b/third_party/WebKit/Source/core/dom/ExecutionContext.h
@@ -40,7 +40,8 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -107,7 +108,7 @@ void reportException(ErrorEvent*, AccessControlStatus); virtual void addConsoleMessage(ConsoleMessage*) = 0; - virtual void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) = 0; + virtual void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) = 0; PublicURLManager& publicURLManager(); @@ -116,7 +117,7 @@ void suspendActiveDOMObjects(); void resumeActiveDOMObjects(); void stopActiveDOMObjects(); - void postSuspendableTask(std::unique_ptr<SuspendableTask>); + void postSuspendableTask(PassOwnPtr<SuspendableTask>); void notifyContextDestroyed() override; virtual void suspendScheduledTasks(); @@ -167,7 +168,7 @@ bool m_inDispatchErrorEvent; class PendingException; - std::unique_ptr<Vector<std::unique_ptr<PendingException>>> m_pendingExceptions; + OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions; bool m_activeDOMObjectsAreSuspended; bool m_activeDOMObjectsAreStopped; @@ -180,7 +181,7 @@ // increment and decrement the counter. int m_windowInteractionTokens; - Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; + Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; bool m_isRunSuspendableTasksScheduled; ReferrerPolicy m_referrerPolicy;
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContextTask.h b/third_party/WebKit/Source/core/dom/ExecutionContextTask.h index 4fdbbc90..4efe576 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContextTask.h +++ b/third_party/WebKit/Source/core/dom/ExecutionContextTask.h
@@ -104,7 +104,7 @@ std::unique_ptr<ExecutionContextTask> createSameThreadTask( FunctionType function, P&&... parameters) { - return internal::createCallClosureTask(WTF::bind(function, std::forward<P>(parameters)...)); + return internal::createCallClosureTask(bind(function, std::forward<P>(parameters)...)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp index f795010..dfb887d1 100644 --- a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp +++ b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp
@@ -5,14 +5,12 @@ #include "core/dom/IncrementLoadEventDelayCount.h" #include "core/dom/Document.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<IncrementLoadEventDelayCount> IncrementLoadEventDelayCount::create(Document& document) +PassOwnPtr<IncrementLoadEventDelayCount> IncrementLoadEventDelayCount::create(Document& document) { - return wrapUnique(new IncrementLoadEventDelayCount(document)); + return adoptPtr(new IncrementLoadEventDelayCount(document)); } IncrementLoadEventDelayCount::IncrementLoadEventDelayCount(Document& document)
diff --git a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h index dfafde11..43e971d 100644 --- a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h +++ b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h
@@ -8,7 +8,6 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); public: - static std::unique_ptr<IncrementLoadEventDelayCount> create(Document&); + static PassOwnPtr<IncrementLoadEventDelayCount> create(Document&); ~IncrementLoadEventDelayCount(); // Increments the new document's count and decrements the old count.
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h index 8db704e..0d1d6cd 100644 --- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h +++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
@@ -32,10 +32,8 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/WeakPtr.h" -#include <memory> namespace blink { @@ -46,7 +44,7 @@ USING_FAST_MALLOC(MainThreadTaskRunner); WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner); public: - static std::unique_ptr<MainThreadTaskRunner> create(ExecutionContext*); + static PassOwnPtr<MainThreadTaskRunner> create(ExecutionContext*); ~MainThreadTaskRunner(); @@ -75,9 +73,9 @@ WeakPtrFactory<MainThreadTaskRunner> m_weakFactory; }; -inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create(ExecutionContext* context) +inline PassOwnPtr<MainThreadTaskRunner> MainThreadTaskRunner::create(ExecutionContext* context) { - return wrapUnique(new MainThreadTaskRunner(context)); + return adoptPtr(new MainThreadTaskRunner(context)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp index 1651ef4f..13f52143 100644 --- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp +++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp
@@ -33,7 +33,8 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -45,7 +46,7 @@ TEST(MainThreadTaskRunnerTest, PostTask) { NullExecutionContext* context = new NullExecutionContext(); - std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; runner->postTask(BLINK_FROM_HERE, createSameThreadTask(&markBoolean, &isMarked)); @@ -57,7 +58,7 @@ TEST(MainThreadTaskRunnerTest, SuspendTask) { NullExecutionContext* context = new NullExecutionContext(); - std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; context->setTasksNeedSuspension(true); @@ -75,7 +76,7 @@ TEST(MainThreadTaskRunnerTest, RemoveRunner) { NullExecutionContext* context = new NullExecutionContext(); - std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; context->setTasksNeedSuspension(true);
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.cpp b/third_party/WebKit/Source/core/dom/MessagePort.cpp index 59fce93..17fc8bb3 100644 --- a/third_party/WebKit/Source/core/dom/MessagePort.cpp +++ b/third_party/WebKit/Source/core/dom/MessagePort.cpp
@@ -39,9 +39,7 @@ #include "core/workers/WorkerGlobalScope.h" #include "public/platform/WebString.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -81,7 +79,7 @@ return; } } - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; @@ -89,16 +87,16 @@ getExecutionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "MessagePort cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/334408")); WebString messageString = message->toWireString(); - std::unique_ptr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArray(std::move(channels)); - m_entangledChannel->postMessage(messageString, webChannels.release()); + OwnPtr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArray(std::move(channels)); + m_entangledChannel->postMessage(messageString, webChannels.leakPtr()); } // static -std::unique_ptr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray> channels) +PassOwnPtr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray(PassOwnPtr<MessagePortChannelArray> channels) { - std::unique_ptr<WebMessagePortChannelArray> webChannels; + OwnPtr<WebMessagePortChannelArray> webChannels; if (channels && channels->size()) { - webChannels = wrapUnique(new WebMessagePortChannelArray(channels->size())); + webChannels = adoptPtr(new WebMessagePortChannelArray(channels->size())); for (size_t i = 0; i < channels->size(); ++i) (*webChannels)[i] = (*channels)[i].release(); } @@ -108,7 +106,7 @@ // static MessagePortArray* MessagePort::toMessagePortArray(ExecutionContext* context, const WebMessagePortChannelArray& webChannels) { - std::unique_ptr<MessagePortChannelArray> channels = wrapUnique(new MessagePortChannelArray(webChannels.size())); + OwnPtr<MessagePortChannelArray> channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); for (size_t i = 0; i < webChannels.size(); ++i) (*channels)[i] = WebMessagePortChannelUniquePtr(webChannels[i]); return MessagePort::entanglePorts(*context, std::move(channels)); @@ -165,7 +163,7 @@ return EventTargetNames::MessagePort; } -static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels) +static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels) { WebString messageString; WebMessagePortChannelArray webChannels; @@ -173,7 +171,7 @@ return false; if (webChannels.size()) { - channels = wrapUnique(new MessagePortChannelArray(webChannels.size())); + channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); for (size_t i = 0; i < webChannels.size(); ++i) (*channels)[i] = WebMessagePortChannelUniquePtr(webChannels[i]); } @@ -181,7 +179,7 @@ return true; } -bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels) +bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels) { if (!m_entangledChannel) return false; @@ -200,7 +198,7 @@ return; RefPtr<SerializedScriptValue> message; - std::unique_ptr<MessagePortChannelArray> channels; + OwnPtr<MessagePortChannelArray> channels; while (tryGetMessage(message, channels)) { // close() in Worker onmessage handler should prevent next message from dispatching. if (getExecutionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(getExecutionContext())->isClosing()) @@ -220,7 +218,7 @@ return m_started && isEntangled(); } -std::unique_ptr<MessagePortChannelArray> MessagePort::disentanglePorts(ExecutionContext* context, const MessagePortArray& ports, ExceptionState& exceptionState) +PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(ExecutionContext* context, const MessagePortArray& ports, ExceptionState& exceptionState) { if (!ports.size()) return nullptr; @@ -247,13 +245,13 @@ UseCounter::count(context, UseCounter::MessagePortsTransferred); // Passed-in ports passed validity checks, so we can disentangle them. - std::unique_ptr<MessagePortChannelArray> portArray = wrapUnique(new MessagePortChannelArray(ports.size())); + OwnPtr<MessagePortChannelArray> portArray = adoptPtr(new MessagePortChannelArray(ports.size())); for (unsigned i = 0; i < ports.size(); ++i) (*portArray)[i] = ports[i]->disentangle(); return portArray; } -MessagePortArray* MessagePort::entanglePorts(ExecutionContext& context, std::unique_ptr<MessagePortChannelArray> channels) +MessagePortArray* MessagePort::entanglePorts(ExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels) { // https://html.spec.whatwg.org/multipage/comms.html#message-ports // |ports| should be an empty array, not null even when there is no ports.
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.h b/third_party/WebKit/Source/core/dom/MessagePort.h index 6224a2b..4742b7d 100644 --- a/third_party/WebKit/Source/core/dom/MessagePort.h +++ b/third_party/WebKit/Source/core/dom/MessagePort.h
@@ -35,6 +35,8 @@ #include "core/events/EventTarget.h" #include "public/platform/WebMessagePortChannel.h" #include "public/platform/WebMessagePortChannelClient.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" @@ -71,16 +73,16 @@ WebMessagePortChannelUniquePtr disentangle(); // Returns nullptr if the passed-in array is nullptr/empty. - static std::unique_ptr<WebMessagePortChannelArray> toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray>); + static PassOwnPtr<WebMessagePortChannelArray> toWebMessagePortChannelArray(PassOwnPtr<MessagePortChannelArray>); // Returns an empty array if the passed array is empty. static MessagePortArray* toMessagePortArray(ExecutionContext*, const WebMessagePortChannelArray&); // Returns nullptr if there is an exception, or if the passed-in array is nullptr/empty. - static std::unique_ptr<MessagePortChannelArray> disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&); + static PassOwnPtr<MessagePortChannelArray> disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&); // Returns an empty array if the passed array is nullptr/empty. - static MessagePortArray* entanglePorts(ExecutionContext&, std::unique_ptr<MessagePortChannelArray>); + static MessagePortArray* entanglePorts(ExecutionContext&, PassOwnPtr<MessagePortChannelArray>); bool started() const { return m_started; } @@ -111,7 +113,7 @@ protected: explicit MessagePort(ExecutionContext&); - bool tryGetMessage(RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels); + bool tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels); private: // WebMessagePortChannelClient implementation.
diff --git a/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h b/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h index 3b1cf40..a0520a1c 100644 --- a/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h +++ b/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h
@@ -37,6 +37,7 @@ #include "core/dom/QualifiedName.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index a7f51f70..c0853351 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -93,6 +93,7 @@ #include "platform/TraceEvent.h" #include "platform/TracedValue.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CString.h"
diff --git a/third_party/WebKit/Source/core/dom/NodeRareData.h b/third_party/WebKit/Source/core/dom/NodeRareData.h index 5103db61..f8d7759 100644 --- a/third_party/WebKit/Source/core/dom/NodeRareData.h +++ b/third_party/WebKit/Source/core/dom/NodeRareData.h
@@ -26,6 +26,8 @@ #include "core/dom/NodeListsNodeData.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp index 3a0b750..fe24da8 100644 --- a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp +++ b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp
@@ -8,7 +8,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void NthIndexCacheTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp index c2f9f38c..0c9eb8c 100644 --- a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp +++ b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -34,7 +34,6 @@ #include "core/xml/DocumentXSLT.h" #include "core/xml/XSLStyleSheet.h" #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes() -#include <memory> namespace blink { @@ -225,7 +224,7 @@ DCHECK(m_isXSL); m_sheet = XSLStyleSheet::create(this, href, baseURL); - std::unique_ptr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::create(document()); + OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::create(document()); parseStyleSheet(sheet); }
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp index 212d353..9fc5886 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
@@ -36,8 +36,6 @@ #include "core/dom/StaticNodeList.h" #include "core/dom/shadow/ElementShadow.h" #include "core/dom/shadow/ShadowRoot.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -527,9 +525,9 @@ findTraverseRootsAndExecute<SelectorQueryTrait>(rootNode, output); } -std::unique_ptr<SelectorQuery> SelectorQuery::adopt(CSSSelectorList selectorList) +PassOwnPtr<SelectorQuery> SelectorQuery::adopt(CSSSelectorList selectorList) { - return wrapUnique(new SelectorQuery(std::move(selectorList))); + return adoptPtr(new SelectorQuery(std::move(selectorList))); } SelectorQuery::SelectorQuery(CSSSelectorList selectorList) @@ -560,7 +558,7 @@ SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Document& document, ExceptionState& exceptionState) { - HashMap<AtomicString, std::unique_ptr<SelectorQuery>>::iterator it = m_entries.find(selectors); + HashMap<AtomicString, OwnPtr<SelectorQuery>>::iterator it = m_entries.find(selectors); if (it != m_entries.end()) return it->value.get();
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.h b/third_party/WebKit/Source/core/dom/SelectorQuery.h index 2dc05bf4..33fb551 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.h +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.h
@@ -32,7 +32,6 @@ #include "wtf/HashMap.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" -#include <memory> namespace blink { @@ -90,7 +89,7 @@ WTF_MAKE_NONCOPYABLE(SelectorQuery); USING_FAST_MALLOC(SelectorQuery); public: - static std::unique_ptr<SelectorQuery> adopt(CSSSelectorList); + static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList); bool matches(Element&) const; Element* closest(Element&) const; @@ -110,7 +109,7 @@ void invalidate(); private: - HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries; + HashMap<AtomicString, OwnPtr<SelectorQuery>> m_entries; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp index d10c1af..5f44146 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
@@ -8,7 +8,6 @@ #include "core/dom/Document.h" #include "core/html/HTMLHtmlElement.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ document->documentElement()->setInnerHTML("<body><style>span::before { content: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION); CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr), nullptr, "span::before"); - std::unique_ptr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList)); + OwnPtr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList)); Element* elm = query->queryFirst(*document); EXPECT_EQ(nullptr, elm);
diff --git a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp index c37c7b8..5f1f6c61 100644 --- a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp
@@ -9,13 +9,12 @@ #include "core/html/HTMLStyleElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(StyleElementTest, CreateSheetUsesCache) { - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); Document& document = dummyPageHolder->document(); document.documentElement()->setInnerHTML("<style id=style>a { top: 0; }</style>", ASSERT_NO_EXCEPTION);
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.h b/third_party/WebKit/Source/core/dom/StyleEngine.h index b2cd4f0..24dfe57 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngine.h +++ b/third_party/WebKit/Source/core/dom/StyleEngine.h
@@ -43,7 +43,6 @@ #include "wtf/TemporaryChange.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -262,7 +261,7 @@ HeapHashMap<AtomicString, Member<StyleSheetContents>> m_textToSheetCache; HeapHashMap<Member<StyleSheetContents>, AtomicString> m_sheetToTextCache; - std::unique_ptr<StyleResolverStats> m_styleResolverStats; + OwnPtr<StyleResolverStats> m_styleResolverStats; unsigned m_styleForElementCount = 0; friend class StyleEngineTest;
diff --git a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp index 7d2bd26a..098395e 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp +++ b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
@@ -11,7 +11,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpdateDocumentStyleSheetCollection(AnalyzedStyleUpdate); } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void StyleEngineTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp index 8567a58..f3a4b56 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
@@ -10,7 +10,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -132,7 +131,7 @@ const char* bodyContent = "<div id=div></div>" "<a-a id=v1v0></a-a>" "<font-face id=v0></font-face>"; - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); document.body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXCEPTION); @@ -167,7 +166,7 @@ { "font-face", CustomElementState::Uncustomized, Element::V0WaitingForUpgrade }, { "_-X", CustomElementState::Uncustomized, Element::V0WaitingForUpgrade }, }; - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); for (const auto& data : createElementData) { Element* element = document.createElement(data.name, ASSERT_NO_EXCEPTION);
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp index a838691..22b80ad 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp
@@ -14,8 +14,8 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -56,7 +56,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(CustomElementUpgradeSorterTest, inOtherDocument_notInSet)
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp index 17467d0b..da2245a 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp
@@ -71,7 +71,7 @@ void SetUp() override { CustomElementsRegistryTestBase::SetUp(); - m_page.reset(DummyPageHolder::create(IntSize(1, 1)).release()); + m_page.reset(DummyPageHolder::create(IntSize(1, 1)).leakPtr()); } void TearDown() override
diff --git a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp index 55ca8a7..6dbcf26 100644 --- a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp +++ b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp
@@ -17,9 +17,9 @@ #include "platform/geometry/IntSize.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Compiler.h" +#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -41,7 +41,7 @@ void SetUp() override; Persistent<HTMLDocument> m_document; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void FlatTreeTraversalTest::SetUp()
diff --git a/third_party/WebKit/Source/core/editing/EditingTestBase.h b/third_party/WebKit/Source/core/editing/EditingTestBase.h index 53f971b..1f30bac 100644 --- a/third_party/WebKit/Source/core/editing/EditingTestBase.h +++ b/third_party/WebKit/Source/core/editing/EditingTestBase.h
@@ -8,7 +8,6 @@ #include "core/editing/Position.h" #include "wtf/Forward.h" #include <gtest/gtest.h> -#include <memory> #include <string> namespace blink { @@ -33,7 +32,7 @@ void updateAllLifecyclePhases(); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 4c2e912..e705c69 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -87,7 +87,6 @@ #include "core/svg/SVGImageElement.h" #include "platform/KillRing.h" #include "platform/weborigin/KURL.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CharacterNames.h" namespace blink { @@ -769,7 +768,7 @@ , m_shouldStartNewKillRingSequence(false) // This is off by default, since most editors want this behavior (this matches IE but not FF). , m_shouldStyleWithCSS(false) - , m_killRing(wrapUnique(new KillRing)) + , m_killRing(adoptPtr(new KillRing)) , m_areMarkedTextMatchesHighlighted(false) , m_defaultParagraphSeparator(EditorParagraphSeparatorIsDiv) , m_overwriteModeEnabled(false)
diff --git a/third_party/WebKit/Source/core/editing/Editor.h b/third_party/WebKit/Source/core/editing/Editor.h index e2bd766a..4262211 100644 --- a/third_party/WebKit/Source/core/editing/Editor.h +++ b/third_party/WebKit/Source/core/editing/Editor.h
@@ -39,7 +39,6 @@ #include "core/editing/markers/DocumentMarker.h" #include "platform/PasteMode.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -256,7 +255,7 @@ int m_preventRevealSelection; bool m_shouldStartNewKillRingSequence; bool m_shouldStyleWithCSS; - const std::unique_ptr<KillRing> m_killRing; + const OwnPtr<KillRing> m_killRing; VisibleSelection m_mark; bool m_areMarkedTextMatchesHighlighted; EditorParagraphSeparator m_defaultParagraphSeparator;
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp index 0e7844a..6b3befe 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -77,7 +77,6 @@ #include "platform/geometry/FloatQuad.h" #include "platform/graphics/GraphicsContext.h" #include "platform/text/UnicodeUtilities.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include <stdio.h> @@ -1300,9 +1299,9 @@ return m_granularityStrategy.get(); if (strategyType == SelectionStrategy::Direction) - m_granularityStrategy = wrapUnique(new DirectionGranularityStrategy()); + m_granularityStrategy = adoptPtr(new DirectionGranularityStrategy()); else - m_granularityStrategy = wrapUnique(new CharacterGranularityStrategy()); + m_granularityStrategy = adoptPtr(new CharacterGranularityStrategy()); return m_granularityStrategy.get(); }
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h index f50aa62..3f559f5 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.h +++ b/third_party/WebKit/Source/core/editing/FrameSelection.h
@@ -39,7 +39,6 @@ #include "platform/geometry/LayoutRect.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -302,7 +301,7 @@ bool m_focused : 1; // Controls text granularity used to adjust the selection's extent in moveRangeSelectionExtent. - std::unique_ptr<GranularityStrategy> m_granularityStrategy; + OwnPtr<GranularityStrategy> m_granularityStrategy; const Member<FrameCaret> m_frameCaret; };
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp index 1924c09..19050016 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -19,10 +19,10 @@ #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -113,7 +113,7 @@ frameRect.setHeight(frameRect.height() + 1); dummyPageHolder().frameView().setFrameRect(frameRect); } - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); { GraphicsContext context(*paintController); DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect());
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp index 82853aff..dac7bae0 100644 --- a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp +++ b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
@@ -15,10 +15,10 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -69,7 +69,7 @@ Vector<IntPoint> m_wordMiddles; private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp index 1a8bf2c5..b176244 100644 --- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -15,7 +15,6 @@ #include "core/html/HTMLInputElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -29,7 +28,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp index 46ceeac..3a9b2c942 100644 --- a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp +++ b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp
@@ -12,7 +12,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -26,7 +25,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void SurroundingTextTest::SetUp()
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp index 5611a89..62a53a0 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
@@ -41,7 +41,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -61,7 +60,7 @@ void setBodyInnerHTML(const char*); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; Text* DocumentMarkerControllerTest::createTextNode(const char* textContents)
diff --git a/third_party/WebKit/Source/core/events/ErrorEvent.cpp b/third_party/WebKit/Source/core/events/ErrorEvent.cpp index 1d878850..bab76836f 100644 --- a/third_party/WebKit/Source/core/events/ErrorEvent.cpp +++ b/third_party/WebKit/Source/core/events/ErrorEvent.cpp
@@ -31,7 +31,6 @@ #include "core/events/ErrorEvent.h" #include "bindings/core/v8/V8Binding.h" -#include <memory> #include <v8.h> namespace blink { @@ -59,7 +58,7 @@ m_error = initializer.error(); } -ErrorEvent::ErrorEvent(const String& message, std::unique_ptr<SourceLocation> location, DOMWrapperWorld* world) +ErrorEvent::ErrorEvent(const String& message, PassOwnPtr<SourceLocation> location, DOMWrapperWorld* world) : Event(EventTypeNames::error, false, true) , m_sanitizedMessage(message) , m_location(std::move(location))
diff --git a/third_party/WebKit/Source/core/events/ErrorEvent.h b/third_party/WebKit/Source/core/events/ErrorEvent.h index e44e284..97121d5 100644 --- a/third_party/WebKit/Source/core/events/ErrorEvent.h +++ b/third_party/WebKit/Source/core/events/ErrorEvent.h
@@ -37,7 +37,6 @@ #include "core/events/Event.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -48,7 +47,7 @@ { return new ErrorEvent; } - static ErrorEvent* create(const String& message, std::unique_ptr<SourceLocation> location, DOMWrapperWorld* world) + static ErrorEvent* create(const String& message, PassOwnPtr<SourceLocation> location, DOMWrapperWorld* world) { return new ErrorEvent(message, std::move(location), world); } @@ -83,12 +82,12 @@ private: ErrorEvent(); - ErrorEvent(const String& message, std::unique_ptr<SourceLocation>, DOMWrapperWorld*); + ErrorEvent(const String& message, PassOwnPtr<SourceLocation>, DOMWrapperWorld*); ErrorEvent(const AtomicString&, const ErrorEventInit&); String m_unsanitizedMessage; String m_sanitizedMessage; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; ScriptValue m_error; RefPtr<DOMWrapperWorld> m_world;
diff --git a/third_party/WebKit/Source/core/events/EventFactory.h b/third_party/WebKit/Source/core/events/EventFactory.h index 78b6de61..01f7c688c 100644 --- a/third_party/WebKit/Source/core/events/EventFactory.h +++ b/third_party/WebKit/Source/core/events/EventFactory.h
@@ -29,9 +29,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -50,9 +48,9 @@ class EventFactory final : public EventFactoryBase { public: - static std::unique_ptr<EventFactory> create() + static PassOwnPtr<EventFactory> create() { - return wrapUnique(new EventFactory()); + return adoptPtr(new EventFactory()); } Event* create(ExecutionContext*, const String& eventType) override;
diff --git a/third_party/WebKit/Source/core/events/EventListenerMap.h b/third_party/WebKit/Source/core/events/EventListenerMap.h index 37851fc..a6a6b8d 100644 --- a/third_party/WebKit/Source/core/events/EventListenerMap.h +++ b/third_party/WebKit/Source/core/events/EventListenerMap.h
@@ -38,6 +38,7 @@ #include "core/events/EventListenerOptions.h" #include "core/events/RegisteredEventListener.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/AtomicStringHash.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/events/EventPathTest.cpp b/third_party/WebKit/Source/core/events/EventPathTest.cpp index ad8654a..4351aab 100644 --- a/third_party/WebKit/Source/core/events/EventPathTest.cpp +++ b/third_party/WebKit/Source/core/events/EventPathTest.cpp
@@ -10,7 +10,6 @@ #include "core/style/ComputedStyleConstants.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; void EventPathTest::SetUp()
diff --git a/third_party/WebKit/Source/core/events/EventQueue.h b/third_party/WebKit/Source/core/events/EventQueue.h index b7beffb..1ac313cd 100644 --- a/third_party/WebKit/Source/core/events/EventQueue.h +++ b/third_party/WebKit/Source/core/events/EventQueue.h
@@ -31,6 +31,7 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index a7115074..21ee9c2 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -46,11 +46,9 @@ #include "core/inspector/ConsoleMessage.h" #include "core/inspector/InspectorInstrumentation.h" #include "platform/EventDispatchForbiddenScope.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" #include "wtf/Vector.h" -#include <memory> using namespace WTF; @@ -109,7 +107,7 @@ event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener->isolate(), handler); - std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(function); + OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function); ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMessageLevel, messageText, std::move(location)); context->addConsoleMessage(message); registeredListener->setBlockedEventWarningEmitted(); @@ -554,7 +552,7 @@ size_t i = 0; size_t size = entry.size(); if (!d->firingEventIterators) - d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); + d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)); double blockedEventThreshold = blockedEventsWarningThreshold(context, event);
diff --git a/third_party/WebKit/Source/core/events/EventTarget.h b/third_party/WebKit/Source/core/events/EventTarget.h index 366bc3f..56b0544 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.h +++ b/third_party/WebKit/Source/core/events/EventTarget.h
@@ -44,7 +44,6 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -79,7 +78,7 @@ DECLARE_TRACE(); EventListenerMap eventListenerMap; - std::unique_ptr<FiringEventIteratorVector> firingEventIterators; + OwnPtr<FiringEventIteratorVector> firingEventIterators; }; // This is the base class for all DOM event targets. To make your class an
diff --git a/third_party/WebKit/Source/core/events/GenericEventQueue.h b/third_party/WebKit/Source/core/events/GenericEventQueue.h index 62cd783..18fb486 100644 --- a/third_party/WebKit/Source/core/events/GenericEventQueue.h +++ b/third_party/WebKit/Source/core/events/GenericEventQueue.h
@@ -30,6 +30,7 @@ #include "core/events/EventQueue.h" #include "core/events/EventTarget.h" #include "platform/Timer.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp index 9d4f92f4..146800f 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
@@ -26,7 +26,6 @@ #include "bindings/core/v8/ScriptState.h" #include "platform/PlatformKeyboardEvent.h" #include "platform/WindowsKeyboardCodes.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -74,7 +73,7 @@ KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* view) : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()) - , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) + , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) , m_keyIdentifier(key.keyIdentifier()) , m_code(key.code()) , m_key(key.key())
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.h b/third_party/WebKit/Source/core/events/KeyboardEvent.h index c1f97456..e3f075e 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.h +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.h
@@ -27,7 +27,6 @@ #include "core/CoreExport.h" #include "core/events/KeyboardEventInit.h" #include "core/events/UIEventWithKeyState.h" -#include <memory> namespace blink { @@ -98,7 +97,7 @@ void initLocationModifiers(unsigned location); - std::unique_ptr<PlatformKeyboardEvent> m_keyEvent; + OwnPtr<PlatformKeyboardEvent> m_keyEvent; String m_keyIdentifier; String m_code; String m_key;
diff --git a/third_party/WebKit/Source/core/events/MessageEvent.cpp b/third_party/WebKit/Source/core/events/MessageEvent.cpp index 0966e17..8a0aa5d 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.cpp +++ b/third_party/WebKit/Source/core/events/MessageEvent.cpp
@@ -31,7 +31,6 @@ #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/V8ArrayBuffer.h" #include "bindings/core/v8/V8PrivateProperty.h" -#include <memory> namespace blink { @@ -88,7 +87,7 @@ ASSERT(isValidSource(m_source.get())); } -MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortChannelArray> channels, const String& suborigin) +MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArray> channels, const String& suborigin) : Event(EventTypeNames::message, false, false) , m_dataType(DataTypeSerializedScriptValue) , m_dataAsSerializedScriptValue(data)
diff --git a/third_party/WebKit/Source/core/events/MessageEvent.h b/third_party/WebKit/Source/core/events/MessageEvent.h index b338c11..1f961bec 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.h +++ b/third_party/WebKit/Source/core/events/MessageEvent.h
@@ -37,7 +37,6 @@ #include "core/events/MessageEventInit.h" #include "core/fileapi/Blob.h" #include "core/frame/DOMWindow.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ { return new MessageEvent(data, origin, lastEventId, source, ports, suborigin); } - static MessageEvent* create(std::unique_ptr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), EventTarget* source = nullptr, const String& suborigin = String()) + static MessageEvent* create(PassOwnPtr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), EventTarget* source = nullptr, const String& suborigin = String()) { return new MessageEvent(data, origin, lastEventId, source, std::move(channels), suborigin); } @@ -119,7 +118,7 @@ MessageEvent(const AtomicString&, const MessageEventInit&); MessageEvent(const String& origin, const String& lastEventId, EventTarget* source, MessagePortArray*, const String& suborigin); MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, MessagePortArray*, const String& suborigin); - MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortChannelArray>, const String& suborigin); + MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArray>, const String& suborigin); MessageEvent(const String& data, const String& origin, const String& suborigin); MessageEvent(Blob* data, const String& origin, const String& suborigin); @@ -138,7 +137,7 @@ // the MessageChannels in a disentangled state. Only one of them can be // non-empty at a time. entangleMessagePorts() moves between the states. Member<MessagePortArray> m_ports; - std::unique_ptr<MessagePortChannelArray> m_channels; + OwnPtr<MessagePortChannelArray> m_channels; String m_suborigin; };
diff --git a/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp b/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp index ea6b553..c514ec67 100644 --- a/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp +++ b/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp
@@ -34,8 +34,7 @@ #include "core/events/EventDispatchMediator.h" #include "core/events/EventDispatcher.h" #include "core/events/EventTarget.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -55,8 +54,8 @@ void ScopedEventQueue::initialize() { ASSERT(!s_instance); - std::unique_ptr<ScopedEventQueue> instance = wrapUnique(new ScopedEventQueue); - s_instance = instance.release(); + OwnPtr<ScopedEventQueue> instance = adoptPtr(new ScopedEventQueue); + s_instance = instance.leakPtr(); } void ScopedEventQueue::enqueueEventDispatchMediator(EventDispatchMediator* mediator)
diff --git a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp index fb03c6c6..2d7cbb0 100644 --- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp +++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -36,6 +36,7 @@ #include "core/fetch/ResourceFetcher.h" #include "platform/network/ResourceRequest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp index d302bcaf..267e0d9 100644 --- a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp +++ b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -34,18 +34,16 @@ #include "platform/network/ResourceResponse.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/weborigin/SecurityOrigin.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/text/AtomicString.h" #include "wtf/text/StringBuilder.h" #include <algorithm> -#include <memory> namespace blink { -static std::unique_ptr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet() +static PassOwnPtr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet() { - std::unique_ptr<HTTPHeaderSet> headerSet = wrapUnique(new HashSet<String, CaseFoldingHash>); + OwnPtr<HTTPHeaderSet> headerSet = adoptPtr(new HashSet<String, CaseFoldingHash>); headerSet->add("cache-control"); headerSet->add("content-language"); @@ -59,7 +57,7 @@ bool isOnAccessControlResponseHeaderWhitelist(const String& name) { - DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHeaders, (createAllowedCrossOriginResponseHeadersSet().release())); + DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHeaders, (createAllowedCrossOriginResponseHeadersSet().leakPtr())); return allowedCrossOriginResponseHeaders.contains(name); }
diff --git a/third_party/WebKit/Source/core/fetch/DocumentResource.h b/third_party/WebKit/Source/core/fetch/DocumentResource.h index ea70a68..68027484 100644 --- a/third_party/WebKit/Source/core/fetch/DocumentResource.h +++ b/third_party/WebKit/Source/core/fetch/DocumentResource.h
@@ -27,7 +27,6 @@ #include "core/fetch/ResourceClient.h" #include "core/html/parser/TextResourceDecoder.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -66,7 +65,7 @@ Document* createDocument(const KURL&); Member<Document> m_document; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; }; DEFINE_TYPE_CASTS(DocumentResource, Resource, resource, resource->getType() == Resource::SVGDocument, resource.getType() == Resource::SVGDocument);
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.h b/third_party/WebKit/Source/core/fetch/FontResource.h index 6b8eb95a..27ceeb7 100644 --- a/third_party/WebKit/Source/core/fetch/FontResource.h +++ b/third_party/WebKit/Source/core/fetch/FontResource.h
@@ -31,7 +31,7 @@ #include "platform/Timer.h" #include "platform/fonts/FontOrientation.h" #include "platform/heap/Handle.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -84,7 +84,7 @@ enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; - std::unique_ptr<FontCustomPlatformData> m_fontData; + OwnPtr<FontCustomPlatformData> m_fontData; String m_otsParsingMessage; LoadLimitState m_loadLimitState; bool m_corsFailed;
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp index 9d49d11..827f4c9 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp +++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -39,7 +39,6 @@ #include "public/platform/WebCachePolicy.h" #include "wtf/CurrentTime.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -407,7 +406,7 @@ notifyObservers(); } -void ImageResource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT(!handle); ASSERT(!m_multipartParser);
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.h b/third_party/WebKit/Source/core/fetch/ImageResource.h index a0962d9..8ab5b6d1 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResource.h +++ b/third_party/WebKit/Source/core/fetch/ImageResource.h
@@ -32,7 +32,6 @@ #include "platform/graphics/ImageObserver.h" #include "platform/graphics/ImageOrientation.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -101,7 +100,7 @@ void appendData(const char*, size_t) override; void error(const ResourceError&) override; - void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void finish(double finishTime = 0.0) override; // For compatibility, images keep loading even if there are HTTP errors.
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp index 6754c1d..3224ca7 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp +++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -45,8 +45,6 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -110,10 +108,10 @@ private: ImageResourceTestMockFetchContext() - : m_runner(wrapUnique(new MockTaskRunner)) + : m_runner(adoptPtr(new MockTaskRunner)) { } - std::unique_ptr<MockTaskRunner> m_runner; + OwnPtr<MockTaskRunner> m_runner; }; TEST(ImageResourceTest, MultipartImage)
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp index f029b62..a66426a3 100644 --- a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp +++ b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
@@ -36,6 +36,7 @@ #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp index d6cfe576..37c225d 100644 --- a/third_party/WebKit/Source/core/fetch/RawResource.cpp +++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -31,7 +31,6 @@ #include "core/fetch/ResourceFetcher.h" #include "core/fetch/ResourceLoader.h" #include "platform/HTTPNames.h" -#include <memory> namespace blink { @@ -143,7 +142,7 @@ c->redirectBlocked(); } -void RawResource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void RawResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCode() == 304; Resource::responseReceived(response, nullptr);
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.h b/third_party/WebKit/Source/core/fetch/RawResource.h index a2328a2..84b7026 100644 --- a/third_party/WebKit/Source/core/fetch/RawResource.h +++ b/third_party/WebKit/Source/core/fetch/RawResource.h
@@ -27,8 +27,8 @@ #include "core/fetch/Resource.h" #include "core/fetch/ResourceClient.h" #include "public/platform/WebDataConsumerHandle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" -#include <memory> namespace blink { class FetchRequest; @@ -82,7 +82,7 @@ void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override; void willNotFollowRedirect() override; - void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void setSerializedCachedMetadata(const char*, size_t) override; void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; void didDownloadData(int) override; @@ -112,7 +112,7 @@ ResourceClientType getResourceClientType() const final { return RawResourceType; } virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { } - virtual void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) { } + virtual void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) { } virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { } virtual void dataReceived(Resource*, const char* /* data */, size_t /* length */) { } virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) { }
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp index 20b69e38..c481de0 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.cpp +++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -48,7 +48,6 @@ #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include <algorithm> -#include <memory> namespace blink { @@ -237,7 +236,7 @@ ResourceCallback(); void runTask(); - std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory; + OwnPtr<CancellableTaskFactory> m_callbackTaskFactory; HeapHashSet<Member<Resource>> m_resourcesWithPendingClients; }; @@ -568,7 +567,7 @@ return true; } -void Resource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle>) +void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle>) { m_responseTimestamp = currentTime(); if (m_preloadDiscoveryTime) {
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h index 36a1f2a..c524d3b 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.h +++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -37,8 +37,8 @@ #include "wtf/Allocator.h" #include "wtf/HashCountedSet.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -181,7 +181,7 @@ // already been made to not follow it. virtual void willNotFollowRedirect() {} - virtual void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>); + virtual void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>); void setResponse(const ResourceResponse&); const ResourceResponse& response() const { return m_response; }
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp index 2a8f5d8b..554ef07 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -52,7 +52,6 @@ #include "public/platform/WebURLRequest.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> using blink::WebURLRequest; @@ -293,7 +292,7 @@ if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_validatedURLs.contains(request.resourceRequest().url())) { // Resources loaded from memory cache should be reported the first time they're used. - std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.options().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource); + OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.options().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource); populateResourceTiming(info.get(), resource); info->clearLoadTimings(); info->setLoadFinishTime(info->initialTime()); @@ -308,9 +307,9 @@ m_validatedURLs.add(request.resourceRequest().url()); } -static std::unique_ptr<TracedValue> urlForTraceEvent(const KURL& url) +static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("url", url.getString()); return value; } @@ -525,7 +524,7 @@ void ResourceFetcher::resourceTimingReportTimerFired(Timer<ResourceFetcher>* timer) { ASSERT_UNUSED(timer, timer == &m_resourceTimingReportTimer); - Vector<std::unique_ptr<ResourceTimingInfo>> timingReports; + Vector<OwnPtr<ResourceTimingInfo>> timingReports; timingReports.swap(m_scheduledResourceTimingReports); for (const auto& timingInfo : timingReports) context().addResourceTiming(*timingInfo); @@ -610,7 +609,7 @@ return; bool isMainResource = resource->getType() == Resource::MainResource; - std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource); + OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource); if (resource->isCacheValidator()) { const AtomicString& timingAllowOrigin = resource->response().httpHeaderField(HTTPNames::Timing_Allow_Origin); @@ -912,7 +911,7 @@ DCHECK(!m_loaders.contains(resource->loader())); DCHECK(finishReason == DidFinishFirstPartInMultipart || !m_nonBlockingLoaders.contains(resource->loader())); - if (std::unique_ptr<ResourceTimingInfo> info = m_resourceTimingInfoMap.take(resource)) { + if (OwnPtr<ResourceTimingInfo> info = m_resourceTimingInfoMap.take(resource)) { if (resource->response().isHTTP() && resource->response().httpStatusCode() < 400) { populateResourceTiming(info.get(), resource); info->setLoadFinishTime(finishTime);
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h index faad67c..31a65ed 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h
@@ -42,7 +42,6 @@ #include "wtf/HashSet.h" #include "wtf/ListHashSet.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -190,10 +189,10 @@ Timer<ResourceFetcher> m_resourceTimingReportTimer; - using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, std::unique_ptr<ResourceTimingInfo>>; + using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, OwnPtr<ResourceTimingInfo>>; ResourceTimingInfoMap m_resourceTimingInfoMap; - Vector<std::unique_ptr<ResourceTimingInfo>> m_scheduledResourceTimingReports; + Vector<OwnPtr<ResourceTimingInfo>> m_scheduledResourceTimingReports; ResourceLoaderSet m_loaders; ResourceLoaderSet m_nonBlockingLoaders;
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp index b17a699..f230f79 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -46,8 +46,6 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -85,12 +83,12 @@ private: ResourceFetcherTestMockFetchContext() : m_policy(CachePolicyVerify) - , m_runner(wrapUnique(new MockTaskRunner)) + , m_runner(adoptPtr(new MockTaskRunner)) , m_complete(false) { } CachePolicy m_policy; - std::unique_ptr<MockTaskRunner> m_runner; + OwnPtr<MockTaskRunner> m_runner; bool m_complete; }; @@ -356,7 +354,7 @@ // No callbacks should be received except for the notifyFinished() // triggered by ResourceLoader::cancel(). void dataSent(Resource*, unsigned long long, unsigned long long) override { ASSERT_TRUE(false); } - void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override { ASSERT_TRUE(false); } + void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override { ASSERT_TRUE(false); } void setSerializedCachedMetadata(Resource*, const char*, size_t) override { ASSERT_TRUE(false); } void dataReceived(Resource*, const char*, size_t) override { ASSERT_TRUE(false); } void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) override { ASSERT_TRUE(false); }
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp index 2be163c8..4b28e5c 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
@@ -44,8 +44,6 @@ #include "public/platform/WebURLResponse.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -82,7 +80,7 @@ return; } - m_loader = wrapUnique(Platform::current()->createURLLoader()); + m_loader = adoptPtr(Platform::current()->createURLLoader()); m_loader->setDefersLoading(defersLoading); ASSERT(m_loader); m_loader->setLoadingTaskRunner(loadingTaskRunner); @@ -154,14 +152,14 @@ { ASSERT(!response.isNull()); // |rawHandle|'s ownership is transferred to the callee. - std::unique_ptr<WebDataConsumerHandle> handle = wrapUnique(rawHandle); + OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); const ResourceResponse& resourceResponse = response.toResourceResponse(); if (responseNeedsAccessControlCheck()) { if (response.wasFetchedViaServiceWorker()) { if (response.wasFallbackRequiredByServiceWorker()) { m_loader.reset(); - m_loader = wrapUnique(Platform::current()->createURLLoader()); + m_loader = adoptPtr(Platform::current()->createURLLoader()); ASSERT(m_loader); ResourceRequest request = m_resource->lastResourceRequest(); ASSERT(!request.skipServiceWorker());
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.h b/third_party/WebKit/Source/core/fetch/ResourceLoader.h index d8f6395..80eb85d 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.h +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.h
@@ -35,7 +35,6 @@ #include "public/platform/WebURLLoader.h" #include "public/platform/WebURLLoaderClient.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -88,7 +87,7 @@ bool responseNeedsAccessControlCheck() const; - std::unique_ptr<WebURLLoader> m_loader; + OwnPtr<WebURLLoader> m_loader; Member<ResourceFetcher> m_fetcher; Member<Resource> m_resource; };
diff --git a/third_party/WebKit/Source/core/fetch/TextResource.h b/third_party/WebKit/Source/core/fetch/TextResource.h index 075f241..a412f16 100644 --- a/third_party/WebKit/Source/core/fetch/TextResource.h +++ b/third_party/WebKit/Source/core/fetch/TextResource.h
@@ -7,7 +7,6 @@ #include "core/CoreExport.h" #include "core/fetch/Resource.h" -#include <memory> namespace blink { @@ -27,7 +26,7 @@ ~TextResource() override; private: - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/fileapi/Blob.cpp b/third_party/WebKit/Source/core/fileapi/Blob.cpp index 57c3b5f1a..22143b9 100644 --- a/third_party/WebKit/Source/core/fileapi/Blob.cpp +++ b/third_party/WebKit/Source/core/fileapi/Blob.cpp
@@ -38,7 +38,6 @@ #include "core/frame/UseCounter.h" #include "platform/blob/BlobRegistry.h" #include "platform/blob/BlobURL.h" -#include <memory> namespace blink { @@ -100,7 +99,7 @@ if (normalizeLineEndingsToNative) UseCounter::count(context, UseCounter::FileAPINativeLineEndings); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(options.type().lower()); populateBlobData(blobData.get(), blobParts, normalizeLineEndingsToNative); @@ -113,7 +112,7 @@ { ASSERT(data); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendBytes(data, bytes); long long blobSize = blobData->length(); @@ -178,7 +177,7 @@ clampSliceOffsets(size, start, end); long long length = end - start; - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendBlob(m_blobDataHandle, start, length); return Blob::create(BlobDataHandle::create(std::move(blobData), length)); @@ -200,7 +199,7 @@ // size as zero. Blob and FileReader operations now throws on // being passed a Blob in that state. Downstream uses of closed Blobs // (e.g., XHR.send()) consider them as empty. - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(type()); m_blobDataHandle = BlobDataHandle::create(std::move(blobData), 0); m_isClosed = true;
diff --git a/third_party/WebKit/Source/core/fileapi/File.cpp b/third_party/WebKit/Source/core/fileapi/File.cpp index e8f41f96..0270cca 100644 --- a/third_party/WebKit/Source/core/fileapi/File.cpp +++ b/third_party/WebKit/Source/core/fileapi/File.cpp
@@ -36,7 +36,6 @@ #include "public/platform/WebFileUtilities.h" #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" -#include <memory> namespace blink { @@ -55,35 +54,35 @@ return type; } -static std::unique_ptr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType) +static PassOwnPtr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendFile(path); return blobData; } -static std::unique_ptr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy) +static PassOwnPtr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy) { return createBlobDataForFileWithType(path, getContentTypeFromFileName(path, policy)); } -static std::unique_ptr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy) +static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy) { return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName, policy)); } -static std::unique_ptr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata) +static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes)); blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTime / msPerSecond); return blobData; } -static std::unique_ptr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSystemURL, const FileMetadata& metadata) +static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSystemURL, const FileMetadata& metadata) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), File::WellKnownContentTypes)); blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.modificationTime / msPerSecond); return blobData; @@ -108,7 +107,7 @@ if (normalizeLineEndingsToNative) UseCounter::count(context, UseCounter::FileAPINativeLineEndings); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(options.type().lower()); populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative); @@ -278,7 +277,7 @@ clampSliceOffsets(size, start, end); long long length = end - start; - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); if (!m_fileSystemURL.isEmpty()) { blobData->appendFileSystemURL(m_fileSystemURL, start, length, modificationTimeMS / msPerSecond);
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.h b/third_party/WebKit/Source/core/fileapi/FileReader.h index de7bee0d..945ef15 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReader.h +++ b/third_party/WebKit/Source/core/fileapi/FileReader.h
@@ -40,7 +40,6 @@ #include "core/fileapi/FileReaderLoaderClient.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -129,7 +128,7 @@ FileReaderLoader::ReadType m_readType; String m_encoding; - std::unique_ptr<FileReaderLoader> m_loader; + OwnPtr<FileReaderLoader> m_loader; Member<FileError> m_error; double m_lastProgressNotificationTimeMS; };
diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp index 92af972..18c91d8 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp +++ b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
@@ -43,13 +43,12 @@ #include "platform/network/ResourceRequest.h" #include "platform/network/ResourceResponse.h" #include "public/platform/WebURLRequest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -174,7 +173,7 @@ } } -void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); if (response.httpStatusCode() != 200) { @@ -212,9 +211,9 @@ } if (initialBufferLength < 0) - m_rawData = wrapUnique(new ArrayBufferBuilder()); + m_rawData = adoptPtr(new ArrayBufferBuilder()); else - m_rawData = wrapUnique(new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); + m_rawData = adoptPtr(new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); if (!m_rawData || !m_rawData->isValid()) { failed(FileError::NOT_READABLE_ERR);
diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h index 9d5f453..66060e0 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h +++ b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h
@@ -36,11 +36,10 @@ #include "core/loader/ThreadableLoaderClient.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferBuilder.h" -#include <memory> namespace blink { @@ -64,9 +63,9 @@ }; // If client is given, do the loading asynchronously. Otherwise, load synchronously. - static std::unique_ptr<FileReaderLoader> create(ReadType readType, FileReaderLoaderClient* client) + static PassOwnPtr<FileReaderLoader> create(ReadType readType, FileReaderLoaderClient* client) { - return wrapUnique(new FileReaderLoader(readType, client)); + return adoptPtr(new FileReaderLoader(readType, client)); } FileReaderLoader(ReadType, FileReaderLoaderClient*); @@ -77,7 +76,7 @@ void cancel(); // ThreadableLoaderClient - void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didReceiveData(const char*, unsigned) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; @@ -123,15 +122,15 @@ KURL m_urlForReading; bool m_urlForReadingIsStream; - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; - std::unique_ptr<ArrayBufferBuilder> m_rawData; + OwnPtr<ArrayBufferBuilder> m_rawData; bool m_isRawDataConverted; String m_stringResult; // The decoder used to decode the text data. - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; bool m_finishedLoading; long long m_bytesLoaded;
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.h b/third_party/WebKit/Source/core/frame/DOMTimer.h index 236e9297..ad00b44 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimer.h +++ b/third_party/WebKit/Source/core/frame/DOMTimer.h
@@ -32,6 +32,8 @@ #include "core/frame/SuspendableTimer.h" #include "platform/UserGestureIndicator.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp index e9311351..3f3460e6 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp +++ b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp
@@ -7,11 +7,10 @@ #include "core/dom/ExecutionContext.h" #include "core/frame/DOMTimer.h" #include <algorithm> -#include <memory> namespace blink { -DOMTimerCoordinator::DOMTimerCoordinator(std::unique_ptr<WebTaskRunner> timerTaskRunner) +DOMTimerCoordinator::DOMTimerCoordinator(PassOwnPtr<WebTaskRunner> timerTaskRunner) : m_circularSequentialID(0) , m_timerNestingLevel(0) , m_timerTaskRunner(std::move(timerTaskRunner)) @@ -62,7 +61,7 @@ } } -void DOMTimerCoordinator::setTimerTaskRunner(std::unique_ptr<WebTaskRunner> timerTaskRunner) +void DOMTimerCoordinator::setTimerTaskRunner(PassOwnPtr<WebTaskRunner> timerTaskRunner) { m_timerTaskRunner = std::move(timerTaskRunner); }
diff --git a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h index a431574..e3270fa 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h +++ b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h
@@ -7,7 +7,7 @@ #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -25,7 +25,7 @@ DISALLOW_NEW(); WTF_MAKE_NONCOPYABLE(DOMTimerCoordinator); public: - explicit DOMTimerCoordinator(std::unique_ptr<WebTaskRunner>); + explicit DOMTimerCoordinator(PassOwnPtr<WebTaskRunner>); // Creates and installs a new timer. Returns the assigned ID. int installNewTimeout(ExecutionContext*, ScheduledAction*, int timeout, bool singleShot); @@ -45,7 +45,7 @@ // deeper timer nesting level, see DOMTimer::DOMTimer. void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } - void setTimerTaskRunner(std::unique_ptr<WebTaskRunner>); + void setTimerTaskRunner(PassOwnPtr<WebTaskRunner>); WebTaskRunner* timerTaskRunner() const { return m_timerTaskRunner.get(); } @@ -59,7 +59,7 @@ int m_circularSequentialID; int m_timerNestingLevel; - std::unique_ptr<WebTaskRunner> m_timerTaskRunner; + OwnPtr<WebTaskRunner> m_timerTaskRunner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp index e871c8e..ef72b51 100644 --- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -29,7 +29,6 @@ #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/Suborigin.h" -#include <memory> namespace blink { @@ -198,7 +197,7 @@ } } - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(getExecutionContext(), ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(getExecutionContext(), ports, exceptionState); if (exceptionState.hadException()) return;
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp index c612285..833e9200 100644 --- a/third_party/WebKit/Source/core/frame/Frame.cpp +++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -31,8 +31,8 @@ #include "core/dom/DocumentType.h" #include "core/events/Event.h" -#include "core/frame/FrameHost.h" #include "core/frame/LocalDOMWindow.h" +#include "core/frame/FrameHost.h" #include "core/frame/Settings.h" #include "core/html/HTMLFrameElementBase.h" #include "core/input/EventHandler.h" @@ -45,6 +45,7 @@ #include "core/page/Page.h" #include "platform/Histogram.h" #include "platform/UserGestureIndicator.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/FrameConsole.cpp b/third_party/WebKit/Source/core/frame/FrameConsole.cpp index ab36bd3..2faacc3 100644 --- a/third_party/WebKit/Source/core/frame/FrameConsole.cpp +++ b/third_party/WebKit/Source/core/frame/FrameConsole.cpp
@@ -38,7 +38,6 @@ #include "platform/network/ResourceError.h" #include "platform/network/ResourceResponse.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -82,7 +81,7 @@ if (!frame().host()) return; if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(), url)) { - std::unique_ptr<SourceLocation> location = SourceLocation::captureWithFullStackTrace(); + OwnPtr<SourceLocation> location = SourceLocation::captureWithFullStackTrace(); if (!location->isUnknown()) stackTrace = location->toString(); }
diff --git a/third_party/WebKit/Source/core/frame/FrameConsole.h b/third_party/WebKit/Source/core/frame/FrameConsole.h index e3797ad..7024c16 100644 --- a/third_party/WebKit/Source/core/frame/FrameConsole.h +++ b/third_party/WebKit/Source/core/frame/FrameConsole.h
@@ -33,6 +33,7 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.h b/third_party/WebKit/Source/core/frame/FrameHost.h index 1a44fcc..b3685b97 100644 --- a/third_party/WebKit/Source/core/frame/FrameHost.h +++ b/third_party/WebKit/Source/core/frame/FrameHost.h
@@ -35,8 +35,9 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -139,7 +140,7 @@ const Member<Page> m_page; const Member<TopControls> m_topControls; - const std::unique_ptr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; + const OwnPtr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; const Member<VisualViewport> m_visualViewport; const Member<OverscrollController> m_overscrollController; const Member<EventHandlerRegistry> m_eventHandlerRegistry;
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp index a8626c6..9babd85 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -63,6 +63,7 @@ #include "platform/graphics/Image.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextEncoding.h"
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index c6270646..ad346da 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -108,10 +108,8 @@ #include "public/platform/WebDisplayItemList.h" #include "public/platform/WebFrameScheduler.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/TemporaryChange.h" -#include <memory> namespace blink { @@ -222,7 +220,7 @@ m_safeToPropagateScrollToParent = true; m_lastViewportSize = IntSize(); m_lastZoomFactor = 1.0f; - m_trackedObjectPaintInvalidations = wrapUnique(s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); + m_trackedObjectPaintInvalidations = adoptPtr(s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); m_visuallyNonEmptyCharacterCount = 0; m_visuallyNonEmptyPixelCount = 0; m_isVisuallyNonEmpty = false; @@ -837,15 +835,15 @@ return; } if (!m_analyzer) - m_analyzer = wrapUnique(new LayoutAnalyzer()); + m_analyzer = adoptPtr(new LayoutAnalyzer()); m_analyzer->reset(); } -std::unique_ptr<TracedValue> FrameView::analyzerCounters() +PassOwnPtr<TracedValue> FrameView::analyzerCounters() { if (!m_analyzer) return TracedValue::create(); - std::unique_ptr<TracedValue> value = m_analyzer->toTracedValue(); + OwnPtr<TracedValue> value = m_analyzer->toTracedValue(); value->setString("host", layoutViewItem().document().location()->host()); value->setString("frame", String::format("0x%" PRIxPTR, reinterpret_cast<uintptr_t>(m_frame.get()))); value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect().height()); @@ -1309,7 +1307,7 @@ void FrameView::addViewportConstrainedObject(LayoutObject* object) { if (!m_viewportConstrainedObjects) - m_viewportConstrainedObjects = wrapUnique(new ViewportConstrainedObjectSet); + m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet); if (!m_viewportConstrainedObjects->contains(object)) { m_viewportConstrainedObjects->add(object); @@ -2945,7 +2943,7 @@ if (!frame->isLocalFrame()) continue; if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem()) { - layoutView.frameView()->m_trackedObjectPaintInvalidations = wrapUnique(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); + layoutView.frameView()->m_trackedObjectPaintInvalidations = adoptPtr(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); layoutView.compositor()->setTracksPaintInvalidations(trackPaintInvalidations); } } @@ -2981,7 +2979,7 @@ void FrameView::addResizerArea(LayoutBox& resizerBox) { if (!m_resizerAreas) - m_resizerAreas = wrapUnique(new ResizerAreaSet); + m_resizerAreas = adoptPtr(new ResizerAreaSet); m_resizerAreas->add(&resizerBox); }
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h index a3d645e..ce1d5d8 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.h +++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -49,9 +49,9 @@ #include "wtf/Forward.h" #include "wtf/HashSet.h" #include "wtf/ListHashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/TemporaryChange.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -758,7 +758,7 @@ ScrollingCoordinator* scrollingCoordinator() const; void prepareLayoutAnalyzer(); - std::unique_ptr<TracedValue> analyzerCounters(); + PassOwnPtr<TracedValue> analyzerCounters(); // LayoutObject for the viewport-defining element (see Document::viewportDefiningElement). LayoutObject* viewportLayoutObject(); @@ -810,7 +810,7 @@ unsigned m_nestedLayoutCount; Timer<FrameView> m_postLayoutTasksTimer; Timer<FrameView> m_updateWidgetsTimer; - std::unique_ptr<CancellableTaskFactory> m_renderThrottlingObserverNotificationFactory; + OwnPtr<CancellableTaskFactory> m_renderThrottlingObserverNotificationFactory; bool m_firstLayout; bool m_isTransparent; @@ -834,8 +834,8 @@ Member<ScrollableAreaSet> m_scrollableAreas; Member<ScrollableAreaSet> m_animatingScrollableAreas; - std::unique_ptr<ResizerAreaSet> m_resizerAreas; - std::unique_ptr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; + OwnPtr<ResizerAreaSet> m_resizerAreas; + OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; unsigned m_stickyPositionObjectCount; ViewportConstrainedObjectSet m_backgroundAttachmentFixedObjects; Member<FrameViewAutoSizeInfo> m_autoSizeInfo; @@ -880,7 +880,7 @@ bool m_inUpdateScrollbars; - std::unique_ptr<LayoutAnalyzer> m_analyzer; + OwnPtr<LayoutAnalyzer> m_analyzer; // Mark if something has changed in the mapping from Frame to GraphicsLayer // and the Frame Timing regions should be recalculated. @@ -926,7 +926,7 @@ String name; PaintInvalidationReason reason; }; - std::unique_ptr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalidations; + OwnPtr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalidations; }; inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp index f567725..c4024cd 100644 --- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -17,7 +17,7 @@ #include "platform/heap/Handle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> +#include "wtf/OwnPtr.h" using testing::_; using testing::AnyNumber; @@ -63,7 +63,7 @@ private: Persistent<MockChromeClient> m_chromeClient; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; class FrameViewTest : public FrameViewTestBase {
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp index 5eb9d50a..94b7e8b7 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -11,9 +11,7 @@ #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -35,16 +33,16 @@ return frameBitmap.colorType() == kN32_SkColorType; } -static std::unique_ptr<uint8_t[]> copySkImageData(SkImage* input, const SkImageInfo& info) +static PassOwnPtr<uint8_t[]> copySkImageData(SkImage* input, const SkImageInfo& info) { - std::unique_ptr<uint8_t[]> dstPixels = wrapArrayUnique(new uint8_t[input->width() * input->height() * info.bytesPerPixel()]); + OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[input->width() * input->height() * info.bytesPerPixel()]); input->readPixels(info, dstPixels.get(), input->width() * info.bytesPerPixel(), 0, 0); return dstPixels; } -static PassRefPtr<SkImage> newSkImageFromRaster(const SkImageInfo& info, std::unique_ptr<uint8_t[]> imagePixels, int imageRowBytes) +static PassRefPtr<SkImage> newSkImageFromRaster(const SkImageInfo& info, PassOwnPtr<uint8_t[]> imagePixels, int imageRowBytes) { - return fromSkSp(SkImage::MakeFromRaster(SkPixmap(info, imagePixels.release(), imageRowBytes), + return fromSkSp(SkImage::MakeFromRaster(SkPixmap(info, imagePixels.leakPtr(), imageRowBytes), [](const void* pixels, void*) { delete[] static_cast<const uint8_t*>(pixels); @@ -76,7 +74,7 @@ int height = input->height(); SkImageInfo info = SkImageInfo::MakeN32(width, height, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType); int imageRowBytes = width * info.bytesPerPixel(); - std::unique_ptr<uint8_t[]> imagePixels = copySkImageData(input, info); + OwnPtr<uint8_t[]> imagePixels = copySkImageData(input, info); for (int i = 0; i < height / 2; i++) { int topFirstElement = i * imageRowBytes; int topLastElement = (i + 1) * imageRowBytes; @@ -89,18 +87,18 @@ static PassRefPtr<SkImage> premulSkImageToUnPremul(SkImage* input) { SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_SkColorType, kUnpremul_SkAlphaType); - std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(input, info); + OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); return newSkImageFromRaster(info, std::move(dstPixels), input->width() * info.bytesPerPixel()); } static PassRefPtr<SkImage> unPremulSkImageToPremul(SkImage* input) { SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_SkColorType, kPremul_SkAlphaType); - std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(input, info); + OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); return newSkImageFromRaster(info, std::move(dstPixels), input->width() * info.bytesPerPixel()); } -PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(std::unique_ptr<ImageDecoder> decoder) +PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(PassOwnPtr<ImageDecoder> decoder) { if (!decoder->frameCount()) return nullptr; @@ -128,14 +126,14 @@ // We immediately return a transparent black image with cropRect.size() if (srcRect.isEmpty() && !premultiplyAlpha) { SkImageInfo info = SkImageInfo::Make(cropRect.width(), cropRect.height(), kN32_SkColorType, kUnpremul_SkAlphaType); - std::unique_ptr<uint8_t[]> dstPixels = wrapArrayUnique(new uint8_t[cropRect.width() * cropRect.height() * info.bytesPerPixel()]()); + OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[cropRect.width() * cropRect.height() * info.bytesPerPixel()]()); return StaticBitmapImage::create(newSkImageFromRaster(info, std::move(dstPixels), cropRect.width() * info.bytesPerPixel())); } RefPtr<SkImage> skiaImage = image->imageForCurrentFrame(); // Attempt to get raw unpremultiplied image data, executed only when skiaImage is premultiplied. if ((((!premultiplyAlpha && !skiaImage->isOpaque()) || !skiaImage) && image->data() && imageFormat == PremultiplyAlpha) || colorSpaceOp == ImageDecoder::GammaAndColorProfileIgnored) { - std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*(image->data()), + OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*(image->data()), premultiplyAlpha ? ImageDecoder::AlphaPremultiplied : ImageDecoder::AlphaNotPremultiplied, colorSpaceOp)); if (!decoder) @@ -216,7 +214,7 @@ IntRect videoRect = IntRect(IntPoint(), playerSize); IntRect srcRect = intersection(cropRect, videoRect); - std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); if (!buffer) return; @@ -285,7 +283,7 @@ // restore the original ImageData swizzleImageData(srcAddr, srcHeight, srcPixelBytesPerRow, flipY); } else { - std::unique_ptr<uint8_t[]> copiedDataBuffer = wrapArrayUnique(new uint8_t[dstHeight * dstPixelBytesPerRow]()); + OwnPtr<uint8_t[]> copiedDataBuffer = adoptArrayPtr(new uint8_t[dstHeight * dstPixelBytesPerRow]()); if (!srcRect.isEmpty()) { IntPoint srcPoint = IntPoint((cropRect.x() > 0) ? cropRect.x() : 0, (cropRect.y() > 0) ? cropRect.y() : 0); IntPoint dstPoint = IntPoint((cropRect.x() >= 0) ? 0 : -cropRect.x(), (cropRect.y() >= 0) ? 0 : -cropRect.y()); @@ -319,7 +317,7 @@ return; } - std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); if (!buffer) return; @@ -445,10 +443,10 @@ return ImageBitmap::create(StaticBitmapImage::create(fromSkSp(image))); } -std::unique_ptr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp) +PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp) { SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType); - std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame().get(), info); + OwnPtr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame().get(), info); return dstPixels; }
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.h b/third_party/WebKit/Source/core/frame/ImageBitmap.h index 102232a..71aba7f 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.h +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.h
@@ -17,7 +17,6 @@ #include "platform/graphics/StaticBitmapImage.h" #include "platform/heap/Handle.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -42,14 +41,14 @@ static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions()); static ImageBitmap* create(WebExternalTextureMailbox&); - static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecoder>); + static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); // Type and helper function required by CallbackPromiseAdapter: using WebType = sk_sp<SkImage>; static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } - std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremultiplyAlpha); + PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremultiplyAlpha); unsigned long width() const; unsigned long height() const; IntSize size() const;
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp index 6027353..274315b 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -45,6 +45,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp index b8654e6..20a01b9 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -78,7 +78,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebScreenInfo.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -127,7 +127,7 @@ class PostMessageTimer final : public GarbageCollectedFinalized<PostMessageTimer>, public SuspendableTimer { USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer); public: - PostMessageTimer(LocalDOMWindow& window, MessageEvent* event, PassRefPtr<SecurityOrigin> targetOrigin, std::unique_ptr<SourceLocation> location, UserGestureToken* userGestureToken) + PostMessageTimer(LocalDOMWindow& window, MessageEvent* event, PassRefPtr<SecurityOrigin> targetOrigin, PassOwnPtr<SourceLocation> location, UserGestureToken* userGestureToken) : SuspendableTimer(window.document()) , m_event(event) , m_window(&window) @@ -141,7 +141,7 @@ MessageEvent* event() const { return m_event; } SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } - std::unique_ptr<SourceLocation> takeLocation() { return std::move(m_location); } + PassOwnPtr<SourceLocation> takeLocation() { return std::move(m_location); } UserGestureToken* userGestureToken() const { return m_userGestureToken.get(); } void stop() override { @@ -184,7 +184,7 @@ Member<MessageEvent> m_event; Member<LocalDOMWindow> m_window; RefPtr<SecurityOrigin> m_targetOrigin; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; RefPtr<UserGestureToken> m_userGestureToken; bool m_disposalAllowed; }; @@ -695,7 +695,7 @@ m_postMessageTimers.remove(timer); } -void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event* event, std::unique_ptr<SourceLocation> location) +void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event* event, PassOwnPtr<SourceLocation> location) { if (intendedTargetOrigin) { // Check target origin now since the target document may have changed since the timer was scheduled.
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.h b/third_party/WebKit/Source/core/frame/LocalDOMWindow.h index 00c57bb..87e5acdf 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.h +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.h
@@ -36,9 +36,9 @@ #include "core/frame/LocalFrameLifecycleObserver.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" + #include "wtf/Assertions.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -170,7 +170,7 @@ void postMessageTimerFired(PostMessageTimer*); void removePostMessageTimer(PostMessageTimer*); - void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event*, std::unique_ptr<SourceLocation>); + void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event*, PassOwnPtr<SourceLocation>); // Events // EventTarget API
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 8bb45280b..8c25729a 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -86,9 +86,8 @@ #include "public/platform/WebScreenInfo.h" #include "public/platform/WebViewScheduler.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -115,7 +114,7 @@ m_bounds.setWidth(m_bounds.width() * deviceScaleFactor); m_bounds.setHeight(m_bounds.height() * deviceScaleFactor); - m_pictureBuilder = wrapUnique(new SkPictureBuilder(SkRect::MakeIWH(m_bounds.width(), m_bounds.height()))); + m_pictureBuilder = adoptPtr(new SkPictureBuilder(SkRect::MakeIWH(m_bounds.width(), m_bounds.height()))); AffineTransform transform; transform.scale(deviceScaleFactor, deviceScaleFactor); @@ -125,7 +124,7 @@ GraphicsContext& context() { return m_pictureBuilder->context(); } - std::unique_ptr<DragImage> createImage() + PassOwnPtr<DragImage> createImage() { if (m_draggedNode && m_draggedNode->layoutObject()) m_draggedNode->layoutObject()->updateDragState(false); @@ -149,7 +148,7 @@ Member<Node> m_draggedNode; FloatRect m_bounds; float m_opacity; - std::unique_ptr<SkPictureBuilder> m_pictureBuilder; + OwnPtr<SkPictureBuilder> m_pictureBuilder; }; inline float parentPageZoomFactor(LocalFrame* frame) @@ -596,7 +595,7 @@ return ratio; } -std::unique_ptr<DragImage> LocalFrame::nodeImage(Node& node) +PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) { m_view->updateAllLifecyclePhasesExceptPaint(); LayoutObject* layoutObject = node.layoutObject(); @@ -620,7 +619,7 @@ return dragImageBuilder.createImage(); } -std::unique_ptr<DragImage> LocalFrame::dragImageForSelection(float opacity) +PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) { if (!selection().isRange()) return nullptr;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h index 2165cca6..7c5a2f34 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.h +++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -41,7 +41,6 @@ #include "platform/heap/Handle.h" #include "platform/scroll/ScrollTypes.h" #include "wtf/HashSet.h" -#include <memory> namespace blink { @@ -155,8 +154,8 @@ void deviceScaleFactorChanged(); double devicePixelRatio() const; - std::unique_ptr<DragImage> nodeImage(Node&); - std::unique_ptr<DragImage> dragImageForSelection(float opacity); + PassOwnPtr<DragImage> nodeImage(Node&); + PassOwnPtr<DragImage> dragImageForSelection(float opacity); String selectedText() const; String selectedTextForClipboard() const; @@ -213,7 +212,7 @@ const Member<EventHandler> m_eventHandler; const Member<FrameConsole> m_console; const Member<InputMethodController> m_inputMethodController; - std::unique_ptr<WebFrameScheduler> m_frameScheduler; + OwnPtr<WebFrameScheduler> m_frameScheduler; int m_navigationDisableCount;
diff --git a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h index 9dd45f92..7104d6d 100644 --- a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h +++ b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h
@@ -37,8 +37,7 @@ #include "platform/Length.h" #include "platform/geometry/IntSize.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -47,9 +46,9 @@ class CORE_EXPORT PageScaleConstraintsSet { USING_FAST_MALLOC(PageScaleConstraintsSet); public: - static std::unique_ptr<PageScaleConstraintsSet> create() + static PassOwnPtr<PageScaleConstraintsSet> create() { - return wrapUnique(new PageScaleConstraintsSet); + return adoptPtr(new PageScaleConstraintsSet); } void setDefaultConstraints(const PageScaleConstraints&);
diff --git a/third_party/WebKit/Source/core/frame/Settings.cpp b/third_party/WebKit/Source/core/frame/Settings.cpp index 066ba97..7ba6251f 100644 --- a/third_party/WebKit/Source/core/frame/Settings.cpp +++ b/third_party/WebKit/Source/core/frame/Settings.cpp
@@ -27,8 +27,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollbarTheme.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -70,9 +68,9 @@ { } -std::unique_ptr<Settings> Settings::create() +PassOwnPtr<Settings> Settings::create() { - return wrapUnique(new Settings); + return adoptPtr(new Settings); } SETTINGS_SETTER_BODIES
diff --git a/third_party/WebKit/Source/core/frame/Settings.h b/third_party/WebKit/Source/core/frame/Settings.h index 8b909e3..6ab18c6 100644 --- a/third_party/WebKit/Source/core/frame/Settings.h +++ b/third_party/WebKit/Source/core/frame/Settings.h
@@ -44,7 +44,6 @@ #include "public/platform/PointerProperties.h" #include "public/platform/WebDisplayMode.h" #include "public/platform/WebViewportStyle.h" -#include <memory> namespace blink { @@ -52,7 +51,7 @@ WTF_MAKE_NONCOPYABLE(Settings); USING_FAST_MALLOC(Settings); public: - static std::unique_ptr<Settings> create(); + static PassOwnPtr<Settings> create(); GenericFontFamilySettings& genericFontFamilySettings() { return m_genericFontFamilySettings; } void notifyGenericFontFamilyChange() { invalidate(SettingsDelegate::FontFamilyChange); }
diff --git a/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp b/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp index 1b7c221..71236be 100644 --- a/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp +++ b/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp
@@ -31,11 +31,10 @@ #include "core/frame/SettingsDelegate.h" #include "core/frame/Settings.h" -#include <memory> namespace blink { -SettingsDelegate::SettingsDelegate(std::unique_ptr<Settings> settings) +SettingsDelegate::SettingsDelegate(PassOwnPtr<Settings> settings) : m_settings(std::move(settings)) { if (m_settings)
diff --git a/third_party/WebKit/Source/core/frame/SettingsDelegate.h b/third_party/WebKit/Source/core/frame/SettingsDelegate.h index 4b37ff97..561cfa7 100644 --- a/third_party/WebKit/Source/core/frame/SettingsDelegate.h +++ b/third_party/WebKit/Source/core/frame/SettingsDelegate.h
@@ -33,7 +33,8 @@ #include "core/CoreExport.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -42,7 +43,7 @@ class CORE_EXPORT SettingsDelegate { DISALLOW_NEW(); public: - explicit SettingsDelegate(std::unique_ptr<Settings>); + explicit SettingsDelegate(PassOwnPtr<Settings>); virtual ~SettingsDelegate(); Settings* settings() const { return m_settings.get(); } @@ -66,7 +67,7 @@ virtual void settingsChanged(ChangeType) = 0; protected: - std::unique_ptr<Settings> const m_settings; + OwnPtr<Settings> const m_settings; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/TopControls.h b/third_party/WebKit/Source/core/frame/TopControls.h index e6cef92..49dd9ee 100644 --- a/third_party/WebKit/Source/core/frame/TopControls.h +++ b/third_party/WebKit/Source/core/frame/TopControls.h
@@ -8,6 +8,8 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "public/platform/WebTopControlsState.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { class FrameHost;
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index a75982d..9f27be2 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -31,6 +31,8 @@ #include "core/css/parser/CSSParserMode.h" #include "wtf/BitVector.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp index 85c73df4..cd08431 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp +++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -55,7 +55,6 @@ #include "public/platform/WebLayerTreeView.h" #include "public/platform/WebScrollbar.h" #include "public/platform/WebScrollbarLayer.h" -#include <memory> using blink::WebLayer; using blink::WebLayerTreeView; @@ -376,7 +375,7 @@ return; } - if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_innerViewportScrollLayer.get()) + if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_innerViewportScrollLayer) return; if (!m_innerViewportScrollLayer) { @@ -448,7 +447,7 @@ bool isHorizontal = orientation == WebScrollbar::Horizontal; GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); - std::unique_ptr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? + OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::mobileTheme(); @@ -833,7 +832,7 @@ name = "Overlay Scrollbar Horizontal Layer"; } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { name = "Overlay Scrollbar Vertical Layer"; - } else if (graphicsLayer == m_rootTransformLayer.get()) { + } else if (graphicsLayer == m_rootTransformLayer) { name = "Root Transform Layer"; } else { ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.h b/third_party/WebKit/Source/core/frame/VisualViewport.h index 58b3d7b9..d15d234 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.h +++ b/third_party/WebKit/Source/core/frame/VisualViewport.h
@@ -40,7 +40,8 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/WebScrollbar.h" #include "public/platform/WebSize.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { class WebLayerTreeView; @@ -247,15 +248,15 @@ } Member<FrameHost> m_frameHost; - std::unique_ptr<GraphicsLayer> m_rootTransformLayer; - std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer; - std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer; - std::unique_ptr<GraphicsLayer> m_pageScaleLayer; - std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer; - std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal; - std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical; - std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; - std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical; + OwnPtr<GraphicsLayer> m_rootTransformLayer; + OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; + OwnPtr<GraphicsLayer> m_overscrollElasticityLayer; + OwnPtr<GraphicsLayer> m_pageScaleLayer; + OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; + OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; + OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; + OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; + OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarVertical; // Offset of the visual viewport from the main frame's origin, in CSS pixels. FloatPoint m_offset;
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h index 3b611112..257ccb0 100644 --- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h +++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
@@ -15,6 +15,7 @@ #include "platform/network/ResourceRequest.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/ReferrerPolicy.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp index 643530e..3f0944bf 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -60,11 +60,9 @@ #include "public/platform/Platform.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" -#include "wtf/PtrUtil.h" #include "wtf/StringHasher.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringUTF8Adaptor.h" -#include <memory> namespace blink { @@ -345,9 +343,9 @@ m_selfSource = new CSPSource(this, m_selfProtocol, origin->host(), origin->port(), String(), CSPSource::NoWildcard, CSPSource::NoWildcard); } -std::unique_ptr<Vector<CSPHeaderAndType>> ContentSecurityPolicy::headers() const +PassOwnPtr<Vector<CSPHeaderAndType>> ContentSecurityPolicy::headers() const { - std::unique_ptr<Vector<CSPHeaderAndType>> headers = wrapUnique(new Vector<CSPHeaderAndType>); + OwnPtr<Vector<CSPHeaderAndType>> headers = adoptPtr(new Vector<CSPHeaderAndType>); for (const auto& policy : m_policies) { CSPHeaderAndType headerAndType(policy->header(), policy->headerType()); headers->append(headerAndType); @@ -810,7 +808,7 @@ if (!SecurityOrigin::isSecure(document->url()) && document->loader()) init.setStatusCode(document->loader()->response().httpStatusCode()); - std::unique_ptr<SourceLocation> location = SourceLocation::capture(document); + OwnPtr<SourceLocation> location = SourceLocation::capture(document); if (location->lineNumber()) { KURL source = KURL(ParsedURLString, location->url()); init.setSourceFile(stripURLForUseInReport(document, source, redirectStatus));
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h index 9c4eceb0..88554042 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h
@@ -39,11 +39,11 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringHash.h" #include "wtf/text/TextPosition.h" #include "wtf/text/WTFString.h" -#include <memory> #include <utility> namespace WTF { @@ -148,7 +148,7 @@ void addPolicyFromHeaderValue(const String&, ContentSecurityPolicyHeaderType, ContentSecurityPolicyHeaderSource); void reportAccumulatedHeaders(FrameLoaderClient*) const; - std::unique_ptr<Vector<CSPHeaderAndType>> headers() const; + PassOwnPtr<Vector<CSPHeaderAndType>> headers() const; bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; bool allowInlineEventHandler(const String& source, const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
diff --git a/third_party/WebKit/Source/core/html/ClassList.cpp b/third_party/WebKit/Source/core/html/ClassList.cpp index 8637d0a..1637c65 100644 --- a/third_party/WebKit/Source/core/html/ClassList.cpp +++ b/third_party/WebKit/Source/core/html/ClassList.cpp
@@ -25,7 +25,6 @@ #include "core/html/ClassList.h" #include "core/dom/Document.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -55,7 +54,7 @@ ASSERT(m_element->hasClass()); if (m_element->document().inQuirksMode()) { if (!m_classNamesForQuirksMode) - m_classNamesForQuirksMode = wrapUnique(new SpaceSplitString(value(), SpaceSplitString::ShouldNotFoldCase)); + m_classNamesForQuirksMode = adoptPtr(new SpaceSplitString(value(), SpaceSplitString::ShouldNotFoldCase)); return *m_classNamesForQuirksMode.get(); } return m_element->classNames();
diff --git a/third_party/WebKit/Source/core/html/ClassList.h b/third_party/WebKit/Source/core/html/ClassList.h index 9656909..1ee73c4 100644 --- a/third_party/WebKit/Source/core/html/ClassList.h +++ b/third_party/WebKit/Source/core/html/ClassList.h
@@ -29,7 +29,7 @@ #include "core/dom/DOMTokenList.h" #include "core/dom/Element.h" #include "core/dom/SpaceSplitString.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -64,7 +64,7 @@ void setValue(const AtomicString& value) override { m_element->setAttribute(HTMLNames::classAttr, value); } Member<Element> m_element; - mutable std::unique_ptr<SpaceSplitString> m_classNamesForQuirksMode; + mutable OwnPtr<SpaceSplitString> m_classNamesForQuirksMode; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp index 7e72fd17..f9f7872b 100644 --- a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
@@ -30,7 +30,6 @@ #include "core/layout/LayoutImage.h" #include "platform/graphics/Path.h" #include "platform/transforms/AffineTransform.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -166,7 +165,7 @@ } // Cache the original path, not depending on containerObject. - m_path = wrapUnique(new Path(path)); + m_path = adoptPtr(new Path(path)); } // Zoom the path into coordinates of the container object.
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.h b/third_party/WebKit/Source/core/html/HTMLAreaElement.h index c92e20c..1a85d80ed 100644 --- a/third_party/WebKit/Source/core/html/HTMLAreaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.h
@@ -26,7 +26,6 @@ #include "core/CoreExport.h" #include "core/html/HTMLAnchorElement.h" #include "platform/geometry/LayoutRect.h" -#include <memory> namespace blink { @@ -68,7 +67,7 @@ enum Shape { Default, Poly, Rect, Circle }; void invalidateCachedPath(); - mutable std::unique_ptr<Path> m_path; + mutable OwnPtr<Path> m_path; Vector<double> m_coords; Shape m_shape; };
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index ca982ba..5df9847 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -68,9 +68,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" #include "wtf/CheckedNumeric.h" -#include "wtf/PtrUtil.h" #include <math.h> -#include <memory> #include <v8.h> namespace blink { @@ -210,7 +208,7 @@ return renderingContextFactories()[type].get(); } -void HTMLCanvasElement::registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory> renderingContextFactory) +void HTMLCanvasElement::registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory> renderingContextFactory) { CanvasRenderingContext::ContextType type = renderingContextFactory->getContextType(); DCHECK(type < CanvasRenderingContext::ContextTypeCount); @@ -771,9 +769,9 @@ class UnacceleratedSurfaceFactory : public RecordingImageBufferFallbackSurfaceFactory { public: - virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) + virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) { - return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode)); + return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode)); } virtual ~UnacceleratedSurfaceFactory() { } @@ -790,7 +788,7 @@ return true; } -std::unique_ptr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) +PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) { OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; @@ -799,13 +797,13 @@ // If 3d, but the use of the canvas will be for non-accelerated content // then make a non-accelerated ImageBuffer. This means copying the internal // Image will require a pixel readback, but that is unavoidable in this case. - return wrapUnique(new AcceleratedImageBufferSurface(deviceSize, opacityMode)); + return adoptPtr(new AcceleratedImageBufferSurface(deviceSize, opacityMode)); } if (shouldAccelerate(deviceSize)) { if (document().settings()) *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASampleCount(); - std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new Canvas2DImageBufferSurface(deviceSize, *msaaSampleCount, opacityMode, Canvas2DLayerBridge::EnableAcceleration)); + OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSurface(deviceSize, *msaaSampleCount, opacityMode, Canvas2DLayerBridge::EnableAcceleration)); if (surface->isValid()) { CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvasImageBufferCreated); return surface; @@ -813,15 +811,15 @@ CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvasImageBufferCreationFailed); } - std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = wrapUnique(new UnacceleratedSurfaceFactory()); + OwnPtr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); if (shouldUseDisplayList(deviceSize)) { - std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(deviceSize, std::move(surfaceFactory), opacityMode)); + OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(deviceSize, std::move(surfaceFactory), opacityMode)); if (surface->isValid()) { CanvasMetrics::countCanvasContextUsage(CanvasMetrics::DisplayList2DCanvasImageBufferCreated); return surface; } - surfaceFactory = wrapUnique(new UnacceleratedSurfaceFactory()); // recreate because previous one was released + surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreate because previous one was released } auto surface = surfaceFactory->createSurface(deviceSize, opacityMode); if (!surface->isValid()) { @@ -839,7 +837,7 @@ m_context->loseContext(CanvasRenderingContext::SyntheticLostContext); } -void HTMLCanvasElement::createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalSurface) +void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface) { DCHECK(!m_imageBuffer); @@ -850,7 +848,7 @@ return; int msaaSampleCount = 0; - std::unique_ptr<ImageBufferSurface> surface; + OwnPtr<ImageBufferSurface> surface; if (externalSurface) { surface = std::move(externalSurface); } else { @@ -959,7 +957,7 @@ return m_imageBuffer.get(); } -void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(std::unique_ptr<ImageBufferSurface> surface) +void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface> surface) { discardImageBuffer(); setWidth(surface->size().width()); @@ -1186,7 +1184,7 @@ void HTMLCanvasElement::createSurfaceLayerBridge() { - m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge()); + m_surfaceLayerBridge = adoptPtr(new CanvasSurfaceLayerBridge()); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h index 7ba4aa0..cb6c241 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
@@ -46,7 +46,6 @@ #include "platform/graphics/GraphicsTypes3D.h" #include "platform/graphics/ImageBufferClient.h" #include "platform/heap/Handle.h" -#include <memory> #define CanvasDefaultInterpolationQuality InterpolationLow @@ -186,9 +185,9 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); - void createImageBufferUsingSurfaceForTesting(std::unique_ptr<ImageBufferSurface>); + void createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface>); - static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory>); + static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory>); void updateExternallyAllocatedMemory() const; void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newStyle); @@ -213,7 +212,7 @@ explicit HTMLCanvasElement(Document&); void dispose(); - using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFactory>>; + using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; static ContextFactoryVector& renderingContextFactories(); static CanvasRenderingContextFactory* getRenderingContextFactory(int); @@ -223,9 +222,9 @@ void reset(); - std::unique_ptr<ImageBufferSurface> createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount); + PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount); void createImageBuffer(); - void createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalSurface); + void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface); bool shouldUseDisplayList(const IntSize& deviceSize); void setSurfaceSize(const IntSize&); @@ -253,12 +252,12 @@ // after the first attempt failed. mutable bool m_didFailToCreateImageBuffer; bool m_imageBufferIsClear; - std::unique_ptr<ImageBuffer> m_imageBuffer; + OwnPtr<ImageBuffer> m_imageBuffer; mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue). // Used for OffscreenCanvas that controls this HTML canvas element - std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; + OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp index 1f9acf5e..f4c621c 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp
@@ -11,7 +11,6 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -23,7 +22,7 @@ HTMLDocument& document() const { return *m_document; } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.h b/third_party/WebKit/Source/core/html/HTMLFormElement.h index df92148..53feb7a0 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormElement.h +++ b/third_party/WebKit/Source/core/html/HTMLFormElement.h
@@ -29,6 +29,7 @@ #include "core/html/HTMLFormControlElement.h" #include "core/html/forms/RadioButtonGroupScope.h" #include "core/loader/FormSubmission.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp index 76e70be..551499de 100644 --- a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
@@ -8,7 +8,6 @@ #include "core/frame/FrameView.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ { } - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(HTMLImageElementTest, width)
diff --git a/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp b/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp index 843cb92..8e367eb6 100644 --- a/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp +++ b/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp
@@ -16,6 +16,7 @@ #include "core/html/HTMLImageLoader.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLStyleElement.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp index bb5c667..a5bc1375 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
@@ -10,7 +10,6 @@ #include "core/html/HTMLHtmlElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -37,7 +36,7 @@ toHTMLBodyElement(html->firstChild())->setInnerHTML("<input type='range' />", ASSERT_NO_EXCEPTION); documentWithoutFrame->appendChild(html); - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); auto& document = pageHolder->document(); EXPECT_NE(nullptr, document.frameHost());
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index 76a40bc..bd1dc1d 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -91,7 +91,6 @@ #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" #include "wtf/CurrentTime.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include <limits> @@ -3613,7 +3612,7 @@ void HTMLMediaElement::mediaSourceOpened(WebMediaSource* webMediaSource) { - m_mediaSource->setWebMediaSourceAndOpen(wrapUnique(webMediaSource)); + m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); } bool HTMLMediaElement::isInteractiveContent() const
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h index 79c1a3e..653bd314 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -40,7 +40,6 @@ #include "public/platform/WebAudioSourceProviderClient.h" #include "public/platform/WebMediaPlayerClient.h" #include "public/platform/WebMimeRegistry.h" -#include <memory> namespace blink { @@ -548,7 +547,7 @@ DeferredLoadState m_deferredLoadState; Timer<HTMLMediaElement> m_deferredLoadTimer; - std::unique_ptr<WebMediaPlayer> m_webMediaPlayer; + OwnPtr<WebMediaPlayer> m_webMediaPlayer; WebLayer* m_webLayer; DisplayMode m_displayMode; @@ -597,8 +596,8 @@ Member<CueTimeline> m_cueTimeline; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers; - std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask; - std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask; + OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; + OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; ExceptionCode m_playPromiseErrorCode;
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaSource.h b/third_party/WebKit/Source/core/html/HTMLMediaSource.h index bdee973..796e6f4 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaSource.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaSource.h
@@ -35,7 +35,6 @@ #include "core/html/URLRegistry.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ // Once attached, the source uses the element to synchronously service some // API operations like duration change that may need to initiate seek. virtual bool attachToElement(HTMLMediaElement*) = 0; - virtual void setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) = 0; + virtual void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) = 0; virtual void close() = 0; virtual bool isClosed() const = 0; virtual double duration() const = 0;
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp index f24144ea..8f8622b 100644 --- a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
@@ -11,7 +11,6 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ HTMLDocument& document() const { return *m_document; } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp index 02e9279..2af5bde 100644 --- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -315,7 +315,7 @@ DCHECK(root); DCHECK(root->isV1()); SlotAssignment& assignment = root->ensureSlotAssignment(); - if (assignment.findSlot(*this) != this) + if (assignment.findSlotByName(name()) != this) return false; return assignment.findHostChildBySlotName(name()); }
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp index 76cad26..93529b68 100644 --- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp
@@ -21,8 +21,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -39,8 +38,8 @@ void forceLayoutFlag(); private: - std::unique_ptr<SpellCheckerClient> m_spellCheckerClient; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<SpellCheckerClient> m_spellCheckerClient; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLTextFormControlElement> m_textControl; @@ -63,7 +62,7 @@ { Page::PageClients pageClients; fillWithEmptyClients(pageClients); - m_spellCheckerClient = wrapUnique(new DummySpellCheckerClient); + m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); pageClients.spellCheckerClient = m_spellCheckerClient.get(); m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients);
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp index 04ae3c0f..a68cc16 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -46,7 +46,6 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/gpu/Extensions3DUtil.h" #include "public/platform/WebCanvas.h" -#include <memory> namespace blink { @@ -295,7 +294,7 @@ IntSize intrinsicSize(videoWidth(), videoHeight()); // FIXME: Not sure if we dhould we be doing anything with the AccelerationHint argument here? - std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); if (!imageBuffer) { *status = InvalidSourceImageStatus; return nullptr;
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp index d50e429..23c88ae 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
@@ -14,8 +14,6 @@ #include "public/platform/WebSize.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -66,9 +64,9 @@ return new StubFrameLoaderClient; } - std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override + PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override { - return wrapUnique(new MockWebMediaPlayer); + return adoptPtr(new MockWebMediaPlayer); } }; @@ -95,7 +93,7 @@ return static_cast<MockWebMediaPlayer*>(m_video->webMediaPlayer()); } - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLVideoElement> m_video; };
diff --git a/third_party/WebKit/Source/core/html/LinkManifest.h b/third_party/WebKit/Source/core/html/LinkManifest.h index 0d34d30b..7e4db20 100644 --- a/third_party/WebKit/Source/core/html/LinkManifest.h +++ b/third_party/WebKit/Source/core/html/LinkManifest.h
@@ -7,6 +7,7 @@ #include "core/html/LinkResource.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/PublicURLManager.h b/third_party/WebKit/Source/core/html/PublicURLManager.h index ec59435..ec7fbb5 100644 --- a/third_party/WebKit/Source/core/html/PublicURLManager.h +++ b/third_party/WebKit/Source/core/html/PublicURLManager.h
@@ -30,6 +30,7 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/ValidityState.h b/third_party/WebKit/Source/core/html/ValidityState.h index ad43fe0..13dd57e5 100644 --- a/third_party/WebKit/Source/core/html/ValidityState.h +++ b/third_party/WebKit/Source/core/html/ValidityState.h
@@ -26,6 +26,7 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "core/html/FormAssociatedElement.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index 0ea4fc06..8781100 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -17,7 +17,6 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/CurrentTime.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -91,7 +90,7 @@ , m_callback(callback) { ASSERT(m_data->length() == (unsigned) (size.height() * size.width() * 4)); - m_encodedImage = wrapUnique(new Vector<unsigned char>()); + m_encodedImage = adoptPtr(new Vector<unsigned char>()); m_pixelRowStride = size.width() * NumChannelsPng; m_idleTaskStatus = IdleTaskNotSupported; m_numRowsCompleted = 0;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h index 0bb35ed..b1176d55 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -7,9 +7,9 @@ #include "core/fileapi/BlobCallback.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -66,10 +66,10 @@ void dispose(); - std::unique_ptr<PNGImageEncoderState> m_pngEncoderState; - std::unique_ptr<JPEGImageEncoderState> m_jpegEncoderState; + OwnPtr<PNGImageEncoderState> m_pngEncoderState; + OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; Member<DOMUint8ClampedArray> m_data; - std::unique_ptr<Vector<unsigned char>> m_encodedImage; + OwnPtr<Vector<unsigned char>> m_encodedImage; int m_numRowsCompleted; const IntSize m_size;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp index 0fa892a..4717d51 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp
@@ -4,8 +4,6 @@ #include "core/html/canvas/CanvasDrawListener.h" -#include <memory> - namespace blink { CanvasDrawListener::~CanvasDrawListener() {} @@ -25,7 +23,7 @@ m_frameCaptureRequested = true; } -CanvasDrawListener::CanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) +CanvasDrawListener::CanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) : m_frameCaptureRequested(true) , m_handler(std::move(handler)) {
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h index e0a654db..b03a04d 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h
@@ -9,7 +9,6 @@ #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" #include "wtf/PassRefPtr.h" -#include <memory> class SkImage; @@ -23,10 +22,10 @@ void requestFrame(); protected: - explicit CanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); + explicit CanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); bool m_frameCaptureRequested; - std::unique_ptr<WebCanvasCaptureHandler> m_handler; + OwnPtr<WebCanvasCaptureHandler> m_handler; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp index a6da4a2..cc641808 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
@@ -10,7 +10,6 @@ #include "core/style/ComputedStyle.h" #include "platform/fonts/FontCache.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" namespace { @@ -135,7 +134,7 @@ if (m_pruningScheduled) return; ASSERT(!m_mainCachePurgePreventer); - m_mainCachePurgePreventer = wrapUnique(new FontCachePurgePreventer); + m_mainCachePurgePreventer = adoptPtr(new FontCachePurgePreventer); Platform::current()->currentThread()->addTaskObserver(this); m_pruningScheduled = true; }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h index f17c620..47fc912 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h
@@ -13,7 +13,6 @@ #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ HashMap<String, Font> m_fontsResolvedUsingDefaultStyle; MutableStylePropertyMap m_fetchedFonts; ListHashSet<String> m_fontLRUList; - std::unique_ptr<FontCachePurgePreventer> m_mainCachePurgePreventer; + OwnPtr<FontCachePurgePreventer> m_mainCachePurgePreventer; Member<Document> m_document; RefPtr<ComputedStyle> m_defaultFontStyle; bool m_pruningScheduled;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp index ffd08f2..462df0e 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
@@ -13,7 +13,6 @@ #include "platform/graphics/UnacceleratedImageBufferSurface.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> using ::testing::Mock; @@ -31,7 +30,7 @@ CanvasFontCache* cache() { return m_document->canvasFontCache(); } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement; };
diff --git a/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp b/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp index 3a921fe3..8c287c76 100644 --- a/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp
@@ -31,6 +31,7 @@ #include "core/html/forms/ButtonInputType.h" #include "core/InputTypeNames.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp index 1872d26..e6ef9410 100644 --- a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
@@ -35,6 +35,7 @@ #include "core/events/KeyboardEvent.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp index e7510c5..55a62830 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
@@ -49,6 +49,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/UserGestureIndicator.h" #include "platform/graphics/Color.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/DateInputType.cpp b/third_party/WebKit/Source/core/html/forms/DateInputType.cpp index 71bbb9ba..ab75ee4 100644 --- a/third_party/WebKit/Source/core/html/forms/DateInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/DateInputType.cpp
@@ -37,6 +37,7 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp b/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp index 1e6f6a62..7c525fc2 100644 --- a/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp
@@ -37,6 +37,7 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp index 98353fb..fe130fe 100644 --- a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
@@ -40,6 +40,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/UserGestureIndicator.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.cpp b/third_party/WebKit/Source/core/html/forms/FormController.cpp index 558ada8..e28c74d 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.cpp +++ b/third_party/WebKit/Source/core/html/forms/FormController.cpp
@@ -26,9 +26,7 @@ #include "platform/FileChooser.h" #include "wtf/Deque.h" #include "wtf/HashTableDeletedValueType.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -178,8 +176,8 @@ USING_FAST_MALLOC(SavedFormState); public: - static std::unique_ptr<SavedFormState> create(); - static std::unique_ptr<SavedFormState> deserialize(const Vector<String>&, size_t& index); + static PassOwnPtr<SavedFormState> create(); + static PassOwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index); void serializeTo(Vector<String>&) const; bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); } void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&); @@ -195,9 +193,9 @@ size_t m_controlStateCount; }; -std::unique_ptr<SavedFormState> SavedFormState::create() +PassOwnPtr<SavedFormState> SavedFormState::create() { - return wrapUnique(new SavedFormState); + return adoptPtr(new SavedFormState); } static bool isNotFormControlTypeCharacter(UChar ch) @@ -205,7 +203,7 @@ return ch != '-' && (ch > 'z' || ch < 'a'); } -std::unique_ptr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) +PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) { if (index >= stateVector.size()) return nullptr; @@ -213,7 +211,7 @@ size_t itemCount = stateVector[index++].toUInt(); if (!itemCount) return nullptr; - std::unique_ptr<SavedFormState> savedFormState = wrapUnique(new SavedFormState); + OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState); while (itemCount--) { if (index + 1 >= stateVector.size()) return nullptr; @@ -413,7 +411,7 @@ Vector<String> DocumentState::toStateVector() { FormKeyGenerator* keyGenerator = FormKeyGenerator::create(); - std::unique_ptr<SavedFormStateMap> stateMap = wrapUnique(new SavedFormStateMap); + OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap); for (const auto& formControl : m_formControls) { HTMLFormControlElementWithState* control = formControl.get(); ASSERT(control->inShadowIncludingDocument()); @@ -490,7 +488,7 @@ while (i + 1 < stateVector.size()) { AtomicString formKey = AtomicString(stateVector[i++]); - std::unique_ptr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); + OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); if (!state) { i = 0; break;
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.h b/third_party/WebKit/Source/core/html/forms/FormController.h index 16a6c75..785237b 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.h +++ b/third_party/WebKit/Source/core/html/forms/FormController.h
@@ -28,7 +28,6 @@ #include "wtf/ListHashSet.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" -#include <memory> namespace blink { @@ -73,7 +72,7 @@ m_values.append(value); } -using SavedFormStateMap = HashMap<AtomicString, std::unique_ptr<SavedFormState>>; +using SavedFormStateMap = HashMap<AtomicString, OwnPtr<SavedFormState>>; class DocumentState final : public GarbageCollected<DocumentState> { public:
diff --git a/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp b/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp index a2b0666..ebf7327 100644 --- a/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp
@@ -36,6 +36,7 @@ #include "core/html/FormData.h" #include "core/html/HTMLInputElement.h" #include "core/html/forms/FormController.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp b/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp index 3e87020..a6d333a 100644 --- a/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp
@@ -35,6 +35,7 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "core/layout/LayoutBlockFlow.h" #include "core/layout/LayoutImage.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/InputType.cpp b/third_party/WebKit/Source/core/html/forms/InputType.cpp index ebd6b06..4144964 100644 --- a/third_party/WebKit/Source/core/html/forms/InputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/InputType.cpp
@@ -71,8 +71,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/text/PlatformLocale.h" #include "platform/text/TextBreakIterator.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -82,9 +80,9 @@ using InputTypeFactoryFunction = InputType* (*)(HTMLInputElement&); using InputTypeFactoryMap = HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash>; -static std::unique_ptr<InputTypeFactoryMap> createInputTypeFactoryMap() +static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() { - std::unique_ptr<InputTypeFactoryMap> map = wrapUnique(new InputTypeFactoryMap); + OwnPtr<InputTypeFactoryMap> map = adoptPtr(new InputTypeFactoryMap); map->add(InputTypeNames::button, ButtonInputType::create); map->add(InputTypeNames::checkbox, CheckboxInputType::create); map->add(InputTypeNames::color, ColorInputType::create); @@ -112,7 +110,7 @@ static const InputTypeFactoryMap* factoryMap() { - static const InputTypeFactoryMap* factoryMap = createInputTypeFactoryMap().release(); + static const InputTypeFactoryMap* factoryMap = createInputTypeFactoryMap().leakPtr(); return factoryMap; }
diff --git a/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp b/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp index 3c60b01..2b33186 100644 --- a/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp
@@ -39,6 +39,7 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp b/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp index d234c1e..9b48e328 100644 --- a/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp
@@ -43,6 +43,7 @@ #include "core/layout/LayoutObject.h" #include "platform/text/PlatformLocale.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h index 4dd49dde..bdc28630 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h +++ b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h
@@ -24,6 +24,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" #include "wtf/text/StringHash.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp index 550985d8..656a6e98 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp
@@ -31,6 +31,7 @@ #include "core/html/HTMLInputElement.h" #include "core/page/SpatialNavigation.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp index b5bc8c4..ffb1bea 100644 --- a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
@@ -56,6 +56,7 @@ #include "platform/PlatformMouseEvent.h" #include "wtf/MathExtras.h" #include "wtf/NonCopyingSort.h" +#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp b/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp index e832161..7bb7317 100644 --- a/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp
@@ -36,6 +36,7 @@ #include "core/html/HTMLFormElement.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp b/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp index 23dfa89..e12b515 100644 --- a/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp
@@ -40,6 +40,7 @@ #include "core/html/shadow/ShadowElementNames.h" #include "core/html/shadow/TextControlInnerElements.h" #include "core/layout/LayoutSearchField.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp b/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp index 59c7aaf..c33b946 100644 --- a/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp
@@ -37,6 +37,7 @@ #include "core/html/HTMLFormElement.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp b/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp index 5c041b8..11982aa0 100644 --- a/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp
@@ -31,6 +31,7 @@ #include "core/html/forms/TelephoneInputType.h" #include "core/InputTypeNames.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TextInputType.cpp b/third_party/WebKit/Source/core/html/forms/TextInputType.cpp index 3073c70..854a2d3 100644 --- a/third_party/WebKit/Source/core/html/forms/TextInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TextInputType.cpp
@@ -32,6 +32,7 @@ #include "core/InputTypeNames.h" #include "core/html/HTMLInputElement.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp b/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp index 475d4e7..8a0edc7a 100644 --- a/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp
@@ -41,6 +41,7 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/URLInputType.cpp b/third_party/WebKit/Source/core/html/forms/URLInputType.cpp index e4ce6b2..4328f90 100644 --- a/third_party/WebKit/Source/core/html/forms/URLInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/URLInputType.cpp
@@ -34,6 +34,7 @@ #include "core/html/HTMLInputElement.h" #include "core/html/parser/HTMLParserIdioms.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp b/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp index 626c8d82..f9592d9 100644 --- a/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp
@@ -36,6 +36,7 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp index 1615aac..4a9596f0 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp
@@ -39,7 +39,6 @@ #include "core/html/imports/HTMLImportsController.h" #include "core/loader/DocumentWriter.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" -#include <memory> namespace blink { @@ -72,7 +71,7 @@ setResource(resource); } -void HTMLImportLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void HTMLImportLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); // Resource may already have been loaded with the import loader
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h index 0ecc96db..b029f2b 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h
@@ -35,8 +35,9 @@ #include "core/fetch/RawResource.h" #include "core/fetch/ResourceOwner.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -96,7 +97,7 @@ HTMLImportLoader(HTMLImportsController*); // RawResourceClient - void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void dataReceived(Resource*, const char* data, size_t length) override; void notifyFinished(Resource*) override; String debugName() const override { return "HTMLImportLoader"; }
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h index f2ec8a7f..317bf5d 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h
@@ -7,6 +7,7 @@ #include "core/html/imports/HTMLImport.h" #include "platform/Timer.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/imports/LinkImport.h b/third_party/WebKit/Source/core/html/imports/LinkImport.h index b0cc9a4b..d512bb6 100644 --- a/third_party/WebKit/Source/core/html/imports/LinkImport.h +++ b/third_party/WebKit/Source/core/html/imports/LinkImport.h
@@ -34,6 +34,7 @@ #include "core/html/LinkResource.h" #include "core/html/imports/HTMLImportChildClient.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h b/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h index 3c28c83c..8f8205f2 100644 --- a/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h +++ b/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h
@@ -31,8 +31,6 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -153,7 +151,7 @@ break; case HTMLToken::DOCTYPE: m_name = AtomicString(token.data()); - m_doctypeData = wrapUnique(new DoctypeData()); + m_doctypeData = adoptPtr(new DoctypeData()); m_doctypeData->m_hasPublicIdentifier = true; append(m_doctypeData->m_publicIdentifier, token.publicIdentifier()); m_doctypeData->m_hasSystemIdentifier = true; @@ -214,7 +212,7 @@ String m_data; // For DOCTYPE - std::unique_ptr<DoctypeData> m_doctypeData; + OwnPtr<DoctypeData> m_doctypeData; // For StartTag and EndTag bool m_selfClosing;
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp index a022af5..d2e5924f 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -33,9 +33,7 @@ #include "platform/TraceEvent.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextPosition.h" -#include <memory> namespace blink { @@ -82,7 +80,7 @@ #endif -void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner) +void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner) { new BackgroundHTMLParser(reference, std::move(config), documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData, std::move(loadingTaskRunner)); // Caller must free by calling stop(). @@ -94,18 +92,18 @@ { } -BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner) +BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner) : m_weakFactory(reference, this) - , m_token(wrapUnique(new HTMLToken)) + , m_token(adoptPtr(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(config->options)) , m_treeBuilderSimulator(config->options) , m_options(config->options) , m_outstandingTokenLimit(config->outstandingTokenLimit) , m_parser(config->parser) - , m_pendingTokens(wrapUnique(new CompactHTMLTokenStream)) + , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream)) , m_pendingTokenLimit(config->pendingTokenLimit) , m_xssAuditor(std::move(config->xssAuditor)) - , m_preloadScanner(wrapUnique(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData))) + , m_preloadScanner(adoptPtr(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData))) , m_decoder(std::move(config->decoder)) , m_loadingTaskRunner(std::move(loadingTaskRunner)) , m_parsedChunkQueue(config->parsedChunkQueue.release()) @@ -126,7 +124,7 @@ updateDocument(m_decoder->decode(data, dataLength)); } -void BackgroundHTMLParser::appendRawBytesFromMainThread(std::unique_ptr<Vector<char>> buffer) +void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char>> buffer) { ASSERT(m_decoder); updateDocument(m_decoder->decode(buffer->data(), buffer->size())); @@ -139,7 +137,7 @@ pumpTokenizer(); } -void BackgroundHTMLParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) +void BackgroundHTMLParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) { ASSERT(decoder); m_decoder = std::move(decoder); @@ -170,7 +168,7 @@ appendDecodedBytes(decodedData); } -void BackgroundHTMLParser::resumeFrom(std::unique_ptr<Checkpoint> checkpoint) +void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint) { m_parser = checkpoint->parser; m_token = std::move(checkpoint->token); @@ -242,7 +240,7 @@ { TextPosition position = TextPosition(m_input.current().currentLine(), m_input.current().currentColumn()); - if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { + if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { xssInfo->m_textPosition = position; m_pendingXSSInfos.append(std::move(xssInfo)); } @@ -289,7 +287,7 @@ checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos); #endif - std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk = wrapUnique(new HTMLDocumentParser::ParsedChunk); + OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentParser::ParsedChunk); TRACE_EVENT_WITH_FLOW0("blink,loading", "BackgroundHTMLParser::sendTokensToMainThread", chunk.get(), TRACE_EVENT_FLAG_FLOW_OUT); chunk->preloads.swap(m_pendingPreloads); if (m_viewportDescription.set) @@ -311,7 +309,7 @@ threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, m_parser)); } - m_pendingTokens = wrapUnique(new CompactHTMLTokenStream); + m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h index 3553f42..28320e7 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
@@ -36,8 +36,8 @@ #include "core/html/parser/ParsedChunkQueue.h" #include "core/html/parser/TextResourceDecoder.h" #include "core/html/parser/XSSAuditorDelegate.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" -#include <memory> namespace blink { @@ -55,8 +55,8 @@ Configuration(); HTMLParserOptions options; WeakPtr<HTMLDocumentParser> parser; - std::unique_ptr<XSSAuditor> xssAuditor; - std::unique_ptr<TextResourceDecoder> decoder; + OwnPtr<XSSAuditor> xssAuditor; + OwnPtr<TextResourceDecoder> decoder; RefPtr<ParsedChunkQueue> parsedChunkQueue; // outstandingTokenLimit must be greater than or equal to // pendingTokenLimit @@ -64,14 +64,14 @@ size_t pendingTokenLimit; }; - static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::unique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebTaskRunner>); + static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); struct Checkpoint { USING_FAST_MALLOC(Checkpoint); public: WeakPtr<HTMLDocumentParser> parser; - std::unique_ptr<HTMLToken> token; - std::unique_ptr<HTMLTokenizer> tokenizer; + OwnPtr<HTMLToken> token; + OwnPtr<HTMLTokenizer> tokenizer; HTMLTreeBuilderSimulator::State treeBuilderState; HTMLInputCheckpoint inputCheckpoint; TokenPreloadScannerCheckpoint preloadScannerCheckpoint; @@ -80,10 +80,10 @@ void appendRawBytesFromParserThread(const char* data, int dataLength); - void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>); - void setDecoder(std::unique_ptr<TextResourceDecoder>); + void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>); + void setDecoder(PassOwnPtr<TextResourceDecoder>); void flush(); - void resumeFrom(std::unique_ptr<Checkpoint>); + void resumeFrom(PassOwnPtr<Checkpoint>); void startedChunkWithCheckpoint(HTMLInputCheckpoint); void finish(); void stop(); @@ -91,7 +91,7 @@ void forcePlaintextForTextDocument(); private: - BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::unique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebTaskRunner>); + BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); ~BackgroundHTMLParser(); void appendDecodedBytes(const String&); @@ -103,14 +103,14 @@ WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; BackgroundHTMLInputStream m_input; HTMLSourceTracker m_sourceTracker; - std::unique_ptr<HTMLToken> m_token; - std::unique_ptr<HTMLTokenizer> m_tokenizer; + OwnPtr<HTMLToken> m_token; + OwnPtr<HTMLTokenizer> m_tokenizer; HTMLTreeBuilderSimulator m_treeBuilderSimulator; HTMLParserOptions m_options; const size_t m_outstandingTokenLimit; WeakPtr<HTMLDocumentParser> m_parser; - std::unique_ptr<CompactHTMLTokenStream> m_pendingTokens; + OwnPtr<CompactHTMLTokenStream> m_pendingTokens; const size_t m_pendingTokenLimit; PreloadRequestStream m_pendingPreloads; // Indices into |m_pendingTokens|. @@ -118,11 +118,11 @@ ViewportDescriptionWrapper m_viewportDescription; XSSInfoStream m_pendingXSSInfos; - std::unique_ptr<XSSAuditor> m_xssAuditor; - std::unique_ptr<TokenPreloadScanner> m_preloadScanner; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<XSSAuditor> m_xssAuditor; + OwnPtr<TokenPreloadScanner> m_preloadScanner; + OwnPtr<TextResourceDecoder> m_decoder; DocumentEncodingData m_lastSeenEncodingData; - std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; + OwnPtr<WebTaskRunner> m_loadingTaskRunner; RefPtr<ParsedChunkQueue> m_parsedChunkQueue; bool m_startingScript;
diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp index 0b8fb30..939aa383 100644 --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -30,7 +30,6 @@ #include "core/fetch/FetchInitiatorTypeNames.h" #include "core/html/parser/HTMLParserIdioms.h" #include "platform/text/SegmentedString.h" -#include <memory> namespace blink { @@ -221,7 +220,7 @@ String url = parseCSSStringOrURL(m_ruleValue.toString()); if (!url.isEmpty()) { TextPosition position = TextPosition(source.currentLine(), source.currentColumn()); - std::unique_ptr<PreloadRequest> request = PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleSheet, m_referrerPolicy); + OwnPtr<PreloadRequest> request = PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleSheet, m_referrerPolicy); // FIXME: Should this be including the charset in the preload request? m_requests->append(std::move(request)); }
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index aa007910..69f8d51 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -55,9 +55,7 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" -#include "wtf/PtrUtil.h" #include "wtf/TemporaryChange.h" -#include <memory> namespace blink { @@ -91,11 +89,11 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, ParserSynchronizationPolicy syncPolicy) : ScriptableDocumentParser(document) , m_options(&document) - , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken) : nullptr) + , m_token(syncPolicy == ForceSynchronousParsing ? adoptPtr(new HTMLToken) : nullptr) , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(m_options) : nullptr) , m_scriptRunner(HTMLScriptRunner::create(&document, this)) , m_treeBuilder(HTMLTreeBuilder::create(this, &document, getParserContentPolicy(), m_options)) - , m_loadingTaskRunner(wrapUnique(document.loadingTaskRunner()->clone())) + , m_loadingTaskRunner(adoptPtr(document.loadingTaskRunner()->clone())) , m_parserScheduler(HTMLParserScheduler::create(this, m_loadingTaskRunner.get())) , m_xssAuditorDelegate(&document) , m_weakFactory(this) @@ -119,10 +117,10 @@ HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, ParserContentPolicy parserContentPolicy) : ScriptableDocumentParser(fragment->document(), parserContentPolicy) , m_options(&fragment->document()) - , m_token(wrapUnique(new HTMLToken)) + , m_token(adoptPtr(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(m_options)) , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this->getParserContentPolicy(), m_options)) - , m_loadingTaskRunner(wrapUnique(fragment->document().loadingTaskRunner()->clone())) + , m_loadingTaskRunner(adoptPtr(fragment->document().loadingTaskRunner()->clone())) , m_xssAuditorDelegate(&fragment->document()) , m_weakFactory(this) , m_shouldUseThreading(false) @@ -292,7 +290,7 @@ TRACE_EVENT0("blink", "HTMLDocumentParser::notifyPendingParsedChunks"); ASSERT(m_parsedChunkQueue); - Vector<std::unique_ptr<ParsedChunk>> pendingChunks; + Vector<OwnPtr<ParsedChunk>> pendingChunks; m_parsedChunkQueue->takeAll(pendingChunks); if (!isParsing()) @@ -343,7 +341,7 @@ document()->setEncodingData(data); } -void HTMLDocumentParser::validateSpeculations(std::unique_ptr<ParsedChunk> chunk) +void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) { ASSERT(chunk); if (isWaitingForScripts()) { @@ -357,8 +355,8 @@ } ASSERT(!m_lastChunkBeforeScript); - std::unique_ptr<HTMLTokenizer> tokenizer = std::move(m_tokenizer); - std::unique_ptr<HTMLToken> token = std::move(m_token); + OwnPtr<HTMLTokenizer> tokenizer = std::move(m_tokenizer); + OwnPtr<HTMLToken> token = std::move(m_token); if (!tokenizer) { // There must not have been any changes to the HTMLTokenizer state on @@ -382,12 +380,12 @@ discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::move(tokenizer)); } -void HTMLDocumentParser::discardSpeculationsAndResumeFrom(std::unique_ptr<ParsedChunk> lastChunkBeforeScript, std::unique_ptr<HTMLToken> token, std::unique_ptr<HTMLTokenizer> tokenizer) +void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer) { m_weakFactory.revokeAll(); m_speculations.clear(); - std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint = wrapUnique(new BackgroundHTMLParser::Checkpoint); + OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new BackgroundHTMLParser::Checkpoint); checkpoint->parser = m_weakFactory.createWeakPtr(); checkpoint->token = std::move(token); checkpoint->tokenizer = std::move(tokenizer); @@ -401,7 +399,7 @@ HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::resumeFrom, m_backgroundParser, passed(std::move(checkpoint)))); } -size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(std::unique_ptr<ParsedChunk> popChunk) +size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk> popChunk) { TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processParsedChunkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true); @@ -416,8 +414,8 @@ ASSERT(!m_token); ASSERT(!m_lastChunkBeforeScript); - std::unique_ptr<ParsedChunk> chunk(std::move(popChunk)); - std::unique_ptr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); + OwnPtr<ParsedChunk> chunk(std::move(popChunk)); + OwnPtr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); size_t elementTokenCount = 0; HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::startedChunkWithCheckpoint, m_backgroundParser, chunk->inputCheckpoint)); @@ -586,7 +584,7 @@ // We do not XSS filter innerHTML, which means we (intentionally) fail // http/tests/security/xssAuditor/dom-write-innerHTML.html - if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) + if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) m_xssAuditorDelegate.didBlockScript(*xssInfo); } @@ -675,7 +673,7 @@ if (!m_tokenizer) { ASSERT(!inPumpSession()); ASSERT(m_haveBackgroundParser || wasCreatedByScript()); - m_token = wrapUnique(new HTMLToken); + m_token = adoptPtr(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); } @@ -711,10 +709,10 @@ RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<BackgroundHTMLParser>::createUnbound(); m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); - std::unique_ptr<BackgroundHTMLParser::Configuration> config = wrapUnique(new BackgroundHTMLParser::Configuration); + OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration); config->options = m_options; config->parser = m_weakFactory.createWeakPtr(); - config->xssAuditor = wrapUnique(new XSSAuditor); + config->xssAuditor = adoptPtr(new XSSAuditor); config->xssAuditor->init(document(), &m_xssAuditorDelegate); config->decoder = takeDecoder(); @@ -734,7 +732,7 @@ document()->url(), passed(CachedDocumentParameters::create(document())), MediaValuesCached::MediaValuesCachedData(*document()), - passed(wrapUnique(m_loadingTaskRunner->clone())))); + passed(adoptPtr(m_loadingTaskRunner->clone())))); } void HTMLDocumentParser::stopBackgroundParser() @@ -860,7 +858,7 @@ // We're finishing before receiving any data. Rather than booting up // the background parser just to spin it down, we finish parsing // synchronously. - m_token = wrapUnique(new HTMLToken); + m_token = adoptPtr(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); } @@ -1012,7 +1010,7 @@ if (!m_haveBackgroundParser) startBackgroundParser(); - std::unique_ptr<Vector<char>> buffer = wrapUnique(new Vector<char>(length)); + OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(length)); memcpy(buffer->data(), data, length); TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentParser::appendBytes", "size", (unsigned)length); @@ -1034,7 +1032,7 @@ // appendBytes. Fallback to synchronous parsing in that case. if (!m_haveBackgroundParser) { m_shouldUseThreading = false; - m_token = wrapUnique(new HTMLToken); + m_token = adoptPtr(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); DecodedDataDocumentParser::flush(); return; @@ -1046,7 +1044,7 @@ } } -void HTMLDocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) +void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) { ASSERT(decoder); DecodedDataDocumentParser::setDecoder(std::move(decoder)); @@ -1068,7 +1066,7 @@ m_preloader->takeAndPreload(m_queuedPreloads); } -std::unique_ptr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() +PassOwnPtr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() { return HTMLPreloadScanner::create( m_options, @@ -1095,7 +1093,7 @@ double duration = monotonicallyIncreasingTimeMS() - startTime; int currentPreloadCount = document()->loader()->fetcher()->countPreloads(); - std::unique_ptr<HTMLPreloadScanner> scanner = createPreloadScanner(); + OwnPtr<HTMLPreloadScanner> scanner = createPreloadScanner(); scanner->appendToEnd(SegmentedString(writtenSource)); scanner->scanAndPreload(m_preloader.get(), document()->baseElementURL(), nullptr); int numPreloads = document()->loader()->fetcher()->countPreloads() - currentPreloadCount;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h index 8f4fc0e..11273d40 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
@@ -47,9 +47,9 @@ #include "core/html/parser/XSSAuditorDelegate.h" #include "platform/text/SegmentedString.h" #include "wtf/Deque.h" +#include "wtf/OwnPtr.h" #include "wtf/WeakPtr.h" #include "wtf/text/TextPosition.h" -#include <memory> namespace blink { @@ -94,7 +94,7 @@ struct ParsedChunk { USING_FAST_MALLOC(ParsedChunk); public: - std::unique_ptr<CompactHTMLTokenStream> tokens; + OwnPtr<CompactHTMLTokenStream> tokens; PreloadRequestStream preloads; ViewportDescriptionWrapper viewport; XSSInfoStream xssInfos; @@ -111,7 +111,7 @@ void appendBytes(const char* bytes, size_t length) override; void flush() final; - void setDecoder(std::unique_ptr<TextResourceDecoder>) final; + void setDecoder(PassOwnPtr<TextResourceDecoder>) final; protected: void insert(const SegmentedString&) final; @@ -149,9 +149,9 @@ void startBackgroundParser(); void stopBackgroundParser(); - void validateSpeculations(std::unique_ptr<ParsedChunk> lastChunk); - void discardSpeculationsAndResumeFrom(std::unique_ptr<ParsedChunk> lastChunk, std::unique_ptr<HTMLToken>, std::unique_ptr<HTMLTokenizer>); - size_t processParsedChunkFromBackgroundParser(std::unique_ptr<ParsedChunk>); + void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); + void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, PassOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); + size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); void pumpPendingSpeculations(); bool canTakeNextToken(); @@ -175,7 +175,7 @@ bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts() || isScheduledForResume() || isExecutingScript(); } - std::unique_ptr<HTMLPreloadScanner> createPreloadScanner(); + PassOwnPtr<HTMLPreloadScanner> createPreloadScanner(); int preloadInsertion(const SegmentedString& source); void evaluateAndPreloadScriptForDocumentWrite(const String& source); @@ -185,13 +185,13 @@ HTMLParserOptions m_options; HTMLInputStream m_input; - std::unique_ptr<HTMLToken> m_token; - std::unique_ptr<HTMLTokenizer> m_tokenizer; + OwnPtr<HTMLToken> m_token; + OwnPtr<HTMLTokenizer> m_tokenizer; Member<HTMLScriptRunner> m_scriptRunner; Member<HTMLTreeBuilder> m_treeBuilder; - std::unique_ptr<HTMLPreloadScanner> m_preloadScanner; - std::unique_ptr<HTMLPreloadScanner> m_insertionPreloadScanner; - std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; + OwnPtr<HTMLPreloadScanner> m_preloadScanner; + OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; + OwnPtr<WebTaskRunner> m_loadingTaskRunner; Member<HTMLParserScheduler> m_parserScheduler; HTMLSourceTracker m_sourceTracker; TextPosition m_textPosition; @@ -200,15 +200,15 @@ // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object // so they can be set and cleared together and passed between threads together. - std::unique_ptr<ParsedChunk> m_lastChunkBeforeScript; - Deque<std::unique_ptr<ParsedChunk>> m_speculations; + OwnPtr<ParsedChunk> m_lastChunkBeforeScript; + Deque<OwnPtr<ParsedChunk>> m_speculations; WeakPtrFactory<HTMLDocumentParser> m_weakFactory; WeakPtr<BackgroundHTMLParser> m_backgroundParser; Member<HTMLResourcePreloader> m_preloader; PreloadRequestStream m_queuedPreloads; Vector<String> m_queuedDocumentWriteScripts; RefPtr<ParsedChunkQueue> m_parsedChunkQueue; - std::unique_ptr<DocumentWriteEvaluator> m_evaluator; + OwnPtr<DocumentWriteEvaluator> m_evaluator; bool m_shouldUseThreading; bool m_endWasDelayed;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h b/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h index 53d3e0c..4bb7331 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h
@@ -30,6 +30,8 @@ #include "core/html/parser/HTMLStackItem.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h b/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h index 35837bd..18796f83 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h
@@ -29,10 +29,8 @@ #include "core/html/parser/HTMLToken.h" #include "platform/text/SegmentedString.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -41,7 +39,7 @@ class HTMLMetaCharsetParser { WTF_MAKE_NONCOPYABLE(HTMLMetaCharsetParser); USING_FAST_MALLOC(HTMLMetaCharsetParser); public: - static std::unique_ptr<HTMLMetaCharsetParser> create() { return wrapUnique(new HTMLMetaCharsetParser()); } + static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTMLMetaCharsetParser()); } ~HTMLMetaCharsetParser(); @@ -55,8 +53,8 @@ bool processMeta(); - std::unique_ptr<HTMLTokenizer> m_tokenizer; - std::unique_ptr<TextCodec> m_assumedCodec; + OwnPtr<HTMLTokenizer> m_tokenizer; + OwnPtr<TextCodec> m_assumedCodec; SegmentedString m_input; HTMLToken m_token; bool m_inHeadSection;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp index 0d757cbc5..ae74514 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
@@ -26,13 +26,12 @@ #include "core/html/parser/HTMLParserScheduler.h" #include "core/dom/Document.h" -#include "core/frame/FrameView.h" #include "core/html/parser/HTMLDocumentParser.h" +#include "core/frame/FrameView.h" #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -68,7 +67,7 @@ HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser* parser, WebTaskRunner* loadingTaskRunner) : m_parser(parser) - , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) + , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) , m_cancellableContinueParse(CancellableTaskFactory::create(this, &HTMLParserScheduler::continueParsing)) , m_isSuspendedWithActiveTimer(false) {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h index e8bd9af..2651e5e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h
@@ -29,8 +29,8 @@ #include "core/html/parser/NestingLevelIncrementer.h" #include "platform/scheduler/CancellableTaskFactory.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -96,9 +96,9 @@ void continueParsing(); Member<HTMLDocumentParser> m_parser; - std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; + OwnPtr<WebTaskRunner> m_loadingTaskRunner; - std::unique_ptr<CancellableTaskFactory> m_cancellableContinueParse; + OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; bool m_isSuspendedWithActiveTimer; };
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp index 8740657..90a6fea 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp
@@ -35,6 +35,7 @@ #include "platform/heap/SafePoint.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h index 308229a..3a595b79 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h
@@ -36,7 +36,8 @@ #include "platform/WebThreadSupportingGC.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -57,7 +58,7 @@ void setupHTMLParserThread(); void cleanupHTMLParserThread(WaitableEvent*); - std::unique_ptr<WebThreadSupportingGC> m_thread; + OwnPtr<WebThreadSupportingGC> m_thread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp index 14ecba3..40c27a3 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -50,7 +50,6 @@ #include "platform/Histogram.h" #include "platform/MIMETypeRegistry.h" #include "platform/TraceEvent.h" -#include <memory> namespace blink { @@ -207,7 +206,7 @@ } } - std::unique_ptr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL, const SegmentedString& source, const ClientHintsPreferences& clientHintsPreferences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPolicy) + PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL, const SegmentedString& source, const ClientHintsPreferences& clientHintsPreferences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPolicy) { PreloadRequest::RequestType requestType = PreloadRequest::RequestTypePreload; if (shouldPreconnect()) { @@ -241,7 +240,7 @@ // The element's 'referrerpolicy' attribute (if present) takes precedence over the document's referrer policy. ReferrerPolicy referrerPolicy = (m_referrerPolicy != ReferrerPolicyDefault) ? m_referrerPolicy : documentReferrerPolicy; - std::unique_ptr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, referrerPolicy, resourceWidth, clientHintsPreferences, requestType); + OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, referrerPolicy, resourceWidth, clientHintsPreferences, requestType); request->setCrossOrigin(m_crossOrigin); request->setCharset(charset()); request->setDefer(m_defer); @@ -481,7 +480,7 @@ IntegrityMetadataSet m_integrityMetadata; }; -TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) +TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) : m_documentURL(documentURL) , m_inStyle(false) , m_inPicture(false) @@ -745,7 +744,7 @@ scanner.processAttributes(token.attributes()); if (m_inPicture) scanner.handlePictureSourceURL(m_pictureData); - std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, m_documentParameters->referrerPolicy); + OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, m_documentParameters->referrerPolicy); if (request) requests.append(std::move(request)); return; @@ -766,7 +765,7 @@ } } -HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) +HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) : m_scanner(documentURL, std::move(documentParameters), mediaValuesCachedData) , m_tokenizer(HTMLTokenizer::create(options)) {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h index 8da9b7b..fbbe93b 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h
@@ -34,9 +34,7 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "platform/text/SegmentedString.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -58,9 +56,9 @@ struct CORE_EXPORT CachedDocumentParameters { USING_FAST_MALLOC(CachedDocumentParameters); public: - static std::unique_ptr<CachedDocumentParameters> create(Document* document) + static PassOwnPtr<CachedDocumentParameters> create(Document* document) { - return wrapUnique(new CachedDocumentParameters(document)); + return adoptPtr(new CachedDocumentParameters(document)); } bool doHtmlPreloadScanning; @@ -77,7 +75,7 @@ class TokenPreloadScanner { WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); USING_FAST_MALLOC(TokenPreloadScanner); public: - TokenPreloadScanner(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); + TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); ~TokenPreloadScanner(); void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& requests, ViewportDescriptionWrapper*); @@ -144,7 +142,7 @@ bool m_isCSPEnabled; PictureData m_pictureData; size_t m_templateCount; - std::unique_ptr<CachedDocumentParameters> m_documentParameters; + OwnPtr<CachedDocumentParameters> m_documentParameters; Persistent<MediaValuesCached> m_mediaValues; ClientHintsPreferences m_clientHintsPreferences; @@ -156,9 +154,9 @@ class CORE_EXPORT HTMLPreloadScanner { WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); USING_FAST_MALLOC(HTMLPreloadScanner); public: - static std::unique_ptr<HTMLPreloadScanner> create(const HTMLParserOptions& options, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) + static PassOwnPtr<HTMLPreloadScanner> create(const HTMLParserOptions& options, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) { - return wrapUnique(new HTMLPreloadScanner(options, documentURL, std::move(documentParameters), mediaValuesCachedData)); + return adoptPtr(new HTMLPreloadScanner(options, documentURL, std::move(documentParameters), mediaValuesCachedData)); } @@ -168,12 +166,12 @@ void scanAndPreload(ResourcePreloader*, const KURL& documentBaseElementURL, ViewportDescriptionWrapper*); private: - HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); + HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); TokenPreloadScanner m_scanner; SegmentedString m_source; HTMLToken m_token; - std::unique_ptr<HTMLTokenizer> m_tokenizer; + OwnPtr<HTMLTokenizer> m_tokenizer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp index bc584d1e..8b90b65 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
@@ -13,7 +13,6 @@ #include "core/html/parser/HTMLResourcePreloader.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -81,13 +80,13 @@ } protected: - void preload(std::unique_ptr<PreloadRequest> preloadRequest, const NetworkHintsInterface&) override + void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsInterface&) override { m_preloadRequest = std::move(preloadRequest); } private: - std::unique_ptr<PreloadRequest> m_preloadRequest; + OwnPtr<PreloadRequest> m_preloadRequest; }; class HTMLPreloadScannerTest : public testing::Test { @@ -172,8 +171,8 @@ } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; - std::unique_ptr<HTMLPreloadScanner> m_scanner; + OwnPtr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<HTMLPreloadScanner> m_scanner; }; TEST_F(HTMLPreloadScannerTest, testImages)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp index 1b6b669..efa3ff9 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp
@@ -31,7 +31,6 @@ #include "core/loader/DocumentLoader.h" #include "platform/Histogram.h" #include "public/platform/Platform.h" -#include <memory> namespace blink { @@ -60,7 +59,7 @@ networkHintsInterface.preconnectHost(host, request->crossOrigin()); } -void HTMLResourcePreloader::preload(std::unique_ptr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface) +void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface) { if (preload->isPreconnect()) { preconnectHost(preload.get(), networkHintsInterface);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h index e2df0cde..29ddf17c 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h
@@ -33,7 +33,6 @@ #include "core/loader/NetworkHintsInterface.h" #include "wtf/CurrentTime.h" #include "wtf/text/TextPosition.h" -#include <memory> namespace blink { @@ -45,7 +44,7 @@ DECLARE_TRACE(); protected: - void preload(std::unique_ptr<PreloadRequest>, const NetworkHintsInterface&) override; + void preload(PassOwnPtr<PreloadRequest>, const NetworkHintsInterface&) override; private: explicit HTMLResourcePreloader(Document&);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp index 7455b241..4326fd3 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp
@@ -7,7 +7,6 @@ #include "core/html/parser/PreloadRequest.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -54,7 +53,7 @@ { // TODO(yoav): Need a mock loader here to verify things are happenning beyond preconnect. PreloaderNetworkHintsMock networkHints; - std::unique_ptr<PreloadRequest> preloadRequest = PreloadRequest::create(String(), + OwnPtr<PreloadRequest> preloadRequest = PreloadRequest::create(String(), TextPosition(), testCase.url, KURL(ParsedURLStringTag(), testCase.baseURL), @@ -73,7 +72,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(HTMLResourcePreloaderTest, testPreconnect)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp index f5839e7..70e4f9a 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp
@@ -30,9 +30,9 @@ #include "bindings/core/v8/V8PerIsolateData.h" #include "core/dom/DocumentParserTiming.h" #include "core/dom/Element.h" +#include "core/events/Event.h" #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" #include "core/dom/ScriptLoader.h" -#include "core/events/Event.h" #include "core/fetch/ScriptResource.h" #include "core/frame/LocalFrame.h" #include "core/html/parser/HTMLInputStream.h" @@ -44,7 +44,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebFrameScheduler.h" #include <inttypes.h> -#include <memory> namespace blink { @@ -52,9 +51,9 @@ // TODO(bmcquade): move this to a shared location if we find ourselves wanting // to trace similar data elsewhere in the codebase. -std::unique_ptr<TracedValue> getTraceArgsForScriptElement(Element* element, const TextPosition& textPosition) +PassOwnPtr<TracedValue> getTraceArgsForScriptElement(Element* element, const TextPosition& textPosition) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); if (scriptLoader && scriptLoader->resource()) value->setString("url", scriptLoader->resource()->url().getString());
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLToken.h b/third_party/WebKit/Source/core/html/parser/HTMLToken.h index 679a187..3c90de9d 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLToken.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLToken.h
@@ -29,8 +29,7 @@ #include "core/dom/Attribute.h" #include "core/html/parser/HTMLParserIdioms.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -200,7 +199,7 @@ { ASSERT(m_type == Uninitialized); m_type = DOCTYPE; - m_doctypeData = wrapUnique(new DoctypeData); + m_doctypeData = adoptPtr(new DoctypeData); } void beginDOCTYPE(UChar character) @@ -255,7 +254,7 @@ m_doctypeData->m_systemIdentifier.append(character); } - std::unique_ptr<DoctypeData> releaseDoctypeData() + PassOwnPtr<DoctypeData> releaseDoctypeData() { return std::move(m_doctypeData); } @@ -473,7 +472,7 @@ Attribute* m_currentAttribute; // For DOCTYPE - std::unique_ptr<DoctypeData> m_doctypeData; + OwnPtr<DoctypeData> m_doctypeData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h index c7166a13..09335ac 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h
@@ -31,8 +31,6 @@ #include "core/html/parser/HTMLToken.h" #include "core/html/parser/InputStreamPreprocessor.h" #include "platform/text/SegmentedString.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -40,7 +38,7 @@ WTF_MAKE_NONCOPYABLE(HTMLTokenizer); USING_FAST_MALLOC(HTMLTokenizer); public: - static std::unique_ptr<HTMLTokenizer> create(const HTMLParserOptions& options) { return wrapUnique(new HTMLTokenizer(options)); } + static PassOwnPtr<HTMLTokenizer> create(const HTMLParserOptions& options) { return adoptPtr(new HTMLTokenizer(options)); } ~HTMLTokenizer(); void reset();
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp index 8ef2234e..b8894f1 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -46,7 +46,6 @@ #include "core/html/parser/HTMLTokenizer.h" #include "platform/text/PlatformLocale.h" #include "wtf/text/CharacterNames.h" -#include <memory> namespace blink { @@ -529,7 +528,7 @@ static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); + OwnPtr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount); } @@ -539,13 +538,13 @@ token->setName(casedName.localName()); } -template<std::unique_ptr<const QualifiedName*[]> getAttrs(), unsigned length> +template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> static void adjustAttributes(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const QualifiedName*[]> attrs = getAttrs(); + OwnPtr<const QualifiedName*[]> attrs = getAttrs(); mapLoweredLocalNameToName(caseMap, attrs.get(), length); } @@ -584,10 +583,10 @@ if (!map) { map = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); + OwnPtr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCount); - std::unique_ptr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); + OwnPtr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount); map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h index e9096c2..74ae5c6b 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
@@ -32,6 +32,7 @@ #include "core/html/parser/HTMLParserOptions.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp index b3f5675..ad5e3d8 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp
@@ -30,7 +30,6 @@ #include "core/html/parser/HTMLParserOptions.h" #include "core/html/parser/HTMLToken.h" #include "core/html/parser/XSSAuditorDelegate.h" -#include <memory> namespace blink { @@ -52,7 +51,7 @@ return; m_sourceTracker.end(m_input.current(), m_tokenizer.get(), m_token); - std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA())); + OwnPtr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA())); HTMLViewSourceDocument::SourceAnnotation annotation = xssInfo ? HTMLViewSourceDocument::AnnotateSourceAsXSS : HTMLViewSourceDocument::AnnotateSourceAsSafe; document()->addSource(m_sourceTracker.sourceForToken(m_token), m_token, annotation);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h index 907a57f..1aca1d2 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h
@@ -32,7 +32,6 @@ #include "core/html/parser/HTMLSourceTracker.h" #include "core/html/parser/HTMLTokenizer.h" #include "core/html/parser/XSSAuditor.h" -#include <memory> namespace blink { @@ -60,7 +59,7 @@ HTMLInputStream m_input; HTMLToken m_token; HTMLSourceTracker m_sourceTracker; - std::unique_ptr<HTMLTokenizer> m_tokenizer; + OwnPtr<HTMLTokenizer> m_tokenizer; XSSAuditor m_xssAuditor; };
diff --git a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp index 913e2b0..263c9a9 100644 --- a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp +++ b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp
@@ -4,8 +4,6 @@ #include "core/html/parser/ParsedChunkQueue.h" -#include <memory> - namespace blink { ParsedChunkQueue::ParsedChunkQueue() @@ -16,7 +14,7 @@ { } -bool ParsedChunkQueue::enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk) +bool ParsedChunkQueue::enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk> chunk) { MutexLocker locker(m_mutex); @@ -32,7 +30,7 @@ m_pendingChunks.clear(); } -void ParsedChunkQueue::takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>& vector) +void ParsedChunkQueue::takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>& vector) { MutexLocker locker(m_mutex);
diff --git a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h index d65f292..3c9c9a7c 100644 --- a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h +++ b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h
@@ -7,11 +7,12 @@ #include "core/html/parser/HTMLDocumentParser.h" #include "wtf/Deque.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -32,16 +33,16 @@ ~ParsedChunkQueue(); - bool enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk>); + bool enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk>); void clear(); - void takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>&); + void takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>&); private: ParsedChunkQueue(); Mutex m_mutex; - Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>> m_pendingChunks; + Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>> m_pendingChunks; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h index 9154fff..cb0932d 100644 --- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h +++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -12,9 +12,7 @@ #include "platform/CrossOriginAttributeValue.h" #include "platform/weborigin/SecurityPolicy.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextPosition.h" -#include <memory> namespace blink { @@ -25,9 +23,9 @@ public: enum RequestType { RequestTypePreload, RequestTypePreconnect, RequestTypeLinkRelPreload }; - static std::unique_ptr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const ReferrerPolicy referrerPolicy, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestType requestType = RequestTypePreload) + static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const ReferrerPolicy referrerPolicy, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestType requestType = RequestTypePreload) { - return wrapUnique(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); + return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); } bool isSafeToSendToAnotherThread() const; @@ -106,7 +104,7 @@ IntegrityMetadataSet m_integrityMetadata; }; -typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream; +typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h b/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h index 5974d8a0..571eecf 100644 --- a/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h +++ b/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h
@@ -7,7 +7,6 @@ #include "core/CoreExport.h" #include "core/html/parser/PreloadRequest.h" -#include <memory> namespace blink { @@ -17,7 +16,7 @@ public: virtual void takeAndPreload(PreloadRequestStream&); private: - virtual void preload(std::unique_ptr<PreloadRequest>, const NetworkHintsInterface&) = 0; + virtual void preload(PassOwnPtr<PreloadRequest>, const NetworkHintsInterface&) = 0; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h index e7d83108..82411a7 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
@@ -24,9 +24,7 @@ #define TextResourceDecoder_h #include "core/CoreExport.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -47,15 +45,15 @@ EncodingFromParentFrame }; - static std::unique_ptr<TextResourceDecoder> create(const String& mimeType, const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetector = false) + static PassOwnPtr<TextResourceDecoder> create(const String& mimeType, const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetector = false) { - return wrapUnique(new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector ? UseAllAutoDetection : UseContentAndBOMBasedDetection)); + return adoptPtr(new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector ? UseAllAutoDetection : UseContentAndBOMBasedDetection)); } // Corresponds to utf-8 decode in Encoding spec: // https://encoding.spec.whatwg.org/#utf-8-decode. - static std::unique_ptr<TextResourceDecoder> createAlwaysUseUTF8ForText() + static PassOwnPtr<TextResourceDecoder> createAlwaysUseUTF8ForText() { - return wrapUnique(new TextResourceDecoder("plain/text", UTF8Encoding(), AlwaysUseUTF8ForText)); + return adoptPtr(new TextResourceDecoder("plain/text", UTF8Encoding(), AlwaysUseUTF8ForText)); } ~TextResourceDecoder(); @@ -114,7 +112,7 @@ ContentType m_contentType; WTF::TextEncoding m_encoding; - std::unique_ptr<TextCodec> m_codec; + OwnPtr<TextCodec> m_codec; EncodingSource m_source; const char* m_hintEncoding; Vector<char> m_buffer; @@ -126,7 +124,7 @@ bool m_sawError; EncodingDetectionOption m_encodingDetectionOption; - std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; + OwnPtr<HTMLMetaCharsetParser> m_charsetParser; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp index 80fb277..f2fc50ca 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
@@ -45,8 +45,6 @@ #include "platform/network/EncodedFormData.h" #include "platform/text/DecodeEscapeSequences.h" #include "wtf/ASCIICType.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace { @@ -395,14 +393,14 @@ if (m_decodedHTTPBody.find(isRequiredForInjection) == kNotFound) m_decodedHTTPBody = String(); if (m_decodedHTTPBody.length() >= miniumLengthForSuffixTree) - m_decodedHTTPBodySuffixTree = wrapUnique(new SuffixTree<ASCIICodebook>(m_decodedHTTPBody, suffixTreeDepth)); + m_decodedHTTPBodySuffixTree = adoptPtr(new SuffixTree<ASCIICodebook>(m_decodedHTTPBody, suffixTreeDepth)); } if (m_decodedURL.isEmpty() && m_decodedHTTPBody.isEmpty()) m_isEnabled = false; } -std::unique_ptr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request) +PassOwnPtr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request) { ASSERT(m_state != Uninitialized); if (!m_isEnabled || m_xssProtection == AllowReflectedXSS) @@ -420,7 +418,7 @@ if (didBlockScript) { bool didBlockEntirePage = (m_xssProtection == BlockReflectedXSS); - std::unique_ptr<XSSInfo> xssInfo = XSSInfo::create(m_documentURL, didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader); + OwnPtr<XSSInfo> xssInfo = XSSInfo::create(m_documentURL, didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader); return xssInfo; } return nullptr;
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.h b/third_party/WebKit/Source/core/html/parser/XSSAuditor.h index 88874b33..0ff1aa2 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.h +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.h
@@ -31,8 +31,8 @@ #include "platform/text/SuffixTree.h" #include "platform/weborigin/KURL.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -63,7 +63,7 @@ void init(Document*, XSSAuditorDelegate*); void initForFragment(); - std::unique_ptr<XSSInfo> filterToken(const FilterTokenRequest&); + PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&); bool isSafeToSendToAnotherThread() const; void setEncoding(const WTF::TextEncoding&); @@ -129,7 +129,7 @@ String m_decodedURL; String m_decodedHTTPBody; String m_httpBodyAsString; - std::unique_ptr<SuffixTree<ASCIICodebook>> m_decodedHTTPBodySuffixTree; + OwnPtr<SuffixTree<ASCIICodebook>> m_decodedHTTPBodySuffixTree; State m_state; bool m_scriptTagFoundInRequest;
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h b/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h index 33e25ce..87c593d 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h
@@ -28,11 +28,11 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/TextPosition.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -43,9 +43,9 @@ USING_FAST_MALLOC(XSSInfo); WTF_MAKE_NONCOPYABLE(XSSInfo); public: - static std::unique_ptr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader) + static PassOwnPtr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader) { - return wrapUnique(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader)); + return adoptPtr(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader)); } String buildConsoleError() const; @@ -84,7 +84,7 @@ KURL m_reportURL; }; -typedef Vector<std::unique_ptr<XSSInfo>> XSSInfoStream; +typedef Vector<OwnPtr<XSSInfo>> XSSInfoStream; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp index 08cae76..f5ce2f8c 100644 --- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp +++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -14,7 +14,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -85,7 +84,7 @@ Document& document() { return m_pageHolder->document(); } private: - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; Persistent<MediaControls> m_mediaControls; };
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h index cdfe4780..f32234b21 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h
@@ -39,8 +39,8 @@ #include "core/html/track/vtt/VTTRegion.h" #include "core/html/track/vtt/VTTTokenizer.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -139,7 +139,7 @@ static bool collectTimeStamp(VTTScanner& input, double& timeStamp); BufferedLineReader m_lineReader; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; AtomicString m_currentId; double m_currentStartTime; double m_currentEndTime;
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp index af9291e..86b14a70 100644 --- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp +++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
@@ -50,7 +50,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include <memory> #include <v8.h> namespace blink { @@ -235,7 +234,7 @@ ImageDecoder::GammaAndColorProfileOption colorSpaceOp = ImageDecoder::GammaAndColorProfileApplied; if (m_options.colorSpaceConversion() == "none") colorSpaceOp = ImageDecoder::GammaAndColorProfileIgnored; - std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, colorSpaceOp)); + OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, colorSpaceOp)); RefPtr<SkImage> frame; if (decoder) { decoder->setData(sharedBuffer.get(), true);
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index 04b488f..a66c15d 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -100,10 +100,8 @@ #include "platform/scroll/Scrollbar.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/TemporaryChange.h" -#include <memory> namespace blink { @@ -1116,12 +1114,12 @@ if (!mouseEvent.fromTouch()) m_frame->selection().setCaretBlinkingSuspended(false); - std::unique_ptr<UserGestureIndicator> gestureIndicator; + OwnPtr<UserGestureIndicator> gestureIndicator; if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken) - gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); + gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); else - gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture)); + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture)); #if OS(WIN) if (Page* page = m_frame->page())
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp index 5fa99f75..0452500 100644 --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -16,7 +16,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/PlatformMouseEvent.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -30,7 +29,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; class TapEventBuilder : public PlatformGestureEvent {
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp index 9d7d5a8..d5b475c 100644 --- a/third_party/WebKit/Source/core/input/ScrollManager.cpp +++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -19,8 +19,6 @@ #include "core/page/scrolling/ScrollState.h" #include "core/paint/PaintLayer.h" #include "platform/PlatformGestureEvent.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -248,7 +246,7 @@ // using parts of the scroll customization framework on just this element. computeScrollChainForSingleNode(*node, m_currentScrollChain); - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->delta_x = delta.width(); scrollStateData->delta_y = delta.height(); scrollStateData->position_x = position.x(); @@ -328,7 +326,7 @@ passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { m_currentScrollChain.clear(); - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->position_x = gestureEvent.position().x(); scrollStateData->position_y = gestureEvent.position().y(); scrollStateData->is_beginning = true; @@ -382,7 +380,7 @@ } if (handleScrollCustomization) { - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->delta_x = delta.width(); scrollStateData->delta_y = delta.height(); scrollStateData->delta_granularity = ScrollByPrecisePixel; @@ -447,7 +445,7 @@ if (node) { passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->is_ending = true; scrollStateData->is_in_inertial_phase = gestureEvent.inertialPhase() == ScrollInertialPhaseMomentum; scrollStateData->from_user_input = true;
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp index 5971003..7b6d67c 100644 --- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp +++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -18,8 +18,6 @@ #include "platform/Histogram.h" #include "platform/PlatformTouchEvent.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -471,7 +469,7 @@ isSameOrigin = true; } - std::unique_ptr<UserGestureIndicator> gestureIndicator; + OwnPtr<UserGestureIndicator> gestureIndicator; if (isTap || isSameOrigin) { UserGestureUtilizedCallback* callback = 0; // These are cases we'd like to migrate to not hold a user gesture. @@ -482,9 +480,9 @@ callback = this; } if (m_touchSequenceUserGestureToken) - gestureIndicator = wrapUnique(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback)); + gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback)); else - gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback)); + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback)); m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); }
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp index 19fa9dc..4bb74a6c 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp
@@ -8,7 +8,7 @@ #include "bindings/core/v8/SourceLocation.h" #include "core/inspector/ScriptArguments.h" #include "wtf/CurrentTime.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -40,7 +40,7 @@ } // static -ConsoleMessage* ConsoleMessage::create(MessageSource source, MessageLevel level, const String& message, std::unique_ptr<SourceLocation> location, ScriptArguments* arguments) +ConsoleMessage* ConsoleMessage::create(MessageSource source, MessageLevel level, const String& message, PassOwnPtr<SourceLocation> location, ScriptArguments* arguments) { return new ConsoleMessage(source, level, message, std::move(location), arguments); } @@ -54,7 +54,7 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageLevel level, const String& message, - std::unique_ptr<SourceLocation> location, + PassOwnPtr<SourceLocation> location, ScriptArguments* arguments) : m_source(source) , m_level(level)
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h index 0df4f4f..3fcc279 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h
@@ -13,7 +13,6 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ class CORE_EXPORT ConsoleMessage final: public GarbageCollectedFinalized<ConsoleMessage> { public: // Location should not be null. Zero lineNumber or columnNumber means unknown. - static ConsoleMessage* create(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>, ScriptArguments* = nullptr); + static ConsoleMessage* create(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>, ScriptArguments* = nullptr); // Shortcut when location is unknown. Captures current location. static ConsoleMessage* create(MessageSource, MessageLevel, const String& message); @@ -57,13 +56,13 @@ DECLARE_TRACE(); private: - ConsoleMessage(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>, ScriptArguments*); + ConsoleMessage(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>, ScriptArguments*); MessageSource m_source; MessageLevel m_level; MessageType m_type; String m_message; - std::unique_ptr<SourceLocation> m_location; + OwnPtr<SourceLocation> m_location; Member<ScriptArguments> m_scriptArguments; unsigned long m_requestIdentifier; double m_timestamp;
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp index 3115d97..02f656a8 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp
@@ -53,7 +53,6 @@ #include "wtf/RefPtr.h" #include "wtf/text/Base64.h" #include "wtf/text/CString.h" -#include <memory> namespace blink { @@ -400,7 +399,7 @@ { Digest* digest = new Digest(node); - std::unique_ptr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); + OwnPtr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); DigestValue digestResult; Node::NodeType nodeType = node->getNodeType(); @@ -420,7 +419,7 @@ AttributeCollection attributes = element.attributesWithoutUpdate(); if (!attributes.isEmpty()) { - std::unique_ptr<WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorithmSha1); + OwnPtr<WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorithmSha1); for (auto& attribute : attributes) { addStringToDigestor(attrsDigestor.get(), attribute.name().toString()); addStringToDigestor(attrsDigestor.get(), attribute.value().getString());
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h index 37155bf..68ba046 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h
@@ -33,6 +33,8 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp index 47e1b9e7..fadc5d0b 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -29,7 +29,6 @@ #include "platform/animation/TimingFunction.h" #include "platform/v8_inspector/public/V8InspectorSession.h" #include "wtf/text/Base64.h" -#include <memory> namespace AnimationAgentState { static const char animationAgentEnabled[] = "animationAgentEnabled"; @@ -426,7 +425,7 @@ Element* element = effect->target(); HeapVector<Member<CSSStyleDeclaration>> styles = m_cssAgent->matchingStyles(element); - std::unique_ptr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); + OwnPtr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); addStringToDigestor(digestor.get(), type); addStringToDigestor(digestor.get(), animation.id()); for (CSSPropertyID property : cssProperties) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h index 1e4e2b3..c8815ce 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
@@ -10,6 +10,7 @@ #include "core/css/CSSKeyframesRule.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Animation.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h b/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h index 2acbcdb4..d19d368 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h
@@ -30,6 +30,7 @@ #include "core/inspector/protocol/ApplicationCache.h" #include "core/loader/appcache/ApplicationCacheHost.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp index 4c062559..c8bf64b 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -78,10 +78,8 @@ #include "platform/PlatformTouchEvent.h" #include "platform/v8_inspector/public/V8InspectorSession.h" #include "wtf/ListHashSet.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -1091,7 +1089,7 @@ m_client->setInspectMode(searchMode, searchMode != NotSearching ? highlightConfigFromInspectorObject(errorString, highlightInspectorObject) : nullptr); } -std::unique_ptr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString* errorString, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject) +PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString* errorString, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject) { if (!highlightInspectorObject.isJust()) { *errorString = "Internal error: highlight configuration parameter is missing"; @@ -1099,7 +1097,7 @@ } protocol::DOM::HighlightConfig* config = highlightInspectorObject.fromJust(); - std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); + OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); highlightConfig->showInfo = config->getShowInfo(false); highlightConfig->showRulers = config->getShowRulers(false); highlightConfig->showExtensionLines = config->getShowExtensionLines(false); @@ -1140,13 +1138,13 @@ void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - std::unique_ptr<FloatQuad> quad = wrapUnique(new FloatQuad(FloatRect(x, y, width, height))); + OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad(FloatRect(x, y, width, height))); innerHighlightQuad(std::move(quad), color, outlineColor); } void InspectorDOMAgent::highlightQuad(ErrorString* errorString, std::unique_ptr<protocol::Array<double>> quadArray, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - std::unique_ptr<FloatQuad> quad = wrapUnique(new FloatQuad()); + OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad()); if (!parseQuad(std::move(quadArray), quad.get())) { *errorString = "Invalid Quad format"; return; @@ -1154,9 +1152,9 @@ innerHighlightQuad(std::move(quad), color, outlineColor); } -void InspectorDOMAgent::innerHighlightQuad(std::unique_ptr<FloatQuad> quad, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) +void InspectorDOMAgent::innerHighlightQuad(PassOwnPtr<FloatQuad> quad, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); + OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); highlightConfig->content = parseColor(color.fromMaybe(nullptr)); highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr)); if (m_client) @@ -1196,7 +1194,7 @@ if (!node) return; - std::unique_ptr<InspectorHighlightConfig> highlightConfig = highlightConfigFromInspectorObject(errorString, std::move(highlightInspectorObject)); + OwnPtr<InspectorHighlightConfig> highlightConfig = highlightConfigFromInspectorObject(errorString, std::move(highlightInspectorObject)); if (!highlightConfig) return; @@ -1213,7 +1211,7 @@ LocalFrame* frame = IdentifiersFactory::frameById(m_inspectedFrames, frameId); // FIXME: Inspector doesn't currently work cross process. if (frame && frame->deprecatedLocalOwner()) { - std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); + OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); highlightConfig->showInfo = true; // Always show tooltips for frames. highlightConfig->content = parseColor(color.fromMaybe(nullptr)); highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr));
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h index 84dc60e..68468d6d 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h
@@ -39,12 +39,14 @@ #include "platform/geometry/FloatQuad.h" #include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/public/V8InspectorSession.h" + #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -87,8 +89,8 @@ virtual ~Client() { } virtual void hideHighlight() { } virtual void highlightNode(Node*, const InspectorHighlightConfig&, bool omitTooltip) { } - virtual void highlightQuad(std::unique_ptr<FloatQuad>, const InspectorHighlightConfig&) { } - virtual void setInspectMode(SearchMode searchMode, std::unique_ptr<InspectorHighlightConfig>) { } + virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) { } + virtual void setInspectMode(SearchMode searchMode, PassOwnPtr<InspectorHighlightConfig>) { } virtual void setInspectedNode(Node*) { } }; @@ -198,7 +200,7 @@ void innerEnable(); void setSearchingForNode(ErrorString*, SearchMode, const Maybe<protocol::DOM::HighlightConfig>&); - std::unique_ptr<InspectorHighlightConfig> highlightConfigFromInspectorObject(ErrorString*, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject); + PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(ErrorString*, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject); // Node-related methods. typedef HeapHashMap<Member<Node>, int> NodeToIdMap; @@ -226,7 +228,7 @@ void discardFrontendBindings(); - void innerHighlightQuad(std::unique_ptr<FloatQuad>, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor); + void innerHighlightQuad(PassOwnPtr<FloatQuad>, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor); bool pushDocumentUponHandlelessOperation(ErrorString*);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h index 844bae2..4bcddb7 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h
@@ -37,6 +37,7 @@ #include "core/inspector/InspectorDOMAgent.h" #include "core/inspector/protocol/DOMDebugger.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h index 0d48264..0244a01 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h
@@ -35,6 +35,7 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Input.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp index 4d2887f..688a196 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -57,7 +57,6 @@ #include "public/platform/WebLayer.h" #include "wtf/text/Base64.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -399,7 +398,7 @@ const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); if (!snapshot) return; - std::unique_ptr<Vector<char>> base64Data = snapshot->replay(fromStep.fromMaybe(0), toStep.fromMaybe(0), scale.fromMaybe(1.0)); + OwnPtr<Vector<char>> base64Data = snapshot->replay(fromStep.fromMaybe(0), toStep.fromMaybe(0), scale.fromMaybe(1.0)); if (!base64Data) { *errorString = "Image encoding failed"; return; @@ -424,7 +423,7 @@ FloatRect rect; if (clipRect.isJust()) parseRect(clipRect.fromJust(), &rect); - std::unique_ptr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount.fromMaybe(1), minDuration.fromMaybe(0), clipRect.isJust() ? &rect : 0); + OwnPtr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount.fromMaybe(1), minDuration.fromMaybe(0), clipRect.isJust() ? &rect : 0); *outTimings = Array<Array<double>>::create(); for (size_t i = 0; i < timings->size(); ++i) { const Vector<double>& row = (*timings)[i];
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h index 4f9ea48..76db7d9 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
@@ -35,6 +35,7 @@ #include "core/inspector/protocol/LayerTree.h" #include "platform/Timer.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp index 0fd1bb3..1d06a3d 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp
@@ -31,6 +31,7 @@ #include "core/inspector/InspectorMemoryAgent.h" #include "core/inspector/InstanceCounters.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h index 9acd5eb..05a2ee66 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h
@@ -34,6 +34,7 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Memory.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 31a9361..9171a7ce 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -74,7 +74,6 @@ #include "wtf/CurrentTime.h" #include "wtf/RefPtr.h" #include "wtf/text/Base64.h" -#include <memory> namespace blink { @@ -184,7 +183,7 @@ String m_mimeType; String m_textEncodingName; std::unique_ptr<GetResponseBodyCallback> m_callback; - std::unique_ptr<FileReaderLoader> m_loader; + OwnPtr<FileReaderLoader> m_loader; RefPtr<SharedBuffer> m_rawData; };
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h index eacb8c7e..d787c07 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
@@ -38,6 +38,7 @@ #include "core/inspector/protocol/Network.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp index 375be28..174c351 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -71,7 +71,6 @@ #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -149,12 +148,12 @@ return type == Resource::CSSStyleSheet || type == Resource::XSLStyleSheet || type == Resource::Script || type == Resource::Raw || type == Resource::ImportResource || type == Resource::MainResource; } -static std::unique_ptr<TextResourceDecoder> createResourceTextDecoder(const String& mimeType, const String& textEncodingName) +static PassOwnPtr<TextResourceDecoder> createResourceTextDecoder(const String& mimeType, const String& textEncodingName) { if (!textEncodingName.isEmpty()) return TextResourceDecoder::create("text/plain", textEncodingName); if (DOMImplementation::isXMLMIMEType(mimeType)) { - std::unique_ptr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); + OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); decoder->useLenientXMLDecoding(); return decoder; } @@ -164,7 +163,7 @@ return TextResourceDecoder::create("text/plain", "UTF-8"); if (DOMImplementation::isTextMIMEType(mimeType)) return TextResourceDecoder::create("text/plain", "ISO-8859-1"); - return std::unique_ptr<TextResourceDecoder>(); + return PassOwnPtr<TextResourceDecoder>(); } static void maybeEncodeTextContent(const String& textContent, PassRefPtr<SharedBuffer> buffer, String* result, bool* base64Encoded) @@ -189,7 +188,7 @@ return false; String textContent; - std::unique_ptr<TextResourceDecoder> decoder = createResourceTextDecoder(mimeType, textEncodingName); + OwnPtr<TextResourceDecoder> decoder = createResourceTextDecoder(mimeType, textEncodingName); WTF::TextEncoding encoding(textEncodingName); if (decoder) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorSession.h b/third_party/WebKit/Source/core/inspector/InspectorSession.h index 74bf806..6628556 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorSession.h +++ b/third_party/WebKit/Source/core/inspector/InspectorSession.h
@@ -12,6 +12,7 @@ #include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/public/V8InspectorSessionClient.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp index 2a95b4b..ace6c4d 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -53,7 +53,8 @@ #include "core/inspector/InspectorResourceContainer.h" #include "core/svg/SVGStyleElement.h" #include "platform/v8_inspector/public/V8ContentSearchUtil.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextPosition.h" #include <algorithm> @@ -883,13 +884,13 @@ InspectorStyleSheetBase::InspectorStyleSheetBase(Listener* listener) : m_id(IdentifiersFactory::createIdentifier()) , m_listener(listener) - , m_lineEndings(wrapUnique(new LineEndings())) + , m_lineEndings(adoptPtr(new LineEndings())) { } void InspectorStyleSheetBase::onStyleSheetTextChanged() { - m_lineEndings = wrapUnique(new LineEndings()); + m_lineEndings = adoptPtr(new LineEndings()); if (listener()) listener()->styleSheetChanged(this); }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h index c4be8519..26d56ac6 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h
@@ -35,7 +35,6 @@ #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -117,7 +116,7 @@ String m_id; Listener* m_listener; - std::unique_ptr<LineEndings> m_lineEndings; + OwnPtr<LineEndings> m_lineEndings; }; class InspectorStyleSheet : public InspectorStyleSheetBase {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h index 235166d..84562608 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h
@@ -11,6 +11,8 @@ #include "wtf/Forward.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp index a3426f5..073ed50 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -34,7 +34,6 @@ #include "wtf/Vector.h" #include "wtf/text/TextPosition.h" #include <inttypes.h> -#include <memory> #include <v8-profiler.h> #include <v8.h> @@ -168,9 +167,9 @@ } // namespace namespace InspectorScheduleStyleInvalidationTrackingEvent { -std::unique_ptr<TracedValue> fillCommonPart(Element& element, const InvalidationSet& invalidationSet, const char* invalidatedSelector) +PassOwnPtr<TracedValue> fillCommonPart(Element& element, const InvalidationSet& invalidationSet, const char* invalidatedSelector) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(element.document().frame())); setNodeInfo(value.get(), &element, "nodeId", "nodeName"); value->setString("invalidationSet", descendantInvalidationSetToIdString(invalidationSet)); @@ -199,30 +198,30 @@ return priorityString; } -std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::idChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& id) +PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::idChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& id) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); + OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); value->setString("changedId", id); return value; } -std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::classChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& className) +PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::classChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& className) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); + OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); value->setString("changedClass", className); return value; } -std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::attributeChange(Element& element, const InvalidationSet& invalidationSet, const QualifiedName& attributeName) +PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::attributeChange(Element& element, const InvalidationSet& invalidationSet, const QualifiedName& attributeName) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); + OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); value->setString("changedAttribute", attributeName.toString()); return value; } -std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::pseudoChange(Element& element, const InvalidationSet& invalidationSet, CSSSelector::PseudoType pseudoType) +PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::pseudoChange(Element& element, const InvalidationSet& invalidationSet, CSSSelector::PseudoType pseudoType) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); + OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); value->setString("changedPseudo", pseudoTypeToString(pseudoType)); return value; } @@ -241,9 +240,9 @@ const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParent[] = "Prevent style sharing for parent"; namespace InspectorStyleInvalidatorInvalidateEvent { -std::unique_ptr<TracedValue> fillCommonPart(Element& element, const char* reason) +PassOwnPtr<TracedValue> fillCommonPart(Element& element, const char* reason) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(element.document().frame())); setNodeInfo(value.get(), &element, "nodeId", "nodeName"); value->setString("reason", reason); @@ -251,14 +250,14 @@ } } // namespace InspectorStyleInvalidatorInvalidateEvent -std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::data(Element& element, const char* reason) +PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::data(Element& element, const char* reason) { return fillCommonPart(element, reason); } -std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::selectorPart(Element& element, const char* reason, const InvalidationSet& invalidationSet, const String& selectorPart) +PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::selectorPart(Element& element, const char* reason, const InvalidationSet& invalidationSet, const String& selectorPart) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, reason); + OwnPtr<TracedValue> value = fillCommonPart(element, reason); value->beginArray("invalidationList"); invalidationSet.toTracedValue(value.get()); value->endArray(); @@ -266,9 +265,9 @@ return value; } -std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::invalidationList(Element& element, const Vector<RefPtr<InvalidationSet>>& invalidationList) +PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::invalidationList(Element& element, const Vector<RefPtr<InvalidationSet>>& invalidationList) { - std::unique_ptr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalidationList); + OwnPtr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalidationList); value->beginArray("invalidationList"); for (const auto& invalidationSet : invalidationList) invalidationSet->toTracedValue(value.get()); @@ -276,11 +275,11 @@ return value; } -std::unique_ptr<TracedValue> InspectorStyleRecalcInvalidationTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) +PassOwnPtr<TracedValue> InspectorStyleRecalcInvalidationTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) { ASSERT(node); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(node->document().frame())); setNodeInfo(value.get(), node, "nodeId", "nodeName"); value->setString("reason", reason.reasonString()); @@ -289,7 +288,7 @@ return value; } -std::unique_ptr<TracedValue> InspectorLayoutEvent::beginData(FrameView* frameView) +PassOwnPtr<TracedValue> InspectorLayoutEvent::beginData(FrameView* frameView) { bool isPartial; unsigned needsLayoutObjects; @@ -297,7 +296,7 @@ LocalFrame& frame = frameView->frame(); frame.view()->countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("dirtyObjects", needsLayoutObjects); value->setInteger("totalObjects", totalObjects); value->setBoolean("partialLayout", isPartial); @@ -331,12 +330,12 @@ setNodeInfo(value, node, idFieldName, nameFieldName); } -std::unique_ptr<TracedValue> InspectorLayoutEvent::endData(LayoutObject* rootForThisLayout) +PassOwnPtr<TracedValue> InspectorLayoutEvent::endData(LayoutObject* rootForThisLayout) { Vector<FloatQuad> quads; rootForThisLayout->absoluteQuads(quads); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); if (quads.size() >= 1) { createQuad(value.get(), "root", quads[0]); setGeneratingNodeInfo(value.get(), rootForThisLayout, "rootNode"); @@ -382,10 +381,10 @@ const char ScrollbarChanged[] = "Scrollbar changed"; } // namespace LayoutInvalidationReason -std::unique_ptr<TracedValue> InspectorLayoutInvalidationTrackingEvent::data(const LayoutObject* layoutObject, LayoutInvalidationReasonForTracing reason) +PassOwnPtr<TracedValue> InspectorLayoutInvalidationTrackingEvent::data(const LayoutObject* layoutObject, LayoutInvalidationReasonForTracing reason) { ASSERT(layoutObject); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId", "nodeName"); value->setString("reason", reason); @@ -393,21 +392,21 @@ return value; } -std::unique_ptr<TracedValue> InspectorPaintInvalidationTrackingEvent::data(const LayoutObject* layoutObject, const LayoutObject& paintContainer) +PassOwnPtr<TracedValue> InspectorPaintInvalidationTrackingEvent::data(const LayoutObject* layoutObject, const LayoutObject& paintContainer) { ASSERT(layoutObject); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), &paintContainer, "paintId"); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId", "nodeName"); return value; } -std::unique_ptr<TracedValue> InspectorScrollInvalidationTrackingEvent::data(const LayoutObject& layoutObject) +PassOwnPtr<TracedValue> InspectorScrollInvalidationTrackingEvent::data(const LayoutObject& layoutObject) { static const char ScrollInvalidationReason[] = "Scroll with viewport-constrained element"; - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject.frame())); value->setString("reason", ScrollInvalidationReason); setGeneratingNodeInfo(value.get(), &layoutObject, "nodeId", "nodeName"); @@ -415,21 +414,21 @@ return value; } -std::unique_ptr<TracedValue> InspectorChangeResourcePriorityEvent::data(unsigned long identifier, const ResourceLoadPriority& loadPriority) +PassOwnPtr<TracedValue> InspectorChangeResourcePriorityEvent::data(unsigned long identifier, const ResourceLoadPriority& loadPriority) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("priority", resourcePriorityString(loadPriority)); return value; } -std::unique_ptr<TracedValue> InspectorSendRequestEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceRequest& request) +PassOwnPtr<TracedValue> InspectorSendRequestEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceRequest& request) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setString("url", request.url().getString()); @@ -441,11 +440,11 @@ return value; } -std::unique_ptr<TracedValue> InspectorReceiveResponseEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& response) +PassOwnPtr<TracedValue> InspectorReceiveResponseEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& response) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setInteger("statusCode", response.httpStatusCode()); @@ -453,22 +452,22 @@ return value; } -std::unique_ptr<TracedValue> InspectorReceiveDataEvent::data(unsigned long identifier, LocalFrame* frame, int encodedDataLength) +PassOwnPtr<TracedValue> InspectorReceiveDataEvent::data(unsigned long identifier, LocalFrame* frame, int encodedDataLength) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setInteger("encodedDataLength", encodedDataLength); return value; } -std::unique_ptr<TracedValue> InspectorResourceFinishEvent::data(unsigned long identifier, double finishTime, bool didFail) +PassOwnPtr<TracedValue> InspectorResourceFinishEvent::data(unsigned long identifier, double finishTime, bool didFail) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setBoolean("didFail", didFail); if (finishTime) @@ -484,39 +483,39 @@ return frame; } -static std::unique_ptr<TracedValue> genericTimerData(ExecutionContext* context, int timerId) +static PassOwnPtr<TracedValue> genericTimerData(ExecutionContext* context, int timerId) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("timerId", timerId); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); return value; } -std::unique_ptr<TracedValue> InspectorTimerInstallEvent::data(ExecutionContext* context, int timerId, int timeout, bool singleShot) +PassOwnPtr<TracedValue> InspectorTimerInstallEvent::data(ExecutionContext* context, int timerId, int timeout, bool singleShot) { - std::unique_ptr<TracedValue> value = genericTimerData(context, timerId); + OwnPtr<TracedValue> value = genericTimerData(context, timerId); value->setInteger("timeout", timeout); value->setBoolean("singleShot", singleShot); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorTimerRemoveEvent::data(ExecutionContext* context, int timerId) +PassOwnPtr<TracedValue> InspectorTimerRemoveEvent::data(ExecutionContext* context, int timerId) { - std::unique_ptr<TracedValue> value = genericTimerData(context, timerId); + OwnPtr<TracedValue> value = genericTimerData(context, timerId); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorTimerFireEvent::data(ExecutionContext* context, int timerId) +PassOwnPtr<TracedValue> InspectorTimerFireEvent::data(ExecutionContext* context, int timerId) { return genericTimerData(context, timerId); } -std::unique_ptr<TracedValue> InspectorAnimationFrameEvent::data(ExecutionContext* context, int callbackId) +PassOwnPtr<TracedValue> InspectorAnimationFrameEvent::data(ExecutionContext* context, int callbackId) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("id", callbackId); if (context->isDocument()) value->setString("frame", toHexString(toDocument(context)->frame())); @@ -526,9 +525,9 @@ return value; } -std::unique_ptr<TracedValue> genericIdleCallbackEvent(ExecutionContext* context, int id) +PassOwnPtr<TracedValue> genericIdleCallbackEvent(ExecutionContext* context, int id) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("id", id); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -536,29 +535,29 @@ return value; } -std::unique_ptr<TracedValue> InspectorIdleCallbackRequestEvent::data(ExecutionContext* context, int id, double timeout) +PassOwnPtr<TracedValue> InspectorIdleCallbackRequestEvent::data(ExecutionContext* context, int id, double timeout) { - std::unique_ptr<TracedValue> value = genericIdleCallbackEvent(context, id); + OwnPtr<TracedValue> value = genericIdleCallbackEvent(context, id); value->setInteger("timeout", timeout); return value; } -std::unique_ptr<TracedValue> InspectorIdleCallbackCancelEvent::data(ExecutionContext* context, int id) +PassOwnPtr<TracedValue> InspectorIdleCallbackCancelEvent::data(ExecutionContext* context, int id) { return genericIdleCallbackEvent(context, id); } -std::unique_ptr<TracedValue> InspectorIdleCallbackFireEvent::data(ExecutionContext* context, int id, double allottedMilliseconds, bool timedOut) +PassOwnPtr<TracedValue> InspectorIdleCallbackFireEvent::data(ExecutionContext* context, int id, double allottedMilliseconds, bool timedOut) { - std::unique_ptr<TracedValue> value = genericIdleCallbackEvent(context, id); + OwnPtr<TracedValue> value = genericIdleCallbackEvent(context, id); value->setDouble("allottedMilliseconds", allottedMilliseconds); value->setBoolean("timedOut", timedOut); return value; } -std::unique_ptr<TracedValue> InspectorParseHtmlEvent::beginData(Document* document, unsigned startLine) +PassOwnPtr<TracedValue> InspectorParseHtmlEvent::beginData(Document* document, unsigned startLine) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("startLine", startLine); value->setString("frame", toHexString(document->frame())); value->setString("url", document->url().getString()); @@ -566,23 +565,23 @@ return value; } -std::unique_ptr<TracedValue> InspectorParseHtmlEvent::endData(unsigned endLine) +PassOwnPtr<TracedValue> InspectorParseHtmlEvent::endData(unsigned endLine) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("endLine", endLine); return value; } -std::unique_ptr<TracedValue> InspectorParseAuthorStyleSheetEvent::data(const CSSStyleSheetResource* cachedStyleSheet) +PassOwnPtr<TracedValue> InspectorParseAuthorStyleSheetEvent::data(const CSSStyleSheetResource* cachedStyleSheet) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("styleSheetUrl", cachedStyleSheet->url().getString()); return value; } -std::unique_ptr<TracedValue> InspectorXhrReadyStateChangeEvent::data(ExecutionContext* context, XMLHttpRequest* request) +PassOwnPtr<TracedValue> InspectorXhrReadyStateChangeEvent::data(ExecutionContext* context, XMLHttpRequest* request) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("url", request->url().getString()); value->setInteger("readyState", request->readyState()); if (LocalFrame* frame = frameForExecutionContext(context)) @@ -591,9 +590,9 @@ return value; } -std::unique_ptr<TracedValue> InspectorXhrLoadEvent::data(ExecutionContext* context, XMLHttpRequest* request) +PassOwnPtr<TracedValue> InspectorXhrLoadEvent::data(ExecutionContext* context, XMLHttpRequest* request) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("url", request->url().getString()); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -618,20 +617,20 @@ const char InspectorLayerInvalidationTrackingEvent::ReflectionLayerChanged[] = "Reflection layer change"; const char InspectorLayerInvalidationTrackingEvent::NewCompositedLayer[] = "Assigned a new composited layer"; -std::unique_ptr<TracedValue> InspectorLayerInvalidationTrackingEvent::data(const PaintLayer* layer, const char* reason) +PassOwnPtr<TracedValue> InspectorLayerInvalidationTrackingEvent::data(const PaintLayer* layer, const char* reason) { const LayoutObject& paintInvalidationContainer = layer->layoutObject()->containerForPaintInvalidation(); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(paintInvalidationContainer.frame())); setGeneratingNodeInfo(value.get(), &paintInvalidationContainer, "paintId"); value->setString("reason", reason); return value; } -std::unique_ptr<TracedValue> InspectorPaintEvent::data(LayoutObject* layoutObject, const LayoutRect& clipRect, const GraphicsLayer* graphicsLayer) +PassOwnPtr<TracedValue> InspectorPaintEvent::data(LayoutObject* layoutObject, const LayoutRect& clipRect, const GraphicsLayer* graphicsLayer) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); FloatQuad quad; localToPageQuad(*layoutObject, clipRect, &quad); @@ -643,9 +642,9 @@ return value; } -std::unique_ptr<TracedValue> frameEventData(LocalFrame* frame) +PassOwnPtr<TracedValue> frameEventData(LocalFrame* frame) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); bool isMainFrame = frame && frame->isMainFrame(); value->setBoolean("isMainFrame", isMainFrame); @@ -654,35 +653,35 @@ } -std::unique_ptr<TracedValue> InspectorCommitLoadEvent::data(LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorCommitLoadEvent::data(LocalFrame* frame) { return frameEventData(frame); } -std::unique_ptr<TracedValue> InspectorMarkLoadEvent::data(LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorMarkLoadEvent::data(LocalFrame* frame) { return frameEventData(frame); } -std::unique_ptr<TracedValue> InspectorScrollLayerEvent::data(LayoutObject* layoutObject) +PassOwnPtr<TracedValue> InspectorScrollLayerEvent::data(LayoutObject* layoutObject) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId"); return value; } -std::unique_ptr<TracedValue> InspectorUpdateLayerTreeEvent::data(LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorUpdateLayerTreeEvent::data(LocalFrame* frame) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); return value; } namespace { -std::unique_ptr<TracedValue> fillLocation(const String& url, const TextPosition& textPosition) +PassOwnPtr<TracedValue> fillLocation(const String& url, const TextPosition& textPosition) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("url", url); value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); @@ -690,31 +689,31 @@ } } -std::unique_ptr<TracedValue> InspectorEvaluateScriptEvent::data(LocalFrame* frame, const String& url, const TextPosition& textPosition) +PassOwnPtr<TracedValue> InspectorEvaluateScriptEvent::data(LocalFrame* frame, const String& url, const TextPosition& textPosition) { - std::unique_ptr<TracedValue> value = fillLocation(url, textPosition); + OwnPtr<TracedValue> value = fillLocation(url, textPosition); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorParseScriptEvent::data(unsigned long identifier, const String& url) +PassOwnPtr<TracedValue> InspectorParseScriptEvent::data(unsigned long identifier, const String& url) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("url", url); return value; } -std::unique_ptr<TracedValue> InspectorCompileScriptEvent::data(const String& url, const TextPosition& textPosition) +PassOwnPtr<TracedValue> InspectorCompileScriptEvent::data(const String& url, const TextPosition& textPosition) { return fillLocation(url, textPosition); } -std::unique_ptr<TracedValue> InspectorFunctionCallEvent::data(ExecutionContext* context, const v8::Local<v8::Function>& function) +PassOwnPtr<TracedValue> InspectorFunctionCallEvent::data(ExecutionContext* context, const v8::Local<v8::Function>& function) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -725,34 +724,34 @@ v8::Local<v8::Value> functionName = originalFunction->GetDebugName(); if (!functionName.IsEmpty() && functionName->IsString()) value->setString("functionName", toCoreString(functionName.As<v8::String>())); - std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(originalFunction); + OwnPtr<SourceLocation> location = SourceLocation::fromFunction(originalFunction); value->setString("scriptId", String::number(location->scriptId())); value->setString("scriptName", location->url()); value->setInteger("scriptLine", location->lineNumber()); return value; } -std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutImage& layoutImage) +PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutImage& layoutImage) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), &layoutImage, "nodeId"); if (const ImageResource* resource = layoutImage.cachedImage()) value->setString("url", resource->url().getString()); return value; } -std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject& owningLayoutObject, const StyleImage& styleImage) +PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject& owningLayoutObject, const StyleImage& styleImage) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), &owningLayoutObject, "nodeId"); if (const ImageResource* resource = styleImage.cachedImage()) value->setString("url", resource->url().getString()); return value; } -std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject* owningLayoutObject, const ImageResource& imageResource) +PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject* owningLayoutObject, const ImageResource& imageResource) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), owningLayoutObject, "nodeId"); value->setString("url", imageResource.url().getString()); return value; @@ -765,9 +764,9 @@ return heapStatistics.used_heap_size(); } -std::unique_ptr<TracedValue> InspectorUpdateCountersEvent::data() +PassOwnPtr<TracedValue> InspectorUpdateCountersEvent::data() { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); if (isMainThread()) { value->setInteger("documents", InstanceCounters::counterValue(InstanceCounters::DocumentCounter)); value->setInteger("nodes", InstanceCounters::counterValue(InstanceCounters::NodeCounter)); @@ -777,67 +776,67 @@ return value; } -std::unique_ptr<TracedValue> InspectorInvalidateLayoutEvent::data(LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorInvalidateLayoutEvent::data(LocalFrame* frame) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorRecalculateStylesEvent::data(LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorRecalculateStylesEvent::data(LocalFrame* frame) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorEventDispatchEvent::data(const Event& event) +PassOwnPtr<TracedValue> InspectorEventDispatchEvent::data(const Event& event) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("type", event.type()); setCallStack(value.get()); return value; } -std::unique_ptr<TracedValue> InspectorTimeStampEvent::data(ExecutionContext* context, const String& message) +PassOwnPtr<TracedValue> InspectorTimeStampEvent::data(ExecutionContext* context, const String& message) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("message", message); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); return value; } -std::unique_ptr<TracedValue> InspectorTracingSessionIdForWorkerEvent::data(const String& sessionId, const String& workerId, WorkerThread* workerThread) +PassOwnPtr<TracedValue> InspectorTracingSessionIdForWorkerEvent::data(const String& sessionId, const String& workerId, WorkerThread* workerThread) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setString("workerId", workerId); value->setDouble("workerThreadId", workerThread->platformThreadId()); return value; } -std::unique_ptr<TracedValue> InspectorTracingStartedInFrame::data(const String& sessionId, LocalFrame* frame) +PassOwnPtr<TracedValue> InspectorTracingStartedInFrame::data(const String& sessionId, LocalFrame* frame) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setString("page", toHexString(frame)); return value; } -std::unique_ptr<TracedValue> InspectorSetLayerTreeId::data(const String& sessionId, int layerTreeId) +PassOwnPtr<TracedValue> InspectorSetLayerTreeId::data(const String& sessionId, int layerTreeId) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setInteger("layerTreeId", layerTreeId); return value; } -std::unique_ptr<TracedValue> InspectorAnimationEvent::data(const Animation& animation) +PassOwnPtr<TracedValue> InspectorAnimationEvent::data(const Animation& animation) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("id", String::number(animation.sequenceNumber())); value->setString("state", animation.playState()); if (const AnimationEffect* effect = animation.effect()) { @@ -850,16 +849,16 @@ return value; } -std::unique_ptr<TracedValue> InspectorAnimationStateEvent::data(const Animation& animation) +PassOwnPtr<TracedValue> InspectorAnimationStateEvent::data(const Animation& animation) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("state", animation.playState()); return value; } -std::unique_ptr<TracedValue> InspectorHitTestEvent::endData(const HitTestRequest& request, const HitTestLocation& location, const HitTestResult& result) +PassOwnPtr<TracedValue> InspectorHitTestEvent::endData(const HitTestRequest& request, const HitTestLocation& location, const HitTestResult& result) { - std::unique_ptr<TracedValue> value(TracedValue::create()); + OwnPtr<TracedValue> value(TracedValue::create()); value->setInteger("x", location.roundedPoint().x()); value->setInteger("y", location.roundedPoint().y()); if (location.isRectBasedTest())
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h index 5ec488c0..07eeea2 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
@@ -13,7 +13,6 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" -#include <memory> namespace v8 { class Function; @@ -57,8 +56,8 @@ enum ResourceLoadPriority : int; namespace InspectorLayoutEvent { -std::unique_ptr<TracedValue> beginData(FrameView*); -std::unique_ptr<TracedValue> endData(LayoutObject* rootForThisLayout); +PassOwnPtr<TracedValue> beginData(FrameView*); +PassOwnPtr<TracedValue> endData(LayoutObject* rootForThisLayout); } namespace InspectorScheduleStyleInvalidationTrackingEvent { @@ -67,10 +66,10 @@ extern const char Id[]; extern const char Pseudo[]; -std::unique_ptr<TracedValue> attributeChange(Element&, const InvalidationSet&, const QualifiedName&); -std::unique_ptr<TracedValue> classChange(Element&, const InvalidationSet&, const AtomicString&); -std::unique_ptr<TracedValue> idChange(Element&, const InvalidationSet&, const AtomicString&); -std::unique_ptr<TracedValue> pseudoChange(Element&, const InvalidationSet&, CSSSelector::PseudoType); +PassOwnPtr<TracedValue> attributeChange(Element&, const InvalidationSet&, const QualifiedName&); +PassOwnPtr<TracedValue> classChange(Element&, const InvalidationSet&, const AtomicString&); +PassOwnPtr<TracedValue> idChange(Element&, const InvalidationSet&, const AtomicString&); +PassOwnPtr<TracedValue> pseudoChange(Element&, const InvalidationSet&, CSSSelector::PseudoType); } // namespace InspectorScheduleStyleInvalidationTrackingEvent #define TRACE_SCHEDULE_STYLE_INVALIDATION(element, invalidationSet, changeType, ...) \ @@ -82,7 +81,7 @@ InspectorScheduleStyleInvalidationTrackingEvent::changeType((element), (invalidationSet), __VA_ARGS__)); namespace InspectorStyleRecalcInvalidationTrackingEvent { -std::unique_ptr<TracedValue> data(Node*, const StyleChangeReasonForTracing&); +PassOwnPtr<TracedValue> data(Node*, const StyleChangeReasonForTracing&); } String descendantInvalidationSetToIdString(const InvalidationSet&); @@ -96,9 +95,9 @@ extern const char InvalidationSetMatchedTagName[]; extern const char PreventStyleSharingForParent[]; -std::unique_ptr<TracedValue> data(Element&, const char* reason); -std::unique_ptr<TracedValue> selectorPart(Element&, const char* reason, const InvalidationSet&, const String&); -std::unique_ptr<TracedValue> invalidationList(Element&, const Vector<RefPtr<InvalidationSet>>&); +PassOwnPtr<TracedValue> data(Element&, const char* reason); +PassOwnPtr<TracedValue> selectorPart(Element&, const char* reason, const InvalidationSet&, const String&); +PassOwnPtr<TracedValue> invalidationList(Element&, const Vector<RefPtr<InvalidationSet>>&); } // namespace InspectorStyleInvalidatorInvalidateEvent #define TRACE_STYLE_INVALIDATOR_INVALIDATION(element, reason) \ @@ -162,80 +161,80 @@ typedef const char LayoutInvalidationReasonForTracing[]; namespace InspectorLayoutInvalidationTrackingEvent { -std::unique_ptr<TracedValue> CORE_EXPORT data(const LayoutObject*, LayoutInvalidationReasonForTracing); +PassOwnPtr<TracedValue> CORE_EXPORT data(const LayoutObject*, LayoutInvalidationReasonForTracing); } namespace InspectorPaintInvalidationTrackingEvent { -std::unique_ptr<TracedValue> data(const LayoutObject*, const LayoutObject& paintContainer); +PassOwnPtr<TracedValue> data(const LayoutObject*, const LayoutObject& paintContainer); } namespace InspectorScrollInvalidationTrackingEvent { -std::unique_ptr<TracedValue> data(const LayoutObject&); +PassOwnPtr<TracedValue> data(const LayoutObject&); } namespace InspectorChangeResourcePriorityEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, const ResourceLoadPriority&); +PassOwnPtr<TracedValue> data(unsigned long identifier, const ResourceLoadPriority&); } namespace InspectorSendRequestEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceRequest&); +PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceRequest&); } namespace InspectorReceiveResponseEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceResponse&); +PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceResponse&); } namespace InspectorReceiveDataEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, int encodedDataLength); +PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, int encodedDataLength); } namespace InspectorResourceFinishEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, double finishTime, bool didFail); +PassOwnPtr<TracedValue> data(unsigned long identifier, double finishTime, bool didFail); } namespace InspectorTimerInstallEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId, int timeout, bool singleShot); +PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId, int timeout, bool singleShot); } namespace InspectorTimerRemoveEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId); +PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId); } namespace InspectorTimerFireEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId); +PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId); } namespace InspectorIdleCallbackRequestEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int id, double timeout); +PassOwnPtr<TracedValue> data(ExecutionContext*, int id, double timeout); } namespace InspectorIdleCallbackCancelEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int id); +PassOwnPtr<TracedValue> data(ExecutionContext*, int id); } namespace InspectorIdleCallbackFireEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int id, double allottedMilliseconds, bool timedOut); +PassOwnPtr<TracedValue> data(ExecutionContext*, int id, double allottedMilliseconds, bool timedOut); } namespace InspectorAnimationFrameEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, int callbackId); +PassOwnPtr<TracedValue> data(ExecutionContext*, int callbackId); } namespace InspectorParseHtmlEvent { -std::unique_ptr<TracedValue> beginData(Document*, unsigned startLine); -std::unique_ptr<TracedValue> endData(unsigned endLine); +PassOwnPtr<TracedValue> beginData(Document*, unsigned startLine); +PassOwnPtr<TracedValue> endData(unsigned endLine); } namespace InspectorParseAuthorStyleSheetEvent { -std::unique_ptr<TracedValue> data(const CSSStyleSheetResource*); +PassOwnPtr<TracedValue> data(const CSSStyleSheetResource*); } namespace InspectorXhrReadyStateChangeEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); +PassOwnPtr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); } namespace InspectorXhrLoadEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); +PassOwnPtr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); } namespace InspectorLayerInvalidationTrackingEvent { @@ -245,7 +244,7 @@ extern const char ReflectionLayerChanged[]; extern const char NewCompositedLayer[]; -std::unique_ptr<TracedValue> data(const PaintLayer*, const char* reason); +PassOwnPtr<TracedValue> data(const PaintLayer*, const char* reason); } #define TRACE_LAYER_INVALIDATION(LAYER, REASON) \ @@ -257,89 +256,89 @@ InspectorLayerInvalidationTrackingEvent::data((LAYER), (REASON))); namespace InspectorPaintEvent { -std::unique_ptr<TracedValue> data(LayoutObject*, const LayoutRect& clipRect, const GraphicsLayer*); +PassOwnPtr<TracedValue> data(LayoutObject*, const LayoutRect& clipRect, const GraphicsLayer*); } namespace InspectorPaintImageEvent { -std::unique_ptr<TracedValue> data(const LayoutImage&); -std::unique_ptr<TracedValue> data(const LayoutObject&, const StyleImage&); -std::unique_ptr<TracedValue> data(const LayoutObject*, const ImageResource&); +PassOwnPtr<TracedValue> data(const LayoutImage&); +PassOwnPtr<TracedValue> data(const LayoutObject&, const StyleImage&); +PassOwnPtr<TracedValue> data(const LayoutObject*, const ImageResource&); } namespace InspectorCommitLoadEvent { -std::unique_ptr<TracedValue> data(LocalFrame*); +PassOwnPtr<TracedValue> data(LocalFrame*); } namespace InspectorMarkLoadEvent { -std::unique_ptr<TracedValue> data(LocalFrame*); +PassOwnPtr<TracedValue> data(LocalFrame*); } namespace InspectorScrollLayerEvent { -std::unique_ptr<TracedValue> data(LayoutObject*); +PassOwnPtr<TracedValue> data(LayoutObject*); } namespace InspectorUpdateLayerTreeEvent { -std::unique_ptr<TracedValue> data(LocalFrame*); +PassOwnPtr<TracedValue> data(LocalFrame*); } namespace InspectorEvaluateScriptEvent { -std::unique_ptr<TracedValue> data(LocalFrame*, const String& url, const WTF::TextPosition&); +PassOwnPtr<TracedValue> data(LocalFrame*, const String& url, const WTF::TextPosition&); } namespace InspectorParseScriptEvent { -std::unique_ptr<TracedValue> data(unsigned long identifier, const String& url); +PassOwnPtr<TracedValue> data(unsigned long identifier, const String& url); } namespace InspectorCompileScriptEvent { -std::unique_ptr<TracedValue> data(const String& url, const WTF::TextPosition&); +PassOwnPtr<TracedValue> data(const String& url, const WTF::TextPosition&); } namespace InspectorFunctionCallEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, const v8::Local<v8::Function>&); +PassOwnPtr<TracedValue> data(ExecutionContext*, const v8::Local<v8::Function>&); } namespace InspectorUpdateCountersEvent { -std::unique_ptr<TracedValue> data(); +PassOwnPtr<TracedValue> data(); } namespace InspectorInvalidateLayoutEvent { -std::unique_ptr<TracedValue> data(LocalFrame*); +PassOwnPtr<TracedValue> data(LocalFrame*); } namespace InspectorRecalculateStylesEvent { -std::unique_ptr<TracedValue> data(LocalFrame*); +PassOwnPtr<TracedValue> data(LocalFrame*); } namespace InspectorEventDispatchEvent { -std::unique_ptr<TracedValue> data(const Event&); +PassOwnPtr<TracedValue> data(const Event&); } namespace InspectorTimeStampEvent { -std::unique_ptr<TracedValue> data(ExecutionContext*, const String& message); +PassOwnPtr<TracedValue> data(ExecutionContext*, const String& message); } namespace InspectorTracingSessionIdForWorkerEvent { -std::unique_ptr<TracedValue> data(const String& sessionId, const String& workerId, WorkerThread*); +PassOwnPtr<TracedValue> data(const String& sessionId, const String& workerId, WorkerThread*); } namespace InspectorTracingStartedInFrame { -std::unique_ptr<TracedValue> data(const String& sessionId, LocalFrame*); +PassOwnPtr<TracedValue> data(const String& sessionId, LocalFrame*); } namespace InspectorSetLayerTreeId { -std::unique_ptr<TracedValue> data(const String& sessionId, int layerTreeId); +PassOwnPtr<TracedValue> data(const String& sessionId, int layerTreeId); } namespace InspectorAnimationEvent { -std::unique_ptr<TracedValue> data(const Animation&); +PassOwnPtr<TracedValue> data(const Animation&); } namespace InspectorAnimationStateEvent { -std::unique_ptr<TracedValue> data(const Animation&); +PassOwnPtr<TracedValue> data(const Animation&); } namespace InspectorHitTestEvent { -std::unique_ptr<TracedValue> endData(const HitTestRequest&, const HitTestLocation&, const HitTestResult&); +PassOwnPtr<TracedValue> endData(const HitTestRequest&, const HitTestLocation&, const HitTestResult&); } CORE_EXPORT String toHexString(const void* p);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h index 0d338a1..fa3a077 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h
@@ -10,6 +10,7 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Tracing.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp index 3e627262..68263aa 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -33,6 +33,7 @@ #include "core/dom/Document.h" #include "core/inspector/InspectedFrames.h" #include "platform/weborigin/KURL.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/LayoutEditor.h b/third_party/WebKit/Source/core/inspector/LayoutEditor.h index ae2a279e..d93f7da1 100644 --- a/third_party/WebKit/Source/core/inspector/LayoutEditor.h +++ b/third_party/WebKit/Source/core/inspector/LayoutEditor.h
@@ -12,6 +12,7 @@ #include "core/dom/Element.h" #include "platform/heap/Handle.h" #include "platform/inspector_protocol/Values.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp index 8927df9..dcd4d44 100644 --- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp +++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
@@ -53,9 +53,9 @@ #include "core/xml/XPathResult.h" #include "platform/UserGestureIndicator.h" #include "platform/v8_inspector/public/V8Debugger.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -79,7 +79,7 @@ MainThreadDebugger::MainThreadDebugger(v8::Isolate* isolate) : ThreadDebugger(isolate) - , m_taskRunner(wrapUnique(new InspectorTaskRunner())) + , m_taskRunner(adoptPtr(new InspectorTaskRunner())) { MutexLocker locker(creationMutex()); ASSERT(!s_instance); @@ -93,7 +93,7 @@ s_instance = nullptr; } -void MainThreadDebugger::setClientMessageLoop(std::unique_ptr<ClientMessageLoop> clientMessageLoop) +void MainThreadDebugger::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clientMessageLoop) { ASSERT(!m_clientMessageLoop); ASSERT(clientMessageLoop);
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h index d0a7046..343d364 100644 --- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h +++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h
@@ -36,7 +36,6 @@ #include "core/inspector/InspectorTaskRunner.h" #include "core/inspector/ThreadDebugger.h" #include "platform/heap/Handle.h" -#include <memory> #include <v8.h> namespace blink { @@ -63,7 +62,7 @@ InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } bool isWorker() override { return false; } - void setClientMessageLoop(std::unique_ptr<ClientMessageLoop>); + void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); int contextGroupId(LocalFrame*); void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*); void contextWillBeDestroyed(ScriptState*); @@ -85,8 +84,8 @@ bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Local<v8::Context> target) override; int ensureDefaultContextInGroup(int contextGroupId) override; - std::unique_ptr<ClientMessageLoop> m_clientMessageLoop; - std::unique_ptr<InspectorTaskRunner> m_taskRunner; + OwnPtr<ClientMessageLoop> m_clientMessageLoop; + OwnPtr<InspectorTaskRunner> m_taskRunner; static MainThreadDebugger* s_instance;
diff --git a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp index fd93123..6e41c04 100644 --- a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp +++ b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
@@ -32,7 +32,6 @@ #include "core/fetch/Resource.h" #include "platform/SharedBuffer.h" #include "platform/network/ResourceResponse.h" -#include <memory> namespace blink { @@ -208,7 +207,7 @@ String filePath = response.downloadedFilePath(); if (!filePath.isEmpty()) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendFile(filePath); AtomicString mimeType; if (response.isHTTP())
diff --git a/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h b/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h index 9b21149..076700f1 100644 --- a/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h +++ b/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h
@@ -33,6 +33,7 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorConsoleAgent.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp index abb5fe4c..1de42b5 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
@@ -22,8 +22,7 @@ #include "core/inspector/ScriptArguments.h" #include "platform/ScriptForbiddenScope.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -67,7 +66,7 @@ void ThreadDebugger::beginUserGesture() { - m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + m_userGestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); } void ThreadDebugger::endUserGesture() @@ -323,7 +322,7 @@ m_timerData.append(data); m_timerCallbacks.append(callback); - std::unique_ptr<Timer<ThreadDebugger>> timer = wrapUnique(new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); + OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); Timer<ThreadDebugger>* timerPtr = timer.get(); m_timers.append(std::move(timer)); timerPtr->startRepeating(interval, BLINK_FROM_HERE); @@ -345,7 +344,7 @@ void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) { for (size_t index = 0; index < m_timers.size(); ++index) { - if (m_timers[index].get() == timer) { + if (m_timers[index] == timer) { m_timerCallbacks[index](m_timerData[index]); return; }
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h index 766ef8e..3c2aa536 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
@@ -12,7 +12,7 @@ #include "platform/v8_inspector/public/V8DebuggerClient.h" #include "wtf/Forward.h" #include "wtf/Vector.h" -#include <memory> + #include <v8.h> namespace blink { @@ -67,10 +67,10 @@ static void getEventListenersCallback(const v8::FunctionCallbackInfo<v8::Value>&); - Vector<std::unique_ptr<Timer<ThreadDebugger>>> m_timers; + Vector<OwnPtr<Timer<ThreadDebugger>>> m_timers; Vector<V8DebuggerClient::TimerCallback> m_timerCallbacks; Vector<void*> m_timerData; - std::unique_ptr<UserGestureIndicator> m_userGestureIndicator; + OwnPtr<UserGestureIndicator> m_userGestureIndicator; v8::Global<v8::Function> m_eventLogFunction; };
diff --git a/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h b/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h index e2abc047..309f9736 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h +++ b/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h
@@ -32,6 +32,7 @@ #define WorkerConsoleAgent_h #include "core/inspector/InspectorConsoleAgent.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp index 4e4d8d8..ca14f5f9 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp +++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
@@ -41,6 +41,7 @@ #include "platform/inspector_protocol/DispatcherBase.h" #include "platform/v8_inspector/public/V8Debugger.h" #include "platform/v8_inspector/public/V8InspectorSession.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h index 3e0fcb3..2121c14 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h +++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h
@@ -36,6 +36,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ClipPathOperation.h b/third_party/WebKit/Source/core/layout/ClipPathOperation.h index 6edf717..7258316 100644 --- a/third_party/WebKit/Source/core/layout/ClipPathOperation.h +++ b/third_party/WebKit/Source/core/layout/ClipPathOperation.h
@@ -32,10 +32,10 @@ #include "core/style/BasicShapes.h" #include "platform/graphics/Path.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -105,7 +105,7 @@ { ASSERT(m_shape); m_path.reset(); - m_path = wrapUnique(new Path); + m_path = adoptPtr(new Path); m_shape->path(*m_path, boundingRect); m_path->setWindRule(m_shape->getWindRule()); return *m_path; @@ -121,7 +121,7 @@ } RefPtr<BasicShape> m_shape; - std::unique_ptr<Path> m_path; + OwnPtr<Path> m_path; }; DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == ClipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE);
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp index 3972c9d..eff3aae 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -29,9 +29,8 @@ #include "core/layout/shapes/ShapeOutsideInfo.h" #include "core/paint/PaintLayer.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PtrUtil.h" + #include <algorithm> -#include <memory> using namespace WTF; @@ -89,9 +88,9 @@ return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled(); } -std::unique_ptr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) +PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) { - std::unique_ptr<FloatingObject> newObj = wrapUnique(new FloatingObject(layoutObject)); + OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject)); // If a layer exists, the float will paint itself. Otherwise someone else will. newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shouldPaintForCompositedLayoutPart()); @@ -106,14 +105,14 @@ return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); } -std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const +PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const { - return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); + return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); } -std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const +PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const { - std::unique_ptr<FloatingObject> cloneObject = wrapUnique(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); + OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); cloneObject->m_isPlaced = m_isPlaced; return cloneObject; } @@ -407,7 +406,7 @@ void FloatingObjects::moveAllToFloatInfoMap(LayoutBoxToFloatInfoMap& map) { while (!m_set.isEmpty()) { - std::unique_ptr<FloatingObject> floatingObject = m_set.takeFirst(); + OwnPtr<FloatingObject> floatingObject = m_set.takeFirst(); LayoutBox* layoutObject = floatingObject->layoutObject(); map.add(layoutObject, std::move(floatingObject)); } @@ -467,11 +466,11 @@ markLowestFloatLogicalBottomCacheAsDirty(); } -FloatingObject* FloatingObjects::add(std::unique_ptr<FloatingObject> floatingObject) +FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject) { - FloatingObject* newObject = floatingObject.release(); + FloatingObject* newObject = floatingObject.leakPtr(); increaseObjectsCount(newObject->getType()); - m_set.add(wrapUnique(newObject)); + m_set.add(adoptPtr(newObject)); if (newObject->isPlaced()) addPlacedObject(*newObject); markLowestFloatLogicalBottomCacheAsDirty(); @@ -481,7 +480,7 @@ void FloatingObjects::remove(FloatingObject* toBeRemoved) { decreaseObjectsCount(toBeRemoved->getType()); - std::unique_ptr<FloatingObject> floatingObject = m_set.take(toBeRemoved); + OwnPtr<FloatingObject> floatingObject = m_set.take(toBeRemoved); ASSERT(floatingObject->isPlaced() || !floatingObject->isInPlacedTree()); if (floatingObject->isPlaced()) removePlacedObject(*floatingObject);
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.h b/third_party/WebKit/Source/core/layout/FloatingObjects.h index 35fd6d6..11f78d9 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.h +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.h
@@ -28,7 +28,7 @@ #include "platform/PODIntervalTree.h" #include "platform/geometry/LayoutRect.h" #include "wtf/ListHashSet.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -47,11 +47,11 @@ // Note that Type uses bits so you can use FloatLeftRight as a mask to query for both left and right. enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 }; - static std::unique_ptr<FloatingObject> create(LayoutBox*); + static PassOwnPtr<FloatingObject> create(LayoutBox*); - std::unique_ptr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const; + PassOwnPtr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const; - std::unique_ptr<FloatingObject> unsafeClone() const; + PassOwnPtr<FloatingObject> unsafeClone() const; Type getType() const { return static_cast<Type>(m_type); } LayoutBox* layoutObject() const { return m_layoutObject; } @@ -112,9 +112,9 @@ struct FloatingObjectHashFunctions { STATIC_ONLY(FloatingObjectHashFunctions); static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::Hash::hash(key->layoutObject()); } - static unsigned hash(const std::unique_ptr<FloatingObject>& key) { return hash(key.get()); } - static bool equal(std::unique_ptr<FloatingObject>& a, FloatingObject* b) { return a->layoutObject() == b->layoutObject(); } - static bool equal(std::unique_ptr<FloatingObject>& a, const std::unique_ptr<FloatingObject>& b) { return equal(a, b.get()); } + static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.get()); } + static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->layoutObject() == b->layoutObject(); } + static bool equal(OwnPtr<FloatingObject>& a, const OwnPtr<FloatingObject>& b) { return equal(a, b.get()); } static const bool safeToCompareToEmptyOrDeleted = true; }; @@ -122,14 +122,14 @@ STATIC_ONLY(FloatingObjectHashTranslator); static unsigned hash(LayoutBox* key) { return DefaultHash<LayoutBox*>::Hash::hash(key); } static bool equal(FloatingObject* a, LayoutBox* b) { return a->layoutObject() == b; } - static bool equal(const std::unique_ptr<FloatingObject>& a, LayoutBox* b) { return a->layoutObject() == b; } + static bool equal(const OwnPtr<FloatingObject>& a, LayoutBox* b) { return a->layoutObject() == b; } }; -typedef ListHashSet<std::unique_ptr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet; +typedef ListHashSet<OwnPtr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet; typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; typedef PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval; typedef PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree; typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena; -typedef HashMap<LayoutBox*, std::unique_ptr<FloatingObject>> LayoutBoxToFloatInfoMap; +typedef HashMap<LayoutBox*, OwnPtr<FloatingObject>> LayoutBoxToFloatInfoMap; class FloatingObjects { WTF_MAKE_NONCOPYABLE(FloatingObjects); USING_FAST_MALLOC(FloatingObjects); @@ -139,7 +139,7 @@ void clear(); void moveAllToFloatInfoMap(LayoutBoxToFloatInfoMap&); - FloatingObject* add(std::unique_ptr<FloatingObject>); + FloatingObject* add(PassOwnPtr<FloatingObject>); void remove(FloatingObject*); void addPlacedObject(FloatingObject&); void removePlacedObject(FloatingObject&);
diff --git a/third_party/WebKit/Source/core/layout/HitTestLocation.h b/third_party/WebKit/Source/core/layout/HitTestLocation.h index b2597f0b..6fef9bd 100644 --- a/third_party/WebKit/Source/core/layout/HitTestLocation.h +++ b/third_party/WebKit/Source/core/layout/HitTestLocation.h
@@ -29,6 +29,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/ListHashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/HitTestResult.h b/third_party/WebKit/Source/core/layout/HitTestResult.h index 9e616bf..82da88f2 100644 --- a/third_party/WebKit/Source/core/layout/HitTestResult.h +++ b/third_party/WebKit/Source/core/layout/HitTestResult.h
@@ -32,6 +32,7 @@ #include "platform/text/TextDirection.h" #include "wtf/Forward.h" #include "wtf/ListHashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/VectorTraits.h"
diff --git a/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp b/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp index c6b9460..3b8e067 100644 --- a/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp +++ b/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp
@@ -26,6 +26,7 @@ #include "core/layout/HitTestingTransformState.h" #include "platform/geometry/LayoutRect.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp index 56a93cb..429c944 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
@@ -35,7 +35,6 @@ #include "core/frame/Settings.h" #include "core/page/ChromeClient.h" #include "core/page/Page.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -93,14 +92,14 @@ } ImageQualityController::ImageQualityController() - : m_timer(wrapUnique(new Timer<ImageQualityController>(this, &ImageQualityController::highQualityRepaintTimerFired))) + : m_timer(adoptPtr(new Timer<ImageQualityController>(this, &ImageQualityController::highQualityRepaintTimerFired))) , m_frameTimeWhenTimerStarted(0.0) { } void ImageQualityController::setTimer(Timer<ImageQualityController>* newTimer) { - m_timer = wrapUnique(newTimer); + m_timer = adoptPtr(newTimer); } void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMap* innerMap, const void* layer)
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.h b/third_party/WebKit/Source/core/layout/ImageQualityController.h index d6636b7..7066d21 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityController.h +++ b/third_party/WebKit/Source/core/layout/ImageQualityController.h
@@ -37,7 +37,6 @@ #include "platform/geometry/LayoutSize.h" #include "platform/graphics/Image.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -84,7 +83,7 @@ void setTimer(Timer<ImageQualityController>*); ObjectLayerSizeMap m_objectLayerSizeMap; - std::unique_ptr<Timer<ImageQualityController>> m_timer; + OwnPtr<Timer<ImageQualityController>> m_timer; double m_frameTimeWhenTimerStarted; // For calling set().
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp index 4324de7f..7ee78d39 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
@@ -9,7 +9,6 @@ #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -171,7 +170,7 @@ LayoutImage* img = toLayoutImage(document().body()->firstChild()->layoutObject()); RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality); - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); // Paint once. This will kick off a timer to see if we resize it during that timer's execution. @@ -197,7 +196,7 @@ LayoutImage* nonAnimatingImage = toLayoutImage(document().getElementById("myNonAnimatingImage")->layoutObject()); RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality); - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); // Paint once. This will kick off a timer to see if we resize it during that timer's execution.
diff --git a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp index 754a31c..1f5b741 100644 --- a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp
@@ -9,7 +9,6 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutText.h" #include "platform/TracedValue.h" -#include <memory> namespace blink { @@ -105,9 +104,9 @@ --m_depth; } -std::unique_ptr<TracedValue> LayoutAnalyzer::toTracedValue() +PassOwnPtr<TracedValue> LayoutAnalyzer::toTracedValue() { - std::unique_ptr<TracedValue> tracedValue(TracedValue::create()); + OwnPtr<TracedValue> tracedValue(TracedValue::create()); for (size_t i = 0; i < NumCounters; ++i) { if (m_counters[i] > 0) tracedValue->setInteger(nameForCounter(static_cast<Counter>(i)), m_counters[i]);
diff --git a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h index cda9ffb1..00c7a0dd 100644 --- a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h +++ b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h
@@ -8,7 +8,7 @@ #include "platform/LayoutUnit.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -82,7 +82,7 @@ m_counters[counter] += delta; } - std::unique_ptr<TracedValue> toTracedValue(); + PassOwnPtr<TracedValue> toTracedValue(); private: const char* nameForCounter(Counter) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index fda8bbe..a8bae52 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -54,9 +54,7 @@ #include "core/paint/PaintLayer.h" #include "core/style/ComputedStyle.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -105,7 +103,7 @@ void LayoutBlock::removeFromGlobalMaps() { if (hasPositionedObjects()) { - std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendantsMap->take(this); + OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendantsMap->take(this); ASSERT(!descendants->isEmpty()); for (LayoutBox* descendant : *descendants) { ASSERT(gPositionedContainerMap->get(descendant) == this); @@ -113,7 +111,7 @@ } } if (hasPercentHeightDescendants()) { - std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescendantsMap->take(this); + OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescendantsMap->take(this); ASSERT(!descendants->isEmpty()); for (LayoutBox* descendant : *descendants) { ASSERT(descendant->percentHeightContainer() == this); @@ -876,7 +874,7 @@ TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get(this); if (!descendantSet) { descendantSet = new TrackedLayoutBoxListHashSet; - gPositionedDescendantsMap->set(this, wrapUnique(descendantSet)); + gPositionedDescendantsMap->set(this, adoptPtr(descendantSet)); } descendantSet->add(o); @@ -964,7 +962,7 @@ TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->get(this); if (!descendantSet) { descendantSet = new TrackedLayoutBoxListHashSet; - gPercentHeightDescendantsMap->set(this, wrapUnique(descendantSet)); + gPercentHeightDescendantsMap->set(this, adoptPtr(descendantSet)); } descendantSet->add(descendant);
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h index 89e0b4a..59bcd53 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -26,7 +26,7 @@ #include "core/CoreExport.h" #include "core/layout/LayoutBox.h" #include "wtf/ListHashSet.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -35,7 +35,7 @@ class WordMeasurement; typedef WTF::ListHashSet<LayoutBox*, 16> TrackedLayoutBoxListHashSet; -typedef WTF::HashMap<const LayoutBlock*, std::unique_ptr<TrackedLayoutBoxListHashSet>> TrackedDescendantsMap; +typedef WTF::HashMap<const LayoutBlock*, OwnPtr<TrackedLayoutBoxListHashSet>> TrackedDescendantsMap; typedef WTF::HashMap<const LayoutBox*, LayoutBlock*> TrackedContainerMap; typedef Vector<WordMeasurement, 64> WordMeasurements;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index a7c3fbaa..45536cf5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -49,8 +49,6 @@ #include "core/layout/line/LineWidth.h" #include "core/layout/shapes/ShapeOutsideInfo.h" #include "core/paint/PaintLayer.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -1126,7 +1124,7 @@ LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end; ++it) { - std::unique_ptr<FloatingObject>& floatingObject = it->value; + OwnPtr<FloatingObject>& floatingObject = it->value; if (!floatingObject->isDescendant()) { changeLogicalTop = LayoutUnit(); changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(*floatingObject)); @@ -1764,7 +1762,7 @@ return; if (!m_rareData) - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); m_rareData->m_discardMarginBefore = value; } @@ -1780,7 +1778,7 @@ return; if (!m_rareData) - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); m_rareData->m_discardMarginAfter = value; } @@ -1825,7 +1823,7 @@ if (!m_rareData) { if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) && neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this)) return; - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); } m_rareData->m_margins.setPositiveMarginBefore(pos); m_rareData->m_margins.setNegativeMarginBefore(neg); @@ -1836,7 +1834,7 @@ if (!m_rareData) { if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) && neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this)) return; - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); } m_rareData->m_margins.setPositiveMarginAfter(pos); m_rareData->m_margins.setNegativeMarginAfter(neg); @@ -2200,7 +2198,7 @@ void LayoutBlockFlow::createFloatingObjects() { - m_floatingObjects = wrapUnique(new FloatingObjects(this, isHorizontalWritingMode())); + m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMode())); } void LayoutBlockFlow::willBeDestroyed() @@ -3005,7 +3003,7 @@ // Create the special object entry & append it to the list - std::unique_ptr<FloatingObject> newObj = FloatingObject::create(&floatBox); + OwnPtr<FloatingObject> newObj = FloatingObject::create(&floatBox); // Our location is irrelevant if we're unsplittable or no pagination is in effect. // Just go ahead and lay out the float. @@ -3463,7 +3461,7 @@ if (!m_rareData) { if (!strut) return; - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); } m_rareData->m_paginationStrutPropagatedFromChild = strut; } @@ -3605,7 +3603,7 @@ if (m_rareData) return *m_rareData; - m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); + m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); return *m_rareData; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h index 4734a25..55c9f49 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h
@@ -43,7 +43,6 @@ #include "core/layout/line/LineBoxList.h" #include "core/layout/line/RootInlineBox.h" #include "core/layout/line/TrailingObjects.h" -#include <memory> namespace blink { @@ -616,8 +615,8 @@ bool checkIfIsSelfCollapsingBlock() const; protected: - std::unique_ptr<LayoutBlockFlowRareData> m_rareData; - std::unique_ptr<FloatingObjects> m_floatingObjects; + OwnPtr<LayoutBlockFlowRareData> m_rareData; + OwnPtr<FloatingObjects> m_floatingObjects; friend class MarginInfo; friend class LineWidth; // needs to know FloatingObject
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 2dae9193..0cda260 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -61,7 +61,6 @@ #include "platform/geometry/DoubleRect.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/FloatRoundedRect.h" -#include "wtf/PtrUtil.h" #include <algorithm> #include <math.h> @@ -4200,7 +4199,7 @@ } if (!m_overflow) - m_overflow = wrapUnique(new BoxOverflowModel(clientBox, borderBoxRect())); + m_overflow = adoptPtr(new BoxOverflowModel(clientBox, borderBoxRect())); m_overflow->addLayoutOverflow(overflowRect); } @@ -4215,7 +4214,7 @@ return; if (!m_overflow) - m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox)); + m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox)); m_overflow->addSelfVisualOverflow(rect); } @@ -4233,7 +4232,7 @@ return; if (!m_overflow) - m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox)); + m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox)); m_overflow->addContentsVisualOverflow(rect); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h index 5b41c529..0f80c7e 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.h +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -28,8 +28,6 @@ #include "core/layout/OverflowModel.h" #include "core/layout/ScrollEnums.h" #include "platform/scroll/ScrollTypes.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -89,12 +87,12 @@ LayoutBox* m_snapContainer; // For snap container, the descendant snap areas that contribute snap // points. - std::unique_ptr<SnapAreaSet> m_snapAreas; + OwnPtr<SnapAreaSet> m_snapAreas; SnapAreaSet& ensureSnapAreas() { if (!m_snapAreas) - m_snapAreas = wrapUnique(new SnapAreaSet); + m_snapAreas = adoptPtr(new SnapAreaSet); return *m_snapAreas; } @@ -1061,7 +1059,7 @@ LayoutBoxRareData& ensureRareData() { if (!m_rareData) - m_rareData = wrapUnique(new LayoutBoxRareData()); + m_rareData = adoptPtr(new LayoutBoxRareData()); return *m_rareData.get(); } @@ -1124,13 +1122,13 @@ LayoutUnit m_maxPreferredLogicalWidth; // Our overflow information. - std::unique_ptr<BoxOverflowModel> m_overflow; + OwnPtr<BoxOverflowModel> m_overflow; private: // The inline box containing this LayoutBox, for atomic inline elements. InlineBox* m_inlineBoxWrapper; - std::unique_ptr<LayoutBoxRareData> m_rareData; + OwnPtr<LayoutBoxRareData> m_rareData; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBox, isBox());
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index a9bafeec..fd76c7b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -39,7 +39,6 @@ #include "core/paint/PaintLayer.h" #include "core/style/ShadowList.h" #include "platform/LengthFunctions.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -327,7 +326,7 @@ void LayoutBoxModelObject::createLayer() { ASSERT(!m_layer); - m_layer = wrapUnique(new PaintLayer(this)); + m_layer = adoptPtr(new PaintLayer(this)); setHasLayer(true); m_layer->insertOnlyThisLayerAfterStyleChange(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h index f61090f4..df963367 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
@@ -30,8 +30,6 @@ #include "core/layout/LayoutObject.h" #include "core/page/scrolling/StickyPositionScrollingConstraints.h" #include "platform/geometry/LayoutRect.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -372,15 +370,15 @@ LayoutBoxModelObjectRareData& ensureRareData() { if (!m_rareData) - m_rareData = wrapUnique(new LayoutBoxModelObjectRareData()); + m_rareData = adoptPtr(new LayoutBoxModelObjectRareData()); return *m_rareData.get(); } // The PaintLayer associated with this object. // |m_layer| can be nullptr depending on the return value of layerTypeRequired(). - std::unique_ptr<PaintLayer> m_layer; + OwnPtr<PaintLayer> m_layer; - std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData; + OwnPtr<LayoutBoxModelObjectRareData> m_rareData; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
diff --git a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp index d652693..8f48f65 100644 --- a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp
@@ -30,9 +30,7 @@ #include "core/layout/LayoutView.h" #include "core/layout/ListMarkerText.h" #include "core/style/ComputedStyle.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -43,7 +41,7 @@ using namespace HTMLNames; typedef HashMap<AtomicString, RefPtr<CounterNode>> CounterMap; -typedef HashMap<const LayoutObject*, std::unique_ptr<CounterMap>> CounterMaps; +typedef HashMap<const LayoutObject*, OwnPtr<CounterMap>> CounterMaps; static CounterNode* makeCounterNodeIfNeeded(LayoutObject&, const AtomicString& identifier, bool alwaysCreateCounter); @@ -341,7 +339,7 @@ nodeMap = counterMaps().get(&object); } else { nodeMap = new CounterMap; - counterMaps().set(&object, wrapUnique(nodeMap)); + counterMaps().set(&object, adoptPtr(nodeMap)); object.setHasCounterNodeMap(true); } nodeMap->set(identifier, newNode);
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h index c18e95c..ed6666c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
@@ -34,6 +34,7 @@ #include "platform/geometry/IntSize.h" #include "platform/geometry/LayoutSize.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h index 4f60d33..6b4350d 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h
@@ -30,7 +30,7 @@ #include "platform/geometry/LayoutSize.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -63,7 +63,7 @@ } const LayoutObject* m_layoutObject; LayoutSize m_offset; - std::unique_ptr<TransformationMatrix> m_transform; // Includes offset if non-null. + OwnPtr<TransformationMatrix> m_transform; // Includes offset if non-null. // If m_offsetForFixedPosition could only apply to the fixed position steps, we may be able to merge // with m_offsetForStickyPosition and simplify mapping. LayoutSize m_offsetForFixedPosition;
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp index b2639b5b..1ac1d2d3 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -32,9 +32,7 @@ #include "core/style/ComputedStyle.h" #include "core/style/GridArea.h" #include "platform/LengthFunctions.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -201,7 +199,7 @@ return true; } - std::unique_ptr<GridArea> nextEmptyGridArea(size_t fixedTrackSpan, size_t varyingTrackSpan) + PassOwnPtr<GridArea> nextEmptyGridArea(size_t fixedTrackSpan, size_t varyingTrackSpan) { DCHECK(!m_grid.isEmpty()); DCHECK(!m_grid[0].isEmpty()); @@ -214,7 +212,7 @@ const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size(); for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) { if (checkEmptyCells(rowSpan, columnSpan)) { - std::unique_ptr<GridArea> result = wrapUnique(new GridArea(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); + OwnPtr<GridArea> result = adoptPtr(new GridArea(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); // Advance the iterator to avoid an infinite loop where we would return the same grid area over and over. ++varyingTrackIndex; return result; @@ -636,13 +634,13 @@ return LayoutUnit(infinity); } -double LayoutGrid::computeFlexFactorUnitSize(const Vector<GridTrack>& tracks, GridTrackSizingDirection direction, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexible) const +double LayoutGrid::computeFlexFactorUnitSize(const Vector<GridTrack>& tracks, GridTrackSizingDirection direction, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible) const { // We want to avoid the effect of flex factors sum below 1 making the factor unit size to grow exponentially. double hypotheticalFactorUnitSize = leftOverSpace / std::max<double>(1, flexFactorSum); // product of the hypothetical "flex factor unit" and any flexible track's "flex factor" must be grater than such track's "base size". - std::unique_ptr<TrackIndexSet> additionalTracksToTreatAsInflexible = std::move(tracksToTreatAsInflexible); + OwnPtr<TrackIndexSet> additionalTracksToTreatAsInflexible = std::move(tracksToTreatAsInflexible); bool validFlexFactorUnit = true; for (auto index : flexibleTracksIndexes) { if (additionalTracksToTreatAsInflexible && additionalTracksToTreatAsInflexible->contains(index)) @@ -654,7 +652,7 @@ leftOverSpace -= baseSize; flexFactorSum -= flexFactor; if (!additionalTracksToTreatAsInflexible) - additionalTracksToTreatAsInflexible = wrapUnique(new TrackIndexSet()); + additionalTracksToTreatAsInflexible = adoptPtr(new TrackIndexSet()); additionalTracksToTreatAsInflexible->add(index); validFlexFactorUnit = false; } @@ -1415,13 +1413,13 @@ column.grow(maximumColumnIndex + abs(m_smallestColumnStart)); } -std::unique_ptr<GridArea> LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const +PassOwnPtr<GridArea> LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const { GridTrackSizingDirection crossDirection = specifiedDirection == ForColumns ? ForRows : ForColumns; const size_t endOfCrossDirection = crossDirection == ForColumns ? gridColumnCount() : gridRowCount(); size_t crossDirectionSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem, crossDirection); GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan(endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize); - return wrapUnique(new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions)); + return adoptPtr(new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions)); } void LayoutGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>& autoGridItems) @@ -1442,7 +1440,7 @@ unsigned majorAxisInitialPosition = majorAxisPositions.startLine(); GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAxisPositions.startLine(), isGridAutoFlowDense ? 0 : minorAxisCursors.get(majorAxisInitialPosition)); - std::unique_ptr<GridArea> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize); + OwnPtr<GridArea> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize); if (!emptyGridArea) emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(*autoGridItem, autoPlacementMajorAxisDirection(), majorAxisPositions); @@ -1480,7 +1478,7 @@ size_t majorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.second : autoPlacementCursor.first; size_t minorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.first : autoPlacementCursor.second; - std::unique_ptr<GridArea> emptyGridArea; + OwnPtr<GridArea> emptyGridArea; if (minorAxisPositions.isTranslatedDefinite()) { // Move to the next track in major axis if initial position in minor axis is before auto-placement cursor. if (minorAxisPositions.startLine() < minorAxisAutoPlacementCursor)
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h index 01c34999..335e18ba 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.h +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -29,7 +29,6 @@ #include "core/layout/LayoutBlock.h" #include "core/layout/OrderIterator.h" #include "core/style/GridPositionsResolver.h" -#include <memory> namespace blink { @@ -133,7 +132,7 @@ void placeItemsOnGrid(); void populateExplicitGridAndOrderIterator(); - std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; + PassOwnPtr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& autoPlacementCursor); @@ -157,7 +156,7 @@ template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingData&, LayoutUnit& availableLogicalSpace); typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<size_t>> TrackIndexSet; - double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDirection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexible = nullptr) const; + double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDirection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible = nullptr) const; double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, GridTrackSizingDirection, LayoutUnit leftOverSpace) const; const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index c5b4180..8263e0f5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -80,7 +80,6 @@ #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include <algorithm> -#include <memory> #ifndef NDEBUG #include <stdio.h> #endif @@ -138,7 +137,7 @@ // The pointer to paint properties is implemented as a global hash map temporarily, // to avoid memory regression during the transition towards SPv2. -typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> ObjectPaintPropertiesMap; +typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintPropertiesMap; static ObjectPaintPropertiesMap& objectPaintPropertiesMap() { DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap, ()); @@ -1171,9 +1170,9 @@ value->endDictionary(); } -static std::unique_ptr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason) +static PassOwnPtr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); addJsonObjectForRect(value.get(), "rect", rect); value->setString("invalidation_reason", invalidationReason); return value; @@ -1328,9 +1327,9 @@ } } -static std::unique_ptr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation) +static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); addJsonObjectForRect(value.get(), "oldRect", oldRect); addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); addJsonObjectForRect(value.get(), "newRect", newRect);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp index 00f82f5..8d24d01 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -44,7 +44,6 @@ #include "core/paint/PaintLayer.h" #include "core/paint/TablePainter.h" #include "core/style/StyleInheritedData.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -92,9 +91,9 @@ // According to the CSS2 spec, you only use fixed table layout if an // explicit width is specified on the table. Auto width implies auto table layout. if (style()->isFixedTableLayout()) - m_tableLayout = wrapUnique(new TableLayoutAlgorithmFixed(this)); + m_tableLayout = adoptPtr(new TableLayoutAlgorithmFixed(this)); else - m_tableLayout = wrapUnique(new TableLayoutAlgorithmAuto(this)); + m_tableLayout = adoptPtr(new TableLayoutAlgorithmAuto(this)); } // If border was changed, invalidate collapsed borders cache.
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h index 2c0f062..b969dc6 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.h +++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
@@ -30,7 +30,6 @@ #include "core/layout/LayoutBlock.h" #include "core/style/CollapsedBorderValue.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -475,7 +474,7 @@ // // As the algorithm is dependent on the style, this field is nullptr before // the first style is applied in styleDidChange(). - std::unique_ptr<TableLayoutAlgorithm> m_tableLayout; + OwnPtr<TableLayoutAlgorithm> m_tableLayout; // A sorted list of all unique border values that we want to paint. //
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp index e6fa743..9adadc04 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -34,7 +34,6 @@ #include "core/style/CollapsedBorderValue.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/TransformState.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -923,7 +922,7 @@ m_collapsedBorderValues = nullptr; } else if (!m_collapsedBorderValues) { changed = true; - m_collapsedBorderValues = wrapUnique(new CollapsedBorderValues(newValues)); + m_collapsedBorderValues = adoptPtr(new CollapsedBorderValues(newValues)); } else { // We check visuallyEquals so that the table cell is invalidated only if a changed // collapsed border is visible in the first place.
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h index dba89847..023f92db 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -30,7 +30,6 @@ #include "core/layout/LayoutTableRow.h" #include "core/layout/LayoutTableSection.h" #include "platform/LengthFunctions.h" -#include <memory> namespace blink { @@ -367,7 +366,7 @@ int m_intrinsicPaddingBefore; int m_intrinsicPaddingAfter; - std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; + OwnPtr<CollapsedBorderValues> m_collapsedBorderValues; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
diff --git a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h index 189a8d87d..a6c0c6c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h +++ b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h
@@ -13,8 +13,8 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include <gtest/gtest.h> -#include <memory> namespace blink { @@ -60,7 +60,7 @@ Persistent<LocalFrame> m_subframe; Persistent<FrameLoaderClient> m_frameLoaderClient; Persistent<FrameLoaderClient> m_childFrameLoaderClient; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; class SingleChildFrameLoaderClient final : public EmptyFrameLoaderClient {
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp index f3039dfa..240020a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
@@ -14,7 +14,6 @@ #include "core/testing/DummyPageHolder.h" #include "platform/graphics/Color.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index f71ba49..4bbb895 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -44,7 +44,6 @@ #include "platform/geometry/TransformState.h" #include "platform/graphics/paint/PaintController.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" #include <inttypes.h> namespace blink { @@ -244,7 +243,7 @@ if (pageLogicalHeight() && shouldUsePrintingLayout()) { m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); if (!m_fragmentationContext) - m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*this)); + m_fragmentationContext = adoptPtr(new ViewFragmentationContext(*this)); } else if (m_fragmentationContext) { m_fragmentationContext.reset(); } @@ -953,7 +952,7 @@ PaintLayerCompositor* LayoutView::compositor() { if (!m_compositor) - m_compositor = wrapUnique(new PaintLayerCompositor(*this)); + m_compositor = adoptPtr(new PaintLayerCompositor(*this)); return m_compositor.get(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.h b/third_party/WebKit/Source/core/layout/LayoutView.h index 6a123a2..0441c81 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.h +++ b/third_party/WebKit/Source/core/layout/LayoutView.h
@@ -32,7 +32,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" #include "platform/scroll/ScrollableArea.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -262,8 +262,8 @@ // See the class comment for more details. LayoutState* m_layoutState; - std::unique_ptr<ViewFragmentationContext> m_fragmentationContext; - std::unique_ptr<PaintLayerCompositor> m_compositor; + OwnPtr<ViewFragmentationContext> m_fragmentationContext; + OwnPtr<PaintLayerCompositor> m_compositor; RefPtr<IntervalArena> m_intervalArena; LayoutQuote* m_layoutQuoteHead;
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp index 3f6ee8e..9ce514ca 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -47,8 +47,6 @@ #include "core/layout/api/LayoutAPIShim.h" #include "core/layout/api/LayoutViewItem.h" #include "core/page/Page.h" -#include "wtf/PtrUtil.h" -#include <memory> #ifdef AUTOSIZING_DOM_DEBUG_INFO #include "core/dom/ExecutionContextTask.h" @@ -84,7 +82,7 @@ node = toDocument(node)->documentElement(); if (!node->isElementNode()) return; - node->document().postTask(wrapUnique(new WriteDebugInfoTask(toElement(node), output))); + node->document().postTask(adoptPtr(new WriteDebugInfoTask(toElement(node), output))); } void TextAutosizer::writeClusterDebugInfo(Cluster* cluster) @@ -363,7 +361,7 @@ m_blocksThatHaveBegunLayout.add(block); #endif if (Cluster* cluster = maybeCreateCluster(block)) - m_clusterStack.append(wrapUnique(cluster)); + m_clusterStack.append(adoptPtr(cluster)); } } @@ -377,7 +375,7 @@ ASSERT(!m_clusterStack.isEmpty() || block->isLayoutView()); if (Cluster* cluster = maybeCreateCluster(block)) - m_clusterStack.append(wrapUnique(cluster)); + m_clusterStack.append(adoptPtr(cluster)); ASSERT(!m_clusterStack.isEmpty()); @@ -767,12 +765,12 @@ if (!roots || roots->size() < 2 || !roots->contains(block)) return nullptr; - SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, std::unique_ptr<Supercluster>()); + SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, PassOwnPtr<Supercluster>()); if (!addResult.isNewEntry) return addResult.storedValue->value.get(); Supercluster* supercluster = new Supercluster(roots); - addResult.storedValue->value = wrapUnique(supercluster); + addResult.storedValue->value = adoptPtr(supercluster); return supercluster; } @@ -1095,9 +1093,9 @@ { add(block, fingerprint); - ReverseFingerprintMap::AddResult addResult = m_blocksForFingerprint.add(fingerprint, std::unique_ptr<BlockSet>()); + ReverseFingerprintMap::AddResult addResult = m_blocksForFingerprint.add(fingerprint, PassOwnPtr<BlockSet>()); if (addResult.isNewEntry) - addResult.storedValue->value = wrapUnique(new BlockSet); + addResult.storedValue->value = adoptPtr(new BlockSet); addResult.storedValue->value->add(block); #if ENABLE(ASSERT) assertMapsAreConsistent();
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.h b/third_party/WebKit/Source/core/layout/TextAutosizer.h index c680135..4f3a2a6 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.h +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.h
@@ -36,7 +36,8 @@ #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" + #include <unicode/uchar.h> namespace blink { @@ -206,8 +207,8 @@ "sizeof(FingerprintSourceData) must be a multiple of UChar"); typedef unsigned Fingerprint; - typedef HashMap<Fingerprint, std::unique_ptr<Supercluster>> SuperclusterMap; - typedef Vector<std::unique_ptr<Cluster>> ClusterStack; + typedef HashMap<Fingerprint, OwnPtr<Supercluster>> SuperclusterMap; + typedef Vector<OwnPtr<Cluster>> ClusterStack; // Fingerprints are computed during style recalc, for (some subset of) // blocks that will become cluster roots. @@ -223,7 +224,7 @@ bool hasFingerprints() const { return !m_fingerprints.isEmpty(); } private: typedef HashMap<const LayoutObject*, Fingerprint> FingerprintMap; - typedef HashMap<Fingerprint, std::unique_ptr<BlockSet>> ReverseFingerprintMap; + typedef HashMap<Fingerprint, OwnPtr<BlockSet>> ReverseFingerprintMap; FingerprintMap m_fingerprints; ReverseFingerprintMap m_blocksForFingerprint;
diff --git a/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp b/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp index efc34549d..fddb6c4 100644 --- a/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp
@@ -9,7 +9,6 @@ #include "core/layout/LayoutText.h" #include "core/layout/LayoutView.h" #include <inttypes.h> -#include <memory> namespace blink { @@ -100,9 +99,9 @@ } // namespace -std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) +PassOwnPtr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) { - std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); + OwnPtr<TracedValue> tracedValue = TracedValue::create(); dumpToTracedValue(view, traceGeometry, tracedValue.get()); return tracedValue; }
diff --git a/third_party/WebKit/Source/core/layout/TracedLayoutObject.h b/third_party/WebKit/Source/core/layout/TracedLayoutObject.h index 085b558b..4f03b9b 100644 --- a/third_party/WebKit/Source/core/layout/TracedLayoutObject.h +++ b/third_party/WebKit/Source/core/layout/TracedLayoutObject.h
@@ -6,7 +6,6 @@ #define TracedLayoutObject_h #include "platform/TracedValue.h" -#include <memory> namespace blink { @@ -14,7 +13,7 @@ class TracedLayoutObject { public: - static std::unique_ptr<TracedValue> create(const LayoutView&, bool traceGeometry = true); + static PassOwnPtr<TracedValue> create(const LayoutView&, bool traceGeometry = true); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h index a9a7076..a7973d8 100644 --- a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h +++ b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h
@@ -7,7 +7,6 @@ #include "core/layout/api/LineLayoutSVGInline.h" #include "core/layout/svg/LayoutSVGTextPath.h" -#include <memory> namespace blink { @@ -28,7 +27,7 @@ LineLayoutSVGTextPath() { } - std::unique_ptr<PathPositionMapper> layoutPath() const + PassOwnPtr<PathPositionMapper> layoutPath() const { return toSVGTextPath()->layoutPath(); }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index 315a6b0..78d921f 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -70,7 +70,6 @@ #include "platform/graphics/paint/TransformDisplayItem.h" #include "wtf/CurrentTime.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -222,9 +221,9 @@ destroyGraphicsLayers(); } -std::unique_ptr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons) +PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons) { - std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this); + OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this); graphicsLayer->setCompositingReasons(reasons); graphicsLayer->setSquashingDisallowedReasons(squashingDisallowedReasons); @@ -502,7 +501,7 @@ updateChildClippingMaskLayer(needsChildClippingMask); - if (layerToApplyChildClippingMask == m_graphicsLayer.get()) { + if (layerToApplyChildClippingMask == m_graphicsLayer) { if (m_graphicsLayer->maskLayer() != m_childClippingMaskLayer.get()) { m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get()); maskLayerChanged = true; @@ -1330,7 +1329,7 @@ m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground; } -bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(std::unique_ptr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) +bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) { if (needsLayer == !!layer) return false; @@ -2250,7 +2249,7 @@ IntSize offsetFromAnchorLayoutObject; const LayoutBoxModelObject* anchorLayoutObject; - if (graphicsLayer == m_squashingLayer.get()) { + if (graphicsLayer == m_squashingLayer) { // TODO(chrishtr): this is a speculative fix for crbug.com/561306. However, it should never be the case that // m_squashingLayer exists yet m_squashedLayers.size() == 0. There must be a bug elsewhere. if (m_squashedLayers.size() == 0) @@ -2261,7 +2260,7 @@ anchorLayoutObject = m_squashedLayers[0].paintLayer->layoutObject(); offsetFromAnchorLayoutObject = m_squashedLayers[0].offsetFromLayoutObject; } else { - ASSERT(graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_scrollingContentsLayer.get()); + ASSERT(graphicsLayer == m_graphicsLayer || graphicsLayer == m_scrollingContentsLayer); anchorLayoutObject = m_owningLayer.layoutObject(); offsetFromAnchorLayoutObject = graphicsLayer->offsetFromLayoutObject(); adjustForCompositedScrolling(graphicsLayer, offsetFromAnchorLayoutObject); @@ -2346,7 +2345,7 @@ // Paint the whole layer if "mainFrameClipsContent" is false, meaning that WebPreferences::record_whole_document is true. bool shouldPaintWholePage = !m_owningLayer.layoutObject()->document().settings()->mainFrameClipsContent(); if (shouldPaintWholePage - || (graphicsLayer != m_graphicsLayer.get() && graphicsLayer != m_squashingLayer.get() && graphicsLayer != m_squashingLayer.get() && graphicsLayer != m_scrollingContentsLayer.get())) + || (graphicsLayer != m_graphicsLayer && graphicsLayer != m_squashingLayer && graphicsLayer != m_squashingLayer && graphicsLayer != m_scrollingContentsLayer)) return wholeLayerRect; IntRect newInterestRect = recomputeInterestRect(graphicsLayer); @@ -2405,7 +2404,7 @@ if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; - if (graphicsLayer == m_backgroundLayer.get()) + if (graphicsLayer == m_backgroundLayer) paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers. else if (compositor()->fixedRootBackgroundLayer()) paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h index 93154db8f..ffe6c9c 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
@@ -33,7 +33,6 @@ #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/GraphicsLayerClient.h" #include "wtf/Allocator.h" -#include <memory> namespace blink { @@ -249,8 +248,8 @@ void createPrimaryGraphicsLayer(); void destroyGraphicsLayers(); - std::unique_ptr<GraphicsLayer> createGraphicsLayer(CompositingReasons, SquashingDisallowedReasons = SquashingDisallowedReasonsNone); - bool toggleScrollbarLayerIfNeeded(std::unique_ptr<GraphicsLayer>&, bool needsLayer, CompositingReasons); + PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons, SquashingDisallowedReasons = SquashingDisallowedReasonsNone); + bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, CompositingReasons); LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObject(); } PaintLayerCompositor* compositor() const { return m_owningLayer.compositor(); } @@ -364,18 +363,18 @@ // In this case B is clipped by another layer that doesn't happen to be its ancestor: A. // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped // as if it had been A's descendant. - std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. - std::unique_ptr<GraphicsLayer> m_graphicsLayer; - std::unique_ptr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children. - std::unique_ptr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective. - std::unique_ptr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. - std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. + OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. + OwnPtr<GraphicsLayer> m_graphicsLayer; + OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children. + OwnPtr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective. + OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. + OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. // This layer is also added to the hierarchy by the RLB, but in a different way than // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if // we have a mask, and isn't part of the typical hierarchy (it has no children). - std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. - std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. + OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. + OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. // There are two other (optional) layers whose painting is managed by the CompositedLayerMapping, // but whose position in the hierarchy is maintained by the PaintLayerCompositor. These @@ -399,17 +398,17 @@ // // With the hierarchy set up like this, the root content layer is able to scroll without affecting // the background layer (or paint invalidation). - std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. - std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. + OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. + OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. - std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; - std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; - std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; + OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; + OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; + OwnPtr<GraphicsLayer> m_layerForScrollCorner; // This layer contains the scrollbar and scroll corner layers and clips them to the border box // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but may be reparented by // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling content. - std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; + OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; // The reparented overflow controls sometimes need to be clipped by a non-ancestor. In just the same // way we need an ancestor clipping layer to clip this CLM's internal hierarchy, we add another layer @@ -417,7 +416,7 @@ // would require manually intersecting their clips, and shifting the overflow controls to compensate // for this clip's offset. By using a separate layer, the overflow controls can remain ignorant of // ancestor clipping. - std::unique_ptr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; + OwnPtr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; // A squashing CLM has two possible squashing-related structures. // @@ -435,8 +434,8 @@ // // Stacking children of a squashed layer receive graphics layers that are parented to the compositd ancestor of the // squashed layer (i.e. nearest enclosing composited layer that is not squashed). - std::unique_ptr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk. - std::unique_ptr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into. + OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk. + OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into. Vector<GraphicsLayerPaintInfo> m_squashedLayers; LayoutPoint m_squashingLayerOffsetFromTransformedAncestor;
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h index 95cf7561..0ccd54c 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
@@ -30,7 +30,6 @@ #include "core/layout/compositing/CompositingReasonFinder.h" #include "platform/graphics/GraphicsLayerClient.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -220,7 +219,7 @@ Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const; LayoutView& m_layoutView; - std::unique_ptr<GraphicsLayer> m_rootContentLayer; + OwnPtr<GraphicsLayer> m_rootContentLayer; CompositingReasonFinder m_compositingReasonFinder; @@ -245,16 +244,16 @@ RootLayerAttachment m_rootLayerAttachment; // Enclosing container layer, which clips for iframe content - std::unique_ptr<GraphicsLayer> m_containerLayer; - std::unique_ptr<GraphicsLayer> m_scrollLayer; + OwnPtr<GraphicsLayer> m_containerLayer; + OwnPtr<GraphicsLayer> m_scrollLayer; // Enclosing layer for overflow controls and the clipping layer - std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; + OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; // Layers for overflow controls - std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; - std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; - std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; + OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; + OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; + OwnPtr<GraphicsLayer> m_layerForScrollCorner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp index 13a0d46..1767ac8 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -36,7 +36,6 @@ #include "core/paint/InlineFlowBoxPainter.h" #include "core/style/ShadowList.h" #include "platform/fonts/Font.h" -#include "wtf/PtrUtil.h" #include <algorithm> #include <math.h> @@ -953,7 +952,7 @@ return; if (!m_overflow) - m_overflow = wrapUnique(new SimpleOverflowModel(frameBox, frameBox)); + m_overflow = adoptPtr(new SimpleOverflowModel(frameBox, frameBox)); m_overflow->setLayoutOverflow(rect); } @@ -965,7 +964,7 @@ return; if (!m_overflow) - m_overflow = wrapUnique(new SimpleOverflowModel(frameBox, frameBox)); + m_overflow = adoptPtr(new SimpleOverflowModel(frameBox, frameBox)); m_overflow->setVisualOverflow(rect); }
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h index 2b55056..d1dd6e3 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h
@@ -25,7 +25,6 @@ #include "core/layout/api/SelectionState.h" #include "core/layout/line/InlineBox.h" #include "core/style/ShadowData.h" -#include <memory> namespace blink { @@ -311,7 +310,7 @@ void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, const LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom); protected: - std::unique_ptr<SimpleOverflowModel> m_overflow; + OwnPtr<SimpleOverflowModel> m_overflow; bool isInlineFlowBox() const final { return true; }
diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.h b/third_party/WebKit/Source/core/layout/line/RootInlineBox.h index 538b0def..09df02a 100644 --- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.h +++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.h
@@ -25,8 +25,6 @@ #include "core/layout/api/SelectionState.h" #include "core/layout/line/InlineFlowBox.h" #include "platform/text/BidiContext.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -126,7 +124,7 @@ if (m_floats) m_floats->append(floatingBox); else - m_floats= wrapUnique(new Vector<LayoutBox*>(1, floatingBox)); + m_floats= adoptPtr(new Vector<LayoutBox*>(1, floatingBox)); } Vector<LayoutBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get(); } @@ -184,7 +182,7 @@ // Floats hanging off the line are pushed into this vector during layout. It is only // good for as long as the line has not been marked dirty. - std::unique_ptr<Vector<LayoutBox*>> m_floats; + OwnPtr<Vector<LayoutBox*>> m_floats; LayoutUnit m_lineTop; LayoutUnit m_lineBottom;
diff --git a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp index 0c707169..ee06118 100644 --- a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
@@ -31,7 +31,6 @@ #include "platform/geometry/FloatRoundedRect.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -39,7 +38,7 @@ protected: BoxShapeTest() { } - std::unique_ptr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin) + PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin) { return Shape::createLayoutBoxShape(bounds, TopToBottomWritingMode, shapeMargin); } @@ -74,7 +73,7 @@ */ TEST_F(BoxShapeTest, zeroRadii) { - std::unique_ptr<Shape> shape = createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); + OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); EXPECT_FALSE(shape->isEmpty()); EXPECT_EQ(LayoutRect(-10, -10, 120, 70), shape->shapeMarginLogicalBoundingBox()); @@ -119,7 +118,7 @@ TEST_F(BoxShapeTest, getIntervals) { const FloatRoundedRect::Radii cornerRadii(FloatSize(10, 15), FloatSize(10, 20), FloatSize(25, 15), FloatSize(20, 30)); - std::unique_ptr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100), cornerRadii), 0); + OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100), cornerRadii), 0); EXPECT_FALSE(shape->isEmpty()); EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox());
diff --git a/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h b/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h index f238812..62dd4a6 100644 --- a/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h +++ b/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h
@@ -33,7 +33,6 @@ #include "core/layout/shapes/Shape.h" #include "core/layout/shapes/ShapeInterval.h" #include "platform/geometry/FloatPolygon.h" -#include <memory> namespace blink { @@ -62,7 +61,7 @@ class PolygonShape final : public Shape { WTF_MAKE_NONCOPYABLE(PolygonShape); public: - PolygonShape(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) + PolygonShape(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) : Shape() , m_polygon(std::move(vertices), fillRule) {
diff --git a/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp b/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp index a4a1cc3b..a1c420632 100644 --- a/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp
@@ -30,8 +30,6 @@ #include "core/layout/shapes/RasterShape.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -74,10 +72,10 @@ return IntShapeInterval(m_x1 - dx, m_x2 + dx); } -std::unique_ptr<RasterShapeIntervals> RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const +PassOwnPtr<RasterShapeIntervals> RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const { int marginIntervalsSize = (offset() > shapeMargin) ? size() : size() - offset() * 2 + shapeMargin * 2; - std::unique_ptr<RasterShapeIntervals> result = wrapUnique(new RasterShapeIntervals(marginIntervalsSize, std::max(shapeMargin, offset()))); + OwnPtr<RasterShapeIntervals> result = adoptPtr(new RasterShapeIntervals(marginIntervalsSize, std::max(shapeMargin, offset()))); MarginIntervalGenerator marginIntervalGenerator(shapeMargin); for (int y = bounds().y(); y < bounds().maxY(); ++y) {
diff --git a/third_party/WebKit/Source/core/layout/shapes/RasterShape.h b/third_party/WebKit/Source/core/layout/shapes/RasterShape.h index e43e9e8..e9d262e3 100644 --- a/third_party/WebKit/Source/core/layout/shapes/RasterShape.h +++ b/third_party/WebKit/Source/core/layout/shapes/RasterShape.h
@@ -35,7 +35,6 @@ #include "platform/geometry/FloatRect.h" #include "wtf/Assertions.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -64,7 +63,7 @@ return m_intervals[y + m_offset]; } - std::unique_ptr<RasterShapeIntervals> computeShapeMarginIntervals(int shapeMargin) const; + PassOwnPtr<RasterShapeIntervals> computeShapeMarginIntervals(int shapeMargin) const; void buildBoundsPath(Path&) const; @@ -82,7 +81,7 @@ class RasterShape final : public Shape { WTF_MAKE_NONCOPYABLE(RasterShape); public: - RasterShape(std::unique_ptr<RasterShapeIntervals> intervals, const IntSize& marginRectSize) + RasterShape(PassOwnPtr<RasterShapeIntervals> intervals, const IntSize& marginRectSize) : m_intervals(std::move(intervals)) , m_marginRectSize(marginRectSize) { @@ -102,8 +101,8 @@ private: const RasterShapeIntervals& marginIntervals() const; - std::unique_ptr<RasterShapeIntervals> m_intervals; - mutable std::unique_ptr<RasterShapeIntervals> m_marginIntervals; + OwnPtr<RasterShapeIntervals> m_intervals; + mutable OwnPtr<RasterShapeIntervals> m_marginIntervals; IntSize m_marginRectSize; };
diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp index 37602c62..76e973ce 100644 --- a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
@@ -45,33 +45,32 @@ #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/ImageBuffer.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/typed_arrays/ArrayBufferContents.h" -#include <memory> namespace blink { -static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) +static PassOwnPtr<Shape> createInsetShape(const FloatRoundedRect& bounds) { ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0); - return wrapUnique(new BoxShape(bounds)); + return adoptPtr(new BoxShape(bounds)); } -static std::unique_ptr<Shape> createCircleShape(const FloatPoint& center, float radius) +static PassOwnPtr<Shape> createCircleShape(const FloatPoint& center, float radius) { ASSERT(radius >= 0); - return wrapUnique(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius))); + return adoptPtr(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius))); } -static std::unique_ptr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii) +static PassOwnPtr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii) { ASSERT(radii.width() >= 0 && radii.height() >= 0); - return wrapUnique(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); + return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); } -static std::unique_ptr<Shape> createPolygonShape(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) +static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) { - return wrapUnique(new PolygonShape(std::move(vertices), fillRule)); + return adoptPtr(new PolygonShape(std::move(vertices), fillRule)); } static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logicalBoxHeight, WritingMode writingMode) @@ -99,14 +98,14 @@ return size.transposedSize(); } -std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin) +PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin) { ASSERT(basicShape); bool horizontalWritingMode = isHorizontalWritingMode(writingMode); float boxWidth = horizontalWritingMode ? logicalBoxSize.width().toFloat() : logicalBoxSize.height().toFloat(); float boxHeight = horizontalWritingMode ? logicalBoxSize.height().toFloat() : logicalBoxSize.width().toFloat(); - std::unique_ptr<Shape> shape; + OwnPtr<Shape> shape; switch (basicShape->type()) { @@ -136,7 +135,7 @@ const Vector<Length>& values = polygon->values(); size_t valuesSize = values.size(); ASSERT(!(valuesSize % 2)); - std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<FloatPoint>(valuesSize / 2)); + OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(valuesSize / 2)); for (unsigned i = 0; i < valuesSize; i += 2) { FloatPoint vertex( floatValueForLength(values.at(i), boxWidth), @@ -180,22 +179,22 @@ return shape; } -std::unique_ptr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin) +PassOwnPtr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin) { - std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(0, 0)); - std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), IntSize())); + OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(0, 0)); + OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), IntSize())); rasterShape->m_writingMode = writingMode; rasterShape->m_margin = margin; return std::move(rasterShape); } -std::unique_ptr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin) +PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin) { IntRect imageRect = pixelSnappedIntRect(imageR); IntRect marginRect = pixelSnappedIntRect(marginR); - std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(marginRect.height(), -marginRect.y())); - std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); + OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(marginRect.height(), -marginRect.y())); + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); if (image && imageBuffer) { // FIXME: This is not totally correct but it is needed to prevent shapes @@ -235,17 +234,17 @@ } } - std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), marginRect.size())); + OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), marginRect.size())); rasterShape->m_writingMode = writingMode; rasterShape->m_margin = margin; return std::move(rasterShape); } -std::unique_ptr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin) +PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin) { FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()); FloatRoundedRect bounds(rect, roundedRect.getRadii()); - std::unique_ptr<Shape> shape = createInsetShape(bounds); + OwnPtr<Shape> shape = createInsetShape(bounds); shape->m_writingMode = writingMode; shape->m_margin = margin;
diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.h b/third_party/WebKit/Source/core/layout/shapes/Shape.h index f6cff72d..59002f0 100644 --- a/third_party/WebKit/Source/core/layout/shapes/Shape.h +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.h
@@ -36,7 +36,7 @@ #include "platform/geometry/LayoutRect.h" #include "platform/graphics/Path.h" #include "platform/text/WritingMode.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -76,10 +76,10 @@ Path shape; Path marginShape; }; - static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin); - static std::unique_ptr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); - static std::unique_ptr<Shape> createEmptyRasterShape(WritingMode, float margin); - static std::unique_ptr<Shape> createLayoutBoxShape(const FloatRoundedRect&, WritingMode, float margin); + static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin); + static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); + static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); + static PassOwnPtr<Shape> createLayoutBoxShape(const FloatRoundedRect&, WritingMode, float margin); virtual ~Shape() { }
diff --git a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp index 6b388d21..3ddffa0 100644 --- a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp
@@ -36,7 +36,6 @@ #include "core/layout/LayoutImage.h" #include "platform/LengthFunctions.h" #include "public/platform/Platform.h" -#include <memory> namespace blink { @@ -120,7 +119,7 @@ return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSizeBytes; } -std::unique_ptr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const +PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const { const LayoutSize& imageSize = styleImage->imageSize(m_layoutBox, m_layoutBox.style()->effectiveZoom(), m_referenceBoxLogicalSize);
diff --git a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h index 0dc4a70c..56f27f27e 100644 --- a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h +++ b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h
@@ -36,8 +36,7 @@ #include "core/style/ShapeValue.h" #include "platform/geometry/FloatRect.h" #include "platform/geometry/LayoutSize.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -94,7 +93,7 @@ LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLogicalBoundingBox().width(); } LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLogicalBoundingBox().height(); } - static std::unique_ptr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) { return wrapUnique(new ShapeOutsideInfo(layoutBox)); } + static PassOwnPtr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) { return adoptPtr(new ShapeOutsideInfo(layoutBox)); } static bool isEnabledFor(const LayoutBox&); ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlockFlow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); @@ -127,12 +126,12 @@ { } private: - std::unique_ptr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold, WritingMode, float margin) const; + PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold, WritingMode, float margin) const; LayoutUnit logicalTopOffset() const; LayoutUnit logicalLeftOffset() const; - typedef HashMap<const LayoutBox*, std::unique_ptr<ShapeOutsideInfo>> InfoMap; + typedef HashMap<const LayoutBox*, OwnPtr<ShapeOutsideInfo>> InfoMap; static InfoMap& infoMap() { DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); @@ -140,7 +139,7 @@ } const LayoutBox& m_layoutBox; - mutable std::unique_ptr<Shape> m_shape; + mutable OwnPtr<Shape> m_shape; LayoutSize m_referenceBoxLogicalSize; ShapeOutsideDeltas m_shapeOutsideDeltas; mutable bool m_isComputingShape;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp index 0c957d3f..2f56243e 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp
@@ -22,9 +22,6 @@ #include "core/layout/svg/LayoutSVGResourceGradient.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { LayoutSVGResourceGradient::LayoutSVGResourceGradient(SVGGradientElement* node) @@ -73,9 +70,9 @@ if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty()) return SVGPaintServer::invalid(); - std::unique_ptr<GradientData>& gradientData = m_gradientMap.add(&object, nullptr).storedValue->value; + OwnPtr<GradientData>& gradientData = m_gradientMap.add(&object, nullptr).storedValue->value; if (!gradientData) - gradientData = wrapUnique(new GradientData); + gradientData = adoptPtr(new GradientData); // Create gradient object if (!gradientData->gradient) {
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h index ccfcb20..5f2bffc 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h
@@ -28,7 +28,6 @@ #include "platform/graphics/Gradient.h" #include "platform/transforms/AffineTransform.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -62,7 +61,7 @@ private: bool m_shouldCollectGradientAttributes : 1; - HashMap<const LayoutObject*, std::unique_ptr<GradientData>> m_gradientMap; + HashMap<const LayoutObject*, OwnPtr<GradientData>> m_gradientMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp index 3b9d2ebf..c8311c0 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp
@@ -31,8 +31,6 @@ #include "platform/graphics/paint/PaintController.h" #include "platform/graphics/paint/SkPictureBuilder.h" #include "third_party/skia/include/core/SkPicture.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -77,7 +75,7 @@ return m_patternMap.set(&object, buildPatternData(object)).storedValue->value.get(); } -std::unique_ptr<PatternData> LayoutSVGResourcePattern::buildPatternData(const LayoutObject& object) +PassOwnPtr<PatternData> LayoutSVGResourcePattern::buildPatternData(const LayoutObject& object) { // If we couldn't determine the pattern content element root, stop here. const PatternAttributes& attributes = this->attributes(); @@ -109,7 +107,7 @@ tileTransform.scale(clientBoundingBox.width(), clientBoundingBox.height()); } - std::unique_ptr<PatternData> patternData = wrapUnique(new PatternData); + OwnPtr<PatternData> patternData = adoptPtr(new PatternData); patternData->pattern = Pattern::createPicturePattern(asPicture(tileBounds, tileTransform)); // Compute pattern space transformation.
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h index 0c18098..e4709b16 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h
@@ -26,8 +26,8 @@ #include "core/svg/PatternAttributes.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> class SkPicture; @@ -53,7 +53,7 @@ LayoutSVGResourceType resourceType() const override { return s_resourceType; } private: - std::unique_ptr<PatternData> buildPatternData(const LayoutObject&); + PassOwnPtr<PatternData> buildPatternData(const LayoutObject&); PassRefPtr<SkPicture> asPicture(const FloatRect& tile, const AffineTransform&) const; PatternData* patternForLayoutObject(const LayoutObject&); @@ -71,7 +71,7 @@ // should be able to cache a single display list per LayoutSVGResourcePattern + one // Pattern(shader) for each client -- this would avoid re-recording when multiple clients // share the same pattern. - HashMap<const LayoutObject*, std::unique_ptr<PatternData>> m_patternMap; + HashMap<const LayoutObject*, OwnPtr<PatternData>> m_patternMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp index 32f65ee..a049d043 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -41,7 +41,6 @@ #include "platform/geometry/FloatPoint.h" #include "platform/graphics/StrokeData.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -60,7 +59,7 @@ void LayoutSVGShape::createPath() { if (!m_path) - m_path = wrapUnique(new Path()); + m_path = adoptPtr(new Path()); *m_path = toSVGGeometryElement(element())->asPath(); if (m_rareData.get()) m_rareData->m_cachedNonScalingStrokePath.clear(); @@ -302,7 +301,7 @@ LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { if (!m_rareData) - m_rareData = wrapUnique(new LayoutSVGShapeRareData()); + m_rareData = adoptPtr(new LayoutSVGShapeRareData()); return *m_rareData.get(); }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h index a7b3fde9..2e4899c1 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h
@@ -30,8 +30,8 @@ #include "core/layout/svg/SVGMarkerData.h" #include "platform/geometry/FloatRect.h" #include "platform/transforms/AffineTransform.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -131,8 +131,8 @@ // TODO(fmalita): the Path is now cached in SVGPath; while this additional cache is just a // shallow copy, it certainly has a complexity/state management cost (plus allocation & storage // overhead) - so we should look into removing it. - std::unique_ptr<Path> m_path; - mutable std::unique_ptr<LayoutSVGShapeRareData> m_rareData; + OwnPtr<Path> m_path; + mutable OwnPtr<LayoutSVGShapeRareData> m_rareData; bool m_needsBoundariesUpdate : 1; bool m_needsShapeUpdate : 1;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp index d3222d48..261e9c4 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp
@@ -23,7 +23,6 @@ #include "core/svg/SVGPathElement.h" #include "core/svg/SVGTextPathElement.h" #include "platform/graphics/Path.h" -#include <memory> namespace blink { @@ -65,7 +64,7 @@ return child->isSVGInline() && !child->isSVGTextPath(); } -std::unique_ptr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const +PassOwnPtr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const { const SVGTextPathElement& textPathElement = toSVGTextPathElement(*node()); Element* targetElement = SVGURIReference::targetElementFromIRIString(
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h index 897583b..1fd09f0 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h
@@ -22,8 +22,6 @@ #define LayoutSVGTextPath_h #include "core/layout/svg/LayoutSVGInline.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -33,9 +31,9 @@ class PathPositionMapper { USING_FAST_MALLOC(PathPositionMapper); public: - static std::unique_ptr<PathPositionMapper> create(const Path& path) + static PassOwnPtr<PathPositionMapper> create(const Path& path) { - return wrapUnique(new PathPositionMapper(path)); + return adoptPtr(new PathPositionMapper(path)); } enum PositionType { @@ -57,7 +55,7 @@ public: explicit LayoutSVGTextPath(Element*); - std::unique_ptr<PathPositionMapper> layoutPath() const; + PassOwnPtr<PathPositionMapper> layoutPath() const; float calculateStartOffset(float) const; bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp index 3f90215..fe15b73 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp +++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
@@ -30,8 +30,6 @@ #include "core/svg/SVGGradientElement.h" #include "core/svg/SVGPatternElement.h" #include "core/svg/SVGURIReference.h" -#include "wtf/PtrUtil.h" -#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -197,15 +195,15 @@ || m_linkedResource; } -static inline SVGResources& ensureResources(std::unique_ptr<SVGResources>& resources) +static inline SVGResources& ensureResources(OwnPtr<SVGResources>& resources) { if (!resources) - resources = wrapUnique(new SVGResources); + resources = adoptPtr(new SVGResources); return *resources.get(); } -std::unique_ptr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const SVGComputedStyle& style) +PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const SVGComputedStyle& style) { ASSERT(object); @@ -222,7 +220,7 @@ TreeScope& treeScope = element->treeScope(); SVGDocumentExtensions& extensions = element->document().accessSVGExtensions(); - std::unique_ptr<SVGResources> resources; + OwnPtr<SVGResources> resources; if (clipperFilterMaskerTags().contains(tagName)) { if (style.hasClipper()) { AtomicString id = style.clipperResource();
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.h b/third_party/WebKit/Source/core/layout/svg/SVGResources.h index 03842305..d3b806e 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResources.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.h
@@ -23,8 +23,8 @@ #include "wtf/Allocator.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -44,7 +44,7 @@ public: SVGResources(); - static std::unique_ptr<SVGResources> buildResources(const LayoutObject*, const SVGComputedStyle&); + static PassOwnPtr<SVGResources> buildResources(const LayoutObject*, const SVGComputedStyle&); void layoutIfNeeded(); static bool supportsMarkers(const SVGElement&); @@ -121,9 +121,9 @@ { } - static std::unique_ptr<ClipperFilterMaskerData> create() + static PassOwnPtr<ClipperFilterMaskerData> create() { - return wrapUnique(new ClipperFilterMaskerData); + return adoptPtr(new ClipperFilterMaskerData); } LayoutSVGResourceClipper* clipper; @@ -143,9 +143,9 @@ { } - static std::unique_ptr<MarkerData> create() + static PassOwnPtr<MarkerData> create() { - return wrapUnique(new MarkerData); + return adoptPtr(new MarkerData); } LayoutSVGResourceMarker* markerStart; @@ -166,18 +166,18 @@ { } - static std::unique_ptr<FillStrokeData> create() + static PassOwnPtr<FillStrokeData> create() { - return wrapUnique(new FillStrokeData); + return adoptPtr(new FillStrokeData); } LayoutSVGResourcePaintServer* fill; LayoutSVGResourcePaintServer* stroke; }; - std::unique_ptr<ClipperFilterMaskerData> m_clipperFilterMaskerData; - std::unique_ptr<MarkerData> m_markerData; - std::unique_ptr<FillStrokeData> m_fillStrokeData; + OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; + OwnPtr<MarkerData> m_markerData; + OwnPtr<FillStrokeData> m_fillStrokeData; LayoutSVGResourceContainer* m_linkedResource; };
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp index c222134..1e120bf 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp +++ b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp
@@ -24,7 +24,6 @@ #include "core/layout/svg/SVGResources.h" #include "core/layout/svg/SVGResourcesCycleSolver.h" #include "core/svg/SVGDocumentExtensions.h" -#include <memory> namespace blink { @@ -44,7 +43,7 @@ const SVGComputedStyle& svgStyle = style.svgStyle(); // Build a list of all resources associated with the passed LayoutObject. - std::unique_ptr<SVGResources> newResources = SVGResources::buildResources(object, svgStyle); + OwnPtr<SVGResources> newResources = SVGResources::buildResources(object, svgStyle); if (!newResources) return; @@ -65,7 +64,7 @@ void SVGResourcesCache::removeResourcesFromLayoutObject(LayoutObject* object) { - std::unique_ptr<SVGResources> resources = m_cache.take(object); + OwnPtr<SVGResources> resources = m_cache.take(object); if (!resources) return;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h index db57752..433a95e 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h
@@ -24,7 +24,7 @@ #include "wtf/Allocator.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -60,7 +60,7 @@ void addResourcesFromLayoutObject(LayoutObject*, const ComputedStyle&); void removeResourcesFromLayoutObject(LayoutObject*); - typedef HashMap<const LayoutObject*, std::unique_ptr<SVGResources>> CacheMap; + typedef HashMap<const LayoutObject*, OwnPtr<SVGResources>> CacheMap; CacheMap m_cache; };
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h index 5e2de72..5e61b74 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h
@@ -25,7 +25,6 @@ #include "core/layout/svg/SVGTextFragment.h" #include "wtf/Allocator.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -89,7 +88,7 @@ bool m_textLengthSpacingInEffect; // Text on path layout - std::unique_ptr<PathPositionMapper> m_textPath; + OwnPtr<PathPositionMapper> m_textPath; float m_textPathStartOffset; float m_textPathCurrentOffset; float m_textPathDisplacement;
diff --git a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp index 9006fa5..0b8713a 100644 --- a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp +++ b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp
@@ -31,7 +31,6 @@ #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -152,7 +151,7 @@ return cache; } -void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KURL& url, std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult) +void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KURL& url, PassOwnPtr<CrossOriginPreflightResultCacheItem> preflightResult) { ASSERT(isMainThread()); m_preflightHashMap.set(std::make_pair(origin, url), std::move(preflightResult));
diff --git a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h index 7f8c2d7..b5cb30a 100644 --- a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h +++ b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h
@@ -31,8 +31,8 @@ #include "platform/weborigin/KURLHash.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -70,13 +70,13 @@ public: static CrossOriginPreflightResultCache& shared(); - void appendEntry(const String& origin, const KURL&, std::unique_ptr<CrossOriginPreflightResultCacheItem>); + void appendEntry(const String& origin, const KURL&, PassOwnPtr<CrossOriginPreflightResultCacheItem>); bool canSkipPreflight(const String& origin, const KURL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders); private: CrossOriginPreflightResultCache() { } - typedef HashMap<std::pair<String, KURL>, std::unique_ptr<CrossOriginPreflightResultCacheItem>> CrossOriginPreflightResultHashMap; + typedef HashMap<std::pair<String, KURL>, OwnPtr<CrossOriginPreflightResultCacheItem>> CrossOriginPreflightResultHashMap; CrossOriginPreflightResultHashMap m_preflightHashMap; };
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp index b8db10de..d775ffb 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp
@@ -7,7 +7,6 @@ #include "core/loader/DocumentLoader.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -16,7 +15,7 @@ TEST_F(DocumentLoadTimingTest, ensureValidNavigationStartAfterEmbedder) { - std::unique_ptr<DummyPageHolder> dummyPage = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> dummyPage = DummyPageHolder::create(); DocumentLoadTiming timing(*(dummyPage->document().loader())); double delta = -1000; @@ -31,7 +30,7 @@ TEST_F(DocumentLoadTimingTest, correctTimingDeltas) { - std::unique_ptr<DummyPageHolder> dummyPage = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> dummyPage = DummyPageHolder::create(); DocumentLoadTiming timing(*(dummyPage->document().loader())); double navigationStartDelta = -456;
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 10b44fc..8f11b8e5 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -75,7 +75,6 @@ #include "wtf/Assertions.h" #include "wtf/TemporaryChange.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -166,7 +165,7 @@ return m_request.url(); } -void DocumentLoader::setSubresourceFilter(std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) +void DocumentLoader::setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilter> subresourceFilter) { m_subresourceFilter = std::move(subresourceFilter); } @@ -371,7 +370,7 @@ return; } -void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(resource, m_mainResource == resource); ASSERT_UNUSED(handle, !handle);
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.h b/third_party/WebKit/Source/core/loader/DocumentLoader.h index 9bf58f7f..acdd1ef 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.h
@@ -49,7 +49,6 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "wtf/HashSet.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -85,7 +84,7 @@ ResourceFetcher* fetcher() const { return m_fetcher.get(); } - void setSubresourceFilter(std::unique_ptr<WebDocumentSubresourceFilter>); + void setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilter>); WebDocumentSubresourceFilter* subresourceFilter() const { return m_subresourceFilter.get(); } const SubstituteData& substituteData() const { return m_substituteData; } @@ -171,7 +170,7 @@ void finishedLoading(double finishTime); void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) final; - void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) final; + void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final; void dataReceived(Resource*, const char* data, size_t length) final; void processData(const char* data, size_t length); void notifyFinished(Resource*) final; @@ -185,7 +184,7 @@ Member<LocalFrame> m_frame; Member<ResourceFetcher> m_fetcher; - std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; + OwnPtr<WebDocumentSubresourceFilter> m_subresourceFilter; Member<RawResource> m_mainResource;
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index 3ccae82..bce49a4 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -55,8 +55,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebURLRequest.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -126,13 +124,13 @@ void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { // The loader will be deleted as soon as this function exits. - std::unique_ptr<DocumentThreadableLoader> loader = wrapUnique(new DocumentThreadableLoader(document, &client, LoadSynchronously, options, resourceLoaderOptions)); + OwnPtr<DocumentThreadableLoader> loader = adoptPtr(new DocumentThreadableLoader(document, &client, LoadSynchronously, options, resourceLoaderOptions)); loader->start(request); } -std::unique_ptr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) +PassOwnPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - return wrapUnique(new DocumentThreadableLoader(document, client, LoadAsynchronously, options, resourceLoaderOptions)); + return adoptPtr(new DocumentThreadableLoader(document, client, LoadAsynchronously, options, resourceLoaderOptions)); } DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient* client, BlockingBehavior blockingBehavior, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) @@ -453,7 +451,7 @@ // TODO(horo): If we support any API which expose the internal body, we // will have to read the body. And also HTTPCache changes will be needed // because it doesn't store the body of redirect responses. - responseReceived(resource, redirectResponse, wrapUnique(new EmptyDataHandle())); + responseReceived(resource, redirectResponse, adoptPtr(new EmptyDataHandle())); if (!self) { request = ResourceRequest(); @@ -598,7 +596,7 @@ // |this| may be dead here. } -void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(resource, resource == this->resource()); ASSERT(m_async); @@ -632,7 +630,7 @@ return; } - std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult = wrapUnique(new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); + OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult = adoptPtr(new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); if (!preflightResult->parse(response, accessControlErrorDescription) || !preflightResult->allowsCrossOriginMethod(m_actualRequest.httpMethod(), accessControlErrorDescription) || !preflightResult->allowsCrossOriginHeaders(m_actualRequest.httpHeaderFields(), accessControlErrorDescription)) { @@ -658,7 +656,7 @@ frame->console().reportResourceResponseReceived(loader, identifier, response); } -void DocumentThreadableLoader::handleResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void DocumentThreadableLoader::handleResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT(m_client);
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h index 9729960..e0eda8e 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h
@@ -41,9 +41,10 @@ #include "platform/network/HTTPHeaderMap.h" #include "platform/network/ResourceError.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -57,7 +58,7 @@ USING_FAST_MALLOC(DocumentThreadableLoader); public: static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); - static std::unique_ptr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); + static PassOwnPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); ~DocumentThreadableLoader() override; void start(const ResourceRequest&) override; @@ -89,7 +90,7 @@ // // |this| may be dead after calling these methods. void dataSent(Resource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void setSerializedCachedMetadata(Resource*, const char*, size_t) override; void dataReceived(Resource*, const char* data, size_t dataLength) override; void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) override; @@ -108,7 +109,7 @@ // common to both sync and async mode. // // |this| may be dead after calling these method in async mode. - void handleResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>); + void handleResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>); void handleReceivedData(const char* data, size_t dataLength); void handleSuccessfulFinish(unsigned long identifier, double finishTime);
diff --git a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp index 7d1ae825..5cfca6d3 100644 --- a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp
@@ -39,7 +39,7 @@ #include "core/loader/FrameLoaderStateMachine.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -86,7 +86,7 @@ { ASSERT(m_parser); if (m_parser->needsDecoder() && 0 < length) { - std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); + OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); m_parser->setDecoder(std::move(decoder)); } // appendBytes() can result replacing DocumentLoader::m_writer. @@ -101,7 +101,7 @@ return; if (m_parser->needsDecoder()) { - std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); + OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); m_parser->setDecoder(std::move(decoder)); }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.cpp b/third_party/WebKit/Source/core/loader/EmptyClients.cpp index 3a74c62..51f7127 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.cpp +++ b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
@@ -40,8 +40,6 @@ #include "public/platform/modules/mediasession/WebMediaSession.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -113,9 +111,9 @@ return String(); } -std::unique_ptr<WebFrameScheduler> EmptyChromeClient::createFrameScheduler(BlameContext*) +PassOwnPtr<WebFrameScheduler> EmptyChromeClient::createFrameScheduler(BlameContext*) { - return wrapUnique(new EmptyFrameScheduler()); + return adoptPtr(new EmptyFrameScheduler()); } NavigationPolicy EmptyFrameLoaderClient::decidePolicyForNavigation(const ResourceRequest&, DocumentLoader*, NavigationType, NavigationPolicy, bool, bool) @@ -151,12 +149,12 @@ return nullptr; } -std::unique_ptr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) +PassOwnPtr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) { return nullptr; } -std::unique_ptr<WebMediaSession> EmptyFrameLoaderClient::createWebMediaSession() +PassOwnPtr<WebMediaSession> EmptyFrameLoaderClient::createWebMediaSession() { return nullptr; } @@ -165,12 +163,12 @@ { } -std::unique_ptr<WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider() +PassOwnPtr<WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider() { return nullptr; } -std::unique_ptr<WebApplicationCacheHost> EmptyFrameLoaderClient::createApplicationCacheHost(WebApplicationCacheHostClient*) +PassOwnPtr<WebApplicationCacheHost> EmptyFrameLoaderClient::createApplicationCacheHost(WebApplicationCacheHostClient*) { return nullptr; }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h index 72b4525..97882afb 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.h +++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -48,7 +48,6 @@ #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebScreenInfo.h" #include "wtf/Forward.h" -#include <memory> #include <v8.h> /* @@ -177,7 +176,7 @@ void registerPopupOpeningObserver(PopupOpeningObserver*) override {} void unregisterPopupOpeningObserver(PopupOpeningObserver*) override {} - std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; + PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; }; class CORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient { @@ -252,8 +251,8 @@ LocalFrame* createFrame(const FrameLoadRequest&, const AtomicString&, HTMLFrameOwnerElement*) override; Widget* createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool, DetachedPluginPolicy) override; bool canCreatePluginWithoutRenderer(const String& mimeType) const override { return false; } - std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; - std::unique_ptr<WebMediaSession> createWebMediaSession() override; + PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; + PassOwnPtr<WebMediaSession> createWebMediaSession() override; ObjectContentType getObjectContentType(const KURL&, const String&, bool) override { return ObjectContentType(); } @@ -269,10 +268,10 @@ WebCookieJar* cookieJar() const override { return 0; } - std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() override; + PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() override; bool isControlledByServiceWorker(DocumentLoader&) override { return false; } int64_t serviceWorkerID(DocumentLoader&) override { return -1; } - std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; + PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; protected: EmptyFrameLoaderClient() {}
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 9166180..f09d2ece 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -73,8 +73,8 @@ #include "public/platform/WebDocumentSubresourceFilter.h" #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebInsecureRequestPolicy.h" + #include <algorithm> -#include <memory> namespace blink { @@ -397,11 +397,11 @@ return m_documentLoader == frame()->loader().documentLoader(); } -static std::unique_ptr<TracedValue> loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) +static PassOwnPtr<TracedValue> loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) { String requestId = IdentifiersFactory::requestId(identifier); - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("url", url.getString()); value->setInteger("priority", priority);
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.h b/third_party/WebKit/Source/core/loader/FrameFetchContext.h index e04fd81..3f7ed4b 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.h +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.h
@@ -37,6 +37,7 @@ #include "core/frame/csp/ContentSecurityPolicy.h" #include "platform/heap/Handle.h" #include "platform/network/ResourceRequest.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp index 8e8aa81b..e8ee435 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -48,7 +48,6 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -123,7 +122,7 @@ return childFetchContext; } - std::unique_ptr<DummyPageHolder> dummyPageHolder; + OwnPtr<DummyPageHolder> dummyPageHolder; // We don't use the DocumentLoader directly in any tests, but need to keep it around as long // as the ResourceFetcher and Document live due to indirect usage. Persistent<DocumentLoader> documentLoader;
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index 8be7514c..4f8c4d0a 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -99,7 +99,6 @@ #include "wtf/TemporaryChange.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> using blink::WebURLRequest; @@ -1598,9 +1597,9 @@ return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade(); } -std::unique_ptr<TracedValue> FrameLoader::toTracedValue() const +PassOwnPtr<TracedValue> FrameLoader::toTracedValue() const { - std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); + OwnPtr<TracedValue> tracedValue = TracedValue::create(); tracedValue->beginDictionary("frame"); tracedValue->setString("id_ref", String::format("0x%" PRIx64, static_cast<uint64_t>(reinterpret_cast<uintptr_t>(m_frame.get())))); tracedValue->endDictionary();
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.h b/third_party/WebKit/Source/core/loader/FrameLoader.h index 127d12b..7334fb6 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.h +++ b/third_party/WebKit/Source/core/loader/FrameLoader.h
@@ -49,7 +49,6 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/Forward.h" #include "wtf/HashSet.h" -#include <memory> namespace blink { @@ -222,12 +221,12 @@ void detachDocumentLoader(Member<DocumentLoader>&); - std::unique_ptr<TracedValue> toTracedValue() const; + PassOwnPtr<TracedValue> toTracedValue() const; void takeObjectSnapshot() const; Member<LocalFrame> m_frame; - // FIXME: These should be std::unique_ptr<T> to reduce build times and simplify + // FIXME: These should be OwnPtr<T> to reduce build times and simplify // header dependencies unless performance testing proves otherwise. // Some of these could be lazily created for memory savings on devices. mutable FrameLoaderStateMachine m_stateMachine;
diff --git a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h index d16e979..4135098 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h +++ b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h
@@ -48,7 +48,6 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "wtf/Forward.h" #include "wtf/Vector.h" -#include <memory> #include <v8.h> namespace blink { @@ -175,9 +174,9 @@ virtual bool canCreatePluginWithoutRenderer(const String& mimeType) const = 0; virtual Widget* createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually, DetachedPluginPolicy) = 0; - virtual std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) = 0; + virtual PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) = 0; - virtual std::unique_ptr<WebMediaSession> createWebMediaSession() = 0; + virtual PassOwnPtr<WebMediaSession> createWebMediaSession() = 0; virtual ObjectContentType getObjectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages) = 0; @@ -244,7 +243,7 @@ virtual void dispatchDidChangeResourcePriority(unsigned long identifier, ResourceLoadPriority, int intraPriorityValue) { } - virtual std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() = 0; + virtual PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() = 0; virtual bool isControlledByServiceWorker(DocumentLoader&) = 0; @@ -252,7 +251,7 @@ virtual SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() { return 0; } - virtual std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; + virtual PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; virtual void dispatchDidChangeManifest() { }
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp index 4f38a21..66d5f545 100644 --- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -51,7 +51,6 @@ #include "public/platform/WebCachePolicy.h" #include "public/platform/WebURLRequest.h" #include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -263,7 +262,7 @@ // m_pendingTask to null). m_pendingTask.clear(); // Make sure to only decrement the count when we exit this function - std::unique_ptr<IncrementLoadEventDelayCount> loadDelayCounter; + OwnPtr<IncrementLoadEventDelayCount> loadDelayCounter; loadDelayCounter.swap(m_loadDelayCounter); Document& document = m_element->document();
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.h b/third_party/WebKit/Source/core/loader/ImageLoader.h index 5ac085d..b7fa112 100644 --- a/third_party/WebKit/Source/core/loader/ImageLoader.h +++ b/third_party/WebKit/Source/core/loader/ImageLoader.h
@@ -31,7 +31,6 @@ #include "wtf/HashSet.h" #include "wtf/WeakPtr.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -159,7 +158,7 @@ Timer<ImageLoader> m_derefElementTimer; AtomicString m_failedLoadURL; WeakPtr<Task> m_pendingTask; // owned by Microtask - std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter; + OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; bool m_hasPendingLoadEvent : 1; bool m_hasPendingErrorEvent : 1; bool m_imageComplete : 1;
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.h b/third_party/WebKit/Source/core/loader/LinkLoader.h index a9f0b1dd..0e0004a 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoader.h +++ b/third_party/WebKit/Source/core/loader/LinkLoader.h
@@ -41,6 +41,7 @@ #include "platform/PrerenderClient.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp index 6a6913a..e43d2e1c 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -18,7 +18,6 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "testing/gtest/include/gtest/gtest.h" #include <base/macros.h> -#include <memory> namespace blink { @@ -136,7 +135,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); dummyPageHolder->frame().settings()->setScriptEnabled(true); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.linkLoaderShouldLoadValue); LinkLoader* loader = LinkLoader::create(loaderClient.get()); @@ -192,7 +191,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); dummyPageHolder->document().settings()->setDNSPrefetchingEnabled(true); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.shouldLoad); LinkLoader* loader = LinkLoader::create(loaderClient.get()); @@ -228,7 +227,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.shouldLoad); LinkLoader* loader = LinkLoader::create(loaderClient.get()); KURL hrefURL = KURL(KURL(ParsedURLStringTag(), String("http://example.com")), testCase.href);
diff --git a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp index 5d59282..f6b321589 100644 --- a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp +++ b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
@@ -14,7 +14,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/RefPtr.h" #include <base/macros.h> -#include <memory> namespace blink { @@ -49,7 +48,7 @@ TEST(MixedContentCheckerTest, ContextTypeForInspector) { - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1)); dummyPageHolder->frame().document()->setSecurityOrigin(SecurityOrigin::createFromString("http://example.test")); ResourceRequest notMixedContent("https://example.test/foo.jpg"); @@ -88,7 +87,7 @@ TEST(MixedContentCheckerTest, HandleCertificateError) { MockFrameLoaderClient* client = new MockFrameLoaderClient; - std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, client); + OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, client); KURL mainResourceUrl(KURL(), "https://example.test"); KURL displayedUrl(KURL(), "https://example-displayed.test");
diff --git a/third_party/WebKit/Source/core/loader/MockThreadableLoader.h b/third_party/WebKit/Source/core/loader/MockThreadableLoader.h index 4769196..dd05e484 100644 --- a/third_party/WebKit/Source/core/loader/MockThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/MockThreadableLoader.h
@@ -7,14 +7,13 @@ #include "core/loader/ThreadableLoader.h" #include "testing/gmock/include/gmock/gmock.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { class MockThreadableLoader : public ThreadableLoader { public: - static std::unique_ptr<MockThreadableLoader> create() { return wrapUnique(new testing::StrictMock<MockThreadableLoader>); } + static PassOwnPtr<MockThreadableLoader> create() { return adoptPtr(new testing::StrictMock<MockThreadableLoader>); } MOCK_METHOD1(start, void(const ResourceRequest&)); MOCK_METHOD1(overrideTimeout, void(unsigned long));
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index f687976..bbb1429 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -55,8 +55,6 @@ #include "public/platform/WebCachePolicy.h" #include "public/platform/WebScheduler.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -122,11 +120,11 @@ Document* originDocument() const { return m_originDocument.get(); } bool replacesCurrentItem() const { return m_replacesCurrentItem; } bool isLocationChange() const { return m_isLocationChange; } - std::unique_ptr<UserGestureIndicator> createUserGestureIndicator() + PassOwnPtr<UserGestureIndicator> createUserGestureIndicator() { if (m_wasUserGesture && m_userGestureToken) - return wrapUnique(new UserGestureIndicator(m_userGestureToken)); - return wrapUnique(new UserGestureIndicator(DefinitelyNotProcessingUserGesture)); + return adoptPtr(new UserGestureIndicator(m_userGestureToken)); + return adoptPtr(new UserGestureIndicator(DefinitelyNotProcessingUserGesture)); } DEFINE_INLINE_VIRTUAL_TRACE() @@ -159,7 +157,7 @@ void fire(LocalFrame* frame) override { - std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheckMainWorldContentSecurityPolicy); request.setReplacesCurrentItem(replacesCurrentItem()); request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); @@ -187,7 +185,7 @@ void fire(LocalFrame* frame) override { - std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest request(originDocument(), url(), "_self"); request.setReplacesCurrentItem(replacesCurrentItem()); if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.resourceRequest().url())) @@ -226,7 +224,7 @@ void fire(LocalFrame* frame) override { - std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); ResourceRequest resourceRequest = frame->loader().resourceRequestForReload(FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirect); if (resourceRequest.isNull()) return; @@ -252,7 +250,7 @@ void fire(LocalFrame* frame) override { - std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF-8", KURL(), ForceSynchronousLoad); FrameLoadRequest request(originDocument(), url(), substituteData); request.setReplacesCurrentItem(true); @@ -277,7 +275,7 @@ void fire(LocalFrame* frame) override { - std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest frameRequest = m_submission->createFrameLoadRequest(originDocument()); frameRequest.setReplacesCurrentItem(replacesCurrentItem()); maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledFormSubmission, frame, frameRequest, gestureIndicator.get());
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.h b/third_party/WebKit/Source/core/loader/NavigationScheduler.h index cc8f867..bdb9a25d 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.h +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.h
@@ -37,9 +37,10 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -85,7 +86,7 @@ static bool mustReplaceCurrentItem(LocalFrame* targetFrame); Member<LocalFrame> m_frame; - std::unique_ptr<CancellableTaskFactory> m_navigateTaskFactory; + OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; Member<ScheduledNavigation> m_redirect; WebScheduler::NavigatingFrameType m_frameType; // Exists because we can't deref m_frame in destructor. };
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp index 83ae268e..9a5050cb3 100644 --- a/third_party/WebKit/Source/core/loader/PingLoader.cpp +++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -54,7 +54,7 @@ #include "public/platform/WebURLLoader.h" #include "public/platform/WebURLRequest.h" #include "public/platform/WebURLResponse.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" namespace blink { @@ -141,7 +141,7 @@ frame->document()->fetcher()->context().willStartLoadingResource(m_identifier, request, Resource::Image); frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier, request, ResourceResponse(), initiatorInfo); - m_loader = wrapUnique(Platform::current()->createURLLoader()); + m_loader = adoptPtr(Platform::current()->createURLLoader()); ASSERT(m_loader); WrappedResourceRequest wrappedRequest(request); wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCredentials);
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.h b/third_party/WebKit/Source/core/loader/PingLoader.h index 58b1806..cd6ba0a 100644 --- a/third_party/WebKit/Source/core/loader/PingLoader.h +++ b/third_party/WebKit/Source/core/loader/PingLoader.h
@@ -41,7 +41,6 @@ #include "public/platform/WebURLLoaderClient.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -96,7 +95,7 @@ void didFailLoading(LocalFrame*); - std::unique_ptr<WebURLLoader> m_loader; + OwnPtr<WebURLLoader> m_loader; Timer<PingLoader> m_timeout; String m_url; unsigned long m_identifier;
diff --git a/third_party/WebKit/Source/core/loader/PrerenderHandle.h b/third_party/WebKit/Source/core/loader/PrerenderHandle.h index 432456d..7e432f8 100644 --- a/third_party/WebKit/Source/core/loader/PrerenderHandle.h +++ b/third_party/WebKit/Source/core/loader/PrerenderHandle.h
@@ -35,6 +35,7 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/ProgressTracker.cpp b/third_party/WebKit/Source/core/loader/ProgressTracker.cpp index da475fa..66c8517a 100644 --- a/third_party/WebKit/Source/core/loader/ProgressTracker.cpp +++ b/third_party/WebKit/Source/core/loader/ProgressTracker.cpp
@@ -36,7 +36,6 @@ #include "platform/Logging.h" #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" using namespace std; @@ -169,7 +168,7 @@ item->bytesReceived = 0; item->estimatedLength = estimatedLength; } else { - m_progressItems.set(identifier, wrapUnique(new ProgressItem(estimatedLength))); + m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLength))); } }
diff --git a/third_party/WebKit/Source/core/loader/ProgressTracker.h b/third_party/WebKit/Source/core/loader/ProgressTracker.h index a5198095..705badc 100644 --- a/third_party/WebKit/Source/core/loader/ProgressTracker.h +++ b/third_party/WebKit/Source/core/loader/ProgressTracker.h
@@ -32,7 +32,7 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -84,7 +84,7 @@ bool m_finalProgressChangedSent; double m_progressValue; - HashMap<unsigned long, std::unique_ptr<ProgressItem>> m_progressItems; + HashMap<unsigned long, OwnPtr<ProgressItem>> m_progressItems; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp index 86189fbc..655aa28 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
@@ -34,7 +34,6 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" #include "platform/weborigin/SecurityOrigin.h" -#include <memory> namespace blink { @@ -129,7 +128,7 @@ } -inline std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoderInstance(Document* document) +inline PassOwnPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoderInstance(Document* document) { const WTF::TextEncoding encodingFromDomain = getEncodingFromDomain(document->url()); if (LocalFrame* frame = document->frame()) { @@ -168,9 +167,9 @@ } } -std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* document) +PassOwnPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* document) { - std::unique_ptr<TextResourceDecoder> decoder = createDecoderInstance(document); + OwnPtr<TextResourceDecoder> decoder = createDecoderInstance(document); setupEncoding(decoder.get(), document); return decoder; }
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h index 37f32d5..ba9d1fc 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h
@@ -35,7 +35,6 @@ #include "wtf/Allocator.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -48,7 +47,7 @@ TextResourceDecoderBuilder(const AtomicString& mimeType, const AtomicString& encoding); ~TextResourceDecoderBuilder(); - std::unique_ptr<TextResourceDecoder> buildFor(Document*); + PassOwnPtr<TextResourceDecoder> buildFor(Document*); const AtomicString& mimeType() const { return m_mimeType; } const AtomicString& encoding() const { return m_encoding; } @@ -56,7 +55,7 @@ void clear(); private: - std::unique_ptr<TextResourceDecoder> createDecoderInstance(Document*); + PassOwnPtr<TextResourceDecoder> createDecoderInstance(Document*); void setupEncoding(TextResourceDecoder*, Document*); AtomicString m_mimeType;
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp index 611d4674..eaf7950b 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp
@@ -6,13 +6,12 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { static const WTF::TextEncoding defaultEncodingForURL(const char* url) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(0, 0)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(0, 0)); Document& document = pageHolder->document(); document.setURL(KURL(KURL(), url)); TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom);
diff --git a/third_party/WebKit/Source/core/loader/TextTrackLoader.h b/third_party/WebKit/Source/core/loader/TextTrackLoader.h index 6d7665c..3ec27cd2 100644 --- a/third_party/WebKit/Source/core/loader/TextTrackLoader.h +++ b/third_party/WebKit/Source/core/loader/TextTrackLoader.h
@@ -32,6 +32,7 @@ #include "platform/CrossOriginAttributeValue.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp index 16f78451..325030f 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp
@@ -37,11 +37,10 @@ #include "core/loader/WorkerThreadableLoader.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" -#include <memory> namespace blink { -std::unique_ptr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) +PassOwnPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { ASSERT(client);
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.h b/third_party/WebKit/Source/core/loader/ThreadableLoader.h index 3d2b2d2..fc360b1 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.h
@@ -36,7 +36,7 @@ #include "platform/CrossThreadCopier.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -166,8 +166,8 @@ // ThreadableLoaderClient methods: // - may call cancel() // - can destroy the ThreadableLoader instance in them (by clearing - // std::unique_ptr<ThreadableLoader>). - static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); + // OwnPtr<ThreadableLoader>). + static PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); // The methods on the ThreadableLoaderClient passed on create() call // may be called synchronous to start() call.
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h b/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h index a159447..2d641cdc 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h
@@ -35,7 +35,7 @@ #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -48,7 +48,7 @@ public: virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } - virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) { } + virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) { } virtual void didReceiveData(const char*, unsigned /*dataLength*/) { } virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) { } virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h b/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h index e70a1d6..4de6111 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h
@@ -35,11 +35,11 @@ #include "platform/network/ResourceResponse.h" #include "platform/network/ResourceTimingInfo.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Threading.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -83,7 +83,7 @@ m_client->didSendData(bytesSent, totalBytesToBeSent); } - void didReceiveResponse(unsigned long identifier, std::unique_ptr<CrossThreadResourceResponseData> responseData, std::unique_ptr<WebDataConsumerHandle> handle) + void didReceiveResponse(unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData, PassOwnPtr<WebDataConsumerHandle> handle) { ResourceResponse response(responseData.get()); @@ -91,7 +91,7 @@ m_client->didReceiveResponse(identifier, response, std::move(handle)); } - void didReceiveData(std::unique_ptr<Vector<char>> data) + void didReceiveData(PassOwnPtr<Vector<char>> data) { RELEASE_ASSERT(data->size() <= std::numeric_limits<unsigned>::max()); @@ -99,7 +99,7 @@ m_client->didReceiveData(data->data(), data->size()); } - void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data) + void didReceiveCachedMetadata(PassOwnPtr<Vector<char>> data) { if (m_client) m_client->didReceiveCachedMetadata(data->data(), data->size()); @@ -139,9 +139,9 @@ m_client->didDownloadData(dataLength); } - void didReceiveResourceTiming(std::unique_ptr<CrossThreadResourceTimingInfoData> timingData) + void didReceiveResourceTiming(PassOwnPtr<CrossThreadResourceTimingInfoData> timingData) { - std::unique_ptr<ResourceTimingInfo> info(ResourceTimingInfo::adopt(std::move(timingData))); + OwnPtr<ResourceTimingInfo> info(ResourceTimingInfo::adopt(std::move(timingData))); if (m_resourceTimingClient) m_resourceTimingClient->didReceiveResourceTiming(*info);
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp index 39e72b0f..b2a664b6 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
@@ -30,9 +30,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -47,13 +47,13 @@ class MockThreadableLoaderClient : public ThreadableLoaderClient { public: - static std::unique_ptr<MockThreadableLoaderClient> create() + static PassOwnPtr<MockThreadableLoaderClient> create() { - return wrapUnique(new ::testing::StrictMock<MockThreadableLoaderClient>); + return adoptPtr(new ::testing::StrictMock<MockThreadableLoaderClient>); } MOCK_METHOD2(didSendData, void(unsigned long long, unsigned long long)); MOCK_METHOD3(didReceiveResponseMock, void(unsigned long, const ResourceResponse&, WebDataConsumerHandle*)); - void didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) + void didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { didReceiveResponseMock(identifier, response, handle.get()); } @@ -146,9 +146,9 @@ private: Document& document() { return m_dummyPageHolder->document(); } - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Checkpoint m_checkpoint; - std::unique_ptr<DocumentThreadableLoader> m_loader; + OwnPtr<DocumentThreadableLoader> m_loader; }; class WorkerThreadableLoaderTestHelper : public ThreadableLoaderTestHelper, public WorkerLoaderProxyProvider { @@ -160,7 +160,7 @@ void createLoader(ThreadableLoaderClient* client, CrossOriginRequestPolicy crossOriginRequestPolicy) override { - std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerCreateLoader, AllowCrossThreadAccess(this), @@ -172,7 +172,7 @@ void startLoader(const ResourceRequest& request) override { - std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerStartLoader, AllowCrossThreadAccess(this), @@ -206,7 +206,7 @@ { testing::runPendingTasks(); - std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerCallCheckpoint, AllowCrossThreadAccess(this), @@ -217,9 +217,9 @@ void onSetUp() override { - m_mockWorkerReportingProxy = wrapUnique(new MockWorkerReportingProxy()); + m_mockWorkerReportingProxy = adoptPtr(new MockWorkerReportingProxy()); m_securityOrigin = document().getSecurityOrigin(); - m_workerThread = wrapUnique(new WorkerThreadForTest( + m_workerThread = adoptPtr(new WorkerThreadForTest( this, *m_mockWorkerReportingProxy)); @@ -276,7 +276,7 @@ event->signal(); } - void workerStartLoader(WaitableEvent* event, std::unique_ptr<CrossThreadResourceRequestData> requestData) + void workerStartLoader(WaitableEvent* event, PassOwnPtr<CrossThreadResourceRequestData> requestData) { ASSERT(m_workerThread); ASSERT(m_workerThread->isCurrentThread()); @@ -310,13 +310,13 @@ } RefPtr<SecurityOrigin> m_securityOrigin; - std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; - std::unique_ptr<WorkerThreadForTest> m_workerThread; + OwnPtr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; + OwnPtr<WorkerThreadForTest> m_workerThread; - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Checkpoint m_checkpoint; // |m_loader| must be touched only from the worker thread only. - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; }; class ThreadableLoaderTest : public ::testing::TestWithParam<ThreadableLoaderToTest> { @@ -325,10 +325,10 @@ { switch (GetParam()) { case DocumentThreadableLoaderTest: - m_helper = wrapUnique(new DocumentThreadableLoaderTestHelper); + m_helper = adoptPtr(new DocumentThreadableLoaderTestHelper); break; case WorkerThreadableLoaderTest: - m_helper = wrapUnique(new WorkerThreadableLoaderTestHelper); + m_helper = adoptPtr(new WorkerThreadableLoaderTestHelper); break; } } @@ -424,8 +424,8 @@ URLTestHelpers::registerMockedURLLoadWithCustomResponse(url, "fox-null-terminated.html", "", response); } - std::unique_ptr<MockThreadableLoaderClient> m_client; - std::unique_ptr<ThreadableLoaderTestHelper> m_helper; + OwnPtr<MockThreadableLoaderClient> m_client; + OwnPtr<ThreadableLoaderTestHelper> m_helper; }; INSTANTIATE_TEST_CASE_P(Document,
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp index e90b4c5..796d3fe 100644 --- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
@@ -46,15 +46,14 @@ #include "platform/network/ResourceTimingInfo.h" #include "platform/weborigin/SecurityPolicy.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { -static std::unique_ptr<Vector<char>> createVectorFromMemoryRegion(const char* data, unsigned dataLength) +static PassOwnPtr<Vector<char>> createVectorFromMemoryRegion(const char* data, unsigned dataLength) { - std::unique_ptr<Vector<char>> buffer = wrapUnique(new Vector<char>(dataLength)); + OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(dataLength)); memcpy(buffer->data(), data, dataLength); return buffer; } @@ -73,7 +72,7 @@ void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& workerGlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - std::unique_ptr<WorkerThreadableLoader> loader = wrapUnique(new WorkerThreadableLoader(workerGlobalScope, &client, options, resourceLoaderOptions, LoadSynchronously)); + OwnPtr<WorkerThreadableLoader> loader = adoptPtr(new WorkerThreadableLoader(workerGlobalScope, &client, options, resourceLoaderOptions, LoadSynchronously)); loader->start(request); } @@ -134,7 +133,7 @@ ASSERT(m_mainThreadLoader); } -void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadStart(std::unique_ptr<CrossThreadResourceRequestData> requestData) +void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData> requestData) { ASSERT(isMainThread()); ASSERT(m_mainThreadLoader); @@ -217,7 +216,7 @@ forwardTaskToWorker(createCrossThreadTask(&ThreadableLoaderClientWrapper::didSendData, m_workerClientWrapper, bytesSent, totalBytesToBeSent)); } -void WorkerThreadableLoader::MainThreadBridgeBase::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void WorkerThreadableLoader::MainThreadBridgeBase::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { forwardTaskToWorker(createCrossThreadTask(&ThreadableLoaderClientWrapper::didReceiveResponse, m_workerClientWrapper, identifier, response, passed(std::move(handle)))); } @@ -305,7 +304,7 @@ void WorkerThreadableLoader::MainThreadSyncBridge::start(const ResourceRequest& request, const WorkerGlobalScope& workerGlobalScope) { WaitableEvent* terminationEvent = workerGlobalScope.thread()->terminationEvent(); - m_loaderDoneEvent = wrapUnique(new WaitableEvent()); + m_loaderDoneEvent = adoptPtr(new WaitableEvent()); startInMainThread(request, workerGlobalScope);
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h index d841549..e30a4bd 100644 --- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
@@ -37,14 +37,14 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/Referrer.h" #include "wtf/Functional.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -61,9 +61,9 @@ USING_FAST_MALLOC(WorkerThreadableLoader); public: static void loadResourceSynchronously(WorkerGlobalScope&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); - static std::unique_ptr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) + static PassOwnPtr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - return wrapUnique(new WorkerThreadableLoader(workerGlobalScope, client, options, resourceLoaderOptions, LoadAsynchronously)); + return adoptPtr(new WorkerThreadableLoader(workerGlobalScope, client, options, resourceLoaderOptions, LoadAsynchronously)); } ~WorkerThreadableLoader() override; @@ -110,7 +110,7 @@ // All executed on the main thread. void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) final; - void didReceiveResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) final; + void didReceiveResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final; void didReceiveData(const char*, unsigned dataLength) final; void didDownloadData(int dataLength) final; void didReceiveCachedMetadata(const char*, int dataLength) final; @@ -142,13 +142,13 @@ // All executed on the main thread. void mainThreadCreateLoader(ThreadableLoaderOptions, ResourceLoaderOptions, ExecutionContext*); - void mainThreadStart(std::unique_ptr<CrossThreadResourceRequestData>); + void mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData>); void mainThreadDestroy(ExecutionContext*); void mainThreadOverrideTimeout(unsigned long timeoutMilliseconds, ExecutionContext*); void mainThreadCancel(ExecutionContext*); // Only to be used on the main thread. - std::unique_ptr<ThreadableLoader> m_mainThreadLoader; + OwnPtr<ThreadableLoader> m_mainThreadLoader; // ThreadableLoaderClientWrapper is to be used on the worker context thread. // The ref counting is done on either thread: @@ -185,7 +185,7 @@ void forwardTaskToWorkerOnLoaderDone(std::unique_ptr<ExecutionContextTask>) override; bool m_done; - std::unique_ptr<WaitableEvent> m_loaderDoneEvent; + OwnPtr<WaitableEvent> m_loaderDoneEvent; // Thread-safety: |m_clientTasks| can be written (i.e. Closures are added) // on the main thread only before |m_loaderDoneEvent| is signaled and can be read // on the worker context thread only after |m_loaderDoneEvent| is signaled.
diff --git a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h index ad1267b..524e86ee 100644 --- a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h +++ b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h
@@ -35,8 +35,8 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebApplicationCacheHostClient.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { class ApplicationCache; @@ -175,7 +175,7 @@ void dispatchDOMEvent(EventID, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason, const String& errorURL, int errorStatus, const String& errorMessage); - std::unique_ptr<WebApplicationCacheHost> m_host; + OwnPtr<WebApplicationCacheHost> m_host; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index ddd9976..b10144a 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -9,7 +9,6 @@ #include "core/html/canvas/CanvasRenderingContext.h" #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "wtf/MathExtras.h" -#include <memory> namespace blink { @@ -96,7 +95,7 @@ return renderingContextFactories()[type].get(); } -void OffscreenCanvas::registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory> renderingContextFactory) +void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory> renderingContextFactory) { CanvasRenderingContext::ContextType type = renderingContextFactory->getContextType(); ASSERT(type < CanvasRenderingContext::ContextTypeCount);
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h index 7025234c..f6e592a7 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
@@ -11,7 +11,6 @@ #include "core/html/HTMLCanvasElement.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -42,7 +41,7 @@ CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String&, const CanvasContextCreationAttributes&); CanvasRenderingContext* renderingContext() { return m_context; } - static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory>); + static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory>); bool originClean() const; void setOriginTainted() { m_originClean = false; } @@ -52,7 +51,7 @@ private: explicit OffscreenCanvas(const IntSize&); - using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFactory>>; + using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; static ContextFactoryVector& renderingContextFactories(); static CanvasRenderingContextFactory* getRenderingContextFactory(int);
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp index 5d37016..6029493 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp
@@ -18,9 +18,7 @@ #include "public/platform/WebOriginTrialTokenStatus.h" #include "public/platform/WebTrialTokenValidator.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" -#include <memory> namespace blink { namespace { @@ -81,7 +79,7 @@ OriginTrialContextTest() : m_frameworkWasEnabled(RuntimeEnabledFeatures::originTrialsEnabled()) , m_executionContext(new NullExecutionContext()) - , m_tokenValidator(wrapUnique(new MockTokenValidator())) + , m_tokenValidator(adoptPtr(new MockTokenValidator())) , m_originTrialContext(new OriginTrialContext(m_executionContext.get(), m_tokenValidator.get())) , m_histogramTester(new HistogramTester()) { @@ -141,7 +139,7 @@ private: const bool m_frameworkWasEnabled; Persistent<NullExecutionContext> m_executionContext; - std::unique_ptr<MockTokenValidator> m_tokenValidator; + OwnPtr<MockTokenValidator> m_tokenValidator; Persistent<OriginTrialContext> m_originTrialContext; std::unique_ptr<HistogramTester> m_histogramTester; };
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.h b/third_party/WebKit/Source/core/page/AutoscrollController.h index 3c19a2ee..794a460 100644 --- a/third_party/WebKit/Source/core/page/AutoscrollController.h +++ b/third_party/WebKit/Source/core/page/AutoscrollController.h
@@ -29,6 +29,7 @@ #include "core/CoreExport.h" #include "platform/geometry/IntPoint.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h index 6f55c92a..7d5752ce 100644 --- a/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/third_party/WebKit/Source/core/page/ChromeClient.h
@@ -39,8 +39,8 @@ #include "public/platform/WebEventListenerProperties.h" #include "public/platform/WebFocusType.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -279,7 +279,7 @@ // that this is comprehensive. virtual void didObserveNonGetFetchFromScript() const {} - virtual std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) = 0; + virtual PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) = 0; // Returns the time of the beginning of the last beginFrame, in seconds, if any, and 0.0 otherwise. virtual double lastFrameTimeMonotonic() const { return 0.0; }
diff --git a/third_party/WebKit/Source/core/page/ContextMenuController.cpp b/third_party/WebKit/Source/core/page/ContextMenuController.cpp index 97f5b89..d388d1e 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuController.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuController.cpp
@@ -39,8 +39,6 @@ #include "core/page/CustomContextMenuProvider.h" #include "platform/ContextMenu.h" #include "platform/ContextMenuItem.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -146,7 +144,7 @@ showContextMenu(nullptr); } -std::unique_ptr<ContextMenu> ContextMenuController::createContextMenu(Event* event) +PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event) { ASSERT(event); @@ -157,7 +155,7 @@ return createContextMenu(event->target()->toNode()->document().frame(), mouseEvent->absoluteLocation()); } -std::unique_ptr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* frame, const LayoutPoint& location) +PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* frame, const LayoutPoint& location) { HitTestRequest::HitTestRequestType type = HitTestRequest::ReadOnly | HitTestRequest::Active; HitTestResult result(type, location); @@ -170,7 +168,7 @@ m_hitTestResult = result; - return wrapUnique(new ContextMenu); + return adoptPtr(new ContextMenu); } void ContextMenuController::showContextMenu(Event* event)
diff --git a/third_party/WebKit/Source/core/page/ContextMenuController.h b/third_party/WebKit/Source/core/page/ContextMenuController.h index 3f62e0a..fadbade 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuController.h +++ b/third_party/WebKit/Source/core/page/ContextMenuController.h
@@ -30,9 +30,9 @@ #include "core/layout/HitTestResult.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -68,13 +68,13 @@ private: ContextMenuController(Page*, ContextMenuClient*); - std::unique_ptr<ContextMenu> createContextMenu(Event*); - std::unique_ptr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint&); + PassOwnPtr<ContextMenu> createContextMenu(Event*); + PassOwnPtr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint&); void populateCustomContextMenu(const Event&); void showContextMenu(Event*); ContextMenuClient* m_client; - std::unique_ptr<ContextMenu> m_contextMenu; + OwnPtr<ContextMenu> m_contextMenu; Member<ContextMenuProvider> m_menuProvider; HitTestResult m_hitTestResult; };
diff --git a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp index 752ed69..f6270fd0 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
@@ -12,7 +12,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/ContextMenu.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -32,7 +32,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; TEST_F(ContextMenuControllerTest, TestCustomMenu)
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp index c6cae63..04f89281 100644 --- a/third_party/WebKit/Source/core/page/DragController.cpp +++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -83,8 +83,9 @@ #include "public/platform/WebScreenInfo.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> #if OS(WIN) #include <windows.h> @@ -800,9 +801,9 @@ return maxSizeInPixels; } -static std::unique_ptr<DragImage> dragImageForImage(Element* element, Image* image, float deviceScaleFactor, const IntPoint& dragOrigin, const IntPoint& imageElementLocation, const IntSize& imageElementSizeInPixels, IntPoint& dragLocation) +static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, float deviceScaleFactor, const IntPoint& dragOrigin, const IntPoint& imageElementLocation, const IntSize& imageElementSizeInPixels, IntPoint& dragLocation) { - std::unique_ptr<DragImage> dragImage; + OwnPtr<DragImage> dragImage; IntPoint origin; InterpolationQuality interpolationQuality = element->ensureComputedStyle()->imageRendering() == ImageRenderingPixelated ? InterpolationNone : InterpolationHigh; @@ -838,11 +839,11 @@ return dragImage; } -static std::unique_ptr<DragImage> dragImageForLink(const KURL& linkURL, const String& linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint& dragLoc) +static PassOwnPtr<DragImage> dragImageForLink(const KURL& linkURL, const String& linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint& dragLoc) { FontDescription fontDescription; LayoutTheme::theme().systemFont(blink::CSSValueNone, fontDescription); - std::unique_ptr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescription, deviceScaleFactor); + OwnPtr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescription, deviceScaleFactor); IntSize size = dragImage ? dragImage->size() : IntSize(); IntPoint dragImageOffset(-size.width() / 2, -LinkDragBorderInset); @@ -876,7 +877,7 @@ DataTransfer* dataTransfer = state.m_dragDataTransfer.get(); // We allow DHTML/JS to set the drag image, even if its a link, image or text we're dragging. // This is in the spirit of the IE API, which allows overriding of pasteboard data and DragOp. - std::unique_ptr<DragImage> dragImage = dataTransfer->createDragImage(dragOffset, src); + OwnPtr<DragImage> dragImage = dataTransfer->createDragImage(dragOffset, src); if (dragImage) { dragLocation = dragLocationForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragOffset, !linkURL.isEmpty()); }
diff --git a/third_party/WebKit/Source/core/page/EventSource.cpp b/third_party/WebKit/Source/core/page/EventSource.cpp index 77c3b18..dfa1f82 100644 --- a/third_party/WebKit/Source/core/page/EventSource.cpp +++ b/third_party/WebKit/Source/core/page/EventSource.cpp
@@ -55,7 +55,6 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebURLRequest.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -222,7 +221,7 @@ return ActiveDOMObject::getExecutionContext(); } -void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); ASSERT(m_state == CONNECTING);
diff --git a/third_party/WebKit/Source/core/page/EventSource.h b/third_party/WebKit/Source/core/page/EventSource.h index e44530e43..c49ac87 100644 --- a/third_party/WebKit/Source/core/page/EventSource.h +++ b/third_party/WebKit/Source/core/page/EventSource.h
@@ -42,7 +42,7 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -95,7 +95,7 @@ private: EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); - void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didReceiveData(const char*, unsigned) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; @@ -122,7 +122,7 @@ State m_state; Member<EventSourceParser> m_parser; - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; Timer<EventSource> m_connectTimer; unsigned long long m_reconnectDelay;
diff --git a/third_party/WebKit/Source/core/page/EventSourceParser.h b/third_party/WebKit/Source/core/page/EventSourceParser.h index ffe8145..7629b68 100644 --- a/third_party/WebKit/Source/core/page/EventSourceParser.h +++ b/third_party/WebKit/Source/core/page/EventSourceParser.h
@@ -7,11 +7,11 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/TextCodec.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -49,7 +49,7 @@ AtomicString m_lastEventId; Member<Client> m_client; - std::unique_ptr<TextCodec> m_codec; + OwnPtr<TextCodec> m_codec; bool m_isRecognizingCRLF = false; bool m_isRecognizingBOM = true;
diff --git a/third_party/WebKit/Source/core/page/FocusControllerTest.cpp b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp index a36f5a91..9dd4120 100644 --- a/third_party/WebKit/Source/core/page/FocusControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp
@@ -8,7 +8,6 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ private: void SetUp() override { m_pageHolder = DummyPageHolder::create(); } - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; TEST_F(FocusControllerTest, SetInitialFocus)
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp index e6658bd..26fe7a4 100644 --- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp +++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
@@ -30,7 +30,6 @@ #include "core/page/Page.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" @@ -74,7 +73,7 @@ MutexLocker locker(m_mutex); ObserverListMap::AddResult result = m_observers.add(context, nullptr); if (result.isNewEntry) - result.storedValue->value = wrapUnique(new ObserverList); + result.storedValue->value = adoptPtr(new ObserverList); ASSERT(result.storedValue->value->observers.find(observer) == kNotFound); result.storedValue->value->observers.append(observer);
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.h b/third_party/WebKit/Source/core/page/NetworkStateNotifier.h index f2534832..955284c0e 100644 --- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.h +++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.h
@@ -34,7 +34,6 @@ #include "wtf/Noncopyable.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -143,7 +142,7 @@ // The ObserverListMap is cross-thread accessed, adding/removing Observers running // within an ExecutionContext. Kept off-heap to ease cross-thread allocation and use; // the observers are (already) responsible for explicitly unregistering while finalizing. - using ObserverListMap = HashMap<UntracedMember<ExecutionContext>, std::unique_ptr<ObserverList>>; + using ObserverListMap = HashMap<UntracedMember<ExecutionContext>, OwnPtr<ObserverList>>; void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double maxBandwidthMbps, ExecutionContext*);
diff --git a/third_party/WebKit/Source/core/page/PrintContextTest.cpp b/third_party/WebKit/Source/core/page/PrintContextTest.cpp index 8ecda1ee..922a629 100644 --- a/third_party/WebKit/Source/core/page/PrintContextTest.cpp +++ b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
@@ -19,7 +19,6 @@ #include "platform/text/TextStream.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" -#include <memory> namespace blink { @@ -129,7 +128,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; Persistent<MockPrintContext> m_printContext; };
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp index d08fd308..e8caada 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
@@ -7,8 +7,6 @@ #include "core/dom/DOMNodeIds.h" #include "core/dom/Element.h" #include "core/dom/ExceptionCode.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -28,7 +26,7 @@ ScrollState* ScrollState::create(ScrollStateInit init) { - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->delta_x = init.deltaX(); scrollStateData->delta_y = init.deltaY(); scrollStateData->position_x = init.positionX(); @@ -46,13 +44,13 @@ return scrollState; } -ScrollState* ScrollState::create(std::unique_ptr<ScrollStateData> data) +ScrollState* ScrollState::create(PassOwnPtr<ScrollStateData> data) { ScrollState* scrollState = new ScrollState(std::move(data)); return scrollState; } -ScrollState::ScrollState(std::unique_ptr<ScrollStateData> data) +ScrollState::ScrollState(PassOwnPtr<ScrollStateData> data) : m_data(std::move(data)) { }
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h index 65f164d..050ee6b 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
@@ -12,7 +12,6 @@ #include "platform/scroll/ScrollStateData.h" #include "wtf/Forward.h" #include <deque> -#include <memory> namespace blink { @@ -23,7 +22,7 @@ public: static ScrollState* create(ScrollStateInit); - static ScrollState* create(std::unique_ptr<ScrollStateData>); + static ScrollState* create(PassOwnPtr<ScrollStateData>); ~ScrollState() { @@ -93,9 +92,9 @@ private: ScrollState(); - explicit ScrollState(std::unique_ptr<ScrollStateData>); + explicit ScrollState(PassOwnPtr<ScrollStateData>); - std::unique_ptr<ScrollStateData> m_data; + OwnPtr<ScrollStateData> m_data; std::deque<int> m_scrollChain; };
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp index 5b84165..e79dce5 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
@@ -7,8 +7,6 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -16,7 +14,7 @@ ScrollState* CreateScrollState(double deltaX, double deltaY, bool beginning, bool ending) { - std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); scrollStateData->delta_x = deltaX; scrollStateData->delta_y = deltaY; scrollStateData->is_beginning = beginning;
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index ee69398..88221d0a 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -63,9 +63,7 @@ #include "public/platform/WebScrollbarLayer.h" #include "public/platform/WebScrollbarThemeGeometry.h" #include "public/platform/WebScrollbarThemePainter.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" -#include <memory> using blink::WebLayer; using blink::WebLayerPositionConstraint; @@ -275,25 +273,25 @@ void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation) { ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontalScrollbars : m_verticalScrollbars; - if (std::unique_ptr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableArea)) + if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableArea)) GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); } -static std::unique_ptr<WebScrollbarLayer> createScrollbarLayer(Scrollbar& scrollbar, float deviceScaleFactor) +static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar& scrollbar, float deviceScaleFactor) { ScrollbarTheme& theme = scrollbar.theme(); WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); - std::unique_ptr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::create(theme)); + OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::create(theme)); - std::unique_ptr<WebScrollbarLayer> scrollbarLayer = wrapUnique(Platform::current()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(&scrollbar), painter, geometry.release())); + OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(&scrollbar), painter, geometry.leakPtr())); GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); return scrollbarLayer; } -std::unique_ptr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar) +PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar) { WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollbar) ? WebScrollbar::Horizontal : WebScrollbar::Vertical; - std::unique_ptr<WebScrollbarLayer> scrollbarLayer = wrapUnique(Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, trackStart, isLeftSideVerticalScrollbar)); + OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, trackStart, isLeftSideVerticalScrollbar)); GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); return scrollbarLayer; } @@ -320,7 +318,7 @@ scrollbarGraphicsLayer->setDrawsContent(false); } -WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, std::unique_ptr<WebScrollbarLayer> scrollbarLayer) +WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, PassOwnPtr<WebScrollbarLayer> scrollbarLayer) { ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontalScrollbars : m_verticalScrollbars; return scrollbars.add(scrollableArea, std::move(scrollbarLayer)).storedValue->value.get(); @@ -350,7 +348,7 @@ if (!scrollbarLayer) { Settings* settings = m_page->mainFrame()->settings(); - std::unique_ptr<WebScrollbarLayer> webScrollbarLayer; + OwnPtr<WebScrollbarLayer> webScrollbarLayer; if (settings->useSolidColorScrollbars()) { ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); webScrollbarLayer = createSolidColorScrollbarLayer(orientation, scrollbar.theme().thumbThickness(scrollbar), scrollbar.theme().trackPosition(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft());
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h index f9d5dd4a42..f503f8f7 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -34,7 +34,6 @@ #include "platform/scroll/ScrollTypes.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { class WebScrollbarLayer; @@ -96,7 +95,7 @@ MainThreadScrollingReasons mainThreadScrollingReasons() const; bool shouldUpdateScrollLayerPositionOnMainThread() const { return mainThreadScrollingReasons() != 0; } - std::unique_ptr<WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar); + PassOwnPtr<WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar); void willDestroyScrollableArea(ScrollableArea*); // Returns true if the coordinator handled this change. @@ -147,15 +146,15 @@ void setTouchEventTargetRects(LayerHitTestRects&); void computeTouchEventTargetRects(LayerHitTestRects&); - WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation, std::unique_ptr<WebScrollbarLayer>); + WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation, PassOwnPtr<WebScrollbarLayer>); WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); bool frameViewIsDirty() const; - std::unique_ptr<CompositorAnimationTimeline> m_programmaticScrollAnimatorTimeline; + OwnPtr<CompositorAnimationTimeline> m_programmaticScrollAnimatorTimeline; - using ScrollbarMap = HeapHashMap<Member<ScrollableArea>, std::unique_ptr<WebScrollbarLayer>>; + using ScrollbarMap = HeapHashMap<Member<ScrollableArea>, OwnPtr<WebScrollbarLayer>>; ScrollbarMap m_horizontalScrollbars; ScrollbarMap m_verticalScrollbars; HashSet<const PaintLayer*> m_layersWithTouchRects;
diff --git a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp index 1b854d9..bcebdc8 100644 --- a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp
@@ -10,8 +10,8 @@ #include "core/style/ComputedStyle.h" #include "core/testing/DummyPageHolder.h" #include "platform/scroll/ScrollTypes.h" + #include <gtest/gtest.h> -#include <memory> namespace blink { @@ -82,7 +82,7 @@ return coordinator().snapOffsets(node, orientation); } - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; INSTANTIATE_TEST_CASE_P(All, SnapCoordinatorTest, ::testing::Values(
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.cpp b/third_party/WebKit/Source/core/paint/FilterPainter.cpp index bccab959..41b9732 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
@@ -17,8 +17,6 @@ #include "platform/graphics/paint/PaintController.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -56,13 +54,13 @@ paintingInfo.clipToDirtyRect = false; if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) { - m_clipRecorder = wrapUnique(new LayerClipRecorder(context, *layer.layoutObject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags)); + m_clipRecorder = adoptPtr(new LayerClipRecorder(context, *layer.layoutObject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags)); } ASSERT(m_layoutObject); if (!context.getPaintController().displayItemConstructionIsDisabled()) { FilterOperations filterOperations(layer.computeFilterOperations(m_layoutObject->styleRef())); - std::unique_ptr<CompositorFilterOperations> compositorFilterOperations = CompositorFilterOperations::create(); + OwnPtr<CompositorFilterOperations> compositorFilterOperations = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filterOperations, compositorFilterOperations.get()); // FIXME: It's possible to have empty CompositorFilterOperations here even // though the SkImageFilter produced above is non-null, since the
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.h b/third_party/WebKit/Source/core/paint/FilterPainter.h index 966827a8..c178b70 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.h +++ b/third_party/WebKit/Source/core/paint/FilterPainter.h
@@ -7,7 +7,7 @@ #include "core/paint/PaintLayerPaintingInfo.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -25,7 +25,7 @@ private: bool m_filterInProgress; GraphicsContext& m_context; - std::unique_ptr<LayerClipRecorder> m_clipRecorder; + OwnPtr<LayerClipRecorder> m_clipRecorder; LayoutObject* m_layoutObject; };
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h index 3ebd68e..525c5aa 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h +++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -10,10 +10,9 @@ #include "platform/graphics/paint/EffectPaintPropertyNode.h" #include "platform/graphics/paint/PaintChunkProperties.h" #include "platform/graphics/paint/TransformPaintPropertyNode.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -28,9 +27,9 @@ public: struct LocalBorderBoxProperties; - static std::unique_ptr<ObjectPaintProperties> create() + static PassOwnPtr<ObjectPaintProperties> create() { - return wrapUnique(new ObjectPaintProperties()); + return adoptPtr(new ObjectPaintProperties()); } // The hierarchy of transform subtree created by a LayoutObject. @@ -97,7 +96,7 @@ m_scrollTranslation = translation; } void setScrollbarPaintOffset(PassRefPtr<TransformPaintPropertyNode> paintOffset) { m_scrollbarPaintOffset = paintOffset; } - void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> properties) { m_localBorderBoxProperties = std::move(properties); } + void setLocalBorderBoxProperties(PassOwnPtr<LocalBorderBoxProperties> properties) { m_localBorderBoxProperties = std::move(properties); } RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; RefPtr<TransformPaintPropertyNode> m_transform; @@ -111,7 +110,7 @@ RefPtr<TransformPaintPropertyNode> m_scrollTranslation; RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; - std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; + OwnPtr<LocalBorderBoxProperties> m_localBorderBoxProperties; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp index 781b3a3f..b6aad442 100644 --- a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
@@ -6,7 +6,6 @@ #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -17,7 +16,7 @@ , m_context(*m_paintController) { } - std::unique_ptr<PaintController> m_paintController; + OwnPtr<PaintController> m_paintController; GraphicsContext m_context; };
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index 37f7d4a..0292065 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -83,7 +83,6 @@ #include "platform/transforms/TransformationMatrix.h" #include "platform/transforms/TranslateTransformOperation.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CString.h" @@ -983,7 +982,7 @@ if (rareCompositingInputs.isDefault()) m_rareAncestorDependentCompositingInputs.reset(); else - m_rareAncestorDependentCompositingInputs = wrapUnique(new RareAncestorDependentCompositingInputs(rareCompositingInputs)); + m_rareAncestorDependentCompositingInputs = adoptPtr(new RareAncestorDependentCompositingInputs(rareCompositingInputs)); m_hasAncestorWithClipPath = hasAncestorWithClipPath; m_needsAncestorDependentCompositingInputsUpdate = false; } @@ -1452,7 +1451,7 @@ ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle)); if (layoutObject()->hasReflection()) { if (!ensureRareData().reflectionInfo) - m_rareData->reflectionInfo = wrapUnique(new PaintLayerReflectionInfo(*layoutBox())); + m_rareData->reflectionInfo = adoptPtr(new PaintLayerReflectionInfo(*layoutBox())); m_rareData->reflectionInfo->updateAfterStyleChange(oldStyle); } else if (m_rareData && m_rareData->reflectionInfo) { m_rareData->reflectionInfo = nullptr; @@ -1463,7 +1462,7 @@ { ASSERT(!m_stackingNode); if (requiresStackingNode()) - m_stackingNode = wrapUnique(new PaintLayerStackingNode(this)); + m_stackingNode = adoptPtr(new PaintLayerStackingNode(this)); else m_stackingNode = nullptr; } @@ -2334,7 +2333,7 @@ if (m_rareData && m_rareData->compositedLayerMapping) return; - ensureRareData().compositedLayerMapping = wrapUnique(new CompositedLayerMapping(*this)); + ensureRareData().compositedLayerMapping = adoptPtr(new CompositedLayerMapping(*this)); m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); updateOrRemoveFilterEffectBuilder();
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h index 7511da5..90968fcb 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.h +++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -60,8 +60,7 @@ #include "platform/graphics/SquashingDisallowedReasons.h" #include "public/platform/WebBlendMode.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -100,7 +99,7 @@ // Our current relative position offset. LayoutSize offsetForInFlowPosition; - std::unique_ptr<TransformationMatrix> transform; + OwnPtr<TransformationMatrix> transform; // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if we are not paginated. // @@ -125,14 +124,14 @@ // If the layer paints into its own backings, this keeps track of the backings. // It's nullptr if the layer is not composited or paints into grouped backing. - std::unique_ptr<CompositedLayerMapping> compositedLayerMapping; + OwnPtr<CompositedLayerMapping> compositedLayerMapping; // If the layer paints into grouped backing (i.e. squashed), this points to the // grouped CompositedLayerMapping. It's null if the layer is not composited or // paints into its own backing. CompositedLayerMapping* groupedMapping; - std::unique_ptr<PaintLayerReflectionInfo> reflectionInfo; + OwnPtr<PaintLayerReflectionInfo> reflectionInfo; Persistent<PaintLayerFilterInfo> filterInfo; @@ -696,7 +695,7 @@ ClipRectsCache& ensureClipRectsCache() const { if (!m_clipRectsCache) - m_clipRectsCache = wrapUnique(new ClipRectsCache); + m_clipRectsCache = adoptPtr(new ClipRectsCache); return *m_clipRectsCache; } void clearClipRectsCache() const { m_clipRectsCache.reset(); } @@ -783,7 +782,7 @@ PaintLayerRareData& ensureRareData() { if (!m_rareData) - m_rareData = wrapUnique(new PaintLayerRareData); + m_rareData = adoptPtr(new PaintLayerRareData); return *m_rareData; } @@ -883,19 +882,19 @@ const PaintLayer* m_ancestorOverflowLayer; AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; - std::unique_ptr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompositingInputs; + OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompositingInputs; Persistent<PaintLayerScrollableArea> m_scrollableArea; - mutable std::unique_ptr<ClipRectsCache> m_clipRectsCache; + mutable OwnPtr<ClipRectsCache> m_clipRectsCache; - std::unique_ptr<PaintLayerStackingNode> m_stackingNode; + OwnPtr<PaintLayerStackingNode> m_stackingNode; IntSize m_previousScrollOffsetAccumulationForPainting; RefPtr<ClipRects> m_previousPaintingClipRects; LayoutRect m_previousPaintDirtyRect; - std::unique_ptr<PaintLayerRareData> m_rareData; + OwnPtr<PaintLayerRareData> m_rareData; DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION };
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h index 59776ed..a0d4db07 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -50,8 +50,6 @@ #include "core/paint/PaintInvalidationCapableScrollableArea.h" #include "core/paint/PaintLayerFragment.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -459,7 +457,7 @@ PaintLayerScrollableAreaRareData& ensureRareData() { if (!m_rareData) - m_rareData = wrapUnique(new PaintLayerScrollableAreaRareData()); + m_rareData = adoptPtr(new PaintLayerScrollableAreaRareData()); return *m_rareData.get(); } @@ -511,7 +509,7 @@ ScrollAnchor m_scrollAnchor; - std::unique_ptr<PaintLayerScrollableAreaRareData> m_rareData; + OwnPtr<PaintLayerScrollableAreaRareData> m_rareData; #if ENABLE(ASSERT) bool m_hasBeenDisposed;
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp index 747674a..8489a69 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp
@@ -48,9 +48,7 @@ #include "core/layout/compositing/PaintLayerCompositor.h" #include "core/paint/PaintLayer.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -150,7 +148,7 @@ PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); // Create the buffer if it doesn't exist yet. if (!m_posZOrderList) - m_posZOrderList = wrapUnique(new Vector<PaintLayerStackingNode*>); + m_posZOrderList = adoptPtr(new Vector<PaintLayerStackingNode*>); m_posZOrderList->append(layer->stackingNode()); } } @@ -163,15 +161,15 @@ m_zOrderListsDirty = false; } -void PaintLayerStackingNode::collectLayers(std::unique_ptr<Vector<PaintLayerStackingNode*>>& posBuffer, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuffer) +void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer) { if (layer()->isInTopLayer()) return; if (isStacked()) { - std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; + OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; if (!buffer) - buffer = wrapUnique(new Vector<PaintLayerStackingNode*>); + buffer = adoptPtr(new Vector<PaintLayerStackingNode*>); buffer->append(this); }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h index 9da7094..977f7be 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h
@@ -48,8 +48,8 @@ #include "core/CoreExport.h" #include "core/layout/LayoutBoxModelObject.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -149,7 +149,7 @@ } void rebuildZOrderLists(); - void collectLayers(std::unique_ptr<Vector<PaintLayerStackingNode*>>& posZOrderList, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negZOrderList); + void collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posZOrderList, OwnPtr<Vector<PaintLayerStackingNode*>>& negZOrderList); #if ENABLE(ASSERT) bool isInStackingParentZOrderLists() const; @@ -169,8 +169,8 @@ // that have z-indices of 0 (or is treated as 0 for positioned objects) or greater. // m_negZOrderList holds descendants within our stacking context with // negative z-indices. - std::unique_ptr<Vector<PaintLayerStackingNode*>> m_posZOrderList; - std::unique_ptr<Vector<PaintLayerStackingNode*>> m_negZOrderList; + OwnPtr<Vector<PaintLayerStackingNode*>> m_posZOrderList; + OwnPtr<Vector<PaintLayerStackingNode*>> m_negZOrderList; // This boolean caches whether the z-order lists above are dirty. // It is only ever set for stacking contexts, as no other element can
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp index be3393e..3c9c9a31 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -13,8 +13,6 @@ #include "core/paint/ObjectPaintProperties.h" #include "core/paint/PaintLayer.h" #include "platform/transforms/TransformationMatrix.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -166,8 +164,8 @@ if (!object.hasLayer()) return; - std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = - wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); + OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = + adoptPtr(new ObjectPaintProperties::LocalBorderBoxProperties); borderBoxContext->paintOffset = context.paintOffset; borderBoxContext->transform = context.currentTransform; borderBoxContext->clip = context.currentClip;
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp index 0bf5781..a98c0c6 100644 --- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
@@ -9,7 +9,6 @@ #include "core/paint/LayoutObjectDrawingRecorder.h" #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/graphics/filters/SourceGraphic.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -19,7 +18,7 @@ // Create a new context so the contents of the filter can be drawn and cached. m_paintController = PaintController::create(); - m_context = wrapUnique(new GraphicsContext(*m_paintController)); + m_context = adoptPtr(new GraphicsContext(*m_paintController)); filterData->m_state = FilterData::RecordingContent; return m_context.get();
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.h b/third_party/WebKit/Source/core/paint/SVGFilterPainter.h index ffbdac3..1d650365 100644 --- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.h +++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.h
@@ -8,7 +8,7 @@ #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -28,8 +28,8 @@ GraphicsContext& paintingContext() const { return m_initialContext; } private: - std::unique_ptr<PaintController> m_paintController; - std::unique_ptr<GraphicsContext> m_context; + OwnPtr<PaintController> m_paintController; + OwnPtr<GraphicsContext> m_context; GraphicsContext& m_initialContext; };
diff --git a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp index 93f1068..9cc33a14 100644 --- a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
@@ -22,7 +22,6 @@ #include "core/paint/SVGPaintContext.h" #include "core/style/ShadowList.h" #include "platform/graphics/GraphicsContextStateSaver.h" -#include <memory> namespace blink { @@ -314,7 +313,7 @@ paint.setAntiAlias(true); if (hasShadow) { - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLooper(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSPropertyColor)); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLooper(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSPropertyColor)); paint.setLooper(toSkSp(drawLooperBuilder->detachDrawLooper())); }
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp index e080d68..c595c9c 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
@@ -32,7 +32,6 @@ #include "core/layout/svg/SVGResourcesCache.h" #include "core/paint/SVGMaskPainter.h" #include "platform/FloatConversion.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -90,7 +89,7 @@ return false; if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(&m_object)) - m_compositingRecorder = wrapUnique(new CompositingRecorder(paintInfo().context, m_object, SkXfermode::kSrcOver_Mode, 1)); + m_compositingRecorder = adoptPtr(new CompositingRecorder(paintInfo().context, m_object, SkXfermode::kSrcOver_Mode, 1)); return true; } @@ -109,7 +108,7 @@ style.blendMode() : WebBlendModeNormal; if (opacity < 1 || blendMode != WebBlendModeNormal) { const FloatRect compositingBounds = m_object.paintInvalidationRectInLocalSVGCoordinates(); - m_compositingRecorder = wrapUnique(new CompositingRecorder(paintInfo().context, m_object, + m_compositingRecorder = adoptPtr(new CompositingRecorder(paintInfo().context, m_object, WebCoreCompositeToSkiaComposite(CompositeSourceOver, blendMode), opacity, &compositingBounds)); } } @@ -129,7 +128,7 @@ ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOperation); if (!clipPath->isValid()) return false; - m_clipPathRecorder = wrapUnique(new ClipPathRecorder(paintInfo().context, m_object, clipPath->path(m_object.objectBoundingBox()))); + m_clipPathRecorder = adoptPtr(new ClipPathRecorder(paintInfo().context, m_object, clipPath->path(m_object.objectBoundingBox()))); } } return true; @@ -151,7 +150,7 @@ if (m_object.style()->svgStyle().hasFilter()) return false; } else if (LayoutSVGResourceFilter* filter = resources->filter()) { - m_filterRecordingContext = wrapUnique(new SVGFilterRecordingContext(paintInfo().context)); + m_filterRecordingContext = adoptPtr(new SVGFilterRecordingContext(paintInfo().context)); m_filter = filter; GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect(m_object, *m_filterRecordingContext); if (!filterContext) @@ -159,7 +158,7 @@ // Because the filter needs to cache its contents we replace the context // during filtering with the filter's context. - m_filterPaintInfo = wrapUnique(new PaintInfo(*filterContext, m_paintInfo)); + m_filterPaintInfo = adoptPtr(new PaintInfo(*filterContext, m_paintInfo)); // Because we cache the filter contents and do not invalidate on paint // invalidation rect changes, we need to paint the entire filter region
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.h b/third_party/WebKit/Source/core/paint/SVGPaintContext.h index b493dde8..d8f1a18 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.h +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
@@ -33,7 +33,6 @@ #include "platform/graphics/paint/ClipPathRecorder.h" #include "platform/graphics/paint/CompositingRecorder.h" #include "platform/transforms/AffineTransform.h" -#include <memory> namespace blink { @@ -86,14 +85,14 @@ const LayoutObject& m_object; PaintInfo m_paintInfo; - std::unique_ptr<PaintInfo> m_filterPaintInfo; + OwnPtr<PaintInfo> m_filterPaintInfo; LayoutSVGResourceFilter* m_filter; LayoutSVGResourceClipper* m_clipper; SVGClipPainter::ClipperState m_clipperState; LayoutSVGResourceMasker* m_masker; - std::unique_ptr<CompositingRecorder> m_compositingRecorder; - std::unique_ptr<ClipPathRecorder> m_clipPathRecorder; - std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; + OwnPtr<CompositingRecorder> m_compositingRecorder; + OwnPtr<ClipPathRecorder> m_clipPathRecorder; + OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; #if ENABLE(ASSERT) bool m_applyClipMaskAndFilterIfNecessaryCalled; #endif
diff --git a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp index cf65e59..807f57e7 100644 --- a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp
@@ -15,7 +15,6 @@ #include "core/style/ShadowList.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { namespace { @@ -47,7 +46,7 @@ } LayoutText* m_layoutText; - std::unique_ptr<PaintController> m_paintController; + OwnPtr<PaintController> m_paintController; GraphicsContext m_context; };
diff --git a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm index a71ea3a..5daffb72 100644 --- a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm +++ b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm
@@ -224,7 +224,7 @@ trackInfo.reserved = 0; trackInfo.filler1 = 0; - std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); if (!imageBuffer) return true;
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp index 9004c71..af7b78e 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp
@@ -16,7 +16,6 @@ #include "core/streams/UnderlyingSource.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -151,7 +150,7 @@ return ReadResultCapturingFunction::createFunction(getScriptState(), value); } - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; Persistent<StringStream> m_stream; };
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp index dc0a0d70..8ee42c8 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp
@@ -19,7 +19,6 @@ #include "testing/gmock/include/gmock/gmock-more-actions.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -154,7 +153,7 @@ return stream; } - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; Persistent<MockUnderlyingSource> m_underlyingSource; };
diff --git a/third_party/WebKit/Source/core/style/CachedUAStyle.h b/third_party/WebKit/Source/core/style/CachedUAStyle.h index 347b4fe2..f9cadf8b 100644 --- a/third_party/WebKit/Source/core/style/CachedUAStyle.h +++ b/third_party/WebKit/Source/core/style/CachedUAStyle.h
@@ -25,8 +25,6 @@ #include "core/style/ComputedStyle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -38,9 +36,9 @@ USING_FAST_MALLOC(CachedUAStyle); WTF_MAKE_NONCOPYABLE(CachedUAStyle); public: - static std::unique_ptr<CachedUAStyle> create(const ComputedStyle* style) + static PassOwnPtr<CachedUAStyle> create(const ComputedStyle* style) { - return wrapUnique(new CachedUAStyle(style)); + return adoptPtr(new CachedUAStyle(style)); } BorderData border;
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp index ed7babe..aedf1102 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -32,10 +32,10 @@ #include "core/layout/TextAutosizer.h" #include "core/style/AppliedTextDecoration.h" #include "core/style/BorderEdge.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/ContentData.h" -#include "core/style/CursorData.h" #include "core/style/DataEquivalency.h" +#include "core/style/ComputedStyleConstants.h" +#include "core/style/CursorData.h" #include "core/style/QuotesData.h" #include "core/style/ShadowList.h" #include "core/style/StyleImage.h" @@ -52,8 +52,8 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "wtf/MathExtras.h" #include "wtf/PtrUtil.h" + #include <algorithm> -#include <memory> namespace blink { @@ -406,7 +406,7 @@ ComputedStyle* result = pseudo.get(); if (!m_cachedPseudoStyles) - m_cachedPseudoStyles = wrapUnique(new PseudoStyleCache); + m_cachedPseudoStyles = adoptPtr(new PseudoStyleCache); m_cachedPseudoStyles->append(pseudo); @@ -1149,9 +1149,9 @@ CounterDirectiveMap& ComputedStyle::accessCounterDirectives() { - std::unique_ptr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m_counterDirectives; + OwnPtr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m_counterDirectives; if (!map) - map = wrapUnique(new CounterDirectiveMap); + map = adoptPtr(new CounterDirectiveMap); return *map; }
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index 4e50f80..c058e29 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -28,9 +28,9 @@ #include "core/CSSPropertyNames.h" #include "core/CoreExport.h" #include "core/style/BorderValue.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/CounterDirectives.h" #include "core/style/DataRef.h" +#include "core/style/ComputedStyleConstants.h" #include "core/style/LineClampValue.h" #include "core/style/NinePieceImage.h" #include "core/style/SVGComputedStyle.h" @@ -71,9 +71,9 @@ #include "platform/transforms/TransformOperations.h" #include "wtf/Forward.h" #include "wtf/LeakAnnotations.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); } @@ -153,7 +153,7 @@ DataRef<StyleInheritedData> inherited; // list of associated pseudo styles - std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; + OwnPtr<PseudoStyleCache> m_cachedPseudoStyles; DataRef<SVGComputedStyle> m_svgStyle;
diff --git a/third_party/WebKit/Source/core/style/ContentData.cpp b/third_party/WebKit/Source/core/style/ContentData.cpp index 6ea4e4d..7689ff27 100644 --- a/third_party/WebKit/Source/core/style/ContentData.cpp +++ b/third_party/WebKit/Source/core/style/ContentData.cpp
@@ -28,7 +28,6 @@ #include "core/layout/LayoutQuote.h" #include "core/layout/LayoutTextFragment.h" #include "core/style/ComputedStyle.h" -#include <memory> namespace blink { @@ -42,7 +41,7 @@ return new TextContentData(text); } -ContentData* ContentData::create(std::unique_ptr<CounterContent> counter) +ContentData* ContentData::create(PassOwnPtr<CounterContent> counter) { return new CounterContentData(std::move(counter)); }
diff --git a/third_party/WebKit/Source/core/style/ContentData.h b/third_party/WebKit/Source/core/style/ContentData.h index 4ed54df..683319d 100644 --- a/third_party/WebKit/Source/core/style/ContentData.h +++ b/third_party/WebKit/Source/core/style/ContentData.h
@@ -27,8 +27,8 @@ #include "core/style/CounterContent.h" #include "core/style/StyleImage.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -40,7 +40,7 @@ public: static ContentData* create(StyleImage*); static ContentData* create(const String&); - static ContentData* create(std::unique_ptr<CounterContent>); + static ContentData* create(PassOwnPtr<CounterContent>); static ContentData* create(QuoteType); virtual ~ContentData() { } @@ -140,20 +140,20 @@ friend class ContentData; public: const CounterContent* counter() const { return m_counter.get(); } - void setCounter(std::unique_ptr<CounterContent> counter) { m_counter = std::move(counter); } + void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = std::move(counter); } bool isCounter() const override { return true; } LayoutObject* createLayoutObject(Document&, ComputedStyle&) const override; private: - CounterContentData(std::unique_ptr<CounterContent> counter) + CounterContentData(PassOwnPtr<CounterContent> counter) : m_counter(std::move(counter)) { } ContentData* cloneInternal() const override { - std::unique_ptr<CounterContent> counterData = wrapUnique(new CounterContent(*counter())); + OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counter())); return create(std::move(counterData)); } @@ -164,7 +164,7 @@ return *static_cast<const CounterContentData&>(data).counter() == *counter(); } - std::unique_ptr<CounterContent> m_counter; + OwnPtr<CounterContent> m_counter; }; DEFINE_CONTENT_DATA_TYPE_CASTS(Counter);
diff --git a/third_party/WebKit/Source/core/style/CounterDirectives.cpp b/third_party/WebKit/Source/core/style/CounterDirectives.cpp index bbb3526..ce9d391cb 100644 --- a/third_party/WebKit/Source/core/style/CounterDirectives.cpp +++ b/third_party/WebKit/Source/core/style/CounterDirectives.cpp
@@ -21,8 +21,7 @@ #include "core/style/CounterDirectives.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -34,9 +33,9 @@ && a.resetValue() == b.resetValue(); } -std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives) +PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives) { - std::unique_ptr<CounterDirectiveMap> result = wrapUnique(new CounterDirectiveMap); + OwnPtr<CounterDirectiveMap> result = adoptPtr(new CounterDirectiveMap); *result = counterDirectives; return result; }
diff --git a/third_party/WebKit/Source/core/style/CounterDirectives.h b/third_party/WebKit/Source/core/style/CounterDirectives.h index a7205990..6e6de38 100644 --- a/third_party/WebKit/Source/core/style/CounterDirectives.h +++ b/third_party/WebKit/Source/core/style/CounterDirectives.h
@@ -31,7 +31,6 @@ #include "wtf/RefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" -#include <memory> namespace blink { @@ -107,7 +106,7 @@ typedef HashMap<AtomicString, CounterDirectives> CounterDirectiveMap; -std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap&); +PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap&); } // namespace blink
diff --git a/third_party/WebKit/Source/core/style/DataEquivalency.h b/third_party/WebKit/Source/core/style/DataEquivalency.h index b37b626..b9b49370 100644 --- a/third_party/WebKit/Source/core/style/DataEquivalency.h +++ b/third_party/WebKit/Source/core/style/DataEquivalency.h
@@ -5,8 +5,8 @@ #ifndef DataEquivalency_h #define DataEquivalency_h +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -44,7 +44,7 @@ } template <typename T> -bool dataEquivalent(const std::unique_ptr<T>& a, const std::unique_ptr<T>& b) +bool dataEquivalent(const OwnPtr<T>& a, const OwnPtr<T>& b) { return dataEquivalent(a.get(), b.get()); }
diff --git a/third_party/WebKit/Source/core/style/DataPersistent.h b/third_party/WebKit/Source/core/style/DataPersistent.h index e2a3118c7..b97a41a 100644 --- a/third_party/WebKit/Source/core/style/DataPersistent.h +++ b/third_party/WebKit/Source/core/style/DataPersistent.h
@@ -7,8 +7,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -37,7 +36,7 @@ : m_ownCopy(false) { if (other.m_data) - m_data = wrapUnique(new Persistent<T>(other.m_data->get())); + m_data = adoptPtr(new Persistent<T>(other.m_data->get())); // Invalidated, subsequent mutations will happen on a new copy. // @@ -63,7 +62,7 @@ void init() { ASSERT(!m_data); - m_data = wrapUnique(new Persistent<T>(T::create())); + m_data = adoptPtr(new Persistent<T>(T::create())); m_ownCopy = true; } @@ -84,7 +83,7 @@ void operator=(std::nullptr_t) { m_data.clear(); } private: // Reduce size of DataPersistent<> by delaying creation of Persistent<>. - std::unique_ptr<Persistent<T>> m_data; + OwnPtr<Persistent<T>> m_data; unsigned m_ownCopy:1; };
diff --git a/third_party/WebKit/Source/core/style/GridArea.h b/third_party/WebKit/Source/core/style/GridArea.h index 7a4e37ae..52c3d03 100644 --- a/third_party/WebKit/Source/core/style/GridArea.h +++ b/third_party/WebKit/Source/core/style/GridArea.h
@@ -34,6 +34,7 @@ #include "core/style/GridPositionsResolver.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include <algorithm>
diff --git a/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h b/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h index fc171a1..e2447cd 100644 --- a/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h +++ b/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h
@@ -33,6 +33,8 @@ #include "platform/Length.h" #include "platform/graphics/Color.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/RefVector.h"
diff --git a/third_party/WebKit/Source/core/style/ShadowList.cpp b/third_party/WebKit/Source/core/style/ShadowList.cpp index 126b909..281d415 100644 --- a/third_party/WebKit/Source/core/style/ShadowList.cpp +++ b/third_party/WebKit/Source/core/style/ShadowList.cpp
@@ -31,7 +31,7 @@ #include "core/style/ShadowList.h" #include "platform/geometry/FloatRect.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -77,9 +77,9 @@ return ShadowList::adopt(shadows); } -std::unique_ptr<DrawLooperBuilder> ShadowList::createDrawLooper(DrawLooperBuilder::ShadowAlphaMode alphaMode, const Color& currentColor, bool isHorizontal) const +PassOwnPtr<DrawLooperBuilder> ShadowList::createDrawLooper(DrawLooperBuilder::ShadowAlphaMode alphaMode, const Color& currentColor, bool isHorizontal) const { - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); for (size_t i = shadows().size(); i--; ) { const ShadowData& shadow = shadows()[i]; float shadowX = isHorizontal ? shadow.x() : shadow.y();
diff --git a/third_party/WebKit/Source/core/style/ShadowList.h b/third_party/WebKit/Source/core/style/ShadowList.h index 0ddd80e..5172e92 100644 --- a/third_party/WebKit/Source/core/style/ShadowList.h +++ b/third_party/WebKit/Source/core/style/ShadowList.h
@@ -36,9 +36,9 @@ #include "platform/geometry/FloatRectOutsets.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/DrawLooperBuilder.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -68,7 +68,7 @@ void adjustRectForShadow(FloatRect&) const; - std::unique_ptr<DrawLooperBuilder> createDrawLooper(DrawLooperBuilder::ShadowAlphaMode, const Color& currentColor, bool isHorizontal = true) const; + PassOwnPtr<DrawLooperBuilder> createDrawLooper(DrawLooperBuilder::ShadowAlphaMode, const Color& currentColor, bool isHorizontal = true) const; private: ShadowList(ShadowDataVector& shadows)
diff --git a/third_party/WebKit/Source/core/style/StylePath.cpp b/third_party/WebKit/Source/core/style/StylePath.cpp index 147919ac..397bc12 100644 --- a/third_party/WebKit/Source/core/style/StylePath.cpp +++ b/third_party/WebKit/Source/core/style/StylePath.cpp
@@ -8,12 +8,10 @@ #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathUtilities.h" #include "platform/graphics/Path.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -StylePath::StylePath(std::unique_ptr<SVGPathByteStream> pathByteStream) +StylePath::StylePath(PassOwnPtr<SVGPathByteStream> pathByteStream) : m_byteStream(std::move(pathByteStream)) , m_pathLength(std::numeric_limits<float>::quiet_NaN()) { @@ -24,7 +22,7 @@ { } -PassRefPtr<StylePath> StylePath::create(std::unique_ptr<SVGPathByteStream> pathByteStream) +PassRefPtr<StylePath> StylePath::create(PassOwnPtr<SVGPathByteStream> pathByteStream) { return adoptRef(new StylePath(std::move(pathByteStream))); } @@ -38,7 +36,7 @@ const Path& StylePath::path() const { if (!m_path) { - m_path = wrapUnique(new Path); + m_path = adoptPtr(new Path); buildPathFromByteStream(*m_byteStream, *m_path); } return *m_path;
diff --git a/third_party/WebKit/Source/core/style/StylePath.h b/third_party/WebKit/Source/core/style/StylePath.h index 6fb672e..763caab 100644 --- a/third_party/WebKit/Source/core/style/StylePath.h +++ b/third_party/WebKit/Source/core/style/StylePath.h
@@ -6,10 +6,10 @@ #define StylePath_h #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -19,7 +19,7 @@ class StylePath : public RefCounted<StylePath> { public: - static PassRefPtr<StylePath> create(std::unique_ptr<SVGPathByteStream>); + static PassRefPtr<StylePath> create(PassOwnPtr<SVGPathByteStream>); ~StylePath(); static StylePath* emptyPath(); @@ -35,10 +35,10 @@ bool operator==(const StylePath&) const; private: - explicit StylePath(std::unique_ptr<SVGPathByteStream>); + explicit StylePath(PassOwnPtr<SVGPathByteStream>); - std::unique_ptr<SVGPathByteStream> m_byteStream; - mutable std::unique_ptr<Path> m_path; + OwnPtr<SVGPathByteStream> m_byteStream; + mutable OwnPtr<Path> m_path; mutable float m_pathLength; };
diff --git a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h index 5d9b9e2e4..5f6563a7 100644 --- a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h +++ b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h
@@ -28,11 +28,11 @@ #include "core/CoreExport.h" #include "core/css/StyleColor.h" #include "core/layout/ClipPathOperation.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/CounterDirectives.h" #include "core/style/DataPersistent.h" #include "core/style/DataRef.h" #include "core/style/FillLayer.h" +#include "core/style/ComputedStyleConstants.h" #include "core/style/LineClampValue.h" #include "core/style/NinePieceImage.h" #include "core/style/ShapeValue.h" @@ -40,10 +40,10 @@ #include "core/style/StyleScrollSnapData.h" #include "core/style/StyleSelfAlignmentData.h" #include "platform/LengthPoint.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -123,9 +123,9 @@ DataRef<StyleScrollSnapData> m_scrollSnap; Persistent<ContentData> m_content; - std::unique_ptr<CounterDirectiveMap> m_counterDirectives; - std::unique_ptr<CSSAnimationData> m_animations; - std::unique_ptr<CSSTransitionData> m_transitions; + OwnPtr<CounterDirectiveMap> m_counterDirectives; + OwnPtr<CSSAnimationData> m_animations; + OwnPtr<CSSTransitionData> m_transitions; RefPtr<ShadowList> m_boxShadow;
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h index b9d1c953..7a40781 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h
@@ -28,6 +28,7 @@ #include "core/svg/SVGAnimatedTypeAnimator.h" #include "core/svg/SVGAnimationElement.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include <base/gtest_prod_util.h> namespace blink {
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h index 5f2cbca..37eabf60 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h
@@ -23,6 +23,7 @@ #include "core/svg/properties/SVGPropertyInfo.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.h b/third_party/WebKit/Source/core/svg/SVGElement.h index a134ab3d..4f68a87 100644 --- a/third_party/WebKit/Source/core/svg/SVGElement.h +++ b/third_party/WebKit/Source/core/svg/SVGElement.h
@@ -30,6 +30,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/svg/SVGPath.cpp b/third_party/WebKit/Source/core/svg/SVGPath.cpp index e9f3137..4784626 100644 --- a/third_party/WebKit/Source/core/svg/SVGPath.cpp +++ b/third_party/WebKit/Source/core/svg/SVGPath.cpp
@@ -30,15 +30,14 @@ #include "core/svg/SVGPathByteStreamSource.h" #include "core/svg/SVGPathUtilities.h" #include "platform/graphics/Path.h" -#include <memory> namespace blink { namespace { -std::unique_ptr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& toStream, float progress) +PassOwnPtr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& toStream, float progress) { - std::unique_ptr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*resultStream); SVGPathByteStreamSource fromSource(fromStream); SVGPathByteStreamSource toSource(toStream); @@ -47,9 +46,9 @@ return resultStream; } -std::unique_ptr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) +PassOwnPtr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) { - std::unique_ptr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*resultStream); SVGPathByteStreamSource fromSource(fromStream); SVGPathByteStreamSource bySource(byStream); @@ -58,7 +57,7 @@ return resultStream; } -std::unique_ptr<SVGPathByteStream> conditionallyAddPathByteStreams(std::unique_ptr<SVGPathByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) +PassOwnPtr<SVGPathByteStream> conditionallyAddPathByteStreams(PassOwnPtr<SVGPathByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) { if (fromStream->isEmpty() || byStream.isEmpty()) return fromStream; @@ -92,7 +91,7 @@ SVGParsingError SVGPath::setValueAsString(const String& string) { - std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); SVGParsingError parseStatus = buildByteStreamFromString(string, *byteStream); m_pathValue = CSSPathValue::create(std::move(byteStream)); return parseStatus; @@ -100,7 +99,7 @@ SVGPropertyBase* SVGPath::cloneForAnimation(const String& value) const { - std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); buildByteStreamFromString(value, *byteStream); return SVGPath::create(CSSPathValue::create(std::move(byteStream))); } @@ -131,7 +130,7 @@ const SVGPath& from = toSVGPath(*fromValue); const SVGPathByteStream* fromStream = &from.byteStream(); - std::unique_ptr<SVGPathByteStream> copy; + OwnPtr<SVGPathByteStream> copy; if (isToAnimation) { copy = byteStream().clone(); fromStream = copy.get(); @@ -150,7 +149,7 @@ } } - std::unique_ptr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toStream, percentage); + OwnPtr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toStream, percentage); // Handle additive='sum'. if (animationElement->isAdditive() && !isToAnimation)
diff --git a/third_party/WebKit/Source/core/svg/SVGPathByteStream.h b/third_party/WebKit/Source/core/svg/SVGPathByteStream.h index 980bc20c..31ac395 100644 --- a/third_party/WebKit/Source/core/svg/SVGPathByteStream.h +++ b/third_party/WebKit/Source/core/svg/SVGPathByteStream.h
@@ -21,9 +21,8 @@ #define SVGPathByteStream_h #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -36,14 +35,14 @@ class SVGPathByteStream { USING_FAST_MALLOC(SVGPathByteStream); public: - static std::unique_ptr<SVGPathByteStream> create() + static PassOwnPtr<SVGPathByteStream> create() { - return wrapUnique(new SVGPathByteStream); + return adoptPtr(new SVGPathByteStream); } - std::unique_ptr<SVGPathByteStream> clone() const + PassOwnPtr<SVGPathByteStream> clone() const { - return wrapUnique(new SVGPathByteStream(m_data)); + return adoptPtr(new SVGPathByteStream(m_data)); } typedef Vector<unsigned char> Data;
diff --git a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp index 8a8aaea..27cccf53a 100644 --- a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp +++ b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp
@@ -27,7 +27,6 @@ #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h" -#include <memory> // Test that SVG content with JavaScript URLs is sanitized by removing // the URLs. This sanitization happens when the content is pasted or @@ -77,7 +76,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -99,7 +98,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -122,7 +121,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped_caseAndEntityInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -144,7 +143,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped_caseAndEntityInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -167,7 +166,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped_entityWithoutSemicolonInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -189,7 +188,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped_entityWithoutSemicolonInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -217,7 +216,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnimatedAnchor_javaScriptHrefIsStripped_caseAndEntityInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -241,7 +240,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnimatedAnchor_javaScriptXlinkHrefIsStripped_caseAndEntityInProtocol) { - std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'"
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp index 0a9074f..2893343 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -31,7 +31,6 @@ #include "core/svg/graphics/SVGImage.h" #include "platform/graphics/ImageObserver.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -40,7 +39,7 @@ SVGImageChromeClient::SVGImageChromeClient(SVGImage* image) : m_image(image) , m_animationTimer( - wrapUnique(new Timer<SVGImageChromeClient>( + adoptPtr(new Timer<SVGImageChromeClient>( this, &SVGImageChromeClient::animationTimerFired))) , m_timelineState(Running) { @@ -114,7 +113,7 @@ void SVGImageChromeClient::setTimer(Timer<SVGImageChromeClient>* timer) { - m_animationTimer = wrapUnique(timer); + m_animationTimer = adoptPtr(timer); } void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*)
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h index 35e6148..32a2a3b 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
@@ -33,7 +33,6 @@ #include "core/CoreExport.h" #include "core/loader/EmptyClients.h" #include "platform/Timer.h" -#include <memory> namespace blink { @@ -62,7 +61,7 @@ void animationTimerFired(Timer<SVGImageChromeClient>*); SVGImage* m_image; - std::unique_ptr<Timer<SVGImageChromeClient>> m_animationTimer; + OwnPtr<Timer<SVGImageChromeClient>> m_animationTimer; enum { Running, Suspended,
diff --git a/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp b/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp index a95add4..6747c7ee 100644 --- a/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp +++ b/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp
@@ -38,8 +38,6 @@ #include "core/frame/VisualViewport.h" #include "core/loader/EmptyClients.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -48,12 +46,12 @@ settings.setRootLayerScrolls(true); } -std::unique_ptr<DummyPageHolder> DummyPageHolder::create( +PassOwnPtr<DummyPageHolder> DummyPageHolder::create( const IntSize& initialViewSize, Page::PageClients* pageClients, FrameLoaderClient* frameLoaderClient, FrameSettingOverrideFunction settingOverrider) { - return wrapUnique(new DummyPageHolder(initialViewSize, pageClients, frameLoaderClient, settingOverrider)); + return adoptPtr(new DummyPageHolder(initialViewSize, pageClients, frameLoaderClient, settingOverrider)); } DummyPageHolder::DummyPageHolder(
diff --git a/third_party/WebKit/Source/core/testing/DummyPageHolder.h b/third_party/WebKit/Source/core/testing/DummyPageHolder.h index 5704e1ef..67257e8 100644 --- a/third_party/WebKit/Source/core/testing/DummyPageHolder.h +++ b/third_party/WebKit/Source/core/testing/DummyPageHolder.h
@@ -37,7 +37,8 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -64,7 +65,7 @@ WTF_MAKE_NONCOPYABLE(DummyPageHolder); USING_FAST_MALLOC(DummyPageHolder); public: - static std::unique_ptr<DummyPageHolder> create( + static PassOwnPtr<DummyPageHolder> create( const IntSize& initialViewSize = IntSize(), Page::PageClients* = 0, FrameLoaderClient* = nullptr,
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 8e01970..20d5a45 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -145,11 +145,10 @@ #include "public/platform/WebGraphicsContext3DProvider.h" #include "public/platform/WebLayer.h" #include "wtf/InstanceCounter.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/dtoa.h" #include "wtf/text/StringBuffer.h" #include <deque> -#include <memory> #include <v8.h> namespace blink { @@ -1474,7 +1473,7 @@ Vector<AtomicString> Internals::htmlTags() { Vector<AtomicString> tags(HTMLNames::HTMLTagsCount); - std::unique_ptr<const HTMLQualifiedName*[]> qualifiedNames = HTMLNames::getHTMLTags(); + OwnPtr<const HTMLQualifiedName*[]> qualifiedNames = HTMLNames::getHTMLTags(); for (size_t i = 0; i < HTMLNames::HTMLTagsCount; ++i) tags[i] = qualifiedNames[i]->localName(); return tags; @@ -1488,7 +1487,7 @@ Vector<AtomicString> Internals::svgTags() { Vector<AtomicString> tags(SVGNames::SVGTagsCount); - std::unique_ptr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); + OwnPtr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); for (size_t i = 0; i < SVGNames::SVGTagsCount; ++i) tags[i] = qualifiedNames[i]->localName(); return tags; @@ -2220,7 +2219,7 @@ bool Internals::loseSharedGraphicsContext3D() { - std::unique_ptr<WebGraphicsContext3DProvider> sharedProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + OwnPtr<WebGraphicsContext3DProvider> sharedProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!sharedProvider) return false; gpu::gles2::GLES2Interface* sharedGL = sharedProvider->contextGL();
diff --git a/third_party/WebKit/Source/core/testing/NullExecutionContext.h b/third_party/WebKit/Source/core/testing/NullExecutionContext.h index f9847e99..10a4500f 100644 --- a/third_party/WebKit/Source/core/testing/NullExecutionContext.h +++ b/third_party/WebKit/Source/core/testing/NullExecutionContext.h
@@ -12,7 +12,6 @@ #include "core/inspector/ConsoleMessage.h" #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" -#include <memory> namespace blink { @@ -38,7 +37,7 @@ DOMTimerCoordinator* timers() override { return nullptr; } void addConsoleMessage(ConsoleMessage*) override { } - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override { } + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override { } void setIsSecureContext(bool); bool isSecureContext(String& errorMessage, const SecureContextCheck = StandardSecureContextCheck) const override;
diff --git a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp index 2c71ba8..d45a90db 100644 --- a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp +++ b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp
@@ -10,7 +10,6 @@ #include "bindings/core/v8/V8PrivateScriptTest.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> // PrivateScriptTest.js is available only in debug builds. #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp index d0f92280..846935f 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp
@@ -41,11 +41,10 @@ #include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerThreadStartupData.h" -#include <memory> namespace blink { -DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double timeOrigin) +DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -56,7 +55,7 @@ return context; } -DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) { } @@ -73,7 +72,7 @@ void DedicatedWorkerGlobalScope::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(channels));
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h index 5628e4f..a933cd50 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h
@@ -35,7 +35,6 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/heap/Visitor.h" -#include <memory> namespace blink { @@ -45,7 +44,7 @@ class CORE_EXPORT DedicatedWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static DedicatedWorkerGlobalScope* create(DedicatedWorkerThread*, std::unique_ptr<WorkerThreadStartupData>, double timeOrigin); + static DedicatedWorkerGlobalScope* create(DedicatedWorkerThread*, PassOwnPtr<WorkerThreadStartupData>, double timeOrigin); ~DedicatedWorkerGlobalScope() override; bool isDedicatedWorkerGlobalScope() const override { return true; } @@ -64,7 +63,7 @@ DECLARE_VIRTUAL_TRACE(); private: - DedicatedWorkerGlobalScope(const KURL&, const String& userAgent, DedicatedWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); + DedicatedWorkerGlobalScope(const KURL&, const String& userAgent, DedicatedWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp index 41b1db6..8df33e8f 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp
@@ -6,7 +6,6 @@ #include "core/workers/DedicatedWorkerThread.h" #include "core/workers/WorkerClients.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ { } -std::unique_ptr<WorkerThread> DedicatedWorkerMessagingProxy::createWorkerThread(double originTime) +PassOwnPtr<WorkerThread> DedicatedWorkerMessagingProxy::createWorkerThread(double originTime) { return DedicatedWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h index 3824a390..941e069 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h
@@ -7,7 +7,6 @@ #include "core/CoreExport.h" #include "core/workers/InProcessWorkerMessagingProxy.h" -#include <memory> namespace blink { @@ -18,7 +17,7 @@ DedicatedWorkerMessagingProxy(InProcessWorkerBase*, WorkerClients*); ~DedicatedWorkerMessagingProxy() override; - std::unique_ptr<WorkerThread> createWorkerThread(double originTime) override; + PassOwnPtr<WorkerThread> createWorkerThread(double originTime) override; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp index 7f74489..896d18da 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp
@@ -34,14 +34,12 @@ #include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<DedicatedWorkerThread> DedicatedWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) +PassOwnPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) { - return wrapUnique(new DedicatedWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); + return adoptPtr(new DedicatedWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); } DedicatedWorkerThread::DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) @@ -56,7 +54,7 @@ { } -WorkerGlobalScope* DedicatedWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* DedicatedWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) { return DedicatedWorkerGlobalScope::create(this, std::move(startupData), m_timeOrigin); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h index bc062678..a6fa87d 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
@@ -31,7 +31,6 @@ #define DedicatedWorkerThread_h #include "core/workers/WorkerThread.h" -#include <memory> namespace blink { @@ -40,20 +39,20 @@ class DedicatedWorkerThread final : public WorkerThread { public: - static std::unique_ptr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); + static PassOwnPtr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); ~DedicatedWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } protected: - WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; void postInitialize() override; private: DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); - std::unique_ptr<WorkerBackingThread> m_workerBackingThread; + OwnPtr<WorkerBackingThread> m_workerBackingThread; InProcessWorkerObjectProxy& m_workerObjectProxy; double m_timeOrigin; };
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp index 6990487f..472928b 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp
@@ -14,7 +14,6 @@ #include "core/workers/WorkerScriptLoader.h" #include "core/workers/WorkerThread.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" -#include <memory> namespace blink { @@ -37,7 +36,7 @@ { DCHECK(m_contextProxy); // Disentangle the port in preparation for sending it to the remote context. - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; m_contextProxy->postMessageToWorkerGlobalScope(message, std::move(channels));
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h index 0022c07..419ae2d 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h
@@ -35,7 +35,7 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerThread.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -51,7 +51,7 @@ virtual void terminateWorkerGlobalScope() = 0; - virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>) = 0; + virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0; virtual bool hasPendingActivity() const = 0;
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp index efc696f2..29f1480 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
@@ -47,19 +47,18 @@ #include "core/workers/WorkerInspectorProxy.h" #include "core/workers/WorkerThreadStartupData.h" #include "wtf/WTF.h" -#include <memory> namespace blink { namespace { -void processUnhandledExceptionOnWorkerGlobalScope(const String& errorMessage, std::unique_ptr<SourceLocation> location, ExecutionContext* scriptContext) +void processUnhandledExceptionOnWorkerGlobalScope(const String& errorMessage, PassOwnPtr<SourceLocation> location, ExecutionContext* scriptContext) { WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); globalScope->exceptionUnhandled(errorMessage, std::move(location)); } -void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* workerObjectProxy, ExecutionContext* scriptContext) +void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* workerObjectProxy, ExecutionContext* scriptContext) { WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); MessagePortArray* ports = MessagePort::entanglePorts(*scriptContext, std::move(channels)); @@ -118,7 +117,7 @@ DCHECK(csp); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers().get(), starterOrigin, m_workerClients.release(), document->addressSpace(), OriginTrialContext::getTokens(document).get()); + OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers().get(), starterOrigin, m_workerClients.release(), document->addressSpace(), OriginTrialContext::getTokens(document).get()); double originTime = document->loader() ? document->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime(); m_loaderProxy = WorkerLoaderProxy::create(this); @@ -128,7 +127,7 @@ m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); } -void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) +void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { DCHECK(isParentContextThread()); if (!m_workerObject || m_askedToTerminate) @@ -138,7 +137,7 @@ m_workerObject->dispatchEvent(MessageEvent::create(ports, message)); } -void InProcessWorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) +void InProcessWorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { DCHECK(isParentContextThread()); if (m_askedToTerminate) @@ -169,7 +168,7 @@ getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task)); } -void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) { DCHECK(isParentContextThread()); if (!m_workerObject) @@ -186,7 +185,7 @@ postTaskToWorkerGlobalScope(createCrossThreadTask(&processUnhandledExceptionOnWorkerGlobalScope, errorMessage, passed(std::move(location)))); } -void InProcessWorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, std::unique_ptr<SourceLocation> location) +void InProcessWorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, PassOwnPtr<SourceLocation> location) { DCHECK(isParentContextThread()); if (m_askedToTerminate)
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h index 27722da..54543993 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
@@ -34,10 +34,10 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -60,15 +60,15 @@ // (Only use these methods in the parent context thread.) void startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode) override; void terminateWorkerGlobalScope() override; - void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>) override; + void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) override; bool hasPendingActivity() const final; void workerObjectDestroyed() override; // These methods come from worker context thread via // InProcessWorkerObjectProxy and are called on the parent context thread. - void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>); - void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>); - void reportConsoleMessage(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>); + void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); + void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>); + void reportConsoleMessage(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>); void postMessageToPageInspector(const String&); void postWorkerConsoleAgentEnabled(); void confirmMessageFromWorkerObject(bool hasPendingActivity); @@ -85,7 +85,7 @@ InProcessWorkerMessagingProxy(InProcessWorkerBase*, WorkerClients*); ~InProcessWorkerMessagingProxy() override; - virtual std::unique_ptr<WorkerThread> createWorkerThread(double originTime) = 0; + virtual PassOwnPtr<WorkerThread> createWorkerThread(double originTime) = 0; PassRefPtr<WorkerLoaderProxy> loaderProxy() { return m_loaderProxy; } InProcessWorkerObjectProxy& workerObjectProxy() { return *m_workerObjectProxy.get(); } @@ -104,10 +104,10 @@ bool isParentContextThread() const; Persistent<ExecutionContext> m_executionContext; - std::unique_ptr<InProcessWorkerObjectProxy> m_workerObjectProxy; + OwnPtr<InProcessWorkerObjectProxy> m_workerObjectProxy; WeakPersistent<InProcessWorkerBase> m_workerObject; bool m_mayBeDestroyed; - std::unique_ptr<WorkerThread> m_workerThread; + OwnPtr<WorkerThread> m_workerThread; // Unconfirmed messages from the parent context thread to the worker thread. unsigned m_unconfirmedMessageCount;
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp index d183e1e..83d8baedd 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -37,18 +37,16 @@ #include "core/inspector/ConsoleMessage.h" #include "core/workers/InProcessWorkerMessagingProxy.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(InProcessWorkerMessagingProxy* messagingProxy) +PassOwnPtr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(InProcessWorkerMessagingProxy* messagingProxy) { DCHECK(messagingProxy); - return wrapUnique(new InProcessWorkerObjectProxy(messagingProxy)); + return adoptPtr(new InProcessWorkerObjectProxy(messagingProxy)); } -void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) +void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, AllowCrossThreadAccess(m_messagingProxy), message, passed(std::move(channels)))); } @@ -68,7 +66,7 @@ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportPendingActivity, AllowCrossThreadAccess(m_messagingProxy), hasPendingActivity)); } -void InProcessWorkerObjectProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void InProcessWorkerObjectProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) { getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportException, AllowCrossThreadAccess(m_messagingProxy), errorMessage, passed(std::move(location)))); }
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h index 1bfe52a..111f10e 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
@@ -35,8 +35,8 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerReportingProxy.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -55,16 +55,16 @@ USING_FAST_MALLOC(InProcessWorkerObjectProxy); WTF_MAKE_NONCOPYABLE(InProcessWorkerObjectProxy); public: - static std::unique_ptr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*); + static PassOwnPtr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*); ~InProcessWorkerObjectProxy() override { } - void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>); + void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>); void confirmMessageFromWorkerObject(bool hasPendingActivity); void reportPendingActivity(bool hasPendingActivity); // WorkerReportingProxy overrides. - void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) override; + void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const String&) override; void postWorkerConsoleAgentEnabled() override;
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp index e3fd264b..b299a80 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp
@@ -32,13 +32,12 @@ #include "bindings/core/v8/SourceLocation.h" #include "core/events/MessageEvent.h" -#include "core/frame/LocalDOMWindow.h" #include "core/inspector/ConsoleMessage.h" +#include "core/frame/LocalDOMWindow.h" #include "core/origin_trials/OriginTrialContext.h" #include "core/workers/SharedWorkerThread.h" #include "core/workers/WorkerClients.h" #include "wtf/CurrentTime.h" -#include <memory> namespace blink { @@ -50,7 +49,7 @@ } // static -SharedWorkerGlobalScope* SharedWorkerGlobalScope::create(const String& name, SharedWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData) +SharedWorkerGlobalScope* SharedWorkerGlobalScope::create(const String& name, SharedWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -61,7 +60,7 @@ return context; } -SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, monotonicallyIncreasingTime(), std::move(starterOriginPrivilegeData), workerClients) , m_name(name) { @@ -81,7 +80,7 @@ return static_cast<SharedWorkerThread*>(Base::thread()); } -void SharedWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void SharedWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) { WorkerGlobalScope::logExceptionToConsole(errorMessage, location->clone()); ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location));
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h index 4879f9a..22bcfb0 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h
@@ -36,7 +36,6 @@ #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThreadStartupData.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -47,7 +46,7 @@ DEFINE_WRAPPERTYPEINFO(); public: typedef WorkerGlobalScope Base; - static SharedWorkerGlobalScope* create(const String& name, SharedWorkerThread*, std::unique_ptr<WorkerThreadStartupData>); + static SharedWorkerGlobalScope* create(const String& name, SharedWorkerThread*, PassOwnPtr<WorkerThreadStartupData>); ~SharedWorkerGlobalScope() override; bool isSharedWorkerGlobalScope() const override { return true; } @@ -64,8 +63,8 @@ DECLARE_VIRTUAL_TRACE(); private: - SharedWorkerGlobalScope(const String& name, const KURL&, const String& userAgent, SharedWorkerThread*, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; + SharedWorkerGlobalScope(const String& name, const KURL&, const String& userAgent, SharedWorkerThread*, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; String m_name; };
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp b/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp index 2b7b851f..14c6875f 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp
@@ -33,14 +33,12 @@ #include "core/workers/SharedWorkerGlobalScope.h" #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<SharedWorkerThread> SharedWorkerThread::create(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) +PassOwnPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return wrapUnique(new SharedWorkerThread(name, workerLoaderProxy, workerReportingProxy)); + return adoptPtr(new SharedWorkerThread(name, workerLoaderProxy, workerReportingProxy)); } SharedWorkerThread::SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) @@ -54,7 +52,7 @@ { } -WorkerGlobalScope* SharedWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* SharedWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) { return SharedWorkerGlobalScope::create(m_name, this, std::move(startupData)); }
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerThread.h b/third_party/WebKit/Source/core/workers/SharedWorkerThread.h index c0286d0..0945805 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerThread.h +++ b/third_party/WebKit/Source/core/workers/SharedWorkerThread.h
@@ -33,7 +33,6 @@ #include "core/CoreExport.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" -#include <memory> namespace blink { @@ -41,18 +40,18 @@ class CORE_EXPORT SharedWorkerThread : public WorkerThread { public: - static std::unique_ptr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); + static PassOwnPtr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); ~SharedWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } protected: - WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; private: SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); - std::unique_ptr<WorkerBackingThread> m_workerBackingThread; + OwnPtr<WorkerBackingThread> m_workerBackingThread; String m_name; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp index 168e6d3..0c7ae4e 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp
@@ -14,8 +14,6 @@ #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -73,13 +71,13 @@ V8Initializer::initializeWorker(m_isolate); m_backingThread->initialize(); - std::unique_ptr<V8IsolateInterruptor> interruptor = wrapUnique(new V8IsolateInterruptor(m_isolate)); + OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); ThreadState::current()->addInterruptor(std::move(interruptor)); ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController::traceDOMWrappers, nullptr); if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) - V8PerIsolateData::enableIdleTasks(m_isolate, wrapUnique(new V8IdleTaskRunner(backingThread().platformThread().scheduler()))); + V8PerIsolateData::enableIdleTasks(m_isolate, adoptPtr(new V8IdleTaskRunner(backingThread().platformThread().scheduler()))); if (m_isOwningThread) Platform::current()->didStartWorkerThread(); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.h b/third_party/WebKit/Source/core/workers/WorkerBackingThread.h index 6fc1627..389586706 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.h +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.h
@@ -7,9 +7,9 @@ #include "core/CoreExport.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> #include <v8.h> namespace blink { @@ -27,13 +27,13 @@ // WorkerGlobalScopes) can share one WorkerBackingThread. class CORE_EXPORT WorkerBackingThread final { public: - static std::unique_ptr<WorkerBackingThread> create(const char* name) { return wrapUnique(new WorkerBackingThread(name, false)); } - static std::unique_ptr<WorkerBackingThread> create(WebThread* thread) { return wrapUnique(new WorkerBackingThread(thread, false)); } + static PassOwnPtr<WorkerBackingThread> create(const char* name) { return adoptPtr(new WorkerBackingThread(name, false)); } + static PassOwnPtr<WorkerBackingThread> create(WebThread* thread) { return adoptPtr(new WorkerBackingThread(thread, false)); } // These are needed to suppress leak reports. See // https://crbug.com/590802 and https://crbug.com/v8/1428. - static std::unique_ptr<WorkerBackingThread> createForTest(const char* name) { return wrapUnique(new WorkerBackingThread(name, true)); } - static std::unique_ptr<WorkerBackingThread> createForTest(WebThread* thread) { return wrapUnique(new WorkerBackingThread(thread, true)); } + static PassOwnPtr<WorkerBackingThread> createForTest(const char* name) { return adoptPtr(new WorkerBackingThread(name, true)); } + static PassOwnPtr<WorkerBackingThread> createForTest(WebThread* thread) { return adoptPtr(new WorkerBackingThread(thread, true)); } ~WorkerBackingThread(); @@ -59,7 +59,7 @@ WorkerBackingThread(const char* name, bool shouldCallGCOnShutdown); WorkerBackingThread(WebThread*, bool shouldCallGCOnSHutdown); - std::unique_ptr<WebThreadSupportingGC> m_backingThread; + OwnPtr<WebThreadSupportingGC> m_backingThread; v8::Isolate* m_isolate = nullptr; bool m_isOwningThread; bool m_shouldCallGCOnShutdown;
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp index e5b8fe1..c1b11f5 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -53,6 +53,7 @@ #include "core/inspector/InspectorConsoleInstrumentation.h" #include "core/inspector/WorkerInspectorController.h" #include "core/loader/WorkerThreadableLoader.h" +#include "core/workers/WorkerNavigator.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerLoaderProxy.h" #include "core/workers/WorkerLocation.h" @@ -66,11 +67,10 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebURLRequest.h" -#include <memory> namespace blink { -WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData, WorkerClients* workerClients) +WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData, WorkerClients* workerClients) : m_url(url) , m_userAgent(userAgent) , m_v8CacheOptions(V8CacheOptionsDefault) @@ -253,7 +253,7 @@ scriptLoaded(scriptLoader->script().length(), scriptLoader->cachedMetadata() ? scriptLoader->cachedMetadata()->size() : 0); ErrorEvent* errorEvent = nullptr; - std::unique_ptr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata()); + OwnPtr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata()); CachedMetadataHandler* handler(createWorkerScriptCachedMetadataHandler(completeURL, cachedMetaData.get())); m_scriptController->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader->responseURL()), &errorEvent, handler, m_v8CacheOptions); if (errorEvent) { @@ -268,7 +268,7 @@ return this; } -void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) { thread()->workerReportingProxy().reportException(errorMessage, std::move(location)); } @@ -346,7 +346,7 @@ return m_messageStorage.get(); } -void WorkerGlobalScope::exceptionUnhandled(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void WorkerGlobalScope::exceptionUnhandled(const String& errorMessage, PassOwnPtr<SourceLocation> location) { addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location))); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h index 1117ef4..ff21f438 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h
@@ -45,10 +45,10 @@ #include "wtf/Assertions.h" #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/AtomicStringHash.h" -#include <memory> namespace blink { @@ -141,7 +141,7 @@ void addConsoleMessage(ConsoleMessage*) final; ConsoleMessageStorage* messageStorage(); - void exceptionUnhandled(const String& errorMessage, std::unique_ptr<SourceLocation>); + void exceptionUnhandled(const String& errorMessage, PassOwnPtr<SourceLocation>); virtual void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) { } @@ -153,10 +153,10 @@ DECLARE_VIRTUAL_TRACE(); protected: - WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); + WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); void applyContentSecurityPolicyFromVector(const Vector<CSPHeaderAndType>& headers); - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; void addMessageToWorkerConsole(ConsoleMessage*); void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v8CacheOptions; }
diff --git a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h index 62af4c7..a05f0cb6 100644 --- a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h +++ b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h
@@ -34,6 +34,7 @@ #include "core/CoreExport.h" #include "core/dom/ExecutionContext.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h b/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h index 7e9d343..ea14f923 100644 --- a/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h +++ b/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h
@@ -34,7 +34,7 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -47,7 +47,7 @@ public: virtual ~WorkerReportingProxy() { } - virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) = 0; + virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) = 0; virtual void reportConsoleMessage(ConsoleMessage*) = 0; virtual void postMessageToPageInspector(const String&) = 0; virtual void postWorkerConsoleAgentEnabled() = 0;
diff --git a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp index 7bdabf14..e8087ae 100644 --- a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
@@ -39,9 +39,8 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -126,7 +125,7 @@ return request; } -void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { DCHECK(!handle); if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { @@ -170,7 +169,7 @@ void WorkerScriptLoader::didReceiveCachedMetadata(const char* data, int size) { - m_cachedMetadata = wrapUnique(new Vector<char>(size)); + m_cachedMetadata = adoptPtr(new Vector<char>(size)); memcpy(m_cachedMetadata->data(), data, size); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h index eae83c0..0b46670 100644 --- a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h +++ b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h
@@ -37,10 +37,10 @@ #include "public/platform/WebURLRequest.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -76,7 +76,7 @@ unsigned long identifier() const { return m_identifier; } long long appCacheID() const { return m_appCacheID; } - std::unique_ptr<Vector<char>> releaseCachedMetadata() { return std::move(m_cachedMetadata); } + PassOwnPtr<Vector<char>> releaseCachedMetadata() { return std::move(m_cachedMetadata); } const Vector<char>* cachedMetadata() const { return m_cachedMetadata.get(); } ContentSecurityPolicy* contentSecurityPolicy() { return m_contentSecurityPolicy.get(); } @@ -87,7 +87,7 @@ const Vector<String>* originTrialTokens() const { return m_originTrialTokens.get(); } // ThreadableLoaderClient - void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didReceiveData(const char* data, unsigned dataLength) override; void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; void didFinishLoading(unsigned long identifier, double) override; @@ -112,9 +112,9 @@ std::unique_ptr<SameThreadClosure> m_responseCallback; std::unique_ptr<SameThreadClosure> m_finishedCallback; - std::unique_ptr<ThreadableLoader> m_threadableLoader; + OwnPtr<ThreadableLoader> m_threadableLoader; String m_responseEncoding; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; StringBuilder m_script; KURL m_url; KURL m_responseURL; @@ -122,7 +122,7 @@ bool m_needToCancel; unsigned long m_identifier; long long m_appCacheID; - std::unique_ptr<Vector<char>> m_cachedMetadata; + OwnPtr<Vector<char>> m_cachedMetadata; WebURLRequest::RequestContext m_requestContext; Persistent<ContentSecurityPolicy> m_contentSecurityPolicy; WebAddressSpace m_responseAddressSpace;
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index f789496..4c9fd41 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -49,11 +49,9 @@ #include "public/platform/WebThread.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/text/WTFString.h" #include <limits.h> -#include <memory> namespace blink { @@ -67,9 +65,9 @@ // started before this task runs, the task is simply cancelled. class WorkerThread::ForceTerminationTask final { public: - static std::unique_ptr<ForceTerminationTask> create(WorkerThread* workerThread) + static PassOwnPtr<ForceTerminationTask> create(WorkerThread* workerThread) { - return wrapUnique(new ForceTerminationTask(workerThread)); + return adoptPtr(new ForceTerminationTask(workerThread)); } void schedule() @@ -106,7 +104,7 @@ } WorkerThread* m_workerThread; - std::unique_ptr<CancellableTaskFactory> m_cancellableTaskFactory; + OwnPtr<CancellableTaskFactory> m_cancellableTaskFactory; }; class WorkerThread::WorkerMicrotaskRunner final : public WebThread::TaskObserver { @@ -186,7 +184,7 @@ exitCodeHistogram.count(static_cast<int>(m_exitCode)); } -void WorkerThread::start(std::unique_ptr<WorkerThreadStartupData> startupData) +void WorkerThread::start(PassOwnPtr<WorkerThreadStartupData> startupData) { DCHECK(isMainThread()); @@ -324,13 +322,13 @@ WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) : m_forceTerminationDelayInMs(kForceTerminationDelayInMs) - , m_inspectorTaskRunner(wrapUnique(new InspectorTaskRunner())) + , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner())) , m_workerLoaderProxy(workerLoaderProxy) , m_workerReportingProxy(workerReportingProxy) - , m_terminationEvent(wrapUnique(new WaitableEvent( + , m_terminationEvent(adoptPtr(new WaitableEvent( WaitableEvent::ResetPolicy::Manual, WaitableEvent::InitialState::NonSignaled))) - , m_shutdownEvent(wrapUnique(new WaitableEvent( + , m_shutdownEvent(adoptPtr(new WaitableEvent( WaitableEvent::ResetPolicy::Manual, WaitableEvent::InitialState::NonSignaled))) , m_workerThreadLifecycleContext(new WorkerThreadLifecycleContext) @@ -430,12 +428,12 @@ isolate()->TerminateExecution(); } -void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData> startupData) +void WorkerThread::initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData> startupData) { KURL scriptURL = startupData->m_scriptURL; String sourceCode = startupData->m_sourceCode; WorkerThreadStartMode startMode = startupData->m_startMode; - std::unique_ptr<Vector<char>> cachedMetaData = std::move(startupData->m_cachedMetaData); + OwnPtr<Vector<char>> cachedMetaData = std::move(startupData->m_cachedMetaData); V8CacheOptions v8CacheOptions = startupData->m_v8CacheOptions; { @@ -460,8 +458,8 @@ workerBackingThread().initialize(); if (shouldAttachThreadDebugger()) - V8PerIsolateData::from(isolate())->setThreadDebugger(wrapUnique(new WorkerThreadDebugger(this, isolate()))); - m_microtaskRunner = wrapUnique(new WorkerMicrotaskRunner(this)); + V8PerIsolateData::from(isolate())->setThreadDebugger(adoptPtr(new WorkerThreadDebugger(this, isolate()))); + m_microtaskRunner = adoptPtr(new WorkerMicrotaskRunner(this)); workerBackingThread().backingThread().addTaskObserver(m_microtaskRunner.get()); // Optimize for memory usage instead of latency for the worker isolate.
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h index 0309cae..556c934 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.h +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -37,8 +37,8 @@ #include "platform/WaitableEvent.h" #include "wtf/Forward.h" #include "wtf/Functional.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> #include <v8.h> namespace blink { @@ -100,7 +100,7 @@ virtual ~WorkerThread(); // Called on the main thread. - void start(std::unique_ptr<WorkerThreadStartupData>); + void start(PassOwnPtr<WorkerThreadStartupData>); void terminate(); // Called on the main thread. Internally calls terminateInternal() and wait @@ -159,7 +159,7 @@ // Factory method for creating a new worker context for the thread. // Called on the worker thread. - virtual WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) = 0; + virtual WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) = 0; // Returns true when this WorkerThread owns the associated // WorkerBackingThread exclusively. If this function returns true, the @@ -193,7 +193,7 @@ void terminateInternal(TerminationMode); void forciblyTerminateExecution(); - void initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>); + void initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData>); void prepareForShutdownOnWorkerThread(); void performShutdownOnWorkerThread(); void performTaskOnWorkerThread(std::unique_ptr<ExecutionContextTask>, bool isInstrumented); @@ -209,8 +209,8 @@ long long m_forceTerminationDelayInMs; - std::unique_ptr<InspectorTaskRunner> m_inspectorTaskRunner; - std::unique_ptr<WorkerMicrotaskRunner> m_microtaskRunner; + OwnPtr<InspectorTaskRunner> m_inspectorTaskRunner; + OwnPtr<WorkerMicrotaskRunner> m_microtaskRunner; RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; WorkerReportingProxy& m_workerReportingProxy; @@ -223,14 +223,14 @@ Persistent<WorkerGlobalScope> m_workerGlobalScope; // Signaled when the thread starts termination on the main thread. - std::unique_ptr<WaitableEvent> m_terminationEvent; + OwnPtr<WaitableEvent> m_terminationEvent; // Signaled when the thread completes termination on the worker thread. - std::unique_ptr<WaitableEvent> m_shutdownEvent; + OwnPtr<WaitableEvent> m_shutdownEvent; // Scheduled when termination starts with TerminationMode::Force, and // cancelled when the worker thread is gracefully shut down. - std::unique_ptr<ForceTerminationTask> m_scheduledForceTerminationTask; + OwnPtr<ForceTerminationTask> m_scheduledForceTerminationTask; Persistent<WorkerThreadLifecycleContext> m_workerThreadLifecycleContext; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp index 659d28b..e9b767ca 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp
@@ -31,12 +31,10 @@ #include "core/workers/WorkerThreadStartupData.h" #include "platform/network/ContentSecurityPolicyParsers.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions) +WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions) : m_scriptURL(scriptURL.copy()) , m_userAgent(userAgent.isolatedCopy()) , m_sourceCode(sourceCode.isolatedCopy()) @@ -47,7 +45,7 @@ , m_addressSpace(addressSpace) , m_v8CacheOptions(v8CacheOptions) { - m_contentSecurityPolicyHeaders = wrapUnique(new Vector<CSPHeaderAndType>()); + m_contentSecurityPolicyHeaders = adoptPtr(new Vector<CSPHeaderAndType>()); if (contentSecurityPolicyHeaders) { for (const auto& header : *contentSecurityPolicyHeaders) { CSPHeaderAndType copiedHeader(header.first.isolatedCopy(), header.second);
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h index c26db13..fb5fad7 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h +++ b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h
@@ -41,8 +41,6 @@ #include "public/platform/WebAddressSpace.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -52,9 +50,9 @@ WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); USING_FAST_MALLOC(WorkerThreadStartupData); public: - static std::unique_ptr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions = V8CacheOptionsDefault) + static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions = V8CacheOptionsDefault) { - return wrapUnique(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, std::move(cachedMetaData), startMode, contentSecurityPolicyHeaders, starterOrigin, workerClients, addressSpace, originTrialTokens, v8CacheOptions)); + return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, std::move(cachedMetaData), startMode, contentSecurityPolicyHeaders, starterOrigin, workerClients, addressSpace, originTrialTokens, v8CacheOptions)); } ~WorkerThreadStartupData(); @@ -62,9 +60,9 @@ KURL m_scriptURL; String m_userAgent; String m_sourceCode; - std::unique_ptr<Vector<char>> m_cachedMetaData; + OwnPtr<Vector<char>> m_cachedMetaData; WorkerThreadStartMode m_startMode; - std::unique_ptr<Vector<CSPHeaderAndType>> m_contentSecurityPolicyHeaders; + OwnPtr<Vector<CSPHeaderAndType>> m_contentSecurityPolicyHeaders; std::unique_ptr<Vector<String>> m_originTrialTokens; @@ -77,7 +75,7 @@ // // See SecurityOrigin::transferPrivilegesFrom() for details on what // privileges are transferred. - std::unique_ptr<SecurityOrigin::PrivilegeData> m_starterOriginPrivilegeData; + OwnPtr<SecurityOrigin::PrivilegeData> m_starterOriginPrivilegeData; // This object is created and initialized on the thread creating // a new worker context, but ownership of it and this WorkerThreadStartupData @@ -94,7 +92,7 @@ V8CacheOptions m_v8CacheOptions; private: - WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin*, WorkerClients*, WebAddressSpace, const Vector<String>* originTrialTokens, V8CacheOptions); + WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin*, WorkerClients*, WebAddressSpace, const Vector<String>* originTrialTokens, V8CacheOptions); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp index e1c372d..3552cf9 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -8,8 +8,6 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> using testing::_; using testing::AtMost; @@ -20,10 +18,10 @@ public: void SetUp() override { - m_mockWorkerLoaderProxyProvider = wrapUnique(new MockWorkerLoaderProxyProvider()); - m_mockWorkerReportingProxy = wrapUnique(new MockWorkerReportingProxy()); + m_mockWorkerLoaderProxyProvider = adoptPtr(new MockWorkerLoaderProxyProvider()); + m_mockWorkerReportingProxy = adoptPtr(new MockWorkerReportingProxy()); m_securityOrigin = SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); - m_workerThread = wrapUnique(new WorkerThreadForTest( + m_workerThread = adoptPtr(new WorkerThreadForTest( m_mockWorkerLoaderProxyProvider.get(), *m_mockWorkerReportingProxy)); m_mockWorkerThreadLifecycleObserver = new MockWorkerThreadLifecycleObserver(m_workerThread->getWorkerThreadLifecycleContext()); @@ -85,9 +83,9 @@ } RefPtr<SecurityOrigin> m_securityOrigin; - std::unique_ptr<MockWorkerLoaderProxyProvider> m_mockWorkerLoaderProxyProvider; - std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; - std::unique_ptr<WorkerThreadForTest> m_workerThread; + OwnPtr<MockWorkerLoaderProxyProvider> m_mockWorkerLoaderProxyProvider; + OwnPtr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; + OwnPtr<WorkerThreadForTest> m_workerThread; Persistent<MockWorkerThreadLifecycleObserver> m_mockWorkerThreadLifecycleObserver; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h index bd35df2..3513c64 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
@@ -25,9 +25,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "wtf/CurrentTime.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> #include <v8.h> namespace blink { @@ -55,7 +55,7 @@ ~MockWorkerReportingProxy() override { } MOCK_METHOD2(reportExceptionMock, void(const String& errorMessage, SourceLocation*)); - void reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) + void reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) { reportExceptionMock(errorMessage, location.get()); } @@ -86,7 +86,7 @@ WorkerReportingProxy& mockWorkerReportingProxy) : WorkerThread(WorkerLoaderProxy::create(mockWorkerLoaderProxyProvider), mockWorkerReportingProxy) , m_workerBackingThread(WorkerBackingThread::createForTest("Test thread")) - , m_scriptLoadedEvent(wrapUnique(new WaitableEvent())) + , m_scriptLoadedEvent(adoptPtr(new WaitableEvent())) { } @@ -94,7 +94,7 @@ WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } - WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; void waitUntilScriptLoaded() { @@ -108,7 +108,7 @@ void startWithSourceCode(SecurityOrigin* securityOrigin, const String& source) { - std::unique_ptr<Vector<CSPHeaderAndType>> headers = wrapUnique(new Vector<CSPHeaderAndType>()); + OwnPtr<Vector<CSPHeaderAndType>> headers = adoptPtr(new Vector<CSPHeaderAndType>()); CSPHeaderAndType headerAndType("contentSecurityPolicy", ContentSecurityPolicyHeaderTypeReport); headers->append(headerAndType); @@ -130,19 +130,19 @@ void waitForInit() { - std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WaitableEvent::signal, AllowCrossThreadAccess(completionEvent.get()))); completionEvent->wait(); } private: - std::unique_ptr<WorkerBackingThread> m_workerBackingThread; - std::unique_ptr<WaitableEvent> m_scriptLoadedEvent; + OwnPtr<WorkerBackingThread> m_workerBackingThread; + OwnPtr<WaitableEvent> m_scriptLoadedEvent; }; class FakeWorkerGlobalScope : public WorkerGlobalScope { public: - FakeWorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThreadForTest* thread, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) + FakeWorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThreadForTest* thread, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, monotonicallyIncreasingTime(), std::move(starterOriginPrivilegeData), workerClients) , m_thread(thread) { @@ -163,7 +163,7 @@ return EventTargetNames::DedicatedWorkerGlobalScope; } - void logExceptionToConsole(const String&, std::unique_ptr<SourceLocation>) override + void logExceptionToConsole(const String&, PassOwnPtr<SourceLocation>) override { } @@ -171,7 +171,7 @@ WorkerThreadForTest* m_thread; }; -inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) +inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) { return new FakeWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, this, std::move(startupData->m_starterOriginPrivilegeData), std::move(startupData->m_workerClients)); }
diff --git a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp index 9a5d5da2..e6cc221 100644 --- a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp
@@ -8,7 +8,6 @@ #include "bindings/core/v8/WorkerOrWorkletScriptController.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/MainThreadDebugger.h" -#include <memory> namespace blink { @@ -69,7 +68,7 @@ InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); } -void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) { ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)); addConsoleMessage(consoleMessage);
diff --git a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h index c9693716..a89c07f 100644 --- a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h
@@ -13,7 +13,6 @@ #include "core/inspector/ConsoleMessage.h" #include "core/workers/WorkerOrWorkletGlobalScope.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -55,7 +54,7 @@ } void reportBlockedScriptExecutionToInspector(const String& directiveText) final; - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) final; + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) final; DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/xml/XPathParser.cpp b/third_party/WebKit/Source/core/xml/XPathParser.cpp index 3d2a055c..bd9e093 100644 --- a/third_party/WebKit/Source/core/xml/XPathParser.cpp +++ b/third_party/WebKit/Source/core/xml/XPathParser.cpp
@@ -33,7 +33,6 @@ #include "core/xml/XPathEvaluator.h" #include "core/xml/XPathNSResolver.h" #include "core/xml/XPathPath.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringHash.h" @@ -501,7 +500,7 @@ ASSERT(!m_strings.contains(s)); - m_strings.add(wrapUnique(s)); + m_strings.add(adoptPtr(s)); } void Parser::deleteString(String* s)
diff --git a/third_party/WebKit/Source/core/xml/XPathParser.h b/third_party/WebKit/Source/core/xml/XPathParser.h index dcf7aa8..7e9228a 100644 --- a/third_party/WebKit/Source/core/xml/XPathParser.h +++ b/third_party/WebKit/Source/core/xml/XPathParser.h
@@ -30,7 +30,6 @@ #include "core/xml/XPathPredicate.h" #include "core/xml/XPathStep.h" #include "wtf/Allocator.h" -#include <memory> namespace blink { @@ -109,7 +108,7 @@ int m_lastTokenType; Member<XPathNSResolver> m_resolver; - HashSet<std::unique_ptr<String>> m_strings; + HashSet<OwnPtr<String>> m_strings; }; } // namespace XPath
diff --git a/third_party/WebKit/Source/core/xml/XSLImportRule.h b/third_party/WebKit/Source/core/xml/XSLImportRule.h index 1cc23b6..349166b 100644 --- a/third_party/WebKit/Source/core/xml/XSLImportRule.h +++ b/third_party/WebKit/Source/core/xml/XSLImportRule.h
@@ -25,6 +25,7 @@ #include "core/xml/XSLStyleSheet.h" #include "platform/RuntimeEnabledFeatures.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index cb1c994..a8511a0 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -67,7 +67,6 @@ #include "platform/network/ResourceResponse.h" #include "platform/v8_inspector/public/ConsoleTypes.h" #include "platform/weborigin/SecurityOrigin.h" -#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/TemporaryChange.h" #include "wtf/Threading.h" @@ -77,7 +76,6 @@ #include <libxml/parser.h> #include <libxml/parserInternals.h> #include <libxslt/xslt.h> -#include <memory> namespace blink { @@ -962,7 +960,7 @@ if (m_parserPaused) { m_scriptStartPosition = textPosition(); - m_pendingCallbacks.append(wrapUnique(new PendingStartElementNSCallback(localName, prefix, uri, nbNamespaces, libxmlNamespaces, + m_pendingCallbacks.append(adoptPtr(new PendingStartElementNSCallback(localName, prefix, uri, nbNamespaces, libxmlNamespaces, nbAttributes, nbDefaulted, libxmlAttributes))); return; } @@ -1041,7 +1039,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingEndElementNSCallback(m_scriptStartPosition))); + m_pendingCallbacks.append(adoptPtr(new PendingEndElementNSCallback(m_scriptStartPosition))); return; } @@ -1123,7 +1121,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingCharactersCallback(chars, length))); + m_pendingCallbacks.append(adoptPtr(new PendingCharactersCallback(chars, length))); return; } @@ -1140,7 +1138,7 @@ vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args); if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingErrorCallback(type, reinterpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); + m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinterpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); return; } @@ -1153,7 +1151,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingProcessingInstructionCallback(target, data))); + m_pendingCallbacks.append(adoptPtr(new PendingProcessingInstructionCallback(target, data))); return; } @@ -1192,7 +1190,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingCDATABlockCallback(text))); + m_pendingCallbacks.append(adoptPtr(new PendingCDATABlockCallback(text))); return; } @@ -1208,7 +1206,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingCommentCallback(text))); + m_pendingCallbacks.append(adoptPtr(new PendingCommentCallback(text))); return; } @@ -1253,7 +1251,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(wrapUnique(new PendingInternalSubsetCallback(name, externalID, systemID))); + m_pendingCallbacks.append(adoptPtr(new PendingInternalSubsetCallback(name, externalID, systemID))); return; } @@ -1491,7 +1489,7 @@ V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()->frame(), document(), noStyleMessage); } else if (m_sawXSLTransform) { xmlDocPtr doc = xmlDocPtrForString(document(), m_originalSourceForTransform.toString(), document()->url().getString()); - document()->setTransformSource(wrapUnique(new TransformSource(doc))); + document()->setTransformSource(adoptPtr(new TransformSource(doc))); DocumentParser::stopParsing(); } } @@ -1542,7 +1540,7 @@ // First, execute any pending callbacks while (!m_pendingCallbacks.isEmpty()) { - std::unique_ptr<PendingCallback> callback = m_pendingCallbacks.takeFirst(); + OwnPtr<PendingCallback> callback = m_pendingCallbacks.takeFirst(); callback->call(this); // A callback paused the parser
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h index 8a21eb1..b8b84bd 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h
@@ -33,11 +33,11 @@ #include "platform/heap/Handle.h" #include "platform/text/SegmentedString.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" #include <libxml/tree.h> -#include <memory> namespace blink { @@ -165,7 +165,7 @@ xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; } RefPtr<XMLParserContext> m_context; - Deque<std::unique_ptr<PendingCallback>> m_pendingCallbacks; + Deque<OwnPtr<PendingCallback>> m_pendingCallbacks; Vector<xmlChar> m_bufferedText; Member<ContainerNode> m_currentNode;
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index 10c60eda8..eab81df 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -77,7 +77,6 @@ #include "wtf/Assertions.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" -#include <memory> namespace blink { @@ -335,7 +334,7 @@ // copying the bytes between the browser and the renderer. m_responseBlob = Blob::create(createBlobDataHandleFromResponse()); } else { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); size_t size = 0; if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { size = m_binaryResponseBuilder->size(); @@ -1024,7 +1023,7 @@ // If, window.onload contains open() and send(), m_loader will be set to // non 0 value. So, we cannot continue the outer open(). In such case, // just abort the outer open() by returning false. - std::unique_ptr<ThreadableLoader> loader = std::move(m_loader); + OwnPtr<ThreadableLoader> loader = std::move(m_loader); loader->cancel(); // If abort() called internalAbort() and a nested open() ended up @@ -1437,7 +1436,7 @@ PassRefPtr<BlobDataHandle> XMLHttpRequest::createBlobDataHandleFromResponse() { ASSERT(m_downloadingToFile); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); String filePath = m_response.downloadedFilePath(); // If we errored out or got no data, we return an empty handle. if (!filePath.isEmpty() && m_lengthDownloadedToFile) { @@ -1510,7 +1509,7 @@ } } -void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); WTF_LOG(Network, "XMLHttpRequest %p didReceiveResponse(%lu)", this, identifier); @@ -1545,7 +1544,7 @@ m_responseDocumentParser->appendBytes(data, len); } -std::unique_ptr<TextResourceDecoder> XMLHttpRequest::createDecoder() const +PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const { if (m_responseTypeCode == ResponseTypeJSON) return TextResourceDecoder::create("application/json", "UTF-8"); @@ -1555,7 +1554,7 @@ // allow TextResourceDecoder to look inside the m_response if it's XML or HTML if (responseIsXML()) { - std::unique_ptr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); + OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); // Don't stop on encoding errors, unlike it is done for other kinds // of XML resources. This matches the behavior of previous WebKit // versions, Firefox and Opera.
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h index 453404e..4b33c0e8 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
@@ -37,12 +37,13 @@ #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -156,7 +157,7 @@ SecurityOrigin* getSecurityOrigin() const; void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - void didReceiveResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didReceiveData(const char* data, unsigned dataLength) override; // When responseType is set to "blob", didDownloadData() is called instead // of didReceiveData(). @@ -192,7 +193,7 @@ bool responseIsXML() const; bool responseIsHTML() const; - std::unique_ptr<TextResourceDecoder> createDecoder() const; + PassOwnPtr<TextResourceDecoder> createDecoder() const; void initResponseDocument(); void parseDocumentChunk(const char* data, unsigned dataLength); @@ -264,13 +265,13 @@ Member<Blob> m_responseBlob; Member<Stream> m_responseLegacyStream; - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; State m_state; ResourceResponse m_response; String m_finalResponseCharset; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; ScriptString m_responseText; Member<Document> m_responseDocument;
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h index 293fbb48..3d30862 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h
@@ -31,6 +31,7 @@ #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/EventModulesFactory.h b/third_party/WebKit/Source/modules/EventModulesFactory.h index cf5aa10..e4691214 100644 --- a/third_party/WebKit/Source/modules/EventModulesFactory.h +++ b/third_party/WebKit/Source/modules/EventModulesFactory.h
@@ -8,9 +8,7 @@ #include "core/events/EventFactory.h" #include "platform/heap/Handle.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -18,9 +16,9 @@ class EventModulesFactory final : public EventFactoryBase { public: - static std::unique_ptr<EventModulesFactory> create() + static PassOwnPtr<EventModulesFactory> create() { - return wrapUnique(new EventModulesFactory()); + return adoptPtr(new EventModulesFactory()); } Event* create(ExecutionContext*, const String& eventType) override;
diff --git a/third_party/WebKit/Source/modules/ModulesInitializer.cpp b/third_party/WebKit/Source/modules/ModulesInitializer.cpp index f83ea2ba..b04f7fca 100644 --- a/third_party/WebKit/Source/modules/ModulesInitializer.cpp +++ b/third_party/WebKit/Source/modules/ModulesInitializer.cpp
@@ -24,7 +24,6 @@ #include "modules/webdatabase/DatabaseManager.h" #include "modules/webgl/WebGL2RenderingContext.h" #include "modules/webgl/WebGLRenderingContext.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -50,14 +49,14 @@ CoreInitializer::initialize(); // Canvas context types must be registered with the HTMLCanvasElement. - HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new CanvasRenderingContext2D::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGLRenderingContext::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGL2RenderingContext::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new ImageBitmapRenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRenderingContext2D::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2RenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new ImageBitmapRenderingContext::Factory())); // OffscreenCanvas context types must be registered with the OffscreenCanvas. - OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new OffscreenCanvasRenderingContext2D::Factory())); - OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new WebGLRenderingContext::Factory())); + OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new OffscreenCanvasRenderingContext2D::Factory())); + OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new WebGLRenderingContext::Factory())); ASSERT(isInitialized()); }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp index 0aff29dd..04665908 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -77,7 +77,6 @@ #include "modules/accessibility/AXTableHeaderContainer.h" #include "modules/accessibility/AXTableRow.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -737,7 +736,7 @@ HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id); if (!owners) { owners = new HashSet<AXID>(); - m_idToAriaOwnersMapping.set(id, wrapUnique(owners)); + m_idToAriaOwnersMapping.set(id, adoptPtr(owners)); } owners->add(owner->axObjectID()); }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h index 166ade3..a8ed70a 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h
@@ -36,7 +36,6 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include <memory> namespace blink { @@ -228,7 +227,7 @@ // want to own that ID. This is *unvalidated*, it includes possible duplicates. // This is used so that when an element with an ID is added to the tree or changes // its ID, we can quickly determine if it affects an aria-owns relationship. - HashMap<String, std::unique_ptr<HashSet<AXID>>> m_idToAriaOwnersMapping; + HashMap<String, OwnPtr<HashSet<AXID>>> m_idToAriaOwnersMapping; Timer<AXObjectCacheImpl> m_notificationPostTimer; HeapVector<std::pair<Member<AXObject>, AXNotification>> m_notificationsToPost;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp index dd49114b..c3afc19 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
@@ -8,7 +8,6 @@ #include "core/dom/Element.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; void AXObjectTest::SetUp()
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp index 78b6bf0..f0ad546 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -15,7 +15,6 @@ #include "modules/accessibility/AXObjectCacheImpl.h" #include "modules/accessibility/InspectorTypeBuilderHelper.h" #include "platform/inspector_protocol/Values.h" -#include <memory> namespace blink { @@ -382,7 +381,7 @@ return; Document& document = node->document(); - std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document); + OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document); AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache->get()); AXObject* axObject = cacheImpl->getOrCreate(node); if (!axObject || axObject->accessibilityIsIgnored()) {
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h index 6a808c8..bed0ecd6 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h
@@ -8,6 +8,7 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Accessibility.h" #include "modules/ModulesExport.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h b/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h index ba5e6cf..d1d475d 100644 --- a/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h +++ b/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h
@@ -8,6 +8,7 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "public/platform/modules/app_banner/WebAppBannerPromptResult.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h b/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h index 7d824bd..616b823 100644 --- a/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h +++ b/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h
@@ -8,7 +8,7 @@ #include "modules/ModulesExport.h" #include "platform/Supplementable.h" #include "public/platform/WebSetSinkIdCallbacks.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -22,7 +22,7 @@ virtual ~AudioOutputDeviceClient() {} // Checks that a given sink exists and has permissions to be used from the origin of the current frame. - virtual void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks>) = 0; + virtual void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks>) = 0; // Supplement requirements. static AudioOutputDeviceClient* from(ExecutionContext*);
diff --git a/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp b/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp index 6d94fe7..f231e65 100644 --- a/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp +++ b/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp
@@ -11,8 +11,6 @@ #include "modules/audio_output_devices/AudioOutputDeviceClient.h" #include "modules/audio_output_devices/SetSinkIdCallbacks.h" #include "public/platform/WebSecurityOrigin.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -61,11 +59,11 @@ { ExecutionContext* context = getExecutionContext(); ASSERT(context && context->isDocument()); - std::unique_ptr<SetSinkIdCallbacks> callbacks = wrapUnique(new SetSinkIdCallbacks(this, *m_element, m_sinkId)); + OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this, *m_element, m_sinkId)); WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); if (webMediaPlayer) { - // Using release() to transfer ownership because |webMediaPlayer| is a platform object that takes raw pointers - webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.release()); + // Using leakPtr() to transfer ownership because |webMediaPlayer| is a platform object that takes raw pointers + webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.leakPtr()); } else { if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(context)) { client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp b/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp index b25dae94..9b6e3e7 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp +++ b/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp
@@ -7,8 +7,8 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/background_sync/SyncError.h" #include "modules/serviceworkers/ServiceWorkerRegistration.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -30,7 +30,7 @@ return; } - std::unique_ptr<WebSyncRegistration> registration = wrapUnique(webSyncRegistration.release()); + OwnPtr<WebSyncRegistration> registration = adoptPtr(webSyncRegistration.release()); if (!registration) { m_resolver->resolve(v8::Null(m_resolver->getScriptState()->isolate())); return;
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncError.cpp b/third_party/WebKit/Source/modules/background_sync/SyncError.cpp index 4cefecf..e5dfc82 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncError.cpp +++ b/third_party/WebKit/Source/modules/background_sync/SyncError.cpp
@@ -6,6 +6,7 @@ #include "core/dom/DOMException.h" #include "core/dom/ExceptionCode.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp index 0483c6a..23653f1 100644 --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp
@@ -8,6 +8,7 @@ #include "public/platform/Platform.h" #include "public/platform/ServiceRegistry.h" #include "wtf/Assertions.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h index 5bf039f..134b484 100644 --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h
@@ -10,6 +10,7 @@ #include "modules/ModulesExport.h" #include "modules/battery/BatteryManager.h" #include "modules/battery/battery_status.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp index e717ea2d..d3a2fe6e 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
@@ -13,11 +13,10 @@ #include "modules/bluetooth/BluetoothRemoteGATTServer.h" #include "modules/bluetooth/BluetoothSupplement.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" -#include <memory> namespace blink { -BluetoothDevice::BluetoothDevice(ExecutionContext* context, std::unique_ptr<WebBluetoothDeviceInit> webDevice) +BluetoothDevice::BluetoothDevice(ExecutionContext* context, PassOwnPtr<WebBluetoothDeviceInit> webDevice) : ActiveDOMObject(context) , m_webDevice(std::move(webDevice)) , m_gatt(BluetoothRemoteGATTServer::create(this)) @@ -26,7 +25,7 @@ ThreadState::current()->registerPreFinalizer(this); } -BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebBluetoothDeviceInit> webDevice) +BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebBluetoothDeviceInit> webDevice) { ASSERT(webDevice); BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext(), std::move(webDevice));
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h index 5b33bf21..6949310a 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
@@ -12,8 +12,9 @@ #include "platform/heap/Heap.h" #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" #include "public/platform/modules/bluetooth/WebBluetoothDeviceInit.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -35,11 +36,11 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(BluetoothDevice); public: - BluetoothDevice(ExecutionContext*, std::unique_ptr<WebBluetoothDeviceInit>); + BluetoothDevice(ExecutionContext*, PassOwnPtr<WebBluetoothDeviceInit>); // Interface required by CallbackPromiseAdapter: - using WebType = std::unique_ptr<WebBluetoothDeviceInit>; - static BluetoothDevice* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothDeviceInit>); + using WebType = OwnPtr<WebBluetoothDeviceInit>; + static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothDeviceInit>); // We should disconnect from the device in all of the following cases: // 1. When the object gets GarbageCollected e.g. it went out of scope. @@ -80,7 +81,7 @@ DEFINE_ATTRIBUTE_EVENT_LISTENER(gattserverdisconnected); private: - std::unique_ptr<WebBluetoothDeviceInit> m_webDevice; + OwnPtr<WebBluetoothDeviceInit> m_webDevice; Member<BluetoothRemoteGATTServer> m_gatt; };
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp index 91df251..04b4311 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
@@ -16,7 +16,6 @@ #include "modules/bluetooth/BluetoothError.h" #include "modules/bluetooth/BluetoothSupplement.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" -#include <memory> namespace blink { @@ -31,7 +30,7 @@ } // anonymous namespace -BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic(ExecutionContext* context, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) +BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic(ExecutionContext* context, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) : ActiveDOMObject(context) , m_webCharacteristic(std::move(webCharacteristic)) , m_stopped(false) @@ -41,7 +40,7 @@ ThreadState::current()->registerPreFinalizer(this); } -BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) +BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) { if (!webCharacteristic) { return nullptr;
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h index 3079ec2..efcc800 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h
@@ -13,8 +13,9 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristicInit.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -40,11 +41,11 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); public: - explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>); + explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit>); // Interface required by CallbackPromiseAdapter. - using WebType = std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>; - static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>); + using WebType = OwnPtr<WebBluetoothRemoteGATTCharacteristicInit>; + static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit>); // Save value. void setValue(DOMDataView*); @@ -87,7 +88,7 @@ void addedEventListener(const AtomicString& eventType, RegisteredEventListener&) override; private: - std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; + OwnPtr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; bool m_stopped; Member<BluetoothCharacteristicProperties> m_properties; Member<DOMDataView> m_value;
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp index 8b134e79..a57e6e1 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -15,6 +15,7 @@ #include "modules/bluetooth/BluetoothSupplement.h" #include "modules/bluetooth/BluetoothUUID.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" +#include "wtf/OwnPtr.h" namespace blink { @@ -96,14 +97,14 @@ if (m_quantity == mojom::WebBluetoothGATTQueryQuantity::SINGLE) { DCHECK_EQ(1u, webServices.size()); - m_resolver->resolve(BluetoothRemoteGATTService::take(m_resolver, wrapUnique(webServices[0]))); + m_resolver->resolve(BluetoothRemoteGATTService::take(m_resolver, adoptPtr(webServices[0]))); return; } HeapVector<Member<BluetoothRemoteGATTService>> services; services.reserveInitialCapacity(webServices.size()); for (WebBluetoothRemoteGATTService* webService : webServices) { - services.append(BluetoothRemoteGATTService::take(m_resolver, wrapUnique(webService))); + services.append(BluetoothRemoteGATTService::take(m_resolver, adoptPtr(webService))); } m_resolver->resolve(services); }
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h index b29f68b..657eadb 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
@@ -10,6 +10,8 @@ #include "modules/bluetooth/BluetoothDevice.h" #include "platform/heap/Heap.h" #include "public/platform/modules/bluetooth/WebBluetoothError.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp index ed200dd2..250e55cf 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
@@ -15,17 +15,15 @@ #include "modules/bluetooth/BluetoothSupplement.h" #include "modules/bluetooth/BluetoothUUID.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -BluetoothRemoteGATTService::BluetoothRemoteGATTService(std::unique_ptr<WebBluetoothRemoteGATTService> webService) +BluetoothRemoteGATTService::BluetoothRemoteGATTService(PassOwnPtr<WebBluetoothRemoteGATTService> webService) : m_webService(std::move(webService)) { } -BluetoothRemoteGATTService* BluetoothRemoteGATTService::take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTService> webService) +BluetoothRemoteGATTService* BluetoothRemoteGATTService::take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTService> webService) { if (!webService) { return nullptr; @@ -48,14 +46,14 @@ if (m_quantity == mojom::WebBluetoothGATTQueryQuantity::SINGLE) { DCHECK_EQ(1u, webCharacteristics.size()); - m_resolver->resolve(BluetoothRemoteGATTCharacteristic::take(m_resolver, wrapUnique(webCharacteristics[0]))); + m_resolver->resolve(BluetoothRemoteGATTCharacteristic::take(m_resolver, adoptPtr(webCharacteristics[0]))); return; } HeapVector<Member<BluetoothRemoteGATTCharacteristic>> characteristics; characteristics.reserveInitialCapacity(webCharacteristics.size()); for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : webCharacteristics) { - characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_resolver, wrapUnique(webCharacteristic))); + characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_resolver, adoptPtr(webCharacteristic))); } m_resolver->resolve(characteristics); }
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h index 1f647c1..107c2ec 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h
@@ -10,8 +10,9 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h" #include "public/platform/modules/bluetooth/web_bluetooth.mojom.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -32,11 +33,11 @@ , public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - explicit BluetoothRemoteGATTService(std::unique_ptr<WebBluetoothRemoteGATTService>); + explicit BluetoothRemoteGATTService(PassOwnPtr<WebBluetoothRemoteGATTService>); // Interface required by CallbackPromiseAdapter: - using WebType = std::unique_ptr<WebBluetoothRemoteGATTService>; - static BluetoothRemoteGATTService* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTService>); + using WebType = OwnPtr<WebBluetoothRemoteGATTService>; + static BluetoothRemoteGATTService* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTService>); // Interface required by garbage collection. DEFINE_INLINE_TRACE() { } @@ -51,7 +52,7 @@ private: ScriptPromise getCharacteristicsImpl(ScriptState*, mojom::WebBluetoothGATTQueryQuantity, String characteristicUUID = String()); - std::unique_ptr<WebBluetoothRemoteGATTService> m_webService; + OwnPtr<WebBluetoothRemoteGATTService> m_webService; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/cachestorage/Cache.cpp b/third_party/WebKit/Source/modules/cachestorage/Cache.cpp index 3a3787ef..29bd687 100644 --- a/third_party/WebKit/Source/modules/cachestorage/Cache.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/Cache.cpp
@@ -23,6 +23,7 @@ #include "platform/Histogram.h" #include "platform/RuntimeEnabledFeatures.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h" + #include <memory> namespace blink { @@ -359,7 +360,7 @@ WebServiceWorkerResponse m_webResponse; }; -Cache* Cache::create(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCache> webCache) +Cache* Cache::create(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCache> webCache) { return new Cache(fetcher, std::move(webCache)); } @@ -471,7 +472,7 @@ return webQueryParams; } -Cache::Cache(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCache> webCache) +Cache::Cache(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCache> webCache) : m_scopedFetcher(fetcher) , m_webCache(std::move(webCache)) {
diff --git a/third_party/WebKit/Source/modules/cachestorage/Cache.h b/third_party/WebKit/Source/modules/cachestorage/Cache.h index 8357fe99..3ae67a6 100644 --- a/third_party/WebKit/Source/modules/cachestorage/Cache.h +++ b/third_party/WebKit/Source/modules/cachestorage/Cache.h
@@ -14,9 +14,9 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -31,7 +31,7 @@ DEFINE_WRAPPERTYPEINFO(); WTF_MAKE_NONCOPYABLE(Cache); public: - static Cache* create(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCache>); + static Cache* create(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCache>); // From Cache.idl: ScriptPromise match(ScriptState*, const RequestInfo&, const CacheQueryOptions&, ExceptionState&); @@ -53,7 +53,7 @@ class BlobHandleCallbackForPut; class FetchResolvedForAdd; friend class FetchResolvedForAdd; - Cache(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCache>); + Cache(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCache>); ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOptions&); ScriptPromise matchAllImpl(ScriptState*); @@ -67,7 +67,7 @@ WebServiceWorkerCache* webCache() const; Member<GlobalFetch::ScopedFetcher> m_scopedFetcher; - std::unique_ptr<WebServiceWorkerCache> m_webCache; + OwnPtr<WebServiceWorkerCache> m_webCache; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp index 057bd46cc..f6152032 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp
@@ -15,8 +15,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -97,7 +95,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - Cache* cache = Cache::create(m_cacheStorage->m_scopedFetcher, wrapUnique(webCache.release())); + Cache* cache = Cache::create(m_cacheStorage->m_scopedFetcher, adoptPtr(webCache.release())); m_cacheStorage->m_nameToCacheMap.set(m_cacheName, cache); m_resolver->resolve(cache); m_resolver.clear(); @@ -218,7 +216,7 @@ CacheStorage* CacheStorage::create(GlobalFetch::ScopedFetcher* fetcher, WebServiceWorkerCacheStorage* webCacheStorage) { - return new CacheStorage(fetcher, wrapUnique(webCacheStorage)); + return new CacheStorage(fetcher, adoptPtr(webCacheStorage)); } ScriptPromise CacheStorage::open(ScriptState* scriptState, const String& cacheName, ExceptionState& exceptionState) @@ -327,7 +325,7 @@ return promise; } -CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCacheStorage> webCacheStorage) +CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCacheStorage> webCacheStorage) : m_scopedFetcher(fetcher) , m_webCacheStorage(std::move(webCacheStorage)) {
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h index 9a0d149d..29a4721 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h +++ b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h
@@ -15,7 +15,6 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -48,11 +47,11 @@ friend class WithCacheCallbacks; friend class DeleteCallbacks; - CacheStorage(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCacheStorage>); + CacheStorage(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCacheStorage>); ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOptions&); Member<GlobalFetch::ScopedFetcher> m_scopedFetcher; - std::unique_ptr<WebServiceWorkerCacheStorage> m_webCacheStorage; + OwnPtr<WebServiceWorkerCacheStorage> m_webCacheStorage; HeapHashMap<String, Member<Cache>> m_nameToCacheMap; };
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp index 0d39207..d2f723b2 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
@@ -24,9 +24,9 @@ #include "public/platform/WebURLResponse.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" + #include <algorithm> -#include <memory> #include <string> namespace blink { @@ -117,7 +117,7 @@ checkUrlIfProvided(webRequest.url()); checkQueryParamsIfProvided(queryParams); - std::unique_ptr<CacheMatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheMatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onError(m_error); } @@ -127,7 +127,7 @@ checkUrlIfProvided(webRequest.url()); checkQueryParamsIfProvided(queryParams); - std::unique_ptr<CacheWithResponsesCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheWithResponsesCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onError(m_error); } @@ -139,7 +139,7 @@ checkQueryParamsIfProvided(queryParams); } - std::unique_ptr<CacheWithRequestsCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheWithRequestsCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onError(m_error); } @@ -148,7 +148,7 @@ m_lastErrorWebCacheMethodCalled = "dispatchBatch"; checkBatchOperationsIfProvided(batchOperations); - std::unique_ptr<CacheBatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheBatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onError(m_error); } @@ -213,7 +213,7 @@ Cache* createCache(ScopedFetcherForTests* fetcher, WebServiceWorkerCache* webCache) { - return Cache::create(fetcher, wrapUnique(webCache)); + return Cache::create(fetcher, adoptPtr(webCache)); } ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } @@ -306,7 +306,7 @@ }; // Lifetime is that of the text fixture. - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; NonThrowableExceptionState m_exceptionState; }; @@ -479,7 +479,7 @@ // From WebServiceWorkerCache: void dispatchMatch(CacheMatchCallbacks* callbacks, const WebServiceWorkerRequest& webRequest, const QueryParams& queryParams) override { - std::unique_ptr<CacheMatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheMatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onSuccess(m_response); } @@ -515,7 +515,7 @@ void dispatchKeys(CacheWithRequestsCallbacks* callbacks, const WebServiceWorkerRequest* webRequest, const QueryParams& queryParams) override { - std::unique_ptr<CacheWithRequestsCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheWithRequestsCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onSuccess(m_requests); } @@ -560,13 +560,13 @@ void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, const WebServiceWorkerRequest& webRequest, const QueryParams& queryParams) override { - std::unique_ptr<CacheWithResponsesCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheWithResponsesCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onSuccess(m_responses); } void dispatchBatch(CacheBatchCallbacks* callbacks, const WebVector<BatchOperation>& batchOperations) override { - std::unique_ptr<CacheBatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); + OwnPtr<CacheBatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); return callbacks->onSuccess(); }
diff --git a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp index a509375..ab8ea03 100644 --- a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp
@@ -20,12 +20,13 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringBuilder.h" + #include <algorithm> #include <memory> @@ -63,7 +64,7 @@ return true; } -std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString* errorString, const String& securityOrigin) +PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString* errorString, const String& securityOrigin) { RefPtr<SecurityOrigin> secOrigin = SecurityOrigin::createFromString(securityOrigin); @@ -73,13 +74,13 @@ return nullptr; } - std::unique_ptr<WebServiceWorkerCacheStorage> cache = wrapUnique(Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); + OwnPtr<WebServiceWorkerCacheStorage> cache = adoptPtr(Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); if (!cache) *errorString = "Could not find cache storage."; return cache; } -std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId(ErrorString* errorString, const String& cacheId, String* cacheName) +PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId(ErrorString* errorString, const String& cacheId, String* cacheName) { String securityOrigin; if (!parseCacheId(errorString, cacheId, &securityOrigin, cacheName)) { @@ -248,7 +249,7 @@ WTF_MAKE_NONCOPYABLE(GetCacheKeysForRequestData); public: - GetCacheKeysForRequestData(const DataRequestParams& params, std::unique_ptr<WebServiceWorkerCache> cache, std::unique_ptr<RequestEntriesCallback> callback) + GetCacheKeysForRequestData(const DataRequestParams& params, PassOwnPtr<WebServiceWorkerCache> cache, std::unique_ptr<RequestEntriesCallback> callback) : m_params(params) , m_cache(std::move(cache)) , m_callback(std::move(callback)) @@ -280,7 +281,7 @@ private: DataRequestParams m_params; - std::unique_ptr<WebServiceWorkerCache> m_cache; + OwnPtr<WebServiceWorkerCache> m_cache; std::unique_ptr<RequestEntriesCallback> m_callback; }; @@ -298,7 +299,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override { - auto* cacheRequest = new GetCacheKeysForRequestData(m_params, wrapUnique(cache.release()), std::move(m_callback)); + auto* cacheRequest = new GetCacheKeysForRequestData(m_params, adoptPtr(cache.release()), std::move(m_callback)); cacheRequest->cache()->dispatchKeys(cacheRequest, nullptr, WebServiceWorkerCache::QueryParams()); } @@ -417,7 +418,7 @@ return; } - std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, securityOrigin); + OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, securityOrigin); if (!cache) { callback->sendFailure(*errorString); return; @@ -428,7 +429,7 @@ void InspectorCacheStorageAgent::requestEntries(ErrorString* errorString, const String& cacheId, int skipCount, int pageSize, std::unique_ptr<RequestEntriesCallback> callback) { String cacheName; - std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return; @@ -443,7 +444,7 @@ void InspectorCacheStorageAgent::deleteCache(ErrorString* errorString, const String& cacheId, std::unique_ptr<DeleteCacheCallback> callback) { String cacheName; - std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return; @@ -454,7 +455,7 @@ void InspectorCacheStorageAgent::deleteEntry(ErrorString* errorString, const String& cacheId, const String& request, std::unique_ptr<DeleteEntryCallback> callback) { String cacheName; - std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return;
diff --git a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h index 868a0b0..7b16352 100644 --- a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h +++ b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h
@@ -8,6 +8,7 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/CacheStorage.h" #include "modules/ModulesExport.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp index 9ed184d..7ddd64cf 100644 --- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp +++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
@@ -12,7 +12,6 @@ #include "core/offscreencanvas/OffscreenCanvas.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -22,7 +21,7 @@ { Page::PageClients pageClients; fillWithEmptyClients(pageClients); - std::unique_ptr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); + OwnPtr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); Persistent<HTMLDocument> m_document = toHTMLDocument(&m_dummyPageHolder->document()); m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas></body>", ASSERT_NO_EXCEPTION); m_document->view()->updateAllLifecyclePhases();
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp index ba8009b..cab800506 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -62,6 +62,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImageFilter.h" #include "wtf/MathExtras.h" +#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/typed_arrays/ArrayBufferContents.h"
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp index 81889c2ac..a45f82dd6 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
@@ -20,7 +20,6 @@ #include "platform/graphics/UnacceleratedImageBufferSurface.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> using ::testing::Mock; @@ -39,7 +38,7 @@ void createContext(OpacityMode); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement;
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp index cff1f1b0..d0f57780 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
@@ -22,7 +22,6 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" -#include <memory> static const char defaultFont[] = "10px sans-serif"; static const char defaultFilter[] = "none"; @@ -352,7 +351,7 @@ SkDrawLooper* CanvasRenderingContext2DState::emptyDrawLooper() const { if (!m_emptyDrawLooper) { - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); m_emptyDrawLooper = drawLooperBuilder->detachDrawLooper(); } return m_emptyDrawLooper.get(); @@ -361,7 +360,7 @@ SkDrawLooper* CanvasRenderingContext2DState::shadowOnlyDrawLooper() const { if (!m_shadowOnlyDrawLooper) { - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(m_shadowOffset, m_shadowBlur, m_shadowColor, DrawLooperBuilder::ShadowIgnoresTransforms, DrawLooperBuilder::ShadowRespectsAlpha); m_shadowOnlyDrawLooper = drawLooperBuilder->detachDrawLooper(); } @@ -371,7 +370,7 @@ SkDrawLooper* CanvasRenderingContext2DState::shadowAndForegroundDrawLooper() const { if (!m_shadowAndForegroundDrawLooper) { - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(m_shadowOffset, m_shadowBlur, m_shadowColor, DrawLooperBuilder::ShadowIgnoresTransforms, DrawLooperBuilder::ShadowRespectsAlpha); drawLooperBuilder->addUnmodifiedContent(); m_shadowAndForegroundDrawLooper = drawLooperBuilder->detachDrawLooper();
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp index a33dbaf..dd38e5a4 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
@@ -23,8 +23,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PtrUtil.h" -#include <memory> using ::testing::Mock; @@ -90,7 +88,7 @@ void unrefCanvas(); private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement; Persistent<MemoryCache> m_globalMemoryCache; @@ -211,7 +209,7 @@ //============================================================================ #define TEST_OVERDRAW_SETUP(EXPECTED_OVERDRAWS) \ - std::unique_ptr<MockImageBufferSurfaceForOverwriteTesting> mockSurface = wrapUnique(new MockImageBufferSurfaceForOverwriteTesting(IntSize(10, 10), NonOpaque)); \ + OwnPtr<MockImageBufferSurfaceForOverwriteTesting> mockSurface = adoptPtr(new MockImageBufferSurfaceForOverwriteTesting(IntSize(10, 10), NonOpaque)); \ MockImageBufferSurfaceForOverwriteTesting* surfacePtr = mockSurface.get(); \ canvasElement().createImageBufferUsingSurfaceForTesting(std::move(mockSurface)); \ EXPECT_CALL(*surfacePtr, willOverwriteCanvas()).Times(EXPECTED_OVERDRAWS); \ @@ -263,13 +261,13 @@ ExpectFallback, ExpectNoFallback }; - static std::unique_ptr<MockSurfaceFactory> create(FallbackExpectation expectation) { return wrapUnique(new MockSurfaceFactory(expectation)); } + static PassOwnPtr<MockSurfaceFactory> create(FallbackExpectation expectation) { return adoptPtr(new MockSurfaceFactory(expectation)); } - std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode mode) override + PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode mode) override { EXPECT_EQ(ExpectFallback, m_expectation); m_didFallback = true; - return wrapUnique(new UnacceleratedImageBufferSurface(size, mode)); + return adoptPtr(new UnacceleratedImageBufferSurface(size, mode)); } ~MockSurfaceFactory() override @@ -409,7 +407,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionByDefault) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); EXPECT_FALSE(canvasElement().shouldBeDirectComposited()); @@ -418,7 +416,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderOverdrawLimit) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setGlobalAlpha(0.5f); // To prevent overdraw optimization @@ -432,7 +430,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverOverdrawLimit) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setGlobalAlpha(0.5f); // To prevent overdraw optimization @@ -446,7 +444,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderImageSizeRatioLimit) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); NonThrowableExceptionState exceptionState; @@ -454,7 +452,7 @@ EXPECT_FALSE(exceptionState.hadException()); HTMLCanvasElement* sourceCanvas = static_cast<HTMLCanvasElement*>(sourceCanvasElement); IntSize sourceSize(10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio); - std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); + OwnPtr<UnacceleratedImageBufferSurface> sourceSurface = adoptPtr(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); sourceCanvas->createImageBufferUsingSurfaceForTesting(std::move(sourceSurface)); const ImageBitmapOptions defaultOptions; @@ -470,7 +468,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverImageSizeRatioLimit) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); NonThrowableExceptionState exceptionState; @@ -478,7 +476,7 @@ EXPECT_FALSE(exceptionState.hadException()); HTMLCanvasElement* sourceCanvas = static_cast<HTMLCanvasElement*>(sourceCanvasElement); IntSize sourceSize(10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio + 1); - std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); + OwnPtr<UnacceleratedImageBufferSurface> sourceSurface = adoptPtr(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); sourceCanvas->createImageBufferUsingSurfaceForTesting(std::move(sourceSurface)); const ImageBitmapOptions defaultOptions; @@ -494,7 +492,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderExpensivePathPointCount) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -511,7 +509,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverExpensivePathPointCount) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -528,7 +526,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWhenPathIsConcave) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -548,7 +546,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionWithRectangleClip) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -562,7 +560,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWithComplexClip) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -583,7 +581,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWithBlurredShadow) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setShadowColor(String("red")); @@ -600,7 +598,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionWithSharpShadow) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setShadowColor(String("red")); @@ -613,7 +611,7 @@ TEST_F(CanvasRenderingContext2DTest, NoFallbackWithSmallState) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillRect(0, 0, 1, 1); // To have a non-empty dirty rect @@ -627,7 +625,7 @@ TEST_F(CanvasRenderingContext2DTest, FallbackWithLargeState) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillRect(0, 0, 1, 1); // To have a non-empty dirty rect @@ -646,7 +644,7 @@ // does not support pixel geometry settings. // See: crbug.com/583809 createContext(Opaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), Opaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), Opaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillText("Text", 0, 5); @@ -655,7 +653,7 @@ TEST_F(CanvasRenderingContext2DTest, NonOpaqueDisplayListDoesNotFallBackForText) { createContext(NonOpaque); - std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillText("Text", 0, 5); @@ -687,7 +685,7 @@ { createContext(NonOpaque); - std::unique_ptr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface = wrapUnique(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 10), NonOpaque)); + OwnPtr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface = adoptPtr(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 10), NonOpaque)); FakeAcceleratedImageBufferSurfaceForTesting* fakeAccelerateSurfacePtr = fakeAccelerateSurface.get(); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(fakeAccelerateSurface)); // 800 = 10 * 10 * 4 * 2 where 10*10 is canvas size, 4 is num of bytes per pixel per buffer, @@ -711,8 +709,8 @@ EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); // Creating a different accelerated image buffer - std::unique_ptr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface2 = wrapUnique(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 5), NonOpaque)); - std::unique_ptr<ImageBuffer> imageBuffer2 = ImageBuffer::create(std::move(fakeAccelerateSurface2)); + OwnPtr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface2 = adoptPtr(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 5), NonOpaque)); + OwnPtr<ImageBuffer> imageBuffer2 = ImageBuffer::create(std::move(fakeAccelerateSurface2)); EXPECT_EQ(800, getCurrentGPUMemoryUsage()); EXPECT_EQ(1200, getGlobalGPUMemoryUsage()); EXPECT_EQ(2u, getGlobalAcceleratedImageBufferCount());
diff --git a/third_party/WebKit/Source/modules/canvas2d/HitRegion.h b/third_party/WebKit/Source/modules/canvas2d/HitRegion.h index 799dd103..6d3b11e 100644 --- a/third_party/WebKit/Source/modules/canvas2d/HitRegion.h +++ b/third_party/WebKit/Source/modules/canvas2d/HitRegion.h
@@ -10,6 +10,8 @@ #include "platform/graphics/Path.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp index 2bf0b6a..4e04afc 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -9,11 +9,10 @@ #include "core/workers/WorkerThreadStartupData.h" #include "modules/EventTargetModules.h" #include "modules/compositorworker/CompositorWorkerThread.h" -#include <memory> namespace blink { -CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double timeOrigin) +CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -23,7 +22,7 @@ return context; } -CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) , m_executingAnimationFrameCallbacks(false) , m_callbackCollection(this) @@ -49,7 +48,7 @@ void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(executionContext, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(executionContext, ports, exceptionState); if (exceptionState.hadException()) return; thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(channels));
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h index c1e619f..726131c 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h
@@ -10,7 +10,6 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerGlobalScope.h" #include "modules/ModulesExport.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ class MODULES_EXPORT CompositorWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static CompositorWorkerGlobalScope* create(CompositorWorkerThread*, std::unique_ptr<WorkerThreadStartupData>, double timeOrigin); + static CompositorWorkerGlobalScope* create(CompositorWorkerThread*, PassOwnPtr<WorkerThreadStartupData>, double timeOrigin); ~CompositorWorkerGlobalScope() override; // EventTarget @@ -39,7 +38,7 @@ DECLARE_VIRTUAL_TRACE(); private: - CompositorWorkerGlobalScope(const KURL&, const String& userAgent, CompositorWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); + CompositorWorkerGlobalScope(const KURL&, const String& userAgent, CompositorWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); CompositorWorkerThread* thread() const; bool m_executingAnimationFrameCallbacks;
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp index c6c7e911..6ad530b 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp
@@ -6,7 +6,6 @@ #include "core/workers/WorkerThreadStartupData.h" #include "modules/compositorworker/CompositorWorkerThread.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ { } -std::unique_ptr<WorkerThread> CompositorWorkerMessagingProxy::createWorkerThread(double originTime) +PassOwnPtr<WorkerThread> CompositorWorkerMessagingProxy::createWorkerThread(double originTime) { return CompositorWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h index 8f0752d..07d2aeff 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h
@@ -7,7 +7,6 @@ #include "core/workers/InProcessWorkerMessagingProxy.h" #include "wtf/Allocator.h" -#include <memory> namespace blink { @@ -19,7 +18,7 @@ protected: ~CompositorWorkerMessagingProxy() override; - std::unique_ptr<WorkerThread> createWorkerThread(double originTime) override; + PassOwnPtr<WorkerThread> createWorkerThread(double originTime) override; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp index 4573680..de797ad 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
@@ -16,8 +16,6 @@ #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -62,7 +60,7 @@ WorkerBackingThread* thread() { return m_thread.get(); } private: - BackingThreadHolder(std::unique_ptr<WorkerBackingThread> useBackingThread = nullptr) + BackingThreadHolder(PassOwnPtr<WorkerBackingThread> useBackingThread = nullptr) : m_thread(useBackingThread ? std::move(useBackingThread) : WorkerBackingThread::create(Platform::current()->compositorThread())) { DCHECK(isMainThread()); @@ -97,7 +95,7 @@ doneEvent->signal(); } - std::unique_ptr<WorkerBackingThread> m_thread; + OwnPtr<WorkerBackingThread> m_thread; bool m_initialized = false; static BackingThreadHolder* s_instance; @@ -107,11 +105,11 @@ } // namespace -std::unique_ptr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) +PassOwnPtr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWorkerThread::create"); ASSERT(isMainThread()); - return wrapUnique(new CompositorWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); + return adoptPtr(new CompositorWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); } CompositorWorkerThread::CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) @@ -130,7 +128,7 @@ return *BackingThreadHolder::instance().thread(); } -WorkerGlobalScope*CompositorWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) +WorkerGlobalScope*CompositorWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWorkerThread::createWorkerGlobalScope"); return CompositorWorkerGlobalScope::create(this, std::move(startupData), m_timeOrigin);
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h index 1ca5db2..b72fe9c 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h
@@ -7,7 +7,6 @@ #include "core/workers/WorkerThread.h" #include "modules/ModulesExport.h" -#include <memory> namespace blink { @@ -15,7 +14,7 @@ class MODULES_EXPORT CompositorWorkerThread final : public WorkerThread { public: - static std::unique_ptr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); + static PassOwnPtr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); ~CompositorWorkerThread() override; InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } @@ -30,7 +29,7 @@ protected: CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); - WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; bool isOwningBackingThread() const override { return false; } private:
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp index adb2ac49..1b3c0d83 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -23,8 +23,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebAddressSpace.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { @@ -32,13 +30,13 @@ // A null InProcessWorkerObjectProxy, supplied when creating CompositorWorkerThreads. class TestCompositorWorkerObjectProxy : public InProcessWorkerObjectProxy { public: - static std::unique_ptr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context) + static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context) { - return wrapUnique(new TestCompositorWorkerObjectProxy(context)); + return adoptPtr(new TestCompositorWorkerObjectProxy(context)); } // (Empty) WorkerReportingProxy implementation: - virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) {} + virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) {} void reportConsoleMessage(ConsoleMessage*) override {} void postMessageToPageInspector(const String&) override {} void postWorkerConsoleAgentEnabled() override {} @@ -77,7 +75,7 @@ class CompositorWorkerTestPlatform : public TestingPlatformSupport { public: CompositorWorkerTestPlatform() - : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor"))) + : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor"))) { } @@ -89,7 +87,7 @@ WebCompositorSupport* compositorSupport() override { return &m_compositorSupport; } private: - std::unique_ptr<WebThread> m_thread; + OwnPtr<WebThread> m_thread; TestingCompositorSupport m_compositorSupport; }; @@ -111,9 +109,9 @@ CompositorWorkerThread::clearSharedBackingThread(); } - std::unique_ptr<CompositorWorkerThread> createCompositorWorker() + PassOwnPtr<CompositorWorkerThread> createCompositorWorker() { - std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); + OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); WorkerClients* clients = WorkerClients::create(); provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); workerThread->start(WorkerThreadStartupData::create( @@ -134,7 +132,7 @@ // Attempts to run some simple script for |worker|. void checkWorkerCanExecuteScript(WorkerThread* worker) { - std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent()); worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThreadAccess(this), AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get()))); waitEvent->wait(); @@ -149,15 +147,15 @@ waitEvent->signal(); } - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; RefPtr<SecurityOrigin> m_securityOrigin; - std::unique_ptr<InProcessWorkerObjectProxy> m_objectProxy; + OwnPtr<InProcessWorkerObjectProxy> m_objectProxy; CompositorWorkerTestPlatform m_testPlatform; }; TEST_F(CompositorWorkerThreadTest, Basic) { - std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); checkWorkerCanExecuteScript(compositorWorker.get()); compositorWorker->terminateAndWait(); } @@ -166,14 +164,14 @@ TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst) { // Create the first worker and wait until it is initialized. - std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(); WebThreadSupportingGC* firstThread = &firstWorker->workerBackingThread().backingThread(); checkWorkerCanExecuteScript(firstWorker.get()); v8::Isolate* firstIsolate = firstWorker->isolate(); ASSERT_TRUE(firstIsolate); // Create the second worker and immediately destroy the first worker. - std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(); // We don't use terminateAndWait here to avoid forcible termination. firstWorker->terminate(); firstWorker->waitForShutdownForTesting(); @@ -197,7 +195,7 @@ TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond) { // Create the first worker, wait until it is initialized, and terminate it. - std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread(); checkWorkerCanExecuteScript(compositorWorker.get()); @@ -217,7 +215,7 @@ // Tests that v8::Isolate and WebThread are correctly set-up if a worker is created while another is terminating. TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst) { - std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(); checkWorkerCanExecuteScript(firstWorker.get()); v8::Isolate* firstIsolate = firstWorker->isolate(); ASSERT_TRUE(firstIsolate); @@ -229,7 +227,7 @@ // Note: We rely on the assumption that the termination steps don't run // on the worker thread so quickly. This could be a source of flakiness. - std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker(); + OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(); v8::Isolate* secondIsolate = secondWorker->isolate(); ASSERT_TRUE(secondIsolate);
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp index 9f93a00..b671c5c 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
@@ -27,8 +27,6 @@ #include "public/platform/WebCredentialManagerError.h" #include "public/platform/WebFederatedCredential.h" #include "public/platform/WebPasswordCredential.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -82,7 +80,7 @@ Frame* frame = toDocument(m_resolver->getScriptState()->getExecutionContext())->frame(); SECURITY_CHECK(!frame || frame == frame->tree().top()); - std::unique_ptr<WebCredential> credential = wrapUnique(webCredential.release()); + OwnPtr<WebCredential> credential = adoptPtr(webCredential.release()); if (!credential || !frame) { m_resolver->resolve(); return;
diff --git a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp index f2d8fbe..bffa584c 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp
@@ -16,7 +16,6 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -46,7 +45,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp index d09a7b0..caf0638 100644 --- a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp +++ b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -40,11 +40,9 @@ #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebString.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/StringBuilder.h" #include <algorithm> -#include <memory> namespace blink { @@ -449,7 +447,7 @@ // dictionary AesCbcParams : Algorithm { // required BufferSource iv; // }; -bool parseAesCbcParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesCbcParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource ivBufferSource; if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) @@ -457,7 +455,7 @@ DOMArrayPiece iv(ivBufferSource); - params = wrapUnique(new WebCryptoAesCbcParams(iv.bytes(), iv.byteLength())); + params = adoptPtr(new WebCryptoAesCbcParams(iv.bytes(), iv.byteLength())); return true; } @@ -466,13 +464,13 @@ // dictionary AesKeyGenParams : Algorithm { // [EnforceRange] required unsigned short length; // }; -bool parseAesKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint16_t length; if (!getUint16(raw, "length", length, context, error)) return false; - params = wrapUnique(new WebCryptoAesKeyGenParams(length)); + params = adoptPtr(new WebCryptoAesKeyGenParams(length)); return true; } @@ -498,7 +496,7 @@ // FIXME: http://crbug.com/438475: The current implementation differs from the // spec in that the "hash" parameter is required. This seems more sensible, and // is being proposed as a change to the spec. (https://www.w3.org/Bugs/Public/show_bug.cgi?id=27448). -bool parseHmacImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHmacImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -509,7 +507,7 @@ if (!getOptionalUint32(raw, "length", hasLength, length, context, error)) return false; - params = wrapUnique(new WebCryptoHmacImportParams(hash, hasLength, length)); + params = adoptPtr(new WebCryptoHmacImportParams(hash, hasLength, length)); return true; } @@ -519,7 +517,7 @@ // required HashAlgorithmIdentifier hash; // [EnforceRange] unsigned long length; // }; -bool parseHmacKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHmacKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -530,7 +528,7 @@ if (!getOptionalUint32(raw, "length", hasLength, length, context, error)) return false; - params = wrapUnique(new WebCryptoHmacKeyGenParams(hash, hasLength, length)); + params = adoptPtr(new WebCryptoHmacKeyGenParams(hash, hasLength, length)); return true; } @@ -539,13 +537,13 @@ // dictionary RsaHashedImportParams : Algorithm { // required HashAlgorithmIdentifier hash; // }; -bool parseRsaHashedImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaHashedImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = wrapUnique(new WebCryptoRsaHashedImportParams(hash)); + params = adoptPtr(new WebCryptoRsaHashedImportParams(hash)); return true; } @@ -559,7 +557,7 @@ // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { // required HashAlgorithmIdentifier hash; // }; -bool parseRsaHashedKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint32_t modulusLength; if (!getUint32(raw, "modulusLength", modulusLength, context, error)) @@ -573,7 +571,7 @@ if (!parseHash(raw, hash, context, error)) return false; - params = wrapUnique(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteLength())); + params = adoptPtr(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteLength())); return true; } @@ -583,7 +581,7 @@ // required BufferSource counter; // [EnforceRange] required octet length; // }; -bool parseAesCtrParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesCtrParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource counterBufferSource; if (!getBufferSource(raw, "counter", counterBufferSource, context, error)) @@ -594,7 +592,7 @@ if (!getUint8(raw, "length", length, context, error)) return false; - params = wrapUnique(new WebCryptoAesCtrParams(length, counter.bytes(), counter.byteLength())); + params = adoptPtr(new WebCryptoAesCtrParams(length, counter.bytes(), counter.byteLength())); return true; } @@ -605,7 +603,7 @@ // BufferSource additionalData; // [EnforceRange] octet tagLength; // } -bool parseAesGcmParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesGcmParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource ivBufferSource; if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) @@ -624,7 +622,7 @@ DOMArrayPiece iv(ivBufferSource); DOMArrayPiece additionalData(additionalDataBufferSource, DOMArrayPiece::AllowNullPointToNullWithZeroSize); - params = wrapUnique(new WebCryptoAesGcmParams(iv.bytes(), iv.byteLength(), hasAdditionalData, additionalData.bytes(), additionalData.byteLength(), hasTagLength, tagLength)); + params = adoptPtr(new WebCryptoAesGcmParams(iv.bytes(), iv.byteLength(), hasAdditionalData, additionalData.bytes(), additionalData.byteLength(), hasTagLength, tagLength)); return true; } @@ -633,7 +631,7 @@ // dictionary RsaOaepParams : Algorithm { // BufferSource label; // }; -bool parseRsaOaepParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaOaepParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { bool hasLabel; BufferSource labelBufferSource; @@ -641,7 +639,7 @@ return false; DOMArrayPiece label(labelBufferSource, DOMArrayPiece::AllowNullPointToNullWithZeroSize); - params = wrapUnique(new WebCryptoRsaOaepParams(hasLabel, label.bytes(), label.byteLength())); + params = adoptPtr(new WebCryptoRsaOaepParams(hasLabel, label.bytes(), label.byteLength())); return true; } @@ -650,13 +648,13 @@ // dictionary RsaPssParams : Algorithm { // [EnforceRange] required unsigned long saltLength; // }; -bool parseRsaPssParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaPssParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint32_t saltLengthBytes; if (!getUint32(raw, "saltLength", saltLengthBytes, context, error)) return false; - params = wrapUnique(new WebCryptoRsaPssParams(saltLengthBytes)); + params = adoptPtr(new WebCryptoRsaPssParams(saltLengthBytes)); return true; } @@ -665,13 +663,13 @@ // dictionary EcdsaParams : Algorithm { // required HashAlgorithmIdentifier hash; // }; -bool parseEcdsaParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcdsaParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = wrapUnique(new WebCryptoEcdsaParams(hash)); + params = adoptPtr(new WebCryptoEcdsaParams(hash)); return true; } @@ -713,13 +711,13 @@ // dictionary EcKeyGenParams : Algorithm { // required NamedCurve namedCurve; // }; -bool parseEcKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoNamedCurve namedCurve; if (!parseNamedCurve(raw, namedCurve, context, error)) return false; - params = wrapUnique(new WebCryptoEcKeyGenParams(namedCurve)); + params = adoptPtr(new WebCryptoEcKeyGenParams(namedCurve)); return true; } @@ -728,13 +726,13 @@ // dictionary EcKeyImportParams : Algorithm { // required NamedCurve namedCurve; // }; -bool parseEcKeyImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcKeyImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoNamedCurve namedCurve; if (!parseNamedCurve(raw, namedCurve, context, error)) return false; - params = wrapUnique(new WebCryptoEcKeyImportParams(namedCurve)); + params = adoptPtr(new WebCryptoEcKeyImportParams(namedCurve)); return true; } @@ -743,7 +741,7 @@ // dictionary EcdhKeyDeriveParams : Algorithm { // required CryptoKey public; // }; -bool parseEcdhKeyDeriveParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcdhKeyDeriveParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { v8::Local<v8::Value> v8Value; if (!raw.get("public", v8Value)) { @@ -757,7 +755,7 @@ return false; } - params = wrapUnique(new WebCryptoEcdhKeyDeriveParams(cryptoKey->key())); + params = adoptPtr(new WebCryptoEcdhKeyDeriveParams(cryptoKey->key())); return true; } @@ -768,7 +766,7 @@ // [EnforceRange] required unsigned long iterations; // required HashAlgorithmIdentifier hash; // }; -bool parsePbkdf2Params(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parsePbkdf2Params(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource saltBufferSource; if (!getBufferSource(raw, "salt", saltBufferSource, context, error)) @@ -783,7 +781,7 @@ WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = wrapUnique(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteLength(), iterations)); + params = adoptPtr(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteLength(), iterations)); return true; } @@ -792,13 +790,13 @@ // dictionary AesDerivedKeyParams : Algorithm { // [EnforceRange] required unsigned short length; // }; -bool parseAesDerivedKeyParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesDerivedKeyParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint16_t length; if (!getUint16(raw, "length", length, context, error)) return false; - params = wrapUnique(new WebCryptoAesDerivedKeyParams(length)); + params = adoptPtr(new WebCryptoAesDerivedKeyParams(length)); return true; } @@ -814,7 +812,7 @@ // required BufferSource salt; // required BufferSource info; // }; -bool parseHkdfParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHkdfParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -829,11 +827,11 @@ DOMArrayPiece salt(saltBufferSource); DOMArrayPiece info(infoBufferSource); - params = wrapUnique(new WebCryptoHkdfParams(hash, salt.bytes(), salt.byteLength(), info.bytes(), info.byteLength())); + params = adoptPtr(new WebCryptoHkdfParams(hash, salt.bytes(), salt.byteLength(), info.bytes(), info.byteLength())); return true; } -bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, std::unique_ptr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error) +bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, OwnPtr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error) { switch (type) { case WebCryptoAlgorithmParamsTypeNone: @@ -944,7 +942,7 @@ WebCryptoAlgorithmParamsType paramsType = static_cast<WebCryptoAlgorithmParamsType>(algorithmInfo->operationToParamsType[op]); - std::unique_ptr<WebCryptoAlgorithmParams> params; + OwnPtr<WebCryptoAlgorithmParams> params; if (!parseAlgorithmParams(raw, paramsType, params, context, error)) return false;
diff --git a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp index c957321..41059bb 100644 --- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp +++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp
@@ -17,7 +17,6 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/PaintGeneratedImage.h" #include "platform/graphics/RecordingImageBufferSurface.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -56,7 +55,7 @@ DCHECK(layoutObject.node()); PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( - ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size)))); + ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size)))); Geometry* geometry = Geometry::create(size); StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create( CSSComputedStyleDeclaration::create(layoutObject.node()),
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp index 2d975bb..3d887ec 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp
@@ -5,11 +5,10 @@ #include "modules/csspaint/PaintRenderingContext2D.h" #include "platform/graphics/ImageBuffer.h" -#include <memory> namespace blink { -PaintRenderingContext2D::PaintRenderingContext2D(std::unique_ptr<ImageBuffer> imageBuffer) +PaintRenderingContext2D::PaintRenderingContext2D(PassOwnPtr<ImageBuffer> imageBuffer) : m_imageBuffer(std::move(imageBuffer)) { m_clipAntialiasing = AntiAliased;
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h index 03b3fa6..55ab09b 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h
@@ -9,7 +9,6 @@ #include "modules/ModulesExport.h" #include "modules/canvas2d/BaseRenderingContext2D.h" #include "platform/graphics/ImageBuffer.h" -#include <memory> class SkCanvas; @@ -23,7 +22,7 @@ USING_GARBAGE_COLLECTED_MIXIN(PaintRenderingContext2D); WTF_MAKE_NONCOPYABLE(PaintRenderingContext2D); public: - static PaintRenderingContext2D* create(std::unique_ptr<ImageBuffer> imageBuffer) + static PaintRenderingContext2D* create(PassOwnPtr<ImageBuffer> imageBuffer) { return new PaintRenderingContext2D(std::move(imageBuffer)); } @@ -68,9 +67,9 @@ bool isContextLost() const final { return false; } private: - explicit PaintRenderingContext2D(std::unique_ptr<ImageBuffer>); + explicit PaintRenderingContext2D(PassOwnPtr<ImageBuffer>); - std::unique_ptr<ImageBuffer> m_imageBuffer; + OwnPtr<ImageBuffer> m_imageBuffer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp index 05f4c79..eb7740a 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
@@ -13,7 +13,7 @@ #include "modules/csspaint/PaintWorkletGlobalScope.h" #include "modules/csspaint/WindowPaintWorklet.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -39,7 +39,7 @@ } protected: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition)
diff --git a/third_party/WebKit/Source/modules/encoding/TextDecoder.h b/third_party/WebKit/Source/modules/encoding/TextDecoder.h index 5118a26b..ccbab4d 100644 --- a/third_party/WebKit/Source/modules/encoding/TextDecoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextDecoder.h
@@ -39,7 +39,6 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -68,7 +67,7 @@ String decode(const char* start, size_t length, const TextDecodeOptions&, ExceptionState&); WTF::TextEncoding m_encoding; - std::unique_ptr<WTF::TextCodec> m_codec; + OwnPtr<WTF::TextCodec> m_codec; bool m_fatal; bool m_ignoreBOM; bool m_bomSeen;
diff --git a/third_party/WebKit/Source/modules/encoding/TextEncoder.h b/third_party/WebKit/Source/modules/encoding/TextEncoder.h index 02dc49b..d8cd446 100644 --- a/third_party/WebKit/Source/modules/encoding/TextEncoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextEncoder.h
@@ -37,7 +37,6 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -60,7 +59,7 @@ TextEncoder(const WTF::TextEncoding&); WTF::TextEncoding m_encoding; - std::unique_ptr<WTF::TextCodec> m_codec; + OwnPtr<WTF::TextCodec> m_codec; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp index 60426813..a8c49763 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
@@ -50,7 +50,6 @@ #include "public/platform/WebString.h" #include "public/platform/WebURL.h" #include "wtf/ASCIICType.h" -#include "wtf/PtrUtil.h" #include <cmath> #include <limits> @@ -332,7 +331,7 @@ // initializeNewSession() is called in response to the user calling // generateRequest(). WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); - m_session = wrapUnique(cdm->createSession()); + m_session = adoptPtr(cdm->createSession()); m_session->setClientInterface(this); // From https://w3c.github.io/encrypted-media/#createSession:
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h index 018d75d..8fcfaf9 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h
@@ -36,7 +36,6 @@ #include "platform/heap/Handle.h" #include "public/platform/WebContentDecryptionModuleSession.h" #include "public/platform/WebEncryptedMediaTypes.h" -#include <memory> namespace blink { @@ -119,7 +118,7 @@ void finishLoad(); Member<GenericEventQueue> m_asyncEventQueue; - std::unique_ptr<WebContentDecryptionModuleSession> m_session; + OwnPtr<WebContentDecryptionModuleSession> m_session; // Used to determine if MediaKeys is still active. WeakMember<MediaKeys> m_mediaKeys;
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp index 3c9dd43..9485c91 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp
@@ -18,8 +18,6 @@ #include "public/platform/WebContentDecryptionModule.h" #include "public/platform/WebEncryptedMediaTypes.h" #include "public/platform/WebMediaKeySystemConfiguration.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -50,7 +48,7 @@ { // NOTE: Continued from step 2.8 of createMediaKeys(). // 2.9. Let media keys be a new MediaKeys object. - MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_supportedSessionTypes, wrapUnique(cdm)); + MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_supportedSessionTypes, adoptPtr(cdm)); // 2.10. Resolve promise with media keys. resolve(mediaKeys); @@ -107,7 +105,7 @@ } // namespace -MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, std::unique_ptr<WebContentDecryptionModuleAccess> access) +MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, PassOwnPtr<WebContentDecryptionModuleAccess> access) : m_keySystem(keySystem) , m_access(std::move(access)) {
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h index e5c4f411..c1c4e13c 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h
@@ -10,7 +10,6 @@ #include "modules/encryptedmedia/MediaKeySystemConfiguration.h" #include "public/platform/WebContentDecryptionModuleAccess.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -18,7 +17,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - MediaKeySystemAccess(const String& keySystem, std::unique_ptr<WebContentDecryptionModuleAccess>); + MediaKeySystemAccess(const String& keySystem, PassOwnPtr<WebContentDecryptionModuleAccess>); virtual ~MediaKeySystemAccess(); const String& keySystem() const { return m_keySystem; } @@ -29,7 +28,7 @@ private: const String m_keySystem; - std::unique_ptr<WebContentDecryptionModuleAccess> m_access; + OwnPtr<WebContentDecryptionModuleAccess> m_access; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp index cb4bded..1668a823 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -38,7 +38,6 @@ #include "platform/Timer.h" #include "public/platform/WebContentDecryptionModule.h" #include "wtf/RefPtr.h" -#include <memory> #define MEDIA_KEYS_LOG_LEVEL 3 @@ -117,14 +116,14 @@ } }; -MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule> cdm) +MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm) { MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::move(cdm)); mediaKeys->suspendIfNeeded(); return mediaKeys; } -MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule> cdm) +MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_supportedSessionTypes(supportedSessionTypes)
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h index 05f7972..8541355 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h
@@ -38,7 +38,6 @@ #include "public/platform/WebVector.h" #include "wtf/Forward.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -55,7 +54,7 @@ USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); DEFINE_WRAPPERTYPEINFO(); public: - static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule>); + static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); ~MediaKeys() override; MediaKeySession* createSession(ScriptState*, const String& sessionTypeString, ExceptionState&); @@ -92,14 +91,14 @@ bool hasPendingActivity() const final; private: - MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule>); + MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); class PendingAction; bool sessionTypeSupported(WebEncryptedMediaSessionType); void timerFired(Timer<MediaKeys>*); const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; - std::unique_ptr<WebContentDecryptionModule> m_cdm; + OwnPtr<WebContentDecryptionModule> m_cdm; // Keep track of the HTMLMediaElement that references this object. Keeping // a WeakMember so that HTMLMediaElement's lifetime isn't dependent on
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp index 6977f4cc..dd0af18 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -24,7 +24,6 @@ #include "public/platform/WebMediaKeySystemConfiguration.h" #include "public/platform/WebMediaKeySystemMediaCapability.h" #include "public/platform/WebVector.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" #include <algorithm> @@ -168,7 +167,7 @@ { checkEmptyCodecs(access->getConfiguration()); - m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, wrapUnique(access))); + m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, adoptPtr(access))); m_resolver.clear(); }
diff --git a/third_party/WebKit/Source/modules/fetch/Body.cpp b/third_party/WebKit/Source/modules/fetch/Body.cpp index d7d78ec..239d6e6 100644 --- a/third_party/WebKit/Source/modules/fetch/Body.cpp +++ b/third_party/WebKit/Source/modules/fetch/Body.cpp
@@ -15,9 +15,9 @@ #include "modules/fetch/BodyStreamBuffer.h" #include "modules/fetch/FetchDataLoader.h" #include "public/platform/WebDataConsumerHandle.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -141,7 +141,7 @@ if (bodyBuffer()) { bodyBuffer()->startLoading(FetchDataLoader::createLoaderAsBlobHandle(mimeType()), new BodyBlobConsumer(resolver)); } else { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->setContentType(mimeType()); resolver->resolve(Blob::create(BlobDataHandle::create(std::move(blobData), 0))); }
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp index a339b1e..0ddba08 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
@@ -20,7 +20,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" -#include <memory> namespace blink { @@ -98,7 +97,7 @@ Member<FetchDataLoader::Client> m_client; }; -BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<FetchDataConsumerHandle> handle) +BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, PassOwnPtr<FetchDataConsumerHandle> handle) : UnderlyingSourceBase(scriptState) , m_scriptState(scriptState) , m_handle(std::move(handle)) @@ -215,7 +214,7 @@ { ASSERT(!m_loader); ASSERT(m_scriptState->contextIsValid()); - std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle(); + OwnPtr<FetchDataConsumerHandle> handle = releaseHandle(); m_loader = loader; loader->start(handle.get(), new LoaderClient(m_scriptState->getExecutionContext(), this, client)); } @@ -235,8 +234,8 @@ *branch2 = new BodyStreamBuffer(m_scriptState.get(), stream2); return; } - std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle(); - std::unique_ptr<FetchDataConsumerHandle> handle1, handle2; + OwnPtr<FetchDataConsumerHandle> handle = releaseHandle(); + OwnPtr<FetchDataConsumerHandle> handle1, handle2; DataConsumerTee::create(m_scriptState->getExecutionContext(), std::move(handle), &handle1, &handle2); *branch1 = new BodyStreamBuffer(m_scriptState.get(), std::move(handle1)); *branch2 = new BodyStreamBuffer(m_scriptState.get(), std::move(handle2)); @@ -450,7 +449,7 @@ m_loader = nullptr; } -std::unique_ptr<FetchDataConsumerHandle> BodyStreamBuffer::releaseHandle() +PassOwnPtr<FetchDataConsumerHandle> BodyStreamBuffer::releaseHandle() { DCHECK(!isStreamLocked()); DCHECK(!isStreamDisturbed()); @@ -470,7 +469,7 @@ // We need to call these before calling closeAndLockAndDisturb. const bool isClosed = isStreamClosed(); const bool isErrored = isStreamErrored(); - std::unique_ptr<FetchDataConsumerHandle> handle = std::move(m_handle); + OwnPtr<FetchDataConsumerHandle> handle = std::move(m_handle); closeAndLockAndDisturb();
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h index ba0226b..2ef8bc9 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
@@ -17,7 +17,8 @@ #include "modules/fetch/FetchDataLoader.h" #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -31,7 +32,7 @@ // Needed because we have to release |m_reader| promptly. EAGERLY_FINALIZE(); // |handle| cannot be null and cannot be locked. - BodyStreamBuffer(ScriptState*, std::unique_ptr<FetchDataConsumerHandle> /* handle */); + BodyStreamBuffer(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> /* handle */); // |ReadableStreamOperations::isReadableStream(stream)| must hold. BodyStreamBuffer(ScriptState*, ScriptValue stream); @@ -80,11 +81,11 @@ void processData(); void endLoading(); void stopLoading(); - std::unique_ptr<FetchDataConsumerHandle> releaseHandle(); + PassOwnPtr<FetchDataConsumerHandle> releaseHandle(); RefPtr<ScriptState> m_scriptState; - std::unique_ptr<FetchDataConsumerHandle> m_handle; - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle> m_handle; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; Member<ReadableByteStream> m_stream; // We need this member to keep it alive while loading. Member<FetchDataLoader> m_loader;
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp index defd829..c7869ca2 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -15,8 +15,7 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -32,7 +31,7 @@ class FakeLoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override + PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override { ASSERT_NOT_REACHED(); return nullptr; @@ -51,7 +50,7 @@ ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } ExecutionContext* getExecutionContext() { return &m_page->document(); } - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; ScriptValue eval(const char* s) { @@ -94,7 +93,7 @@ EXPECT_CALL(*client2, didFetchDataLoadedString(String("hello, world"))); EXPECT_CALL(checkpoint, Call(4)); - std::unique_ptr<DataConsumerHandleTestUtil::ReplayingHandle> handle = DataConsumerHandleTestUtil::ReplayingHandle::create(); + OwnPtr<DataConsumerHandleTestUtil::ReplayingHandle> handle = DataConsumerHandleTestUtil::ReplayingHandle::create(); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Data, "hello, ")); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Data, "world")); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Done)); @@ -174,7 +173,7 @@ TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) { - std::unique_ptr<BlobData> data = BlobData::create(); + OwnPtr<BlobData> data = BlobData::create(); data->appendText("hello", false); auto size = data->length(); RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(data), size); @@ -194,7 +193,7 @@ TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandleReturnsNull) { // This handle is not drainable. - std::unique_ptr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); + OwnPtr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); EXPECT_FALSE(buffer->isStreamLocked()); @@ -250,7 +249,7 @@ TEST_F(BodyStreamBufferTest, DrainAsFormDataReturnsNull) { // This handle is not drainable. - std::unique_ptr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); + OwnPtr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); EXPECT_FALSE(buffer->isStreamLocked()); @@ -294,7 +293,7 @@ EXPECT_CALL(*client, didFetchDataLoadedArrayBufferMock(_)).WillOnce(SaveArg<0>(&arrayBuffer)); EXPECT_CALL(checkpoint, Call(2)); - std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -326,7 +325,7 @@ EXPECT_CALL(*client, didFetchDataLoadedBlobHandleMock(_)).WillOnce(SaveArg<0>(&blobDataHandle)); EXPECT_CALL(checkpoint, Call(2)); - std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -356,7 +355,7 @@ EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); EXPECT_CALL(checkpoint, Call(2)); - std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -452,7 +451,7 @@ EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); EXPECT_CALL(checkpoint, Call(2)); - std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -467,7 +466,7 @@ // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleTestUtil::MockFetchDataConsumerHandle { public: - static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>); } + static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>); } ~MockFetchDataConsumerHandleWithMockDestructor() override { @@ -482,8 +481,8 @@ ScriptState::Scope scope(getScriptState()); using MockHandle = MockFetchDataConsumerHandleWithMockDestructor; using MockReader = DataConsumerHandleTestUtil::MockFetchDataConsumerReader; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); Checkpoint checkpoint; InSequence s; @@ -495,7 +494,7 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); checkpoint.Call(1);
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp index e1b9266..5679b7b 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp
@@ -10,10 +10,8 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Locker.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -34,14 +32,14 @@ class CompositeDataConsumerHandle::Context final : public ThreadSafeRefCounted<Context> { public: using Token = unsigned; - static PassRefPtr<Context> create(std::unique_ptr<WebDataConsumerHandle> handle) { return adoptRef(new Context(std::move(handle))); } + static PassRefPtr<Context> create(PassOwnPtr<WebDataConsumerHandle> handle) { return adoptRef(new Context(std::move(handle))); } ~Context() { ASSERT(!m_readerThread); ASSERT(!m_reader); ASSERT(!m_client); } - std::unique_ptr<ReaderImpl> obtainReader(Client* client) + PassOwnPtr<ReaderImpl> obtainReader(Client* client) { MutexLocker locker(m_mutex); ASSERT(!m_readerThread); @@ -51,7 +49,7 @@ m_client = client; m_readerThread = Platform::current()->currentThread(); m_reader = m_handle->obtainReader(m_client); - return wrapUnique(new ReaderImpl(this)); + return adoptPtr(new ReaderImpl(this)); } void detachReader() { @@ -66,7 +64,7 @@ m_readerThread = nullptr; m_client = nullptr; } - void update(std::unique_ptr<WebDataConsumerHandle> handle) + void update(PassOwnPtr<WebDataConsumerHandle> handle) { MutexLocker locker(m_mutex); m_handle = std::move(handle); @@ -108,7 +106,7 @@ } private: - explicit Context(std::unique_ptr<WebDataConsumerHandle> handle) + explicit Context(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) , m_readerThread(nullptr) , m_client(nullptr) @@ -145,8 +143,8 @@ m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&Context::updateReader, this, m_token)); } - std::unique_ptr<Reader> m_reader; - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<Reader> m_reader; + OwnPtr<WebDataConsumerHandle> m_handle; // Note: Holding a WebThread raw pointer is not generally safe, but we can // do that in this case because: // 1. Destructing a ReaderImpl when the bound thread ends is a user's @@ -194,14 +192,14 @@ CompositeDataConsumerHandle::Updater::~Updater() {} -void CompositeDataConsumerHandle::Updater::update(std::unique_ptr<WebDataConsumerHandle> handle) +void CompositeDataConsumerHandle::Updater::update(PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT(handle); ASSERT(m_thread->isCurrentThread()); m_context->update(std::move(handle)); } -CompositeDataConsumerHandle::CompositeDataConsumerHandle(std::unique_ptr<WebDataConsumerHandle> handle, Updater** updater) +CompositeDataConsumerHandle::CompositeDataConsumerHandle(PassOwnPtr<WebDataConsumerHandle> handle, Updater** updater) : m_context(Context::create(std::move(handle))) { *updater = new Updater(m_context); @@ -211,7 +209,7 @@ WebDataConsumerHandle::Reader* CompositeDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_context->obtainReader(client).release(); + return m_context->obtainReader(client).leakPtr(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h index e2a95d2d..cc41704d 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h
@@ -9,9 +9,9 @@ #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -32,7 +32,7 @@ ~Updater(); // |handle| must not be null and must not be locked. - void update(std::unique_ptr<WebDataConsumerHandle> /* handle */); + void update(PassOwnPtr<WebDataConsumerHandle> /* handle */); DEFINE_INLINE_TRACE() { } private: @@ -46,11 +46,11 @@ // associated updater will be bound to the calling thread. // |handle| must not be null and must not be locked. template<typename T> - static std::unique_ptr<WebDataConsumerHandle> create(std::unique_ptr<WebDataConsumerHandle> handle, T* updater) + static PassOwnPtr<WebDataConsumerHandle> create(PassOwnPtr<WebDataConsumerHandle> handle, T* updater) { ASSERT(handle); Updater* u = nullptr; - std::unique_ptr<CompositeDataConsumerHandle> p = wrapUnique(new CompositeDataConsumerHandle(std::move(handle), &u)); + OwnPtr<CompositeDataConsumerHandle> p = adoptPtr(new CompositeDataConsumerHandle(std::move(handle), &u)); *updater = u; return std::move(p); } @@ -62,7 +62,7 @@ const char* debugName() const override { return "CompositeDataConsumerHandle"; } - CompositeDataConsumerHandle(std::unique_ptr<WebDataConsumerHandle>, Updater**); + CompositeDataConsumerHandle(PassOwnPtr<WebDataConsumerHandle>, Updater**); RefPtr<Context> m_context; };
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp index 0ff02a9..863dd6da 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp
@@ -14,8 +14,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Locker.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -32,7 +30,7 @@ class MockReader : public WebDataConsumerHandle::Reader { public: - static std::unique_ptr<StrictMock<MockReader>> create() { return wrapUnique(new StrictMock<MockReader>); } + static PassOwnPtr<StrictMock<MockReader>> create() { return adoptPtr(new StrictMock<MockReader>); } using Result = WebDataConsumerHandle::Result; using Flags = WebDataConsumerHandle::Flags; @@ -43,7 +41,7 @@ class MockHandle : public WebDataConsumerHandle { public: - static std::unique_ptr<StrictMock<MockHandle>> create() { return wrapUnique(new StrictMock<MockHandle>); } + static PassOwnPtr<StrictMock<MockHandle>> create() { return adoptPtr(new StrictMock<MockHandle>); } MOCK_METHOD1(obtainReaderInternal, Reader*(Client*)); @@ -59,7 +57,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -86,7 +84,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -98,7 +96,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -127,7 +125,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -139,7 +137,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -168,7 +166,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -180,8 +178,8 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); - m_updateEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); + m_updateEvent = adoptPtr(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -219,9 +217,9 @@ m_reader = m_handle->obtainReader(&m_client); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; - std::unique_ptr<WaitableEvent> m_updateEvent; + OwnPtr<WaitableEvent> m_updateEvent; }; class ThreadingRegistrationUpdateTwiceAtOneTimeTest : public DataConsumerHandleTestUtil::ThreadingTestBase { @@ -232,8 +230,8 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); - m_updateEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); + m_updateEvent = adoptPtr(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -265,9 +263,9 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; - std::unique_ptr<WaitableEvent> m_updateEvent; + OwnPtr<WaitableEvent> m_updateEvent; }; TEST(CompositeDataConsumerHandleTest, Read) @@ -277,10 +275,10 @@ DataConsumerHandleTestUtil::NoopClient client; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle1 = MockHandle::create(); - std::unique_ptr<MockHandle> handle2 = MockHandle::create(); - std::unique_ptr<MockReader> reader1 = MockReader::create(); - std::unique_ptr<MockReader> reader2 = MockReader::create(); + OwnPtr<MockHandle> handle1 = MockHandle::create(); + OwnPtr<MockHandle> handle2 = MockHandle::create(); + OwnPtr<MockReader> reader1 = MockReader::create(); + OwnPtr<MockReader> reader2 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -294,13 +292,13 @@ EXPECT_CALL(checkpoint, Call(4)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.release()); - ASSERT_TRUE(reader2.release()); + ASSERT_TRUE(reader1.leakPtr()); + ASSERT_TRUE(reader2.leakPtr()); CompositeDataConsumerHandle::Updater* updater = nullptr; - std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(&client); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(&client); checkpoint.Call(1); EXPECT_EQ(kOk, reader->read(buffer, sizeof(buffer), kNone, &size)); checkpoint.Call(2); @@ -316,10 +314,10 @@ size_t size = 0; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle1 = MockHandle::create(); - std::unique_ptr<MockHandle> handle2 = MockHandle::create(); - std::unique_ptr<MockReader> reader1 = MockReader::create(); - std::unique_ptr<MockReader> reader2 = MockReader::create(); + OwnPtr<MockHandle> handle1 = MockHandle::create(); + OwnPtr<MockHandle> handle2 = MockHandle::create(); + OwnPtr<MockReader> reader1 = MockReader::create(); + OwnPtr<MockReader> reader2 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -337,13 +335,13 @@ EXPECT_CALL(checkpoint, Call(6)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.release()); - ASSERT_TRUE(reader2.release()); + ASSERT_TRUE(reader1.leakPtr()); + ASSERT_TRUE(reader2.leakPtr()); CompositeDataConsumerHandle::Updater* updater = nullptr; - std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); checkpoint.Call(1); EXPECT_EQ(kOk, reader->beginRead(&p, kNone, &size)); checkpoint.Call(2); @@ -363,12 +361,12 @@ size_t size = 0; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle1 = MockHandle::create(); - std::unique_ptr<MockHandle> handle2 = MockHandle::create(); - std::unique_ptr<MockHandle> handle3 = MockHandle::create(); - std::unique_ptr<MockReader> reader1 = MockReader::create(); - std::unique_ptr<MockReader> reader2 = MockReader::create(); - std::unique_ptr<MockReader> reader3 = MockReader::create(); + OwnPtr<MockHandle> handle1 = MockHandle::create(); + OwnPtr<MockHandle> handle2 = MockHandle::create(); + OwnPtr<MockHandle> handle3 = MockHandle::create(); + OwnPtr<MockReader> reader1 = MockReader::create(); + OwnPtr<MockReader> reader2 = MockReader::create(); + OwnPtr<MockReader> reader3 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -390,14 +388,14 @@ EXPECT_CALL(checkpoint, Call(8)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.release()); - ASSERT_TRUE(reader2.release()); - ASSERT_TRUE(reader3.release()); + ASSERT_TRUE(reader1.leakPtr()); + ASSERT_TRUE(reader2.leakPtr()); + ASSERT_TRUE(reader3.leakPtr()); CompositeDataConsumerHandle::Updater* updater = nullptr; - std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); checkpoint.Call(1); EXPECT_EQ(kOk, reader->beginRead(&p, kNone, &size)); checkpoint.Call(2);
diff --git a/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h b/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h index 12da6c70..9492ba1f 100644 --- a/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h +++ b/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h
@@ -10,11 +10,11 @@ #include "core/dom/ExecutionContext.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Locker.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -33,10 +33,10 @@ // Must be called on the thread where |obj| is created // (== the thread of |executionContext|). // The current thread must be attached to Oilpan. - static std::unique_ptr<CrossThreadHolder<T>> create(ExecutionContext* executionContext, std::unique_ptr<T> obj) + static PassOwnPtr<CrossThreadHolder<T>> create(ExecutionContext* executionContext, PassOwnPtr<T> obj) { ASSERT(executionContext->isContextThread()); - return wrapUnique(new CrossThreadHolder(executionContext, std::move(obj))); + return adoptPtr(new CrossThreadHolder(executionContext, std::move(obj))); } // Can be called from any thread. @@ -65,7 +65,7 @@ private: // Object graph: // +------+ +-----------------+ - // T <-std::unique_ptr- |Bridge| ---------*-------------> |CrossThreadHolder| + // T <-OwnPtr- |Bridge| ---------*-------------> |CrossThreadHolder| // | | <-CrossThreadPersistent- | | // +------+ +-----------------+ // | | @@ -93,7 +93,7 @@ , public ActiveDOMObject { USING_GARBAGE_COLLECTED_MIXIN(Bridge); public: - Bridge(ExecutionContext* executionContext, std::unique_ptr<T> obj, PassRefPtr<MutexWrapper> mutex, CrossThreadHolder* holder) + Bridge(ExecutionContext* executionContext, PassOwnPtr<T> obj, PassRefPtr<MutexWrapper> mutex, CrossThreadHolder* holder) : ActiveDOMObject(executionContext) , m_obj(std::move(obj)) , m_mutex(mutex) @@ -145,7 +145,7 @@ } - std::unique_ptr<T> m_obj; + OwnPtr<T> m_obj; // All accesses to |m_holder| must be protected by |m_mutex|. RefPtr<MutexWrapper> m_mutex; CrossThreadHolder* m_holder; @@ -159,7 +159,7 @@ m_bridge.clear(); } - CrossThreadHolder(ExecutionContext* executionContext, std::unique_ptr<T> obj) + CrossThreadHolder(ExecutionContext* executionContext, PassOwnPtr<T> obj) : m_mutex(MutexWrapper::create()) , m_bridge(new Bridge(executionContext, std::move(obj), m_mutex, this)) {
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp index 7b28ea9..efb5391 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -5,15 +5,13 @@ #include "modules/fetch/DataConsumerHandleTestUtil.h" #include "bindings/core/v8/DOMWrapperWorld.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { DataConsumerHandleTestUtil::Thread::Thread(const char* name, InitializationPolicy initializationPolicy) : m_thread(WebThreadSupportingGC::create(name)) , m_initializationPolicy(initializationPolicy) - , m_waitableEvent(wrapUnique(new WaitableEvent())) + , m_waitableEvent(adoptPtr(new WaitableEvent())) { m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, AllowCrossThreadAccess(this))); m_waitableEvent->wait(); @@ -28,7 +26,7 @@ void DataConsumerHandleTestUtil::Thread::initialize() { if (m_initializationPolicy >= ScriptExecution) { - m_isolateHolder = wrapUnique(new gin::IsolateHolder()); + m_isolateHolder = adoptPtr(new gin::IsolateHolder()); isolate()->Enter(); } m_thread->initialize(); @@ -167,7 +165,7 @@ , m_client(nullptr) , m_result(ShouldWait) , m_isHandleAttached(true) - , m_detached(wrapUnique(new WaitableEvent())) + , m_detached(adoptPtr(new WaitableEvent())) { } @@ -231,7 +229,7 @@ m_context->add(command); } -DataConsumerHandleTestUtil::HandleReader::HandleReader(std::unique_ptr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) +DataConsumerHandleTestUtil::HandleReader::HandleReader(PassOwnPtr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) : m_reader(handle->obtainReader(this)) , m_onFinishedReading(std::move(onFinishedReading)) { @@ -250,20 +248,20 @@ break; m_data.append(buffer, size); } - std::unique_ptr<HandleReadResult> result = wrapUnique(new HandleReadResult(r, m_data)); + OwnPtr<HandleReadResult> result = adoptPtr(new HandleReadResult(r, m_data)); m_data.clear(); - Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&HandleReader::runOnFinishedReading, this, passed(std::move(result)))); + Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&HandleReader::runOnFinishedReading, this, passed(std::move(result)))); m_reader = nullptr; } -void DataConsumerHandleTestUtil::HandleReader::runOnFinishedReading(std::unique_ptr<HandleReadResult> result) +void DataConsumerHandleTestUtil::HandleReader::runOnFinishedReading(PassOwnPtr<HandleReadResult> result) { ASSERT(m_onFinishedReading); std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedReading)); (*onFinishedReading)(std::move(result)); } -DataConsumerHandleTestUtil::HandleTwoPhaseReader::HandleTwoPhaseReader(std::unique_ptr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) +DataConsumerHandleTestUtil::HandleTwoPhaseReader::HandleTwoPhaseReader(PassOwnPtr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) : m_reader(handle->obtainReader(this)) , m_onFinishedReading(std::move(onFinishedReading)) { @@ -285,13 +283,13 @@ m_data.append(static_cast<const char*>(buffer), readSize); m_reader->endRead(readSize); } - std::unique_ptr<HandleReadResult> result = wrapUnique(new HandleReadResult(r, m_data)); + OwnPtr<HandleReadResult> result = adoptPtr(new HandleReadResult(r, m_data)); m_data.clear(); - Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&HandleTwoPhaseReader::runOnFinishedReading, this, passed(std::move(result)))); + Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&HandleTwoPhaseReader::runOnFinishedReading, this, passed(std::move(result)))); m_reader = nullptr; } -void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std::unique_ptr<HandleReadResult> result) +void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(PassOwnPtr<HandleReadResult> result) { ASSERT(m_onFinishedReading); std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedReading));
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h index 47cb1c70..e629a03 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
@@ -20,13 +20,14 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/Deque.h" #include "wtf/Locker.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" + #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <memory> #include <v8.h> namespace blink { @@ -68,11 +69,11 @@ void initialize(); void shutdown(); - std::unique_ptr<WebThreadSupportingGC> m_thread; + OwnPtr<WebThreadSupportingGC> m_thread; const InitializationPolicy m_initializationPolicy; - std::unique_ptr<WaitableEvent> m_waitableEvent; + OwnPtr<WaitableEvent> m_waitableEvent; Persistent<NullExecutionContext> m_executionContext; - std::unique_ptr<gin::IsolateHolder> m_isolateHolder; + OwnPtr<gin::IsolateHolder> m_isolateHolder; RefPtr<ScriptState> m_scriptState; }; @@ -159,8 +160,8 @@ public: ThreadHolder(ThreadingTestBase* test) : m_context(test->m_context) - , m_readingThread(wrapUnique(new Thread("reading thread"))) - , m_updatingThread(wrapUnique(new Thread("updating thread"))) + , m_readingThread(adoptPtr(new Thread("reading thread"))) + , m_updatingThread(adoptPtr(new Thread("updating thread"))) { m_context->registerThreadHolder(this); } @@ -174,8 +175,8 @@ private: RefPtr<Context> m_context; - std::unique_ptr<Thread> m_readingThread; - std::unique_ptr<Thread> m_updatingThread; + OwnPtr<Thread> m_readingThread; + OwnPtr<Thread> m_updatingThread; }; class ReaderImpl final : public WebDataConsumerHandle::Reader { @@ -199,9 +200,9 @@ class DataConsumerHandle final : public WebDataConsumerHandle { USING_FAST_MALLOC(DataConsumerHandle); public: - static std::unique_ptr<WebDataConsumerHandle> create(const String& name, PassRefPtr<Context> context) + static PassOwnPtr<WebDataConsumerHandle> create(const String& name, PassRefPtr<Context> context) { - return wrapUnique(new DataConsumerHandle(name, context)); + return adoptPtr(new DataConsumerHandle(name, context)); } private: @@ -240,8 +241,8 @@ : m_context(Context::create()) { } RefPtr<Context> m_context; - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; - std::unique_ptr<WaitableEvent> m_waitableEvent; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WaitableEvent> m_waitableEvent; NoopClient m_client; }; @@ -250,10 +251,10 @@ using Self = ThreadingHandleNotificationTest; static PassRefPtr<Self> create() { return adoptRef(new Self); } - void run(std::unique_ptr<WebDataConsumerHandle> handle) + void run(PassOwnPtr<WebDataConsumerHandle> handle) { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); m_handle = std::move(handle); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -271,7 +272,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; }; class ThreadingHandleNoNotificationTest : public ThreadingTestBase, public WebDataConsumerHandle::Client { @@ -279,10 +280,10 @@ using Self = ThreadingHandleNoNotificationTest; static PassRefPtr<Self> create() { return adoptRef(new Self); } - void run(std::unique_ptr<WebDataConsumerHandle> handle) + void run(PassOwnPtr<WebDataConsumerHandle> handle) { ThreadHolder holder(this); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_waitableEvent = adoptPtr(new WaitableEvent()); m_handle = std::move(handle); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -301,12 +302,12 @@ ASSERT_NOT_REACHED(); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; }; class MockFetchDataConsumerHandle : public FetchDataConsumerHandle { public: - static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandle>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerHandle>); } + static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandle>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerHandle>); } MOCK_METHOD1(obtainReaderInternal, Reader*(Client*)); private: @@ -315,7 +316,7 @@ class MockFetchDataConsumerReader : public FetchDataConsumerHandle::Reader { public: - static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerReader>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerReader>); } + static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerReader>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerReader>); } using Result = WebDataConsumerHandle::Result; using Flags = WebDataConsumerHandle::Flags; @@ -387,7 +388,7 @@ class ReplayingHandle final : public WebDataConsumerHandle { USING_FAST_MALLOC(ReplayingHandle); public: - static std::unique_ptr<ReplayingHandle> create() { return wrapUnique(new ReplayingHandle()); } + static PassOwnPtr<ReplayingHandle> create() { return adoptPtr(new ReplayingHandle()); } ~ReplayingHandle(); // Add a command to this handle. This function must be called on the @@ -424,7 +425,7 @@ Result m_result; bool m_isHandleAttached; Mutex m_mutex; - std::unique_ptr<WaitableEvent> m_detached; + OwnPtr<WaitableEvent> m_detached; }; Context* getContext() { return m_context.get(); } @@ -457,15 +458,15 @@ class HandleReader final : public WebDataConsumerHandle::Client { USING_FAST_MALLOC(HandleReader); public: - using OnFinishedReading = WTF::Function<void(std::unique_ptr<HandleReadResult>)>; + using OnFinishedReading = WTF::Function<void(PassOwnPtr<HandleReadResult>)>; - HandleReader(std::unique_ptr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); + HandleReader(PassOwnPtr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); void didGetReadable() override; private: - void runOnFinishedReading(std::unique_ptr<HandleReadResult>); + void runOnFinishedReading(PassOwnPtr<HandleReadResult>); - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; std::unique_ptr<OnFinishedReading> m_onFinishedReading; Vector<char> m_data; }; @@ -475,15 +476,15 @@ class HandleTwoPhaseReader final : public WebDataConsumerHandle::Client { USING_FAST_MALLOC(HandleTwoPhaseReader); public: - using OnFinishedReading = WTF::Function<void(std::unique_ptr<HandleReadResult>)>; + using OnFinishedReading = WTF::Function<void(PassOwnPtr<HandleReadResult>)>; - HandleTwoPhaseReader(std::unique_ptr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); + HandleTwoPhaseReader(PassOwnPtr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); void didGetReadable() override; private: - void runOnFinishedReading(std::unique_ptr<HandleReadResult>); + void runOnFinishedReading(PassOwnPtr<HandleReadResult>); - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; std::unique_ptr<OnFinishedReading> m_onFinishedReading; Vector<char> m_data; }; @@ -494,9 +495,9 @@ class HandleReaderRunner final { STACK_ALLOCATED(); public: - explicit HandleReaderRunner(std::unique_ptr<WebDataConsumerHandle> handle) - : m_thread(wrapUnique(new Thread("reading thread"))) - , m_event(wrapUnique(new WaitableEvent())) + explicit HandleReaderRunner(PassOwnPtr<WebDataConsumerHandle> handle) + : m_thread(adoptPtr(new Thread("reading thread"))) + , m_event(adoptPtr(new WaitableEvent())) , m_isDone(false) { m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&HandleReaderRunner::start, AllowCrossThreadAccess(this), passed(std::move(handle)))); @@ -506,7 +507,7 @@ wait(); } - std::unique_ptr<HandleReadResult> wait() + PassOwnPtr<HandleReadResult> wait() { if (m_isDone) return nullptr; @@ -516,24 +517,24 @@ } private: - void start(std::unique_ptr<WebDataConsumerHandle> handle) + void start(PassOwnPtr<WebDataConsumerHandle> handle) { - m_handleReader = wrapUnique(new T(std::move(handle), WTF::bind<std::unique_ptr<HandleReadResult>>(&HandleReaderRunner::onFinished, this))); + m_handleReader = adoptPtr(new T(std::move(handle), bind<PassOwnPtr<HandleReadResult>>(&HandleReaderRunner::onFinished, this))); } - void onFinished(std::unique_ptr<HandleReadResult> result) + void onFinished(PassOwnPtr<HandleReadResult> result) { m_handleReader = nullptr; m_result = std::move(result); m_event->signal(); } - std::unique_ptr<Thread> m_thread; - std::unique_ptr<WaitableEvent> m_event; - std::unique_ptr<HandleReadResult> m_result; + OwnPtr<Thread> m_thread; + OwnPtr<WaitableEvent> m_event; + OwnPtr<HandleReadResult> m_result; bool m_isDone; - std::unique_ptr<T> m_handleReader; + OwnPtr<T> m_handleReader; }; };
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp index f53b200..34326a17 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp
@@ -10,8 +10,6 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -73,11 +71,11 @@ class WebToFetchDataConsumerHandleAdapter : public FetchDataConsumerHandle { public: - WebToFetchDataConsumerHandleAdapter(std::unique_ptr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) { } + WebToFetchDataConsumerHandleAdapter(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) { } private: class ReaderImpl final : public FetchDataConsumerHandle::Reader { public: - ReaderImpl(std::unique_ptr<WebDataConsumerHandle::Reader> reader) : m_reader(std::move(reader)) { } + ReaderImpl(PassOwnPtr<WebDataConsumerHandle::Reader> reader) : m_reader(std::move(reader)) { } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { return m_reader->read(data, size, flags, readSize); @@ -92,36 +90,36 @@ return m_reader->endRead(readSize); } private: - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; }; Reader* obtainReaderInternal(Client* client) override { return new ReaderImpl(m_handle->obtainReader(client)); } const char* debugName() const override { return m_handle->debugName(); } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; }; } // namespace -std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerHandle() +PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle() { - return wrapUnique(new WaitingHandle); + return adoptPtr(new WaitingHandle); } -std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHandle() +PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle() { - return wrapUnique(new DoneHandle); + return adoptPtr(new DoneHandle); } -std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle() +PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle() { - return wrapUnique(new UnexpectedErrorHandle); + return adoptPtr(new UnexpectedErrorHandle); } -std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(std::unique_ptr<WebDataConsumerHandle> handle) +PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle> handle) { - return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle))); + return adoptPtr(new WebToFetchDataConsumerHandleAdapter(std::move(handle))); } NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* client)
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h index 51602cb..bbd5585 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h
@@ -9,25 +9,25 @@ #include "modules/fetch/FetchDataConsumerHandle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" -#include <memory> namespace blink { // Returns a handle that returns ShouldWait for read / beginRead and // UnexpectedError for endRead. -MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerHandle(); +MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle(); // Returns a handle that returns Done for read / beginRead and // UnexpectedError for endRead. -MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHandle(); +MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle(); // Returns a handle that returns UnexpectedError for read / beginRead / // endRead. -MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle(); +MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle(); // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. -MODULES_EXPORT std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(std::unique_ptr<WebDataConsumerHandle>); +MODULES_EXPORT PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle>); // A helper class to call Client::didGetReadable() asynchronously after // Reader creation.
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp index 13115fe8..760cf0e 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp
@@ -5,7 +5,6 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/DataConsumerHandleTestUtil.h" -#include <memory> namespace blink { @@ -21,8 +20,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - std::unique_ptr<WebDataConsumerHandle> handle = createWaitingDataConsumerHandle(); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle> handle = createWaitingDataConsumerHandle(); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kShouldWait, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kShouldWait, reader->beginRead(&p, kNone, &size)); @@ -41,8 +40,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - std::unique_ptr<WebDataConsumerHandle> handle = createDoneDataConsumerHandle(); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle> handle = createDoneDataConsumerHandle(); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kDone, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kDone, reader->beginRead(&p, kNone, &size)); @@ -68,8 +67,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - std::unique_ptr<WebDataConsumerHandle> handle = createUnexpectedErrorDataConsumerHandle(); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle> handle = createUnexpectedErrorDataConsumerHandle(); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kUnexpectedError, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kUnexpectedError, reader->beginRead(&p, kNone, &size));
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp index a646561..71f3deb 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
@@ -16,11 +16,9 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/Deque.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -150,7 +148,7 @@ { MutexLocker locker(m_mutex); needsNotification = m_queue.isEmpty(); - std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>); + OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>); data->append(buffer, size); m_queue.append(std::move(data)); } @@ -211,7 +209,7 @@ m_readerThread = nullptr; m_client = nullptr; } - const std::unique_ptr<Vector<char>>& top() const { return m_queue.first(); } + const OwnPtr<Vector<char>>& top() const { return m_queue.first(); } bool isEmpty() const { return m_queue.isEmpty(); } size_t offset() const { return m_offset; } void consume(size_t size) @@ -247,7 +245,7 @@ } Result m_result; - Deque<std::unique_ptr<Vector<char>>> m_queue; + Deque<OwnPtr<Vector<char>>> m_queue; // Note: Holding a WebThread raw pointer is not generally safe, but we can // do that in this case because: // 1. Destructing a ReaderImpl when the bound thread ends is a user's @@ -289,7 +287,7 @@ if (context()->isEmpty()) return context()->getResult(); - const std::unique_ptr<Vector<char>>& chunk = context()->top(); + const OwnPtr<Vector<char>>& chunk = context()->top(); *available = chunk->size() - context()->offset(); *buffer = chunk->data() + context()->offset(); return WebDataConsumerHandle::Ok; @@ -312,9 +310,9 @@ class DestinationHandle final : public WebDataConsumerHandle { public: - static std::unique_ptr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy) + static PassOwnPtr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy) { - return wrapUnique(new DestinationHandle(contextProxy)); + return adoptPtr(new DestinationHandle(contextProxy)); } private: @@ -331,7 +329,7 @@ public: SourceContext( PassRefPtr<TeeRootObject> root, - std::unique_ptr<WebDataConsumerHandle> src, + PassOwnPtr<WebDataConsumerHandle> src, PassRefPtr<DestinationContext> dest1, PassRefPtr<DestinationContext> dest2, ExecutionContext* executionContext) @@ -396,14 +394,14 @@ } RefPtr<TeeRootObject> m_root; - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; RefPtr<DestinationContext> m_dest1; RefPtr<DestinationContext> m_dest2; }; } // namespace -void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<WebDataConsumerHandle> src, std::unique_ptr<WebDataConsumerHandle>* dest1, std::unique_ptr<WebDataConsumerHandle>* dest2) +void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<WebDataConsumerHandle> src, OwnPtr<WebDataConsumerHandle>* dest1, OwnPtr<WebDataConsumerHandle>* dest2) { RefPtr<TeeRootObject> root = TeeRootObject::create(); RefPtr<DestinationTracker> tracker = DestinationTracker::create(root); @@ -416,7 +414,7 @@ *dest2 = DestinationHandle::create(DestinationContext::Proxy::create(context2, tracker)); } -void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<FetchDataConsumerHandle> src, std::unique_ptr<FetchDataConsumerHandle>* dest1, std::unique_ptr<FetchDataConsumerHandle>* dest2) +void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<FetchDataConsumerHandle> src, OwnPtr<FetchDataConsumerHandle>* dest1, OwnPtr<FetchDataConsumerHandle>* dest2) { RefPtr<BlobDataHandle> blobDataHandle = src->obtainReader(nullptr)->drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize); if (blobDataHandle) { @@ -425,8 +423,8 @@ return; } - std::unique_ptr<WebDataConsumerHandle> webDest1, webDest2; - DataConsumerTee::create(executionContext, static_cast<std::unique_ptr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2); + OwnPtr<WebDataConsumerHandle> webDest1, webDest2; + DataConsumerTee::create(executionContext, static_cast<PassOwnPtr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2); *dest1 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest1)); *dest2 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest2)); return;
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h index b0e283d2..30a5782 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h
@@ -9,7 +9,8 @@ #include "modules/fetch/FetchDataConsumerHandle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -19,8 +20,8 @@ STATIC_ONLY(DataConsumerTee); public: // Create two handles from one. |src| must be a valid unlocked handle. - static void create(ExecutionContext*, std::unique_ptr<WebDataConsumerHandle> src, std::unique_ptr<WebDataConsumerHandle>* dest1, std::unique_ptr<WebDataConsumerHandle>* dest2); - static void create(ExecutionContext*, std::unique_ptr<FetchDataConsumerHandle> src, std::unique_ptr<FetchDataConsumerHandle>* dest1, std::unique_ptr<FetchDataConsumerHandle>* dest2); + static void create(ExecutionContext*, PassOwnPtr<WebDataConsumerHandle> src, OwnPtr<WebDataConsumerHandle>* dest1, OwnPtr<WebDataConsumerHandle>* dest2); + static void create(ExecutionContext*, PassOwnPtr<FetchDataConsumerHandle> src, OwnPtr<FetchDataConsumerHandle>* dest1, OwnPtr<FetchDataConsumerHandle>* dest2); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp index dfa3d1c..d467143 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
@@ -15,9 +15,7 @@ #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> #include <string.h> #include <v8.h> @@ -55,10 +53,10 @@ template<typename Handle> class TeeCreationThread { public: - void run(std::unique_ptr<Handle> src, std::unique_ptr<Handle>* dest1, std::unique_ptr<Handle>* dest2) + void run(PassOwnPtr<Handle> src, OwnPtr<Handle>* dest1, OwnPtr<Handle>* dest2) { - m_thread = wrapUnique(new Thread("src thread", Thread::WithExecutionContext)); - m_waitableEvent = wrapUnique(new WaitableEvent()); + m_thread = adoptPtr(new Thread("src thread", Thread::WithExecutionContext)); + m_waitableEvent = adoptPtr(new WaitableEvent()); m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&TeeCreationThread<Handle>::runInternal, AllowCrossThreadAccess(this), passed(std::move(src)), AllowCrossThreadAccess(dest1), AllowCrossThreadAccess(dest2))); m_waitableEvent->wait(); } @@ -66,24 +64,24 @@ Thread* getThread() { return m_thread.get(); } private: - void runInternal(std::unique_ptr<Handle> src, std::unique_ptr<Handle>* dest1, std::unique_ptr<Handle>* dest2) + void runInternal(PassOwnPtr<Handle> src, OwnPtr<Handle>* dest1, OwnPtr<Handle>* dest2) { DataConsumerTee::create(m_thread->getExecutionContext(), std::move(src), dest1, dest2); m_waitableEvent->signal(); } - std::unique_ptr<Thread> m_thread; - std::unique_ptr<WaitableEvent> m_waitableEvent; + OwnPtr<Thread> m_thread; + OwnPtr<WaitableEvent> m_waitableEvent; }; TEST(DataConsumerTeeTest, CreateDone) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -91,8 +89,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)), r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ(0u, res1->data().size()); @@ -102,8 +100,8 @@ TEST(DataConsumerTeeTest, Read) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); @@ -113,7 +111,7 @@ src->add(Command(Command::Wait)); src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -122,8 +120,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)); HandleReaderRunner<HandleReader> r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -134,8 +132,8 @@ TEST(DataConsumerTeeTest, TwoPhaseRead) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); @@ -146,7 +144,7 @@ src->add(Command(Command::Wait)); src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -155,8 +153,8 @@ HandleReaderRunner<HandleTwoPhaseReader> r1(std::move(dest1)); HandleReaderRunner<HandleTwoPhaseReader> r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -167,14 +165,14 @@ TEST(DataConsumerTeeTest, Error) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Error)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -183,8 +181,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)); HandleReaderRunner<HandleReader> r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -197,13 +195,13 @@ TEST(DataConsumerTeeTest, StopSource) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -216,8 +214,8 @@ // t->thread() is alive. t->getThread()->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(postStop, AllowCrossThreadAccess(t->getThread()))); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -225,13 +223,13 @@ TEST(DataConsumerTeeTest, DetachSource) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -242,8 +240,8 @@ t = nullptr; - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -251,21 +249,21 @@ TEST(DataConsumerTeeTest, DetachSourceAfterReadingDone) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); ASSERT_TRUE(dest2); HandleReaderRunner<HandleReader> r1(std::move(dest1)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -273,7 +271,7 @@ t = nullptr; HandleReaderRunner<HandleReader> r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res2->result()); EXPECT_EQ("hello, world", toString(res2->data())); @@ -281,14 +279,14 @@ TEST(DataConsumerTeeTest, DetachOneDestination) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -297,7 +295,7 @@ dest1 = nullptr; HandleReaderRunner<HandleReader> r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res2->result()); EXPECT_EQ("hello, world", toString(res2->data())); @@ -305,14 +303,14 @@ TEST(DataConsumerTeeTest, DetachBothDestinationsShouldStopSourceReader) { - std::unique_ptr<Handle> src(Handle::create()); + OwnPtr<Handle> src(Handle::create()); RefPtr<Handle::Context> context(src->getContext()); - std::unique_ptr<WebDataConsumerHandle> dest1, dest2; + OwnPtr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); + OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -329,8 +327,8 @@ TEST(FetchDataConsumerTeeTest, Create) { RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(); - std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); - std::unique_ptr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); + OwnPtr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); + OwnPtr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); Checkpoint checkpoint; InSequence s; @@ -341,10 +339,10 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); - std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; - std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); + OwnPtr<FetchDataConsumerHandle> dest1, dest2; + OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); checkpoint.Call(1); t->run(std::move(src), &dest1, &dest2); @@ -359,8 +357,8 @@ TEST(FetchDataConsumerTeeTest, CreateFromBlobWithInvalidSize) { RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(BlobData::create(), -1); - std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); - std::unique_ptr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); + OwnPtr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); + OwnPtr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); Checkpoint checkpoint; InSequence s; @@ -371,10 +369,10 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); - std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; - std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); + OwnPtr<FetchDataConsumerHandle> dest1, dest2; + OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); checkpoint.Call(1); t->run(std::move(src), &dest1, &dest2); @@ -390,12 +388,12 @@ TEST(FetchDataConsumerTeeTest, CreateDone) { - std::unique_ptr<Handle> src(Handle::create()); - std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; + OwnPtr<Handle> src(Handle::create()); + OwnPtr<FetchDataConsumerHandle> dest1, dest2; src->add(Command(Command::Done)); - std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); + OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); t->run(createFetchDataConsumerHandleFromWebHandle(std::move(src)), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -406,8 +404,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)), r2(std::move(dest2)); - std::unique_ptr<HandleReadResult> res1 = r1.wait(); - std::unique_ptr<HandleReadResult> res2 = r2.wait(); + OwnPtr<HandleReadResult> res1 = r1.wait(); + OwnPtr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ(0u, res1->data().size());
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp index d7a0254..9a86008 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp
@@ -13,8 +13,7 @@ #include "platform/blob/BlobRegistry.h" #include "platform/blob/BlobURL.h" #include "platform/network/ResourceRequest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -103,7 +102,7 @@ } private: - std::unique_ptr<ThreadableLoader> createLoader(ExecutionContext* executionContext, ThreadableLoaderClient* client) const + PassOwnPtr<ThreadableLoader> createLoader(ExecutionContext* executionContext, ThreadableLoaderClient* client) const { ThreadableLoaderOptions options; options.preflightPolicy = ConsiderPreflight; @@ -118,7 +117,7 @@ } // ThreadableLoaderClient - void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle> handle) override + void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle> handle) override { ASSERT(!m_receivedResponse); m_receivedResponse = true; @@ -154,14 +153,14 @@ RefPtr<BlobDataHandle> m_blobDataHandle; Persistent<FetchBlobDataConsumerHandle::LoaderFactory> m_loaderFactory; - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; bool m_receivedResponse; }; class DefaultLoaderFactory final : public FetchBlobDataConsumerHandle::LoaderFactory { public: - std::unique_ptr<ThreadableLoader> create( + PassOwnPtr<ThreadableLoader> create( ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, @@ -181,7 +180,7 @@ public: class ReaderImpl : public FetchDataConsumerHandle::Reader { public: - ReaderImpl(Client* client, PassRefPtr<ReaderContext> readerContext, std::unique_ptr<WebDataConsumerHandle::Reader> reader) + ReaderImpl(Client* client, PassRefPtr<ReaderContext> readerContext, PassOwnPtr<WebDataConsumerHandle::Reader> reader) : m_readerContext(readerContext) , m_reader(std::move(reader)) , m_notifier(client) { } @@ -239,7 +238,7 @@ private: RefPtr<ReaderContext> m_readerContext; - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; NotifyOnReaderCreationHelper m_notifier; }; @@ -250,12 +249,12 @@ { CompositeDataConsumerHandle::Updater* updater = nullptr; m_handle = CompositeDataConsumerHandle::create(createWaitingDataConsumerHandle(), &updater); - m_loaderContextHolder = CrossThreadHolder<LoaderContext>::create(executionContext, wrapUnique(new BlobLoaderContext(updater, m_blobDataHandleForDrain, loaderFactory))); + m_loaderContextHolder = CrossThreadHolder<LoaderContext>::create(executionContext, adoptPtr(new BlobLoaderContext(updater, m_blobDataHandleForDrain, loaderFactory))); } - std::unique_ptr<FetchDataConsumerHandle::Reader> obtainReader(WebDataConsumerHandle::Client* client) + PassOwnPtr<FetchDataConsumerHandle::Reader> obtainReader(WebDataConsumerHandle::Client* client) { - return wrapUnique(new ReaderImpl(client, this, m_handle->obtainReader(client))); + return adoptPtr(new ReaderImpl(client, this, m_handle->obtainReader(client))); } private: @@ -275,9 +274,9 @@ bool drained() const { return m_drained; } void setDrained() { m_drained = true; } - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; RefPtr<BlobDataHandle> m_blobDataHandleForDrain; - std::unique_ptr<CrossThreadHolder<LoaderContext>> m_loaderContextHolder; + OwnPtr<CrossThreadHolder<LoaderContext>> m_loaderContextHolder; bool m_loaderStarted; bool m_drained; @@ -292,25 +291,25 @@ { } -std::unique_ptr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle, LoaderFactory* loaderFactory) +PassOwnPtr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle, LoaderFactory* loaderFactory) { if (!blobDataHandle) return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumerHandle()); - return wrapUnique(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, loaderFactory)); + return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, loaderFactory)); } -std::unique_ptr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle) +PassOwnPtr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle) { if (!blobDataHandle) return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumerHandle()); - return wrapUnique(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, new DefaultLoaderFactory)); + return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, new DefaultLoaderFactory)); } FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_readerContext->obtainReader(client).release(); + return m_readerContext->obtainReader(client).leakPtr(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h index 658c468..2167b4b7 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h
@@ -10,9 +10,9 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchDataConsumerHandle.h" #include "platform/blob/BlobData.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -24,15 +24,15 @@ public: class MODULES_EXPORT LoaderFactory : public GarbageCollectedFinalized<LoaderFactory> { public: - virtual std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) = 0; + virtual PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) = 0; virtual ~LoaderFactory() { } DEFINE_INLINE_VIRTUAL_TRACE() { } }; - static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>); + static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>); // For testing. - static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>, LoaderFactory*); + static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>, LoaderFactory*); ~FetchBlobDataConsumerHandle();
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp index aa597e4..869a7273 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
@@ -18,10 +18,9 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> #include <string.h> namespace blink { @@ -53,9 +52,9 @@ class MockLoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - std::unique_ptr<ThreadableLoader> create(ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& threadableLoaderOptions, const ResourceLoaderOptions& resourceLoaderOptions) override + PassOwnPtr<ThreadableLoader> create(ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& threadableLoaderOptions, const ResourceLoaderOptions& resourceLoaderOptions) override { - return wrapUnique(createInternal(executionContext, client, threadableLoaderOptions, resourceLoaderOptions)); + return adoptPtr(createInternal(executionContext, client, threadableLoaderOptions, resourceLoaderOptions)); } MOCK_METHOD4(createInternal, ThreadableLoader*(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&)); @@ -63,7 +62,7 @@ PassRefPtr<BlobDataHandle> createBlobDataHandle(const char* s) { - std::unique_ptr<BlobData> data = BlobData::create(); + OwnPtr<BlobData> data = BlobData::create(); data->appendText(s, false); auto size = data->length(); return BlobDataHandle::create(std::move(data), size); @@ -88,7 +87,7 @@ Document& document() { return m_dummyPageHolder->document(); } private: - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(FetchBlobDataConsumerHandleTest, CreateLoader) @@ -100,7 +99,7 @@ ThreadableLoaderOptions options; ResourceLoaderOptions resourceLoaderOptions; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; @@ -108,13 +107,13 @@ EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll( SaveArg<2>(&options), SaveArg<3>(&resourceLoaderOptions), - Return(loader.release()))); + Return(loader.leakPtr()))); EXPECT_CALL(*loaderPtr, start(_)).WillOnce(SaveArg<0>(&request)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); testing::runPendingTasks(); @@ -145,19 +144,19 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.release())); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.leakPtr())); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); EXPECT_CALL(checkpoint, Call(3)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); testing::runPendingTasks(); @@ -175,12 +174,12 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.release())); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.leakPtr())); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(checkpoint, Call(3)); @@ -188,9 +187,9 @@ EXPECT_CALL(checkpoint, Call(4)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); testing::runPendingTasks(); size_t size = 0; @@ -210,22 +209,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); @@ -239,7 +238,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -249,22 +248,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); @@ -278,7 +277,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -288,18 +287,18 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); size_t size = 0; @@ -309,7 +308,7 @@ checkpoint.Call(2); client->didFail(ResourceError()); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kUnexpectedError, r->result()); } @@ -318,22 +317,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<WebDataConsumerHandle> handle + OwnPtr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Error)); @@ -345,7 +344,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kUnexpectedError, r->result()); } @@ -354,7 +353,7 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<FetchDataConsumerHandle> handle + OwnPtr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); size_t size = 0; @@ -369,7 +368,7 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<FetchDataConsumerHandle> handle + OwnPtr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); RefPtr<EncodedFormData> formData = handle->obtainReader(nullptr)->drainAsFormData(); @@ -390,9 +389,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<FetchDataConsumerHandle> handle + OwnPtr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kShouldWait, reader->read(nullptr, 0, kNone, &readSize)); @@ -404,9 +403,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<FetchDataConsumerHandle> handle + OwnPtr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; char c; @@ -419,9 +418,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - std::unique_ptr<FetchDataConsumerHandle> handle + OwnPtr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); const void* buffer; size_t available;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h index 608ec91..1179835 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h
@@ -11,8 +11,6 @@ #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Forward.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -66,7 +64,7 @@ // TODO(yhirano): obtainReader() is currently non-virtual override, and // will be changed into virtual override when we can use unique_ptr in // Blink. - std::unique_ptr<Reader> obtainReader(Client* client) { return wrapUnique(obtainReaderInternal(client)); } + PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainReaderInternal(client)); } private: Reader* obtainReaderInternal(Client*) override = 0;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp b/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp index abf3900..ea21ae5 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp
@@ -5,11 +5,9 @@ #include "modules/fetch/FetchDataLoader.h" #include "core/html/parser/TextResourceDecoder.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferBuilder.h" -#include <memory> namespace blink { @@ -103,11 +101,11 @@ m_client.clear(); } - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; String m_mimeType; - std::unique_ptr<BlobData> m_blobData; + OwnPtr<BlobData> m_blobData; }; class FetchDataLoaderAsArrayBuffer @@ -130,7 +128,7 @@ ASSERT(!m_rawData); ASSERT(!m_reader); m_client = client; - m_rawData = wrapUnique(new ArrayBufferBuilder()); + m_rawData = adoptPtr(new ArrayBufferBuilder()); m_reader = handle->obtainReader(this); } @@ -193,10 +191,10 @@ m_client.clear(); } - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; - std::unique_ptr<ArrayBufferBuilder> m_rawData; + OwnPtr<ArrayBufferBuilder> m_rawData; }; class FetchDataLoaderAsString @@ -279,10 +277,10 @@ m_client.clear(); } - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; - std::unique_ptr<TextResourceDecoder> m_decoder; + OwnPtr<TextResourceDecoder> m_decoder; StringBuilder m_builder; }; @@ -371,7 +369,7 @@ m_outStream.clear(); } - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; Member<Stream> m_outStream;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp index 666ac44..9c031fa 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp
@@ -7,7 +7,6 @@ #include "modules/fetch/DataConsumerHandleTestUtil.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -40,8 +39,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -60,7 +59,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -81,8 +80,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -100,7 +99,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -116,8 +115,8 @@ { Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -130,7 +129,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -141,15 +140,15 @@ TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithSameContentType) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNull); blobData->setContentType("text/test"); RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::move(blobData), kQuickBrownFoxLengthWithTerminatingNull); Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -164,7 +163,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -180,15 +179,15 @@ TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithDifferentContentType) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNull); blobData->setContentType("text/different"); RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::move(blobData), kQuickBrownFoxLengthWithTerminatingNull); Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -203,7 +202,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -222,8 +221,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); DOMArrayBuffer* arrayBuffer = nullptr; @@ -241,7 +240,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -262,8 +261,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -280,7 +279,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -296,8 +295,8 @@ { Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -309,7 +308,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -323,8 +322,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -341,7 +340,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -358,8 +357,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -376,7 +375,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -393,8 +392,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -411,7 +410,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -427,8 +426,8 @@ { Checkpoint checkpoint; - std::unique_ptr<MockHandle> handle = MockHandle::create(); - std::unique_ptr<MockReader> reader = MockReader::create(); + OwnPtr<MockHandle> handle = MockHandle::create(); + OwnPtr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -440,7 +439,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.release()); + ASSERT_TRUE(reader.leakPtr()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient);
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp index b20f742..36bc1754 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp
@@ -6,13 +6,12 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/FetchBlobDataConsumerHandle.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" -#include <memory> + #include <utility> namespace blink { @@ -36,7 +35,7 @@ WTF_MAKE_NONCOPYABLE(Context); public: virtual ~Context() {} - virtual std::unique_ptr<FetchDataConsumerHandle::Reader> obtainReader(Client*) = 0; + virtual PassOwnPtr<FetchDataConsumerHandle::Reader> obtainReader(Client*) = 0; protected: explicit Context() {} @@ -49,7 +48,7 @@ static PassRefPtr<SimpleContext> create(const void* data, size_t size) { return adoptRef(new SimpleContext(data, size)); } static PassRefPtr<SimpleContext> create(PassRefPtr<EncodedFormData> body) { return adoptRef(new SimpleContext(body)); } - std::unique_ptr<Reader> obtainReader(Client* client) override + PassOwnPtr<Reader> obtainReader(Client* client) override { // For memory barrier. Mutex m; @@ -62,7 +61,7 @@ if (!m_formData) return nullptr; flatten(); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendBytes(m_flattenFormData.data(), m_flattenFormData.size()); m_flattenFormData.clear(); auto length = blobData->length(); @@ -122,7 +121,7 @@ class ReaderImpl final : public FetchDataConsumerHandle::Reader { WTF_MAKE_NONCOPYABLE(ReaderImpl); public: - static std::unique_ptr<ReaderImpl> create(PassRefPtr<SimpleContext> context, Client* client) { return wrapUnique(new ReaderImpl(context, client)); } + static PassOwnPtr<ReaderImpl> create(PassRefPtr<SimpleContext> context, Client* client) { return adoptPtr(new ReaderImpl(context, client)); } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { return m_context->read(data, size, flags, readSize); @@ -185,7 +184,7 @@ return adoptRef(new ComplexContext(executionContext, formData, factory)); } - std::unique_ptr<FetchFormDataConsumerHandle::Reader> obtainReader(Client* client) override + PassOwnPtr<FetchFormDataConsumerHandle::Reader> obtainReader(Client* client) override { // For memory barrier. Mutex m; @@ -197,7 +196,7 @@ class ReaderImpl final : public FetchDataConsumerHandle::Reader { WTF_MAKE_NONCOPYABLE(ReaderImpl); public: - static std::unique_ptr<ReaderImpl> create(PassRefPtr<ComplexContext> context, Client* client) { return wrapUnique(new ReaderImpl(context, client)); } + static PassOwnPtr<ReaderImpl> create(PassRefPtr<ComplexContext> context, Client* client) { return adoptPtr(new ReaderImpl(context, client)); } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { Result r = m_reader->read(data, size, flags, readSize); @@ -240,12 +239,12 @@ ReaderImpl(PassRefPtr<ComplexContext> context, Client* client) : m_context(context), m_reader(m_context->m_handle->obtainReader(client)) {} RefPtr<ComplexContext> m_context; - std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; + OwnPtr<FetchDataConsumerHandle::Reader> m_reader; }; ComplexContext(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory* factory) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); for (const auto& element : body->elements()) { switch (element.m_type) { case FormDataElement::data: @@ -285,35 +284,35 @@ } RefPtr<EncodedFormData> m_formData; - std::unique_ptr<FetchDataConsumerHandle> m_handle; + OwnPtr<FetchDataConsumerHandle> m_handle; }; -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const String& body) +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const String& body) { - return wrapUnique(new FetchFormDataConsumerHandle(body)); + return adoptPtr(new FetchFormDataConsumerHandle(body)); } -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBuffer* body) +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBuffer* body) { - return wrapUnique(new FetchFormDataConsumerHandle(body->data(), body->byteLength())); + return adoptPtr(new FetchFormDataConsumerHandle(body->data(), body->byteLength())); } -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBufferView* body) +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBufferView* body) { - return wrapUnique(new FetchFormDataConsumerHandle(body->baseAddress(), body->byteLength())); + return adoptPtr(new FetchFormDataConsumerHandle(body->baseAddress(), body->byteLength())); } -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const void* data, size_t size) +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const void* data, size_t size) { - return wrapUnique(new FetchFormDataConsumerHandle(data, size)); + return adoptPtr(new FetchFormDataConsumerHandle(data, size)); } -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body) +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body) { - return wrapUnique(new FetchFormDataConsumerHandle(executionContext, body)); + return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body)); } -std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::createForTest( +PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::createForTest( ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory* loaderFactory) { - return wrapUnique(new FetchFormDataConsumerHandle(executionContext, body, loaderFactory)); + return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body, loaderFactory)); } FetchFormDataConsumerHandle::FetchFormDataConsumerHandle(const String& body) : m_context(SimpleContext::create(body)) {} @@ -332,7 +331,7 @@ FetchDataConsumerHandle::Reader* FetchFormDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_context->obtainReader(client).release(); + return m_context->obtainReader(client).leakPtr(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h index 2abe693d..ab25ff88 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h
@@ -13,10 +13,10 @@ #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" -#include <memory> namespace blink { @@ -27,16 +27,16 @@ class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsumerHandle { WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle); public: - static std::unique_ptr<FetchDataConsumerHandle> create(const String& body); - static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBuffer* body); - static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBufferView* body); - static std::unique_ptr<FetchDataConsumerHandle> create(const void* data, size_t); - static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<EncodedFormData> body); + static PassOwnPtr<FetchDataConsumerHandle> create(const String& body); + static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBuffer* body); + static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBufferView* body); + static PassOwnPtr<FetchDataConsumerHandle> create(const void* data, size_t); + static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<EncodedFormData> body); // Use FetchBlobDataConsumerHandle for blobs. ~FetchFormDataConsumerHandle() override; - static std::unique_ptr<FetchDataConsumerHandle> createForTest( + static PassOwnPtr<FetchDataConsumerHandle> createForTest( ExecutionContext*, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory*);
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp index 43262d0..f4432a6 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
@@ -15,12 +15,13 @@ #include "platform/weborigin/KURL.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" -#include <memory> #include <string.h> namespace blink { @@ -49,14 +50,14 @@ class LoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - explicit LoaderFactory(std::unique_ptr<WebDataConsumerHandle> handle) + explicit LoaderFactory(PassOwnPtr<WebDataConsumerHandle> handle) : m_client(nullptr) , m_handle(std::move(handle)) {} - std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient* client, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override + PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient* client, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override { m_client = client; - std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); + OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); EXPECT_CALL(*loader, start(_)).WillOnce(InvokeWithoutArgs(this, &LoaderFactory::handleDidReceiveResponse)); EXPECT_CALL(*loader, cancel()).Times(1); return std::move(loader); @@ -69,7 +70,7 @@ } ThreadableLoaderClient* m_client; - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; }; class FetchFormDataConsumerHandleTest : public ::testing::Test { @@ -79,7 +80,7 @@ protected: Document* getDocument() { return &m_page->document(); } - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; PassRefPtr<EncodedFormData> complexFormData() @@ -89,7 +90,7 @@ data->appendData("foo", 3); data->appendFileRange("/foo/bar/baz", 3, 4, 5); data->appendFileSystemURLRange(KURL(KURL(), "file:///foo/bar/baz"), 6, 7, 8); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendText("hello", false); auto size = blobData->length(); RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(blobData), size); @@ -131,18 +132,18 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromString) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } TEST_F(FetchFormDataConsumerHandleTest, TwoPhaseReadFromString) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -150,9 +151,9 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromStringNonLatin) { UChar cs[] = {0x3042, 0}; - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String(cs)); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String(cs)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("\xe3\x81\x82", toString(r->data())); } @@ -161,9 +162,9 @@ { const unsigned char data[] = { 0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88 }; DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(buffer); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(buffer); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); Vector<char> expected; expected.append(data, WTF_ARRAY_LENGTH(data)); @@ -175,9 +176,9 @@ const unsigned char data[] = { 0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88 }; const size_t offset = 1, size = 4; DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMUint8Array::create(buffer, offset, size)); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMUint8Array::create(buffer, offset, size)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); Vector<char> expected; expected.append(data + offset, size); @@ -190,10 +191,10 @@ data->appendData("foo", 3); data->appendData("hoge", 4); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), data); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), data); HandleReaderRunner<HandleReader> runner(std::move(handle)); testing::runPendingTasks(); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("foohoge", toString(r->data())); } @@ -201,17 +202,17 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromComplexFormData) { RefPtr<EncodedFormData> data = complexFormData(); - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); char c; size_t readSize; EXPECT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(&c, 1, kNone, &readSize)); HandleReaderRunner<HandleReader> runner(std::move(handle)); testing::runPendingTasks(); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("bar", toString(r->data())); } @@ -219,25 +220,25 @@ TEST_F(FetchFormDataConsumerHandleTest, TwoPhaseReadFromComplexFormData) { RefPtr<EncodedFormData> data = complexFormData(); - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); char c; size_t readSize; EXPECT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(&c, 1, kNone, &readSize)); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); testing::runPendingTasks(); - std::unique_ptr<HandleReadResult> r = runner.wait(); + OwnPtr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("bar", toString(r->data())); } TEST_F(FetchFormDataConsumerHandleTest, DrainAsBlobDataHandleFromString) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -251,8 +252,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsBlobDataHandleFromArrayBuffer) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -271,8 +272,8 @@ data->append("name2", "value2"); RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData(); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -288,8 +289,8 @@ { RefPtr<EncodedFormData> inputFormData = complexFormData(); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -301,8 +302,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsFormDataFromString) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); ASSERT_TRUE(formData); EXPECT_TRUE(formData->isSafeToSendToAnotherThread()); @@ -316,8 +317,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsFormDataFromArrayBuffer) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); ASSERT_TRUE(formData); EXPECT_TRUE(formData->isSafeToSendToAnotherThread()); @@ -331,8 +332,8 @@ data->append("name2", "value2"); RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData(); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> outputFormData = reader->drainAsFormData(); ASSERT_TRUE(outputFormData); EXPECT_TRUE(outputFormData->isSafeToSendToAnotherThread()); @@ -344,8 +345,8 @@ { RefPtr<EncodedFormData> inputFormData = complexFormData(); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> outputFormData = reader->drainAsFormData(); ASSERT_TRUE(outputFormData); EXPECT_TRUE(outputFormData->isSafeToSendToAnotherThread()); @@ -355,8 +356,8 @@ TEST_F(FetchFormDataConsumerHandleTest, ZeroByteReadDoesNotAffectDraining) { - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kOk, reader->read(nullptr, 0, kNone, &readSize)); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); @@ -368,8 +369,8 @@ TEST_F(FetchFormDataConsumerHandleTest, OneByteReadAffectsDraining) { char c; - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kOk, reader->read(&c, 1, kNone, &readSize)); EXPECT_EQ(1u, readSize); @@ -380,8 +381,8 @@ TEST_F(FetchFormDataConsumerHandleTest, BeginReadAffectsDraining) { const void* buffer = nullptr; - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t available; EXPECT_EQ(kOk, reader->beginRead(&buffer, kNone, &available)); ASSERT_TRUE(buffer); @@ -393,11 +394,11 @@ TEST_F(FetchFormDataConsumerHandleTest, ZeroByteReadDoesNotAffectDrainingForComplexFormData) { - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kShouldWait, reader->read(nullptr, 0, kNone, &readSize)); testing::runPendingTasks(); @@ -410,11 +411,11 @@ TEST_F(FetchFormDataConsumerHandleTest, OneByteReadAffectsDrainingForComplexFormData) { - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); char c; size_t readSize; EXPECT_EQ(kShouldWait, reader->read(&c, 1, kNone, &readSize)); @@ -427,12 +428,12 @@ TEST_F(FetchFormDataConsumerHandleTest, BeginReadAffectsDrainingForComplexFormData) { - std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); + OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); const void* buffer = nullptr; - std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t available; EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); testing::runPendingTasks();
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp index aa54baf1..cb329ed 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
@@ -6,7 +6,7 @@ #include "core/fetch/FetchUtils.h" #include "platform/network/HTTPParsers.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -36,7 +36,7 @@ // "To append a name/value (|name|/|value|) pair to a header list (|list|), // append a new header whose name is |name|, byte lowercased, and value is // |value|, to |list|." - m_headerList.append(wrapUnique(new Header(name.lower(), value))); + m_headerList.append(adoptPtr(new Header(name.lower(), value))); } void FetchHeaderList::set(const String& name, const String& value) @@ -61,7 +61,7 @@ return; } } - m_headerList.append(wrapUnique(new Header(lowercasedName, value))); + m_headerList.append(adoptPtr(new Header(lowercasedName, value))); } String FetchHeaderList::extractMIMEType() const
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h index e22abab..2aa9d0f 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h +++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h
@@ -7,10 +7,10 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> #include <utility> namespace blink { @@ -39,7 +39,7 @@ bool containsNonSimpleHeader() const; - const Vector<std::unique_ptr<Header>>& list() const { return m_headerList; } + const Vector<OwnPtr<Header>>& list() const { return m_headerList; } const Header& entry(size_t index) const { return *(m_headerList[index].get()); } static bool isValidHeaderName(const String&); @@ -49,7 +49,7 @@ private: FetchHeaderList(); - Vector<std::unique_ptr<Header>> m_headerList; + Vector<OwnPtr<Header>> m_headerList; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp index 742c0f6..482e116 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
@@ -38,9 +38,9 @@ #include "platform/weborigin/SecurityPolicy.h" #include "public/platform/WebURLRequest.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -64,7 +64,7 @@ ~Loader() override; DECLARE_VIRTUAL_TRACE(); - void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; void didFailAccessControlCheck(const ResourceError&) override; @@ -80,7 +80,7 @@ // SRIVerifier takes ownership of |handle| and |response|. // |updater| must be garbage collected. The other arguments // all must have the lifetime of the give loader. - SRIVerifier(std::unique_ptr<WebDataConsumerHandle> handle, CompositeDataConsumerHandle::Updater* updater, Response* response, FetchManager::Loader* loader, String integrityMetadata, const KURL& url) + SRIVerifier(PassOwnPtr<WebDataConsumerHandle> handle, CompositeDataConsumerHandle::Updater* updater, Response* response, FetchManager::Loader* loader, String integrityMetadata, const KURL& url) : m_handle(std::move(handle)) , m_updater(updater) , m_response(response) @@ -141,13 +141,13 @@ visitor->trace(m_loader); } private: - std::unique_ptr<WebDataConsumerHandle> m_handle; + OwnPtr<WebDataConsumerHandle> m_handle; Member<CompositeDataConsumerHandle::Updater> m_updater; Member<Response> m_response; Member<FetchManager::Loader> m_loader; String m_integrityMetadata; KURL m_url; - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + OwnPtr<WebDataConsumerHandle::Reader> m_reader; Vector<char> m_buffer; bool m_finished; }; @@ -167,7 +167,7 @@ Member<FetchManager> m_fetchManager; Member<ScriptPromiseResolver> m_resolver; Member<FetchRequestData> m_request; - std::unique_ptr<ThreadableLoader> m_loader; + OwnPtr<ThreadableLoader> m_loader; bool m_failed; bool m_finished; int m_responseHttpStatusCode; @@ -206,7 +206,7 @@ visitor->trace(m_executionContext); } -void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT(handle); @@ -562,7 +562,7 @@ request.setHTTPMethod(m_request->method()); request.setFetchRequestMode(m_request->mode()); request.setFetchCredentialsMode(m_request->credentials()); - const Vector<std::unique_ptr<FetchHeaderList::Header>>& list = m_request->headerList()->list(); + const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList()->list(); for (size_t i = 0; i < list.size(); ++i) { request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(list[i]->second)); }
diff --git a/third_party/WebKit/Source/modules/fetch/FetchRequestData.h b/third_party/WebKit/Source/modules/fetch/FetchRequestData.h index 2ba45e8..3935f79 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchRequestData.h +++ b/third_party/WebKit/Source/modules/fetch/FetchRequestData.h
@@ -12,6 +12,7 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "public/platform/WebURLRequest.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp index 17bfc8c5..9e10c5a8 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
@@ -11,7 +11,6 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/FetchHeaderList.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -190,7 +189,7 @@ FetchResponseData* newResponse = create(); newResponse->m_type = m_type; if (m_terminationReason) { - newResponse->m_terminationReason = wrapUnique(new TerminationReason); + newResponse->m_terminationReason = adoptPtr(new TerminationReason); *newResponse->m_terminationReason = *m_terminationReason; } newResponse->m_url = m_url;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.h b/third_party/WebKit/Source/modules/fetch/FetchResponseData.h index b4aab02..5f066dec 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.h +++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.h
@@ -12,7 +12,6 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" #include "wtf/PassRefPtr.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -89,7 +88,7 @@ FetchResponseData(Type, unsigned short, AtomicString); Type m_type; - std::unique_ptr<TerminationReason> m_terminationReason; + OwnPtr<TerminationReason> m_terminationReason; KURL m_url; unsigned short m_status; AtomicString m_statusMessage;
diff --git a/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp b/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp index 12bbb679..872a327 100644 --- a/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp +++ b/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp
@@ -12,6 +12,7 @@ #include "modules/fetch/Request.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/Headers.h b/third_party/WebKit/Source/modules/fetch/Headers.h index ab97171..e1c6c4e7 100644 --- a/third_party/WebKit/Source/modules/fetch/Headers.h +++ b/third_party/WebKit/Source/modules/fetch/Headers.h
@@ -11,6 +11,7 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchHeaderList.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h index 905f0b7..cb14457 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
@@ -9,9 +9,8 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchDataConsumerHandle.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -30,9 +29,9 @@ class MODULES_EXPORT ReadableStreamDataConsumerHandle final : public FetchDataConsumerHandle { WTF_MAKE_NONCOPYABLE(ReadableStreamDataConsumerHandle); public: - static std::unique_ptr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, ScriptValue streamReader) + static PassOwnPtr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, ScriptValue streamReader) { - return wrapUnique(new ReadableStreamDataConsumerHandle(scriptState, streamReader)); + return adoptPtr(new ReadableStreamDataConsumerHandle(scriptState, streamReader)); } ~ReadableStreamDataConsumerHandle() override;
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp index 3cfcf1a8..fd89148 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp
@@ -16,7 +16,6 @@ #include "public/platform/WebDataConsumerHandle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> // TODO(yhirano): Add cross-thread tests once the handle gets thread-safe. @@ -82,7 +81,7 @@ return r; } - std::unique_ptr<ReadableStreamDataConsumerHandle> createHandle(ScriptValue stream) + PassOwnPtr<ReadableStreamDataConsumerHandle> createHandle(ScriptValue stream) { NonThrowableExceptionState es; ScriptValue reader = ReadableStreamOperations::getReader(getScriptState(), stream, es); @@ -94,7 +93,7 @@ void gc() { V8GCController::collectAllGarbageForTesting(isolate()); } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(ReadableStreamDataConsumerHandleTest, Create) @@ -102,7 +101,7 @@ ScriptState::Scope scope(getScriptState()); ScriptValue stream(getScriptState(), evalWithPrintingError("new ReadableStream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -112,7 +111,7 @@ EXPECT_CALL(*client, didGetReadable()); EXPECT_CALL(checkpoint, Call(2)); - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -125,7 +124,7 @@ ScriptValue stream(getScriptState(), evalWithPrintingError( "new ReadableStream({start: c => c.close()})")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -139,7 +138,7 @@ char c; size_t readBytes; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -156,7 +155,7 @@ ScriptValue stream(getScriptState(), evalWithPrintingError( "new ReadableStream({start: c => c.error()})")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -170,7 +169,7 @@ char c; size_t readBytes; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -193,7 +192,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -213,7 +212,7 @@ char buffer[3]; size_t readBytes; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -261,7 +260,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -281,7 +280,7 @@ const void* buffer; size_t available; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -338,7 +337,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -352,7 +351,7 @@ const void* buffer; size_t available; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -373,7 +372,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -387,7 +386,7 @@ const void* buffer; size_t available; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -408,7 +407,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -422,7 +421,7 @@ const void* buffer; size_t available; - std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -435,7 +434,7 @@ TEST_F(ReadableStreamDataConsumerHandleTest, StreamReaderShouldBeWeak) { - std::unique_ptr<FetchDataConsumerHandle::Reader> reader; + OwnPtr<FetchDataConsumerHandle::Reader> reader; Checkpoint checkpoint; Persistent<MockClient> client = MockClient::create(); ScriptValue stream; @@ -453,7 +452,7 @@ ScriptState::Scope scope(getScriptState()); stream = ScriptValue(getScriptState(), evalWithPrintingError("new ReadableStream()")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); reader = handle->obtainReader(client); @@ -476,7 +475,7 @@ TEST_F(ReadableStreamDataConsumerHandleTest, StreamReaderShouldBeWeakWhenReading) { - std::unique_ptr<FetchDataConsumerHandle::Reader> reader; + OwnPtr<FetchDataConsumerHandle::Reader> reader; Checkpoint checkpoint; Persistent<MockClient> client = MockClient::create(); ScriptValue stream; @@ -495,7 +494,7 @@ ScriptState::Scope scope(getScriptState()); stream = ScriptValue(getScriptState(), evalWithPrintingError("new ReadableStream()")); ASSERT_FALSE(stream.isEmpty()); - std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); reader = handle->obtainReader(client);
diff --git a/third_party/WebKit/Source/modules/fetch/RequestInit.h b/third_party/WebKit/Source/modules/fetch/RequestInit.h index 593f713..7fbf8e2 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestInit.h +++ b/third_party/WebKit/Source/modules/fetch/RequestInit.h
@@ -9,9 +9,9 @@ #include "platform/heap/Handle.h" #include "platform/network/EncodedFormData.h" #include "platform/weborigin/Referrer.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -29,7 +29,7 @@ Member<Headers> headers; Dictionary headersDictionary; String contentType; - std::unique_ptr<FetchDataConsumerHandle> body; + OwnPtr<FetchDataConsumerHandle> body; Referrer referrer; String mode; String credentials;
diff --git a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp index a264e1e..cb56d27 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp
@@ -14,7 +14,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashMap.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { namespace { @@ -28,7 +27,7 @@ ExecutionContext* getExecutionContext() { return getScriptState()->getExecutionContext(); } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(ServiceWorkerRequestTest, FromString)
diff --git a/third_party/WebKit/Source/modules/fetch/Response.cpp b/third_party/WebKit/Source/modules/fetch/Response.cpp index d801f76..6d74e14 100644 --- a/third_party/WebKit/Source/modules/fetch/Response.cpp +++ b/third_party/WebKit/Source/modules/fetch/Response.cpp
@@ -29,7 +29,6 @@ #include "platform/network/HTTPHeaderMap.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -147,7 +146,7 @@ if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) { bodyBuffer = new BodyStreamBuffer(scriptState, bodyValue); } else { - std::unique_ptr<FetchDataConsumerHandle> bodyHandle; + OwnPtr<FetchDataConsumerHandle> bodyHandle; reader = ReadableStreamOperations::getReader(scriptState, bodyValue, exceptionState); if (exceptionState.hadException()) { reader = ScriptValue();
diff --git a/third_party/WebKit/Source/modules/fetch/Response.h b/third_party/WebKit/Source/modules/fetch/Response.h index 4f91a0d..01c16c42 100644 --- a/third_party/WebKit/Source/modules/fetch/Response.h +++ b/third_party/WebKit/Source/modules/fetch/Response.h
@@ -15,6 +15,7 @@ #include "modules/fetch/Headers.h" #include "platform/blob/BlobData.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp index 0fee482..a1fad617 100644 --- a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp
@@ -17,13 +17,11 @@ #include "platform/testing/UnitTestHelpers.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { -std::unique_ptr<WebServiceWorkerResponse> createTestWebServiceWorkerResponse() +PassOwnPtr<WebServiceWorkerResponse> createTestWebServiceWorkerResponse() { const KURL url(ParsedURLString, "http://www.webresponse.com/"); const unsigned short status = 200; @@ -33,7 +31,7 @@ const char* value; } headers[] = { { "cache-control", "no-cache" }, { "set-cookie", "foop" }, { "foo", "bar" }, { 0, 0 } }; - std::unique_ptr<WebServiceWorkerResponse> webResponse = wrapUnique(new WebServiceWorkerResponse()); + OwnPtr<WebServiceWorkerResponse> webResponse = adoptPtr(new WebServiceWorkerResponse()); webResponse->setURL(url); webResponse->setStatus(status); webResponse->setStatusText(statusText); @@ -52,7 +50,7 @@ ExecutionContext* getExecutionContext() { return getScriptState()->getExecutionContext(); } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; @@ -70,7 +68,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponse) { - std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); Response* response = Response::create(getScriptState(), *webResponse); ASSERT(response); EXPECT_EQ(webResponse->url(), response->url()); @@ -91,7 +89,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseDefault) { - std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeDefault); Response* response = Response::create(getScriptState(), *webResponse); @@ -105,7 +103,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseBasic) { - std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeBasic); Response* response = Response::create(getScriptState(), *webResponse); @@ -119,7 +117,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseCORS) { - std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeCORS); Response* response = Response::create(getScriptState(), *webResponse); @@ -133,7 +131,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseOpaque) { - std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeOpaque); Response* response = Response::create(getScriptState(), *webResponse); @@ -189,7 +187,7 @@ BodyStreamBuffer* createHelloWorldBuffer(ScriptState* scriptState) { using Command = DataConsumerHandleTestUtil::Command; - std::unique_ptr<DataConsumerHandleTestUtil::ReplayingHandle> src(DataConsumerHandleTestUtil::ReplayingHandle::create()); + OwnPtr<DataConsumerHandleTestUtil::ReplayingHandle> src(DataConsumerHandleTestUtil::ReplayingHandle::create()); src->add(Command(Command::Data, "Hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done));
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp index 4f66b32..980c34d 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
@@ -46,9 +46,9 @@ #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" #include "public/platform/WebSecurityOrigin.h" +#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -160,7 +160,7 @@ FileWriter* fileWriter = FileWriter::create(getExecutionContext()); FileWriterBaseCallback* conversionCallback = ConvertToFileWriterCallback::create(successCallback); - std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, conversionCallback, errorCallback, m_context); + OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, conversionCallback, errorCallback, m_context); fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, std::move(callbacks)); }
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp index 02cf027..07fb06f4 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp
@@ -48,9 +48,9 @@ #include "public/platform/Platform.h" #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" +#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -222,7 +222,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, m_context, this)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->readMetadata(createFileSystemURL(entry), std::move(callbacks)); } @@ -269,7 +269,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); + OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->move(createFileSystemURL(source), parent->filesystem()->createFileSystemURL(destinationPath), std::move(callbacks)); @@ -288,7 +288,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); + OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->createFileSystemURL(destinationPath), std::move(callbacks)); @@ -308,7 +308,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->remove(createFileSystemURL(entry), std::move(callbacks)); @@ -328,7 +328,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->removeRecursively(createFileSystemURL(entry), std::move(callbacks)); @@ -360,7 +360,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) @@ -382,7 +382,7 @@ return; } - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, true)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, true)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) @@ -400,7 +400,7 @@ ASSERT(DOMFilePath::isAbsolute(path)); - std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successCallback, errorCallback, m_context, reader, path)); + OwnPtr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successCallback, errorCallback, m_context, reader, path)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); return fileSystem()->readDirectory(createFileSystemURL(path), std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp index e57da4d..c5f2012 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp
@@ -43,8 +43,6 @@ #include "platform/FileMetadata.h" #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -103,9 +101,9 @@ } }; - static std::unique_ptr<AsyncFileSystemCallbacks> create(CreateFileResult* result, const String& name, const KURL& url, FileSystemType type) + static PassOwnPtr<AsyncFileSystemCallbacks> create(CreateFileResult* result, const String& name, const KURL& url, FileSystemType type) { - return wrapUnique(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHelper(result, name, url, type))); + return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHelper(result, name, url, type))); } void didFail(int code) override @@ -214,7 +212,7 @@ FileError::ErrorCode errorCode = FileError::OK; LocalErrorCallback* errorCallback = LocalErrorCallback::create(errorCode); - std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, successCallback, errorCallback, m_context); + OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, successCallback, errorCallback, m_context); callbacks->setShouldBlockUntilCompletion(true); fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp index 34c58f2..b88517d 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp
@@ -51,8 +51,6 @@ #include "modules/filesystem/MetadataCallback.h" #include "platform/FileMetadata.h" #include "public/platform/WebFileWriter.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -106,9 +104,9 @@ // EntryCallbacks ------------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) +PassOwnPtr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) { - return wrapUnique(new EntryCallbacks(successCallback, errorCallback, context, fileSystem, expectedPath, isDirectory)); + return adoptPtr(new EntryCallbacks(successCallback, errorCallback, context, fileSystem, expectedPath, isDirectory)); } EntryCallbacks::EntryCallbacks(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) @@ -131,9 +129,9 @@ // EntriesCallbacks ----------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> EntriesCallbacks::create(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) +PassOwnPtr<AsyncFileSystemCallbacks> EntriesCallbacks::create(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) { - return wrapUnique(new EntriesCallbacks(successCallback, errorCallback, context, directoryReader, basePath)); + return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, context, directoryReader, basePath)); } EntriesCallbacks::EntriesCallbacks(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) @@ -165,9 +163,9 @@ // FileSystemCallbacks -------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> FileSystemCallbacks::create(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) +PassOwnPtr<AsyncFileSystemCallbacks> FileSystemCallbacks::create(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) { - return wrapUnique(new FileSystemCallbacks(successCallback, errorCallback, context, type)); + return adoptPtr(new FileSystemCallbacks(successCallback, errorCallback, context, type)); } FileSystemCallbacks::FileSystemCallbacks(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) @@ -185,9 +183,9 @@ // ResolveURICallbacks -------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +PassOwnPtr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return wrapUnique(new ResolveURICallbacks(successCallback, errorCallback, context)); + return adoptPtr(new ResolveURICallbacks(successCallback, errorCallback, context)); } ResolveURICallbacks::ResolveURICallbacks(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -215,9 +213,9 @@ // MetadataCallbacks ---------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> MetadataCallbacks::create(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) +PassOwnPtr<AsyncFileSystemCallbacks> MetadataCallbacks::create(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) { - return wrapUnique(new MetadataCallbacks(successCallback, errorCallback, context, fileSystem)); + return adoptPtr(new MetadataCallbacks(successCallback, errorCallback, context, fileSystem)); } MetadataCallbacks::MetadataCallbacks(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) @@ -234,9 +232,9 @@ // FileWriterBaseCallbacks ---------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +PassOwnPtr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return wrapUnique(new FileWriterBaseCallbacks(fileWriter, successCallback, errorCallback, context)); + return adoptPtr(new FileWriterBaseCallbacks(fileWriter, successCallback, errorCallback, context)); } FileWriterBaseCallbacks::FileWriterBaseCallbacks(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -246,7 +244,7 @@ { } -void FileWriterBaseCallbacks::didCreateFileWriter(std::unique_ptr<WebFileWriter> fileWriter, long long length) +void FileWriterBaseCallbacks::didCreateFileWriter(PassOwnPtr<WebFileWriter> fileWriter, long long length) { m_fileWriter->initialize(std::move(fileWriter), length); if (m_successCallback) @@ -255,9 +253,9 @@ // SnapshotFileCallback ------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +PassOwnPtr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return wrapUnique(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback, context)); + return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback, context)); } SnapshotFileCallback::SnapshotFileCallback(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -283,9 +281,9 @@ // VoidCallbacks -------------------------------------------------------------- -std::unique_ptr<AsyncFileSystemCallbacks> VoidCallbacks::create(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) +PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) { - return wrapUnique(new VoidCallbacks(successCallback, errorCallback, context, fileSystem)); + return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, fileSystem)); } VoidCallbacks::VoidCallbacks(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem)
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h index 937f0573..0deb73a 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h
@@ -36,7 +36,6 @@ #include "platform/FileSystemType.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -84,7 +83,7 @@ class EntryCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*, const String& expectedPath, bool isDirectory); + static PassOwnPtr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*, const String& expectedPath, bool isDirectory); void didSucceed() override; private: @@ -96,7 +95,7 @@ class EntriesCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(EntriesCallback*, ErrorCallback*, ExecutionContext*, DirectoryReaderBase*, const String& basePath); + static PassOwnPtr<AsyncFileSystemCallbacks> create(EntriesCallback*, ErrorCallback*, ExecutionContext*, DirectoryReaderBase*, const String& basePath); void didReadDirectoryEntry(const String& name, bool isDirectory) override; void didReadDirectoryEntries(bool hasMore) override; @@ -110,7 +109,7 @@ class FileSystemCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(FileSystemCallback*, ErrorCallback*, ExecutionContext*, FileSystemType); + static PassOwnPtr<AsyncFileSystemCallbacks> create(FileSystemCallback*, ErrorCallback*, ExecutionContext*, FileSystemType); void didOpenFileSystem(const String& name, const KURL& rootURL) override; private: @@ -121,7 +120,7 @@ class ResolveURICallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*); + static PassOwnPtr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*); void didResolveURL(const String& name, const KURL& rootURL, FileSystemType, const String& filePath, bool isDirectry) override; private: @@ -131,7 +130,7 @@ class MetadataCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); + static PassOwnPtr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); void didReadMetadata(const FileMetadata&) override; private: @@ -141,8 +140,8 @@ class FileWriterBaseCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); - void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long length) override; + static PassOwnPtr<AsyncFileSystemCallbacks> create(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); + void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length) override; private: FileWriterBaseCallbacks(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); @@ -152,7 +151,7 @@ class SnapshotFileCallback final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const String& name, const KURL&, BlobCallback*, ErrorCallback*, ExecutionContext*); + static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const String& name, const KURL&, BlobCallback*, ErrorCallback*, ExecutionContext*); virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataHandle> snapshot); private: @@ -164,7 +163,7 @@ class VoidCallbacks final : public FileSystemCallbacksBase { public: - static std::unique_ptr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); + static PassOwnPtr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); void didSucceed() override; private:
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h b/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h index 772a179b..7fb2fc30 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h
@@ -36,7 +36,6 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -53,12 +52,12 @@ virtual ~FileSystemClient() { } virtual bool requestFileSystemAccessSync(ExecutionContext*) = 0; - virtual void requestFileSystemAccessAsync(ExecutionContext*, std::unique_ptr<ContentSettingCallbacks>) = 0; + virtual void requestFileSystemAccessAsync(ExecutionContext*, PassOwnPtr<ContentSettingCallbacks>) = 0; }; -MODULES_EXPORT void provideLocalFileSystemTo(LocalFrame&, std::unique_ptr<FileSystemClient>); +MODULES_EXPORT void provideLocalFileSystemTo(LocalFrame&, PassOwnPtr<FileSystemClient>); -MODULES_EXPORT void provideLocalFileSystemToWorker(WorkerClients*, std::unique_ptr<FileSystemClient>); +MODULES_EXPORT void provideLocalFileSystemToWorker(WorkerClients*, PassOwnPtr<FileSystemClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp index 46da89cf..ab9f91b 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp +++ b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp
@@ -34,7 +34,6 @@ #include "core/fileapi/Blob.h" #include "core/fileapi/FileError.h" #include "public/platform/WebFileWriter.h" -#include <memory> namespace blink { @@ -42,7 +41,7 @@ { } -void FileWriterBase::initialize(std::unique_ptr<WebFileWriter> writer, long long length) +void FileWriterBase::initialize(PassOwnPtr<WebFileWriter> writer, long long length) { ASSERT(!m_writer); ASSERT(length >= 0);
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h index dcace75a0..89d97d9 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h +++ b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h
@@ -32,7 +32,8 @@ #define FileWriterBase_h #include "platform/heap/Handle.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -41,7 +42,7 @@ class FileWriterBase : public GarbageCollectedMixin { public: virtual ~FileWriterBase(); - void initialize(std::unique_ptr<WebFileWriter>, long long length); + void initialize(PassOwnPtr<WebFileWriter>, long long length); long long position() const { @@ -75,7 +76,7 @@ void seekInternal(long long position); private: - std::unique_ptr<WebFileWriter> m_writer; + OwnPtr<WebFileWriter> m_writer; long long m_position; long long m_length; };
diff --git a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp index 3db0b122..10feb91 100644 --- a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp
@@ -42,13 +42,12 @@ #include "public/platform/Platform.h" #include "public/platform/WebFileSystem.h" #include "wtf/Functional.h" -#include <memory> namespace blink { namespace { -void reportFailure(std::unique_ptr<AsyncFileSystemCallbacks> callbacks, FileError::ErrorCode error) +void reportFailure(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileError::ErrorCode error) { callbacks->didFail(error); } @@ -57,12 +56,12 @@ class CallbackWrapper final : public GarbageCollectedFinalized<CallbackWrapper> { public: - CallbackWrapper(std::unique_ptr<AsyncFileSystemCallbacks> c) + CallbackWrapper(PassOwnPtr<AsyncFileSystemCallbacks> c) : m_callbacks(std::move(c)) { } virtual ~CallbackWrapper() { } - std::unique_ptr<AsyncFileSystemCallbacks> release() + PassOwnPtr<AsyncFileSystemCallbacks> release() { return std::move(m_callbacks); } @@ -70,10 +69,10 @@ DEFINE_INLINE_TRACE() { } private: - std::unique_ptr<AsyncFileSystemCallbacks> m_callbacks; + OwnPtr<AsyncFileSystemCallbacks> m_callbacks; }; -LocalFileSystem* LocalFileSystem::create(std::unique_ptr<FileSystemClient> client) +LocalFileSystem* LocalFileSystem::create(PassOwnPtr<FileSystemClient> client) { return new LocalFileSystem(std::move(client)); } @@ -82,7 +81,7 @@ { } -void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSystemURL, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSystemURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); requestFileSystemAccessInternal(context, @@ -90,7 +89,7 @@ bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrapper)); } -void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemType type, long long size, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); requestFileSystemAccessInternal(context, @@ -98,7 +97,7 @@ bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrapper)); } -void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { ASSERT(context); ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); @@ -190,7 +189,7 @@ fileSystem->deleteFileSystem(storagePartition, static_cast<WebFileSystemType>(type), callbacks->release()); } -LocalFileSystem::LocalFileSystem(std::unique_ptr<FileSystemClient> client) +LocalFileSystem::LocalFileSystem(PassOwnPtr<FileSystemClient> client) : m_client(std::move(client)) { } @@ -210,12 +209,12 @@ return static_cast<LocalFileSystem*>(Supplement<WorkerClients>::from(clients, supplementName())); } -void provideLocalFileSystemTo(LocalFrame& frame, std::unique_ptr<FileSystemClient> client) +void provideLocalFileSystemTo(LocalFrame& frame, PassOwnPtr<FileSystemClient> client) { frame.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::create(std::move(client))); } -void provideLocalFileSystemToWorker(WorkerClients* clients, std::unique_ptr<FileSystemClient> client) +void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSystemClient> client) { clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h index 1255126..696d955 100644 --- a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h +++ b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h
@@ -37,7 +37,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -53,12 +53,12 @@ USING_GARBAGE_COLLECTED_MIXIN(LocalFileSystem); WTF_MAKE_NONCOPYABLE(LocalFileSystem); public: - static LocalFileSystem* create(std::unique_ptr<FileSystemClient>); + static LocalFileSystem* create(PassOwnPtr<FileSystemClient>); ~LocalFileSystem(); - void resolveURL(ExecutionContext*, const KURL&, std::unique_ptr<AsyncFileSystemCallbacks>); - void requestFileSystem(ExecutionContext*, FileSystemType, long long size, std::unique_ptr<AsyncFileSystemCallbacks>); - void deleteFileSystem(ExecutionContext*, FileSystemType, std::unique_ptr<AsyncFileSystemCallbacks>); + void resolveURL(ExecutionContext*, const KURL&, PassOwnPtr<AsyncFileSystemCallbacks>); + void requestFileSystem(ExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>); + void deleteFileSystem(ExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>); FileSystemClient* client() const { return m_client.get(); } @@ -72,7 +72,7 @@ } private: - explicit LocalFileSystem(std::unique_ptr<FileSystemClient>); + explicit LocalFileSystem(PassOwnPtr<FileSystemClient>); WebFileSystem* getFileSystem() const; void fileSystemNotAvailable(ExecutionContext*, CallbackWrapper*); @@ -83,7 +83,7 @@ void resolveURLInternal(ExecutionContext*, const KURL&, CallbackWrapper*); void deleteFileSystemInternal(ExecutionContext*, FileSystemType, CallbackWrapper*); - std::unique_ptr<FileSystemClient> m_client; + OwnPtr<FileSystemClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp index b9e309b..7a0841c0 100644 --- a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
@@ -41,7 +41,6 @@ #include "modules/filesystem/SyncCallbackHelper.h" #include "platform/FileSystemType.h" #include "platform/weborigin/SecurityOrigin.h" -#include <memory> namespace blink { @@ -77,7 +76,7 @@ } FileSystemSyncCallbackHelper* helper = FileSystemSyncCallbackHelper::create(); - std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(helper->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType); + OwnPtr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(helper->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType); callbacks->setShouldBlockUntilCompletion(true); LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, size, std::move(callbacks)); @@ -116,7 +115,7 @@ } EntrySyncCallbackHelper* resolveURLHelper = EntrySyncCallbackHelper::create(); - std::unique_ptr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(resolveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &worker); + OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(resolveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &worker); callbacks->setShouldBlockUntilCompletion(true); LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp index fb0aaf17..7e04c0c 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -20,7 +20,6 @@ #include "public/platform/ServiceRegistry.h" #include "public/platform/WebImageCaptureFrameGrabber.h" #include "public/platform/WebMediaStreamTrack.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -160,7 +159,7 @@ // Create |m_frameGrabber| the first time. if (!m_frameGrabber) - m_frameGrabber = wrapUnique(Platform::current()->createImageCaptureFrameGrabber()); + m_frameGrabber = adoptPtr(Platform::current()->createImageCaptureFrameGrabber()); if (!m_frameGrabber) { resolver->reject(DOMException::create(UnknownError, "Couldn't create platform resources"));
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h index 88662e5..93c396a 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h
@@ -13,7 +13,6 @@ #include "modules/EventTargetModules.h" #include "modules/ModulesExport.h" #include "platform/AsyncMethodRunner.h" -#include <memory> namespace blink { @@ -65,7 +64,7 @@ void onServiceConnectionError(); Member<MediaStreamTrack> m_streamTrack; - std::unique_ptr<WebImageCaptureFrameGrabber> m_frameGrabber; + OwnPtr<WebImageCaptureFrameGrabber> m_frameGrabber; media::mojom::blink::ImageCapturePtr m_service; HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp index c168f0a2..f0a5cfab 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
@@ -42,19 +42,18 @@ #include "public/platform/modules/indexeddb/WebIDBDatabase.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" #include <limits> -#include <memory> using blink::WebIDBCursor; using blink::WebIDBDatabase; namespace blink { -IDBCursor* IDBCursor::create(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursor* IDBCursor::create(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) { return new IDBCursor(std::move(backend), direction, request, source, transaction); } -IDBCursor::IDBCursor(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursor::IDBCursor(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) : m_backend(std::move(backend)) , m_request(request) , m_direction(direction) @@ -149,7 +148,7 @@ m_request->setPendingCursor(this); m_gotValue = false; - m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).release()); + m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); } void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& keyValue, ExceptionState& exceptionState) @@ -243,7 +242,7 @@ // will be on the original context openCursor was called on. Is this right? m_request->setPendingCursor(this); m_gotValue = false; - m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).release()); + m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).leakPtr()); } IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& exceptionState) @@ -283,7 +282,7 @@ ASSERT(!exceptionState.hadException()); IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, WebIDBCallbacksImpl::create(request).release()); + m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h index 57c97d5..e4af669 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h
@@ -35,7 +35,6 @@ #include "public/platform/modules/indexeddb/WebIDBTypes.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -50,7 +49,7 @@ public: static WebIDBCursorDirection stringToDirection(const String& modeString); - static IDBCursor* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); virtual ~IDBCursor(); DECLARE_TRACE(); void contextWillBeDestroyed() { m_backend.reset(); } @@ -84,12 +83,12 @@ virtual bool isCursorWithValue() const { return false; } protected: - IDBCursor(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); private: IDBObjectStore* effectiveObjectStore() const; - std::unique_ptr<WebIDBCursor> m_backend; + OwnPtr<WebIDBCursor> m_backend; Member<IDBRequest> m_request; const WebIDBCursorDirection m_direction; Member<IDBAny> m_source;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp index 047993a..c5a2793 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp
@@ -26,18 +26,17 @@ #include "modules/indexeddb/IDBCursorWithValue.h" #include "modules/indexeddb/IDBKey.h" -#include <memory> using blink::WebIDBCursor; namespace blink { -IDBCursorWithValue* IDBCursorWithValue::create(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursorWithValue* IDBCursorWithValue::create(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) { return new IDBCursorWithValue(std::move(backend), direction, request, source, transaction); } -IDBCursorWithValue::IDBCursorWithValue(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursorWithValue::IDBCursorWithValue(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) : IDBCursor(std::move(backend), direction, request, source, transaction) { }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h index 9fac966..49ab3e51 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h
@@ -30,7 +30,7 @@ #include "modules/indexeddb/IndexedDB.h" #include "public/platform/modules/indexeddb/WebIDBCursor.h" #include "public/platform/modules/indexeddb/WebIDBTypes.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -41,7 +41,7 @@ class IDBCursorWithValue final : public IDBCursor { DEFINE_WRAPPERTYPEINFO(); public: - static IDBCursorWithValue* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + static IDBCursorWithValue* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); ~IDBCursorWithValue() override; // The value attribute defined in the IDL is simply implemented in IDBCursor (but not exposed via @@ -51,7 +51,7 @@ bool isCursorWithValue() const override { return true; } private: - IDBCursorWithValue(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + IDBCursorWithValue(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); }; DEFINE_TYPE_CASTS(IDBCursorWithValue, IDBCursor, cursor, cursor->isCursorWithValue(), cursor.isCursorWithValue());
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp index fa8eda5..48c1da54 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
@@ -45,7 +45,6 @@ #include "public/platform/modules/indexeddb/WebIDBTypes.h" #include "wtf/Atomics.h" #include <limits> -#include <memory> using blink::WebIDBDatabase; @@ -67,14 +66,14 @@ const char IDBDatabase::transactionReadOnlyErrorMessage[] = "The transaction is read-only."; const char IDBDatabase::databaseClosedErrorMessage[] = "The database connection is closed."; -IDBDatabase* IDBDatabase::create(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks) +IDBDatabase* IDBDatabase::create(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks) { IDBDatabase* idbDatabase = new IDBDatabase(context, std::move(database), callbacks); idbDatabase->suspendIfNeeded(); return idbDatabase; } -IDBDatabase::IDBDatabase(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks) +IDBDatabase::IDBDatabase(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_backend(std::move(backend)) @@ -312,7 +311,7 @@ } int64_t transactionId = nextTransactionId(); - m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::create(m_databaseCallbacks).release(), objectStoreIds, mode); + m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::create(m_databaseCallbacks).leakPtr(), objectStoreIds, mode); return IDBTransaction::create(scriptState, transactionId, scope, mode, this); }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h index 51fe135..ff099ff 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
@@ -43,9 +43,10 @@ #include "modules/indexeddb/IndexedDB.h" #include "platform/heap/Handle.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -60,7 +61,7 @@ USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); DEFINE_WRAPPERTYPEINFO(); public: - static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*); + static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallbacks*); ~IDBDatabase() override; DECLARE_VIRTUAL_TRACE(); @@ -139,13 +140,13 @@ DispatchEventResult dispatchEventInternal(Event*) override; private: - IDBDatabase(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*); + IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallbacks*); IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionState&); void closeConnection(); IDBDatabaseMetadata m_metadata; - std::unique_ptr<WebIDBDatabase> m_backend; + OwnPtr<WebIDBDatabase> m_backend; Member<IDBTransaction> m_versionChangeTransaction; HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp index 7374353..2826402 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
@@ -45,7 +45,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebSecurityOrigin.h" #include "public/platform/modules/indexeddb/WebIDBFactory.h" -#include <memory> namespace blink { @@ -82,7 +81,7 @@ return request; } - Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::create(request).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; } @@ -116,7 +115,7 @@ return request; } - Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).release(), WebIDBDatabaseCallbacksImpl::create(databaseCallbacks).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::create(databaseCallbacks).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; } @@ -144,7 +143,7 @@ return request; } - Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl::create(request).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp index 86e21667..b7340d4 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
@@ -37,7 +37,6 @@ #include "modules/indexeddb/IDBTransaction.h" #include "modules/indexeddb/WebIDBCallbacksImpl.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" -#include <memory> using blink::WebIDBCallbacks; using blink::WebIDBCursor; @@ -102,7 +101,7 @@ { IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); - backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, false, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); + backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, false, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -132,7 +131,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, WebIDBCallbacksImpl::create(request).release()); + backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -162,7 +161,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); - backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); + backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -228,7 +227,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, keyOnly, WebIDBCallbacksImpl::create(request).release()); + backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -259,7 +258,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, maxCount, keyOnly, WebIDBCallbacksImpl::create(request).release()); + backendDB()->getAll(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, maxCount, keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp index 2f035a20..98764c5e 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -46,7 +46,6 @@ #include "public/platform/WebVector.h" #include "public/platform/modules/indexeddb/WebIDBKey.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" -#include <memory> #include <v8.h> using blink::WebBlobInfo; @@ -114,7 +113,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, false, WebIDBCallbacksImpl::create(request).release()); + backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, false, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -150,7 +149,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, false, WebIDBCallbacksImpl::create(request).release()); + backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, false, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -186,7 +185,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).release()); + backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -341,7 +340,7 @@ serializedValue->toWireBytes(wireBytes); RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); - backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo, key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).release(), indexIds, indexKeys); + backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo, key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys); return request; } @@ -378,7 +377,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallbacksImpl::create(request).release()); + backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -407,7 +406,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).release()); + backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -666,7 +665,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); - backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).release()); + backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -699,7 +698,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); - backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); + backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); return request; } @@ -729,7 +728,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, WebIDBCallbacksImpl::create(request).release()); + backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp index 9be4f6b..ce8ba0c 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp
@@ -33,7 +33,6 @@ #include "modules/indexeddb/IDBDatabaseCallbacks.h" #include "modules/indexeddb/IDBTracing.h" #include "modules/indexeddb/IDBVersionChangeEvent.h" -#include <memory> using blink::WebIDBDatabase; @@ -79,11 +78,11 @@ enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::blocked, oldVersion, newVersionNullable)); } -void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata, WebIDBDataLoss dataLoss, String dataLossMessage) +void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata, WebIDBDataLoss dataLoss, String dataLossMessage) { IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); if (m_contextStopped || !getExecutionContext()) { - std::unique_ptr<WebIDBDatabase> db = std::move(backend); + OwnPtr<WebIDBDatabase> db = std::move(backend); db->abort(m_transactionId); db->close(); return; @@ -111,11 +110,11 @@ enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, oldVersion, m_version, dataLoss, dataLossMessage)); } -void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata) +void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata) { IDB_TRACE("IDBOpenDBRequest::onSuccess()"); if (m_contextStopped || !getExecutionContext()) { - std::unique_ptr<WebIDBDatabase> db = std::move(backend); + OwnPtr<WebIDBDatabase> db = std::move(backend); if (db) db->close(); return;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h index 637d1a28..8347cb6 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h
@@ -29,7 +29,6 @@ #include "modules/ModulesExport.h" #include "modules/indexeddb/IDBRequest.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" -#include <memory> namespace blink { @@ -45,8 +44,8 @@ using IDBRequest::onSuccess; void onBlocked(int64_t existingVersion) override; - void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override; - void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) override; + void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override; + void onSuccess(PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&) override; void onSuccess(int64_t oldVersion) override; // EventTarget
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp index 7c1d7d8..c4157b0 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
@@ -44,7 +44,6 @@ #include "modules/indexeddb/IDBValue.h" #include "platform/SharedBuffer.h" #include "public/platform/WebBlobInfo.h" -#include <memory> using blink::WebIDBCursor; @@ -250,7 +249,7 @@ onSuccessInternal(IDBAny::create(domStringList)); } -void IDBRequest::onSuccess(std::unique_ptr<WebIDBCursor> backend, IDBKey* key, IDBKey* primaryKey, PassRefPtr<IDBValue> value) +void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey* primaryKey, PassRefPtr<IDBValue> value) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); if (!shouldEnqueueEvent())
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h index 112f0b0..16e1875 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
@@ -46,7 +46,6 @@ #include "public/platform/WebBlobInfo.h" #include "public/platform/modules/indexeddb/WebIDBCursor.h" #include "public/platform/modules/indexeddb/WebIDBTypes.h" -#include <memory> namespace blink { @@ -98,7 +97,7 @@ virtual void onError(DOMException*); virtual void onSuccess(const Vector<String>&); - virtual void onSuccess(std::unique_ptr<WebIDBCursor>, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); + virtual void onSuccess(PassOwnPtr<WebIDBCursor>, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); virtual void onSuccess(IDBKey*); virtual void onSuccess(PassRefPtr<IDBValue>); virtual void onSuccess(const Vector<RefPtr<IDBValue>>&); @@ -108,8 +107,8 @@ // Only IDBOpenDBRequest instances should receive these: virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); } - virtual void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) { ASSERT_NOT_REACHED(); } - virtual void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) { ASSERT_NOT_REACHED(); } + virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) { ASSERT_NOT_REACHED(); } + virtual void onSuccess(PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&) { ASSERT_NOT_REACHED(); } // ActiveScriptWrappable bool hasPendingActivity() const final;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp index 17c17087..f594ece9 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
@@ -39,10 +39,11 @@ #include "modules/indexeddb/MockWebIDBDatabase.h" #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/dtoa/utils.h" -#include <memory> #include <v8.h> namespace blink { @@ -96,7 +97,7 @@ Persistent<IDBDatabaseCallbacks> callbacks = IDBDatabaseCallbacks::create(); { - std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, abort(transactionId)) .Times(1); EXPECT_CALL(*backend, close()) @@ -109,7 +110,7 @@ } { - std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, close()) .Times(1); IDBOpenDBRequest* request = IDBOpenDBRequest::create(scope.getScriptState(), callbacks, transactionId, version);
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index aa6524d..6bb3ca61 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -39,8 +39,6 @@ #include "modules/indexeddb/IDBObjectStore.h" #include "modules/indexeddb/IDBOpenDBRequest.h" #include "modules/indexeddb/IDBTracing.h" -#include "wtf/PtrUtil.h" -#include <memory> using blink::WebIDBDatabase; @@ -65,9 +63,9 @@ class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask { public: - static std::unique_ptr<DeactivateTransactionTask> create(IDBTransaction* transaction) + static PassOwnPtr<DeactivateTransactionTask> create(IDBTransaction* transaction) { - return wrapUnique(new DeactivateTransactionTask(transaction)); + return adoptPtr(new DeactivateTransactionTask(transaction)); } void run() override
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp index ce3a478..6fde069 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
@@ -39,7 +39,6 @@ #include "modules/indexeddb/MockWebIDBDatabase.h" #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> #include <v8.h> namespace blink { @@ -64,7 +63,7 @@ TEST(IDBTransactionTest, EnsureLifetime) { V8TestingScope scope; - std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, close()) .Times(1); Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), FakeIDBDatabaseCallbacks::create()); @@ -99,7 +98,7 @@ V8TestingScope scope; const int64_t transactionId = 1234; - std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, commit(transactionId)) .Times(1); EXPECT_CALL(*backend, close())
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp index 5e30bc95..ca3bcd78 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
@@ -7,7 +7,6 @@ #include "platform/blob/BlobData.h" #include "public/platform/WebBlobInfo.h" #include "public/platform/modules/indexeddb/WebIDBValue.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -20,8 +19,8 @@ IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>& webBlobInfo, IDBKey* primaryKey, const IDBKeyPath& keyPath) : m_data(data) - , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) - , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(webBlobInfo.size()))) + , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>())) + , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(webBlobInfo.size()))) , m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr) , m_keyPath(keyPath) { @@ -33,8 +32,8 @@ IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath) : m_data(value->m_data) - , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) - , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(value->m_blobInfo->size()))) + , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>())) + , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(value->m_blobInfo->size()))) , m_primaryKey(primaryKey) , m_keyPath(keyPath) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.h b/third_party/WebKit/Source/modules/indexeddb/IDBValue.h index 84cccd7..69fd9c6a 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.h
@@ -10,8 +10,8 @@ #include "modules/indexeddb/IDBKeyPath.h" #include "platform/SharedBuffer.h" #include "public/platform/WebVector.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -39,8 +39,8 @@ IDBValue(const IDBValue*, IDBKey*, const IDBKeyPath&); const RefPtr<SharedBuffer> m_data; - const std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> m_blobData; - const std::unique_ptr<Vector<WebBlobInfo>> m_blobInfo; + const OwnPtr<Vector<RefPtr<BlobDataHandle>>> m_blobData; + const OwnPtr<Vector<WebBlobInfo>> m_blobInfo; const Persistent<IDBKey> m_primaryKey; const IDBKeyPath m_keyPath; };
diff --git a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h index c66535c..ea13563 100644 --- a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h +++ b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h
@@ -34,6 +34,7 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/IndexedDB.h" #include "modules/ModulesExport.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp index 1d27732..af6d5d7 100644 --- a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp
@@ -4,18 +4,15 @@ #include "MockWebIDBDatabase.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { MockWebIDBDatabase::MockWebIDBDatabase() {} MockWebIDBDatabase::~MockWebIDBDatabase() {} -std::unique_ptr<MockWebIDBDatabase> MockWebIDBDatabase::create() +PassOwnPtr<MockWebIDBDatabase> MockWebIDBDatabase::create() { - return wrapUnique(new MockWebIDBDatabase()); + return adoptPtr(new MockWebIDBDatabase()); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h index 30445548..5492dac 100644 --- a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h +++ b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h
@@ -9,8 +9,8 @@ #include "modules/indexeddb/IDBKeyRange.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" +#include "wtf/PassOwnPtr.h" #include <gmock/gmock.h> -#include <memory> namespace blink { @@ -18,7 +18,7 @@ public: virtual ~MockWebIDBDatabase(); - static std::unique_ptr<MockWebIDBDatabase> create(); + static PassOwnPtr<MockWebIDBDatabase> create(); MOCK_METHOD5(createObjectStore, void(long long transactionId, long long objectStoreId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement)); MOCK_METHOD2(deleteObjectStore, void(long long transactionId, long long objectStoreId));
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp index abecd340..b97c3024 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
@@ -39,8 +39,6 @@ #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" #include "public/platform/modules/indexeddb/WebIDBKey.h" #include "public/platform/modules/indexeddb/WebIDBValue.h" -#include "wtf/PtrUtil.h" -#include <memory> using blink::WebIDBCursor; using blink::WebIDBDatabase; @@ -54,9 +52,9 @@ namespace blink { // static -std::unique_ptr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) +PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) { - return wrapUnique(new WebIDBCallbacksImpl(request)); + return adoptPtr(new WebIDBCallbacksImpl(request)); } WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) @@ -88,13 +86,13 @@ void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebIDBValue& value) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onSuccess(wrapUnique(cursor), key, primaryKey, IDBValue::create(value)); + m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(value)); } void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadata& metadata) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onSuccess(wrapUnique(backend), IDBDatabaseMetadata(metadata)); + m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); } void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) @@ -145,7 +143,7 @@ void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dataLossMessage) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onUpgradeNeeded(oldVersion, wrapUnique(database), IDBDatabaseMetadata(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); + m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetadata(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h index 6443648..4f8d0c23 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h
@@ -30,9 +30,9 @@ #define WebIDBCallbacksImpl_h #include "public/platform/modules/indexeddb/WebIDBCallbacks.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -47,7 +47,7 @@ class WebIDBCallbacksImpl final : public WebIDBCallbacks { USING_FAST_MALLOC(WebIDBCallbacksImpl); public: - static std::unique_ptr<WebIDBCallbacksImpl> create(IDBRequest*); + static PassOwnPtr<WebIDBCallbacksImpl> create(IDBRequest*); ~WebIDBCallbacksImpl() override;
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp index d134a77f..89bcc52 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp
@@ -26,15 +26,13 @@ #include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h" #include "core/dom/DOMException.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { // static -std::unique_ptr<WebIDBDatabaseCallbacksImpl> WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) +PassOwnPtr<WebIDBDatabaseCallbacksImpl> WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) { - return wrapUnique(new WebIDBDatabaseCallbacksImpl(callbacks)); + return adoptPtr(new WebIDBDatabaseCallbacksImpl(callbacks)); } WebIDBDatabaseCallbacksImpl::WebIDBDatabaseCallbacksImpl(IDBDatabaseCallbacks* callbacks)
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h index 0f2067945..25fd433 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h
@@ -30,16 +30,16 @@ #include "public/platform/WebString.h" #include "public/platform/modules/indexeddb/WebIDBDatabaseCallbacks.h" #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { class WebIDBDatabaseCallbacksImpl final : public WebIDBDatabaseCallbacks { USING_FAST_MALLOC(WebIDBDatabaseCallbacksImpl); public: - static std::unique_ptr<WebIDBDatabaseCallbacksImpl> create(IDBDatabaseCallbacks*); + static PassOwnPtr<WebIDBDatabaseCallbacksImpl> create(IDBDatabaseCallbacks*); ~WebIDBDatabaseCallbacksImpl() override;
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp index 1109202..d5aca1b 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp
@@ -4,17 +4,15 @@ #include "modules/mediacapturefromelement/AutoCanvasDrawListener.h" -#include <memory> - namespace blink { -AutoCanvasDrawListener::AutoCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) +AutoCanvasDrawListener::AutoCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) : CanvasDrawListener(std::move(handler)) { } // static -AutoCanvasDrawListener* AutoCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler) +AutoCanvasDrawListener* AutoCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler) { return new AutoCanvasDrawListener(std::move(handler)); }
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h index 2d58d4dd..4a3fdf31d 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h
@@ -8,19 +8,18 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" -#include <memory> namespace blink { class AutoCanvasDrawListener final : public GarbageCollectedFinalized<AutoCanvasDrawListener>, public CanvasDrawListener { USING_GARBAGE_COLLECTED_MIXIN(AutoCanvasDrawListener); public: - static AutoCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>); + static AutoCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>); ~AutoCanvasDrawListener() {} DEFINE_INLINE_TRACE() {} private: - AutoCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); + AutoCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp index 7fd5002..023e959 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp
@@ -9,16 +9,15 @@ #include "modules/mediacapturefromelement/OnRequestCanvasDrawListener.h" #include "modules/mediacapturefromelement/TimedCanvasDrawListener.h" #include "platform/mediastream/MediaStreamCenter.h" -#include <memory> namespace blink { -CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler) +CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler) { return new CanvasCaptureMediaStreamTrack(component, element, std::move(handler)); } -CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) +CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) { return new CanvasCaptureMediaStreamTrack(component, element, std::move(handler), frameRate); } @@ -57,7 +56,7 @@ m_canvasElement->addListener(m_drawListener.get()); } -CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler) +CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler) : MediaStreamTrack(element->getExecutionContext(), component) , m_canvasElement(element) { @@ -66,7 +65,7 @@ m_canvasElement->addListener(m_drawListener.get()); } -CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) +CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) : MediaStreamTrack(element->getExecutionContext(), component) , m_canvasElement(element) {
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h index 6aae39b..a906bf1 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h
@@ -8,7 +8,6 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "modules/mediastream/MediaStreamTrack.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -18,8 +17,8 @@ class CanvasCaptureMediaStreamTrack final : public MediaStreamTrack { DEFINE_WRAPPERTYPEINFO(); public: - static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>); - static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); + static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>); + static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); HTMLCanvasElement* canvas() const; void requestFrame(); @@ -30,8 +29,8 @@ private: CanvasCaptureMediaStreamTrack(const CanvasCaptureMediaStreamTrack&, MediaStreamComponent*); - CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>); - CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); + CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>); + CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); Member<HTMLCanvasElement> m_canvasElement; Member<CanvasDrawListener> m_drawListener;
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp index cb88f4c..cdf1317e 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp
@@ -12,8 +12,6 @@ #include "public/platform/WebCanvasCaptureHandler.h" #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamTrack.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace { const double kDefaultFrameRate = 60.0; @@ -45,11 +43,11 @@ WebMediaStreamTrack track; const WebSize size(element.width(), element.height()); - std::unique_ptr<WebCanvasCaptureHandler> handler; + OwnPtr<WebCanvasCaptureHandler> handler; if (givenFrameRate) - handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track)); + handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track)); else - handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track)); + handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track)); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture handler can be created.");
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp index 2cad4d3..87cee32 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp
@@ -4,11 +4,9 @@ #include "modules/mediacapturefromelement/OnRequestCanvasDrawListener.h" -#include <memory> - namespace blink { -OnRequestCanvasDrawListener::OnRequestCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) +OnRequestCanvasDrawListener::OnRequestCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) : CanvasDrawListener(std::move(handler)) { } @@ -16,7 +14,7 @@ OnRequestCanvasDrawListener::~OnRequestCanvasDrawListener() {} // static -OnRequestCanvasDrawListener* OnRequestCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler) +OnRequestCanvasDrawListener* OnRequestCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler) { return new OnRequestCanvasDrawListener(std::move(handler)); }
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h index d84e024..5992b90 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h
@@ -8,7 +8,6 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" -#include <memory> namespace blink { @@ -16,12 +15,12 @@ USING_GARBAGE_COLLECTED_MIXIN(OnRequestCanvasDrawListener); public: ~OnRequestCanvasDrawListener(); - static OnRequestCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>); + static OnRequestCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>); void sendNewFrame(const WTF::PassRefPtr<SkImage>&) override; DEFINE_INLINE_TRACE() {} private: - OnRequestCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); + OnRequestCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp index 7615cc5..60a8586 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
@@ -4,11 +4,9 @@ #include "modules/mediacapturefromelement/TimedCanvasDrawListener.h" -#include <memory> - namespace blink { -TimedCanvasDrawListener::TimedCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) +TimedCanvasDrawListener::TimedCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) : CanvasDrawListener(std::move(handler)) , m_frameInterval(1 / frameRate) , m_requestFrameTimer(this, &TimedCanvasDrawListener::requestFrameTimerFired) @@ -18,7 +16,7 @@ TimedCanvasDrawListener::~TimedCanvasDrawListener() {} // static -TimedCanvasDrawListener* TimedCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) +TimedCanvasDrawListener* TimedCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) { TimedCanvasDrawListener* listener = new TimedCanvasDrawListener(std::move(handler), frameRate); listener->m_requestFrameTimer.startRepeating(listener->m_frameInterval, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h index 039fc16..1786473 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h
@@ -9,7 +9,6 @@ #include "platform/Timer.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" -#include <memory> namespace blink { @@ -17,12 +16,12 @@ USING_GARBAGE_COLLECTED_MIXIN(TimedCanvasDrawListener); public: ~TimedCanvasDrawListener(); - static TimedCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); + static TimedCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); void sendNewFrame(const WTF::PassRefPtr<SkImage>&) override; DEFINE_INLINE_TRACE() {} private: - TimedCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); + TimedCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); // Implementation of TimerFiredFunction. void requestFrameTimerFired(Timer<TimedCanvasDrawListener>*);
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp index 4d415e0..c7dd954 100644 --- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp +++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -14,7 +14,6 @@ #include "platform/blob/BlobData.h" #include "public/platform/Platform.h" #include "public/platform/WebMediaStream.h" -#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -146,7 +145,7 @@ { DCHECK(m_stream->getTracks().size()); - m_recorderHandler = wrapUnique(Platform::current()->createMediaRecorderHandler()); + m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler()); DCHECK(m_recorderHandler); if (!m_recorderHandler) {
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h index a0972e0..52de037c 100644 --- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h +++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h
@@ -15,7 +15,6 @@ #include "platform/AsyncMethodRunner.h" #include "public/platform/WebMediaRecorderHandler.h" #include "public/platform/WebMediaRecorderHandlerClient.h" -#include <memory> namespace blink { @@ -103,9 +102,9 @@ State m_state; - std::unique_ptr<BlobData> m_blobData; + OwnPtr<BlobData> m_blobData; - std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; + OwnPtr<WebMediaRecorderHandler> m_recorderHandler; Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; HeapVector<Member<Event>> m_scheduledEvents;
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp index 5f47c82..d5062dd8 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
@@ -14,11 +14,10 @@ #include "core/loader/FrameLoaderClient.h" #include "modules/mediasession/MediaMetadata.h" #include "modules/mediasession/MediaSessionError.h" -#include <memory> namespace blink { -MediaSession::MediaSession(std::unique_ptr<WebMediaSession> webMediaSession) +MediaSession::MediaSession(PassOwnPtr<WebMediaSession> webMediaSession) : m_webMediaSession(std::move(webMediaSession)) { DCHECK(m_webMediaSession); @@ -29,7 +28,7 @@ Document* document = toDocument(context); LocalFrame* frame = document->frame(); FrameLoaderClient* client = frame->loader().client(); - std::unique_ptr<WebMediaSession> webMediaSession = client->createWebMediaSession(); + OwnPtr<WebMediaSession> webMediaSession = client->createWebMediaSession(); if (!webMediaSession) { exceptionState.throwDOMException(NotSupportedError, "Missing platform implementation."); return nullptr;
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.h b/third_party/WebKit/Source/modules/mediasession/MediaSession.h index 07c250043..8501a3bd4 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.h +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.h
@@ -10,7 +10,7 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" #include "public/platform/modules/mediasession/WebMediaSession.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -37,9 +37,9 @@ private: friend class MediaSessionTest; - explicit MediaSession(std::unique_ptr<WebMediaSession>); + explicit MediaSession(PassOwnPtr<WebMediaSession>); - std::unique_ptr<WebMediaSession> m_webMediaSession; + OwnPtr<WebMediaSession> m_webMediaSession; Member<MediaMetadata> m_metadata; };
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp index 165d225e..654d9b6 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp
@@ -11,8 +11,6 @@ #include "public/platform/modules/mediasession/WebMediaSession.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> using ::testing::_; using ::testing::Invoke; @@ -29,13 +27,13 @@ { // The MediaSession takes ownership of the WebMediaSession, and the // caller must take care to not end up with a stale pointer. - return new MediaSession(wrapUnique(webMediaSession)); + return new MediaSession(adoptPtr(webMediaSession)); } Document& document() { return m_page->document(); } ScriptState* mainScriptState() { return ScriptState::forMainWorld(document().frame()); } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; namespace {
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp index 6ff989d..2ab2e78 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
@@ -46,9 +46,7 @@ #include "platform/TraceEvent.h" #include "public/platform/WebMediaSource.h" #include "public/platform/WebSourceBuffer.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" -#include <memory> using blink::WebMediaSource; using blink::WebSourceBuffer; @@ -150,7 +148,7 @@ // 5. Create a new SourceBuffer object and associated resources. ContentType contentType(type); String codecs = contentType.parameter("codecs"); - std::unique_ptr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType.type(), codecs, exceptionState); + OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType.type(), codecs, exceptionState); if (!webSourceBuffer) { DCHECK(exceptionState.code() == NotSupportedError || exceptionState.code() == QuotaExceededError); @@ -287,7 +285,7 @@ ActiveDOMObject::trace(visitor); } -void MediaSource::setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource> webMediaSource) +void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSource) { TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this); DCHECK(webMediaSource); @@ -579,13 +577,13 @@ m_webMediaSource.reset(); } -std::unique_ptr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& type, const String& codecs, ExceptionState& exceptionState) +PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& type, const String& codecs, ExceptionState& exceptionState) { WebSourceBuffer* webSourceBuffer = 0; switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) { case WebMediaSource::AddStatusOk: - return wrapUnique(webSourceBuffer); + return adoptPtr(webSourceBuffer); case WebMediaSource::AddStatusNotSupported: DCHECK(!webSourceBuffer); // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.h b/third_party/WebKit/Source/modules/mediasource/MediaSource.h index d022f7d..6c0a4d6 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.h +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.h
@@ -39,8 +39,8 @@ #include "modules/mediasource/SourceBuffer.h" #include "modules/mediasource/SourceBufferList.h" #include "public/platform/WebMediaSource.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -78,7 +78,7 @@ // HTMLMediaSource bool attachToElement(HTMLMediaElement*) override; - void setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) override; + void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) override; void close() override; bool isClosed() const override; double duration() const override; @@ -118,7 +118,7 @@ bool isUpdating() const; - std::unique_ptr<WebSourceBuffer> createWebSourceBuffer(const String& type, const String& codecs, ExceptionState&); + PassOwnPtr<WebSourceBuffer> createWebSourceBuffer(const String& type, const String& codecs, ExceptionState&); void scheduleEvent(const AtomicString& eventName); void endOfStreamInternal(const WebMediaSource::EndOfStreamStatus, ExceptionState&); @@ -126,7 +126,7 @@ // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#duration-change-algorithm void durationChangeAlgorithm(double newDuration); - std::unique_ptr<WebMediaSource> m_webMediaSource; + OwnPtr<WebMediaSource> m_webMediaSource; AtomicString m_readyState; Member<GenericEventQueue> m_asyncEventQueue; WeakMember<HTMLMediaElement> m_attachedElement;
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index 67c78a8a..2405720e 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -53,8 +53,8 @@ #include "platform/TraceEvent.h" #include "public/platform/WebSourceBuffer.h" #include "wtf/MathExtras.h" + #include <limits> -#include <memory> #include <sstream> using blink::WebSourceBuffer; @@ -96,14 +96,14 @@ } // namespace -SourceBuffer* SourceBuffer::create(std::unique_ptr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) +SourceBuffer* SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) { SourceBuffer* sourceBuffer = new SourceBuffer(std::move(webSourceBuffer), source, asyncEventQueue); sourceBuffer->suspendIfNeeded(); return sourceBuffer; } -SourceBuffer::SourceBuffer(std::unique_ptr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) +SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) : ActiveScriptWrappable(this) , ActiveDOMObject(source->getExecutionContext()) , m_webSourceBuffer(std::move(webSourceBuffer))
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h index 2d38752..5add19d 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h
@@ -40,7 +40,6 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebSourceBufferClient.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -66,7 +65,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_PRE_FINALIZER(SourceBuffer, dispose); public: - static SourceBuffer* create(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); + static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); static const AtomicString& segmentsKeyword(); static const AtomicString& sequenceKeyword(); @@ -116,7 +115,7 @@ DECLARE_VIRTUAL_TRACE(); private: - SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); + SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); void dispose(); bool isRemoved() const; @@ -143,7 +142,7 @@ void didFinishLoading() override; void didFail(FileError::ErrorCode) override; - std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; + OwnPtr<WebSourceBuffer> m_webSourceBuffer; Member<MediaSource> m_source; Member<TrackDefaultList> m_trackDefaults; Member<GenericEventQueue> m_asyncEventQueue; @@ -169,7 +168,7 @@ unsigned long long m_streamMaxSize; Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; Member<Stream> m_stream; - std::unique_ptr<FileReaderLoader> m_loader; + OwnPtr<FileReaderLoader> m_loader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h b/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h index 8819abb..39c35ca2 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h
@@ -31,6 +31,7 @@ #include "modules/ModulesExport.h" #include "modules/mediastream/MediaDeviceInfo.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index 26670613..3ead30dc 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -42,7 +42,6 @@ #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebSourceInfo.h" #include "wtf/Assertions.h" -#include <memory> namespace blink { @@ -256,7 +255,7 @@ return !ended() && hasEventListeners(EventTypeNames::ended); } -std::unique_ptr<AudioSourceProvider> MediaStreamTrack::createWebAudioSource() +PassOwnPtr<AudioSourceProvider> MediaStreamTrack::createWebAudioSource() { return MediaStreamCenter::instance().createWebAudioSourceFromMediaStreamTrack(component()); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h index 31f11568..99ed5f8 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
@@ -35,7 +35,6 @@ #include "platform/mediastream/MediaStreamSource.h" #include "public/platform/WebMediaConstraints.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -100,7 +99,7 @@ // ActiveDOMObject void stop() override; - std::unique_ptr<AudioSourceProvider> createWebAudioSource(); + PassOwnPtr<AudioSourceProvider> createWebAudioSource(); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp index 3d800b0..f16f517 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp
@@ -32,6 +32,7 @@ #include "public/platform/WebSourceInfo.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp index f80a229..96ecb6c 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp
@@ -30,12 +30,10 @@ #include "modules/mediastream/RTCCertificate.h" -#include "wtf/PtrUtil.h" - namespace blink { RTCCertificate::RTCCertificate(std::unique_ptr<WebRTCCertificate> certificate) - : m_certificate(wrapUnique(certificate.release())) + : m_certificate(adoptPtr(certificate.release())) { }
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h index d51268a..a3e155f 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h
@@ -35,6 +35,8 @@ #include "core/dom/DOMTimeStamp.h" #include "platform/heap/GarbageCollected.h" #include "public/platform/WebRTCCertificate.h" +#include "wtf/OwnPtr.h" + #include <memory> namespace blink { @@ -55,7 +57,7 @@ DOMTimeStamp expires() const; private: - std::unique_ptr<WebRTCCertificate> m_certificate; + OwnPtr<WebRTCCertificate> m_certificate; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp index d1a433f..fcde7c0 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp
@@ -34,8 +34,6 @@ #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebRTCDTMFSenderHandler.h" #include "public/platform/WebRTCPeerConnectionHandler.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -47,7 +45,7 @@ RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnectionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exceptionState) { - std::unique_ptr<WebRTCDTMFSenderHandler> handler = wrapUnique(peerConnectionHandler->createDTMFSender(track->component())); + OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->createDTMFSender(track->component())); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrack provided is not an element of a MediaStream that's currently in the local streams set."); return nullptr; @@ -58,7 +56,7 @@ return dtmfSender; } -RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, std::unique_ptr<WebRTCDTMFSenderHandler> handler) +RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, PassOwnPtr<WebRTCDTMFSenderHandler> handler) : ActiveDOMObject(context) , m_track(track) , m_duration(defaultToneDurationMs)
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h index dbe33121..9518f11 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h
@@ -30,7 +30,6 @@ #include "modules/EventTargetModules.h" #include "platform/Timer.h" #include "public/platform/WebRTCDTMFSenderHandlerClient.h" -#include <memory> namespace blink { @@ -72,7 +71,7 @@ DECLARE_VIRTUAL_TRACE(); private: - RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, std::unique_ptr<WebRTCDTMFSenderHandler>); + RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, PassOwnPtr<WebRTCDTMFSenderHandler>); void dispose(); void scheduleDispatchEvent(Event*); @@ -85,7 +84,7 @@ int m_duration; int m_interToneGap; - std::unique_ptr<WebRTCDTMFSenderHandler> m_handler; + OwnPtr<WebRTCDTMFSenderHandler> m_handler; bool m_stopped;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp index a3e9296d..e054159b 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
@@ -33,8 +33,6 @@ #include "core/fileapi/Blob.h" #include "modules/mediastream/RTCPeerConnection.h" #include "public/platform/WebRTCPeerConnectionHandler.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -53,7 +51,7 @@ exceptionState.throwDOMException(NotSupportedError, "Blob support not implemented yet"); } -RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, std::unique_ptr<WebRTCDataChannelHandler> handler) +RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, PassOwnPtr<WebRTCDataChannelHandler> handler) { DCHECK(handler); RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); @@ -64,7 +62,7 @@ RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, WebRTCPeerConnectionHandler* peerConnectionHandler, const String& label, const WebRTCDataChannelInit& init, ExceptionState& exceptionState) { - std::unique_ptr<WebRTCDataChannelHandler> handler = wrapUnique(peerConnectionHandler->createDataChannel(label, init)); + OwnPtr<WebRTCDataChannelHandler> handler = adoptPtr(peerConnectionHandler->createDataChannel(label, init)); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "RTCDataChannel is not supported"); return nullptr; @@ -75,7 +73,7 @@ return channel; } -RTCDataChannel::RTCDataChannel(ExecutionContext* context, std::unique_ptr<WebRTCDataChannelHandler> handler) +RTCDataChannel::RTCDataChannel(ExecutionContext* context, PassOwnPtr<WebRTCDataChannelHandler> handler) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_handler(std::move(handler))
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h index 6091d2b..ed92c02 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h
@@ -34,7 +34,6 @@ #include "public/platform/WebRTCDataChannelHandler.h" #include "public/platform/WebRTCDataChannelHandlerClient.h" #include "wtf/Compiler.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_PRE_FINALIZER(RTCDataChannel, dispose); public: - static RTCDataChannel* create(ExecutionContext*, std::unique_ptr<WebRTCDataChannelHandler>); + static RTCDataChannel* create(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); ~RTCDataChannel() override; @@ -117,13 +116,13 @@ void didDetectError() override; private: - RTCDataChannel(ExecutionContext*, std::unique_ptr<WebRTCDataChannelHandler>); + RTCDataChannel(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); void dispose(); void scheduleDispatchEvent(Event*); void scheduledEventTimerFired(Timer<RTCDataChannel>*); - std::unique_ptr<WebRTCDataChannelHandler> m_handler; + OwnPtr<WebRTCDataChannelHandler> m_handler; WebRTCDataChannelHandlerClient::ReadyState m_readyState;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp index de660958..500a4c2 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp
@@ -12,7 +12,6 @@ #include "public/platform/WebRTCDataChannelHandler.h" #include "public/platform/WebVector.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" @@ -78,7 +77,7 @@ TEST(RTCDataChannelTest, BufferedAmount) { MockHandler* handler = new MockHandler(); - RTCDataChannel* channel = RTCDataChannel::create(0, wrapUnique(handler)); + RTCDataChannel* channel = RTCDataChannel::create(0, adoptPtr(handler)); handler->changeState(WebRTCDataChannelHandlerClient::ReadyStateOpen); String message(std::string(100, 'A').c_str()); @@ -89,7 +88,7 @@ TEST(RTCDataChannelTest, BufferedAmountLow) { MockHandler* handler = new MockHandler(); - RTCDataChannel* channel = RTCDataChannel::create(0, wrapUnique(handler)); + RTCDataChannel* channel = RTCDataChannel::create(0, adoptPtr(handler)); // Add and drain 100 bytes handler->changeState(WebRTCDataChannelHandlerClient::ReadyStateOpen);
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp index a421337..0467f453 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -90,7 +90,7 @@ #include "public/platform/WebRTCStatsRequest.h" #include "public/platform/WebRTCVoidRequest.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" + #include <memory> namespace blink { @@ -455,7 +455,7 @@ return; } - m_peerHandler = wrapUnique(Platform::current()->createRTCPeerConnectionHandler(this)); + m_peerHandler = adoptPtr(Platform::current()->createRTCPeerConnectionHandler(this)); if (!m_peerHandler) { m_closed = true; m_stopped = true; @@ -747,7 +747,7 @@ } DCHECK(!keyParams.isNull()); - std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUnique( + OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr( Platform::current()->createRTCCertificateGenerator()); // |keyParams| was successfully constructed, but does the certificate generator support these parameters? @@ -1102,7 +1102,7 @@ if (m_signalingState == SignalingStateClosed) return; - RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), wrapUnique(handler)); + RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), adoptPtr(handler)); scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachannel, false, false, channel)); }
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h index 823d949d..560b210 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h
@@ -43,7 +43,6 @@ #include "public/platform/WebMediaConstraints.h" #include "public/platform/WebRTCPeerConnectionHandler.h" #include "public/platform/WebRTCPeerConnectionHandlerClient.h" -#include <memory> namespace blink { class ExceptionState; @@ -205,7 +204,7 @@ MediaStreamVector m_localStreams; MediaStreamVector m_remoteStreams; - std::unique_ptr<WebRTCPeerConnectionHandler> m_peerHandler; + OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler; Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; HeapVector<Member<EventWrapper>> m_scheduledEvents;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h b/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h index 11dbf432..a8a7f183 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h
@@ -34,6 +34,7 @@ #include "core/dom/ActiveDOMObject.h" #include "platform/heap/Handle.h" #include "platform/mediastream/RTCSessionDescriptionRequest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h index d185880..471a42b 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h
@@ -27,6 +27,7 @@ #include "core/frame/LocalFrame.h" #include "modules/mediastream/UserMediaClient.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h index d510d47e..2708fb3 100644 --- a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h +++ b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h
@@ -31,6 +31,7 @@ #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp index 3b545f9..41f05f7 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
@@ -17,7 +17,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/CurrentTime.h" #include "wtf/Threading.h" -#include <memory> namespace blink { @@ -94,7 +93,7 @@ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, fileSizeHistogram, new CustomCountHistogram("Notifications.Icon.FileSize", 1, 10000000 /* ~10mb max */, 50 /* buckets */)); fileSizeHistogram.count(m_data->size()); - std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*m_data.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*m_data.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (decoder) { decoder->setData(m_data.get(), true /* allDataReceived */); // The |ImageFrame*| is owned by the decoder.
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h index 363b4fb..8aeb557 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
@@ -10,8 +10,9 @@ #include "platform/SharedBuffer.h" #include "platform/heap/Handle.h" #include "wtf/Functional.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> class SkBitmap; @@ -55,7 +56,7 @@ double m_startTime; RefPtr<SharedBuffer> m_data; std::unique_ptr<ImageCallback> m_imageCallback; - std::unique_ptr<ThreadableLoader> m_threadableLoader; + OwnPtr<ThreadableLoader> m_threadableLoader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h b/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h index fda8a9b5..26e2243c 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h
@@ -8,6 +8,7 @@ #include "bindings/core/v8/ScriptPromise.h" #include "modules/ModulesExport.h" #include "platform/Supplementable.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h index 238a53d..a3424d83 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h
@@ -13,6 +13,8 @@ #include "platform/heap/ThreadState.h" #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Functional.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include <memory>
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp index c3aba1c..cd82f45d 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
@@ -84,7 +84,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; Persistent<NotificationResourcesLoader> m_loader; std::unique_ptr<WebNotificationResources> m_resources; };
diff --git a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp index 990ea7a..d5967e45 100644 --- a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp +++ b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
@@ -21,9 +21,7 @@ #include "public/platform/WebSecurityOrigin.h" #include "public/platform/modules/notifications/WebNotificationData.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { namespace { @@ -78,7 +76,7 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); - std::unique_ptr<WebNotificationShowCallbacks> callbacks = wrapUnique(new CallbackPromiseAdapter<void, void>(resolver)); + OwnPtr<WebNotificationShowCallbacks> callbacks = adoptPtr(new CallbackPromiseAdapter<void, void>(resolver)); ServiceWorkerRegistrationNotifications::from(executionContext, registration).prepareShow(data, std::move(callbacks)); return promise; @@ -127,22 +125,22 @@ return *supplement; } -void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationData& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks) +void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationData& data, PassOwnPtr<WebNotificationShowCallbacks> callbacks) { RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); - NotificationResourcesLoader* loader = new NotificationResourcesLoader(WTF::bind<NotificationResourcesLoader*>(&ServiceWorkerRegistrationNotifications::didLoadResources, WeakPersistentThisPointer<ServiceWorkerRegistrationNotifications>(this), origin.release(), data, passed(std::move(callbacks)))); + NotificationResourcesLoader* loader = new NotificationResourcesLoader(bind<NotificationResourcesLoader*>(&ServiceWorkerRegistrationNotifications::didLoadResources, WeakPersistentThisPointer<ServiceWorkerRegistrationNotifications>(this), origin.release(), data, passed(std::move(callbacks)))); m_loaders.add(loader); loader->start(getExecutionContext(), data); } -void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<SecurityOrigin> origin, const WebNotificationData& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks, NotificationResourcesLoader* loader) +void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<SecurityOrigin> origin, const WebNotificationData& data, PassOwnPtr<WebNotificationShowCallbacks> callbacks, NotificationResourcesLoader* loader) { DCHECK(m_loaders.contains(loader)); WebNotificationManager* notificationManager = Platform::current()->notificationManager(); DCHECK(notificationManager); - notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, loader->getResources(), m_registration->webRegistration(), callbacks.release()); + notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, loader->getResources(), m_registration->webRegistration(), callbacks.leakPtr()); m_loaders.remove(loader); }
diff --git a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h index 445c3e6a..53c3b55 100644 --- a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h +++ b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h
@@ -14,8 +14,9 @@ #include "platform/heap/Visitor.h" #include "public/platform/modules/notifications/WebNotificationManager.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -47,8 +48,8 @@ static const char* supplementName(); static ServiceWorkerRegistrationNotifications& from(ExecutionContext*, ServiceWorkerRegistration&); - void prepareShow(const WebNotificationData&, std::unique_ptr<WebNotificationShowCallbacks>); - void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData&, std::unique_ptr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); + void prepareShow(const WebNotificationData&, PassOwnPtr<WebNotificationShowCallbacks>); + void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData&, PassOwnPtr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); Member<ServiceWorkerRegistration> m_registration; HeapHashSet<Member<NotificationResourcesLoader>> m_loaders;
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h index 6fef3c01..89bcba6 100644 --- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h +++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h
@@ -9,7 +9,6 @@ #include "core/html/canvas/CanvasRenderingContext.h" #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/canvas2d/BaseRenderingContext2D.h" -#include <memory> namespace blink { @@ -81,7 +80,7 @@ private: bool m_hasAlpha; bool m_needsMatrixClipRestore = false; - std::unique_ptr<ImageBuffer> m_imageBuffer; + OwnPtr<ImageBuffer> m_imageBuffer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp index 260ca91..eaf46a0 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
@@ -12,6 +12,7 @@ #include "modules/payments/PaymentDetails.h" #include "modules/payments/PaymentTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include <ostream> // NOLINT namespace blink {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp index ce0d4a7..b0d152c 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
@@ -12,7 +12,7 @@ #include "modules/payments/PaymentUpdater.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { namespace {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp index 577877f..12812b4 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
@@ -13,7 +13,7 @@ #include "modules/payments/PaymentTestHelper.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> +#include "wtf/OwnPtr.h" #include <utility> namespace blink {
diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp index a0530be..64f5741a 100644 --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
@@ -23,9 +23,7 @@ #include "public/platform/Platform.h" #include "public/platform/modules/permissions/WebPermissionClient.h" #include "wtf/NotFound.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -169,8 +167,8 @@ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't request permissions.")); ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Permissions", scriptState->context()->Global(), scriptState->isolate()); - std::unique_ptr<Vector<WebPermissionType>> internalPermissions = wrapUnique(new Vector<WebPermissionType>()); - std::unique_ptr<Vector<int>> callerIndexToInternalIndex = wrapUnique(new Vector<int>(rawPermissions.size())); + OwnPtr<Vector<WebPermissionType>> internalPermissions = adoptPtr(new Vector<WebPermissionType>()); + OwnPtr<Vector<int>> callerIndexToInternalIndex = adoptPtr(new Vector<int>(rawPermissions.size())); for (size_t i = 0; i < rawPermissions.size(); ++i) { const Dictionary& rawPermission = rawPermissions[i];
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp index 5e8006a8..b60a017 100644 --- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp +++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
@@ -6,12 +6,10 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/permissions/PermissionStatus.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, std::unique_ptr<Vector<WebPermissionType>> internalPermissions, std::unique_ptr<Vector<int>> callerIndexToInternalIndex) +PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<Vector<WebPermissionType>> internalPermissions, PassOwnPtr<Vector<int>> callerIndexToInternalIndex) : m_resolver(resolver) , m_internalPermissions(std::move(internalPermissions)) , m_callerIndexToInternalIndex(std::move(callerIndexToInternalIndex)) @@ -24,7 +22,7 @@ if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - std::unique_ptr<WebVector<WebPermissionStatus>> statusPtr = wrapUnique(permissionStatus.release()); + OwnPtr<WebVector<WebPermissionStatus>> statusPtr = adoptPtr(permissionStatus.release()); HeapVector<Member<PermissionStatus>> result(m_callerIndexToInternalIndex->size()); // Create the response vector by finding the status for each index by
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h index 2173f58e..a2351c9 100644 --- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h +++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h
@@ -13,6 +13,7 @@ #include "wtf/Noncopyable.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" + #include <memory> namespace blink { @@ -26,7 +27,7 @@ class PermissionsCallback final : public WebCallbacks<std::unique_ptr<WebVector<WebPermissionStatus>>, void> { public: - PermissionsCallback(ScriptPromiseResolver*, std::unique_ptr<Vector<WebPermissionType>>, std::unique_ptr<Vector<int>>); + PermissionsCallback(ScriptPromiseResolver*, PassOwnPtr<Vector<WebPermissionType>>, PassOwnPtr<Vector<int>>); ~PermissionsCallback() = default; void onSuccess(std::unique_ptr<WebVector<WebPermissionStatus>>) override; @@ -36,12 +37,12 @@ Persistent<ScriptPromiseResolver> m_resolver; // The permission types which were passed to the client to be requested. - std::unique_ptr<Vector<WebPermissionType>> m_internalPermissions; + OwnPtr<Vector<WebPermissionType>> m_internalPermissions; // Maps each index in the caller vector to the corresponding index in the // internal vector (i.e. the vector passsed to the client) such that both // indices have the same WebPermissionType. - std::unique_ptr<Vector<int>> m_callerIndexToInternalIndex; + OwnPtr<Vector<int>> m_callerIndexToInternalIndex; WTF_MAKE_NONCOPYABLE(PermissionsCallback); };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp index c1ccce2..70c9c53 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -24,8 +24,8 @@ #include "modules/presentation/PresentationRequest.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -171,7 +171,7 @@ } // static -PresentationConnection* PresentationConnection::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebPresentationConnectionClient> client, PresentationRequest* request) +PresentationConnection* PresentationConnection::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request) { ASSERT(resolver); ASSERT(client); @@ -190,7 +190,7 @@ } // static -PresentationConnection* PresentationConnection::take(PresentationController* controller, std::unique_ptr<WebPresentationConnectionClient> client, PresentationRequest* request) +PresentationConnection* PresentationConnection::take(PresentationController* controller, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request) { ASSERT(controller); ASSERT(request); @@ -355,7 +355,7 @@ switch (m_binaryType) { case BinaryTypeBlob: { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendBytes(data, length); Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), length)); dispatchEvent(MessageEvent::create(blob));
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.h b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h index 4c1cc29..130fbcf2 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.h +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h
@@ -11,8 +11,8 @@ #include "core/frame/DOMWindowProperty.h" #include "platform/heap/Handle.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { class AtomicString; @@ -32,10 +32,10 @@ DEFINE_WRAPPERTYPEINFO(); public: // For CallbackPromiseAdapter. - using WebType = std::unique_ptr<WebPresentationConnectionClient>; + using WebType = OwnPtr<WebPresentationConnectionClient>; - static PresentationConnection* take(ScriptPromiseResolver*, std::unique_ptr<WebPresentationConnectionClient>, PresentationRequest*); - static PresentationConnection* take(PresentationController*, std::unique_ptr<WebPresentationConnectionClient>, PresentationRequest*); + static PresentationConnection* take(ScriptPromiseResolver*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*); + static PresentationConnection* take(PresentationController*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*); ~PresentationConnection() override; // EventTarget implementation.
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp index e9511d1..a9d211b 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
@@ -10,8 +10,6 @@ #include "modules/presentation/PresentationRequest.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" #include "public/platform/modules/presentation/WebPresentationError.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -25,7 +23,7 @@ void PresentationConnectionCallbacks::onSuccess(std::unique_ptr<WebPresentationConnectionClient> PresentationConnectionClient) { - std::unique_ptr<WebPresentationConnectionClient> result(wrapUnique(PresentationConnectionClient.release())); + OwnPtr<WebPresentationConnectionClient> result(adoptPtr(PresentationConnectionClient.release())); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return;
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp index 2cc3b32..f0904d2f 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp
@@ -7,8 +7,6 @@ #include "core/frame/LocalFrame.h" #include "modules/presentation/PresentationConnection.h" #include "public/platform/modules/presentation/WebPresentationClient.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -67,12 +65,12 @@ { if (!m_presentation || !m_presentation->defaultRequest()) return; - PresentationConnection::take(this, wrapUnique(connectionClient), m_presentation->defaultRequest()); + PresentationConnection::take(this, adoptPtr(connectionClient), m_presentation->defaultRequest()); } void PresentationController::didChangeSessionState(WebPresentationConnectionClient* connectionClient, WebPresentationConnectionState state) { - std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); + OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -82,7 +80,7 @@ void PresentationController::didCloseConnection(WebPresentationConnectionClient* connectionClient, WebPresentationConnectionCloseReason reason, const WebString& message) { - std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); + OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -92,7 +90,7 @@ void PresentationController::didReceiveSessionTextMessage(WebPresentationConnectionClient* connectionClient, const WebString& message) { - std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); + OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -102,7 +100,7 @@ void PresentationController::didReceiveSessionBinaryMessage(WebPresentationConnectionClient* connectionClient, const uint8_t* data, size_t length) { - std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); + OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection)
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationError.cpp b/third_party/WebKit/Source/modules/presentation/PresentationError.cpp index cf37005..cb35d89 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationError.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationError.cpp
@@ -7,6 +7,7 @@ #include "core/dom/DOMException.h" #include "core/dom/ExceptionCode.h" #include "public/platform/modules/presentation/WebPresentationError.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushController.cpp b/third_party/WebKit/Source/modules/push_messaging/PushController.cpp index 5bb8e508..2172060 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushController.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushController.cpp
@@ -6,6 +6,7 @@ #include "public/platform/modules/push_messaging/WebPushClient.h" #include "wtf/Assertions.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushController.h b/third_party/WebKit/Source/modules/push_messaging/PushController.h index eb29149c..797c023 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushController.h +++ b/third_party/WebKit/Source/modules/push_messaging/PushController.h
@@ -10,6 +10,7 @@ #include "platform/Supplementable.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp index 91c2a586..08bda90d 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
@@ -13,7 +13,7 @@ #include "platform/blob/BlobData.h" #include "wtf/Assertions.h" #include "wtf/text/TextEncoding.h" -#include <memory> + #include <v8.h> namespace blink { @@ -63,7 +63,7 @@ Blob* PushMessageData::blob() const { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendBytes(m_data.data(), m_data.size()); // Note that the content type of the Blob object is deliberately not being
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp index 01363e82..a83699c 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
@@ -13,12 +13,12 @@ #include "public/platform/modules/push_messaging/WebPushProvider.h" #include "public/platform/modules/push_messaging/WebPushSubscription.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" #include "wtf/text/Base64.h" -#include <memory> namespace blink { -PushSubscription* PushSubscription::take(ScriptPromiseResolver*, std::unique_ptr<WebPushSubscription> pushSubscription, ServiceWorkerRegistration* serviceWorkerRegistration) +PushSubscription* PushSubscription::take(ScriptPromiseResolver*, PassOwnPtr<WebPushSubscription> pushSubscription, ServiceWorkerRegistration* serviceWorkerRegistration) { if (!pushSubscription) return nullptr;
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h index e21dcbd..be6fd12d 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h
@@ -13,7 +13,6 @@ #include "platform/weborigin/KURL.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ class PushSubscription final : public GarbageCollectedFinalized<PushSubscription>, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - static PushSubscription* take(ScriptPromiseResolver*, std::unique_ptr<WebPushSubscription>, ServiceWorkerRegistration*); + static PushSubscription* take(ScriptPromiseResolver*, PassOwnPtr<WebPushSubscription>, ServiceWorkerRegistration*); static void dispose(WebPushSubscription* subscriptionRaw); virtual ~PushSubscription();
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp index fa77180..8dea001 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp
@@ -10,7 +10,6 @@ #include "modules/serviceworkers/ServiceWorkerRegistration.h" #include "public/platform/modules/push_messaging/WebPushSubscription.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -31,7 +30,7 @@ if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(PushSubscription::take(m_resolver.get(), wrapUnique(webPushSubscription.release()), m_serviceWorkerRegistration)); + m_resolver->resolve(PushSubscription::take(m_resolver.get(), adoptPtr(webPushSubscription.release()), m_serviceWorkerRegistration)); } void PushSubscriptionCallbacks::onError(const WebPushError& error)
diff --git a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h index f39bdda5..01936d8 100644 --- a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h +++ b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h
@@ -33,6 +33,7 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h index 8529807..5b80d08 100644 --- a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h
@@ -36,6 +36,7 @@ #include "modules/quota/StorageQuotaCallback.h" #include "modules/quota/StorageUsageCallback.h" #include "platform/StorageQuotaCallbacks.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h b/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h index d12e720..14300b3 100644 --- a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h
@@ -34,6 +34,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/ModulesExport.h" #include "platform/StorageQuotaCallbacks.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp index f3b58f8..bb3e62cc 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
@@ -41,7 +41,6 @@ #include "public/platform/WebSecurityOrigin.h" #include "public/platform/WebString.h" #include "public/platform/modules/serviceworker/WebServiceWorkerState.h" -#include <memory> namespace blink { @@ -59,7 +58,7 @@ } // Disentangle the port in preparation for sending it to the remote context. - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; if (m_handle->serviceWorker()->state() == WebServiceWorkerStateRedundant) { @@ -71,8 +70,8 @@ context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "ServiceWorker cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/511119")); WebString messageString = message->toWireString(); - std::unique_ptr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); - m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.release()); + OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); + m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.leakPtr()); } void ServiceWorker::internalsTerminate() @@ -113,7 +112,7 @@ } } -ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) +ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) { return getOrCreate(executionContext, std::move(handle)); } @@ -130,7 +129,7 @@ m_wasStopped = true; } -ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) +ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) { if (!handle) return nullptr; @@ -146,7 +145,7 @@ return newWorker; } -ServiceWorker::ServiceWorker(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) +ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) : AbstractWorker(executionContext) , ActiveScriptWrappable(this) , m_handle(std::move(handle))
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h index fdd2d3f..1d93fa0 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h
@@ -38,8 +38,9 @@ #include "modules/ModulesExport.h" #include "public/platform/modules/serviceworker/WebServiceWorker.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProxy.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -49,7 +50,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(ServiceWorker); public: - static ServiceWorker* from(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); + static ServiceWorker* from(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); ~ServiceWorker() override; DECLARE_VIRTUAL_TRACE(); @@ -71,8 +72,8 @@ void internalsTerminate(); private: - static ServiceWorker* getOrCreate(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); - ServiceWorker(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); + static ServiceWorker* getOrCreate(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); + ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); // ActiveScriptWrappable overrides. bool hasPendingActivity() const final; @@ -81,7 +82,7 @@ void stop() override; // A handle to the service worker representation in the embedder. - std::unique_ptr<WebServiceWorker::Handle> m_handle; + OwnPtr<WebServiceWorker::Handle> m_handle; bool m_wasStopped; };
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp index c77396fd..ae934b81 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
@@ -12,11 +12,10 @@ #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" #include "public/platform/WebString.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { -ServiceWorkerClient* ServiceWorkerClient::take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo> webClient) +ServiceWorkerClient* ServiceWorkerClient::take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo> webClient) { if (!webClient) return nullptr; @@ -71,7 +70,7 @@ void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; @@ -79,7 +78,7 @@ context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/511119")); WebString messageString = message->toWireString(); - std::unique_ptr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); + OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, messageString, std::move(webChannels)); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h index b847b72..4a2419d 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h
@@ -12,7 +12,6 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -24,9 +23,9 @@ DEFINE_WRAPPERTYPEINFO(); public: // To be used by CallbackPromiseAdapter. - using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; + using WebType = OwnPtr<WebServiceWorkerClientInfo>; - static ServiceWorkerClient* take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo>); + static ServiceWorkerClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo>); static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); virtual ~ServiceWorkerClient();
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp index ab56d4f..85cad8a 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
@@ -16,10 +16,10 @@ #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientQueryOptions.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -68,7 +68,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerClientInfo> webClient) override { - std::unique_ptr<WebServiceWorkerClientInfo> client = wrapUnique(webClient.release()); + OwnPtr<WebServiceWorkerClientInfo> client = adoptPtr(webClient.release()); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; if (!client) {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp index 7298ac3..efd57b7 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -56,8 +56,6 @@ #include "public/platform/modules/serviceworker/WebServiceWorker.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -71,7 +69,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), wrapUnique(handle.release()))); + m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), adoptPtr(handle.release()))); } void onError(const WebServiceWorkerError& error) override @@ -98,7 +96,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerRegistration::Handle> webPassHandle) override { - std::unique_ptr<WebServiceWorkerRegistration::Handle> handle = wrapUnique(webPassHandle.release()); + OwnPtr<WebServiceWorkerRegistration::Handle> handle = adoptPtr(webPassHandle.release()); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; if (!handle) { @@ -129,10 +127,10 @@ void onSuccess(std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webPassRegistrations) override { - Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>> handles; - std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = wrapUnique(webPassRegistrations.release()); + Vector<OwnPtr<WebServiceWorkerRegistration::Handle>> handles; + OwnPtr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = adoptPtr(webPassRegistrations.release()); for (auto& handle : *webRegistrations) { - handles.append(wrapUnique(handle)); + handles.append(adoptPtr(handle)); } if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) @@ -163,7 +161,7 @@ ASSERT(m_ready->getState() == ReadyProperty::Pending); if (m_ready->getExecutionContext() && !m_ready->getExecutionContext()->activeDOMObjectsAreStopped()) - m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), wrapUnique(handle.release()))); + m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), adoptPtr(handle.release()))); } private: @@ -197,7 +195,7 @@ ContextLifecycleObserver::trace(visitor); } -void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, std::unique_ptr<RegistrationCallbacks> callbacks) +void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, PassOwnPtr<RegistrationCallbacks> callbacks) { if (!m_provider) { callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::ErrorTypeState, "Failed to register a ServiceWorker: The document is in an invalid state.")); @@ -257,7 +255,7 @@ } } - m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.release()); + m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.leakPtr()); } ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptState, const String& url, const RegistrationOptions& options) @@ -284,7 +282,7 @@ else patternURL = enteredExecutionContext(scriptState->isolate())->completeURL(options.scope()); - registerServiceWorkerImpl(executionContext, scriptURL, patternURL, wrapUnique(new RegistrationCallback(resolver))); + registerServiceWorkerImpl(executionContext, scriptURL, patternURL, adoptPtr(new RegistrationCallback(resolver))); return promise; } @@ -387,7 +385,7 @@ { if (!getExecutionContext()) return; - m_controller = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); + m_controller = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); if (m_controller) UseCounter::count(getExecutionContext(), UseCounter::ServiceWorkerControlledPage); if (shouldNotifyControllerChange) @@ -401,7 +399,7 @@ MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContext(), webChannels); RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); - ServiceWorker* source = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); + ServiceWorker* source = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExecutionContext()->getSecurityOrigin()->toString())); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h index b912d7c..0103990 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h
@@ -44,7 +44,6 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -73,7 +72,7 @@ ScriptPromise ready(ScriptState*); WebServiceWorkerProvider* provider() { return m_provider; } - void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, const KURL& scope, std::unique_ptr<RegistrationCallbacks>); + void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, const KURL& scope, PassOwnPtr<RegistrationCallbacks>); ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, const RegistrationOptions&); ScriptPromise getRegistration(ScriptState*, const String& documentURL);
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp index 7237bfab..8842166 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp
@@ -10,16 +10,15 @@ #include "core/loader/FrameLoaderClient.h" #include "core/workers/WorkerGlobalScope.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" -#include <memory> namespace blink { -ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(std::unique_ptr<WebServiceWorkerProvider> provider) +ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(PassOwnPtr<WebServiceWorkerProvider> provider) { return new ServiceWorkerContainerClient(std::move(provider)); } -ServiceWorkerContainerClient::ServiceWorkerContainerClient(std::unique_ptr<WebServiceWorkerProvider> provider) +ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider> provider) : m_provider(std::move(provider)) { } @@ -52,7 +51,7 @@ return client; } -void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, std::unique_ptr<WebServiceWorkerProvider> provider) +void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwnPtr<WebServiceWorkerProvider> provider) { clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provider))); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h index e28b38b..28e63b6a 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h
@@ -9,7 +9,6 @@ #include "core/workers/WorkerClients.h" #include "modules/ModulesExport.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -25,7 +24,7 @@ USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); public: - static ServiceWorkerContainerClient* create(std::unique_ptr<WebServiceWorkerProvider>); + static ServiceWorkerContainerClient* create(PassOwnPtr<WebServiceWorkerProvider>); virtual ~ServiceWorkerContainerClient(); WebServiceWorkerProvider* provider() { return m_provider.get(); } @@ -40,12 +39,12 @@ } protected: - explicit ServiceWorkerContainerClient(std::unique_ptr<WebServiceWorkerProvider>); + explicit ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider>); - std::unique_ptr<WebServiceWorkerProvider> m_provider; + OwnPtr<WebServiceWorkerProvider> m_provider; }; -MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*, std::unique_ptr<WebServiceWorkerProvider>); +MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*, PassOwnPtr<WebServiceWorkerProvider>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp index f57b4ce..fbc9c84 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
@@ -23,9 +23,9 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> #include <v8.h> namespace blink { @@ -162,7 +162,7 @@ v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } - void provide(std::unique_ptr<WebServiceWorkerProvider> provider) + void provide(PassOwnPtr<WebServiceWorkerProvider> provider) { Supplement<Document>::provideTo(m_page->document(), ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provider))); } @@ -180,7 +180,7 @@ { // When the registration is rejected, a register call must not reach // the provider. - provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); + provide(adoptPtr(new NotReachedWebServiceWorkerProvider())); ServiceWorkerContainer* container = ServiceWorkerContainer::create(getExecutionContext()); ScriptState::Scope scriptScope(getScriptState()); @@ -194,7 +194,7 @@ void testGetRegistrationRejected(const String& documentURL, const ScriptValueTest& valueTest) { - provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); + provide(adoptPtr(new NotReachedWebServiceWorkerProvider())); ServiceWorkerContainer* container = ServiceWorkerContainer::create(getExecutionContext()); ScriptState::Scope scriptScope(getScriptState()); @@ -205,7 +205,7 @@ } private: - std::unique_ptr<DummyPageHolder> m_page; + OwnPtr<DummyPageHolder> m_page; }; TEST_F(ServiceWorkerContainerTest, Register_NonSecureOriginIsRejected) @@ -263,9 +263,9 @@ // StubWebServiceWorkerProvider, but |registerServiceWorker| and // other methods must not be called after the // StubWebServiceWorkerProvider dies. - std::unique_ptr<WebServiceWorkerProvider> provider() + PassOwnPtr<WebServiceWorkerProvider> provider() { - return wrapUnique(new WebServiceWorkerProviderImpl(*this)); + return adoptPtr(new WebServiceWorkerProviderImpl(*this)); } size_t registerCallCount() { return m_registerCallCount; } @@ -289,14 +289,14 @@ m_owner.m_registerCallCount++; m_owner.m_registerScope = pattern; m_owner.m_registerScriptURL = scriptURL; - m_registrationCallbacksToDelete.append(wrapUnique(callbacks)); + m_registrationCallbacksToDelete.append(adoptPtr(callbacks)); } void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegistrationCallbacks* callbacks) override { m_owner.m_getRegistrationCallCount++; m_owner.m_getRegistrationURL = documentURL; - m_getRegistrationCallbacksToDelete.append(wrapUnique(callbacks)); + m_getRegistrationCallbacksToDelete.append(adoptPtr(callbacks)); } bool validateScopeAndScriptURL(const WebURL& scope, const WebURL& scriptURL, WebString* errorMessage) @@ -306,8 +306,8 @@ private: StubWebServiceWorkerProvider& m_owner; - Vector<std::unique_ptr<WebServiceWorkerRegistrationCallbacks>> m_registrationCallbacksToDelete; - Vector<std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrationCallbacksToDelete; + Vector<OwnPtr<WebServiceWorkerRegistrationCallbacks>> m_registrationCallbacksToDelete; + Vector<OwnPtr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrationCallbacksToDelete; }; private:
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h index 9145d11..c2054d7b 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h
@@ -33,6 +33,8 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp index 82d10cd..de78c5e 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -62,12 +62,10 @@ #include "public/platform/Platform.h" #include "public/platform/WebURL.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create(ServiceWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData) +ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create(ServiceWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -81,7 +79,7 @@ return context; } -ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) , m_didEvaluateScript(false) , m_hadErrorInTopLevelEventHandler(false) @@ -144,7 +142,7 @@ { if (!getExecutionContext()) return; - m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(), wrapUnique(handle.release())); + m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(), adoptPtr(handle.release())); } bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& eventType, EventListener* listener, const AddEventListenerOptions& options) @@ -210,7 +208,7 @@ return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, metaData); } -void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) { WorkerGlobalScope::logExceptionToConsole(errorMessage, location->clone()); ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location));
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h index 7abf63fb..330860b 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h
@@ -37,7 +37,6 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, std::unique_ptr<WorkerThreadStartupData>); + static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, PassOwnPtr<WorkerThreadStartupData>); ~ServiceWorkerGlobalScope() override; bool isServiceWorkerGlobalScope() const override { return true; } @@ -93,10 +92,10 @@ bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const AddEventListenerOptions&) override; private: - ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); + ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); void importScripts(const Vector<String>& urls, ExceptionState&) override; CachedMetadataHandler* createWorkerScriptCachedMetadataHandler(const KURL& scriptURL, const Vector<char>* metaData) override; - void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; + void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; Member<ServiceWorkerClients> m_clients;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h index 8040ac1..91d839f 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h
@@ -41,7 +41,6 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallbacks.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -80,8 +79,8 @@ virtual void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResult) = 0; virtual void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) = 0; virtual void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) = 0; - virtual void postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) = 0; - virtual void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) = 0; + virtual void postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) = 0; + virtual void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) = 0; virtual void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) = 0; virtual void claim(WebServiceWorkerClientsClaimCallbacks*) = 0; virtual void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) = 0;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp index effb5e78..255f515d 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
@@ -13,7 +13,6 @@ #include "modules/serviceworkers/ServiceWorkerContainer.h" #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -73,7 +72,7 @@ TrackExceptionState exceptionState; - NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindow()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptURL, scopeURL, wrapUnique(new RegistrationCallback(m_owner))); + NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindow()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptURL, scopeURL, adoptPtr(new RegistrationCallback(m_owner))); } bool ServiceWorkerLinkResource::hasLoaded() const
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h index 3e372dd..5ea5f60 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h
@@ -8,6 +8,7 @@ #include "core/html/LinkResource.h" #include "modules/ModulesExport.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp index 1582384..6572f6d 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
@@ -15,8 +15,6 @@ #include "modules/serviceworkers/ServiceWorkerContainerClient.h" #include "modules/serviceworkers/ServiceWorkerError.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -34,24 +32,24 @@ { if (!getExecutionContext()) return; - m_installing = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); + m_installing = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); } void ServiceWorkerRegistration::setWaiting(std::unique_ptr<WebServiceWorker::Handle> handle) { if (!getExecutionContext()) return; - m_waiting = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); + m_waiting = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); } void ServiceWorkerRegistration::setActive(std::unique_ptr<WebServiceWorker::Handle> handle) { if (!getExecutionContext()) return; - m_active = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); + m_active = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); } -ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) +ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) { ASSERT(handle); @@ -95,7 +93,7 @@ return promise; } -ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) +ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) : ActiveScriptWrappable(this) , ActiveDOMObject(executionContext) , m_handle(std::move(handle))
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h index bff04eb6..1368c7e 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
@@ -15,7 +15,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRegistrationProxy.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -48,7 +48,7 @@ // Returns an existing registration object for the handle if it exists. // Otherwise, returns a new registration object. - static ServiceWorkerRegistration* getOrCreate(ExecutionContext*, std::unique_ptr<WebServiceWorkerRegistration::Handle>); + static ServiceWorkerRegistration* getOrCreate(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegistration::Handle>); ServiceWorker* installing() { return m_installing; } ServiceWorker* waiting() { return m_waiting; } @@ -68,7 +68,7 @@ DECLARE_VIRTUAL_TRACE(); private: - ServiceWorkerRegistration(ExecutionContext*, std::unique_ptr<WebServiceWorkerRegistration::Handle>); + ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegistration::Handle>); void dispose(); // ActiveScriptWrappable overrides. @@ -78,7 +78,7 @@ void stop() override; // A handle to the registration representation in the embedder. - std::unique_ptr<WebServiceWorkerRegistration::Handle> m_handle; + OwnPtr<WebServiceWorkerRegistration::Handle> m_handle; Member<ServiceWorker> m_installing; Member<ServiceWorker> m_waiting; @@ -90,7 +90,7 @@ class ServiceWorkerRegistrationArray { STATIC_ONLY(ServiceWorkerRegistrationArray); public: - static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResolver* resolver, Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>* webServiceWorkerRegistrations) + static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResolver* resolver, Vector<OwnPtr<WebServiceWorkerRegistration::Handle>>* webServiceWorkerRegistrations) { HeapVector<Member<ServiceWorkerRegistration>> registrations; for (auto& registration : *webServiceWorkerRegistrations)
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h index 45feb02..a6beb078 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h
@@ -8,6 +8,7 @@ #include "core/fetch/CachedMetadataHandler.h" #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp index 831291fd..933be5c 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp
@@ -33,14 +33,12 @@ #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<ServiceWorkerThread> ServiceWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) +PassOwnPtr<ServiceWorkerThread> ServiceWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return wrapUnique(new ServiceWorkerThread(workerLoaderProxy, workerReportingProxy)); + return adoptPtr(new ServiceWorkerThread(workerLoaderProxy, workerReportingProxy)); } ServiceWorkerThread::ServiceWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) @@ -53,7 +51,7 @@ { } -WorkerGlobalScope* ServiceWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* ServiceWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) { return ServiceWorkerGlobalScope::create(this, std::move(startupData)); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h index 7328fbf..0a178d4a 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h
@@ -33,7 +33,6 @@ #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" #include "modules/ModulesExport.h" -#include <memory> namespace blink { @@ -41,17 +40,17 @@ class MODULES_EXPORT ServiceWorkerThread final : public WorkerThread { public: - static std::unique_ptr<ServiceWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); + static PassOwnPtr<ServiceWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); ~ServiceWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } protected: - WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; private: ServiceWorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); - std::unique_ptr<WorkerBackingThread> m_workerBackingThread; + OwnPtr<WorkerBackingThread> m_workerBackingThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp index 5064c5e..3bf05a0 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp
@@ -16,11 +16,10 @@ #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" #include "public/platform/WebString.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { -ServiceWorkerWindowClient* ServiceWorkerWindowClient::take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo> webClient) +ServiceWorkerWindowClient* ServiceWorkerWindowClient::take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo> webClient) { return webClient ? ServiceWorkerWindowClient::create(*webClient) : nullptr; }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h index 8ecc696a..c0c714f 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h
@@ -10,7 +10,8 @@ #include "modules/serviceworkers/ServiceWorkerClient.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -21,9 +22,9 @@ DEFINE_WRAPPERTYPEINFO(); public: // To be used by CallbackPromiseAdapter. - using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; + using WebType = OwnPtr<WebServiceWorkerClientInfo>; - static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo>); + static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo>); static ServiceWorkerWindowClient* create(const WebServiceWorkerClientInfo&); ~ServiceWorkerWindowClient() override;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp index 36a1fab..2658542 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp
@@ -8,7 +8,6 @@ #include "core/dom/DOMException.h" #include "modules/serviceworkers/ServiceWorkerError.h" #include "modules/serviceworkers/ServiceWorkerWindowClient.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -16,7 +15,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), wrapUnique(clientInfo.release()))); + m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), adoptPtr(clientInfo.release()))); } void NavigateClientCallback::onError(const WebServiceWorkerError& error)
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h index 4fdbe5f..80d6f9b 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h
@@ -28,7 +28,6 @@ #include "modules/ModulesExport.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -46,7 +45,7 @@ virtual ~SpeechRecognitionClient() { } }; -MODULES_EXPORT void provideSpeechRecognitionTo(Page&, std::unique_ptr<SpeechRecognitionClient>); +MODULES_EXPORT void provideSpeechRecognitionTo(Page&, PassOwnPtr<SpeechRecognitionClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp index ed82c39..7867771 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp
@@ -25,8 +25,6 @@ #include "modules/speech/SpeechRecognitionController.h" -#include <memory> - namespace blink { const char* SpeechRecognitionController::supplementName() @@ -34,7 +32,7 @@ return "SpeechRecognitionController"; } -SpeechRecognitionController::SpeechRecognitionController(std::unique_ptr<SpeechRecognitionClient> client) +SpeechRecognitionController::SpeechRecognitionController(PassOwnPtr<SpeechRecognitionClient> client) : m_client(std::move(client)) { } @@ -44,12 +42,12 @@ // FIXME: Call m_client->pageDestroyed(); once we have implemented a client. } -SpeechRecognitionController* SpeechRecognitionController::create(std::unique_ptr<SpeechRecognitionClient> client) +SpeechRecognitionController* SpeechRecognitionController::create(PassOwnPtr<SpeechRecognitionClient> client) { return new SpeechRecognitionController(std::move(client)); } -void provideSpeechRecognitionTo(Page& page, std::unique_ptr<SpeechRecognitionClient> client) +void provideSpeechRecognitionTo(Page& page, PassOwnPtr<SpeechRecognitionClient> client) { SpeechRecognitionController::provideTo(page, SpeechRecognitionController::supplementName(), SpeechRecognitionController::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h index 68971af..6eced0e 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h
@@ -28,7 +28,7 @@ #include "core/page/Page.h" #include "modules/speech/SpeechRecognitionClient.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -47,16 +47,16 @@ void stop(SpeechRecognition* recognition) { m_client->stop(recognition); } void abort(SpeechRecognition* recognition) { m_client->abort(recognition); } - static SpeechRecognitionController* create(std::unique_ptr<SpeechRecognitionClient>); + static SpeechRecognitionController* create(PassOwnPtr<SpeechRecognitionClient>); static const char* supplementName(); static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); } DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<Page>::trace(visitor); } private: - explicit SpeechRecognitionController(std::unique_ptr<SpeechRecognitionClient>); + explicit SpeechRecognitionController(PassOwnPtr<SpeechRecognitionClient>); - std::unique_ptr<SpeechRecognitionClient> m_client; + OwnPtr<SpeechRecognitionClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h b/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h index 13d50e5..34b7370 100644 --- a/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h +++ b/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h
@@ -34,6 +34,7 @@ #include "modules/ModulesExport.h" #include "modules/storage/StorageArea.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/storage/Storage.cpp b/third_party/WebKit/Source/modules/storage/Storage.cpp index 323111b..06bb4ecb 100644 --- a/third_party/WebKit/Source/modules/storage/Storage.cpp +++ b/third_party/WebKit/Source/modules/storage/Storage.cpp
@@ -26,6 +26,7 @@ #include "modules/storage/Storage.h" #include "bindings/core/v8/ExceptionState.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/modules/storage/StorageArea.cpp b/third_party/WebKit/Source/modules/storage/StorageArea.cpp index 7447f5b..ca5f398 100644 --- a/third_party/WebKit/Source/modules/storage/StorageArea.cpp +++ b/third_party/WebKit/Source/modules/storage/StorageArea.cpp
@@ -43,16 +43,15 @@ #include "public/platform/WebStorageArea.h" #include "public/platform/WebString.h" #include "public/platform/WebURL.h" -#include <memory> namespace blink { -StorageArea* StorageArea::create(std::unique_ptr<WebStorageArea> storageArea, StorageType storageType) +StorageArea* StorageArea::create(PassOwnPtr<WebStorageArea> storageArea, StorageType storageType) { return new StorageArea(std::move(storageArea), storageType); } -StorageArea::StorageArea(std::unique_ptr<WebStorageArea> storageArea, StorageType storageType) +StorageArea::StorageArea(PassOwnPtr<WebStorageArea> storageArea, StorageType storageType) : LocalFrameLifecycleObserver(nullptr) , m_storageArea(std::move(storageArea)) , m_storageType(storageType) @@ -210,7 +209,7 @@ { ASSERT(storage); StorageArea* area = storage->area(); - return area->m_storageArea.get() == sourceAreaInstance; + return area->m_storageArea == sourceAreaInstance; } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/StorageArea.h b/third_party/WebKit/Source/modules/storage/StorageArea.h index 3f28860..406012a8 100644 --- a/third_party/WebKit/Source/modules/storage/StorageArea.h +++ b/third_party/WebKit/Source/modules/storage/StorageArea.h
@@ -29,8 +29,9 @@ #include "core/frame/LocalFrameLifecycleObserver.h" #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -50,7 +51,7 @@ class MODULES_EXPORT StorageArea final : public GarbageCollectedFinalized<StorageArea>, public LocalFrameLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(StorageArea); public: - static StorageArea* create(std::unique_ptr<WebStorageArea>, StorageType); + static StorageArea* create(PassOwnPtr<WebStorageArea>, StorageType); virtual ~StorageArea(); @@ -73,11 +74,11 @@ DECLARE_TRACE(); private: - StorageArea(std::unique_ptr<WebStorageArea>, StorageType); + StorageArea(PassOwnPtr<WebStorageArea>, StorageType); static bool isEventSource(Storage*, WebStorageArea* sourceAreaInstance); - std::unique_ptr<WebStorageArea> m_storageArea; + OwnPtr<WebStorageArea> m_storageArea; StorageType m_storageType; bool m_canAccessStorageCachedResult; };
diff --git a/third_party/WebKit/Source/modules/storage/StorageClient.h b/third_party/WebKit/Source/modules/storage/StorageClient.h index ef26ffec..ef98e4a1 100644 --- a/third_party/WebKit/Source/modules/storage/StorageClient.h +++ b/third_party/WebKit/Source/modules/storage/StorageClient.h
@@ -6,7 +6,7 @@ #define StorageClient_h #include "modules/storage/StorageArea.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -16,7 +16,7 @@ public: virtual ~StorageClient() { } - virtual std::unique_ptr<StorageNamespace> createSessionStorageNamespace() = 0; + virtual PassOwnPtr<StorageNamespace> createSessionStorageNamespace() = 0; virtual bool canAccessStorage(LocalFrame*, StorageType) const = 0; };
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp b/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp index 1ad21f84..60f68693 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp +++ b/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp
@@ -30,12 +30,10 @@ #include "public/platform/Platform.h" #include "public/platform/WebStorageArea.h" #include "public/platform/WebStorageNamespace.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -StorageNamespace::StorageNamespace(std::unique_ptr<WebStorageNamespace> webStorageNamespace) +StorageNamespace::StorageNamespace(PassOwnPtr<WebStorageNamespace> webStorageNamespace) : m_webStorageNamespace(std::move(webStorageNamespace)) { } @@ -50,12 +48,12 @@ static WebStorageNamespace* localStorageNamespace = nullptr; if (!localStorageNamespace) localStorageNamespace = Platform::current()->createLocalStorageNamespace(); - return StorageArea::create(wrapUnique(localStorageNamespace->createStorageArea(origin->toString())), LocalStorage); + return StorageArea::create(adoptPtr(localStorageNamespace->createStorageArea(origin->toString())), LocalStorage); } StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) { - return StorageArea::create(wrapUnique(m_webStorageNamespace->createStorageArea(origin->toString())), SessionStorage); + return StorageArea::create(adoptPtr(m_webStorageNamespace->createStorageArea(origin->toString())), SessionStorage); } bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespace) const
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespace.h b/third_party/WebKit/Source/modules/storage/StorageNamespace.h index 48565ba..1161c6e 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespace.h +++ b/third_party/WebKit/Source/modules/storage/StorageNamespace.h
@@ -28,7 +28,8 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -39,7 +40,7 @@ class MODULES_EXPORT StorageNamespace { USING_FAST_MALLOC(StorageNamespace); public: - explicit StorageNamespace(std::unique_ptr<WebStorageNamespace>); + explicit StorageNamespace(PassOwnPtr<WebStorageNamespace>); ~StorageNamespace(); static StorageArea* localStorageArea(SecurityOrigin*); @@ -48,7 +49,7 @@ bool isSameNamespace(const WebStorageNamespace& sessionNamespace) const; private: - std::unique_ptr<WebStorageNamespace> m_webStorageNamespace; + OwnPtr<WebStorageNamespace> m_webStorageNamespace; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h b/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h index b0deffaf..8ac6cb08 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h +++ b/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h
@@ -8,7 +8,7 @@ #include "core/page/Page.h" #include "modules/ModulesExport.h" #include "platform/Supplementable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -33,7 +33,7 @@ private: explicit StorageNamespaceController(StorageClient*); static const char* supplementName(); - std::unique_ptr<StorageNamespace> m_sessionStorage; + OwnPtr<StorageNamespace> m_sessionStorage; StorageClient* m_client; Member<InspectorDOMStorageAgent> m_inspectorAgent; };
diff --git a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp index e0aa660..0bc7237 100644 --- a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp
@@ -22,9 +22,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/AsyncAudioDecoder.h" #include "core/dom/DOMArrayBuffer.h" #include "modules/webaudio/AbstractAudioContext.h" -#include "modules/webaudio/AsyncAudioDecoder.h" #include "modules/webaudio/AudioBuffer.h" #include "modules/webaudio/AudioBufferCallback.h" #include "platform/ThreadSafeFunctional.h" @@ -32,12 +32,12 @@ #include "platform/audio/AudioFileReader.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" namespace blink { AsyncAudioDecoder::AsyncAudioDecoder() - : m_thread(wrapUnique(Platform::current()->createThread("Audio Decoder"))) + : m_thread(adoptPtr(Platform::current()->createThread("Audio Decoder"))) { }
diff --git a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h index b05694c..859e59f3 100644 --- a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h +++ b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h
@@ -27,8 +27,8 @@ #include "platform/heap/Handle.h" #include "public/platform/WebThread.h" +#include "wtf/OwnPtr.h" #include "wtf/build_config.h" -#include <memory> namespace blink { @@ -59,7 +59,7 @@ static void decode(DOMArrayBuffer* audioData, float sampleRate, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ScriptPromiseResolver*, AbstractAudioContext*); static void notifyComplete(DOMArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, AudioBus*, ScriptPromiseResolver*, AbstractAudioContext*); - std::unique_ptr<WebThread> m_thread; + OwnPtr<WebThread> m_thread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp index 2d7a126..9e6cc6a 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp
@@ -27,11 +27,10 @@ #include "modules/webaudio/AudioNodeOutput.h" #include "platform/audio/AudioBus.h" #include "platform/audio/AudioProcessor.h" -#include <memory> namespace blink { -AudioBasicProcessorHandler::AudioBasicProcessorHandler(NodeType nodeType, AudioNode& node, float sampleRate, std::unique_ptr<AudioProcessor> processor) +AudioBasicProcessorHandler::AudioBasicProcessorHandler(NodeType nodeType, AudioNode& node, float sampleRate, PassOwnPtr<AudioProcessor> processor) : AudioHandler(nodeType, node, sampleRate) , m_processor(std::move(processor)) { @@ -39,7 +38,7 @@ addOutput(1); } -PassRefPtr<AudioBasicProcessorHandler> AudioBasicProcessorHandler::create(NodeType nodeType, AudioNode& node, float sampleRate, std::unique_ptr<AudioProcessor> processor) +PassRefPtr<AudioBasicProcessorHandler> AudioBasicProcessorHandler::create(NodeType nodeType, AudioNode& node, float sampleRate, PassOwnPtr<AudioProcessor> processor) { return adoptRef(new AudioBasicProcessorHandler(nodeType, node, sampleRate, std::move(processor))); }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h index 46677685..2b8ab3d77 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h
@@ -28,7 +28,6 @@ #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -39,7 +38,7 @@ // where the input and output have the same number of channels. class MODULES_EXPORT AudioBasicProcessorHandler : public AudioHandler { public: - static PassRefPtr<AudioBasicProcessorHandler> create(NodeType, AudioNode&, float sampleRate, std::unique_ptr<AudioProcessor>); + static PassRefPtr<AudioBasicProcessorHandler> create(NodeType, AudioNode&, float sampleRate, PassOwnPtr<AudioProcessor>); ~AudioBasicProcessorHandler() override; // AudioHandler @@ -56,11 +55,11 @@ AudioProcessor* processor() { return m_processor.get(); } private: - AudioBasicProcessorHandler(NodeType, AudioNode&, float sampleRate, std::unique_ptr<AudioProcessor>); + AudioBasicProcessorHandler(NodeType, AudioNode&, float sampleRate, PassOwnPtr<AudioProcessor>); double tailTime() const final; double latencyTime() const final; - std::unique_ptr<AudioProcessor> m_processor; + OwnPtr<AudioProcessor> m_processor; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp index 535d1a1..612c176 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp
@@ -2,13 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/testing/DummyPageHolder.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" +#include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" #include "platform/audio/AudioProcessor.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -30,14 +28,14 @@ MockProcessorNode(AbstractAudioContext& context) : AudioNode(context) { - setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, 48000, wrapUnique(new MockAudioProcessor()))); + setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, 48000, adoptPtr(new MockAudioProcessor()))); handler().initialize(); } }; TEST(AudioBasicProcessorHandlerTest, ProcessorFinalization) { - std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); MockProcessorNode* node = new MockProcessorNode(*context); AudioBasicProcessorHandler& handler = static_cast<AudioBasicProcessorHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp index f660a33..bb0d054 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -22,17 +22,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/AudioBufferSourceNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "core/frame/UseCounter.h" #include "modules/webaudio/AbstractAudioContext.h" -#include "modules/webaudio/AudioBufferSourceNode.h" #include "modules/webaudio/AudioNodeOutput.h" #include "platform/FloatConversion.h" #include "platform/audio/AudioUtilities.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -370,8 +369,8 @@ output(0).setNumberOfChannels(numberOfChannels); - m_sourceChannels = wrapArrayUnique(new const float* [numberOfChannels]); - m_destinationChannels = wrapArrayUnique(new float* [numberOfChannels]); + m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]); + m_destinationChannels = adoptArrayPtr(new float* [numberOfChannels]); for (unsigned i = 0; i < numberOfChannels; ++i) m_sourceChannels[i] = buffer->getChannelData(i)->data();
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h index 70de4a2..35f1c1e4 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
@@ -30,10 +30,10 @@ #include "modules/webaudio/AudioScheduledSourceNode.h" #include "modules/webaudio/PannerNode.h" #include "platform/audio/AudioBus.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" -#include <memory> namespace blink { @@ -103,8 +103,8 @@ Persistent<AudioBuffer> m_buffer; // Pointers for the buffer and destination. - std::unique_ptr<const float*[]> m_sourceChannels; - std::unique_ptr<float*[]> m_destinationChannels; + OwnPtr<const float*[]> m_sourceChannels; + OwnPtr<float*[]> m_destinationChannels; RefPtr<AudioParamHandler> m_playbackRate; RefPtr<AudioParamHandler> m_detune;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.h b/third_party/WebKit/Source/modules/webaudio/AudioNode.h index 9d7fda8..15a3bd5 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.h
@@ -29,11 +29,12 @@ #include "modules/ModulesExport.h" #include "platform/audio/AudioBus.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Vector.h" #include "wtf/build_config.h" -#include <memory> #define DEBUG_AUDIONODE_REFERENCES 0 @@ -251,8 +252,8 @@ UntracedMember<AbstractAudioContext> m_context; float m_sampleRate; - Vector<std::unique_ptr<AudioNodeInput>> m_inputs; - Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; + Vector<OwnPtr<AudioNodeInput>> m_inputs; + Vector<OwnPtr<AudioNodeOutput>> m_outputs; double m_lastProcessingTime; double m_lastNonSilentTime;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp index 090af4fb..a6af8e30 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp
@@ -24,9 +24,7 @@ #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -38,9 +36,9 @@ m_internalSummingBus = AudioBus::create(1, AudioHandler::ProcessingSizeInFrames); } -std::unique_ptr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) +PassOwnPtr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) { - return wrapUnique(new AudioNodeInput(handler)); + return adoptPtr(new AudioNodeInput(handler)); } void AudioNodeInput::connect(AudioNodeOutput& output)
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h index 3af2208..c790d9ae 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h
@@ -30,7 +30,6 @@ #include "platform/audio/AudioBus.h" #include "wtf/Allocator.h" #include "wtf/HashSet.h" -#include <memory> namespace blink { @@ -43,7 +42,7 @@ class AudioNodeInput final : public AudioSummingJunction { USING_FAST_MALLOC(AudioNodeInput); public: - static std::unique_ptr<AudioNodeInput> create(AudioHandler&); + static PassOwnPtr<AudioNodeInput> create(AudioHandler&); // AudioSummingJunction void didUpdate() override;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp index ed17124..1bc384d6 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp
@@ -22,12 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/AudioNodeOutput.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeInput.h" -#include "modules/webaudio/AudioNodeOutput.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" -#include <memory> namespace blink { @@ -48,9 +46,9 @@ m_internalBus = AudioBus::create(numberOfChannels, AudioHandler::ProcessingSizeInFrames); } -std::unique_ptr<AudioNodeOutput> AudioNodeOutput::create(AudioHandler* handler, unsigned numberOfChannels) +PassOwnPtr<AudioNodeOutput> AudioNodeOutput::create(AudioHandler* handler, unsigned numberOfChannels) { - return wrapUnique(new AudioNodeOutput(handler, numberOfChannels)); + return adoptPtr(new AudioNodeOutput(handler, numberOfChannels)); } void AudioNodeOutput::dispose()
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h index 8fe931c..ebddbff 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h
@@ -30,7 +30,6 @@ #include "platform/audio/AudioBus.h" #include "wtf/HashSet.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -43,7 +42,7 @@ public: // It's OK to pass 0 for numberOfChannels in which case // setNumberOfChannels() must be called later on. - static std::unique_ptr<AudioNodeOutput> create(AudioHandler*, unsigned numberOfChannels); + static PassOwnPtr<AudioNodeOutput> create(AudioHandler*, unsigned numberOfChannels); void dispose(); // Causes our AudioNode to process if it hasn't already for this render quantum.
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp index 7053583..68a13022 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
@@ -23,10 +23,8 @@ */ #include "modules/webaudio/BiquadFilterNode.h" - #include "modules/webaudio/AudioBasicProcessorHandler.h" #include "platform/Histogram.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -41,7 +39,7 @@ AudioHandler::NodeTypeBiquadFilter, *this, context.sampleRate(), - wrapUnique(new BiquadProcessor( + adoptPtr(new BiquadProcessor( context.sampleRate(), 1, m_frequency->handler(),
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp index a665e78b..110dff4 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp
@@ -22,10 +22,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/BiquadDSPKernel.h" #include "modules/webaudio/BiquadProcessor.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "modules/webaudio/BiquadDSPKernel.h" namespace blink { @@ -47,9 +45,9 @@ uninitialize(); } -std::unique_ptr<AudioDSPKernel> BiquadProcessor::createKernel() +PassOwnPtr<AudioDSPKernel> BiquadProcessor::createKernel() { - return wrapUnique(new BiquadDSPKernel(this)); + return adoptPtr(new BiquadDSPKernel(this)); } void BiquadProcessor::checkForDirtyCoefficients() @@ -112,7 +110,7 @@ // to avoid interfering with the processing running in the audio // thread on the main kernels. - std::unique_ptr<BiquadDSPKernel> responseKernel = wrapUnique(new BiquadDSPKernel(this)); + OwnPtr<BiquadDSPKernel> responseKernel = adoptPtr(new BiquadDSPKernel(this)); responseKernel->getFrequencyResponse(nFrequencies, frequencyHz, magResponse, phaseResponse); }
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h index 13fe5bb..c9d29e2 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h
@@ -31,7 +31,6 @@ #include "platform/audio/AudioDSPKernelProcessor.h" #include "platform/audio/Biquad.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -54,7 +53,7 @@ BiquadProcessor(float sampleRate, size_t numberOfChannels, AudioParamHandler& frequency, AudioParamHandler& q, AudioParamHandler& gain, AudioParamHandler& detune); ~BiquadProcessor() override; - std::unique_ptr<AudioDSPKernel> createKernel() override; + PassOwnPtr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp index dee1806..3413e7a 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp
@@ -22,15 +22,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/ConvolverNode.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AudioBuffer.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" -#include "modules/webaudio/ConvolverNode.h" #include "platform/audio/Reverb.h" -#include "wtf/PtrUtil.h" -#include <memory> // Note about empirical tuning: // The maximum FFT size affects reverb performance and accuracy. @@ -129,7 +127,7 @@ bufferBus->setSampleRate(buffer->sampleRate()); // Create the reverb with the given impulse response. - std::unique_ptr<Reverb> reverb = wrapUnique(new Reverb(bufferBus.get(), ProcessingSizeInFrames, MaxFFTSize, 2, context() && context()->hasRealtimeConstraint(), m_normalize)); + OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), ProcessingSizeInFrames, MaxFFTSize, 2, context() && context()->hasRealtimeConstraint(), m_normalize)); { // Synchronize with process().
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h index d27be4e..294fde6 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h
@@ -28,9 +28,9 @@ #include "base/gtest_prod_util.h" #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -58,7 +58,7 @@ double tailTime() const override; double latencyTime() const override; - std::unique_ptr<Reverb> m_reverb; + OwnPtr<Reverb> m_reverb; // This Persistent doesn't make a reference cycle including the owner // ConvolverNode. Persistent<AudioBuffer> m_buffer;
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp index ff2545cd..04d5122 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp
@@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/testing/DummyPageHolder.h" #include "modules/webaudio/ConvolverNode.h" +#include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(ConvolverNodeTest, ReverbLifetime) { - std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); ConvolverNode* node = context->createConvolver(ASSERT_NO_EXCEPTION); ConvolverHandler& handler = node->convolverHandler();
diff --git a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h index 4940ac8..9b6a8d2 100644 --- a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h
@@ -27,7 +27,7 @@ #include "modules/webaudio/AudioDestinationNode.h" #include "platform/audio/AudioDestination.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -54,7 +54,7 @@ explicit DefaultAudioDestinationHandler(AudioNode&); void createDestination(); - std::unique_ptr<AudioDestination> m_destination; + OwnPtr<AudioDestination> m_destination; String m_inputDeviceId; unsigned m_numberOfInputChannels; };
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp b/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp index eb35ee1..b8d530f 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp
@@ -22,14 +22,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/DelayNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" -#include "modules/webaudio/DelayNode.h" #include "modules/webaudio/DelayProcessor.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -43,7 +42,7 @@ AudioHandler::NodeTypeDelay, *this, context.sampleRate(), - wrapUnique(new DelayProcessor( + adoptPtr(new DelayProcessor( context.sampleRate(), 1, m_delayTime->handler(),
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp index c502851..3a35f865 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp
@@ -22,10 +22,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/DelayDSPKernel.h" #include "modules/webaudio/DelayProcessor.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "modules/webaudio/DelayDSPKernel.h" namespace blink { @@ -42,9 +40,9 @@ uninitialize(); } -std::unique_ptr<AudioDSPKernel> DelayProcessor::createKernel() +PassOwnPtr<AudioDSPKernel> DelayProcessor::createKernel() { - return wrapUnique(new DelayDSPKernel(this)); + return adoptPtr(new DelayDSPKernel(this)); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h index a8223e5..20278f6 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h
@@ -27,8 +27,8 @@ #include "modules/webaudio/AudioParam.h" #include "platform/audio/AudioDSPKernelProcessor.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -39,7 +39,7 @@ DelayProcessor(float sampleRate, unsigned numberOfChannels, AudioParamHandler& delayTime, double maxDelayTime); ~DelayProcessor() override; - std::unique_ptr<AudioDSPKernel> createKernel() override; + PassOwnPtr<AudioDSPKernel> createKernel() override; AudioParamHandler& delayTime() const { return *m_delayTime; } double maxDelayTime() { return m_maxDelayTime; }
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp index d12764d..b259ddb 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp
@@ -22,11 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/DynamicsCompressorNode.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" -#include "modules/webaudio/DynamicsCompressorNode.h" #include "platform/audio/DynamicsCompressor.h" -#include "wtf/PtrUtil.h" // Set output to stereo by default. static const unsigned defaultNumberOfOutputChannels = 2; @@ -106,7 +105,7 @@ return; AudioHandler::initialize(); - m_dynamicsCompressor = wrapUnique(new DynamicsCompressor(sampleRate(), defaultNumberOfOutputChannels)); + m_dynamicsCompressor = adoptPtr(new DynamicsCompressor(sampleRate(), defaultNumberOfOutputChannels)); } void DynamicsCompressorHandler::clearInternalStateWhenDisabled()
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h index 27e2201..6eb63ca 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h
@@ -29,7 +29,7 @@ #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" #include "modules/webaudio/AudioParam.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -67,7 +67,7 @@ double tailTime() const override; double latencyTime() const override; - std::unique_ptr<DynamicsCompressor> m_dynamicsCompressor; + OwnPtr<DynamicsCompressor> m_dynamicsCompressor; RefPtr<AudioParamHandler> m_threshold; RefPtr<AudioParamHandler> m_knee; RefPtr<AudioParamHandler> m_ratio;
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp index e04a567..67bd8b7 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp
@@ -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 "modules/webaudio/DynamicsCompressorNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/AbstractAudioContext.h" -#include "modules/webaudio/DynamicsCompressorNode.h" #include "modules/webaudio/OfflineAudioContext.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(DynamicsCompressorNodeTest, ProcessorLifetime) { - std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); DynamicsCompressorNode* node = context->createDynamicsCompressor(ASSERT_NO_EXCEPTION); DynamicsCompressorHandler& handler = node->dynamicsCompressorHandler();
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp index 98d008e..bde304df 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp
@@ -10,7 +10,6 @@ #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" #include "platform/Histogram.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -19,7 +18,7 @@ { setHandler(AudioBasicProcessorHandler::create( AudioHandler::NodeTypeIIRFilter, *this, context.sampleRate(), - wrapUnique(new IIRProcessor(context.sampleRate(), 1, feedforwardCoef, feedbackCoef)))); + adoptPtr(new IIRProcessor(context.sampleRate(), 1, feedforwardCoef, feedbackCoef)))); // Histogram of the IIRFilter order. createIIRFilter ensures that the length of |feedbackCoef| // is in the range [1, IIRFilter::kMaxOrder + 1]. The order is one less than the length of this
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp index e6ce38f..660dd44 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp
@@ -5,8 +5,6 @@ #include "modules/webaudio/IIRProcessor.h" #include "modules/webaudio/IIRDSPKernel.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -48,7 +46,7 @@ m_feedback[0] = 1; } - m_responseKernel = wrapUnique(new IIRDSPKernel(this)); + m_responseKernel = adoptPtr(new IIRDSPKernel(this)); } IIRProcessor::~IIRProcessor() @@ -57,9 +55,9 @@ uninitialize(); } -std::unique_ptr<AudioDSPKernel> IIRProcessor::createKernel() +PassOwnPtr<AudioDSPKernel> IIRProcessor::createKernel() { - return wrapUnique(new IIRDSPKernel(this)); + return adoptPtr(new IIRDSPKernel(this)); } void IIRProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess)
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h index 11b39be6..e6866c0b 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h
@@ -9,7 +9,6 @@ #include "platform/audio/AudioDSPKernel.h" #include "platform/audio/AudioDSPKernelProcessor.h" #include "platform/audio/IIRFilter.h" -#include <memory> namespace blink { @@ -21,7 +20,7 @@ const Vector<double>& feedforwardCoef, const Vector<double>& feedbackCoef); ~IIRProcessor() override; - std::unique_ptr<AudioDSPKernel> createKernel() override; + PassOwnPtr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override; @@ -37,7 +36,7 @@ AudioDoubleArray m_feedback; AudioDoubleArray m_feedforward; // This holds the IIR kernel for computing the frequency response. - std::unique_ptr<IIRDSPKernel> m_responseKernel; + OwnPtr<IIRDSPKernel> m_responseKernel; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp index f4309bb..c1fb73a 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp
@@ -22,17 +22,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/MediaElementAudioSourceNode.h" #include "core/dom/CrossThreadTask.h" #include "core/html/HTMLMediaElement.h" #include "core/inspector/ConsoleMessage.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeOutput.h" -#include "modules/webaudio/MediaElementAudioSourceNode.h" #include "platform/Logging.h" #include "platform/audio/AudioUtilities.h" #include "platform/weborigin/SecurityOrigin.h" #include "wtf/Locker.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -91,7 +90,7 @@ if (sourceSampleRate != sampleRate()) { double scaleFactor = sourceSampleRate / sampleRate(); - m_multiChannelResampler = wrapUnique(new MultiChannelResampler(scaleFactor, numberOfChannels)); + m_multiChannelResampler = adoptPtr(new MultiChannelResampler(scaleFactor, numberOfChannels)); } else { // Bypass resampling. m_multiChannelResampler.reset();
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h index 20fa9a6..c0181005 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h
@@ -28,9 +28,9 @@ #include "modules/webaudio/AudioSourceNode.h" #include "platform/audio/AudioSourceProviderClient.h" #include "platform/audio/MultiChannelResampler.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -78,7 +78,7 @@ unsigned m_sourceNumberOfChannels; double m_sourceSampleRate; - std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; + OwnPtr<MultiChannelResampler> m_multiChannelResampler; // |m_passesCurrentSrcCORSAccessCheck| holds the value of // context()->getSecurityOrigin() && context()->getSecurityOrigin()->canRequest(mediaElement()->currentSrc()),
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h index 2267b15..cf4989d 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h
@@ -28,6 +28,7 @@ #include "modules/mediastream/MediaStream.h" #include "modules/webaudio/AudioBasicInspectorNode.h" #include "platform/audio/AudioBus.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp index e976165..0a911f61 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp
@@ -29,11 +29,10 @@ #include "modules/webaudio/AudioNodeOutput.h" #include "platform/Logging.h" #include "wtf/Locker.h" -#include <memory> namespace blink { -MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) +MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) : AudioHandler(NodeTypeMediaStreamAudioSource, node, node.context()->sampleRate()) , m_mediaStream(mediaStream) , m_audioTrack(audioTrack) @@ -47,7 +46,7 @@ initialize(); } -PassRefPtr<MediaStreamAudioSourceHandler> MediaStreamAudioSourceHandler::create(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) +PassRefPtr<MediaStreamAudioSourceHandler> MediaStreamAudioSourceHandler::create(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) { return adoptRef(new MediaStreamAudioSourceHandler(node, mediaStream, audioTrack, std::move(audioSourceProvider))); } @@ -111,7 +110,7 @@ // ---------------------------------------------------------------- -MediaStreamAudioSourceNode::MediaStreamAudioSourceNode(AbstractAudioContext& context, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) +MediaStreamAudioSourceNode::MediaStreamAudioSourceNode(AbstractAudioContext& context, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) : AudioSourceNode(context) { setHandler(MediaStreamAudioSourceHandler::create(*this, mediaStream, audioTrack, std::move(audioSourceProvider))); @@ -136,7 +135,7 @@ // Use the first audio track in the media stream. MediaStreamTrack* audioTrack = audioTracks[0]; - std::unique_ptr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); + OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); MediaStreamAudioSourceNode* node = new MediaStreamAudioSourceNode(context, mediaStream, audioTrack, std::move(provider));
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h index d0f448d..da461bc 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h
@@ -29,9 +29,9 @@ #include "modules/webaudio/AudioSourceNode.h" #include "platform/audio/AudioSourceProvider.h" #include "platform/audio/AudioSourceProviderClient.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Threading.h" -#include <memory> namespace blink { @@ -39,7 +39,7 @@ class MediaStreamAudioSourceHandler final : public AudioHandler { public: - static PassRefPtr<MediaStreamAudioSourceHandler> create(AudioNode&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); + static PassRefPtr<MediaStreamAudioSourceHandler> create(AudioNode&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); ~MediaStreamAudioSourceHandler() override; MediaStream* getMediaStream() { return m_mediaStream.get(); } @@ -54,7 +54,7 @@ AudioSourceProvider* getAudioSourceProvider() const { return m_audioSourceProvider.get(); } private: - MediaStreamAudioSourceHandler(AudioNode&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); + MediaStreamAudioSourceHandler(AudioNode&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); // As an audio source, we will never propagate silence. bool propagatesSilence() const override { return false; } @@ -62,7 +62,7 @@ // MediaStreamAudioSourceNode. Persistent<MediaStream> m_mediaStream; Persistent<MediaStreamTrack> m_audioTrack; - std::unique_ptr<AudioSourceProvider> m_audioSourceProvider; + OwnPtr<AudioSourceProvider> m_audioSourceProvider; Mutex m_processLock; @@ -83,7 +83,7 @@ void setFormat(size_t numberOfChannels, float sampleRate) override; private: - MediaStreamAudioSourceNode(AbstractAudioContext&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); + MediaStreamAudioSourceNode(AbstractAudioContext&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp index b1a943e8..92696e0 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -22,17 +22,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/OfflineAudioDestinationNode.h" #include "core/dom/CrossThreadTask.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" #include "modules/webaudio/OfflineAudioContext.h" -#include "modules/webaudio/OfflineAudioDestinationNode.h" #include "platform/audio/AudioBus.h" #include "platform/audio/DenormalDisabler.h" #include "platform/audio/HRTFDatabaseLoader.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -42,7 +41,7 @@ OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(AudioNode& node, AudioBuffer* renderTarget) : AudioDestinationHandler(node, renderTarget->sampleRate()) , m_renderTarget(renderTarget) - , m_renderThread(wrapUnique(Platform::current()->createThread("offline audio renderer"))) + , m_renderThread(adoptPtr(Platform::current()->createThread("offline audio renderer"))) , m_framesProcessed(0) , m_framesToProcess(0) , m_isRenderingStarted(false)
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h index b4a4716..69a700b 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h
@@ -31,7 +31,6 @@ #include "public/platform/WebThread.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -99,7 +98,7 @@ RefPtr<AudioBus> m_renderBus; // Rendering thread. - std::unique_ptr<WebThread> m_renderThread; + OwnPtr<WebThread> m_renderThread; // These variables are for counting the number of frames for the current // progress and the remaining frames to be processed.
diff --git a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h index f515946e..841bad2 100644 --- a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h +++ b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h
@@ -28,6 +28,7 @@ #include "modules/webaudio/AudioParam.h" #include "modules/webaudio/AudioScheduledSourceNode.h" #include "platform/audio/AudioBus.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h"
diff --git a/third_party/WebKit/Source/modules/webaudio/PannerNode.h b/third_party/WebKit/Source/modules/webaudio/PannerNode.h index ca5fde4..e360a27 100644 --- a/third_party/WebKit/Source/modules/webaudio/PannerNode.h +++ b/third_party/WebKit/Source/modules/webaudio/PannerNode.h
@@ -34,7 +34,6 @@ #include "platform/audio/Panner.h" #include "platform/geometry/FloatPoint3D.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -153,7 +152,7 @@ // This Persistent doesn't make a reference cycle including the owner // PannerNode. Persistent<AudioListener> m_listener; - std::unique_ptr<Panner> m_panner; + OwnPtr<Panner> m_panner; unsigned m_panningModel; unsigned m_distanceModel;
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp index fdd7ebd..cbe3d43 100644 --- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp +++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
@@ -26,17 +26,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/PeriodicWave.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/OscillatorNode.h" -#include "modules/webaudio/PeriodicWave.h" #include "platform/audio/FFTFrame.h" #include "platform/audio/VectorMath.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -244,7 +242,7 @@ // Create the band-limited table. unsigned waveSize = periodicWaveSize(); - std::unique_ptr<AudioFloatArray> table = wrapUnique(new AudioFloatArray(waveSize)); + OwnPtr<AudioFloatArray> table = adoptPtr(new AudioFloatArray(waveSize)); adjustV8ExternalMemory(waveSize * sizeof(float)); m_bandLimitedTables.append(std::move(table));
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h index a5629b9..17a7844 100644 --- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h +++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h
@@ -34,7 +34,6 @@ #include "platform/audio/AudioArray.h" #include "wtf/Forward.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -105,7 +104,7 @@ // Creates tables based on numberOfComponents Fourier coefficients. void createBandLimitedTables(const float* real, const float* imag, unsigned numberOfComponents, bool disableNormalization); - Vector<std::unique_ptr<AudioFloatArray>> m_bandLimitedTables; + Vector<OwnPtr<AudioFloatArray>> m_bandLimitedTables; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp index 3acf089..212e4d0 100644 --- a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp +++ b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp
@@ -27,7 +27,6 @@ #include "platform/audio/AudioUtilities.h" #include "platform/audio/VectorMath.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include <algorithm> #include <complex> #include <limits.h> @@ -55,7 +54,7 @@ , m_maxDecibels(DefaultMaxDecibels) , m_lastAnalysisTime(-1) { - m_analysisFrame = wrapUnique(new FFTFrame(DefaultFFTSize)); + m_analysisFrame = adoptPtr(new FFTFrame(DefaultFFTSize)); } bool RealtimeAnalyser::setFftSize(size_t size) @@ -70,7 +69,7 @@ return false; if (m_fftSize != size) { - m_analysisFrame = wrapUnique(new FFTFrame(size)); + m_analysisFrame = adoptPtr(new FFTFrame(size)); // m_magnitudeBuffer has size = fftSize / 2 because it contains floats reduced from complex values in m_analysisFrame. m_magnitudeBuffer.allocate(size / 2); m_fftSize = size;
diff --git a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h index 6d61f94..2b27a00 100644 --- a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h +++ b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h
@@ -29,7 +29,7 @@ #include "platform/audio/AudioArray.h" #include "platform/audio/FFTFrame.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -81,7 +81,7 @@ RefPtr<AudioBus> m_downMixBus; size_t m_fftSize; - std::unique_ptr<FFTFrame> m_analysisFrame; + OwnPtr<FFTFrame> m_analysisFrame; void doFFTAnalysis(); // Convert the contents of magnitudeBuffer to byte values, saving the result in |destination|.
diff --git a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp index d22af2d..db38a7d 100644 --- a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp
@@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "modules/webaudio/ScriptProcessorNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" -#include "modules/webaudio/ScriptProcessorNode.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(ScriptProcessorNodeTest, BufferLifetime) { - std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); ScriptProcessorNode* node = context->createScriptProcessor(ASSERT_NO_EXCEPTION); ScriptProcessorHandler& handler = static_cast<ScriptProcessorHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h index 4837c43..32f1d9b1 100644 --- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h +++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h
@@ -10,7 +10,6 @@ #include "modules/webaudio/AudioParam.h" #include "platform/audio/AudioBus.h" #include "platform/audio/Spatializer.h" -#include <memory> namespace blink { @@ -32,7 +31,7 @@ private: StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan); - std::unique_ptr<Spatializer> m_stereoPanner; + OwnPtr<Spatializer> m_stereoPanner; RefPtr<AudioParamHandler> m_pan; AudioFloatArray m_sampleAccuratePanValues;
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp index 2f02f60..a195c09a 100644 --- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp
@@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "modules/webaudio/StereoPannerNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" -#include "modules/webaudio/StereoPannerNode.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { TEST(StereoPannerNodeTest, StereoPannerLifetime) { - std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); + OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); StereoPannerNode* node = context->createStereoPanner(ASSERT_NO_EXCEPTION); StereoPannerHandler& handler = static_cast<StereoPannerHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp index f841b05..fdd64071 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp
@@ -23,7 +23,6 @@ */ #include "modules/webaudio/WaveShaperDSPKernel.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include <algorithm> @@ -41,12 +40,12 @@ void WaveShaperDSPKernel::lazyInitializeOversampling() { if (!m_tempBuffer) { - m_tempBuffer = wrapUnique(new AudioFloatArray(RenderingQuantum * 2)); - m_tempBuffer2 = wrapUnique(new AudioFloatArray(RenderingQuantum * 4)); - m_upSampler = wrapUnique(new UpSampler(RenderingQuantum)); - m_downSampler = wrapUnique(new DownSampler(RenderingQuantum * 2)); - m_upSampler2 = wrapUnique(new UpSampler(RenderingQuantum * 2)); - m_downSampler2 = wrapUnique(new DownSampler(RenderingQuantum * 4)); + m_tempBuffer = adoptPtr(new AudioFloatArray(RenderingQuantum * 2)); + m_tempBuffer2 = adoptPtr(new AudioFloatArray(RenderingQuantum * 4)); + m_upSampler = adoptPtr(new UpSampler(RenderingQuantum)); + m_downSampler = adoptPtr(new DownSampler(RenderingQuantum * 2)); + m_upSampler2 = adoptPtr(new UpSampler(RenderingQuantum * 2)); + m_downSampler2 = adoptPtr(new DownSampler(RenderingQuantum * 4)); } }
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h index 67d143a..7d8c2dd3 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h
@@ -30,7 +30,7 @@ #include "platform/audio/AudioDSPKernel.h" #include "platform/audio/DownSampler.h" #include "platform/audio/UpSampler.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -62,12 +62,12 @@ WaveShaperProcessor* getWaveShaperProcessor() { return static_cast<WaveShaperProcessor*>(processor()); } // Oversampling. - std::unique_ptr<AudioFloatArray> m_tempBuffer; - std::unique_ptr<AudioFloatArray> m_tempBuffer2; - std::unique_ptr<UpSampler> m_upSampler; - std::unique_ptr<DownSampler> m_downSampler; - std::unique_ptr<UpSampler> m_upSampler2; - std::unique_ptr<DownSampler> m_downSampler2; + OwnPtr<AudioFloatArray> m_tempBuffer; + OwnPtr<AudioFloatArray> m_tempBuffer2; + OwnPtr<UpSampler> m_upSampler; + OwnPtr<DownSampler> m_downSampler; + OwnPtr<UpSampler> m_upSampler2; + OwnPtr<DownSampler> m_downSampler2; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp index ae9ae322..6247608 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp
@@ -22,20 +22,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "modules/webaudio/WaveShaperNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" -#include "modules/webaudio/WaveShaperNode.h" -#include "wtf/PtrUtil.h" namespace blink { WaveShaperNode::WaveShaperNode(AbstractAudioContext& context) : AudioNode(context) { - setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, context.sampleRate(), wrapUnique(new WaveShaperProcessor(context.sampleRate(), 1)))); + setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sampleRate(), 1)))); handler().initialize(); }
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp index 3ad18df..a289cb7a 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp
@@ -22,10 +22,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/WaveShaperDSPKernel.h" #include "modules/webaudio/WaveShaperProcessor.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "modules/webaudio/WaveShaperDSPKernel.h" namespace blink { @@ -41,9 +39,9 @@ uninitialize(); } -std::unique_ptr<AudioDSPKernel> WaveShaperProcessor::createKernel() +PassOwnPtr<AudioDSPKernel> WaveShaperProcessor::createKernel() { - return wrapUnique(new WaveShaperDSPKernel(this)); + return adoptPtr(new WaveShaperDSPKernel(this)); } void WaveShaperProcessor::setCurve(DOMFloat32Array* curve)
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h index b6b6708..3a54e9b 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h
@@ -31,7 +31,6 @@ #include "platform/audio/AudioDSPKernelProcessor.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -49,7 +48,7 @@ ~WaveShaperProcessor() override; - std::unique_ptr<AudioDSPKernel> createKernel() override; + PassOwnPtr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
diff --git a/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h b/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h index 00d7b1c..dbf4c20 100644 --- a/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h +++ b/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h
@@ -31,7 +31,6 @@ #include "modules/webdatabase/SQLTransactionBackend.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -51,7 +50,7 @@ String m_oldVersion; String m_newVersion; - std::unique_ptr<SQLErrorData> m_sqlError; + OwnPtr<SQLErrorData> m_sqlError; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 101fb0a7..2f31777 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -55,7 +55,6 @@ #include "public/platform/WebSecurityOrigin.h" #include "wtf/Atomics.h" #include "wtf/CurrentTime.h" -#include <memory> // Registering "opened" databases with the DatabaseTracker // ======================================================= @@ -266,7 +265,7 @@ DatabaseTracker::tracker().prepareToOpenDatabase(this); bool success = false; - std::unique_ptr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success); + OwnPtr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); synchronizer.waitForTaskCompletion(); @@ -332,7 +331,7 @@ transaction = m_transactionQueue.takeFirst(); if (transaction && getDatabaseContext()->databaseThreadAvailable()) { - std::unique_ptr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction()); m_transactionInProgress = true; getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); @@ -346,7 +345,7 @@ if (!getDatabaseContext()->databaseThreadAvailable()) return; - std::unique_ptr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); } @@ -810,7 +809,7 @@ runTransaction(callback, errorCallback, successCallback, true); } -static void callTransactionErrorCallback(SQLTransactionErrorCallback* callback, std::unique_ptr<SQLErrorData> errorData) +static void callTransactionErrorCallback(SQLTransactionErrorCallback* callback, PassOwnPtr<SQLErrorData> errorData) { callback->handleEvent(SQLError::create(*errorData)); } @@ -836,7 +835,7 @@ SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback(); ASSERT(callback == originalErrorCallback); if (callback) { - std::unique_ptr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ERR, "database has been closed"); + OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ERR, "database has been closed"); getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&callTransactionErrorCallback, callback, passed(std::move(error)))); } } @@ -888,7 +887,7 @@ if (!getDatabaseContext()->databaseThreadAvailable()) return result; - std::unique_ptr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); + OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); synchronizer.waitForTaskCompletion();
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h index 6102d48..84deeb1 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h
@@ -35,11 +35,11 @@ #include "modules/webdatabase/SQLTransactionBackend.h" #include "platform/TaskSynchronizer.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Threading.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -73,9 +73,9 @@ class Database::DatabaseOpenTask final : public DatabaseTask { public: - static std::unique_ptr<DatabaseOpenTask> create(Database* db, bool setVersionInNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& errorMessage, bool& success) + static PassOwnPtr<DatabaseOpenTask> create(Database* db, bool setVersionInNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& errorMessage, bool& success) { - return wrapUnique(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success)); + return adoptPtr(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success)); } private: @@ -94,9 +94,9 @@ class Database::DatabaseCloseTask final : public DatabaseTask { public: - static std::unique_ptr<DatabaseCloseTask> create(Database* db, TaskSynchronizer* synchronizer) + static PassOwnPtr<DatabaseCloseTask> create(Database* db, TaskSynchronizer* synchronizer) { - return wrapUnique(new DatabaseCloseTask(db, synchronizer)); + return adoptPtr(new DatabaseCloseTask(db, synchronizer)); } private: @@ -113,9 +113,9 @@ ~DatabaseTransactionTask() override; // Transaction task is never synchronous, so no 'synchronizer' parameter. - static std::unique_ptr<DatabaseTransactionTask> create(SQLTransactionBackend* transaction) + static PassOwnPtr<DatabaseTransactionTask> create(SQLTransactionBackend* transaction) { - return wrapUnique(new DatabaseTransactionTask(transaction)); + return adoptPtr(new DatabaseTransactionTask(transaction)); } SQLTransactionBackend* transaction() const { return m_transaction.get(); } @@ -134,9 +134,9 @@ class Database::DatabaseTableNamesTask final : public DatabaseTask { public: - static std::unique_ptr<DatabaseTableNamesTask> create(Database* db, TaskSynchronizer* synchronizer, Vector<String>& names) + static PassOwnPtr<DatabaseTableNamesTask> create(Database* db, TaskSynchronizer* synchronizer, Vector<String>& names) { - return wrapUnique(new DatabaseTableNamesTask(db, synchronizer, names)); + return adoptPtr(new DatabaseTableNamesTask(db, synchronizer, names)); } private:
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp index e6bc6f22..0fe5777 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
@@ -36,13 +36,11 @@ #include "platform/ThreadSafeFunctional.h" #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { DatabaseThread::DatabaseThread() - : m_transactionClient(wrapUnique(new SQLTransactionClient())) + : m_transactionClient(adoptPtr(new SQLTransactionClient())) , m_cleanupSync(nullptr) , m_terminationRequested(false) { @@ -162,7 +160,7 @@ return !isMainThread(); } -void DatabaseThread::scheduleTask(std::unique_ptr<DatabaseTask> task) +void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) { ASSERT(m_thread); #if ENABLE(ASSERT)
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h index afe5454..26355298 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h
@@ -31,8 +31,9 @@ #include "platform/WebThreadSupportingGC.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -53,7 +54,7 @@ void terminate(); // Callable from the main thread or the database thread. - void scheduleTask(std::unique_ptr<DatabaseTask>); + void scheduleTask(PassOwnPtr<DatabaseTask>); bool isDatabaseThread() const; // Callable only from the database thread. @@ -71,14 +72,14 @@ void cleanupDatabaseThread(); void cleanupDatabaseThreadCompleted(); - std::unique_ptr<WebThreadSupportingGC> m_thread; + OwnPtr<WebThreadSupportingGC> m_thread; // This set keeps track of the open databases that have been used on this thread. // This must be updated in the database thread though it is constructed and // destructed in the context thread. HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet; - std::unique_ptr<SQLTransactionClient> m_transactionClient; + OwnPtr<SQLTransactionClient> m_transactionClient; CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator; TaskSynchronizer* m_cleanupSync;
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp index 3c31da46..d19c06e4 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
@@ -88,7 +88,7 @@ { MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); if (!m_openDatabaseMap) - m_openDatabaseMap = wrapUnique(new DatabaseOriginMap); + m_openDatabaseMap = adoptPtr(new DatabaseOriginMap); String originString = database->getSecurityOrigin()->toRawString(); DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString);
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h index 3a8bc64..03a57a7 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h
@@ -38,7 +38,6 @@ #include "wtf/ThreadingPrimitives.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -86,7 +85,7 @@ Mutex m_openDatabaseMapGuard; - mutable std::unique_ptr<DatabaseOriginMap> m_openDatabaseMap; + mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h index b8ec23c..5ceb9c1 100644 --- a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h +++ b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h
@@ -35,6 +35,7 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLError.h b/third_party/WebKit/Source/modules/webdatabase/SQLError.h index 730f5c9..25187680 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLError.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLError.h
@@ -30,26 +30,24 @@ #define SQLError_h #include "bindings/core/v8/ScriptWrappable.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { class SQLErrorData { USING_FAST_MALLOC(SQLErrorData); public: - static std::unique_ptr<SQLErrorData> create(unsigned code, const String& message) + static PassOwnPtr<SQLErrorData> create(unsigned code, const String& message) { - return wrapUnique(new SQLErrorData(code, message)); + return adoptPtr(new SQLErrorData(code, message)); } - static std::unique_ptr<SQLErrorData> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage) + static PassOwnPtr<SQLErrorData> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage) { return create(code, String::format("%s (%d %s)", message, sqliteCode, sqliteMessage)); } - static std::unique_ptr<SQLErrorData> create(const SQLErrorData& data) + static PassOwnPtr<SQLErrorData> create(const SQLErrorData& data) { return create(data.code(), data.message()); }
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h index 1f789c6..204d50b 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h
@@ -33,7 +33,6 @@ #include "wtf/Forward.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -72,7 +71,7 @@ bool m_hasCallback; bool m_hasErrorCallback; - std::unique_ptr<SQLErrorData> m_error; + OwnPtr<SQLErrorData> m_error; Member<SQLResultSet> m_resultSet; int m_permissions;
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h index ed47e55..21e5eaf7 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h
@@ -35,7 +35,6 @@ #include "modules/webdatabase/SQLStatement.h" #include "modules/webdatabase/SQLTransactionStateMachine.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -111,7 +110,7 @@ Member<SQLTransactionErrorCallback> m_errorCallback; bool m_executeSqlAllowed; - std::unique_ptr<SQLErrorData> m_transactionError; + OwnPtr<SQLErrorData> m_transactionError; bool m_readOnly; };
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp index 8a4f350..d1f589f8 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp
@@ -41,9 +41,7 @@ #include "modules/webdatabase/sqlite/SQLValue.h" #include "modules/webdatabase/sqlite/SQLiteTransaction.h" #include "platform/Logging.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> // How does a SQLTransaction work? @@ -255,7 +253,7 @@ // // When executing the transaction (in DatabaseThread::databaseThread()): // ==================================================================== -// std::unique_ptr<DatabaseTask> task; // points to ... +// OwnPtr<DatabaseTask> task; // points to ... // --> DatabaseTransactionTask // Member<SQLTransactionBackend> m_transaction points to ... // --> SQLTransactionBackend // Member<SQLTransaction> m_frontend; // --> SQLTransaction // Member<SQLTransactionBackend> m_backend points to ... @@ -279,7 +277,7 @@ // However, there will still be a DatabaseTask pointing to the SQLTransactionBackend (see // the "When executing the transaction" chain above). This will keep the // SQLTransactionBackend alive until DatabaseThread::databaseThread() releases its -// task std::unique_ptr. +// task OwnPtr. // // What happens if a transaction is interrupted? // ============================================ @@ -563,7 +561,7 @@ m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize()); ASSERT(!m_sqliteTransaction); - m_sqliteTransaction = wrapUnique(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); + m_sqliteTransaction = adoptPtr(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); m_database->resetDeletes(); m_database->disableAuthorizer();
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h index 989d733..c3504d8d 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h
@@ -35,7 +35,6 @@ #include "wtf/Deque.h" #include "wtf/Forward.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -111,7 +110,7 @@ Member<Database> m_database; Member<SQLTransactionWrapper> m_wrapper; - std::unique_ptr<SQLErrorData> m_transactionError; + OwnPtr<SQLErrorData> m_transactionError; bool m_hasCallback; bool m_hasSuccessCallback; @@ -125,7 +124,7 @@ Mutex m_statementMutex; Deque<CrossThreadPersistent<SQLStatementBackend>> m_statementQueue; - std::unique_ptr<SQLiteTransaction> m_sqliteTransaction; + OwnPtr<SQLiteTransaction> m_sqliteTransaction; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp index 230486d9..9b0db26 100644 --- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp
@@ -30,9 +30,7 @@ #include "platform/heap/SafePoint.h" #include "third_party/sqlite/sqlite3.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" -#include <memory> // SQLite 3.6.16 makes sqlite3_prepare_v2 automatically retry preparing the statement // once if the database scheme has changed. We rely on this behavior. @@ -102,8 +100,8 @@ // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race // with Oilpan stack scanning. - std::unique_ptr<const char*> tail = wrapUnique(new const char*); - std::unique_ptr<sqlite3_stmt*> statement = wrapUnique(new sqlite3_stmt*); + OwnPtr<const char*> tail = adoptPtr(new const char*); + OwnPtr<sqlite3_stmt*> statement = adoptPtr(new sqlite3_stmt*); *tail = nullptr; *statement = nullptr; int error;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp index a9ddea2..0f85d11 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp
@@ -28,7 +28,6 @@ #include "platform/graphics/gpu/DrawingBuffer.h" #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" -#include <memory> namespace blink { @@ -40,11 +39,11 @@ } WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 2)); + OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 2)); if (!contextProvider) return nullptr; gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); - std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); if (!extensionsUtil) return nullptr; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { @@ -70,7 +69,7 @@ canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, error)); } -WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGL2RenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h index 68959acd..ea07b6d 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h
@@ -7,7 +7,6 @@ #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/webgl/WebGL2RenderingContextBase.h" -#include <memory> namespace blink { @@ -43,7 +42,7 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); protected: - WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); + WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); Member<EXTColorBufferFloat> m_extColorBufferFloat; Member<EXTDisjointTimerQuery> m_extDisjointTimerQuery;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index 1a18fb1..d5e7e456 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -26,9 +26,9 @@ #include "modules/webgl/WebGLVertexArrayObject.h" #include "platform/CheckedInt.h" #include "public/platform/WebGraphicsContext3DProvider.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> using WTF::String; @@ -114,7 +114,7 @@ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, }; -WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, kSupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStorage)); @@ -405,20 +405,20 @@ switch (pname) { case GL_SAMPLES: { - std::unique_ptr<GLint[]> values; + OwnPtr<GLint[]> values; GLint length = -1; if (!floatType) { contextGL()->GetInternalformativ(target, internalformat, GL_NUM_SAMPLE_COUNTS, 1, &length); if (length <= 0) return WebGLAny(scriptState, DOMInt32Array::create(0)); - values = wrapArrayUnique(new GLint[length]); + values = adoptArrayPtr(new GLint[length]); for (GLint ii = 0; ii < length; ++ii) values[ii] = 0; contextGL()->GetInternalformativ(target, internalformat, GL_SAMPLES, length, values.get()); } else { length = 1; - values = wrapArrayUnique(new GLint[1]); + values = adoptArrayPtr(new GLint[1]); values[0] = 1; } return WebGLAny(scriptState, DOMInt32Array::create(values.get(), length)); @@ -2116,7 +2116,7 @@ if (maxNameLength <= 0) { return nullptr; } - std::unique_ptr<GLchar[]> name = wrapArrayUnique(new GLchar[maxNameLength]); + OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]); GLsizei length = 0; GLsizei size = 0; GLenum type = 0; @@ -2409,7 +2409,7 @@ synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invalid uniform block index"); return String(); } - std::unique_ptr<GLchar[]> name = wrapArrayUnique(new GLchar[maxNameLength]); + OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]); GLsizei length = 0; contextGL()->GetActiveUniformBlockName(objectOrZero(program), uniformBlockIndex, maxNameLength, &length, name.get());
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h index 60d9fd2..9910182c 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
@@ -7,7 +7,6 @@ #include "modules/webgl/WebGLExtension.h" #include "modules/webgl/WebGLRenderingContextBase.h" -#include <memory> namespace blink { @@ -218,7 +217,7 @@ DECLARE_VIRTUAL_TRACE(); protected: - WebGL2RenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); + WebGL2RenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); // Helper function to validate target and the attachment combination for getFramebufferAttachmentParameters. // Generate GL error and return false if parameters are illegal.
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp index c2509ac..377dc58 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp
@@ -62,7 +62,6 @@ #include "platform/graphics/gpu/DrawingBuffer.h" #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" -#include <memory> namespace blink { @@ -73,7 +72,7 @@ if (!contextProvider) return false; gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); - std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); if (!extensionsUtil) return false; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { @@ -86,7 +85,7 @@ CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scriptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes& attrs) { WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(scriptState, attributes, 1)); + OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(scriptState, attributes, 1)); if (!shouldCreateContext(contextProvider.get())) return nullptr; @@ -102,7 +101,7 @@ CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document&) { WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 1)); + OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 1)); if (!shouldCreateContext(contextProvider.get())) return nullptr; @@ -122,12 +121,12 @@ canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, error)); } -WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedOffscreenCanvas, std::move(contextProvider), requestedAttributes) { }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h index d3d7b2bd..bd12bf1 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
@@ -28,7 +28,6 @@ #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/webgl/WebGLRenderingContextBase.h" -#include <memory> namespace blink { @@ -65,8 +64,8 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); private: - WebGLRenderingContext(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - WebGLRenderingContext(OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContext(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); // Enabled extension objects. Member<ANGLEInstancedArrays> m_angleInstancedArrays;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 548a2cd..8bff5927 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -93,10 +93,11 @@ #include "public/platform/Platform.h" #include "public/platform/functional/WebFunction.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/typed_arrays/ArrayBufferContents.h" + #include <memory> namespace blink { @@ -536,18 +537,18 @@ Platform::GraphicsInfo* glInfo; ScriptState* scriptState; // Outputs. - std::unique_ptr<WebGraphicsContext3DProvider> createdContextProvider; + OwnPtr<WebGraphicsContext3DProvider> createdContextProvider; }; static void createContextProviderOnMainThread(ContextProviderCreationInfo* creationInfo, WaitableEvent* waitableEvent) { ASSERT(isMainThread()); - creationInfo->createdContextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( + creationInfo->createdContextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( creationInfo->contextAttributes, creationInfo->scriptState->getExecutionContext()->url(), 0, creationInfo->glInfo)); waitableEvent->signal(); } -static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderOnWorkerThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState) +static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderOnWorkerThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState) { WaitableEvent waitableEvent; ContextProviderCreationInfo creationInfo; @@ -560,7 +561,7 @@ return std::move(creationInfo.createdContextProvider); } -std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createContextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) +PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createContextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) { // Exactly one of these must be provided. DCHECK_EQ(!canvas, !!scriptState); @@ -569,10 +570,10 @@ Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(attributes, webGLVersion); Platform::GraphicsInfo glInfo; - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; + OwnPtr<WebGraphicsContext3DProvider> contextProvider; if (isMainThread()) { const auto& url = canvas ? canvas->document().topDocument().url() : scriptState->getExecutionContext()->url(); - contextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( + contextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( contextAttributes, url, 0, &glInfo)); } else { contextProvider = createContextProviderOnWorkerThread(contextAttributes, &glInfo, scriptState); @@ -598,7 +599,7 @@ return contextProvider; } -std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsigned webGLVersion) +PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsigned webGLVersion) { Document& document = canvas->document(); LocalFrame* frame = document.frame(); @@ -618,7 +619,7 @@ return createContextProviderInternal(canvas, nullptr, attributes, webGLVersion); } -std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) +PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) { return createContextProviderInternal(nullptr, scriptState, attributes, webGLVersion); } @@ -877,15 +878,15 @@ } // namespace -WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas) , m_isHidden(false) , m_contextLostMode(NotLostContext) @@ -936,7 +937,7 @@ ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); } -PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider) +PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider) { bool premultipliedAlpha = m_requestedAttributes.premultipliedAlpha(); bool wantAlphaChannel = m_requestedAttributes.alpha(); @@ -4433,9 +4434,9 @@ } // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. - std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new AcceleratedImageBufferSurface(IntSize(video->videoWidth(), video->videoHeight()))); + OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBufferSurface(IntSize(video->videoWidth(), video->videoHeight()))); if (surface->isValid()) { - std::unique_ptr<ImageBuffer> imageBuffer(ImageBuffer::create(std::move(surface))); + OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(std::move(surface))); if (imageBuffer) { // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, // we enable the WebMediaPlayer implementation to do any necessary color space conversion on the GPU (though it @@ -4485,7 +4486,7 @@ ASSERT(bitmap->bitmapImage()); RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); SkPixmap pixmap; - std::unique_ptr<uint8_t[]> pixelData; + OwnPtr<uint8_t[]> pixelData; uint8_t* pixelDataPtr = nullptr; // TODO(crbug.com/613411): peekPixels fails if the SkImage is texture-backed // Use texture mailbox in that case. @@ -6090,7 +6091,7 @@ Platform::ContextAttributes attributes = toPlatformContextAttributes(m_requestedAttributes, version()); Platform::GraphicsInfo glInfo; - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( + OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( attributes, canvas()->document().topDocument().url(), 0, &glInfo)); RefPtr<DrawingBuffer> buffer; if (contextProvider->bindToCurrentThread()) { @@ -6132,7 +6133,7 @@ } WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache(int capacity) - : m_buffers(wrapArrayUnique(new std::unique_ptr<ImageBuffer>[capacity])) + : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity])) , m_capacity(capacity) { } @@ -6150,7 +6151,7 @@ return buf; } - std::unique_ptr<ImageBuffer> temp(ImageBuffer::create(size)); + OwnPtr<ImageBuffer> temp(ImageBuffer::create(size)); if (!temp) return nullptr; i = std::min(m_capacity - 1, i);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h index ed747be..db23380a 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -48,8 +48,9 @@ #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/khronos/GLES2/gl2.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> + #include <set> namespace blink { @@ -139,8 +140,8 @@ static unsigned getWebGLVersion(const CanvasRenderingContext*); - static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); - static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); + static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); + static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); static void forceNextWebGLContextCreationToFail(); int drawingBufferWidth() const; @@ -430,9 +431,9 @@ friend class ScopedTexture2DRestorer; friend class ScopedFramebufferRestorer; - WebGLRenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - WebGLRenderingContextBase(OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - PassRefPtr<DrawingBuffer> createDrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>); + WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContextBase(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider>); void setupFlags(); // CanvasRenderingContext implementation. @@ -536,7 +537,7 @@ ImageBuffer* imageBuffer(const IntSize&); private: void bubbleToFront(int idx); - std::unique_ptr<std::unique_ptr<ImageBuffer>[]> m_buffers; + OwnPtr<OwnPtr<ImageBuffer>[]> m_buffers; int m_capacity; }; LRUImageBufferCache m_generatedImageCache; @@ -585,7 +586,7 @@ unsigned long m_onePlusMaxNonDefaultTextureUnit; - std::unique_ptr<Extensions3DUtil> m_extensionsUtil; + OwnPtr<Extensions3DUtil> m_extensionsUtil; enum ExtensionFlags { ApprovedExtension = 0x00, @@ -1103,8 +1104,8 @@ static const char* getTexImageFunctionName(TexImageFunctionID); private: - WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); + WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); }; DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, context->is3d(), context.is3d());
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp index bb99e15..4fdf4f1 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp
@@ -42,13 +42,12 @@ #include "modules/webmidi/MIDIOutputMap.h" #include "modules/webmidi/MIDIPort.h" #include "platform/AsyncMethodRunner.h" -#include <memory> namespace blink { using PortState = MIDIAccessor::MIDIPortState; -MIDIAccess::MIDIAccess(std::unique_ptr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) +MIDIAccess::MIDIAccess(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) : ActiveScriptWrappable(this) , ActiveDOMObject(executionContext) , m_accessor(std::move(accessor))
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h index b6e61ad..6484a205 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h
@@ -40,7 +40,6 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "platform/heap/Handle.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -55,7 +54,7 @@ USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); USING_PRE_FINALIZER(MIDIAccess, dispose); public: - static MIDIAccess* create(std::unique_ptr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) + static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) { MIDIAccess* access = new MIDIAccess(std::move(accessor), sysexEnabled, ports, executionContext); access->suspendIfNeeded(); @@ -103,10 +102,10 @@ DECLARE_VIRTUAL_TRACE(); private: - MIDIAccess(std::unique_ptr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>&, ExecutionContext*); + MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>&, ExecutionContext*); void dispose(); - std::unique_ptr<MIDIAccessor> m_accessor; + OwnPtr<MIDIAccessor> m_accessor; bool m_sysexEnabled; bool m_hasPendingActivity; HeapVector<Member<MIDIInput>> m_inputs;
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h index ed1e4e5e7..727630c 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h
@@ -12,8 +12,8 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "modules/webmidi/MIDIOptions.h" #include "modules/webmidi/MIDIPort.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -73,7 +73,7 @@ void contextDestroyed() override; - std::unique_ptr<MIDIAccessor> m_accessor; + OwnPtr<MIDIAccessor> m_accessor; Vector<PortDescriptor> m_portDescriptors; MIDIOptions m_options; bool m_hasBeenDisposed;
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp index 262b448..47d2bce 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp
@@ -32,18 +32,16 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "public/platform/Platform.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" -#include <memory> using blink::WebString; namespace blink { // Factory method -std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) +PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { - return wrapUnique(new MIDIAccessor(client)); + return adoptPtr(new MIDIAccessor(client)); } MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) @@ -51,7 +49,7 @@ { DCHECK(client); - m_accessor = wrapUnique(Platform::current()->createMIDIAccessor(this)); + m_accessor = adoptPtr(Platform::current()->createMIDIAccessor(this)); DCHECK(m_accessor); }
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h index 66a8863..43b8e921 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h
@@ -34,7 +34,8 @@ #include "public/platform/modules/webmidi/WebMIDIAccessor.h" #include "public/platform/modules/webmidi/WebMIDIAccessorClient.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -43,7 +44,7 @@ class MIDIAccessor final : public WebMIDIAccessorClient { USING_FAST_MALLOC(MIDIAccessor); public: - static std::unique_ptr<MIDIAccessor> create(MIDIAccessorClient*); + static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*); ~MIDIAccessor() override { } @@ -66,7 +67,7 @@ explicit MIDIAccessor(MIDIAccessorClient*); MIDIAccessorClient* m_client; - std::unique_ptr<WebMIDIAccessor> m_accessor; + OwnPtr<WebMIDIAccessor> m_accessor; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIClient.h b/third_party/WebKit/Source/modules/webmidi/MIDIClient.h index c5a93e34..f260923e 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIClient.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIClient.h
@@ -33,7 +33,6 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -49,7 +48,7 @@ virtual ~MIDIClient() { } }; -MODULES_EXPORT void provideMIDITo(LocalFrame&, std::unique_ptr<MIDIClient>); +MODULES_EXPORT void provideMIDITo(LocalFrame&, PassOwnPtr<MIDIClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp index 3ae61d7..8ea0a21 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp
@@ -32,7 +32,6 @@ #include "modules/webmidi/MIDIAccessInitializer.h" #include "modules/webmidi/MIDIClient.h" -#include <memory> namespace blink { @@ -41,7 +40,7 @@ return "MIDIController"; } -MIDIController::MIDIController(std::unique_ptr<MIDIClient> client) +MIDIController::MIDIController(PassOwnPtr<MIDIClient> client) : m_client(std::move(client)) { DCHECK(m_client); @@ -51,7 +50,7 @@ { } -MIDIController* MIDIController::create(std::unique_ptr<MIDIClient> client) +MIDIController* MIDIController::create(PassOwnPtr<MIDIClient> client) { return new MIDIController(std::move(client)); } @@ -66,7 +65,7 @@ m_client->cancelPermissionRequest(initializer); } -void provideMIDITo(LocalFrame& frame, std::unique_ptr<MIDIClient> client) +void provideMIDITo(LocalFrame& frame, PassOwnPtr<MIDIClient> client) { MIDIController::provideTo(frame, MIDIController::supplementName(), MIDIController::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIController.h b/third_party/WebKit/Source/modules/webmidi/MIDIController.h index cdb7d4a..4cf7bdf 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIController.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIController.h
@@ -33,7 +33,6 @@ #include "core/frame/LocalFrame.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -49,17 +48,17 @@ void requestPermission(MIDIAccessInitializer*, const MIDIOptions&); void cancelPermissionRequest(MIDIAccessInitializer*); - static MIDIController* create(std::unique_ptr<MIDIClient>); + static MIDIController* create(PassOwnPtr<MIDIClient>); static const char* supplementName(); static MIDIController* from(LocalFrame* frame) { return static_cast<MIDIController*>(Supplement<LocalFrame>::from(frame, supplementName())); } DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } protected: - explicit MIDIController(std::unique_ptr<MIDIClient>); + explicit MIDIController(PassOwnPtr<MIDIClient>); private: - std::unique_ptr<MIDIClient> m_client; + OwnPtr<MIDIClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp index b30348d..8a008b84 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
@@ -58,11 +58,11 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/Assertions.h" #include "wtf/HashSet.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -638,7 +638,7 @@ m_eventQueue->dispatch(MessageEvent::create(msg, SecurityOrigin::create(m_url)->toString())); } -void DOMWebSocket::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> binaryData) +void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> binaryData) { WTF_LOG(Network, "WebSocket %p didReceiveBinaryMessage() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size())); switch (m_binaryType) { @@ -646,7 +646,7 @@ size_t size = binaryData->size(); RefPtr<RawData> rawData = RawData::create(); binaryData->swap(*rawData->mutableData()); - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), size)); recordReceiveTypeHistogram(WebSocketReceiveTypeBlob);
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h index 15fb738..2badc24 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h
@@ -48,7 +48,6 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdint.h> namespace blink { @@ -128,7 +127,7 @@ // WebSocketChannelClient functions. void didConnect(const String& subprotocol, const String& extensions) override; void didReceiveTextMessage(const String& message) override; - void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) override; + void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; void didError() override; void didConsumeBufferedAmount(uint64_t) override; void didStartClosingHandshake() override;
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp index 8ca88848..d41105e 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
@@ -18,10 +18,10 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> #include <v8.h> using testing::_; @@ -52,19 +52,19 @@ MOCK_METHOD3(send, void(const DOMArrayBuffer&, unsigned, unsigned)); MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>)); MOCK_METHOD1(sendTextAsCharVectorMock, void(Vector<char>*)); - void sendTextAsCharVector(std::unique_ptr<Vector<char>> vector) + void sendTextAsCharVector(PassOwnPtr<Vector<char>> vector) { sendTextAsCharVectorMock(vector.get()); } MOCK_METHOD1(sendBinaryAsCharVectorMock, void(Vector<char>*)); - void sendBinaryAsCharVector(std::unique_ptr<Vector<char>> vector) + void sendBinaryAsCharVector(PassOwnPtr<Vector<char>> vector) { sendBinaryAsCharVectorMock(vector.get()); } MOCK_CONST_METHOD0(bufferedAmount, unsigned()); MOCK_METHOD2(close, void(int, const String&)); MOCK_METHOD3(failMock, void(const String&, MessageLevel, SourceLocation*)); - void fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) + void fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) { failMock(reason, level, location.get()); }
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp index f329365..ca91d4b9 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -55,8 +55,6 @@ #include "public/platform/WebVector.h" #include "public/platform/modules/websockets/WebSocketHandshakeRequestInfo.h" #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h" -#include "wtf/PtrUtil.h" -#include <memory> using blink::WebSocketHandle; @@ -91,7 +89,7 @@ explicit Message(PassRefPtr<BlobDataHandle>); explicit Message(DOMArrayBuffer*); // For WorkerWebSocketChannel - explicit Message(std::unique_ptr<Vector<char>>, MessageType); + explicit Message(PassOwnPtr<Vector<char>>, MessageType); // Close message Message(unsigned short code, const String& reason); @@ -105,7 +103,7 @@ CString text; RefPtr<BlobDataHandle> blobDataHandle; Member<DOMArrayBuffer> arrayBuffer; - std::unique_ptr<Vector<char>> vectorData; + OwnPtr<Vector<char>> vectorData; unsigned short code; String reason; }; @@ -136,9 +134,9 @@ // |this| is deleted here. } -DocumentWebSocketChannel::DocumentWebSocketChannel(Document* document, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location, WebSocketHandle *handle) +DocumentWebSocketChannel::DocumentWebSocketChannel(Document* document, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location, WebSocketHandle *handle) : ContextLifecycleObserver(document) - , m_handle(wrapUnique(handle ? handle : Platform::current()->createWebSocketHandle())) + , m_handle(adoptPtr(handle ? handle : Platform::current()->createWebSocketHandle())) , m_client(client) , m_identifier(createUniqueIdentifier()) , m_sendingQuota(0) @@ -228,7 +226,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::sendTextAsCharVector(std::unique_ptr<Vector<char>> data) +void DocumentWebSocketChannel::sendTextAsCharVector(PassOwnPtr<Vector<char>> data) { WTF_LOG(Network, "DocumentWebSocketChannel %p sendTextAsCharVector(%p, %llu)", this, data.get(), static_cast<unsigned long long>(data->size())); // FIXME: Change the inspector API to show the entire message instead @@ -238,7 +236,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) +void DocumentWebSocketChannel::sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) { WTF_LOG(Network, "DocumentWebSocketChannel %p sendBinaryAsCharVector(%p, %llu)", this, data.get(), static_cast<unsigned long long>(data->size())); // FIXME: Change the inspector API to show the entire message instead @@ -257,7 +255,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) +void DocumentWebSocketChannel::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) { WTF_LOG(Network, "DocumentWebSocketChannel %p fail(%s)", this, reason.utf8().data()); // m_handle and m_client can be null here. @@ -299,7 +297,7 @@ : type(MessageTypeArrayBuffer) , arrayBuffer(arrayBuffer) { } -DocumentWebSocketChannel::Message::Message(std::unique_ptr<Vector<char>> vectorData, MessageType type) +DocumentWebSocketChannel::Message::Message(PassOwnPtr<Vector<char>> vectorData, MessageType type) : type(type) , vectorData(std::move(vectorData)) { @@ -418,7 +416,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didConnect(%p, %s, %s)", this, handle, selectedProtocol.utf8().c_str(), extensions.utf8().c_str()); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); ASSERT(m_client); m_client->didConnect(selectedProtocol, extensions); @@ -429,7 +427,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didStartOpeningHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketSendHandshakeRequest", TRACE_EVENT_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier)); InspectorInstrumentation::willSendWebSocketHandshakeRequest(document(), m_identifier, &request.toCoreRequest()); @@ -441,7 +439,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didFinishOpeningHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketReceiveHandshakeResponse", TRACE_EVENT_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier)); InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(document(), m_identifier, m_handshakeRequest.get(), &response.toCoreResponse()); @@ -453,7 +451,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didFail(%p, %s)", this, handle, message.utf8().data()); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); // This function is called when the browser is required to fail the // WebSocketConnection. Hence we fail this channel by calling @@ -467,7 +465,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didReceiveData(%p, %d, %d, (%p, %zu))", this, handle, fin, type, data, size); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); ASSERT(m_client); // Non-final frames cannot be empty. ASSERT(fin || size); @@ -507,7 +505,7 @@ m_client->didReceiveTextMessage(message); } } else { - std::unique_ptr<Vector<char>> binaryData = wrapUnique(new Vector<char>); + OwnPtr<Vector<char>> binaryData = adoptPtr(new Vector<char>); binaryData->swap(m_receivingMessageData); m_client->didReceiveBinaryMessage(std::move(binaryData)); } @@ -518,7 +516,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didClose(%p, %d, %u, %s)", this, handle, wasClean, code, String(reason).utf8().data()); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); m_handle.reset(); @@ -537,7 +535,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didReceiveFlowControl(%p, %ld)", this, handle, static_cast<long>(quota)); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); ASSERT(quota >= 0); m_sendingQuota += quota; @@ -549,7 +547,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didStartClosingHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle.get()); + ASSERT(handle == m_handle); if (m_client) m_client->didStartClosingHandshake();
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h index 9b964e5..ae655665 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h
@@ -43,12 +43,13 @@ #include "public/platform/modules/websockets/WebSocketHandle.h" #include "public/platform/modules/websockets/WebSocketHandleClient.h" #include "wtf/Deque.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdint.h> namespace blink { @@ -68,7 +69,7 @@ // In the usual case, they are set automatically and you don't have to // pass it. // Specify handle explicitly only in tests. - static DocumentWebSocketChannel* create(Document* document, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location, WebSocketHandle *handle = 0) + static DocumentWebSocketChannel* create(Document* document, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location, WebSocketHandle *handle = 0) { return new DocumentWebSocketChannel(document, client, std::move(location), handle); } @@ -79,12 +80,12 @@ void send(const CString& message) override; void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; void send(PassRefPtr<BlobDataHandle>) override; - void sendTextAsCharVector(std::unique_ptr<Vector<char>> data) override; - void sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) override; + void sendTextAsCharVector(PassOwnPtr<Vector<char>> data) override; + void sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) override; // Start closing handshake. Use the CloseEventCodeNotSpecified for the code // argument to omit payload. void close(int code, const String& reason) override; - void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) override; + void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) override; void disconnect() override; DECLARE_VIRTUAL_TRACE(); @@ -107,7 +108,7 @@ Vector<char> data; }; - DocumentWebSocketChannel(Document*, WebSocketChannelClient*, std::unique_ptr<SourceLocation>, WebSocketHandle*); + DocumentWebSocketChannel(Document*, WebSocketChannelClient*, PassOwnPtr<SourceLocation>, WebSocketHandle*); void sendInternal(WebSocketHandle::MessageType, const char* data, size_t totalSize, uint64_t* consumedBufferedAmount); void processSendQueue(); void flowControlIfNecessary(); @@ -132,7 +133,7 @@ // m_handle is a handle of the connection. // m_handle == 0 means this channel is closed. - std::unique_ptr<WebSocketHandle> m_handle; + OwnPtr<WebSocketHandle> m_handle; // m_client can be deleted while this channel is alive, but this class // expects that disconnect() is called before the deletion. @@ -149,7 +150,7 @@ uint64_t m_receivedDataSizeForFlowControl; size_t m_sentSizeOfTopMessage; - std::unique_ptr<SourceLocation> m_locationAtConstruction; + OwnPtr<SourceLocation> m_locationAtConstruction; RefPtr<WebSocketHandshakeRequest> m_handshakeRequest; static const uint64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15;
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp index 6903609..73b697cb 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -21,10 +21,9 @@ #include "public/platform/modules/websockets/WebSocketHandleClient.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdint.h> using testing::_; @@ -53,7 +52,7 @@ MOCK_METHOD2(didConnect, void(const String&, const String&)); MOCK_METHOD1(didReceiveTextMessage, void(const String&)); - void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override + void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) override { didReceiveBinaryMessageMock(*payload); } @@ -142,7 +141,7 @@ ::testing::Mock::VerifyAndClearExpectations(this); } - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; Persistent<MockWebSocketChannelClient> m_channelClient; MockWebSocketHandle* m_handle; Persistent<DocumentWebSocketChannel> m_channel; @@ -241,7 +240,7 @@ Vector<char> fooVector; fooVector.append("foo", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(fooVector))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(fooVector))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -263,22 +262,22 @@ { Vector<char> v; v.append("\0ar", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); } { Vector<char> v; v.append("b\0z", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); } { Vector<char> v; v.append("qu\0", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); } { Vector<char> v; v.append("\0\0\0", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); } EXPECT_EQ(12ul, m_sumOfConsumedBufferedAmount); @@ -294,7 +293,7 @@ Vector<char> v; v.append("\xe7\x8b\x90", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -309,7 +308,7 @@ Vector<char> v; v.append("\x80\xff\xe7", 3); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -330,7 +329,7 @@ Vector<char> v; v.append("\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90", 18); - channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); checkpoint.Call(1); handleClient()->didReceiveFlowControl(handle(), 16);
diff --git a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp index c48f7c56..e95695f1 100644 --- a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp +++ b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp
@@ -6,13 +6,12 @@ #include "core/dom/Document.h" #include "platform/weborigin/KURL.h" -#include <memory> namespace blink { -std::unique_ptr<TracedValue> InspectorWebSocketCreateEvent::data(Document* document, unsigned long identifier, const KURL& url, const String& protocol) +PassOwnPtr<TracedValue> InspectorWebSocketCreateEvent::data(Document* document, unsigned long identifier, const KURL& url, const String& protocol) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("identifier", identifier); value->setString("url", url.getString()); value->setString("frame", toHexString(document->frame())); @@ -22,9 +21,9 @@ return value; } -std::unique_ptr<TracedValue> InspectorWebSocketEvent::data(Document* document, unsigned long identifier) +PassOwnPtr<TracedValue> InspectorWebSocketEvent::data(Document* document, unsigned long identifier) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("identifier", identifier); value->setString("frame", toHexString(document->frame())); setCallStack(value.get());
diff --git a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h index 35ed61f57..418f0e66 100644 --- a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h +++ b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h
@@ -11,7 +11,6 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" -#include <memory> namespace blink { @@ -21,13 +20,13 @@ class InspectorWebSocketCreateEvent { STATIC_ONLY(InspectorWebSocketCreateEvent); public: - static std::unique_ptr<TracedValue> data(Document*, unsigned long identifier, const KURL&, const String& protocol); + static PassOwnPtr<TracedValue> data(Document*, unsigned long identifier, const KURL&, const String& protocol); }; class InspectorWebSocketEvent { STATIC_ONLY(InspectorWebSocketEvent); public: - static std::unique_ptr<TracedValue> data(Document*, unsigned long identifier); + static PassOwnPtr<TracedValue> data(Document*, unsigned long identifier); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp index 3cbc754..49e46a1 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp
@@ -38,7 +38,6 @@ #include "modules/websockets/DocumentWebSocketChannel.h" #include "modules/websockets/WebSocketChannelClient.h" #include "modules/websockets/WorkerWebSocketChannel.h" -#include <memory> namespace blink { @@ -47,7 +46,7 @@ ASSERT(context); ASSERT(client); - std::unique_ptr<SourceLocation> location = SourceLocation::capture(context); + OwnPtr<SourceLocation> location = SourceLocation::capture(context); if (context->isWorkerGlobalScope()) { WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h index b702aaa..14cdd686 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
@@ -37,7 +37,6 @@ #include "platform/v8_inspector/public/ConsoleTypes.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -78,8 +77,8 @@ virtual void send(PassRefPtr<BlobDataHandle>) = 0; // For WorkerWebSocketChannel. - virtual void sendTextAsCharVector(std::unique_ptr<Vector<char>>) = 0; - virtual void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) = 0; + virtual void sendTextAsCharVector(PassOwnPtr<Vector<char>>) = 0; + virtual void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) = 0; // Do not call |send| after calling this method. virtual void close(int code, const String& reason) = 0; @@ -92,7 +91,7 @@ // and the "current" location in the sense of JavaScript execution // may be shown if this method is called in a JS execution context. // Location should not be null. - virtual void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) = 0; + virtual void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) = 0; // Do not call any methods after calling this method. virtual void disconnect() = 0; // Will suppress didClose().
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h b/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h index 25f1926..3777408 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h
@@ -34,8 +34,8 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> #include <stdint.h> namespace blink { @@ -45,7 +45,7 @@ virtual ~WebSocketChannelClient() { } virtual void didConnect(const String& subprotocol, const String& extensions) { } virtual void didReceiveTextMessage(const String&) { } - virtual void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) { } + virtual void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) { } virtual void didError() { } virtual void didConsumeBufferedAmount(uint64_t consumed) { } virtual void didStartClosingHandshake() { }
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp index 51a29d6..3fe0bd7 100644 --- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
@@ -45,10 +45,8 @@ #include "public/platform/Platform.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -60,7 +58,7 @@ // thread. signalWorkerThread() must be called before any getters are called. class WebSocketChannelSyncHelper : public GarbageCollectedFinalized<WebSocketChannelSyncHelper> { public: - static WebSocketChannelSyncHelper* create(std::unique_ptr<WaitableEvent> event) + static WebSocketChannelSyncHelper* create(PassOwnPtr<WaitableEvent> event) { return new WebSocketChannelSyncHelper(std::move(event)); } @@ -95,17 +93,17 @@ DEFINE_INLINE_TRACE() { } private: - explicit WebSocketChannelSyncHelper(std::unique_ptr<WaitableEvent> event) + explicit WebSocketChannelSyncHelper(PassOwnPtr<WaitableEvent> event) : m_event(std::move(event)) , m_connectRequestResult(false) { } - std::unique_ptr<WaitableEvent> m_event; + OwnPtr<WaitableEvent> m_event; bool m_connectRequestResult; }; -WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location) +WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location) : m_bridge(new Bridge(client, workerGlobalScope)) , m_locationAtConnection(std::move(location)) { @@ -147,12 +145,12 @@ m_bridge->close(code, reason); } -void WorkerWebSocketChannel::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) +void WorkerWebSocketChannel::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) { if (!m_bridge) return; - std::unique_ptr<SourceLocation> capturedLocation = SourceLocation::capture(); + OwnPtr<SourceLocation> capturedLocation = SourceLocation::capture(); if (!capturedLocation->isUnknown()) { // If we are in JavaScript context, use the current location instead // of passed one - it's more precise. @@ -194,7 +192,7 @@ DCHECK(isMainThread()); } -bool Peer::initialize(std::unique_ptr<SourceLocation> location, ExecutionContext* context) +bool Peer::initialize(PassOwnPtr<SourceLocation> location, ExecutionContext* context) { ASSERT(isMainThread()); if (wasContextDestroyedBeforeObserverCreation()) @@ -217,14 +215,14 @@ m_syncHelper->signalWorkerThread(); } -void Peer::sendTextAsCharVector(std::unique_ptr<Vector<char>> data) +void Peer::sendTextAsCharVector(PassOwnPtr<Vector<char>> data) { ASSERT(isMainThread()); if (m_mainWebSocketChannel) m_mainWebSocketChannel->sendTextAsCharVector(std::move(data)); } -void Peer::sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) +void Peer::sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) { ASSERT(isMainThread()); if (m_mainWebSocketChannel) @@ -247,7 +245,7 @@ m_mainWebSocketChannel->close(code, reason); } -void Peer::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) +void Peer::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) { ASSERT(isMainThread()); ASSERT(m_syncHelper); @@ -293,14 +291,14 @@ m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveTextMessage, m_bridge, payload)); } -static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, std::unique_ptr<Vector<char>> payload, ExecutionContext* context) +static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, PassOwnPtr<Vector<char>> payload, ExecutionContext* context) { ASSERT_UNUSED(context, context->isWorkerGlobalScope()); if (bridge->client()) bridge->client()->didReceiveBinaryMessage(std::move(payload)); } -void Peer::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) +void Peer::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) { ASSERT(isMainThread()); m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveBinaryMessage, m_bridge, passed(std::move(payload)))); @@ -384,7 +382,7 @@ : m_client(client) , m_workerGlobalScope(workerGlobalScope) , m_loaderProxy(m_workerGlobalScope->thread()->workerLoaderProxy()) - , m_syncHelper(WebSocketChannelSyncHelper::create(wrapUnique(new WaitableEvent()))) + , m_syncHelper(WebSocketChannelSyncHelper::create(adoptPtr(new WaitableEvent()))) { } @@ -393,7 +391,7 @@ ASSERT(!m_peer); } -void Bridge::createPeerOnMainThread(std::unique_ptr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, ExecutionContext* context) +void Bridge::createPeerOnMainThread(PassOwnPtr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, ExecutionContext* context) { DCHECK(isMainThread()); DCHECK(!m_peer); @@ -403,7 +401,7 @@ m_syncHelper->signalWorkerThread(); } -void Bridge::initialize(std::unique_ptr<SourceLocation> location) +void Bridge::initialize(PassOwnPtr<SourceLocation> location) { // Wait for completion of the task on the main thread because the connection // must synchronously be established (see Bridge::connect). @@ -429,7 +427,7 @@ void Bridge::send(const CString& message) { ASSERT(m_peer); - std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(message.length())); + OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(message.length())); if (message.length()) memcpy(data->data(), static_cast<const char*>(message.data()), message.length()); @@ -440,7 +438,7 @@ { ASSERT(m_peer); // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied into Vector<char>. - std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(byteLength)); + OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(byteLength)); if (binaryData.byteLength()) memcpy(data->data(), static_cast<const char*>(binaryData.data()) + byteOffset, byteLength); @@ -459,7 +457,7 @@ m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::close, wrapCrossThreadPersistent(m_peer.get()), code, reason)); } -void Bridge::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) +void Bridge::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) { ASSERT(m_peer); m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::fail, wrapCrossThreadPersistent(m_peer.get()), reason, level, passed(std::move(location))));
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h index 1efba5f..9a6b4ee 100644 --- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h
@@ -39,10 +39,10 @@ #include "platform/v8_inspector/public/ConsoleTypes.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdint.h> namespace blink { @@ -58,7 +58,7 @@ class WorkerWebSocketChannel final : public WebSocketChannel { WTF_MAKE_NONCOPYABLE(WorkerWebSocketChannel); public: - static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location) + static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location) { return new WorkerWebSocketChannel(workerGlobalScope, client, std::move(location)); } @@ -69,16 +69,16 @@ void send(const CString&) override; void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; void send(PassRefPtr<BlobDataHandle>) override; - void sendTextAsCharVector(std::unique_ptr<Vector<char>>) override + void sendTextAsCharVector(PassOwnPtr<Vector<char>>) override { ASSERT_NOT_REACHED(); } - void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) override + void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) override { ASSERT_NOT_REACHED(); } void close(int code, const String& reason) override; - void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) override; + void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) override; void disconnect() override; // Will suppress didClose(). DECLARE_VIRTUAL_TRACE(); @@ -93,14 +93,14 @@ ~Peer() override; // SourceLocation parameter may be shown when the connection fails. - bool initialize(std::unique_ptr<SourceLocation>, ExecutionContext*); + bool initialize(PassOwnPtr<SourceLocation>, ExecutionContext*); void connect(const KURL&, const String& protocol); - void sendTextAsCharVector(std::unique_ptr<Vector<char>>); - void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>); + void sendTextAsCharVector(PassOwnPtr<Vector<char>>); + void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>); void sendBlob(PassRefPtr<BlobDataHandle>); void close(int code, const String& reason); - void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>); + void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>); void disconnect(); DECLARE_VIRTUAL_TRACE(); @@ -110,7 +110,7 @@ // WebSocketChannelClient functions. void didConnect(const String& subprotocol, const String& extensions) override; void didReceiveTextMessage(const String& payload) override; - void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) override; + void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; void didConsumeBufferedAmount(uint64_t) override; void didStartClosingHandshake() override; void didClose(ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) override; @@ -133,16 +133,16 @@ Bridge(WebSocketChannelClient*, WorkerGlobalScope&); ~Bridge(); // SourceLocation parameter may be shown when the connection fails. - void initialize(std::unique_ptr<SourceLocation>); + void initialize(PassOwnPtr<SourceLocation>); bool connect(const KURL&, const String& protocol); void send(const CString& message); void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength); void send(PassRefPtr<BlobDataHandle>); void close(int code, const String& reason); - void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>); + void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>); void disconnect(); - void createPeerOnMainThread(std::unique_ptr<SourceLocation>, WorkerThreadLifecycleContext*, ExecutionContext*); + void createPeerOnMainThread(PassOwnPtr<SourceLocation>, WorkerThreadLifecycleContext*, ExecutionContext*); // Returns null when |disconnect| has already been called. WebSocketChannelClient* client() { return m_client; } @@ -163,10 +163,10 @@ }; private: - WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, std::unique_ptr<SourceLocation>); + WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, PassOwnPtr<SourceLocation>); Member<Bridge> m_bridge; - std::unique_ptr<SourceLocation> m_locationAtConnection; + OwnPtr<SourceLocation> m_locationAtConnection; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h b/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h index 5ec265c..0285d3b 100644 --- a/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h +++ b/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h
@@ -39,7 +39,6 @@ #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -71,7 +70,7 @@ virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } // Called when an AsyncFileWrter has been created successfully. - virtual void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long length) { ASSERT_NOT_REACHED(); } + virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length) { ASSERT_NOT_REACHED(); } // Called when there was an error. virtual void didFail(int code) = 0;
diff --git a/third_party/WebKit/Source/platform/CalculationValue.h b/third_party/WebKit/Source/platform/CalculationValue.h index 68bf3163..9ec1c61 100644 --- a/third_party/WebKit/Source/platform/CalculationValue.h +++ b/third_party/WebKit/Source/platform/CalculationValue.h
@@ -33,6 +33,8 @@ #include "platform/Length.h" #include "platform/LengthFunctions.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp b/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp index 76a3143..7431999 100644 --- a/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp +++ b/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp
@@ -30,14 +30,11 @@ #include "platform/ContentSettingCallbacks.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { -std::unique_ptr<ContentSettingCallbacks> ContentSettingCallbacks::create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied) +PassOwnPtr<ContentSettingCallbacks> ContentSettingCallbacks::create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied) { - return wrapUnique(new ContentSettingCallbacks(std::move(allowed), std::move(denied))); + return adoptPtr(new ContentSettingCallbacks(std::move(allowed), std::move(denied))); } ContentSettingCallbacks::ContentSettingCallbacks(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied)
diff --git a/third_party/WebKit/Source/platform/ContentSettingCallbacks.h b/third_party/WebKit/Source/platform/ContentSettingCallbacks.h index 08f52831..2a76970 100644 --- a/third_party/WebKit/Source/platform/ContentSettingCallbacks.h +++ b/third_party/WebKit/Source/platform/ContentSettingCallbacks.h
@@ -9,7 +9,8 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -17,7 +18,7 @@ USING_FAST_MALLOC(ContentSettingCallbacks); WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); public: - static std::unique_ptr<ContentSettingCallbacks> create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); + static PassOwnPtr<ContentSettingCallbacks> create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); virtual ~ContentSettingCallbacks() { } void onAllowed() { (*m_allowed)(); }
diff --git a/third_party/WebKit/Source/platform/ContextMenuItem.h b/third_party/WebKit/Source/platform/ContextMenuItem.h index 29690412..854c9fb 100644 --- a/third_party/WebKit/Source/platform/ContextMenuItem.h +++ b/third_party/WebKit/Source/platform/ContextMenuItem.h
@@ -29,6 +29,7 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp index 80337ad..f5b4c797 100644 --- a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp +++ b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp
@@ -35,7 +35,6 @@ #include "platform/network/ResourceResponse.h" #include "platform/weborigin/KURL.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -114,11 +113,11 @@ >::value), "Raw pointer RefCounted test"); -// Verify that std::unique_ptr gets passed through. +// Verify that PassOwnPtr gets passed through. static_assert((std::is_same< - std::unique_ptr<float>, - CrossThreadCopier<std::unique_ptr<float>>::Type + PassOwnPtr<float>, + CrossThreadCopier<PassOwnPtr<float>>::Type >::value), - "std::unique_ptr test"); + "PassOwnPtr test"); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h index cfb46fa..40fca7bc 100644 --- a/third_party/WebKit/Source/platform/CrossThreadCopier.h +++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -35,11 +35,11 @@ #include "platform/heap/Handle.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/TypeTraits.h" -#include <memory> class SkRefCnt; @@ -134,6 +134,16 @@ STATIC_ONLY(CrossThreadCopier); }; +template <typename T> +struct CrossThreadCopier<PassOwnPtr<T>> { + STATIC_ONLY(CrossThreadCopier); + typedef PassOwnPtr<T> Type; + static Type copy(Type ownPtr) + { + return ownPtr; + } +}; + template <typename T, typename Deleter> struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { STATIC_ONLY(CrossThreadCopier); @@ -195,14 +205,14 @@ template <> struct CrossThreadCopier<ResourceRequest> { STATIC_ONLY(CrossThreadCopier); - typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceRequestData>> Type; + typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceRequestData>> Type; PLATFORM_EXPORT static Type copy(const ResourceRequest&); }; template <> struct CrossThreadCopier<ResourceResponse> { STATIC_ONLY(CrossThreadCopier); - typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; + typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceResponseData>> Type; PLATFORM_EXPORT static Type copy(const ResourceResponse&); };
diff --git a/third_party/WebKit/Source/platform/Crypto.cpp b/third_party/WebKit/Source/platform/Crypto.cpp index 79fa67b..00cdd51 100644 --- a/third_party/WebKit/Source/platform/Crypto.cpp +++ b/third_party/WebKit/Source/platform/Crypto.cpp
@@ -7,8 +7,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebCrypto.h" #include "public/platform/WebCryptoAlgorithm.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -38,7 +36,7 @@ ASSERT(crypto); - std::unique_ptr<WebCryptoDigestor> digestor = wrapUnique(crypto->createDigestor(algorithmId)); + OwnPtr<WebCryptoDigestor> digestor = adoptPtr(crypto->createDigestor(algorithmId)); if (!digestor.get() || !digestor->consume(reinterpret_cast<const unsigned char*>(digestable), length) || !digestor->finish(result, resultSize)) return false; @@ -46,9 +44,9 @@ return true; } -std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm algorithm) +PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm algorithm) { - return wrapUnique(Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm))); + return adoptPtr(Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm))); } void finishDigestor(WebCryptoDigestor* digestor, DigestValue& digestResult)
diff --git a/third_party/WebKit/Source/platform/Crypto.h b/third_party/WebKit/Source/platform/Crypto.h index 388462e..891d685d 100644 --- a/third_party/WebKit/Source/platform/Crypto.h +++ b/third_party/WebKit/Source/platform/Crypto.h
@@ -17,7 +17,6 @@ #include "wtf/HashSet.h" #include "wtf/StringHasher.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -33,7 +32,7 @@ }; PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult); -PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm); +PLATFORM_EXPORT PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm); PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResult); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp index 35e3a2c..52e7c7e 100644 --- a/third_party/WebKit/Source/platform/DragImage.cpp +++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -50,11 +50,11 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" + #include <algorithm> -#include <memory> namespace blink { @@ -132,7 +132,7 @@ return imageScale; } -std::unique_ptr<DragImage> DragImage::create(Image* image, +PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor, InterpolationQuality interpolationQuality, float opacity, FloatSize imageScale) { @@ -153,7 +153,7 @@ if (!resizedImage || !resizedImage->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode)) return nullptr; - return wrapUnique(new DragImage(bm, deviceScaleFactor, interpolationQuality)); + return adoptPtr(new DragImage(bm, deviceScaleFactor, interpolationQuality)); } static Font deriveDragLabelFont(int size, FontWeight fontWeight, const FontDescription& systemFont) @@ -167,7 +167,7 @@ return result; } -std::unique_ptr<DragImage> DragImage::create(const KURL& url, const String& inLabel, const FontDescription& systemFont, float deviceScaleFactor) +PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, const FontDescription& systemFont, float deviceScaleFactor) { const Font labelFont = deriveDragLabelFont(kDragLinkLabelFontSize, FontWeightBold, systemFont); const Font urlFont = deriveDragLabelFont(kDragLinkUrlFontSize, FontWeightNormal, systemFont); @@ -213,7 +213,7 @@ // fill the background IntSize scaledImageSize = imageSize; scaledImageSize.scale(deviceScaleFactor); - std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); + OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); if (!buffer) return nullptr;
diff --git a/third_party/WebKit/Source/platform/DragImage.h b/third_party/WebKit/Source/platform/DragImage.h index 9fd422c7..64f458ae 100644 --- a/third_party/WebKit/Source/platform/DragImage.h +++ b/third_party/WebKit/Source/platform/DragImage.h
@@ -34,7 +34,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" -#include <memory> class SkImage; @@ -48,12 +47,12 @@ USING_FAST_MALLOC(DragImage); WTF_MAKE_NONCOPYABLE(DragImage); public: - static std::unique_ptr<DragImage> create(Image*, + static PassOwnPtr<DragImage> create(Image*, RespectImageOrientationEnum = DoNotRespectImageOrientation, float deviceScaleFactor = 1, InterpolationQuality = InterpolationHigh, float opacity = 1, FloatSize imageScale = FloatSize(1, 1)); - static std::unique_ptr<DragImage> create(const KURL&, const String& label, const FontDescription& systemFont, float deviceScaleFactor); + static PassOwnPtr<DragImage> create(const KURL&, const String& label, const FontDescription& systemFont, float deviceScaleFactor); ~DragImage(); static FloatSize clampedImageScale(const IntSize&, const IntSize&, const IntSize& maxSize);
diff --git a/third_party/WebKit/Source/platform/DragImageTest.cpp b/third_party/WebKit/Source/platform/DragImageTest.cpp index d8f295e..ba67881 100644 --- a/third_party/WebKit/Source/platform/DragImageTest.cpp +++ b/third_party/WebKit/Source/platform/DragImageTest.cpp
@@ -43,9 +43,10 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPixelRef.h" #include "third_party/skia/include/core/SkSurface.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -124,7 +125,7 @@ TEST(DragImageTest, NonNullHandling) { RefPtr<TestImage> testImage(TestImage::create(IntSize(2, 2))); - std::unique_ptr<DragImage> dragImage = DragImage::create(testImage.get()); + OwnPtr<DragImage> dragImage = DragImage::create(testImage.get()); ASSERT_TRUE(dragImage); dragImage->scale(0.5, 0.5); @@ -157,9 +158,9 @@ fontDescription.setWeight(FontWeightNormal); fontDescription.setStyle(FontStyleNormal); - std::unique_ptr<DragImage> testImage = + OwnPtr<DragImage> testImage = DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); - std::unique_ptr<DragImage> expectedImage = + OwnPtr<DragImage> expectedImage = DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor); EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); @@ -192,7 +193,7 @@ // Create a DragImage from it. In MSAN builds, this will cause a failure if // the pixel memory is not initialized, if we have to respect non-default // orientation. - std::unique_ptr<DragImage> dragImage = DragImage::create(image.get(), RespectImageOrientation); + OwnPtr<DragImage> dragImage = DragImage::create(image.get(), RespectImageOrientation); // With an invalid pixel ref, BitmapImage should have no backing SkImage => we don't allocate // a DragImage. @@ -222,7 +223,7 @@ } RefPtr<TestImage> testImage = TestImage::create(fromSkSp(SkImage::MakeFromBitmap(testBitmap))); - std::unique_ptr<DragImage> dragImage = DragImage::create(testImage.get(), DoNotRespectImageOrientation, 1, InterpolationNone); + OwnPtr<DragImage> dragImage = DragImage::create(testImage.get(), DoNotRespectImageOrientation, 1, InterpolationNone); ASSERT_TRUE(dragImage); dragImage->scale(2, 2); const SkBitmap& dragBitmap = dragImage->bitmap();
diff --git a/third_party/WebKit/Source/platform/EventTracer.cpp b/third_party/WebKit/Source/platform/EventTracer.cpp index 7e5d35ab..6e6b386 100644 --- a/third_party/WebKit/Source/platform/EventTracer.cpp +++ b/third_party/WebKit/Source/platform/EventTracer.cpp
@@ -37,7 +37,6 @@ #include "public/platform/Platform.h" #include "wtf/Assertions.h" #include "wtf/text/StringUTF8Adaptor.h" -#include <memory> #include <stdio.h> namespace blink { @@ -73,8 +72,8 @@ const char* name, const char* scope, unsigned long long id, unsigned long long bindId, double timestamp, int numArgs, const char* argNames[], const unsigned char argTypes[], const unsigned long long argValues[], - std::unique_ptr<TracedValue> tracedValue1, - std::unique_ptr<TracedValue> tracedValue2, + PassOwnPtr<TracedValue> tracedValue1, + PassOwnPtr<TracedValue> tracedValue2, unsigned flags) { std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2];
diff --git a/third_party/WebKit/Source/platform/EventTracer.h b/third_party/WebKit/Source/platform/EventTracer.h index 2b1f9c1..4f896619 100644 --- a/third_party/WebKit/Source/platform/EventTracer.h +++ b/third_party/WebKit/Source/platform/EventTracer.h
@@ -33,7 +33,9 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" + #include <memory> #include <stdint.h> @@ -76,8 +78,8 @@ const char* argNames[], const unsigned char argTypes[], const unsigned long long argValues[], - std::unique_ptr<TracedValue>, - std::unique_ptr<TracedValue>, + PassOwnPtr<TracedValue>, + PassOwnPtr<TracedValue>, unsigned flags); static TraceEvent::TraceEventHandle addTraceEvent(char phase, const unsigned char* categoryEnabledFlag,
diff --git a/third_party/WebKit/Source/platform/PODArena.h b/third_party/WebKit/Source/platform/PODArena.h index d8ebf83..3250e786 100644 --- a/third_party/WebKit/Source/platform/PODArena.h +++ b/third_party/WebKit/Source/platform/PODArena.h
@@ -29,11 +29,11 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" #include "wtf/allocator/Partitions.h" -#include <memory> #include <stdint.h> namespace blink { @@ -132,7 +132,7 @@ if (!ptr) { if (roundedSize > m_currentChunkSize) m_currentChunkSize = roundedSize; - m_chunks.append(wrapUnique(new Chunk(m_allocator.get(), m_currentChunkSize))); + m_chunks.append(adoptPtr(new Chunk(m_allocator.get(), m_currentChunkSize))); m_current = m_chunks.last().get(); ptr = m_current->allocate(roundedSize); } @@ -194,7 +194,7 @@ RefPtr<Allocator> m_allocator; Chunk* m_current; size_t m_currentChunkSize; - Vector<std::unique_ptr<Chunk>> m_chunks; + Vector<OwnPtr<Chunk>> m_chunks; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/PurgeableVector.cpp b/third_party/WebKit/Source/platform/PurgeableVector.cpp index 5c42bd1..b193230b 100644 --- a/third_party/WebKit/Source/platform/PurgeableVector.cpp +++ b/third_party/WebKit/Source/platform/PurgeableVector.cpp
@@ -34,8 +34,11 @@ #include "base/memory/discardable_memory_allocator.h" #include "platform/web_process_memory_dump.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/text/WTFString.h" + #include <cstring> #include <utility>
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.h b/third_party/WebKit/Source/platform/SharedBuffer.h index 9edad438..7b522cb 100644 --- a/third_party/WebKit/Source/platform/SharedBuffer.h +++ b/third_party/WebKit/Source/platform/SharedBuffer.h
@@ -31,6 +31,7 @@ #include "platform/PurgeableVector.h" #include "third_party/skia/include/core/SkData.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/platform/SharedBufferTest.cpp b/third_party/WebKit/Source/platform/SharedBufferTest.cpp index a93154e..5dfda03d 100644 --- a/third_party/WebKit/Source/platform/SharedBufferTest.cpp +++ b/third_party/WebKit/Source/platform/SharedBufferTest.cpp
@@ -31,12 +31,12 @@ #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include <algorithm> #include <cstdlib> -#include <memory> namespace blink { @@ -51,7 +51,7 @@ sharedBuffer->append(testData2, strlen(testData2)); const size_t size = sharedBuffer->size(); - std::unique_ptr<char[]> data = wrapArrayUnique(new char[size]); + OwnPtr<char[]> data = adoptArrayPtr(new char[size]); ASSERT_TRUE(sharedBuffer->getAsBytes(data.get(), size)); char expectedConcatenation[] = "HelloWorldGoodbye"; @@ -76,7 +76,7 @@ sharedBuffer->append(vector2); const size_t size = sharedBuffer->size(); - std::unique_ptr<char[]> data = wrapArrayUnique(new char[size]); + OwnPtr<char[]> data = adoptArrayPtr(new char[size]); ASSERT_TRUE(sharedBuffer->getAsBytes(data.get(), size)); ASSERT_EQ(0x4000U + 0x4000U + 0x4000U, size);
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index dec68506..22a5a8a 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -11,9 +11,7 @@ #include "public/platform/WebViewScheduler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" -#include <memory> #include <queue> using testing::ElementsAre; @@ -22,10 +20,10 @@ namespace { double gCurrentTimeSecs = 0.0; -// This class exists because gcc doesn't know how to move an std::unique_ptr. +// This class exists because gcc doesn't know how to move an OwnPtr. class RefCountedTaskContainer : public RefCounted<RefCountedTaskContainer> { public: - explicit RefCountedTaskContainer(WebTaskRunner::Task* task) : m_task(wrapUnique(task)) { } + explicit RefCountedTaskContainer(WebTaskRunner::Task* task) : m_task(adoptPtr(task)) { } ~RefCountedTaskContainer() { } @@ -35,7 +33,7 @@ } private: - std::unique_ptr<WebTaskRunner::Task> m_task; + OwnPtr<WebTaskRunner::Task> m_task; }; class DelayedTask { @@ -202,7 +200,7 @@ class FakeWebThread : public WebThread { public: - FakeWebThread() : m_webScheduler(wrapUnique(new MockWebScheduler())) { } + FakeWebThread() : m_webScheduler(adoptPtr(new MockWebScheduler())) { } ~FakeWebThread() override { } virtual bool isCurrentThread() const @@ -239,13 +237,13 @@ } private: - std::unique_ptr<MockWebScheduler> m_webScheduler; + OwnPtr<MockWebScheduler> m_webScheduler; }; class TimerTestPlatform : public TestingPlatformSupport { public: TimerTestPlatform() - : m_webThread(wrapUnique(new FakeWebThread())) { } + : m_webThread(adoptPtr(new FakeWebThread())) { } ~TimerTestPlatform() override { } WebThread* currentThread() override @@ -284,7 +282,7 @@ return static_cast<MockWebScheduler*>(m_webThread->scheduler()); } - std::unique_ptr<FakeWebThread> m_webThread; + OwnPtr<FakeWebThread> m_webThread; }; class TimerTest : public testing::Test {
diff --git a/third_party/WebKit/Source/platform/TraceEvent.h b/third_party/WebKit/Source/platform/TraceEvent.h index bbb08f2..6fca921 100644 --- a/third_party/WebKit/Source/platform/TraceEvent.h +++ b/third_party/WebKit/Source/platform/TraceEvent.h
@@ -37,8 +37,8 @@ #include "wtf/Allocator.h" #include "wtf/DynamicAnnotations.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" -#include <memory> //////////////////////////////////////////////////////////////////////////////// // Implementation specific tracing API definitions. @@ -116,7 +116,7 @@ // const char** arg_names, // const unsigned char* arg_types, // const unsigned long long* arg_values, -// std::unique_ptr<TracedValue> tracedValues[], +// PassOwnPtr<TracedValue> tracedValues[], // unsigned char flags) #define TRACE_EVENT_API_ADD_TRACE_EVENT \ blink::EventTracer::addTraceEvent @@ -427,22 +427,22 @@ *type = TRACE_VALUE_TYPE_CONVERTABLE; } -template<typename T> static inline void setTraceValue(const std::unique_ptr<T>& ptr, unsigned char* type, unsigned long long* value) +template<typename T> static inline void setTraceValue(const PassOwnPtr<T>& ptr, unsigned char* type, unsigned long long* value) { setTraceValue(ptr.get(), type, value); } template<typename T> struct TracedValueTraits { static const bool isTracedValue = false; - static std::unique_ptr<TracedValue> moveFromIfTracedValue(const T&) + static PassOwnPtr<TracedValue> moveFromIfTracedValue(const T&) { return nullptr; } }; -template<typename T> struct TracedValueTraits<std::unique_ptr<T>> { +template<typename T> struct TracedValueTraits<PassOwnPtr<T>> { static const bool isTracedValue = std::is_convertible<T*, TracedValue*>::value; - static std::unique_ptr<TracedValue> moveFromIfTracedValue(std::unique_ptr<T>&& tracedValue) + static PassOwnPtr<TracedValue> moveFromIfTracedValue(PassOwnPtr<T>&& tracedValue) { return std::move(tracedValue); } @@ -453,7 +453,7 @@ return TracedValueTraits<T>::isTracedValue; } -template<typename T> std::unique_ptr<TracedValue> moveFromIfTracedValue(T&& value) +template<typename T> PassOwnPtr<TracedValue> moveFromIfTracedValue(T&& value) { return TracedValueTraits<T>::moveFromIfTracedValue(std::forward<T>(value)); }
diff --git a/third_party/WebKit/Source/platform/TraceEventCommon.h b/third_party/WebKit/Source/platform/TraceEventCommon.h index 95addda..b38208d 100644 --- a/third_party/WebKit/Source/platform/TraceEventCommon.h +++ b/third_party/WebKit/Source/platform/TraceEventCommon.h
@@ -148,8 +148,8 @@ // class MyData { // public: // MyData() {} -// std::unique_ptr<TracedValue> toTracedValue() { -// std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); +// PassOwnPtr<TracedValue> toTracedValue() { +// OwnPtr<TracedValue> tracedValue = TracedValue::create(); // tracedValue->setInteger("foo", 1); // tracedValue->beginArray("bar"); // tracedValue->pushInteger(2);
diff --git a/third_party/WebKit/Source/platform/TracedValue.cpp b/third_party/WebKit/Source/platform/TracedValue.cpp index d60ad77f..3302698e 100644 --- a/third_party/WebKit/Source/platform/TracedValue.cpp +++ b/third_party/WebKit/Source/platform/TracedValue.cpp
@@ -5,15 +5,13 @@ #include "platform/TracedValue.h" #include "base/trace_event/trace_event_argument.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringUTF8Adaptor.h" -#include <memory> namespace blink { -std::unique_ptr<TracedValue> TracedValue::create() +PassOwnPtr<TracedValue> TracedValue::create() { - return wrapUnique(new TracedValue()); + return adoptPtr(new TracedValue()); } TracedValue::TracedValue()
diff --git a/third_party/WebKit/Source/platform/TracedValue.h b/third_party/WebKit/Source/platform/TracedValue.h index f3b315b0..2423700ac 100644 --- a/third_party/WebKit/Source/platform/TracedValue.h +++ b/third_party/WebKit/Source/platform/TracedValue.h
@@ -7,8 +7,8 @@ #include "base/memory/ref_counted.h" #include "platform/EventTracer.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace base { namespace trace_event { @@ -25,7 +25,7 @@ public: ~TracedValue(); - static std::unique_ptr<TracedValue> create(); + static PassOwnPtr<TracedValue> create(); void endDictionary(); void endArray();
diff --git a/third_party/WebKit/Source/platform/TracedValueTest.cpp b/third_party/WebKit/Source/platform/TracedValueTest.cpp index 7a35df6..b2357545 100644 --- a/third_party/WebKit/Source/platform/TracedValueTest.cpp +++ b/third_party/WebKit/Source/platform/TracedValueTest.cpp
@@ -7,11 +7,10 @@ #include "base/json/json_reader.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { -std::unique_ptr<base::Value> parseTracedValue(std::unique_ptr<TracedValue> value) +std::unique_ptr<base::Value> parseTracedValue(PassOwnPtr<TracedValue> value) { base::JSONReader reader; CString utf8 = value->toString().utf8(); @@ -20,7 +19,7 @@ TEST(TracedValueTest, FlatDictionary) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("int", 2014); value->setDouble("double", 0.0); value->setBoolean("bool", true); @@ -42,7 +41,7 @@ TEST(TracedValueTest, Hierarchy) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setInteger("i0", 2014); value->beginDictionary("dict1"); value->setInteger("i1", 2014); @@ -103,7 +102,7 @@ TEST(TracedValueTest, Escape) { - std::unique_ptr<TracedValue> value = TracedValue::create(); + OwnPtr<TracedValue> value = TracedValue::create(); value->setString("s0", "value0\\"); value->setString("s1", "value\n1"); value->setString("s2", "\"value2\"");
diff --git a/third_party/WebKit/Source/platform/WaitableEvent.cpp b/third_party/WebKit/Source/platform/WaitableEvent.cpp index 3bbb8577..6c5f9ee 100644 --- a/third_party/WebKit/Source/platform/WaitableEvent.cpp +++ b/third_party/WebKit/Source/platform/WaitableEvent.cpp
@@ -5,14 +5,15 @@ #include "platform/WaitableEvent.h" #include "base/synchronization/waitable_event.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" + #include <vector> namespace blink { WaitableEvent::WaitableEvent(ResetPolicy policy, InitialState state) { - m_impl = wrapUnique(new base::WaitableEvent( + m_impl = adoptPtr(new base::WaitableEvent( policy == ResetPolicy::Manual ? base::WaitableEvent::ResetPolicy::MANUAL : base::WaitableEvent::ResetPolicy::AUTOMATIC,
diff --git a/third_party/WebKit/Source/platform/WaitableEvent.h b/third_party/WebKit/Source/platform/WaitableEvent.h index dad4a30..8b227cc 100644 --- a/third_party/WebKit/Source/platform/WaitableEvent.h +++ b/third_party/WebKit/Source/platform/WaitableEvent.h
@@ -32,8 +32,8 @@ #define WaitableEvent_h #include "platform/PlatformExport.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace base { class WaitableEvent; @@ -78,7 +78,7 @@ WaitableEvent(const WaitableEvent&) = delete; void operator=(const WaitableEvent&) = delete; - std::unique_ptr<base::WaitableEvent> m_impl; + OwnPtr<base::WaitableEvent> m_impl; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/WebScheduler.cpp b/third_party/WebKit/Source/platform/WebScheduler.cpp index 7cb3420..7e0a116 100644 --- a/third_party/WebKit/Source/platform/WebScheduler.cpp +++ b/third_party/WebKit/Source/platform/WebScheduler.cpp
@@ -7,6 +7,7 @@ #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Assertions.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp index bb85da48..6c7f2cdc 100644 --- a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp +++ b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp
@@ -6,20 +6,18 @@ #include "platform/heap/SafePoint.h" #include "public/platform/WebScheduler.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" -#include <memory> namespace blink { -std::unique_ptr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name, bool perThreadHeapEnabled) +PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name, bool perThreadHeapEnabled) { - return wrapUnique(new WebThreadSupportingGC(name, nullptr, perThreadHeapEnabled)); + return adoptPtr(new WebThreadSupportingGC(name, nullptr, perThreadHeapEnabled)); } -std::unique_ptr<WebThreadSupportingGC> WebThreadSupportingGC::createForThread(WebThread* thread, bool perThreadHeapEnabled) +PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::createForThread(WebThread* thread, bool perThreadHeapEnabled) { - return wrapUnique(new WebThreadSupportingGC(nullptr, thread, perThreadHeapEnabled)); + return adoptPtr(new WebThreadSupportingGC(nullptr, thread, perThreadHeapEnabled)); } WebThreadSupportingGC::WebThreadSupportingGC(const char* name, WebThread* thread, bool perThreadHeapEnabled) @@ -34,7 +32,7 @@ #endif if (!m_thread) { // If |thread| is not given, create a new one and own it. - m_owningThread = wrapUnique(Platform::current()->createThread(name)); + m_owningThread = adoptPtr(Platform::current()->createThread(name)); m_thread = m_owningThread.get(); } } @@ -51,7 +49,7 @@ void WebThreadSupportingGC::initialize() { ThreadState::attachCurrentThread(m_perThreadHeapEnabled); - m_gcTaskRunner = wrapUnique(new GCTaskRunner(m_thread)); + m_gcTaskRunner = adoptPtr(new GCTaskRunner(m_thread)); } void WebThreadSupportingGC::shutdown()
diff --git a/third_party/WebKit/Source/platform/WebThreadSupportingGC.h b/third_party/WebKit/Source/platform/WebThreadSupportingGC.h index 184365c..faeacc2d 100644 --- a/third_party/WebKit/Source/platform/WebThreadSupportingGC.h +++ b/third_party/WebKit/Source/platform/WebThreadSupportingGC.h
@@ -11,7 +11,8 @@ #include "public/platform/WebThread.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -28,8 +29,8 @@ USING_FAST_MALLOC(WebThreadSupportingGC); WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); public: - static std::unique_ptr<WebThreadSupportingGC> create(const char* name, bool perThreadHeapEnabled = false); - static std::unique_ptr<WebThreadSupportingGC> createForThread(WebThread*, bool perThreadHeapEnabled = false); + static PassOwnPtr<WebThreadSupportingGC> create(const char* name, bool perThreadHeapEnabled = false); + static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*, bool perThreadHeapEnabled = false); ~WebThreadSupportingGC(); void postTask(const WebTraceLocation& location, std::unique_ptr<SameThreadClosure> task) @@ -79,13 +80,13 @@ private: WebThreadSupportingGC(const char* name, WebThread*, bool perThreadHeapEnabled); - std::unique_ptr<GCTaskRunner> m_gcTaskRunner; + OwnPtr<GCTaskRunner> m_gcTaskRunner; // m_thread is guaranteed to be non-null after this instance is constructed. // m_owningThread is non-null unless this instance is constructed for an // existing thread via createForThread(). WebThread* m_thread = nullptr; - std::unique_ptr<WebThread> m_owningThread; + OwnPtr<WebThread> m_owningThread; bool m_perThreadHeapEnabled; };
diff --git a/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp b/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp index 4a1934b..0e9ac9b 100644 --- a/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp +++ b/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp
@@ -34,14 +34,13 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { TEST(AnimationTranslationUtilTest, transformsWork) { TransformOperations ops; - std::unique_ptr<CompositorTransformOperations> outOps = CompositorTransformOperations::create(); + OwnPtr<CompositorTransformOperations> outOps = CompositorTransformOperations::create(); ops.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TranslateX)); ops.operations().append(RotateTransformOperation::create(0.1, 0.2, 0.3, 200000.4, TransformOperation::Rotate3D)); @@ -74,7 +73,7 @@ TEST(AnimationTranslationUtilTest, filtersWork) { FilterOperations ops; - std::unique_ptr<CompositorFilterOperations> outOps = CompositorFilterOperations::create(); + OwnPtr<CompositorFilterOperations> outOps = CompositorFilterOperations::create(); ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterOperation::SATURATE)); ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterOperation::GRAYSCALE));
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp index 63becca..2b73cd8 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp
@@ -13,7 +13,6 @@ #include "platform/animation/CompositorFloatAnimationCurve.h" #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" #include "platform/animation/CompositorTransformAnimationCurve.h" -#include <memory> using cc::Animation; using cc::AnimationIdProvider; @@ -127,7 +126,7 @@ return std::move(m_animation); } -std::unique_ptr<CompositorFloatAnimationCurve> CompositorAnimation::floatCurveForTesting() const +PassOwnPtr<CompositorFloatAnimationCurve> CompositorAnimation::floatCurveForTesting() const { const cc::AnimationCurve* curve = m_animation->curve(); DCHECK_EQ(cc::AnimationCurve::FLOAT, curve->Type());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h index 681141a..c3e7bd85 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h
@@ -9,7 +9,8 @@ #include "platform/PlatformExport.h" #include "platform/animation/CompositorTargetProperty.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" + #include <memory> namespace cc { @@ -28,9 +29,9 @@ using Direction = cc::Animation::Direction; using FillMode = cc::Animation::FillMode; - static std::unique_ptr<CompositorAnimation> create(const blink::CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId) + static PassOwnPtr<CompositorAnimation> create(const blink::CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId) { - return wrapUnique(new CompositorAnimation(curve, target, animationId, groupId)); + return adoptPtr(new CompositorAnimation(curve, target, animationId, groupId)); } ~CompositorAnimation(); @@ -67,7 +68,7 @@ std::unique_ptr<cc::Animation> passAnimation(); - std::unique_ptr<CompositorFloatAnimationCurve> floatCurveForTesting() const; + PassOwnPtr<CompositorFloatAnimationCurve> floatCurveForTesting() const; private: CompositorAnimation(const CompositorAnimationCurve&, CompositorTargetProperty::Type, int animationId, int groupId);
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp index 30b47359..1514d2d4 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp
@@ -8,8 +8,6 @@ #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/testing/CompositorTest.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -18,13 +16,13 @@ TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached) { - std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline(); EXPECT_FALSE(ccTimeline->animation_host()); EXPECT_TRUE(timeline->compositorAnimationHost().isNull()); - std::unique_ptr<WebLayerTreeView> layerTreeHost = wrapUnique(new WebLayerTreeViewImplForTesting); + OwnPtr<WebLayerTreeView> layerTreeHost = adoptPtr(new WebLayerTreeViewImplForTesting); DCHECK(layerTreeHost); layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h index 003ae77..117ffcc 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h
@@ -12,7 +12,8 @@ #include "cc/animation/animation_player.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" + #include <memory> namespace blink { @@ -25,9 +26,9 @@ class PLATFORM_EXPORT CompositorAnimationPlayer : public cc::AnimationDelegate { WTF_MAKE_NONCOPYABLE(CompositorAnimationPlayer); public: - static std::unique_ptr<CompositorAnimationPlayer> create() + static PassOwnPtr<CompositorAnimationPlayer> create() { - return wrapUnique(new CompositorAnimationPlayer()); + return adoptPtr(new CompositorAnimationPlayer()); } ~CompositorAnimationPlayer();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp index daa8206..25d8fdc 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp
@@ -44,7 +44,7 @@ return m_player.get(); } - std::unique_ptr<CompositorAnimationPlayer> m_player; + OwnPtr<CompositorAnimationPlayer> m_player; }; class CompositorAnimationPlayerTest : public CompositorTest { @@ -56,7 +56,7 @@ { std::unique_ptr<CompositorAnimationDelegateForTesting> delegate(new CompositorAnimationDelegateForTesting); - std::unique_ptr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); + OwnPtr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); cc::AnimationPlayer* ccPlayer = player->animationPlayer(); player->setAnimationDelegate(delegate.get()); @@ -76,7 +76,7 @@ { std::unique_ptr<CompositorAnimationDelegateForTesting> delegate(new CompositorAnimationDelegateForTesting); - std::unique_ptr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); + OwnPtr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); scoped_refptr<cc::AnimationPlayer> ccPlayer = player->animationPlayer(); player->setAnimationDelegate(delegate.get()); @@ -92,7 +92,7 @@ TEST_F(CompositorAnimationPlayerTest, CompositorPlayerDeletionDetachesFromCCTimeline) { - std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); std::unique_ptr<CompositorAnimationPlayerTestClient> client(new CompositorAnimationPlayerTestClient); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp index b230193..066b14e 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp
@@ -11,8 +11,8 @@ TEST(WebCompositorAnimationTest, DefaultSettings) { - std::unique_ptr<CompositorAnimationCurve> curve = CompositorFloatAnimationCurve::create(); - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create( + OwnPtr<CompositorAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( *curve, CompositorTargetProperty::OPACITY, 1, 0); // Ensure that the defaults are correct. @@ -24,8 +24,8 @@ TEST(WebCompositorAnimationTest, ModifiedSettings) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create( + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( *curve, CompositorTargetProperty::OPACITY, 1, 0); animation->setIterations(2); animation->setStartTime(2);
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h index 7a8eece..384c1a2 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h
@@ -9,7 +9,8 @@ #include "cc/animation/animation_timeline.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" + #include <memory> namespace blink { @@ -21,9 +22,9 @@ class PLATFORM_EXPORT CompositorAnimationTimeline { WTF_MAKE_NONCOPYABLE(CompositorAnimationTimeline); public: - static std::unique_ptr<CompositorAnimationTimeline> create() + static PassOwnPtr<CompositorAnimationTimeline> create() { - return wrapUnique(new CompositorAnimationTimeline()); + return adoptPtr(new CompositorAnimationTimeline()); } ~CompositorAnimationTimeline();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp index c4d4d5d..99912f9 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp
@@ -9,8 +9,6 @@ #include "platform/animation/CompositorAnimationPlayer.h" #include "platform/testing/CompositorTest.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -19,12 +17,12 @@ TEST_F(CompositorAnimationTimelineTest, CompositorTimelineDeletionDetachesFromAnimationHost) { - std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline(); EXPECT_FALSE(ccTimeline->animation_host()); - std::unique_ptr<WebLayerTreeView> layerTreeHost = wrapUnique(new WebLayerTreeViewImplForTesting); + OwnPtr<WebLayerTreeView> layerTreeHost = adoptPtr(new WebLayerTreeViewImplForTesting); DCHECK(layerTreeHost); layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h index 4b621f1..9984335 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h
@@ -10,8 +10,7 @@ #include "platform/animation/CompositorFilterKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace cc { class KeyframedFilterAnimationCurve; @@ -27,9 +26,9 @@ class PLATFORM_EXPORT CompositorFilterAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorFilterAnimationCurve); public: - static std::unique_ptr<CompositorFilterAnimationCurve> create() + static PassOwnPtr<CompositorFilterAnimationCurve> create() { - return wrapUnique(new CompositorFilterAnimationCurve()); + return adoptPtr(new CompositorFilterAnimationCurve()); } ~CompositorFilterAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp index d67ba928..1758ee89 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp
@@ -4,11 +4,9 @@ #include "platform/animation/CompositorFilterKeyframe.h" -#include <memory> - namespace blink { -CompositorFilterKeyframe::CompositorFilterKeyframe(double time, std::unique_ptr<CompositorFilterOperations> value) +CompositorFilterKeyframe::CompositorFilterKeyframe(double time, PassOwnPtr<CompositorFilterOperations> value) : m_time(time) , m_value(std::move(value)) {
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h index bbecf3fa..75a8687 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h
@@ -7,13 +7,14 @@ #include "platform/PlatformExport.h" #include "platform/graphics/CompositorFilterOperations.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { class PLATFORM_EXPORT CompositorFilterKeyframe { public: - CompositorFilterKeyframe(double time, std::unique_ptr<CompositorFilterOperations>); + CompositorFilterKeyframe(double time, PassOwnPtr<CompositorFilterOperations>); ~CompositorFilterKeyframe(); double time() const { return m_time; } @@ -22,7 +23,7 @@ private: double m_time; - std::unique_ptr<CompositorFilterOperations> m_value; + OwnPtr<CompositorFilterOperations> m_value; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp index 5c6a461..47fd8da 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp
@@ -7,8 +7,6 @@ #include "cc/animation/animation_curve.h" #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/timing_function.h" -#include "wtf/PtrUtil.h" -#include <memory> using blink::CompositorFloatKeyframe; @@ -28,9 +26,9 @@ { } -std::unique_ptr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) +PassOwnPtr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) { - return wrapUnique(new CompositorFloatAnimationCurve(std::move(curve))); + return adoptPtr(new CompositorFloatAnimationCurve(std::move(curve))); } Vector<CompositorFloatKeyframe> CompositorFloatAnimationCurve::keyframesForTesting() const
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h index 69340ce..2ddc495 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h
@@ -10,9 +10,8 @@ #include "platform/animation/CompositorFloatKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace cc { class KeyframedFloatAnimationCurve; @@ -28,14 +27,14 @@ class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); public: - static std::unique_ptr<CompositorFloatAnimationCurve> create() + static PassOwnPtr<CompositorFloatAnimationCurve> create() { - return wrapUnique(new CompositorFloatAnimationCurve()); + return adoptPtr(new CompositorFloatAnimationCurve()); } ~CompositorFloatAnimationCurve() override; - static std::unique_ptr<CompositorFloatAnimationCurve> CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve>); + static PassOwnPtr<CompositorFloatAnimationCurve> CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve>); Vector<CompositorFloatKeyframe> keyframesForTesting() const; // TODO(loyso): Erase these methods once blink/cc timing functions unified.
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp index dc34795..23900099 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp
@@ -18,7 +18,7 @@ // Tests that a float animation with one keyframe works as expected. TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); @@ -30,7 +30,7 @@ // Tests that a float animation with two keyframes works as expected. TEST(WebFloatAnimationCurveTest, TwoFloatKeyframe) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); @@ -43,7 +43,7 @@ // Tests that a float animation with three keyframes works as expected. TEST(WebFloatAnimationCurveTest, ThreeFloatKeyframe) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(2, 8)); @@ -59,7 +59,7 @@ // Tests that a float animation with multiple keys at a given time works sanely. TEST(WebFloatAnimationCurveTest, RepeatedFloatKeyTimes) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 6)); @@ -81,7 +81,7 @@ // Tests that the keyframes may be added out of order. TEST(WebFloatAnimationCurveTest, UnsortedKeyframes) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(2, 8)); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); @@ -98,7 +98,7 @@ // Tests that a cubic bezier timing function works as expected. TEST(WebFloatAnimationCurveTest, CubicBezierTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), 0.25, 0, 0.75, 1); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -114,7 +114,7 @@ // Tests that an ease timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -129,7 +129,7 @@ // Tests using a linear timing function. TEST(WebFloatAnimationCurveTest, LinearTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 0)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -142,7 +142,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_IN); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -157,7 +157,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_OUT); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -172,7 +172,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_IN_OUT); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -187,7 +187,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); double x1 = 0.3; double y1 = 0.2; double x2 = 0.8; @@ -206,7 +206,7 @@ // Tests that the default timing function is indeed ease. TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) { - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1));
diff --git a/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h index fc6a25d77..af799e3c 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h
@@ -9,8 +9,7 @@ #include "platform/animation/CompositorAnimationCurve.h" #include "platform/geometry/FloatPoint.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace cc { class ScrollOffsetAnimationCurve; @@ -27,13 +26,13 @@ ScrollDurationInverseDelta }; - static std::unique_ptr<CompositorScrollOffsetAnimationCurve> create(FloatPoint targetValue, CompositorScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) + static PassOwnPtr<CompositorScrollOffsetAnimationCurve> create(FloatPoint targetValue, CompositorScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) { - return wrapUnique(new CompositorScrollOffsetAnimationCurve(targetValue, durationBehavior)); + return adoptPtr(new CompositorScrollOffsetAnimationCurve(targetValue, durationBehavior)); } - static std::unique_ptr<CompositorScrollOffsetAnimationCurve> create(cc::ScrollOffsetAnimationCurve* curve) + static PassOwnPtr<CompositorScrollOffsetAnimationCurve> create(cc::ScrollOffsetAnimationCurve* curve) { - return wrapUnique(new CompositorScrollOffsetAnimationCurve(curve)); + return adoptPtr(new CompositorScrollOffsetAnimationCurve(curve)); } ~CompositorScrollOffsetAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h index 1b882e3..fcab856 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h
@@ -10,8 +10,7 @@ #include "platform/animation/CompositorTransformKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace cc { class KeyframedTransformAnimationCurve; @@ -27,9 +26,9 @@ class PLATFORM_EXPORT CompositorTransformAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorTransformAnimationCurve); public: - static std::unique_ptr<CompositorTransformAnimationCurve> create() + static PassOwnPtr<CompositorTransformAnimationCurve> create() { - return wrapUnique(new CompositorTransformAnimationCurve()); + return adoptPtr(new CompositorTransformAnimationCurve()); } ~CompositorTransformAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp index 0bcc1d2..dc7e32a 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp
@@ -4,11 +4,9 @@ #include "platform/animation/CompositorTransformKeyframe.h" -#include <memory> - namespace blink { -CompositorTransformKeyframe::CompositorTransformKeyframe(double time, std::unique_ptr<CompositorTransformOperations> value) +CompositorTransformKeyframe::CompositorTransformKeyframe(double time, PassOwnPtr<CompositorTransformOperations> value) : m_time(time) , m_value(std::move(value)) {
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h index 1eeecd6..4188a38f 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h
@@ -8,14 +8,15 @@ #include "platform/PlatformExport.h" #include "platform/animation/CompositorTransformOperations.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { class PLATFORM_EXPORT CompositorTransformKeyframe { WTF_MAKE_NONCOPYABLE(CompositorTransformKeyframe); public: - CompositorTransformKeyframe(double time, std::unique_ptr<CompositorTransformOperations> value); + CompositorTransformKeyframe(double time, PassOwnPtr<CompositorTransformOperations> value); ~CompositorTransformKeyframe(); double time() const; @@ -23,7 +24,7 @@ private: double m_time; - std::unique_ptr<CompositorTransformOperations> m_value; + OwnPtr<CompositorTransformOperations> m_value; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h b/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h index 6bf5254..418a3a9 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h
@@ -8,8 +8,7 @@ #include "cc/animation/transform_operations.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" class SkMatrix44; @@ -18,9 +17,9 @@ class PLATFORM_EXPORT CompositorTransformOperations { WTF_MAKE_NONCOPYABLE(CompositorTransformOperations); public: - static std::unique_ptr<CompositorTransformOperations> create() + static PassOwnPtr<CompositorTransformOperations> create() { - return wrapUnique(new CompositorTransformOperations()); + return adoptPtr(new CompositorTransformOperations()); } const cc::TransformOperations& asTransformOperations() const;
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunction.h b/third_party/WebKit/Source/platform/animation/TimingFunction.h index fb84a1d..caab057 100644 --- a/third_party/WebKit/Source/platform/animation/TimingFunction.h +++ b/third_party/WebKit/Source/platform/animation/TimingFunction.h
@@ -30,6 +30,8 @@ #include "platform/heap/Handle.h" #include "platform/heap/Heap.h" #include "ui/gfx/geometry/cubic_bezier.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/platform/audio/AudioBus.cpp b/third_party/WebKit/Source/platform/audio/AudioBus.cpp index 91483ad..2c8d4f4 100644 --- a/third_party/WebKit/Source/platform/audio/AudioBus.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioBus.cpp
@@ -33,11 +33,10 @@ #include "platform/audio/VectorMath.h" #include "public/platform/Platform.h" #include "public/platform/WebAudioBus.h" -#include "wtf/PtrUtil.h" -#include <algorithm> +#include "wtf/OwnPtr.h" #include <assert.h> #include <math.h> -#include <memory> +#include <algorithm> namespace blink { @@ -63,7 +62,7 @@ m_channels.reserveInitialCapacity(numberOfChannels); for (unsigned i = 0; i < numberOfChannels; ++i) { - std::unique_ptr<AudioChannel> channel = allocate ? wrapUnique(new AudioChannel(length)) : wrapUnique(new AudioChannel(0, length)); + PassOwnPtr<AudioChannel> channel = allocate ? adoptPtr(new AudioChannel(length)) : adoptPtr(new AudioChannel(0, length)); m_channels.append(std::move(channel)); } @@ -490,7 +489,7 @@ if (framesToDezipper) { if (!m_dezipperGainValues.get() || m_dezipperGainValues->size() < framesToDezipper) - m_dezipperGainValues = wrapUnique(new AudioFloatArray(framesToDezipper)); + m_dezipperGainValues = adoptPtr(new AudioFloatArray(framesToDezipper)); float* gainValues = m_dezipperGainValues->data(); for (unsigned i = 0; i < framesToDezipper; ++i) {
diff --git a/third_party/WebKit/Source/platform/audio/AudioBus.h b/third_party/WebKit/Source/platform/audio/AudioBus.h index 6f661961..eb20236 100644 --- a/third_party/WebKit/Source/platform/audio/AudioBus.h +++ b/third_party/WebKit/Source/platform/audio/AudioBus.h
@@ -31,9 +31,9 @@ #include "platform/audio/AudioChannel.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -159,10 +159,10 @@ void sumFromByDownMixing(const AudioBus&); size_t m_length; - Vector<std::unique_ptr<AudioChannel>> m_channels; + Vector<OwnPtr<AudioChannel>> m_channels; int m_layout; float m_busGain; - std::unique_ptr<AudioFloatArray> m_dezipperGainValues; + OwnPtr<AudioFloatArray> m_dezipperGainValues; bool m_isFirstTime; float m_sampleRate; // 0.0 if unknown or N/A };
diff --git a/third_party/WebKit/Source/platform/audio/AudioChannel.cpp b/third_party/WebKit/Source/platform/audio/AudioChannel.cpp index d6c089f..9c8edc63 100644 --- a/third_party/WebKit/Source/platform/audio/AudioChannel.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioChannel.cpp
@@ -28,6 +28,7 @@ #include "platform/audio/AudioChannel.h" #include "platform/audio/VectorMath.h" +#include "wtf/OwnPtr.h" #include <algorithm> #include <math.h>
diff --git a/third_party/WebKit/Source/platform/audio/AudioChannel.h b/third_party/WebKit/Source/platform/audio/AudioChannel.h index 472227b..f156911 100644 --- a/third_party/WebKit/Source/platform/audio/AudioChannel.h +++ b/third_party/WebKit/Source/platform/audio/AudioChannel.h
@@ -32,8 +32,7 @@ #include "platform/PlatformExport.h" #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -59,7 +58,7 @@ , m_rawPointer(nullptr) , m_silent(true) { - m_memBuffer = wrapUnique(new AudioFloatArray(length)); + m_memBuffer = adoptPtr(new AudioFloatArray(length)); } // A "blank" audio channel -- must call set() before it's useful... @@ -134,7 +133,7 @@ size_t m_length; float* m_rawPointer; - std::unique_ptr<AudioFloatArray> m_memBuffer; + OwnPtr<AudioFloatArray> m_memBuffer; bool m_silent; };
diff --git a/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h b/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h index abc1e20..ac02a9c0 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h +++ b/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h
@@ -33,9 +33,10 @@ #include "platform/audio/AudioBus.h" #include "platform/audio/AudioProcessor.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -54,7 +55,7 @@ // Subclasses create the appropriate type of processing kernel here. // We'll call this to create a kernel for each channel. - virtual std::unique_ptr<AudioDSPKernel> createKernel() = 0; + virtual PassOwnPtr<AudioDSPKernel> createKernel() = 0; // AudioProcessor methods void initialize() override; @@ -68,7 +69,7 @@ double latencyTime() const override; protected: - Vector<std::unique_ptr<AudioDSPKernel>> m_kernels; + Vector<OwnPtr<AudioDSPKernel>> m_kernels; mutable Mutex m_processLock; bool m_hasJustReset; };
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp index 145baa8..53c329f 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -33,8 +33,6 @@ #include "platform/audio/AudioPullFIFO.h" #include "public/platform/Platform.h" #include "public/platform/WebSecurityOrigin.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -45,9 +43,9 @@ const size_t fifoSize = 8192; // Factory method: Chromium-implementation -std::unique_ptr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) +PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) { - return wrapUnique(new AudioDestination(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, securityOrigin)); + return adoptPtr(new AudioDestination(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, securityOrigin)); } AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) @@ -91,7 +89,7 @@ if (m_callbackBufferSize + renderBufferSize > fifoSize) return; - m_audioDevice = wrapUnique(Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId, securityOrigin)); + m_audioDevice = adoptPtr(Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId, securityOrigin)); ASSERT(m_audioDevice); // Record the sizes if we successfully created an output device. @@ -103,10 +101,10 @@ // contains enough data, the data will be provided directly. // Otherwise, the FIFO will call the provider enough times to // satisfy the request for data. - m_fifo = wrapUnique(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, renderBufferSize)); + m_fifo = adoptPtr(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, renderBufferSize)); // Input buffering. - m_inputFifo = wrapUnique(new AudioFIFO(numberOfInputChannels, fifoSize)); + m_inputFifo = adoptPtr(new AudioFIFO(numberOfInputChannels, fifoSize)); // If the callback size does not match the render size, then we need to buffer some // extra silence for the input. Otherwise, we can over-consume the input FIFO.
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.h b/third_party/WebKit/Source/platform/audio/AudioDestination.h index 14c8f91..70b4780e 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.h +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.h
@@ -37,7 +37,6 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ // Pass in (numberOfInputChannels > 0) if live/local audio input is desired. // Port-specific device identification information for live/local input streams can be passed in the inputDeviceId. - static std::unique_ptr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>&); + static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>&); virtual void start(); virtual void stop(); @@ -87,11 +86,11 @@ RefPtr<AudioBus> m_renderBus; float m_sampleRate; bool m_isPlaying; - std::unique_ptr<WebAudioDevice> m_audioDevice; + OwnPtr<WebAudioDevice> m_audioDevice; size_t m_callbackBufferSize; - std::unique_ptr<AudioFIFO> m_inputFifo; - std::unique_ptr<AudioPullFIFO> m_fifo; + OwnPtr<AudioFIFO> m_inputFifo; + OwnPtr<AudioPullFIFO> m_fifo; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/AudioResampler.cpp b/third_party/WebKit/Source/platform/audio/AudioResampler.cpp index 2e6e3d9..175a5e1 100644 --- a/third_party/WebKit/Source/platform/audio/AudioResampler.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioResampler.cpp
@@ -23,9 +23,8 @@ */ #include "platform/audio/AudioResampler.h" -#include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include <algorithm> +#include "wtf/MathExtras.h" namespace blink { @@ -34,7 +33,7 @@ AudioResampler::AudioResampler() : m_rate(1.0) { - m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); + m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); m_sourceBus = AudioBus::create(1, 0, false); } @@ -42,7 +41,7 @@ : m_rate(1.0) { for (unsigned i = 0; i < numberOfChannels; ++i) - m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); + m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); m_sourceBus = AudioBus::create(numberOfChannels, 0, false); } @@ -56,7 +55,7 @@ // First deal with adding or removing kernels. if (numberOfChannels > currentSize) { for (unsigned i = currentSize; i < numberOfChannels; ++i) - m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); + m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); } else m_kernels.resize(numberOfChannels);
diff --git a/third_party/WebKit/Source/platform/audio/AudioResampler.h b/third_party/WebKit/Source/platform/audio/AudioResampler.h index 1f6298c..5fc4636 100644 --- a/third_party/WebKit/Source/platform/audio/AudioResampler.h +++ b/third_party/WebKit/Source/platform/audio/AudioResampler.h
@@ -30,8 +30,8 @@ #include "platform/audio/AudioSourceProvider.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -63,7 +63,7 @@ private: double m_rate; - Vector<std::unique_ptr<AudioResamplerKernel>> m_kernels; + Vector<OwnPtr<AudioResamplerKernel>> m_kernels; RefPtr<AudioBus> m_sourceBus; };
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp index 163e21bfe..2658a871 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp
@@ -26,11 +26,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/DynamicsCompressor.h" #include "platform/audio/AudioBus.h" #include "platform/audio/AudioUtilities.h" -#include "platform/audio/DynamicsCompressor.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -196,8 +195,8 @@ void DynamicsCompressor::setNumberOfChannels(unsigned numberOfChannels) { - m_sourceChannels = wrapArrayUnique(new const float* [numberOfChannels]); - m_destinationChannels = wrapArrayUnique(new float* [numberOfChannels]); + m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]); + m_destinationChannels = adoptArrayPtr(new float* [numberOfChannels]); m_compressor.setNumberOfChannels(numberOfChannels); m_numberOfChannels = numberOfChannels;
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h index b799cad..a27ec22 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h
@@ -34,7 +34,7 @@ #include "platform/audio/ZeroPole.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -98,8 +98,8 @@ float m_lastAnchor; float m_lastFilterStageGain; - std::unique_ptr<const float*[]> m_sourceChannels; - std::unique_ptr<float*[]> m_destinationChannels; + OwnPtr<const float*[]> m_sourceChannels; + OwnPtr<float*[]> m_destinationChannels; // The core compressor. DynamicsCompressorKernel m_compressor;
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp index cdb8282..81fab59 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
@@ -26,11 +26,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/DynamicsCompressorKernel.h" #include "platform/audio/AudioUtilities.h" #include "platform/audio/DenormalDisabler.h" -#include "platform/audio/DynamicsCompressorKernel.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include <algorithm> #include <cmath> @@ -73,7 +72,7 @@ m_preDelayBuffers.clear(); for (unsigned i = 0; i < numberOfChannels; ++i) - m_preDelayBuffers.append(wrapUnique(new AudioFloatArray(MaxPreDelayFrames))); + m_preDelayBuffers.append(adoptPtr(new AudioFloatArray(MaxPreDelayFrames))); } void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime)
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h index 32da625..e743ede 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h
@@ -33,7 +33,8 @@ #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -91,7 +92,7 @@ unsigned m_lastPreDelayFrames; void setPreDelayTime(float); - Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers; + Vector<OwnPtr<AudioFloatArray>> m_preDelayBuffers; int m_preDelayReadIndex; int m_preDelayWriteIndex;
diff --git a/third_party/WebKit/Source/platform/audio/FFTFrame.cpp b/third_party/WebKit/Source/platform/audio/FFTFrame.cpp index 9e167e8..9d70364c 100644 --- a/third_party/WebKit/Source/platform/audio/FFTFrame.cpp +++ b/third_party/WebKit/Source/platform/audio/FFTFrame.cpp
@@ -30,9 +30,8 @@ #include "platform/audio/VectorMath.h" #include "platform/Logging.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include <complex> -#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -50,9 +49,9 @@ doFFT(paddedResponse.data()); } -std::unique_ptr<FFTFrame> FFTFrame::createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x) +PassOwnPtr<FFTFrame> FFTFrame::createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x) { - std::unique_ptr<FFTFrame> newFrame = wrapUnique(new FFTFrame(frame1.fftSize())); + OwnPtr<FFTFrame> newFrame = adoptPtr(new FFTFrame(frame1.fftSize())); newFrame->interpolateFrequencyComponents(frame1, frame2, x);
diff --git a/third_party/WebKit/Source/platform/audio/FFTFrame.h b/third_party/WebKit/Source/platform/audio/FFTFrame.h index fccda3b..2450084 100644 --- a/third_party/WebKit/Source/platform/audio/FFTFrame.h +++ b/third_party/WebKit/Source/platform/audio/FFTFrame.h
@@ -33,8 +33,8 @@ #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Threading.h" -#include <memory> #if OS(MACOSX) #include <Accelerate/Accelerate.h> @@ -74,7 +74,7 @@ // The remaining public methods have cross-platform implementations: // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0 - static std::unique_ptr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x); + static PassOwnPtr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x); void doPaddedFFT(const float* data, size_t dataSize); // zero-padding with dataSize <= fftSize double extractAverageGroupDelay(); void addConstantGroupDelay(double sampleFrameDelay);
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp index 6b79e7f..7b88489 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
@@ -29,8 +29,6 @@ #include "platform/audio/HRTFDatabase.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -41,9 +39,9 @@ const unsigned HRTFDatabase::InterpolationFactor = 1; const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor; -std::unique_ptr<HRTFDatabase> HRTFDatabase::create(float sampleRate) +PassOwnPtr<HRTFDatabase> HRTFDatabase::create(float sampleRate) { - return wrapUnique(new HRTFDatabase(sampleRate)); + return adoptPtr(new HRTFDatabase(sampleRate)); } HRTFDatabase::HRTFDatabase(float sampleRate) @@ -52,7 +50,7 @@ { unsigned elevationIndex = 0; for (int elevation = MinElevation; elevation <= MaxElevation; elevation += RawElevationAngleSpacing) { - std::unique_ptr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate); + OwnPtr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate); ASSERT(hrtfElevation.get()); if (!hrtfElevation.get()) return;
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabase.h b/third_party/WebKit/Source/platform/audio/HRTFDatabase.h index 81d8ada..1674f90 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.h +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.h
@@ -33,9 +33,9 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -45,7 +45,7 @@ USING_FAST_MALLOC(HRTFDatabase); WTF_MAKE_NONCOPYABLE(HRTFDatabase); public: - static std::unique_ptr<HRTFDatabase> create(float sampleRate); + static PassOwnPtr<HRTFDatabase> create(float sampleRate); // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation. // azimuthBlend must be in the range 0 -> 1. @@ -78,7 +78,7 @@ // Returns the index for the correct HRTFElevation given the elevation angle. static unsigned indexFromElevationAngle(double); - Vector<std::unique_ptr<HRTFElevation>> m_elevations; + Vector<OwnPtr<HRTFElevation>> m_elevations; float m_sampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp index 6a150874..d57b760 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp
@@ -26,13 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/HRTFDatabaseLoader.h" #include "platform/TaskSynchronizer.h" #include "platform/ThreadSafeFunctional.h" -#include "platform/audio/HRTFDatabaseLoader.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -93,7 +92,7 @@ MutexLocker locker(m_lock); if (!m_hrtfDatabase && !m_thread) { // Start the asynchronous database loading process. - m_thread = wrapUnique(Platform::current()->createThread("HRTF database loader")); + m_thread = adoptPtr(Platform::current()->createThread("HRTF database loader")); // TODO(alexclarke): Should this be posted as a loading task? m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::loadTask, AllowCrossThreadAccess(this))); }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h index bf8ec64..2b630880 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h
@@ -34,7 +34,6 @@ #include "wtf/HashMap.h" #include "wtf/RefCounted.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -77,9 +76,9 @@ // Holding a m_lock is required when accessing m_hrtfDatabase since we access it from multiple threads. Mutex m_lock; - std::unique_ptr<HRTFDatabase> m_hrtfDatabase; + OwnPtr<HRTFDatabase> m_hrtfDatabase; - std::unique_ptr<WebThread> m_thread; + OwnPtr<WebThread> m_thread; float m_databaseSampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp index c51917d..aa8ca147 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp
@@ -26,15 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/AudioBus.h" #include "platform/audio/HRTFElevation.h" +#include <math.h> +#include <algorithm> +#include "platform/audio/AudioBus.h" #include "platform/audio/HRTFPanner.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/StringHash.h" -#include <algorithm> -#include <math.h> -#include <memory> namespace blink { @@ -98,7 +96,7 @@ } #endif -bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, std::unique_ptr<HRTFKernel>& kernelL, std::unique_ptr<HRTFKernel>& kernelR) +bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, OwnPtr<HRTFKernel>& kernelL, OwnPtr<HRTFKernel>& kernelR) { // Valid values for azimuth are 0 -> 345 in 15 degree increments. // Valid values for elevation are -45 -> +90 in 15 degree increments. @@ -221,15 +219,15 @@ 45 // 345 }; -std::unique_ptr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) +PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) { bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; ASSERT(isElevationGood); if (!isElevationGood) return nullptr; - std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); - std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); // Load convolution kernels from HRTF files. int interpolatedIndex = 0; @@ -258,11 +256,11 @@ } } - std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); + OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); return hrtfElevation; } -std::unique_ptr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) +PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) { ASSERT(hrtfElevation1 && hrtfElevation2); if (!hrtfElevation1 || !hrtfElevation2) @@ -270,8 +268,8 @@ ASSERT(x >= 0.0 && x < 1.0); - std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); - std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); @@ -287,7 +285,7 @@ // Interpolate elevation angle. double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle(); - std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); + OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); return hrtfElevation; }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.h b/third_party/WebKit/Source/platform/audio/HRTFElevation.h index f3786c3d..988a204 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFElevation.h +++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.h
@@ -32,11 +32,12 @@ #include "platform/audio/HRTFKernel.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -50,10 +51,10 @@ // Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names. // Interpolated azimuths will be generated based on InterpolationFactor. // Valid values for elevation are -45 -> +90 in 15 degree increments. - static std::unique_ptr<HRTFElevation> createForSubject(const String& subjectName, int elevation, float sampleRate); + static PassOwnPtr<HRTFElevation> createForSubject(const String& subjectName, int elevation, float sampleRate); // Given two HRTFElevations, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFElevation. - static std::unique_ptr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate); + static PassOwnPtr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate); // Returns the list of left or right ear HRTFKernels for all the azimuths going from 0 to 360 degrees. HRTFKernelList* kernelListL() { return m_kernelListL.get(); } @@ -83,10 +84,10 @@ // Valid values for azimuth are 0 -> 345 in 15 degree increments. // Valid values for elevation are -45 -> +90 in 15 degree increments. // Returns true on success. - static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, std::unique_ptr<HRTFKernel>& kernelL, std::unique_ptr<HRTFKernel>& kernelR); + static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, OwnPtr<HRTFKernel>& kernelL, OwnPtr<HRTFKernel>& kernelR); private: - HRTFElevation(std::unique_ptr<HRTFKernelList> kernelListL, std::unique_ptr<HRTFKernelList> kernelListR, int elevation, float sampleRate) + HRTFElevation(PassOwnPtr<HRTFKernelList> kernelListL, PassOwnPtr<HRTFKernelList> kernelListR, int elevation, float sampleRate) : m_kernelListL(std::move(kernelListL)) , m_kernelListR(std::move(kernelListR)) , m_elevationAngle(elevation) @@ -94,8 +95,8 @@ { } - std::unique_ptr<HRTFKernelList> m_kernelListL; - std::unique_ptr<HRTFKernelList> m_kernelListR; + OwnPtr<HRTFKernelList> m_kernelListL; + OwnPtr<HRTFKernelList> m_kernelListR; double m_elevationAngle; float m_sampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp index df21d79..6ef5208b 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp
@@ -26,13 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/FloatConversion.h" -#include "platform/audio/AudioChannel.h" #include "platform/audio/HRTFKernel.h" +#include "platform/audio/AudioChannel.h" +#include "platform/FloatConversion.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -88,13 +86,13 @@ } } - m_fftFrame = wrapUnique(new FFTFrame(fftSize)); + m_fftFrame = adoptPtr(new FFTFrame(fftSize)); m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength); } -std::unique_ptr<AudioChannel> HRTFKernel::createImpulseResponse() +PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse() { - std::unique_ptr<AudioChannel> channel = wrapUnique(new AudioChannel(fftSize())); + OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize())); FFTFrame fftFrame(*m_fftFrame); // Add leading delay back in. @@ -105,7 +103,7 @@ } // Interpolates two kernels with x: 0 -> 1 and returns the result. -std::unique_ptr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) +PassOwnPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) { ASSERT(kernel1 && kernel2); if (!kernel1 || !kernel2) @@ -122,7 +120,7 @@ float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay(); - std::unique_ptr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x); + OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x); return HRTFKernel::create(std::move(interpolatedFrame), frameDelay, sampleRate1); }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFKernel.h b/third_party/WebKit/Source/platform/audio/HRTFKernel.h index d1e9f44..1de613d 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFKernel.h +++ b/third_party/WebKit/Source/platform/audio/HRTFKernel.h
@@ -32,9 +32,9 @@ #include "platform/audio/FFTFrame.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -52,18 +52,18 @@ public: // Note: this is destructive on the passed in AudioChannel. // The length of channel must be a power of two. - static std::unique_ptr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, float sampleRate) + static PassOwnPtr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, float sampleRate) { - return wrapUnique(new HRTFKernel(channel, fftSize, sampleRate)); + return adoptPtr(new HRTFKernel(channel, fftSize, sampleRate)); } - static std::unique_ptr<HRTFKernel> create(std::unique_ptr<FFTFrame> fftFrame, float frameDelay, float sampleRate) + static PassOwnPtr<HRTFKernel> create(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate) { - return wrapUnique(new HRTFKernel(std::move(fftFrame), frameDelay, sampleRate)); + return adoptPtr(new HRTFKernel(std::move(fftFrame), frameDelay, sampleRate)); } // Given two HRTFKernels, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFKernel. - static std::unique_ptr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x); + static PassOwnPtr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x); FFTFrame* fftFrame() { return m_fftFrame.get(); } @@ -74,25 +74,25 @@ double nyquist() const { return 0.5 * sampleRate(); } // Converts back into impulse-response form. - std::unique_ptr<AudioChannel> createImpulseResponse(); + PassOwnPtr<AudioChannel> createImpulseResponse(); private: // Note: this is destructive on the passed in AudioChannel. HRTFKernel(AudioChannel*, size_t fftSize, float sampleRate); - HRTFKernel(std::unique_ptr<FFTFrame> fftFrame, float frameDelay, float sampleRate) + HRTFKernel(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate) : m_fftFrame(std::move(fftFrame)) , m_frameDelay(frameDelay) , m_sampleRate(sampleRate) { } - std::unique_ptr<FFTFrame> m_fftFrame; + OwnPtr<FFTFrame> m_fftFrame; float m_frameDelay; float m_sampleRate; }; -typedef Vector<std::unique_ptr<HRTFKernel>> HRTFKernelList; +typedef Vector<OwnPtr<HRTFKernel>> HRTFKernelList; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp index af2e8a24..e8b7168e 100644 --- a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp +++ b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp
@@ -26,9 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/AudioBus.h" #include "platform/audio/MultiChannelResampler.h" -#include "wtf/PtrUtil.h" +#include "platform/audio/AudioBus.h" namespace blink { @@ -93,7 +92,7 @@ { // Create each channel's resampler. for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) - m_kernels.append(wrapUnique(new SincResampler(scaleFactor))); + m_kernels.append(adoptPtr(new SincResampler(scaleFactor))); } void MultiChannelResampler::process(AudioSourceProvider* provider, AudioBus* destination, size_t framesToProcess)
diff --git a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h index 33f02b2..2888e08 100644 --- a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h +++ b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h
@@ -32,7 +32,7 @@ #include "platform/audio/SincResampler.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -53,7 +53,7 @@ // https://bugs.webkit.org/show_bug.cgi?id=75118 // Each channel will be resampled using a high-quality SincResampler. - Vector<std::unique_ptr<SincResampler>> m_kernels; + Vector<OwnPtr<SincResampler>> m_kernels; unsigned m_numberOfChannels; };
diff --git a/third_party/WebKit/Source/platform/audio/Panner.cpp b/third_party/WebKit/Source/platform/audio/Panner.cpp index 196e071..363999dc 100644 --- a/third_party/WebKit/Source/platform/audio/Panner.cpp +++ b/third_party/WebKit/Source/platform/audio/Panner.cpp
@@ -26,22 +26,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/Panner.h" #include "platform/audio/EqualPowerPanner.h" #include "platform/audio/HRTFPanner.h" -#include "platform/audio/Panner.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader) +PassOwnPtr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader) { switch (model) { case PanningModelEqualPower: - return wrapUnique(new EqualPowerPanner(sampleRate)); + return adoptPtr(new EqualPowerPanner(sampleRate)); case PanningModelHRTF: - return wrapUnique(new HRTFPanner(sampleRate, databaseLoader)); + return adoptPtr(new HRTFPanner(sampleRate, databaseLoader)); default: ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/platform/audio/Panner.h b/third_party/WebKit/Source/platform/audio/Panner.h index 79109cb..896863a 100644 --- a/third_party/WebKit/Source/platform/audio/Panner.h +++ b/third_party/WebKit/Source/platform/audio/Panner.h
@@ -32,8 +32,8 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/build_config.h" -#include <memory> namespace blink { @@ -54,7 +54,7 @@ typedef unsigned PanningModel; - static std::unique_ptr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*); + static PassOwnPtr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*); virtual ~Panner() { };
diff --git a/third_party/WebKit/Source/platform/audio/Reverb.cpp b/third_party/WebKit/Source/platform/audio/Reverb.cpp index 5f4babda..dc7e9ea 100644 --- a/third_party/WebKit/Source/platform/audio/Reverb.cpp +++ b/third_party/WebKit/Source/platform/audio/Reverb.cpp
@@ -26,13 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/AudioBus.h" #include "platform/audio/Reverb.h" +#include <math.h> +#include "platform/audio/AudioBus.h" #include "platform/audio/VectorMath.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" -#include <math.h> -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #if OS(MACOSX) using namespace std; @@ -116,7 +116,7 @@ for (size_t i = 0; i < numResponseChannels; ++i) { AudioChannel* channel = impulseResponseBuffer->channel(i); - std::unique_ptr<ReverbConvolver> convolver = wrapUnique(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); + OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); m_convolvers.append(std::move(convolver)); convolverRenderPhase += renderSliceSize;
diff --git a/third_party/WebKit/Source/platform/audio/Reverb.h b/third_party/WebKit/Source/platform/audio/Reverb.h index 3320931..1fb29a8 100644 --- a/third_party/WebKit/Source/platform/audio/Reverb.h +++ b/third_party/WebKit/Source/platform/audio/Reverb.h
@@ -33,7 +33,6 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -61,7 +60,7 @@ size_t m_impulseResponseLength; - Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; + Vector<OwnPtr<ReverbConvolver>> m_convolvers; // For "True" stereo processing RefPtr<AudioBus> m_tempBuffer;
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp index dfa6ab7..4a59630 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp
@@ -26,16 +26,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/ReverbConvolver.h" #include "platform/ThreadSafeFunctional.h" #include "platform/audio/AudioBus.h" -#include "platform/audio/ReverbConvolver.h" #include "platform/audio/VectorMath.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -90,7 +88,7 @@ bool useDirectConvolver = !stageOffset; - std::unique_ptr<ReverbConvolverStage> stage = wrapUnique(new ReverbConvolverStage(response, totalResponseLength, reverbTotalLatency, stageOffset, stageSize, fftSize, renderPhase, renderSliceSize, &m_accumulationBuffer, useDirectConvolver)); + OwnPtr<ReverbConvolverStage> stage = adoptPtr(new ReverbConvolverStage(response, totalResponseLength, reverbTotalLatency, stageOffset, stageSize, fftSize, renderPhase, renderSliceSize, &m_accumulationBuffer, useDirectConvolver)); bool isBackgroundStage = false; @@ -118,7 +116,7 @@ // Start up background thread // FIXME: would be better to up the thread priority here. It doesn't need to be real-time, but higher than the default... if (useBackgroundThreads && m_backgroundStages.size() > 0) - m_backgroundThread = wrapUnique(Platform::current()->createThread("Reverb convolution background thread")); + m_backgroundThread = adoptPtr(Platform::current()->createThread("Reverb convolution background thread")); } ReverbConvolver::~ReverbConvolver()
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolver.h b/third_party/WebKit/Source/platform/audio/ReverbConvolver.h index 5e61ee77..07b981b 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolver.h +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolver.h
@@ -36,8 +36,8 @@ #include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbInputBuffer.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -64,8 +64,8 @@ private: void processInBackground(); - Vector<std::unique_ptr<ReverbConvolverStage>> m_stages; - Vector<std::unique_ptr<ReverbConvolverStage>> m_backgroundStages; + Vector<OwnPtr<ReverbConvolverStage>> m_stages; + Vector<OwnPtr<ReverbConvolverStage>> m_backgroundStages; size_t m_impulseResponseLength; ReverbAccumulationBuffer m_accumulationBuffer; @@ -81,7 +81,7 @@ size_t m_maxRealtimeFFTSize; // Background thread and synchronization - std::unique_ptr<WebThread> m_backgroundThread; + OwnPtr<WebThread> m_backgroundThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp index 4b3d63e..7bc04a3d 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp
@@ -26,12 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbAccumulationBuffer.h" #include "platform/audio/ReverbConvolver.h" -#include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbInputBuffer.h" #include "platform/audio/VectorMath.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -48,16 +48,16 @@ ASSERT(accumulationBuffer); if (!m_directMode) { - m_fftKernel = wrapUnique(new FFTFrame(fftSize)); + m_fftKernel = adoptPtr(new FFTFrame(fftSize)); m_fftKernel->doPaddedFFT(impulseResponse + stageOffset, stageLength); - m_fftConvolver = wrapUnique(new FFTConvolver(fftSize)); + m_fftConvolver = adoptPtr(new FFTConvolver(fftSize)); } else { ASSERT(!stageOffset); ASSERT(stageLength <= fftSize / 2); - m_directKernel = wrapUnique(new AudioFloatArray(fftSize / 2)); + m_directKernel = adoptPtr(new AudioFloatArray(fftSize / 2)); m_directKernel->copyToRange(impulseResponse, 0, stageLength); - m_directConvolver = wrapUnique(new DirectConvolver(renderSliceSize)); + m_directConvolver = adoptPtr(new DirectConvolver(renderSliceSize)); } m_temporaryBuffer.allocate(renderSliceSize);
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h index e1b99d3e..8b4983a 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h
@@ -33,7 +33,7 @@ #include "platform/audio/FFTFrame.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -63,8 +63,8 @@ int inputReadIndex() const { return m_inputReadIndex; } private: - std::unique_ptr<FFTFrame> m_fftKernel; - std::unique_ptr<FFTConvolver> m_fftConvolver; + OwnPtr<FFTFrame> m_fftKernel; + OwnPtr<FFTConvolver> m_fftConvolver; AudioFloatArray m_preDelayBuffer; @@ -80,8 +80,8 @@ AudioFloatArray m_temporaryBuffer; bool m_directMode; - std::unique_ptr<AudioFloatArray> m_directKernel; - std::unique_ptr<DirectConvolver> m_directConvolver; + OwnPtr<AudioFloatArray> m_directKernel; + OwnPtr<DirectConvolver> m_directConvolver; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/Spatializer.cpp b/third_party/WebKit/Source/platform/audio/Spatializer.cpp index ff4896c..ba11fbc3 100644 --- a/third_party/WebKit/Source/platform/audio/Spatializer.cpp +++ b/third_party/WebKit/Source/platform/audio/Spatializer.cpp
@@ -4,16 +4,14 @@ #include "platform/audio/Spatializer.h" #include "platform/audio/StereoPanner.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<Spatializer> Spatializer::create(PanningModel model, float sampleRate) +PassOwnPtr<Spatializer> Spatializer::create(PanningModel model, float sampleRate) { switch (model) { case PanningModelEqualPower: - return wrapUnique(new StereoPanner(sampleRate)); + return adoptPtr(new StereoPanner(sampleRate)); default: ASSERT_NOT_REACHED(); return nullptr;
diff --git a/third_party/WebKit/Source/platform/audio/Spatializer.h b/third_party/WebKit/Source/platform/audio/Spatializer.h index a4629a5..9da000b 100644 --- a/third_party/WebKit/Source/platform/audio/Spatializer.h +++ b/third_party/WebKit/Source/platform/audio/Spatializer.h
@@ -8,7 +8,7 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -28,7 +28,7 @@ typedef unsigned PanningModel; - static std::unique_ptr<Spatializer> create(PanningModel, float sampleRate); + static PassOwnPtr<Spatializer> create(PanningModel, float sampleRate); virtual ~Spatializer(); // Handle sample-accurate panning by AudioParam automation.
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.cpp b/third_party/WebKit/Source/platform/blob/BlobData.cpp index 4a82ea4..85c4f2e 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobData.cpp
@@ -33,13 +33,12 @@ #include "platform/UUID.h" #include "platform/blob/BlobRegistry.h" #include "platform/text/LineEnding.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -79,9 +78,9 @@ fileSystemURL = fileSystemURL.copy(); } -std::unique_ptr<BlobData> BlobData::create() +PassOwnPtr<BlobData> BlobData::create() { - return wrapUnique(new BlobData()); + return adoptPtr(new BlobData()); } void BlobData::detachFromCurrentThread() @@ -204,7 +203,7 @@ BlobRegistry::registerBlobData(m_uuid, BlobData::create()); } -BlobDataHandle::BlobDataHandle(std::unique_ptr<BlobData> data, long long size) +BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size) : m_uuid(createCanonicalUUIDString()) , m_type(data->contentType().isolatedCopy()) , m_size(size)
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.h b/third_party/WebKit/Source/platform/blob/BlobData.h index c132b95..d357358c 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.h +++ b/third_party/WebKit/Source/platform/blob/BlobData.h
@@ -35,9 +35,9 @@ #include "platform/FileMetadata.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -164,7 +164,7 @@ USING_FAST_MALLOC(BlobData); WTF_MAKE_NONCOPYABLE(BlobData); public: - static std::unique_ptr<BlobData> create(); + static PassOwnPtr<BlobData> create(); // Detaches from current thread so that it can be passed to another thread. void detachFromCurrentThread(); @@ -208,7 +208,7 @@ } // For initial creation. - static PassRefPtr<BlobDataHandle> create(std::unique_ptr<BlobData> data, long long size) + static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size) { return adoptRef(new BlobDataHandle(std::move(data), size)); } @@ -227,7 +227,7 @@ private: BlobDataHandle(); - BlobDataHandle(std::unique_ptr<BlobData>, long long size); + BlobDataHandle(PassOwnPtr<BlobData>, long long size); BlobDataHandle(const String& uuid, const String& type, long long size); const String m_uuid;
diff --git a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp index 8ac1d5ac..e7bef25 100644 --- a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
@@ -6,8 +6,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -28,7 +28,7 @@ EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12)); - std::unique_ptr<char[]> large_data = wrapArrayUnique(new char[kMaxConsolidatedItemSizeInBytes]); + OwnPtr<char[]> large_data = adoptArrayPtr(new char[kMaxConsolidatedItemSizeInBytes]); data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes); EXPECT_EQ(2u, data.m_items.size());
diff --git a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp index 6458fd9..c0d11582 100644 --- a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
@@ -48,7 +48,6 @@ #include "wtf/Threading.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -89,7 +88,7 @@ originMap()->remove(url.getString()); } -void BlobRegistry::registerBlobData(const String& uuid, std::unique_ptr<BlobData> data) +void BlobRegistry::registerBlobData(const String& uuid, PassOwnPtr<BlobData> data) { blobRegistry()->registerBlobData(uuid, WebBlobData(std::move(data))); }
diff --git a/third_party/WebKit/Source/platform/blob/BlobRegistry.h b/third_party/WebKit/Source/platform/blob/BlobRegistry.h index 3631adc..603cd52 100644 --- a/third_party/WebKit/Source/platform/blob/BlobRegistry.h +++ b/third_party/WebKit/Source/platform/blob/BlobRegistry.h
@@ -34,8 +34,8 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> namespace blink { @@ -50,7 +50,7 @@ STATIC_ONLY(BlobRegistry); public: // Methods for controlling Blobs. - static void registerBlobData(const String& uuid, std::unique_ptr<BlobData>); + static void registerBlobData(const String& uuid, PassOwnPtr<BlobData>); static void addBlobDataRef(const String& uuid); static void removeBlobDataRef(const String& uuid); static void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr<BlobDataHandle>);
diff --git a/third_party/WebKit/Source/platform/exported/Platform.cpp b/third_party/WebKit/Source/platform/exported/Platform.cpp index c0f50a0..1eaf688 100644 --- a/third_party/WebKit/Source/platform/exported/Platform.cpp +++ b/third_party/WebKit/Source/platform/exported/Platform.cpp
@@ -40,6 +40,7 @@ #include "public/platform/ServiceRegistry.h" #include "public/platform/WebPrerenderingSupport.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp index a5dd44f..50453e7 100644 --- a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp +++ b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp
@@ -27,26 +27,24 @@ #include "public/platform/WebGestureCurve.h" #include "public/platform/WebGestureCurveTarget.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<WebActiveGestureAnimation> WebActiveGestureAnimation::createAtAnimationStart(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target) +PassOwnPtr<WebActiveGestureAnimation> WebActiveGestureAnimation::createAtAnimationStart(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target) { - return wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, 0, true)); + return adoptPtr(new WebActiveGestureAnimation(std::move(curve), target, 0, true)); } -std::unique_ptr<WebActiveGestureAnimation> WebActiveGestureAnimation::createWithTimeOffset(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime) +PassOwnPtr<WebActiveGestureAnimation> WebActiveGestureAnimation::createWithTimeOffset(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime) { - return wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, startTime, false)); + return adoptPtr(new WebActiveGestureAnimation(std::move(curve), target, startTime, false)); } WebActiveGestureAnimation::~WebActiveGestureAnimation() { } -WebActiveGestureAnimation::WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime, bool waitingForFirstTick) +WebActiveGestureAnimation::WebActiveGestureAnimation(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime, bool waitingForFirstTick) : m_startTime(startTime) , m_waitingForFirstTick(waitingForFirstTick) , m_curve(std::move(curve))
diff --git a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h index 9ca0bec..4510ff8 100644 --- a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h +++ b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h
@@ -29,7 +29,8 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -44,19 +45,19 @@ USING_FAST_MALLOC(WebActiveGestureAnimation); WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); public: - static std::unique_ptr<WebActiveGestureAnimation> createAtAnimationStart(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*); - static std::unique_ptr<WebActiveGestureAnimation> createWithTimeOffset(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*, double startTime); + static PassOwnPtr<WebActiveGestureAnimation> createAtAnimationStart(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*); + static PassOwnPtr<WebActiveGestureAnimation> createWithTimeOffset(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*, double startTime); ~WebActiveGestureAnimation(); bool animate(double time); private: // Assumes a valid WebGestureCurveTarget that outlives the animation. - WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*, double startTime, bool waitingForFirstTick); + WebActiveGestureAnimation(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*, double startTime, bool waitingForFirstTick); double m_startTime; bool m_waitingForFirstTick; - std::unique_ptr<WebGestureCurve> m_curve; + OwnPtr<WebGestureCurve> m_curve; WebGestureCurveTarget* m_target; };
diff --git a/third_party/WebKit/Source/platform/exported/WebBlobData.cpp b/third_party/WebKit/Source/platform/exported/WebBlobData.cpp index 942d2aec..6b67d588 100644 --- a/third_party/WebKit/Source/platform/exported/WebBlobData.cpp +++ b/third_party/WebKit/Source/platform/exported/WebBlobData.cpp
@@ -32,7 +32,7 @@ #include "public/platform/WebBlobData.h" #include "platform/blob/BlobData.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -94,18 +94,18 @@ return m_private->contentType(); } -WebBlobData::WebBlobData(std::unique_ptr<BlobData> data) +WebBlobData::WebBlobData(PassOwnPtr<BlobData> data) : m_private(std::move(data)) { } -WebBlobData& WebBlobData::operator=(std::unique_ptr<BlobData> data) +WebBlobData& WebBlobData::operator=(PassOwnPtr<BlobData> data) { m_private.reset(std::move(data)); return *this; } -WebBlobData::operator std::unique_ptr<BlobData>() +WebBlobData::operator PassOwnPtr<BlobData>() { return m_private.release(); }
diff --git a/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp b/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp index 2524e147..de907f6e 100644 --- a/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp +++ b/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp
@@ -6,13 +6,12 @@ #include "platform/ContentSettingCallbacks.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCallbacksPrivate> { public: - static PassRefPtr<WebContentSettingCallbacksPrivate> create(std::unique_ptr<ContentSettingCallbacks> callbacks) + static PassRefPtr<WebContentSettingCallbacksPrivate> create(PassOwnPtr<ContentSettingCallbacks> callbacks) { return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callbacks))); } @@ -20,11 +19,11 @@ ContentSettingCallbacks* callbacks() { return m_callbacks.get(); } private: - WebContentSettingCallbacksPrivate(std::unique_ptr<ContentSettingCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } - std::unique_ptr<ContentSettingCallbacks> m_callbacks; + WebContentSettingCallbacksPrivate(PassOwnPtr<ContentSettingCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } + OwnPtr<ContentSettingCallbacks> m_callbacks; }; -WebContentSettingCallbacks::WebContentSettingCallbacks(std::unique_ptr<ContentSettingCallbacks>&& callbacks) +WebContentSettingCallbacks::WebContentSettingCallbacks(PassOwnPtr<ContentSettingCallbacks>&& callbacks) { m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks)); }
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp index b174f45..eb1793b6 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp
@@ -32,10 +32,9 @@ #include "public/platform/WebCryptoAlgorithmParams.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/ThreadSafeRefCounted.h" -#include <memory> namespace blink { @@ -296,17 +295,17 @@ class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithmPrivate> { public: - WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoAlgorithmParams> params) + WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoAlgorithmParams> params) : id(id) , params(std::move(params)) { } WebCryptoAlgorithmId id; - std::unique_ptr<WebCryptoAlgorithmParams> params; + OwnPtr<WebCryptoAlgorithmParams> params; }; -WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoAlgorithmParams> params) +WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoAlgorithmParams> params) : m_private(adoptRef(new WebCryptoAlgorithmPrivate(id, std::move(params)))) { } @@ -318,7 +317,7 @@ WebCryptoAlgorithm WebCryptoAlgorithm::adoptParamsAndCreate(WebCryptoAlgorithmId id, WebCryptoAlgorithmParams* params) { - return WebCryptoAlgorithm(id, wrapUnique(params)); + return WebCryptoAlgorithm(id, adoptPtr(params)); } const WebCryptoAlgorithmInfo* WebCryptoAlgorithm::lookupAlgorithmInfo(WebCryptoAlgorithmId id)
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp index 07437ec..97660f7 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp
@@ -33,15 +33,14 @@ #include "public/platform/WebCryptoAlgorithm.h" #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebCryptoKeyAlgorithm.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" -#include <memory> namespace blink { class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> { public: - WebCryptoKeyPrivate(std::unique_ptr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) + WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) : handle(std::move(handle)) , type(type) , extractable(extractable) @@ -51,7 +50,7 @@ ASSERT(!algorithm.isNull()); } - const std::unique_ptr<WebCryptoKeyHandle> handle; + const OwnPtr<WebCryptoKeyHandle> handle; const WebCryptoKeyType type; const bool extractable; const WebCryptoKeyAlgorithm algorithm; @@ -61,7 +60,7 @@ WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) { WebCryptoKey key; - key.m_private = adoptRef(new WebCryptoKeyPrivate(wrapUnique(handle), type, extractable, algorithm, usages)); + key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, usages)); return key; }
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp index 771722e2..45e406a 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp
@@ -30,9 +30,8 @@ #include "public/platform/WebCryptoKeyAlgorithm.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" -#include <memory> namespace blink { @@ -44,24 +43,24 @@ class WebCryptoKeyAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoKeyAlgorithmPrivate> { public: - WebCryptoKeyAlgorithmPrivate(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoKeyAlgorithmParams> params) + WebCryptoKeyAlgorithmPrivate(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoKeyAlgorithmParams> params) : id(id) , params(std::move(params)) { } WebCryptoAlgorithmId id; - std::unique_ptr<WebCryptoKeyAlgorithmParams> params; + OwnPtr<WebCryptoKeyAlgorithmParams> params; }; -WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoKeyAlgorithmParams> params) +WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoKeyAlgorithmParams> params) : m_private(adoptRef(new WebCryptoKeyAlgorithmPrivate(id, std::move(params)))) { } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::adoptParamsAndCreate(WebCryptoAlgorithmId id, WebCryptoKeyAlgorithmParams* params) { - return WebCryptoKeyAlgorithm(id, wrapUnique(params)); + return WebCryptoKeyAlgorithm(id, adoptPtr(params)); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes(WebCryptoAlgorithmId id, unsigned short keyLengthBits) @@ -70,14 +69,14 @@ // FIXME: Move this somewhere more general. if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoAesKeyAlgorithmParams(keyLengthBits))); + return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoAesKeyAlgorithmParams(keyLengthBits))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(WebCryptoAlgorithmId hash, unsigned keyLengthBits) { if (!WebCryptoAlgorithm::isHash(hash)) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, wrapUnique(new WebCryptoHmacKeyAlgorithmParams(createHash(hash), keyLengthBits))); + return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, adoptPtr(new WebCryptoHmacKeyAlgorithmParams(createHash(hash), keyLengthBits))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(WebCryptoAlgorithmId id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize, WebCryptoAlgorithmId hash) @@ -85,12 +84,12 @@ // FIXME: Verify that id is an RSA algorithm which expects a hash if (!WebCryptoAlgorithm::isHash(hash)) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash)))); + return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithmParams(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash)))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(WebCryptoAlgorithmId id, WebCryptoNamedCurve namedCurve) { - return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoEcKeyAlgorithmParams(namedCurve))); + return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoEcKeyAlgorithmParams(namedCurve))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams(WebCryptoAlgorithmId id)
diff --git a/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp b/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp index 5c87021..3e757f9e 100644 --- a/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp
@@ -5,9 +5,8 @@ #include "public/platform/WebDataConsumerHandle.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" + #include <algorithm> -#include <memory> #include <string.h> namespace blink { @@ -22,10 +21,10 @@ ASSERT(ThreadState::current()); } -std::unique_ptr<WebDataConsumerHandle::Reader> WebDataConsumerHandle::obtainReader(WebDataConsumerHandle::Client* client) +PassOwnPtr<WebDataConsumerHandle::Reader> WebDataConsumerHandle::obtainReader(WebDataConsumerHandle::Client* client) { ASSERT(ThreadState::current()); - return wrapUnique(obtainReaderInternal(client)); + return adoptPtr(obtainReaderInternal(client)); } WebDataConsumerHandle::Result WebDataConsumerHandle::Reader::read(void* data, size_t size, Flags flags, size_t* readSize)
diff --git a/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp b/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp index 92e8975..410ccbc 100644 --- a/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp +++ b/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp
@@ -37,16 +37,15 @@ #include "public/platform/WebFileSystemEntry.h" #include "public/platform/WebFileWriter.h" #include "public/platform/WebString.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { class WebFileSystemCallbacksPrivate : public RefCounted<WebFileSystemCallbacksPrivate> { public: - static PassRefPtr<WebFileSystemCallbacksPrivate> create(std::unique_ptr<AsyncFileSystemCallbacks> callbacks) + static PassRefPtr<WebFileSystemCallbacksPrivate> create(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { return adoptRef(new WebFileSystemCallbacksPrivate(std::move(callbacks))); } @@ -54,11 +53,11 @@ AsyncFileSystemCallbacks* callbacks() { return m_callbacks.get(); } private: - WebFileSystemCallbacksPrivate(std::unique_ptr<AsyncFileSystemCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } - std::unique_ptr<AsyncFileSystemCallbacks> m_callbacks; + WebFileSystemCallbacksPrivate(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } + OwnPtr<AsyncFileSystemCallbacks> m_callbacks; }; -WebFileSystemCallbacks::WebFileSystemCallbacks(std::unique_ptr<AsyncFileSystemCallbacks>&& callbacks) +WebFileSystemCallbacks::WebFileSystemCallbacks(PassOwnPtr<AsyncFileSystemCallbacks>&& callbacks) { m_private = WebFileSystemCallbacksPrivate::create(std::move(callbacks)); } @@ -97,7 +96,7 @@ ASSERT(!m_private.isNull()); // It's important to create a BlobDataHandle that refers to the platform file path prior // to return from this method so the underlying file will not be deleted. - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendFile(webFileInfo.platformPath, 0, webFileInfo.length, invalidFileTime()); RefPtr<BlobDataHandle> snapshotBlob = BlobDataHandle::create(std::move(blobData), webFileInfo.length); @@ -136,7 +135,7 @@ void WebFileSystemCallbacks::didCreateFileWriter(WebFileWriter* webFileWriter, long long length) { ASSERT(!m_private.isNull()); - m_private->callbacks()->didCreateFileWriter(wrapUnique(webFileWriter), length); + m_private->callbacks()->didCreateFileWriter(adoptPtr(webFileWriter), length); m_private.reset(); }
diff --git a/third_party/WebKit/Source/platform/exported/WebImage.cpp b/third_party/WebKit/Source/platform/exported/WebImage.cpp index 31dc8d7..bb14044 100644 --- a/third_party/WebKit/Source/platform/exported/WebImage.cpp +++ b/third_party/WebKit/Source/platform/exported/WebImage.cpp
@@ -36,17 +36,18 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "third_party/skia/include/core/SkImage.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include <algorithm> -#include <memory> namespace blink { WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) { RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); - std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); + OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); if (!decoder) return WebImage(); @@ -90,7 +91,7 @@ const size_t maxFrameCount = 8; RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); - std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); + OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); if (!decoder) return WebVector<WebImage>();
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp index 9573897..468f919 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp
@@ -31,9 +31,9 @@ #include "public/platform/WebMediaStreamSource.h" #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebString.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -41,12 +41,12 @@ class ExtraDataContainer : public MediaStreamDescriptor::ExtraData { public: - ExtraDataContainer(std::unique_ptr<WebMediaStream::ExtraData> extraData) : m_extraData(std::move(extraData)) { } + ExtraDataContainer(PassOwnPtr<WebMediaStream::ExtraData> extraData) : m_extraData(std::move(extraData)) { } WebMediaStream::ExtraData* getExtraData() { return m_extraData.get(); } private: - std::unique_ptr<WebMediaStream::ExtraData> m_extraData; + OwnPtr<WebMediaStream::ExtraData> m_extraData; }; } // namespace @@ -76,7 +76,7 @@ void WebMediaStream::setExtraData(ExtraData* extraData) { - m_private->setExtraData(wrapUnique(new ExtraDataContainer(wrapUnique(extraData)))); + m_private->setExtraData(adoptPtr(new ExtraDataContainer(adoptPtr(extraData)))); } void WebMediaStream::audioTracks(WebVector<WebMediaStreamTrack>& webTracks) const
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp index be39614..59996c8 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp
@@ -35,9 +35,8 @@ #include "public/platform/WebAudioDestinationConsumer.h" #include "public/platform/WebMediaConstraints.h" #include "public/platform/WebString.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -45,12 +44,12 @@ class ExtraDataContainer : public MediaStreamSource::ExtraData { public: - ExtraDataContainer(std::unique_ptr<WebMediaStreamSource::ExtraData> extraData) : m_extraData(std::move(extraData)) { } + ExtraDataContainer(PassOwnPtr<WebMediaStreamSource::ExtraData> extraData) : m_extraData(std::move(extraData)) { } WebMediaStreamSource::ExtraData* getExtraData() { return m_extraData.get(); } private: - std::unique_ptr<WebMediaStreamSource::ExtraData> m_extraData; + OwnPtr<WebMediaStreamSource::ExtraData> m_extraData; }; } // namespace @@ -155,7 +154,7 @@ if (extraData) extraData->setOwner(m_private.get()); - m_private->setExtraData(wrapUnique(new ExtraDataContainer(wrapUnique(extraData)))); + m_private->setExtraData(adoptPtr(new ExtraDataContainer(adoptPtr(extraData)))); } WebMediaConstraints WebMediaStreamSource::constraints()
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp index 7f3468f..9111c56 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp
@@ -30,8 +30,6 @@ #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamSource.h" #include "public/platform/WebString.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -39,7 +37,7 @@ class TrackDataContainer : public MediaStreamComponent::TrackData { public: - explicit TrackDataContainer(std::unique_ptr<WebMediaStreamTrack::TrackData> extraData) + explicit TrackDataContainer(PassOwnPtr<WebMediaStreamTrack::TrackData> extraData) : m_extraData(std::move(extraData)) { } @@ -51,7 +49,7 @@ } private: - std::unique_ptr<WebMediaStreamTrack::TrackData> m_extraData; + OwnPtr<WebMediaStreamTrack::TrackData> m_extraData; }; } // namespace @@ -123,7 +121,7 @@ { ASSERT(!m_private.isNull()); - m_private->setTrackData(wrapUnique(new TrackDataContainer(wrapUnique(extraData)))); + m_private->setTrackData(adoptPtr(new TrackDataContainer(adoptPtr(extraData)))); } void WebMediaStreamTrack::setSourceProvider(WebAudioSourceProvider* provider)
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp index 700e14c7..8e9b69b 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp
@@ -28,6 +28,7 @@ #include "platform/mediastream/MediaStreamTrackSourcesRequest.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebSourceInfo.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebPrerender.cpp b/third_party/WebKit/Source/platform/exported/WebPrerender.cpp index 5f23fca..f7d33ee 100644 --- a/third_party/WebKit/Source/platform/exported/WebPrerender.cpp +++ b/third_party/WebKit/Source/platform/exported/WebPrerender.cpp
@@ -32,8 +32,6 @@ #include "platform/Prerender.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -49,11 +47,11 @@ private: explicit ExtraDataContainer(WebPrerender::ExtraData* extraData) - : m_extraData(wrapUnique(extraData)) + : m_extraData(adoptPtr(extraData)) { } - std::unique_ptr<WebPrerender::ExtraData> m_extraData; + OwnPtr<WebPrerender::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp index 513c92d7..119fff05 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp
@@ -32,6 +32,7 @@ #include "platform/mediastream/RTCSessionDescriptionRequest.h" #include "public/platform/WebRTCSessionDescription.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp index db537f4..10452de7 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp
@@ -35,6 +35,7 @@ #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebRTCStatsResponse.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp b/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp index dd47529..e3ad7e38 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp
@@ -25,6 +25,7 @@ #include "public/platform/WebRTCStatsResponse.h" #include "platform/mediastream/RTCStatsResponseBase.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp index 166c6cc..1fdc7b4f 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp
@@ -31,6 +31,7 @@ #include "public/platform/WebRTCVoidRequest.h" #include "platform/mediastream/RTCVoidRequest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp index 1cc919f..5f39f1b 100644 --- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp +++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp
@@ -28,14 +28,12 @@ #include "platform/exported/WebScrollbarThemeClientImpl.h" #include "platform/scroll/ScrollbarTheme.h" #include "public/platform/WebScrollbar.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::create(ScrollbarTheme& theme) +PassOwnPtr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::create(ScrollbarTheme& theme) { - return wrapUnique(new WebScrollbarThemeGeometryNative(theme)); + return adoptPtr(new WebScrollbarThemeGeometryNative(theme)); } WebScrollbarThemeGeometryNative::WebScrollbarThemeGeometryNative(ScrollbarTheme& theme)
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h index cb0ca43..b280628 100644 --- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h +++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h
@@ -31,7 +31,7 @@ #include "public/platform/WebScrollbarThemeGeometry.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -42,7 +42,7 @@ USING_FAST_MALLOC(WebScrollbarThemeGeometryNative); WTF_MAKE_NONCOPYABLE(WebScrollbarThemeGeometryNative); public: - static std::unique_ptr<WebScrollbarThemeGeometryNative> create(ScrollbarTheme&); + static PassOwnPtr<WebScrollbarThemeGeometryNative> create(ScrollbarTheme&); bool hasButtons(WebScrollbar*) override; bool hasThumb(WebScrollbar*) override;
diff --git a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp index 54776d2..c2592d82 100644 --- a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp
@@ -39,8 +39,6 @@ #include "public/platform/WebURL.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -56,11 +54,11 @@ private: explicit ExtraDataContainer(WebURLRequest::ExtraData* extraData) - : m_extraData(wrapUnique(extraData)) + : m_extraData(adoptPtr(extraData)) { } - std::unique_ptr<WebURLRequest::ExtraData> m_extraData; + OwnPtr<WebURLRequest::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp b/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp index 2dda37a..1766df4 100644 --- a/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp +++ b/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp
@@ -39,9 +39,7 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLLoadTiming.h" #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -57,11 +55,11 @@ private: explicit ExtraDataContainer(WebURLResponse::ExtraData* extraData) - : m_extraData(wrapUnique(extraData)) + : m_extraData(adoptPtr(extraData)) { } - std::unique_ptr<WebURLResponse::ExtraData> m_extraData; + OwnPtr<WebURLResponse::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index 3a7a8db2..ac4a0eb3 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -50,12 +50,10 @@ #include "public/platform/Platform.h" #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" -#include <memory> using namespace WTF; @@ -69,9 +67,9 @@ } #endif // !OS(WIN) && !OS(LINUX) -typedef HashMap<unsigned, std::unique_ptr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; +typedef HashMap<unsigned, OwnPtr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; typedef HashMap<FontCacheKey, SizedFontPlatformDataSet, FontCacheKeyHash, FontCacheKeyTraits> FontPlatformDataCache; -typedef HashMap<FallbackListCompositeKey, std::unique_ptr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; +typedef HashMap<FallbackListCompositeKey, OwnPtr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; static FontPlatformDataCache* gFontPlatformDataCache = nullptr; static FallbackListShaperCache* gFallbackListShaperCache = nullptr; @@ -120,7 +118,7 @@ // Take a different size instance of the same font before adding an entry to |sizedFont|. FontPlatformData* anotherSize = wasEmpty ? nullptr : sizedFonts->begin()->value.get(); auto addResult = sizedFonts->add(roundedSize, nullptr); - std::unique_ptr<FontPlatformData>* found = &addResult.storedValue->value; + OwnPtr<FontPlatformData>* found = &addResult.storedValue->value; if (addResult.isNewEntry) { if (wasEmpty) *found = createFontPlatformData(fontDescription, creationParams, size); @@ -143,19 +141,19 @@ if (result) { // Cache the result under the old name. auto adding = &gFontPlatformDataCache->add(key, SizedFontPlatformDataSet()).storedValue->value; - adding->set(roundedSize, wrapUnique(new FontPlatformData(*result))); + adding->set(roundedSize, adoptPtr(new FontPlatformData(*result))); } } return result; } -std::unique_ptr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) +PassOwnPtr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { #if OS(MACOSX) return createFontPlatformData(fontDescription, creationParams, fontSize); #else - return wrapUnique(new FontPlatformData(fontPlatformData, fontSize)); + return adoptPtr(new FontPlatformData(fontPlatformData, fontSize)); #endif } @@ -168,7 +166,7 @@ ShapeCache* result = nullptr; if (it == gFallbackListShaperCache->end()) { result = new ShapeCache(); - gFallbackListShaperCache->set(key, wrapUnique(result)); + gFallbackListShaperCache->set(key, adoptPtr(result)); } else { result = it->value.get(); }
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.h b/third_party/WebKit/Source/platform/fonts/FontCache.h index 189d3e0..52bb119 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.h +++ b/third_party/WebKit/Source/platform/fonts/FontCache.h
@@ -44,7 +44,6 @@ #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" #include <limits.h> -#include <memory> #include "SkFontMgr.h" @@ -173,8 +172,8 @@ FontPlatformData* getFontPlatformData(const FontDescription&, const FontFaceCreationParams&, bool checkingAlternateName = false); // These methods are implemented by each platform. - std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize); - std::unique_ptr<FontPlatformData> scaleFontPlatformData(const FontPlatformData&, const FontDescription&, const FontFaceCreationParams&, float fontSize); + PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize); + PassOwnPtr<FontPlatformData> scaleFontPlatformData(const FontPlatformData&, const FontDescription&, const FontFaceCreationParams&, float fontSize); // Implemented on skia platforms. PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFaceCreationParams&, CString& name);
diff --git a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp index c38d495f..5b80c62 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp
@@ -39,8 +39,7 @@ #include "platform/fonts/WebFontDecoder.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -57,7 +56,7 @@ return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation); } -std::unique_ptr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer, String& otsParseMessage) +PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer, String& otsParseMessage) { DCHECK(buffer); WebFontDecoder decoder; @@ -66,7 +65,7 @@ otsParseMessage = decoder.getErrorString(); return nullptr; } - return wrapUnique(new FontCustomPlatformData(typeface.release())); + return adoptPtr(new FontCustomPlatformData(typeface.release())); } bool FontCustomPlatformData::supportsFormat(const String& format)
diff --git a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h index 022879b..dc11a4c 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h +++ b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h
@@ -39,7 +39,6 @@ #include "wtf/Noncopyable.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> class SkTypeface; @@ -52,7 +51,7 @@ USING_FAST_MALLOC(FontCustomPlatformData); WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: - static std::unique_ptr<FontCustomPlatformData> create(SharedBuffer*, String& otsParseMessage); + static PassOwnPtr<FontCustomPlatformData> create(SharedBuffer*, String& otsParseMessage); ~FontCustomPlatformData(); FontPlatformData fontPlatformData(float size, bool bold, bool italic, FontOrientation = FontOrientation::Horizontal);
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h b/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h index f4225f0..b5e412d 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h +++ b/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h
@@ -34,9 +34,9 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/HashMap.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/Unicode.h" -#include <memory> namespace blink { @@ -93,7 +93,7 @@ bool m_filledPrimaryPage; GlyphMetricsPage m_primaryPage; // We optimize for the page that contains glyph indices 0-255. - std::unique_ptr<HashMap<int, std::unique_ptr<GlyphMetricsPage>>> m_pages; + OwnPtr<HashMap<int, OwnPtr<GlyphMetricsPage>>> m_pages; }; template<> inline float GlyphMetricsMap<float>::unknownMetrics() @@ -119,10 +119,10 @@ if (page) return page; } else { - m_pages = wrapUnique(new HashMap<int, std::unique_ptr<GlyphMetricsPage>>); + m_pages = adoptPtr(new HashMap<int, OwnPtr<GlyphMetricsPage>>); } page = new GlyphMetricsPage; - m_pages->set(pageNumber, wrapUnique(page)); + m_pages->set(pageNumber, adoptPtr(page)); } // Fill in the whole page with the unknown glyph information.
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp index 46238b2..d0b99cf 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp +++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
@@ -31,11 +31,9 @@ #include "platform/fonts/SegmentedFontData.h" #include "platform/fonts/SimpleFontData.h" #include "platform/fonts/opentype/OpenTypeVerticalData.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdio.h> namespace blink { @@ -357,7 +355,7 @@ #if ENABLE(ASSERT) child->m_pageNumber = m_pageNumber; #endif - m_children.set(fontData, wrapUnique(child)); + m_children.set(fontData, adoptPtr(child)); fontData->setMaxGlyphPageTreeLevel(max(fontData->maxGlyphPageTreeLevel(), child->m_level)); child->initializePage(fontData, pageNumber); return child; @@ -371,7 +369,7 @@ return m_systemFallbackChild.get(); SystemFallbackGlyphPageTreeNode* child = new SystemFallbackGlyphPageTreeNode(this); - m_systemFallbackChild = wrapUnique(child); + m_systemFallbackChild = adoptPtr(child); #if ENABLE(ASSERT) child->m_pageNumber = m_pageNumber; #endif @@ -384,7 +382,7 @@ return; // Prune any branch that contains this FontData. - if (std::unique_ptr<GlyphPageTreeNode> node = m_children.take(fontData)) { + if (OwnPtr<GlyphPageTreeNode> node = m_children.take(fontData)) { if (unsigned customFontCount = node->m_customFontCount + 1) { for (GlyphPageTreeNode* curr = this; curr; curr = curr->m_parent) curr->m_customFontCount -= customFontCount; @@ -413,7 +411,7 @@ m_page->removePerGlyphFontData(fontData); // Prune any branch that contains this FontData. - if (std::unique_ptr<GlyphPageTreeNode> node = m_children.take(fontData)) { + if (OwnPtr<GlyphPageTreeNode> node = m_children.take(fontData)) { if (unsigned customFontCount = node->m_customFontCount) { for (GlyphPageTreeNode* curr = this; curr; curr = curr->m_parent) curr->m_customFontCount -= customFontCount;
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h index 3954e36..5926e2b 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h +++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h
@@ -32,10 +32,11 @@ #include "platform/fonts/GlyphPage.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/Unicode.h" -#include <memory> #include <string.h> + #include <unicode/uscript.h> namespace blink { @@ -133,9 +134,9 @@ static GlyphPageTreeNode* pageZeroRoot; RefPtr<GlyphPage> m_page; - typedef HashMap<const FontData*, std::unique_ptr<GlyphPageTreeNode>> GlyphPageTreeNodeMap; + typedef HashMap<const FontData*, OwnPtr<GlyphPageTreeNode>> GlyphPageTreeNodeMap; GlyphPageTreeNodeMap m_children; - std::unique_ptr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; + OwnPtr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; }; class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNodeBase {
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp b/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp index 2f40b00..fe03220 100644 --- a/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp
@@ -4,12 +4,10 @@ #include "OrientationIterator.h" -#include "wtf/PtrUtil.h" - namespace blink { OrientationIterator::OrientationIterator(const UChar* buffer, unsigned bufferSize, FontOrientation runOrientation) - : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_atEnd(bufferSize == 0) {
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIterator.h b/third_party/WebKit/Source/platform/fonts/OrientationIterator.h index a67650a..30ec83b 100644 --- a/third_party/WebKit/Source/platform/fonts/OrientationIterator.h +++ b/third_party/WebKit/Source/platform/fonts/OrientationIterator.h
@@ -10,7 +10,6 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -28,7 +27,7 @@ bool consume(unsigned* orientationLimit, RenderOrientation*); private: - std::unique_ptr<UTF16TextIterator> m_utf16Iterator; + OwnPtr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; bool m_atEnd; };
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp index efed5b90..e18b729 100644 --- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp +++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
@@ -38,11 +38,9 @@ #include "platform/fonts/VDMXParser.h" #include "platform/geometry/FloatRect.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/Unicode.h" -#include <memory> #include <unicode/unorm.h> #include <unicode/utf16.h> @@ -345,9 +343,9 @@ || fontData->m_derivedFontData->verticalRightOrientation == this; } -std::unique_ptr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::create(bool forCustomFont) +PassOwnPtr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::create(bool forCustomFont) { - return wrapUnique(new DerivedFontData(forCustomFont)); + return adoptPtr(new DerivedFontData(forCustomFont)); } SimpleFontData::DerivedFontData::~DerivedFontData()
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h index 9cbeb8b..1403a8e 100644 --- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h +++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h
@@ -35,9 +35,9 @@ #include "platform/fonts/TypesettingFeatures.h" #include "platform/fonts/opentype/OpenTypeVerticalData.h" #include "platform/geometry/FloatRect.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -144,7 +144,7 @@ FontPlatformData m_platformData; - mutable std::unique_ptr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; + mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; mutable GlyphMetricsMap<float> m_glyphToWidthMap; bool m_isTextOrientationFallback; @@ -161,7 +161,7 @@ USING_FAST_MALLOC(DerivedFontData); WTF_MAKE_NONCOPYABLE(DerivedFontData); public: - static std::unique_ptr<DerivedFontData> create(bool forCustomFont); + static PassOwnPtr<DerivedFontData> create(bool forCustomFont); ~DerivedFontData(); bool forCustomFont; @@ -177,7 +177,7 @@ } }; - mutable std::unique_ptr<DerivedFontData> m_derivedFontData; + mutable OwnPtr<DerivedFontData> m_derivedFontData; RefPtr<CustomFontData> m_customFontData; }; @@ -193,7 +193,7 @@ bounds = platformBoundsForGlyph(glyph); if (!m_glyphToBoundsMap) - m_glyphToBoundsMap = wrapUnique(new GlyphMetricsMap<FloatRect>); + m_glyphToBoundsMap = adoptPtr(new GlyphMetricsMap<FloatRect>); m_glyphToBoundsMap->setMetricsForGlyph(glyph, bounds); return bounds; }
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp index 88fd1e5..2e13587 100644 --- a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp
@@ -4,13 +4,12 @@ #include "SmallCapsIterator.h" -#include "wtf/PtrUtil.h" #include <unicode/utypes.h> namespace blink { SmallCapsIterator::SmallCapsIterator(const UChar* buffer, unsigned bufferSize) - : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_nextUChar32(0) , m_atEnd(bufferSize == 0)
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h index c262719..b689d3a 100644 --- a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h +++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h
@@ -10,7 +10,6 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -28,7 +27,7 @@ bool consume(unsigned* capsLimit, SmallCapsBehavior*); private: - std::unique_ptr<UTF16TextIterator> m_utf16Iterator; + OwnPtr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; UChar32 m_nextUChar32; bool m_atEnd;
diff --git a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp index fa780125..44dcceb 100644 --- a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp
@@ -4,7 +4,6 @@ #include "SymbolsIterator.h" -#include "wtf/PtrUtil.h" #include <unicode/uchar.h> #include <unicode/uniset.h> @@ -13,7 +12,7 @@ using namespace WTF::Unicode; SymbolsIterator::SymbolsIterator(const UChar* buffer, unsigned bufferSize) - : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_nextChar(0) , m_atEnd(bufferSize == 0)
diff --git a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h index 01dcdb5..db5ccc0 100644 --- a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h +++ b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h
@@ -11,7 +11,6 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> namespace blink { @@ -26,7 +25,7 @@ private: FontFallbackPriority fontFallbackPriorityForCharacter(UChar32); - std::unique_ptr<UTF16TextIterator> m_utf16Iterator; + OwnPtr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; UChar32 m_nextChar; bool m_atEnd;
diff --git a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm index 3f14d83..26ff434 100644 --- a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm +++ b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm
@@ -41,9 +41,7 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> // Forward declare Mac SPIs. // Request for public API: rdar://13803570 @@ -204,7 +202,7 @@ return getFontData(fontDescription, lucidaGrandeStr, false, shouldRetain); } -std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { NSFontTraitMask traits = fontDescription.style() ? NSFontItalicTrait : 0; @@ -234,7 +232,7 @@ // Out-of-process loading occurs for registered fonts stored in non-system locations. // When loading fails, we do not want to use the returned FontPlatformData since it will not have // a valid SkTypeface. - std::unique_ptr<FontPlatformData> platformData = wrapUnique(new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); + OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); if (!platformData->typeface()) { return nullptr; }
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h index 51d75cc..dcab4f03 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h
@@ -30,6 +30,7 @@ #include "platform/geometry/FloatRect.h" #include "platform/text/TextRun.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp index 4475685..de852dd 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -10,8 +10,6 @@ #include "platform/fonts/shaping/CachingWordShapeIterator.h" #include "platform/fonts/shaping/ShapeResultTestInfo.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -28,13 +26,13 @@ font.update(nullptr); ASSERT_TRUE(font.canShapeWordByWord()); fallbackFonts = nullptr; - cache = wrapUnique(new ShapeCache()); + cache = adoptPtr(new ShapeCache()); } FontCachePurgePreventer fontCachePurgePreventer; FontDescription fontDescription; Font font; - std::unique_ptr<ShapeCache> cache; + OwnPtr<ShapeCache> cache; HashSet<const SimpleFontData*>* fallbackFonts; unsigned startIndex = 0; unsigned numGlyphs = 0; @@ -119,7 +117,7 @@ GlyphBuffer glyphBuffer; shaper.fillGlyphBuffer(&font, textRun, fallbackFonts, &glyphBuffer, 0, 3); - std::unique_ptr<ShapeCache> referenceCache = wrapUnique(new ShapeCache()); + OwnPtr<ShapeCache> referenceCache = adoptPtr(new ShapeCache()); CachingWordShaper referenceShaper(referenceCache.get()); GlyphBuffer referenceGlyphBuffer; font.setCanShapeWordByWordForTesting(false); @@ -144,7 +142,7 @@ GlyphBuffer glyphBuffer; shaper.fillGlyphBuffer(&font, textRun, fallbackFonts, &glyphBuffer, 1, 6); - std::unique_ptr<ShapeCache> referenceCache = wrapUnique(new ShapeCache()); + OwnPtr<ShapeCache> referenceCache = adoptPtr(new ShapeCache()); CachingWordShaper referenceShaper(referenceCache.get()); GlyphBuffer referenceGlyphBuffer; font.setCanShapeWordByWordForTesting(false);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp index 3dffa865..1115eff 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -37,8 +37,6 @@ #include "platform/fonts/shaping/HarfBuzzShaper.h" #include "wtf/HashMap.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" -#include <memory> #include <hb-ot.h> #include <hb.h> @@ -114,11 +112,11 @@ private: explicit HbFontCacheEntry(hb_font_t* font) : m_hbFont(HbFontUniquePtr(font)) - , m_hbFontData(wrapUnique(new HarfBuzzFontData())) + , m_hbFontData(adoptPtr(new HarfBuzzFontData())) { }; HbFontUniquePtr m_hbFont; - std::unique_ptr<HarfBuzzFontData> m_hbFontData; + OwnPtr<HarfBuzzFontData> m_hbFontData; }; typedef HashMap<uint64_t, RefPtr<HbFontCacheEntry>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> HarfBuzzFontCache;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp index fe7bd7d..0999e94 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -45,11 +45,10 @@ #include "platform/text/TextBreakIterator.h" #include "wtf/Compiler.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/text/Unicode.h" + #include <algorithm> #include <hb.h> -#include <memory> #include <unicode/uchar.h> #include <unicode/uscript.h> @@ -115,7 +114,7 @@ : Shaper(font, run) , m_normalizedBufferLength(0) { - m_normalizedBuffer = wrapArrayUnique(new UChar[m_textRun.length() + 1]); + m_normalizedBuffer = adoptArrayPtr(new UChar[m_textRun.length() + 1]); normalizeCharacters(m_textRun, m_textRun.length(), m_normalizedBuffer.get(), &m_normalizedBufferLength); setFontFeatures(); } @@ -468,7 +467,7 @@ ShapeResult::RunInfo* run = new ShapeResult::RunInfo(currentFont, direction, ICUScriptToHBScript(currentRunScript), startIndex, numGlyphsToInsert, numCharacters); - shapeResult->insertRun(wrapUnique(run), lastChangePosition, + shapeResult->insertRun(adoptPtr(run), lastChangePosition, numGlyphsToInsert, harfBuzzBuffer); } @@ -682,7 +681,7 @@ const TextRun& textRun, float positionOffset, unsigned count) { const SimpleFontData* fontData = font->primaryFont(); - std::unique_ptr<ShapeResult::RunInfo> run = wrapUnique(new ShapeResult::RunInfo(fontData, + OwnPtr<ShapeResult::RunInfo> run = adoptPtr(new ShapeResult::RunInfo(fontData, // Tab characters are always LTR or RTL, not TTB, even when isVerticalAnyUpright(). textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR, HB_SCRIPT_COMMON, 0, count, count));
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h index 40f2936..2da39dc 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
@@ -41,10 +41,12 @@ #include "wtf/Allocator.h" #include "wtf/Deque.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/CharacterNames.h" + #include <hb.h> -#include <memory> #include <unicode/uscript.h> namespace blink { @@ -202,9 +204,9 @@ bool isLastResort); bool collectFallbackHintChars(Vector<UChar32>& hint, bool needsList); - void insertRunIntoShapeResult(ShapeResult*, std::unique_ptr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); + void insertRunIntoShapeResult(ShapeResult*, PassOwnPtr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); - std::unique_ptr<UChar[]> m_normalizedBuffer; + OwnPtr<UChar[]> m_normalizedBuffer; unsigned m_normalizedBufferLength; FeaturesVector m_features;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp index fd63329..08fd5c7d 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp
@@ -10,16 +10,15 @@ #include "platform/fonts/UTF16TextIterator.h" #include "platform/text/Character.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" namespace blink { RunSegmenter::RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrientation runOrientation) : m_bufferSize(bufferSize) , m_candidateRange({ 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationKeep, FontFallbackPriority::Text }) - , m_scriptRunIterator(wrapUnique(new ScriptRunIterator(buffer, bufferSize))) - , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? wrapUnique(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr) - , m_symbolsIterator(wrapUnique(new SymbolsIterator(buffer, bufferSize))) + , m_scriptRunIterator(adoptPtr(new ScriptRunIterator(buffer, bufferSize))) + , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? adoptPtr(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr) + , m_symbolsIterator(adoptPtr(new SymbolsIterator(buffer, bufferSize))) , m_lastSplit(0) , m_scriptRunIteratorPosition(0) , m_orientationIteratorPosition(runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize)
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h index e347f295..8a77f9f7 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h
@@ -14,7 +14,7 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> + #include <unicode/uscript.h> namespace blink { @@ -49,9 +49,9 @@ unsigned m_bufferSize; RunSegmenterRange m_candidateRange; - std::unique_ptr<ScriptRunIterator> m_scriptRunIterator; - std::unique_ptr<OrientationIterator> m_orientationIterator; - std::unique_ptr<SymbolsIterator> m_symbolsIterator; + OwnPtr<ScriptRunIterator> m_scriptRunIterator; + OwnPtr<OrientationIterator> m_orientationIterator; + OwnPtr<SymbolsIterator> m_symbolsIterator; unsigned m_lastSplit; unsigned m_scriptRunIteratorPosition; unsigned m_orientationIteratorPosition;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp index e05e7b1..9367176 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
@@ -34,9 +34,7 @@ #include "platform/fonts/Font.h" #include "platform/fonts/shaping/ShapeResultInlineHeaders.h" #include "platform/fonts/shaping/ShapeResultSpacing.h" -#include "wtf/PtrUtil.h" #include <hb.h> -#include <memory> namespace blink { @@ -156,7 +154,7 @@ { m_runs.reserveCapacity(other.m_runs.size()); for (const auto& run : other.m_runs) - m_runs.append(wrapUnique(new ShapeResult::RunInfo(*run))); + m_runs.append(adoptPtr(new ShapeResult::RunInfo(*run))); } ShapeResult::~ShapeResult() @@ -280,11 +278,11 @@ return static_cast<float>(value) / (1 << 16); } -void ShapeResult::insertRun(std::unique_ptr<ShapeResult::RunInfo> runToInsert, +void ShapeResult::insertRun(PassOwnPtr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t* harfBuzzBuffer) { ASSERT(numGlyphs > 0); - std::unique_ptr<ShapeResult::RunInfo> run(std::move(runToInsert)); + OwnPtr<ShapeResult::RunInfo> run(std::move(runToInsert)); ASSERT(numGlyphs == run->m_glyphData.size()); const SimpleFontData* currentFontData = run->m_fontData.get();
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h index ba2f52d8..c83666d 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
@@ -36,9 +36,9 @@ #include "platform/text/TextDirection.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> struct hb_buffer_t; @@ -88,12 +88,12 @@ } void applySpacing(ShapeResultSpacing&, const TextRun&); - void insertRun(std::unique_ptr<ShapeResult::RunInfo>, unsigned startGlyph, + void insertRun(PassOwnPtr<ShapeResult::RunInfo>, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); float m_width; FloatRect m_glyphBoundingBox; - Vector<std::unique_ptr<RunInfo>> m_runs; + Vector<OwnPtr<RunInfo>> m_runs; RefPtr<SimpleFontData> m_primaryFont; unsigned m_numCharacters;
diff --git a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp index 0a60262..9cd1424 100644 --- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp +++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
@@ -42,10 +42,8 @@ #include "public/platform/Platform.h" #include "public/platform/linux/WebSandboxSupport.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" #include "wtf/text/CString.h" -#include <memory> #include <unicode/locid.h> #if !OS(WIN) && !OS(ANDROID) @@ -203,7 +201,7 @@ } #if !OS(WIN) -std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { CString name; @@ -211,7 +209,7 @@ if (!tf) return nullptr; - return wrapUnique(new FontPlatformData(tf, + return adoptPtr(new FontPlatformData(tf, name.data(), fontSize, (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescription.isSyntheticBold(),
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp index 5d6a886..d8a150d5 100644 --- a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp +++ b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp
@@ -40,8 +40,6 @@ #include "platform/fonts/FontPlatformData.h" #include "platform/fonts/SimpleFontData.h" #include "platform/fonts/win/FontFallbackWin.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -357,7 +355,7 @@ return false; } -std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { ASSERT(creationParams.creationType() == CreateFontByFamily); @@ -395,7 +393,7 @@ } } - std::unique_ptr<FontPlatformData> result = wrapUnique(new FontPlatformData(tf, + OwnPtr<FontPlatformData> result = adoptPtr(new FontPlatformData(tf, name.data(), fontSize, (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDescription.isSyntheticBold(),
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp b/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp index 2ad06042..74cb1bf2 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp
@@ -30,7 +30,6 @@ #include "platform/geometry/FloatPolygon.h" #include "wtf/MathExtras.h" -#include <memory> namespace blink { @@ -79,7 +78,7 @@ return vertexIndex2; } -FloatPolygon::FloatPolygon(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) +FloatPolygon::FloatPolygon(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) : m_vertices(std::move(vertices)) , m_fillRule(fillRule) {
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygon.h b/third_party/WebKit/Source/platform/geometry/FloatPolygon.h index 26e891b5..0799fa6 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygon.h +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygon.h
@@ -35,8 +35,9 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/GraphicsTypes.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -51,7 +52,7 @@ USING_FAST_MALLOC(FloatPolygon); WTF_MAKE_NONCOPYABLE(FloatPolygon); public: - FloatPolygon(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule); + FloatPolygon(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule); const FloatPoint& vertexAt(unsigned index) const { return (*m_vertices)[index]; } unsigned numberOfVertices() const { return m_vertices->size(); } @@ -73,7 +74,7 @@ bool containsNonZero(const FloatPoint&) const; bool containsEvenOdd(const FloatPoint&) const; - std::unique_ptr<Vector<FloatPoint>> m_vertices; + OwnPtr<Vector<FloatPoint>> m_vertices; WindRule m_fillRule; FloatRect m_boundingBox; bool m_empty;
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp index e5cf1e5d..a8a1ff91 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp
@@ -30,8 +30,6 @@ #include "platform/geometry/FloatPolygon.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -40,16 +38,16 @@ FloatPolygonTestValue(const float* coordinates, unsigned coordinatesLength, WindRule fillRule) { ASSERT(!(coordinatesLength % 2)); - std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<FloatPoint>(coordinatesLength / 2)); + OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(coordinatesLength / 2)); for (unsigned i = 0; i < coordinatesLength; i += 2) (*vertices)[i / 2] = FloatPoint(coordinates[i], coordinates[i + 1]); - m_polygon = wrapUnique(new FloatPolygon(std::move(vertices), fillRule)); + m_polygon = adoptPtr(new FloatPolygon(std::move(vertices), fillRule)); } const FloatPolygon& polygon() const { return *m_polygon; } private: - std::unique_ptr<FloatPolygon> m_polygon; + OwnPtr<FloatPolygon> m_polygon; }; namespace {
diff --git a/third_party/WebKit/Source/platform/geometry/TransformState.cpp b/third_party/WebKit/Source/platform/geometry/TransformState.cpp index 86ceb92..cdfc0120 100644 --- a/third_party/WebKit/Source/platform/geometry/TransformState.cpp +++ b/third_party/WebKit/Source/platform/geometry/TransformState.cpp
@@ -25,6 +25,7 @@ #include "platform/geometry/TransformState.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/geometry/TransformState.h b/third_party/WebKit/Source/platform/geometry/TransformState.h index 7ef3f6c..f3c4104 100644 --- a/third_party/WebKit/Source/platform/geometry/TransformState.h +++ b/third_party/WebKit/Source/platform/geometry/TransformState.h
@@ -33,7 +33,7 @@ #include "platform/transforms/AffineTransform.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Allocator.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -133,7 +133,7 @@ FloatQuad m_lastPlanarQuad; // We only allocate the transform if we need to - std::unique_ptr<TransformationMatrix> m_accumulatedTransform; + OwnPtr<TransformationMatrix> m_accumulatedTransform; LayoutSize m_accumulatedOffset; bool m_accumulatingTransform; bool m_forceAccumulatingTransform;
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp index 17d815c5..b950446 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -37,7 +37,6 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "third_party/skia/include/core/SkCanvas.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" namespace blink { @@ -480,7 +479,7 @@ if (catchUpIfNecessary == DoNotCatchUp || time < m_desiredFrameStartTime) { // Haven't yet reached time for next frame to start; delay until then. - m_frameTimer = wrapUnique(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation)); + m_frameTimer = adoptPtr(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation)); m_frameTimer->startOneShot(std::max(m_desiredFrameStartTime - time, 0.), BLINK_FROM_HERE); } else { // We've already reached or passed the time for the next frame to start. @@ -504,7 +503,7 @@ // may be in the past, meaning the next time through this function we'll // kick off the next advancement sooner than this frame's duration would // suggest. - m_frameTimer = wrapUnique(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimationWithoutCatchUp)); + m_frameTimer = adoptPtr(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimationWithoutCatchUp)); m_frameTimer->startOneShot(0, BLINK_FROM_HERE); } }
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.h b/third_party/WebKit/Source/platform/graphics/BitmapImage.h index 98a16777..a530097 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.h
@@ -37,7 +37,7 @@ #include "platform/graphics/ImageSource.h" #include "platform/image-decoders/ImageAnimation.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -164,7 +164,7 @@ RefPtr<SkImage> m_cachedFrame; // A cached copy of the most recently-accessed frame. size_t m_cachedFrameIndex; // Index of the frame that is cached. - std::unique_ptr<Timer<BitmapImage>> m_frameTimer; + OwnPtr<Timer<BitmapImage>> m_frameTimer; int m_repetitionCount; // How many total animation loops we should do. This will be cAnimationNone if this image type is incapable of animation. RepetitionCountStatus m_repetitionCountStatus; int m_repetitionsComplete; // How many repetitions we've finished.
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 8a5ca10..c782456b 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -45,8 +45,6 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace { enum { @@ -90,7 +88,7 @@ PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) { TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_SCOPE_GLOBAL); - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!contextProvider) return nullptr; RefPtr<Canvas2DLayerBridge> layerBridge; @@ -98,9 +96,9 @@ return layerBridge.release(); } -Canvas2DLayerBridge::Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) +Canvas2DLayerBridge::Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) : m_contextProvider(std::move(contextProvider)) - , m_logger(wrapUnique(new Logger)) + , m_logger(adoptPtr(new Logger)) , m_weakPtrFactory(this) , m_imageBuffer(0) , m_msaaSampleCount(msaaSampleCount) @@ -139,7 +137,7 @@ void Canvas2DLayerBridge::startRecording() { DCHECK(m_isDeferralEnabled); - m_recorder = wrapUnique(new SkPictureRecorder); + m_recorder = adoptPtr(new SkPictureRecorder); m_recorder->beginRecording(m_size.width(), m_size.height(), nullptr); if (m_imageBuffer) { m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas()); @@ -147,7 +145,7 @@ m_recordingPixelCount = 0; } -void Canvas2DLayerBridge::setLoggerForTesting(std::unique_ptr<Logger> logger) +void Canvas2DLayerBridge::setLoggerForTesting(PassOwnPtr<Logger> logger) { m_logger = std::move(logger); } @@ -486,7 +484,7 @@ reportSurfaceCreationFailure(); if (m_surface && surfaceIsAccelerated && !m_layer) { - m_layer = wrapUnique(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); + m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); m_layer->setOpaque(m_opacityMode == Opaque); m_layer->setBlendBackgroundColor(m_opacityMode != Opaque); GraphicsLayer::registerContentsLayer(m_layer->layer()); @@ -750,7 +748,7 @@ gpu::gles2::GLES2Interface* sharedGL = nullptr; m_layer->clearTexture(); - m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (m_contextProvider) sharedGL = m_contextProvider->contextGL();
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h index 7c8ce5b9..2ffda5a 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
@@ -37,11 +37,11 @@ #include "third_party/skia/include/core/SkSurface.h" #include "wtf/Allocator.h" #include "wtf/Deque.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/WeakPtr.h" -#include <memory> class SkImage; struct SkImageInfo; @@ -146,7 +146,7 @@ virtual ~Logger() { } }; - void setLoggerForTesting(std::unique_ptr<Logger>); + void setLoggerForTesting(PassOwnPtr<Logger>); private: #if USE_IOSURFACE_FOR_2D_CANVAS @@ -185,7 +185,7 @@ MailboxInfo() {} }; - Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const IntSize&, int msaaSampleCount, OpacityMode, AccelerationMode); + Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize&, int msaaSampleCount, OpacityMode, AccelerationMode); gpu::gles2::GLES2Interface* contextGL(); void startRecording(); void skipQueuedDrawCommands(); @@ -233,14 +233,14 @@ // changing texture bindings. void resetSkiaTextureBinding(); - std::unique_ptr<SkPictureRecorder> m_recorder; + OwnPtr<SkPictureRecorder> m_recorder; RefPtr<SkSurface> m_surface; RefPtr<SkImage> m_hibernationImage; int m_initialSurfaceSaveCount; - std::unique_ptr<WebExternalTextureLayer> m_layer; - std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; - std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; - std::unique_ptr<Logger> m_logger; + OwnPtr<WebExternalTextureLayer> m_layer; + OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; + OwnPtr<SharedContextRateLimiter> m_rateLimiter; + OwnPtr<Logger> m_logger; WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; ImageBuffer* m_imageBuffer; int m_msaaSampleCount;
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 9ced0261..350b948 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -47,8 +47,8 @@ #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" + #include <memory> using testing::AnyNumber; @@ -149,7 +149,7 @@ class Canvas2DLayerBridgeTest : public Test { public: - PassRefPtr<Canvas2DLayerBridge> makeBridge(std::unique_ptr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode) + PassRefPtr<Canvas2DLayerBridge> makeBridge(PassOwnPtr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode) { return adoptRef(new Canvas2DLayerBridge(std::move(provider), size, 0, NonOpaque, accelerationMode)); } @@ -158,7 +158,7 @@ void fullLifecycleTest() { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::DisableAcceleration))); @@ -170,7 +170,7 @@ void fallbackToSoftwareIfContextLost() { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); gl.setIsContextLost(true); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); @@ -183,7 +183,7 @@ { // No fallback case. FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); EXPECT_TRUE(bridge->checkSurfaceValid()); EXPECT_TRUE(bridge->isAccelerated()); @@ -195,7 +195,7 @@ { // Fallback case. FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); GrContext* gr = contextProvider->grContext(); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); EXPECT_TRUE(bridge->checkSurfaceValid()); @@ -212,7 +212,7 @@ void noDrawOnContextLostTest() { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); EXPECT_TRUE(bridge->checkSurfaceValid()); @@ -235,7 +235,7 @@ void prepareMailboxWithBitmapTest() { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); bridge->m_lastImageId = 1; @@ -252,7 +252,7 @@ // This test passes by not crashing and not triggering assertions. { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); WebExternalTextureMailbox mailbox; bridge->prepareMailbox(&mailbox, 0); @@ -262,7 +262,7 @@ // Retry with mailbox released while bridge destruction is in progress. { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); WebExternalTextureMailbox mailbox; Canvas2DLayerBridge* rawBridge; { @@ -280,7 +280,7 @@ { { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); SkPaint paint; bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint); @@ -291,7 +291,7 @@ { FakeGLES2Interface gl; - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); SkPaint paint; bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint); @@ -346,7 +346,7 @@ void runCreateBridgeTask(Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost, WaitableEvent* doneEvent) { - std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(gl)); + OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(gl)); *bridgePtr = testHost->makeBridge(std::move(contextProvider), IntSize(300, 300), Canvas2DLayerBridge::EnableAcceleration); // draw+flush to trigger the creation of a GPU surface (*bridgePtr)->didDraw(FloatRect(0, 0, 1, 1)); @@ -357,7 +357,7 @@ void postAndWaitCreateBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost) { - std::unique_ptr<WaitableEvent> bridgeCreatedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> bridgeCreatedEvent = adoptPtr(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runCreateBridgeTask, @@ -386,7 +386,7 @@ void postAndWaitDestroyBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr) { - std::unique_ptr<WaitableEvent> bridgeDestroyedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> bridgeDestroyedEvent = adoptPtr(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runDestroyBridgeTask, @@ -414,7 +414,7 @@ void postAndWaitSetIsHiddenTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge, bool value) { - std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); postSetIsHiddenTask(location, testThread, bridge, value, doneEvent.get()); doneEvent->wait(); } @@ -422,7 +422,7 @@ class MockImageBuffer : public ImageBuffer { public: MockImageBuffer() - : ImageBuffer(wrapUnique(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { } + : ImageBuffer(adoptPtr(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { } MOCK_CONST_METHOD1(resetCanvas, void(SkCanvas*)); @@ -436,7 +436,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -444,12 +444,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -480,7 +480,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -488,12 +488,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -529,7 +529,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -541,12 +541,12 @@ bridge->setImageBuffer(&mockImageBuffer); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -583,7 +583,7 @@ void postAndWaitRenderingTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge) { - std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runRenderingTask, @@ -599,7 +599,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -607,12 +607,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -650,7 +650,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -662,12 +662,12 @@ bridge->disableDeferral(DisableDeferralReasonUnknown); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -711,7 +711,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -722,12 +722,12 @@ bridge->setImageBuffer(&mockImageBuffer); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -771,7 +771,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -779,12 +779,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -807,7 +807,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -815,12 +815,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -842,7 +842,7 @@ EXPECT_TRUE(bridge->checkSurfaceValid()); // End hibernation normally - std::unique_ptr<WaitableEvent> hibernationEndedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationEndedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationEndedNormally)) .WillOnce(testing::InvokeWithoutArgs(hibernationEndedEvent.get(), &WaitableEvent::signal)); postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), false); @@ -876,7 +876,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -884,12 +884,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationScheduledEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationScheduledEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), true, hibernationScheduledEvent.get()); postDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); @@ -904,7 +904,7 @@ // completion before the thread is destroyed. // This test passes by not crashing, which proves that the WeakPtr logic // is sound. - std::unique_ptr<WaitableEvent> fenceEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> fenceEvent = adoptPtr(new WaitableEvent()); testThread->scheduler()->postIdleTask(BLINK_FROM_HERE, new IdleFenceTask(fenceEvent.get())); fenceEvent->wait(); } @@ -916,7 +916,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -924,12 +924,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToPendingDestruction)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -950,7 +950,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -958,12 +958,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToVisibilityChange)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -987,7 +987,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -995,13 +995,13 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); gl.setIsContextLost(true); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueGpuContextLoss)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -1022,7 +1022,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -1030,12 +1030,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -1061,7 +1061,7 @@ #endif { FakeGLES2Interface gl; - std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); + OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -1069,12 +1069,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); + OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp index 03926147..b13d9ad7 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
@@ -9,7 +9,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "public/platform/WebLayer.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -17,7 +16,7 @@ { m_solidColorLayer = cc::SolidColorLayer::Create(); m_solidColorLayer->SetBackgroundColor(SK_ColorBLUE); - m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_solidColorLayer.get())); + m_webLayer = adoptPtr(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_solidColorLayer.get())); GraphicsLayer::registerContentsLayer(m_webLayer.get()); }
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h index 5f9adc9..3e9f320 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h
@@ -7,7 +7,7 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace cc { // TODO(611796): replace SolidColorLayer with SurfaceLayer @@ -26,7 +26,7 @@ private: scoped_refptr<cc::SolidColorLayer> m_solidColorLayer; - std::unique_ptr<WebLayer> m_webLayer; + OwnPtr<WebLayer> m_webLayer; }; }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h b/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h index beb590f9..0b3a941 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h
@@ -11,8 +11,7 @@ #include "platform/graphics/Color.h" #include "third_party/skia/include/core/SkScalar.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" class SkImageFilter; @@ -22,9 +21,9 @@ class PLATFORM_EXPORT CompositorFilterOperations { WTF_MAKE_NONCOPYABLE(CompositorFilterOperations); public: - static std::unique_ptr<CompositorFilterOperations> create() + static PassOwnPtr<CompositorFilterOperations> create() { - return wrapUnique(new CompositorFilterOperations()); + return adoptPtr(new CompositorFilterOperations()); } const cc::FilterOperations& asFilterOperations() const;
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp index 04f8c9c9..82886a1b 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp
@@ -8,8 +8,8 @@ #include "cc/trees/layer_tree_impl.h" #include "platform/graphics/CompositorMutableState.h" #include "platform/graphics/CompositorMutation.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -36,7 +36,7 @@ // Only if this is a new entry do we want to allocate a new mutation. if (result.isNewEntry) - result.storedValue->value = wrapUnique(new CompositorMutation); + result.storedValue->value = adoptPtr(new CompositorMutation); return wrapUnique(new CompositorMutableState(result.storedValue->value.get(), layers.main, layers.scroll)); }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h index 91c6a531..3f0bc4ea 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h
@@ -6,6 +6,7 @@ #define CompositorMutableStateProvider_h #include "platform/PlatformExport.h" + #include <cstdint> #include <memory>
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp index 994e8cf..0d0cb78d 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
@@ -16,6 +16,7 @@ #include "platform/graphics/CompositorMutableStateProvider.h" #include "platform/graphics/CompositorMutation.h" #include "testing/gtest/include/gtest/gtest.h" + #include <memory> namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutation.h b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h index b712cc8..971540af 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutation.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h
@@ -8,7 +8,6 @@ #include "platform/graphics/CompositorMutableProperties.h" #include "third_party/skia/include/core/SkMatrix44.h" #include "wtf/HashMap.h" -#include <memory> namespace blink { @@ -54,7 +53,7 @@ }; struct CompositorMutations { - HashMap<uint64_t, std::unique_ptr<CompositorMutation>> map; + HashMap<uint64_t, OwnPtr<CompositorMutation>> map; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp index 8c47f77..b3d04d8 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp
@@ -12,8 +12,6 @@ #include "platform/graphics/CompositorMutation.h" #include "platform/graphics/CompositorMutationsTarget.h" #include "platform/graphics/CompositorMutator.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -38,7 +36,7 @@ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate"); double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF(); if (!m_mutations) - m_mutations = wrapUnique(new CompositorMutations); + m_mutations = adoptPtr(new CompositorMutations); CompositorMutableStateProvider compositorState(treeImpl, m_mutations.get()); bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow, &compositorState); return shouldReinvoke; @@ -59,7 +57,7 @@ return base::Bind(&CompositorMutationsTarget::applyMutations, base::Unretained(m_mutationsTarget), - base::Owned(m_mutations.release())); + base::Owned(m_mutations.leakPtr())); } void CompositorMutatorClient::setNeedsMutate() @@ -68,7 +66,7 @@ m_client->SetNeedsMutate(); } -void CompositorMutatorClient::setMutationsForTesting(std::unique_ptr<CompositorMutations> mutations) +void CompositorMutatorClient::setMutationsForTesting(PassOwnPtr<CompositorMutations> mutations) { m_mutations = std::move(mutations); }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h index 6fb3299..6adfb58 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h
@@ -8,7 +8,8 @@ #include "platform/PlatformExport.h" #include "platform/heap/Handle.h" #include "public/platform/WebCompositorMutatorClient.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -30,12 +31,12 @@ CompositorMutator* mutator() { return m_mutator.get(); } - void setMutationsForTesting(std::unique_ptr<CompositorMutations>); + void setMutationsForTesting(PassOwnPtr<CompositorMutations>); private: cc::LayerTreeMutatorClient* m_client; CompositorMutationsTarget* m_mutationsTarget; Persistent<CompositorMutator> m_mutator; - std::unique_ptr<CompositorMutations> m_mutations; + OwnPtr<CompositorMutations> m_mutations; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp index 58c8e61..26fade6 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp
@@ -10,8 +10,7 @@ #include "platform/graphics/CompositorMutator.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" using ::testing::_; @@ -39,7 +38,7 @@ MockCompositoMutationsTarget target; CompositorMutatorClient client(new StubCompositorMutator, &target); - std::unique_ptr<CompositorMutations> mutations = wrapUnique(new CompositorMutations()); + OwnPtr<CompositorMutations> mutations = adoptPtr(new CompositorMutations()); client.setMutationsForTesting(std::move(mutations)); EXPECT_CALL(target, applyMutations(_));
diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h index f84f27d..cfe4403 100644 --- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h +++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h
@@ -30,6 +30,7 @@ #include "public/platform/WebContentLayerClient.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" class SkCanvas;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp index cb42fef..7b8980d 100644 --- a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp
@@ -6,11 +6,10 @@ #include "wtf/Allocator.h" #include "wtf/ContainerAnnotations.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/allocator/PartitionAlloc.h" #include "wtf/allocator/Partitions.h" #include <algorithm> -#include <memory> namespace blink { @@ -175,7 +174,7 @@ ContiguousContainerBase::allocateNewBufferForNextAllocation(size_t bufferSize, const char* typeName) { ASSERT(m_buffers.isEmpty() || m_endIndex == m_buffers.size() - 1); - std::unique_ptr<Buffer> newBuffer = wrapUnique(new Buffer(bufferSize, typeName)); + OwnPtr<Buffer> newBuffer = adoptPtr(new Buffer(bufferSize, typeName)); Buffer* bufferToReturn = newBuffer.get(); m_buffers.append(std::move(newBuffer)); m_endIndex = m_buffers.size() - 1;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h index a50431b..a52ad85 100644 --- a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h +++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h
@@ -10,11 +10,11 @@ #include "wtf/Allocator.h" #include "wtf/Compiler.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/TypeTraits.h" #include "wtf/Vector.h" #include <cstddef> #include <iterator> -#include <memory> #include <utility> namespace blink { @@ -67,7 +67,7 @@ Buffer* allocateNewBufferForNextAllocation(size_t, const char* typeName); - Vector<std::unique_ptr<Buffer>> m_buffers; + Vector<OwnPtr<Buffer>> m_buffers; unsigned m_endIndex; size_t m_maxObjectSize; };
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp index 160ecd4..b7f8c45 100644 --- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp +++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -32,7 +32,6 @@ #include "platform/image-decoders/ImageDecoder.h" #include "platform/image-decoders/SegmentReader.h" #include "third_party/skia/include/core/SkData.h" -#include <memory> namespace blink { @@ -110,7 +109,7 @@ { // We just need the size of the image, so we have to temporarily create an ImageDecoder. Since // we only need the size, it doesn't really matter about premul or not, or gamma settings. - std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(static_cast<const char*>(data->data()), data->size(), + OwnPtr<ImageDecoder> decoder = ImageDecoder::create(static_cast<const char*>(data->data()), data->size(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (!decoder) return 0;
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp index 60d6544..09fa440 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -33,8 +33,7 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/SegmentReader.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -57,22 +56,22 @@ uint32_t m_uniqueID; }; -std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(const SharedBuffer& data, ImageDecoder::AlphaOption alphaOption, ImageDecoder::GammaAndColorProfileOption colorOptions) +PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::create(const SharedBuffer& data, ImageDecoder::AlphaOption alphaOption, ImageDecoder::GammaAndColorProfileOption colorOptions) { - std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(data, alphaOption, colorOptions); + OwnPtr<ImageDecoder> actualDecoder = ImageDecoder::create(data, alphaOption, colorOptions); if (!actualDecoder) return nullptr; - return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); + return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder))); } -std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(std::unique_ptr<ImageDecoder> actualDecoder) +PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(PassOwnPtr<ImageDecoder> actualDecoder) { - return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); + return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder))); } -DeferredImageDecoder::DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder) +DeferredImageDecoder::DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder) : m_allDataReceived(false) , m_actualDecoder(std::move(actualDecoder)) , m_repetitionCount(cAnimationNone) @@ -130,7 +129,7 @@ if (m_frameGenerator) { if (!m_rwBuffer) - m_rwBuffer = wrapUnique(new SkRWBuffer(data.size())); + m_rwBuffer = adoptPtr(new SkRWBuffer(data.size())); const char* segment = 0; for (size_t length = data.getSomeData(segment, m_rwBuffer->size());
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h index 3db9411..4838182 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h
@@ -32,8 +32,8 @@ #include "third_party/skia/include/core/SkRWBuffer.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> class SkImage; @@ -47,9 +47,9 @@ WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); USING_FAST_MALLOC(DeferredImageDecoder); public: - static std::unique_ptr<DeferredImageDecoder> create(const SharedBuffer& data, ImageDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); + static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, ImageDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); - static std::unique_ptr<DeferredImageDecoder> createForTesting(std::unique_ptr<ImageDecoder>); + static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDecoder>); ~DeferredImageDecoder(); @@ -74,7 +74,7 @@ bool hotSpot(IntPoint&) const; private: - explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder); + explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); friend class DeferredImageDecoderTest; ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } @@ -86,9 +86,9 @@ // Copy of the data that is passed in, used by deferred decoding. // Allows creating readonly snapshots that may be read in another thread. - std::unique_ptr<SkRWBuffer> m_rwBuffer; + OwnPtr<SkRWBuffer> m_rwBuffer; bool m_allDataReceived; - std::unique_ptr<ImageDecoder> m_actualDecoder; + OwnPtr<ImageDecoder> m_actualDecoder; String m_filenameExtension; IntSize m_size;
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp index c0a04ccc..09d3da1 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -42,9 +42,7 @@ #include "third_party/skia/include/core/SkPixmap.h" #include "third_party/skia/include/core/SkSurface.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -101,7 +99,7 @@ ImageDecodingStore::instance().setCacheLimitInBytes(1024 * 1024); m_data = SharedBuffer::create(whitePNG, sizeof(whitePNG)); m_frameCount = 1; - std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::create(this); + OwnPtr<MockImageDecoder> decoder = MockImageDecoder::create(this); m_actualDecoder = decoder.get(); m_actualDecoder->setSize(1, 1); m_lazyDecoder = DeferredImageDecoder::createForTesting(std::move(decoder)); @@ -162,7 +160,7 @@ // Don't own this but saves the pointer to query states. MockImageDecoder* m_actualDecoder; - std::unique_ptr<DeferredImageDecoder> m_lazyDecoder; + OwnPtr<DeferredImageDecoder> m_lazyDecoder; sk_sp<SkSurface> m_surface; int m_decodeRequestCount; RefPtr<SharedBuffer> m_data; @@ -245,7 +243,7 @@ EXPECT_EQ(0, m_decodeRequestCount); // Create a thread to rasterize SkPicture. - std::unique_ptr<WebThread> thread = wrapUnique(Platform::current()->createThread("RasterThread")); + OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("RasterThread")); thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&rasterizeMain, AllowCrossThreadAccess(m_surface->getCanvas()), AllowCrossThreadAccess(picture.get()))); thread.reset(); EXPECT_EQ(0, m_decodeRequestCount); @@ -360,9 +358,9 @@ TEST_F(DeferredImageDecoderTest, frameOpacity) { - std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(*m_data, + OwnPtr<ImageDecoder> actualDecoder = ImageDecoder::create(*m_data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); - std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::createForTesting(std::move(actualDecoder)); + OwnPtr<DeferredImageDecoder> decoder = DeferredImageDecoder::createForTesting(std::move(actualDecoder)); decoder->setData(*m_data, true); SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1);
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp index 80bf250..f9677b3 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp
@@ -9,7 +9,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkImage.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -35,7 +34,7 @@ RefPtr<SharedBuffer> file = readFile(fileName); ASSERT_NE(file, nullptr); - std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create(*file.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); + OwnPtr<DeferredImageDecoder> decoder = DeferredImageDecoder::create(*file.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); ASSERT_TRUE(decoder.get()); RefPtr<SharedBuffer> partialFile = SharedBuffer::create(file->data(), bytesForFirstFrame);
diff --git a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp index 018d193..7b3e224 100644 --- a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp
@@ -39,9 +39,7 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkXfermode.h" #include "third_party/skia/include/effects/SkBlurMaskFilter.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -49,9 +47,9 @@ DrawLooperBuilder::~DrawLooperBuilder() { } -std::unique_ptr<DrawLooperBuilder> DrawLooperBuilder::create() +PassOwnPtr<DrawLooperBuilder> DrawLooperBuilder::create() { - return wrapUnique(new DrawLooperBuilder); + return adoptPtr(new DrawLooperBuilder); } PassRefPtr<SkDrawLooper> DrawLooperBuilder::detachDrawLooper()
diff --git a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h index eeb03dfd..b94f5a7f 100644 --- a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h +++ b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h
@@ -35,8 +35,8 @@ #include "third_party/skia/include/effects/SkLayerDrawLooper.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> class SkDrawLooper; @@ -64,7 +64,7 @@ DrawLooperBuilder(); ~DrawLooperBuilder(); - static std::unique_ptr<DrawLooperBuilder> create(); + static PassOwnPtr<DrawLooperBuilder> create(); // Creates the SkDrawLooper and passes ownership to the caller. The builder // should not be used any more after calling this method.
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp index d0fbe4e..0244a5ad 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
@@ -49,7 +49,6 @@ #include "third_party/skia/include/utils/SkNullCanvas.h" #include "wtf/Assertions.h" #include "wtf/MathExtras.h" -#include <memory> namespace blink { @@ -176,7 +175,7 @@ if (contextDisabled()) return; - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); if (!color.alpha()) { // When shadow-only but there is no shadow, we use an empty draw looper // to disable rendering of the source primitive. When not shadow-only, we @@ -195,7 +194,7 @@ setDrawLooper(std::move(drawLooperBuilder)); } -void GraphicsContext::setDrawLooper(std::unique_ptr<DrawLooperBuilder> drawLooperBuilder) +void GraphicsContext::setDrawLooper(PassOwnPtr<DrawLooperBuilder> drawLooperBuilder) { if (contextDisabled()) return; @@ -434,7 +433,7 @@ clip(rect.rect()); } - std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, shadowColor, DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha); setDrawLooper(std::move(drawLooperBuilder));
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h index 71fde7ed..ff0ba7a 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h
@@ -41,7 +41,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/PassOwnPtr.h" class SkBitmap; class SkImage; @@ -215,7 +215,7 @@ // It is assumed that this draw looper is used only for shadows // (i.e. a draw looper is set if and only if there is a shadow). // The builder passed into this method will be destroyed. - void setDrawLooper(std::unique_ptr<DrawLooperBuilder>); + void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&); void drawFocusRing(const Path&, int width, int offset, const Color&); @@ -343,7 +343,7 @@ // Paint states stack. Enables local drawing state change with save()/restore() calls. // This state controls the appearance of drawn content. // We do not delete from this stack to avoid memory churn. - Vector<std::unique_ptr<GraphicsContextState>> m_paintStateStack; + Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; // Current index on the stack. May not be the last thing on the stack. unsigned m_paintStateIndex; // Raw pointer to the current state.
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h index b8605c5b..df82cfe 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h
@@ -36,9 +36,8 @@ #include "third_party/skia/include/core/SkPaint.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -47,14 +46,14 @@ class PLATFORM_EXPORT GraphicsContextState final { USING_FAST_MALLOC(GraphicsContextState); public: - static std::unique_ptr<GraphicsContextState> create() + static PassOwnPtr<GraphicsContextState> create() { - return wrapUnique(new GraphicsContextState()); + return adoptPtr(new GraphicsContextState()); } - static std::unique_ptr<GraphicsContextState> createAndCopy(const GraphicsContextState& other) + static PassOwnPtr<GraphicsContextState> createAndCopy(const GraphicsContextState& other) { - return wrapUnique(new GraphicsContextState(other)); + return adoptPtr(new GraphicsContextState(other)); } void copy(const GraphicsContextState&);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp index 5b5886e5..46da10f 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
@@ -32,7 +32,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkShader.h" -#include <memory> namespace blink { @@ -70,7 +69,7 @@ bitmap.eraseColor(0); SkCanvas canvas(bitmap); - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); Color opaque(1.0f, 0.0f, 0.0f, 1.0f); @@ -103,7 +102,7 @@ Color alpha(0.0f, 0.0f, 0.0f, 0.0f); FloatRect bounds(0, 0, 100, 100); - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); context.beginRecording(bounds);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index 7a3cfb4..7572bd3b 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -57,12 +57,10 @@ #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/text/WTFString.h" #include <algorithm> #include <cmath> -#include <memory> #include <utility> #ifndef NDEBUG @@ -109,9 +107,9 @@ return map; } -std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) +PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) { - return wrapUnique(new GraphicsLayer(client)); + return adoptPtr(new GraphicsLayer(client)); } GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) @@ -150,8 +148,8 @@ m_client->verifyNotPainting(); #endif - m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); - m_layer = wrapUnique(Platform::current()->compositorSupport()->createContentLayer(m_contentLayerDelegate.get())); + m_contentLayerDelegate = adoptPtr(new ContentLayerDelegate(this)); + m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(m_contentLayerDelegate.get())); m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); m_layer->layer()->setLayerClient(this); } @@ -1157,7 +1155,7 @@ if (image && skImage) { if (!m_imageLayer) { - m_imageLayer = wrapUnique(Platform::current()->compositorSupport()->createImageLayer()); + m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer()); registerContentsLayer(m_imageLayer->layer()); } m_imageLayer->setImage(skImage.get()); @@ -1180,14 +1178,14 @@ void GraphicsLayer::setFilters(const FilterOperations& filters) { - std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); + OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get()); m_layer->layer()->setFilters(compositorFilters->asFilterOperations()); } void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) { - std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); + OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get()); m_layer->layer()->setBackgroundFilters(compositorFilters->asFilterOperations()); }
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h index 0b117dc..b6f7032 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h
@@ -50,8 +50,9 @@ #include "public/platform/WebImageLayer.h" #include "public/platform/WebLayerScrollClient.h" #include "third_party/skia/include/core/SkFilterQuality.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -71,7 +72,7 @@ class PLATFORM_EXPORT GraphicsLayer : public WebLayerScrollClient, public cc::LayerClient, public DisplayItemClient { WTF_MAKE_NONCOPYABLE(GraphicsLayer); USING_FAST_MALLOC(GraphicsLayer); public: - static std::unique_ptr<GraphicsLayer> create(GraphicsLayerClient*); + static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*); ~GraphicsLayer() override; @@ -356,8 +357,8 @@ int m_paintCount; - std::unique_ptr<WebContentLayer> m_layer; - std::unique_ptr<WebImageLayer> m_imageLayer; + OwnPtr<WebContentLayer> m_layer; + OwnPtr<WebImageLayer> m_imageLayer; WebLayer* m_contentsLayer; // We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point, @@ -367,13 +368,13 @@ Vector<LinkHighlight*> m_linkHighlights; - std::unique_ptr<ContentLayerDelegate> m_contentLayerDelegate; + OwnPtr<ContentLayerDelegate> m_contentLayerDelegate; WeakPersistent<ScrollableArea> m_scrollableArea; GraphicsLayerDebugInfo m_debugInfo; int m_3dRenderingContext; - std::unique_ptr<PaintController> m_paintController; + OwnPtr<PaintController> m_paintController; IntRect m_previousInterestRect;
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index 6464d428..1b2c3738 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -43,8 +43,7 @@ #include "public/platform/WebLayer.h" #include "public/platform/WebLayerTreeView.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -52,15 +51,15 @@ public: GraphicsLayerTest() { - m_clipLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); - m_scrollElasticityLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); - m_graphicsLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); + m_clipLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); + m_scrollElasticityLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); + m_graphicsLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); m_clipLayer->addChild(m_scrollElasticityLayer.get()); m_scrollElasticityLayer->addChild(m_graphicsLayer.get()); m_graphicsLayer->platformLayer()->setScrollClipLayer( m_clipLayer->platformLayer()); m_platformLayer = m_graphicsLayer->platformLayer(); - m_layerTreeView = wrapUnique(new WebLayerTreeViewImplForTesting); + m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting); ASSERT(m_layerTreeView); m_layerTreeView->setRootLayer(*m_clipLayer->platformLayer()); m_layerTreeView->registerViewportLayers( @@ -78,12 +77,12 @@ protected: WebLayer* m_platformLayer; - std::unique_ptr<FakeGraphicsLayer> m_graphicsLayer; - std::unique_ptr<FakeGraphicsLayer> m_scrollElasticityLayer; - std::unique_ptr<FakeGraphicsLayer> m_clipLayer; + OwnPtr<FakeGraphicsLayer> m_graphicsLayer; + OwnPtr<FakeGraphicsLayer> m_scrollElasticityLayer; + OwnPtr<FakeGraphicsLayer> m_clipLayer; private: - std::unique_ptr<WebLayerTreeView> m_layerTreeView; + OwnPtr<WebLayerTreeView> m_layerTreeView; FakeGraphicsLayerClient m_client; }; @@ -99,19 +98,19 @@ return m_compositorPlayer.get(); } - std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; + OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; }; TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations) { ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0.0, 0.0), CubicBezierTimingFunction::EaseType::EASE); - std::unique_ptr<CompositorAnimation> floatAnimation(CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0)); + OwnPtr<CompositorAnimation> floatAnimation(CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0)); int animationId = floatAnimation->id(); - std::unique_ptr<CompositorAnimationTimeline> compositorTimeline = CompositorAnimationTimeline::create(); + OwnPtr<CompositorAnimationTimeline> compositorTimeline = CompositorAnimationTimeline::create(); AnimationPlayerForTesting player; layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->animationTimeline()); @@ -120,7 +119,7 @@ player.compositorPlayer()->attachLayer(m_platformLayer); ASSERT_TRUE(player.compositorPlayer()->isLayerAttached()); - player.compositorPlayer()->addAnimation(floatAnimation.release()); + player.compositorPlayer()->addAnimation(floatAnimation.leakPtr()); ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting());
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index 828ade9..e545ca2 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -54,31 +54,29 @@ #include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "wtf/CheckedNumeric.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferContents.h" -#include <memory> namespace blink { -std::unique_ptr<ImageBuffer> ImageBuffer::create(std::unique_ptr<ImageBufferSurface> surface) +PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surface) { if (!surface->isValid()) return nullptr; - return wrapUnique(new ImageBuffer(std::move(surface))); + return adoptPtr(new ImageBuffer(std::move(surface))); } -std::unique_ptr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opacityMode, ImageInitializationMode initializationMode) +PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opacityMode, ImageInitializationMode initializationMode) { - std::unique_ptr<ImageBufferSurface> surface(wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode, initializationMode))); + OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode, initializationMode))); if (!surface->isValid()) return nullptr; - return wrapUnique(new ImageBuffer(std::move(surface))); + return adoptPtr(new ImageBuffer(std::move(surface))); } -ImageBuffer::ImageBuffer(std::unique_ptr<ImageBufferSurface> surface) +ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) : m_snapshotState(InitialSnapshotState) , m_surface(std::move(surface)) , m_client(0) @@ -206,12 +204,12 @@ if (!textureInfo || !textureInfo->fID) return false; - std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return false; gpu::gles2::GLES2Interface* sharedGL = provider->contextGL(); - std::unique_ptr<WebExternalTextureMailbox> mailbox = wrapUnique(new WebExternalTextureMailbox); + OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureMailbox); mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()); // Contexts may be in a different share group. We must transfer the texture through a mailbox first @@ -250,7 +248,7 @@ { if (!drawingBuffer || !m_surface->isAccelerated()) return false; - std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return false; gpu::gles2::GLES2Interface* gl = provider->contextGL();
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h index 56b9fd9..20bcd76 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h
@@ -39,11 +39,12 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPicture.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/Uint8ClampedArray.h" -#include <memory> namespace gpu { namespace gles2 { @@ -75,8 +76,8 @@ WTF_MAKE_NONCOPYABLE(ImageBuffer); USING_FAST_MALLOC(ImageBuffer); public: - static std::unique_ptr<ImageBuffer> create(const IntSize&, OpacityMode = NonOpaque, ImageInitializationMode = InitializeImagePixels); - static std::unique_ptr<ImageBuffer> create(std::unique_ptr<ImageBufferSurface>); + static PassOwnPtr<ImageBuffer> create(const IntSize&, OpacityMode = NonOpaque, ImageInitializationMode = InitializeImagePixels); + static PassOwnPtr<ImageBuffer> create(PassOwnPtr<ImageBufferSurface>); virtual ~ImageBuffer(); @@ -146,7 +147,7 @@ intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } protected: - ImageBuffer(std::unique_ptr<ImageBufferSurface>); + ImageBuffer(PassOwnPtr<ImageBufferSurface>); private: enum SnapshotState { @@ -155,7 +156,7 @@ DrawnToAfterSnapshot, }; mutable SnapshotState m_snapshotState; - std::unique_ptr<ImageBufferSurface> m_surface; + OwnPtr<ImageBufferSurface> m_surface; ImageBufferClient* m_client; mutable intptr_t m_gpuMemoryUsage;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp index a181e9e..54ab435 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -28,7 +28,6 @@ #include "platform/TraceEvent.h" #include "platform/graphics/ImageFrameGenerator.h" #include "wtf/Threading.h" -#include <memory> namespace blink { @@ -56,7 +55,7 @@ ImageDecodingStore& ImageDecodingStore::instance() { - DEFINE_THREAD_SAFE_STATIC_LOCAL(ImageDecodingStore, store, ImageDecodingStore::create().release()); + DEFINE_THREAD_SAFE_STATIC_LOCAL(ImageDecodingStore, store, ImageDecodingStore::create().leakPtr()); return store; } @@ -92,12 +91,12 @@ m_orderedCacheList.append(cacheEntry); } -void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, std::unique_ptr<ImageDecoder> decoder) +void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder) { // Prune old cache entries to give space for the new one. prune(); - std::unique_ptr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generator, std::move(decoder)); + OwnPtr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generator, std::move(decoder)); MutexLocker lock(m_mutex); ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey())); @@ -106,7 +105,7 @@ void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator, const ImageDecoder* decoder) { - Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; + Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::makeCacheKey(generator, decoder)); @@ -128,7 +127,7 @@ void ImageDecodingStore::removeCacheIndexedByGenerator(const ImageFrameGenerator* generator) { - Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; + Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); @@ -183,7 +182,7 @@ { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.image_decoding"), "ImageDecodingStore::prune"); - Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; + Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); @@ -209,7 +208,7 @@ } template<class T, class U, class V> -void ImageDecodingStore::insertCacheInternal(std::unique_ptr<T> cacheEntry, U* cacheMap, V* identifierMap) +void ImageDecodingStore::insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap) { const size_t cacheEntryBytes = cacheEntry->memoryUsageInBytes(); m_heapMemoryUsageInBytes += cacheEntryBytes; @@ -228,7 +227,7 @@ } template<class T, class U, class V> -void ImageDecodingStore::removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<std::unique_ptr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry>>* deletionList) { const size_t cacheEntryBytes = cacheEntry->memoryUsageInBytes(); ASSERT(m_heapMemoryUsageInBytes >= cacheEntryBytes); @@ -248,7 +247,7 @@ TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.image_decoding"), "ImageDecodingStoreNumOfDecoders", m_decoderCacheMap.size()); } -void ImageDecodingStore::removeFromCacheInternal(const CacheEntry* cacheEntry, Vector<std::unique_ptr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeFromCacheInternal(const CacheEntry* cacheEntry, Vector<OwnPtr<CacheEntry>>* deletionList) { if (cacheEntry->type() == CacheEntry::TypeDecoder) { removeFromCacheInternal(static_cast<const DecoderCacheEntry*>(cacheEntry), &m_decoderCacheMap, &m_decoderCacheKeyMap, deletionList); @@ -258,7 +257,7 @@ } template<class U, class V> -void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator* generator, Vector<std::unique_ptr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator* generator, Vector<OwnPtr<CacheEntry>>* deletionList) { typename V::iterator iter = identifierMap->find(generator); if (iter == identifierMap->end()) @@ -271,13 +270,13 @@ // For each cache identifier find the corresponding CacheEntry and remove it. for (size_t i = 0; i < cacheIdentifierList.size(); ++i) { ASSERT(cacheMap->contains(cacheIdentifierList[i])); - const auto& cacheEntry = cacheMap->get(cacheIdentifierList[i]); + const typename U::MappedType::PtrType cacheEntry = cacheMap->get(cacheIdentifierList[i]); ASSERT(!cacheEntry->useCount()); removeFromCacheInternal(cacheEntry, cacheMap, identifierMap, deletionList); } } -void ImageDecodingStore::removeFromCacheListInternal(const Vector<std::unique_ptr<CacheEntry>>& deletionList) +void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry>>& deletionList) { for (size_t i = 0; i < deletionList.size(); ++i) m_orderedCacheList.remove(deletionList[i].get());
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h index 465963a..7117456 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
@@ -31,12 +31,13 @@ #include "platform/PlatformExport.h" #include "platform/graphics/skia/SkSizeHash.h" #include "platform/image-decoders/ImageDecoder.h" + #include "wtf/DoublyLinkedList.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -64,7 +65,7 @@ USING_FAST_MALLOC(ImageDecodingStore); WTF_MAKE_NONCOPYABLE(ImageDecodingStore); public: - static std::unique_ptr<ImageDecodingStore> create() { return wrapUnique(new ImageDecodingStore); } + static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDecodingStore); } ~ImageDecodingStore(); static ImageDecodingStore& instance(); @@ -73,7 +74,7 @@ // and scaled size. Return true if the cached object is found. bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, ImageDecoder**); void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*); - void insertDecoder(const ImageFrameGenerator*, std::unique_ptr<ImageDecoder>); + void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>); void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*); // Remove all cache entries indexed by ImageFrameGenerator. @@ -135,12 +136,12 @@ class DecoderCacheEntry final : public CacheEntry { public: - static std::unique_ptr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, std::unique_ptr<ImageDecoder> decoder) + static PassOwnPtr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder) { - return wrapUnique(new DecoderCacheEntry(generator, 0, std::move(decoder))); + return adoptPtr(new DecoderCacheEntry(generator, 0, std::move(decoder))); } - DecoderCacheEntry(const ImageFrameGenerator* generator, int count, std::unique_ptr<ImageDecoder> decoder) + DecoderCacheEntry(const ImageFrameGenerator* generator, int count, PassOwnPtr<ImageDecoder> decoder) : CacheEntry(generator, count) , m_cachedDecoder(std::move(decoder)) , m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), m_cachedDecoder->decodedSize().height())) @@ -162,7 +163,7 @@ ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); } private: - std::unique_ptr<ImageDecoder> m_cachedDecoder; + OwnPtr<ImageDecoder> m_cachedDecoder; SkISize m_size; }; @@ -171,22 +172,22 @@ void prune(); // These helper methods are called while m_mutex is locked. - template<class T, class U, class V> void insertCacheInternal(std::unique_ptr<T> cacheEntry, U* cacheMap, V* identifierMap); + template<class T, class U, class V> void insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap); // Helper method to remove a cache entry. Ownership is transferred to // deletionList. Use of Vector<> is handy when removing multiple entries. - template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<std::unique_ptr<CacheEntry>>* deletionList); + template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry>>* deletionList); // Helper method to remove a cache entry. Uses the templated version base on // the type of cache entry. - void removeFromCacheInternal(const CacheEntry*, Vector<std::unique_ptr<CacheEntry>>* deletionList); + void removeFromCacheInternal(const CacheEntry*, Vector<OwnPtr<CacheEntry>>* deletionList); // Helper method to remove all cache entries associated with a ImageFraneGenerator. // Ownership of cache entries is transferred to deletionList. - template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<std::unique_ptr<CacheEntry>>* deletionList); + template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<OwnPtr<CacheEntry>>* deletionList); // Helper method to remove cache entry pointers from the LRU list. - void removeFromCacheListInternal(const Vector<std::unique_ptr<CacheEntry>>& deletionList); + void removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry>>& deletionList); // A doubly linked list that maintains usage history of cache entries. // This is used for eviction of old entries. @@ -195,7 +196,7 @@ DoublyLinkedList<CacheEntry> m_orderedCacheList; // A lookup table for all decoder cache objects. Owns all decoder cache objects. - typedef HashMap<DecoderCacheKey, std::unique_ptr<DecoderCacheEntry>> DecoderCacheMap; + typedef HashMap<DecoderCacheKey, OwnPtr<DecoderCacheEntry>> DecoderCacheMap; DecoderCacheMap m_decoderCacheMap; // A lookup table to map ImageFrameGenerator to all associated
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp index bbd4fbe..809174a 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
@@ -28,7 +28,6 @@ #include "platform/graphics/ImageFrameGenerator.h" #include "platform/graphics/test/MockImageDecoder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -83,7 +82,7 @@ TEST_F(ImageDecodingStoreTest, insertDecoder) { const SkISize size = SkISize::Make(1, 1); - std::unique_ptr<ImageDecoder> decoder = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this); decoder->setSize(1, 1); const ImageDecoder* refDecoder = decoder.get(); ImageDecodingStore::instance().insertDecoder(m_generator.get(), std::move(decoder)); @@ -100,9 +99,9 @@ TEST_F(ImageDecodingStoreTest, evictDecoder) { - std::unique_ptr<ImageDecoder> decoder1 = MockImageDecoder::create(this); - std::unique_ptr<ImageDecoder> decoder2 = MockImageDecoder::create(this); - std::unique_ptr<ImageDecoder> decoder3 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this); decoder1->setSize(1, 1); decoder2->setSize(2, 2); decoder3->setSize(3, 3); @@ -127,9 +126,9 @@ TEST_F(ImageDecodingStoreTest, decoderInUseNotEvicted) { - std::unique_ptr<ImageDecoder> decoder1 = MockImageDecoder::create(this); - std::unique_ptr<ImageDecoder> decoder2 = MockImageDecoder::create(this); - std::unique_ptr<ImageDecoder> decoder3 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this); decoder1->setSize(1, 1); decoder2->setSize(2, 2); decoder3->setSize(3, 3); @@ -156,7 +155,7 @@ TEST_F(ImageDecodingStoreTest, removeDecoder) { const SkISize size = SkISize::Make(1, 1); - std::unique_ptr<ImageDecoder> decoder = MockImageDecoder::create(this); + OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this); decoder->setSize(1, 1); const ImageDecoder* refDecoder = decoder.get(); ImageDecodingStore::instance().insertDecoder(m_generator.get(), std::move(decoder));
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp index cebc233..faf1444 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -30,8 +30,6 @@ #include "platform/graphics/ImageDecodingStore.h" #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkYUVSizeInfo.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -160,13 +158,13 @@ return false; } - std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); // getYUVComponentSizes was already called and was successful, so ImageDecoder::create must succeed. ASSERT(decoder); decoder->setData(data, true); - std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes)); + OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT(decoder->canDecodeToYUV()); @@ -201,9 +199,9 @@ // If we are not resuming decoding that means the decoder is freshly // created and we have ownership. If we are resuming decoding then // the decoder is owned by ImageDecodingStore. - std::unique_ptr<ImageDecoder> decoderContainer; + OwnPtr<ImageDecoder> decoderContainer; if (!resumeDecoding) - decoderContainer = wrapUnique(decoder); + decoderContainer = adoptPtr(decoder); if (fullSizeImage.isNull()) { // If decoding has failed, we can save work in the future by @@ -264,10 +262,10 @@ if (!*decoder) { newDecoder = true; if (m_imageDecoderFactory) - *decoder = m_imageDecoderFactory->create().release(); + *decoder = m_imageDecoderFactory->create().leakPtr(); if (!*decoder) - *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).release(); + *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).leakPtr(); if (!*decoder) return false; @@ -327,13 +325,13 @@ if (m_yuvDecodingFailed) return false; - std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (!decoder) return false; // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. decoder->setData(data, true); - std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); + OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); decoder->setImagePlanes(std::move(dummyImagePlanes)); return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fWidthBytes);
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h index 37685411..b8053b9 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
@@ -33,13 +33,13 @@ #include "third_party/skia/include/core/SkTypes.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" -#include <memory> class SkData; struct SkYUVSizeInfo; @@ -54,7 +54,7 @@ public: ImageDecoderFactory() {} virtual ~ImageDecoderFactory() { } - virtual std::unique_ptr<ImageDecoder> create() = 0; + virtual PassOwnPtr<ImageDecoder> create() = 0; }; class PLATFORM_EXPORT ImageFrameGenerator final : public ThreadSafeRefCounted<ImageFrameGenerator> { @@ -95,7 +95,7 @@ friend class ImageFrameGeneratorTest; friend class DeferredImageDecoderTest; // For testing. |factory| will overwrite the default ImageDecoder creation logic if |factory->create()| returns non-zero. - void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { m_imageDecoderFactory = std::move(factory); } + void setImageDecoderFactory(PassOwnPtr<ImageDecoderFactory> factory) { m_imageDecoderFactory = std::move(factory); } void setHasAlpha(size_t index, bool hasAlpha); @@ -111,7 +111,7 @@ size_t m_frameCount; Vector<bool> m_hasAlpha; - std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; + OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; // Prevents multiple decode operations on the same data. Mutex m_decodeMutex;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp index 63f41a4..74e5a2b 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
@@ -35,8 +35,6 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -186,7 +184,7 @@ // LocalFrame can now be decoded completely. setFrameStatus(ImageFrame::FrameComplete); addNewData(); - std::unique_ptr<WebThread> thread = wrapUnique(Platform::current()->createThread("DecodeThread")); + OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("DecodeThread")); thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&decodeThreadMain, m_generator, m_segmentReader)); thread.reset(); EXPECT_EQ(2, m_decodeRequestCount);
diff --git a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp index ac6c74b..ada2c2d 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
@@ -30,8 +30,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -96,7 +95,7 @@ TEST(ImageLayerChromiumTest, imageLayerContentReset) { FakeGraphicsLayerClient client; - std::unique_ptr<FakeGraphicsLayer> graphicsLayer = wrapUnique(new FakeGraphicsLayer(&client)); + OwnPtr<FakeGraphicsLayer> graphicsLayer = adoptPtr(new FakeGraphicsLayer(&client)); ASSERT_TRUE(graphicsLayer.get()); ASSERT_FALSE(graphicsLayer->hasContentsLayer()); @@ -118,7 +117,7 @@ TEST(ImageLayerChromiumTest, opaqueImages) { FakeGraphicsLayerClient client; - std::unique_ptr<FakeGraphicsLayer> graphicsLayer = wrapUnique(new FakeGraphicsLayer(&client)); + OwnPtr<FakeGraphicsLayer> graphicsLayer = adoptPtr(new FakeGraphicsLayer(&client)); ASSERT_TRUE(graphicsLayer.get()); bool opaque = true;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageSource.h b/third_party/WebKit/Source/platform/graphics/ImageSource.h index 5e8ded4..3e5d183 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageSource.h +++ b/third_party/WebKit/Source/platform/graphics/ImageSource.h
@@ -30,7 +30,7 @@ #include "platform/graphics/ImageOrientation.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" class SkImage; @@ -95,7 +95,7 @@ size_t frameBytesAtIndex(size_t) const; private: - std::unique_ptr<DeferredImageDecoder> m_decoder; + OwnPtr<DeferredImageDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h index 58f55fd..d78262ba 100644 --- a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h
@@ -7,6 +7,7 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/GeneratedImage.h" +#include "wtf/OwnPtr.h" class SkPicture;
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp index 8cc9f53..5bc8eb1c 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -46,10 +46,8 @@ #include "third_party/skia/include/core/SkStream.h" #include "wtf/CurrentTime.h" #include "wtf/HexNumber.h" -#include "wtf/PtrUtil.h" #include "wtf/text/Base64.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace blink { @@ -60,7 +58,7 @@ static bool decodeBitmap(const void* data, size_t length, SkBitmap* result) { - std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cast<const char*>(data), length, + OwnPtr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cast<const char*>(data), length, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); if (!imageDecoder) return false; @@ -109,7 +107,7 @@ return m_picture->cullRect().isEmpty(); } -std::unique_ptr<Vector<char>> PictureSnapshot::replay(unsigned fromStep, unsigned toStep, double scale) const +PassOwnPtr<Vector<char>> PictureSnapshot::replay(unsigned fromStep, unsigned toStep, double scale) const { const SkIRect bounds = m_picture->cullRect().roundOut(); @@ -129,7 +127,7 @@ canvas.resetStepCount(); m_picture->playback(&canvas, &canvas); } - std::unique_ptr<Vector<char>> base64Data = wrapUnique(new Vector<char>()); + OwnPtr<Vector<char>> base64Data = adoptPtr(new Vector<char>()); Vector<char> encodedImage; RefPtr<SkImage> image = fromSkSp(SkImage::MakeFromBitmap(bitmap)); @@ -146,9 +144,9 @@ return base64Data; } -std::unique_ptr<PictureSnapshot::Timings> PictureSnapshot::profile(unsigned minRepeatCount, double minDuration, const FloatRect* clipRect) const +PassOwnPtr<PictureSnapshot::Timings> PictureSnapshot::profile(unsigned minRepeatCount, double minDuration, const FloatRect* clipRect) const { - std::unique_ptr<PictureSnapshot::Timings> timings = wrapUnique(new PictureSnapshot::Timings()); + OwnPtr<PictureSnapshot::Timings> timings = adoptPtr(new PictureSnapshot::Timings()); timings->reserveCapacity(minRepeatCount); const SkIRect bounds = m_picture->cullRect().roundOut(); SkBitmap bitmap;
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h index ffe561f..34bac46 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h
@@ -37,7 +37,6 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { @@ -57,13 +56,13 @@ PictureSnapshot(PassRefPtr<const SkPicture>); - std::unique_ptr<Vector<char>> replay(unsigned fromStep = 0, unsigned toStep = 0, double scale = 1.0) const; - std::unique_ptr<Timings> profile(unsigned minIterations, double minDuration, const FloatRect* clipRect) const; + PassOwnPtr<Vector<char>> replay(unsigned fromStep = 0, unsigned toStep = 0, double scale = 1.0) const; + PassOwnPtr<Timings> profile(unsigned minIterations, double minDuration, const FloatRect* clipRect) const; PassRefPtr<JSONArray> snapshotCommandLog() const; bool isEmpty() const; private: - std::unique_ptr<SkBitmap> createBitmap() const; + PassOwnPtr<SkBitmap> createBitmap() const; RefPtr<const SkPicture> m_picture; };
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp index 6784aee..c19292b 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp
@@ -11,13 +11,12 @@ #include "platform/graphics/ImageBuffer.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMode opacityMode) +RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMode opacityMode) : ImageBufferSurface(size, opacityMode) , m_imageBuffer(0) , m_currentFramePixelCount(0) @@ -37,7 +36,7 @@ void RecordingImageBufferSurface::initializeCurrentFrame() { static SkRTreeFactory rTreeFactory; - m_currentFrame = wrapUnique(new SkPictureRecorder); + m_currentFrame = adoptPtr(new SkPictureRecorder); m_currentFrame->beginRecording(size().width(), size().height(), &rTreeFactory); if (m_imageBuffer) { m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas());
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h index 257a9316..011073e 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h
@@ -10,8 +10,8 @@ #include "public/platform/WebThread.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> class SkCanvas; class SkPicture; @@ -26,7 +26,7 @@ USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory); public: - virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize&, OpacityMode) = 0; + virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, OpacityMode) = 0; virtual ~RecordingImageBufferFallbackSurfaceFactory() { } protected: RecordingImageBufferFallbackSurfaceFactory() { } @@ -39,7 +39,7 @@ // for one frame and should not be used for any operations which need a // raster surface, (i.e. writePixels). // Only #getPicture should be used to access the resulting frame. - RecordingImageBufferSurface(const IntSize&, std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory = nullptr, OpacityMode = NonOpaque); + RecordingImageBufferSurface(const IntSize&, PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory = nullptr, OpacityMode = NonOpaque); ~RecordingImageBufferSurface() override; // Implementation of ImageBufferSurface interfaces @@ -94,9 +94,9 @@ bool finalizeFrameInternal(FallbackReason*); int approximateOpCount(); - std::unique_ptr<SkPictureRecorder> m_currentFrame; + OwnPtr<SkPictureRecorder> m_currentFrame; RefPtr<SkPicture> m_previousFrame; - std::unique_ptr<ImageBufferSurface> m_fallbackSurface; + OwnPtr<ImageBufferSurface> m_fallbackSurface; ImageBuffer* m_imageBuffer; int m_initialSaveCount; int m_currentFramePixelCount; @@ -105,7 +105,7 @@ bool m_didRecordDrawCommandsInCurrentFrame; bool m_currentFrameHasExpensiveOp; bool m_previousFrameHasExpensiveOp; - std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; + OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp index c5641e84..7e9b5702 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
@@ -17,9 +17,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> using testing::Test; @@ -78,10 +78,10 @@ public: MockSurfaceFactory() : m_createSurfaceCount(0) { } - virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) + virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) { m_createSurfaceCount++; - return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode)); + return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode)); } virtual ~MockSurfaceFactory() { } @@ -96,15 +96,15 @@ protected: RecordingImageBufferSurfaceTest() { - std::unique_ptr<MockSurfaceFactory> surfaceFactory = wrapUnique(new MockSurfaceFactory()); + OwnPtr<MockSurfaceFactory> surfaceFactory = adoptPtr(new MockSurfaceFactory()); m_surfaceFactory = surfaceFactory.get(); - std::unique_ptr<RecordingImageBufferSurface> testSurface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory))); + OwnPtr<RecordingImageBufferSurface> testSurface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory))); m_testSurface = testSurface.get(); // We create an ImageBuffer in order for the testSurface to be // properly initialized with a GraphicsContext m_imageBuffer = ImageBuffer::create(std::move(testSurface)); EXPECT_FALSE(!m_imageBuffer); - m_fakeImageBufferClient = wrapUnique(new FakeImageBufferClient(m_imageBuffer.get())); + m_fakeImageBufferClient = adoptPtr(new FakeImageBufferClient(m_imageBuffer.get())); m_imageBuffer->setClient(m_fakeImageBufferClient.get()); } @@ -226,8 +226,8 @@ private: MockSurfaceFactory* m_surfaceFactory; RecordingImageBufferSurface* m_testSurface; - std::unique_ptr<FakeImageBufferClient> m_fakeImageBufferClient; - std::unique_ptr<ImageBuffer> m_imageBuffer; + OwnPtr<FakeImageBufferClient> m_fakeImageBufferClient; + OwnPtr<ImageBuffer> m_imageBuffer; }; namespace {
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp index aa45be3a..ac88b3d3 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -14,8 +14,6 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkShader.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -76,7 +74,7 @@ // In the place when we consume an ImageBitmap that is gpu texture backed, // create a new SkImage from that texture. // TODO(xidachen): make this work on a worker thread. - std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return nullptr; GrContext* grContext = provider->grContext();
diff --git a/third_party/WebKit/Source/platform/graphics/StrokeData.cpp b/third_party/WebKit/Source/platform/graphics/StrokeData.cpp index a82fe7e..d7b3b56 100644 --- a/third_party/WebKit/Source/platform/graphics/StrokeData.cpp +++ b/third_party/WebKit/Source/platform/graphics/StrokeData.cpp
@@ -28,8 +28,8 @@ #include "platform/graphics/StrokeData.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -49,7 +49,7 @@ } size_t count = !(dashLength % 2) ? dashLength : dashLength * 2; - std::unique_ptr<SkScalar[]> intervals = wrapArrayUnique(new SkScalar[count]); + OwnPtr<SkScalar[]> intervals = adoptArrayPtr(new SkScalar[count]); for (unsigned i = 0; i < count; i++) intervals[i] = dashes[i % dashLength];
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp index 090e79bfb..c88437b 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -32,9 +32,8 @@ #include "ui/gfx/skia_util.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include <algorithm> -#include <memory> #include <utility> namespace blink { @@ -69,7 +68,7 @@ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) return; m_rootLayer = cc::Layer::Create(); - m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_rootLayer.get())); + m_webLayer = adoptPtr(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_rootLayer.get())); } PaintArtifactCompositor::~PaintArtifactCompositor() @@ -374,7 +373,7 @@ // The common case: create a layer for painted content. gfx::Rect combinedBounds = enclosingIntRect(paintChunk.bounds); scoped_refptr<cc::DisplayItemList> displayList = recordPaintChunk(paintArtifact, paintChunk, combinedBounds); - std::unique_ptr<ContentLayerClientImpl> contentLayerClient = wrapUnique( + OwnPtr<ContentLayerClientImpl> contentLayerClient = adoptPtr( new ContentLayerClientImpl(std::move(displayList), gfx::Rect(combinedBounds.size()))); layerOffset = combinedBounds.OffsetFromOrigin();
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h index ad732528d..1c2f526 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
@@ -8,8 +8,8 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace cc { class Layer; @@ -62,8 +62,8 @@ scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const PaintChunk&, gfx::Vector2dF& layerOffset); scoped_refptr<cc::Layer> m_rootLayer; - std::unique_ptr<WebLayer> m_webLayer; - Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; + OwnPtr<WebLayer> m_webLayer; + Vector<OwnPtr<ContentLayerClientImpl>> m_contentLayerClients; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp index ef9edb4..f21059a1 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
@@ -17,8 +17,6 @@ #include "platform/testing/WebLayerTreeViewImplForTesting.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { @@ -39,7 +37,7 @@ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); // Delay constructing the compositor until after the feature is set. - m_paintArtifactCompositor = wrapUnique(new PaintArtifactCompositor); + m_paintArtifactCompositor = adoptPtr(new PaintArtifactCompositor); } void TearDown() override @@ -53,7 +51,7 @@ private: RuntimeEnabledFeatures::Backup m_featuresBackup; - std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor; + OwnPtr<PaintArtifactCompositor> m_paintArtifactCompositor; }; TEST_F(PaintArtifactCompositorTest, EmptyPaintArtifact) @@ -387,7 +385,7 @@ cc::LayerTreeSettings settings = WebLayerTreeViewImplForTesting::defaultLayerTreeSettings(); settings.single_thread_proxy_scheduler = false; settings.use_layer_lists = true; - m_webLayerTreeView = wrapUnique(new WebLayerTreeViewWithOutputSurface(settings)); + m_webLayerTreeView = adoptPtr(new WebLayerTreeViewWithOutputSurface(settings)); m_webLayerTreeView->setRootLayer(*getPaintArtifactCompositor().getWebLayer()); } @@ -405,7 +403,7 @@ private: scoped_refptr<base::TestSimpleTaskRunner> m_taskRunner; base::ThreadTaskRunnerHandle m_taskRunnerHandle; - std::unique_ptr<WebLayerTreeViewWithOutputSurface> m_webLayerTreeView; + OwnPtr<WebLayerTreeViewWithOutputSurface> m_webLayerTreeView; }; TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EmptyPaintArtifact)
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp index ece3a8d..0101f44 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp
@@ -28,8 +28,7 @@ #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/text/TextStream.h" #include "wtf/CheckedNumeric.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -151,7 +150,7 @@ SkIPoint target = SkIPoint::Make(m_targetOffset.x(), m_targetOffset.y()); SkMatrixConvolutionImageFilter::TileMode tileMode = toSkiaTileMode(m_edgeMode); bool convolveAlpha = !m_preserveAlpha; - std::unique_ptr<SkScalar[]> kernel = wrapArrayUnique(new SkScalar[numElements]); + OwnPtr<SkScalar[]> kernel = adoptArrayPtr(new SkScalar[numElements]); for (int i = 0; i < numElements; ++i) kernel[i] = SkFloatToScalar(m_kernelMatrix[numElements - 1 - i]); SkImageFilter::CropRect cropRect = getCropRect();
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp index 8c55d52..3b1cccd 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp
@@ -25,8 +25,7 @@ #include "SkMergeImageFilter.h" #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/text/TextStream.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -44,7 +43,7 @@ { unsigned size = numberOfEffectInputs(); - std::unique_ptr<sk_sp<SkImageFilter>[]> inputRefs = wrapArrayUnique(new sk_sp<SkImageFilter>[size]); + OwnPtr<sk_sp<SkImageFilter>[]> inputRefs = adoptArrayPtr(new sk_sp<SkImageFilter>[size]); for (unsigned i = 0; i < size; ++i) inputRefs[i] = SkiaImageFilterBuilder::build(inputEffect(i), operatingColorSpace()); SkImageFilter::CropRect rect = getCropRect();
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp index cc07c2345..21edb3e 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
@@ -35,7 +35,7 @@ #include "public/platform/WebGraphicsContext3DProvider.h" #include "skia/ext/texture_handle.h" #include "third_party/skia/include/gpu/GrContext.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink { @@ -43,7 +43,7 @@ AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(const IntSize& size, OpacityMode opacityMode) : ImageBufferSurface(size, opacityMode) { - m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!m_contextProvider) return; GrContext* grContext = m_contextProvider->grContext();
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h index 021cb84..5a2da49 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h
@@ -34,7 +34,7 @@ #include "platform/graphics/ImageBufferSurface.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/skia/include/core/SkSurface.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -51,7 +51,7 @@ GLuint getBackingTextureHandleForOverwrite() override; private: - std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; + OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; sk_sp<SkSurface> m_surface; // Uses m_contextProvider. };
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 601e4dac..3b72a2e 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -43,10 +43,8 @@ #include "public/platform/WebExternalTextureLayer.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "wtf/CheckedNumeric.h" -#include "wtf/PtrUtil.h" #include "wtf/typed_arrays/ArrayBufferContents.h" #include <algorithm> -#include <memory> namespace blink { @@ -81,7 +79,7 @@ } // namespace -PassRefPtr<DrawingBuffer> DrawingBuffer::create(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, bool premultipliedAlpha, bool wantAlphaChannel, bool wantDepthBuffer, bool wantStencilBuffer, bool wantAntialiasing, PreserveDrawingBuffer preserve) +PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, bool premultipliedAlpha, bool wantAlphaChannel, bool wantDepthBuffer, bool wantStencilBuffer, bool wantAntialiasing, PreserveDrawingBuffer preserve) { ASSERT(contextProvider); @@ -90,7 +88,7 @@ return nullptr; } - std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); + OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); if (!extensionsUtil->isValid()) { // This might be the first time we notice that the GL context is lost. return nullptr; @@ -126,8 +124,8 @@ } DrawingBuffer::DrawingBuffer( - std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, - std::unique_ptr<Extensions3DUtil> extensionsUtil, + PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, + PassOwnPtr<Extensions3DUtil> extensionsUtil, bool discardFramebufferSupported, bool wantAlphaChannel, bool premultipliedAlpha, @@ -560,7 +558,7 @@ WebLayer* DrawingBuffer::platformLayer() { if (!m_layer) { - m_layer = wrapUnique(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); + m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); m_layer->setOpaque(!m_wantAlphaChannel); m_layer->setBlendBackgroundColor(m_wantAlphaChannel);
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index da880647..b0a31df 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -41,8 +41,9 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" -#include <memory> namespace gpu { namespace gles2 { @@ -74,7 +75,7 @@ }; static PassRefPtr<DrawingBuffer> create( - std::unique_ptr<WebGraphicsContext3DProvider>, + PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize&, bool premultipliedAlpha, bool wantAlphaChannel, @@ -221,8 +222,8 @@ protected: // For unittests DrawingBuffer( - std::unique_ptr<WebGraphicsContext3DProvider>, - std::unique_ptr<Extensions3DUtil>, + PassOwnPtr<WebGraphicsContext3DProvider>, + PassOwnPtr<Extensions3DUtil>, bool discardFramebufferSupported, bool wantAlphaChannel, bool premultipliedAlpha, @@ -367,10 +368,10 @@ GLfloat m_clearColor[4]; GLboolean m_colorMask[4]; - std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; + OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; // Lifetime is tied to the m_contextProvider. gpu::gles2::GLES2Interface* m_gl; - std::unique_ptr<Extensions3DUtil> m_extensionsUtil; + OwnPtr<Extensions3DUtil> m_extensionsUtil; IntSize m_size = { -1, -1 }; const bool m_discardFramebufferSupported; const bool m_wantAlphaChannel; @@ -430,7 +431,7 @@ bool m_isHidden = false; SkFilterQuality m_filterQuality = kLow_SkFilterQuality; - std::unique_ptr<WebExternalTextureLayer> m_layer; + OwnPtr<WebExternalTextureLayer> m_layer; // All of the mailboxes that this DrawingBuffer has ever created. Vector<RefPtr<MailboxInfo>> m_textureMailboxes;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index e8ac977..7e161b6f 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -42,9 +42,7 @@ #include "public/platform/functional/WebFunction.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" -#include <memory> using testing::Test; using testing::_; @@ -217,9 +215,9 @@ class DrawingBufferForTests : public DrawingBuffer { public: - static PassRefPtr<DrawingBufferForTests> create(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve) + static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve) { - std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); + OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBufferForTests(std::move(contextProvider), std::move(extensionsUtil), preserve)); bool multisampleExtensionSupported = false; if (!drawingBuffer->initialize(size, multisampleExtensionSupported)) { @@ -229,7 +227,7 @@ return drawingBuffer.release(); } - DrawingBufferForTests(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, std::unique_ptr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) + DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) : DrawingBuffer(std::move(contextProvider), std::move(extensionsUtil), false /* discardFramebufferSupported */, true /* wantAlphaChannel */, false /* premultipliedAlpha */, preserve, false /* wantDepth */, false /* wantStencil */) , m_live(0) { } @@ -245,7 +243,7 @@ class WebGraphicsContext3DProviderForTests : public WebGraphicsContext3DProvider { public: - WebGraphicsContext3DProviderForTests(std::unique_ptr<gpu::gles2::GLES2Interface> gl) + WebGraphicsContext3DProviderForTests(PassOwnPtr<gpu::gles2::GLES2Interface> gl) : m_gl(std::move(gl)) { } @@ -262,16 +260,16 @@ void setErrorMessageCallback(WebFunction<void(const char*, int32_t id)>) {} private: - std::unique_ptr<gpu::gles2::GLES2Interface> m_gl; + OwnPtr<gpu::gles2::GLES2Interface> m_gl; }; class DrawingBufferTest : public Test { protected: void SetUp() override { - std::unique_ptr<GLES2InterfaceForTests> gl = wrapUnique(new GLES2InterfaceForTests); + OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests); m_gl = gl.get(); - std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); + OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); m_drawingBuffer = DrawingBufferForTests::create(std::move(provider), IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); CHECK(m_drawingBuffer); } @@ -491,9 +489,9 @@ protected: void SetUp() override { - std::unique_ptr<GLES2InterfaceForTests> gl = wrapUnique(new GLES2InterfaceForTests); + OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests); m_gl = gl.get(); - std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); + OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); m_imageId0 = m_gl->nextImageIdToBeCreated(); EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); @@ -709,9 +707,9 @@ for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { SCOPED_TRACE(cases[i].testCaseName); - std::unique_ptr<DepthStencilTrackingGLES2Interface> gl = wrapUnique(new DepthStencilTrackingGLES2Interface); + OwnPtr<DepthStencilTrackingGLES2Interface> gl = adoptPtr(new DepthStencilTrackingGLES2Interface); DepthStencilTrackingGLES2Interface* trackingGL = gl.get(); - std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); + OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; bool premultipliedAlpha = false;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp index 0f00d826..58cd5d2 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp
@@ -5,10 +5,10 @@ #include "platform/graphics/gpu/Extensions3DUtil.h" #include "gpu/command_buffer/client/gles2_interface.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -24,9 +24,9 @@ } // anonymous namespace -std::unique_ptr<Extensions3DUtil> Extensions3DUtil::create(gpu::gles2::GLES2Interface* gl) +PassOwnPtr<Extensions3DUtil> Extensions3DUtil::create(gpu::gles2::GLES2Interface* gl) { - std::unique_ptr<Extensions3DUtil> out = wrapUnique(new Extensions3DUtil(gl)); + OwnPtr<Extensions3DUtil> out = adoptPtr(new Extensions3DUtil(gl)); out->initializeExtensions(); return out; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h index 155d21fd..418daf3 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h
@@ -12,7 +12,6 @@ #include "wtf/Noncopyable.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" -#include <memory> namespace gpu { namespace gles2 { @@ -27,7 +26,7 @@ WTF_MAKE_NONCOPYABLE(Extensions3DUtil); public: // Creates a new Extensions3DUtil. If the passed GLES2Interface has been spontaneously lost, returns null. - static std::unique_ptr<Extensions3DUtil> create(gpu::gles2::GLES2Interface*); + static PassOwnPtr<Extensions3DUtil> create(gpu::gles2::GLES2Interface*); ~Extensions3DUtil(); bool isValid() { return m_isValid; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp index 54152e96..c351f16 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
@@ -9,27 +9,25 @@ #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/khronos/GLES2/gl2.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<SharedContextRateLimiter> SharedContextRateLimiter::create(unsigned maxPendingTicks) +PassOwnPtr<SharedContextRateLimiter> SharedContextRateLimiter::create(unsigned maxPendingTicks) { - return wrapUnique(new SharedContextRateLimiter(maxPendingTicks)); + return adoptPtr(new SharedContextRateLimiter(maxPendingTicks)); } SharedContextRateLimiter::SharedContextRateLimiter(unsigned maxPendingTicks) : m_maxPendingTicks(maxPendingTicks) , m_canUseSyncQueries(false) { - m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!m_contextProvider) return; gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { - std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); // TODO(junov): when the GLES 3.0 command buffer is ready, we could use fenceSync instead m_canUseSyncQueries = extensionsUtil->supportsExtension("GL_CHROMIUM_sync_query"); }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h index 4a276b7f..96805c1 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h
@@ -9,7 +9,8 @@ #include "wtf/Allocator.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -39,13 +40,13 @@ USING_FAST_MALLOC(SharedContextRateLimiter); WTF_MAKE_NONCOPYABLE(SharedContextRateLimiter); public: - static std::unique_ptr<SharedContextRateLimiter> create(unsigned maxPendingTicks); + static PassOwnPtr<SharedContextRateLimiter> create(unsigned maxPendingTicks); void tick(); void reset(); private: SharedContextRateLimiter(unsigned maxPendingTicks); - std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; + OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; Deque<GLuint> m_queries; unsigned m_maxPendingTicks; bool m_canUseSyncQueries;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp index ea70f07..5e264f9 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
@@ -11,8 +11,8 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -1715,7 +1715,7 @@ { const unsigned MaxNumberOfComponents = 4; const unsigned MaxBytesPerComponent = 4; - m_unpackedIntermediateSrcData = wrapArrayUnique(new uint8_t[m_width * MaxNumberOfComponents *MaxBytesPerComponent]); + m_unpackedIntermediateSrcData = adoptArrayPtr(new uint8_t[m_width * MaxNumberOfComponents *MaxBytesPerComponent]); ASSERT(m_unpackedIntermediateSrcData.get()); } @@ -1737,7 +1737,7 @@ void* const m_dstStart; const int m_srcStride, m_dstStride; bool m_success; - std::unique_ptr<uint8_t[]> m_unpackedIntermediateSrcData; + OwnPtr<uint8_t[]> m_unpackedIntermediateSrcData; }; void FormatConverter::convert(WebGLImageConversion::DataFormat srcFormat, WebGLImageConversion::DataFormat dstFormat, WebGLImageConversion::AlphaOp alphaOp) @@ -2141,7 +2141,7 @@ if ((!skiaImage || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && m_image->data()) { // Attempt to get raw unpremultiplied image data. - std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( + OwnPtr<ImageDecoder> decoder(ImageDecoder::create( *(m_image->data()), ImageDecoder::AlphaNotPremultiplied, ignoreGammaAndColorProfile ? ImageDecoder::GammaAndColorProfileIgnored : ImageDecoder::GammaAndColorProfileApplied)); if (!decoder)
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h index de020e2..eede2c21 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h
@@ -10,6 +10,7 @@ #include "platform/geometry/FloatRoundedRect.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/paint/DisplayItem.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h index 721b1ee..47cbddff 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h
@@ -9,6 +9,7 @@ #include "platform/graphics/Path.h" #include "platform/graphics/paint/DisplayItem.h" #include "third_party/skia/include/core/SkPath.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h index 10dd663..1e444fc 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h
@@ -9,6 +9,7 @@ #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/paint/DisplayItem.h" #include "public/platform/WebBlendMode.h" +#include "wtf/PassOwnPtr.h" #ifndef NDEBUG #include "wtf/text/WTFString.h" #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h index 94f60a1..78a2c09 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -11,6 +11,7 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #ifndef NDEBUG #include "wtf/text/StringBuilder.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h index b2aed26..1892622e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h
@@ -10,6 +10,7 @@ #include "platform/geometry/FloatPoint.h" #include "platform/graphics/paint/DisplayItem.h" #include "third_party/skia/include/core/SkPicture.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h index 8eee7b6..0c67a4a 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h
@@ -8,17 +8,17 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/CompositorFilterOperations.h" #include "platform/graphics/paint/DisplayItem.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #ifndef NDEBUG #include "wtf/text/WTFString.h" #endif -#include <memory> namespace blink { class PLATFORM_EXPORT BeginFilterDisplayItem final : public PairedBeginDisplayItem { public: - BeginFilterDisplayItem(const DisplayItemClient& client, sk_sp<SkImageFilter> imageFilter, const FloatRect& bounds, std::unique_ptr<CompositorFilterOperations> filterOperations = nullptr) + BeginFilterDisplayItem(const DisplayItemClient& client, sk_sp<SkImageFilter> imageFilter, const FloatRect& bounds, PassOwnPtr<CompositorFilterOperations> filterOperations = nullptr) : PairedBeginDisplayItem(client, BeginFilter, sizeof(*this)) , m_imageFilter(std::move(imageFilter)) , m_webFilterOperations(std::move(filterOperations)) @@ -43,7 +43,7 @@ // FIXME: m_imageFilter should be replaced with m_webFilterOperations when copying data to the compositor. sk_sp<SkImageFilter> m_imageFilter; - std::unique_ptr<CompositorFilterOperations> m_webFilterOperations; + OwnPtr<CompositorFilterOperations> m_webFilterOperations; const FloatRect m_bounds; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h index b6275a1..e9cac36 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h
@@ -8,6 +8,7 @@ #include "platform/PlatformExport.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/paint/DisplayItem.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h index 279e94f..0087fa0 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h
@@ -20,9 +20,8 @@ #include "wtf/Assertions.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> #include <utility> class SkPicture; @@ -40,9 +39,9 @@ WTF_MAKE_NONCOPYABLE(PaintController); USING_FAST_MALLOC(PaintController); public: - static std::unique_ptr<PaintController> create() + static PassOwnPtr<PaintController> create() { - return wrapUnique(new PaintController()); + return adoptPtr(new PaintController()); } ~PaintController()
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index 826c05d..bd302cd 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -15,7 +15,6 @@ #include "platform/graphics/paint/SubsequenceRecorder.h" #include "platform/testing/FakeDisplayItemClient.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -39,7 +38,7 @@ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled); } - std::unique_ptr<PaintController> m_paintController; + OwnPtr<PaintController> m_paintController; bool m_originalSlimmingPaintV2Enabled; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h index f8b0e54..73ca8c1 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h
@@ -8,6 +8,7 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/paint/DisplayItem.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp index 2d8215d5..6c5a50d4 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp
@@ -7,7 +7,6 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -20,7 +19,7 @@ m_paintController = PaintController::create(); m_paintController->beginSkippingCache(); - m_context = wrapUnique(new GraphicsContext(*m_paintController, disabledMode, metaData)); + m_context = adoptPtr(new GraphicsContext(*m_paintController, disabledMode, metaData)); if (containingContext) { m_context->setDeviceScaleFactor(containingContext->deviceScaleFactor());
diff --git a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h index edf2b25c8..1bb4839 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h +++ b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h
@@ -9,8 +9,8 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/paint/DisplayItemClient.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include <memory> class SkMetaData; class SkPicture; @@ -45,8 +45,8 @@ private: DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION - std::unique_ptr<PaintController> m_paintController; - std::unique_ptr<GraphicsContext> m_context; + OwnPtr<PaintController> m_paintController; + OwnPtr<GraphicsContext> m_context; FloatRect m_bounds; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h index b25dcd5..cb028bcb 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h
@@ -9,6 +9,7 @@ #include "platform/graphics/paint/DisplayItem.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Assertions.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h index 1852458..e05a1b8 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h
@@ -7,6 +7,7 @@ #include "platform/graphics/paint/DisplayItem.h" #include "platform/transforms/AffineTransform.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h b/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h index f40291e9..a109d96 100644 --- a/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h +++ b/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h
@@ -26,8 +26,7 @@ #ifndef MockImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -66,7 +65,7 @@ class MockImageDecoder : public ImageDecoder { public: - static std::unique_ptr<MockImageDecoder> create(MockImageDecoderClient* client) { return wrapUnique(new MockImageDecoder(client)); } + static PassOwnPtr<MockImageDecoder> create(MockImageDecoderClient* client) { return adoptPtr(new MockImageDecoder(client)); } MockImageDecoder(MockImageDecoderClient* client) : ImageDecoder(AlphaPremultiplied, GammaAndColorProfileApplied, noDecodedImageByteLimit) @@ -138,19 +137,19 @@ class MockImageDecoderFactory : public ImageDecoderFactory { public: - static std::unique_ptr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const SkISize& decodedSize) + static PassOwnPtr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const SkISize& decodedSize) { - return wrapUnique(new MockImageDecoderFactory(client, IntSize(decodedSize.width(), decodedSize.height()))); + return adoptPtr(new MockImageDecoderFactory(client, IntSize(decodedSize.width(), decodedSize.height()))); } - static std::unique_ptr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const IntSize& decodedSize) + static PassOwnPtr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const IntSize& decodedSize) { - return wrapUnique(new MockImageDecoderFactory(client, decodedSize)); + return adoptPtr(new MockImageDecoderFactory(client, decodedSize)); } - std::unique_ptr<ImageDecoder> create() override + PassOwnPtr<ImageDecoder> create() override { - std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::create(m_client); + OwnPtr<MockImageDecoder> decoder = MockImageDecoder::create(m_client); decoder->setSize(m_decodedSize.width(), m_decodedSize.height()); return std::move(decoder); }
diff --git a/third_party/WebKit/Source/platform/heap/GCTaskRunner.h b/third_party/WebKit/Source/platform/heap/GCTaskRunner.h index 8ef05d6..d2a37098 100644 --- a/third_party/WebKit/Source/platform/heap/GCTaskRunner.h +++ b/third_party/WebKit/Source/platform/heap/GCTaskRunner.h
@@ -36,8 +36,6 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -102,11 +100,11 @@ USING_FAST_MALLOC(GCTaskRunner); public: explicit GCTaskRunner(WebThread* thread) - : m_gcTaskObserver(wrapUnique(new GCTaskObserver)) + : m_gcTaskObserver(adoptPtr(new GCTaskObserver)) , m_thread(thread) { m_thread->addTaskObserver(m_gcTaskObserver.get()); - ThreadState::current()->addInterruptor(wrapUnique(new MessageLoopInterruptor(thread->getWebTaskRunner()))); + ThreadState::current()->addInterruptor(adoptPtr(new MessageLoopInterruptor(thread->getWebTaskRunner()))); } ~GCTaskRunner() @@ -115,7 +113,7 @@ } private: - std::unique_ptr<GCTaskObserver> m_gcTaskObserver; + OwnPtr<GCTaskObserver> m_gcTaskObserver; WebThread* m_thread; };
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index 6156652..527b04a1 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -48,9 +48,7 @@ #include "wtf/CurrentTime.h" #include "wtf/DataLog.h" #include "wtf/LeakAnnotations.h" -#include "wtf/PtrUtil.h" #include "wtf/allocator/Partitions.h" -#include <memory> namespace blink { @@ -219,15 +217,15 @@ } ThreadHeap::ThreadHeap() - : m_regionTree(wrapUnique(new RegionTree())) - , m_heapDoesNotContainCache(wrapUnique(new HeapDoesNotContainCache)) - , m_safePointBarrier(wrapUnique(new SafePointBarrier())) - , m_freePagePool(wrapUnique(new FreePagePool)) - , m_orphanedPagePool(wrapUnique(new OrphanedPagePool)) - , m_markingStack(wrapUnique(new CallbackStack())) - , m_postMarkingCallbackStack(wrapUnique(new CallbackStack())) - , m_globalWeakCallbackStack(wrapUnique(new CallbackStack())) - , m_ephemeronStack(wrapUnique(new CallbackStack(CallbackStack::kMinimalBlockSize))) + : m_regionTree(adoptPtr(new RegionTree())) + , m_heapDoesNotContainCache(adoptPtr(new HeapDoesNotContainCache)) + , m_safePointBarrier(adoptPtr(new SafePointBarrier())) + , m_freePagePool(adoptPtr(new FreePagePool)) + , m_orphanedPagePool(adoptPtr(new OrphanedPagePool)) + , m_markingStack(adoptPtr(new CallbackStack())) + , m_postMarkingCallbackStack(adoptPtr(new CallbackStack())) + , m_globalWeakCallbackStack(adoptPtr(new CallbackStack())) + , m_ephemeronStack(adoptPtr(new CallbackStack(CallbackStack::kMinimalBlockSize))) { if (ThreadState::current()->isMainThread()) s_mainThreadHeap = this; @@ -488,7 +486,7 @@ RELEASE_ASSERT(!state->isGCForbidden()); state->completeSweep(); - std::unique_ptr<Visitor> visitor = Visitor::create(state, gcType); + OwnPtr<Visitor> visitor = Visitor::create(state, gcType); SafePointScope safePointScope(stackState, state); @@ -581,7 +579,7 @@ // ahead while it is running, hence the termination GC does not enter a // safepoint. VisitorScope will not enter also a safepoint scope for // ThreadTerminationGC. - std::unique_ptr<Visitor> visitor = Visitor::create(state, BlinkGC::ThreadTerminationGC); + OwnPtr<Visitor> visitor = Visitor::create(state, BlinkGC::ThreadTerminationGC); ThreadState::NoAllocationScope noAllocationScope(state);
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h index 9330378..e6dd3ffd 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.h +++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -42,7 +42,6 @@ #include "wtf/Assertions.h" #include "wtf/Atomics.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -404,15 +403,15 @@ RecursiveMutex m_threadAttachMutex; ThreadStateSet m_threads; ThreadHeapStats m_stats; - std::unique_ptr<RegionTree> m_regionTree; - std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; - std::unique_ptr<SafePointBarrier> m_safePointBarrier; - std::unique_ptr<FreePagePool> m_freePagePool; - std::unique_ptr<OrphanedPagePool> m_orphanedPagePool; - std::unique_ptr<CallbackStack> m_markingStack; - std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; - std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; - std::unique_ptr<CallbackStack> m_ephemeronStack; + OwnPtr<RegionTree> m_regionTree; + OwnPtr<HeapDoesNotContainCache> m_heapDoesNotContainCache; + OwnPtr<SafePointBarrier> m_safePointBarrier; + OwnPtr<FreePagePool> m_freePagePool; + OwnPtr<OrphanedPagePool> m_orphanedPagePool; + OwnPtr<CallbackStack> m_markingStack; + OwnPtr<CallbackStack> m_postMarkingCallbackStack; + OwnPtr<CallbackStack> m_globalWeakCallbackStack; + OwnPtr<CallbackStack> m_ephemeronStack; BlinkGC::GCReason m_lastGCReason; static ThreadHeap* s_mainThreadHeap;
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp index b7da90a..d9b9c60 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -48,6 +48,7 @@ #include "wtf/ContainerAnnotations.h" #include "wtf/CurrentTime.h" #include "wtf/LeakAnnotations.h" +#include "wtf/PassOwnPtr.h" #include "wtf/TemporaryChange.h" #include "wtf/allocator/PageAllocator.h" #include "wtf/allocator/Partitions.h"
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp index 5f7d8fd1..2c2dcf1 100644 --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -44,8 +44,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashTraits.h" #include "wtf/LinkedHashSet.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -467,9 +465,9 @@ protected: static void test(ThreadedTesterBase* tester) { - Vector<std::unique_ptr<WebThread>, numberOfThreads> m_threads; + Vector<OwnPtr<WebThread>, numberOfThreads> m_threads; for (int i = 0; i < numberOfThreads; i++) { - m_threads.append(wrapUnique(Platform::current()->createThread("blink gc testing thread"))); + m_threads.append(adoptPtr(Platform::current()->createThread("blink gc testing thread"))); m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(threadFunc, AllowCrossThreadAccess(tester))); } while (tester->m_threadsToFinish) { @@ -531,11 +529,11 @@ using GlobalIntWrapperPersistent = CrossThreadPersistent<IntWrapper>; Mutex m_mutex; - Vector<std::unique_ptr<GlobalIntWrapperPersistent>> m_crossPersistents; + Vector<OwnPtr<GlobalIntWrapperPersistent>> m_crossPersistents; - std::unique_ptr<GlobalIntWrapperPersistent> createGlobalPersistent(int value) + PassOwnPtr<GlobalIntWrapperPersistent> createGlobalPersistent(int value) { - return wrapUnique(new GlobalIntWrapperPersistent(IntWrapper::create(value))); + return adoptPtr(new GlobalIntWrapperPersistent(IntWrapper::create(value))); } void addGlobalPersistent() @@ -559,7 +557,7 @@ { Persistent<IntWrapper> wrapper; - std::unique_ptr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb); + OwnPtr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb); for (int i = 0; i < numberOfAllocations; i++) { wrapper = IntWrapper::create(0x0bbac0de); @@ -1390,7 +1388,7 @@ class FinalizationObserverWithHashMap { public: - typedef HeapHashMap<WeakMember<Observable>, std::unique_ptr<FinalizationObserverWithHashMap>> ObserverMap; + typedef HeapHashMap<WeakMember<Observable>, OwnPtr<FinalizationObserverWithHashMap>> ObserverMap; explicit FinalizationObserverWithHashMap(Observable& target) : m_target(target) { } ~FinalizationObserverWithHashMap() @@ -1404,7 +1402,7 @@ ObserverMap& map = observers(); ObserverMap::AddResult result = map.add(&target, nullptr); if (result.isNewEntry) - result.storedValue->value = wrapUnique(new FinalizationObserverWithHashMap(target)); + result.storedValue->value = adoptPtr(new FinalizationObserverWithHashMap(target)); else ASSERT(result.storedValue->value); return map; @@ -4796,9 +4794,9 @@ TEST(HeapTest, DestructorsCalled) { - HeapHashMap<Member<IntWrapper>, std::unique_ptr<SimpleClassWithDestructor>> map; + HeapHashMap<Member<IntWrapper>, OwnPtr<SimpleClassWithDestructor>> map; SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); - map.add(IntWrapper::create(1), wrapUnique(hasDestructor)); + map.add(IntWrapper::create(1), adoptPtr(hasDestructor)); SimpleClassWithDestructor::s_wasDestructed = false; map.clear(); EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); @@ -4943,7 +4941,7 @@ public: static void test() { - std::unique_ptr<WebThread> sleepingThread = wrapUnique(Platform::current()->createThread("SleepingThread")); + OwnPtr<WebThread> sleepingThread = adoptPtr(Platform::current()->createThread("SleepingThread")); sleepingThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(sleeperMainFunc)); // Wait for the sleeper to run. @@ -5608,7 +5606,7 @@ IntWrapper::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Wait for the worker thread to have done its initialization, @@ -5711,7 +5709,7 @@ IntWrapper::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Wait for the worker thread initialization. The worker @@ -5914,7 +5912,7 @@ DestructorLockingObject::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Park the main thread until the worker thread has initialized. @@ -6619,7 +6617,7 @@ TEST(HeapTest, WeakPersistent) { Persistent<IntWrapper> object = new IntWrapper(20); - std::unique_ptr<WeakPersistentHolder> holder = wrapUnique(new WeakPersistentHolder(object)); + OwnPtr<WeakPersistentHolder> holder = adoptPtr(new WeakPersistentHolder(object)); preciselyCollectGarbage(); EXPECT_TRUE(holder->object()); object = nullptr; @@ -6660,7 +6658,7 @@ // Step 1: Initiate a worker thread, and wait for |object| to get allocated on the worker thread. MutexLocker mainThreadMutexLocker(mainThreadMutex()); - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); DestructorLockingObject* object = nullptr; workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object))); parkMainThread();
diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.h b/third_party/WebKit/Source/platform/heap/PersistentNode.h index c9bebe3..a685840 100644 --- a/third_party/WebKit/Source/platform/heap/PersistentNode.h +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.h
@@ -9,9 +9,7 @@ #include "platform/heap/ThreadState.h" #include "wtf/Allocator.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace blink { @@ -174,7 +172,7 @@ class CrossThreadPersistentRegion final { USING_FAST_MALLOC(CrossThreadPersistentRegion); public: - CrossThreadPersistentRegion() : m_persistentRegion(wrapUnique(new PersistentRegion)) { } + CrossThreadPersistentRegion() : m_persistentRegion(adoptPtr(new PersistentRegion)) { } void allocatePersistentNode(PersistentNode*& persistentNode, void* self, TraceCallback trace) { @@ -244,7 +242,7 @@ // We don't make CrossThreadPersistentRegion inherit from PersistentRegion // because we don't want to virtualize performance-sensitive methods // such as PersistentRegion::allocate/freePersistentNode. - std::unique_ptr<PersistentRegion> m_persistentRegion; + OwnPtr<PersistentRegion> m_persistentRegion; // Recursive as prepareForThreadStateTermination() clears a PersistentNode's // associated Persistent<> -- it in turn freeing the PersistentNode. And both
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 63e607a7..8d0320d 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -49,11 +49,8 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/CurrentTime.h" #include "wtf/DataLog.h" -#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/allocator/Partitions.h" -#include <memory> -#include <v8.h> #if OS(WIN) #include <stddef.h> @@ -69,6 +66,8 @@ #include <pthread_np.h> #endif +#include <v8.h> + namespace blink { WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = nullptr; @@ -78,7 +77,7 @@ ThreadState::ThreadState(bool perThreadHeapEnabled) : m_thread(currentThread()) - , m_persistentRegion(wrapUnique(new PersistentRegion())) + , m_persistentRegion(adoptPtr(new PersistentRegion())) #if OS(WIN) && COMPILER(MSVC) , m_threadStackSize(0) #endif @@ -133,7 +132,7 @@ m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkGC::LargeObjectArenaIndex); - m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedArraySize]); + m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArraySize]); clearArenaAges(); // There is little use of weak references and collections off the main thread; @@ -448,7 +447,7 @@ // Due to the complexity, we just forbid allocations. NoAllocationScope noAllocationScope(this); - std::unique_ptr<Visitor> visitor = Visitor::create(this, BlinkGC::ThreadLocalWeakProcessing); + OwnPtr<Visitor> visitor = Visitor::create(this, BlinkGC::ThreadLocalWeakProcessing); // Perform thread-specific weak processing. while (popAndInvokeThreadLocalWeakCallback(visitor.get())) { } @@ -1321,7 +1320,7 @@ } } -void ThreadState::addInterruptor(std::unique_ptr<BlinkGCInterruptor> interruptor) +void ThreadState::addInterruptor(PassOwnPtr<BlinkGCInterruptor> interruptor) { ASSERT(checkThread()); SafePointScope scope(BlinkGC::HeapPointersOnStack);
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h index 16825dc..234e07f 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.h +++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -45,7 +45,6 @@ #include "wtf/ThreadSpecific.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> namespace v8 { class Isolate; @@ -79,12 +78,12 @@ // Since a pre-finalizer adds pressure on GC performance, you should use it // only if necessary. // -// A pre-finalizer is similar to the HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> +// A pre-finalizer is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> // idiom. The difference between this and the idiom is that pre-finalizer // function is called whenever an object is destructed with this feature. The -// HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> idiom requires an assumption +// HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> idiom requires an assumption // that the HeapHashMap outlives objects pointed by WeakMembers. -// FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> +// FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> // idiom usages with the pre-finalizer if the replacement won't cause // performance regressions. // @@ -335,7 +334,7 @@ void leaveSafePoint(SafePointAwareMutexLocker* = nullptr); bool isAtSafePoint() const { return m_atSafePoint; } - void addInterruptor(std::unique_ptr<BlinkGCInterruptor>); + void addInterruptor(PassOwnPtr<BlinkGCInterruptor>); void recordStackEnd(intptr_t* endOfStack) { @@ -601,7 +600,7 @@ void reportMemoryToV8(); // Should only be called under protection of threadAttachMutex(). - const Vector<std::unique_ptr<BlinkGCInterruptor>>& interruptors() const { return m_interruptors; } + const Vector<OwnPtr<BlinkGCInterruptor>>& interruptors() const { return m_interruptors; } friend class SafePointAwareMutexLocker; friend class SafePointBarrier; @@ -622,7 +621,7 @@ ThreadHeap* m_heap; ThreadIdentifier m_thread; - std::unique_ptr<PersistentRegion> m_persistentRegion; + OwnPtr<PersistentRegion> m_persistentRegion; BlinkGC::StackState m_stackState; #if OS(WIN) && COMPILER(MSVC) size_t m_threadStackSize; @@ -633,7 +632,7 @@ void* m_safePointScopeMarker; Vector<Address> m_safePointStackCopy; bool m_atSafePoint; - Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors; + Vector<OwnPtr<BlinkGCInterruptor>> m_interruptors; bool m_sweepForbidden; size_t m_noAllocationCount; size_t m_gcForbiddenCount; @@ -683,7 +682,7 @@ // since there will be less than 2^8 types of objects in common cases. static const int likelyToBePromptlyFreedArraySize = (1 << 8); static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedArraySize - 1; - std::unique_ptr<int[]> m_likelyToBePromptlyFreed; + OwnPtr<int[]> m_likelyToBePromptlyFreed; // Stats for heap memory of this thread. size_t m_allocatedObjectSize;
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.cpp b/third_party/WebKit/Source/platform/heap/Visitor.cpp index e69f336b..3649860 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.cpp +++ b/third_party/WebKit/Source/platform/heap/Visitor.cpp
@@ -7,23 +7,21 @@ #include "platform/heap/BlinkGC.h" #include "platform/heap/MarkingVisitor.h" #include "platform/heap/ThreadState.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType) +PassOwnPtr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType) { switch (gcType) { case BlinkGC::GCWithSweep: case BlinkGC::GCWithoutSweep: - return wrapUnique(new MarkingVisitor<Visitor::GlobalMarking>(state)); + return adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>(state)); case BlinkGC::TakeSnapshot: - return wrapUnique(new MarkingVisitor<Visitor::SnapshotMarking>(state)); + return adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>(state)); case BlinkGC::ThreadTerminationGC: - return wrapUnique(new MarkingVisitor<Visitor::ThreadLocalMarking>(state)); + return adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>(state)); case BlinkGC::ThreadLocalWeakProcessing: - return wrapUnique(new MarkingVisitor<Visitor::WeakProcessing>(state)); + return adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>(state)); default: ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h index 97a660d3b..9ddefb9 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.h +++ b/third_party/WebKit/Source/platform/heap/Visitor.h
@@ -38,7 +38,6 @@ #include "wtf/Forward.h" #include "wtf/HashTraits.h" #include "wtf/TypeTraits.h" -#include <memory> namespace blink { @@ -262,7 +261,7 @@ WeakProcessing, }; - static std::unique_ptr<Visitor> create(ThreadState*, BlinkGC::GCType); + static PassOwnPtr<Visitor> create(ThreadState*, BlinkGC::GCType); virtual ~Visitor();
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp index 8a09dec8..6a887969 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -27,8 +27,7 @@ #include "platform/image-decoders/jpeg/JPEGImageDecoder.h" #include "platform/image-decoders/png/PNGImageDecoder.h" #include "platform/image-decoders/webp/WEBPImageDecoder.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -80,7 +79,7 @@ return !memcmp(contents, "BM", 2); } -std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +PassOwnPtr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const size_t longestSignatureLength = sizeof("RIFF????WEBPVP") - 1; ASSERT(longestSignatureLength == 14); @@ -91,34 +90,34 @@ size_t maxDecodedBytes = Platform::current() ? Platform::current()->maxDecodedImageBytes() : noDecodedImageByteLimit; if (matchesJPEGSignature(contents)) - return wrapUnique(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesPNGSignature(contents)) - return wrapUnique(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesGIFSignature(contents)) - return wrapUnique(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesWebPSignature(contents)) - return wrapUnique(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesICOSignature(contents) || matchesCURSignature(contents)) - return wrapUnique(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesBMPSignature(contents)) - return wrapUnique(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return adoptPtr(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); return nullptr; } -std::unique_ptr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const char* contents; const size_t length = data.getSomeData<size_t>(contents); return create(contents, length, alphaOption, colorOptions); } -std::unique_ptr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +PassOwnPtr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const char* contents; const size_t length = data.getSomeData(contents, 0);
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h index c444907..70198f1f 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -36,6 +36,7 @@ #include "platform/image-decoders/SegmentReader.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" #include "wtf/Vector.h" @@ -108,9 +109,9 @@ // we can't sniff a supported type from the provided data (possibly // because there isn't enough data yet). // Sets m_maxDecodedBytes to Platform::maxImageDecodedBytes(). - static std::unique_ptr<ImageDecoder> create(const char* data, size_t length, AlphaOption, GammaAndColorProfileOption); - static std::unique_ptr<ImageDecoder> create(const SharedBuffer&, AlphaOption, GammaAndColorProfileOption); - static std::unique_ptr<ImageDecoder> create(const SegmentReader&, AlphaOption, GammaAndColorProfileOption); + static PassOwnPtr<ImageDecoder> create(const char* data, size_t length, AlphaOption, GammaAndColorProfileOption); + static PassOwnPtr<ImageDecoder> create(const SharedBuffer&, AlphaOption, GammaAndColorProfileOption); + static PassOwnPtr<ImageDecoder> create(const SegmentReader&, AlphaOption, GammaAndColorProfileOption); virtual String filenameExtension() const = 0; @@ -263,7 +264,7 @@ virtual bool canDecodeToYUV() { return false; } virtual bool decodeToYUV() { return false; } - virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) { } + virtual void setImagePlanes(PassOwnPtr<ImagePlanes>) { } protected: // Calculates the most recent frame whose image data may be needed in
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp index e66fc61..c21e161 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
@@ -32,9 +32,9 @@ #include "platform/image-decoders/ImageFrame.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -73,7 +73,7 @@ TEST(ImageDecoderTest, sizeCalculationMayOverflow) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); EXPECT_FALSE(decoder->setSize(1 << 29, 1)); EXPECT_FALSE(decoder->setSize(1, 1 << 29)); EXPECT_FALSE(decoder->setSize(1 << 15, 1 << 15)); @@ -84,7 +84,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndex) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(6); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -109,7 +109,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexDisposeOverwriteBgcolor) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -126,7 +126,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexForFrame1) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(2); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -155,7 +155,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexBlendAtopBgcolor) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -180,7 +180,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexKnownOpaque) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -204,7 +204,7 @@ TEST(ImageDecoderTest, clearCacheExceptFrameDoNothing) { - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->clearCacheExceptFrame(0); // This should not crash. @@ -215,7 +215,7 @@ TEST(ImageDecoderTest, clearCacheExceptFrameAll) { const size_t numFrames = 10; - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(numFrames); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); for (size_t i = 0; i < numFrames; ++i) @@ -232,7 +232,7 @@ TEST(ImageDecoderTest, clearCacheExceptFramePreverveClearExceptFrame) { const size_t numFrames = 10; - std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); + OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); decoder->initFrames(numFrames); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); for (size_t i = 0; i < numFrames; ++i)
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp index 6e11a895..574ea355 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
@@ -9,8 +9,8 @@ #include "platform/image-decoders/ImageFrame.h" #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/StringHasher.h" -#include <memory> namespace blink { @@ -39,7 +39,7 @@ static unsigned createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data, true); ImageFrame* frame = decoder->frameBufferAtIndex(0); return hashBitmap(frame->bitmap()); @@ -47,7 +47,7 @@ void createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data, Vector<unsigned>* baselineHashes) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data, true); size_t frameCount = decoder->frameCount(); for (size_t i = 0; i < frameCount; ++i) { @@ -65,7 +65,7 @@ Vector<unsigned> baselineHashes; createDecodingBaseline(createDecoder, data.get(), &baselineHashes); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); size_t frameCount = 0; size_t framesDecoded = 0; @@ -129,7 +129,7 @@ RefPtr<SharedBuffer> segmentedData = SharedBuffer::create(); segmentedData->append(data->data(), data->size()); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(segmentedData.get(), true); ASSERT_TRUE(decoder->isSizeAvailable());
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h index 837b5306..88683855b 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> class SkBitmap; @@ -11,7 +11,7 @@ class ImageDecoder; class SharedBuffer; -using DecoderCreator = std::unique_ptr<ImageDecoder>(*)(); +using DecoderCreator = PassOwnPtr<ImageDecoder>(*)(); PassRefPtr<SharedBuffer> readFile(const char* fileName); PassRefPtr<SharedBuffer> readFile(const char* dir, const char* fileName); unsigned hashBitmap(const SkBitmap&);
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp index 0cf541a..87a80281 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp
@@ -31,7 +31,7 @@ #include "platform/image-decoders/bmp/BMPImageDecoder.h" #include "platform/image-decoders/FastSharedBufferReader.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -80,7 +80,7 @@ return false; if (!m_reader) { - m_reader = wrapUnique(new BMPImageReader(this, m_decodedOffset, imgDataOffset, false)); + m_reader = adoptPtr(new BMPImageReader(this, m_decodedOffset, imgDataOffset, false)); m_reader->setData(m_data.get()); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h index a912246d..e4a6bd1 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h
@@ -32,7 +32,7 @@ #define BMPImageDecoder_h #include "platform/image-decoders/bmp/BMPImageReader.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -74,7 +74,7 @@ size_t m_decodedOffset; // The reader used to do most of the BMP decoding. - std::unique_ptr<BMPImageReader> m_reader; + OwnPtr<BMPImageReader> m_reader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp index 14b399a..1e2bc10 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
@@ -7,16 +7,14 @@ #include "platform/SharedBuffer.h" #include "platform/image-decoders/ImageDecoderTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { -std::unique_ptr<ImageDecoder> createDecoder() +PassOwnPtr<ImageDecoder> createDecoder() { - return wrapUnique(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return adoptPtr(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } } // anonymous namespace @@ -27,7 +25,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); EXPECT_TRUE(decoder->isSizeAvailable()); EXPECT_EQ(256, decoder->size().width()); @@ -40,7 +38,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0); @@ -58,7 +56,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0);
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp index 68e9334..2cae67e0a 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -25,10 +25,10 @@ #include "platform/image-decoders/gif/GIFImageDecoder.h" +#include <limits> #include "platform/image-decoders/gif/GIFImageReader.h" #include "wtf/NotFound.h" -#include "wtf/PtrUtil.h" -#include <limits> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -331,7 +331,7 @@ return; if (!m_reader) { - m_reader = wrapUnique(new GIFImageReader(this)); + m_reader = adoptPtr(new GIFImageReader(this)); m_reader->setData(m_data); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h index a2c6ce1..98941e68 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h
@@ -28,7 +28,7 @@ #include "platform/image-decoders/ImageDecoder.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" class GIFImageReader; @@ -86,7 +86,7 @@ bool m_currentBufferSawAlpha; mutable int m_repetitionCount; - std::unique_ptr<GIFImageReader> m_reader; + OwnPtr<GIFImageReader> m_reader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp index 25f7ad5..756eb33 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -35,9 +35,9 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -46,9 +46,9 @@ const char decodersTestingDir[] = "Source/platform/image-decoders/testing"; const char layoutTestResourcesDir[] = "LayoutTests/fast/images/resources"; -std::unique_ptr<ImageDecoder> createDecoder() +PassOwnPtr<ImageDecoder> createDecoder() { - return wrapUnique(new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return adoptPtr(new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } void testRandomFrameDecode(const char* dir, const char* gifFile) @@ -62,7 +62,7 @@ size_t frameCount = baselineHashes.size(); // Random decoding should get the same results as sequential decoding. - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(fullData.get(), true); const size_t skippingStep = 5; for (size_t i = 0; i < skippingStep; ++i) { @@ -93,7 +93,7 @@ createDecodingBaseline(&createDecoder, data.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) { decoder->clearCacheExceptFrame(clearExceptFrame); @@ -112,7 +112,7 @@ TEST(GIFImageDecoderTest, decodeTwoFrames) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -138,7 +138,7 @@ TEST(GIFImageDecoderTest, parseAndDecode) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -162,7 +162,7 @@ TEST(GIFImageDecoderTest, parseByteByByte) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -187,7 +187,7 @@ TEST(GIFImageDecoderTest, parseAndDecodeByteByByte) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated-gif-with-offsets.gif"); ASSERT_TRUE(data.get()); @@ -215,7 +215,7 @@ TEST(GIFImageDecoderTest, brokenSecondFrame) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(decodersTestingDir, "broken.gif"); ASSERT_TRUE(data.get()); @@ -233,7 +233,7 @@ ASSERT_TRUE(fullData.get()); const size_t fullLength = fullData->size(); - std::unique_ptr<ImageDecoder> decoder; + OwnPtr<ImageDecoder> decoder; ImageFrame* frame; Vector<unsigned> truncatedHashes; @@ -280,7 +280,7 @@ TEST(GIFImageDecoderTest, allDataReceivedTruncation) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -300,7 +300,7 @@ TEST(GIFImageDecoderTest, frameIsComplete) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -315,7 +315,7 @@ TEST(GIFImageDecoderTest, frameIsCompleteLoading) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -342,13 +342,13 @@ ASSERT_TRUE(referenceData.get()); ASSERT_TRUE(testData.get()); - std::unique_ptr<ImageDecoder> referenceDecoder = createDecoder(); + OwnPtr<ImageDecoder> referenceDecoder = createDecoder(); referenceDecoder->setData(referenceData.get(), true); EXPECT_EQ(1u, referenceDecoder->frameCount()); ImageFrame* referenceFrame = referenceDecoder->frameBufferAtIndex(0); ASSERT(referenceFrame); - std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); + OwnPtr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ImageFrame* testFrame = testDecoder->frameBufferAtIndex(0); @@ -359,7 +359,7 @@ TEST(GIFImageDecoderTest, updateRequiredPreviousFrameAfterFirstDecode) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile(layoutTestResourcesDir, "animated-10color.gif"); ASSERT_TRUE(fullData.get()); @@ -409,7 +409,7 @@ createDecodingBaseline(&createDecoder, fullData.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); // Let frame 0 be partially decoded. size_t partialSize = 1; @@ -439,7 +439,7 @@ RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "bad-initial-code.gif"); ASSERT_TRUE(testData.get()); - std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); + OwnPtr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ASSERT_TRUE(testDecoder->frameBufferAtIndex(0)); @@ -452,7 +452,7 @@ RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "bad-code.gif"); ASSERT_TRUE(testData.get()); - std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); + OwnPtr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ASSERT_TRUE(testDecoder->frameBufferAtIndex(0)); @@ -461,7 +461,7 @@ TEST(GIFImageDecoderTest, invalidDisposalMethod) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); // The image has 2 frames, with disposal method 4 and 5, respectively. RefPtr<SharedBuffer> data = readFile(decodersTestingDir, "invalid-disposal-method.gif"); @@ -480,7 +480,7 @@ RefPtr<SharedBuffer> fullData = readFile(decodersTestingDir, "first-frame-has-greater-size-than-screen-size.gif"); ASSERT_TRUE(fullData.get()); - std::unique_ptr<ImageDecoder> decoder; + OwnPtr<ImageDecoder> decoder; IntSize frameSize; // Compute hashes when the file is truncated. @@ -502,7 +502,7 @@ TEST(GIFImageDecoderTest, verifyRepetitionCount) { const int expectedRepetitionCount = 2; - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "full2loop.gif"); ASSERT_TRUE(data.get()); decoder->setData(data.get(), true); @@ -528,11 +528,11 @@ ASSERT_TRUE(kTruncateSize < fullData->size()); RefPtr<SharedBuffer> partialData = SharedBuffer::create(fullData->data(), kTruncateSize); - std::unique_ptr<ImageDecoder> premulDecoder = wrapUnique(new GIFImageDecoder( + OwnPtr<ImageDecoder> premulDecoder = adoptPtr(new GIFImageDecoder( ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); - std::unique_ptr<ImageDecoder> unpremulDecoder = wrapUnique(new GIFImageDecoder( + OwnPtr<ImageDecoder> unpremulDecoder = adoptPtr(new GIFImageDecoder( ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit));
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp index 3ed6e66..34679f5 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
@@ -75,8 +75,8 @@ #include "platform/image-decoders/gif/GIFImageReader.h" #include "platform/Histogram.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" + #include <string.h> using blink::GIFImageDecoder; @@ -336,7 +336,7 @@ if (!isDataSizeDefined() || !isHeaderDefined()) return true; - m_lzwContext = wrapUnique(new GIFLZWContext(client, this)); + m_lzwContext = adoptPtr(new GIFLZWContext(client, this)); if (!m_lzwContext->prepareToDecode()) { m_lzwContext.reset(); return false; @@ -827,7 +827,7 @@ void GIFImageReader::addFrameIfNecessary() { if (m_frames.isEmpty() || m_frames.last()->isComplete()) - m_frames.append(wrapUnique(new GIFFrameContext(m_frames.size()))); + m_frames.append(adoptPtr(new GIFFrameContext(m_frames.size()))); } // FIXME: Move this method to close to doLZW().
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h index 068b921..1ec9d384 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h
@@ -44,8 +44,9 @@ #include "platform/image-decoders/gif/GIFImageDecoder.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> #define MAX_DICTIONARY_ENTRY_BITS 12 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS @@ -266,7 +267,7 @@ unsigned m_delayTime; // Display time, in milliseconds, for this image in a multi-image GIF. - std::unique_ptr<GIFLZWContext> m_lzwContext; + OwnPtr<GIFLZWContext> m_lzwContext; Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. GIFColorMap m_localColorMap; @@ -352,7 +353,7 @@ GIFColorMap m_globalColorMap; int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders. - Vector<std::unique_ptr<GIFFrameContext>> m_frames; + Vector<OwnPtr<GIFFrameContext>> m_frames; RefPtr<blink::SegmentReader> m_data; bool m_parseCompleted;
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp index f8d39b9..00d19d7e 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp
@@ -32,8 +32,9 @@ #include "platform/Histogram.h" #include "platform/image-decoders/png/PNGImageDecoder.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Threading.h" + #include <algorithm> namespace blink { @@ -195,7 +196,7 @@ if (imageType == BMP) { if (!m_bmpReaders[index]) { - m_bmpReaders[index] = wrapUnique(new BMPImageReader(this, dirEntry.m_imageOffset, 0, true)); + m_bmpReaders[index] = adoptPtr(new BMPImageReader(this, dirEntry.m_imageOffset, 0, true)); m_bmpReaders[index]->setData(m_data.get()); } // Update the pointer to the buffer as it could change after @@ -210,7 +211,7 @@ if (!m_pngDecoders[index]) { AlphaOption alphaOption = m_premultiplyAlpha ? AlphaPremultiplied : AlphaNotPremultiplied; GammaAndColorProfileOption colorOptions = m_ignoreGammaAndColorProfile ? GammaAndColorProfileIgnored : GammaAndColorProfileApplied; - m_pngDecoders[index] = wrapUnique(new PNGImageDecoder(alphaOption, colorOptions, m_maxDecodedBytes, dirEntry.m_imageOffset)); + m_pngDecoders[index] = adoptPtr(new PNGImageDecoder(alphaOption, colorOptions, m_maxDecodedBytes, dirEntry.m_imageOffset)); setDataForPNGDecoderAtIndex(index); } // Fail if the size the PNGImageDecoder calculated does not match the size
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h index 0f875ffe..7bfe240a 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h
@@ -33,7 +33,6 @@ #include "platform/image-decoders/FastSharedBufferReader.h" #include "platform/image-decoders/bmp/BMPImageReader.h" -#include <memory> namespace blink { @@ -160,9 +159,9 @@ IconDirectoryEntries m_dirEntries; // The image decoders for the various frames. - typedef Vector<std::unique_ptr<BMPImageReader>> BMPReaders; + typedef Vector<OwnPtr<BMPImageReader>> BMPReaders; BMPReaders m_bmpReaders; - typedef Vector<std::unique_ptr<PNGImageDecoder>> PNGDecoders; + typedef Vector<OwnPtr<PNGImageDecoder>> PNGDecoders; PNGDecoders m_pngDecoders; // Valid only while a BMPImageReader is decoding, this holds the size
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp index 31b0a3f..9e061ec 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp
@@ -6,16 +6,14 @@ #include "platform/image-decoders/ImageDecoderTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { -std::unique_ptr<ImageDecoder> createDecoder() +PassOwnPtr<ImageDecoder> createDecoder() { - return wrapUnique(new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return adoptPtr(new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } }
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 63827d4..95bb9acd 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -39,9 +39,7 @@ #include "platform/Histogram.h" #include "platform/PlatformInstrumentation.h" -#include "wtf/PtrUtil.h" #include "wtf/Threading.h" -#include <memory> extern "C" { #include <stdio.h> // jpeglib.h needs stdio FILE. @@ -795,7 +793,7 @@ return !failed(); } -void JPEGImageDecoder::setImagePlanes(std::unique_ptr<ImagePlanes> imagePlanes) +void JPEGImageDecoder::setImagePlanes(PassOwnPtr<ImagePlanes> imagePlanes) { m_imagePlanes = std::move(imagePlanes); } @@ -990,7 +988,7 @@ return; if (!m_reader) { - m_reader = wrapUnique(new JPEGImageReader(this)); + m_reader = adoptPtr(new JPEGImageReader(this)); m_reader->setData(m_data.get()); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h index 845bfcb..0dc93f1 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h
@@ -27,7 +27,6 @@ #define JPEGImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" -#include <memory> namespace blink { @@ -48,7 +47,7 @@ size_t decodedYUVWidthBytes(int component) const override; bool canDecodeToYUV() override; bool decodeToYUV() override; - void setImagePlanes(std::unique_ptr<ImagePlanes>) override; + void setImagePlanes(PassOwnPtr<ImagePlanes>) override; bool hasImagePlanes() const { return m_imagePlanes.get(); } bool outputScanlines(); @@ -68,8 +67,8 @@ // data coming, sets the "decode failure" flag. void decode(bool onlySize); - std::unique_ptr<JPEGImageReader> m_reader; - std::unique_ptr<ImagePlanes> m_imagePlanes; + OwnPtr<JPEGImageReader> m_reader; + OwnPtr<ImagePlanes> m_imagePlanes; IntSize m_decodedSize; };
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp index 6295e54..4de383f 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
@@ -36,9 +36,9 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/typed_arrays/ArrayBuffer.h" -#include <memory> namespace blink { @@ -46,12 +46,12 @@ namespace { -std::unique_ptr<ImageDecoder> createDecoder(size_t maxDecodedBytes) +PassOwnPtr<ImageDecoder> createDecoder(size_t maxDecodedBytes) { - return wrapUnique(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes)); + return adoptPtr(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes)); } -std::unique_ptr<ImageDecoder> createDecoder() +PassOwnPtr<ImageDecoder> createDecoder() { return createDecoder(ImageDecoder::noDecodedImageByteLimit); } @@ -63,7 +63,7 @@ RefPtr<SharedBuffer> data = readFile(imageFilePath); ASSERT_TRUE(data); - std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); + OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0); @@ -78,11 +78,11 @@ RefPtr<SharedBuffer> data = readFile(imageFilePath); ASSERT_TRUE(data); - std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); + OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); decoder->setData(data.get(), true); // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. - std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes()); + OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes()); decoder->setImagePlanes(std::move(dummyImagePlanes)); bool sizeIsAvailable = decoder->isSizeAvailable(); @@ -114,7 +114,7 @@ planes[1] = ((char*) planes[0]) + rowBytes[0] * ySize.height(); planes[2] = ((char*) planes[1]) + rowBytes[1] * uSize.height(); - std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes)); + OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT_TRUE(decoder->decodeToYUV()); @@ -123,7 +123,7 @@ // Tests failure on a too big image. TEST(JPEGImageDecoderTest, tooBig) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(100); + OwnPtr<ImageDecoder> decoder = createDecoder(100); EXPECT_FALSE(decoder->setSize(10000, 10000)); EXPECT_TRUE(decoder->failed()); } @@ -247,10 +247,10 @@ RefPtr<SharedBuffer> data = readFile(jpegFile); ASSERT_TRUE(data); - std::unique_ptr<ImageDecoder> decoder = createDecoder(230 * 230 * 4); + OwnPtr<ImageDecoder> decoder = createDecoder(230 * 230 * 4); decoder->setData(data.get(), true); - std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes()); + OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes()); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT_TRUE(decoder->isSizeAvailable()); ASSERT_FALSE(decoder->canDecodeToYUV());
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp index c0b8473a..23715e3 100644 --- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -39,8 +39,6 @@ #include "platform/image-decoders/png/PNGImageDecoder.h" #include "png.h" -#include "wtf/PtrUtil.h" -#include <memory> #if !defined(PNG_LIBPNG_VER_MAJOR) || !defined(PNG_LIBPNG_VER_MINOR) #error version error: compile against a versioned libpng. @@ -144,10 +142,10 @@ bool hasAlpha() const { return m_hasAlpha; } png_bytep interlaceBuffer() const { return m_interlaceBuffer.get(); } - void createInterlaceBuffer(int size) { m_interlaceBuffer = wrapArrayUnique(new png_byte[size]); } + void createInterlaceBuffer(int size) { m_interlaceBuffer = adoptArrayPtr(new png_byte[size]); } #if USE(QCMSLIB) png_bytep rowBuffer() const { return m_rowBuffer.get(); } - void createRowBuffer(int size) { m_rowBuffer = wrapArrayUnique(new png_byte[size]); } + void createRowBuffer(int size) { m_rowBuffer = adoptArrayPtr(new png_byte[size]); } #endif private: @@ -158,9 +156,9 @@ size_t m_currentBufferSize; bool m_decodingSizeOnly; bool m_hasAlpha; - std::unique_ptr<png_byte[]> m_interlaceBuffer; + OwnPtr<png_byte[]> m_interlaceBuffer; #if USE(QCMSLIB) - std::unique_ptr<png_byte[]> m_rowBuffer; + OwnPtr<png_byte[]> m_rowBuffer; #endif }; @@ -430,7 +428,7 @@ return; if (!m_reader) - m_reader = wrapUnique(new PNGImageReader(this, m_offset)); + m_reader = adoptPtr(new PNGImageReader(this, m_offset)); // If we couldn't decode the image but have received all the data, decoding // has failed.
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h index c0c9ca8..f41b543 100644 --- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
@@ -27,7 +27,6 @@ #define PNGImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" -#include <memory> namespace blink { @@ -57,7 +56,7 @@ // data coming, sets the "decode failure" flag. void decode(bool onlySize); - std::unique_ptr<PNGImageReader> m_reader; + OwnPtr<PNGImageReader> m_reader; const unsigned m_offset; };
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp index a941551..b3474e3 100644 --- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
@@ -36,21 +36,21 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/dtoa/utils.h" -#include <memory> namespace blink { namespace { -std::unique_ptr<ImageDecoder> createDecoder(ImageDecoder::AlphaOption alphaOption) +PassOwnPtr<ImageDecoder> createDecoder(ImageDecoder::AlphaOption alphaOption) { - return wrapUnique(new WEBPImageDecoder(alphaOption, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return adoptPtr(new WEBPImageDecoder(alphaOption, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } -std::unique_ptr<ImageDecoder> createDecoder() +PassOwnPtr<ImageDecoder> createDecoder() { return createDecoder(ImageDecoder::AlphaNotPremultiplied); } @@ -66,7 +66,7 @@ size_t frameCount = baselineHashes.size(); // Random decoding should get the same results as sequential decoding. - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(fullData.get(), true); const size_t skippingStep = 5; for (size_t i = 0; i < skippingStep; ++i) { @@ -97,7 +97,7 @@ createDecodingBaseline(&createDecoder, data.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) { decoder->clearCacheExceptFrame(clearExceptFrame); @@ -114,7 +114,7 @@ void testDecodeAfterReallocatingData(const char* webpFile) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); @@ -136,7 +136,7 @@ void testByteByByteSizeAvailable(const char* webpFile, size_t frameOffset, bool hasColorProfile, int expectedRepetitionCount) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); EXPECT_LT(frameOffset, data->size()); @@ -181,7 +181,7 @@ // call); else error is expected during decode (frameBufferAtIndex() call). void testInvalidImage(const char* webpFile, bool parseErrorExpected) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); @@ -242,10 +242,10 @@ RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); - std::unique_ptr<ImageDecoder> decoderA = createDecoder(ImageDecoder::AlphaPremultiplied); + OwnPtr<ImageDecoder> decoderA = createDecoder(ImageDecoder::AlphaPremultiplied); decoderA->setData(data.get(), true); - std::unique_ptr<ImageDecoder> decoderB = createDecoder(ImageDecoder::AlphaNotPremultiplied); + OwnPtr<ImageDecoder> decoderB = createDecoder(ImageDecoder::AlphaNotPremultiplied); decoderB->setData(data.get(), true); size_t frameCount = decoderA->frameCount(); @@ -259,7 +259,7 @@ TEST(AnimatedWebPTests, uniqueGenerationIDs) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(data.get()); @@ -275,7 +275,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersTransparentImage) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); @@ -317,7 +317,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersOpaqueFramesTransparentBackground) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-opaque.webp"); @@ -360,7 +360,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersBlendOverwrite) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-no-blend.webp"); @@ -417,7 +417,7 @@ TEST(AnimatedWebPTests, truncatedLastFrame) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp2.webp"); ASSERT_TRUE(data.get()); @@ -440,7 +440,7 @@ TEST(AnimatedWebPTests, truncatedInBetweenFrame) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp4.webp"); ASSERT_TRUE(fullData.get()); @@ -459,7 +459,7 @@ // Reproduce a crash that used to happen for a specific file with specific sequence of method calls. TEST(AnimatedWebPTests, reproCrash) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid_vp8_vp8x.webp"); ASSERT_TRUE(fullData.get()); @@ -491,7 +491,7 @@ ASSERT_TRUE(fullData.get()); const size_t fullLength = fullData->size(); - std::unique_ptr<ImageDecoder> decoder; + OwnPtr<ImageDecoder> decoder; ImageFrame* frame; Vector<unsigned> truncatedHashes; @@ -536,7 +536,7 @@ TEST(AnimatedWebPTests, frameIsCompleteAndDuration) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(data.get()); @@ -564,7 +564,7 @@ TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(fullData.get()); @@ -612,7 +612,7 @@ createDecodingBaseline(&createDecoder, fullData.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); // Let frame 0 be partially decoded. size_t partialSize = 1; @@ -679,7 +679,7 @@ TEST(StaticWebPTests, notAnimated) { - std::unique_ptr<ImageDecoder> decoder = createDecoder(); + OwnPtr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp"); ASSERT_TRUE(data.get()); decoder->setData(data.get(), true);
diff --git a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp index c4c2b09..93353ff 100644 --- a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp +++ b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp
@@ -34,8 +34,6 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/ImageBuffer.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" -#include <memory> extern "C" { #include <setjmp.h> @@ -136,12 +134,12 @@ return what_to_return; \ } -std::unique_ptr<JPEGImageEncoderState> JPEGImageEncoderState::create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output) +PassOwnPtr<JPEGImageEncoderState> JPEGImageEncoderState::create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output) { if (imageSize.width() <= 0 || imageSize.height() <= 0) return nullptr; - std::unique_ptr<JPEGImageEncoderStateImpl> encoderState = wrapUnique(new JPEGImageEncoderStateImpl()); + OwnPtr<JPEGImageEncoderStateImpl> encoderState = adoptPtr(new JPEGImageEncoderStateImpl()); jpeg_compress_struct* cinfo = encoderState->cinfo(); jpeg_error_mgr* error = encoderState->error(); @@ -207,7 +205,7 @@ return currentRowsCompleted; } -bool JPEGImageEncoder::encodeWithPreInitializedState(std::unique_ptr<JPEGImageEncoderState> encoderState, const unsigned char* inputPixels, int numRowsCompleted) +bool JPEGImageEncoder::encodeWithPreInitializedState(PassOwnPtr<JPEGImageEncoderState> encoderState, const unsigned char* inputPixels, int numRowsCompleted) { JPEGImageEncoderStateImpl* encoderStateImpl = static_cast<JPEGImageEncoderStateImpl*>(encoderState.get()); @@ -234,7 +232,7 @@ if (!imageData.pixels()) return false; - std::unique_ptr<JPEGImageEncoderState> encoderState = JPEGImageEncoderState::create(imageData.size(), quality, output); + OwnPtr<JPEGImageEncoderState> encoderState = JPEGImageEncoderState::create(imageData.size(), quality, output); if (!encoderState) return false;
diff --git a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h index afc0c9f..7ed6d30 100644 --- a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h +++ b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h
@@ -33,8 +33,8 @@ #include "platform/geometry/IntSize.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -44,7 +44,7 @@ USING_FAST_MALLOC(JPEGImageEncoderState); WTF_MAKE_NONCOPYABLE(JPEGImageEncoderState); public: - static std::unique_ptr<JPEGImageEncoderState> create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output); + static PassOwnPtr<JPEGImageEncoderState> create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output); JPEGImageEncoderState() {} virtual ~JPEGImageEncoderState() {} }; @@ -63,7 +63,7 @@ // be safer. static bool encode(const ImageDataBuffer&, const double& quality, Vector<unsigned char>*); - static bool encodeWithPreInitializedState(std::unique_ptr<JPEGImageEncoderState>, const unsigned char*, int numRowsCompleted = 0); + static bool encodeWithPreInitializedState(PassOwnPtr<JPEGImageEncoderState>, const unsigned char*, int numRowsCompleted = 0); static int progressiveEncodeRowsJpegHelper(JPEGImageEncoderState*, unsigned char*, int, const double, double); static int computeCompressionQuality(const double& quality);
diff --git a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp index 77ccf5e..cfaae3f1 100644 --- a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp +++ b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp
@@ -31,8 +31,7 @@ #include "platform/image-encoders/PNGImageEncoder.h" #include "platform/graphics/ImageBuffer.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -46,7 +45,7 @@ static_cast<Vector<unsigned char>*>(png_get_io_ptr(png))->append(data, size); } -std::unique_ptr<PNGImageEncoderState> PNGImageEncoderState::create(const IntSize& imageSize, Vector<unsigned char>* output) +PassOwnPtr<PNGImageEncoderState> PNGImageEncoderState::create(const IntSize& imageSize, Vector<unsigned char>* output) { if (imageSize.width() <= 0 || imageSize.height() <= 0) return nullptr; @@ -74,7 +73,7 @@ png_set_IHDR(png, info, imageSize.width(), imageSize.height(), 8, PNG_COLOR_TYPE_RGB_ALPHA, 0, 0, 0); png_write_info(png, info); - return wrapUnique(new PNGImageEncoderState(png, info)); + return adoptPtr(new PNGImageEncoderState(png, info)); } void PNGImageEncoder::writeOneRowToPng(unsigned char* pixels, PNGImageEncoderState* encoderState) @@ -89,7 +88,7 @@ static bool encodePixels(const IntSize& imageSize, const unsigned char* inputPixels, Vector<unsigned char>* output) { - std::unique_ptr<PNGImageEncoderState> encoderState = PNGImageEncoderState::create(imageSize, output); + OwnPtr<PNGImageEncoderState> encoderState = PNGImageEncoderState::create(imageSize, output); if (!encoderState.get()) return false;
diff --git a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h index a825c66..79f7960 100644 --- a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h +++ b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h
@@ -36,8 +36,8 @@ #include "png.h" } #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -47,7 +47,7 @@ USING_FAST_MALLOC(PNGImageEncoderState); WTF_MAKE_NONCOPYABLE(PNGImageEncoderState); public: - static std::unique_ptr<PNGImageEncoderState> create(const IntSize& imageSize, Vector<unsigned char>* output); + static PassOwnPtr<PNGImageEncoderState> create(const IntSize& imageSize, Vector<unsigned char>* output); ~PNGImageEncoderState(); png_struct* png() { ASSERT(m_png); return m_png; } png_info* info() { ASSERT(m_info); return m_info; }
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h index d07fd37..cdc362b6 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h
@@ -35,7 +35,6 @@ #include "platform/scroll/ScrollAnimatorBase.h" #include "public/platform/WebTaskRunner.h" #include "wtf/RetainPtr.h" -#include <memory> OBJC_CLASS BlinkScrollAnimationHelperDelegate; OBJC_CLASS BlinkScrollbarPainterControllerDelegate; @@ -83,11 +82,11 @@ RetainPtr<BlinkScrollbarPainterDelegate> m_verticalScrollbarPainterDelegate; void initialScrollbarPaintTask(); - std::unique_ptr<CancellableTaskFactory> m_initialScrollbarPaintTaskFactory; + OwnPtr<CancellableTaskFactory> m_initialScrollbarPaintTaskFactory; void sendContentAreaScrolledTask(); - std::unique_ptr<CancellableTaskFactory> m_sendContentAreaScrolledTaskFactory; - std::unique_ptr<WebTaskRunner> m_taskRunner; + OwnPtr<CancellableTaskFactory> m_sendContentAreaScrolledTaskFactory; + OwnPtr<WebTaskRunner> m_taskRunner; FloatSize m_contentAreaScrolledTimerScrollDelta; ScrollResult userScroll(ScrollGranularity, const FloatSize& delta) override;
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm index e148eca..85c5c6d 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm
@@ -39,8 +39,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "wtf/MathExtras.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" using namespace blink; @@ -355,7 +354,7 @@ @interface BlinkScrollbarPartAnimation : NSObject { Scrollbar* _scrollbar; - std::unique_ptr<BlinkScrollbarPartAnimationTimer> _timer; + OwnPtr<BlinkScrollbarPartAnimationTimer> _timer; RetainPtr<ScrollbarPainter> _scrollbarPainter; FeatureToAnimate _featureToAnimate; CGFloat _startValue; @@ -372,7 +371,7 @@ if (!self) return nil; - _timer = wrapUnique(new BlinkScrollbarPartAnimationTimer(self, duration)); + _timer = adoptPtr(new BlinkScrollbarPartAnimationTimer(self, duration)); _scrollbar = scrollbar; _featureToAnimate = featureToAnimate; _startValue = startValue; @@ -683,7 +682,7 @@ : ScrollAnimatorBase(scrollableArea) , m_initialScrollbarPaintTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::initialScrollbarPaintTask)) , m_sendContentAreaScrolledTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::sendContentAreaScrolledTask)) - , m_taskRunner(wrapUnique(Platform::current()->currentThread()->scheduler()->timerTaskRunner()->clone())) + , m_taskRunner(adoptPtr(Platform::current()->currentThread()->scheduler()->timerTaskRunner()->clone())) , m_haveScrolledSincePageLoad(false) , m_needsScrollerStyleUpdate(false) {
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp index f883c81..32943ee 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp
@@ -40,8 +40,7 @@ #include "public/platform/WebMediaStreamCenter.h" #include "public/platform/WebMediaStreamTrack.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -53,7 +52,7 @@ } MediaStreamCenter::MediaStreamCenter() - : m_private(wrapUnique(Platform::current()->createMediaStreamCenter(this))) + : m_private(adoptPtr(Platform::current()->createMediaStreamCenter(this))) { } @@ -122,11 +121,11 @@ m_private->didCreateMediaStreamTrack(track); } -std::unique_ptr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent* track) +PassOwnPtr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent* track) { ASSERT_UNUSED(track, track); if (m_private) - return MediaStreamWebAudioSource::create(wrapUnique(m_private->createWebAudioSourceFromMediaStreamTrack(track))); + return MediaStreamWebAudioSource::create(adoptPtr(m_private->createWebAudioSourceFromMediaStreamTrack(track))); return nullptr; }
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h index a3b047e..c666955 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h
@@ -35,9 +35,9 @@ #include "platform/heap/Handle.h" #include "public/platform/WebMediaStreamCenterClient.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -59,7 +59,7 @@ void didCreateMediaStreamTrack(MediaStreamComponent*); void didSetMediaStreamTrackEnabled(MediaStreamComponent*); bool didStopMediaStreamTrack(MediaStreamComponent*); - std::unique_ptr<AudioSourceProvider> createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent*); + PassOwnPtr<AudioSourceProvider> createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent*); void didCreateMediaStream(MediaStreamDescriptor*); void didCreateMediaStreamAndTracks(MediaStreamDescriptor*); @@ -73,7 +73,7 @@ private: MediaStreamCenter(); - std::unique_ptr<WebMediaStreamCenter> m_private; + OwnPtr<WebMediaStreamCenter> m_private; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h index 87d2167..7c5f406 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h
@@ -38,7 +38,6 @@ #include "wtf/Forward.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -79,7 +78,7 @@ void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.wrap(provider); } TrackData* getTrackData() const { return m_trackData.get(); } - void setTrackData(std::unique_ptr<TrackData> trackData) { m_trackData = std::move(trackData); } + void setTrackData(PassOwnPtr<TrackData> trackData) { m_trackData = std::move(trackData); } void getSettings(WebMediaStreamTrack::Settings&); DECLARE_TRACE(); @@ -115,7 +114,7 @@ String m_id; bool m_enabled; bool m_muted; - std::unique_ptr<TrackData> m_trackData; + OwnPtr<TrackData> m_trackData; }; typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector;
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h index fbbc846..db4dd8d 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h
@@ -37,7 +37,6 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -90,7 +89,7 @@ void setEnded() { m_ended = true; } ExtraData* getExtraData() const { return m_extraData.get(); } - void setExtraData(std::unique_ptr<ExtraData> extraData) { m_extraData = std::move(extraData); } + void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move(extraData); } // |m_extraData| may hold pointers to GC objects, and it may touch them in destruction. // So this class is eagerly finalized to finalize |m_extraData| promptly. @@ -108,7 +107,7 @@ bool m_active; bool m_ended; - std::unique_ptr<ExtraData> m_extraData; + OwnPtr<ExtraData> m_extraData; }; typedef HeapVector<Member<MediaStreamDescriptor>> MediaStreamDescriptorVector;
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h index 38d68f668..ebc1852c 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h
@@ -36,10 +36,11 @@ #include "platform/audio/AudioDestinationConsumer.h" #include "public/platform/WebMediaConstraints.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -81,7 +82,7 @@ void addObserver(Observer*); ExtraData* getExtraData() const { return m_extraData.get(); } - void setExtraData(std::unique_ptr<ExtraData> extraData) { m_extraData = std::move(extraData); } + void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move(extraData); } void setConstraints(WebMediaConstraints constraints) { m_constraints = constraints; } WebMediaConstraints constraints() { return m_constraints; } @@ -111,7 +112,7 @@ HeapHashSet<WeakMember<Observer>> m_observers; Mutex m_audioConsumersLock; HeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers; - std::unique_ptr<ExtraData> m_extraData; + OwnPtr<ExtraData> m_extraData; WebMediaConstraints m_constraints; };
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp index 870d030..47bd137 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp
@@ -28,14 +28,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/AudioBus.h" #include "platform/mediastream/MediaStreamWebAudioSource.h" +#include "platform/audio/AudioBus.h" #include "public/platform/WebAudioSourceProvider.h" -#include <memory> namespace blink { -MediaStreamWebAudioSource::MediaStreamWebAudioSource(std::unique_ptr<WebAudioSourceProvider> provider) +MediaStreamWebAudioSource::MediaStreamWebAudioSource(PassOwnPtr<WebAudioSourceProvider> provider) : m_webAudioSourceProvider(std::move(provider)) { }
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h index 2fca5f3..a2d42605 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h
@@ -33,10 +33,10 @@ #include "platform/audio/AudioSourceProvider.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/build_config.h" -#include <memory> namespace blink { @@ -45,17 +45,17 @@ class MediaStreamWebAudioSource : public AudioSourceProvider { WTF_MAKE_NONCOPYABLE(MediaStreamWebAudioSource); public: - static std::unique_ptr<MediaStreamWebAudioSource> create(std::unique_ptr<WebAudioSourceProvider> provider) { return wrapUnique(new MediaStreamWebAudioSource(std::move(provider))); } + static PassOwnPtr<MediaStreamWebAudioSource> create(PassOwnPtr<WebAudioSourceProvider> provider) { return adoptPtr(new MediaStreamWebAudioSource(std::move(provider))); } ~MediaStreamWebAudioSource() override; private: - explicit MediaStreamWebAudioSource(std::unique_ptr<WebAudioSourceProvider>); + explicit MediaStreamWebAudioSource(PassOwnPtr<WebAudioSourceProvider>); // blink::AudioSourceProvider implementation. void provideInput(AudioBus*, size_t framesToProcess) override; - std::unique_ptr<WebAudioSourceProvider> m_webAudioSourceProvider; + OwnPtr<WebAudioSourceProvider> m_webAudioSourceProvider; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h b/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h index 3b036ca..8e83245 100644 --- a/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h +++ b/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h
@@ -35,10 +35,8 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebRTCCertificate.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -99,7 +97,7 @@ void setRtcpMuxPolicy(RTCRtcpMuxPolicy rtcpMuxPolicy) { m_rtcpMuxPolicy = rtcpMuxPolicy; } RTCRtcpMuxPolicy rtcpMuxPolicy() { return m_rtcpMuxPolicy; } - void appendCertificate(std::unique_ptr<WebRTCCertificate> certificate) { m_certificates.append(wrapUnique(certificate.release())); } + void appendCertificate(std::unique_ptr<WebRTCCertificate> certificate) { m_certificates.append(adoptPtr(certificate.release())); } size_t numberOfCertificates() const { return m_certificates.size(); } WebRTCCertificate* certificate(size_t index) const { return m_certificates[index].get(); } @@ -115,7 +113,7 @@ RTCIceTransports m_iceTransports; RTCBundlePolicy m_bundlePolicy; RTCRtcpMuxPolicy m_rtcpMuxPolicy; - Vector<std::unique_ptr<WebRTCCertificate>> m_certificates; + Vector<OwnPtr<WebRTCCertificate>> m_certificates; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mojo/MojoHelper.h b/third_party/WebKit/Source/platform/mojo/MojoHelper.h index cb37878..b278e75 100644 --- a/third_party/WebKit/Source/platform/mojo/MojoHelper.h +++ b/third_party/WebKit/Source/platform/mojo/MojoHelper.h
@@ -23,6 +23,12 @@ } template <typename R, typename... Args> +base::Callback<R(Args...)> createBaseCallback(PassOwnPtr<Function<R(Args...)>> functor) +{ + return base::Bind(&internal::CallWTFFunction<R, Args...>, base::Owned(functor.leakPtr())); +} + +template <typename R, typename... Args> base::Callback<R(Args...)> createBaseCallback(std::unique_ptr<Function<R(Args...)>> functor) { return base::Bind(&internal::CallWTFFunction<R, Args...>, base::Owned(functor.release()));
diff --git a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp index 2581d2f..c1c37dc 100644 --- a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp +++ b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp
@@ -30,9 +30,6 @@ #include "platform/network/HTTPHeaderMap.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { HTTPHeaderMap::HTTPHeaderMap() @@ -43,9 +40,9 @@ { } -std::unique_ptr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const +PassOwnPtr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const { - std::unique_ptr<CrossThreadHTTPHeaderMapData> data = wrapUnique(new CrossThreadHTTPHeaderMapData()); + OwnPtr<CrossThreadHTTPHeaderMapData> data = adoptPtr(new CrossThreadHTTPHeaderMapData()); data->reserveInitialCapacity(size()); HTTPHeaderMap::const_iterator endIt = end(); @@ -55,7 +52,7 @@ return data; } -void HTTPHeaderMap::adopt(std::unique_ptr<CrossThreadHTTPHeaderMapData> data) +void HTTPHeaderMap::adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData> data) { clear(); size_t dataSize = data->size();
diff --git a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h index f87f2554..3207583 100644 --- a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h +++ b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h
@@ -30,11 +30,11 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" -#include <memory> #include <utility> namespace blink { @@ -49,9 +49,9 @@ ~HTTPHeaderMap(); // Gets a copy of the data suitable for passing to another thread. - std::unique_ptr<CrossThreadHTTPHeaderMapData> copyData() const; + PassOwnPtr<CrossThreadHTTPHeaderMapData> copyData() const; - void adopt(std::unique_ptr<CrossThreadHTTPHeaderMapData>); + void adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData>); typedef HashMap<AtomicString, AtomicString, CaseFoldingHash> MapType; typedef MapType::AddResult AddResult;
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp index e9f1960..f24a2b5 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp
@@ -33,8 +33,6 @@ #include "public/platform/WebAddressSpace.h" #include "public/platform/WebCachePolicy.h" #include "public/platform/WebURLRequest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -80,9 +78,9 @@ m_redirectStatus = data->m_redirectStatus; } -std::unique_ptr<CrossThreadResourceRequestData> ResourceRequest::copyData() const +PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::copyData() const { - std::unique_ptr<CrossThreadResourceRequestData> data = wrapUnique(new CrossThreadResourceRequestData()); + OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResourceRequestData()); data->m_url = url().copy(); data->m_cachePolicy = getCachePolicy(); data->m_timeoutInterval = timeoutInterval();
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequest.h b/third_party/WebKit/Source/platform/network/ResourceRequest.h index 2a6feae6..b8a9508eb 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequest.h +++ b/third_party/WebKit/Source/platform/network/ResourceRequest.h
@@ -38,8 +38,8 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" -#include <memory> namespace blink { @@ -91,7 +91,7 @@ explicit ResourceRequest(CrossThreadResourceRequestData*); // Gets a copy of the data suitable for passing to another thread. - std::unique_ptr<CrossThreadResourceRequestData> copyData() const; + PassOwnPtr<CrossThreadResourceRequestData> copyData() const; bool isNull() const; bool isEmpty() const; @@ -307,7 +307,7 @@ RefPtr<SecurityOrigin> m_requestorOrigin; String m_httpMethod; - std::unique_ptr<CrossThreadHTTPHeaderMapData> m_httpHeaders; + OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders; RefPtr<EncodedFormData> m_httpBody; RefPtr<EncodedFormData> m_attachedCredential; bool m_allowStoredCredentials;
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp index 94ba87f7..0979dff 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp
@@ -11,7 +11,6 @@ #include "public/platform/WebURLRequest.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -76,7 +75,7 @@ EXPECT_STREQ("http://www.example.com/referrer.htm", original.httpReferrer().utf8().data()); EXPECT_EQ(ReferrerPolicyDefault, original.getReferrerPolicy()); - std::unique_ptr<CrossThreadResourceRequestData> data1(original.copyData()); + OwnPtr<CrossThreadResourceRequestData> data1(original.copyData()); ResourceRequest copy1(data1.get()); EXPECT_STREQ("http://www.example.com/test.htm", copy1.url().getString().utf8().data()); @@ -111,7 +110,7 @@ copy1.setFetchRequestMode(WebURLRequest::FetchRequestModeNoCORS); copy1.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeInclude); - std::unique_ptr<CrossThreadResourceRequestData> data2(copy1.copyData()); + OwnPtr<CrossThreadResourceRequestData> data2(copy1.copyData()); ResourceRequest copy2(data2.get()); EXPECT_TRUE(copy2.allowStoredCredentials()); EXPECT_TRUE(copy2.reportUploadProgress());
diff --git a/third_party/WebKit/Source/platform/network/ResourceResponse.cpp b/third_party/WebKit/Source/platform/network/ResourceResponse.cpp index d513f5b..06fa838 100644 --- a/third_party/WebKit/Source/platform/network/ResourceResponse.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceResponse.cpp
@@ -27,9 +27,7 @@ #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" -#include <memory> namespace blink { @@ -150,9 +148,9 @@ // whatever values may be present in the opaque m_extraData structure. } -std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::copyData() const +PassOwnPtr<CrossThreadResourceResponseData> ResourceResponse::copyData() const { - std::unique_ptr<CrossThreadResourceResponseData> data = wrapUnique(new CrossThreadResourceResponseData); + OwnPtr<CrossThreadResourceResponseData> data = adoptPtr(new CrossThreadResourceResponseData); data->m_url = url().copy(); data->m_mimeType = mimeType().getString().isolatedCopy(); data->m_expectedContentLength = expectedContentLength(); @@ -544,7 +542,7 @@ m_downloadedFileHandle.clear(); return; } - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendFile(m_downloadedFilePath); blobData->detachFromCurrentThread(); m_downloadedFileHandle = BlobDataHandle::create(std::move(blobData), -1);
diff --git a/third_party/WebKit/Source/platform/network/ResourceResponse.h b/third_party/WebKit/Source/platform/network/ResourceResponse.h index d19e852..89d64806 100644 --- a/third_party/WebKit/Source/platform/network/ResourceResponse.h +++ b/third_party/WebKit/Source/platform/network/ResourceResponse.h
@@ -35,10 +35,10 @@ #include "platform/network/ResourceLoadTiming.h" #include "platform/weborigin/KURL.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/text/CString.h" -#include <memory> namespace blink { @@ -90,7 +90,7 @@ explicit ResourceResponse(CrossThreadResourceResponseData*); // Gets a copy of the data suitable for passing to another thread. - std::unique_ptr<CrossThreadResourceResponseData> copyData() const; + PassOwnPtr<CrossThreadResourceResponseData> copyData() const; ResourceResponse(); ResourceResponse(const KURL&, const AtomicString& mimeType, long long expectedLength, const AtomicString& textEncodingName, const String& filename); @@ -391,7 +391,7 @@ String m_suggestedFilename; int m_httpStatusCode; String m_httpStatusText; - std::unique_ptr<CrossThreadHTTPHeaderMapData> m_httpHeaders; + OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders; time_t m_lastModifiedDate; RefPtr<ResourceLoadTiming> m_resourceLoadTiming; CString m_securityInfo;
diff --git a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp index 064cc45..03d0297 100644 --- a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp
@@ -5,14 +5,12 @@ #include "platform/network/ResourceTimingInfo.h" #include "platform/CrossThreadCopier.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<ResourceTimingInfo> ResourceTimingInfo::adopt(std::unique_ptr<CrossThreadResourceTimingInfoData> data) +PassOwnPtr<ResourceTimingInfo> ResourceTimingInfo::adopt(PassOwnPtr<CrossThreadResourceTimingInfoData> data) { - std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(AtomicString(data->m_type), data->m_initialTime, data->m_isMainResource); + OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(AtomicString(data->m_type), data->m_initialTime, data->m_isMainResource); info->m_originalTimingAllowOrigin = AtomicString(data->m_originalTimingAllowOrigin); info->m_loadFinishTime = data->m_loadFinishTime; info->m_initialRequest = ResourceRequest(data->m_initialRequest.get()); @@ -22,9 +20,9 @@ return info; } -std::unique_ptr<CrossThreadResourceTimingInfoData> ResourceTimingInfo::copyData() const +PassOwnPtr<CrossThreadResourceTimingInfoData> ResourceTimingInfo::copyData() const { - std::unique_ptr<CrossThreadResourceTimingInfoData> data = wrapUnique(new CrossThreadResourceTimingInfoData); + OwnPtr<CrossThreadResourceTimingInfoData> data = adoptPtr(new CrossThreadResourceTimingInfoData); data->m_type = m_type.getString().isolatedCopy(); data->m_originalTimingAllowOrigin = m_originalTimingAllowOrigin.getString().isolatedCopy(); data->m_initialTime = m_initialTime;
diff --git a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h index f7ff7c1..da3c5b51 100644 --- a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h +++ b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h
@@ -37,9 +37,7 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" -#include <memory> namespace blink { @@ -49,14 +47,14 @@ USING_FAST_MALLOC(ResourceTimingInfo); WTF_MAKE_NONCOPYABLE(ResourceTimingInfo); public: - static std::unique_ptr<ResourceTimingInfo> create(const AtomicString& type, const double time, bool isMainResource) + static PassOwnPtr<ResourceTimingInfo> create(const AtomicString& type, const double time, bool isMainResource) { - return wrapUnique(new ResourceTimingInfo(type, time, isMainResource)); + return adoptPtr(new ResourceTimingInfo(type, time, isMainResource)); } - static std::unique_ptr<ResourceTimingInfo> adopt(std::unique_ptr<CrossThreadResourceTimingInfoData>); + static PassOwnPtr<ResourceTimingInfo> adopt(PassOwnPtr<CrossThreadResourceTimingInfoData>); // Gets a copy of the data suitable for passing to another thread. - std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const; + PassOwnPtr<CrossThreadResourceTimingInfoData> copyData() const; double initialTime() const { return m_initialTime; } bool isMainResource() const { return m_isMainResource; } @@ -114,15 +112,15 @@ String m_originalTimingAllowOrigin; double m_initialTime; double m_loadFinishTime; - std::unique_ptr<CrossThreadResourceRequestData> m_initialRequest; - std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; - Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; + OwnPtr<CrossThreadResourceRequestData> m_initialRequest; + OwnPtr<CrossThreadResourceResponseData> m_finalResponse; + Vector<OwnPtr<CrossThreadResourceResponseData>> m_redirectChain; bool m_isMainResource; }; template <> struct CrossThreadCopier<ResourceTimingInfo> { - typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> Type; + typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceTimingInfoData>> Type; static Type copy(const ResourceTimingInfo& info) { return passed(info.copyData()); } };
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h index c6684da..18741b1f 100644 --- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h +++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h
@@ -11,9 +11,9 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" -#include <memory> #include <type_traits> namespace blink { @@ -37,15 +37,15 @@ // variety, which will refer back to the owner heap object safely (but weakly.) // template<typename T> - static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr) + static PassOwnPtr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr) { - return wrapUnique(new CancellableTaskFactory(WTF::bind(method, CrossThreadWeakPersistentThisPointer<T>(thisObject)))); + return adoptPtr(new CancellableTaskFactory(WTF::bind(method, CrossThreadWeakPersistentThisPointer<T>(thisObject)))); } template<typename T> - static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr) + static PassOwnPtr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr) { - return wrapUnique(new CancellableTaskFactory(WTF::bind(method, thisObject))); + return adoptPtr(new CancellableTaskFactory(WTF::bind(method, thisObject))); } bool isPending() const
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp index fcb6d78c..579f4e1 100644 --- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp +++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
@@ -6,8 +6,6 @@ #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -35,7 +33,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_TaskCreated) { TestCancellableTaskFactory factory(nullptr); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); EXPECT_TRUE(factory.isPending()); } @@ -48,7 +46,7 @@ { TestCancellableTaskFactory factory(WTF::bind(&EmptyFn)); { - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); task->run(); } @@ -66,7 +64,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_TaskCreatedAndCancelled) { TestCancellableTaskFactory factory(nullptr); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); factory.cancel(); EXPECT_FALSE(factory.isPending()); @@ -74,7 +72,7 @@ class TestClass { public: - std::unique_ptr<CancellableTaskFactory> m_factory; + OwnPtr<CancellableTaskFactory> m_factory; TestClass() : m_factory(CancellableTaskFactory::create(this, &TestClass::TestFn)) @@ -90,7 +88,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_InCallback) { TestClass testClass; - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(testClass.m_factory->cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(testClass.m_factory->cancelAndCreate()); task->run(); } @@ -103,7 +101,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); task->run(); EXPECT_EQ(1, executionCount); @@ -113,7 +111,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); task->run(); task->run(); task->run(); @@ -125,10 +123,10 @@ TEST_F(CancellableTaskFactoryTest, Run_FactoryDestructionPreventsExecution) { int executionCount = 0; - std::unique_ptr<WebTaskRunner::Task> task; + OwnPtr<WebTaskRunner::Task> task; { TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - task = wrapUnique(factory.cancelAndCreate()); + task = adoptPtr(factory.cancelAndCreate()); } task->run(); @@ -140,15 +138,15 @@ int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> taskA = adoptPtr(factory.cancelAndCreate()); taskA->run(); EXPECT_EQ(1, executionCount); - std::unique_ptr<WebTaskRunner::Task> taskB = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> taskB = adoptPtr(factory.cancelAndCreate()); taskB->run(); EXPECT_EQ(2, executionCount); - std::unique_ptr<WebTaskRunner::Task> taskC = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> taskC = adoptPtr(factory.cancelAndCreate()); taskC->run(); EXPECT_EQ(3, executionCount); } @@ -157,7 +155,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); factory.cancel(); task->run(); @@ -169,8 +167,8 @@ int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate()); - std::unique_ptr<WebTaskRunner::Task> taskB = wrapUnique(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> taskA = adoptPtr(factory.cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> taskB = adoptPtr(factory.cancelAndCreate()); taskA->run(); EXPECT_EQ(0, executionCount); @@ -203,7 +201,7 @@ static int s_destructed; static int s_invoked; - std::unique_ptr<CancellableTaskFactory> m_factory; + OwnPtr<CancellableTaskFactory> m_factory; }; int GCObject::s_destructed = 0; @@ -214,7 +212,7 @@ TEST(CancellableTaskFactoryTest, GarbageCollectedWeak) { GCObject* object = new GCObject(); - std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(object->m_factory->cancelAndCreate()); + OwnPtr<WebTaskRunner::Task> task = adoptPtr(object->m_factory->cancelAndCreate()); object = nullptr; ThreadHeap::collectAllGarbage(); task->run();
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp index b53fdae..582d7a9 100644 --- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
@@ -11,8 +11,6 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -122,7 +120,7 @@ bool sentToCompositor = false; if (!m_scrollableArea->shouldScrollOnMainThread()) { - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); int animationId = animation->id(); int animationGroupId = animation->group();
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h index f0bd65a..2aa64ef 100644 --- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h
@@ -10,7 +10,8 @@ #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -52,7 +53,7 @@ void notifyPositionChanged(const DoublePoint&); Member<ScrollableArea> m_scrollableArea; - std::unique_ptr<CompositorScrollOffsetAnimationCurve> m_animationCurve; + OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; FloatPoint m_targetOffset; double m_startTime; };
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp index 6b219ce45..6fce2694 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
@@ -40,8 +40,6 @@ #include "public/platform/WebCompositorSupport.h" #include "wtf/CurrentTime.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -269,7 +267,7 @@ if (m_scrollableArea->shouldScrollOnMainThread()) return false; - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); // Being here means that either there is an animation that needs // to be sent to the compositor, or an animation that needs to // be updated (a new scroll event before the previous animation
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h index bf9f80f..da76f2f 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
@@ -37,7 +37,6 @@ #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" #include "platform/geometry/FloatPoint.h" #include "platform/scroll/ScrollAnimatorBase.h" -#include <memory> namespace blink { @@ -78,7 +77,7 @@ double animationStartTime, std::unique_ptr<cc::AnimationCurve>) override; - std::unique_ptr<CompositorScrollOffsetAnimationCurve> m_animationCurve; + OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; double m_startTime; WTF::TimeFunction m_timeFunction;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp index 1ed8f2c..6e3757e 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -34,6 +34,7 @@ #include "platform/geometry/FloatPoint.h" #include "platform/scroll/ScrollableArea.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp index 85623d4..7ebd18c1 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
@@ -14,8 +14,6 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -78,10 +76,10 @@ } bool ScrollAnimatorCompositorCoordinator::addAnimation( - std::unique_ptr<CompositorAnimation> animation) + PassOwnPtr<CompositorAnimation> animation) { if (m_compositorPlayer->isLayerAttached()) { - m_compositorPlayer->addAnimation(animation.release()); + m_compositorPlayer->addAnimation(animation.leakPtr()); return true; } return false;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h index d0cecc2..bf111dd 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h
@@ -16,7 +16,7 @@ #include "platform/scroll/ScrollTypes.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -63,7 +63,7 @@ IntSize implOnlyAnimationAdjustmentForTesting() { return m_implOnlyAnimationAdjustment; } void resetAnimationIds(); - bool addAnimation(std::unique_ptr<CompositorAnimation>); + bool addAnimation(PassOwnPtr<CompositorAnimation>); void removeAnimation(); virtual void abortAnimation(); @@ -139,7 +139,7 @@ RunningOnCompositorButNeedsAdjustment, }; - std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; + OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; int m_compositorAnimationAttachedToLayerId; RunState m_runState; int m_compositorAnimationId;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h index 0bd8755..a0551da 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h
@@ -11,8 +11,6 @@ #include "platform/scroll/ScrollbarThemeMock.h" #include "platform/testing/TestingPlatformSupport.h" #include "testing/gmock/include/gmock/gmock.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -91,7 +89,7 @@ { TestingPlatformSupport::Config config; config.compositorSupport = Platform::current()->compositorSupport(); - m_fakePlatform = wrapUnique(new TestingPlatformSupportWithMockScheduler(config)); + m_fakePlatform = adoptPtr(new TestingPlatformSupportWithMockScheduler(config)); } void TearDown() override @@ -100,7 +98,7 @@ } private: - std::unique_ptr<TestingPlatformSupportWithMockScheduler> m_fakePlatform; + OwnPtr<TestingPlatformSupportWithMockScheduler> m_fakePlatform; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h index 006c26f..e0325fd 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h
@@ -31,6 +31,7 @@ #include "platform/geometry/IntRect.h" #include "platform/geometry/IntSize.h" #include "platform/scroll/ScrollTypes.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp index ac10dfd..9cc5c8f 100644 --- a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp +++ b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp
@@ -31,7 +31,6 @@ #include "public/platform/WebSpeechSynthesisUtterance.h" #include "public/platform/WebSpeechSynthesizer.h" #include "public/platform/WebSpeechSynthesizerClient.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -46,7 +45,7 @@ : m_speechSynthesizerClient(client) { m_webSpeechSynthesizerClient = new WebSpeechSynthesizerClientImpl(this, client); - m_webSpeechSynthesizer = wrapUnique(Platform::current()->createSpeechSynthesizer(m_webSpeechSynthesizerClient)); + m_webSpeechSynthesizer = adoptPtr(Platform::current()->createSpeechSynthesizer(m_webSpeechSynthesizerClient)); } PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer()
diff --git a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h index 70237e0..3fd6ff12 100644 --- a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h +++ b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h
@@ -30,7 +30,6 @@ #include "platform/heap/Handle.h" #include "platform/speech/PlatformSpeechSynthesisVoice.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -95,7 +94,7 @@ private: Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; - std::unique_ptr<WebSpeechSynthesizer> m_webSpeechSynthesizer; + OwnPtr<WebSpeechSynthesizer> m_webSpeechSynthesizer; Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; };
diff --git a/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp b/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp index 91be6dd..8b94a36 100644 --- a/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp
@@ -9,9 +9,9 @@ #include "platform/fonts/FontDescription.h" #include "platform/fonts/FontSelector.h" #include "platform/testing/UnitTestHelpers.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { namespace testing { @@ -50,12 +50,12 @@ void fontCacheInvalidated() override { } private: - TestFontSelector(std::unique_ptr<FontCustomPlatformData> customPlatformData) + TestFontSelector(PassOwnPtr<FontCustomPlatformData> customPlatformData) : m_customPlatformData(std::move(customPlatformData)) { } - std::unique_ptr<FontCustomPlatformData> m_customPlatformData; + OwnPtr<FontCustomPlatformData> m_customPlatformData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp index 043ca952..0e0fbb6 100644 --- a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp +++ b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp
@@ -5,11 +5,11 @@ #include "platform/testing/HistogramTester.h" #include "base/test/histogram_tester.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" namespace blink { -HistogramTester::HistogramTester() : m_histogramTester(wrapUnique(new base::HistogramTester)) { } +HistogramTester::HistogramTester() : m_histogramTester(adoptPtr(new base::HistogramTester)) { } HistogramTester::~HistogramTester() { }
diff --git a/third_party/WebKit/Source/platform/testing/HistogramTester.h b/third_party/WebKit/Source/platform/testing/HistogramTester.h index 16ccc152..5d2a54a 100644 --- a/third_party/WebKit/Source/platform/testing/HistogramTester.h +++ b/third_party/WebKit/Source/platform/testing/HistogramTester.h
@@ -6,7 +6,7 @@ #define HistogramTester_h #include "platform/Histogram.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace base { class HistogramTester; @@ -24,7 +24,7 @@ void expectTotalCount(const std::string& name, base::HistogramBase::Count) const; private: - std::unique_ptr<base::HistogramTester> m_histogramTester; + OwnPtr<base::HistogramTester> m_histogramTester; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp index 83259b1..a14525d 100644 --- a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp +++ b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
@@ -21,9 +21,8 @@ #include "platform/SharedBuffer.h" #include "platform/image-decoders/ImageDecoder.h" #include "public/platform/Platform.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> #if defined(_WIN32) #include <mmsystem.h> @@ -247,7 +246,7 @@ if (s.st_size <= 0) return SharedBuffer::create(); - std::unique_ptr<unsigned char[]> buffer = wrapArrayUnique(new unsigned char[fileSize]); + OwnPtr<unsigned char[]> buffer = adoptArrayPtr(new unsigned char[fileSize]); if (fileSize != fread(buffer.get(), 1, fileSize, fp)) { fprintf(stderr, "Error reading file %s\n", fileName); exit(2); @@ -259,7 +258,7 @@ bool decodeImageData(SharedBuffer* data, bool colorCorrection, size_t packetSize) { - std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, + OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, colorCorrection ? ImageDecoder::GammaAndColorProfileApplied : ImageDecoder::GammaAndColorProfileIgnored);
diff --git a/third_party/WebKit/Source/platform/testing/RunAllTests.cpp b/third_party/WebKit/Source/platform/testing/RunAllTests.cpp index b84caf21..2cd4f24 100644 --- a/third_party/WebKit/Source/platform/testing/RunAllTests.cpp +++ b/third_party/WebKit/Source/platform/testing/RunAllTests.cpp
@@ -40,7 +40,6 @@ #include "public/platform/Platform.h" #include "wtf/CryptographicallyRandomNumber.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/WTF.h" #include "wtf/allocator/Partitions.h" #include <base/bind.h> @@ -50,7 +49,6 @@ #include <base/test/launcher/unit_test_launcher.h> #include <base/test/test_suite.h> #include <cc/blink/web_compositor_support_impl.h> -#include <memory> namespace { @@ -82,7 +80,7 @@ base::StatisticsRecorder::Initialize(); - std::unique_ptr<DummyPlatform> platform = wrapUnique(new DummyPlatform); + OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); blink::Platform::setCurrentPlatformForTesting(platform.get()); WTF::Partitions::initialize(nullptr); @@ -105,7 +103,7 @@ mojo::edk::Init(); base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); - std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipcSupport(wrapUnique(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); + WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base::Unretained(&testSuite))); blink::ThreadState::detachMainThread();
diff --git a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp index 07878a9..a805e019 100644 --- a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp +++ b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp
@@ -14,8 +14,6 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -76,7 +74,7 @@ TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, Color color) { - std::unique_ptr<DummyRectClient> client = wrapUnique(new DummyRectClient(bounds, color)); + OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(bounds, color)); m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( *client, DisplayItem::DrawingFirst, client->makePicture()); m_dummyClients.append(std::move(client)); @@ -86,7 +84,7 @@ TestPaintArtifact& TestPaintArtifact::foreignLayer(const FloatPoint& location, const IntSize& size, scoped_refptr<cc::Layer> layer) { FloatRect floatBounds(location, FloatSize(size)); - std::unique_ptr<DummyRectClient> client = wrapUnique(new DummyRectClient(floatBounds, Color::transparent)); + OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(floatBounds, Color::transparent)); m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( *client, DisplayItem::ForeignLayerFirst, std::move(layer), location, size); m_dummyClients.append(std::move(client));
diff --git a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h index 5392ee2..c8ff8a3 100644 --- a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h +++ b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h
@@ -10,9 +10,9 @@ #include "platform/graphics/paint/DisplayItemList.h" #include "platform/graphics/paint/PaintArtifact.h" #include "wtf/Allocator.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" -#include <memory> namespace cc { class Layer; @@ -55,7 +55,7 @@ private: class DummyRectClient; - Vector<std::unique_ptr<DummyRectClient>> m_dummyClients; + Vector<OwnPtr<DummyRectClient>> m_dummyClients; // Exists if m_built is false. DisplayItemList m_displayItemList;
diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp index 971224d..e8c7fbcf8 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp
@@ -30,9 +30,6 @@ #include "platform/testing/TestingPlatformSupport.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace blink { TestingPlatformSupport::TestingPlatformSupport() @@ -71,12 +68,12 @@ class TestingPlatformMockWebTaskRunner : public WebTaskRunner { WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); public: - explicit TestingPlatformMockWebTaskRunner(Deque<std::unique_ptr<WebTaskRunner::Task>>* tasks) : m_tasks(tasks) { } + explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>* tasks) : m_tasks(tasks) { } ~TestingPlatformMockWebTaskRunner() override { } void postTask(const WebTraceLocation&, Task* task) override { - m_tasks->append(wrapUnique(task)); + m_tasks->append(adoptPtr(task)); } void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) override @@ -102,13 +99,13 @@ } private: - Deque<std::unique_ptr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED + Deque<OwnPtr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED }; // TestingPlatformMockScheduler definition: TestingPlatformMockScheduler::TestingPlatformMockScheduler() - : m_mockWebTaskRunner(wrapUnique(new TestingPlatformMockWebTaskRunner(&m_tasks))) { } + : m_mockWebTaskRunner(adoptPtr(new TestingPlatformMockWebTaskRunner(&m_tasks))) { } TestingPlatformMockScheduler::~TestingPlatformMockScheduler() { } @@ -138,7 +135,7 @@ class TestingPlatformMockWebThread : public WebThread { WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebThread); public: - TestingPlatformMockWebThread() : m_mockWebScheduler(wrapUnique(new TestingPlatformMockScheduler)) { } + TestingPlatformMockWebThread() : m_mockWebScheduler(adoptPtr(new TestingPlatformMockScheduler)) { } ~TestingPlatformMockWebThread() override { } WebTaskRunner* getWebTaskRunner() override @@ -163,17 +160,17 @@ } private: - std::unique_ptr<TestingPlatformMockScheduler> m_mockWebScheduler; + OwnPtr<TestingPlatformMockScheduler> m_mockWebScheduler; }; // TestingPlatformSupportWithMockScheduler definition: TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler() - : m_mockWebThread(wrapUnique(new TestingPlatformMockWebThread())) { } + : m_mockWebThread(adoptPtr(new TestingPlatformMockWebThread())) { } TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler(const Config& config) : TestingPlatformSupport(config) - , m_mockWebThread(wrapUnique(new TestingPlatformMockWebThread())) { } + , m_mockWebThread(adoptPtr(new TestingPlatformMockWebThread())) { } TestingPlatformSupportWithMockScheduler::~TestingPlatformSupportWithMockScheduler() { }
diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h index bc5b15b..9cc309c 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h
@@ -37,7 +37,6 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -75,8 +74,8 @@ void onNavigationStarted() override { } private: - WTF::Deque<std::unique_ptr<WebTaskRunner::Task>> m_tasks; - std::unique_ptr<TestingPlatformMockWebTaskRunner> m_mockWebTaskRunner; + WTF::Deque<OwnPtr<WebTaskRunner::Task>> m_tasks; + OwnPtr<TestingPlatformMockWebTaskRunner> m_mockWebTaskRunner; }; class TestingPlatformSupport : public Platform { @@ -113,7 +112,7 @@ TestingPlatformMockScheduler* mockWebScheduler(); protected: - std::unique_ptr<TestingPlatformMockWebThread> m_mockWebThread; + OwnPtr<TestingPlatformMockWebThread> m_mockWebThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h index 5cd041c..39f943af 100644 --- a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h +++ b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h
@@ -9,6 +9,8 @@ #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" #include "public/platform/WebLayerTreeView.h" +#include "wtf/PassOwnPtr.h" + #include <memory> namespace cc {
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc index 3984742..35ff1445 100644 --- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc +++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
@@ -9,13 +9,14 @@ #include "public/platform/WebData.h" #include "public/platform/WebURLError.h" #include "public/platform/WebURLLoaderClient.h" +#include "wtf/PassOwnPtr.h" namespace blink { WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, WebURLLoader* default_loader) : factory_(factory), - default_loader_(wrapUnique(default_loader)), + default_loader_(adoptPtr(default_loader)), weak_factory_(this) { } @@ -34,9 +35,9 @@ // If no delegate is provided then create an empty one. The default behavior // will just proxy to the client. - std::unique_ptr<WebURLLoaderTestDelegate> default_delegate; + OwnPtr<WebURLLoaderTestDelegate> default_delegate; if (!delegate) { - default_delegate = wrapUnique(new WebURLLoaderTestDelegate()); + default_delegate = adoptPtr(new WebURLLoaderTestDelegate()); delegate = default_delegate.get(); }
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h index 8978b77..b796266 100644 --- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h +++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h
@@ -7,8 +7,8 @@ #include "base/macros.h" #include "public/platform/WebURLLoader.h" +#include "wtf/OwnPtr.h" #include "wtf/WeakPtr.h" -#include <memory> namespace blink { @@ -61,7 +61,7 @@ private: WebURLLoaderMockFactoryImpl* factory_ = nullptr; WebURLLoaderClient* client_ = nullptr; - std::unique_ptr<WebURLLoader> default_loader_; + OwnPtr<WebURLLoader> default_loader_; bool using_default_loader_ = false; bool is_deferred_ = false;
diff --git a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp index 993ad67..e531959 100644 --- a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp +++ b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
@@ -33,6 +33,7 @@ #include "platform/text/BidiTestHarness.h" #include "platform/text/TextRunIterator.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include <fstream> namespace blink {
diff --git a/third_party/WebKit/Source/platform/text/LocaleICU.cpp b/third_party/WebKit/Source/platform/text/LocaleICU.cpp index 300416e..7bed850a 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICU.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleICU.cpp
@@ -30,21 +30,20 @@ #include "platform/text/LocaleICU.h" -#include "wtf/DateMath.h" -#include "wtf/PtrUtil.h" -#include "wtf/text/StringBuffer.h" -#include "wtf/text/StringBuilder.h" -#include <limits> -#include <memory> #include <unicode/udatpg.h> #include <unicode/udisplaycontext.h> #include <unicode/uloc.h> +#include <limits> +#include "wtf/DateMath.h" +#include "wtf/PassOwnPtr.h" +#include "wtf/text/StringBuffer.h" +#include "wtf/text/StringBuilder.h" using namespace icu; namespace blink { -std::unique_ptr<Locale> Locale::create(const String& locale) +PassOwnPtr<Locale> Locale::create(const String& locale) { return LocaleICU::create(locale.utf8().data()); } @@ -70,9 +69,9 @@ udat_close(m_shortTimeFormat); } -std::unique_ptr<LocaleICU> LocaleICU::create(const char* localeString) +PassOwnPtr<LocaleICU> LocaleICU::create(const char* localeString) { - return wrapUnique(new LocaleICU(localeString)); + return adoptPtr(new LocaleICU(localeString)); } String LocaleICU::decimalSymbol(UNumberFormatSymbol symbol) @@ -181,14 +180,14 @@ return String::adopt(buffer); } -std::unique_ptr<Vector<String>> LocaleICU::createLabelVector(const UDateFormat* dateFormat, UDateFormatSymbolType type, int32_t startIndex, int32_t size) +PassOwnPtr<Vector<String>> LocaleICU::createLabelVector(const UDateFormat* dateFormat, UDateFormatSymbolType type, int32_t startIndex, int32_t size) { if (!dateFormat) - return std::unique_ptr<Vector<String>>(); + return PassOwnPtr<Vector<String>>(); if (udat_countSymbols(dateFormat, type) != startIndex + size) - return std::unique_ptr<Vector<String>>(); + return PassOwnPtr<Vector<String>>(); - std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); + OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); labels->reserveCapacity(size); bool isStandAloneMonth = (type == UDAT_STANDALONE_MONTHS) || (type == UDAT_STANDALONE_SHORT_MONTHS); for (int32_t i = 0; i < size; ++i) { @@ -202,7 +201,7 @@ length = udat_getSymbols(dateFormat, type, startIndex + i, 0, 0, &status); } if (status != U_BUFFER_OVERFLOW_ERROR) - return std::unique_ptr<Vector<String>>(); + return PassOwnPtr<Vector<String>>(); StringBuffer<UChar> buffer(length); status = U_ZERO_ERROR; if (isStandAloneMonth) { @@ -211,15 +210,15 @@ udat_getSymbols(dateFormat, type, startIndex + i, buffer.characters(), length, &status); } if (U_FAILURE(status)) - return std::unique_ptr<Vector<String>>(); + return PassOwnPtr<Vector<String>>(); labels->append(String::adopt(buffer)); } return labels; } -static std::unique_ptr<Vector<String>> createFallbackWeekDayShortLabels() +static PassOwnPtr<Vector<String>> createFallbackWeekDayShortLabels() { - std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); + OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); labels->reserveCapacity(7); labels->append("Sun"); labels->append("Mon"); @@ -248,9 +247,9 @@ m_weekDayShortLabels = createFallbackWeekDayShortLabels(); } -static std::unique_ptr<Vector<String>> createFallbackMonthLabels() +static PassOwnPtr<Vector<String>> createFallbackMonthLabels() { - std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); + OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); labels->reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName)); for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) labels->append(WTF::monthFullName[i]); @@ -288,9 +287,9 @@ return uloc_getCharacterOrientation(m_locale.data(), &status) == ULOC_LAYOUT_RTL; } -static std::unique_ptr<Vector<String>> createFallbackAMPMLabels() +static PassOwnPtr<Vector<String>> createFallbackAMPMLabels() { - std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); + OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); labels->reserveCapacity(2); labels->append("AM"); labels->append("PM"); @@ -319,7 +318,7 @@ m_dateTimeFormatWithoutSeconds = getDateFormatPattern(dateTimeFormatWithoutSeconds); udat_close(dateTimeFormatWithoutSeconds); - std::unique_ptr<Vector<String>> timeAMPMLabels = createLabelVector(m_mediumTimeFormat, UDAT_AM_PMS, UCAL_AM, 2); + OwnPtr<Vector<String>> timeAMPMLabels = createLabelVector(m_mediumTimeFormat, UDAT_AM_PMS, UCAL_AM, 2); if (!timeAMPMLabels) timeAMPMLabels = createFallbackAMPMLabels(); m_timeAMPMLabels = *timeAMPMLabels; @@ -406,7 +405,7 @@ if (!m_shortMonthLabels.isEmpty()) return m_shortMonthLabels; if (initializeShortDateFormat()) { - if (std::unique_ptr<Vector<String>> labels = createLabelVector(m_shortDateFormat, UDAT_SHORT_MONTHS, UCAL_JANUARY, 12)) { + if (OwnPtr<Vector<String>> labels = createLabelVector(m_shortDateFormat, UDAT_SHORT_MONTHS, UCAL_JANUARY, 12)) { m_shortMonthLabels = *labels; return m_shortMonthLabels; } @@ -423,7 +422,7 @@ return m_standAloneMonthLabels; UDateFormat* monthFormatter = openDateFormatForStandAloneMonthLabels(false); if (monthFormatter) { - if (std::unique_ptr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) { + if (OwnPtr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) { m_standAloneMonthLabels = *labels; udat_close(monthFormatter); return m_standAloneMonthLabels; @@ -440,7 +439,7 @@ return m_shortStandAloneMonthLabels; UDateFormat* monthFormatter = openDateFormatForStandAloneMonthLabels(true); if (monthFormatter) { - if (std::unique_ptr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_SHORT_MONTHS, UCAL_JANUARY, 12)) { + if (OwnPtr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_SHORT_MONTHS, UCAL_JANUARY, 12)) { m_shortStandAloneMonthLabels = *labels; udat_close(monthFormatter); return m_shortStandAloneMonthLabels;
diff --git a/third_party/WebKit/Source/platform/text/LocaleICU.h b/third_party/WebKit/Source/platform/text/LocaleICU.h index 5c7c2c6..9cc7574 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICU.h +++ b/third_party/WebKit/Source/platform/text/LocaleICU.h
@@ -31,14 +31,14 @@ #ifndef LocaleICU_h #define LocaleICU_h +#include <unicode/udat.h> +#include <unicode/unum.h> #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> -#include <unicode/udat.h> -#include <unicode/unum.h> namespace blink { @@ -46,7 +46,7 @@ // and LocalizedNumberICUTest.cpp. class PLATFORM_EXPORT LocaleICU : public Locale { public: - static std::unique_ptr<LocaleICU> create(const char* localeString); + static PassOwnPtr<LocaleICU> create(const char* localeString); ~LocaleICU() override; const Vector<String>& weekDayShortLabels() override; @@ -80,7 +80,7 @@ void initializeCalendar(); - std::unique_ptr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size); + PassOwnPtr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size); void initializeDateTimeFormat(); CString m_locale; @@ -89,9 +89,9 @@ bool m_didCreateDecimalFormat; bool m_didCreateShortDateFormat; - std::unique_ptr<Vector<String>> m_weekDayShortLabels; + OwnPtr<Vector<String>> m_weekDayShortLabels; unsigned m_firstDayOfWeek; - std::unique_ptr<Vector<String>> m_monthLabels; + OwnPtr<Vector<String>> m_monthLabels; String m_dateFormat; String m_monthFormat; String m_shortMonthFormat;
diff --git a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp index ff5e2b5..256467bc 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
@@ -31,8 +31,8 @@ #include "platform/text/LocaleICU.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" -#include <memory> #include <unicode/uvernum.h> namespace blink { @@ -89,49 +89,49 @@ String monthFormat(const char* localeString) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->monthFormat(); } String localizedDateFormatText(const char* localeString) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->timeFormat(); } String localizedShortDateFormatText(const char* localeString) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortTimeFormat(); } String shortMonthLabel(const char* localeString, unsigned index) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortMonthLabels()[index]; } String shortStandAloneMonthLabel(const char* localeString, unsigned index) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortStandAloneMonthLabels()[index]; } String standAloneMonthLabel(const char* localeString, unsigned index) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->standAloneMonthLabels()[index]; } Labels timeAMPMLabels(const char* localeString) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return Labels(locale->timeAMPMLabels()); } bool isRTL(const char* localeString) { - std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); return locale->isRTL(); } }; @@ -237,7 +237,7 @@ static String testDecimalSeparator(const AtomicString& localeIdentifier) { - std::unique_ptr<Locale> locale = Locale::create(localeIdentifier); + OwnPtr<Locale> locale = Locale::create(localeIdentifier); return locale->localizedDecimalSeparator(); } @@ -249,7 +249,7 @@ void testNumberIsReversible(const AtomicString& localeIdentifier, const char* original, const char* shouldHave = 0) { - std::unique_ptr<Locale> locale = Locale::create(localeIdentifier); + OwnPtr<Locale> locale = Locale::create(localeIdentifier); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/LocaleMac.h b/third_party/WebKit/Source/platform/text/LocaleMac.h index ec3a367..8a8a563 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMac.h +++ b/third_party/WebKit/Source/platform/text/LocaleMac.h
@@ -36,7 +36,6 @@ #include "wtf/RetainPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> OBJC_CLASS NSCalendar; OBJC_CLASS NSDateFormatter; @@ -46,8 +45,8 @@ class PLATFORM_EXPORT LocaleMac : public Locale { public: - static std::unique_ptr<LocaleMac> create(const String&); - static std::unique_ptr<LocaleMac> create(NSLocale*); + static PassOwnPtr<LocaleMac> create(const String&); + static PassOwnPtr<LocaleMac> create(NSLocale*); ~LocaleMac(); const Vector<String>& weekDayShortLabels() override;
diff --git a/third_party/WebKit/Source/platform/text/LocaleMac.mm b/third_party/WebKit/Source/platform/text/LocaleMac.mm index 9a225b91..39c762f 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMac.mm +++ b/third_party/WebKit/Source/platform/text/LocaleMac.mm
@@ -35,10 +35,9 @@ #include "platform/Language.h" #include "platform/LayoutTestSupport.h" #include "wtf/DateMath.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RetainPtr.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -65,7 +64,7 @@ return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]); } -std::unique_ptr<Locale> Locale::create(const String& locale) +PassOwnPtr<Locale> Locale::create(const String& locale) { return LocaleMac::create(determineLocale(locale).get()); } @@ -98,15 +97,15 @@ { } -std::unique_ptr<LocaleMac> LocaleMac::create(const String& localeIdentifier) +PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier) { RetainPtr<NSLocale> locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]; - return wrapUnique(new LocaleMac(locale.get())); + return adoptPtr(new LocaleMac(locale.get())); } -std::unique_ptr<LocaleMac> LocaleMac::create(NSLocale* locale) +PassOwnPtr<LocaleMac> LocaleMac::create(NSLocale* locale) { - return wrapUnique(new LocaleMac(locale)); + return adoptPtr(new LocaleMac(locale)); } RetainPtr<NSDateFormatter> LocaleMac::shortDateFormatter()
diff --git a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp index 60c9f7e..06fc799d 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
@@ -31,8 +31,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" -#include <memory> namespace blink { @@ -80,7 +80,7 @@ String formatWeek(const String& localeString, const String& isoString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); DateComponents date; unsigned end; date.parseWeek(isoString, 0, end); @@ -89,7 +89,7 @@ String formatMonth(const String& localeString, const String& isoString, bool useShortFormat) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); DateComponents date; unsigned end; date.parseMonth(isoString, 0, end); @@ -98,85 +98,85 @@ String formatDate(const String& localeString, int year, int month, int day) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->formatDateTime(getDateComponents(year, month, day)); } String formatTime(const String& localeString, int hour, int minute, int second, int millisecond, bool useShortFormat) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->formatDateTime(getTimeComponents(hour, minute, second, millisecond), (useShortFormat ? Locale::FormatTypeShort : Locale::FormatTypeMedium)); } unsigned firstDayOfWeek(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->firstDayOfWeek(); } String monthLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->monthLabels()[index]; } String weekDayShortLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->weekDayShortLabels()[index]; } bool isRTL(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->isRTL(); } String monthFormat(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->monthFormat(); } String timeFormat(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->timeFormat(); } String shortTimeFormat(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortTimeFormat(); } String shortMonthLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortMonthLabels()[index]; } String standAloneMonthLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->standAloneMonthLabels()[index]; } String shortStandAloneMonthLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortStandAloneMonthLabels()[index]; } String timeAMPMLabel(const String& localeString, unsigned index) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->timeAMPMLabels()[index]; } String decimalSeparator(const String& localeString) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); return locale->localizedDecimalSeparator(); } }; @@ -361,7 +361,7 @@ static void testNumberIsReversible(const AtomicString& localeString, const char* original, const char* shouldHave = 0) { - std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/LocaleWin.cpp b/third_party/WebKit/Source/platform/text/LocaleWin.cpp index cdbd1b7..35a6ec7e 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWin.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleWin.cpp
@@ -30,6 +30,7 @@ #include "platform/text/LocaleWin.h" +#include <limits> #include "platform/DateComponents.h" #include "platform/Language.h" #include "platform/LayoutTestSupport.h" @@ -37,12 +38,11 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/HashMap.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringHash.h" -#include <limits> -#include <memory> namespace blink { @@ -76,7 +76,7 @@ return lcid; } -std::unique_ptr<Locale> Locale::create(const String& locale) +PassOwnPtr<Locale> Locale::create(const String& locale) { // Whether the default settings for the locale should be used, ignoring user overrides. bool defaultsForLocale = LayoutTestSupport::isRunningLayoutTest(); @@ -95,9 +95,9 @@ m_firstDayOfWeek = (value + 1) % 7; } -std::unique_ptr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) +PassOwnPtr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) { - return wrapUnique(new LocaleWin(lcid, defaultsForLocale)); + return adoptPtr(new LocaleWin(lcid, defaultsForLocale)); } LocaleWin::~LocaleWin()
diff --git a/third_party/WebKit/Source/platform/text/LocaleWin.h b/third_party/WebKit/Source/platform/text/LocaleWin.h index 485e34bf..373a1fb 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWin.h +++ b/third_party/WebKit/Source/platform/text/LocaleWin.h
@@ -31,18 +31,17 @@ #ifndef LocaleWin_h #define LocaleWin_h +#include <windows.h> #include "platform/text/PlatformLocale.h" #include "wtf/Forward.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> -#include <windows.h> namespace blink { class PLATFORM_EXPORT LocaleWin : public Locale { public: - static std::unique_ptr<LocaleWin> create(LCID, bool defaultsForLocale); + static PassOwnPtr<LocaleWin> create(LCID, bool defaultsForLocale); ~LocaleWin(); const Vector<String>& weekDayShortLabels() override; unsigned firstDayOfWeek() override;
diff --git a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp index 70930c0..898fe5b 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
@@ -34,8 +34,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" -#include <memory> namespace blink { @@ -84,67 +84,67 @@ String formatDate(LCID lcid, int year, int month, int day) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->formatDateTime(getDateComponents(year, month, day)); } unsigned firstDayOfWeek(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->firstDayOfWeek(); } String monthLabel(LCID lcid, unsigned index) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->monthLabels()[index]; } String weekDayShortLabel(LCID lcid, unsigned index) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->weekDayShortLabels()[index]; } bool isRTL(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->isRTL(); } String monthFormat(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->monthFormat(); } String timeFormat(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->timeFormat(); } String shortTimeFormat(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->shortTimeFormat(); } String shortMonthLabel(LCID lcid, unsigned index) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->shortMonthLabels()[index]; } String timeAMPMLabel(LCID lcid, unsigned index) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->timeAMPMLabels()[index]; } String decimalSeparator(LCID lcid) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->localizedDecimalSeparator(); } }; @@ -261,7 +261,7 @@ static void testNumberIsReversible(LCID lcid, const char* original, const char* shouldHave = 0) { - std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/PlatformLocale.cpp b/third_party/WebKit/Source/platform/text/PlatformLocale.cpp index d4a0f56..3641a7c7 100644 --- a/third_party/WebKit/Source/platform/text/PlatformLocale.cpp +++ b/third_party/WebKit/Source/platform/text/PlatformLocale.cpp
@@ -33,7 +33,6 @@ #include "platform/text/DateTimeFormat.h" #include "public/platform/Platform.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -177,7 +176,7 @@ Locale& Locale::defaultLocale() { - static Locale* locale = Locale::create(defaultLanguage()).release(); + static Locale* locale = Locale::create(defaultLanguage()).leakPtr(); ASSERT(isMainThread()); return *locale; }
diff --git a/third_party/WebKit/Source/platform/text/PlatformLocale.h b/third_party/WebKit/Source/platform/text/PlatformLocale.h index ed248b3..d9189bb8f 100644 --- a/third_party/WebKit/Source/platform/text/PlatformLocale.h +++ b/third_party/WebKit/Source/platform/text/PlatformLocale.h
@@ -30,8 +30,8 @@ #include "platform/Language.h" #include "public/platform/WebLocalizedString.h" #include "wtf/Allocator.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -39,7 +39,7 @@ WTF_MAKE_NONCOPYABLE(Locale); USING_FAST_MALLOC(Locale); public: - static std::unique_ptr<Locale> create(const String& localeIdentifier); + static PassOwnPtr<Locale> create(const String& localeIdentifier); static Locale& defaultLocale(); String queryString(WebLocalizedString::Name);
diff --git a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp index eae10b8..9691763 100644 --- a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp +++ b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
@@ -24,11 +24,10 @@ #include "platform/text/TextBreakIteratorInternalICU.h" #include "wtf/Assertions.h" #include "wtf/HashMap.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/WTFString.h" -#include <memory> #include <unicode/rbbi.h> #include <unicode/ubrk.h> @@ -46,7 +45,7 @@ return **pool; } - static std::unique_ptr<LineBreakIteratorPool> create() { return wrapUnique(new LineBreakIteratorPool); } + static PassOwnPtr<LineBreakIteratorPool> create() { return adoptPtr(new LineBreakIteratorPool); } icu::BreakIterator* take(const AtomicString& locale) {
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h index 63dc410..f403459 100644 --- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h +++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h
@@ -7,6 +7,7 @@ #include "platform/PlatformExport.h" #include "wtf/Functional.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp index 25f85362..ec1e624 100644 --- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp +++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
@@ -8,8 +8,6 @@ #include "platform/WaitableEvent.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace { @@ -26,7 +24,7 @@ TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread) { - std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeShortRunningTask); // Test passes by not hanging on the following wait(). doneEvent->wait(); @@ -34,7 +32,7 @@ TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread) { - std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); + OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeLongRunningTask); // Test passes by not hanging on the following wait(). doneEvent->wait();
diff --git a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h index 14fdd36..64f47ad 100644 --- a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h +++ b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h
@@ -32,8 +32,7 @@ #include "wtf/Alignment.h" #include "wtf/Allocator.h" #include "wtf/CPU.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" #include <string.h> // for memcpy namespace blink { @@ -62,24 +61,24 @@ typedef double Matrix4[4][4]; #endif - static std::unique_ptr<TransformationMatrix> create() + static PassOwnPtr<TransformationMatrix> create() { - return wrapUnique(new TransformationMatrix()); + return adoptPtr(new TransformationMatrix()); } - static std::unique_ptr<TransformationMatrix> create(const TransformationMatrix& t) + static PassOwnPtr<TransformationMatrix> create(const TransformationMatrix& t) { - return wrapUnique(new TransformationMatrix(t)); + return adoptPtr(new TransformationMatrix(t)); } - static std::unique_ptr<TransformationMatrix> create(double a, double b, double c, double d, double e, double f) + static PassOwnPtr<TransformationMatrix> create(double a, double b, double c, double d, double e, double f) { - return wrapUnique(new TransformationMatrix(a, b, c, d, e, f)); + return adoptPtr(new TransformationMatrix(a, b, c, d, e, f)); } - static std::unique_ptr<TransformationMatrix> create(double m11, double m12, double m13, double m14, + static PassOwnPtr<TransformationMatrix> create(double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44) { - return wrapUnique(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); + return adoptPtr(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); } TransformationMatrix()
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump.cc b/third_party/WebKit/Source/platform/web_process_memory_dump.cc index 5da3aef..46f768a 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump.cc +++ b/third_party/WebKit/Source/platform/web_process_memory_dump.cc
@@ -74,7 +74,7 @@ // memory_allocator_dumps_ will take ownership of // |web_memory_allocator_dump|. memory_allocator_dumps_.set( - memory_allocator_dump, wrapUnique(web_memory_allocator_dump)); + memory_allocator_dump, adoptPtr(web_memory_allocator_dump)); return web_memory_allocator_dump; }
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump.h b/third_party/WebKit/Source/platform/web_process_memory_dump.h index ed7310f..5fb92cda 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump.h +++ b/third_party/WebKit/Source/platform/web_process_memory_dump.h
@@ -12,7 +12,9 @@ #include "platform/PlatformExport.h" #include "platform/web_memory_allocator_dump.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" + #include <map> #include <memory> #include <vector> @@ -156,7 +158,7 @@ // Those pointers are valid only within the scope of the call and can be // safely torn down once the WebProcessMemoryDump itself is destroyed. HashMap<base::trace_event::MemoryAllocatorDump*, - std::unique_ptr<WebMemoryAllocatorDump>> memory_allocator_dumps_; + OwnPtr<WebMemoryAllocatorDump>> memory_allocator_dumps_; // Stores SkTraceMemoryDump for the current ProcessMemoryDump. std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> sk_trace_dump_list_;
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc b/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc index 09875fb..aafa2d6 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc +++ b/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc
@@ -12,6 +12,7 @@ #include "base/values.h" #include "platform/web_memory_allocator_dump.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/third_party/WebKit/Source/platform/weborigin/KURL.cpp index b191958..d8b32348 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.cpp +++ b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -29,7 +29,6 @@ #include "platform/weborigin/KnownPorts.h" #include "url/url_util.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" @@ -275,7 +274,7 @@ , m_string(other.m_string) { if (other.m_innerURL.get()) - m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); + m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); } KURL::~KURL() @@ -289,7 +288,7 @@ m_parsed = other.m_parsed; m_string = other.m_string; if (other.m_innerURL) - m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); + m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); else m_innerURL.reset(); return *this; @@ -303,7 +302,7 @@ result.m_parsed = m_parsed; result.m_string = m_string.isolatedCopy(); if (m_innerURL) - result.m_innerURL = wrapUnique(new KURL(m_innerURL->copy())); + result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy())); return result; } @@ -819,7 +818,7 @@ return; } if (url::Parsed* innerParsed = m_parsed.inner_parsed()) - m_innerURL = wrapUnique(new KURL(ParsedURLString, m_string.substring(innerParsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); + m_innerURL = adoptPtr(new KURL(ParsedURLString, m_string.substring(innerParsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); else m_innerURL.reset(); }
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.h b/third_party/WebKit/Source/platform/weborigin/KURL.h index abb207f..ce7c730 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.h +++ b/third_party/WebKit/Source/platform/weborigin/KURL.h
@@ -32,8 +32,8 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/HashTableDeletedValueType.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { class TextEncoding; @@ -202,7 +202,7 @@ bool m_protocolIsInHTTPFamily; url::Parsed m_parsed; String m_string; - std::unique_ptr<KURL> m_innerURL; + OwnPtr<KURL> m_innerURL; }; PLATFORM_EXPORT bool operator==(const KURL&, const KURL&);
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp index 4560bab..395869e 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -37,10 +37,10 @@ #include "url/url_canon_ip.h" #include "wtf/HexNumber.h" #include "wtf/NotFound.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" -#include <memory> namespace blink { @@ -565,16 +565,16 @@ return uniqueSecurityOriginURL; } -std::unique_ptr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeData() const +PassOwnPtr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeData() const { - std::unique_ptr<PrivilegeData> privilegeData = wrapUnique(new PrivilegeData); + OwnPtr<PrivilegeData> privilegeData = adoptPtr(new PrivilegeData); privilegeData->m_universalAccess = m_universalAccess; privilegeData->m_canLoadLocalResources = m_canLoadLocalResources; privilegeData->m_blockLocalAccessFromLocalOrigin = m_blockLocalAccessFromLocalOrigin; return privilegeData; } -void SecurityOrigin::transferPrivilegesFrom(std::unique_ptr<PrivilegeData> privilegeData) +void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeData) { m_universalAccess = privilegeData->m_universalAccess; m_canLoadLocalResources = privilegeData->m_canLoadLocalResources;
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h index bfc37ff..6b06883 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h
@@ -35,7 +35,6 @@ #include "wtf/Noncopyable.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -252,8 +251,8 @@ bool m_canLoadLocalResources; bool m_blockLocalAccessFromLocalOrigin; }; - std::unique_ptr<PrivilegeData> createPrivilegeData() const; - void transferPrivilegesFrom(std::unique_ptr<PrivilegeData>); + PassOwnPtr<PrivilegeData> createPrivilegeData() const; + void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>); void setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOriginPotentiallyTrustworthy);
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp index e915a51..14cde14 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -35,15 +35,15 @@ #include "platform/weborigin/SecurityOrigin.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Threading.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { using OriginAccessWhiteList = Vector<OriginAccessEntry>; -using OriginAccessMap = HashMap<String, std::unique_ptr<OriginAccessWhiteList>>; +using OriginAccessMap = HashMap<String, OwnPtr<OriginAccessWhiteList>>; using OriginSet = HashSet<String>; static OriginAccessMap& originAccessMap() @@ -186,7 +186,7 @@ String sourceString = sourceOrigin.toString(); OriginAccessMap::AddResult result = originAccessMap().add(sourceString, nullptr); if (result.isNewEntry) - result.storedValue->value = wrapUnique(new OriginAccessWhiteList); + result.storedValue->value = adoptPtr(new OriginAccessWhiteList); OriginAccessWhiteList* list = result.storedValue->value.get(); list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp index a740f02..008e332 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp
@@ -48,10 +48,8 @@ #include "public/web/WebDataSource.h" #include "web/WebLocalFrameImpl.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" #include <limits.h> -#include <memory> namespace blink { @@ -81,11 +79,11 @@ class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoaderClient { WTF_MAKE_NONCOPYABLE(ClientAdapter); public: - static std::unique_ptr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); + static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); // ThreadableLoaderClient void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) override; - void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; void didDownloadData(int /*dataLength*/) override; void didReceiveData(const char*, unsigned /*dataLength*/) override; void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; @@ -125,9 +123,9 @@ bool m_didFail; }; -std::unique_ptr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) +PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) { - return wrapUnique(new ClientAdapter(loader, client, options)); + return adoptPtr(new ClientAdapter(loader, client, options)); } AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) @@ -160,7 +158,7 @@ m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); } -void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) +void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); if (!m_client)
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.h b/third_party/WebKit/Source/web/AssociatedURLLoader.h index 990d43c..234b8b6 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.h +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.h
@@ -35,8 +35,8 @@ #include "public/platform/WebURLLoader.h" #include "public/web/WebURLLoaderOptions.h" #include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -83,8 +83,8 @@ // An adapter which converts the DocumentThreadableLoaderClient method // calls into the WebURLLoaderClient method calls. - std::unique_ptr<ClientAdapter> m_clientAdapter; - std::unique_ptr<DocumentThreadableLoader> m_loader; + OwnPtr<ClientAdapter> m_clientAdapter; + OwnPtr<DocumentThreadableLoader> m_loader; // A ContextLifecycleObserver for cancelling |m_loader| when the Document // is detached.
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp index e29d874..ff6deb36 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp +++ b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp
@@ -45,10 +45,8 @@ #include "public/web/WebView.h" #include "testing/gtest/include/gtest/gtest.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> using blink::URLTestHelpers::toKURL; using blink::testing::runPendingTasks; @@ -117,16 +115,16 @@ Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); } - std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOptions options = WebURLLoaderOptions()) + PassOwnPtr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOptions options = WebURLLoaderOptions()) { - return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); + return adoptPtr(mainFrame()->createAssociatedURLLoader(options)); } // WebURLLoaderClient implementation. void willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) override { m_willFollowRedirect = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); // Check that CORS simple headers are transferred to the new request. EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.httpHeaderField("accept")); @@ -138,14 +136,14 @@ void didSendData(WebURLLoader* loader, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override { m_didSendData = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); } void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response) override { m_didReceiveResponse = true; m_actualResponse = WebURLResponse(response); - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); EXPECT_EQ(m_expectedResponse.url(), response.url()); EXPECT_EQ(m_expectedResponse.httpStatusCode(), response.httpStatusCode()); } @@ -153,13 +151,13 @@ void didDownloadData(WebURLLoader* loader, int dataLength, int encodedDataLength) override { m_didDownloadData = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); } void didReceiveData(WebURLLoader* loader, const char* data, int dataLength, int encodedDataLength) override { m_didReceiveData = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); EXPECT_TRUE(data); EXPECT_GT(dataLength, 0); } @@ -167,19 +165,19 @@ void didReceiveCachedMetadata(WebURLLoader* loader, const char* data, int dataLength) override { m_didReceiveCachedMetadata = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); } void didFinishLoading(WebURLLoader* loader, double finishTime, int64_t encodedDataLength) override { m_didFinishLoading = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); } void didFail(WebURLLoader* loader, const WebURLError& error) override { m_didFail = true; - EXPECT_EQ(m_expectedLoader.get(), loader); + EXPECT_EQ(m_expectedLoader, loader); } void CheckMethodFails(const char* unsafeMethod) @@ -270,7 +268,7 @@ String m_frameFilePath; FrameTestHelpers::WebViewHelper m_helper; - std::unique_ptr<WebURLLoader> m_expectedLoader; + OwnPtr<WebURLLoader> m_expectedLoader; WebURLResponse m_actualResponse; WebURLResponse m_expectedResponse; WebURLRequest m_expectedNewRequest;
diff --git a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp index f1d32424..4607fba 100644 --- a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp +++ b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp
@@ -8,7 +8,6 @@ #include "core/dom/ExecutionContext.h" #include "public/web/WebFrameClient.h" #include "web/WebLocalFrameImpl.h" -#include <memory> namespace blink { @@ -25,13 +24,13 @@ { } -void AudioOutputDeviceClientImpl::checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext* context, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks> callbacks) +void AudioOutputDeviceClientImpl::checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext* context, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks> callbacks) { DCHECK(context); DCHECK(context->isDocument()); Document* document = toDocument(context); WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); - webFrame->client()->checkIfAudioSinkExistsAndIsAuthorized(sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.release()); + webFrame->client()->checkIfAudioSinkExistsAndIsAuthorized(sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.leakPtr()); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h index b8bd34c..62e6da5 100644 --- a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h +++ b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h
@@ -7,7 +7,6 @@ #include "modules/audio_output_devices/AudioOutputDeviceClient.h" #include "platform/heap/Handle.h" -#include <memory> namespace blink { @@ -20,7 +19,7 @@ ~AudioOutputDeviceClientImpl() override; // AudioOutputDeviceClient implementation. - void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks>) override; + void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks>) override; // GarbageCollectedFinalized implementation. DEFINE_INLINE_VIRTUAL_TRACE() { AudioOutputDeviceClient::trace(visitor); }
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index 6b3b603..f3d796c7 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -103,12 +103,10 @@ #include "web/WebPluginContainerImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringConcatenate.h" -#include <memory> namespace blink { @@ -1115,9 +1113,9 @@ m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript(); } -std::unique_ptr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContext* blameContext) +PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContext* blameContext) { - return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext).release()); + return adoptPtr(m_webView->scheduler()->createFrameScheduler(blameContext).release()); } double ChromeClientImpl::lastFrameTimeMonotonic() const
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h index 72f56e20..183ca260 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.h +++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -36,7 +36,7 @@ #include "core/page/WindowFeatures.h" #include "public/web/WebNavigationPolicy.h" #include "web/WebExport.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -184,7 +184,7 @@ void didObserveNonGetFetchFromScript() const override; - std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; + PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; double lastFrameTimeMonotonic() const override;
diff --git a/third_party/WebKit/Source/web/ColorChooserPopupUIController.h b/third_party/WebKit/Source/web/ColorChooserPopupUIController.h index a0d7aa8..933ab26c 100644 --- a/third_party/WebKit/Source/web/ColorChooserPopupUIController.h +++ b/third_party/WebKit/Source/web/ColorChooserPopupUIController.h
@@ -28,6 +28,7 @@ #include "core/page/PagePopupClient.h" #include "web/ColorChooserUIController.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/ColorChooserUIController.cpp b/third_party/WebKit/Source/web/ColorChooserUIController.cpp index 8e5dccd..93ebd3c 100644 --- a/third_party/WebKit/Source/web/ColorChooserUIController.cpp +++ b/third_party/WebKit/Source/web/ColorChooserUIController.cpp
@@ -32,7 +32,6 @@ #include "public/web/WebColorSuggestion.h" #include "public/web/WebFrameClient.h" #include "web/WebLocalFrameImpl.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -99,7 +98,7 @@ WebFrameClient* webFrameClient = frame->client(); if (!webFrameClient) return; - m_chooser = wrapUnique(webFrameClient->createColorChooser( + m_chooser = adoptPtr(webFrameClient->createColorChooser( this, static_cast<WebColor>(m_client->currentColor().rgb()), m_client->suggestions())); }
diff --git a/third_party/WebKit/Source/web/ColorChooserUIController.h b/third_party/WebKit/Source/web/ColorChooserUIController.h index e83acd7e..123b86d3 100644 --- a/third_party/WebKit/Source/web/ColorChooserUIController.h +++ b/third_party/WebKit/Source/web/ColorChooserUIController.h
@@ -30,7 +30,7 @@ #include "platform/heap/Handle.h" #include "platform/text/PlatformLocale.h" #include "public/web/WebColorChooserClient.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -64,7 +64,7 @@ ColorChooserUIController(LocalFrame*, ColorChooserClient*); void openColorChooser(); - std::unique_ptr<WebColorChooser> m_chooser; + OwnPtr<WebColorChooser> m_chooser; Member<ColorChooserClient> m_client; Member<LocalFrame> m_frame;
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp index 79709e1..211ea54 100644 --- a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp +++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
@@ -14,7 +14,6 @@ #include "platform/heap/Handle.h" #include "public/platform/Platform.h" #include "web/CompositorProxyClientImpl.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -31,7 +30,7 @@ } // namespace CompositorMutatorImpl::CompositorMutatorImpl() - : m_animationManager(wrapUnique(new CustomCompositorAnimationManager)) + : m_animationManager(adoptPtr(new CustomCompositorAnimationManager)) , m_client(nullptr) { }
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.h b/third_party/WebKit/Source/web/CompositorMutatorImpl.h index a5281b6..7fa50747 100644 --- a/third_party/WebKit/Source/web/CompositorMutatorImpl.h +++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.h
@@ -10,7 +10,8 @@ #include "platform/heap/Handle.h" #include "platform/heap/HeapAllocator.h" #include "wtf/Noncopyable.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -53,7 +54,7 @@ using ProxyClients = HeapHashSet<WeakMember<CompositorProxyClientImpl>>; ProxyClients m_proxyClients; - std::unique_ptr<CustomCompositorAnimationManager> m_animationManager; + OwnPtr<CustomCompositorAnimationManager> m_animationManager; CompositorMutatorClient* m_client; };
diff --git a/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h b/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h index 3e1b9e3..64b5b07 100644 --- a/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h +++ b/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h
@@ -32,16 +32,14 @@ #define ContextFeaturesClientImpl_h #include "core/dom/ContextFeatures.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { class ContextFeaturesClientImpl final : public ContextFeaturesClient { public: - static std::unique_ptr<ContextFeaturesClientImpl> create() + static PassOwnPtr<ContextFeaturesClientImpl> create() { - return wrapUnique(new ContextFeaturesClientImpl()); + return adoptPtr(new ContextFeaturesClientImpl()); } bool isEnabled(Document*, ContextFeatures::FeatureType, bool defaultValue) override;
diff --git a/third_party/WebKit/Source/web/DateTimeChooserImpl.h b/third_party/WebKit/Source/web/DateTimeChooserImpl.h index 419cbd7..1949bf2 100644 --- a/third_party/WebKit/Source/web/DateTimeChooserImpl.h +++ b/third_party/WebKit/Source/web/DateTimeChooserImpl.h
@@ -33,7 +33,6 @@ #include "core/html/forms/DateTimeChooser.h" #include "core/page/PagePopupClient.h" -#include <memory> namespace blink { @@ -68,7 +67,7 @@ Member<DateTimeChooserClient> m_client; PagePopup* m_popup; DateTimeChooserParameters m_parameters; - std::unique_ptr<Locale> m_locale; + OwnPtr<Locale> m_locale; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp index bb651146..c9a6881 100644 --- a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp +++ b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp
@@ -43,7 +43,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/WorkerContentSettingsClient.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -55,7 +54,7 @@ WorkerClients* workerClients = WorkerClients::create(); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create()); - provideContentSettingsClientToWorker(workerClients, wrapUnique(webFrame->client()->createWorkerContentSettingsClientProxy())); + provideContentSettingsClientToWorker(workerClients, adoptPtr(webFrame->client()->createWorkerContentSettingsClientProxy())); // FIXME: call provideServiceWorkerContainerClientToWorker here when we // support ServiceWorker in dedicated workers (http://crbug.com/371690) return new DedicatedWorkerMessagingProxy(worker, workerClients);
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h index 1f99166e..8ed01a7 100644 --- a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h +++ b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h
@@ -33,6 +33,7 @@ #include "core/workers/DedicatedWorkerGlobalScopeProxyProvider.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp index 848f4e1..3b8be5b 100644 --- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
@@ -16,7 +16,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" namespace { @@ -367,8 +366,8 @@ PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const WebGestureEvent&>(inputEvent)); float pageScaleFactor = page->pageScaleFactor(); if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { - m_lastPinchAnchorCss = wrapUnique(new IntPoint(frameView->scrollPosition() + gestureEvent.position())); - m_lastPinchAnchorDip = wrapUnique(new IntPoint(gestureEvent.position())); + m_lastPinchAnchorCss = adoptPtr(new IntPoint(frameView->scrollPosition() + gestureEvent.position())); + m_lastPinchAnchorDip = adoptPtr(new IntPoint(gestureEvent.position())); m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); } if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPinchAnchorCss) {
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.h b/third_party/WebKit/Source/web/DevToolsEmulator.h index 07836526..73c35b4 100644 --- a/third_party/WebKit/Source/web/DevToolsEmulator.h +++ b/third_party/WebKit/Source/web/DevToolsEmulator.h
@@ -10,7 +10,7 @@ #include "public/platform/WebViewportStyle.h" #include "public/web/WebDeviceEmulationParams.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -83,8 +83,8 @@ bool m_originalDeviceSupportsMouse; bool m_originalDeviceSupportsTouch; int m_originalMaxTouchPoints; - std::unique_ptr<IntPoint> m_lastPinchAnchorCss; - std::unique_ptr<IntPoint> m_lastPinchAnchorDip; + OwnPtr<IntPoint> m_lastPinchAnchorCss; + OwnPtr<IntPoint> m_lastPinchAnchorDip; bool m_embedderScriptEnabled; bool m_scriptExecutionDisabled;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp index b3e73d3..b9c93176a 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -50,7 +50,6 @@ #include "public/web/WebPopupMenuInfo.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -112,7 +111,7 @@ #if OS(MACOSX) const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { - m_syntheticEvent = wrapUnique(new WebMouseEvent); + m_syntheticEvent = adoptPtr(new WebMouseEvent); *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent); m_syntheticEvent->type = WebInputEvent::MouseUp; m_dispatchEventTimer.startOneShot(0, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.h b/third_party/WebKit/Source/web/ExternalPopupMenu.h index 497343c2..e11ef4b 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenu.h +++ b/third_party/WebKit/Source/web/ExternalPopupMenu.h
@@ -38,7 +38,6 @@ #include "public/web/WebExternalPopupMenuClient.h" #include "web/WebExport.h" #include "wtf/Compiler.h" -#include <memory> namespace blink { @@ -86,7 +85,7 @@ Member<HTMLSelectElement> m_ownerElement; Member<LocalFrame> m_localFrame; WebViewImpl& m_webView; - std::unique_ptr<WebMouseEvent> m_syntheticEvent; + OwnPtr<WebMouseEvent> m_syntheticEvent; Timer<ExternalPopupMenu> m_dispatchEventTimer; // The actual implementor of the show menu. WebExternalPopupMenu* m_webExternalPopupMenu;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp index a48b89b2..b4bd8b0 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
@@ -23,7 +23,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" -#include <memory> namespace blink { @@ -43,7 +42,7 @@ m_dummyPageHolder->document().updateStyleAndLayoutIgnorePendingStylesheets(); } - std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + OwnPtr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLSelectElement> m_ownerElement; };
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp index 0f4a87b..108b2af 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -103,11 +103,9 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebPluginContainerImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> #include <v8.h> namespace blink { @@ -805,7 +803,7 @@ return container; } -std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( +PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( HTMLMediaElement& htmlMediaElement, const WebMediaPlayerSource& source, WebMediaPlayerClient* client) @@ -822,17 +820,17 @@ HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMedia::from(htmlMediaElement); WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); - return wrapUnique(webFrame->client()->createMediaPlayer(source, + return adoptPtr(webFrame->client()->createMediaPlayer(source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession)); } -std::unique_ptr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() +PassOwnPtr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() { if (!m_webFrame->client()) return nullptr; - return wrapUnique(m_webFrame->client()->createMediaSession()); + return adoptPtr(m_webFrame->client()->createMediaSession()); } ObjectContentType FrameLoaderClientImpl::getObjectContentType( @@ -965,11 +963,11 @@ m_webFrame->client()->willInsertBody(m_webFrame); } -std::unique_ptr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerProvider() +PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerProvider() { if (!m_webFrame->client()) return nullptr; - return wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); + return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); } bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) @@ -989,11 +987,11 @@ return m_webFrame->sharedWorkerRepositoryClient(); } -std::unique_ptr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCacheHost(WebApplicationCacheHostClient* client) +PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCacheHost(WebApplicationCacheHostClient* client) { if (!m_webFrame->client()) return nullptr; - return wrapUnique(m_webFrame->client()->createApplicationCacheHost(client)); + return adoptPtr(m_webFrame->client()->createApplicationCacheHost(client)); } void FrameLoaderClientImpl::dispatchDidChangeManifest()
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h index a8035c5..46f1519 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h
@@ -36,8 +36,8 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/platform/WebInsecureRequestPolicy.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -131,8 +131,8 @@ HTMLPlugInElement*, const KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually, DetachedPluginPolicy) override; - std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; - std::unique_ptr<WebMediaSession> createWebMediaSession() override; + PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; + PassOwnPtr<WebMediaSession> createWebMediaSession() override; ObjectContentType getObjectContentType( const KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) override; void didChangeScrollOffset() override; @@ -165,12 +165,12 @@ void dispatchWillInsertBody() override; - std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() override; + PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() override; bool isControlledByServiceWorker(DocumentLoader&) override; int64_t serviceWorkerID(DocumentLoader&) override; SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() override; - std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; + PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; void dispatchDidChangeManifest() override;
diff --git a/third_party/WebKit/Source/web/FullscreenController.h b/third_party/WebKit/Source/web/FullscreenController.h index 039535c..2655d15d 100644 --- a/third_party/WebKit/Source/web/FullscreenController.h +++ b/third_party/WebKit/Source/web/FullscreenController.h
@@ -34,6 +34,7 @@ #include "platform/geometry/FloatPoint.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.cpp b/third_party/WebKit/Source/web/InspectorOverlay.cpp index 80d894cc..f88ab50d 100644 --- a/third_party/WebKit/Source/web/InspectorOverlay.cpp +++ b/third_party/WebKit/Source/web/InspectorOverlay.cpp
@@ -58,7 +58,6 @@ #include "web/WebInputEventConversion.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" -#include <memory> #include <v8.h> namespace blink { @@ -321,7 +320,7 @@ scheduleUpdate(); } -void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode, std::unique_ptr<InspectorHighlightConfig> highlightConfig) +void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode, PassOwnPtr<InspectorHighlightConfig> highlightConfig) { if (m_layoutEditor) overlayClearSelection(true); @@ -349,7 +348,7 @@ initializeLayoutEditorIfNeeded(node); } -void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const InspectorHighlightConfig& highlightConfig) +void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const InspectorHighlightConfig& highlightConfig) { m_quadHighlightConfig = highlightConfig; m_highlightQuad = std::move(quad);
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.h b/third_party/WebKit/Source/web/InspectorOverlay.h index c9daa2b..3975ed1 100644 --- a/third_party/WebKit/Source/web/InspectorOverlay.h +++ b/third_party/WebKit/Source/web/InspectorOverlay.h
@@ -38,9 +38,10 @@ #include "platform/heap/Handle.h" #include "platform/inspector_protocol/Values.h" #include "public/web/WebInputEvent.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -109,8 +110,8 @@ // InspectorDOMAgent::Client implementation. void hideHighlight() override; void highlightNode(Node*, const InspectorHighlightConfig&, bool omitTooltip) override; - void highlightQuad(std::unique_ptr<FloatQuad>, const InspectorHighlightConfig&) override; - void setInspectMode(InspectorDOMAgent::SearchMode, std::unique_ptr<InspectorHighlightConfig>) override; + void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) override; + void setInspectMode(InspectorDOMAgent::SearchMode, PassOwnPtr<InspectorHighlightConfig>) override; void setInspectedNode(Node*) override; void highlightNode(Node*, Node* eventTarget, const InspectorHighlightConfig&, bool omitTooltip); @@ -144,7 +145,7 @@ Member<Node> m_highlightNode; Member<Node> m_eventTargetNode; InspectorHighlightConfig m_nodeHighlightConfig; - std::unique_ptr<FloatQuad> m_highlightQuad; + OwnPtr<FloatQuad> m_highlightQuad; Member<Page> m_overlayPage; Member<InspectorOverlayChromeClient> m_overlayChromeClient; Member<InspectorOverlayHost> m_overlayHost; @@ -160,10 +161,10 @@ Member<InspectorDOMAgent> m_domAgent; Member<InspectorCSSAgent> m_cssAgent; Member<LayoutEditor> m_layoutEditor; - std::unique_ptr<PageOverlay> m_pageOverlay; + OwnPtr<PageOverlay> m_pageOverlay; Member<Node> m_hoveredNodeForInspectMode; InspectorDOMAgent::SearchMode m_inspectMode; - std::unique_ptr<InspectorHighlightConfig> m_inspectModeHighlightConfig; + OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp index 81153985a..9df40f3 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp +++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
@@ -59,15 +59,13 @@ #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/Vector.h" -#include <memory> namespace blink { -std::unique_ptr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl* owningWebViewImpl) +PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl* owningWebViewImpl) { - return wrapUnique(new LinkHighlightImpl(node, owningWebViewImpl)); + return adoptPtr(new LinkHighlightImpl(node, owningWebViewImpl)); } LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owningWebViewImpl) @@ -83,8 +81,8 @@ DCHECK(owningWebViewImpl); WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); DCHECK(compositorSupport); - m_contentLayer = wrapUnique(compositorSupport->createContentLayer(this)); - m_clipLayer = wrapUnique(compositorSupport->createLayer()); + m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); + m_clipLayer = adoptPtr(compositorSupport->createLayer()); m_clipLayer->setTransformOrigin(WebFloatPoint3D()); m_clipLayer->addChild(m_contentLayer->layer()); @@ -304,7 +302,7 @@ m_contentLayer->layer()->setOpacity(startOpacity); - std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); const auto easeType = CubicBezierTimingFunction::EaseType::EASE; @@ -316,10 +314,10 @@ // For layout tests we don't fade out. curve->addCubicBezierKeyframe(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0), easeType); - std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0); + OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0); m_contentLayer->layer()->setDrawsContent(true); - m_compositorPlayer->addAnimation(animation.release()); + m_compositorPlayer->addAnimation(animation.leakPtr()); invalidate(); m_owningWebViewImpl->scheduleAnimation();
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.h b/third_party/WebKit/Source/web/LinkHighlightImpl.h index 86c28fc..d92a28a 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImpl.h +++ b/third_party/WebKit/Source/web/LinkHighlightImpl.h
@@ -36,7 +36,7 @@ #include "public/platform/WebContentLayerClient.h" #include "web/WebExport.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -52,7 +52,7 @@ , public CompositorAnimationDelegate , public CompositorAnimationPlayerClient { public: - static std::unique_ptr<LinkHighlightImpl> create(Node*, WebViewImpl*); + static PassOwnPtr<LinkHighlightImpl> create(Node*, WebViewImpl*); ~LinkHighlightImpl() override; WebContentLayer* contentLayer(); @@ -91,15 +91,15 @@ // size since the last call to this function. bool computeHighlightLayerPathAndPosition(const LayoutBoxModelObject&); - std::unique_ptr<WebContentLayer> m_contentLayer; - std::unique_ptr<WebLayer> m_clipLayer; + OwnPtr<WebContentLayer> m_contentLayer; + OwnPtr<WebLayer> m_clipLayer; Path m_path; Persistent<Node> m_node; WebViewImpl* m_owningWebViewImpl; GraphicsLayer* m_currentGraphicsLayer; bool m_isScrollingGraphicsLayer; - std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; + OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; bool m_geometryNeedsUpdate; bool m_isAnimating;
diff --git a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp index c4551696..4a7f761a 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp +++ b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
@@ -47,8 +47,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -167,7 +166,7 @@ // A lifetime test: delete LayerTreeView while running LinkHighlights. TEST(LinkHighlightImplTest, resetLayerTreeView) { - std::unique_ptr<FakeCompositingWebViewClient> webViewClient = wrapUnique(new FakeCompositingWebViewClient()); + OwnPtr<FakeCompositingWebViewClient> webViewClient = adoptPtr(new FakeCompositingWebViewClient()); const std::string baseURL("http://www.test.com/"); const std::string fileName("test_touch_link_highlight.html");
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp index 76e1690..ad431ca 100644 --- a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp +++ b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp
@@ -38,15 +38,13 @@ #include "public/web/WebContentSettingsClient.h" #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { -std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() +PassOwnPtr<FileSystemClient> LocalFileSystemClient::create() { - return wrapUnique(static_cast<FileSystemClient*>(new LocalFileSystemClient())); + return adoptPtr(static_cast<FileSystemClient*>(new LocalFileSystemClient())); } LocalFileSystemClient::~LocalFileSystemClient() @@ -65,7 +63,7 @@ return WorkerContentSettingsClient::from(*toWorkerGlobalScope(context))->requestFileSystemAccessSync(); } -void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* context, std::unique_ptr<ContentSettingCallbacks> callbacks) +void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* context, PassOwnPtr<ContentSettingCallbacks> callbacks) { DCHECK(context); if (!context->isDocument()) {
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.h b/third_party/WebKit/Source/web/LocalFileSystemClient.h index 4326d2b..597d55f 100644 --- a/third_party/WebKit/Source/web/LocalFileSystemClient.h +++ b/third_party/WebKit/Source/web/LocalFileSystemClient.h
@@ -33,18 +33,17 @@ #include "modules/filesystem/FileSystemClient.h" #include "wtf/Forward.h" -#include <memory> namespace blink { class LocalFileSystemClient final : public FileSystemClient { public: - static std::unique_ptr<FileSystemClient> create(); + static PassOwnPtr<FileSystemClient> create(); ~LocalFileSystemClient() override; bool requestFileSystemAccessSync(ExecutionContext*) override; - void requestFileSystemAccessAsync(ExecutionContext*, std::unique_ptr<ContentSettingCallbacks>) override; + void requestFileSystemAccessAsync(ExecutionContext*, PassOwnPtr<ContentSettingCallbacks>) override; private: LocalFileSystemClient();
diff --git a/third_party/WebKit/Source/web/MIDIClientProxy.h b/third_party/WebKit/Source/web/MIDIClientProxy.h index 9f8cefaf..05395e8d 100644 --- a/third_party/WebKit/Source/web/MIDIClientProxy.h +++ b/third_party/WebKit/Source/web/MIDIClientProxy.h
@@ -33,8 +33,6 @@ #include "modules/webmidi/MIDIClient.h" #include "platform/heap/Handle.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -44,9 +42,9 @@ class MIDIClientProxy final : public MIDIClient { public: - static std::unique_ptr<MIDIClientProxy> create(WebMIDIClient* client) + static PassOwnPtr<MIDIClientProxy> create(WebMIDIClient* client) { - return wrapUnique(new MIDIClientProxy(client)); + return adoptPtr(new MIDIClientProxy(client)); } // MIDIClient
diff --git a/third_party/WebKit/Source/web/PageOverlay.cpp b/third_party/WebKit/Source/web/PageOverlay.cpp index e113b7f..cfb2d80e 100644 --- a/third_party/WebKit/Source/web/PageOverlay.cpp +++ b/third_party/WebKit/Source/web/PageOverlay.cpp
@@ -40,14 +40,12 @@ #include "public/web/WebViewClient.h" #include "web/WebDevToolsAgentImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { -std::unique_ptr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate) +PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate) { - return wrapUnique(new PageOverlay(viewImpl, delegate)); + return adoptPtr(new PageOverlay(viewImpl, delegate)); } PageOverlay::PageOverlay(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate)
diff --git a/third_party/WebKit/Source/web/PageOverlay.h b/third_party/WebKit/Source/web/PageOverlay.h index e261c4f2..c027ea2 100644 --- a/third_party/WebKit/Source/web/PageOverlay.h +++ b/third_party/WebKit/Source/web/PageOverlay.h
@@ -33,8 +33,9 @@ #include "platform/graphics/GraphicsLayerClient.h" #include "platform/graphics/paint/DisplayItemClient.h" #include "web/WebExport.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -58,7 +59,7 @@ virtual ~Delegate() { } }; - static std::unique_ptr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); + static PassOwnPtr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); ~PageOverlay(); @@ -82,7 +83,7 @@ WebViewImpl* m_viewImpl; Persistent<PageOverlay::Delegate> m_delegate; - std::unique_ptr<GraphicsLayer> m_layer; + OwnPtr<GraphicsLayer> m_layer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/PageOverlayTest.cpp b/third_party/WebKit/Source/web/PageOverlayTest.cpp index 5ada6d1..5eddde85 100644 --- a/third_party/WebKit/Source/web/PageOverlayTest.cpp +++ b/third_party/WebKit/Source/web/PageOverlayTest.cpp
@@ -22,7 +22,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" -#include <memory> using testing::_; using testing::AtLeast; @@ -80,7 +79,7 @@ WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - std::unique_ptr<PageOverlay> createSolidYellowOverlay() + PassOwnPtr<PageOverlay> createSolidYellowOverlay() { return PageOverlay::create(webViewImpl(), new SolidColorOverlay(SK_ColorYELLOW)); } @@ -112,7 +111,7 @@ initialize(AcceleratedCompositing); webViewImpl()->layerTreeView()->setViewportSize(WebSize(viewportWidth, viewportHeight)); - std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); + OwnPtr<PageOverlay> pageOverlay = createSolidYellowOverlay(); pageOverlay->update(); webViewImpl()->updateAllLifecyclePhases(); @@ -142,7 +141,7 @@ TEST_F(PageOverlayTest, PageOverlay_VisualRect) { initialize(AcceleratedCompositing); - std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); + OwnPtr<PageOverlay> pageOverlay = createSolidYellowOverlay(); pageOverlay->update(); webViewImpl()->updateAllLifecyclePhases(); EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), pageOverlay->visualRect());
diff --git a/third_party/WebKit/Source/web/PageWidgetDelegate.h b/third_party/WebKit/Source/web/PageWidgetDelegate.h index 95f9b1ef..ef12d7a 100644 --- a/third_party/WebKit/Source/web/PageWidgetDelegate.h +++ b/third_party/WebKit/Source/web/PageWidgetDelegate.h
@@ -35,6 +35,7 @@ #include "public/web/WebInputEvent.h" #include "public/web/WebWidget.h" #include "web/WebExport.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp index b22754b..e3b220f 100644 --- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp +++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
@@ -18,8 +18,6 @@ #include "web/WebInputEventConversion.h" #include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -174,11 +172,11 @@ // This is only called when we have out-of-process iframes, which // need to forward input events across processes. // FIXME: Add a check for out-of-process iframes enabled. - std::unique_ptr<WebInputEvent> webEvent; + OwnPtr<WebInputEvent> webEvent; if (event->isKeyboardEvent()) - webEvent = wrapUnique(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); + webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); else if (event->isMouseEvent()) - webEvent = wrapUnique(new WebMouseEventBuilder(m_webFrame->frame()->view(), LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_cast<MouseEvent*>(event))); + webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view(), LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_cast<MouseEvent*>(event))); // Other or internal Blink events should not be forwarded. if (!webEvent || webEvent->type == WebInputEvent::Undefined)
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp index 2983d67..b3cfe304 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp
@@ -34,7 +34,7 @@ #include "public/platform/WebURL.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -122,14 +122,14 @@ m_client.didHandleSyncEvent(syncEventID, result); } -void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray> webChannels) +void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) { - m_client.postMessageToClient(clientUUID, message, webChannels.release()); + m_client.postMessageToClient(clientUUID, message, webChannels.leakPtr()); } -void ServiceWorkerGlobalScopeClientImpl::postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& client, const WebString& message, std::unique_ptr<WebMessagePortChannelArray> webChannels) +void ServiceWorkerGlobalScopeClientImpl::postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& client, const WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) { - m_client.postMessageToCrossOriginClient(client, message, webChannels.release()); + m_client.postMessageToCrossOriginClient(client, message, webChannels.leakPtr()); } void ServiceWorkerGlobalScopeClientImpl::skipWaiting(WebServiceWorkerSkipWaitingCallbacks* callbacks)
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h index e9ca382..52d6d4a 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h
@@ -34,7 +34,7 @@ #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallbacks.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -65,8 +65,8 @@ void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResult) override; void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) override; void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) override; - void postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) override; - void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) override; + void postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) override; + void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) override; void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) override; void claim(WebServiceWorkerClientsClaimCallbacks*) override; void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) override;
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp index 80b9d7d..e998bb0 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -64,8 +64,8 @@ #include "web/WebEmbeddedWorkerImpl.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" + #include <utility> namespace blink { @@ -124,7 +124,7 @@ String origin; if (!sourceOrigin.isUnique()) origin = sourceOrigin.toString(); - ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), wrapUnique(handle.release())); + ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), adoptPtr(handle.release())); WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID); Event* event = ExtendableMessageEvent::create(value, origin, ports, source, observer); @@ -217,7 +217,7 @@ return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); } -void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) +void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) { client().reportException(errorMessage, location->lineNumber(), location->columnNumber(), location->url()); }
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h index 70c9a54..bddf8ab9 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
@@ -37,7 +37,7 @@ #include "public/platform/WebString.h" #include "public/web/modules/serviceworker/WebServiceWorkerContextProxy.h" #include "wtf/Forward.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace blink { @@ -84,7 +84,7 @@ bool hasFetchEventHandler() override; // WorkerReportingProxy overrides: - void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) override; + void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const String&) override; void postWorkerConsoleAgentEnabled() override { }
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp index d70c05e..9971e968 100644 --- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp +++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp
@@ -50,15 +50,13 @@ #include "public/web/WebSharedWorkerCreationErrors.h" #include "public/web/WebSharedWorkerRepositoryClient.h" #include "web/WebLocalFrameImpl.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { // Callback class that keeps the SharedWorker and WebSharedWorker objects alive while connecting. class SharedWorkerConnector : private WebSharedWorkerConnector::ConnectListener { public: - SharedWorkerConnector(SharedWorker* worker, const KURL& url, const String& name, WebMessagePortChannelUniquePtr channel, std::unique_ptr<WebSharedWorkerConnector> webWorkerConnector) + SharedWorkerConnector(SharedWorker* worker, const KURL& url, const String& name, WebMessagePortChannelUniquePtr channel, PassOwnPtr<WebSharedWorkerConnector> webWorkerConnector) : m_worker(worker) , m_url(url) , m_name(name) @@ -76,7 +74,7 @@ Persistent<SharedWorker> m_worker; KURL m_url; String m_name; - std::unique_ptr<WebSharedWorkerConnector> m_webWorkerConnector; + OwnPtr<WebSharedWorkerConnector> m_webWorkerConnector; WebMessagePortChannelUniquePtr m_channel; }; @@ -122,7 +120,7 @@ // when multiple might have been sent. Fix by making the // SharedWorkerConnector interface take a map that can contain // multiple headers. - std::unique_ptr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->contentSecurityPolicy()->headers(); + OwnPtr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->contentSecurityPolicy()->headers(); WebString header; WebContentSecurityPolicyType headerType = WebContentSecurityPolicyTypeReport; @@ -134,7 +132,7 @@ WebWorkerCreationError creationError; String unusedSecureContextError; bool isSecureContext = worker->getExecutionContext()->isSecureContext(unusedSecureContextError); - std::unique_ptr<WebSharedWorkerConnector> webWorkerConnector = wrapUnique(m_client->createSharedWorkerConnector(url, name, getId(document), header, headerType, worker->getExecutionContext()->securityContext().addressSpace(), isSecureContext ? WebSharedWorkerCreationContextTypeSecure : WebSharedWorkerCreationContextTypeNonsecure, &creationError)); + OwnPtr<WebSharedWorkerConnector> webWorkerConnector = adoptPtr(m_client->createSharedWorkerConnector(url, name, getId(document), header, headerType, worker->getExecutionContext()->securityContext().addressSpace(), isSecureContext ? WebSharedWorkerCreationContextTypeSecure : WebSharedWorkerCreationContextTypeNonsecure, &creationError)); if (creationError != WebWorkerCreationErrorNone) { if (creationError == WebWorkerCreationErrorURLMismatch) { // Existing worker does not match this url, so return an error back to the caller.
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h index fbc621d..ce91215 100644 --- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h +++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h
@@ -33,9 +33,8 @@ #include "core/workers/SharedWorkerRepositoryClient.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -45,9 +44,9 @@ WTF_MAKE_NONCOPYABLE(SharedWorkerRepositoryClientImpl); USING_FAST_MALLOC(SharedWorkerRepositoryClientImpl); public: - static std::unique_ptr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client) + static PassOwnPtr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client) { - return wrapUnique(new SharedWorkerRepositoryClientImpl(client)); + return adoptPtr(new SharedWorkerRepositoryClientImpl(client)); } ~SharedWorkerRepositoryClientImpl() override { }
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp index 62f929c3..798091f 100644 --- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp +++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp
@@ -42,8 +42,6 @@ #include "public/web/WebSpeechRecognitionResult.h" #include "public/web/WebSpeechRecognizer.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -51,9 +49,9 @@ { } -std::unique_ptr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(WebSpeechRecognizer* recognizer) +PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(WebSpeechRecognizer* recognizer) { - return wrapUnique(new SpeechRecognitionClientProxy(recognizer)); + return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); } void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives, MediaStreamTrack* audioTrack)
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h index c23ac5fd..0ff2721d 100644 --- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h +++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h
@@ -29,8 +29,8 @@ #include "modules/speech/SpeechRecognitionClient.h" #include "public/web/WebSpeechRecognizerClient.h" #include "wtf/Compiler.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -44,7 +44,7 @@ // Constructing a proxy object with a 0 WebSpeechRecognizer is safe in // itself, but attempting to call start/stop/abort on it will crash. - static std::unique_ptr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*); + static PassOwnPtr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*); // SpeechRecognitionClient: void start(SpeechRecognition*, const SpeechGrammarList*, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives, MediaStreamTrack*) override;
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.cpp b/third_party/WebKit/Source/web/StorageClientImpl.cpp index 6c651c2b6..9db053e 100644 --- a/third_party/WebKit/Source/web/StorageClientImpl.cpp +++ b/third_party/WebKit/Source/web/StorageClientImpl.cpp
@@ -31,8 +31,6 @@ #include "public/web/WebViewClient.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -41,11 +39,11 @@ { } -std::unique_ptr<StorageNamespace> StorageClientImpl::createSessionStorageNamespace() +PassOwnPtr<StorageNamespace> StorageClientImpl::createSessionStorageNamespace() { if (!m_webView->client()) return nullptr; - return wrapUnique(new StorageNamespace(wrapUnique(m_webView->client()->createSessionStorageNamespace()))); + return adoptPtr(new StorageNamespace(adoptPtr(m_webView->client()->createSessionStorageNamespace()))); } bool StorageClientImpl::canAccessStorage(LocalFrame* frame, StorageType type) const
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.h b/third_party/WebKit/Source/web/StorageClientImpl.h index d8de138..019b1d3 100644 --- a/third_party/WebKit/Source/web/StorageClientImpl.h +++ b/third_party/WebKit/Source/web/StorageClientImpl.h
@@ -6,7 +6,6 @@ #define StorageClientImpl_h #include "modules/storage/StorageClient.h" -#include <memory> namespace blink { @@ -16,7 +15,7 @@ public: explicit StorageClientImpl(WebViewImpl*); - std::unique_ptr<StorageNamespace> createSessionStorageNamespace() override; + PassOwnPtr<StorageNamespace> createSessionStorageNamespace() override; bool canAccessStorage(LocalFrame*, StorageType) const override; private:
diff --git a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp index 9a3dabc..3a0a955 100644 --- a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp +++ b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp
@@ -11,8 +11,6 @@ #include "platform/UserGestureIndicator.h" #include "public/platform/WebVector.h" #include "public/web/WebScriptExecutionCallback.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -67,9 +65,9 @@ { // after calling the destructor of object - object will be unsubscribed from // resumed and contextDestroyed LifecycleObserver methods - std::unique_ptr<UserGestureIndicator> indicator; + OwnPtr<UserGestureIndicator> indicator; if (m_userGesture) - indicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); v8::HandleScope scope(v8::Isolate::GetCurrent()); Vector<v8::Local<v8::Value>> results;
diff --git a/third_party/WebKit/Source/web/TextFinder.h b/third_party/WebKit/Source/web/TextFinder.h index 7466c43c11..267f2335 100644 --- a/third_party/WebKit/Source/web/TextFinder.h +++ b/third_party/WebKit/Source/web/TextFinder.h
@@ -40,6 +40,7 @@ #include "public/web/WebFindOptions.h" #include "web/WebExport.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebBlob.cpp b/third_party/WebKit/Source/web/WebBlob.cpp index 977cc96..370a6b10 100644 --- a/third_party/WebKit/Source/web/WebBlob.cpp +++ b/third_party/WebKit/Source/web/WebBlob.cpp
@@ -35,7 +35,7 @@ #include "core/fileapi/Blob.h" #include "platform/FileMetadata.h" #include "platform/blob/BlobData.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -46,7 +46,7 @@ WebBlob WebBlob::createFromFile(const WebString& path, long long size) { - std::unique_ptr<BlobData> blobData = BlobData::create(); + OwnPtr<BlobData> blobData = BlobData::create(); blobData->appendFile(path, 0, size, invalidFileTime()); return Blob::create(BlobDataHandle::create(std::move(blobData), size)); }
diff --git a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp index ff332a0..71236d1 100644 --- a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp +++ b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp
@@ -35,15 +35,13 @@ #include "core/dom/Document.h" #include "core/frame/LocalDOMWindow.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { class DOMActivityLoggerContainer : public V8DOMActivityLogger { public: - explicit DOMActivityLoggerContainer(std::unique_ptr<WebDOMActivityLogger> logger) + explicit DOMActivityLoggerContainer(PassOwnPtr<WebDOMActivityLogger> logger) : m_domActivityLogger(std::move(logger)) { } @@ -86,7 +84,7 @@ return WebString(); } - std::unique_ptr<WebDOMActivityLogger> m_domActivityLogger; + OwnPtr<WebDOMActivityLogger> m_domActivityLogger; }; bool hasDOMActivityLogger(int worldId, const WebString& extensionId) @@ -97,7 +95,7 @@ void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActivityLogger* logger) { DCHECK(logger); - V8DOMActivityLogger::setActivityLogger(worldId, extensionId, wrapUnique(new DOMActivityLoggerContainer(wrapUnique(logger)))); + V8DOMActivityLogger::setActivityLogger(worldId, extensionId, adoptPtr(new DOMActivityLoggerContainer(adoptPtr(logger)))); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp index 1cf7e7b4..4be3221 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp
@@ -35,8 +35,7 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLError.h" #include "public/platform/WebVector.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { @@ -105,8 +104,8 @@ void WebDataSourceImpl::setExtraData(ExtraData* extraData) { - // extraData can't be a std::unique_ptr because setExtraData is a WebKit API function. - m_extraData = wrapUnique(extraData); + // extraData can't be a PassOwnPtr because setExtraData is a WebKit API function. + m_extraData = adoptPtr(extraData); } void WebDataSourceImpl::setNavigationStartTime(double navigationStart) @@ -152,7 +151,7 @@ void WebDataSourceImpl::setSubresourceFilter(WebDocumentSubresourceFilter* subresourceFilter) { - DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter)); + DocumentLoader::setSubresourceFilter(WTF::adoptPtr(subresourceFilter)); } DEFINE_TRACE(WebDataSourceImpl)
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.h b/third_party/WebKit/Source/web/WebDataSourceImpl.h index 717c9c6a..5bb0cecf 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.h +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.h
@@ -37,8 +37,9 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/web/WebDataSource.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -83,7 +84,7 @@ mutable WrappedResourceRequest m_requestWrapper; mutable WrappedResourceResponse m_responseWrapper; - std::unique_ptr<ExtraData> m_extraData; + OwnPtr<ExtraData> m_extraData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp index 7b5a6e3..0e5a4f94 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
@@ -90,9 +90,7 @@ #include "web/WebViewImpl.h" #include "wtf/MathExtras.h" #include "wtf/Noncopyable.h" -#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -118,7 +116,7 @@ { if (s_instance) return; - std::unique_ptr<ClientMessageLoopAdapter> instance = wrapUnique(new ClientMessageLoopAdapter(wrapUnique(client->createClientMessageLoop()))); + OwnPtr<ClientMessageLoopAdapter> instance = adoptPtr(new ClientMessageLoopAdapter(adoptPtr(client->createClientMessageLoop()))); s_instance = instance.get(); MainThreadDebugger::instance()->setClientMessageLoop(std::move(instance)); } @@ -154,7 +152,7 @@ } private: - ClientMessageLoopAdapter(std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> messageLoop) + ClientMessageLoopAdapter(PassOwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> messageLoop) : m_runningForDebugBreak(false) , m_runningForCreateWindow(false) , m_messageLoop(std::move(messageLoop)) @@ -269,7 +267,7 @@ bool m_runningForDebugBreak; bool m_runningForCreateWindow; - std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; + OwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; typedef HashSet<WebViewImpl*> FrozenViewsSet; FrozenViewsSet m_frozenViews; WebFrameWidgetsSet m_frozenWidgets; @@ -648,7 +646,7 @@ flushProtocolNotifications(); } -void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, std::unique_ptr<WebDevToolsAgent::MessageDescriptor> descriptor) +void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, PassOwnPtr<WebDevToolsAgent::MessageDescriptor> descriptor) { WebDevToolsAgent* webagent = descriptor->agent(); if (!webagent) @@ -661,8 +659,8 @@ void WebDevToolsAgent::interruptAndDispatch(int sessionId, MessageDescriptor* rawDescriptor) { - // rawDescriptor can't be a std::unique_ptr because interruptAndDispatch is a WebKit API function. - MainThreadDebugger::interruptMainThreadAndRun(threadSafeBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, passed(wrapUnique(rawDescriptor)))); + // rawDescriptor can't be a PassOwnPtr because interruptAndDispatch is a WebKit API function. + MainThreadDebugger::interruptMainThreadAndRun(threadSafeBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, passed(adoptPtr(rawDescriptor)))); } bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method)
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h index a25d5a1..222a0d2 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h
@@ -40,8 +40,8 @@ #include "public/web/WebDevToolsAgent.h" #include "web/InspectorEmulationAgent.h" #include "wtf/Forward.h" +#include "wtf/OwnPtr.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -135,7 +135,7 @@ void dispatchMessageFromFrontend(int sessionId, const String& method, const String& message); friend class WebDevToolsAgent; - static void runDebuggerTask(int sessionId, std::unique_ptr<WebDevToolsAgent::MessageDescriptor>); + static void runDebuggerTask(int sessionId, PassOwnPtr<WebDevToolsAgent::MessageDescriptor>); bool attached() const { return m_session.get(); }
diff --git a/third_party/WebKit/Source/web/WebElementTest.cpp b/third_party/WebKit/Source/web/WebElementTest.cpp index 58cecc69..3395001 100644 --- a/third_party/WebKit/Source/web/WebElementTest.cpp +++ b/third_party/WebKit/Source/web/WebElementTest.cpp
@@ -9,7 +9,6 @@ #include "core/dom/shadow/ShadowRoot.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -69,7 +68,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; void WebElementTest::insertHTML(String html)
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp index e995bff4..d6d3b30 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -71,14 +71,12 @@ #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* client, WebWorkerContentSettingsClientProxy* contentSettingsClient) { - return new WebEmbeddedWorkerImpl(wrapUnique(client), wrapUnique(contentSettingsClient)); + return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(contentSettingsClient)); } static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances() @@ -87,7 +85,7 @@ return set; } -WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient> client, std::unique_ptr<WebWorkerContentSettingsClientProxy> contentSettingsClient) +WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextClient> client, PassOwnPtr<WebWorkerContentSettingsClientProxy> contentSettingsClient) : m_workerContextClient(std::move(client)) , m_contentSettingsClient(std::move(contentSettingsClient)) , m_workerInspectorProxy(WorkerInspectorProxy::create()) @@ -329,7 +327,7 @@ DCHECK(m_loadingShadowPage); DCHECK(!m_askedToTerminate); m_loadingShadowPage = false; - m_networkProvider = wrapUnique(m_workerContextClient->createServiceWorkerNetworkProvider(frame->dataSource())); + m_networkProvider = adoptPtr(m_workerContextClient->createServiceWorkerNetworkProvider(frame->dataSource())); m_mainScriptLoader = WorkerScriptLoader::create(); m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextServiceWorker); m_mainScriptLoader->loadAsynchronously( @@ -408,7 +406,7 @@ provideContentSettingsClientToWorker(workerClients, std::move(m_contentSettingsClient)); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGlobalScopeClientImpl::create(*m_workerContextClient)); - provideServiceWorkerContainerClientToWorker(workerClients, wrapUnique(m_workerContextClient->createServiceWorkerProvider())); + provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_workerContextClient->createServiceWorkerProvider())); // We need to set the CSP to both the shadow page's document and the ServiceWorkerGlobalScope. document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecurityPolicy()); @@ -416,7 +414,7 @@ KURL scriptURL = m_mainScriptLoader->url(); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( + OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( scriptURL, m_workerStartData.userAgent, m_mainScriptLoader->script(),
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h index 614f4e19..1997bc8 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h
@@ -38,7 +38,6 @@ #include "public/web/WebEmbeddedWorker.h" #include "public/web/WebEmbeddedWorkerStartData.h" #include "public/web/WebFrameClient.h" -#include <memory> namespace blink { @@ -57,7 +56,7 @@ , private WorkerLoaderProxyProvider { WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); public: - WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, std::unique_ptr<WebWorkerContentSettingsClientProxy>); + WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextClient>, PassOwnPtr<WebWorkerContentSettingsClientProxy>); ~WebEmbeddedWorkerImpl() override; // WebEmbeddedWorker overrides. @@ -96,20 +95,20 @@ WebEmbeddedWorkerStartData m_workerStartData; - std::unique_ptr<WebServiceWorkerContextClient> m_workerContextClient; + OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; // This is kept until startWorkerContext is called, and then passed on // to WorkerContext. - std::unique_ptr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; + OwnPtr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; // We retain ownership of this one which is for use on the // main thread only. - std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; + OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; // Kept around only while main script loading is ongoing. RefPtr<WorkerScriptLoader> m_mainScriptLoader; - std::unique_ptr<WorkerThread> m_workerThread; + OwnPtr<WorkerThread> m_workerThread; RefPtr<WorkerLoaderProxy> m_loaderProxy; Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; Persistent<WorkerInspectorProxy> m_workerInspectorProxy;
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp index bb6f205f..8b2cea6f 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
@@ -16,8 +16,6 @@ #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { namespace { @@ -63,7 +61,7 @@ void SetUp() override { m_mockClient = new MockServiceWorkerContextClient(); - m_worker = wrapUnique(WebEmbeddedWorker::create(m_mockClient, nullptr)); + m_worker = adoptPtr(WebEmbeddedWorker::create(m_mockClient, nullptr)); WebURL scriptURL = URLTestHelpers::toKURL("https://www.example.com/sw.js"); WebURLResponse response; @@ -87,7 +85,7 @@ WebEmbeddedWorkerStartData m_startData; MockServiceWorkerContextClient* m_mockClient; - std::unique_ptr<WebEmbeddedWorker> m_worker; + OwnPtr<WebEmbeddedWorker> m_worker; }; } // namespace
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp index 5b8b065..f4c83cd 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -61,8 +61,6 @@ #include "web/WebPluginContainerImpl.h" #include "web/WebRemoteFrameImpl.h" #include "web/WebViewFrameWidget.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -346,7 +344,7 @@ if (inputEvent.type == WebInputEvent::MouseUp) mouseCaptureLost(); - std::unique_ptr<UserGestureIndicator> gestureIndicator; + OwnPtr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (inputEvent.type) { @@ -358,12 +356,12 @@ break; case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_mouseCaptureGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = wrapUnique(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); + gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); break; default: NOTREACHED();
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h index a2e21f96..d94ae869 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -43,6 +43,7 @@ #include "web/WebViewImpl.h" #include "wtf/Assertions.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" namespace blink { class Frame;
diff --git a/third_party/WebKit/Source/web/WebHelperPluginImpl.h b/third_party/WebKit/Source/web/WebHelperPluginImpl.h index d632b380..89a09a2 100644 --- a/third_party/WebKit/Source/web/WebHelperPluginImpl.h +++ b/third_party/WebKit/Source/web/WebHelperPluginImpl.h
@@ -35,6 +35,7 @@ #include "public/web/WebHelperPlugin.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebImageDecoder.cpp b/third_party/WebKit/Source/web/WebImageDecoder.cpp index d4ffb79..1750509 100644 --- a/third_party/WebKit/Source/web/WebImageDecoder.cpp +++ b/third_party/WebKit/Source/web/WebImageDecoder.cpp
@@ -37,6 +37,8 @@ #include "public/platform/WebData.h" #include "public/platform/WebImage.h" #include "public/platform/WebSize.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index a7dc8e7..37681a9 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp
@@ -45,12 +45,10 @@ #include "public/platform/Platform.h" #include "public/platform/WebThread.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/WTF.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/AtomicString.h" #include "wtf/text/TextEncoding.h" -#include <memory> #include <v8.h> namespace blink { @@ -76,7 +74,7 @@ static ModulesInitializer& modulesInitializer() { - DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, (wrapUnique(new ModulesInitializer))); + DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new ModulesInitializer))); return *initializer; }
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp index 0192b11..0893b67 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -114,9 +114,9 @@ #include "core/editing/spellcheck/SpellChecker.h" #include "core/fetch/ResourceFetcher.h" #include "core/fetch/SubstituteData.h" +#include "core/frame/LocalDOMWindow.h" #include "core/frame/FrameHost.h" #include "core/frame/FrameView.h" -#include "core/frame/LocalDOMWindow.h" #include "core/frame/RemoteFrame.h" #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" @@ -136,6 +136,7 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutPart.h" #include "core/layout/api/LayoutViewItem.h" +#include "core/style/StyleInheritedData.h" #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" @@ -148,7 +149,6 @@ #include "core/page/PrintContext.h" #include "core/paint/PaintLayer.h" #include "core/paint/TransformRecorder.h" -#include "core/style/StyleInheritedData.h" #include "core/timing/DOMWindowPerformance.h" #include "core/timing/Performance.h" #include "modules/app_banner/AppBannerController.h" @@ -235,9 +235,7 @@ #include "web/WebViewImpl.h" #include "wtf/CurrentTime.h" #include "wtf/HashMap.h" -#include "wtf/PtrUtil.h" #include <algorithm> -#include <memory> namespace blink { @@ -498,9 +496,9 @@ class WebSuspendableTaskWrapper: public SuspendableTask { public: - static std::unique_ptr<WebSuspendableTaskWrapper> create(std::unique_ptr<WebSuspendableTask> task) + static PassOwnPtr<WebSuspendableTaskWrapper> create(PassOwnPtr<WebSuspendableTask> task) { - return wrapUnique(new WebSuspendableTaskWrapper(std::move(task))); + return adoptPtr(new WebSuspendableTaskWrapper(std::move(task))); } void run() override @@ -514,12 +512,12 @@ } private: - explicit WebSuspendableTaskWrapper(std::unique_ptr<WebSuspendableTask> task) + explicit WebSuspendableTaskWrapper(PassOwnPtr<WebSuspendableTask> task) : m_task(std::move(task)) { } - std::unique_ptr<WebSuspendableTask> m_task; + OwnPtr<WebSuspendableTask> m_task; }; // WebFrame ------------------------------------------------------------------- @@ -1949,7 +1947,7 @@ { DCHECK(frame()); DCHECK(frame()->document()); - frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(wrapUnique(task))); + frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(adoptPtr(task))); } void WebLocalFrameImpl::didCallAddSearchProvider()
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index 8e98f5a..a05039bd 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -43,8 +43,8 @@ #include "web/WebExport.h" #include "web/WebFrameImplBase.h" #include "wtf/Compiler.h" +#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -371,7 +371,7 @@ WebFrameClient* m_client; WebAutofillClient* m_autofillClient; WebContentSettingsClient* m_contentSettingsClient; - std::unique_ptr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; + OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; // Will be initialized after first call to find() or scopeStringMatches(). Member<TextFinder> m_textFinder;
diff --git a/third_party/WebKit/Source/web/WebNode.cpp b/third_party/WebKit/Source/web/WebNode.cpp index 60933df..d133bbc8 100644 --- a/third_party/WebKit/Source/web/WebNode.cpp +++ b/third_party/WebKit/Source/web/WebNode.cpp
@@ -57,7 +57,6 @@ #include "web/FrameLoaderClientImpl.h" #include "web/WebLocalFrameImpl.h" #include "web/WebPluginContainerImpl.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -196,7 +195,7 @@ void WebNode::simulateClick() { - m_private->getExecutionContext()->postSuspendableTask(wrapUnique(new NodeDispatchSimulatedClickTask(m_private))); + m_private->getExecutionContext()->postSuspendableTask(adoptPtr(new NodeDispatchSimulatedClickTask(m_private))); } WebElementCollection WebNode::getElementsByHTMLTagName(const WebString& tag) const
diff --git a/third_party/WebKit/Source/web/WebNodeTest.cpp b/third_party/WebKit/Source/web/WebNodeTest.cpp index aa2fffd..171dcc82 100644 --- a/third_party/WebKit/Source/web/WebNodeTest.cpp +++ b/third_party/WebKit/Source/web/WebNodeTest.cpp
@@ -10,7 +10,6 @@ #include "public/web/WebElement.h" #include "public/web/WebElementCollection.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { @@ -34,7 +33,7 @@ private: void SetUp() override; - std::unique_ptr<DummyPageHolder> m_pageHolder; + OwnPtr<DummyPageHolder> m_pageHolder; }; void WebNodeTest::SetUp()
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp index 5b8f766..6add730 100644 --- a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp +++ b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
@@ -63,7 +63,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" -#include "wtf/PtrUtil.h" namespace blink { @@ -285,7 +284,7 @@ m_page->settings().setAccessibilityEnabled(m_webView->page()->settings().accessibilityEnabled()); m_page->settings().setScrollAnimatorEnabled(m_webView->page()->settings().scrollAnimatorEnabled()); - provideContextFeaturesTo(*m_page, wrapUnique(new PagePopupFeaturesClient())); + provideContextFeaturesTo(*m_page, adoptPtr(new PagePopupFeaturesClient())); DEFINE_STATIC_LOCAL(FrameLoaderClient, emptyFrameLoaderClient, (EmptyFrameLoaderClient::create())); LocalFrame* frame = LocalFrame::create(&emptyFrameLoaderClient, &m_page->frameHost(), 0); frame->setPagePopupOwner(m_popupClient->ownerElement());
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.h b/third_party/WebKit/Source/web/WebPagePopupImpl.h index 8f953e4..5f9c599 100644 --- a/third_party/WebKit/Source/web/WebPagePopupImpl.h +++ b/third_party/WebKit/Source/web/WebPagePopupImpl.h
@@ -34,6 +34,7 @@ #include "core/page/PagePopup.h" #include "public/web/WebPagePopup.h" #include "web/PageWidgetDelegate.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebPepperSocket.cpp b/third_party/WebKit/Source/web/WebPepperSocket.cpp index 65ce079..fccbba0 100644 --- a/third_party/WebKit/Source/web/WebPepperSocket.cpp +++ b/third_party/WebKit/Source/web/WebPepperSocket.cpp
@@ -31,8 +31,6 @@ #include "public/web/WebPepperSocket.h" #include "web/WebPepperSocketImpl.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -41,10 +39,10 @@ if (!client) return 0; - std::unique_ptr<WebPepperSocketImpl> websocket = wrapUnique(new WebPepperSocketImpl(document, client)); + OwnPtr<WebPepperSocketImpl> websocket = adoptPtr(new WebPepperSocketImpl(document, client)); if (websocket && websocket->isNull()) return 0; - return websocket.release(); + return websocket.leakPtr(); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h index fc714ba5..0c35cbe 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h +++ b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h
@@ -8,9 +8,9 @@ #include "modules/websockets/WebSocketChannelClient.h" #include "platform/heap/Handle.h" #include "web/WebPepperSocketImpl.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" -#include <memory> #include <stdint.h> namespace blink { @@ -36,7 +36,7 @@ { m_impl->didReceiveTextMessage(payload); } - void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override + void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) override { m_impl->didReceiveBinaryMessage(std::move(payload)); }
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp index d225683..2a65d50 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp +++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp
@@ -42,7 +42,6 @@ #include "web/WebPepperSocketChannelClientProxy.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" -#include <memory> namespace blink { @@ -165,7 +164,7 @@ m_client->didReceiveMessage(WebString(payload)); } -void WebPepperSocketImpl::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) +void WebPepperSocketImpl::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) { switch (m_binaryType) { case BinaryTypeBlob:
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.h b/third_party/WebKit/Source/web/WebPepperSocketImpl.h index cc5dea86..62c67261 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketImpl.h +++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.h
@@ -37,8 +37,8 @@ #include "public/platform/WebString.h" #include "public/web/WebPepperSocket.h" #include "public/web/WebPepperSocketClient.h" +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -69,7 +69,7 @@ // WebSocketChannelClient methods proxied by WebPepperSocketChannelClientProxy. void didConnect(const String& subprotocol, const String& extensions); void didReceiveTextMessage(const String& payload); - void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload); + void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload); void didError(); void didConsumeBufferedAmount(unsigned long consumed); void didStartClosingHandshake();
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.h b/third_party/WebKit/Source/web/WebPluginContainerImpl.h index 213c45ba..ff84d43 100644 --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
@@ -38,6 +38,7 @@ #include "public/web/WebPluginContainer.h" #include "web/WebExport.h" #include "wtf/Compiler.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h index d50a7d3..c0bbe2a 100644 --- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h +++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -14,6 +14,7 @@ #include "web/WebExport.h" #include "web/WebFrameImplBase.h" #include "wtf/Compiler.h" +#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp index 51b411c..5060946 100644 --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -72,8 +72,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -172,7 +170,7 @@ { DCHECK(!m_loadingDocument); DCHECK(!m_mainScriptLoader); - m_networkProvider = wrapUnique(m_client->createServiceWorkerNetworkProvider(frame->dataSource())); + m_networkProvider = adoptPtr(m_client->createServiceWorkerNetworkProvider(frame->dataSource())); m_mainScriptLoader = WorkerScriptLoader::create(); m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWorker); m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document(); @@ -219,7 +217,7 @@ // WorkerReportingProxy -------------------------------------------------------- -void WebSharedWorkerImpl::reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) +void WebSharedWorkerImpl::reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) { // Not suppported in SharedWorker. } @@ -333,11 +331,11 @@ WorkerClients* workerClients = WorkerClients::create(); provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create()); WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin()); - provideContentSettingsClientToWorker(workerClients, wrapUnique(m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin))); + provideContentSettingsClientToWorker(workerClients, adoptPtr(m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin))); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); ContentSecurityPolicy* contentSecurityPolicy = m_mainScriptLoader->releaseContentSecurityPolicy(); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( + OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( m_url, m_loadingDocument->userAgent(), m_mainScriptLoader->script(),
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h index 3c675336..9a00362 100644 --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
@@ -42,8 +42,8 @@ #include "public/web/WebDevToolsAgentClient.h" #include "public/web/WebFrameClient.h" #include "public/web/WebSharedWorkerClient.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" -#include <memory> namespace blink { @@ -75,7 +75,7 @@ explicit WebSharedWorkerImpl(WebSharedWorkerClient*); // WorkerReportingProxy methods: - void reportException(const WTF::String&, std::unique_ptr<SourceLocation>) override; + void reportException(const WTF::String&, PassOwnPtr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const WTF::String&) override; void postWorkerConsoleAgentEnabled() override { } @@ -141,11 +141,11 @@ bool m_askedToTerminate; // This one is bound to and used only on the main thread. - std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; + OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; Persistent<WorkerInspectorProxy> m_workerInspectorProxy; - std::unique_ptr<WorkerThread> m_workerThread; + OwnPtr<WorkerThread> m_workerThread; WebSharedWorkerClient* m_client;
diff --git a/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp b/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp index 228b8bae..c0a333f 100644 --- a/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp +++ b/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp
@@ -35,6 +35,7 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebURL.h" #include "web/WebViewImpl.h" +#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index af351b3..3df57d6 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -180,10 +180,8 @@ #include "web/WebRemoteFrameImpl.h" #include "web/WebSettingsImpl.h" #include "wtf/CurrentTime.h" -#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/TemporaryChange.h" -#include <memory> #if USE(DEFAULT_RENDER_THEME) #include "core/layout/LayoutThemeDefault.h" @@ -231,9 +229,9 @@ // Used to defer all page activity in cases where the embedder wishes to run // a nested event loop. Using a stack enables nesting of message loop invocations. -static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>& pageLoadDeferrerStack() +static Vector<OwnPtr<ScopedPageLoadDeferrer>>& pageLoadDeferrerStack() { - DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>, deferrerStack, ()); + DEFINE_STATIC_LOCAL(Vector<OwnPtr<ScopedPageLoadDeferrer>>, deferrerStack, ()); return deferrerStack; } @@ -364,7 +362,7 @@ void WebView::willEnterModalLoop() { - pageLoadDeferrerStack().append(wrapUnique(new ScopedPageLoadDeferrer())); + pageLoadDeferrerStack().append(adoptPtr(new ScopedPageLoadDeferrer())); } void WebView::didExitModalLoop() @@ -450,7 +448,7 @@ , m_displayMode(WebDisplayModeBrowser) , m_elasticOverscroll(FloatSize()) , m_mutator(nullptr) - , m_scheduler(wrapUnique(Platform::current()->currentThread()->scheduler()->createWebViewScheduler(this).release())) + , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->createWebViewScheduler(this).release())) , m_lastFrameTimeMonotonic(0) { Page::PageClients pageClients; @@ -740,7 +738,7 @@ m_flingModifier = event.modifiers; m_flingSourceDevice = event.sourceDevice; DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized); - std::unique_ptr<WebGestureCurve> flingCurve = wrapUnique(Platform::current()->createFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize())); + OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->createFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize())); DCHECK(flingCurve); m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(std::move(flingCurve), this); scheduleAnimation(); @@ -961,7 +959,7 @@ m_positionOnFlingStart = parameters.point; m_globalPositionOnFlingStart = parameters.globalPoint; m_flingModifier = parameters.modifiers; - std::unique_ptr<WebGestureCurve> curve = wrapUnique(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll)); + OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll)); DCHECK(curve); m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(std::move(curve), this, parameters.startTime); DCHECK_NE(parameters.sourceDevice, WebGestureDeviceUninitialized); @@ -2192,7 +2190,7 @@ if (inputEvent.type == WebInputEvent::MouseUp) mouseCaptureLost(); - std::unique_ptr<UserGestureIndicator> gestureIndicator; + OwnPtr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (inputEvent.type) { @@ -2204,12 +2202,12 @@ break; case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_mouseCaptureGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = wrapUnique(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); + gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); break; default: NOTREACHED(); @@ -2839,7 +2837,7 @@ WebSettingsImpl* WebViewImpl::settingsImpl() { if (!m_webSettings) - m_webSettings = wrapUnique(new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); + m_webSettings = adoptPtr(new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); DCHECK(m_webSettings); return m_webSettings.get(); } @@ -4476,17 +4474,17 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) { - std::unique_ptr<UserGestureIndicator> gestureIndicator; + OwnPtr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (event.type) { case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_pointerLockGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = wrapUnique(new UserGestureIndicator(m_pointerLockGestureToken.release())); + gestureIndicator = adoptPtr(new UserGestureIndicator(m_pointerLockGestureToken.release())); break; case WebInputEvent::MouseMove: eventType = EventTypeNames::mousemove;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index d327836b..716e264 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -63,9 +63,9 @@ #include "web/WebExport.h" #include "wtf/Compiler.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include <memory> namespace blink { @@ -642,7 +642,7 @@ // An object that can be used to manipulate m_page->settings() without linking // against WebCore. This is lazily allocated the first time GetWebSettings() // is called. - std::unique_ptr<WebSettingsImpl> m_webSettings; + OwnPtr<WebSettingsImpl> m_webSettings; // A copy of the web drop data object we received from the browser. Persistent<DataObject> m_currentDragData; @@ -702,7 +702,7 @@ RefPtr<WebPagePopupImpl> m_pagePopup; Persistent<DevToolsEmulator> m_devToolsEmulator; - std::unique_ptr<PageOverlay> m_pageColorOverlay; + OwnPtr<PageOverlay> m_pageColorOverlay; // Whether the webview is rendering transparently. bool m_isTransparent; @@ -724,13 +724,13 @@ static const WebInputEvent* m_currentInputEvent; MediaKeysClientImpl m_mediaKeysClientImpl; - std::unique_ptr<WebActiveGestureAnimation> m_gestureAnimation; + OwnPtr<WebActiveGestureAnimation> m_gestureAnimation; WebPoint m_positionOnFlingStart; WebPoint m_globalPositionOnFlingStart; int m_flingModifier; WebGestureDevice m_flingSourceDevice; - Vector<std::unique_ptr<LinkHighlightImpl>> m_linkHighlights; - std::unique_ptr<CompositorAnimationTimeline> m_linkHighlightsTimeline; + Vector<OwnPtr<LinkHighlightImpl>> m_linkHighlights; + OwnPtr<CompositorAnimationTimeline> m_linkHighlightsTimeline; Persistent<FullscreenController> m_fullscreenController; WebColor m_baseBackgroundColor; @@ -754,7 +754,7 @@ WebPageImportanceSignals m_pageImportanceSignals; - const std::unique_ptr<WebViewScheduler> m_scheduler; + const OwnPtr<WebViewScheduler> m_scheduler; // Manages the layer tree created for this page in Slimming Paint v2. PaintArtifactCompositor m_paintArtifactCompositor;
diff --git a/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp b/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp index 889f979..e396aa7 100644 --- a/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp +++ b/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp
@@ -33,11 +33,11 @@ #include "core/workers/WorkerGlobalScope.h" #include "public/platform/WebString.h" #include "public/web/WebWorkerContentSettingsClientProxy.h" -#include <memory> +#include "wtf/PassOwnPtr.h" namespace blink { -WorkerContentSettingsClient* WorkerContentSettingsClient::create(std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) +WorkerContentSettingsClient* WorkerContentSettingsClient::create(PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) { return new WorkerContentSettingsClient(std::move(proxy)); } @@ -72,12 +72,12 @@ return static_cast<WorkerContentSettingsClient*>(Supplement<WorkerClients>::from(*clients, supplementName())); } -WorkerContentSettingsClient::WorkerContentSettingsClient(std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) +WorkerContentSettingsClient::WorkerContentSettingsClient(PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) : m_proxy(std::move(proxy)) { } -void provideContentSettingsClientToWorker(WorkerClients* clients, std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) +void provideContentSettingsClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) { DCHECK(clients); WorkerContentSettingsClient::provideTo(*clients, WorkerContentSettingsClient::supplementName(), WorkerContentSettingsClient::create(std::move(proxy)));
diff --git a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h index ed02e11..d2b92723 100644 --- a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h +++ b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h
@@ -33,7 +33,6 @@ #include "core/workers/WorkerClients.h" #include "wtf/Forward.h" -#include <memory> namespace blink { @@ -44,7 +43,7 @@ class WorkerContentSettingsClient final : public GarbageCollectedFinalized<WorkerContentSettingsClient>, public Supplement<WorkerClients> { USING_GARBAGE_COLLECTED_MIXIN(WorkerContentSettingsClient); public: - static WorkerContentSettingsClient* create(std::unique_ptr<WebWorkerContentSettingsClientProxy>); + static WorkerContentSettingsClient* create(PassOwnPtr<WebWorkerContentSettingsClientProxy>); virtual ~WorkerContentSettingsClient(); bool requestFileSystemAccessSync(); @@ -56,12 +55,12 @@ DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<WorkerClients>::trace(visitor); } private: - explicit WorkerContentSettingsClient(std::unique_ptr<WebWorkerContentSettingsClientProxy>); + explicit WorkerContentSettingsClient(PassOwnPtr<WebWorkerContentSettingsClientProxy>); - std::unique_ptr<WebWorkerContentSettingsClientProxy> m_proxy; + OwnPtr<WebWorkerContentSettingsClientProxy> m_proxy; }; -void provideContentSettingsClientToWorker(WorkerClients*, std::unique_ptr<WebWorkerContentSettingsClientProxy>); +void provideContentSettingsClientToWorker(WorkerClients*, PassOwnPtr<WebWorkerContentSettingsClientProxy>); } // namespace blink
diff --git a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp index a999ac8..5f313ac 100644 --- a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp +++ b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
@@ -11,7 +11,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" #include "wtf/text/Base64.h" #include <v8.h> @@ -70,7 +69,7 @@ ActivityLoggerTest() { m_activityLogger = new TestActivityLogger(); - V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), wrapUnique(m_activityLogger)); + V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), adoptPtr(m_activityLogger)); m_webViewHelper.initialize(true); m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->frame()->script(); FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(), "about:blank");
diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp index eb6d633..c405ad1 100644 --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
@@ -21,9 +21,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" #include <gtest/gtest.h> -#include <memory> namespace blink { @@ -279,7 +277,7 @@ EXPECT_NE(0UL, elementId); TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); - std::unique_ptr<CompositorMutation> mutation = wrapUnique(new CompositorMutation); + OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix)); mutation->setOpacity(0.5); @@ -293,7 +291,7 @@ } // Verify that updating one property does not impact others - mutation = wrapUnique(new CompositorMutation); + mutation = adoptPtr(new CompositorMutation); mutation->setOpacity(0.8); proxiedElement->updateFromCompositorMutation(*mutation);
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp index 12bc6d2..438ebbf 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -48,7 +48,6 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" @@ -307,7 +306,7 @@ void TestWebViewClient::initializeLayerTreeView() { - m_layerTreeView = wrapUnique(new WebLayerTreeViewImplForTesting); + m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting); } } // namespace FrameTestHelpers
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h index 067e7fa..eaadcac 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h
@@ -42,9 +42,9 @@ #include "public/web/WebRemoteFrameClient.h" #include "public/web/WebViewClient.h" #include "web/WebViewImpl.h" +#include "wtf/PassOwnPtr.h" #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <memory> #include <string> namespace blink { @@ -134,7 +134,7 @@ WebWidgetClient* widgetClient() { return this; } private: - std::unique_ptr<WebLayerTreeView> m_layerTreeView; + OwnPtr<WebLayerTreeView> m_layerTreeView; bool m_animationScheduled; };
diff --git a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp index bf1877e0..d5275e0c 100644 --- a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp +++ b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp
@@ -37,7 +37,6 @@ #include "public/web/WebInputEvent.h" #include "testing/gtest/include/gtest/gtest.h" #include "web/WebInputEventConversion.h" -#include <memory> namespace blink { @@ -54,7 +53,7 @@ PlatformKeyboardEventBuilder evt(webKeyboardEvent); evt.setKeyType(keyType); KeyboardEvent* keyboardEvent = KeyboardEvent::create(evt, 0); - std::unique_ptr<Settings> settings = Settings::create(); + OwnPtr<Settings> settings = Settings::create(); EditingBehavior behavior(settings->editingBehaviorType()); return behavior.interpretKeyEvent(*keyboardEvent); }
diff --git a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp index ca5ca224..67f8091 100644 --- a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp +++ b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
@@ -44,10 +44,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include <functional> #include <list> -#include <memory> using namespace blink; using blink::URLTestHelpers::toKURL; @@ -67,7 +66,7 @@ void setExtraDataForNextPrerender(WebPrerender::ExtraData* extraData) { DCHECK(!m_extraData); - m_extraData = wrapUnique(extraData); + m_extraData = adoptPtr(extraData); } WebPrerender releaseWebPrerender() @@ -92,13 +91,13 @@ // From WebPrerendererClient: void willAddPrerender(WebPrerender* prerender) override { - prerender->setExtraData(m_extraData.release()); + prerender->setExtraData(m_extraData.leakPtr()); DCHECK(!prerender->isNull()); m_webPrerenders.push_back(*prerender); } - std::unique_ptr<WebPrerender::ExtraData> m_extraData; + OwnPtr<WebPrerender::ExtraData> m_extraData; std::list<WebPrerender> m_webPrerenders; };
diff --git a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp index 769d349..80531c59 100644 --- a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp +++ b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
@@ -36,8 +36,8 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" namespace blink { @@ -77,8 +77,8 @@ { char sharedBuffer[bufferSize]; - std::unique_ptr<WebThread> thread1 = wrapUnique(Platform::current()->createThread("thread1")); - std::unique_ptr<WebThread> thread2 = wrapUnique(Platform::current()->createThread("thread2")); + OwnPtr<WebThread> thread1 = adoptPtr(Platform::current()->createThread("thread1")); + OwnPtr<WebThread> thread2 = adoptPtr(Platform::current()->createThread("thread2")); thread1->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer)))); thread2->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer))));
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp index 9ee5ae5..bfa8a86f 100644 --- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp +++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -22,6 +22,7 @@ #include "web/FindInPageCoordinates.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" +#include "wtf/OwnPtr.h" using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index 7bcfe35..cc7b83617 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -128,10 +128,8 @@ #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" #include "wtf/Forward.h" -#include "wtf/PtrUtil.h" #include "wtf/dtoa/utils.h" #include <map> -#include <memory> #include <stdarg.h> #include <v8.h> @@ -256,7 +254,7 @@ webViewHelper->resize(WebSize(640, 480)); } - std::unique_ptr<DragImage> nodeImageTestSetup(FrameTestHelpers::WebViewHelper* webViewHelper, const std::string& testcase) + PassOwnPtr<DragImage> nodeImageTestSetup(FrameTestHelpers::WebViewHelper* webViewHelper, const std::string& testcase) { registerMockedHttpURLLoad("nodeimage.html"); webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); @@ -2449,7 +2447,7 @@ int viewWidth = 500; int viewHeight = 500; - std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FakeCompositingWebViewClient()); + OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FakeCompositingWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView); @@ -3424,18 +3422,18 @@ releaseNotifications.clear(); } - Vector<std::unique_ptr<Notification>> createNotifications; - Vector<std::unique_ptr<Notification>> releaseNotifications; + Vector<OwnPtr<Notification>> createNotifications; + Vector<OwnPtr<Notification>> releaseNotifications; private: void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> context, int extensionGroup, int worldId) override { - createNotifications.append(wrapUnique(new Notification(frame, context, worldId))); + createNotifications.append(adoptPtr(new Notification(frame, context, worldId))); } void willReleaseScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> context, int worldId) override { - releaseNotifications.append(wrapUnique(new Notification(frame, context, worldId))); + releaseNotifications.append(adoptPtr(new Notification(frame, context, worldId))); } }; @@ -4543,7 +4541,7 @@ void registerSelection(const WebSelection& selection) override { - m_selection = wrapUnique(new WebSelection(selection)); + m_selection = adoptPtr(new WebSelection(selection)); } void clearSelection() override @@ -4565,7 +4563,7 @@ private: bool m_selectionCleared; - std::unique_ptr<WebSelection> m_selection; + OwnPtr<WebSelection> m_selection; }; class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::TestWebViewClient { @@ -6254,7 +6252,7 @@ TEST_F(WebFrameTest, overflowHiddenRewrite) { registerMockedHttpURLLoad("non-scrollable.html"); - std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FakeCompositingWebViewClient()); + OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FakeCompositingWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView); @@ -6970,7 +6968,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSSTransformDescendant) { FrameTestHelpers::WebViewHelper webViewHelper(this); - std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform-descendant")); + OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform-descendant")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6979,7 +6977,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSSTransform) { FrameTestHelpers::WebViewHelper webViewHelper(this); - std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); + OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6988,7 +6986,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSS3DTransform) { FrameTestHelpers::WebViewHelper webViewHelper(this); - std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform")); + OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6997,7 +6995,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestInlineBlock) { FrameTestHelpers::WebViewHelper webViewHelper(this); - std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-inlineblock")); + OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-inlineblock")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -7006,7 +7004,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestFloatLeft) { FrameTestHelpers::WebViewHelper webViewHelper(this); - std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-float-left-overflow-hidden")); + OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-float-left-overflow-hidden")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get());
diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp index f6084a73..b69327a 100644 --- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
@@ -66,8 +66,6 @@ #include "web/WebViewImpl.h" #include "web/tests/FakeWebPlugin.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" -#include <memory> using blink::testing::runPendingTasks; @@ -604,7 +602,7 @@ public: CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params) : FakeWebPlugin(frame, params) - , m_layer(wrapUnique(Platform::current()->compositorSupport()->createLayer())) + , m_layer(adoptPtr(Platform::current()->compositorSupport()->createLayer())) { } @@ -627,7 +625,7 @@ } private: - std::unique_ptr<WebLayer> m_layer; + OwnPtr<WebLayer> m_layer; }; class ScopedSPv2 { @@ -658,7 +656,7 @@ Element* element = static_cast<Element*>(container->element()); const auto* plugin = static_cast<const CompositedPlugin*>(container->plugin()); - std::unique_ptr<PaintController> paintController = PaintController::create(); + OwnPtr<PaintController> paintController = PaintController::create(); GraphicsContext graphicsContext(*paintController); container->paint(graphicsContext, CullRect(IntRect(10, 10, 400, 300))); paintController->commitNewDisplayItems();
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index 237a8c6..b99c5ba0 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -96,8 +96,6 @@ #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PtrUtil.h" -#include <memory> #if OS(MACOSX) #include "public/web/mac/WebSubstringUtil.h" @@ -1866,7 +1864,7 @@ TEST_F(WebViewTest, ShowPressOnTransformedLink) { - std::unique_ptr<FrameTestHelpers::TestWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FrameTestHelpers::TestWebViewClient()); + OwnPtr<FrameTestHelpers::TestWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FrameTestHelpers::TestWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; WebViewImpl* webViewImpl = webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView);
diff --git a/third_party/WebKit/Source/wtf/Assertions.cpp b/third_party/WebKit/Source/wtf/Assertions.cpp index ed523882..ec94840 100644 --- a/third_party/WebKit/Source/wtf/Assertions.cpp +++ b/third_party/WebKit/Source/wtf/Assertions.cpp
@@ -34,10 +34,10 @@ #include "wtf/Assertions.h" #include "wtf/Compiler.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSpecific.h" #include "wtf/Threading.h" -#include <memory> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -115,7 +115,7 @@ return; } - std::unique_ptr<char[]> formatWithNewline = wrapArrayUnique(new char[formatLength + 2]); + OwnPtr<char[]> formatWithNewline = adoptArrayPtr(new char[formatLength + 2]); memcpy(formatWithNewline.get(), format, formatLength); formatWithNewline[formatLength] = '\n'; formatWithNewline[formatLength + 1] = 0;
diff --git a/third_party/WebKit/Source/wtf/DataLog.cpp b/third_party/WebKit/Source/wtf/DataLog.cpp index 61076f4..5d8d981 100644 --- a/third_party/WebKit/Source/wtf/DataLog.cpp +++ b/third_party/WebKit/Source/wtf/DataLog.cpp
@@ -59,7 +59,7 @@ snprintf(actualFilename, sizeof(actualFilename), "%s.%d.txt", filename, getpid()); if (filename) { - file = FilePrintStream::open(actualFilename, "w").release(); + file = FilePrintStream::open(actualFilename, "w").leakPtr(); if (!file) fprintf(stderr, "Warning: Could not open log file %s for writing.\n", actualFilename); }
diff --git a/third_party/WebKit/Source/wtf/DequeTest.cpp b/third_party/WebKit/Source/wtf/DequeTest.cpp index 8c6e360b..114afbb9 100644 --- a/third_party/WebKit/Source/wtf/DequeTest.cpp +++ b/third_party/WebKit/Source/wtf/DequeTest.cpp
@@ -27,7 +27,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include <memory> namespace WTF { @@ -177,11 +178,11 @@ { int destructNumber = 0; OwnPtrDeque deque; - deque.append(wrapUnique(new DestructCounter(0, &destructNumber))); - deque.append(wrapUnique(new DestructCounter(1, &destructNumber))); + deque.append(adoptPtr(new DestructCounter(0, &destructNumber))); + deque.append(adoptPtr(new DestructCounter(1, &destructNumber))); EXPECT_EQ(2u, deque.size()); - std::unique_ptr<DestructCounter>& counter0 = deque.first(); + OwnPtr<DestructCounter>& counter0 = deque.first(); EXPECT_EQ(0, counter0->get()); int counter1 = deque.last()->get(); EXPECT_EQ(1, counter1); @@ -189,7 +190,7 @@ size_t index = 0; for (auto iter = deque.begin(); iter != deque.end(); ++iter) { - std::unique_ptr<DestructCounter>& refCounter = *iter; + OwnPtr<DestructCounter>& refCounter = *iter; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); EXPECT_EQ(index, static_cast<size_t>((*refCounter).get())); index++; @@ -198,7 +199,7 @@ auto it = deque.begin(); for (index = 0; index < deque.size(); ++index) { - std::unique_ptr<DestructCounter>& refCounter = *it; + OwnPtr<DestructCounter>& refCounter = *it; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); index++; ++it; @@ -211,7 +212,7 @@ EXPECT_EQ(1u, deque.size()); EXPECT_EQ(1, destructNumber); - std::unique_ptr<DestructCounter> ownCounter1 = std::move(deque.first()); + OwnPtr<DestructCounter> ownCounter1 = std::move(deque.first()); deque.removeFirst(); EXPECT_EQ(counter1, ownCounter1->get()); EXPECT_EQ(0u, deque.size()); @@ -223,9 +224,9 @@ size_t count = 1025; destructNumber = 0; for (size_t i = 0; i < count; ++i) - deque.prepend(wrapUnique(new DestructCounter(i, &destructNumber))); + deque.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); - // Deque relocation must not destruct std::unique_ptr element. + // Deque relocation must not destruct OwnPtr element. EXPECT_EQ(0, destructNumber); EXPECT_EQ(count, deque.size()); @@ -241,8 +242,8 @@ TEST(DequeTest, OwnPtr) { - ownPtrTest<Deque<std::unique_ptr<DestructCounter>>>(); - ownPtrTest<Deque<std::unique_ptr<DestructCounter>, 2>>(); + ownPtrTest<Deque<OwnPtr<DestructCounter>>>(); + ownPtrTest<Deque<OwnPtr<DestructCounter>, 2>>(); } class MoveOnly {
diff --git a/third_party/WebKit/Source/wtf/FilePrintStream.cpp b/third_party/WebKit/Source/wtf/FilePrintStream.cpp index c967e8a..d248c8c 100644 --- a/third_party/WebKit/Source/wtf/FilePrintStream.cpp +++ b/third_party/WebKit/Source/wtf/FilePrintStream.cpp
@@ -25,9 +25,6 @@ #include "wtf/FilePrintStream.h" -#include "wtf/PtrUtil.h" -#include <memory> - namespace WTF { FilePrintStream::FilePrintStream(FILE* file, AdoptionMode adoptionMode) @@ -43,13 +40,13 @@ fclose(m_file); } -std::unique_ptr<FilePrintStream> FilePrintStream::open(const char* filename, const char* mode) +PassOwnPtr<FilePrintStream> FilePrintStream::open(const char* filename, const char* mode) { FILE* file = fopen(filename, mode); if (!file) - return std::unique_ptr<FilePrintStream>(); + return PassOwnPtr<FilePrintStream>(); - return wrapUnique(new FilePrintStream(file)); + return adoptPtr(new FilePrintStream(file)); } void FilePrintStream::vprintf(const char* format, va_list argList)
diff --git a/third_party/WebKit/Source/wtf/FilePrintStream.h b/third_party/WebKit/Source/wtf/FilePrintStream.h index 8756472..6f4eccdf6 100644 --- a/third_party/WebKit/Source/wtf/FilePrintStream.h +++ b/third_party/WebKit/Source/wtf/FilePrintStream.h
@@ -26,8 +26,8 @@ #ifndef FilePrintStream_h #define FilePrintStream_h +#include "wtf/PassOwnPtr.h" #include "wtf/PrintStream.h" -#include <memory> #include <stdio.h> namespace WTF { @@ -42,7 +42,7 @@ FilePrintStream(FILE*, AdoptionMode = Adopt); ~FilePrintStream() override; - static std::unique_ptr<FilePrintStream> open(const char* filename, const char* mode); + static PassOwnPtr<FilePrintStream> open(const char* filename, const char* mode); FILE* file() { return m_file; }
diff --git a/third_party/WebKit/Source/wtf/Forward.h b/third_party/WebKit/Source/wtf/Forward.h index 521fffe8..03f1333 100644 --- a/third_party/WebKit/Source/wtf/Forward.h +++ b/third_party/WebKit/Source/wtf/Forward.h
@@ -26,6 +26,15 @@ namespace WTF { +template <typename T> class OwnPtr; +#if COMPILER(MSVC) +#ifndef PassOwnPtr +#define PassOwnPtr OwnPtr +#endif +#else +template <typename T> +using PassOwnPtr = OwnPtr<T>; +#endif template <typename T> class PassRefPtr; template <typename T> class RefPtr; template <size_t size> class SizeSpecificPartitionAllocator; @@ -54,6 +63,8 @@ } // namespace WTF +using WTF::OwnPtr; +using WTF::PassOwnPtr; using WTF::PassRefPtr; using WTF::RefPtr; using WTF::Vector;
diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h index dd3b7a2..694963a 100644 --- a/third_party/WebKit/Source/wtf/Functional.h +++ b/third_party/WebKit/Source/wtf/Functional.h
@@ -29,6 +29,7 @@ #include "base/tuple.h" #include "wtf/Allocator.h" #include "wtf/Assertions.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" @@ -167,6 +168,12 @@ } template <typename... IncomingParameters> + R operator()(const PassOwnPtr<C>& c, IncomingParameters&&... parameters) + { + return (c.get()->*m_function)(std::forward<IncomingParameters>(parameters)...); + } + + template <typename... IncomingParameters> R operator()(const std::unique_ptr<C>& c, IncomingParameters&&... parameters) { return (c.get()->*m_function)(std::forward<IncomingParameters>(parameters)...);
diff --git a/third_party/WebKit/Source/wtf/HashFunctions.h b/third_party/WebKit/Source/wtf/HashFunctions.h index 569282b..31fc76a 100644 --- a/third_party/WebKit/Source/wtf/HashFunctions.h +++ b/third_party/WebKit/Source/wtf/HashFunctions.h
@@ -21,6 +21,7 @@ #ifndef WTF_HashFunctions_h #define WTF_HashFunctions_h +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" #include <memory> @@ -154,6 +155,18 @@ }; template <typename T> +struct OwnPtrHash : PtrHash<T> { + using PtrHash<T>::hash; + static unsigned hash(const OwnPtr<T>& key) { return hash(key.get()); } + + static bool equal(const OwnPtr<T>& a, const OwnPtr<T>& b) + { + return a.get() == b.get(); + } + static bool equal(const OwnPtr<T>& a, T* b) { return a == b; } +}; + +template <typename T> struct UniquePtrHash : PtrHash<T> { using PtrHash<T>::hash; static unsigned hash(const std::unique_ptr<T>& key) { return hash(key.get()); } @@ -202,6 +215,10 @@ using Hash = RefPtrHash<T>; }; template <typename T> +struct DefaultHash<OwnPtr<T>> { + using Hash = OwnPtrHash<T>; +}; +template <typename T> struct DefaultHash<std::unique_ptr<T>> { using Hash = UniquePtrHash<T>; };
diff --git a/third_party/WebKit/Source/wtf/HashMapTest.cpp b/third_party/WebKit/Source/wtf/HashMapTest.cpp index 17583d95..f8b97ed0 100644 --- a/third_party/WebKit/Source/wtf/HashMapTest.cpp +++ b/third_party/WebKit/Source/wtf/HashMapTest.cpp
@@ -26,8 +26,9 @@ #include "wtf/HashMap.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" #include <memory> @@ -103,14 +104,14 @@ int* m_destructNumber; }; -using OwnPtrHashMap = HashMap<int, std::unique_ptr<DestructCounter>>; +using OwnPtrHashMap = HashMap<int, OwnPtr<DestructCounter>>; TEST(HashMapTest, OwnPtrAsValue) { int destructNumber = 0; OwnPtrHashMap map; - map.add(1, wrapUnique(new DestructCounter(1, &destructNumber))); - map.add(2, wrapUnique(new DestructCounter(2, &destructNumber))); + map.add(1, adoptPtr(new DestructCounter(1, &destructNumber))); + map.add(2, adoptPtr(new DestructCounter(2, &destructNumber))); DestructCounter* counter1 = map.get(1); EXPECT_EQ(1, counter1->get()); @@ -119,12 +120,12 @@ EXPECT_EQ(0, destructNumber); for (OwnPtrHashMap::iterator iter = map.begin(); iter != map.end(); ++iter) { - std::unique_ptr<DestructCounter>& ownCounter = iter->value; + OwnPtr<DestructCounter>& ownCounter = iter->value; EXPECT_EQ(iter->key, ownCounter->get()); } ASSERT_EQ(0, destructNumber); - std::unique_ptr<DestructCounter> ownCounter1 = map.take(1); + OwnPtr<DestructCounter> ownCounter1 = map.take(1); EXPECT_EQ(ownCounter1.get(), counter1); EXPECT_FALSE(map.contains(1)); EXPECT_EQ(0, destructNumber); @@ -242,7 +243,7 @@ private: int m_v; }; -using IntSimpleMap = HashMap<int, std::unique_ptr<SimpleClass>>; +using IntSimpleMap = HashMap<int, OwnPtr<SimpleClass>>; TEST(HashMapTest, AddResult) { @@ -253,10 +254,10 @@ EXPECT_EQ(0, result.storedValue->value.get()); SimpleClass* simple1 = new SimpleClass(1); - result.storedValue->value = wrapUnique(simple1); + result.storedValue->value = adoptPtr(simple1); EXPECT_EQ(simple1, map.get(1)); - IntSimpleMap::AddResult result2 = map.add(1, wrapUnique(new SimpleClass(2))); + IntSimpleMap::AddResult result2 = map.add(1, adoptPtr(new SimpleClass(2))); EXPECT_FALSE(result2.isNewEntry); EXPECT_EQ(1, result.storedValue->key); EXPECT_EQ(1, result.storedValue->value->v());
diff --git a/third_party/WebKit/Source/wtf/HashSetTest.cpp b/third_party/WebKit/Source/wtf/HashSetTest.cpp index 2313b7c..d9497665 100644 --- a/third_party/WebKit/Source/wtf/HashSetTest.cpp +++ b/third_party/WebKit/Source/wtf/HashSetTest.cpp
@@ -26,9 +26,9 @@ #include "wtf/HashSet.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" -#include <memory> namespace WTF { @@ -90,14 +90,14 @@ { bool deleted1 = false, deleted2 = false; - typedef HashSet<std::unique_ptr<Dummy>> OwnPtrSet; + typedef HashSet<OwnPtr<Dummy>> OwnPtrSet; OwnPtrSet set; Dummy* ptr1 = new Dummy(deleted1); { // AddResult in a separate scope to avoid assertion hit, // since we modify the container further. - HashSet<std::unique_ptr<Dummy>>::AddResult res1 = set.add(wrapUnique(ptr1)); + HashSet<OwnPtr<Dummy>>::AddResult res1 = set.add(adoptPtr(ptr1)); EXPECT_EQ(ptr1, res1.storedValue->get()); } @@ -105,11 +105,11 @@ EXPECT_EQ(1UL, set.size()); OwnPtrSet::iterator it1 = set.find(ptr1); EXPECT_NE(set.end(), it1); - EXPECT_EQ(ptr1, (*it1).get()); + EXPECT_EQ(ptr1, (*it1)); Dummy* ptr2 = new Dummy(deleted2); { - HashSet<std::unique_ptr<Dummy>>::AddResult res2 = set.add(wrapUnique(ptr2)); + HashSet<OwnPtr<Dummy>>::AddResult res2 = set.add(adoptPtr(ptr2)); EXPECT_EQ(res2.storedValue->get(), ptr2); } @@ -117,7 +117,7 @@ EXPECT_EQ(2UL, set.size()); OwnPtrSet::iterator it2 = set.find(ptr2); EXPECT_NE(set.end(), it2); - EXPECT_EQ(ptr2, (*it2).get()); + EXPECT_EQ(ptr2, (*it2)); set.remove(ptr1); EXPECT_TRUE(deleted1); @@ -130,22 +130,22 @@ deleted2 = false; { OwnPtrSet set; - set.add(wrapUnique(new Dummy(deleted1))); - set.add(wrapUnique(new Dummy(deleted2))); + set.add(adoptPtr(new Dummy(deleted1))); + set.add(adoptPtr(new Dummy(deleted2))); } EXPECT_TRUE(deleted1); EXPECT_TRUE(deleted2); deleted1 = false; deleted2 = false; - std::unique_ptr<Dummy> ownPtr1; - std::unique_ptr<Dummy> ownPtr2; + OwnPtr<Dummy> ownPtr1; + OwnPtr<Dummy> ownPtr2; ptr1 = new Dummy(deleted1); ptr2 = new Dummy(deleted2); { OwnPtrSet set; - set.add(wrapUnique(ptr1)); - set.add(wrapUnique(ptr2)); + set.add(adoptPtr(ptr1)); + set.add(adoptPtr(ptr2)); ownPtr1 = set.take(ptr1); EXPECT_EQ(1UL, set.size()); ownPtr2 = set.takeAny(); @@ -154,8 +154,8 @@ EXPECT_FALSE(deleted1); EXPECT_FALSE(deleted2); - EXPECT_EQ(ptr1, ownPtr1.get()); - EXPECT_EQ(ptr2, ownPtr2.get()); + EXPECT_EQ(ptr1, ownPtr1); + EXPECT_EQ(ptr2, ownPtr2); } class DummyRefCounted : public RefCounted<DummyRefCounted> {
diff --git a/third_party/WebKit/Source/wtf/HashTable.h b/third_party/WebKit/Source/wtf/HashTable.h index f6720ab..64c7018 100644 --- a/third_party/WebKit/Source/wtf/HashTable.h +++ b/third_party/WebKit/Source/wtf/HashTable.h
@@ -25,9 +25,7 @@ #include "wtf/Assertions.h" #include "wtf/ConditionalDestructor.h" #include "wtf/HashTraits.h" -#include "wtf/PtrUtil.h" #include "wtf/allocator/PartitionAllocator.h" -#include <memory> #define DUMP_HASHTABLE_STATS 0 #define DUMP_HASHTABLE_STATS_PER_TABLE 0 @@ -581,7 +579,7 @@ #if DUMP_HASHTABLE_STATS_PER_TABLE public: - mutable std::unique_ptr<Stats> m_stats; + mutable OwnPtr<Stats> m_stats; #endif template <WeakHandlingFlag x, typename T, typename U, typename V, typename W, typename X, typename Y, typename Z> friend struct WeakProcessingHashTableHelper; @@ -600,7 +598,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(wrapUnique(new Stats)) + , m_stats(adoptPtr(new Stats)) #endif { static_assert(Allocator::isGarbageCollected || (!IsPointerToGarbageCollectedType<Key>::value && !IsPointerToGarbageCollectedType<Value>::value), "Cannot put raw pointers to garbage-collected classes into an off-heap collection."); @@ -1237,7 +1235,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(wrapUnique(new Stats(*other.m_stats))) + , m_stats(adoptPtr(new Stats(*other.m_stats))) #endif { // Copy the hash table the dumb way, by adding each element to the new @@ -1260,7 +1258,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(wrapUnique(new Stats(*other.m_stats))) + , m_stats(adoptPtr(new Stats(*other.m_stats))) #endif { swap(other);
diff --git a/third_party/WebKit/Source/wtf/HashTraits.h b/third_party/WebKit/Source/wtf/HashTraits.h index 3ddd834..bd8f8c9 100644 --- a/third_party/WebKit/Source/wtf/HashTraits.h +++ b/third_party/WebKit/Source/wtf/HashTraits.h
@@ -155,6 +155,23 @@ static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); } }; +template <typename P> struct HashTraits<OwnPtr<P>> : SimpleClassHashTraits<OwnPtr<P>> { + typedef std::nullptr_t EmptyValueType; + + static EmptyValueType emptyValue() { return nullptr; } + + static const bool hasIsEmptyValueFunction = true; + static bool isEmptyValue(const OwnPtr<P>& value) { return !value; } + + typedef typename OwnPtr<P>::PtrType PeekInType; + + static void store(PassOwnPtr<P> value, OwnPtr<P>& storage) { storage = std::move(value); } + + typedef typename OwnPtr<P>::PtrType PeekOutType; + static PeekOutType peek(const OwnPtr<P>& value) { return value.get(); } + static PeekOutType peek(std::nullptr_t) { return 0; } +}; + template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPtr<P>> { typedef std::nullptr_t EmptyValueType; static EmptyValueType emptyValue() { return nullptr; }
diff --git a/third_party/WebKit/Source/wtf/LinkedHashSet.h b/third_party/WebKit/Source/wtf/LinkedHashSet.h index e85c72fd..894138bf 100644 --- a/third_party/WebKit/Source/wtf/LinkedHashSet.h +++ b/third_party/WebKit/Source/wtf/LinkedHashSet.h
@@ -24,6 +24,8 @@ #include "wtf/AddressSanitizer.h" #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/allocator/PartitionAllocator.h" namespace WTF {
diff --git a/third_party/WebKit/Source/wtf/LinkedStack.h b/third_party/WebKit/Source/wtf/LinkedStack.h index 3350c217..63bbbde7 100644 --- a/third_party/WebKit/Source/wtf/LinkedStack.h +++ b/third_party/WebKit/Source/wtf/LinkedStack.h
@@ -32,8 +32,7 @@ #define LinkedStack_h #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/OwnPtr.h" namespace WTF { @@ -46,7 +45,7 @@ // Iterative cleanup to prevent stack overflow problems. ~LinkedStack() { - std::unique_ptr<Node> ptr = m_head.release(); + OwnPtr<Node> ptr = m_head.release(); while (ptr) ptr = ptr->m_next.release(); } @@ -63,18 +62,18 @@ class Node { USING_FAST_MALLOC(LinkedStack::Node); public: - Node(const T&, std::unique_ptr<Node> next); + Node(const T&, PassOwnPtr<Node> next); T m_data; - std::unique_ptr<Node> m_next; + OwnPtr<Node> m_next; }; - std::unique_ptr<Node> m_head; + OwnPtr<Node> m_head; size_t m_size; }; template <typename T> -LinkedStack<T>::Node::Node(const T& data, std::unique_ptr<Node> next) +LinkedStack<T>::Node::Node(const T& data, PassOwnPtr<Node> next) : m_data(data) , m_next(next) { @@ -89,7 +88,7 @@ template <typename T> inline void LinkedStack<T>::push(const T& data) { - m_head = wrapUnique(new Node(data, m_head.release())); + m_head = adoptPtr(new Node(data, m_head.release())); ++m_size; }
diff --git a/third_party/WebKit/Source/wtf/ListHashSet.h b/third_party/WebKit/Source/wtf/ListHashSet.h index ebc2220..54aded52 100644 --- a/third_party/WebKit/Source/wtf/ListHashSet.h +++ b/third_party/WebKit/Source/wtf/ListHashSet.h
@@ -23,8 +23,9 @@ #define WTF_ListHashSet_h #include "wtf/HashSet.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/allocator/PartitionAllocator.h" -#include <memory> namespace WTF { @@ -267,7 +268,7 @@ } private: - // Not using std::unique_ptr as this pointer should be deleted at + // Not using OwnPtr as this pointer should be deleted at // releaseAllocator() method rather than at destructor. ListHashSetAllocator* m_allocator; };
diff --git a/third_party/WebKit/Source/wtf/ListHashSetTest.cpp b/third_party/WebKit/Source/wtf/ListHashSetTest.cpp index 97a1443..1c5a3545 100644 --- a/third_party/WebKit/Source/wtf/ListHashSetTest.cpp +++ b/third_party/WebKit/Source/wtf/ListHashSetTest.cpp
@@ -28,10 +28,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/LinkedHashSet.h" #include "wtf/PassRefPtr.h" -#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" -#include <memory> #include <type_traits> namespace WTF { @@ -554,14 +552,14 @@ { bool deleted1 = false, deleted2 = false; - typedef ListHashSet<std::unique_ptr<Dummy>> OwnPtrSet; + typedef ListHashSet<OwnPtr<Dummy>> OwnPtrSet; OwnPtrSet set; Dummy* ptr1 = new Dummy(deleted1); { // AddResult in a separate scope to avoid assertion hit, // since we modify the container further. - OwnPtrSet::AddResult res1 = set.add(wrapUnique(ptr1)); + OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); EXPECT_EQ(res1.storedValue->get(), ptr1); } @@ -569,11 +567,11 @@ EXPECT_EQ(1UL, set.size()); OwnPtrSet::iterator it1 = set.find(ptr1); EXPECT_NE(set.end(), it1); - EXPECT_EQ(ptr1, (*it1).get()); + EXPECT_EQ(ptr1, (*it1)); Dummy* ptr2 = new Dummy(deleted2); { - OwnPtrSet::AddResult res2 = set.add(wrapUnique(ptr2)); + OwnPtrSet::AddResult res2 = set.add(adoptPtr(ptr2)); EXPECT_EQ(res2.storedValue->get(), ptr2); } @@ -581,7 +579,7 @@ EXPECT_EQ(2UL, set.size()); OwnPtrSet::iterator it2 = set.find(ptr2); EXPECT_NE(set.end(), it2); - EXPECT_EQ(ptr2, (*it2).get()); + EXPECT_EQ(ptr2, (*it2)); set.remove(ptr1); EXPECT_TRUE(deleted1); @@ -594,8 +592,8 @@ deleted2 = false; { OwnPtrSet set; - set.add(wrapUnique(new Dummy(deleted1))); - set.add(wrapUnique(new Dummy(deleted2))); + set.add(adoptPtr(new Dummy(deleted1))); + set.add(adoptPtr(new Dummy(deleted2))); } EXPECT_TRUE(deleted1); EXPECT_TRUE(deleted2); @@ -603,14 +601,14 @@ deleted1 = false; deleted2 = false; - std::unique_ptr<Dummy> ownPtr1; - std::unique_ptr<Dummy> ownPtr2; + OwnPtr<Dummy> ownPtr1; + OwnPtr<Dummy> ownPtr2; ptr1 = new Dummy(deleted1); ptr2 = new Dummy(deleted2); { OwnPtrSet set; - set.add(wrapUnique(ptr1)); - set.add(wrapUnique(ptr2)); + set.add(adoptPtr(ptr1)); + set.add(adoptPtr(ptr2)); ownPtr1 = set.takeFirst(); EXPECT_EQ(1UL, set.size()); ownPtr2 = set.take(ptr2); @@ -619,8 +617,8 @@ EXPECT_FALSE(deleted1); EXPECT_FALSE(deleted2); - EXPECT_EQ(ptr1, ownPtr1.get()); - EXPECT_EQ(ptr2, ownPtr2.get()); + EXPECT_EQ(ptr1, ownPtr1); + EXPECT_EQ(ptr2, ownPtr2); } class CountCopy final {
diff --git a/third_party/WebKit/Source/wtf/OwnPtr.h b/third_party/WebKit/Source/wtf/OwnPtr.h new file mode 100644 index 0000000..6725c07 --- /dev/null +++ b/third_party/WebKit/Source/wtf/OwnPtr.h
@@ -0,0 +1,196 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WTF_OwnPtr_h +#define WTF_OwnPtr_h + +#include "wtf/Allocator.h" +#include "wtf/Compiler.h" +#include "wtf/Forward.h" +#include "wtf/HashTableDeletedValueType.h" +#include "wtf/Noncopyable.h" +#include "wtf/OwnPtrCommon.h" +#include <algorithm> +#include <utility> + +namespace WTF { + +template <typename T> class OwnPtr { + USING_FAST_MALLOC(OwnPtr); + WTF_MAKE_NONCOPYABLE(OwnPtr); +public: + template <typename U> friend PassOwnPtr<U> adoptPtr(U* ptr); + template <typename U> friend PassOwnPtr<U[]> adoptArrayPtr(U* ptr); + + typedef typename std::remove_extent<T>::type ValueType; + typedef ValueType* PtrType; + + OwnPtr() : m_ptr(nullptr) {} + OwnPtr(std::nullptr_t) : m_ptr(nullptr) {} + + // Hash table deleted values, which are only constructed and never copied or + // destroyed. + OwnPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) {} + bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } + + ~OwnPtr() + { + OwnedPtrDeleter<T>::deletePtr(m_ptr); + m_ptr = nullptr; + } + + PtrType get() const { return m_ptr; } + + void reset(); + + PtrType leakPtr() WARN_UNUSED_RETURN; + + ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } + PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } + + ValueType& operator[](std::ptrdiff_t i) const; + + bool operator!() const { return !m_ptr; } + explicit operator bool() const { return m_ptr; } + + OwnPtr& operator=(std::nullptr_t) { reset(); return *this; } + + OwnPtr(OwnPtr&&); + template <typename U, typename = typename std::enable_if<std::is_convertible<U*, T*>::value>::type> OwnPtr(OwnPtr<U>&&); + + OwnPtr& operator=(OwnPtr&&); + template <typename U> OwnPtr& operator=(OwnPtr<U>&&); + + void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); } + + static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } + +private: + explicit OwnPtr(PtrType ptr) : m_ptr(ptr) {} + + // We should never have two OwnPtrs for the same underlying object + // (otherwise we'll get double-destruction), so these equality operators + // should never be needed. + template <typename U> bool operator==(const OwnPtr<U>&) const + { + static_assert(!sizeof(U*), "OwnPtrs should never be equal"); + return false; + } + template <typename U> bool operator!=(const OwnPtr<U>&) const + { + static_assert(!sizeof(U*), "OwnPtrs should never be equal"); + return false; + } + + PtrType m_ptr; +}; + +template <typename T> inline void OwnPtr<T>::reset() +{ + PtrType ptr = m_ptr; + m_ptr = nullptr; + OwnedPtrDeleter<T>::deletePtr(ptr); +} + +template <typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr() +{ + PtrType ptr = m_ptr; + m_ptr = nullptr; + return ptr; +} + +template <typename T> inline typename OwnPtr<T>::ValueType& OwnPtr<T>::operator[](std::ptrdiff_t i) const +{ + static_assert(std::is_array<T>::value, "elements access is possible for arrays only"); + ASSERT(m_ptr); + ASSERT(i >= 0); + return m_ptr[i]; +} + +template <typename T> inline OwnPtr<T>::OwnPtr(OwnPtr<T>&& o) + : m_ptr(o.leakPtr()) +{ +} + +template <typename T> +template <typename U, typename> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o) + : m_ptr(o.leakPtr()) +{ + static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); +} + +template <typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<T>&& o) +{ + PtrType ptr = m_ptr; + m_ptr = o.leakPtr(); + ASSERT(!ptr || m_ptr != ptr); + OwnedPtrDeleter<T>::deletePtr(ptr); + + return *this; +} + +template <typename T> +template <typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<U>&& o) +{ + static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); + PtrType ptr = m_ptr; + m_ptr = o.leakPtr(); + ASSERT(!ptr || m_ptr != ptr); + OwnedPtrDeleter<T>::deletePtr(ptr); + + return *this; +} + +template <typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b) +{ + a.swap(b); +} + +template <typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b) +{ + return a.get() == b; +} + +template <typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b) +{ + return a == b.get(); +} + +template <typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b) +{ + return a.get() != b; +} + +template <typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b) +{ + return a != b.get(); +} + +template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p) +{ + return p.get(); +} + +} // namespace WTF + +using WTF::OwnPtr; + +#endif // WTF_OwnPtr_h
diff --git a/third_party/WebKit/Source/wtf/OwnPtrCommon.h b/third_party/WebKit/Source/wtf/OwnPtrCommon.h new file mode 100644 index 0000000..89e24895 --- /dev/null +++ b/third_party/WebKit/Source/wtf/OwnPtrCommon.h
@@ -0,0 +1,77 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile, Inc. + * Copyright (C) 2010 Company 100 Inc. + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WTF_OwnPtrCommon_h +#define WTF_OwnPtrCommon_h + +#include "wtf/Assertions.h" +#include "wtf/TypeTraits.h" + +namespace WTF { + +class RefCountedBase; +class ThreadSafeRefCountedBase; + +template<typename T> +struct IsRefCounted { + STATIC_ONLY(IsRefCounted); + static const bool value = IsSubclass<T, RefCountedBase>::value + || IsSubclass<T, ThreadSafeRefCountedBase>::value; +}; + +template <typename T> +struct OwnedPtrDeleter { + STATIC_ONLY(OwnedPtrDeleter); + static void deletePtr(T* ptr) + { + static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects"); + static_assert(sizeof(T) > 0, "type must be complete"); + delete ptr; + } +}; + +template <typename T> +struct OwnedPtrDeleter<T[]> { + STATIC_ONLY(OwnedPtrDeleter); + static void deletePtr(T* ptr) + { + static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects"); + static_assert(sizeof(T) > 0, "type must be complete"); + delete[] ptr; + } +}; + +template <class T, int n> +struct OwnedPtrDeleter<T[n]> { + STATIC_ONLY(OwnedPtrDeleter); + static_assert(sizeof(T) < 0, "do not use array with size as type"); +}; + +} // namespace WTF + +#endif // WTF_OwnPtrCommon_h
diff --git a/third_party/WebKit/Source/wtf/PassOwnPtr.h b/third_party/WebKit/Source/wtf/PassOwnPtr.h new file mode 100644 index 0000000..37b1b37 --- /dev/null +++ b/third_party/WebKit/Source/wtf/PassOwnPtr.h
@@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WTF_PassOwnPtr_h +#define WTF_PassOwnPtr_h + +#include "wtf/Allocator.h" +#include "wtf/Forward.h" +#include "wtf/Noncopyable.h" +#include "wtf/OwnPtr.h" + +namespace WTF { + +// PassOwnPtr is now an alias of OwnPtr, as defined in Forward.h. + +template <typename T> PassOwnPtr<T> adoptPtr(T*); +template <typename T> PassOwnPtr<T[]> adoptArrayPtr(T*); + +template <typename T> inline PassOwnPtr<T> adoptPtr(T* ptr) +{ + return PassOwnPtr<T>(ptr); +} + +template <typename T> inline PassOwnPtr<T[]> adoptArrayPtr(T* ptr) +{ + return PassOwnPtr<T[]>(ptr); +} + +template <typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(PassOwnPtr<U>&& p) +{ + static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); + return adoptPtr(static_cast<T*>(p.leakPtr())); +} + +} // namespace WTF + +using WTF::adoptPtr; +using WTF::adoptArrayPtr; +using WTF::static_pointer_cast; + +#endif // WTF_PassOwnPtr_h
diff --git a/third_party/WebKit/Source/wtf/SizeLimits.cpp b/third_party/WebKit/Source/wtf/SizeLimits.cpp index a0c9b03..9049b47 100644 --- a/third_party/WebKit/Source/wtf/SizeLimits.cpp +++ b/third_party/WebKit/Source/wtf/SizeLimits.cpp
@@ -30,6 +30,7 @@ #include "wtf/Assertions.h" #include "wtf/ContainerAnnotations.h" +#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" @@ -37,7 +38,6 @@ #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -77,7 +77,7 @@ #endif }; -static_assert(sizeof(std::unique_ptr<int>) == sizeof(int*), "std::unique_ptr should stay small"); +static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small"); static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small"); static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small"); static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small");
diff --git a/third_party/WebKit/Source/wtf/TerminatedArray.h b/third_party/WebKit/Source/wtf/TerminatedArray.h index 43f3f09..24c0ac4 100644 --- a/third_party/WebKit/Source/wtf/TerminatedArray.h +++ b/third_party/WebKit/Source/wtf/TerminatedArray.h
@@ -5,9 +5,8 @@ #define TerminatedArray_h #include "wtf/Allocator.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" #include "wtf/allocator/Partitions.h" -#include <memory> namespace WTF { @@ -67,7 +66,7 @@ return count; } - // Match Allocator semantics to be able to use std::unique_ptr<TerminatedArray>. + // Match Allocator semantics to be able to use OwnPtr<TerminatedArray>. void operator delete(void* p) { ::WTF::Partitions::fastFree(p); } private: @@ -75,8 +74,8 @@ // of TerminateArray and manage their lifetimes. struct Allocator { STATIC_ONLY(Allocator); - using PassPtr = std::unique_ptr<TerminatedArray>; - using Ptr = std::unique_ptr<TerminatedArray>; + using PassPtr = PassOwnPtr<TerminatedArray>; + using Ptr = OwnPtr<TerminatedArray>; static PassPtr release(Ptr& ptr) { @@ -85,12 +84,12 @@ static PassPtr create(size_t capacity) { - return wrapUnique(static_cast<TerminatedArray*>(WTF::Partitions::fastMalloc(capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); + return adoptPtr(static_cast<TerminatedArray*>(WTF::Partitions::fastMalloc(capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); } static PassPtr resize(Ptr ptr, size_t capacity) { - return wrapUnique(static_cast<TerminatedArray*>(WTF::Partitions::fastRealloc(ptr.release(), capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); + return adoptPtr(static_cast<TerminatedArray*>(WTF::Partitions::fastRealloc(ptr.leakPtr(), capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); } };
diff --git a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp index 2a7cdd1..b270215 100644 --- a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp +++ b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
@@ -35,6 +35,8 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/HashMap.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h"
diff --git a/third_party/WebKit/Source/wtf/ThreadingWin.cpp b/third_party/WebKit/Source/wtf/ThreadingWin.cpp index 86c610c1..83805e58 100644 --- a/third_party/WebKit/Source/wtf/ThreadingWin.cpp +++ b/third_party/WebKit/Source/wtf/ThreadingWin.cpp
@@ -91,6 +91,8 @@ #include "wtf/DateMath.h" #include "wtf/HashMap.h" #include "wtf/MathExtras.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/WTFThreadData.h"
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h index 5b50284..9722d7e 100644 --- a/third_party/WebKit/Source/wtf/Vector.h +++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -271,26 +271,6 @@ }; template <typename T> -struct VectorElementComparer { - STATIC_ONLY(VectorElementComparer); - template <typename U> - static bool compareElement(const T& left, const U& right) - { - return left == right; - } -}; - -template <typename T> -struct VectorElementComparer<std::unique_ptr<T>> { - STATIC_ONLY(VectorElementComparer); - template <typename U> - static bool compareElement(const std::unique_ptr<T>& left, const U& right) - { - return left.get() == right; - } -}; - -template <typename T> struct VectorTypeOperations { STATIC_ONLY(VectorTypeOperations); static void destruct(T* begin, T* end) @@ -332,12 +312,6 @@ { return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size); } - - template <typename U> - static bool compareElement(const T& left, U&& right) - { - return VectorElementComparer<T>::compareElement(left, std::forward<U>(right)); - } }; template <typename T, bool hasInlineCapacity, typename Allocator> @@ -1121,7 +1095,7 @@ const T* b = begin(); const T* e = end(); for (const T* iter = b; iter < e; ++iter) { - if (TypeOperations::compareElement(*iter, value)) + if (*iter == value) return iter - b; } return kNotFound; @@ -1135,7 +1109,7 @@ const T* iter = end(); while (iter > b) { --iter; - if (TypeOperations::compareElement(*iter, value)) + if (*iter == value) return iter - b; } return kNotFound;
diff --git a/third_party/WebKit/Source/wtf/VectorTest.cpp b/third_party/WebKit/Source/wtf/VectorTest.cpp index f0d164d3..11e508c0 100644 --- a/third_party/WebKit/Source/wtf/VectorTest.cpp +++ b/third_party/WebKit/Source/wtf/VectorTest.cpp
@@ -27,7 +27,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashSet.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include <memory> @@ -161,17 +162,17 @@ int* m_destructNumber; }; -typedef WTF::Vector<std::unique_ptr<DestructCounter>> OwnPtrVector; +typedef WTF::Vector<OwnPtr<DestructCounter>> OwnPtrVector; TEST(VectorTest, OwnPtr) { int destructNumber = 0; OwnPtrVector vector; - vector.append(wrapUnique(new DestructCounter(0, &destructNumber))); - vector.append(wrapUnique(new DestructCounter(1, &destructNumber))); + vector.append(adoptPtr(new DestructCounter(0, &destructNumber))); + vector.append(adoptPtr(new DestructCounter(1, &destructNumber))); EXPECT_EQ(2u, vector.size()); - std::unique_ptr<DestructCounter>& counter0 = vector.first(); + OwnPtr<DestructCounter>& counter0 = vector.first(); ASSERT_EQ(0, counter0->get()); int counter1 = vector.last()->get(); ASSERT_EQ(1, counter1); @@ -179,7 +180,7 @@ size_t index = 0; for (OwnPtrVector::iterator iter = vector.begin(); iter != vector.end(); ++iter) { - std::unique_ptr<DestructCounter>* refCounter = iter; + OwnPtr<DestructCounter>* refCounter = iter; EXPECT_EQ(index, static_cast<size_t>(refCounter->get()->get())); EXPECT_EQ(index, static_cast<size_t>((*refCounter)->get())); index++; @@ -187,7 +188,7 @@ EXPECT_EQ(0, destructNumber); for (index = 0; index < vector.size(); index++) { - std::unique_ptr<DestructCounter>& refCounter = vector[index]; + OwnPtr<DestructCounter>& refCounter = vector[index]; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); } EXPECT_EQ(0, destructNumber); @@ -199,7 +200,7 @@ EXPECT_EQ(1u, vector.size()); EXPECT_EQ(1, destructNumber); - std::unique_ptr<DestructCounter> ownCounter1 = std::move(vector[0]); + OwnPtr<DestructCounter> ownCounter1 = std::move(vector[0]); vector.remove(0); ASSERT_EQ(counter1, ownCounter1->get()); ASSERT_EQ(0u, vector.size()); @@ -211,9 +212,9 @@ size_t count = 1025; destructNumber = 0; for (size_t i = 0; i < count; i++) - vector.prepend(wrapUnique(new DestructCounter(i, &destructNumber))); + vector.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); - // Vector relocation must not destruct std::unique_ptr element. + // Vector relocation must not destruct OwnPtr element. EXPECT_EQ(0, destructNumber); EXPECT_EQ(count, vector.size());
diff --git a/third_party/WebKit/Source/wtf/VectorTraits.h b/third_party/WebKit/Source/wtf/VectorTraits.h index e085ec4..04e0e68e 100644 --- a/third_party/WebKit/Source/wtf/VectorTraits.h +++ b/third_party/WebKit/Source/wtf/VectorTraits.h
@@ -21,9 +21,9 @@ #ifndef WTF_VectorTraits_h #define WTF_VectorTraits_h +#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/TypeTraits.h" -#include <memory> #include <type_traits> #include <utility> @@ -68,23 +68,23 @@ static const bool canCompareWithMemcmp = true; }; -// We know std::unique_ptr and RefPtr are simple enough that initializing to 0 and moving +// We know OwnPtr and RefPtr are simple enough that initializing to 0 and moving // with memcpy (and then not destructing the original) will totally work. template <typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits<RefPtr<P>> {}; template <typename P> -struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits<std::unique_ptr<P>> { - // std::unique_ptr -> std::unique_ptr has a very particular structure that tricks the +struct VectorTraits<OwnPtr<P>> : SimpleClassVectorTraits<OwnPtr<P>> { + // OwnPtr -> PassOwnPtr has a very particular structure that tricks the // normal type traits into thinking that the class is "trivially copyable". static const bool canCopyWithMemcpy = false; }; static_assert(VectorTraits<RefPtr<int>>::canInitializeWithMemset, "inefficient RefPtr Vector"); static_assert(VectorTraits<RefPtr<int>>::canMoveWithMemcpy, "inefficient RefPtr Vector"); static_assert(VectorTraits<RefPtr<int>>::canCompareWithMemcmp, "inefficient RefPtr Vector"); -static_assert(VectorTraits<std::unique_ptr<int>>::canInitializeWithMemset, "inefficient std::unique_ptr Vector"); -static_assert(VectorTraits<std::unique_ptr<int>>::canMoveWithMemcpy, "inefficient std::unique_ptr Vector"); -static_assert(VectorTraits<std::unique_ptr<int>>::canCompareWithMemcmp, "inefficient std::unique_ptr Vector"); +static_assert(VectorTraits<OwnPtr<int>>::canInitializeWithMemset, "inefficient OwnPtr Vector"); +static_assert(VectorTraits<OwnPtr<int>>::canMoveWithMemcpy, "inefficient OwnPtr Vector"); +static_assert(VectorTraits<OwnPtr<int>>::canCompareWithMemcmp, "inefficient OwnPtr Vector"); template <typename First, typename Second> struct VectorTraits<std::pair<First, Second>> {
diff --git a/third_party/WebKit/Source/wtf/WTFThreadData.cpp b/third_party/WebKit/Source/wtf/WTFThreadData.cpp index 4fe60343..286c1182 100644 --- a/third_party/WebKit/Source/wtf/WTFThreadData.cpp +++ b/third_party/WebKit/Source/wtf/WTFThreadData.cpp
@@ -26,7 +26,6 @@ #include "wtf/WTFThreadData.h" -#include "wtf/PtrUtil.h" #include "wtf/text/TextCodecICU.h" namespace WTF { @@ -38,7 +37,7 @@ , m_atomicStringTableDestructor(nullptr) , m_compressibleStringTable(nullptr) , m_compressibleStringTableDestructor(nullptr) - , m_cachedConverterICU(wrapUnique(new ICUConverterWrapper)) + , m_cachedConverterICU(adoptPtr(new ICUConverterWrapper)) { }
diff --git a/third_party/WebKit/Source/wtf/WTFThreadData.h b/third_party/WebKit/Source/wtf/WTFThreadData.h index 3460e93..b07fd5d 100644 --- a/third_party/WebKit/Source/wtf/WTFThreadData.h +++ b/third_party/WebKit/Source/wtf/WTFThreadData.h
@@ -34,7 +34,6 @@ #include "wtf/Threading.h" #include "wtf/WTFExport.h" #include "wtf/text/StringHash.h" -#include <memory> namespace blink { @@ -77,7 +76,7 @@ AtomicStringTableDestructor m_atomicStringTableDestructor; blink::CompressibleStringTable* m_compressibleStringTable; blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor; - std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; + OwnPtr<ICUConverterWrapper> m_cachedConverterICU; static ThreadSpecific<WTFThreadData>* staticData; friend WTFThreadData& wtfThreadData();
diff --git a/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp b/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp index 213ba334..cdc4302 100644 --- a/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp +++ b/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp
@@ -33,9 +33,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/BitwiseOperations.h" #include "wtf/CPU.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" -#include <memory> #include <stdlib.h> #include <string.h> @@ -447,7 +447,7 @@ // The +1 is because we need to account for the fact that the current page // never gets thrown on the freelist. ++numToFillFreeListPage; - std::unique_ptr<PartitionPage*[]> pages = wrapArrayUnique(new PartitionPage*[numToFillFreeListPage]); + OwnPtr<PartitionPage*[]> pages = adoptArrayPtr(new PartitionPage*[numToFillFreeListPage]); size_t i; for (i = 0; i < numToFillFreeListPage; ++i) { @@ -493,8 +493,8 @@ --numPagesNeeded; EXPECT_GT(numPagesNeeded, 1u); - std::unique_ptr<PartitionPage*[]> pages; - pages = wrapArrayUnique(new PartitionPage*[numPagesNeeded]); + OwnPtr<PartitionPage*[]> pages; + pages = adoptArrayPtr(new PartitionPage*[numPagesNeeded]); uintptr_t firstSuperPageBase = 0; size_t i; for (i = 0; i < numPagesNeeded; ++i) { @@ -1026,8 +1026,8 @@ // The -2 is because the first and last partition pages in a super page are // guard pages. size_t numPartitionPagesNeeded = kNumPartitionPagesPerSuperPage - 2; - std::unique_ptr<PartitionPage*[]> firstSuperPagePages = wrapArrayUnique(new PartitionPage*[numPartitionPagesNeeded]); - std::unique_ptr<PartitionPage*[]> secondSuperPagePages = wrapArrayUnique(new PartitionPage*[numPartitionPagesNeeded]); + OwnPtr<PartitionPage*[]> firstSuperPagePages = adoptArrayPtr(new PartitionPage*[numPartitionPagesNeeded]); + OwnPtr<PartitionPage*[]> secondSuperPagePages = adoptArrayPtr(new PartitionPage*[numPartitionPagesNeeded]); size_t i; for (i = 0; i < numPartitionPagesNeeded; ++i)
diff --git a/third_party/WebKit/Source/wtf/text/Collator.h b/third_party/WebKit/Source/wtf/text/Collator.h index 18b1efe..247d65d8 100644 --- a/third_party/WebKit/Source/wtf/text/Collator.h +++ b/third_party/WebKit/Source/wtf/text/Collator.h
@@ -31,9 +31,9 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/WTFExport.h" #include "wtf/text/Unicode.h" -#include <memory> struct UCollator; @@ -52,7 +52,7 @@ ~Collator(); void setOrderLowerFirst(bool); - static std::unique_ptr<Collator> userDefault(); + static PassOwnPtr<Collator> userDefault(); Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const;
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/wtf/text/StringImpl.cpp index 77ddb65..c9c1a14b 100644 --- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp +++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp
@@ -26,7 +26,8 @@ #include "wtf/DynamicAnnotations.h" #include "wtf/LeakAnnotations.h" -#include "wtf/PtrUtil.h" +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/allocator/PartitionAlloc.h" #include "wtf/allocator/Partitions.h" @@ -36,7 +37,6 @@ #include "wtf/text/StringHash.h" #include "wtf/text/StringToNumber.h" #include <algorithm> -#include <memory> #include <unicode/translit.h> #include <unicode/unistr.h> @@ -793,8 +793,8 @@ // TODO(jungshik): Cache transliterator if perf penaly warrants it for Greek. UErrorCode status = U_ZERO_ERROR; - std::unique_ptr<icu::Transliterator> translit = - wrapUnique(icu::Transliterator::createInstance(transliteratorId, UTRANS_FORWARD, status)); + OwnPtr<icu::Transliterator> translit = + adoptPtr(icu::Transliterator::createInstance(transliteratorId, UTRANS_FORWARD, status)); if (U_FAILURE(status)) return upper();
diff --git a/third_party/WebKit/Source/wtf/text/TextCodec.h b/third_party/WebKit/Source/wtf/text/TextCodec.h index aae9438f..28f547c 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodec.h +++ b/third_party/WebKit/Source/wtf/text/TextCodec.h
@@ -29,9 +29,9 @@ #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -98,7 +98,7 @@ typedef void (*EncodingNameRegistrar)(const char* alias, const char* name); -typedef std::unique_ptr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData); +typedef PassOwnPtr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData); typedef void (*TextCodecRegistrar)(const char* name, NewTextCodecFunction, const void* additionalData); } // namespace WTF
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp index b2c4d3f..b157bf9 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
@@ -27,14 +27,12 @@ #include "wtf/text/TextCodecICU.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/Threading.h" #include "wtf/WTFThreadData.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuilder.h" -#include <memory> #include <unicode/ucnv.h> #include <unicode/ucnv_cb.h> @@ -53,9 +51,9 @@ return wtfThreadData().cachedConverterICU().converter; } -std::unique_ptr<TextCodec> TextCodecICU::create(const TextEncoding& encoding, const void*) +PassOwnPtr<TextCodec> TextCodecICU::create(const TextEncoding& encoding, const void*) { - return wrapUnique(new TextCodecICU(encoding)); + return adoptPtr(new TextCodecICU(encoding)); } void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.h b/third_party/WebKit/Source/wtf/text/TextCodecICU.h index 9b34d64..9b11005 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecICU.h +++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.h
@@ -29,7 +29,6 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" -#include <memory> #include <unicode/utypes.h> typedef struct UConverter UConverter; @@ -47,7 +46,7 @@ private: TextCodecICU(const TextEncoding&); - static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); + static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) override; CString encode(const UChar*, size_t length, UnencodableHandling) override;
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp b/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp index 94f89b2..ebe9d020 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp
@@ -25,12 +25,11 @@ #include "wtf/text/TextCodecLatin1.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextCodecASCIIFastPath.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -91,9 +90,9 @@ registrar("x-cp1252", "windows-1252"); } -static std::unique_ptr<TextCodec> newStreamingTextDecoderWindowsLatin1(const TextEncoding&, const void*) +static PassOwnPtr<TextCodec> newStreamingTextDecoderWindowsLatin1(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecLatin1); + return adoptPtr(new TextCodecLatin1); } void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp b/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp index 47dc54a..274bae84f 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp
@@ -4,10 +4,9 @@ #include "wtf/text/TextCodecReplacement.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -31,9 +30,9 @@ registrar("iso-2022-kr", "replacement"); } -static std::unique_ptr<TextCodec> newStreamingTextDecoderReplacement(const TextEncoding&, const void*) +static PassOwnPtr<TextCodec> newStreamingTextDecoderReplacement(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecReplacement); + return adoptPtr(new TextCodecReplacement); } void TextCodecReplacement::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp b/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp index 9533604..835b69c 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp
@@ -5,12 +5,12 @@ #include "wtf/text/TextCodecReplacement.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -32,7 +32,7 @@ TEST(TextCodecReplacement, DecodesToFFFD) { TextEncoding encoding(replacementAlias); - std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); + OwnPtr<TextCodec> codec(newTextCodec(encoding)); bool sawError = false; const char testCase[] = "hello world"; @@ -47,7 +47,7 @@ TEST(TextCodecReplacement, EncodesToUTF8) { TextEncoding encoding(replacementAlias); - std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); + OwnPtr<TextCodec> codec(newTextCodec(encoding)); // "Kanji" in Chinese characters. const UChar testCase[] = { 0x6F22, 0x5B57 };
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp index f3e2c12..6fc1f15a 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp
@@ -25,12 +25,11 @@ #include "wtf/text/TextCodecUTF16.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/WTFString.h" -#include <memory> using namespace std; @@ -51,14 +50,14 @@ registrar("unicodeFFFE", "UTF-16BE"); } -static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16LE(const TextEncoding&, const void*) +static PassOwnPtr<TextCodec> newStreamingTextDecoderUTF16LE(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecUTF16(true)); + return adoptPtr(new TextCodecUTF16(true)); } -static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16BE(const TextEncoding&, const void*) +static PassOwnPtr<TextCodec> newStreamingTextDecoderUTF16BE(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecUTF16(false)); + return adoptPtr(new TextCodecUTF16(false)); } void TextCodecUTF16::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp index 865d67cc..bc4f0ed 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
@@ -25,12 +25,10 @@ #include "wtf/text/TextCodecUTF8.h" -#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextCodecASCIIFastPath.h" -#include <memory> namespace WTF { @@ -38,9 +36,9 @@ const int nonCharacter = -1; -std::unique_ptr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*) +PassOwnPtr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecUTF8); + return adoptPtr(new TextCodecUTF8); } void TextCodecUTF8::registerEncodingNames(EncodingNameRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h index 5f943dd..feb5682 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h
@@ -27,7 +27,6 @@ #define TextCodecUTF8_h #include "wtf/text/TextCodec.h" -#include <memory> namespace WTF { @@ -40,7 +39,7 @@ TextCodecUTF8() : m_partialSequenceSize(0) { } private: - static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); + static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) override; CString encode(const UChar*, size_t length, UnencodableHandling) override;
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp index c2b1814c..66fe49f 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp
@@ -31,11 +31,11 @@ #include "wtf/text/TextCodecUTF8.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/OwnPtr.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -44,7 +44,7 @@ TEST(TextCodecUTF8, DecodeAscii) { TextEncoding encoding("UTF-8"); - std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); + OwnPtr<TextCodec> codec(newTextCodec(encoding)); const char testCase[] = "HelloWorld"; size_t testCaseSize = sizeof(testCase) - 1; @@ -61,7 +61,7 @@ TEST(TextCodecUTF8, DecodeChineseCharacters) { TextEncoding encoding("UTF-8"); - std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); + OwnPtr<TextCodec> codec(newTextCodec(encoding)); // "Kanji" in Chinese characters. const char testCase[] = "\xe6\xbc\xa2\xe5\xad\x97"; @@ -78,7 +78,7 @@ TEST(TextCodecUTF8, Decode0xFF) { TextEncoding encoding("UTF-8"); - std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); + OwnPtr<TextCodec> codec(newTextCodec(encoding)); bool sawError = false; const String& result = codec->decode("\xff", 1, DataEOF, false, sawError);
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp index 164befc..8438bf2 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp
@@ -25,12 +25,11 @@ #include "wtf/text/TextCodecUserDefined.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -39,9 +38,9 @@ registrar("x-user-defined", "x-user-defined"); } -static std::unique_ptr<TextCodec> newStreamingTextDecoderUserDefined(const TextEncoding&, const void*) +static PassOwnPtr<TextCodec> newStreamingTextDecoderUserDefined(const TextEncoding&, const void*) { - return wrapUnique(new TextCodecUserDefined); + return adoptPtr(new TextCodecUserDefined); } void TextCodecUserDefined::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp index 31cdfb8..f3f231d 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp +++ b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp
@@ -27,12 +27,12 @@ #include "wtf/text/TextEncoding.h" +#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" #include "wtf/text/CString.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -74,7 +74,7 @@ if (string.isEmpty()) return ""; - std::unique_ptr<TextCodec> textCodec = newTextCodec(*this); + OwnPtr<TextCodec> textCodec = newTextCodec(*this); CString encodedString; if (string.is8Bit()) encodedString = textCodec->encode(string.characters8(), string.length(), handling);
diff --git a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp index 129722e..9f64aee 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp +++ b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp
@@ -42,7 +42,6 @@ #include "wtf/text/TextCodecUTF8.h" #include "wtf/text/TextCodecUserDefined.h" #include "wtf/text/TextEncoding.h" -#include <memory> namespace WTF { @@ -244,7 +243,7 @@ pruneBlacklistedCodecs(); } -std::unique_ptr<TextCodec> newTextCodec(const TextEncoding& encoding) +PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding) { MutexLocker lock(encodingRegistryMutex());
diff --git a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h index c6d0efd4..6b8a2f197 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h +++ b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h
@@ -26,10 +26,10 @@ #ifndef TextEncodingRegistry_h #define TextEncodingRegistry_h +#include "wtf/PassOwnPtr.h" #include "wtf/WTFExport.h" #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -38,7 +38,7 @@ // Use TextResourceDecoder::decode to decode resources, since it handles BOMs. // Use TextEncoding::encode to encode, since it takes care of normalization. -WTF_EXPORT std::unique_ptr<TextCodec> newTextCodec(const TextEncoding&); +WTF_EXPORT PassOwnPtr<TextCodec> newTextCodec(const TextEncoding&); // Only TextEncoding should use the following functions directly. const char* atomicCanonicalTextEncodingName(const char* alias);
diff --git a/third_party/WebKit/Source/wtf/text/TextPosition.cpp b/third_party/WebKit/Source/wtf/text/TextPosition.cpp index 2fc0207..32a0314f 100644 --- a/third_party/WebKit/Source/wtf/text/TextPosition.cpp +++ b/third_party/WebKit/Source/wtf/text/TextPosition.cpp
@@ -24,16 +24,15 @@ #include "wtf/text/TextPosition.h" -#include "wtf/PtrUtil.h" +#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include <algorithm> -#include <memory> namespace WTF { -std::unique_ptr<Vector<unsigned>> lineEndings(const String& text) +PassOwnPtr<Vector<unsigned>> lineEndings(const String& text) { - std::unique_ptr<Vector<unsigned>> result(wrapUnique(new Vector<unsigned>())); + OwnPtr<Vector<unsigned>> result(adoptPtr(new Vector<unsigned>())); unsigned start = 0; while (start < text.length()) {
diff --git a/third_party/WebKit/Source/wtf/text/TextPosition.h b/third_party/WebKit/Source/wtf/text/TextPosition.h index f4c62eb..17140c3 100644 --- a/third_party/WebKit/Source/wtf/text/TextPosition.h +++ b/third_party/WebKit/Source/wtf/text/TextPosition.h
@@ -30,7 +30,6 @@ #include "wtf/Vector.h" #include "wtf/WTFExport.h" #include "wtf/text/WTFString.h" -#include <memory> namespace WTF { @@ -87,7 +86,7 @@ OrdinalNumber m_column; }; -WTF_EXPORT std::unique_ptr<Vector<unsigned>> lineEndings(const String&); +WTF_EXPORT PassOwnPtr<Vector<unsigned>> lineEndings(const String&); } // namespace WTF
diff --git a/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp b/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp index 0bfe2b60..f5efcee 100644 --- a/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp +++ b/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp
@@ -29,11 +29,9 @@ #include "wtf/text/Collator.h" #include "wtf/Assertions.h" -#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" -#include <memory> #include <stdlib.h> #include <string.h> #include <unicode/ucol.h> @@ -56,9 +54,9 @@ setEquivalentLocale(m_locale, m_equivalentLocale); } -std::unique_ptr<Collator> Collator::userDefault() +PassOwnPtr<Collator> Collator::userDefault() { - return wrapUnique(new Collator(0)); + return adoptPtr(new Collator(0)); } Collator::~Collator()
diff --git a/third_party/WebKit/Source/wtf/wtf.gypi b/third_party/WebKit/Source/wtf/wtf.gypi index 639c912..3a7362ee 100644 --- a/third_party/WebKit/Source/wtf/wtf.gypi +++ b/third_party/WebKit/Source/wtf/wtf.gypi
@@ -59,6 +59,9 @@ 'Noncopyable.h', 'NotFound.h', 'Optional.h', + 'OwnPtr.h', + 'OwnPtrCommon.h', + 'PassOwnPtr.h', 'PassRefPtr.h', 'PrintStream.cpp', 'PrintStream.h',
diff --git a/third_party/WebKit/public/platform/WebBlobData.h b/third_party/WebKit/public/platform/WebBlobData.h index 6c028ae..2674210 100644 --- a/third_party/WebKit/public/platform/WebBlobData.h +++ b/third_party/WebKit/public/platform/WebBlobData.h
@@ -38,7 +38,8 @@ #include "WebURL.h" #if INSIDE_BLINK -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -77,9 +78,9 @@ BLINK_PLATFORM_EXPORT WebString contentType() const; #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebBlobData(std::unique_ptr<BlobData>); - BLINK_PLATFORM_EXPORT WebBlobData& operator=(std::unique_ptr<BlobData>); - BLINK_PLATFORM_EXPORT operator std::unique_ptr<BlobData>(); + BLINK_PLATFORM_EXPORT WebBlobData(WTF::PassOwnPtr<BlobData>); + BLINK_PLATFORM_EXPORT WebBlobData& operator=(WTF::PassOwnPtr<BlobData>); + BLINK_PLATFORM_EXPORT operator WTF::PassOwnPtr<BlobData>(); #endif private:
diff --git a/third_party/WebKit/public/platform/WebContentSettingCallbacks.h b/third_party/WebKit/public/platform/WebContentSettingCallbacks.h index 7bd13b8..7d4f0d3 100644 --- a/third_party/WebKit/public/platform/WebContentSettingCallbacks.h +++ b/third_party/WebKit/public/platform/WebContentSettingCallbacks.h
@@ -8,7 +8,8 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -31,7 +32,7 @@ BLINK_PLATFORM_EXPORT void assign(const WebContentSettingCallbacks&); #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebContentSettingCallbacks(std::unique_ptr<ContentSettingCallbacks>&&); + BLINK_PLATFORM_EXPORT WebContentSettingCallbacks(WTF::PassOwnPtr<ContentSettingCallbacks>&&); #endif BLINK_PLATFORM_EXPORT void doAllow();
diff --git a/third_party/WebKit/public/platform/WebCryptoAlgorithm.h b/third_party/WebKit/public/platform/WebCryptoAlgorithm.h index 408cb7c0e..7df6f3ae 100644 --- a/third_party/WebKit/public/platform/WebCryptoAlgorithm.h +++ b/third_party/WebKit/public/platform/WebCryptoAlgorithm.h
@@ -35,7 +35,7 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include <memory> +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -153,7 +153,7 @@ public: #if INSIDE_BLINK WebCryptoAlgorithm() { } - BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, std::unique_ptr<WebCryptoAlgorithmParams>); + BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoAlgorithmParams>); #endif BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm createNull();
diff --git a/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h b/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h index 113670d..df96d30 100644 --- a/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h +++ b/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h
@@ -37,7 +37,7 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include <memory> +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -53,7 +53,7 @@ WebCryptoKeyAlgorithm() { } #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebCryptoKeyAlgorithm(WebCryptoAlgorithmId, std::unique_ptr<WebCryptoKeyAlgorithmParams>); + BLINK_PLATFORM_EXPORT WebCryptoKeyAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoKeyAlgorithmParams>); #endif // FIXME: Delete this in favor of the create*() functions.
diff --git a/third_party/WebKit/public/platform/WebDataConsumerHandle.h b/third_party/WebKit/public/platform/WebDataConsumerHandle.h index 4632ff9..4a36d05 100644 --- a/third_party/WebKit/public/platform/WebDataConsumerHandle.h +++ b/third_party/WebKit/public/platform/WebDataConsumerHandle.h
@@ -8,7 +8,7 @@ #include <stddef.h> #if INSIDE_BLINK -#include <memory> +#include "wtf/PassOwnPtr.h" #endif #include "public/platform/WebCommon.h" @@ -104,7 +104,7 @@ // If |client| is not null and the handle is not waiting, client // notification is called asynchronously. #if INSIDE_BLINK - std::unique_ptr<Reader> obtainReader(Client*); + PassOwnPtr<Reader> obtainReader(Client*); #endif // Returns a string literal (e.g. class name) for debugging only.
diff --git a/third_party/WebKit/public/platform/WebFileSystemCallbacks.h b/third_party/WebKit/public/platform/WebFileSystemCallbacks.h index 13b50014..39189a67 100644 --- a/third_party/WebKit/public/platform/WebFileSystemCallbacks.h +++ b/third_party/WebKit/public/platform/WebFileSystemCallbacks.h
@@ -39,7 +39,8 @@ #include "WebVector.h" #if INSIDE_BLINK -#include <memory> +#include "wtf/OwnPtr.h" +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -66,7 +67,7 @@ BLINK_PLATFORM_EXPORT void assign(const WebFileSystemCallbacks&); #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebFileSystemCallbacks(std::unique_ptr<AsyncFileSystemCallbacks>&&); + BLINK_PLATFORM_EXPORT WebFileSystemCallbacks(WTF::PassOwnPtr<AsyncFileSystemCallbacks>&&); #endif // Callback for WebFileSystem's various operations that don't require
diff --git a/third_party/WebKit/public/platform/WebPrivateOwnPtr.h b/third_party/WebKit/public/platform/WebPrivateOwnPtr.h index 9f29792..64d0451 100644 --- a/third_party/WebKit/public/platform/WebPrivateOwnPtr.h +++ b/third_party/WebKit/public/platform/WebPrivateOwnPtr.h
@@ -33,8 +33,7 @@ #include <cstddef> #if INSIDE_BLINK -#include "wtf/PtrUtil.h" -#include <memory> +#include "wtf/PassOwnPtr.h" #endif namespace blink { @@ -61,7 +60,7 @@ #if INSIDE_BLINK template <typename U> - WebPrivateOwnPtr(std::unique_ptr<U>, EnsurePtrConvertibleArgDecl(U, T)); + WebPrivateOwnPtr(PassOwnPtr<U>, EnsurePtrConvertibleArgDecl(U, T)); void reset(T* ptr) { @@ -69,16 +68,16 @@ m_ptr = ptr; } - void reset(std::unique_ptr<T> o) + void reset(PassOwnPtr<T> o) { - reset(o.release()); + reset(o.leakPtr()); } - std::unique_ptr<T> release() + PassOwnPtr<T> release() { T* ptr = m_ptr; m_ptr = nullptr; - return wrapUnique(ptr); + return adoptPtr(ptr); } T& operator*() const @@ -101,8 +100,8 @@ #if INSIDE_BLINK template <typename T> template <typename U> -inline WebPrivateOwnPtr<T>::WebPrivateOwnPtr(std::unique_ptr<U> o, EnsurePtrConvertibleArgDefn(U, T)) - : m_ptr(o.release()) +inline WebPrivateOwnPtr<T>::WebPrivateOwnPtr(PassOwnPtr<U> o, EnsurePtrConvertibleArgDefn(U, T)) + : m_ptr(o.leakPtr()) { static_assert(!std::is_array<T>::value, "Pointers to array must never be converted"); }
diff --git a/third_party/WebKit/public/platform/WebScrollbar.h b/third_party/WebKit/public/platform/WebScrollbar.h index a57cff19..16b9964 100644 --- a/third_party/WebKit/public/platform/WebScrollbar.h +++ b/third_party/WebKit/public/platform/WebScrollbar.h
@@ -29,6 +29,9 @@ #include "WebRect.h" #include "WebSize.h" #include "WebVector.h" +#if INSIDE_BLINK +#include "wtf/PassOwnPtr.h" +#endif namespace blink {
diff --git a/third_party/WebKit/public/platform/WebTaskRunner.h b/third_party/WebKit/public/platform/WebTaskRunner.h index 2fee34c2..81ac626 100644 --- a/third_party/WebKit/public/platform/WebTaskRunner.h +++ b/third_party/WebKit/public/platform/WebTaskRunner.h
@@ -9,8 +9,6 @@ #ifdef INSIDE_BLINK #include "wtf/Functional.h" -#include "wtf/PtrUtil.h" -#include <memory> #endif namespace blink { @@ -68,9 +66,9 @@ void postTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>); void postDelayedTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>, long long delayMs); - std::unique_ptr<WebTaskRunner> adoptClone() + PassOwnPtr<WebTaskRunner> adoptClone() { - return wrapUnique(clone()); + return adoptPtr(clone()); } #endif };
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index e7894c8..b970be1 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -535,7 +535,13 @@ 'client.v8.fyi': { 'Android Builder': 'gn_official_goma_minimal_symbols_android', + 'Chromium ASAN - debug': 'gn_asan_lsan_edge_debug_bot', + 'Chromium ASAN (symbolized)': + 'gn_asan_lsan_edge_fuzzer_v8_heap_symbolized_release_bot', + 'Chromium Win SyzyASAN': 'gyp_syzyasan_no_pch_win_z7_x86', + 'Linux ASAN Builder': 'swarming_asan_lsan_gn_release_bot', 'Linux Debug Builder': 'gn_debug_bot', + 'Linux Snapshot Builder': 'gn_release_bot', 'V8 Android GN (dbg)': 'android_gn_debug_bot', 'V8 Linux GN': 'gn_release_bot', 'V8-Blink Linux 64': 'noswarming_gn_release_bot_x64',
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 020a698..f105b89c 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -54929,6 +54929,9 @@ </histogram> <histogram name="Sync.AppAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during app association (M18 and earlier were mispelled with this @@ -55035,6 +55038,9 @@ </histogram> <histogram name="Sync.AuthInvalidationRejectedTokenAgeLong" units="days"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Age of all auth tokens rejected by the invalidation server. Measured from @@ -55043,6 +55049,9 @@ </histogram> <histogram name="Sync.AuthInvalidationRejectedTokenAgeShort" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Age of auth tokens younger than one hour that were rejected by the @@ -55051,11 +55060,17 @@ </histogram> <histogram name="Sync.AuthorizationTimeInNetwork" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time taken during initial authorization.</summary> </histogram> <histogram name="Sync.AuthServerRejectedTokenAgeLong" units="days"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Age of all auth tokens rejected by the sync server. Measured from the time @@ -55064,6 +55079,9 @@ </histogram> <histogram name="Sync.AuthServerRejectedTokenAgeShort" units="ms"> + <obsolete> + No longer relevant since transition to OAuth. + </obsolete> <owner>zea@chromium.org</owner> <summary> Age of auth tokens younger than one hour that were rejected by the sync @@ -55179,6 +55197,9 @@ <histogram name="Sync.BackendInitializeRestoreState" enum="SyncBackendInitializeRestoreState"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Compares sync's has_setup_completed pref against the set of types actually @@ -55203,6 +55224,9 @@ </histogram> <histogram name="Sync.BadRequestCountOnSignInNeedsUpdateInfoBar"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Number of bad requests since application startup, when the Sync error @@ -55413,6 +55437,9 @@ </histogram> <histogram name="Sync.CredentialsLost" enum="BooleanCredentialsLost"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Whether or not we detected missing credentials during startup. This may be @@ -55467,6 +55494,9 @@ </histogram> <histogram name="Sync.DatatypePrefRecovery"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Number of clients that have fixed themselves up from a datatype preference @@ -55505,6 +55535,9 @@ </histogram> <histogram name="Sync.DeviceIdMismatchDetails" enum="DeviceIdMismatch"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>pavely@chromium.org</owner> <summary> When signin_scoped_device_id from pref doesn't match the one in @@ -55591,6 +55624,9 @@ </histogram> <histogram name="Sync.ExtensionAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during extension association (M18 and earlier were mispelled with @@ -55676,6 +55712,9 @@ </histogram> <histogram name="Sync.FaviconCount"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Number of synced favicons at initialization time.</summary> </histogram> @@ -55703,6 +55742,9 @@ </histogram> <histogram name="Sync.FaviconsAvailableAtMerge" enum="SyncFaviconsAvailable"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Number of client that have filled their sync favicon cache and must evict @@ -55734,6 +55776,9 @@ </histogram> <histogram name="Sync.FaviconVisitPeriod" units="hours"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time between updates to a synced favicon's visit time.</summary> </histogram> @@ -55865,6 +55910,9 @@ </histogram> <histogram name="Sync.FreqSyncedNotifications" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time between nudges for synced notifications. Used as estimate of datatype @@ -55890,6 +55938,9 @@ </histogram> <histogram name="Sync.FreqWifiCredentials" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time between nudges for WiFi credentials. Used as estimate of datatype @@ -56121,6 +56172,9 @@ </histogram> <histogram name="Sync.PasswordAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during password association (M18 and earlier were mispelled with @@ -56169,6 +56223,9 @@ </histogram> <histogram name="Sync.PreferenceAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during preference association (M18 and earlier were mispelled @@ -56217,6 +56274,9 @@ </histogram> <histogram name="Sync.ReauthorizationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time taken from startup for the user to reauthorize.</summary> </histogram> @@ -56291,6 +56351,9 @@ </histogram> <histogram name="Sync.SearchEngineAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during search engine association (M18 and earlier were mispelled @@ -56355,6 +56418,9 @@ </histogram> <histogram name="Sync.SessionAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during session association (M18 and earlier were mispelled with @@ -56429,6 +56495,9 @@ </histogram> <histogram name="Sync.Shutdown.StopRegistrarTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Amount of time the UI thread waits (at shutdown) to stop the @@ -56437,6 +56506,9 @@ </histogram> <histogram name="Sync.Shutdown.StopSyncThreadTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Amount of time the UI thread waits (at shutdown) to stop the sync thread. @@ -56484,6 +56556,9 @@ </histogram> <histogram name="Sync.SyncAuthError" enum="SyncAuthError"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Counts the number of times sync clients have encountered an auth error and @@ -56492,12 +56567,18 @@ </histogram> <histogram name="Sync.SyncedNotificationsAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time taken during synced notifications association.</summary> </histogram> <histogram name="Sync.SyncedNotificationsConfigureFailure" enum="SyncConfigureResult"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Enumeration of types of synced notifications configuration failures. @@ -56506,6 +56587,9 @@ <histogram name="Sync.SyncedNotificationsStartFailure" enum="SyncStartResult"> <obsolete> + Deprecated in M53. + </obsolete> + <obsolete> Replaced by SyncedNotificationsConfigureFailure. See crbug.com/478226. </obsolete> <owner>zea@chromium.org</owner> @@ -56595,6 +56679,9 @@ </histogram> <histogram name="Sync.TypedUrlAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during typed url association (M18 and earlier were mispelled with @@ -56603,6 +56690,9 @@ </histogram> <histogram name="Sync.TypedUrlChangeProcessorErrors" units="%"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> The percentage of history DB operations initiated by the typed URL change @@ -56621,6 +56711,9 @@ </histogram> <histogram name="Sync.TypedUrlModelAssociationErrors" units="%"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> The percentage of history DB operations during model association that return @@ -56702,11 +56795,17 @@ </histogram> <histogram name="Sync.UserPerceivedAuthorizationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time the user spends looking at the authorization dialog.</summary> </histogram> <histogram name="Sync.UserPerceivedBookmarkAssociation"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time taken during bookmark association.</summary> </histogram> @@ -56717,12 +56816,18 @@ </histogram> <histogram name="Sync.WifiCredentialsAssociationTime" units="ms"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary>Time taken during WiFi credentials association.</summary> </histogram> <histogram name="Sync.WifiCredentialsConfigureFailure" enum="SyncConfigureResult"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>zea@chromium.org</owner> <summary> Enumeration of types of WiFi credentials configuration failures. @@ -56746,6 +56851,9 @@ <histogram name="SyncedNotifications.Actions" enum="SyncedNotificationActionType"> + <obsolete> + Deprecated in M53. + </obsolete> <owner>petewil@chromium.org</owner> <owner>zea@chromium.org</owner> <summary> @@ -65594,6 +65702,8 @@ <int value="5" label="CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION"/> <int value="6" label="CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED"/> <int value="7" label="CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD"/> + <int value="8" + label="CPMD_BAD_ORIGIN_SAVE_GENERATION_FIELD_DETECTED_BY_CLASSIFIER"/> </enum> <enum name="BadSyncDataReason" type="int">
diff --git a/tools/perf/benchmarks/tracing.py b/tools/perf/benchmarks/tracing.py index 95cc44d..f62942f9 100644 --- a/tools/perf/benchmarks/tracing.py +++ b/tools/perf/benchmarks/tracing.py
@@ -4,6 +4,9 @@ from core import perf_benchmark +from telemetry import benchmark +from telemetry.timeline import tracing_category_filter +from telemetry.timeline import tracing_config from telemetry.web_perf import timeline_based_measurement import page_sets @@ -22,3 +25,27 @@ @classmethod def Name(cls): return 'tracing.tracing_with_debug_overhead' + + +# TODO(ssid): Enable on reference builds once stable browser starts supporting +# background mode memory-infra. crbug.com/621195. +@benchmark.Disabled('reference') +class TracingWithBackgroundMemoryInfra(perf_benchmark.PerfBenchmark): + """Measures the overhead of background memory-infra dumps""" + page_set = page_sets.Top10PageSet + + def CreateTimelineBasedMeasurementOptions(self): + # Enable only memory-infra category with periodic background mode dumps + # every 200 milliseconds. + trace_memory = tracing_category_filter.TracingCategoryFilter( + filter_string='-*,blink.console,disabled-by-default-memory-infra') + options = timeline_based_measurement.Options(overhead_level=trace_memory) + memory_dump_config = tracing_config.MemoryDumpConfig() + memory_dump_config.AddTrigger('background', 200) + options.config.SetMemoryDumpConfig(memory_dump_config) + options.SetTimelineBasedMetric('tracingMetric') + return options + + @classmethod + def Name(cls): + return 'tracing.tracing_with_background_memory_infra'