diff --git a/chrome/VERSION b/chrome/VERSION index c174c882..fd1acbf 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=59 MINOR=0 -BUILD=3040 +BUILD=3041 PATCH=0
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 43eaf42..6b3eea4 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -100,7 +100,7 @@ base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kAndroidPaymentApps{"AndroidPaymentApps", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kAndroidPaymentAppsFilter{ "AndroidPaymentAppsFilter", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 338d2e8..add454a7 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3231,6 +3231,7 @@ content::ServiceInfo info; info.factory = base::Bind(&ash_util::CreateEmbeddedAshService, base::ThreadTaskRunnerHandle::Get()); + info.task_runner = base::ThreadTaskRunnerHandle::Get(); services->insert(std::make_pair(ash::mojom::kServiceName, info)); } #endif // OS_CHROMEOS
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter_unittest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter_unittest.cc index f1a950c8..2d471da 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter_unittest.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter_unittest.cc
@@ -4,9 +4,13 @@ #include "chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.h" +#include <memory> +#include <vector> + #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" #include "ui/events/event.h" @@ -24,13 +28,15 @@ void OnEvent(ui::Event* event) override { if (event->IsKeyEvent()) - events_.push_back(new ui::KeyEvent(*event->AsKeyEvent())); + events_.push_back(base::MakeUnique<ui::KeyEvent>(*event->AsKeyEvent())); } - const ScopedVector<ui::KeyEvent>& captured_events() const { return events_; } + const std::vector<std::unique_ptr<ui::KeyEvent>>& captured_events() const { + return events_; + } private: - ScopedVector<ui::KeyEvent> events_; + std::vector<std::unique_ptr<ui::KeyEvent>> events_; DISALLOW_COPY_AND_ASSIGN(EventCapturer); };
diff --git a/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.cc b/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.cc index ab8aa26..2890d88 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -103,7 +104,7 @@ KioskSessionPluginHandler::~KioskSessionPluginHandler() {} void KioskSessionPluginHandler::Observe(content::WebContents* contents) { - watchers_.push_back(new Observer(contents, this)); + watchers_.push_back(base::MakeUnique<Observer>(contents, this)); } void KioskSessionPluginHandler::OnPluginCrashed( @@ -117,14 +118,18 @@ } void KioskSessionPluginHandler::OnWebContentsDestroyed(Observer* observer) { - auto it = std::find(watchers_.begin(), watchers_.end(), observer); - if (it == watchers_.end()) - return; + for (auto it = watchers_.begin(); it != watchers_.end(); ++it) { + if (it->get() == observer) { + it->release(); + watchers_.erase(it); - watchers_.weak_erase(it); + // Schedule the delete later after |observer|'s WebContentsDestroyed + // finishes. + base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, observer); - // Schedule the delete later after |observer|'s WebContentsDestroyed finishes. - base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, observer); + return; + } + } } } // namespace chromeos
diff --git a/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.h b/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.h index b95dfac3..6565ec1b 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.h +++ b/chrome/browser/chromeos/app_mode/kiosk_session_plugin_handler.h
@@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_SESSION_PLUGIN_HANDLER_H_ #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_SESSION_PLUGIN_HANDLER_H_ +#include <memory> #include <set> +#include <vector> #include "base/macros.h" -#include "base/memory/scoped_vector.h" namespace base { class FilePath; @@ -41,7 +42,7 @@ void OnWebContentsDestroyed(Observer* observer); KioskSessionPluginHandlerDelegate* const delegate_; - ScopedVector<Observer> watchers_; + std::vector<std::unique_ptr<Observer>> watchers_; DISALLOW_COPY_AND_ASSIGN(KioskSessionPluginHandler); };
diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc index 233857b..f2fb03b 100644 --- a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc +++ b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc
@@ -5,12 +5,14 @@ #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h" #include <stddef.h> + #include <algorithm> #include <cstring> #include <utility> #include "base/callback_helpers.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/sequenced_task_runner.h" #include "components/drive/chromeos/file_system_interface.h" #include "components/drive/drive.pb.h" @@ -66,8 +68,9 @@ // Copies the content in |pending_data| into |buffer| at most // |buffer_length| bytes, and erases the copied data from // |pending_data|. Returns the number of copied bytes. -int ReadInternal(ScopedVector<std::string>* pending_data, - net::IOBuffer* buffer, int buffer_length) { +int ReadInternal(std::vector<std::unique_ptr<std::string>>* pending_data, + net::IOBuffer* buffer, + int buffer_length) { size_t index = 0; int offset = 0; for (; index < pending_data->size() && offset < buffer_length; ++index) { @@ -234,7 +237,7 @@ remaining_offset_ = 0; } - pending_data_.push_back(data.release()); + pending_data_.push_back(std::move(data)); if (!buffer_.get()) { // No pending Read operation. return;
diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader.h b/chrome/browser/chromeos/drive/drive_file_stream_reader.h index 4e7d2f1a..ce7e13a 100644 --- a/chrome/browser/chromeos/drive/drive_file_stream_reader.h +++ b/chrome/browser/chromeos/drive/drive_file_stream_reader.h
@@ -9,11 +9,11 @@ #include <memory> #include <string> +#include <vector> #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" #include "base/threading/thread_checker.h" #include "components/drive/file_errors.h" #include "google_apis/drive/drive_api_error_codes.h" @@ -111,7 +111,7 @@ private: // The data received from the server, but not yet read. - ScopedVector<std::string> pending_data_; + std::vector<std::unique_ptr<std::string>> pending_data_; // The number of bytes to be skipped. int64_t remaining_offset_;
diff --git a/chrome/browser/chromeos/events/event_rewriter_controller.cc b/chrome/browser/chromeos/events/event_rewriter_controller.cc index b29e774..6d41869 100644 --- a/chrome/browser/chromeos/events/event_rewriter_controller.cc +++ b/chrome/browser/chromeos/events/event_rewriter_controller.cc
@@ -4,7 +4,10 @@ #include "chrome/browser/chromeos/events/event_rewriter_controller.h" +#include <utility> + #include "ash/shell.h" +#include "base/memory/ptr_util.h" #include "ui/aura/env.h" #include "ui/aura/window_tree_host.h" #include "ui/events/event_source.h" @@ -19,15 +22,10 @@ EventRewriterController::~EventRewriterController() { aura::Env::GetInstance()->RemoveObserver(this); // Remove the rewriters from every root window EventSource and destroy them. - for (EventRewriters::iterator rewriter_iter = rewriters_.begin(); - rewriter_iter != rewriters_.end(); - ++rewriter_iter) { + for (const auto& rewriter : rewriters_) { aura::Window::Windows windows = ash::Shell::GetAllRootWindows(); - for (aura::Window::Windows::iterator window_iter = windows.begin(); - window_iter != windows.end(); - ++window_iter) { - (*window_iter)->GetHost()->GetEventSource()->RemoveEventRewriter( - *rewriter_iter); + for (auto* window : windows) { + window->GetHost()->GetEventSource()->RemoveEventRewriter(rewriter.get()); } } rewriters_.clear(); @@ -36,7 +34,7 @@ void EventRewriterController::AddEventRewriter( std::unique_ptr<ui::EventRewriter> rewriter) { DCHECK(!initialized_); - rewriters_.push_back(rewriter.release()); + rewriters_.push_back(std::move(rewriter)); } void EventRewriterController::Init() { @@ -44,10 +42,8 @@ initialized_ = true; // Add the rewriters to each existing root window EventSource. aura::Window::Windows windows = ash::Shell::GetAllRootWindows(); - for (aura::Window::Windows::iterator it = windows.begin(); - it != windows.end(); - ++it) { - AddToEventSource((*it)->GetHost()->GetEventSource()); + for (auto* window : windows) { + AddToEventSource(window->GetHost()->GetEventSource()); } } @@ -58,9 +54,8 @@ void EventRewriterController::AddToEventSource(ui::EventSource* source) { DCHECK(source); - for (EventRewriters::iterator it = rewriters_.begin(); it != rewriters_.end(); - ++it) { - source->AddEventRewriter(*it); + for (const auto& rewriter : rewriters_) { + source->AddEventRewriter(rewriter.get()); } }
diff --git a/chrome/browser/chromeos/events/event_rewriter_controller.h b/chrome/browser/chromeos/events/event_rewriter_controller.h index 1d38430..e234314c 100644 --- a/chrome/browser/chromeos/events/event_rewriter_controller.h +++ b/chrome/browser/chromeos/events/event_rewriter_controller.h
@@ -10,7 +10,6 @@ #include <vector> #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "ui/aura/env_observer.h" #include "ui/events/event_rewriter.h" @@ -40,13 +39,10 @@ void OnHostInitialized(aura::WindowTreeHost* host) override; private: - typedef std::list<ui::EventSource*> EventSourceList; - typedef ScopedVector<ui::EventRewriter> EventRewriters; - void AddToEventSource(ui::EventSource* source); // The |EventRewriter|s managed by this controller. - EventRewriters rewriters_; + std::vector<std::unique_ptr<ui::EventRewriter>> rewriters_; // Whether the owned event rewriters have been added to existing // root windows; after this no more rewriters can be added.
diff --git a/chrome/browser/chromeos/events/event_rewriter_unittest.cc b/chrome/browser/chromeos/events/event_rewriter_unittest.cc index da755cd..460d8e61 100644 --- a/chrome/browser/chromeos/events/event_rewriter_unittest.cc +++ b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
@@ -14,6 +14,7 @@ #include "ash/wm/window_state_aura.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h" @@ -1950,7 +1951,7 @@ EventBuffer() {} ~EventBuffer() override {} - void PopEvents(ScopedVector<ui::Event>* events) { + void PopEvents(std::vector<std::unique_ptr<ui::Event>>* events) { events->clear(); events->swap(events_); } @@ -1962,7 +1963,7 @@ return ui::EventDispatchDetails(); } - ScopedVector<ui::Event> events_; + std::vector<std::unique_ptr<ui::Event>> events_; DISALLOW_COPY_AND_ASSIGN(EventBuffer); }; @@ -2019,7 +2020,9 @@ protected: sync_preferences::TestingPrefServiceSyncable* prefs() { return &prefs_; } - void PopEvents(ScopedVector<ui::Event>* events) { buffer_.PopEvents(events); } + void PopEvents(std::vector<std::unique_ptr<ui::Event>>* events) { + buffer_.PopEvents(events); + } void SetUp() override { AshTestBase::SetUp(); @@ -2060,7 +2063,7 @@ std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(1)); ash::wm::WindowState* window_state = ash::wm::GetWindowState(window.get()); window_state->Activate(); - ScopedVector<ui::Event> events; + std::vector<std::unique_ptr<ui::Event>> events; // Create a simulated keypress of F1 targetted at the window. ui::KeyEvent press_f1(ui::ET_KEY_PRESSED, ui::VKEY_F1, ui::DomCode::F1, @@ -2078,7 +2081,7 @@ EXPECT_EQ( GetExpectedResultAsString(ui::ET_KEY_PRESSED, ui::VKEY_F1, ui::DomCode::F1, ui::EF_NONE, ui::DomKey::F1), - GetKeyEventAsString(*static_cast<ui::KeyEvent*>(events[0]))); + GetKeyEventAsString(*static_cast<ui::KeyEvent*>(events[0].get()))); // If the pref isn't set when an event is sent to a regular window, F1 is // rewritten to the back key. @@ -2090,7 +2093,7 @@ EXPECT_EQ(GetExpectedResultAsString(ui::ET_KEY_PRESSED, ui::VKEY_BROWSER_BACK, ui::DomCode::BROWSER_BACK, ui::EF_NONE, ui::DomKey::BROWSER_BACK), - GetKeyEventAsString(*static_cast<ui::KeyEvent*>(events[0]))); + GetKeyEventAsString(*static_cast<ui::KeyEvent*>(events[0].get()))); } TEST_F(EventRewriterTest, TestRewrittenModifierClick) { @@ -2337,7 +2340,7 @@ TEST_F(EventRewriterAshTest, StickyKeyEventDispatchImpl) { // Test the actual key event dispatch implementation. - ScopedVector<ui::Event> events; + std::vector<std::unique_ptr<ui::Event>> events; SendActivateStickyKeyPattern(ui::VKEY_CONTROL, ui::DomCode::CONTROL_LEFT, ui::DomKey::CONTROL); @@ -2345,7 +2348,7 @@ EXPECT_EQ(1u, events.size()); EXPECT_EQ(ui::ET_KEY_PRESSED, events[0]->type()); EXPECT_EQ(ui::VKEY_CONTROL, - static_cast<ui::KeyEvent*>(events[0])->key_code()); + static_cast<ui::KeyEvent*>(events[0].get())->key_code()); // Test key press event is correctly modified and modifier release // event is sent. @@ -2356,11 +2359,12 @@ PopEvents(&events); EXPECT_EQ(2u, events.size()); EXPECT_EQ(ui::ET_KEY_PRESSED, events[0]->type()); - EXPECT_EQ(ui::VKEY_C, static_cast<ui::KeyEvent*>(events[0])->key_code()); + EXPECT_EQ(ui::VKEY_C, + static_cast<ui::KeyEvent*>(events[0].get())->key_code()); EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type()); EXPECT_EQ(ui::VKEY_CONTROL, - static_cast<ui::KeyEvent*>(events[1])->key_code()); + static_cast<ui::KeyEvent*>(events[1].get())->key_code()); // Test key release event is not modified. ui::KeyEvent release(ui::ET_KEY_RELEASED, ui::VKEY_C, ui::DomCode::US_C, @@ -2371,12 +2375,13 @@ PopEvents(&events); EXPECT_EQ(1u, events.size()); EXPECT_EQ(ui::ET_KEY_RELEASED, events[0]->type()); - EXPECT_EQ(ui::VKEY_C, static_cast<ui::KeyEvent*>(events[0])->key_code()); + EXPECT_EQ(ui::VKEY_C, + static_cast<ui::KeyEvent*>(events[0].get())->key_code()); EXPECT_FALSE(events[0]->flags() & ui::EF_CONTROL_DOWN); } TEST_F(EventRewriterAshTest, MouseEventDispatchImpl) { - ScopedVector<ui::Event> events; + std::vector<std::unique_ptr<ui::Event>> events; SendActivateStickyKeyPattern(ui::VKEY_CONTROL, ui::DomCode::CONTROL_LEFT, ui::DomKey::CONTROL); @@ -2407,11 +2412,11 @@ EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type()); EXPECT_EQ(ui::VKEY_CONTROL, - static_cast<ui::KeyEvent*>(events[1])->key_code()); + static_cast<ui::KeyEvent*>(events[1].get())->key_code()); } TEST_F(EventRewriterAshTest, MouseWheelEventDispatchImpl) { - ScopedVector<ui::Event> events; + std::vector<std::unique_ptr<ui::Event>> events; // Test positive mouse wheel event is correctly modified and modifier release // event is sent. @@ -2431,7 +2436,7 @@ EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type()); EXPECT_EQ(ui::VKEY_CONTROL, - static_cast<ui::KeyEvent*>(events[1])->key_code()); + static_cast<ui::KeyEvent*>(events[1].get())->key_code()); // Test negative mouse wheel event is correctly modified and modifier release // event is sent. @@ -2450,7 +2455,7 @@ EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type()); EXPECT_EQ(ui::VKEY_CONTROL, - static_cast<ui::KeyEvent*>(events[1])->key_code()); + static_cast<ui::KeyEvent*>(events[1].get())->key_code()); } // Tests that if modifier keys are remapped, the flags of a mouse wheel event @@ -2463,7 +2468,7 @@ // Generate a mouse wheel event that has a CONTROL_DOWN modifier flag and // expect that it will be rewritten to ALT_DOWN. - ScopedVector<ui::Event> events; + std::vector<std::unique_ptr<ui::Event>> events; gfx::Point location(0, 0); ui::MouseWheelEvent positive( gfx::Vector2d(0, ui::MouseWheelEvent::kWheelDelta), location, location,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc index 048bc80..41a9982 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_TRUE(abort.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ(extensions::api::file_system_provider::OnAbortRequested::kEventName, event->event_name); base::ListValue* event_args = event->event_args.get();
diff --git a/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc index 8f7e252..17b3c57 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_TRUE(add_watcher.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnAddWatcherRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc index e4cfe07bc..d74256b 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_TRUE(close_file.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnCloseFileRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc index 9a635078..b517516e 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc
@@ -59,7 +59,7 @@ EXPECT_TRUE(configure.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnConfigureRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc index 7e21912..dc560bd9 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc
@@ -66,7 +66,7 @@ EXPECT_TRUE(copy_entry.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnCopyEntryRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc index ba68288..38bd09d 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
@@ -65,7 +65,7 @@ EXPECT_TRUE(create_directory.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ(extensions::api::file_system_provider::OnCreateDirectoryRequested:: kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc index f4a151f..b3ef929 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_TRUE(create_file.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnCreateFileRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc index 27dbb782..a64bb080 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
@@ -64,7 +64,7 @@ EXPECT_TRUE(delete_entry.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnDeleteEntryRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc index b071ac2..209feae 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc
@@ -70,7 +70,7 @@ EXPECT_TRUE(execute_action.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ(extensions::api::file_system_provider::OnExecuteActionRequested:: kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc index a76a663..1393705 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc
@@ -13,7 +13,7 @@ #include "base/files/file_path.h" #include "base/json/json_reader.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/ptr_util.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h" #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" @@ -59,13 +59,13 @@ virtual ~CallbackLogger() {} void OnGetActions(const Actions& actions, base::File::Error result) { - events_.push_back(new Event(actions, result)); + events_.push_back(base::MakeUnique<Event>(actions, result)); } - const ScopedVector<Event>& events() const { return events_; } + const std::vector<std::unique_ptr<Event>>& events() const { return events_; } private: - ScopedVector<Event> events_; + std::vector<std::unique_ptr<Event>> events_; DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; @@ -127,7 +127,7 @@ EXPECT_TRUE(get_actions.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnGetActionsRequested::kEventName, event->event_name); @@ -203,7 +203,7 @@ get_actions.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_OK, event->result()); ASSERT_EQ(3u, event->actions().size()); @@ -238,7 +238,7 @@ base::File::FILE_ERROR_TOO_MANY_OPENED); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result()); ASSERT_EQ(0u, event->actions().size()); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc index 86cf990..dd442651 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
@@ -7,12 +7,13 @@ #include <memory> #include <string> #include <utility> +#include <vector> #include "base/files/file.h" #include "base/files/file_path.h" #include "base/json/json_reader.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/ptr_util.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" #include "chrome/common/extensions/api/file_system_provider.h" @@ -81,13 +82,13 @@ void OnGetMetadata(std::unique_ptr<EntryMetadata> metadata, base::File::Error result) { - events_.push_back(new Event(std::move(metadata), result)); + events_.push_back(base::MakeUnique<Event>(std::move(metadata), result)); } - const ScopedVector<Event>& events() const { return events_; } + const std::vector<std::unique_ptr<Event>>& events() const { return events_; } private: - ScopedVector<Event> events_; + std::vector<std::unique_ptr<Event>> events_; DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; @@ -237,7 +238,7 @@ EXPECT_TRUE(get_metadata.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnGetMetadataRequested::kEventName, event->event_name); @@ -318,7 +319,7 @@ get_metadata.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_OK, event->result()); const EntryMetadata* metadata = event->metadata(); @@ -379,7 +380,7 @@ get_metadata.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_IO, event->result()); const EntryMetadata* metadata = event->metadata(); @@ -406,7 +407,7 @@ base::File::FILE_ERROR_TOO_MANY_OPENED); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result()); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc index 31814a6..629da1e2 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc
@@ -67,7 +67,7 @@ EXPECT_TRUE(move_entry.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnMoveEntryRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc index d7fce02..bd30779 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
@@ -11,7 +11,7 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" #include "chrome/common/extensions/api/file_system_provider.h" @@ -55,13 +55,13 @@ virtual ~CallbackLogger() {} void OnOpenFile(int file_handle, base::File::Error result) { - events_.push_back(new Event(file_handle, result)); + events_.push_back(base::MakeUnique<Event>(file_handle, result)); } - ScopedVector<Event>& events() { return events_; } + std::vector<std::unique_ptr<Event>>& events() { return events_; } private: - ScopedVector<Event> events_; + std::vector<std::unique_ptr<Event>> events_; DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; @@ -100,7 +100,7 @@ EXPECT_TRUE(open_file.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnOpenFileRequested::kEventName, event->event_name); @@ -188,7 +188,7 @@ std::unique_ptr<RequestValue>(new RequestValue()), false /* has_more */); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_OK, event->result()); EXPECT_LT(0, event->file_handle()); } @@ -211,7 +211,7 @@ std::unique_ptr<RequestValue>(new RequestValue()), base::File::FILE_ERROR_TOO_MANY_OPENED); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result()); ASSERT_EQ(0, event->file_handle()); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc index f785f4d..ed342aa 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
@@ -7,12 +7,13 @@ #include <memory> #include <string> #include <utility> +#include <vector> #include "base/files/file.h" #include "base/files/file_path.h" #include "base/json/json_reader.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/ptr_util.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h" #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" @@ -65,13 +66,13 @@ void OnReadDirectory(base::File::Error result, const storage::AsyncFileUtil::EntryList& entry_list, bool has_more) { - events_.push_back(new Event(result, entry_list, has_more)); + events_.push_back(base::MakeUnique<Event>(result, entry_list, has_more)); } - ScopedVector<Event>& events() { return events_; } + std::vector<std::unique_ptr<Event>>& events() { return events_; } private: - ScopedVector<Event> events_; + std::vector<std::unique_ptr<Event>> events_; DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; @@ -130,7 +131,7 @@ EXPECT_TRUE(read_directory.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ(extensions::api::file_system_provider::OnReadDirectoryRequested:: kEventName, event->event_name); @@ -200,7 +201,7 @@ read_directory.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_OK, event->result()); ASSERT_EQ(1u, event->entry_list().size()); @@ -247,7 +248,7 @@ read_directory.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_IO, event->result()); EXPECT_EQ(0u, event->entry_list().size()); @@ -272,7 +273,7 @@ base::File::FILE_ERROR_TOO_MANY_OPENED); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result()); ASSERT_EQ(0u, event->entry_list().size()); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc index 4578cc69..18fd5f6 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
@@ -11,8 +11,8 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" #include "chrome/common/extensions/api/file_system_provider.h" @@ -60,13 +60,13 @@ virtual ~CallbackLogger() {} void OnReadFile(int chunk_length, bool has_more, base::File::Error result) { - events_.push_back(new Event(chunk_length, has_more, result)); + events_.push_back(base::MakeUnique<Event>(chunk_length, has_more, result)); } - ScopedVector<Event>& events() { return events_; } + std::vector<std::unique_ptr<Event>>& events() { return events_; } private: - ScopedVector<Event> events_; + std::vector<std::unique_ptr<Event>> events_; DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; @@ -111,7 +111,7 @@ EXPECT_TRUE(read_file.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnReadFileRequested::kEventName, event->event_name); @@ -191,7 +191,7 @@ read_file.OnSuccess(kRequestId, std::move(request_value), has_more); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(kLength, event->chunk_length()); EXPECT_FALSE(event->has_more()); EXPECT_EQ(data, std::string(io_buffer_->data(), kLength)); @@ -221,7 +221,7 @@ base::File::FILE_ERROR_TOO_MANY_OPENED); ASSERT_EQ(1u, callback_logger.events().size()); - CallbackLogger::Event* event = callback_logger.events()[0]; + CallbackLogger::Event* event = callback_logger.events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result()); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc index a856b18..51c755aa 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_TRUE(remove_watcher.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ(extensions::api::file_system_provider::OnRemoveWatcherRequested:: kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/test_util.cc b/chrome/browser/chromeos/file_system_provider/operations/test_util.cc index 265607f..a5dd70ad 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/test_util.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/test_util.cc
@@ -3,6 +3,9 @@ // found in the LICENSE file. #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" + +#include <utility> + #include "extensions/browser/event_router.h" namespace chromeos { @@ -19,7 +22,7 @@ bool LoggingDispatchEventImpl::OnDispatchEventImpl( std::unique_ptr<extensions::Event> event) { - events_.push_back(event->DeepCopy()); + events_.push_back(std::move(event)); return dispatch_reply_; }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/test_util.h b/chrome/browser/chromeos/file_system_provider/operations/test_util.h index 4bd6f0c7..cbae6470 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/test_util.h +++ b/chrome/browser/chromeos/file_system_provider/operations/test_util.h
@@ -10,7 +10,6 @@ #include "base/files/file.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" namespace extensions { struct Event; @@ -32,10 +31,10 @@ bool OnDispatchEventImpl(std::unique_ptr<extensions::Event> event); // Returns events sent to providing extensions. - ScopedVector<extensions::Event>& events() { return events_; } + std::vector<std::unique_ptr<extensions::Event>>& events() { return events_; } private: - ScopedVector<extensions::Event> events_; + std::vector<std::unique_ptr<extensions::Event>> events_; bool dispatch_reply_; DISALLOW_COPY_AND_ASSIGN(LoggingDispatchEventImpl);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc index d533105..e46bcb1 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
@@ -67,7 +67,7 @@ EXPECT_TRUE(truncate.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnTruncateRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc index 9b61682..24b2624 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
@@ -60,7 +60,7 @@ EXPECT_TRUE(unmount.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnUnmountRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc index 1708cbfa..c78093eb 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc
@@ -74,7 +74,7 @@ EXPECT_TRUE(write_file.Execute(kRequestId)); ASSERT_EQ(1u, dispatcher.events().size()); - extensions::Event* event = dispatcher.events()[0]; + extensions::Event* event = dispatcher.events()[0].get(); EXPECT_EQ( extensions::api::file_system_provider::OnWriteFileRequested::kEventName, event->event_name);
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc index 6594219..3724b01 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
@@ -13,7 +13,6 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" #include "base/run_loop.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" @@ -143,7 +142,8 @@ const ProvidedFileSystemObserver::Changes& changes, const base::Closure& callback) override { EXPECT_EQ(kFileSystemId, file_system_info.file_system_id()); - change_events_.push_back(new ChangeEvent(change_type, changes)); + change_events_.push_back( + base::MakeUnique<ChangeEvent>(change_type, changes)); complete_callback_ = callback; } @@ -168,13 +168,13 @@ } int list_changed_counter() const { return list_changed_counter_; } - const ScopedVector<ChangeEvent>& change_events() const { + const std::vector<std::unique_ptr<ChangeEvent>>& change_events() const { return change_events_; } int tag_updated_counter() const { return tag_updated_counter_; } private: - ScopedVector<ChangeEvent> change_events_; + std::vector<std::unique_ptr<ChangeEvent>> change_events_; int list_changed_counter_; int tag_updated_counter_; base::Closure complete_callback_; @@ -763,7 +763,7 @@ // Verify the observer event. ASSERT_EQ(1u, observer.change_events().size()); const Observer::ChangeEvent* const change_event = - observer.change_events()[0]; + observer.change_events()[0].get(); EXPECT_EQ(change_type, change_event->change_type()); EXPECT_EQ(0u, change_event->changes().size()); @@ -816,7 +816,7 @@ // Verify the observer event. ASSERT_EQ(2u, observer.change_events().size()); const Observer::ChangeEvent* const change_event = - observer.change_events()[1]; + observer.change_events()[1].get(); EXPECT_EQ(change_type, change_event->change_type()); EXPECT_EQ(0u, change_event->changes().size()); }
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc index 121c610..c4bbc46a 100644 --- a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
@@ -18,7 +18,6 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ptr_util.h" -#include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" #include "chrome/browser/chromeos/file_system_provider/notification_manager_interface.h" @@ -132,35 +131,41 @@ virtual ~EventLogger() {} void OnExecute(int request_id) { - execute_events_.push_back(new ExecuteEvent(request_id)); + execute_events_.push_back(base::MakeUnique<ExecuteEvent>(request_id)); } void OnSuccess(int request_id, std::unique_ptr<RequestValue> result, bool has_more) { - success_events_.push_back( - new SuccessEvent(request_id, std::move(result), has_more)); + success_events_.push_back(base::MakeUnique<SuccessEvent>( + request_id, std::move(result), has_more)); } void OnError(int request_id, std::unique_ptr<RequestValue> result, base::File::Error error) { error_events_.push_back( - new ErrorEvent(request_id, std::move(result), error)); + base::MakeUnique<ErrorEvent>(request_id, std::move(result), error)); } - ScopedVector<ExecuteEvent>& execute_events() { return execute_events_; } - ScopedVector<SuccessEvent>& success_events() { return success_events_; } - ScopedVector<ErrorEvent>& error_events() { return error_events_; } + std::vector<std::unique_ptr<ExecuteEvent>>& execute_events() { + return execute_events_; + } + std::vector<std::unique_ptr<SuccessEvent>>& success_events() { + return success_events_; + } + std::vector<std::unique_ptr<ErrorEvent>>& error_events() { + return error_events_; + } base::WeakPtr<EventLogger> GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } private: - ScopedVector<ExecuteEvent> execute_events_; - ScopedVector<SuccessEvent> success_events_; - ScopedVector<ErrorEvent> error_events_; + std::vector<std::unique_ptr<ExecuteEvent>> execute_events_; + std::vector<std::unique_ptr<SuccessEvent>> success_events_; + std::vector<std::unique_ptr<ErrorEvent>> error_events_; base::WeakPtrFactory<EventLogger> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(EventLogger); @@ -399,7 +404,7 @@ // Validate if the callback has correct arguments. ASSERT_EQ(1u, logger.success_events().size()); EXPECT_EQ(0u, logger.error_events().size()); - EventLogger::SuccessEvent* event = logger.success_events()[0]; + EventLogger::SuccessEvent* event = logger.success_events()[0].get(); ASSERT_TRUE(event->result()); const std::string* response_test_string = event->result()->testing_params(); ASSERT_TRUE(response_test_string); @@ -465,7 +470,7 @@ // Validate if the callback has correct arguments. ASSERT_EQ(1u, logger.success_events().size()); EXPECT_EQ(0u, logger.error_events().size()); - EventLogger::SuccessEvent* event = logger.success_events()[0]; + EventLogger::SuccessEvent* event = logger.success_events()[0].get(); EXPECT_TRUE(event->result()); EXPECT_TRUE(event->has_more()); @@ -543,7 +548,7 @@ // Validate if the callback has correct arguments. ASSERT_EQ(1u, logger.error_events().size()); EXPECT_EQ(0u, logger.success_events().size()); - EventLogger::ErrorEvent* event = logger.error_events()[0]; + EventLogger::ErrorEvent* event = logger.error_events()[0].get(); EXPECT_EQ(error, event->error()); ASSERT_EQ(1u, observer.rejected().size()); @@ -719,7 +724,7 @@ // All active requests should be aborted in the destructor of RequestManager. ASSERT_EQ(1u, logger.error_events().size()); - EventLogger::ErrorEvent* event = logger.error_events()[0]; + EventLogger::ErrorEvent* event = logger.error_events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_ABORT, event->error()); EXPECT_EQ(0u, logger.success_events().size()); @@ -763,7 +768,7 @@ EXPECT_EQ(0u, notification_manager_->size()); ASSERT_EQ(1u, logger.error_events().size()); - EventLogger::ErrorEvent* event = logger.error_events()[0]; + EventLogger::ErrorEvent* event = logger.error_events()[0].get(); EXPECT_EQ(base::File::FILE_ERROR_ABORT, event->error()); ASSERT_EQ(1u, observer.rejected().size());
diff --git a/chrome/browser/chromeos/login/login_ui_browsertest.cc b/chrome/browser/chromeos/login/login_ui_browsertest.cc index 8ee0126..2903662 100644 --- a/chrome/browser/chromeos/login/login_ui_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_browsertest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/login/login_manager_test.h" @@ -36,7 +37,7 @@ screenshot_testing_->IgnoreArea(areas::kClockArea); screenshot_testing_->IgnoreArea(areas::kFirstUserpod); screenshot_testing_->IgnoreArea(areas::kSecondUserpod); - AddMixin(screenshot_testing_); + AddMixin(base::WrapUnique(screenshot_testing_)); } ~LoginUITest() override {}
diff --git a/chrome/browser/chromeos/login/mixin_based_browser_test.cc b/chrome/browser/chromeos/login/mixin_based_browser_test.cc index 765f8ab..4d6cbe22 100644 --- a/chrome/browser/chromeos/login/mixin_based_browser_test.cc +++ b/chrome/browser/chromeos/login/mixin_based_browser_test.cc
@@ -4,6 +4,10 @@ #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" +#include <utility> + +#include "base/containers/adapters.h" + namespace chromeos { MixinBasedBrowserTest::MixinBasedBrowserTest() : setup_was_launched_(false) { @@ -14,52 +18,43 @@ void MixinBasedBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { setup_was_launched_ = true; - for (ScopedVector<Mixin>::iterator it = mixins_.begin(); it != mixins_.end(); - ++it) { - (*it)->SetUpCommandLine(command_line); - } + for (const auto& mixin : mixins_) + mixin->SetUpCommandLine(command_line); + InProcessBrowserTest::SetUpCommandLine(command_line); } void MixinBasedBrowserTest::SetUpInProcessBrowserTestFixture() { setup_was_launched_ = true; - for (ScopedVector<Mixin>::iterator it = mixins_.begin(); it != mixins_.end(); - ++it) { - (*it)->SetUpInProcessBrowserTestFixture(); - } + for (const auto& mixin : mixins_) + mixin->SetUpInProcessBrowserTestFixture(); + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); } void MixinBasedBrowserTest::SetUpOnMainThread() { setup_was_launched_ = true; - for (ScopedVector<Mixin>::iterator it = mixins_.begin(); it != mixins_.end(); - ++it) { - (*it)->SetUpOnMainThread(); - } + for (const auto& mixin : mixins_) + mixin->SetUpOnMainThread(); + InProcessBrowserTest::SetUpOnMainThread(); } void MixinBasedBrowserTest::TearDownOnMainThread() { InProcessBrowserTest::TearDownOnMainThread(); - for (ScopedVector<Mixin>::reverse_iterator it = mixins_.rbegin(); - it != mixins_.rend(); - ++it) { - (*it)->TearDownInProcessBrowserTestFixture(); - } + for (const auto& mixin : base::Reversed(mixins_)) + mixin->TearDownInProcessBrowserTestFixture(); } void MixinBasedBrowserTest::TearDownInProcessBrowserTestFixture() { InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); - for (ScopedVector<Mixin>::reverse_iterator it = mixins_.rbegin(); - it != mixins_.rend(); - ++it) { - (*it)->TearDownInProcessBrowserTestFixture(); - } + for (const auto& mixin : base::Reversed(mixins_)) + mixin->TearDownInProcessBrowserTestFixture(); } -void MixinBasedBrowserTest::AddMixin(MixinBasedBrowserTest::Mixin* mixin) { +void MixinBasedBrowserTest::AddMixin(std::unique_ptr<Mixin> mixin) { CHECK(!setup_was_launched_) << "You are trying to add a mixin after setting up has already started."; - mixins_.push_back(mixin); + mixins_.push_back(std::move(mixin)); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/mixin_based_browser_test.h b/chrome/browser/chromeos/login/mixin_based_browser_test.h index 856c8cf..9d32795 100644 --- a/chrome/browser/chromeos/login/mixin_based_browser_test.h +++ b/chrome/browser/chromeos/login/mixin_based_browser_test.h
@@ -5,7 +5,9 @@ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MIXIN_BASED_BROWSER_TEST_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_MIXIN_BASED_BROWSER_TEST_H_ -#include "base/memory/scoped_vector.h" +#include <memory> +#include <vector> + #include "chrome/test/base/in_process_browser_test.h" namespace chromeos { @@ -69,11 +71,11 @@ // for it to MixinBasedBrowserTest. // Should be called in constructor of the test (should be already completed // before running set ups). - void AddMixin(Mixin* mixin); + void AddMixin(std::unique_ptr<Mixin> mixin); private: // Keeps all the mixins for this test, - ScopedVector<Mixin> mixins_; + std::vector<std::unique_ptr<Mixin>> mixins_; // Is false initially, becomes true when any of SetUp* methods is called. // Required to check that AddMixin is always called before setting up.
diff --git a/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc b/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc index aa3f4c6..09b79b9 100644 --- a/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc +++ b/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc
@@ -4,9 +4,10 @@ #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" -#include <memory> +#include <utility> #include "base/bind.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_delegate.h" #include "chrome/browser/chromeos/policy/policy_cert_service.h" #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" @@ -170,7 +171,7 @@ base::Bind(&MultiProfileUserController::OnUserPrefChanged, base::Unretained(this), user_profile)); - pref_watchers_.push_back(registrar.release()); + pref_watchers_.push_back(std::move(registrar)); OnUserPrefChanged(user_profile); }
diff --git a/chrome/browser/chromeos/login/users/multi_profile_user_controller.h b/chrome/browser/chromeos/login/users/multi_profile_user_controller.h index a33a158..5baf14ff 100644 --- a/chrome/browser/chromeos/login/users/multi_profile_user_controller.h +++ b/chrome/browser/chromeos/login/users/multi_profile_user_controller.h
@@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ +#include <memory> #include <string> +#include <vector> #include "base/macros.h" -#include "base/memory/scoped_vector.h" class PrefChangeRegistrar; class PrefRegistrySimple; @@ -101,7 +102,7 @@ MultiProfileUserControllerDelegate* delegate_; // Not owned. PrefService* local_state_; // Not owned. - ScopedVector<PrefChangeRegistrar> pref_watchers_; + std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_watchers_; DISALLOW_COPY_AND_ASSIGN(MultiProfileUserController); };
diff --git a/chrome/browser/chromeos/login/version_info_updater.cc b/chrome/browser/chromeos/login/version_info_updater.cc index 0e2d6a9..a1d417f04 100644 --- a/chrome/browser/chromeos/login/version_info_updater.cc +++ b/chrome/browser/chromeos/login/version_info_updater.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/sys_info.h" @@ -89,8 +90,7 @@ base::Unretained(this)); for (unsigned int i = 0; i < arraysize(kReportingFlags); ++i) { subscriptions_.push_back( - cros_settings_->AddSettingsObserver(kReportingFlags[i], - callback).release()); + cros_settings_->AddSettingsObserver(kReportingFlags[i], callback)); } }
diff --git a/chrome/browser/chromeos/login/version_info_updater.h b/chrome/browser/chromeos/login/version_info_updater.h index 8371fef..b41f6aab 100644 --- a/chrome/browser/chromeos/login/version_info_updater.h +++ b/chrome/browser/chromeos/login/version_info_updater.h
@@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ +#include <memory> #include <string> +#include <vector> #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chromeos/system/version_loader.h" @@ -73,7 +74,8 @@ // Full text for the OS version label. std::string os_version_label_text_; - ScopedVector<CrosSettings::ObserverSubscription> subscriptions_; + std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>> + subscriptions_; chromeos::CrosSettings* cros_settings_;
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc index d9ec782..3d8f9b0 100644 --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chrome_notification_types.h" @@ -167,7 +168,8 @@ invalidation::InvalidationService* invalidation_service = invalidation_provider->GetInvalidationService(); profile_invalidation_service_observers_.push_back( - new InvalidationServiceObserver(this, invalidation_service)); + base::MakeUnique<InvalidationServiceObserver>(this, + invalidation_service)); if (profile_invalidation_service_observers_.back()->IsServiceConnected()) { // If the invalidation service is connected, check whether to switch to it. @@ -288,14 +290,12 @@ DCHECK(consumer_count_); DCHECK(!is_shut_down_); - for (ScopedVector<InvalidationServiceObserver>::const_iterator it = - profile_invalidation_service_observers_.begin(); - it != profile_invalidation_service_observers_.end(); ++it) { - if ((*it)->IsServiceConnected()) { + for (const auto& observer : profile_invalidation_service_observers_) { + if (observer->IsServiceConnected()) { // If a connected invalidation service belonging to an affiliated // logged-in user is found, make it available to consumers. DestroyDeviceInvalidationService(); - SetInvalidationService((*it)->GetInvalidationService()); + SetInvalidationService(observer->GetInvalidationService()); return; } }
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h index 4bf4219..7ebd41c 100644 --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h
@@ -6,9 +6,9 @@ #define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_IMPL_H_ #include <memory> +#include <vector> #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/observer_list.h" #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h" #include "content/public/browser/notification_observer.h" @@ -79,7 +79,7 @@ device_invalidation_service_observer_; // State observers for logged-in users' invalidation services. - ScopedVector<InvalidationServiceObserver> + std::vector<std::unique_ptr<InvalidationServiceObserver>> profile_invalidation_service_observers_; // The invalidation service currently used by consumers. nullptr if there are
diff --git a/chrome/browser/chromeos/policy/upload_job_impl.cc b/chrome/browser/chromeos/policy/upload_job_impl.cc index d474126..c74b147 100644 --- a/chrome/browser/chromeos/policy/upload_job_impl.cc +++ b/chrome/browser/chromeos/policy/upload_job_impl.cc
@@ -10,6 +10,7 @@ #include "base/location.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/sequenced_task_runner.h" #include "base/strings/stringprintf.h" @@ -195,9 +196,8 @@ if (state_ != IDLE) return; - std::unique_ptr<DataSegment> data_segment( - new DataSegment(name, filename, std::move(data), header_entries)); - data_segments_.push_back(std::move(data_segment)); + data_segments_.push_back(base::MakeUnique<DataSegment>( + name, filename, std::move(data), header_entries)); } void UploadJobImpl::Start() { @@ -241,7 +241,7 @@ std::set<std::string> used_names; // Check uniqueness of header field names. - for (auto* data_segment : data_segments_) { + for (const auto& data_segment : data_segments_) { if (!used_names.insert(data_segment->GetName()).second) return false; } @@ -253,7 +253,7 @@ // allocation more efficient. It is not an error if this turns out to be too // small as std::string will take care of the realloc. size_t size = 0; - for (auto* data_segment : data_segments_) { + for (const auto& data_segment : data_segments_) { for (const auto& entry : data_segment->GetHeaderEntries()) size += entry.first.size() + entry.second.size(); size += kMaxMimeBoundarySize + data_segment->GetName().size() + @@ -266,7 +266,7 @@ post_data_.reset(new std::string); post_data_->reserve(size); - for (auto* data_segment : data_segments_) { + for (const auto& data_segment : data_segments_) { post_data_->append("--" + *mime_boundary_.get() + "\r\n"); post_data_->append("Content-Disposition: form-data; name=\"" + data_segment->GetName() + "\"");
diff --git a/chrome/browser/chromeos/policy/upload_job_impl.h b/chrome/browser/chromeos/policy/upload_job_impl.h index 5341949..1b2d1cd 100644 --- a/chrome/browser/chromeos/policy/upload_job_impl.h +++ b/chrome/browser/chromeos/policy/upload_job_impl.h
@@ -8,10 +8,10 @@ #include <map> #include <memory> #include <string> +#include <vector> #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" #include "base/threading/thread_checker.h" #include "chrome/browser/chromeos/policy/upload_job.h" #include "google_apis/gaia/oauth2_token_service.h" @@ -167,7 +167,7 @@ std::unique_ptr<net::URLFetcher> upload_fetcher_; // The data chunks to be uploaded. - ScopedVector<DataSegment> data_segments_; + std::vector<std::unique_ptr<DataSegment>> data_segments_; // TaskRunner used for scheduling retry attempts. const scoped_refptr<base::SequencedTaskRunner> task_runner_;
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc index 6d04283..07cef1b 100644 --- a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc +++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc
@@ -9,6 +9,7 @@ #include <algorithm> #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/ui/focus_ring_layer.h" namespace chromeos { @@ -103,7 +104,7 @@ for (size_t i = 0; i < focus_rings_.size(); ++i) { if (!focus_layers_[i]) - focus_layers_[i] = new AccessibilityFocusRingLayer(this); + focus_layers_[i] = base::MakeUnique<AccessibilityFocusRingLayer>(this); } if (focus_ring_behavior_ == PERSIST_FOCUS_RING &&
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h index 0d63f8c..6eb71726 100644 --- a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h +++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h
@@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ #define CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ +#include <memory> #include <vector> #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/memory/singleton.h" #include "base/time/time.h" #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h" @@ -98,7 +98,7 @@ std::vector<gfx::Rect> focus_rects_; std::vector<AccessibilityFocusRing> previous_focus_rings_; std::vector<AccessibilityFocusRing> focus_rings_; - ScopedVector<AccessibilityFocusRingLayer> focus_layers_; + std::vector<std::unique_ptr<AccessibilityFocusRingLayer>> focus_layers_; FocusRingBehavior focus_ring_behavior_ = FADE_OUT_FOCUS_RING; LayerAnimationInfo cursor_animation_info_;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index e92315d8..9152301 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1854,16 +1854,6 @@ registry->RemoveHandler(handler); } -void Browser::UpdatePreferredSize(WebContents* source, - const gfx::Size& pref_size) { - window_->UpdatePreferredSize(source, pref_size); -} - -void Browser::ResizeDueToAutoResize(WebContents* source, - const gfx::Size& new_size) { - window_->ResizeDueToAutoResize(source, new_size); -} - void Browser::FindReply(WebContents* web_contents, int request_id, int number_of_matches,
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 8da77109..b2a10060 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -677,10 +677,6 @@ const std::string& protocol, const GURL& url, bool user_gesture) override; - void UpdatePreferredSize(content::WebContents* source, - const gfx::Size& pref_size) override; - void ResizeDueToAutoResize(content::WebContents* source, - const gfx::Size& new_size) override; void FindReply(content::WebContents* web_contents, int request_id, int number_of_matches,
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 2422d59..b66d827 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h
@@ -336,17 +336,6 @@ virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() = 0; - // Invoked when the preferred size of the contents in current tab has been - // changed. We might choose to update the window size to accomodate this - // change. - // Note that this won't be fired if we change tabs. - virtual void UpdatePreferredSize(content::WebContents* web_contents, - const gfx::Size& pref_size) {} - - // Invoked when the contents auto-resized and the container should match it. - virtual void ResizeDueToAutoResize(content::WebContents* web_contents, - const gfx::Size& new_size) {} - // Construct a BrowserWindow implementation for the specified |browser|. static BrowserWindow* CreateBrowserWindow(Browser* browser, bool user_gesture);
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index 08c55b8..638e0ecc2 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc
@@ -450,7 +450,6 @@ ServiceManagerConnection* connection = connection_holder->service_manager_connection(); - connection->Start(); // New embedded service factories should be added to |connection| here. @@ -469,6 +468,7 @@ for (const auto& entry : services) { connection->AddEmbeddedService(entry.first, entry.second); } + connection->Start(); } }
diff --git a/content/browser/memory/memory_condition_observer.h b/content/browser/memory/memory_condition_observer.h index e2e9975..40982ff7 100644 --- a/content/browser/memory/memory_condition_observer.h +++ b/content/browser/memory/memory_condition_observer.h
@@ -37,6 +37,7 @@ FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, CalculateNextCondition); FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, UpdateCondition); FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, ForceSetMemoryCondition); + FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, DiscardTabUnderCritical); // Calculates next memory condition from the amount of free memory using // a heuristic.
diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc index b403cf4..a8fd29d7 100644 --- a/content/browser/memory/memory_coordinator_impl.cc +++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -277,6 +277,11 @@ void MemoryCoordinatorImpl::UpdateConditionIfNeeded( MemoryCondition next_condition) { DCHECK(CalledOnValidThread()); + + // Discard one tab when the system is under high memory pressure. + if (next_condition == MemoryCondition::CRITICAL) + DiscardTab(); + if (memory_condition_ == next_condition) return; @@ -309,7 +314,6 @@ // Set THROTTLED state to all clients/processes. UpdateBrowserStateAndNotifyStateToClients(MemoryState::THROTTLED); NotifyStateToChildren(MemoryState::THROTTLED); - // Idea: Start discarding tabs. } }
diff --git a/content/browser/memory/memory_coordinator_impl.h b/content/browser/memory/memory_coordinator_impl.h index 09b0c97..2fc60c4 100644 --- a/content/browser/memory/memory_coordinator_impl.h +++ b/content/browser/memory/memory_coordinator_impl.h
@@ -162,6 +162,7 @@ FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, UpdateCondition); FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, SetMemoryStateForTesting); FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, ForceSetMemoryCondition); + FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, DiscardTabUnderCritical); friend struct MemoryCoordinatorSingletonTraits; friend class MemoryCoordinatorHandleImpl;
diff --git a/content/browser/memory/memory_coordinator_impl_unittest.cc b/content/browser/memory/memory_coordinator_impl_unittest.cc index 9158668..60f58f7 100644 --- a/content/browser/memory/memory_coordinator_impl_unittest.cc +++ b/content/browser/memory/memory_coordinator_impl_unittest.cc
@@ -101,12 +101,12 @@ return true; } - void DiscardTab() override { discard_tab_called_ = true; } + void DiscardTab() override { ++discard_tab_count_; } - bool discard_tab_called() const { return discard_tab_called_; } + int discard_tab_count() const { return discard_tab_count_; } private: - bool discard_tab_called_ = false; + int discard_tab_count_ = 0; DISALLOW_COPY_AND_ASSIGN(TestMemoryCoordinatorDelegate); }; @@ -515,7 +515,49 @@ TEST_F(MemoryCoordinatorImplTest, DiscardTab) { coordinator_->DiscardTab(); - EXPECT_TRUE(coordinator_->GetDelegate()->discard_tab_called()); + EXPECT_EQ(1, coordinator_->GetDelegate()->discard_tab_count()); +} + +TEST_F(MemoryCoordinatorImplTest, DiscardTabUnderCritical) { + auto* condition_observer = coordinator_->condition_observer_.get(); + condition_observer->expected_renderer_size_ = 10; + condition_observer->new_renderers_until_warning_ = 4; + condition_observer->new_renderers_until_critical_ = 2; + condition_observer->new_renderers_back_to_normal_ = 5; + condition_observer->new_renderers_back_to_warning_ = 3; + DCHECK(condition_observer->ValidateParameters()); + GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(50); + + base::TimeDelta interval = base::TimeDelta::FromSeconds(5); + condition_observer->monitoring_interval_ = interval; + + auto* delegate = coordinator_->GetDelegate(); + + coordinator_->Start(); + task_runner_->RunUntilIdle(); + EXPECT_EQ(MemoryCondition::NORMAL, coordinator_->GetMemoryCondition()); + EXPECT_EQ(0, delegate->discard_tab_count()); + + // Enter WARNING condition. No tab discarding should happen. + GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(40); + task_runner_->FastForwardBy(interval + base::TimeDelta::FromSeconds(1)); + EXPECT_EQ(0, delegate->discard_tab_count()); + task_runner_->FastForwardBy(interval); + EXPECT_EQ(0, delegate->discard_tab_count()); + + // Enter CRITICAL condition. Tab discarding should start. + GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(20); + task_runner_->FastForwardBy(interval); + EXPECT_EQ(1, delegate->discard_tab_count()); + task_runner_->FastForwardBy(interval); + EXPECT_EQ(2, delegate->discard_tab_count()); + + // Back to NORMAL. Tab discarding should stop. + GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(50); + task_runner_->FastForwardBy(interval); + EXPECT_EQ(2, delegate->discard_tab_count()); + task_runner_->FastForwardBy(interval); + EXPECT_EQ(2, delegate->discard_tab_count()); } #if defined(OS_ANDROID)
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc index a398ae9a..c400726c 100644 --- a/content/browser/service_manager/service_manager_context.cc +++ b/content/browser/service_manager/service_manager_context.cc
@@ -53,40 +53,31 @@ void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); } -void StartUtilityProcessOnIOThread( - service_manager::mojom::ServiceFactoryRequest request, +void StartServiceInUtilityProcess( + const std::string& service_name, const base::string16& process_name, - bool use_sandbox) { + bool use_sandbox, + service_manager::mojom::ServiceRequest request) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); UtilityProcessHost* process_host = UtilityProcessHost::Create(nullptr, nullptr); process_host->SetName(process_name); if (!use_sandbox) process_host->DisableSandbox(); process_host->Start(); - process_host->GetRemoteInterfaces()->GetInterface(std::move(request)); -} - -void StartServiceInUtilityProcess( - const std::string& service_name, - const base::string16& process_name, - bool use_sandbox, - service_manager::mojom::ServiceRequest request) { service_manager::mojom::ServiceFactoryPtr service_factory; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&StartUtilityProcessOnIOThread, - base::Passed(MakeRequest(&service_factory)), process_name, - use_sandbox)); + process_host->GetRemoteInterfaces()->GetInterface( + mojo::MakeRequest(&service_factory)); service_factory->CreateService(std::move(request), service_name); } #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) // Request service_manager::mojom::ServiceFactory from GPU process host. Must be -// called on -// IO thread. -void RequestGpuServiceFactory( - service_manager::mojom::ServiceFactoryRequest request) { +// called on IO thread. +void StartServiceInGpuProcess(const std::string& service_name, + service_manager::mojom::ServiceRequest request) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); GpuProcessHost* process_host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); if (!process_host) { @@ -94,20 +85,13 @@ return; } + service_manager::mojom::ServiceFactoryPtr service_factory; // TODO(xhwang): It's possible that |process_host| is non-null, but the actual // process is dead. In that case, |request| will be dropped and application // load requests through ServiceFactory will also fail. Make sure we handle // these cases correctly. - process_host->GetRemoteInterfaces()->GetInterface(std::move(request)); -} - -void StartServiceInGpuProcess(const std::string& service_name, - service_manager::mojom::ServiceRequest request) { - service_manager::mojom::ServiceFactoryPtr service_factory; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&RequestGpuServiceFactory, - base::Passed(MakeRequest(&service_factory)))); + process_host->GetRemoteInterfaces()->GetInterface( + mojo::MakeRequest(&service_factory)); service_factory->CreateService(std::move(request), service_name); } @@ -301,13 +285,12 @@ std::move(root_browser_service), mojo::MakeRequest(&pid_receiver)); pid_receiver->SetPID(base::GetCurrentProcId()); - packaged_services_connection_->Start(); - ServiceManagerConnection::GetForProcess()->Start(); ServiceInfo device_info; device_info.factory = base::Bind(&device::CreateDeviceService, BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); + device_info.task_runner = base::ThreadTaskRunnerHandle::Get(); packaged_services_connection_->AddEmbeddedService(device::mojom::kServiceName, device_info); @@ -351,6 +334,8 @@ packaged_services_connection_->AddServiceRequestHandler( "media", base::Bind(&StartServiceInGpuProcess, "media")); #endif + packaged_services_connection_->Start(); + ServiceManagerConnection::GetForProcess()->Start(); } ServiceManagerContext::~ServiceManagerContext() {
diff --git a/content/common/service_manager/service_manager_connection_impl.cc b/content/common/service_manager/service_manager_connection_impl.cc index 212ec813..5549c63 100644 --- a/content/common/service_manager/service_manager_connection_impl.cc +++ b/content/common/service_manager/service_manager_connection_impl.cc
@@ -49,9 +49,6 @@ public: using InitializeCallback = base::Callback<void(const service_manager::Identity&)>; - using ServiceFactoryCallback = - base::Callback<void(service_manager::mojom::ServiceRequest, - const std::string&)>; IOThreadContext( service_manager::mojom::ServiceRequest service_request, @@ -71,7 +68,6 @@ void Start( const InitializeCallback& initialize_callback, const ServiceManagerConnection::OnConnectHandler& on_connect_callback, - const ServiceFactoryCallback& create_service_callback, const base::Closure& stop_callback) { DCHECK(!started_); @@ -79,7 +75,6 @@ callback_task_runner_ = base::ThreadTaskRunnerHandle::Get(); initialize_handler_ = initialize_callback; on_connect_callback_ = on_connect_callback; - create_service_callback_ = create_service_callback; stop_callback_ = stop_callback; io_task_runner_->PostTask( FROM_HERE, base::Bind(&IOThreadContext::StartOnIOThread, this)); @@ -126,6 +121,21 @@ base::ThreadTaskRunnerHandle::Get(), binder); } + void AddEmbeddedService(const std::string& name, const ServiceInfo& info) { + io_task_runner_->PostTask( + FROM_HERE, base::Bind(&ServiceManagerConnectionImpl::IOThreadContext:: + AddEmbeddedServiceRequestHandlerOnIoThread, + this, name, info)); + } + + void AddServiceRequestHandler(const std::string& name, + const ServiceRequestHandler& handler) { + io_task_runner_->PostTask( + FROM_HERE, base::Bind(&ServiceManagerConnectionImpl::IOThreadContext:: + AddServiceRequestHandlerOnIoThread, + this, name, handler)); + } + private: friend class base::RefCountedThreadSafe<IOThreadContext>; @@ -203,6 +213,9 @@ service_context_.reset(); ClearConnectionFiltersOnIOThread(); + + request_handlers_.clear(); + embedded_services_.clear(); } void ClearConnectionFiltersOnIOThread() { @@ -224,6 +237,27 @@ has_browser_connection_ = false; } + void AddEmbeddedServiceRequestHandlerOnIoThread(const std::string& name, + const ServiceInfo& info) { + DCHECK(io_thread_checker_.CalledOnValidThread()); + std::unique_ptr<EmbeddedServiceRunner> service( + new EmbeddedServiceRunner(name, info)); + AddServiceRequestHandlerOnIoThread( + name, base::Bind(&EmbeddedServiceRunner::BindServiceRequest, + base::Unretained(service.get()))); + auto result = + embedded_services_.insert(std::make_pair(name, std::move(service))); + DCHECK(result.second); + } + + void AddServiceRequestHandlerOnIoThread( + const std::string& name, + const ServiceRequestHandler& handler) { + DCHECK(io_thread_checker_.CalledOnValidThread()); + auto result = request_handlers_.insert(std::make_pair(name, handler)); + DCHECK(result.second); + } + ///////////////////////////////////////////////////////////////////////////// // service_manager::Service implementation @@ -295,9 +329,10 @@ void CreateService(service_manager::mojom::ServiceRequest request, const std::string& name) override { DCHECK(io_thread_checker_.CalledOnValidThread()); - callback_task_runner_->PostTask( - FROM_HERE, - base::Bind(create_service_callback_, base::Passed(&request), name)); + auto it = request_handlers_.find(name); + DCHECK(it != request_handlers_.end()) + << "Can't create service " << name << ". No handler found."; + it->second.Run(std::move(request)); } static void CallBinderOnTaskRunner( @@ -329,9 +364,6 @@ // Callback to run when a connection request is received. ServiceManagerConnection::OnConnectHandler on_connect_callback_; - // Callback to run when a new Service request is received. - ServiceFactoryCallback create_service_callback_; - // Callback to run if the service is stopped by the service manager. base::Closure stop_callback_; @@ -359,6 +391,10 @@ base::Lock lock_; std::map<int, std::unique_ptr<ConnectionFilter>> connection_filters_; + std::unordered_map<std::string, std::unique_ptr<EmbeddedServiceRunner>> + embedded_services_; + std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; + base::WeakPtrFactory<IOThreadContext> weak_factory_; DISALLOW_COPY_AND_ASSIGN(IOThreadContext); @@ -433,8 +469,6 @@ weak_factory_.GetWeakPtr()), base::Bind(&ServiceManagerConnectionImpl::OnConnect, weak_factory_.GetWeakPtr()), - base::Bind(&ServiceManagerConnectionImpl::CreateService, - weak_factory_.GetWeakPtr()), base::Bind(&ServiceManagerConnectionImpl::OnConnectionLost, weak_factory_.GetWeakPtr())); } @@ -476,21 +510,13 @@ void ServiceManagerConnectionImpl::AddEmbeddedService(const std::string& name, const ServiceInfo& info) { - std::unique_ptr<EmbeddedServiceRunner> service( - new EmbeddedServiceRunner(name, info)); - AddServiceRequestHandler( - name, base::Bind(&EmbeddedServiceRunner::BindServiceRequest, - base::Unretained(service.get()))); - auto result = - embedded_services_.insert(std::make_pair(name, std::move(service))); - DCHECK(result.second); + context_->AddEmbeddedService(name, info); } void ServiceManagerConnectionImpl::AddServiceRequestHandler( const std::string& name, const ServiceRequestHandler& handler) { - auto result = request_handlers_.insert(std::make_pair(name, handler)); - DCHECK(result.second); + context_->AddServiceRequestHandler(name, handler); } int ServiceManagerConnectionImpl::AddOnConnectHandler( @@ -506,16 +532,6 @@ on_connect_handlers_.erase(it); } -void ServiceManagerConnectionImpl::CreateService( - service_manager::mojom::ServiceRequest request, - const std::string& name) { - auto it = request_handlers_.find(name); - DCHECK(it != request_handlers_.end()) - << "Can't create service " << name << ". No handler found."; - if (it != request_handlers_.end()) - it->second.Run(std::move(request)); -} - void ServiceManagerConnectionImpl::OnContextInitialized( const service_manager::Identity& identity) { identity_ = identity;
diff --git a/content/common/service_manager/service_manager_connection_impl.h b/content/common/service_manager/service_manager_connection_impl.h index 8f4f9bd5..4017d05c 100644 --- a/content/common/service_manager/service_manager_connection_impl.h +++ b/content/common/service_manager/service_manager_connection_impl.h
@@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner.h" +#include "content/common/content_export.h" #include "content/public/common/service_manager_connection.h" #include "mojo/public/cpp/system/message_pipe.h" #include "services/service_manager/public/cpp/identity.h" @@ -22,9 +23,8 @@ namespace content { -class EmbeddedServiceRunner; - -class ServiceManagerConnectionImpl : public ServiceManagerConnection { +class CONTENT_EXPORT ServiceManagerConnectionImpl + : public ServiceManagerConnection { public: explicit ServiceManagerConnectionImpl( service_manager::mojom::ServiceRequest request, @@ -56,8 +56,6 @@ void OnConnectionLost(); void OnConnect(const service_manager::ServiceInfo& local_info, const service_manager::ServiceInfo& remote_info); - void CreateService(service_manager::mojom::ServiceRequest request, - const std::string& name); void GetInterface(service_manager::mojom::InterfaceProvider* provider, const std::string& interface_name, mojo::ScopedMessagePipeHandle request_handle); @@ -71,9 +69,6 @@ base::Closure connection_lost_handler_; - std::unordered_map<std::string, std::unique_ptr<EmbeddedServiceRunner>> - embedded_services_; - std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; int next_on_connect_handler_id_ = 0; std::map<int, OnConnectHandler> on_connect_handlers_;
diff --git a/content/common/service_manager/service_manager_connection_impl_unittest.cc b/content/common/service_manager/service_manager_connection_impl_unittest.cc new file mode 100644 index 0000000..ecca7a6 --- /dev/null +++ b/content/common/service_manager/service_manager_connection_impl_unittest.cc
@@ -0,0 +1,58 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/service_manager/service_manager_connection_impl.h" + +#include "base/message_loop/message_loop.h" +#include "base/synchronization/waitable_event.h" +#include "base/threading/thread.h" +#include "services/service_manager/public/cpp/identity.h" +#include "services/service_manager/public/cpp/service.h" +#include "services/service_manager/public/interfaces/constants.mojom.h" +#include "services/service_manager/public/interfaces/service_factory.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { +namespace { + +constexpr char kTestServiceName[] = "test service"; + +std::unique_ptr<service_manager::Service> LaunchService( + base::WaitableEvent* event) { + event->Signal(); + return base::MakeUnique<service_manager::Service>(); +} + +} // namespace + +TEST(ServiceManagerConnectionImplTest, ServiceLaunchThreading) { + base::MessageLoop message_loop; + base::Thread io_thread("ServiceManagerConnectionImplTest IO Thread"); + io_thread.Start(); + service_manager::mojom::ServicePtr service; + ServiceManagerConnectionImpl connection_impl(mojo::MakeRequest(&service), + io_thread.task_runner()); + ServiceManagerConnection& connection = connection_impl; + ServiceInfo info; + base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); + info.factory = base::Bind(&LaunchService, &event); + info.task_runner = io_thread.task_runner(); + connection.AddEmbeddedService(kTestServiceName, info); + connection.Start(); + service_manager::ServiceInfo source_info( + {service_manager::mojom::kServiceName, + service_manager::mojom::kRootUserID}, + service_manager::InterfaceProviderSpecMap{}); + service_manager::mojom::ServiceFactoryPtr factory; + service->OnBindInterface(source_info, + service_manager::mojom::ServiceFactory::Name_, + mojo::MakeRequest(&factory).PassMessagePipe(), + base::Bind(&base::DoNothing)); + service_manager::mojom::ServicePtr created_service; + factory->CreateService(mojo::MakeRequest(&created_service), kTestServiceName); + event.Wait(); +} + +} // namespace content
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index d6a8786..02d9c0fe 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1365,6 +1365,7 @@ "../common/sandbox_mac_system_access_unittest.mm", "../common/sandbox_mac_unittest_helper.h", "../common/sandbox_mac_unittest_helper.mm", + "../common/service_manager/service_manager_connection_impl_unittest.cc", "../common/service_worker/service_worker_utils_unittest.cc", "../common/webplugininfo_unittest.cc", "../public/test/referrer_unittest.cc",
diff --git a/third_party/WebKit/LayoutTests/hittesting/subframe_active_crash.html b/third_party/WebKit/LayoutTests/hittesting/subframe_active_crash.html new file mode 100644 index 0000000..6cf5cce --- /dev/null +++ b/third_party/WebKit/LayoutTests/hittesting/subframe_active_crash.html
@@ -0,0 +1,21 @@ +<!doctype html> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<style> +#frame:active { + border-width: 5px; +} +</style> +<iframe id="frame"></iframe> +<script> +test(() => { + assert_not_equals(window.eventSender, undefined, 'This test requires eventSender'); + + const frame = document.getElementById('frame'); + const mouseX = frame.offsetLeft + frame.offsetWidth / 2; + const mouseY = frame.offsetTop + frame.offsetHeight / 2; + eventSender.mouseMoveTo(mouseX, mouseY); + eventSender.mouseDown(); + eventSender.mouseUp(); +}, 'Clicking in a subframe with :active style should not crash.'); +</script>
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp index 122e8f4..10d6059c 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp
@@ -104,8 +104,7 @@ case IDBKey::StringType: return v8String(isolate, key->string()); case IDBKey::BinaryType: - // Experimental feature: binary keys - // https://w3c.github.io/IndexedDB/#steps-to-convert-a-key-to-a-value + // https://w3c.github.io/IndexedDB/#convert-a-value-to-a-key return ToV8(DOMArrayBuffer::create(reinterpret_cast<const unsigned char*>( key->binary()->data()), key->binary()->size()), @@ -177,40 +176,37 @@ static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Local<v8::Value> value, Vector<v8::Local<v8::Array>>& stack, - ExceptionState& exceptionState, - bool allowExperimentalTypes = false) { + ExceptionState& exceptionState) { if (value->IsNumber() && !std::isnan(value.As<v8::Number>()->Value())) return IDBKey::createNumber(value.As<v8::Number>()->Value()); if (value->IsString()) return IDBKey::createString(toCoreString(value.As<v8::String>())); if (value->IsDate() && !std::isnan(value.As<v8::Date>()->ValueOf())) return IDBKey::createDate(value.As<v8::Date>()->ValueOf()); - if (allowExperimentalTypes || - RuntimeEnabledFeatures::indexedDBExperimentalEnabled()) { - // Experimental feature: binary keys - // https://w3c.github.io/IndexedDB/#dfn-convert-a-value-to-a-key - if (value->IsArrayBuffer()) { - DOMArrayBuffer* buffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); - if (buffer->isNeutered()) { - exceptionState.throwTypeError("The ArrayBuffer is neutered."); - return nullptr; - } - const char* start = static_cast<const char*>(buffer->data()); - size_t length = buffer->byteLength(); - return IDBKey::createBinary(SharedBuffer::create(start, length)); + + // https://w3c.github.io/IndexedDB/#convert-a-key-to-a-value + if (value->IsArrayBuffer()) { + DOMArrayBuffer* buffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); + if (buffer->isNeutered()) { + exceptionState.throwTypeError("The ArrayBuffer is neutered."); + return nullptr; } - if (value->IsArrayBufferView()) { - DOMArrayBufferView* view = - V8ArrayBufferView::toImpl(value.As<v8::Object>()); - if (view->buffer()->isNeutered()) { - exceptionState.throwTypeError("The viewed ArrayBuffer is neutered."); - return nullptr; - } - const char* start = static_cast<const char*>(view->baseAddress()); - size_t length = view->byteLength(); - return IDBKey::createBinary(SharedBuffer::create(start, length)); - } + const char* start = static_cast<const char*>(buffer->data()); + size_t length = buffer->byteLength(); + return IDBKey::createBinary(SharedBuffer::create(start, length)); } + if (value->IsArrayBufferView()) { + DOMArrayBufferView* view = + V8ArrayBufferView::toImpl(value.As<v8::Object>()); + if (view->buffer()->isNeutered()) { + exceptionState.throwTypeError("The viewed ArrayBuffer is neutered."); + return nullptr; + } + const char* start = static_cast<const char*>(view->baseAddress()); + size_t length = view->byteLength(); + return IDBKey::createBinary(SharedBuffer::create(start, length)); + } + if (value->IsArray()) { v8::Local<v8::Array> array = value.As<v8::Array>(); @@ -232,8 +228,8 @@ exceptionState.rethrowV8Exception(block.Exception()); return nullptr; } - IDBKey* subkey = createIDBKeyFromValue( - isolate, item, stack, exceptionState, allowExperimentalTypes); + IDBKey* subkey = + createIDBKeyFromValue(isolate, item, stack, exceptionState); if (!subkey) subkeys.push_back(IDBKey::createInvalid()); else @@ -248,11 +244,10 @@ static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Local<v8::Value> value, - ExceptionState& exceptionState, - bool allowExperimentalTypes = false) { + ExceptionState& exceptionState) { Vector<v8::Local<v8::Array>> stack; - if (IDBKey* key = createIDBKeyFromValue(isolate, value, stack, exceptionState, - allowExperimentalTypes)) + if (IDBKey* key = + createIDBKeyFromValue(isolate, value, stack, exceptionState)) return key; return IDBKey::createInvalid(); } @@ -287,8 +282,7 @@ static IDBKey* createIDBKeyFromValueAndKeyPath(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, const String& keyPath, - ExceptionState& exceptionState, - bool allowExperimentalTypes) { + ExceptionState& exceptionState) { Vector<String> keyPathElements = parseKeyPath(keyPath); ASSERT(isolate->InContext()); @@ -356,24 +350,21 @@ return nullptr; } } - return createIDBKeyFromValue(isolate, v8Value, exceptionState, - allowExperimentalTypes); + return createIDBKeyFromValue(isolate, v8Value, exceptionState); } -static IDBKey* createIDBKeyFromValueAndKeyPath( - v8::Isolate* isolate, - v8::Local<v8::Value> value, - const IDBKeyPath& keyPath, - ExceptionState& exceptionState, - bool allowExperimentalTypes = false) { +static IDBKey* createIDBKeyFromValueAndKeyPath(v8::Isolate* isolate, + v8::Local<v8::Value> value, + const IDBKeyPath& keyPath, + ExceptionState& exceptionState) { ASSERT(!keyPath.isNull()); v8::HandleScope handleScope(isolate); if (keyPath.getType() == IDBKeyPath::ArrayType) { IDBKey::KeyArray result; const Vector<String>& array = keyPath.array(); for (size_t i = 0; i < array.size(); ++i) { - IDBKey* key = createIDBKeyFromValueAndKeyPath( - isolate, value, array[i], exceptionState, allowExperimentalTypes); + IDBKey* key = createIDBKeyFromValueAndKeyPath(isolate, value, array[i], + exceptionState); if (!key) return nullptr; result.push_back(key); @@ -382,8 +373,8 @@ } ASSERT(keyPath.getType() == IDBKeyPath::StringType); - return createIDBKeyFromValueAndKeyPath( - isolate, value, keyPath.string(), exceptionState, allowExperimentalTypes); + return createIDBKeyFromValueAndKeyPath(isolate, value, keyPath.string(), + exceptionState); } // Deserialize just the value data & blobInfo from the given IDBValue. @@ -605,13 +596,9 @@ ScriptValue keyValue = ScriptValue::from(scriptState, value->primaryKey()); ScriptValue scriptValue(scriptState, deserializeIDBValueData(isolate, value)); - // This assertion is about already persisted data, so allow experimental - // types. - const bool allowExperimentalTypes = true; DummyExceptionStateForTesting exceptionState; IDBKey* expectedKey = createIDBKeyFromValueAndKeyPath( - isolate, scriptValue.v8Value(), value->keyPath(), exceptionState, - allowExperimentalTypes); + isolate, scriptValue.v8Value(), value->keyPath(), exceptionState); ASSERT(!exceptionState.hadException()); if (expectedKey && expectedKey->isEqual(value->primaryKey())) return;
diff --git a/third_party/WebKit/Source/core/css/BUILD.gn b/third_party/WebKit/Source/core/css/BUILD.gn index ff9a27b..a01ee099 100644 --- a/third_party/WebKit/Source/core/css/BUILD.gn +++ b/third_party/WebKit/Source/core/css/BUILD.gn
@@ -381,6 +381,7 @@ "properties/CSSPropertyAPIFontVariantLigatures.cpp", "properties/CSSPropertyAPIFontVariantNumeric.cpp", "properties/CSSPropertyAPIFontVariationSettings.cpp", + "properties/CSSPropertyAPIFragmentation.cpp", "properties/CSSPropertyAPIGridAutoFlow.cpp", "properties/CSSPropertyAPIGridAutoLine.cpp", "properties/CSSPropertyAPIGridLine.cpp",
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index e945bd9..d7fb4e8 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -1398,6 +1398,8 @@ }, { name: "orphans", + api_class: "CSSPropertyAPIFragmentation", + api_methods: ["parseSingleValue"], inherited: true, interpolable: true, type_name: "short", @@ -2028,6 +2030,8 @@ "-webkit-box-lines", { name: "-webkit-box-ordinal-group", + api_class: "CSSPropertyAPIFragmentation", + api_methods: ["parseSingleValue"], type_name: "unsigned int", }, "-webkit-box-orient", @@ -2331,6 +2335,8 @@ }, { name: "widows", + api_class: "CSSPropertyAPIFragmentation", + api_methods: ["parseSingleValue"], inherited: true, interpolable: true, type_name: "short",
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index 95728cb..7486d5a 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1962,10 +1962,6 @@ case CSSPropertyGridRowGap: return consumeLengthOrPercent(m_range, m_context->mode(), ValueRangeNonNegative); - case CSSPropertyWebkitBoxOrdinalGroup: - case CSSPropertyOrphans: - case CSSPropertyWidows: - return consumePositiveInteger(m_range); case CSSPropertyColor: case CSSPropertyBackgroundColor: return consumeColor(m_range, m_context->mode(), inQuirksMode());
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFragmentation.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFragmentation.cpp new file mode 100644 index 0000000..d3b9cc3 --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFragmentation.cpp
@@ -0,0 +1,13 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "core/css/properties/CSSPropertyAPIFragmentation.h" + +#include "core/css/parser/CSSPropertyParserHelpers.h" +namespace blink { +const CSSValue* CSSPropertyAPIFragmentation::parseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext* context) { + return CSSPropertyParserHelpers::consumePositiveInteger(range); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp index 47f38d37..b53e47f 100644 --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -1015,6 +1015,10 @@ void SelectionController::passMousePressEventToSubframe( const MouseEventWithHitTestResults& mev) { + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets + // needs to be audited. See http://crbug.com/590369 for more details. + m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); + // If we're clicking into a frame that is selected, the frame will appear // greyed out even though we're clicking on the selection. This looks // really strange (having the whole frame be greyed out), so we deselect the @@ -1024,10 +1028,6 @@ if (!selection().contains(p)) return; - // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets - // needs to be audited. See http://crbug.com/590369 for more details. - m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); - const VisiblePositionInFlatTree& visiblePos = visiblePositionOfHitTestResult(mev.hitTestResult()); if (visiblePos.isNull()) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.idl b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.idl index 5f2613d..17e55e5 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.idl +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.idl
@@ -45,7 +45,6 @@ [CallWith=ScriptState, RaisesException] IDBRequest update(any value); [RaisesException] void advance([EnforceRange] unsigned long count); [CallWith=ScriptState, ImplementedAs=continueFunction, RaisesException] void continue([Default=Undefined] optional any key); - // TODO(jsbell): Proposal: https://github.com/w3c/IndexedDB/issues/14 - [CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] void continuePrimaryKey(any key, any primaryKey); + [CallWith=ScriptState, RaisesException] void continuePrimaryKey(any key, any primaryKey); [CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(); };
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp index 3cfd0346..2689634 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
@@ -65,9 +65,6 @@ } void IDBIndex::setName(const String& name, ExceptionState& exceptionState) { - if (!RuntimeEnabledFeatures::indexedDBExperimentalEnabled()) - return; - IDB_TRACE("IDBIndex::setName"); if (!m_transaction->isVersionChange()) { exceptionState.throwDOMException(
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp index e7098ea0..1ea1e7a 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -77,9 +77,6 @@ void IDBObjectStore::setName(const String& name, ExceptionState& exceptionState) { - if (!RuntimeEnabledFeatures::indexedDBExperimentalEnabled()) - return; - IDB_TRACE("IDBObjectStore::setName"); if (!m_transaction->isVersionChange()) { exceptionState.throwDOMException(
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.idl b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.idl index e198156..9f98ec0 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.idl +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.idl
@@ -39,7 +39,7 @@ [CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); [CallWith=ScriptState, RaisesException] IDBRequest clear(); [CallWith=ScriptState, RaisesException] IDBRequest get(any key); - [CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] IDBRequest getKey(any key); + [CallWith=ScriptState, RaisesException] IDBRequest getKey(any key); // TODO(cmumford): 0xFFFFFFFF is not necessary. Remove once crbug.com/335871 is fixed. [CallWith=ScriptState, RaisesException] IDBRequest getAll([Default=Undefined] optional any range, [EnforceRange] optional unsigned long maxCount = 0xFFFFFFFF); // TODO(cmumford): 0xFFFFFFFF is not necessary. Remove once crbug.com/335871 is fixed.
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 index c582489..5ce0a14 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -464,10 +464,6 @@ status: "test", }, { - name: "IndexedDBExperimental", - status: "stable", - }, - { name: "InertTopControls", status: "stable", },