diff --git a/AUTHORS b/AUTHORS index 081c617..2694366 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -147,6 +147,7 @@ Clement Scheelfeldt Skau <clementskau@gmail.com> Clinton Staley <clintstaley@chromium.org> Clinton Staley <clintstaley@gmail.com> +Connor Pearson <cjp822@gmail.com> Craig Schlenter <craig.schlenter@gmail.com> Csaba Osztrogonác <ossy.szeged@gmail.com> Daegyu Lee <na7jun8gi@gmail.com>
diff --git a/DEPS b/DEPS index dc13158..c536aab3 100644 --- a/DEPS +++ b/DEPS
@@ -40,7 +40,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '600effbdc7d8fb1cfb1b9dcecf785a2e42cc1cc3', + 'skia_revision': '20b82524e7a7959803edd80cb0e6737629029ef2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -64,7 +64,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'ab1faaa7f81b7dafe03d546341c6a643a58b3678', + 'pdfium_revision': '49f8dc5b1afc4f92110bf40b7639ee1138aa7240', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'bc8989ef1a06a456807e406fcb1a6d337b270845', + 'catapult_revision': '13344fafc8814638210ca360d8ae8cf99cf1639b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/WATCHLISTS b/WATCHLISTS index 43c9012..d57e807 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1878,7 +1878,7 @@ 'halliwell+watch@chromium.org', 'lcwu+watch@chromium.org'], 'chromecast_public': ['gfhuang+watch@chromium.org'], - 'chromedriver': ['samuong+watch@chromium.org'], + 'chromedriver': ['johnchen+watch@chromium.org'], 'chromeos': ['oshima+watch@chromium.org'], 'chromeos_attestation': ['dkrahn+watch@chromium.org'], 'chromeos_calculator': ['dharcourt@chromium.org'],
diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc index 011595f..06b2c12 100644 --- a/ash/display/cursor_window_controller.cc +++ b/ash/display/cursor_window_controller.cc
@@ -88,12 +88,11 @@ CursorWindowController::CursorWindowController() : is_cursor_compositing_enabled_(false), container_(NULL), - cursor_type_(ui::kCursorNone), + cursor_type_(ui::CursorType::kNone), visible_(true), cursor_set_(ui::CURSOR_SET_NORMAL), large_cursor_size_in_dip_(ash::kDefaultLargeCursorSize), - delegate_(new CursorWindowDelegate()) { -} + delegate_(new CursorWindowDelegate()) {} CursorWindowController::~CursorWindowController() { SetContainer(NULL); @@ -320,7 +319,7 @@ void CursorWindowController::UpdateCursorVisibility() { if (!cursor_window_) return; - bool visible = (visible_ && cursor_type_ != ui::kCursorNone); + bool visible = (visible_ && cursor_type_ != ui::CursorType::kNone); if (visible) cursor_window_->Show(); else
diff --git a/ash/display/cursor_window_controller.h b/ash/display/cursor_window_controller.h index 8cf4736d..b8163803 100644 --- a/ash/display/cursor_window_controller.h +++ b/ash/display/cursor_window_controller.h
@@ -79,7 +79,7 @@ gfx::Rect bounds_in_screen_; // The native_type of the cursor, see definitions in cursor.h - int cursor_type_; + ui::CursorType cursor_type_; // The last requested cursor visibility. bool visible_;
diff --git a/ash/display/cursor_window_controller_unittest.cc b/ash/display/cursor_window_controller_unittest.cc index 3609b64..d7460a6 100644 --- a/ash/display/cursor_window_controller_unittest.cc +++ b/ash/display/cursor_window_controller_unittest.cc
@@ -30,7 +30,9 @@ SetCursorCompositionEnabled(true); } - int GetCursorType() const { return cursor_window_controller_->cursor_type_; } + ui::CursorType GetCursorType() const { + return cursor_window_controller_->cursor_type_; + } const gfx::Point& GetCursorHotPoint() const { return cursor_window_controller_->hot_point_; @@ -80,7 +82,7 @@ EXPECT_TRUE(primary_root->Contains(GetCursorWindow())); EXPECT_EQ(primary_display_id, GetCursorDisplayId()); - EXPECT_EQ(ui::kCursorNull, GetCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCursorType()); gfx::Point hot_point = GetCursorHotPoint(); EXPECT_EQ("4,4", hot_point.ToString()); gfx::Rect cursor_bounds = GetCursorWindow()->GetBoundsInScreen(); @@ -104,7 +106,7 @@ EXPECT_TRUE(secondary_root->Contains(GetCursorWindow())); EXPECT_EQ(secondary_display_id, GetCursorDisplayId()); - EXPECT_EQ(ui::kCursorNull, GetCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCursorType()); hot_point = GetCursorHotPoint(); EXPECT_EQ("3,3", hot_point.ToString()); cursor_bounds = GetCursorWindow()->GetBoundsInScreen();
diff --git a/ash/display/mirror_window_controller_unittest.cc b/ash/display/mirror_window_controller_unittest.cc index 496999f..156050e0 100644 --- a/ash/display/mirror_window_controller_unittest.cc +++ b/ash/display/mirror_window_controller_unittest.cc
@@ -77,14 +77,14 @@ EXPECT_EQ("4,4", test_api.GetCursorHotPoint().ToString()); EXPECT_EQ("10,10", test_api.GetCursorHotPointLocationInRootWindow().ToString()); - EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, test_api.GetCurrentCursorType()); EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); // Test if cursor type change is propertly reflected in mirror window. generator.MoveMouseTo(100, 100); EXPECT_EQ("100,100", test_api.GetCursorHotPointLocationInRootWindow().ToString()); - EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, test_api.GetCurrentCursorType()); // Test if visibility change is propertly reflected in mirror window. // A key event hides cursor. @@ -96,7 +96,7 @@ generator.MoveMouseTo(300, 300); EXPECT_EQ("300,300", test_api.GetCursorHotPointLocationInRootWindow().ToString()); - EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, test_api.GetCurrentCursorType()); EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); } @@ -123,11 +123,11 @@ EXPECT_EQ("11,12", test_api.GetCursorHotPoint().ToString()); EXPECT_EQ("100,100", test_api.GetCursorHotPointLocationInRootWindow().ToString()); - EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, test_api.GetCurrentCursorType()); UpdateDisplay("400x400/r,400x400"); // 90 degrees. generator.MoveMouseToInHost(300, 100); - EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, test_api.GetCurrentCursorType()); // The size of cursor image is 25x25, so the rotated hot point must // be (25-12, 11). EXPECT_EQ("13,11", test_api.GetCursorHotPoint().ToString()); @@ -136,7 +136,7 @@ UpdateDisplay("400x400/u,400x400"); // 180 degrees. generator.MoveMouseToInHost(300, 300); - EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, test_api.GetCurrentCursorType()); // Rotated hot point must be (25-11, 25-12). EXPECT_EQ("14,13", test_api.GetCursorHotPoint().ToString()); EXPECT_EQ("300,300", @@ -144,7 +144,7 @@ UpdateDisplay("400x400/l,400x400"); // 270 degrees. generator.MoveMouseToInHost(100, 300); - EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, test_api.GetCurrentCursorType()); // Rotated hot point must be (12, 25-11). EXPECT_EQ("12,14", test_api.GetCursorHotPoint().ToString()); EXPECT_EQ("100,300", @@ -225,7 +225,7 @@ // Check mirrored cursor's location. test::MirrorWindowTestApi test_api; // The hot point location depends on the specific cursor. - EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, test_api.GetCurrentCursorType()); // Rotated hot point must be (25-7, 7). EXPECT_EQ("18,7", test_api.GetCursorHotPoint().ToString()); // New coordinates are not (200,200) because (200,200) is not the center of
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 5a56430..01484baa 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc
@@ -436,13 +436,13 @@ e.set_root_location_f(event.root_location_f()); e.set_flags(event.flags()); op = delegate->OnDragUpdated(e); - gfx::NativeCursor cursor = ui::kCursorNoDrop; + gfx::NativeCursor cursor = ui::CursorType::kNoDrop; if (op & ui::DragDropTypes::DRAG_COPY) - cursor = ui::kCursorCopy; + cursor = ui::CursorType::kCopy; else if (op & ui::DragDropTypes::DRAG_LINK) - cursor = ui::kCursorAlias; + cursor = ui::CursorType::kAlias; else if (op & ui::DragDropTypes::DRAG_MOVE) - cursor = ui::kCursorGrabbing; + cursor = ui::CursorType::kGrabbing; ash::Shell::Get()->cursor_manager()->SetCursor(cursor); } } @@ -460,7 +460,7 @@ void DragDropController::Drop(aura::Window* target, const ui::LocatedEvent& event) { - ash::Shell::Get()->cursor_manager()->SetCursor(ui::kCursorPointer); + ash::Shell::Get()->cursor_manager()->SetCursor(ui::CursorType::kPointer); // We must guarantee that a target gets a OnDragEntered before Drop. WebKit // depends on not getting a Drop without DragEnter. This behavior is @@ -515,7 +515,7 @@ } void DragDropController::DoDragCancel(int drag_cancel_animation_duration_ms) { - ash::Shell::Get()->cursor_manager()->SetCursor(ui::kCursorPointer); + ash::Shell::Get()->cursor_manager()->SetCursor(ui::CursorType::kPointer); // |drag_window_| can be NULL if we have just started the drag and have not // received any DragUpdates, or, if the |drag_window_| gets destroyed during
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 5cca23d..e0e939e 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc
@@ -256,11 +256,11 @@ aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); - EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type()); - EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type()); - Shell::Get()->cursor_manager()->SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type()); - EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kPointer, host0->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kNull, host1->last_cursor().native_type()); + Shell::Get()->cursor_manager()->SetCursor(ui::CursorType::kCopy); + EXPECT_EQ(ui::CursorType::kCopy, host0->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kCopy, host1->last_cursor().native_type()); } TEST_F(ExtendedDesktopTest, TestCursorLocation) {
diff --git a/ash/mus/move_event_handler.cc b/ash/mus/move_event_handler.cc index b0ba9cc8..6c89fa9f 100644 --- a/ash/mus/move_event_handler.cc +++ b/ash/mus/move_event_handler.cc
@@ -31,23 +31,23 @@ ui::mojom::CursorType CursorForWindowComponent(int window_component) { switch (window_component) { case HTBOTTOM: - return ui::mojom::CursorType::SOUTH_RESIZE; + return ui::mojom::CursorType::kSouthResize; case HTBOTTOMLEFT: - return ui::mojom::CursorType::SOUTH_WEST_RESIZE; + return ui::mojom::CursorType::kSouthWestResize; case HTBOTTOMRIGHT: - return ui::mojom::CursorType::SOUTH_EAST_RESIZE; + return ui::mojom::CursorType::kSouthEastResize; case HTLEFT: - return ui::mojom::CursorType::WEST_RESIZE; + return ui::mojom::CursorType::kWestResize; case HTRIGHT: - return ui::mojom::CursorType::EAST_RESIZE; + return ui::mojom::CursorType::kEastResize; case HTTOP: - return ui::mojom::CursorType::NORTH_RESIZE; + return ui::mojom::CursorType::kNorthResize; case HTTOPLEFT: - return ui::mojom::CursorType::NORTH_WEST_RESIZE; + return ui::mojom::CursorType::kNorthWestResize; case HTTOPRIGHT: - return ui::mojom::CursorType::NORTH_EAST_RESIZE; + return ui::mojom::CursorType::kNorthEastResize; default: - return ui::mojom::CursorType::CURSOR_NULL; + return ui::mojom::CursorType::kNull; } }
diff --git a/ash/shell.cc b/ash/shell.cc index d5a70a7..11b3861 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -1063,7 +1063,7 @@ if (cursor_manager_) { if (initially_hide_cursor_) cursor_manager_->HideCursor(); - cursor_manager_->SetCursor(ui::kCursorPointer); + cursor_manager_->SetCursor(ui::CursorType::kPointer); } power_event_observer_.reset(new PowerEventObserver());
diff --git a/ash/test/mirror_window_test_api.cc b/ash/test/mirror_window_test_api.cc index 8a65b84..534eecf3 100644 --- a/ash/test/mirror_window_test_api.cc +++ b/ash/test/mirror_window_test_api.cc
@@ -23,7 +23,7 @@ return window ? window->GetHost() : NULL; } -int MirrorWindowTestApi::GetCurrentCursorType() const { +ui::CursorType MirrorWindowTestApi::GetCurrentCursorType() const { return Shell::Get() ->window_tree_host_manager() ->cursor_window_controller()
diff --git a/ash/test/mirror_window_test_api.h b/ash/test/mirror_window_test_api.h index 7c8f689..2812e4de 100644 --- a/ash/test/mirror_window_test_api.h +++ b/ash/test/mirror_window_test_api.h
@@ -16,6 +16,10 @@ class Point; } +namespace ui { +enum class CursorType; +} + namespace ash { namespace test { @@ -27,7 +31,7 @@ const aura::WindowTreeHost* GetHost() const; - int GetCurrentCursorType() const; + ui::CursorType GetCurrentCursorType() const; // Returns the position of the hot point within the cursor. This is // unaffected by the cursor location.
diff --git a/ash/utility/screenshot_controller.cc b/ash/utility/screenshot_controller.cc index d483fa0..d8b3d29 100644 --- a/ash/utility/screenshot_controller.cc +++ b/ash/utility/screenshot_controller.cc
@@ -204,7 +204,7 @@ return; gfx::NativeCursor original_cursor = cursor_manager->GetCursor(); cursor_manager_ = cursor_manager; - if (cursor == ui::kCursorNone) { + if (cursor == ui::CursorType::kNone) { cursor_manager_->HideCursor(); } else { cursor_manager_->SetCursor(cursor); @@ -261,8 +261,8 @@ } SetSelectedWindow(wm::GetActiveWindow()); - cursor_setter_.reset( - new ScopedCursorSetter(Shell::Get()->cursor_manager(), ui::kCursorCross)); + cursor_setter_.reset(new ScopedCursorSetter(Shell::Get()->cursor_manager(), + ui::CursorType::kCross)); EnableMouseWarp(true); } @@ -287,7 +287,7 @@ if (!pen_events_only_) { cursor_setter_.reset(new ScopedCursorSetter(Shell::Get()->cursor_manager(), - ui::kCursorCross)); + ui::CursorType::kCross)); } EnableMouseWarp(false); @@ -340,7 +340,7 @@ // called before ctor is called. cursor_setter_.reset(); cursor_setter_.reset(new ScopedCursorSetter( - Shell::Get()->cursor_manager(), ui::kCursorNone)); + Shell::Get()->cursor_manager(), ui::CursorType::kNone)); } Update(event); }
diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc index 1bbafbf5..45a3ef8 100644 --- a/ash/wm/ash_native_cursor_manager.cc +++ b/ash/wm/ash_native_cursor_manager.cc
@@ -93,12 +93,12 @@ if (native_cursor_enabled_) { image_cursors_->SetPlatformCursor(&cursor); } else { - gfx::NativeCursor invisible_cursor(ui::kCursorNone); + gfx::NativeCursor invisible_cursor(ui::CursorType::kNone); image_cursors_->SetPlatformCursor(&invisible_cursor); - if (cursor == ui::kCursorCustom) { + if (cursor == ui::CursorType::kCustom) { // Fall back to the default pointer cursor for now. (crbug.com/476078) // TODO(oshima): support custom cursor. - cursor = ui::kCursorPointer; + cursor = ui::CursorType::kPointer; } else { cursor.SetPlatformCursor(invisible_cursor.platform()); } @@ -135,7 +135,7 @@ if (visible) { SetCursor(delegate->GetCursor(), delegate); } else { - gfx::NativeCursor invisible_cursor(ui::kCursorNone); + gfx::NativeCursor invisible_cursor(ui::CursorType::kNone); image_cursors_->SetPlatformCursor(&invisible_cursor); SetCursorOnAllRootWindows(invisible_cursor); }
diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index 0b5d327..0b7f987 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc
@@ -59,8 +59,8 @@ ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); - cursor_manager->SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); + cursor_manager->SetCursor(ui::CursorType::kCopy); + EXPECT_EQ(ui::CursorType::kCopy, test_api.GetCurrentCursor().native_type()); UpdateDisplay("800x800*2/r"); EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet()); @@ -80,8 +80,8 @@ EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet()); // Cursor type does not change while cursor is locked. - cursor_manager->SetCursor(ui::kCursorPointer); - EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); + cursor_manager->SetCursor(ui::CursorType::kPointer); + EXPECT_EQ(ui::CursorType::kCopy, test_api.GetCurrentCursor().native_type()); // Device scale factor and rotation do change even while cursor is locked. UpdateDisplay("800x800/u"); @@ -92,7 +92,8 @@ EXPECT_FALSE(cursor_manager->IsCursorLocked()); // Cursor type changes to the one specified while cursor is locked. - EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type()); + EXPECT_EQ(ui::CursorType::kPointer, + test_api.GetCurrentCursor().native_type()); EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); EXPECT_TRUE(test_api.GetCurrentCursor().platform()); } @@ -100,11 +101,12 @@ TEST_F(AshNativeCursorManagerTest, SetCursor) { ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); - cursor_manager->SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); + cursor_manager->SetCursor(ui::CursorType::kCopy); + EXPECT_EQ(ui::CursorType::kCopy, test_api.GetCurrentCursor().native_type()); EXPECT_TRUE(test_api.GetCurrentCursor().platform()); - cursor_manager->SetCursor(ui::kCursorPointer); - EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type()); + cursor_manager->SetCursor(ui::CursorType::kPointer); + EXPECT_EQ(ui::CursorType::kPointer, + test_api.GetCurrentCursor().native_type()); EXPECT_TRUE(test_api.GetCurrentCursor().platform()); } @@ -179,7 +181,7 @@ // This test is in ash_unittests because ui_base_unittests does not include // 2x assets. crbug.com/372541. TEST_F(AshNativeCursorManagerTest, CursorLoaderX11Test) { - const int kCursorId = 1; + const ui::CursorType kCursorId = ui::CursorType::kPointer; ui::CursorLoaderX11 loader; loader.set_scale(1.0f);
diff --git a/ash/wm/resize_shadow_and_cursor_unittest.cc b/ash/wm/resize_shadow_and_cursor_unittest.cc index 2e33d70de..7a64a58 100644 --- a/ash/wm/resize_shadow_and_cursor_unittest.cc +++ b/ash/wm/resize_shadow_and_cursor_unittest.cc
@@ -99,7 +99,7 @@ } // Returns the current cursor type. - int GetCurrentCursorType() const { + ui::CursorType GetCurrentCursorType() const { CursorManagerTestApi test_api(ash::Shell::Get()->cursor_manager()); return test_api.GetCurrentCursor().native_type(); } @@ -133,44 +133,44 @@ generator.MoveMouseTo(50, 50); VerifyResizeShadow(false); - EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCurrentCursorType()); generator.MoveMouseTo(gfx::Point(50, 0)); VerifyResizeShadow(true); EXPECT_EQ(HTTOP, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorNorthResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNorthResize, GetCurrentCursorType()); generator.MoveMouseTo(50, 50); VerifyResizeShadow(false); - EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCurrentCursorType()); generator.MoveMouseTo(200, 100); VerifyResizeShadow(true); EXPECT_EQ(HTBOTTOMRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorSouthEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kSouthEastResize, GetCurrentCursorType()); generator.MoveMouseTo(50, 100); VerifyResizeShadow(true); EXPECT_EQ(HTBOTTOM, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorSouthResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kSouthResize, GetCurrentCursorType()); generator.MoveMouseTo(50, 100 + ash::kResizeOutsideBoundsSize - 1); VerifyResizeShadow(true); EXPECT_EQ(HTBOTTOM, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorSouthResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kSouthResize, GetCurrentCursorType()); generator.MoveMouseTo(50, 100 + ash::kResizeOutsideBoundsSize + 10); VerifyResizeShadow(false); - EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCurrentCursorType()); generator.MoveMouseTo(50, 100 - ash::kResizeInsideBoundsSize); VerifyResizeShadow(true); EXPECT_EQ(HTBOTTOM, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorSouthResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kSouthResize, GetCurrentCursorType()); generator.MoveMouseTo(50, 100 - ash::kResizeInsideBoundsSize - 10); VerifyResizeShadow(false); - EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCurrentCursorType()); } // Test that the resize shadows stay visible and that the cursor stays the same @@ -184,17 +184,17 @@ generator.PressLeftButton(); VerifyResizeShadow(true); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); generator.MoveMouseTo(210, 50); VerifyResizeShadow(true); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); generator.ReleaseLeftButton(); VerifyResizeShadow(true); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); gfx::Size new_size(window()->bounds().size()); EXPECT_NE(new_size.ToString(), initial_size.ToString()); @@ -222,10 +222,10 @@ generator.MoveMouseTo(200, 50); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); generator.MoveMouseTo(200 - ash::kResizeInsideBoundsSize, 50); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); ash::wm::GetWindowState(window())->Maximize(); gfx::Rect bounds(window()->GetBoundsInRootWindow()); @@ -233,15 +233,15 @@ (bounds.y() + bounds.bottom()) / 2); generator.MoveMouseTo(right_center); VerifyResizeShadow(false); - EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kNull, GetCurrentCursorType()); ash::wm::GetWindowState(window())->Restore(); generator.MoveMouseTo(200, 50); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); generator.MoveMouseTo(200 - ash::kResizeInsideBoundsSize, 50); EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); - EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); + EXPECT_EQ(ui::CursorType::kEastResize, GetCurrentCursorType()); } } // namespace test
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc index e115d77..08c72640 100644 --- a/ash/wm/toplevel_window_event_handler.cc +++ b/ash/wm/toplevel_window_event_handler.cc
@@ -70,7 +70,7 @@ aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(root_window); if (cursor_client) - cursor_client->SetCursor(ui::kCursorPointer); + cursor_client->SetCursor(ui::CursorType::kPointer); base::RunLoop run_loop;
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 69647c3..38667af 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc
@@ -492,7 +492,7 @@ ui::EventSink* sink = host->event_sink(); // Cursor starts as a pointer (set during Shell::Init()). - EXPECT_EQ(ui::kCursorPointer, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kPointer, host->last_cursor().native_type()); { // Resize edges and corners show proper cursors. @@ -501,7 +501,7 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorSouthResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kSouthResize, host->last_cursor().native_type()); } { @@ -510,7 +510,8 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorSouthWestResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kSouthWestResize, + host->last_cursor().native_type()); } { @@ -519,7 +520,8 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorSouthEastResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kSouthEastResize, + host->last_cursor().native_type()); } { @@ -528,7 +530,7 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorWestResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kWestResize, host->last_cursor().native_type()); } { @@ -537,7 +539,7 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorEastResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kEastResize, host->last_cursor().native_type()); } { @@ -546,7 +548,7 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorNorthResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kNorthResize, host->last_cursor().native_type()); } { @@ -555,7 +557,8 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorNorthWestResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kNorthWestResize, + host->last_cursor().native_type()); } { @@ -564,7 +567,8 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorNorthEastResize, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kNorthEastResize, + host->last_cursor().native_type()); } { @@ -574,7 +578,7 @@ ui::EventTimeForNow(), 0, 0); ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); ASSERT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(ui::kCursorNull, host->last_cursor().native_type()); + EXPECT_EQ(ui::CursorType::kNull, host->last_cursor().native_type()); } }
diff --git a/base/threading/thread.h b/base/threading/thread.h index 01f7d8e..2db69c2 100644 --- a/base/threading/thread.h +++ b/base/threading/thread.h
@@ -28,6 +28,9 @@ class MessagePump; class RunLoop; +// IMPORTANT: Instead of creating a base::Thread, consider using +// base::Create(Sequenced|SingleTreaded)TaskRunnerWithTraits(). +// // A simple thread abstraction that establishes a MessageLoop on a new thread. // The consumer uses the MessageLoop of the thread to cause code to execute on // the thread. When this object is destroyed the thread is terminated. All
diff --git a/build/config/ios/find_signing_identity.py b/build/config/ios/find_signing_identity.py index 736e2e4b..7add474 100644 --- a/build/config/ios/find_signing_identity.py +++ b/build/config/ios/find_signing_identity.py
@@ -19,7 +19,7 @@ ]) -def FindValidIdentity(): +def FindValidIdentity(identity_description): lines = list(map(str.strip, ListIdentities().splitlines())) # Look for something like "2) XYZ "iPhone Developer: Name (ABC)"" exp = re.compile('[0-9]+\) ([A-F0-9]+) "([^"]*)"') @@ -27,17 +27,21 @@ res = exp.match(line) if res is None: continue - if "iPhone Developer" in res.group(2): - return res.group(1) - return "" + if identity_description in res.group(2): + yield res.group(1) if __name__ == '__main__': parser = argparse.ArgumentParser('codesign iOS bundles') - parser.add_argument('--developer_dir', required=False, - help='Path to Xcode.') + parser.add_argument( + '--developer_dir', required=False, + help='Path to Xcode.') + parser.add_argument( + '--identity-description', required=True, + help='Text description used to select the code signing identity.') args = parser.parse_args() if args.developer_dir: os.environ['DEVELOPER_DIR'] = args.developer_dir - print FindValidIdentity() + for identity in FindValidIdentity(args.identity_description): + print identity
diff --git a/build/config/ios/ios_sdk.gni b/build/config/ios/ios_sdk.gni index ec9d87f..d576f9c 100644 --- a/build/config/ios/ios_sdk.gni +++ b/build/config/ios/ios_sdk.gni
@@ -24,6 +24,7 @@ # ios_enable_code_signing_flag=<bool> flag to make the invocation clearer. ios_enable_code_signing = true ios_code_signing_identity = "" + ios_code_signing_identity_description = "iPhone Developer" # Prefix for CFBundleIdentifier property of iOS bundles (correspond to the # "Organization Identifier" in Xcode). Code signing will fail if no mobile @@ -115,7 +116,10 @@ } if (ios_enable_code_signing && !use_ios_simulator) { - find_signing_identity_args = [] + find_signing_identity_args = [ + "--identity-description", + ios_code_signing_identity_description, + ] if (!use_system_xcode) { find_signing_identity_args += [ "--developer_dir", @@ -128,13 +132,33 @@ _ios_identities = exec_script("find_signing_identity.py", find_signing_identity_args, "list lines") - ios_code_signing_identity = _ios_identities[0] - } + if (_ios_identities == []) { + print("Tried to prepare a device build without specifying a code signing") + print("identity and could not detect one automatically either.") + print("TIP: Simulator builds don't require code signing...") + assert(false) + } else { + _ios_identities_len = 0 + foreach(_, _ios_identities) { + _ios_identities_len += 1 + } - if (ios_code_signing_identity == "") { - print("Tried to prepare a device build without specifying a code signing") - print("identity and could not detect one automatically either.") - print("TIP: Simulator builds don't require code signing...") - assert(false) + ios_code_signing_identity = _ios_identities[0] + if (_ios_identities_len != 1) { + print("Warning: Multiple codesigning identities match " + + "\"$ios_code_signing_identity_description\"") + foreach(_ios_identity, _ios_identities) { + _selected = "" + if (ios_code_signing_identity == _ios_identity) { + _selected = " (selected)" + } + print("Warning: - $_ios_identity$_selected") + } + print("Warning: Please use either ios_code_signing_identity or ") + print("Warning: ios_code_signing_identity_description variable to ") + print("Warning: control which identity is selected.") + print() + } + } } }
diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn index bfe9f584..95345c8 100644 --- a/build/config/linux/gtk/BUILD.gn +++ b/build/config/linux/gtk/BUILD.gn
@@ -19,6 +19,7 @@ "//chrome/test:interactive_ui_tests", "//gpu/gles2_conform_support:gles2_conform_test_windowless", "//remoting/host", + "//remoting/host/linux", "//remoting/host/it2me:common", "//remoting/host/it2me:remote_assistance_host", "//remoting/host:remoting_me2me_host_static",
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index f925333..6b7472f4 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -519,6 +519,8 @@ "test/begin_frame_args_test.h", "test/begin_frame_source_test.cc", "test/begin_frame_source_test.h", + "test/compositor_frame_helpers.cc", + "test/compositor_frame_helpers.h", "test/fake_compositor_frame_sink.cc", "test/fake_compositor_frame_sink.h", "test/fake_compositor_frame_sink_client.cc",
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc index 634d649..3174dcb 100644 --- a/cc/animation/animation_player.cc +++ b/cc/animation/animation_player.cc
@@ -374,6 +374,10 @@ } } + // This is for the case when an animation is already removed on main thread, + // but the impl version of it sent a finished event and is now waiting for + // deletion. We would need to delete that animation during push properties. + SetNeedsPushProperties(); return false; } @@ -795,6 +799,21 @@ animations_[i]->IsFinishedAt(monotonic_time)) { animations_[i]->SetRunState(Animation::FINISHED, monotonic_time); animation_finished = true; + SetNeedsPushProperties(); + } + if (!animations_[i]->affects_active_elements() && + !animations_[i]->affects_pending_elements()) { + switch (animations_[i]->run_state()) { + case Animation::WAITING_FOR_TARGET_AVAILABILITY: + case Animation::STARTING: + case Animation::RUNNING: + case Animation::PAUSED: + animations_[i]->SetRunState(Animation::FINISHED, monotonic_time); + animation_finished = true; + break; + default: + break; + } } } @@ -814,11 +833,6 @@ animations_[i]->set_affects_active_elements( animations_[i]->affects_pending_elements()); } - auto affects_no_elements = [](const std::unique_ptr<Animation>& animation) { - return !animation->affects_active_elements() && - !animation->affects_pending_elements(); - }; - base::EraseIf(animations_, affects_no_elements); if (animation_activated) element_animations_->UpdateClientAnimationState(); @@ -1151,7 +1165,9 @@ if (animation->is_impl_only()) { return (animation->run_state() == Animation::WAITING_FOR_DELETION); } else { - return !main_thread_player->GetAnimationById(animation->id()); + Animation* main_thread_animation = + main_thread_player->GetAnimationById(animation->id()); + return !main_thread_animation || main_thread_animation->is_finished(); } }
diff --git a/cc/animation/animation_player_unittest.cc b/cc/animation/animation_player_unittest.cc index 4f234a0..d896f21 100644 --- a/cc/animation/animation_player_unittest.cc +++ b/cc/animation/animation_player_unittest.cc
@@ -172,7 +172,7 @@ time += base::TimeDelta::FromSecondsD(duration); TickAnimationsTransferEvents(time, 3u); - EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false)); + EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true)); client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE, end_opacity); @@ -265,8 +265,8 @@ EXPECT_TRUE(delegate1.finished()); EXPECT_TRUE(delegate2.finished()); - EXPECT_FALSE(player1->needs_push_properties()); - EXPECT_FALSE(player2->needs_push_properties()); + EXPECT_TRUE(player1->needs_push_properties()); + EXPECT_TRUE(player2->needs_push_properties()); client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE, end_opacity);
diff --git a/cc/animation/element_animations_unittest.cc b/cc/animation/element_animations_unittest.cc index 75e69c9..8974943 100644 --- a/cc/animation/element_animations_unittest.cc +++ b/cc/animation/element_animations_unittest.cc
@@ -2696,10 +2696,11 @@ PushProperties(); - // animations_impl hasn't yet ticked at/past the end of the animation. - EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( + // Finished animations are pushed, but animations_impl hasn't yet ticked + // at/past the end of the animation. + EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( element_id_, ElementListType::PENDING)); - EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating( + EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( element_id_, ElementListType::PENDING)); EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( element_id_, ElementListType::ACTIVE)); @@ -2913,10 +2914,11 @@ PushProperties(); - // animations_impl hasn't yet ticked at/past the end of the animation. - EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation( + // Finished animations are pushed, but animations_impl hasn't yet ticked + // at/past the end of the animation. + EXPECT_FALSE(client_impl_.GetHasPotentialOpacityAnimation( element_id_, ElementListType::PENDING)); - EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating( + EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating( element_id_, ElementListType::PENDING)); EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation( element_id_, ElementListType::ACTIVE)); @@ -3123,10 +3125,11 @@ PushProperties(); - // animations_impl hasn't yet ticked at/past the end of the animation. - EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation( + // Finished animations are pushed, but animations_impl hasn't yet ticked + // at/past the end of the animation. + EXPECT_FALSE(client_impl_.GetHasPotentialFilterAnimation( element_id_, ElementListType::PENDING)); - EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating( + EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating( element_id_, ElementListType::PENDING)); EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation( element_id_, ElementListType::ACTIVE)); @@ -3304,7 +3307,6 @@ const int animation_id = AddOpacityTransitionToPlayer(player_.get(), 1, 0.5f, 1.f, true); - PushProperties(); player_impl_->ActivateAnimations(); player_impl_->Tick(kInitialTickTime); @@ -3342,8 +3344,20 @@ client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE)); player_impl_->ActivateAnimations(); + events = CreateEventsForTesting(); + player_impl_->UpdateState(true, events.get()); - // Activation should cause the animation to be deleted. + // After Activation the animation doesn't affect neither active nor pending + // thread. UpdateState for this animation would put the animation to wait for + // deletion state. + EXPECT_EQ(Animation::WAITING_FOR_DELETION, + player_impl_->GetAnimationById(animation_id)->run_state()); + EXPECT_EQ(1u, events->events_.size()); + + // The animation is finished on impl thread, and main thread will delete it + // during commit. + player_->animation_host()->SetAnimationEvents(std::move(events)); + PushProperties(); EXPECT_FALSE(player_impl_->has_any_animation()); } @@ -3402,9 +3416,12 @@ player_impl_->ActivateAnimations(); - // The original animation should have been deleted, and the new animation - // should now affect both elements. - EXPECT_FALSE(player_impl_->GetAnimationById(first_animation_id)); + // The original animation no longer affect either elements, and the new + // animation should now affect both elements. + EXPECT_FALSE(player_impl_->GetAnimationById(first_animation_id) + ->affects_pending_elements()); + EXPECT_FALSE(player_impl_->GetAnimationById(first_animation_id) + ->affects_active_elements()); EXPECT_TRUE(player_impl_->GetAnimationById(second_animation_id) ->affects_pending_elements()); EXPECT_TRUE(player_impl_->GetAnimationById(second_animation_id) @@ -3413,6 +3430,10 @@ player_impl_->Tick(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); player_impl_->UpdateState(true, events.get()); + // The original animation should be marked for waiting for deletion. + EXPECT_EQ(Animation::WAITING_FOR_DELETION, + player_impl_->GetAnimationById(first_animation_id)->run_state()); + // The new animation should be running, and the active observer should have // been ticked at the new animation's starting point. EXPECT_EQ(Animation::RUNNING,
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc index 7fc9e65..d85a331 100644 --- a/cc/surfaces/compositor_frame_sink_support.cc +++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -125,13 +125,9 @@ DCHECK(surface_factory_); ++ack_pending_count_; - if (frame.metadata.begin_frame_ack.sequence_number < - BeginFrameArgs::kStartingFrameNumber) { - DLOG(ERROR) << "Received CompositorFrame with invalid BeginFrameAck."; - frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; - frame.metadata.begin_frame_ack.sequence_number = - BeginFrameArgs::kStartingFrameNumber; - } + DCHECK_GE(frame.metadata.begin_frame_ack.sequence_number, + BeginFrameArgs::kStartingFrameNumber); + // |has_damage| is not transmitted. frame.metadata.begin_frame_ack.has_damage = true;
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc index 603d068..1c96a0d 100644 --- a/cc/surfaces/display_unittest.cc +++ b/cc/surfaces/display_unittest.cc
@@ -21,6 +21,7 @@ #include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_manager.h" +#include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_output_surface.h" #include "cc/test/scheduler_test_common.h" #include "cc/test/test_shared_bitmap_manager.h" @@ -125,7 +126,7 @@ protected: void SubmitCompositorFrame(RenderPassList* pass_list, const LocalSurfaceId& local_surface_id) { - CompositorFrame frame; + CompositorFrame frame = test::MakeCompositorFrame(); pass_list->swap(frame.render_pass_list); support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); @@ -330,7 +331,7 @@ pass_list.push_back(std::move(pass)); scheduler_->ResetDamageForTest(); - CompositorFrame frame; + CompositorFrame frame = test::MakeCompositorFrame(); pass_list.swap(frame.render_pass_list); frame.metadata.latency_info.push_back(ui::LatencyInfo()); @@ -360,7 +361,7 @@ pass_list.push_back(std::move(pass)); scheduler_->ResetDamageForTest(); - CompositorFrame frame; + CompositorFrame frame = test::MakeCompositorFrame(); pass_list.swap(frame.render_pass_list); support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc index cac6b14..e02b73c 100644 --- a/cc/surfaces/surface_aggregator_unittest.cc +++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -22,6 +22,7 @@ #include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_manager.h" +#include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_compositor_frame_sink_support_client.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/render_pass_test_utils.h" @@ -57,14 +58,6 @@ return size; } -CompositorFrame MakeCompositorFrame() { - CompositorFrame frame; - frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; - frame.metadata.begin_frame_ack.sequence_number = - BeginFrameArgs::kStartingFrameNumber; - return frame; -} - class SurfaceAggregatorTest : public testing::Test { public: explicit SurfaceAggregatorTest(bool use_damage_rect) @@ -94,7 +87,8 @@ TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) { LocalSurfaceId local_surface_id(7, base::UnguessableToken::Create()); SurfaceId one_id(kArbitraryRootFrameSinkId, local_surface_id); - support_->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); + support_->SubmitCompositorFrame(local_surface_id, + test::MakeCompositorFrame()); CompositorFrame frame = aggregator_.Aggregate(one_id); EXPECT_TRUE(frame.render_pass_list.empty()); @@ -154,7 +148,7 @@ void SubmitPassListAsFrame(CompositorFrameSinkSupport* support, const LocalSurfaceId& local_surface_id, RenderPassList* pass_list) { - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); pass_list->swap(frame.render_pass_list); support->SubmitCompositorFrame(local_surface_id, std::move(frame)); @@ -172,7 +166,7 @@ void QueuePassAsFrame(std::unique_ptr<RenderPass> pass, const LocalSurfaceId& local_surface_id, CompositorFrameSinkSupport* support) { - CompositorFrame child_frame = MakeCompositorFrame(); + CompositorFrame child_frame = test::MakeCompositorFrame(); child_frame.render_pass_list.push_back(std::move(pass)); support->SubmitCompositorFrame(local_surface_id, std::move(child_frame)); @@ -590,7 +584,7 @@ test::Pass(root_quads, arraysize(root_quads), 1), test::Pass(root_quads2, arraysize(root_quads2), 2)}; { - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); AddPasses(&frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); frame.render_pass_list[0]->copy_requests.push_back(std::move(copy_request)); @@ -677,7 +671,7 @@ test::Pass(parent_quads, arraysize(parent_quads))}; { - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); AddPasses(&frame.render_pass_list, gfx::Rect(SurfaceSize()), parent_passes, arraysize(parent_passes)); @@ -693,7 +687,7 @@ test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; { - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); AddPasses(&frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1124,7 +1118,7 @@ grandchild_local_surface_id); grandchild_support->SubmitCompositorFrame(grandchild_local_surface_id, - MakeCompositorFrame()); + test::MakeCompositorFrame()); std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); gfx::Rect output_rect(SurfaceSize()); gfx::Rect damage_rect(SurfaceSize()); @@ -1140,7 +1134,7 @@ SurfaceId child_one_surface_id(child_one_support->frame_sink_id(), child_one_local_surface_id); child_one_support->SubmitCompositorFrame(child_one_local_surface_id, - MakeCompositorFrame()); + test::MakeCompositorFrame()); std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create(); child_one_pass->SetNew(pass_id, output_rect, damage_rect, @@ -1162,7 +1156,7 @@ SurfaceId child_two_surface_id(child_two_support->frame_sink_id(), child_two_local_surface_id); child_two_support->SubmitCompositorFrame(child_two_local_surface_id, - MakeCompositorFrame()); + test::MakeCompositorFrame()); std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create(); child_two_pass->SetNew(pass_id, output_rect, damage_rect, @@ -1260,7 +1254,7 @@ test::Pass(child_quads[1], arraysize(child_quads[1]), child_pass_id[1])}; - CompositorFrame child_frame = MakeCompositorFrame(); + CompositorFrame child_frame = test::MakeCompositorFrame(); AddPasses(&child_frame.render_pass_list, gfx::Rect(SurfaceSize()), child_passes, arraysize(child_passes)); @@ -1292,7 +1286,7 @@ test::Pass(middle_quads, arraysize(middle_quads)), }; - CompositorFrame middle_frame = MakeCompositorFrame(); + CompositorFrame middle_frame = test::MakeCompositorFrame(); AddPasses(&middle_frame.render_pass_list, gfx::Rect(SurfaceSize()), middle_passes, arraysize(middle_passes)); @@ -1316,7 +1310,7 @@ test::Pass(secondary_quads, arraysize(secondary_quads)), test::Pass(root_quads, arraysize(root_quads))}; - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1420,7 +1414,7 @@ test::Pass child_passes[] = { test::Pass(child_quads, arraysize(child_quads), 1)}; - CompositorFrame child_frame = MakeCompositorFrame(); + CompositorFrame child_frame = test::MakeCompositorFrame(); AddPasses(&child_frame.render_pass_list, gfx::Rect(SurfaceSize()), child_passes, arraysize(child_passes)); @@ -1442,7 +1436,7 @@ // Parent surface is only used to test if the transform is applied correctly // to the child surface's damage. - CompositorFrame parent_surface_frame = MakeCompositorFrame(); + CompositorFrame parent_surface_frame = test::MakeCompositorFrame(); AddPasses(&parent_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), parent_surface_passes, arraysize(parent_surface_passes)); @@ -1460,7 +1454,7 @@ test::Pass(root_surface_quads, arraysize(root_surface_quads), 1), test::Pass(root_render_pass_quads, arraysize(root_render_pass_quads), 2)}; - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1486,7 +1480,7 @@ aggregated_pass_list[1]->damage_rect.Contains(gfx::Rect(SurfaceSize()))); { - CompositorFrame child_frame = MakeCompositorFrame(); + CompositorFrame child_frame = test::MakeCompositorFrame(); AddPasses(&child_frame.render_pass_list, gfx::Rect(SurfaceSize()), child_passes, arraysize(child_passes)); @@ -1515,7 +1509,7 @@ } { - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1529,7 +1523,7 @@ } { - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1595,7 +1589,7 @@ test::Pass root_passes[] = { test::Pass(root_render_pass_quads, arraysize(root_render_pass_quads), 2)}; - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1628,7 +1622,7 @@ test::Pass root_passes[] = {test::Pass( root_render_pass_quads, arraysize(root_render_pass_quads), 2)}; - CompositorFrame root_frame = MakeCompositorFrame(); + CompositorFrame root_frame = test::MakeCompositorFrame(); AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, arraysize(root_passes)); @@ -1973,7 +1967,7 @@ SurfaceId child_id, CompositorFrameSinkSupport* support, SurfaceId surface_id) { - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); std::unique_ptr<RenderPass> pass = RenderPass::Create(); pass->id = 1; SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); @@ -2057,7 +2051,7 @@ LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); SurfaceId surface_id(support->frame_sink_id(), local_surface_id); - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); std::unique_ptr<RenderPass> pass = RenderPass::Create(); pass->id = 1; TransferableResource resource; @@ -2228,7 +2222,7 @@ surface1_id, SurfaceDrawQuadType::PRIMARY, nullptr); pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); - CompositorFrame frame = MakeCompositorFrame(); + CompositorFrame frame = test::MakeCompositorFrame(); frame.render_pass_list.push_back(std::move(pass)); support2->SubmitCompositorFrame(local_frame2_id, std::move(frame));
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc index 312a7ae..9a3c29f 100644 --- a/cc/surfaces/surface_hittest_unittest.cc +++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -10,6 +10,7 @@ #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_hittest.h" #include "cc/surfaces/surface_manager.h" +#include "cc/test/compositor_frame_helpers.h" #include "cc/test/surface_hittest_test_helpers.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" @@ -405,7 +406,7 @@ // Create a CompostiorFrame with two RenderPasses. gfx::Rect root_rect(300, 300); - CompositorFrame root_frame; + CompositorFrame root_frame = test::MakeCompositorFrame(); RenderPassList& render_pass_list = root_frame.render_pass_list; // Create a child RenderPass.
diff --git a/cc/surfaces/surface_manager_ref_unittest.cc b/cc/surfaces/surface_manager_ref_unittest.cc index eb678f8..de66181 100644 --- a/cc/surfaces/surface_manager_ref_unittest.cc +++ b/cc/surfaces/surface_manager_ref_unittest.cc
@@ -12,6 +12,7 @@ #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_manager.h" +#include "cc/test/compositor_frame_helpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -21,7 +22,6 @@ using testing::UnorderedElementsAre; namespace cc { - namespace { constexpr FrameSinkId kFrameSink1(1, 0); @@ -41,7 +41,7 @@ LocalSurfaceId local_surface_id(local_id, base::UnguessableToken::Deserialize(0, 1u)); GetCompositorFrameSinkSupport(frame_sink_id) - .SubmitCompositorFrame(local_surface_id, CompositorFrame()); + .SubmitCompositorFrame(local_surface_id, test::MakeCompositorFrame()); return SurfaceId(frame_sink_id, local_surface_id); }
diff --git a/cc/surfaces/surface_unittest.cc b/cc/surfaces/surface_unittest.cc index e40cc05..3ed47c6 100644 --- a/cc/surfaces/surface_unittest.cc +++ b/cc/surfaces/surface_unittest.cc
@@ -10,6 +10,7 @@ #include "cc/surfaces/surface_dependency_tracker.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/begin_frame_args_test.h" +#include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_external_begin_frame_source.h" #include "cc/test/scheduler_test_common.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,7 +33,7 @@ LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); - support->SubmitCompositorFrame(local_surface_id, CompositorFrame()); + support->SubmitCompositorFrame(local_surface_id, test::MakeCompositorFrame()); EXPECT_TRUE(manager.GetSurfaceForId(surface_id)); support->EvictFrame(); @@ -64,7 +65,7 @@ LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); - CompositorFrame frame; + CompositorFrame frame = test::MakeCompositorFrame(); frame.render_pass_list.push_back(RenderPass::Create()); support->SubmitCompositorFrame(local_surface_id, std::move(frame)); Surface* surface = manager.GetSurfaceForId(surface_id); @@ -78,7 +79,7 @@ int max_frame = 3, start_id = 200; for (int i = 0; i < max_frame; ++i) { - CompositorFrame frame; + CompositorFrame frame = test::MakeCompositorFrame(); frame.render_pass_list.push_back(RenderPass::Create()); frame.render_pass_list.back()->id = i * 3 + start_id; frame.render_pass_list.push_back(RenderPass::Create());
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc index 8ba7439..36f1ba91 100644 --- a/cc/surfaces/surfaces_pixeltest.cc +++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -11,6 +11,7 @@ #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_aggregator.h" #include "cc/surfaces/surface_manager.h" +#include "cc/test/compositor_frame_helpers.h" #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -82,8 +83,7 @@ SK_ColorGREEN, force_anti_aliasing_off); - - CompositorFrame root_frame; + CompositorFrame root_frame = test::MakeCompositorFrame(); root_frame.render_pass_list.push_back(std::move(pass)); LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); @@ -140,7 +140,7 @@ SK_ColorYELLOW, force_anti_aliasing_off); - CompositorFrame root_frame; + CompositorFrame root_frame = test::MakeCompositorFrame(); root_frame.render_pass_list.push_back(std::move(pass)); support_->SubmitCompositorFrame(root_local_surface_id, @@ -165,7 +165,7 @@ SK_ColorBLUE, force_anti_aliasing_off); - CompositorFrame child_frame; + CompositorFrame child_frame = test::MakeCompositorFrame(); child_frame.render_pass_list.push_back(std::move(pass)); child_support->SubmitCompositorFrame(child_local_surface_id, @@ -240,7 +240,7 @@ right_child_id, SurfaceDrawQuadType::PRIMARY, nullptr); - CompositorFrame root_frame; + CompositorFrame root_frame = test::MakeCompositorFrame(); root_frame.render_pass_list.push_back(std::move(pass)); support_->SubmitCompositorFrame(root_local_surface_id, @@ -273,7 +273,7 @@ SK_ColorBLUE, force_anti_aliasing_off); - CompositorFrame child_frame; + CompositorFrame child_frame = test::MakeCompositorFrame(); child_frame.render_pass_list.push_back(std::move(pass)); left_support->SubmitCompositorFrame(left_child_local_id, @@ -306,7 +306,7 @@ SK_ColorGREEN, force_anti_aliasing_off); - CompositorFrame child_frame; + CompositorFrame child_frame = test::MakeCompositorFrame(); child_frame.render_pass_list.push_back(std::move(pass)); right_support->SubmitCompositorFrame(right_child_local_id,
diff --git a/cc/test/compositor_frame_helpers.cc b/cc/test/compositor_frame_helpers.cc new file mode 100644 index 0000000..4cccf85 --- /dev/null +++ b/cc/test/compositor_frame_helpers.cc
@@ -0,0 +1,20 @@ +// 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 "cc/test/compositor_frame_helpers.h" +#include "cc/output/compositor_frame.h" + +namespace cc { +namespace test { + +CompositorFrame MakeCompositorFrame() { + CompositorFrame frame; + frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; + frame.metadata.begin_frame_ack.sequence_number = + BeginFrameArgs::kStartingFrameNumber; + return frame; +} + +} // namespace test +} // namespace cc
diff --git a/cc/test/compositor_frame_helpers.h b/cc/test/compositor_frame_helpers.h new file mode 100644 index 0000000..1c23b69 --- /dev/null +++ b/cc/test/compositor_frame_helpers.h
@@ -0,0 +1,19 @@ +// 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. + +#ifndef CC_TEST_COMPOSITOR_FRAME_HELPERS_H_ +#define CC_TEST_COMPOSITOR_FRAME_HELPERS_H_ + +namespace cc { + +class CompositorFrame; + +namespace test { + +CompositorFrame MakeCompositorFrame(); + +} // namespace test +} // namespace cc + +#endif // CC_TEST_COMPOSITOR_FRAME_HELPERS_H_
diff --git a/cc/test/surface_hittest_test_helpers.cc b/cc/test/surface_hittest_test_helpers.cc index ac18aee..ed737fd 100644 --- a/cc/test/surface_hittest_test_helpers.cc +++ b/cc/test/surface_hittest_test_helpers.cc
@@ -9,6 +9,7 @@ #include "cc/quads/shared_quad_state.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/quads/surface_draw_quad.h" +#include "cc/test/compositor_frame_helpers.h" namespace cc { namespace test { @@ -70,7 +71,7 @@ CompositorFrame CreateCompositorFrame(const gfx::Rect& root_rect, RenderPass** render_pass) { - CompositorFrame root_frame; + CompositorFrame root_frame = test::MakeCompositorFrame(); int root_id = 1; CreateRenderPass(root_id, root_rect, gfx::Transform(), &root_frame.render_pass_list);
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index f25dc93..ac4c3968 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -5,6 +5,7 @@ #include "cc/trees/layer_tree_host.h" #include <stdint.h> +#include <climits> #include "cc/animation/animation_curve.h" #include "cc/animation/animation_host.h" @@ -1403,7 +1404,11 @@ player_child_->AttachElement(layer_->element_id()); } - void BeginTest() override { PostSetNeedsCommitToMainThread(); } + void BeginTest() override { + animation_stopped_ = false; + last_frame_number_ = INT_MAX; + PostSetNeedsCommitToMainThread(); + } void DidCommit() override { switch (layer_tree_host()->SourceFrameNumber()) { @@ -1433,6 +1438,7 @@ } void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { + GetImplTimelineAndPlayerByID(*host_impl); LayerImpl* child = host_impl->active_tree()->LayerById(layer_->id()); switch (host_impl->active_tree()->source_frame_number()) { case 0: @@ -1443,18 +1449,37 @@ EXPECT_TRUE(child->screen_space_transform_is_animating()); break; case 2: { - // The animation is removed, the transform that was set afterward is + // The animation is stopped, the transform that was set afterward is // applied. gfx::Transform expected_transform; expected_transform.Translate(10.f, 10.f); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, child->DrawTransform()); EXPECT_FALSE(child->screen_space_transform_is_animating()); - EndTest(); + animation_stopped_ = true; + PostSetNeedsCommitToMainThread(); break; } - default: - NOTREACHED(); + } + } + + void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { + if (host_impl->sync_tree()->source_frame_number() >= last_frame_number_) { + // Check that eventually the animation is removed. + EXPECT_FALSE(player_child_impl_->has_any_animation()); + EndTest(); + } + } + + void UpdateAnimationState(LayerTreeHostImpl* host_impl, + bool has_unfinished_animation) override { + // Non impl only animations are removed during commit. After the animation + // is fully stopped on compositor thread, make sure another commit happens. + if (animation_stopped_ && !has_unfinished_animation) { + last_frame_number_ = + std::min(last_frame_number_, + host_impl->active_tree()->source_frame_number() + 1); + PostSetNeedsCommitToMainThread(); } } @@ -1463,6 +1488,9 @@ private: scoped_refptr<Layer> layer_; FakeContentLayerClient client_; + + int last_frame_number_; + bool animation_stopped_; }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestRemoveAnimation);
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index e90dcdb..434ef501 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -870,11 +870,6 @@ bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { EffectNode* node = FindNodeFromElementId(id); DCHECK(node); - // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is - // calling this without setting element id. - if (!node) - return false; - if (node->opacity == opacity) return false; node->opacity = opacity; @@ -888,11 +883,6 @@ const FilterOperations& filters) { EffectNode* node = FindNodeFromElementId(id); DCHECK(node); - // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is - // calling this without setting element id. - if (!node) - return false; - if (node->filters == filters) return false; node->filters = filters;
diff --git a/chrome/android/java/res/drawable/unionpay_card.xml b/chrome/android/java/res/drawable/unionpay_card.xml new file mode 100644 index 0000000..7e1a077 --- /dev/null +++ b/chrome/android/java/res/drawable/unionpay_card.xml
@@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + tools:targetApi="21" + android:viewportWidth="128" + android:viewportHeight="80" + android:width="32dp" + android:height="20dp"> + <path + android:pathData="M0 8.0000511C0 3.5817449 3.5907529 0 8.0069733 0L119.99303 0C124.41516 0 128 3.5797863 128 8.0000511l0 63.9998979C128 76.418255 124.40925 80 119.99303 80L8.0069733 80C3.584844 80 0 76.420214 0 71.999949L0 8.0000511Z" + android:fillColor="#e0e0e0" /> + <path + android:pathData="M4 8.0000511L4 71.999949C4 74.209472 5.7923805 76 8.0069733 76L119.99303 76C122.20338 76 124 74.205847 124 71.999949L124 8.0000511C124 5.7905281 122.20762 4 119.99303 4L8.0069733 4C5.7966213 4 4 5.7941535 4 8.0000511Z" + android:fillColor="#ffffff" /> + <group + android:translateX="19" + android:translateY="12"> + <path + android:pathData="M20.740341 50.248637L31.191144 5.6617631c0.741483 -3.1240388 3.871032 -5.66198057573 7.006602 -5.66198057573l-20.582577 0c-3.137759 0 -6.273875 2.53794177573 -7.004961 5.66198057573L0.1533857 50.248637c-0.73108561 3.113709 1.222489 5.653281 4.3520388 5.653281l20.5803885 0c-3.139947 0 -5.083125 -2.539572 -4.345472 -5.653281" + android:fillColor="#e21836" /> + <path + android:pathData="M45.534102 50.248637L55.987094 5.6617631C56.717633 2.5377243 59.85156 -0.00021747573 62.991507 -0.00021747573l-22.925225 0 -1.868208 0c-3.136116 0 -6.265119 2.53794177573 -7.007149 5.66198057573L20.740122 50.248637c-0.737105 3.113709 1.206072 5.653281 4.346019 5.653281l1.868208 0 22.931792 0c-3.139947 0 -5.087502 -2.539572 -4.352039 -5.653281" + android:fillColor="#00447c" /> + <path + android:pathData="M85.442676 -0.0001631068l-21.426937 0 -1.023848 0c-3.140495 0 -6.273875 2.5379417068 -7.004961 5.6619806068L45.533938 50.248691c-0.734916 3.113165 1.212092 5.653282 4.352039 5.653282l1.017829 0 21.422559 0c3.138306 0 6.278253 -2.540117 7.015905 -5.653282L89.792526 5.6618175C90.530178 2.5377786 88.580434 -0.0001631068 85.442676 -0.0001631068" + android:fillColor="#007b84" /> + <path + android:pathData="M62.502184 34.74713c-0.42519 0.116893 -1.21647 0.471379 -1.21647 0.471379l0.703725 -2.299806 2.109532 0 -0.508914 1.67565c0 0 -0.651739 0.03806 -1.087873 0.152777l0 0zm0.04049 3.285515c0 0 -0.662683 0.08264 -1.098818 0.180504 -0.429567 0.129399 -1.235075 0.537166 -1.235075 0.537166l0.726708 -2.393321 2.120477 0 -0.513292 1.675651zm-1.181995 3.905864l-2.116099 0 0.613434 -2.019806 2.109532 0 -0.606867 2.019806zm3.311227 -0.0212l-0.739841 0 2.738288 -8.998602 0.908384 0 0.287838 -0.92699 0.029 1.030835c-0.03448 0.637203 0.470061 1.202097 1.795428 1.108582l1.532762 0 0.52752 -1.732738 -0.57677 0c-0.331615 0 -0.485383 -0.08318 -0.466231 -0.261514l-0.02791 -1.048777 -2.838429 0 0 0.0054c-0.917687 0.01957 -3.658164 0.08808 -4.213045 0.23433 -0.671439 0.171806 -1.378994 0.677437 -1.378994 0.677437l0.277988 -0.928078 -2.65511 0 -0.55324 1.841476 -2.774951 9.136155 -0.538464 0 -0.528067 1.720777 5.288331 0 -0.177299 0.573048 2.605861 0 0.172921 -0.573048 0.731086 0 0.572939 -1.85833z" + android:fillColor="#fefefe" /> + <path + android:pathData="M66.456722 36.35694l3.050203 0 -0.438323 1.41033 -3.090697 0 -0.464043 1.541903 2.70436 0 -2.047696 2.864699c-0.143372 0.210408 -0.271968 0.284893 -0.414792 0.344155 -0.143372 0.07231 -0.331616 0.157126 -0.549409 0.157126l-0.750239 0 -0.515481 1.688699 1.962331 0c1.020017 0 1.622506 -0.461048 2.067396 -1.066174l1.404166 -1.909437 0.301518 1.938796c0.06403 0.363184 0.32669 0.575767 0.504537 0.658408 0.196451 0.09786 0.39947 0.265864 0.685666 0.290873 0.308085 0.01305 0.530256 0.02338 0.678005 0.02338l0.963654 0 0.579506 -1.889864 -0.380318 0c-0.218341 0 -0.594281 -0.03643 -0.658305 -0.104388 -0.06403 -0.08264 -0.06403 -0.209864 -0.0985 -0.403418l-0.305896 -1.943145 -1.252586 0 0.549409 -0.649709 3.084678 0 0.474439 -1.541903 -2.85594 0 0.44489 -1.41033 2.847185 0 0.528067 -1.739262 -8.488474 0 -0.519311 1.739262z" + android:fillColor="#fefefe" /> + <path + android:pathData="M40.6946 42.331161l0.711933 -2.353087 2.925984 0 0.534634 -1.750136 -2.92872 0 0.447078 -1.448388 2.86196 0 0.530256 -1.69468 -7.160918 0 -0.519312 1.69468 1.626884 0 -0.433945 1.448388 -1.631262 0 -0.540653 1.780039 1.626337 0 -0.948879 3.113165c-0.128049 0.412116 0.06019 0.569242 0.179488 0.760621 0.12203 0.186486 0.246249 0.309903 0.52369 0.380039 0.286743 0.06361 0.483194 0.10167 0.750238 0.10167l3.298641 0 0.587714 -1.938796 -1.462172 0.199534c-0.282365 0 -1.064342 -0.03371 -0.978976 -0.293049" + android:fillColor="#fefefe" /> + <path + android:pathData="M41.03021 31.066625l-0.74203 1.331495c-0.158146 0.290874 -0.300971 0.471379 -0.429568 0.554563 -0.113274 0.07014 -0.337634 0.0995 -0.662683 0.0995l-0.386884 0 -0.517123 1.703378 1.284872 0c0.617812 0 1.092251 -0.225087 1.3188 -0.337631 0.243513 -0.129398 0.307537 -0.05546 0.495781 -0.235961l0.433945 -0.373515 4.012216 0 0.532445 -1.773514 -2.936929 0 0.512745 -0.968311 -2.915587 0z" + android:fillColor="#fefefe" /> + <path + android:pathData="M48.843086 35.6944l4.097581 0 -0.260476 0.811184c-0.03666 0.01903 -0.124219 -0.04023 -0.541201 0.0087l-3.548173 0 0.252269 -0.819883zm0.820829 -2.720621l4.132057 0 -0.297141 0.977009c0 0 -1.947555 -0.01903 -2.25947 0.03806 -1.372427 0.235961 -2.174104 0.964504 -2.174104 0.964504l0.598658 -1.979572zm-2.710379 9.391145c-0.0684 -0.09732 -0.01915 -0.26967 0.08537 -0.628505l1.096629 -3.606291 3.901129 0c0.568561 -0.0082 0.978976 -0.01468 1.24602 -0.03371 0.286743 -0.0299 0.598658 -0.131572 0.938481 -0.314252 0.350768 -0.191379 0.530257 -0.393087 0.681836 -0.624699 0.169091 -0.231068 0.440512 -0.736699 0.673628 -1.51635l1.378447 -4.563728 -4.048332 0.02338c0 0 -1.246567 0.182679 -1.795976 0.384388 -0.553239 0.225088 -1.344519 0.853592 -1.344519 0.853592l0.365543 -1.251029 -2.500794 0 -3.501112 11.536544c-0.124219 0.448 -0.207397 0.773126 -0.226549 0.968311 -0.0066 0.210407 0.267043 0.41864 0.444342 0.575767 0.209585 0.157126 0.519312 0.131573 0.816452 0.157126 0.312463 0.02338 0.756805 0.03806 1.370238 0.03806l1.921836 0 0.589903 -1.979029 -1.720459 0.161476c-0.183866 0 -0.31684 -0.09786 -0.372109 -0.181049l0 0z" + android:fillColor="#fefefe" /> + <path + android:pathData="M52.771905 39.221965c-0.03393 0.121243 -0.08755 0.195184 -0.162525 0.250641 -0.08318 0.05274 -0.217793 0.07231 -0.418623 0.07231l-0.583883 0 0.03448 -0.987883 -2.428562 0 -0.0985 4.829592c-0.0038 0.348505 0.0301 0.550214 0.286743 0.71169 0.256646 0.201708 1.047378 0.227262 2.111721 0.227262l1.522365 0 0.548862 -1.807767 -1.324819 0.07231 -0.440512 0.02555c-0.06019 -0.02555 -0.117652 -0.04893 -0.181677 -0.112544 -0.05582 -0.05546 -0.149938 -0.0212 -0.134616 -0.369709l0.0104 -1.23798 1.389391 -0.05709c0.750238 0 1.070909 -0.242485 1.344519 -0.473553 0.261024 -0.221282 0.34639 -0.475728 0.44489 -0.819884l0.233115 -1.096077 -1.90925 0 -0.243512 0.773126z" + android:fillColor="#fefefe" /> + <path + android:pathData="M23.478574 14.288699c-2.308721 0.02338 -2.990556 0 -3.20835 -0.05111 -0.08372 0.395262 -1.641659 7.535534 -1.646037 7.541515 -0.335446 1.444582 -0.579506 2.47433 -1.408544 3.139262 -0.470609 0.386563 -1.020017 0.573048 -1.656981 0.573048 -1.023848 0 -1.620318 -0.505087 -1.720459 -1.463068l-0.01915 -0.328932c0 0 0.311916 -1.93499 0.311916 -1.945864 0 0 1.635092 -6.506873 1.927855 -7.36699 0.01532 -0.04893 0.0197 -0.07449 0.02353 -0.09786 -3.18263 0.02773 -3.746814 0 -3.785666 -0.05111 -0.02134 0.07014 -0.100141 0.473554 -0.100141 0.473554l-1.669568 7.333825 -0.143371 0.62198 -0.277441 2.034486c0 0.603495 0.119294 1.096078 0.356788 1.512544 0.761182 1.320621 2.930361 1.518524 4.157775 1.518524 1.581465 0 3.064978 -0.333825 4.067485 -0.943301 1.740159 -1.021592 2.195446 -2.618408 2.601483 -4.037437l0.188243 -0.728c0 0 1.684343 -6.758058 1.970539 -7.637204 0.01094 -0.04893 0.01532 -0.07449 0.0301 -0.09786" + android:fillColor="#fefefe" /> + <path + android:pathData="M29.209387 19.740435c-0.406037 0 -1.148067 0.09786 -1.81458 0.422447 -0.241871 0.123417 -0.470609 0.265864 -0.711933 0.407766l0.217793 -0.781281 -0.119294 -0.131573c-1.412921 0.28435 -1.729761 0.322408 -3.035428 0.505088l-0.108897 0.07231c-0.152127 1.248855 -0.286743 2.187806 -0.848737 4.642563 -0.213963 0.904699 -0.436135 1.818097 -0.658853 2.720622l0.06019 0.114718c1.337953 -0.07014 1.74399 -0.07014 2.906832 -0.05111l0.09412 -0.10167c0.14775 -0.751922 0.166902 -0.928077 0.49414 -2.450951 0.153769 -0.722019 0.474439 -2.308505 0.632586 -2.873398 0.290574 -0.133748 0.577317 -0.265321 0.850927 -0.265321 0.651738 0 0.572939 0.564894 0.547219 0.789981 -0.02791 0.377864 -0.265401 1.612039 -0.508914 2.671689l-0.162524 0.683962c-0.113275 0.505087 -0.237494 0.996038 -0.350768 1.496776l0.04925 0.100039c1.318799 -0.07014 1.721006 -0.07014 2.847184 -0.05111l0.132427 -0.10167c0.203566 -1.174369 0.263213 -1.488621 0.624378 -3.198524l0.181677 -0.785631C30.881144 22.03861 31.058443 21.258959 30.7914 20.62393 30.509034 19.912241 29.831576 19.740435 29.209387 19.740435" + android:fillColor="#fefefe" /> + <path + android:pathData="M35.611476 21.350299c-0.700989 0.133748 -1.148067 0.222913 -1.59241 0.280544 -0.440512 0.06959 -0.870079 0.133747 -1.547537 0.227262l-0.05363 0.04839 -0.04925 0.0386c-0.07059 0.501282 -0.119841 0.934602 -0.213415 1.444039 -0.07935 0.526835 -0.201377 1.125437 -0.400018 1.985553 -0.153769 0.658408 -0.233116 0.887845 -0.320671 1.119457 -0.08537 0.231611 -0.179488 0.456699 -0.352409 1.104233l0.04049 0.05981 0.03393 0.05491c0.633133 -0.0299 1.047378 -0.05111 1.473115 -0.05491 0.42519 -0.01522 0.865702 0 1.547538 0.0038l0.05965 -0.04893 0.06402 -0.05274c0.0985 -0.583922 0.113275 -0.741048 0.173469 -1.025941 0.05965 -0.305554 0.162524 -0.728544 0.414793 -1.85833 0.119294 -0.530641 0.252268 -1.059651 0.37594 -1.601165 0.128596 -0.53934 0.263212 -1.070525 0.391262 -1.601166l-0.01915 -0.06415 -0.02572 -0.05926z" + android:fillColor="#fefefe" /> + <path + android:pathData="M39.37788 23.949786c0.29714 -1.305941 0.647908 -2.402019 1.54316 -2.402019 0.701536 0 0.752427 0.815534 0.440512 2.125825 -0.05582 0.290874 -0.311916 1.372272 -0.658306 1.832777 -0.241871 0.339806 -0.528067 0.545864 -0.84436 0.545864 -0.09412 0 -0.653928 0 -0.662683 -0.825864 -0.0044 -0.407767 0.07935 -0.824233 0.181677 -1.276583m0.100688 3.880311c1.288703 0 2.609691 -0.352854 3.60399 -1.4 0.765013 -0.849243 1.115781 -2.112777 1.237264 -2.633087 0.39564 -1.724583 0.08755 -2.529787 -0.299329 -3.020194 -0.587715 -0.747573 -1.626338 -0.98734 -2.703813 -0.98734 -0.647909 0 -2.191068 0.06361 -3.396594 1.167844 -0.865701 0.796505 -1.265719 1.87736 -1.507043 2.913631 -0.243513 1.055845 -0.523689 2.956583 1.235622 3.663923 0.542842 0.231068 1.325367 0.295223 1.829903 0.295223" + android:fillColor="#fefefe" /> + <path + android:pathData="M67.630235 24.087829c0.301518 -1.282563 0.647908 -2.368311 1.545348 -2.368311 0.567467 0 0.866796 0.520855 0.805508 1.408156 -0.04816 0.221281 -0.100141 0.454524 -0.161977 0.718213 -0.08974 0.381127 -0.187149 0.758991 -0.281818 1.137398 -0.09631 0.258253 -0.207944 0.502913 -0.331616 0.665476 -0.230926 0.325126 -0.780335 0.526835 -1.096628 0.526835 -0.08974 0 -0.64353 0 -0.662683 -0.811184 -0.0044 -0.403962 0.07935 -0.819884 0.183866 -1.276583m-2.95827 -0.06361c-0.245702 1.040622 -0.528067 2.94136 1.222489 3.618797 0.558164 0.235961 1.058323 0.306097 1.56669 0.280543 0.536823 -0.02881 1.034245 -0.29631 1.495004 -0.681242 -0.04159 0.158213 -0.08263 0.316427 -0.124766 0.475184l0.07935 0.10167c1.259153 -0.05274 1.650415 -0.05274 3.014086 -0.04241l0.123672 -0.09351c0.199188 -1.163495 0.386885 -2.293826 0.904554 -4.519146 0.252269 -1.066175 0.50399 -2.122019 0.762825 -3.183845l-0.04049 -0.116893c-1.408544 0.25934 -1.785031 0.314796 -3.139947 0.505631l-0.102878 0.08319c-0.01423 0.108194 -0.02736 0.212038 -0.04104 0.315883 -0.21068 -0.338175 -0.516028 -0.626874 -0.987185 -0.806835 -0.602489 -0.235417 -2.017599 0.06796 -3.234069 1.168388 -0.854757 0.785632 -1.265172 1.862136 -1.498287 2.894602" + android:fillColor="#fefefe" /> + <path + android:pathData="M47.54125 27.662206l0.100688 -0.10167c0.142825 -0.751922 0.166355 -0.928621 0.483195 -2.450952 0.158147 -0.722019 0.484837 -2.308504 0.638606 -2.873398 0.291121 -0.134291 0.572939 -0.265864 0.855304 -0.265864 0.647908 0 0.568562 0.564893 0.542842 0.789981 -0.02353 0.378408 -0.261024 1.612039 -0.508914 2.671689l-0.153769 0.683961c-0.117652 0.505631 -0.245702 0.996039 -0.358976 1.497321l0.04925 0.100039c1.323177 -0.07014 1.710061 -0.07014 2.842806 -0.05111l0.136805 -0.10167c0.198641 -1.174913 0.252269 -1.489165 0.624378 -3.198524l0.177299 -0.786175c0.354599 -1.537554 0.534087 -2.31666 0.271421 -2.951689 -0.290573 -0.71169 -0.972409 -0.883496 -1.585843 -0.883496 -0.406584 0 -1.152444 0.09732 -1.815128 0.422447 -0.236946 0.123417 -0.474439 0.26532 -0.707555 0.407767l0.203019 -0.781282 -0.108897 -0.132116C47.81486 19.942361 47.492 19.980419 46.187975 20.163099l-0.100141 0.07231c-0.158146 1.248854 -0.286743 2.187262 -0.848738 4.642563 -0.213963 0.904699 -0.436134 1.818097 -0.658305 2.720621l0.05965 0.114719c1.340141 -0.07014 1.740159 -0.07014 2.900812 -0.05111" + android:fillColor="#fefefe" /> + <path + android:pathData="M58.883255 20.560264c0 0 0.929726 -4.018408 0.925349 -4.003184l0.0301 -0.206059 0.01259 -0.157126 0.372109 0.03806c0 0 1.917458 0.163651 1.96233 0.168 0.756805 0.290874 1.068721 1.040622 0.850927 2.019262 -0.198641 0.894369 -0.782524 1.646292 -1.532762 2.009476 -0.617812 0.307728 -1.374617 0.333282 -2.154405 0.333282l-0.504536 0 0.03831 -0.201709zm-1.620318 7.152777c0.08318 -0.403418 0.577317 -2.794563 0.581695 -2.794563 0 0 0.420812 -1.754486 0.446531 -1.818097 0 0 0.132428 -0.18268 0.264855 -0.254991l0.19481 0c1.838111 0 3.913716 0 5.5406 -1.189048 1.107026 -0.815534 1.863831 -2.019806 2.201465 -3.483418 0.08756 -0.358835 0.152127 -0.785631 0.152127 -1.212427 0 -0.560544 -0.113274 -1.115107 -0.440512 -1.548427 -0.829585 -1.153165 -2.481641 -1.174369 -4.388702 -1.183068 -0.006 0 -0.940124 0.0087 -0.940124 0.0087 -2.441147 0.0299 -3.420123 0.0212 -3.82233 -0.02773 -0.03393 0.176699 -0.09795 0.490951 -0.09795 0.490951 0 0 -0.874457 4.026563 -0.874457 4.033088 0 0 -2.092569 8.560932 -2.191068 8.964349 2.130874 -0.02555 3.005331 -0.02555 3.373062 0.01468l0 0z" + android:fillColor="#fefefe" /> + <path + android:pathData="M83.078523 19.853033l-0.108897 -0.123417c-1.393769 0.280543 -1.646037 0.325126 -2.926532 0.496932l-0.09412 0.09351c-0.0044 0.01522 -0.0082 0.0386 -0.01478 0.05981l-0.0044 -0.0212c-0.953257 2.185087 -0.925349 1.713709 -1.701306 3.433942 -0.0044 -0.07829 -0.0044 -0.127224 -0.0088 -0.210408l-0.194263 -3.729165 -0.12203 -0.123417c-1.459982 0.280543 -1.494457 0.325126 -2.842807 0.496932l-0.105066 0.09351c-0.01478 0.04458 -0.01478 0.09352 -0.02353 0.146796l0.0088 0.01903c0.168544 0.855767 0.12805 0.664932 0.297141 2.015457 0.0788 0.662757 0.183866 1.32932 0.262665 1.983378 0.132427 1.096078 0.207396 1.635418 0.369921 3.307263 -0.910574 1.49297 -1.126726 2.057863 -2.002825 3.368155l0.006 0.01359 -0.617264 0.969398c-0.07059 0.102214 -0.134616 0.17235 -0.22436 0.202252 -0.0985 0.04839 -0.226549 0.05709 -0.404396 0.05709l-0.342012 0 -0.508367 1.68 1.743989 0.0299c1.023848 -0.0043 1.667379 -0.480078 2.013769 -1.119457l1.096628 -1.867029 -0.01806 0 0.116011 -0.131572c0.737652 -1.577787 6.348844 -11.141282 6.348844 -11.141282" + android:fillColor="#fefefe" /> + <path + android:pathData="M35.626415 19.179837c-0.636964 -0.373515 -1.754934 -0.25499 -2.507361 0.260971 -0.750239 0.505631 -0.835605 1.223301 -0.20083 1.601709 0.62602 0.363184 1.748367 0.254446 2.494228 -0.265321 0.748596 -0.516505 0.842171 -1.22765 0.213963 -1.597359" + android:fillColor="#fefefe" /> + </group> +</vector> \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java b/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java index 02060071..ab527ed 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java
@@ -25,7 +25,6 @@ private boolean mEnableAnimations; private boolean mEnablePrerendering; private boolean mEnableToolbarSwipe; - private boolean mDisableDomainReliability; private final boolean mEnableFullscreen; @@ -49,7 +48,6 @@ mEnableAnimations = false; mEnablePrerendering = false; mEnableToolbarSwipe = false; - mDisableDomainReliability = true; } else { mEnableSnapshots = true; mEnableLayerDecorationCache = true; @@ -57,7 +55,6 @@ mEnableAnimations = true; mEnablePrerendering = true; mEnableToolbarSwipe = true; - mDisableDomainReliability = false; } if (DeviceFormFactor.isTablet(ContextUtils.getApplicationContext())) { @@ -66,6 +63,7 @@ // Flag based configurations. CommandLine commandLine = CommandLine.getInstance(); + assert commandLine.isNativeImplementation(); mEnableAccessibilityLayout |= commandLine .hasSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER); mEnableFullscreen = @@ -125,11 +123,4 @@ public static boolean enableToolbarSwipe() { return getInstance().mEnableToolbarSwipe; } - - /** - * @return Whether or not to disable domain reliability. - */ - public static boolean disableDomainReliability() { - return getInstance().mDisableDomainReliability; - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java index c83111b..ae80955b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -25,6 +25,7 @@ import org.chromium.base.Log; import org.chromium.base.PathUtils; import org.chromium.base.ResourceExtractor; +import org.chromium.base.SysUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.TraceEvent; import org.chromium.base.annotations.RemovableInRelease; @@ -37,7 +38,6 @@ import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.FileProviderHelper; import org.chromium.chrome.browser.crash.MinidumpDirectoryObserver; -import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.chrome.browser.download.DownloadManagerService; import org.chromium.chrome.browser.services.GoogleServicesManager; import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl; @@ -170,7 +170,7 @@ // Domain reliability uses significant enough memory that we should disable it on low memory // devices for now. // TODO(zbowling): remove this after domain reliability is refactored. (crbug.com/495342) - if (DeviceClassManager.disableDomainReliability()) { + if (SysUtils.isLowEndDevice()) { CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_DOMAIN_RELIABILITY); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java index 2ccd407..63ef57e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java
@@ -146,8 +146,7 @@ /** Returns true if the snackbar promo is allowed to be shown. */ public boolean isSnackbarPromoAllowed(String url) { - return url.startsWith(UrlConstants.HTTP_URL_PREFIX) && isDataReductionProxyEnabled() - && isDataReductionProxyPromoAllowed(); + return url.startsWith(UrlConstants.HTTP_URL_PREFIX) && isDataReductionProxyEnabled(); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/DataReductionPromoSnackbarControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/DataReductionPromoSnackbarControllerTest.java index 678be82..7130321 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/DataReductionPromoSnackbarControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/DataReductionPromoSnackbarControllerTest.java
@@ -10,6 +10,7 @@ import org.chromium.base.ContextUtils; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.preferences.datareduction.DataReductionProxyUma; import org.chromium.chrome.test.ChromeTabbedActivityTestBase; @@ -82,6 +83,37 @@ @MediumTest @CommandLineFlags.Add({ "force-fieldtrials=" + DataReductionPromoSnackbarController.PROMO_FIELD_TRIAL_NAME + + "/SnackbarPromoOnly", + "force-fieldtrial-params=" + DataReductionPromoSnackbarController.PROMO_FIELD_TRIAL_NAME + + ".SnackbarPromoOnly:" + + DataReductionPromoSnackbarController.PROMO_PARAM_NAME + "/" + + FIRST_SNACKBAR_SIZE_MB + ";" + + SECOND_SNACKBAR_SIZE_MB }) + public void testDataReductionPromoSnackbarControllerNoOtherPromos() { + assertFalse(DataReductionPromoUtils.hasSnackbarPromoBeenInitWithStartingSavedBytes()); + + mController.maybeShowDataReductionPromoSnackbar(0); + + assertFalse(mManager.isShowing()); + assertTrue(DataReductionPromoUtils.hasSnackbarPromoBeenInitWithStartingSavedBytes()); + assertEquals(0, DataReductionPromoUtils.getDisplayedSnackbarPromoSavedBytes()); + + mController.maybeShowDataReductionPromoSnackbar(FIRST_SNACKBAR_SIZE_MB * BYTES_IN_MB); + + assertTrue(mManager.isShowing()); + assertTrue(mManager.getCurrentSnackbarForTesting().getText().toString() + .endsWith(FIRST_SNACKBAR_SIZE_STRING)); + assertEquals(FIRST_SNACKBAR_SIZE_MB * BYTES_IN_MB, + DataReductionPromoUtils.getDisplayedSnackbarPromoSavedBytes()); + mManager.dismissSnackbars(mController); + + assertFalse(DataReductionProxySettings.getInstance().isDataReductionProxyPromoAllowed()); + } + + @UiThreadTest + @MediumTest + @CommandLineFlags.Add({ + "force-fieldtrials=" + DataReductionPromoSnackbarController.PROMO_FIELD_TRIAL_NAME + "/Enabled", "force-fieldtrial-params=" + DataReductionPromoSnackbarController.PROMO_FIELD_TRIAL_NAME + ".Enabled:"
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 42b2955a..ae72f49f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -836,6 +836,8 @@ "page_load_metrics/observers/protocol_page_load_metrics_observer.h", "page_load_metrics/observers/resource_prefetch_predictor_page_load_metrics_observer.cc", "page_load_metrics/observers/resource_prefetch_predictor_page_load_metrics_observer.h", + "page_load_metrics/observers/resource_tracking_page_load_metrics_observer.cc", + "page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h", "page_load_metrics/observers/service_worker_page_load_metrics_observer.cc", "page_load_metrics/observers/service_worker_page_load_metrics_observer.h", "page_load_metrics/observers/subresource_filter_metrics_observer.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 345c928..f0f52cf1 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -981,6 +981,10 @@ flag_descriptions::kWebrtcHwH264EncodingName, flag_descriptions::kWebrtcHwH264EncodingDescription, kOsAndroid | kOsCrOS, FEATURE_VALUE_TYPE(features::kWebRtcHWH264Encoding)}, + {"enable-webrtc-hw-vp8-encoding", + flag_descriptions::kWebrtcHwVP8EncodingName, + flag_descriptions::kWebrtcHwVP8EncodingDescription, kOsAndroid | kOsCrOS, + FEATURE_VALUE_TYPE(features::kWebRtcHWVP8Encoding)}, {"enable-webrtc-srtp-aes-gcm", flag_descriptions::kWebrtcSrtpAesGcmName, flag_descriptions::kWebrtcSrtpAesGcmDescription, kOsAll, SINGLE_VALUE_TYPE(switches::kEnableWebRtcSrtpAesGcm)},
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.cc b/chrome/browser/android/offline_pages/background_loader_offliner.cc index 74d0f08..acfa8b67 100644 --- a/chrome/browser/android/offline_pages/background_loader_offliner.cc +++ b/chrome/browser/android/offline_pages/background_loader_offliner.cc
@@ -4,9 +4,11 @@ #include "chrome/browser/android/offline_pages/background_loader_offliner.h" +#include "base/bind.h" #include "base/json/json_writer.h" #include "base/metrics/histogram_macros.h" #include "base/sys_info.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" #include "chrome/browser/android/offline_pages/offliner_helper.h" @@ -72,6 +74,13 @@ "OfflinePages.Background.BackgroundLoadingFailedCode"), std::abs(error_code)); } + +void HandleApplicationStateChangeCancel( + const Offliner::CompletionCallback& completion_callback, + const SavePageRequest& canceled_request) { + completion_callback.Run(canceled_request, + Offliner::RequestStatus::FOREGROUND_CANCELED); +} } // namespace BackgroundLoaderOffliner::BackgroundLoaderOffliner( @@ -189,33 +198,36 @@ return true; } -void BackgroundLoaderOffliner::Cancel(const CancelCallback& callback) { +bool BackgroundLoaderOffliner::Cancel(const CancelCallback& callback) { + DCHECK(pending_request_); + // We ignore the case where pending_request_ is not set, but given the checks + // in RequestCoordinator this should not happen. + if (!pending_request_) + return false; + // TODO(chili): We are not able to cancel a pending // OfflinePageModel::SaveSnapshot() operation. We will notify caller that // cancel completed once the SavePage operation returns. - if (!pending_request_) { - callback.Run(0LL); - return; - } - if (save_state_ != NONE) { save_state_ = DELETE_AFTER_SAVE; cancel_callback_ = callback; - return; + return true; } - int64_t request_id = pending_request_->request_id(); + // Post the cancel callback right after this call concludes. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, *pending_request_.get())); ResetState(); - callback.Run(request_id); + return true; } -bool BackgroundLoaderOffliner::HandleTimeout(const SavePageRequest& request) { +bool BackgroundLoaderOffliner::HandleTimeout(int64_t request_id) { if (pending_request_) { - DCHECK(request.request_id() == pending_request_->request_id()); - if (is_low_bar_met_ && - (request.started_attempt_count() + 1 >= policy_->GetMaxStartedTries() || - request.completed_attempt_count() + 1 >= - policy_->GetMaxCompletedTries())) { + DCHECK(request_id == pending_request_->request_id()); + if (is_low_bar_met_ && (pending_request_->started_attempt_count() + 1 >= + policy_->GetMaxStartedTries() || + pending_request_->completed_attempt_count() + 1 >= + policy_->GetMaxCompletedTries())) { // If we are already in the middle of a save operation, let it finish // but do not return SAVED_ON_LAST_RETRY if (save_state_ == NONE) { @@ -402,14 +414,16 @@ if (save_state_ == DELETE_AFTER_SAVE) { save_state_ = NONE; - cancel_callback_.Run(request.request_id()); + cancel_callback_.Run(request); return; } save_state_ = NONE; Offliner::RequestStatus save_status; - if (save_result == SavePageResult::SUCCESS) { + if (save_result == SavePageResult::ALREADY_EXISTS) { + save_status = RequestStatus::SAVED; + } else if (save_result == SavePageResult::SUCCESS) { if (did_snapshot_on_last_retry) save_status = RequestStatus::SAVED_ON_LAST_RETRY; else @@ -446,25 +460,14 @@ application_state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { DVLOG(1) << "App became active, canceling current offlining request"; - SavePageRequest* request = pending_request_.get(); - // This works because Bind will make a copy of request, and we - // should not have to worry about reset being called before cancel callback. - Cancel(base::Bind( - &BackgroundLoaderOffliner::HandleApplicationStateChangeCancel, - weak_ptr_factory_.GetWeakPtr(), *request)); + // No need to check the return value or complete early, as false would + // indicate that there was no request, in which case the state change is + // ignored. + Cancel( + base::Bind(HandleApplicationStateChangeCancel, completion_callback_)); } } -void BackgroundLoaderOffliner::HandleApplicationStateChangeCancel( - const SavePageRequest& request, - int64_t offline_id) { - // If for some reason the request was reset during while waiting for callback - // ignore the completion callback. - if (pending_request_ && pending_request_->request_id() != offline_id) - return; - completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); -} - void BackgroundLoaderOffliner::AddLoadingSignal(const char* signal_name) { base::TimeTicks current_time = base::TimeTicks::Now(); base::TimeDelta delay_so_far = current_time - load_start_time_;
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.h b/chrome/browser/android/offline_pages/background_loader_offliner.h index a09d611b..8e51e30a 100644 --- a/chrome/browser/android/offline_pages/background_loader_offliner.h +++ b/chrome/browser/android/offline_pages/background_loader_offliner.h
@@ -44,8 +44,8 @@ bool LoadAndSave(const SavePageRequest& request, const CompletionCallback& completion_callback, const ProgressCallback& progress_callback) override; - void Cancel(const CancelCallback& callback) override; - bool HandleTimeout(const SavePageRequest& request) override; + bool Cancel(const CancelCallback& callback) override; + bool HandleTimeout(int64_t request_id) override; // WebContentsObserver implementation. void DocumentAvailableInMainFrame() override; @@ -77,8 +77,6 @@ // Called when application state has changed. void OnApplicationStateChange( base::android::ApplicationState application_state); - void HandleApplicationStateChangeCancel(const SavePageRequest& request, - int64_t offline_id); // Called to remember at what time we started loading. void MarkLoadStartTime();
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc index 8ff60b5..fd489a7f 100644 --- a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc +++ b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
@@ -69,6 +69,14 @@ base::Bind(save_page_callback_, SavePageResult::SUCCESS, 123456)); } + void CompleteSavingAsAlreadyExists() { + DCHECK(mock_saving_); + mock_saving_ = false; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(save_page_callback_, + SavePageResult::ALREADY_EXISTS, 123456)); + } + bool mock_saving() const { return mock_saving_; } private: @@ -163,7 +171,7 @@ void OnCompletion(const SavePageRequest& request, Offliner::RequestStatus status); void OnProgress(const SavePageRequest& request, int64_t bytes); - void OnCancel(int64_t offline_id); + void OnCancel(const SavePageRequest& request); content::TestBrowserThreadBundle thread_bundle_; TestingProfile profile_; std::unique_ptr<OfflinerPolicy> policy_; @@ -208,7 +216,7 @@ progress_ = bytes; } -void BackgroundLoaderOfflinerTest::OnCancel(int64_t offline_id) { +void BackgroundLoaderOfflinerTest::OnCancel(const SavePageRequest& request) { DCHECK(!cancel_callback_called_); cancel_callback_called_ = true; } @@ -376,6 +384,24 @@ EXPECT_FALSE(SaveInProgress()); } +TEST_F(BackgroundLoaderOfflinerTest, LoadAndSaveAlreadyExists) { + base::Time creation_time = base::Time::Now(); + SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time, + kUserRequested); + EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), + progress_callback())); + + CompleteLoading(); + PumpLoop(); + model()->CompleteSavingAsAlreadyExists(); + PumpLoop(); + + EXPECT_TRUE(completion_callback_called()); + EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status()); + EXPECT_FALSE(offliner()->is_loading()); + EXPECT_FALSE(SaveInProgress()); +} + TEST_F(BackgroundLoaderOfflinerTest, FailsOnInvalidURL) { base::Time creation_time = base::Time::Now(); SavePageRequest request(kRequestId, kFileUrl, kClientId, creation_time, @@ -495,13 +521,13 @@ base::Time creation_time = base::Time::Now(); SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time, kUserRequested); + request.set_started_attempt_count(policy()->GetMaxStartedTries() - 1); EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); - request.set_started_attempt_count(policy()->GetMaxStartedTries() - 1); - // Sets lowbar. + // Guarantees low bar for saving is met. offliner()->DocumentAvailableInMainFrame(); // Timeout - EXPECT_TRUE(offliner()->HandleTimeout(request)); + EXPECT_TRUE(offliner()->HandleTimeout(kRequestId)); EXPECT_TRUE(SaveInProgress()); model()->CompleteSavingAsSuccess(); PumpLoop(); @@ -512,13 +538,13 @@ base::Time creation_time = base::Time::Now(); SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time, kUserRequested); + request.set_completed_attempt_count(policy()->GetMaxCompletedTries() - 1); EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); - request.set_completed_attempt_count(policy()->GetMaxCompletedTries() - 1); - // Sets lowbar. + // Guarantees low bar for saving is met. offliner()->DocumentAvailableInMainFrame(); // Timeout - EXPECT_TRUE(offliner()->HandleTimeout(request)); + EXPECT_TRUE(offliner()->HandleTimeout(kRequestId)); EXPECT_TRUE(SaveInProgress()); model()->CompleteSavingAsSuccess(); PumpLoop(); @@ -533,7 +559,7 @@ progress_callback())); request.set_started_attempt_count(policy()->GetMaxStartedTries() - 1); // Timeout - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(SaveInProgress()); } @@ -546,7 +572,7 @@ progress_callback())); request.set_completed_attempt_count(policy()->GetMaxCompletedTries() - 1); // Timeout - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(SaveInProgress()); } @@ -559,7 +585,7 @@ // Sets lowbar. offliner()->DocumentAvailableInMainFrame(); // Timeout - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(SaveInProgress()); }
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner.cc b/chrome/browser/android/offline_pages/prerendering_offliner.cc index 899bc107..ea148955 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner.cc +++ b/chrome/browser/android/offline_pages/prerendering_offliner.cc
@@ -8,6 +8,7 @@ #include "base/json/json_writer.h" #include "base/metrics/histogram_macros.h" #include "base/sys_info.h" +#include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" #include "chrome/browser/android/offline_pages/offliner_helper.h" #include "chrome/browser/profiles/profile.h" @@ -21,14 +22,21 @@ #include "content/public/browser/mhtml_extra_parts.h" #include "content/public/browser/web_contents.h" +namespace offline_pages { + namespace { const char kContentType[] = "text/plain"; const char kContentTransferEncodingBinary[] = "Content-Transfer-Encoding: binary"; const char kXHeaderForSignals[] = "X-Chrome-Loading-Metrics-Data: 1"; -} // namespace -namespace offline_pages { +void HandleApplicationStateChangeCancel( + const Offliner::CompletionCallback& completion_callback, + const SavePageRequest& canceled_request) { + completion_callback.Run(canceled_request, + Offliner::RequestStatus::FOREGROUND_CANCELED); +} +} // namespace PrerenderingOffliner::PrerenderingOffliner( content::BrowserContext* browser_context, @@ -157,7 +165,9 @@ // Determine status and run the completion callback. Offliner::RequestStatus save_status; - if (save_result == SavePageResult::SUCCESS) { + if (save_result == SavePageResult::ALREADY_EXISTS) { + save_status = RequestStatus::SAVED; + } else if (save_result == SavePageResult::SUCCESS) { if (saved_on_last_retry_) save_status = RequestStatus::SAVED_ON_LAST_RETRY; else @@ -254,24 +264,26 @@ return accepted; } -void PrerenderingOffliner::Cancel(const CancelCallback& callback) { - int64_t request_id = 0LL; - if (pending_request_) { - request_id = pending_request_->request_id(); - pending_request_.reset(nullptr); - app_listener_.reset(nullptr); - GetOrCreateLoader()->StopLoading(); - // TODO(dougarnett): Consider ability to cancel SavePage request. - } - callback.Run(request_id); +bool PrerenderingOffliner::Cancel(const CancelCallback& callback) { + if (!pending_request_) + return false; + + // Post the cancel callback right after this call concludes. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, *pending_request_.get())); + GetOrCreateLoader()->StopLoading(); + pending_request_.reset(nullptr); + app_listener_.reset(nullptr); + return true; } -bool PrerenderingOffliner::HandleTimeout(const SavePageRequest& request) { +bool PrerenderingOffliner::HandleTimeout(int64_t request_id) { if (pending_request_) { - DCHECK(request.request_id() == pending_request_->request_id()); + DCHECK(request_id == pending_request_->request_id()); if (GetOrCreateLoader()->IsLowbarMet() && - (request.started_attempt_count() + 1 >= policy_->GetMaxStartedTries() || - request.completed_attempt_count() + 1 >= + (pending_request_->started_attempt_count() + 1 >= + policy_->GetMaxStartedTries() || + pending_request_->completed_attempt_count() + 1 >= policy_->GetMaxCompletedTries())) { saved_on_last_retry_ = true; GetOrCreateLoader()->StartSnapshot(); @@ -318,21 +330,11 @@ application_state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { DVLOG(1) << "App became active, canceling current offlining request"; - SavePageRequest* request = pending_request_.get(); - // This works because Bind will make a copy of request, and we - // should not have to worry about reset being called before cancel callback. - Cancel(base::Bind(&PrerenderingOffliner::HandleApplicationStateChangeCancel, - weak_ptr_factory_.GetWeakPtr(), *request)); + // No need to check the return value or complete early, as false would + // indicate that there was no request, in which case the state change is + // ignored. + Cancel( + base::Bind(HandleApplicationStateChangeCancel, completion_callback_)); } } - -void PrerenderingOffliner::HandleApplicationStateChangeCancel( - const SavePageRequest& request, - int64_t offline_id) { - // This shouldn't be immediate, but account for case where request was reset - // while waiting for callback. - if (pending_request_ && pending_request_->request_id() != offline_id) - return; - completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); -} } // namespace offline_pages
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner.h b/chrome/browser/android/offline_pages/prerendering_offliner.h index 02dd912..e7a934e4 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner.h +++ b/chrome/browser/android/offline_pages/prerendering_offliner.h
@@ -37,8 +37,8 @@ bool LoadAndSave(const SavePageRequest& request, const CompletionCallback& completion_callback, const ProgressCallback& progress_callback) override; - void Cancel(const CancelCallback& callback) override; - bool HandleTimeout(const SavePageRequest& request) override; + bool Cancel(const CancelCallback& callback) override; + bool HandleTimeout(int64_t request_id) override; // Allows a loader to be injected for testing. This may only be done once // and must be called before any of the Offliner interface methods are called. @@ -80,8 +80,6 @@ // Listener function for changes to application background/foreground state. void OnApplicationStateChange( base::android::ApplicationState application_state); - void HandleApplicationStateChangeCancel(const SavePageRequest& request, - int64_t offline_id); // Not owned. content::BrowserContext* browser_context_;
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc b/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc index b646818..7e73c92 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc +++ b/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc
@@ -207,7 +207,7 @@ void OnCompletion(const SavePageRequest& request, Offliner::RequestStatus status); void OnProgress(const SavePageRequest& request, int64_t bytes); - void OnCancel(int64_t offline_id); + void OnCancel(const SavePageRequest& request); content::TestBrowserThreadBundle thread_bundle_; TestingProfile profile_; @@ -251,7 +251,7 @@ void PrerenderingOfflinerTest::OnProgress(const SavePageRequest& request, int64_t bytes) {} -void PrerenderingOfflinerTest::OnCancel(int64_t offline_id) { +void PrerenderingOfflinerTest::OnCancel(const SavePageRequest& request) { DCHECK(!cancel_callback_called_); cancel_callback_called_ = true; } @@ -481,7 +481,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(true); - EXPECT_TRUE(offliner()->HandleTimeout(request)); + EXPECT_TRUE(offliner()->HandleTimeout(kRequestId)); EXPECT_TRUE(loader()->start_snapshot_called()); PumpLoop(); // EXPECT_TRUE(SaveInProgress()); @@ -502,7 +502,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(true); - EXPECT_TRUE(offliner()->HandleTimeout(request)); + EXPECT_TRUE(offliner()->HandleTimeout(kRequestId)); EXPECT_TRUE(loader()->start_snapshot_called()); } @@ -517,7 +517,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(false); - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(loader()->start_snapshot_called()); } @@ -532,7 +532,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(false); - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(loader()->start_snapshot_called()); } @@ -546,7 +546,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(true); - EXPECT_TRUE(offliner()->HandleTimeout(request)); + EXPECT_TRUE(offliner()->HandleTimeout(kRequestId)); EXPECT_TRUE(loader()->start_snapshot_called()); } @@ -559,7 +559,7 @@ EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), progress_callback())); loader()->set_is_lowbar_met(true); - EXPECT_FALSE(offliner()->HandleTimeout(request)); + EXPECT_FALSE(offliner()->HandleTimeout(kRequestId)); EXPECT_FALSE(loader()->start_snapshot_called()); }
diff --git a/chrome/browser/android/resource_id.h b/chrome/browser/android/resource_id.h index 2779e1a..17067e6 100644 --- a/chrome/browser/android/resource_id.h +++ b/chrome/browser/android/resource_id.h
@@ -72,6 +72,7 @@ LINK_RESOURCE_ID(IDR_AUTOFILL_CC_JCB, R.drawable.ic_credit_card_black) LINK_RESOURCE_ID(IDR_AUTOFILL_CC_MASTERCARD, R.drawable.mc_card) LINK_RESOURCE_ID(IDR_AUTOFILL_CC_MIR, R.drawable.mir_card) +LINK_RESOURCE_ID(IDR_AUTOFILL_CC_UNIONPAY, R.drawable.unionpay_card) LINK_RESOURCE_ID(IDR_AUTOFILL_CC_VISA, R.drawable.visa_card) LINK_RESOURCE_ID(IDR_AUTOFILL_CC_SCAN_NEW, R.drawable.ic_photo_camera_black) LINK_RESOURCE_ID(IDR_AUTOFILL_HTTP_WARNING, R.drawable.ic_info_outline_grey)
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.cc b/chrome/browser/android/vr_shell/textures/ui_texture.cc index 36cab833..3b074323 100644 --- a/chrome/browser/android/vr_shell/textures/ui_texture.cc +++ b/chrome/browser/android/vr_shell/textures/ui_texture.cc
@@ -55,6 +55,9 @@ sk_sp<SkTypeface> tf(font_mgr->matchFamilyStyleCharacter( default_font.GetFontName().c_str(), SkFontStyle(), nullptr, 0, it.get())); + // TODO(acondor): How should we handle no matching font? + if (!tf) + continue; SkString sk_name; tf->getFamilyName(&sk_name); std::string name(sk_name.c_str());
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc index c1ca630..f538d662 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc +++ b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
@@ -28,13 +28,12 @@ void ScreenshotCallback( const mojom::VoiceInteractionFrameworkHost::CaptureFocusedWindowCallback& callback, - scoped_refptr<base::RefCountedMemory> png_data) { - if (png_data.get() == nullptr) { + scoped_refptr<base::RefCountedMemory> data) { + if (data.get() == nullptr) { callback.Run(std::vector<uint8_t>{}); return; } - std::vector<uint8_t> result(png_data->front(), - png_data->front() + png_data->size()); + std::vector<uint8_t> result(data->front(), data->front() + data->size()); callback.Run(result); } @@ -123,11 +122,12 @@ callback.Run(std::vector<uint8_t>{}); return; } - ui::GrabWindowSnapshotAsyncPNG(window, gfx::Rect(window->bounds().size()), - base::CreateTaskRunnerWithTraits( - base::TaskTraits().MayBlock().WithPriority( - base::TaskPriority::USER_BLOCKING)), - base::Bind(&ScreenshotCallback, callback)); + ui::GrabWindowSnapshotAsyncJPEG( + window, gfx::Rect(window->bounds().size()), + base::CreateTaskRunnerWithTraits( + base::TaskTraits().MayBlock().WithPriority( + base::TaskPriority::USER_BLOCKING)), + base::Bind(&ScreenshotCallback, callback)); } void ArcVoiceInteractionFrameworkService::CaptureFullscreen( @@ -137,11 +137,12 @@ // the screenshot to it. aura::Window* window = ash::Shell::GetPrimaryRootWindow(); DCHECK(window); - ui::GrabWindowSnapshotAsyncPNG(window, gfx::Rect(window->bounds().size()), - base::CreateTaskRunnerWithTraits( - base::TaskTraits().MayBlock().WithPriority( - base::TaskPriority::USER_BLOCKING)), - base::Bind(&ScreenshotCallback, callback)); + ui::GrabWindowSnapshotAsyncJPEG( + window, gfx::Rect(window->bounds().size()), + base::CreateTaskRunnerWithTraits( + base::TaskTraits().MayBlock().WithPriority( + base::TaskPriority::USER_BLOCKING)), + base::Bind(&ScreenshotCallback, callback)); } void ArcVoiceInteractionFrameworkService::OnMetalayerClosed() {
diff --git a/chrome/browser/chromeos/camera_detector.cc b/chrome/browser/chromeos/camera_detector.cc index 918a869..13e3548 100644 --- a/chrome/browser/chromeos/camera_detector.cc +++ b/chrome/browser/chromeos/camera_detector.cc
@@ -11,7 +11,7 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/task_runner_util.h" -#include "base/threading/sequenced_worker_pool.h" +#include "base/task_scheduler/post_task.h" #include "components/storage_monitor/udev_util_linux.h" #include "content/public/browser/browser_thread.h" @@ -47,10 +47,14 @@ DVLOG(1) << "Starting camera presence check"; presence_check_in_progress_ = true; base::PostTaskAndReplyWithResult( - BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN).get(), - FROM_HERE, - base::Bind(&CameraDetector::CheckPresence), + base::CreateTaskRunnerWithTraits( + base::TaskTraits() + .MayBlock() + .WithPriority(base::TaskPriority::BACKGROUND) + .WithShutdownBehavior( + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)) + .get(), + FROM_HERE, base::Bind(&CameraDetector::CheckPresence), base::Bind(&CameraDetector::OnPresenceCheckDone, callback)); }
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc index 4259daa..b5bb95f 100644 --- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc +++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
@@ -17,6 +17,7 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_checker.h" #include "chrome/browser/chrome_notification_types.h" @@ -75,8 +76,6 @@ crypto::ScopedPK11Slot public_slot, crypto::ScopedPK11Slot private_slot, const ReloadKeyCallback& callback) { - DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - std::vector<uint8_t> public_key_data; scoped_refptr<PublicKey> public_key; if (!owner_key_util->ImportPublicKey(&public_key_data)) { @@ -116,8 +115,12 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_refptr<base::TaskRunner> task_runner = - BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); + base::CreateTaskRunnerWithTraits( + base::TaskTraits() + .MayBlock() + .WithPriority(base::TaskPriority::BACKGROUND) + .WithShutdownBehavior( + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); task_runner->PostTask( FROM_HERE, base::Bind( @@ -163,8 +166,12 @@ return; } scoped_refptr<base::TaskRunner> task_runner = - BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); + base::CreateTaskRunnerWithTraits( + base::TaskTraits() + .MayBlock() + .WithPriority(base::TaskPriority::BACKGROUND) + .WithShutdownBehavior( + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); base::PostTaskAndReplyWithResult( task_runner.get(), FROM_HERE,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index dc668e72..04b8048 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -554,6 +554,12 @@ "Support in WebRTC for encoding h264 video streams using platform " "hardware."; +const char kWebrtcHwVP8EncodingName[] = "WebRTC hardware vp8 video encoding"; + +const char kWebrtcHwVP8EncodingDescription[] = + "Support in WebRTC for encoding vp8 video streams using platform " + "hardware."; + const char kWebrtcSrtpAesGcmName[] = "Negotiation with GCM cipher suites for SRTP in WebRTC";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index bfcb0d02..cc6bedd 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -603,6 +603,14 @@ // encoding support. extern const char kWebrtcHwH264EncodingDescription[]; +// Name of chrome:flags option to turn on WebRTC vp8 hardware video encoding +// support. +extern const char kWebrtcHwVP8EncodingName[]; + +// Description of chrome:flags option to turn on WebRTC hardware vp8 video +// encoding support. +extern const char kWebrtcHwVP8EncodingDescription[]; + // Name of chrome:flags option to enable GCM cipher suites for WebRTC extern const char kWebrtcSrtpAesGcmName[];
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc index 2123d4f..a0c7a7b 100644 --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -345,6 +345,26 @@ } } +void NotifyUIThreadOfRequestStarted( + const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, + const content::GlobalRequestID& request_id, + ResourceType resource_type, + base::TimeTicks request_creation_time) { + content::WebContents* web_contents = web_contents_getter.Run(); + + if (!web_contents) + return; + + page_load_metrics::MetricsWebContentsObserver* metrics_observer = + page_load_metrics::MetricsWebContentsObserver::FromWebContents( + web_contents); + + if (metrics_observer) { + metrics_observer->OnRequestStarted(request_id, resource_type, + request_creation_time); + } +} + void NotifyUIThreadOfRequestComplete( const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, const GURL& url, @@ -446,6 +466,17 @@ safe_browsing_->OnResourceRequest(request); const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); + + // TODO(petewil): Unify the safe browsing request and the metrics observer + // request if possible so we only have to cross to the main thread once. + // http://crbug.com/712312. + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&NotifyUIThreadOfRequestStarted, + info->GetWebContentsGetterForRequest(), + info->GetGlobalRequestID(), info->GetResourceType(), + request->creation_time())); + ProfileIOData* io_data = ProfileIOData::FromResourceContext( resource_context);
diff --git a/chrome/browser/memory/tab_manager_browsertest.cc b/chrome/browser/memory/tab_manager_browsertest.cc index a5bad6b..cfe3b33 100644 --- a/chrome/browser/memory/tab_manager_browsertest.cc +++ b/chrome/browser/memory/tab_manager_browsertest.cc
@@ -188,7 +188,7 @@ } // On Linux, memory pressure listener is not implemented yet. -#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) +#if defined(OS_WIN) || defined(OS_MACOSX) // Test that the MemoryPressureListener event is properly triggering a tab // discard upon |MEMORY_PRESSURE_LEVEL_CRITICAL| event.
diff --git a/chrome/browser/memory/tab_manager_delegate_chromeos.cc b/chrome/browser/memory/tab_manager_delegate_chromeos.cc index 02ecbd6..dbc66dc 100644 --- a/chrome/browser/memory/tab_manager_delegate_chromeos.cc +++ b/chrome/browser/memory/tab_manager_delegate_chromeos.cc
@@ -588,21 +588,23 @@ GetSortedCandidates(tab_list, arc_processes); int target_memory_to_free_kb = mem_stat_->TargetMemoryToFreeKB(); - bool killed_candidate = false; // Kill processes until the estimated amount of freed memory is sufficient to // bring the system memory back to a normal level. // The list is sorted by descending importance, so we go through the list // backwards. for (auto it = candidates.rbegin(); it != candidates.rend(); ++it) { - VLOG(3) << "Target memory to free: " << target_memory_to_free_kb << " KB"; + MEMORY_LOG(ERROR) << "Target memory to free: " << target_memory_to_free_kb + << " KB"; + if (target_memory_to_free_kb <= 0) + break; // Never kill selected tab or Android foreground app, regardless whether // they're in the active window. Since the user experience would be bad. ProcessType process_type = it->process_type(); if (process_type == ProcessType::VISIBLE_APP || process_type == ProcessType::FOCUSED_APP || process_type == ProcessType::FOCUSED_TAB) { - VLOG(2) << "Skipped killing " << *it; + MEMORY_LOG(ERROR) << "Skipped killing " << *it; continue; } if (it->app()) { @@ -613,7 +615,8 @@ MemoryKillsMonitor::LogLowMemoryKill("APP", estimated_memory_freed_kb); MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " << estimated_memory_freed_kb << " KB freed"; - killed_candidate = true; + } else { + MEMORY_LOG(ERROR) << "Failed to kill " << *it; } } else { int64_t tab_id = it->tab()->tab_contents_id; @@ -627,16 +630,14 @@ MemoryKillsMonitor::LogLowMemoryKill("TAB", estimated_memory_freed_kb); MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " << estimated_memory_freed_kb << " KB freed"; - killed_candidate = true; + } else { + MEMORY_LOG(ERROR) << "Failed to kill " << *it; } } - if (target_memory_to_free_kb < 0) - break; } - if (!killed_candidate) { - MEMORY_LOG(ERROR) << "Low memory: Unable to kill any candidates. " - << "Attempted to free " << target_memory_to_free_kb - << " KB"; + if (target_memory_to_free_kb > 0) { + MEMORY_LOG(ERROR) + << "Unable to kill enough candidates to meet target_memory_to_free_kb "; } }
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc index 3e41fa8..0d15216 100644 --- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc +++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -252,6 +252,24 @@ return nullptr; } +void MetricsWebContentsObserver::OnRequestStarted( + const content::GlobalRequestID& request_id, + content::ResourceType resource_type, + base::TimeTicks creation_time) { + // Note for the main HTML page, the tracker may not exist yet, so + // OnStartedResource will not be called for the main page. While the main + // page is not being tracked today, if we do decide to track it, we will need + // to first make sure that GlobalRequestID is set in an earlier callback. + // TODO(bmcquade): Evaluate whether moving tracker creation to + // DidStartNavigation would address this. + PageLoadTracker* tracker = + GetTrackerOrNullForRequest(request_id, resource_type, creation_time); + if (tracker) { + ExtraRequestStartInfo extra_request_start_info(resource_type); + tracker->OnStartedResource(extra_request_start_info); + } +} + void MetricsWebContentsObserver::OnRequestComplete( const content::GlobalRequestID& request_id, content::ResourceType resource_type, @@ -264,10 +282,10 @@ PageLoadTracker* tracker = GetTrackerOrNullForRequest(request_id, resource_type, creation_time); if (tracker) { - ExtraRequestInfo extra_request_info( + ExtraRequestCompleteInfo extra_request_complete_info( was_cached, raw_body_bytes, was_cached ? 0 : original_content_length, - std::move(data_reduction_proxy_data)); - tracker->OnLoadedResource(extra_request_info); + std::move(data_reduction_proxy_data), resource_type); + tracker->OnLoadedResource(extra_request_complete_info); } }
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h index 3096854..9b14bef 100644 --- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h +++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
@@ -75,6 +75,12 @@ void WillProcessNavigationResponse( content::NavigationHandle* navigation_handle); + // A resource request started on the IO thread. This method is invoked on + // the UI thread. + void OnRequestStarted(const content::GlobalRequestID& request_id, + content::ResourceType resource_type, + base::TimeTicks creation_time); + // A resource request completed on the IO thread. This method is invoked on // the UI thread. void OnRequestComplete(
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc index 51e236ba..35c6bee 100644 --- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
@@ -673,13 +673,14 @@ } void CorePageLoadMetricsObserver::OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) { - if (extra_request_info.was_cached) { + const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) { + if (extra_request_complete_info.was_cached) { ++num_cache_resources_; - cache_bytes_ += extra_request_info.raw_body_bytes; + cache_bytes_ += extra_request_complete_info.raw_body_bytes; } else { ++num_network_resources_; - network_bytes_ += extra_request_info.raw_body_bytes; + network_bytes_ += extra_request_complete_info.raw_body_bytes; } }
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h index c5ec9670..da546785 100644 --- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h
@@ -133,8 +133,8 @@ const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) override; void OnUserInput(const blink::WebInputEvent& event) override; - void OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) override; + void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) override; private: void RecordTimingHistograms(const page_load_metrics::PageLoadTiming& timing,
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc index db9a01ca..7fac352d 100644 --- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
@@ -415,15 +415,17 @@ NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_RELOAD); SimulateTimingUpdate(timing); - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; int64_t network_bytes = 0; @@ -501,15 +503,17 @@ ui::PAGE_TRANSITION_FORWARD_BACK)); SimulateTimingUpdate(timing); - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; int64_t network_bytes = 0; @@ -581,15 +585,17 @@ NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_LINK); SimulateTimingUpdate(timing); - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; int64_t network_bytes = 0;
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc index c9e3c305..d1fbb2f 100644 --- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
@@ -419,23 +419,25 @@ } void DataReductionProxyMetricsObserver::OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) { - if (extra_request_info.data_reduction_proxy_data && - extra_request_info.data_reduction_proxy_data->lofi_received()) { + const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) { + if (extra_request_complete_info.data_reduction_proxy_data && + extra_request_complete_info.data_reduction_proxy_data->lofi_received()) { data_->set_lofi_received(true); } - if (extra_request_info.was_cached) + if (extra_request_complete_info.was_cached) return; - original_network_bytes_ += extra_request_info.original_network_content_length; - network_bytes_ += extra_request_info.raw_body_bytes; + original_network_bytes_ += + extra_request_complete_info.original_network_content_length; + network_bytes_ += extra_request_complete_info.raw_body_bytes; num_network_resources_++; - if (!extra_request_info.data_reduction_proxy_data || - !extra_request_info.data_reduction_proxy_data + if (!extra_request_complete_info.data_reduction_proxy_data || + !extra_request_complete_info.data_reduction_proxy_data ->used_data_reduction_proxy()) { return; } num_data_reduction_proxy_resources_++; - network_bytes_proxied_ += extra_request_info.raw_body_bytes; + network_bytes_proxied_ += extra_request_complete_info.raw_body_bytes; } DataReductionProxyPingbackClient*
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.h b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.h index 7e58d4c..338cb68c 100644 --- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.h
@@ -104,8 +104,8 @@ const page_load_metrics::PageLoadExtraInfo& info) override; void OnParseStop(const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) override; - void OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) override; + void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_compelte_info) override; private: // Sends the page load information to the pingback client.
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc index fbaeae30..51674a9 100644 --- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc
@@ -418,9 +418,10 @@ data->set_lofi_received(true); // Verify LoFi is tracked when a LoFi response is received. - page_load_metrics::ExtraRequestInfo resource = { + page_load_metrics::ExtraRequestCompleteInfo resource = { true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, - 0 /* original_network_content_length */, std::move(data)}; + 0 /* original_network_content_length */, std::move(data), + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}; RunTest(true, false); SimulateLoadedResource(resource); @@ -453,21 +454,25 @@ data->set_used_data_reduction_proxy(true); // Prepare 4 resources of varying size and configurations. - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .1 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, - 1024 * 40 * 10 /* original_network_content_length */, data->DeepCopy()}, + 1024 * 40 * 10 /* original_network_content_length */, data->DeepCopy(), + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .5 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, - 1024 * 40 * 5 /* original_network_content_length */, std::move(data)}, + 1024 * 40 * 5 /* original_network_content_length */, std::move(data), + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; int network_resources = 0; @@ -505,21 +510,25 @@ data->set_used_data_reduction_proxy(true); // Prepare 4 resources of varying size and configurations. - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .1 compression ratio. {false /*was_cached*/, 1024 * 40 * 10 /* raw_body_bytes */, - 1024 * 40 /* original_network_content_length */, data->DeepCopy()}, + 1024 * 40 /* original_network_content_length */, data->DeepCopy(), + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .5 compression ratio. {false /*was_cached*/, 1024 * 40 * 5 /* raw_body_bytes */, - 1024 * 40 /* original_network_content_length */, std::move(data)}, + 1024 * 40 /* original_network_content_length */, std::move(data), + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; int network_resources = 0;
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc index 6e73c491..57a131c 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc
@@ -24,11 +24,12 @@ MediaPageLoadMetricsObserver::~MediaPageLoadMetricsObserver() = default; void MediaPageLoadMetricsObserver::OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) { - if (extra_request_info.was_cached) { - cache_bytes_ += extra_request_info.raw_body_bytes; + const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) { + if (extra_request_complete_info.was_cached) { + cache_bytes_ += extra_request_complete_info.raw_body_bytes; } else { - network_bytes_ += extra_request_info.raw_body_bytes; + network_bytes_ += extra_request_complete_info.raw_body_bytes; } }
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h index bc3c684..c31fba7 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h
@@ -31,8 +31,8 @@ FlushMetricsOnAppEnterBackground( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) override; - void OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) override; + void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) override; void MediaStartedPlaying( const content::WebContentsObserver::MediaPlayerInfo& video_type, bool is_in_main_frame) override;
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc index c64186d..683e34c1 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc
@@ -54,23 +54,27 @@ SimulateTimingUpdate(timing_); // Prepare 4 resources of varying size and configurations. - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .1 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .5 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; for (const auto& request : resources) {
diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc index 17313de..2a0e0313 100644 --- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc +++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
@@ -149,8 +149,14 @@ web_contents()->GetMainFrame()); } +void PageLoadMetricsObserverTestHarness::SimulateStartedResource( + const ExtraRequestStartInfo& info) { + observer_->OnRequestStarted(content::GlobalRequestID(), info.resource_type, + base::TimeTicks::Now()); +} + void PageLoadMetricsObserverTestHarness::SimulateLoadedResource( - const ExtraRequestInfo& info) { + const ExtraRequestCompleteInfo& info) { observer_->OnRequestComplete(content::GlobalRequestID(), content::RESOURCE_TYPE_SCRIPT, info.was_cached, info.data_reduction_proxy_data
diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h index 2f6fd42..90d7dd3 100644 --- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h +++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h
@@ -57,7 +57,10 @@ const PageLoadMetadata& metadata); // Simulates a loaded resource. - void SimulateLoadedResource(const ExtraRequestInfo& info); + void SimulateStartedResource(const ExtraRequestStartInfo& info); + + // Simulates a loaded resource. + void SimulateLoadedResource(const ExtraRequestCompleteInfo& info); // Simulates a user input. void SimulateInputEvent(const blink::WebInputEvent& event);
diff --git a/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.cc new file mode 100644 index 0000000..1f74a34 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.cc
@@ -0,0 +1,39 @@ +// 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 "chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h" + +namespace page_load_metrics { + +ResourceTrackingPageLoadMetricsObserver:: + ResourceTrackingPageLoadMetricsObserver() + : started_count_(0), completed_count_(0) {} +ResourceTrackingPageLoadMetricsObserver:: + ~ResourceTrackingPageLoadMetricsObserver() {} + +void ResourceTrackingPageLoadMetricsObserver::OnStartedResource( + const ExtraRequestStartInfo& extra_request_start_info) { + // TODO(petewiL): Store this by type. + ++started_count_; +} + +void ResourceTrackingPageLoadMetricsObserver::OnLoadedResource( + const ExtraRequestCompleteInfo& extra_request_complete_info) { + // TODO(petewil): Check to see if the type of the request changed. If it did, + // update the old and new types for the started type. Then update by type for + // the completed type. + ++completed_count_; +} + +void ResourceTrackingPageLoadMetricsObserver::GetCountsForTypeForTesting( + const content::ResourceType type, + int64_t* started_count, + int64_t* completed_count) { + if (started_count != nullptr) + *started_count = started_count_; + if (completed_count != nullptr) + *completed_count = completed_count_; +} + +} // namespace page_load_metrics
diff --git a/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h new file mode 100644 index 0000000..58e8d87 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h
@@ -0,0 +1,49 @@ +// 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. + +#ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_ +#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_ + +#include <stdint.h> + +#include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" + +namespace page_load_metrics { + +class ResourceTrackingPageLoadMetricsObserver + : public page_load_metrics::PageLoadMetricsObserver { + public: + ResourceTrackingPageLoadMetricsObserver(); + ~ResourceTrackingPageLoadMetricsObserver() override; + + // Called by the PageLoadMetrics framework when we start a new request, so we + // can update our data structures to be able to calculate a resource done + // percentage. + void OnStartedResource( + const ExtraRequestStartInfo& extra_request_start_info) override; + + // Called by the PageLoadMetrics framework when we start a new request, so we + // can update our data structures to be able to calculate a resource done + // percentage. + void OnLoadedResource( + const ExtraRequestCompleteInfo& extra_request_complete_info) override; + + // For the specified type, get the count of requests started and completed. + // TODO(petewil) Note that type is not used yet, code to use it is coming + // soon. + void GetCountsForTypeForTesting(const content::ResourceType type, + int64_t* started_count, + int64_t* completed_count); + + private: + // TODO(petewil): Some way to keep track of what we've seen + // TODO(petewil): Some way to inform our keeper of aggregate results when they + // change. + int64_t started_count_; + int64_t completed_count_; +}; + +} // namespace page_load_metrics + +#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_
diff --git a/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer_unittest.cc new file mode 100644 index 0000000..be262f4 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer_unittest.cc
@@ -0,0 +1,71 @@ +// 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 "chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h" + +#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" + +namespace { +const char kFakeUrl[] = "http://www.google.com/nothingotseehere.html"; +} // namespace + +namespace page_load_metrics { + +class ResourceTrackingPageLoadMetricsObserverTest + : public page_load_metrics::PageLoadMetricsObserverTestHarness { + public: + ResourceTrackingPageLoadMetricsObserverTest() : observer_(nullptr) {} + + protected: + void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { + std::unique_ptr<page_load_metrics::ResourceTrackingPageLoadMetricsObserver> + observer( + new page_load_metrics::ResourceTrackingPageLoadMetricsObserver()); + // Keep track of the observer pointer so we can check it in the unit test. + observer_ = observer.get(); + tracker->AddObserver(std::move(observer)); + } + + page_load_metrics::ResourceTrackingPageLoadMetricsObserver* observer() { + return observer_; + } + + private: + // observer_ is owned by the last created PageLoadTracker, and its lifetime is + // dictated by that tracker's lifetime. + page_load_metrics::ResourceTrackingPageLoadMetricsObserver* observer_; +}; + +TEST_F(ResourceTrackingPageLoadMetricsObserverTest, StartAndFinish) { + page_load_metrics::ExtraRequestStartInfo start_info_1{ + content::ResourceType::RESOURCE_TYPE_IMAGE}; + + page_load_metrics::ExtraRequestStartInfo start_info_2{ + content::ResourceType::RESOURCE_TYPE_IMAGE}; + + page_load_metrics::ExtraRequestCompleteInfo done_info{ + false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, + 1024 * 40 /* original_network_content_length */, + nullptr /* data reduction_proxy */, + content::ResourceType::RESOURCE_TYPE_IMAGE}; + + // Start the navigation. This will create the page load tracker and register + // the observers. + NavigateAndCommit(GURL(kFakeUrl)); + + // Simulate starting two images, and completing one. + SimulateStartedResource(start_info_1); + SimulateStartedResource(start_info_2); + SimulateLoadedResource(done_info); + + int64_t started = -1; + int64_t completed = -1; + EXPECT_NE(nullptr, observer()); + observer()->GetCountsForTypeForTesting( + content::ResourceType::RESOURCE_TYPE_IMAGE, &started, &completed); + EXPECT_EQ(2, started); + EXPECT_EQ(1, completed); +} + +} // namespace page_load_metrics
diff --git a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.cc index d58ebaf..2894575 100644 --- a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.cc
@@ -168,13 +168,14 @@ } void SubresourceFilterMetricsObserver::OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) { - if (extra_request_info.was_cached) { + const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) { + if (extra_request_complete_info.was_cached) { ++num_cache_resources_; - cache_bytes_ += extra_request_info.raw_body_bytes; + cache_bytes_ += extra_request_complete_info.raw_body_bytes; } else { ++num_network_resources_; - network_bytes_ += extra_request_info.raw_body_bytes; + network_bytes_ += extra_request_complete_info.raw_body_bytes; } }
diff --git a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.h b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.h index f512bed..f6301ab 100644 --- a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.h
@@ -70,8 +70,8 @@ const page_load_metrics::PageLoadExtraInfo& info) override; void OnComplete(const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) override; - void OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) override; + void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) override; void OnParseStop(const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) override; void OnFirstContentfulPaint(
diff --git a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc index 3d222d7..f1d2e060 100644 --- a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc
@@ -156,7 +156,8 @@ SimulateLoadedResource({false /* was_cached */, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); page_load_metrics::PageLoadTiming timing; timing.navigation_start = base::Time::FromDoubleT(1); @@ -168,11 +169,13 @@ SimulateLoadedResource({false /* was_cached */, 1024 * 20 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); SimulateLoadedResource({true /* was_cached */, 1024 * 10 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); histogram_tester().ExpectTotalCount( internal::kHistogramSubresourceFilterCount, 1); @@ -251,7 +254,8 @@ SimulateLoadedResource({false /* was_cached */, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); page_load_metrics::PageLoadTiming timing; timing.navigation_start = base::Time::FromDoubleT(1); @@ -263,11 +267,13 @@ SimulateLoadedResource({false /* was_cached */, 1024 * 20 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); SimulateLoadedResource({true /* was_cached */, 1024 * 10 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}); + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}); histogram_tester().ExpectTotalCount( internal::kHistogramSubresourceFilterCount, 1);
diff --git a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.cc index fb5d5fda..55c868f7 100644 --- a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.cc
@@ -40,11 +40,12 @@ } void TabRestorePageLoadMetricsObserver::OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) { - if (extra_request_info.was_cached) { - cache_bytes_ += extra_request_info.raw_body_bytes; + const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) { + if (extra_request_complete_info.was_cached) { + cache_bytes_ += extra_request_complete_info.raw_body_bytes; } else { - network_bytes_ += extra_request_info.raw_body_bytes; + network_bytes_ += extra_request_complete_info.raw_body_bytes; } }
diff --git a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.h index 316500c..a8c6682 100644 --- a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer.h
@@ -34,8 +34,8 @@ content::NavigationHandle* navigation_handle, const GURL& currently_committed_url, bool started_in_foreground) override; - void OnLoadedResource( - const page_load_metrics::ExtraRequestInfo& extra_request_info) override; + void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& + extra_request_complete_info) override; page_load_metrics::PageLoadMetricsObserver::ObservePolicy FlushMetricsOnAppEnterBackground( const page_load_metrics::PageLoadTiming& timing,
diff --git a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc index 4c5569c6..ffd4f55 100644 --- a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc
@@ -69,23 +69,27 @@ SimulateTimingUpdate(timing_); // Prepare 4 resources of varying size and configurations. - page_load_metrics::ExtraRequestInfo resources[] = { + page_load_metrics::ExtraRequestCompleteInfo resources[] = { // Cached request. {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 0 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached non-proxied request. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .1 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, // Uncached proxied request with .5 compression ratio. {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 1024 * 40 /* original_network_content_length */, - nullptr /* data_reduction_proxy_data */}, + nullptr /* data_reduction_proxy_data */, + content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, }; for (const auto& request : resources) {
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc index e3f395a..836a877a 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
@@ -56,18 +56,28 @@ page_load_metrics::PageLoadMetadata()); } -ExtraRequestInfo::ExtraRequestInfo( +ExtraRequestCompleteInfo::ExtraRequestCompleteInfo( bool was_cached, int64_t raw_body_bytes, int64_t original_network_content_length, std::unique_ptr<data_reduction_proxy::DataReductionProxyData> - data_reduction_proxy_data) + data_reduction_proxy_data, + content::ResourceType detected_resource_type) : was_cached(was_cached), raw_body_bytes(raw_body_bytes), original_network_content_length(original_network_content_length), - data_reduction_proxy_data(std::move(data_reduction_proxy_data)) {} + data_reduction_proxy_data(std::move(data_reduction_proxy_data)), + resource_type(detected_resource_type) {} -ExtraRequestInfo::~ExtraRequestInfo() {} +ExtraRequestCompleteInfo::~ExtraRequestCompleteInfo() {} + +ExtraRequestStartInfo::ExtraRequestStartInfo(content::ResourceType found_type) + : resource_type(found_type) {} + +ExtraRequestStartInfo::ExtraRequestStartInfo( + const ExtraRequestStartInfo& other) = default; + +ExtraRequestStartInfo::~ExtraRequestStartInfo() {} FailedProvisionalLoadInfo::FailedProvisionalLoadInfo(base::TimeDelta interval, net::Error error)
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_observer.h b/chrome/browser/page_load_metrics/page_load_metrics_observer.h index 5c5b29fb..ad62459 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/page_load_metrics_observer.h
@@ -197,15 +197,18 @@ const PageLoadMetadata child_frame_metadata; }; -// Container for various information about a request within a page load. -struct ExtraRequestInfo { - ExtraRequestInfo(bool was_cached, - int64_t raw_body_bytes, - int64_t original_network_content_length, - std::unique_ptr<data_reduction_proxy::DataReductionProxyData> - data_reduction_proxy_data); +// Container for various information about a completed request within a page +// load. +struct ExtraRequestCompleteInfo { + ExtraRequestCompleteInfo( + bool was_cached, + int64_t raw_body_bytes, + int64_t original_network_content_length, + std::unique_ptr<data_reduction_proxy::DataReductionProxyData> + data_reduction_proxy_data, + content::ResourceType detected_resource_type); - ~ExtraRequestInfo(); + ~ExtraRequestCompleteInfo(); // True if the resource was loaded from cache. const bool was_cached; @@ -220,6 +223,27 @@ // Data related to data saver. const std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data_reduction_proxy_data; + + // The type of the request as gleaned from the mime type. This may + // be more accurate than the type in the ExtraRequestStartInfo since we can + // examine the type headers that arrived with the request. During XHRs, we + // sometimes see resources come back as a different type than we expected. + const content::ResourceType resource_type; +}; + +// Container for various information about a started request within a page load. +struct ExtraRequestStartInfo { + explicit ExtraRequestStartInfo(content::ResourceType type); + + ExtraRequestStartInfo(const ExtraRequestStartInfo& other); + + ~ExtraRequestStartInfo(); + + // The type of the request as gleaned from the DOM or the file extension. This + // may be less accurate than the type at request completion time, which has + // access to mime-type headers. During XHRs, we sometimes see resources come + // back as a different type than we expected. + const content::ResourceType resource_type; }; // Interface for PageLoadMetrics observers. All instances of this class are @@ -377,8 +401,13 @@ const FailedProvisionalLoadInfo& failed_provisional_load_info, const PageLoadExtraInfo& extra_info) {} + // Called whenever a request load begins. + virtual void OnStartedResource( + const ExtraRequestStartInfo& extra_request_start_info) {} + // Called whenever a request is loaded for this page load. - virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} + virtual void OnLoadedResource( + const ExtraRequestCompleteInfo& extra_request_complete_info) {} }; } // namespace page_load_metrics
diff --git a/chrome/browser/page_load_metrics/page_load_tracker.cc b/chrome/browser/page_load_metrics/page_load_tracker.cc index 9e92e975..6aab0748 100644 --- a/chrome/browser/page_load_metrics/page_load_tracker.cc +++ b/chrome/browser/page_load_metrics/page_load_tracker.cc
@@ -619,10 +619,17 @@ } } -void PageLoadTracker::OnLoadedResource( - const ExtraRequestInfo& extra_request_info) { +void PageLoadTracker::OnStartedResource( + const ExtraRequestStartInfo& extra_request_start_info) { for (const auto& observer : observers_) { - observer->OnLoadedResource(extra_request_info); + observer->OnStartedResource(extra_request_start_info); + } +} + +void PageLoadTracker::OnLoadedResource( + const ExtraRequestCompleteInfo& extra_request_complete_info) { + for (const auto& observer : observers_) { + observer->OnLoadedResource(extra_request_complete_info); } }
diff --git a/chrome/browser/page_load_metrics/page_load_tracker.h b/chrome/browser/page_load_metrics/page_load_tracker.h index 2760b01..9e25c7d 100644 --- a/chrome/browser/page_load_metrics/page_load_tracker.h +++ b/chrome/browser/page_load_metrics/page_load_tracker.h
@@ -225,7 +225,11 @@ // UpdateTiming. void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); - void OnLoadedResource(const ExtraRequestInfo& extra_request_info); + void OnStartedResource( + const ExtraRequestStartInfo& extra_request_started_info); + + void OnLoadedResource( + const ExtraRequestCompleteInfo& extra_request_complete_info); // Signals that we should stop tracking metrics for the associated page load. // We may stop tracking a page load if it doesn't meet the criteria for
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index 81cb848..66f39bb 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc
@@ -19,7 +19,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/task_runner_util.h" -#include "base/task_scheduler/post_task.h" +#include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.h" #include "components/google/core/browser/google_util.h" #include "components/policy/core/browser/url_blacklist_manager.h" @@ -195,7 +195,8 @@ return builder.Build(); } -std::unique_ptr<SupervisedUserURLFilter::Contents> LoadWhitelistsAsyncThread( +std::unique_ptr<SupervisedUserURLFilter::Contents> +LoadWhitelistsOnBlockingPoolThread( const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists) { FilterBuilder builder; for (const scoped_refptr<SupervisedUserSiteList>& site_list : site_lists) @@ -237,12 +238,9 @@ google_amp_viewer_path_regex_(kGoogleAmpViewerPathPattern), google_web_cache_query_regex_(kGoogleWebCacheQueryPattern), blocking_task_runner_( - base::CreateTaskRunnerWithTraits( - base::TaskTraits() - .MayBlock() - .WithPriority(base::TaskPriority::BACKGROUND) - .WithShutdownBehavior( - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)) + BrowserThread::GetBlockingPool() + ->GetTaskRunnerWithShutdownBehavior( + base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN) .get()), weak_ptr_factory_(this) { DCHECK(amp_cache_path_regex_.ok()); @@ -483,7 +481,7 @@ base::PostTaskAndReplyWithResult( blocking_task_runner_.get(), FROM_HERE, - base::Bind(&LoadWhitelistsAsyncThread, site_lists), + base::Bind(&LoadWhitelistsOnBlockingPoolThread, site_lists), base::Bind(&SupervisedUserURLFilter::SetContents, weak_ptr_factory_.GetWeakPtr())); }
diff --git a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc index c417022e..2192ba0 100644 --- a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc +++ b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
@@ -58,6 +58,7 @@ // Reset the state. received_answer_ = false; model_->SetSearchAnswerAvailable(false); + current_request_url_ = GURL(); if (!model_->search_engine_is_google()) return;
diff --git a/chrome/browser/ui/autofill/autofill_popup_layout_model.cc b/chrome/browser/ui/autofill/autofill_popup_layout_model.cc index e4502f0b..eb55f02 100644 --- a/chrome/browser/ui/autofill/autofill_popup_layout_model.cc +++ b/chrome/browser/ui/autofill/autofill_popup_layout_model.cc
@@ -56,6 +56,7 @@ {"jcbCC", IDR_AUTOFILL_CC_GENERIC}, {"masterCardCC", IDR_AUTOFILL_CC_MASTERCARD}, {"mirCC", IDR_AUTOFILL_CC_MIR}, + {"unionPayCC", IDR_AUTOFILL_CC_UNIONPAY}, {"visaCC", IDR_AUTOFILL_CC_VISA}, #if defined(OS_ANDROID) {"httpWarning", IDR_AUTOFILL_HTTP_WARNING},
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h index 93e1ab5f..f79f8dc 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h
@@ -63,6 +63,10 @@ // Returns the tooltip for this decoration, return |nil| for no tooltip. virtual NSString* GetToolTip(); + // Returns the accessibility label for this decoration, return |nil| to use + // the result of |GetTooltip()| as a fallback. + virtual NSString* GetAccessibilityLabel(); + // Methods to set up and remove the tracking area from the |control_view|. CrTrackingArea* SetupTrackingArea(NSRect frame, NSView* control_view); void RemoveTrackingArea(); @@ -143,6 +147,10 @@ // to the private DecorationAccessibilityView helper class. void OnAccessibilityViewAction(); + // Called when the omnibox decoration changes state to update the + // accessibility view's attributes to match. + void UpdateAccessibilityView(); + DecorationMouseState state() const { return state_; } bool active() const { return active_; } @@ -177,7 +185,7 @@ // True if the decoration is active. bool active_ = false; - base::scoped_nsobject<NSView> accessibility_view_; + base::scoped_nsobject<NSControl> accessibility_view_; // The decoration's tracking area. Only set if the decoration accepts a mouse // press.
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm index d9c7848..7182d5e 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm
@@ -88,7 +88,8 @@ } - (NSString*)accessibilityLabel { - return owner_->GetToolTip(); + NSString* label = owner_->GetAccessibilityLabel(); + return label ? label : owner_->GetToolTip(); } @end @@ -162,6 +163,10 @@ return NSInsetRect(frame, 0.0, kBackgroundFrameYInset); } +void LocationBarDecoration::UpdateAccessibilityView() { + [accessibility_view_.get() setEnabled:AcceptsMousePress()]; +} + void LocationBarDecoration::DrawInFrame(NSRect frame, NSView* control_view) { NOTREACHED(); } @@ -197,6 +202,10 @@ return nil; } +NSString* LocationBarDecoration::GetAccessibilityLabel() { + return nil; +} + CrTrackingArea* LocationBarDecoration::SetupTrackingArea(NSRect frame, NSView* control_view) { if (!AcceptsMousePress() || !control_view)
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index 5c385498..5bfd53c 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -238,8 +238,9 @@ std::vector<LocationBarDecoration*> GetDecorations(); // Updates |decoration|'s accessibility view's position to match the computed - // position the decoration will be drawn at. - void UpdateAccessibilityViewPosition(LocationBarDecoration* decoration); + // position the decoration will be drawn at, and update its enabled state + // based on whether |decoration| is accepting presses currently. + void UpdateAccessibilityView(LocationBarDecoration* decoration); std::unique_ptr<OmniboxViewMac> omnibox_view_;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 7dbe0c7..4b59a6a 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -334,7 +334,7 @@ // change, here. std::vector<LocationBarDecoration*> decorations = GetDecorations(); for (auto* decoration : decorations) - UpdateAccessibilityViewPosition(decoration); + UpdateAccessibilityView(decoration); [field_ updateMouseTracking]; [field_ resetFieldEditorFrameIfNeeded]; [field_ setNeedsDisplay:YES]; @@ -738,7 +738,7 @@ level == security_state::EV_SECURE; } -void LocationBarViewMac::UpdateAccessibilityViewPosition( +void LocationBarViewMac::UpdateAccessibilityView( LocationBarDecoration* decoration) { if (!decoration->IsVisible()) return; @@ -746,6 +746,7 @@ [[field_ cell] frameForDecoration:decoration inFrame:[field_ frame]]; [decoration->GetAccessibilityView() setFrame:r]; [decoration->GetAccessibilityView() setNeedsDisplayInRect:r]; + decoration->UpdateAccessibilityView(); } std::vector<LocationBarDecoration*> LocationBarViewMac::GetDecorations() {
diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h index cc4a62f..e97d075 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h +++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h
@@ -31,6 +31,7 @@ bool AcceptsMousePress() override; bool HasHoverAndPressEffect() override; NSString* GetToolTip() override; + NSString* GetAccessibilityLabel() override; NSPoint GetBubblePointInFrame(NSRect frame) override; NSRect GetBackgroundFrame(NSRect frame) override;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm index ec453049..3aced3c8 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
@@ -102,7 +102,8 @@ } bool LocationIconDecoration::AcceptsMousePress() { - return true; + // The search icon does not accept mouse presses. + return !owner_->GetOmniboxView()->IsEditingOrEmpty(); } bool LocationIconDecoration::HasHoverAndPressEffect() { @@ -131,3 +132,9 @@ return owner_->GetOmniboxView()->IsEditingOrEmpty() ? nil : l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_LOCATION_ICON); } + +NSString* LocationIconDecoration::GetAccessibilityLabel() { + // This button should always be labelled even when the omnibox is being + // edited. + return l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_LOCATION_ICON); +}
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index ee8a34d..0148bf2 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -290,13 +290,6 @@ return gfx::Size(0, View::GetMinimumSize().height()); } -gfx::Size CollectedCookiesViews::GetPreferredSize() const { - int preferred = - ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::MEDIUM); - return gfx::Size(preferred ? preferred : View::GetPreferredSize().width(), - View::GetPreferredSize().height()); -} - void CollectedCookiesViews::ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) { views::DialogDelegateView::ViewHierarchyChanged(details);
diff --git a/chrome/browser/ui/views/collected_cookies_views.h b/chrome/browser/ui/views/collected_cookies_views.h index f3b2830..d8798593 100644 --- a/chrome/browser/ui/views/collected_cookies_views.h +++ b/chrome/browser/ui/views/collected_cookies_views.h
@@ -62,7 +62,6 @@ // views::View: gfx::Size GetMinimumSize() const override; - gfx::Size GetPreferredSize() const override; void ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) override;
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index f6bcb96..88e65c8 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -187,15 +187,10 @@ gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { gfx::Size preferred_size(views::View::GetPreferredSize()); int preferred_width = - ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::SMALL); - if (!preferred_width) - preferred_width = (!content_setting_bubble_model_->bubble_content() - .domain_lists.empty() && - (kMinMultiLineContentsWidth > preferred_size.width())) - ? kMinMultiLineContentsWidth - : preferred_size.width(); - else - preferred_width -= margins().width(); + (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && + (kMinMultiLineContentsWidth > preferred_size.width())) + ? kMinMultiLineContentsWidth + : preferred_size.width(); if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) { preferred_size.set_width(std::min(preferred_width, kMaxDefaultContentsWidth));
diff --git a/chrome/browser/ui/views/device_chooser_content_view.cc b/chrome/browser/ui/views/device_chooser_content_view.cc index 6cc81fd..9f9835e 100644 --- a/chrome/browser/ui/views/device_chooser_content_view.cc +++ b/chrome/browser/ui/views/device_chooser_content_view.cc
@@ -112,13 +112,7 @@ } gfx::Size DeviceChooserContentView::GetPreferredSize() const { - constexpr int kHeight = 320; - constexpr int kDefaultWidth = 402; - int width = - ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::MEDIUM); - if (!width) - width = kDefaultWidth; - return gfx::Size(width, kHeight); + return gfx::Size(402, 320); } int DeviceChooserContentView::RowCount() {
diff --git a/chrome/browser/ui/views/harmony/chrome_layout_provider.cc b/chrome/browser/ui/views/harmony/chrome_layout_provider.cc index ab9efb6d..dd6b727b 100644 --- a/chrome/browser/ui/views/harmony/chrome_layout_provider.cc +++ b/chrome/browser/ui/views/harmony/chrome_layout_provider.cc
@@ -83,7 +83,3 @@ bool ChromeLayoutProvider::IsHarmonyMode() const { return false; } - -int ChromeLayoutProvider::GetDialogPreferredWidth(DialogWidth width) const { - return 0; -}
diff --git a/chrome/browser/ui/views/harmony/chrome_layout_provider.h b/chrome/browser/ui/views/harmony/chrome_layout_provider.h index 1fe25cf..b78c155 100644 --- a/chrome/browser/ui/views/harmony/chrome_layout_provider.h +++ b/chrome/browser/ui/views/harmony/chrome_layout_provider.h
@@ -50,12 +50,6 @@ DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE, }; -enum class DialogWidth { - SMALL, - MEDIUM, - LARGE, -}; - class ChromeLayoutProvider : public views::LayoutProvider { public: ChromeLayoutProvider() {} @@ -64,8 +58,8 @@ static ChromeLayoutProvider* Get(); static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider(); + // views::LayoutProvider: int GetDistanceMetric(int metric) const override; - const views::TypographyProvider& GetTypographyProvider() const override; // Returns the alignment used for control labels in a GridLayout; for example, @@ -92,10 +86,6 @@ // TODO(pkasting): Fix callers and remove this. virtual bool IsHarmonyMode() const; - // Returns the preferred width in DIPs for a dialog of the specified |width|. - // May return 0 if the dialog has no preferred width. - virtual int GetDialogPreferredWidth(DialogWidth width) const; - private: DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); };
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_provider.cc b/chrome/browser/ui/views/harmony/harmony_layout_provider.cc index 35a53b1..d9dbd4df 100644 --- a/chrome/browser/ui/views/harmony/harmony_layout_provider.cc +++ b/chrome/browser/ui/views/harmony/harmony_layout_provider.cc
@@ -95,17 +95,14 @@ return true; } -int HarmonyLayoutProvider::GetDialogPreferredWidth(DialogWidth width) const { - switch (width) { - case DialogWidth::SMALL: - return 320; - case DialogWidth::MEDIUM: - return 448; - case DialogWidth::LARGE: - return 512; +int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const { + for (int snap_point : {320, 448, 512}) { + if (min_width <= snap_point) + return snap_point; } - NOTREACHED(); - return 0; + + return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * + kHarmonyLayoutUnit; } const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider()
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_provider.h b/chrome/browser/ui/views/harmony/harmony_layout_provider.h index a96c5b2e..4db4e62e 100644 --- a/chrome/browser/ui/views/harmony/harmony_layout_provider.h +++ b/chrome/browser/ui/views/harmony/harmony_layout_provider.h
@@ -23,8 +23,8 @@ bool UseExtraDialogPadding() const override; bool ShouldShowWindowIcon() const override; bool IsHarmonyMode() const override; - int GetDialogPreferredWidth(DialogWidth width) const override; const views::TypographyProvider& GetTypographyProvider() const override; + int GetSnappedDialogWidth(int min_width) const override; private: const HarmonyTypographyProvider typography_provider_;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index 60cdea85d..b3958c5 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -48,6 +48,10 @@ namespace { +// The padding that should be placed between content and description in a +// vertical layout. +static const int kVerticalPadding = 3; + // A mapping from OmniboxResultView's ResultViewState/ColorKind types to // NativeTheme colors. struct TranslationTable { @@ -294,20 +298,10 @@ } gfx::Size OmniboxResultView::GetPreferredSize() const { - if (!match_.answer) - return gfx::Size(0, GetContentLineHeight()); - if (match_.answer->second_line().num_text_lines() == 1) - return gfx::Size(0, GetContentLineHeight() + GetAnswerLineHeight()); - if (!description_rendertext_) { - description_rendertext_ = - CreateAnswerLine(match_.answer->second_line(), GetAnswerLineFont()); - } - description_rendertext_->SetDisplayRect( - gfx::Rect(text_bounds_.width(), 0)); - description_rendertext_->GetStringSize(); - return gfx::Size( - 0, GetContentLineHeight() + - GetAnswerLineHeight() * description_rendertext_->GetNumLines()); + int height = GetTextHeight() + (2 * GetVerticalMargin()); + if (match_.answer) + height += GetAnswerHeight() + kVerticalPadding; + return gfx::Size(0, height); } void OmniboxResultView::GetAccessibleNodeData(ui::AXNodeData* node_data) { @@ -341,7 +335,7 @@ gfx::RenderText* description, gfx::Canvas* canvas, int x) const { - int y = text_bounds_.y(); + int y = text_bounds_.y() + GetVerticalMargin(); if (!separator_rendertext_) { const base::string16& separator = @@ -370,9 +364,9 @@ if (description_max_width != 0) { if (match.answer) { - y += GetContentLineHeight(); + y += GetTextHeight() + kVerticalPadding; if (!answer_image_.isNull()) { - int answer_icon_size = GetAnswerLineHeight(); + int answer_icon_size = GetAnswerHeight(); canvas->DrawImageInt( answer_image_, 0, 0, answer_image_.width(), answer_image_.height(), @@ -460,21 +454,17 @@ prefix_render_text->SetDisplayRect( gfx::Rect(mirroring_context_->mirrored_left_coord( prefix_x, prefix_x + prefix_width), - y, prefix_width, GetContentLineHeight())); + y, prefix_width, GetTextHeight())); prefix_render_text->Draw(canvas); } // Set the display rect to trigger elision. - const int final_width = right_x - x; - int height = GetContentLineHeight(); - if (render_text_type == DESCRIPTION && match.answer) { - render_text->SetDisplayRect(gfx::Rect(gfx::Size(final_width, 0))); - render_text->GetStringSize(); - height = GetAnswerLineHeight() * render_text->GetNumLines(); - } + int height = (render_text_type == DESCRIPTION && match.answer) + ? GetAnswerHeight() + : GetTextHeight(); render_text->SetDisplayRect( gfx::Rect(mirroring_context_->mirrored_left_coord(x, right_x), y, - final_width, height)); + right_x - x, height)); render_text->Draw(canvas); return right_x; } @@ -605,7 +595,7 @@ if (!contents_rendertext_) { if (match_.answer) { contents_rendertext_ = - CreateAnswerLine(match_.answer->first_line(), font_list_); + CreateAnswerText(match_.answer->first_line(), font_list_); } else { contents_rendertext_ = CreateClassifiedRenderText( match_.contents, match_.contents_class, false); @@ -625,8 +615,9 @@ const int end_x = width() - start_x; const gfx::ImageSkia icon = GetIcon(); - icon_bounds_.SetRect(start_x, (GetContentLineHeight() - icon.height()) / 2, - icon.width(), icon.height()); + const int icon_y = + GetVerticalMargin() + (GetTextHeight() - icon.height()) / 2; + icon_bounds_.SetRect(start_x, icon_y, icon.width(), icon.height()); const int text_x = start_x + LocationBarView::kIconWidth + horizontal_padding; int text_width = end_x - text_x; @@ -665,7 +656,7 @@ if (!description_rendertext_) { if (match_.answer) { description_rendertext_ = - CreateAnswerLine(match_.answer->second_line(), GetAnswerLineFont()); + CreateAnswerText(match_.answer->second_line(), GetAnswerFont()); } else if (!match_.description.empty()) { description_rendertext_ = CreateClassifiedRenderText( match_.description, match_.description_class, true); @@ -698,7 +689,7 @@ SchedulePaint(); } -const gfx::FontList& OmniboxResultView::GetAnswerLineFont() const { +const gfx::FontList& OmniboxResultView::GetAnswerFont() const { // This assumes that the first text type in the second answer line can be used // to specify the font for all the text fields in the line. For now this works // but eventually it will be necessary to get RenderText to support multiple @@ -711,20 +702,35 @@ GetTextStyle(text_type).font); } -int OmniboxResultView::GetAnswerLineHeight() const { - return GetAnswerLineFont().GetHeight(); +int OmniboxResultView::GetAnswerHeight() const { + // If the answer specifies a maximum of 1 line we can simply return the answer + // font height. + if (match_.answer->second_line().num_text_lines() == 1) + return GetAnswerFont().GetHeight(); + + // Multi-line answers require layout in order to determine the number of lines + // the RenderText will use. + if (!description_rendertext_) { + description_rendertext_ = + CreateAnswerText(match_.answer->second_line(), GetAnswerFont()); + } + description_rendertext_->SetDisplayRect(gfx::Rect(text_bounds_.width(), 0)); + description_rendertext_->GetStringSize(); + return GetAnswerFont().GetHeight() * description_rendertext_->GetNumLines(); } -int OmniboxResultView::GetContentLineHeight() const { +int OmniboxResultView::GetVerticalMargin() const { + // Regardless of the text size, we ensure a minimum size for the content line + // here. This minimum is larger for hybrid mouse/touch devices to ensure an + // adequately sized touch target. using Md = ui::MaterialDesignController; const int kIconVerticalPad = Md::GetMode() == Md::MATERIAL_HYBRID ? 8 : 4; - const int kTextVerticalPad = 3; - return std::max( - LocationBarView::kIconWidth + 2 * kIconVerticalPad, - GetTextHeight() + 2 * kTextVerticalPad); + const int min_height = LocationBarView::kIconWidth + 2 * kIconVerticalPad; + + return std::max(kVerticalPadding, (min_height - GetTextHeight()) / 2); } -std::unique_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerLine( +std::unique_ptr<gfx::RenderText> OmniboxResultView::CreateAnswerText( const SuggestionAnswer::ImageLine& line, const gfx::FontList& font_list) const { std::unique_ptr<gfx::RenderText> destination =
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.h b/chrome/browser/ui/views/omnibox/omnibox_result_view.h index 3b8784b1..8e0126dd 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
@@ -158,17 +158,17 @@ bool is_ui_rtl, bool is_match_contents_rtl) const; - // Returns the font to use for the description line of answer suggestions. - const gfx::FontList& GetAnswerLineFont() const; + // Returns the font to use for the description section of answer suggestions. + const gfx::FontList& GetAnswerFont() const; - // Returns the height of the the description line of answer suggestions. - int GetAnswerLineHeight() const; + // Returns the height of the the description section of answer suggestions. + int GetAnswerHeight() const; - // Returns the height of the content line. - int GetContentLineHeight() const; + // Returns the margin that should appear at the top and bottom of the result. + int GetVerticalMargin() const; // Creates a RenderText with text and styling from the image line. - std::unique_ptr<gfx::RenderText> CreateAnswerLine( + std::unique_ptr<gfx::RenderText> CreateAnswerText( const SuggestionAnswer::ImageLine& line, const gfx::FontList& font_list) const;
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h index 3744c8b3..ccc555f 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
@@ -29,10 +29,11 @@ // Credit card editor screen of the Payment Request flow. class CreditCardEditorViewController : public EditorViewController { public: - // Does not take ownership of the arguments, which should outlive this object. - // Additionally, |credit_card| could be nullptr if we are adding a card. Else, - // it's a valid pointer to a card that needs to be updated, and which will - // outlive this controller. + // Does not take ownership of the arguments (except for the |on_edited| and + // |on_added| callbacks), which should outlive this object. Additionally, + // |credit_card| could be nullptr if we are adding a card. Else, it's a valid + // pointer to a card that needs to be updated, and which will outlive this + // controller. CreditCardEditorViewController( PaymentRequestSpec* spec, PaymentRequestState* state,
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc index 8e9cad4..c13288d 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
@@ -246,10 +246,13 @@ } void PaymentRequestDialogView::ShowShippingAddressEditor( + base::OnceClosure on_edited, + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, autofill::AutofillProfile* profile) { view_stack_->Push(CreateViewAndInstallController( base::MakeUnique<ShippingAddressEditorViewController>( - request_->spec(), request_->state(), this, profile), + request_->spec(), request_->state(), this, + std::move(on_edited), std::move(on_added), profile), &controller_map_), /* animate = */ true); if (observer_for_testing_)
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.h b/chrome/browser/ui/views/payments/payment_request_dialog_view.h index d45bde2..07e3e4ba 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view.h +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.h
@@ -112,7 +112,13 @@ base::OnceCallback<void(const autofill::CreditCard&)> on_added, autofill::CreditCard* credit_card = nullptr); // |profile| is the address to be edited, or nullptr for adding an address. - void ShowShippingAddressEditor(autofill::AutofillProfile* profile = nullptr); + // |on_edited| is called when |profile| was successfully edited, and + // |on_added| is called when a new profile was added (the reference is + // short-lived; callee should make a copy of the profile object). + void ShowShippingAddressEditor( + base::OnceClosure on_edited, + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, + autofill::AutofillProfile* profile); // |profile| is the profile to be edited, or nullptr for adding a profile. void ShowContactInfoEditor(autofill::AutofillProfile* profile = nullptr); void EditorViewUpdated();
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc index 5fe018fd..4ff1043 100644 --- a/chrome/browser/ui/views/payments/profile_list_view_controller.cc +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -116,7 +116,14 @@ } void ShowEditor(autofill::AutofillProfile* profile) override { - dialog()->ShowShippingAddressEditor(profile); + dialog()->ShowShippingAddressEditor( + /*on_edited=*/base::BindOnce( + &PaymentRequestState::SetSelectedShippingProfile, + base::Unretained(state()), profile), + /*on_added=*/ + base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile, + base::Unretained(state()), /*selected=*/true), + profile); } autofill::AutofillProfile* GetSelectedProfile() override {
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc index e6babf4..1a868b56 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
@@ -67,8 +67,12 @@ PaymentRequestSpec* spec, PaymentRequestState* state, PaymentRequestDialogView* dialog, + base::OnceClosure on_edited, + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, autofill::AutofillProfile* profile) : EditorViewController(spec, state, dialog), + on_edited_(std::move(on_edited)), + on_added_(std::move(on_added)), profile_to_edit_(profile), chosen_country_index_(0), failed_to_load_region_data_(false) { @@ -113,6 +117,8 @@ // Add the profile (will not add a duplicate). profile.set_origin(autofill::kSettingsOrigin); state()->GetPersonalDataManager()->AddProfile(profile); + std::move(on_added_).Run(profile); + on_edited_.Reset(); } else { // Copy the temporary object's data to the object to be edited. Prefer this // method to copying |profile| into |profile_to_edit_|, because the latter @@ -123,6 +129,8 @@ DCHECK(success); profile_to_edit_->set_origin(autofill::kSettingsOrigin); state()->GetPersonalDataManager()->UpdateProfile(*profile_to_edit_); + std::move(on_edited_).Run(); + on_added_.Reset(); } return true;
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h index 05018d49..3a2f8a9 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h
@@ -27,11 +27,18 @@ // Shipping Address editor screen of the Payment Request flow. class ShippingAddressEditorViewController : public EditorViewController { public: - // Does not take ownership of the arguments, which should outlive this object. - ShippingAddressEditorViewController(PaymentRequestSpec* spec, - PaymentRequestState* state, - PaymentRequestDialogView* dialog, - autofill::AutofillProfile* profile); + // Does not take ownership of the arguments (except for the |on_edited| and + // |on_added| callbacks), which should outlive this object. Additionally, + // |profile| could be nullptr if we are adding a new shipping address. Else, + // it's a valid pointer to a card that needs to be updated, and which will + // outlive this controller. + ShippingAddressEditorViewController( + PaymentRequestSpec* spec, + PaymentRequestState* state, + PaymentRequestDialogView* dialog, + base::OnceClosure on_edited, + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, + autofill::AutofillProfile* profile); ~ShippingAddressEditorViewController() override; // EditorViewController: @@ -75,6 +82,12 @@ }; friend class ShippingAddressValidationDelegate; + // Called when |profile_to_edit_| was successfully edited. + base::OnceClosure on_edited_; + // Called when a new profile was added. The const reference is short-lived, + // and the callee should make a copy. + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added_; + // If non-nullptr, a point to an object to be edited, which should outlive // this controller. autofill::AutofillProfile* profile_to_edit_;
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc index 5757514..704c45e 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
@@ -143,6 +143,11 @@ SetRegionDataLoader(&test_region_data_loader_); OpenShippingAddressSectionScreen(); + // No shipping profiles are available. + PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front(); + EXPECT_EQ(0U, request->state()->shipping_profiles().size()); + EXPECT_EQ(nullptr, request->state()->selected_shipping_profile()); + test_region_data_loader_.set_synchronous_callback(true); OpenShippingAddressEditorScreen(); @@ -212,6 +217,12 @@ EXPECT_EQ(base::ASCIIToUTF16(kAnyState), profile->GetRawInfo(autofill::ADDRESS_HOME_STATE)); ExpectExistingRequiredFields(nullptr); + + // One shipping profile is available and selected. + PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front(); + EXPECT_EQ(1UL, request->state()->shipping_profiles().size()); + EXPECT_EQ(request->state()->shipping_profiles().back(), + request->state()->selected_shipping_profile()); } IN_PROC_BROWSER_TEST_F(PaymentRequestShippingAddressEditorTest,
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc index 461c5a4..1c3059a2 100644 --- a/chrome/browser/win/jumplist.cc +++ b/chrome/browser/win/jumplist.cc
@@ -20,6 +20,7 @@ #include "base/task_scheduler/post_task.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" +#include "base/timer/elapsed_timer.h" #include "base/trace_event/trace_event.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/favicon/favicon_service_factory.h" @@ -64,7 +65,12 @@ namespace { // Delay jumplist updates to allow collapsing of redundant update requests. -const int kDelayForJumplistUpdateInMS = 3500; +constexpr base::TimeDelta kDelayForJumplistUpdate = + base::TimeDelta::FromMilliseconds(3500); + +// Timeout jumplist updates for users with extremely slow OS. +constexpr base::TimeDelta kTimeOutForJumplistUpdate = + base::TimeDelta::FromMilliseconds(500); // Append the common switches to each shell link. void AppendCommonSwitches(ShellLinkItem* shell_link) { @@ -176,21 +182,30 @@ return jumplist_updater->AddTasks(items); } -// Updates the application JumpList. -bool UpdateJumpList(const wchar_t* app_id, +// Updates the application JumpList, which consists of 1) delete old icon files; +// 2) create new icon files; 3) notify the OS. +// Note that any timeout error along the way results in the old jumplist being +// left as-is, while any non-timeout error results in the old jumplist being +// left as-is, but without icon files. +void UpdateJumpList(const wchar_t* app_id, const base::FilePath& icon_dir, const ShellLinkItemList& most_visited_pages, const ShellLinkItemList& recently_closed_pages, IncognitoModePrefs::Availability incognito_availability) { - // JumpList is implemented only on Windows 7 or later. - // So, we should return now when this function is called on earlier versions - // of Windows. if (!JumpListUpdater::IsEnabled()) - return true; + return; + + // Records the time cost of starting a JumpListUpdater. + base::ElapsedTimer begin_update_timer; JumpListUpdater jumplist_updater(app_id); if (!jumplist_updater.BeginUpdate()) - return false; + return; + + // Stops jumplist update if JumpListUpdater's start times out, as it's very + // likely the following update steps will also take a long time. + if (begin_update_timer.Elapsed() >= kTimeOutForJumplistUpdate) + return; // We allocate 60% of the given JumpList slots to "most-visited" items // and 40% to "recently-closed" items, respectively. @@ -218,47 +233,39 @@ // links should be updated anyway, as it doesn't involve disk IO. In this // case, Chrome's icon will be used for the new links. - if (base::DirectoryExists(icon_dir) && base::IsDirectoryEmpty(icon_dir)) { - // TODO(chengx): Remove this UMA metric after fixing http://crbug.com/40407. - UMA_HISTOGRAM_COUNTS_100( - "WinJumplist.CreateIconFilesCount", - most_visited_pages.size() + recently_closed_pages.size()); + bool should_create_icons = + base::DirectoryExists(icon_dir) && base::IsDirectoryEmpty(icon_dir); - // Create icon files for shortcuts in the "Most Visited" category. + // Create icon files for shortcuts in the "Most Visited" category. + if (should_create_icons) CreateIconFiles(icon_dir, most_visited_pages, most_visited_items); - // Create icon files for shortcuts in the "Recently Closed" category. - CreateIconFiles(icon_dir, recently_closed_pages, recently_closed_items); - } - - // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. - SCOPED_UMA_HISTOGRAM_TIMER("WinJumplist.UpdateJumpListDuration"); - // Update the "Most Visited" category of the JumpList if it exists. // This update request is applied into the JumpList when we commit this // transaction. if (!jumplist_updater.AddCustomCategory( l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED), most_visited_pages, most_visited_items)) { - return false; + return; } + // Create icon files for shortcuts in the "Recently Closed" category. + if (should_create_icons) + CreateIconFiles(icon_dir, recently_closed_pages, recently_closed_items); + // Update the "Recently Closed" category of the JumpList. if (!jumplist_updater.AddCustomCategory( l10n_util::GetStringUTF16(IDS_RECENTLY_CLOSED), recently_closed_pages, recently_closed_items)) { - return false; + return; } // Update the "Tasks" category of the JumpList. if (!UpdateTaskCategory(&jumplist_updater, incognito_availability)) - return false; + return; // Commit this transaction and send the updated JumpList to Windows. - if (!jumplist_updater.CommitUpdate()) - return false; - - return true; + jumplist_updater.CommitUpdate(); } // Updates the jumplist, once all the data has been fetched. @@ -282,9 +289,7 @@ local_recently_closed_pages = data->recently_closed_pages_; } - // Create a new JumpList and replace the current JumpList with it. The - // jumplist links are updated anyway, while the jumplist icons may not as - // mentioned above. + // Updates the application JumpList. UpdateJumpList(app_id.c_str(), icon_dir, local_most_visited_pages, local_recently_closed_pages, incognito_availability); } @@ -595,9 +600,7 @@ if (timer_.IsRunning()) { timer_.Reset(); } else { - timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kDelayForJumplistUpdateInMS), - this, + timer_.Start(FROM_HERE, kDelayForJumplistUpdate, this, &JumpList::DeferredRunUpdate); } }
diff --git a/chrome/browser/win/jumplist_updater.cc b/chrome/browser/win/jumplist_updater.cc index 14a1ee0..0040196 100644 --- a/chrome/browser/win/jumplist_updater.cc +++ b/chrome/browser/win/jumplist_updater.cc
@@ -14,7 +14,6 @@ #include "base/metrics/histogram_macros.h" #include "base/path_service.h" #include "base/win/win_util.h" -#include "base/win/windows_version.h" #include "chrome/common/chrome_switches.h" #include "content/public/common/content_switches.h" @@ -111,11 +110,9 @@ // static bool JumpListUpdater::IsEnabled() { - // JumpList is implemented only on Windows 7 or later. // Do not create custom JumpLists in tests. See http://crbug.com/389375. - return base::win::GetVersion() >= base::win::VERSION_WIN7 && - !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kTestType); + return !base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kTestType); } bool JumpListUpdater::BeginUpdate() {
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index d76f6ce..2627ecc 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc
@@ -628,10 +628,13 @@ if (!system_level_cmd.GetProgram().empty()) base::LaunchProcess(system_level_cmd, base::LaunchOptions()); - // Tell Google Update that an uninstall has taken place. - // Ignore the return value: success or failure of Google Update - // has no bearing on the success or failure of Chrome's uninstallation. - google_update::UninstallGoogleUpdate(installer_state.system_install()); + // Tell Google Update that an uninstall has taken place if this install did + // not originate from the MSI. Google Update has its own logic relating to + // MSI-driven uninstalls that conflicts with this. Ignore the return value: + // success or failure of Google Update has no bearing on the success or + // failure of Chrome's uninstallation. + if (!installer_state.is_msi()) + google_update::UninstallGoogleUpdate(installer_state.system_install()); return install_status; }
diff --git a/chrome/renderer/resources/extensions/media_router_bindings.js b/chrome/renderer/resources/extensions/media_router_bindings.js index 24b7f15..1bd47e01 100644 --- a/chrome/renderer/resources/extensions/media_router_bindings.js +++ b/chrome/renderer/resources/extensions/media_router_bindings.js
@@ -565,14 +565,10 @@ this.provideSinks = null; /** - * @type {function(string, !bindings.InterfaceRequest): !Promise<boolean>} + * @type {function(string, !bindings.InterfaceRequest, + * !mediaStatusMojom.MediaStatusObserverPtr): !Promise<void>} */ this.createMediaRouteController = null; - - /** - * @type {function(string, !mediaStatusMojom.MediaStatusObserverPtr)} - */ - this.setMediaRouteStatusObserver = null; }; /** @@ -626,7 +622,6 @@ 'searchSinks', 'provideSinks', 'createMediaRouteController', - 'setMediaRouteStatusObserver', 'onBeforeInvokeHandler' ]; requiredHandlers.forEach(function(nextHandler) { @@ -919,40 +914,26 @@ /** * Creates a controller for the given route and binds the given - * InterfaceRequest to it. + * InterfaceRequest to it, and registers an observer for media status updates + * for the route. * @param {string} routeId * @param {!bindings.InterfaceRequest} controllerRequest + * @param {!mediaStatusMojom.MediaStatusObserverPtr} observer * @return {!Promise<!{success: boolean}>} Resolves to true if a controller * is created. Resolves to false if a controller cannot be created, or if * the controller is already bound. */ MediaRouteProvider.prototype.createMediaRouteController = function( - routeId, controllerRequest) { - // TODO(imcheng): Remove this check when M59 is in stable. + routeId, controllerRequest, observer) { + // TODO(imcheng): Remove this check when M60 is in stable. if (!this.handlers_.createMediaRouteController) { return Promise.resolve({success: false}); } this.handlers_.onBeforeInvokeHandler(); - this.handlers_.createMediaRouteController(routeId, controllerRequest) - .then(controller => {success: true}, - e => {success: false}); - } - - /** - * Sets the MediaStatus oberver for a given route. MediaStatus updates are - * notified via the given observer interface. - * @param {string} routeId - * @param {!mediaStatusMojom.MediaStatusObserverPtr} observer - */ - MediaRouteProvider.prototype.setMediaRouteStatusObserver = function( - routeId, observer) { - // TODO(imcheng): Remove this check when M59 is in stable. - if (!this.handlers_.setMediaRouteStatusObserver) { - return; - } - this.handlers_.onBeforeInvokeHandler(); - this.handlers_.setMediaRouteStatusObserver(routeId, observer); + return this.handlers_ + .createMediaRouteController(routeId, controllerRequest, observer) + .then(() => {success: true}, e => {success: false}); }; mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr(
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index b149c1b1..c62ecb1 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3277,6 +3277,7 @@ "../browser/page_load_metrics/observers/previews_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/protocol_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/resource_prefetch_predictor_page_load_metrics_observer_unittest.cc", + "../browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc",
diff --git a/chrome/test/chromedriver/OWNERS b/chrome/test/chromedriver/OWNERS index 0ad5d16..543fcb9e 100644 --- a/chrome/test/chromedriver/OWNERS +++ b/chrome/test/chromedriver/OWNERS
@@ -1,3 +1,5 @@ +# primary reviewer johnchen@chromium.org -samuong@chromium.org + +# backup reviewer stgao@chromium.org
diff --git a/chromecast/base/BUILD.gn b/chromecast/base/BUILD.gn index 16bc654..a4de4ee 100644 --- a/chromecast/base/BUILD.gn +++ b/chromecast/base/BUILD.gn
@@ -38,8 +38,6 @@ "bind_to_task_runner.h", "cast_constants.cc", "cast_constants.h", - "cast_features.cc", - "cast_features.h", "cast_paths.cc", "cast_paths.h", "cast_resource.cc", @@ -128,7 +126,6 @@ sources = [ "alarm_manager_unittest.cc", "bind_to_task_runner_unittest.cc", - "cast_features_unittest.cc", "device_capabilities_impl_unittest.cc", "error_codes_unittest.cc", "path_utils_unittest.cc",
diff --git a/chromecast/base/cast_features.cc b/chromecast/base/cast_features.cc deleted file mode 100644 index 636f145..0000000 --- a/chromecast/base/cast_features.cc +++ /dev/null
@@ -1,197 +0,0 @@ -// 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 "chromecast/base/cast_features.h" - -#include "base/command_line.h" -#include "base/feature_list.h" -#include "base/lazy_instance.h" -#include "base/metrics/field_trial.h" -#include "base/metrics/field_trial_param_associator.h" -#include "base/metrics/field_trial_params.h" -#include "base/strings/string_number_conversions.h" -#include "base/values.h" - -namespace chromecast { -namespace { - -// A constant used to always activate a FieldTrial. -const base::FieldTrial::Probability k100PercentProbability = 100; - -// The name of the default group to use for Cast DCS features. -const char kDefaultDCSFeaturesGroup[] = "default_dcs_features_group"; - -base::LazyInstance<std::unordered_set<int32_t>>::Leaky g_experiment_ids = - LAZY_INSTANCE_INITIALIZER; -bool g_experiment_ids_initialized = false; - -void SetExperimentIds(const base::ListValue& list) { - DCHECK(!g_experiment_ids_initialized); - std::unordered_set<int32_t> ids; - for (size_t i = 0; i < list.GetSize(); ++i) { - int32_t id; - if (list.GetInteger(i, &id)) { - ids.insert(id); - } else { - LOG(ERROR) << "Non-integer value found in experiment id list!"; - } - } - g_experiment_ids.Get().swap(ids); - g_experiment_ids_initialized = true; -} -} // namespace - -// An iterator for a base::DictionaryValue. Use an alias for brevity in loops. -using Iterator = base::DictionaryValue::Iterator; - -void InitializeFeatureList(const base::DictionaryValue& dcs_features, - const base::ListValue& dcs_experiment_ids, - const std::string& cmd_line_enable_features, - const std::string& cmd_line_disable_features) { - DCHECK(!base::FeatureList::GetInstance()); - - // Set the experiments. - SetExperimentIds(dcs_experiment_ids); - - // Initialize the FeatureList from the command line. - auto feature_list = base::MakeUnique<base::FeatureList>(); - feature_list->InitializeFromCommandLine(cmd_line_enable_features, - cmd_line_disable_features); - - // Override defaults from the DCS config. - for (Iterator it(dcs_features); !it.IsAtEnd(); it.Advance()) { - // Each feature must have its own FieldTrial object. Since experiments are - // controlled server-side for Chromecast, and this class is designed with a - // client-side experimentation framework in mind, these parameters are - // carefully chosen: - // - The field trial name is unused for our purposes. However, we need to - // maintain a 1:1 mapping with Features in order to properly store and - // access parameters associated with each Feature. Therefore, use the - // Feature's name as the FieldTrial name to ensure uniqueness. - // - The probability is hard-coded to 100% so that the FeatureList always - // respects the value from DCS. - // - The default group is unused; it will be the same for every feature. - // - Expiration year, month, and day use a special value such that the - // feature will never expire. - // - SESSION_RANDOMIZED is used to prevent the need for an - // entropy_provider. However, this value doesn't matter. - // - We don't care about the group_id. - // - const std::string& feature_name = it.key(); - auto* field_trial = base::FieldTrialList::FactoryGetFieldTrial( - feature_name, k100PercentProbability, kDefaultDCSFeaturesGroup, - base::FieldTrialList::kNoExpirationYear, 1 /* month */, 1 /* day */, - base::FieldTrial::SESSION_RANDOMIZED, nullptr); - - bool enabled; - if (it.value().GetAsBoolean(&enabled)) { - // A boolean entry simply either enables or disables a feature. - feature_list->RegisterFieldTrialOverride( - feature_name, - enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE - : base::FeatureList::OVERRIDE_DISABLE_FEATURE, - field_trial); - continue; - } - - const base::DictionaryValue* params_dict; - if (it.value().GetAsDictionary(¶ms_dict)) { - // A dictionary entry implies that the feature is enabled. - feature_list->RegisterFieldTrialOverride( - feature_name, base::FeatureList::OVERRIDE_ENABLE_FEATURE, - field_trial); - - // If the feature has not been overriden from the command line, set its - // parameters accordingly. - if (!feature_list->IsFeatureOverriddenFromCommandLine( - feature_name, base::FeatureList::OVERRIDE_DISABLE_FEATURE)) { - // Build a map of the FieldTrial parameters and associate it to the - // FieldTrial. - base::FieldTrialParamAssociator::FieldTrialParams params; - for (Iterator p(*params_dict); !p.IsAtEnd(); p.Advance()) { - std::string val; - if (p.value().GetAsString(&val)) { - params[p.key()] = val; - } else { - LOG(ERROR) << "Entry in params dict for \"" << feature_name << "\"" - << " feature is not a string. Skipping."; - } - } - - // Register the params, so that they can be queried by client code. - bool success = base::AssociateFieldTrialParams( - feature_name, kDefaultDCSFeaturesGroup, params); - DCHECK(success); - } - continue; - } - - // Other base::Value types are not supported. - LOG(ERROR) << "A DCS feature mapped to an unsupported value. key: " - << feature_name << " type: " << it.value().type(); - } - - base::FeatureList::SetInstance(std::move(feature_list)); -} - -base::DictionaryValue GetOverriddenFeaturesForStorage( - const base::DictionaryValue& features) { - base::DictionaryValue persistent_dict; - - // |features| maps feature names to either a boolean or a dict of params. - for (Iterator it(features); !it.IsAtEnd(); it.Advance()) { - bool enabled; - if (it.value().GetAsBoolean(&enabled)) { - persistent_dict.SetBoolean(it.key(), enabled); - continue; - } - - const base::DictionaryValue* params_dict; - if (it.value().GetAsDictionary(¶ms_dict)) { - auto params = base::MakeUnique<base::DictionaryValue>(); - - bool bval; - int ival; - double dval; - std::string sval; - for (Iterator p(*params_dict); !p.IsAtEnd(); p.Advance()) { - const auto& param_key = p.key(); - const auto& param_val = p.value(); - if (param_val.GetAsBoolean(&bval)) { - params->SetString(param_key, bval ? "true" : "false"); - } else if (param_val.GetAsInteger(&ival)) { - params->SetString(param_key, base::IntToString(ival)); - } else if (param_val.GetAsDouble(&dval)) { - params->SetString(param_key, base::DoubleToString(dval)); - } else if (param_val.GetAsString(&sval)) { - params->SetString(param_key, sval); - } else { - LOG(ERROR) << "Entry in params dict for \"" << it.key() << "\"" - << " is not of a supported type (key: " << p.key() - << ", type: " << param_val.type(); - } - } - persistent_dict.Set(it.key(), std::move(params)); - continue; - } - - // Other base::Value types are not supported. - LOG(ERROR) << "A DCS feature mapped to an unsupported value. key: " - << it.key() << " type: " << it.value().type(); - } - - return persistent_dict; -} - -const std::unordered_set<int32_t>& GetDCSExperimentIds() { - DCHECK(g_experiment_ids_initialized); - return g_experiment_ids.Get(); -} - -void ResetCastFeaturesForTesting() { - g_experiment_ids_initialized = false; - base::FeatureList::ClearInstanceForTesting(); -} - -} // namespace chromecast
diff --git a/chromecast/base/cast_features.h b/chromecast/base/cast_features.h deleted file mode 100644 index 928399a..0000000 --- a/chromecast/base/cast_features.h +++ /dev/null
@@ -1,52 +0,0 @@ -// 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. - -#ifndef CHROMECAST_BASE_CAST_FEATURES_H_ -#define CHROMECAST_BASE_CAST_FEATURES_H_ - -#include <cstdint> -#include <memory> -#include <string> -#include <unordered_set> - -#include "base/feature_list.h" -#include "base/macros.h" - -namespace base { -class DictionaryValue; -class ListValue; -} - -namespace chromecast { - -// Initialize the global base::FeatureList instance, taking into account -// overrides from DCS and the command line. |dcs_features| and -// |dcs_experiment_ids| are read from the PrefService in the browser process. -// |cmd_line_enable_features| and |cmd_line_disable_features| should be passed -// to this function, unmodified from the command line. -// -// This function should be called before the browser's main loop. After this is -// called, the other functions in this file may be called on any thread. -void InitializeFeatureList(const base::DictionaryValue& dcs_features, - const base::ListValue& dcs_experiment_ids, - const std::string& cmd_line_enable_features, - const std::string& cmd_line_disable_features); - -// Given a dictionary of features, create a copy that is ready to be persisted -// to disk. Encodes all values as strings, which is how the FieldTrial -// classes expect the param data. -base::DictionaryValue GetOverriddenFeaturesForStorage( - const base::DictionaryValue& features); - -// Query the set of experiment ids set for this run. Intended only for metrics -// reporting. Must be called after InitializeFeatureList(). May be called on any -// thread. -const std::unordered_set<int32_t>& GetDCSExperimentIds(); - -// Reset static state to ensure clean unittests. For tests only. -void ResetCastFeaturesForTesting(); - -} // namespace chromecast - -#endif // CHROMECAST_BASE_CAST_FEATURES_H_ \ No newline at end of file
diff --git a/chromecast/base/cast_features_unittest.cc b/chromecast/base/cast_features_unittest.cc deleted file mode 100644 index b64efcd..0000000 --- a/chromecast/base/cast_features_unittest.cc +++ /dev/null
@@ -1,285 +0,0 @@ -// 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 "chromecast/base/cast_features.h" - -#include "base/feature_list.h" -#include "base/macros.h" -#include "base/memory/ptr_util.h" -#include "base/metrics/field_trial.h" -#include "base/metrics/field_trial_params.h" -#include "base/values.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromecast { -namespace { - -const char kTestBooleanFeatureName[] = "test_boolean_feature"; -const char kTestBooleanFeatureName2[] = "test_boolean_feature_2"; -const char kTestBooleanFeatureName3[] = "test_boolean_feature_3"; -const char kTestBooleanFeatureName4[] = "test_boolean_feature_4"; - -const char kTestParamsFeatureName[] = "test_params_feature"; - -} // namespace - -class CastFeaturesTest : public testing::Test { - public: - CastFeaturesTest() : field_trial_list_(nullptr) {} - ~CastFeaturesTest() override {} - - // testing::Test implementation: - void SetUp() override { ResetCastFeaturesForTesting(); } - - private: - // A field trial list must be created before attempting to create FieldTrials. - // In production, this instance lives in CastBrowserMainParts. - base::FieldTrialList field_trial_list_; - - DISALLOW_COPY_AND_ASSIGN(CastFeaturesTest); -}; - -TEST_F(CastFeaturesTest, EnableDisableMultipleBooleanFeatures) { - // Declare several boolean features. - base::Feature bool_feature(kTestBooleanFeatureName, - base::FEATURE_DISABLED_BY_DEFAULT); - base::Feature bool_feature_2(kTestBooleanFeatureName2, - base::FEATURE_ENABLED_BY_DEFAULT); - base::Feature bool_feature_3(kTestBooleanFeatureName3, - base::FEATURE_DISABLED_BY_DEFAULT); - base::Feature bool_feature_4(kTestBooleanFeatureName4, - base::FEATURE_ENABLED_BY_DEFAULT); - - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - features->SetBoolean(kTestBooleanFeatureName, false); - features->SetBoolean(kTestBooleanFeatureName2, false); - features->SetBoolean(kTestBooleanFeatureName3, true); - features->SetBoolean(kTestBooleanFeatureName4, true); - - InitializeFeatureList(*features, *experiments, "", ""); - - // Test that features are properly enabled (they should match the - // DCS config). - ASSERT_FALSE(base::FeatureList::IsEnabled(bool_feature)); - ASSERT_FALSE(base::FeatureList::IsEnabled(bool_feature_2)); - ASSERT_TRUE(base::FeatureList::IsEnabled(bool_feature_3)); - ASSERT_TRUE(base::FeatureList::IsEnabled(bool_feature_4)); -} - -TEST_F(CastFeaturesTest, EnableSingleFeatureWithParams) { - // Define a feature with params. - base::Feature test_feature(kTestParamsFeatureName, - base::FEATURE_DISABLED_BY_DEFAULT); - - // Pass params via DCS. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - auto params = base::MakeUnique<base::DictionaryValue>(); - params->SetString("foo_key", "foo"); - params->SetString("bar_key", "bar"); - params->SetString("doub_key", "3.14159"); - params->SetString("long_doub_key", "1.23459999999999999"); - params->SetString("int_key", "4242"); - params->SetString("bool_key", "true"); - features->Set(kTestParamsFeatureName, std::move(params)); - - InitializeFeatureList(*features, *experiments, "", ""); - - // Test that this feature is enabled, and params are correct. - ASSERT_TRUE(base::FeatureList::IsEnabled(test_feature)); - ASSERT_EQ("foo", - base::GetFieldTrialParamValueByFeature(test_feature, "foo_key")); - ASSERT_EQ("bar", - base::GetFieldTrialParamValueByFeature(test_feature, "bar_key")); - ASSERT_EQ(3.14159, base::GetFieldTrialParamByFeatureAsDouble( - test_feature, "doub_key", 0.000)); - ASSERT_EQ(1.23459999999999999, base::GetFieldTrialParamByFeatureAsDouble( - test_feature, "long_doub_key", 0.000)); - ASSERT_EQ(4242, base::GetFieldTrialParamByFeatureAsInt(test_feature, - "int_key", -1)); - ASSERT_EQ(true, base::GetFieldTrialParamByFeatureAsBool(test_feature, - "bool_key", false)); -} - -TEST_F(CastFeaturesTest, CommandLineOverridesDcsAndDefault) { - // Declare several boolean features. - base::Feature bool_feature(kTestBooleanFeatureName, - base::FEATURE_DISABLED_BY_DEFAULT); - base::Feature bool_feature_2(kTestBooleanFeatureName2, - base::FEATURE_ENABLED_BY_DEFAULT); - base::Feature bool_feature_3(kTestBooleanFeatureName3, - base::FEATURE_DISABLED_BY_DEFAULT); - base::Feature bool_feature_4(kTestBooleanFeatureName4, - base::FEATURE_ENABLED_BY_DEFAULT); - - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - features->SetBoolean(kTestBooleanFeatureName, false); - features->SetBoolean(kTestBooleanFeatureName2, false); - features->SetBoolean(kTestBooleanFeatureName3, true); - features->SetBoolean(kTestBooleanFeatureName4, true); - - // Also override a param feature with DCS config. - base::Feature params_feature(kTestParamsFeatureName, - base::FEATURE_ENABLED_BY_DEFAULT); - auto params = base::MakeUnique<base::DictionaryValue>(); - params->SetString("foo_key", "foo"); - features->Set(kTestParamsFeatureName, std::move(params)); - - // Now override with command line flags. Command line flags should have the - // final say. - std::string enabled_features = std::string(kTestBooleanFeatureName) - .append(",") - .append(kTestBooleanFeatureName2); - - std::string disabled_features = std::string(kTestBooleanFeatureName4) - .append(",") - .append(kTestParamsFeatureName); - - InitializeFeatureList(*features, *experiments, enabled_features, - disabled_features); - - // Test that features are properly enabled (they should match the - // DCS config). - ASSERT_TRUE(base::FeatureList::IsEnabled(bool_feature)); - ASSERT_TRUE(base::FeatureList::IsEnabled(bool_feature_2)); - ASSERT_TRUE(base::FeatureList::IsEnabled(bool_feature_3)); - ASSERT_FALSE(base::FeatureList::IsEnabled(bool_feature_4)); - - // Test that the params feature is disabled, and params are not set. - ASSERT_FALSE(base::FeatureList::IsEnabled(params_feature)); - ASSERT_EQ("", - base::GetFieldTrialParamValueByFeature(params_feature, "foo_key")); -} - -TEST_F(CastFeaturesTest, SetEmptyExperiments) { - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - - InitializeFeatureList(*features, *experiments, "", ""); - ASSERT_EQ(0u, GetDCSExperimentIds().size()); -} - -TEST_F(CastFeaturesTest, SetGoodExperiments) { - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - - int32_t ids[] = {12345678, 123, 0, -1}; - std::unordered_set<int32_t> expected; - for (int32_t id : ids) { - experiments->AppendInteger(id); - expected.insert(id); - } - - InitializeFeatureList(*features, *experiments, "", ""); - ASSERT_EQ(expected, GetDCSExperimentIds()); -} - -TEST_F(CastFeaturesTest, SetSomeGoodExperiments) { - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - experiments->AppendInteger(1234); - experiments->AppendString("foobar"); - experiments->AppendBoolean(true); - experiments->AppendInteger(1); - experiments->AppendDouble(1.23456); - - std::unordered_set<int32_t> expected; - expected.insert(1234); - expected.insert(1); - - InitializeFeatureList(*features, *experiments, "", ""); - ASSERT_EQ(expected, GetDCSExperimentIds()); -} - -TEST_F(CastFeaturesTest, SetAllBadExperiments) { - // Override those features with DCS configs. - auto experiments = base::MakeUnique<base::ListValue>(); - auto features = base::MakeUnique<base::DictionaryValue>(); - experiments->AppendString("foobar"); - experiments->AppendBoolean(true); - experiments->AppendDouble(1.23456); - - std::unordered_set<int32_t> expected; - - InitializeFeatureList(*features, *experiments, "", ""); - ASSERT_EQ(expected, GetDCSExperimentIds()); -} - -TEST_F(CastFeaturesTest, GetOverriddenFeaturesForStorage) { - auto features = base::MakeUnique<base::DictionaryValue>(); - features->SetBoolean("bool_key", false); - features->SetBoolean("bool_key_2", true); - - auto params = base::MakeUnique<base::DictionaryValue>(); - params->SetString("foo_key", "foo"); - params->SetString("bar_key", "bar"); - params->SetDouble("doub_key", 3.14159); - params->SetDouble("long_doub_key", 1.234599999999999); - params->SetInteger("int_key", 4242); - params->SetInteger("negint_key", -273); - params->SetBoolean("bool_key", true); - features->Set("params_key", std::move(params)); - - auto dict = GetOverriddenFeaturesForStorage(*features); - bool bval; - ASSERT_EQ(3u, dict.size()); - ASSERT_TRUE(dict.GetBoolean("bool_key", &bval)); - ASSERT_EQ(false, bval); - ASSERT_TRUE(dict.GetBoolean("bool_key_2", &bval)); - ASSERT_EQ(true, bval); - - const base::DictionaryValue* dval; - std::string sval; - ASSERT_TRUE(dict.GetDictionary("params_key", &dval)); - ASSERT_EQ(7u, dval->size()); - ASSERT_TRUE(dval->GetString("foo_key", &sval)); - ASSERT_EQ("foo", sval); - ASSERT_TRUE(dval->GetString("bar_key", &sval)); - ASSERT_EQ("bar", sval); - ASSERT_TRUE(dval->GetString("doub_key", &sval)); - ASSERT_EQ("3.14159", sval); - ASSERT_TRUE(dval->GetString("long_doub_key", &sval)); - ASSERT_EQ("1.234599999999999", sval); - ASSERT_TRUE(dval->GetString("int_key", &sval)); - ASSERT_EQ("4242", sval); - ASSERT_TRUE(dval->GetString("negint_key", &sval)); - ASSERT_EQ("-273", sval); - ASSERT_TRUE(dval->GetString("bool_key", &sval)); - ASSERT_EQ("true", sval); -} - -TEST_F(CastFeaturesTest, GetOverriddenFeaturesForStorage_BadParams) { - auto features = base::MakeUnique<base::DictionaryValue>(); - features->SetBoolean("bool_key", false); - features->SetString("str_key", "foobar"); - features->SetInteger("int_key", 12345); - features->SetDouble("doub_key", 4.5678); - - auto params = base::MakeUnique<base::DictionaryValue>(); - params->SetString("foo_key", "foo"); - features->Set("params_key", std::move(params)); - - auto dict = GetOverriddenFeaturesForStorage(*features); - bool bval; - ASSERT_EQ(2u, dict.size()); - ASSERT_TRUE(dict.GetBoolean("bool_key", &bval)); - ASSERT_EQ(false, bval); - - const base::DictionaryValue* dval; - std::string sval; - ASSERT_TRUE(dict.GetDictionary("params_key", &dval)); - ASSERT_EQ(1u, dval->size()); - ASSERT_TRUE(dval->GetString("foo_key", &sval)); - ASSERT_EQ("foo", sval); -} - -} // namespace chromecast \ No newline at end of file
diff --git a/chromecast/base/pref_names.cc b/chromecast/base/pref_names.cc index 9ef0f061..237f1336 100644 --- a/chromecast/base/pref_names.cc +++ b/chromecast/base/pref_names.cc
@@ -7,9 +7,6 @@ namespace chromecast { namespace prefs { -// List of experiments enabled by DCS. For metrics purposes only. -const char kActiveDCSExperiments[] = "experiments.ids"; - // Boolean which specifies if remote debugging is enabled const char kEnableRemoteDebugging[] = "enable_remote_debugging"; @@ -17,9 +14,6 @@ // due to bug b/9487011. const char kMetricsIsNewClientID[] = "user_experience_metrics.is_new_client_id"; -// Dictionary of remotely-enabled features from the latest DCS config fetch. -const char kLatestDCSFeatures[] = "experiments.features"; - // Whether or not to report metrics and crashes. const char kOptInStats[] = "opt-in.stats";
diff --git a/chromecast/base/pref_names.h b/chromecast/base/pref_names.h index 9003ee2..7454885d 100644 --- a/chromecast/base/pref_names.h +++ b/chromecast/base/pref_names.h
@@ -8,9 +8,7 @@ namespace chromecast { namespace prefs { -extern const char kActiveDCSExperiments[]; extern const char kEnableRemoteDebugging[]; -extern const char kLatestDCSFeatures[]; extern const char kMetricsIsNewClientID[]; extern const char kOptInStats[]; extern const char kStabilityChildProcessCrashCount[];
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index 5ae5acec..6b5f660 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn
@@ -246,7 +246,6 @@ sources = [ "cast_media_blocker_browsertest.cc", "renderer_prelauncher_test.cc", - "test/cast_features_browsertest.cc", "test/cast_navigation_browsertest.cc", ] @@ -255,10 +254,8 @@ deps = [ ":test_support", "//chromecast:chromecast_features", - "//chromecast/base", "//chromecast/base:chromecast_switches", "//chromecast/base/metrics", - "//components/prefs", "//media/base:test_support", ] }
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc index 75c39e05..ccb0fa8 100644 --- a/chromecast/browser/cast_browser_main_parts.cc +++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -22,13 +22,11 @@ #include "build/build_config.h" #include "cc/base/switches.h" #include "chromecast/base/cast_constants.h" -#include "chromecast/base/cast_features.h" #include "chromecast/base/cast_paths.h" #include "chromecast/base/cast_sys_info_util.h" #include "chromecast/base/chromecast_switches.h" #include "chromecast/base/metrics/cast_metrics_helper.h" #include "chromecast/base/metrics/grouped_histogram.h" -#include "chromecast/base/pref_names.h" #include "chromecast/base/version.h" #include "chromecast/browser/cast_browser_context.h" #include "chromecast/browser/cast_browser_process.h" @@ -279,7 +277,6 @@ URLRequestContextFactory* url_request_context_factory) : BrowserMainParts(), cast_browser_process_(new CastBrowserProcess()), - field_trial_list_(nullptr), parameters_(parameters), url_request_context_factory_(url_request_context_factory), net_log_(new CastNetLog()), @@ -415,26 +412,6 @@ if (!base::CreateDirectory(home_dir)) return 1; - scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); - metrics::RegisterPrefs(pref_registry.get()); - PrefProxyConfigTrackerImpl::RegisterPrefs(pref_registry.get()); - cast_browser_process_->SetPrefService( - PrefServiceHelper::CreatePrefService(pref_registry.get())); - - // As soon as the PrefService is set, initialize the base::FeatureList, so - // objects initialized after this point can use features from - // base::FeatureList. - const auto* features_dict = - cast_browser_process_->pref_service()->GetDictionary( - prefs::kLatestDCSFeatures); - const auto* experiment_ids = cast_browser_process_->pref_service()->GetList( - prefs::kActiveDCSExperiments); - auto* command_line = base::CommandLine::ForCurrentProcess(); - InitializeFeatureList( - *features_dict, *experiment_ids, - command_line->GetSwitchValueASCII(switches::kEnableFeatures), - command_line->GetSwitchValueASCII(switches::kDisableFeatures)); - // Hook for internal code cast_browser_process_->browser_client()->PreCreateThreads(); @@ -459,6 +436,11 @@ } void CastBrowserMainParts::PreMainMessageLoopRun() { + scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); + metrics::RegisterPrefs(pref_registry.get()); + PrefProxyConfigTrackerImpl::RegisterPrefs(pref_registry.get()); + cast_browser_process_->SetPrefService( + PrefServiceHelper::CreatePrefService(pref_registry.get())); #if !defined(OS_ANDROID) memory_pressure_monitor_.reset(new CastMemoryPressureMonitor());
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h index d4d19e8..822e930 100644 --- a/chromecast/browser/cast_browser_main_parts.h +++ b/chromecast/browser/cast_browser_main_parts.h
@@ -9,7 +9,6 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/metrics/field_trial.h" #include "build/buildflag.h" #include "chromecast/chromecast_features.h" #include "content/public/browser/browser_main_parts.h" @@ -66,7 +65,6 @@ private: std::unique_ptr<CastBrowserProcess> cast_browser_process_; - base::FieldTrialList field_trial_list_; const content::MainFunctionParams parameters_; // For running browser tests. URLRequestContextFactory* const url_request_context_factory_; std::unique_ptr<net::NetLog> net_log_;
diff --git a/chromecast/browser/pref_service_helper.cc b/chromecast/browser/pref_service_helper.cc index d6f825dd9..c1b6e5c 100644 --- a/chromecast/browser/pref_service_helper.cc +++ b/chromecast/browser/pref_service_helper.cc
@@ -53,8 +53,6 @@ // opts out, nothing further will be sent (honoring the user's setting). // 2) Dogfood users (see dogfood agreement). registry->RegisterBooleanPref(prefs::kOptInStats, true); - registry->RegisterListPref(prefs::kActiveDCSExperiments); - registry->RegisterDictionaryPref(prefs::kLatestDCSFeatures); RegisterPlatformPrefs(registry);
diff --git a/chromecast/browser/test/cast_features_browsertest.cc b/chromecast/browser/test/cast_features_browsertest.cc deleted file mode 100644 index 6093b96..0000000 --- a/chromecast/browser/test/cast_features_browsertest.cc +++ /dev/null
@@ -1,174 +0,0 @@ -// 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 "chromecast/base/cast_features.h" - -#include "base/feature_list.h" -#include "base/macros.h" -#include "base/metrics/field_trial_params.h" -#include "chromecast/base/pref_names.h" -#include "chromecast/browser/cast_browser_process.h" -#include "chromecast/browser/test/cast_browser_test.h" -#include "components/prefs/pref_service.h" - -namespace chromecast { -namespace shell { -namespace { - -const base::Feature kEnableFoo("enable_foo", base::FEATURE_DISABLED_BY_DEFAULT); -const base::Feature kEnableBar("enable_bar", base::FEATURE_ENABLED_BY_DEFAULT); -const base::Feature kEnableBaz("enable_baz", base::FEATURE_DISABLED_BY_DEFAULT); -const base::Feature kEnableBat("enable_bat", base::FEATURE_ENABLED_BY_DEFAULT); - -const base::Feature kEnableParams("enable_params", - base::FEATURE_DISABLED_BY_DEFAULT); - -} // namespace - -class CastFeaturesBrowserTest : public CastBrowserTest { - public: - CastFeaturesBrowserTest() {} - ~CastFeaturesBrowserTest() override {} - - // Write |dcs_features| to the pref store. This method is intended to be - // overridden in internal test to utilize the real production codepath for - // setting features from the server. - virtual void SetFeatures(const base::DictionaryValue& dcs_features) { - auto pref_features = GetOverriddenFeaturesForStorage(dcs_features); - CastBrowserProcess::GetInstance()->pref_service()->Set( - prefs::kLatestDCSFeatures, pref_features); - } - - static void ClearFeaturesInPrefs() { - DCHECK(CastBrowserProcess::GetInstance()); - DCHECK(CastBrowserProcess::GetInstance()->pref_service()); - CastBrowserProcess::GetInstance()->pref_service()->Set( - prefs::kLatestDCSFeatures, base::DictionaryValue()); - } - - private: - DISALLOW_COPY_AND_ASSIGN(CastFeaturesBrowserTest); -}; - -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, EmptyTest) { - // Default values should be returned. - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableFoo)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); -} - -// Test that set features activate on the next boot. Part 1 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, - PRE_TestFeaturesActivateOnBoot) { - // Default values should be returned. - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableFoo)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBaz)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBat)); - - // Set the features to be used on next boot. - base::DictionaryValue features; - features.SetBoolean("enable_foo", true); - features.SetBoolean("enable_bat", false); - SetFeatures(features); - - // Default values should still be returned until next boot. - EXPECT_FALSE(base::FeatureList::IsEnabled(kEnableFoo)); - EXPECT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); - EXPECT_FALSE(base::FeatureList::IsEnabled(kEnableBaz)); - EXPECT_TRUE(base::FeatureList::IsEnabled(kEnableBat)); -} - -// Test that features activate on the next boot. Part 2 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, TestFeaturesActivateOnBoot) { - // Overriden values set in test case above should be set. - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableFoo)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBaz)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBat)); - - // Clear the features for other tests. - ClearFeaturesInPrefs(); -} - -// Test that features with params activate on boot. Part 1 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, PRE_TestParamsActivateOnBoot) { - // Default value should be returned. - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableParams)); - - // Set the features to be used on next boot. - base::DictionaryValue features; - auto params = base::MakeUnique<base::DictionaryValue>(); - params->SetBoolean("bool_param", true); - params->SetBoolean("bool_param_2", false); - params->SetString("str_param", "foo"); - params->SetDouble("doub_param", 3.14159); - params->SetInteger("int_param", 76543); - features.Set("enable_params", std::move(params)); - SetFeatures(features); - - // Default value should still be returned until next boot. - EXPECT_FALSE(base::FeatureList::IsEnabled(kEnableParams)); -} - -// Test that features with params activate on boot. Part 2 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, TestParamsActivateOnBoot) { - // Check that the feature is now enabled. - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableParams)); - - // Check that the params are populated and correct. - ASSERT_TRUE(base::GetFieldTrialParamByFeatureAsBool( - kEnableParams, "bool_param", false /* default_value */)); - ASSERT_FALSE(base::GetFieldTrialParamByFeatureAsBool( - kEnableParams, "bool_param_2", true /* default_value */)); - ASSERT_EQ("foo", - base::GetFieldTrialParamValueByFeature(kEnableParams, "str_param")); - ASSERT_EQ(76543, base::GetFieldTrialParamByFeatureAsInt( - kEnableParams, "int_param", 0 /* default_value */)); - ASSERT_EQ(3.14159, base::GetFieldTrialParamByFeatureAsDouble( - kEnableParams, "doub_param", 0.0 /* default_value */)); - - // Check that no extra parameters are set. - std::map<std::string, std::string> params_out; - ASSERT_TRUE(base::GetFieldTrialParamsByFeature(kEnableParams, ¶ms_out)); - ASSERT_EQ(5u, params_out.size()); - - // Clear the features for other tests. - ClearFeaturesInPrefs(); -} - -// Test that only well-formed features are persisted to disk. Part 1 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, - PRE_TestOnlyWellFormedFeaturesPersisted) { - // Default values should be returned. - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableFoo)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBaz)); - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBat)); - - // Set both good parameters... - base::DictionaryValue features; - features.SetBoolean("enable_foo", true); - features.SetBoolean("enable_bat", false); - - // ... and bad parameters. - features.SetString("enable_bar", "False"); - features.Set("enable_baz", base::MakeUnique<base::ListValue>()); - - SetFeatures(features); -} - -// Test that only well-formed features are persisted to disk. Part 2 of 2. -IN_PROC_BROWSER_TEST_F(CastFeaturesBrowserTest, - TestOnlyWellFormedFeaturesPersisted) { - // Only the well-formed parameters should be overriden. - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableFoo)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBat)); - - // The other should take default values. - ASSERT_TRUE(base::FeatureList::IsEnabled(kEnableBar)); - ASSERT_FALSE(base::FeatureList::IsEnabled(kEnableBaz)); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc index 8ada86f..f9b80551 100644 --- a/chromeos/network/managed_network_configuration_handler_impl.cc +++ b/chromeos/network/managed_network_configuration_handler_impl.cc
@@ -38,6 +38,7 @@ #include "chromeos/network/policy_util.h" #include "chromeos/network/prohibited_technologies_handler.h" #include "chromeos/network/shill_property_util.h" +#include "chromeos/network/tether_constants.h" #include "components/onc/onc_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -87,6 +88,13 @@ return it->second.get(); } +bool IsTetherShillDictionary(const base::DictionaryValue& dict) { + std::string network_type; + return dict.GetStringWithoutPathExpansion(shill::kTypeProperty, + &network_type) && + network_type == kTypeTether; +} + } // namespace struct ManagedNetworkConfigurationHandlerImpl::Policies { @@ -143,13 +151,17 @@ &profile_path); const NetworkProfile* profile = network_profile_handler_->GetProfileForPath(profile_path); - if (!profile) + if (!profile && !IsTetherShillDictionary(*shill_properties)) { + // Tether networks are not expected to have an associated profile; only + // log an error if the provided properties do not correspond to a + // Tether network. NET_LOG_ERROR("No profile for service: " + profile_path, service_path); + } std::unique_ptr<NetworkUIData> ui_data = shill_property_util::GetUIDataFromProperties(*shill_properties); - const base::DictionaryValue* user_settings = NULL; + const base::DictionaryValue* user_settings = nullptr; if (ui_data && profile) { user_settings = ui_data->user_settings(); @@ -172,8 +184,8 @@ &onc::kNetworkWithStateSignature, network_state)); - const base::DictionaryValue* network_policy = NULL; - const base::DictionaryValue* global_policy = NULL; + const base::DictionaryValue* network_policy = nullptr; + const base::DictionaryValue* global_policy = nullptr; if (profile) { const Policies* policies = GetPoliciesForProfile(*profile); if (!policies) {
diff --git a/chromeos/network/network_configuration_handler.cc b/chromeos/network/network_configuration_handler.cc index 707894c..f6a128a 100644 --- a/chromeos/network/network_configuration_handler.cc +++ b/chromeos/network/network_configuration_handler.cc
@@ -228,6 +228,20 @@ const network_handler::DictionaryResultCallback& callback, const network_handler::ErrorCallback& error_callback) { NET_LOG(USER) << "GetShillProperties: " << service_path; + + const NetworkState* network_state = + network_state_handler_->GetNetworkState(service_path); + if (network_state && + NetworkTypePattern::Tether().MatchesType(network_state->type())) { + // If this is a Tether network, use the properties present in the + // NetworkState object provided by NetworkStateHandler. Tether networks are + // not present in Shill, so the Shill call below will not work. + base::DictionaryValue dictionary; + network_state->GetStateProperties(&dictionary); + callback.Run(service_path, dictionary); + return; + } + DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( dbus::ObjectPath(service_path), base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback,
diff --git a/chromeos/network/network_configuration_handler_unittest.cc b/chromeos/network/network_configuration_handler_unittest.cc index 554d9303..bfe3471 100644 --- a/chromeos/network/network_configuration_handler_unittest.cc +++ b/chromeos/network/network_configuration_handler_unittest.cc
@@ -361,6 +361,37 @@ base::RunLoop().RunUntilIdle(); } +TEST_F(NetworkConfigurationHandlerTest, GetProperties_TetherNetwork) { + network_state_handler_->SetTetherTechnologyState( + NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED); + + std::string kTetherGuid = "TetherGuid"; + network_state_handler_->AddTetherNetworkState( + kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier", + 100 /* battery_percentage */, 100 /* signal_strength */); + + std::string expected_json = + "{\n " + "\"GUID\": \"TetherGuid\",\n " + "\"Name\": \"TetherNetworkName\",\n " + "\"Priority\": 0,\n " + "\"Profile\": \"\",\n " + "\"SecurityClass\": \"\",\n " + "\"State\": \"\",\n " + "\"Tether.BatteryPercentage\": 100,\n " + "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n " + "\"Tether.SignalStrength\": 100,\n " + "\"Type\": \"wifi-tether\"\n" + "}\n"; + + // Tether networks use service path and GUID interchangeably. + std::string& tether_service_path = kTetherGuid; + network_configuration_handler_->GetShillProperties( + tether_service_path, + base::Bind(&DictionaryValueCallback, tether_service_path, expected_json), + base::Bind(&ErrorCallback)); +} + TEST_F(NetworkConfigurationHandlerTest, SetProperties) { std::string service_path = "/service/1"; std::string networkName = "MyNetwork";
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc index cdb9fbf0..f424c97 100644 --- a/chromeos/network/network_state_handler.cc +++ b/chromeos/network/network_state_handler.cc
@@ -1257,8 +1257,11 @@ const std::string& service_path) const { ManagedState* managed = GetModifiableManagedState(&network_list_, service_path); - if (!managed) - return nullptr; + if (!managed) { + managed = GetModifiableManagedState(&tether_network_list_, service_path); + if (!managed) + return nullptr; + } return managed->AsNetworkState(); }
diff --git a/chromeos/network/onc/onc_signature.cc b/chromeos/network/onc/onc_signature.cc index 7887edb..b2c4cd56 100644 --- a/chromeos/network/onc/onc_signature.cc +++ b/chromeos/network/onc/onc_signature.cc
@@ -318,6 +318,7 @@ {::onc::kRecommended, &kRecommendedSignature}, {::onc::kRemove, &kBoolSignature}, {::onc::network_config::kStaticIPConfig, &kStaticIPConfigSignature}, + {::onc::network_config::kTether, &kTetherSignature}, {::onc::network_config::kType, &kStringSignature}, {::onc::network_config::kVPN, &kVPNSignature}, {::onc::network_config::kWiFi, &kWiFiSignature},
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc index 18154f3..2a9a512 100644 --- a/chromeos/network/onc/onc_utils.cc +++ b/chromeos/network/onc/onc_utils.cc
@@ -31,7 +31,9 @@ #include "chromeos/network/onc/onc_translator.h" #include "chromeos/network/onc/onc_utils.h" #include "chromeos/network/onc/onc_validator.h" +#include "chromeos/network/tether_constants.h" #include "components/device_event_log/device_event_log.h" +#include "components/onc/onc_constants.h" #include "components/onc/onc_pref_names.h" #include "components/prefs/pref_service.h" #include "components/proxy_config/proxy_config_dictionary.h"
diff --git a/chromeos/network/proxy/ui_proxy_config_service.cc b/chromeos/network/proxy/ui_proxy_config_service.cc index 2fc9bda..0376ee2 100644 --- a/chromeos/network/proxy/ui_proxy_config_service.cc +++ b/chromeos/network/proxy/ui_proxy_config_service.cc
@@ -15,6 +15,7 @@ #include "chromeos/network/network_state_handler.h" #include "chromeos/network/proxy/proxy_config_handler.h" #include "chromeos/network/proxy/proxy_config_service_impl.h" +#include "chromeos/network/tether_constants.h" #include "components/device_event_log/device_event_log.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "components/proxy_config/proxy_config_pref_names.h" @@ -100,7 +101,10 @@ network_guid); if (!network) { NET_LOG(ERROR) << "No NetworkState for guid: " << network_guid; - } else if (!network->IsInProfile()) { + } else if (!network->IsInProfile() && network->type() != kTypeTether) { + // Tether networks are not expected to have an associated profile; only + // log an error if the provided properties do not correspond to a + // Tether network. NET_LOG(ERROR) << "Network not in profile: " << network_guid; network = nullptr; }
diff --git a/components/BUILD.gn b/components/BUILD.gn index f79a5a5..7b8f6129 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -107,10 +107,6 @@ "//components/ntp_snippets:unit_tests", "//components/ntp_tiles:unit_tests", "//components/offline_items_collection/core:unit_tests", - "//components/offline_pages/core:unit_tests", - "//components/offline_pages/core/background:unit_tests", - "//components/offline_pages/core/downloads:unit_tests", - "//components/offline_pages/core/request_header:unit_tests", "//components/omnibox/browser:unit_tests", "//components/open_from_clipboard:unit_tests", "//components/os_crypt:unit_tests", @@ -202,6 +198,10 @@ "//components/network_hints/renderer:unit_tests", "//components/offline_pages/content:unit_tests", "//components/offline_pages/content/background_loader:unit_tests", + "//components/offline_pages/core:unit_tests", + "//components/offline_pages/core/background:unit_tests", + "//components/offline_pages/core/downloads:unit_tests", + "//components/offline_pages/core/request_header:unit_tests", "//components/packed_ct_ev_whitelist:unit_tests", "//components/password_manager/content/browser:unit_tests", "//components/payments/content:unit_tests",
diff --git a/components/arc/common/voice_interaction_framework.mojom b/components/arc/common/voice_interaction_framework.mojom index 38fb2ec..ce65a14 100644 --- a/components/arc/common/voice_interaction_framework.mojom +++ b/components/arc/common/voice_interaction_framework.mojom
@@ -12,11 +12,13 @@ // Next method ID: 3 interface VoiceInteractionFrameworkHost { // Returns a screenshot of currently focused window or empty array if - // no window is focused. - CaptureFocusedWindow@0() => (array<uint8> png_data); + // no window is focused. |data| represents the image encoded in JPEG + // format. + CaptureFocusedWindow@0() => (array<uint8> data); // Returns a fullscreen screenshot of the primary display. - [MinVersion=1]CaptureFullscreen@1() => (array<uint8> png_data); + // |data| represents the image encoded in JPEG format. + [MinVersion=1]CaptureFullscreen@1() => (array<uint8> data); // Notifies the host that the metalayer has closed or could not open. [MinVersion=2]OnMetalayerClosed@2();
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc index 0e54c44..9256313 100644 --- a/components/autofill/core/browser/credit_card.cc +++ b/components/autofill/core/browser/credit_card.cc
@@ -152,7 +152,7 @@ if (type == kMirCard) return IDR_AUTOFILL_CC_MIR; if (type == kUnionPay) - return IDR_AUTOFILL_CC_GENERIC; + return IDR_AUTOFILL_CC_UNIONPAY; if (type == kVisaCard) return IDR_AUTOFILL_CC_VISA;
diff --git a/components/autofill/core/browser/credit_card_unittest.cc b/components/autofill/core/browser/credit_card_unittest.cc index 4e371ec..f5e186e6 100644 --- a/components/autofill/core/browser/credit_card_unittest.cc +++ b/components/autofill/core/browser/credit_card_unittest.cc
@@ -406,6 +406,8 @@ CreditCard::IconResourceId(kMasterCard)); EXPECT_EQ(IDR_AUTOFILL_CC_MIR, CreditCard::IconResourceId(kMirCard)); + EXPECT_EQ(IDR_AUTOFILL_CC_UNIONPAY, + CreditCard::IconResourceId(kUnionPay)); EXPECT_EQ(IDR_AUTOFILL_CC_VISA, CreditCard::IconResourceId(kVisaCard)); }
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc index e650b4f..fe25e94 100644 --- a/components/exo/pointer.cc +++ b/components/exo/pointer.cc
@@ -51,7 +51,7 @@ Pointer::Pointer(PointerDelegate* delegate) : delegate_(delegate), - cursor_(ui::kCursorNull), + cursor_(ui::CursorType::kNull), cursor_capture_source_id_(base::UnguessableToken::Create()), cursor_capture_weak_ptr_factory_(this) { auto* helper = WMHelper::GetInstance(); @@ -125,7 +125,7 @@ CaptureCursor(); } else { cursor_capture_weak_ptr_factory_.InvalidateWeakPtrs(); - cursor_ = ui::kCursorNone; + cursor_ = ui::CursorType::kNone; UpdateCursor(); } } @@ -151,7 +151,7 @@ // response to each OnPointerEnter() call. focus_->UnregisterCursorProvider(this); focus_ = nullptr; - cursor_ = ui::kCursorNull; + cursor_ = ui::CursorType::kNull; cursor_capture_weak_ptr_factory_.InvalidateWeakPtrs(); } // Second generate an enter event if focus moved to a new target. @@ -348,7 +348,7 @@ if (!focus_) return; - cursor_ = ui::kCursorNone; + cursor_ = ui::CursorType::kNone; if (!result->IsEmpty()) { DCHECK(result->HasBitmap()); std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap(); @@ -363,7 +363,7 @@ XcursorImage* image = ui::SkBitmapToXcursorImage(bitmap.get(), hotspot); platform_cursor = ui::CreateReffedCustomXCursor(image); #endif - cursor_ = ui::kCursorCustom; + cursor_ = ui::CursorType::kCustom; cursor_.SetPlatformCursor(platform_cursor); #if defined(USE_OZONE) ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor);
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 602b5a4..e0ba66d2 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -1330,31 +1330,31 @@ switch (component) { case HTCAPTION: - cursor_client->SetCursor(ui::kCursorPointer); + cursor_client->SetCursor(ui::CursorType::kPointer); break; case HTTOP: - cursor_client->SetCursor(ui::kCursorNorthResize); + cursor_client->SetCursor(ui::CursorType::kNorthResize); break; case HTTOPRIGHT: - cursor_client->SetCursor(ui::kCursorNorthEastResize); + cursor_client->SetCursor(ui::CursorType::kNorthEastResize); break; case HTRIGHT: - cursor_client->SetCursor(ui::kCursorEastResize); + cursor_client->SetCursor(ui::CursorType::kEastResize); break; case HTBOTTOMRIGHT: - cursor_client->SetCursor(ui::kCursorSouthEastResize); + cursor_client->SetCursor(ui::CursorType::kSouthEastResize); break; case HTBOTTOM: - cursor_client->SetCursor(ui::kCursorSouthResize); + cursor_client->SetCursor(ui::CursorType::kSouthResize); break; case HTBOTTOMLEFT: - cursor_client->SetCursor(ui::kCursorSouthWestResize); + cursor_client->SetCursor(ui::CursorType::kSouthWestResize); break; case HTLEFT: - cursor_client->SetCursor(ui::kCursorWestResize); + cursor_client->SetCursor(ui::CursorType::kWestResize); break; case HTTOPLEFT: - cursor_client->SetCursor(ui::kCursorNorthWestResize); + cursor_client->SetCursor(ui::CursorType::kNorthWestResize); break; default: NOTREACHED();
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index 7b57ba8..f186ef9 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -571,10 +571,10 @@ // important. Return the first non-null cursor. for (auto* cursor_provider : cursor_providers_) { gfx::NativeCursor cursor = cursor_provider->GetCursor(); - if (cursor != ui::kCursorNull) + if (cursor != ui::CursorType::kNull) return cursor; } - return ui::kCursorNull; + return ui::CursorType::kNull; } void Surface::SetSurfaceDelegate(SurfaceDelegate* delegate) {
diff --git a/components/exo/surface.h b/components/exo/surface.h index 9c633b63..1b1bd55 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -173,7 +173,7 @@ void UnregisterCursorProvider(CursorProvider* provider); // Returns the cursor for the surface. If no cursor provider is registered - // then kCursorNull is returned. + // then CursorType::kNull is returned. gfx::NativeCursor GetCursor(); // Set the surface delegate.
diff --git a/components/favicon/core/large_icon_service.cc b/components/favicon/core/large_icon_service.cc index 7fcc9dac..bf94e5b 100644 --- a/components/favicon/core/large_icon_service.cc +++ b/components/favicon/core/large_icon_service.cc
@@ -7,11 +7,13 @@ #include <memory> #include "base/bind.h" +#include "base/feature_list.h" #include "base/location.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" #include "base/task_runner.h" @@ -31,12 +33,16 @@ namespace favicon { namespace { +// This feature is only used for accessing field trial parameters, not for +// switching on/off the code. +const base::Feature kLargeIconServiceFetchingFeature{ + "LargeIconServiceFetching", base::FEATURE_ENABLED_BY_DEFAULT}; + const char kGoogleServerV2RequestFormat[] = "https://t0.gstatic.com/faviconV2?" - "client=chrome&drop_404_icon=true&size=%d&min_size=%d&max_size=%d&" + "client=chrome&drop_404_icon=true&size=32&min_size=%d&max_size=64&" "fallback_opts=TYPE,SIZE,URL&url=%s"; -const int kGoogleServerV2MaxSizeInPixel = 128; -const int kGoogleServerV2DesiredSizeInPixel = 64; +const char kGoogleServerV2RequestFormatParam[] = "request_format"; GURL TrimPageUrlForGoogleServer(const GURL& page_url) { if (!page_url.SchemeIsHTTPOrHTTPS() || page_url.HostIsIPAddress()) @@ -52,10 +58,12 @@ GURL GetRequestUrlForGoogleServerV2(const GURL& page_url, int min_source_size_in_pixel) { + std::string url_format = base::GetFieldTrialParamValueByFeature( + kLargeIconServiceFetchingFeature, kGoogleServerV2RequestFormatParam); + return GURL(base::StringPrintf( - kGoogleServerV2RequestFormat, kGoogleServerV2DesiredSizeInPixel, - min_source_size_in_pixel, kGoogleServerV2MaxSizeInPixel, - page_url.spec().c_str())); + url_format.empty() ? kGoogleServerV2RequestFormat : url_format.c_str(), + min_source_size_in_pixel, page_url.spec().c_str())); } bool IsDbResultAdequate(const favicon_base::FaviconRawBitmapResult& db_result, @@ -321,7 +329,8 @@ // Do not download if the URL is invalid after trimming, or there is a // previous cache miss recorded for |server_request_url|. - if (!trimmed_page_url.is_valid() || !image_fetcher_ || + if (!server_request_url.is_valid() || !trimmed_page_url.is_valid() || + !image_fetcher_ || favicon_service_->WasUnableToDownloadFavicon(server_request_url)) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback, false));
diff --git a/components/favicon/core/large_icon_service_unittest.cc b/components/favicon/core/large_icon_service_unittest.cc index d5cabcb..ef463077 100644 --- a/components/favicon/core/large_icon_service_unittest.cc +++ b/components/favicon/core/large_icon_service_unittest.cc
@@ -139,7 +139,7 @@ TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServer) { const GURL kExpectedServerUrl( "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" - "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL" + "&size=32&min_size=42&max_size=64&fallback_opts=TYPE,SIZE,URL" "&url=http://www.example.com/"); EXPECT_CALL(mock_favicon_service_, UnableToDownloadFavicon(_)).Times(0); @@ -167,7 +167,7 @@ TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServerWithOriginalUrl) { const GURL kExpectedServerUrl( "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" - "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL" + "&size=32&min_size=42&max_size=64&fallback_opts=TYPE,SIZE,URL" "&url=http://www.example.com/"); const GURL kExpectedOriginalUrl("http://www.example.com/favicon.png"); @@ -197,7 +197,7 @@ const GURL kDummyUrlWithQuery("http://www.example.com?foo=1"); const GURL kExpectedServerUrl( "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" - "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL" + "&size=32&min_size=42&max_size=64&fallback_opts=TYPE,SIZE,URL" "&url=http://www.example.com/"); EXPECT_CALL(*mock_image_fetcher_, @@ -239,7 +239,7 @@ const GURL kDummyUrlWithQuery("http://www.example.com?foo=1"); const GURL kExpectedServerUrl( "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" - "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL" + "&size=32&min_size=42&max_size=64&fallback_opts=TYPE,SIZE,URL" "&url=http://www.example.com/"); EXPECT_CALL(mock_favicon_service_, SetLastResortFavicons(_, _, _, _, _)) @@ -268,7 +268,7 @@ mock_favicon_service_, WasUnableToDownloadFavicon(GURL( "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" - "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL" + "&size=32&min_size=42&max_size=64&fallback_opts=TYPE,SIZE,URL" "&url=http://www.example.com/"))) .WillByDefault(Return(true));
diff --git a/components/ntp_snippets/category_rankers/category_ranker.h b/components/ntp_snippets/category_rankers/category_ranker.h index c403625..aa19c57d 100644 --- a/components/ntp_snippets/category_rankers/category_ranker.h +++ b/components/ntp_snippets/category_rankers/category_ranker.h
@@ -10,9 +10,6 @@ namespace ntp_snippets { -// TODO(vitaliii): Ensure that changes in the order are propagated to the UI. -// (crbug.com/673743) - // Orders categories. // The order may be dynamic and change at any time. class CategoryRanker { @@ -32,6 +29,16 @@ // known categories, otherwise nothing is changed. virtual void AppendCategoryIfNecessary(Category category) = 0; + // If |category_to_insert| has not been added previously, it is added before + // |anchor|, otherwise nothing is changed. + virtual void InsertCategoryBeforeIfNecessary(Category category_to_insert, + Category anchor) = 0; + + // If |category_to_insert| has not been added previously, it is added after + // |anchor|, otherwise nothing is changed. + virtual void InsertCategoryAfterIfNecessary(Category category_to_insert, + Category anchor) = 0; + // Feedback data from the user to update the ranking. // Called whenever a suggestion is opened by the user.
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc index 31bf8ae6..62e2ad71 100644 --- a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc +++ b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc
@@ -246,9 +246,24 @@ if (!ContainsCategory(category)) { ordered_categories_.push_back(RankedCategory( category, /*clicks=*/0, /*last_dismissed=*/base::Time())); + StoreOrderToPrefs(ordered_categories_); } } +void ClickBasedCategoryRanker::InsertCategoryBeforeIfNecessary( + Category category_to_insert, + Category anchor) { + InsertCategoryRelativeToIfNecessary(category_to_insert, anchor, + /*after=*/false); +} + +void ClickBasedCategoryRanker::InsertCategoryAfterIfNecessary( + Category category_to_insert, + Category anchor) { + InsertCategoryRelativeToIfNecessary(category_to_insert, anchor, + /*after=*/true); +} + void ClickBasedCategoryRanker::OnSuggestionOpened(Category category) { if (!ContainsCategory(category)) { LOG(DFATAL) << "The category with ID " << category.id() @@ -470,6 +485,23 @@ return false; } +void ClickBasedCategoryRanker::InsertCategoryRelativeToIfNecessary( + Category category_to_insert, + Category anchor, + bool after) { + DCHECK(ContainsCategory(anchor)); + if (ContainsCategory(category_to_insert)) { + return; + } + + std::vector<RankedCategory>::iterator anchor_it = FindCategory(anchor); + ordered_categories_.insert(anchor_it + (after ? 1 : 0), + RankedCategory(category_to_insert, + /*clicks=*/anchor_it->clicks, + /*last_dismissed=*/base::Time())); + StoreOrderToPrefs(ordered_categories_); +} + base::Time ClickBasedCategoryRanker::ReadLastDecayTimeFromPrefs() const { return base::Time::FromInternalValue( pref_service_->GetInt64(prefs::kClickBasedCategoryRankerLastDecayTime));
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker.h b/components/ntp_snippets/category_rankers/click_based_category_ranker.h index 0042ffe..06bd846 100644 --- a/components/ntp_snippets/category_rankers/click_based_category_ranker.h +++ b/components/ntp_snippets/category_rankers/click_based_category_ranker.h
@@ -24,8 +24,8 @@ // to the top. The new remote categories must be registered using // AppendCategoryIfNecessary. All other categories must be hardcoded in the // initial order. The order and category usage data are persisted in prefs and -// reloaded on startup. TODO(crbug.com/675929): Remove unused categories from -// prefs. +// reloaded on startup. +// TODO(crbug.com/675929): Remove unused categories from prefs. class ClickBasedCategoryRanker : public CategoryRanker { public: explicit ClickBasedCategoryRanker(PrefService* pref_service, @@ -36,6 +36,10 @@ bool Compare(Category left, Category right) const override; void ClearHistory(base::Time begin, base::Time end) override; void AppendCategoryIfNecessary(Category category) override; + void InsertCategoryBeforeIfNecessary(Category category_to_insert, + Category anchor) override; + void InsertCategoryAfterIfNecessary(Category category_to_insert, + Category anchor) override; void OnSuggestionOpened(Category category) override; void OnCategoryDismissed(Category category) override; @@ -76,6 +80,9 @@ void StoreOrderToPrefs(const std::vector<RankedCategory>& ordered_categories); std::vector<RankedCategory>::iterator FindCategory(Category category); bool ContainsCategory(Category category) const; + void InsertCategoryRelativeToIfNecessary(Category category_to_insert, + Category anchor, + bool after); base::Time ReadLastDecayTimeFromPrefs() const; void StoreLastDecayTimeToPrefs(base::Time last_decay_time);
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc index da07fc4..c7dcc4e 100644 --- a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc +++ b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
@@ -98,6 +98,15 @@ {kCategoryRanker.name}); } + std::vector<Category> ConvertKnownCategories( + std::vector<KnownCategories> known_categories) { + std::vector<Category> converted; + for (auto known : known_categories) { + converted.push_back(Category::FromKnownCategory(known)); + } + return converted; + } + ClickBasedCategoryRanker* ranker() { return ranker_.get(); } private: @@ -746,4 +755,229 @@ IsEmpty()); } +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertCategoryBeforeSelectedCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + + ASSERT_TRUE(CompareCategories(first, second)); + + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryBeforeIfNecessary(inserted, second); + EXPECT_TRUE(CompareCategories(first, inserted)); + EXPECT_TRUE(CompareCategories(inserted, second)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertMultipleCategoriesBeforeSelectedCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + + ASSERT_TRUE(CompareCategories(first, second)); + + Category first_inserted = GetUnusedRemoteCategory(); + Category second_inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryBeforeIfNecessary(first_inserted, second); + ranker()->InsertCategoryBeforeIfNecessary(second_inserted, second); + EXPECT_TRUE(CompareCategories(first, first_inserted)); + EXPECT_TRUE(CompareCategories(first_inserted, second_inserted)); + EXPECT_TRUE(CompareCategories(second_inserted, second)); +} + +TEST_F(ClickBasedCategoryRankerTest, ShouldInsertCategoryBeforeFirstCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryBeforeIfNecessary(inserted, first); + EXPECT_TRUE(CompareCategories(inserted, first)); +} + +TEST_F(ClickBasedCategoryRankerTest, ShouldInsertCategoryBeforeRemoteCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category remote = AddUnusedRemoteCategory(); + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryBeforeIfNecessary(inserted, remote); + EXPECT_TRUE(CompareCategories(inserted, remote)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldNotChangeRemainingOrderWhenInsertingBeforeCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category anchor = Category::FromKnownCategory(default_order[2]); + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryBeforeIfNecessary(inserted, anchor); + std::vector<Category> converted_categories = + ConvertKnownCategories(default_order); + for (size_t i = 0; i + 1 < converted_categories.size(); ++i) { + EXPECT_TRUE(CompareCategories(converted_categories[i], + converted_categories[i + 1])); + } +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertCategoriesBeforeAndAfterSameCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + Category third = Category::FromKnownCategory(default_order[2]); + ASSERT_TRUE(CompareCategories(first, second)); + ASSERT_TRUE(CompareCategories(second, third)); + + Category first_before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(first_before, second); + + Category first_after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(first_after, second); + + Category second_before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(second_before, second); + + Category second_after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(second_after, second); + + EXPECT_TRUE(CompareCategories(first_before, second_before)); + EXPECT_TRUE(CompareCategories(second_before, second)); + EXPECT_TRUE(CompareCategories(second, second_after)); + EXPECT_TRUE(CompareCategories(second_after, first_after)); + EXPECT_TRUE(CompareCategories(first_after, third)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertCategoriesBeforeAndAfterDifferentCategories) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + ASSERT_TRUE(CompareCategories(first, second)); + + Category first_before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(first_before, second); + + Category first_after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(first_after, first); + + Category second_before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(second_before, second); + + Category second_after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(second_after, first); + + EXPECT_TRUE(CompareCategories(first, second_after)); + EXPECT_TRUE(CompareCategories(second_after, first_after)); + EXPECT_TRUE(CompareCategories(first_after, first_before)); + EXPECT_TRUE(CompareCategories(first_before, second_before)); + EXPECT_TRUE(CompareCategories(second_before, second)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldNotEmitNewIndexWhenCategoryInserted) { + base::HistogramTester histogram_tester; + + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + + ASSERT_THAT(histogram_tester.GetAllSamples(kHistogramMovedUpCategoryNewIndex), + IsEmpty()); + + Category before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(before, first); + + Category after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(after, first); + + EXPECT_THAT(histogram_tester.GetAllSamples(kHistogramMovedUpCategoryNewIndex), + IsEmpty()); +} + +// TODO(vitaliii): Reuse these tests for ConstantCategoryRanker. +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertCategoryAfterSelectedCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + + ASSERT_TRUE(CompareCategories(first, second)); + + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryAfterIfNecessary(inserted, first); + EXPECT_TRUE(CompareCategories(first, inserted)); + EXPECT_TRUE(CompareCategories(inserted, second)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldInsertMultipleCategoriesAfterSelectedCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category first = Category::FromKnownCategory(default_order[0]); + Category second = Category::FromKnownCategory(default_order[1]); + + ASSERT_TRUE(CompareCategories(first, second)); + + Category first_inserted = GetUnusedRemoteCategory(); + Category second_inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryAfterIfNecessary(first_inserted, first); + ranker()->InsertCategoryAfterIfNecessary(second_inserted, first); + EXPECT_TRUE(CompareCategories(first, second_inserted)); + EXPECT_TRUE(CompareCategories(second_inserted, first_inserted)); + EXPECT_TRUE(CompareCategories(first_inserted, second)); +} + +TEST_F(ClickBasedCategoryRankerTest, ShouldInsertCategoryAfterLastCategory) { + Category last = AddUnusedRemoteCategory(); + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryAfterIfNecessary(inserted, last); + EXPECT_TRUE(CompareCategories(last, inserted)); +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldNotChangeRemainingOrderWhenInsertingAfterCategory) { + std::vector<KnownCategories> default_order = + ConstantCategoryRanker::GetKnownCategoriesDefaultOrder(); + Category anchor = Category::FromKnownCategory(default_order[2]); + Category inserted = GetUnusedRemoteCategory(); + + ranker()->InsertCategoryAfterIfNecessary(inserted, anchor); + std::vector<Category> converted_categories = + ConvertKnownCategories(default_order); + for (size_t i = 0; i + 1 < converted_categories.size(); ++i) { + EXPECT_TRUE(CompareCategories(converted_categories[i], + converted_categories[i + 1])); + } +} + +TEST_F(ClickBasedCategoryRankerTest, + ShouldAssignScoreToInsertedCategoriesBasedOnAnchor) { + Category anchor = AddUnusedRemoteCategory(); + NotifyOnSuggestionOpened(/*times=*/25, anchor); + + Category inserted_before = GetUnusedRemoteCategory(); + ranker()->InsertCategoryBeforeIfNecessary(inserted_before, anchor); + + Category inserted_after = GetUnusedRemoteCategory(); + ranker()->InsertCategoryAfterIfNecessary(inserted_after, anchor); + + Category tester = AddUnusedRemoteCategory(); + NotifyOnSuggestionOpened(/*times=*/20, tester); + EXPECT_TRUE(CompareCategories(inserted_before, tester)); + EXPECT_TRUE(CompareCategories(inserted_after, tester)); +} + } // namespace ntp_snippets
diff --git a/components/ntp_snippets/category_rankers/constant_category_ranker.cc b/components/ntp_snippets/category_rankers/constant_category_ranker.cc index ea30b64..828cd317e 100644 --- a/components/ntp_snippets/category_rankers/constant_category_ranker.cc +++ b/components/ntp_snippets/category_rankers/constant_category_ranker.cc
@@ -57,6 +57,24 @@ } } +void ConstantCategoryRanker::InsertCategoryBeforeIfNecessary( + Category category_to_insert, + Category anchor) { + // TODO(vitaliii): Implement. + LOG(DFATAL) << "Not implemented, use ClickBasedCategoryRanker instead for " + "inserting categories relative to other categories."; + AppendCategoryIfNecessary(category_to_insert); +} + +void ConstantCategoryRanker::InsertCategoryAfterIfNecessary( + Category category_to_insert, + Category anchor) { + // TODO(vitaliii): Implement. + LOG(DFATAL) << "Not implemented, use ClickBasedCategoryRanker instead for " + "inserting categories relative to other categories."; + AppendCategoryIfNecessary(category_to_insert); +} + void ConstantCategoryRanker::OnSuggestionOpened(Category category) { // Ignored. The order is constant. }
diff --git a/components/ntp_snippets/category_rankers/constant_category_ranker.h b/components/ntp_snippets/category_rankers/constant_category_ranker.h index 67786b2..8e4417e8 100644 --- a/components/ntp_snippets/category_rankers/constant_category_ranker.h +++ b/components/ntp_snippets/category_rankers/constant_category_ranker.h
@@ -27,6 +27,10 @@ bool Compare(Category left, Category right) const override; void ClearHistory(base::Time begin, base::Time end) override; void AppendCategoryIfNecessary(Category category) override; + void InsertCategoryBeforeIfNecessary(Category category_to_insert, + Category anchor) override; + void InsertCategoryAfterIfNecessary(Category category_to_insert, + Category anchor) override; void OnSuggestionOpened(Category category) override; void OnCategoryDismissed(Category category) override;
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.cc b/components/ntp_snippets/category_rankers/fake_category_ranker.cc index 4c34840..94739a7b 100644 --- a/components/ntp_snippets/category_rankers/fake_category_ranker.cc +++ b/components/ntp_snippets/category_rankers/fake_category_ranker.cc
@@ -30,6 +30,18 @@ // Ignored. } +void FakeCategoryRanker::InsertCategoryBeforeIfNecessary( + Category category_to_insert, + Category anchor) { + // Ignored. +} + +void FakeCategoryRanker::InsertCategoryAfterIfNecessary( + Category category_to_insert, + Category anchor) { + // Ignored. +} + void FakeCategoryRanker::OnSuggestionOpened(Category category) { // Ignored. }
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.h b/components/ntp_snippets/category_rankers/fake_category_ranker.h index 314f0f2..9b5e3765 100644 --- a/components/ntp_snippets/category_rankers/fake_category_ranker.h +++ b/components/ntp_snippets/category_rankers/fake_category_ranker.h
@@ -27,6 +27,10 @@ bool Compare(Category left, Category right) const override; void ClearHistory(base::Time begin, base::Time end) override; void AppendCategoryIfNecessary(Category category) override; + void InsertCategoryBeforeIfNecessary(Category category_to_insert, + Category anchor) override; + void InsertCategoryAfterIfNecessary(Category category_to_insert, + Category anchor) override; void OnSuggestionOpened(Category category) override; void OnCategoryDismissed(Category category) override;
diff --git a/components/ntp_snippets/category_rankers/mock_category_ranker.h b/components/ntp_snippets/category_rankers/mock_category_ranker.h index 5ec50ca7..2238aee 100644 --- a/components/ntp_snippets/category_rankers/mock_category_ranker.h +++ b/components/ntp_snippets/category_rankers/mock_category_ranker.h
@@ -20,6 +20,10 @@ MOCK_CONST_METHOD2(Compare, bool(Category left, Category right)); MOCK_METHOD2(ClearHistory, void(base::Time begin, base::Time end)); MOCK_METHOD1(AppendCategoryIfNecessary, void(Category category)); + MOCK_METHOD2(InsertCategoryBeforeIfNecessary, + void(Category category_to_insert, Category anchor)); + MOCK_METHOD2(InsertCategoryAfterIfNecessary, + void(Category category_to_insert, Category anchor)); MOCK_METHOD1(OnSuggestionOpened, void(Category category)); MOCK_METHOD1(OnCategoryDismissed, void(Category Category)); };
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc index 09cfd14e..2c637e3 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
@@ -24,6 +24,7 @@ #include "components/image_fetcher/core/image_decoder.h" #include "components/image_fetcher/core/image_fetcher.h" #include "components/ntp_snippets/category_rankers/category_ranker.h" +#include "components/ntp_snippets/features.h" #include "components/ntp_snippets/pref_names.h" #include "components/ntp_snippets/remote/remote_suggestions_database.h" #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" @@ -31,6 +32,7 @@ #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" +#include "components/variations/variations_associated_data.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image.h" @@ -51,6 +53,47 @@ const char kCategoryContentProvidedByServer[] = "provided_by_server"; const char kCategoryContentAllowFetchingMore[] = "allow_fetching_more"; +// Variation parameter for ordering new remote categories based on their +// position in the response relative to "Article for you" category. +const char kOrderNewRemoteCategoriesBasedOnArticlesCategory[] = + "order_new_remote_categories_based_on_articles_category"; + +bool IsOrderingNewRemoteCategoriesBasedOnArticlesCategoryEnabled() { + return variations::GetVariationParamByFeatureAsBool( + ntp_snippets::kArticleSuggestionsFeature, + kOrderNewRemoteCategoriesBasedOnArticlesCategory, + /*default_value=*/false); +} + +void AddFetchedCategoriesToRankerBasedOnArticlesCategory( + CategoryRanker* ranker, + const RemoteSuggestionsFetcher::FetchedCategoriesVector& fetched_categories, + Category articles_category) { + DCHECK(IsOrderingNewRemoteCategoriesBasedOnArticlesCategoryEnabled()); + // Insert categories which precede "Articles" in the response. + for (const RemoteSuggestionsFetcher::FetchedCategory& fetched_category : + fetched_categories) { + if (fetched_category.category == articles_category) { + break; + } + ranker->InsertCategoryBeforeIfNecessary(fetched_category.category, + articles_category); + } + // Insert categories which follow "Articles" in the response. Note that we + // insert them in reversed order, because they are inserted right after + // "Articles", which reverses the order. + for (auto fetched_category_it = fetched_categories.rbegin(); + fetched_category_it != fetched_categories.rend(); + ++fetched_category_it) { + if (fetched_category_it->category == articles_category) { + return; + } + ranker->InsertCategoryAfterIfNecessary(fetched_category_it->category, + articles_category); + } + NOTREACHED() << "Articles category was not found."; +} + template <typename SuggestionPtrContainer> std::unique_ptr<std::vector<std::string>> GetSuggestionIDVector( const SuggestionPtrContainer& suggestions) { @@ -710,6 +753,7 @@ if (fetched_categories) { // TODO(treib): Reorder |category_contents_| to match the order we received // from the server. crbug.com/653816 + bool response_includes_article_category = false; for (RemoteSuggestionsFetcher::FetchedCategory& fetched_category : *fetched_categories) { // TODO(tschumann): Remove this histogram once we only talk to the content @@ -719,8 +763,9 @@ "NewTabPage.Snippets.NumArticlesFetched", std::min(fetched_category.suggestions.size(), static_cast<size_t>(kMaxSuggestionCount + 1))); + response_includes_article_category = true; } - category_ranker_->AppendCategoryIfNecessary(fetched_category.category); + CategoryContent* content = UpdateCategoryInfo(fetched_category.category, fetched_category.info); content->included_in_last_server_response = true; @@ -728,6 +773,18 @@ &fetched_category.suggestions); IntegrateSuggestions(content, std::move(fetched_category.suggestions)); } + + // Add new remote categories to the ranker. + if (IsOrderingNewRemoteCategoriesBasedOnArticlesCategoryEnabled() && + response_includes_article_category) { + AddFetchedCategoriesToRankerBasedOnArticlesCategory( + category_ranker_, *fetched_categories, articles_category_); + } else { + for (const RemoteSuggestionsFetcher::FetchedCategory& fetched_category : + *fetched_categories) { + category_ranker_->AppendCategoryIfNecessary(fetched_category.category); + } + } } // TODO(tschumann): The suggestions fetcher needs to signal errors so that we
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc index cd89dae..ee61755 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -571,6 +571,20 @@ base::RunLoop().RunUntilIdle(); } + void SetOrderNewRemoteCategoriesBasedOnArticlesCategoryParam(bool value) { + // params_manager supports only one + // |SetVariationParamsWithFeatureAssociations| at a time, so we clear + // previous settings first and then set everything we need. + params_manager_.ClearAllVariationParams(); + params_manager_.SetVariationParamsWithFeatureAssociations( + kArticleSuggestionsFeature.name, + {{"order_new_remote_categories_based_on_articles_category", + value ? "true" : "false"}, + {"content_suggestions_backend", + kTestContentSuggestionsServerEndpoint}}, + {kArticleSuggestionsFeature.name}); + } + private: variations::testing::VariationParamsManager params_manager_; test::RemoteSuggestionsTestUtils utils_; @@ -748,6 +762,58 @@ LoadFromJSONString(service.get(), json_str); } +TEST_F(RemoteSuggestionsProviderImplTest, + AddRemoteCategoriesToCategoryRankerRelativeToArticles) { + SetOrderNewRemoteCategoriesBasedOnArticlesCategoryParam(true); + auto mock_ranker = base::MakeUnique<MockCategoryRanker>(); + MockCategoryRanker* raw_mock_ranker = mock_ranker.get(); + SetCategoryRanker(std::move(mock_ranker)); + std::string json_str = + MultiCategoryJsonBuilder() + .AddCategory({GetSuggestionN(0)}, /*remote_category_id=*/14) + .AddCategory({GetSuggestionN(1)}, /*remote_category_id=*/13) + .AddCategory({GetSuggestionN(2)}, /*remote_category_id=*/1) + .AddCategory({GetSuggestionN(3)}, /*remote_category_id=*/12) + .AddCategory({GetSuggestionN(4)}, /*remote_category_id=*/11) + .Build(); + { + InSequence s; + EXPECT_CALL(*raw_mock_ranker, + InsertCategoryBeforeIfNecessary( + Category::FromRemoteCategory(14), articles_category())); + EXPECT_CALL(*raw_mock_ranker, + InsertCategoryBeforeIfNecessary( + Category::FromRemoteCategory(13), articles_category())); + EXPECT_CALL(*raw_mock_ranker, + InsertCategoryAfterIfNecessary(Category::FromRemoteCategory(11), + articles_category())); + EXPECT_CALL(*raw_mock_ranker, + InsertCategoryAfterIfNecessary(Category::FromRemoteCategory(12), + articles_category())); + } + auto service = MakeSuggestionsProvider(/*set_empty_response=*/false); + LoadFromJSONString(service.get(), json_str); +} + +TEST_F( + RemoteSuggestionsProviderImplTest, + AddRemoteCategoriesToCategoryRankerRelativeToArticlesWithArticlesAbsent) { + SetOrderNewRemoteCategoriesBasedOnArticlesCategoryParam(true); + auto mock_ranker = base::MakeUnique<MockCategoryRanker>(); + MockCategoryRanker* raw_mock_ranker = mock_ranker.get(); + SetCategoryRanker(std::move(mock_ranker)); + std::string json_str = + MultiCategoryJsonBuilder() + .AddCategory({GetSuggestionN(0)}, /*remote_category_id=*/11) + .Build(); + + EXPECT_CALL(*raw_mock_ranker, InsertCategoryBeforeIfNecessary(_, _)).Times(0); + EXPECT_CALL(*raw_mock_ranker, + AppendCategoryIfNecessary(Category::FromRemoteCategory(11))); + auto service = MakeSuggestionsProvider(/*set_empty_response=*/false); + LoadFromJSONString(service.get(), json_str); +} + TEST_F(RemoteSuggestionsProviderImplTest, PersistCategoryInfos) { auto service = MakeSuggestionsProvider(); // TODO(vitaliii): Use |articles_category()| instead of constant ID below.
diff --git a/components/offline_pages/core/background/offliner.h b/components/offline_pages/core/background/offliner.h index d8f447b..aae5fd9c 100644 --- a/components/offline_pages/core/background/offliner.h +++ b/components/offline_pages/core/background/offliner.h
@@ -65,12 +65,11 @@ typedef base::Callback<void(const SavePageRequest&, int64_t received_bytes)> ProgressCallback; // Reports the completion status of a request. - // TODO(dougarnett): consider passing back a request id instead of request. typedef base::Callback<void(const SavePageRequest&, RequestStatus)> CompletionCallback; // Reports that the cancel operation has completed. // TODO(chili): make save operation cancellable. - typedef base::Callback<void(int64_t request_id)> CancelCallback; + typedef base::Callback<void(const SavePageRequest&)> CancelCallback; Offliner() {} virtual ~Offliner() {} @@ -85,12 +84,14 @@ const ProgressCallback& progress_callback) = 0; // Clears the currently processing request, if any, and skips running its - // CompletionCallback. - virtual void Cancel(const CancelCallback& callback) = 0; + // CompletionCallback. Returns false if there is nothing to cancel, otherwise + // returns true and canceled request will be delivered using callback. + virtual bool Cancel(const CancelCallback& callback) = 0; // Handles timeout scenario. Returns true if lowbar is met and try to do a - // snapshot of the current webcontents. - virtual bool HandleTimeout(const SavePageRequest& request) = 0; + // snapshot of the current webcontents. If that is the case, the result of + // offlining will be provided by |completion_callback|. + virtual bool HandleTimeout(int64_t request_id) = 0; // TODO(dougarnett): add policy support methods. };
diff --git a/components/offline_pages/core/background/offliner_stub.cc b/components/offline_pages/core/background/offliner_stub.cc index 04fe6ea..58b80a15 100644 --- a/components/offline_pages/core/background/offliner_stub.cc +++ b/components/offline_pages/core/background/offliner_stub.cc
@@ -24,31 +24,37 @@ if (disable_loading_) return false; - completion_callback_ = completion_callback; - progress_callback_ = progress_callback; + pending_request_.reset(new SavePageRequest(request)); + completion_callback_ = + base::Bind(completion_callback, request, Offliner::RequestStatus::SAVED); // Post the callback on the run loop. if (enable_callback_) { const int64_t arbitrary_size = 153LL; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(progress_callback_, request, arbitrary_size)); - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(completion_callback_, request, - Offliner::RequestStatus::SAVED)); + FROM_HERE, base::Bind(progress_callback, request, arbitrary_size)); + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + completion_callback_); } return true; } -void OfflinerStub::Cancel(const CancelCallback& callback) { +bool OfflinerStub::Cancel(const CancelCallback& callback) { cancel_called_ = true; - callback.Run(0LL); + if (!pending_request_) + return false; + + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(callback, *pending_request_.get())); + pending_request_.reset(); + return true; } -bool OfflinerStub::HandleTimeout(const SavePageRequest& request) { +bool OfflinerStub::HandleTimeout(int64_t request_id) { if (snapshot_on_last_retry_) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(completion_callback_, request, - Offliner::RequestStatus::SAVED)); + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + completion_callback_); + pending_request_.reset(); return true; } return false;
diff --git a/components/offline_pages/core/background/offliner_stub.h b/components/offline_pages/core/background/offliner_stub.h index 2d7f72a..d6ddc24 100644 --- a/components/offline_pages/core/background/offliner_stub.h +++ b/components/offline_pages/core/background/offliner_stub.h
@@ -5,6 +5,9 @@ #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ +#include <memory> + +#include "base/callback_forward.h" #include "components/offline_pages/core/background/offliner.h" namespace offline_pages { @@ -20,7 +23,9 @@ const CompletionCallback& completion_callback, const ProgressCallback& progress_callback) override; - void Cancel(const CancelCallback& callback) override; + bool Cancel(const CancelCallback& callback) override; + + bool HandleTimeout(int64_t request_id) override; void disable_loading() { disable_loading_ = true; } @@ -30,13 +35,11 @@ void reset_cancel_called() { cancel_called_ = false; } - bool HandleTimeout(const SavePageRequest& request) override; - void enable_snapshot_on_last_retry() { snapshot_on_last_retry_ = true; } private: - CompletionCallback completion_callback_; - ProgressCallback progress_callback_; + base::Closure completion_callback_; + std::unique_ptr<SavePageRequest> pending_request_; bool disable_loading_; bool enable_callback_; bool cancel_called_;
diff --git a/components/offline_pages/core/background/request_coordinator.cc b/components/offline_pages/core/background/request_coordinator.cc index e1a7170..c8ef7ae 100644 --- a/components/offline_pages/core/background/request_coordinator.cc +++ b/components/offline_pages/core/background/request_coordinator.cc
@@ -207,7 +207,7 @@ scheduler_(std::move(scheduler)), policy_controller_(new ClientPolicyController()), network_quality_estimator_(network_quality_estimator), - active_request_(nullptr), + active_request_id_(0), last_offlining_status_(Offliner::RequestStatus::UNKNOWN), scheduler_callback_(base::Bind(&EmptySchedulerCallback)), internal_start_processing_callback_(base::Bind(&EmptySchedulerCallback)), @@ -284,21 +284,19 @@ callback.Run(std::move(requests)); } -void RequestCoordinator::StopPrerendering( - const Offliner::CancelCallback& final_callback, - Offliner::RequestStatus stop_status) { +void RequestCoordinator::StopPrerendering(const CancelCallback& final_callback, + Offliner::RequestStatus stop_status) { if (offliner_ && state_ == RequestCoordinatorState::OFFLINING) { - DCHECK(active_request_.get()); - offliner_->Cancel(base::Bind( - &RequestCoordinator::HandleCancelUpdateStatusCallback, - weak_ptr_factory_.GetWeakPtr(), final_callback, stop_status)); - return; + DCHECK_NE(active_request_id_, 0); + if (offliner_->Cancel(base::Bind( + &RequestCoordinator::HandleCancelUpdateStatusCallback, + weak_ptr_factory_.GetWeakPtr(), final_callback, stop_status))) { + return; + } } UpdateStatusForCancel(stop_status); - int64_t request_id = - active_request_.get() ? active_request_->request_id() : 0LL; - final_callback.Run(request_id); + final_callback.Run(active_request_id_); } void RequestCoordinator::GetRequestsForSchedulingCallback( @@ -326,9 +324,9 @@ // If we have a request in progress and need to cancel it, call the // pre-renderer to cancel. TODO Make sure we remove any page created by the // prerenderer if it doesn't get the cancel in time. - if (active_request_ != nullptr) { - if (request_ids.end() != std::find(request_ids.begin(), request_ids.end(), - active_request_->request_id())) { + if (active_request_id_ != 0) { + if (request_ids.end() != + std::find(request_ids.begin(), request_ids.end(), active_request_id_)) { StopPrerendering( base::Bind(&RequestCoordinator::ResetActiveRequestCallback, weak_ptr_factory_.GetWeakPtr()), @@ -526,42 +524,33 @@ } void RequestCoordinator::HandleCancelUpdateStatusCallback( - const Offliner::CancelCallback& final_callback, + const CancelCallback& final_callback, Offliner::RequestStatus stop_status, - int64_t offline_id) { + const SavePageRequest& canceled_request) { if (stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT || stop_status == Offliner::RequestStatus::BACKGROUND_SCHEDULER_CANCELED) { // Consider watchdog timeout a completed attempt. - SavePageRequest request(*active_request_.get()); - UpdateRequestForCompletedAttempt(request, stop_status); + UpdateRequestForCompletedAttempt(canceled_request, stop_status); } else { // Otherwise consider this stop an aborted attempt. - UpdateRequestForAbortedAttempt(*active_request_.get()); + UpdateRequestForAbortedAttempt(canceled_request); } + RecordOfflinerResult(canceled_request, stop_status); UpdateStatusForCancel(stop_status); - final_callback.Run(offline_id); + final_callback.Run(canceled_request.request_id()); } void RequestCoordinator::UpdateStatusForCancel( Offliner::RequestStatus stop_status) { // Stopping offliner means it will not call callback so set last status. last_offlining_status_ = stop_status; - - if (active_request_) { - event_logger_.RecordOfflinerResult(active_request_->client_id().name_space, - last_offlining_status_, - active_request_->request_id()); - RecordOfflinerResultUMA(active_request_->client_id(), - active_request_->creation_time(), - last_offlining_status_); - active_request_.reset(); - } + active_request_id_ = 0; state_ = RequestCoordinatorState::IDLE; } void RequestCoordinator::ResetActiveRequestCallback(int64_t offline_id) { - active_request_.reset(); + active_request_id_ = 0; } void RequestCoordinator::StartSchedulerCallback(int64_t offline_id) { @@ -589,7 +578,7 @@ void RequestCoordinator::HandleWatchdogTimeout() { Offliner::RequestStatus watchdog_status = Offliner::REQUEST_COORDINATOR_TIMED_OUT; - if (offliner_->HandleTimeout(*active_request_.get())) + if (offliner_->HandleTimeout(active_request_id_)) return; StopPrerendering(base::Bind(&RequestCoordinator::TryNextRequestCallback, weak_ptr_factory_.GetWeakPtr()), @@ -886,10 +875,7 @@ return; } - // TODO(fgorski): Switch to request_id only, so that this value is not written - // back to the store. - active_request_.reset( - new SavePageRequest(update_result->updated_items.at(0))); + active_request_id_ = request_id; // Start the load and save process in the offliner (Async). if (offliner_->LoadAndSave( @@ -909,7 +895,7 @@ } // Inform observer of active request. - NotifyChanged(*active_request_.get()); + NotifyChanged(update_result->updated_items.at(0)); // Start a watchdog timer to catch pre-renders running too long watchdog_timer_.Start(FROM_HERE, timeout, this, @@ -932,14 +918,11 @@ << ", status: " << static_cast<int>(status) << ", " << __func__; DCHECK_NE(status, Offliner::RequestStatus::UNKNOWN); DCHECK_NE(status, Offliner::RequestStatus::LOADED); - event_logger_.RecordOfflinerResult(request.client_id().name_space, status, - request.request_id()); + RecordOfflinerResult(request, status); last_offlining_status_ = status; - RecordOfflinerResultUMA(request.client_id(), request.creation_time(), - last_offlining_status_); watchdog_timer_.Stop(); state_ = RequestCoordinatorState::IDLE; - active_request_.reset(nullptr); + active_request_id_ = 0; UpdateRequestForCompletedAttempt(request, status); if (ShouldTryNextRequest(status)) @@ -1103,6 +1086,13 @@ return policy_controller_.get(); } +void RequestCoordinator::RecordOfflinerResult(const SavePageRequest& request, + Offliner::RequestStatus status) { + event_logger_.RecordOfflinerResult(request.client_id().name_space, status, + request.request_id()); + RecordOfflinerResultUMA(request.client_id(), request.creation_time(), status); +} + void RequestCoordinator::Shutdown() { network_quality_estimator_ = nullptr; }
diff --git a/components/offline_pages/core/background/request_coordinator.h b/components/offline_pages/core/background/request_coordinator.h index 412808c..8692d28 100644 --- a/components/offline_pages/core/background/request_coordinator.h +++ b/components/offline_pages/core/background/request_coordinator.h
@@ -98,6 +98,9 @@ typedef base::Callback<void(std::vector<std::unique_ptr<SavePageRequest>>)> GetRequestsCallback; + // Callback for stopping the background offlining. + typedef base::Callback<void(int64_t request_id)> CancelCallback; + RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy, std::unique_ptr<Offliner> offliner, std::unique_ptr<RequestQueue> queue, @@ -284,9 +287,9 @@ // Handle updating of request status after cancel is called. Will call // HandleCancelRecordResultCallback for UMA handling void HandleCancelUpdateStatusCallback( - const Offliner::CancelCallback& next_callback, + const CancelCallback& next_callback, Offliner::RequestStatus stop_status, - int64_t offline_id); + const SavePageRequest& canceled_request); void UpdateStatusForCancel(Offliner::RequestStatus stop_status); void ResetActiveRequestCallback(int64_t offline_id); void StartSchedulerCallback(int64_t offline_id); @@ -336,7 +339,7 @@ void HandleWatchdogTimeout(); // Cancels an in progress pre-rendering, and updates state appropriately. - void StopPrerendering(const Offliner::CancelCallback& callback, + void StopPrerendering(const CancelCallback& callback, Offliner::RequestStatus stop_status); // Marks attempt on the request and sends it to offliner in continuation. @@ -396,6 +399,10 @@ const std::string& name_space, std::unique_ptr<UpdateRequestsResult> result); + // Reports offliner status through UMA and event logger. + void RecordOfflinerResult(const SavePageRequest& request, + Offliner::RequestStatus status); + void SetDeviceConditionsForTest(const DeviceConditions& current_conditions) { use_test_device_conditions_ = true; current_conditions_.reset(new DeviceConditions(current_conditions)); @@ -436,8 +443,8 @@ // Unowned pointer to the Network Quality Estimator. net::NetworkQualityEstimator::NetworkQualityProvider* network_quality_estimator_; - // Holds copy of the active request, if any. - std::unique_ptr<SavePageRequest> active_request_; + // Holds an ID of the currently active request. + int64_t active_request_id_; // Status of the most recent offlining. Offliner::RequestStatus last_offlining_status_; // A set of request_ids that we are holding off until the download manager is
diff --git a/components/offline_pages/core/background/request_coordinator_unittest.cc b/components/offline_pages/core/background/request_coordinator_unittest.cc index b45cf554..5933792f 100644 --- a/components/offline_pages/core/background/request_coordinator_unittest.cc +++ b/components/offline_pages/core/background/request_coordinator_unittest.cc
@@ -1301,13 +1301,7 @@ EXPECT_EQ(kRequestId2, last_requests().at(1)->request_id()); } -#if defined(OS_IOS) -// Flaky on IOS. http://crbug/663311 -#define MAYBE_PauseAndResumeObserver DISABLED_PauseAndResumeObserver -#else -#define MAYBE_PauseAndResumeObserver PauseAndResumeObserver -#endif -TEST_F(RequestCoordinatorTest, MAYBE_PauseAndResumeObserver) { +TEST_F(RequestCoordinatorTest, PauseAndResumeObserver) { // Set low-end device status to actual status. SetIsLowEndDeviceForTest(base::SysInfo::IsLowEndDevice());
diff --git a/components/payments/content/payment_request_state.cc b/components/payments/content/payment_request_state.cc index 2d77682..5628fad 100644 --- a/components/payments/content/payment_request_state.cc +++ b/components/payments/content/payment_request_state.cc
@@ -105,6 +105,20 @@ SetSelectedInstrument(available_instruments_.back().get()); } +void PaymentRequestState::AddAutofillShippingProfile( + bool selected, + const autofill::AutofillProfile& profile) { + profile_cache_.push_back( + base::MakeUnique<autofill::AutofillProfile>(profile)); + // TODO(tmartino): Implement deduplication rules specific to shipping + // profiles. + autofill::AutofillProfile* new_cached_profile = profile_cache_.back().get(); + shipping_profiles_.push_back(new_cached_profile); + + if (selected) + SetSelectedShippingProfile(new_cached_profile); +} + void PaymentRequestState::SetSelectedShippingOption( const std::string& shipping_option_id) { spec_->StartWaitingForUpdateWith(
diff --git a/components/payments/content/payment_request_state.h b/components/payments/content/payment_request_state.h index 508bd979..9ff91422 100644 --- a/components/payments/content/payment_request_state.h +++ b/components/payments/content/payment_request_state.h
@@ -124,6 +124,12 @@ void AddAutofillPaymentInstrument(bool selected, const autofill::CreditCard& card); + // Creates and adds an AutofillProfile as a shipping profile, which makes a + // copy of |profile|. |selected| indicates if the newly-created shipping + // profile should be selected, after which observers will be notified. + void AddAutofillShippingProfile(bool selected, + const autofill::AutofillProfile& profile); + // Setters to change the selected information. Will have the side effect of // recomputing "is ready to pay" and notify observers. void SetSelectedShippingOption(const std::string& shipping_option_id);
diff --git a/components/resources/autofill_scaled_resources.grdp b/components/resources/autofill_scaled_resources.grdp index 53b5a22..76d741a 100644 --- a/components/resources/autofill_scaled_resources.grdp +++ b/components/resources/autofill_scaled_resources.grdp
@@ -7,6 +7,7 @@ <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_JCB" file="autofill/jcb.png" /> <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_MASTERCARD" file="autofill/mastercard.png" /> <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_MIR" file="autofill/mir.png" /> + <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_UNIONPAY" file="autofill/unionpay.png" /> <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_VISA" file="autofill/visa.png" /> <!-- These are not used on desktop, only Android, so use a placeholder file.
diff --git a/components/resources/default_100_percent/autofill/unionpay.png b/components/resources/default_100_percent/autofill/unionpay.png new file mode 100644 index 0000000..e0ab343c --- /dev/null +++ b/components/resources/default_100_percent/autofill/unionpay.png Binary files differ
diff --git a/components/resources/default_200_percent/autofill/unionpay.png b/components/resources/default_200_percent/autofill/unionpay.png new file mode 100644 index 0000000..78380604 --- /dev/null +++ b/components/resources/default_200_percent/autofill/unionpay.png Binary files differ
diff --git a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java index 33592802..ec093851 100644 --- a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java +++ b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java
@@ -26,29 +26,37 @@ private PopupWindow mPopup; /** - * Creates a popup window to show the specified messages, and show it on - * the specified anchor rectangle. + * Creates a popup window to show the specified messages, and show it on the specified anchor + * rectangle. * - * @param contentViewCore The ContentViewCore object to provide various - * information. + * If the anchor view is not in a state where a popup can be shown, this will return null. + * + * @param contentViewCore The ContentViewCore object to provide various information. * @param anchorX Anchor position in the CSS unit. * @param anchorY Anchor position in the CSS unit. * @param anchorWidth Anchor size in the CSS unit. * @param anchorHeight Anchor size in the CSS unit. - * @param mainText The main message. It will shown at the top of the popup - * window, and its font size is larger. - * @param subText The sub message. It will shown below the main message, and - * its font size is smaller. + * @param mainText The main message. It will shown at the top of the popup window, and its font + * size is larger. + * @param subText The sub message. It will shown below the main message, and its font size is + * smaller. */ @CalledByNative - private static ValidationMessageBubble createAndShow( - ContentViewCore contentViewCore, int anchorX, int anchorY, - int anchorWidth, int anchorHeight, String mainText, String subText) { + private static ValidationMessageBubble createAndShowIfApplicable( + ContentViewCore contentViewCore, int anchorX, int anchorY, int anchorWidth, + int anchorHeight, String mainText, String subText) { + if (!canShowBubble(contentViewCore)) return null; + final RectF anchorPixInScreen = makePixRectInScreen( contentViewCore, anchorX, anchorY, anchorWidth, anchorHeight); return new ValidationMessageBubble(contentViewCore, anchorPixInScreen, mainText, subText); } + private static boolean canShowBubble(ContentViewCore contentViewCore) { + return contentViewCore.getContainerView() != null + && contentViewCore.getContainerView().getWindowToken() != null; + } + private ValidationMessageBubble( ContentViewCore contentViewCore, RectF anchor, String mainText, String subText) { final ViewGroup root = (ViewGroup) View.inflate(contentViewCore.getContext(), @@ -72,8 +80,7 @@ /** * Moves the popup window on the specified anchor rectangle. * - * @param contentViewCore The ContentViewCore object to provide various - * information. + * @param contentViewCore The ContentViewCore object to provide various information. * @param anchorX Anchor position in the CSS unit. * @param anchorY Anchor position in the CSS unit. * @param anchorWidth Anchor size in the CSS unit.
diff --git a/components/web_contents_delegate_android/validation_message_bubble_android.cc b/components/web_contents_delegate_android/validation_message_bubble_android.cc index 0dd5eee1..e2ee3a1f 100644 --- a/components/web_contents_delegate_android/validation_message_bubble_android.cc +++ b/components/web_contents_delegate_android/validation_message_bubble_android.cc
@@ -42,7 +42,7 @@ JNIEnv* env = base::android::AttachCurrentThread(); java_validation_message_bubble_.Reset( - Java_ValidationMessageBubble_createAndShow( + Java_ValidationMessageBubble_createAndShowIfApplicable( env, java_content_view_core, anchor_in_root_view.x(), anchor_in_root_view.y(), anchor_in_root_view.width(), anchor_in_root_view.height(), @@ -51,16 +51,20 @@ } ValidationMessageBubbleAndroid::~ValidationMessageBubbleAndroid() { - Java_ValidationMessageBubble_close(base::android::AttachCurrentThread(), - java_validation_message_bubble_); + if (!java_validation_message_bubble_.is_null()) { + Java_ValidationMessageBubble_close(base::android::AttachCurrentThread(), + java_validation_message_bubble_); + } } void ValidationMessageBubbleAndroid::SetPositionRelativeToAnchor( RenderWidgetHost* widget_host, const gfx::Rect& anchor_in_root_view) { base::android::ScopedJavaLocalRef<jobject> java_content_view_core = GetJavaContentViewCoreFrom(widget_host); - if (java_content_view_core.is_null()) + if (java_content_view_core.is_null() || + java_validation_message_bubble_.is_null()) { return; + } Java_ValidationMessageBubble_setPositionRelativeToAnchor( base::android::AttachCurrentThread(), java_validation_message_bubble_,
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index e6667c27c..3a1da35 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -728,11 +728,6 @@ if (ShouldDisableAcceleratedVideoDecode(command_line)) command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); -#if BUILDFLAG(ENABLE_WEBRTC) - if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && - !command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding)) - command_line->AppendSwitch(switches::kDisableWebRtcHWVP8Encoding); -#endif #if defined(USE_AURA) if (!CanUseGpuBrowserCompositor()) @@ -814,25 +809,6 @@ } #endif -#if BUILDFLAG(ENABLE_WEBRTC) -if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE)) { -#if defined (OS_ANDROID) - // On Android HW H264 is enabled by default behind a flag now, regardless of - // the blacklist. Disable HW encoding if every single HW codec is disabled. - // TODO(braveyao): remove this once the blacklist is removed - // (crbug.com/638664). - if (!base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding)) { -#endif - if (!command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) - command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); - if (gpu_preferences) - gpu_preferences->disable_web_rtc_hw_encoding = true; -#if defined (OS_ANDROID) - } -#endif -} -#endif - if (gpu_preferences) { // enable_es3_apis bool blacklisted = IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2); bool enabled = base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 57ae36c0..de233c6 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -124,6 +124,7 @@ switches::kDisableGLExtensions, switches::kDisableLogging, switches::kDisableSeccompFilterSandbox, + switches::kDisableShaderNameHashing, #if BUILDFLAG(ENABLE_WEBRTC) switches::kDisableWebRtcHWEncoding, #endif
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 3e49165..94d72f2 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1501,7 +1501,7 @@ gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { if (mouse_locked_) - return ui::kCursorNone; + return ui::CursorType::kNone; return current_cursor_.GetNativeCursor(); } @@ -2009,8 +2009,8 @@ gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); // Do not show loading cursor when the cursor is currently hidden. - if (is_loading_ && cursor != ui::kCursorNone) - cursor = ui::kCursorPointer; + if (is_loading_ && cursor != ui::CursorType::kNone) + cursor = ui::Cursor(ui::CursorType::kPointer); aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(root_window);
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index e566715..41d21d0 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -150,7 +150,7 @@ @property(nonatomic, assign) NSRange selectedRange; @property(nonatomic, assign) NSRange markedRange; -+ (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; +- (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event consumed:(BOOL)consumed; @@ -2149,7 +2149,7 @@ widgetHost->ForwardKeyboardEvent(event); // Possibly autohide the cursor. - if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) + if ([self shouldAutohideCursorForEvent:theEvent]) [NSCursor setHiddenUntilMouseMoves:YES]; return; @@ -2315,7 +2315,7 @@ } // Possibly autohide the cursor. - if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) + if ([self shouldAutohideCursorForEvent:theEvent]) [NSCursor setHiddenUntilMouseMoves:YES]; } @@ -2833,9 +2833,13 @@ // Determine whether we should autohide the cursor (i.e., hide it until mouse // move) for the given event. Customize here to be more selective about which // key presses to autohide on. -+ (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event { - return ([event type] == NSKeyDown && - !([event modifierFlags] & NSCommandKeyMask)) ? YES : NO; +- (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event { + return (renderWidgetHostView_->GetTextInputType() != + ui::TEXT_INPUT_TYPE_NONE && + [event type] == NSKeyDown && + !([event modifierFlags] & NSCommandKeyMask)) + ? YES + : NO; } - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute
diff --git a/content/common/cursors/webcursor_aura.cc b/content/common/cursors/webcursor_aura.cc index dd43fe85..f198bad5 100644 --- a/content/common/cursors/webcursor_aura.cc +++ b/content/common/cursors/webcursor_aura.cc
@@ -16,93 +16,93 @@ gfx::NativeCursor WebCursor::GetNativeCursor() { switch (type_) { case WebCursorInfo::kTypePointer: - return ui::kCursorPointer; + return ui::CursorType::kPointer; case WebCursorInfo::kTypeCross: - return ui::kCursorCross; + return ui::CursorType::kCross; case WebCursorInfo::kTypeHand: - return ui::kCursorHand; + return ui::CursorType::kHand; case WebCursorInfo::kTypeIBeam: - return ui::kCursorIBeam; + return ui::CursorType::kIBeam; case WebCursorInfo::kTypeWait: - return ui::kCursorWait; + return ui::CursorType::kWait; case WebCursorInfo::kTypeHelp: - return ui::kCursorHelp; + return ui::CursorType::kHelp; case WebCursorInfo::kTypeEastResize: - return ui::kCursorEastResize; + return ui::CursorType::kEastResize; case WebCursorInfo::kTypeNorthResize: - return ui::kCursorNorthResize; + return ui::CursorType::kNorthResize; case WebCursorInfo::kTypeNorthEastResize: - return ui::kCursorNorthEastResize; + return ui::CursorType::kNorthEastResize; case WebCursorInfo::kTypeNorthWestResize: - return ui::kCursorNorthWestResize; + return ui::CursorType::kNorthWestResize; case WebCursorInfo::kTypeSouthResize: - return ui::kCursorSouthResize; + return ui::CursorType::kSouthResize; case WebCursorInfo::kTypeSouthEastResize: - return ui::kCursorSouthEastResize; + return ui::CursorType::kSouthEastResize; case WebCursorInfo::kTypeSouthWestResize: - return ui::kCursorSouthWestResize; + return ui::CursorType::kSouthWestResize; case WebCursorInfo::kTypeWestResize: - return ui::kCursorWestResize; + return ui::CursorType::kWestResize; case WebCursorInfo::kTypeNorthSouthResize: - return ui::kCursorNorthSouthResize; + return ui::CursorType::kNorthSouthResize; case WebCursorInfo::kTypeEastWestResize: - return ui::kCursorEastWestResize; + return ui::CursorType::kEastWestResize; case WebCursorInfo::kTypeNorthEastSouthWestResize: - return ui::kCursorNorthEastSouthWestResize; + return ui::CursorType::kNorthEastSouthWestResize; case WebCursorInfo::kTypeNorthWestSouthEastResize: - return ui::kCursorNorthWestSouthEastResize; + return ui::CursorType::kNorthWestSouthEastResize; case WebCursorInfo::kTypeColumnResize: - return ui::kCursorColumnResize; + return ui::CursorType::kColumnResize; case WebCursorInfo::kTypeRowResize: - return ui::kCursorRowResize; + return ui::CursorType::kRowResize; case WebCursorInfo::kTypeMiddlePanning: - return ui::kCursorMiddlePanning; + return ui::CursorType::kMiddlePanning; case WebCursorInfo::kTypeEastPanning: - return ui::kCursorEastPanning; + return ui::CursorType::kEastPanning; case WebCursorInfo::kTypeNorthPanning: - return ui::kCursorNorthPanning; + return ui::CursorType::kNorthPanning; case WebCursorInfo::kTypeNorthEastPanning: - return ui::kCursorNorthEastPanning; + return ui::CursorType::kNorthEastPanning; case WebCursorInfo::kTypeNorthWestPanning: - return ui::kCursorNorthWestPanning; + return ui::CursorType::kNorthWestPanning; case WebCursorInfo::kTypeSouthPanning: - return ui::kCursorSouthPanning; + return ui::CursorType::kSouthPanning; case WebCursorInfo::kTypeSouthEastPanning: - return ui::kCursorSouthEastPanning; + return ui::CursorType::kSouthEastPanning; case WebCursorInfo::kTypeSouthWestPanning: - return ui::kCursorSouthWestPanning; + return ui::CursorType::kSouthWestPanning; case WebCursorInfo::kTypeWestPanning: - return ui::kCursorWestPanning; + return ui::CursorType::kWestPanning; case WebCursorInfo::kTypeMove: - return ui::kCursorMove; + return ui::CursorType::kMove; case WebCursorInfo::kTypeVerticalText: - return ui::kCursorVerticalText; + return ui::CursorType::kVerticalText; case WebCursorInfo::kTypeCell: - return ui::kCursorCell; + return ui::CursorType::kCell; case WebCursorInfo::kTypeContextMenu: - return ui::kCursorContextMenu; + return ui::CursorType::kContextMenu; case WebCursorInfo::kTypeAlias: - return ui::kCursorAlias; + return ui::CursorType::kAlias; case WebCursorInfo::kTypeProgress: - return ui::kCursorProgress; + return ui::CursorType::kProgress; case WebCursorInfo::kTypeNoDrop: - return ui::kCursorNoDrop; + return ui::CursorType::kNoDrop; case WebCursorInfo::kTypeCopy: - return ui::kCursorCopy; + return ui::CursorType::kCopy; case WebCursorInfo::kTypeNone: - return ui::kCursorNone; + return ui::CursorType::kNone; case WebCursorInfo::kTypeNotAllowed: - return ui::kCursorNotAllowed; + return ui::CursorType::kNotAllowed; case WebCursorInfo::kTypeZoomIn: - return ui::kCursorZoomIn; + return ui::CursorType::kZoomIn; case WebCursorInfo::kTypeZoomOut: - return ui::kCursorZoomOut; + return ui::CursorType::kZoomOut; case WebCursorInfo::kTypeGrab: - return ui::kCursorGrab; + return ui::CursorType::kGrab; case WebCursorInfo::kTypeGrabbing: - return ui::kCursorGrabbing; + return ui::CursorType::kGrabbing; case WebCursorInfo::kTypeCustom: { - ui::Cursor cursor(ui::kCursorCustom); + ui::Cursor cursor(ui::CursorType::kCustom); cursor.SetPlatformCursor(GetPlatformCursor()); return cursor; }
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index 245da16..a4145ba 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -63,9 +63,7 @@ #endif #if BUILDFLAG(ENABLE_WEBRTC) gpu_preferences.disable_web_rtc_hw_encoding = - command_line->HasSwitch(switches::kDisableWebRtcHWEncoding) || - (command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding) && - !base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding)); + command_line->HasSwitch(switches::kDisableWebRtcHWEncoding); #endif #if defined(OS_WIN) uint32_t enable_accelerated_vpx_decode_val =
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 0bae9e36..850838a 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -275,6 +275,16 @@ const base::Feature kWebRtcHWH264Encoding{ "WebRtcHWH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT}; +// Enables HW VP8 encoding on Android. +const base::Feature kWebRtcHWVP8Encoding { + "WebRtcHWVP8Encoding", +#if defined(OS_ANDROID) + base::FEATURE_DISABLED_BY_DEFAULT +#else + base::FEATURE_ENABLED_BY_DEFAULT +#endif +}; + // Enables the WebRTC Echo Canceller version 3 (AEC3). Feature for // http://crbug.com/688388. This value is sent to WebRTC's echo canceller to // toggle which echo canceller should be used.
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index b2342cce..a14b144 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -71,6 +71,7 @@ CONTENT_EXPORT extern const base::Feature kWebPayments; CONTENT_EXPORT extern const base::Feature kWebRtcEcdsaDefault; CONTENT_EXPORT extern const base::Feature kWebRtcHWH264Encoding; +CONTENT_EXPORT extern const base::Feature kWebRtcHWVP8Encoding; CONTENT_EXPORT extern const base::Feature kWebRtcUseEchoCanceller3; CONTENT_EXPORT extern const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames; CONTENT_EXPORT extern const base::Feature kWebUsb;
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 1704d64d..7322b1d 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -921,9 +921,6 @@ // Disables HW encode acceleration for WebRTC. const char kDisableWebRtcHWEncoding[] = "disable-webrtc-hw-encoding"; -// Disables HW VP8 encode acceleration for WebRTC. -const char kDisableWebRtcHWVP8Encoding[] = "disable-webrtc-hw-vp8-encoding"; - // Enables negotiation of GCM cipher suites from RFC 7714 for SRTP in WebRTC. // See https://tools.ietf.org/html/rfc7714 for further information. const char kEnableWebRtcSrtpAesGcm[] = "enable-webrtc-srtp-aes-gcm";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 545ec54..372092a 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -265,7 +265,6 @@ CONTENT_EXPORT extern const char kDisableWebRtcEncryption[]; CONTENT_EXPORT extern const char kDisableWebRtcHWDecoding[]; CONTENT_EXPORT extern const char kDisableWebRtcHWEncoding[]; -CONTENT_EXPORT extern const char kDisableWebRtcHWVP8Encoding[]; CONTENT_EXPORT extern const char kEnableWebRtcSrtpAesGcm[]; CONTENT_EXPORT extern const char kEnableWebRtcStunOrigin[]; CONTENT_EXPORT extern const char kEnforceWebRtcIPPermissionCheck[];
diff --git a/content/public/renderer/BUILD.gn b/content/public/renderer/BUILD.gn index 9f66a566..1e970e5 100644 --- a/content/public/renderer/BUILD.gn +++ b/content/public/renderer/BUILD.gn
@@ -70,12 +70,15 @@ configs += [ "//content:content_implementation" ] + public_deps = [ + "//media", + ] + deps = [ "//content/public/child:child_sources", "//content/public/common:common_sources", "//content/renderer", "//gin", - "//media", "//media/capture", "//media/gpu/ipc/client", "//net",
diff --git a/content/renderer/media/gpu/rtc_video_encoder_factory.cc b/content/renderer/media/gpu/rtc_video_encoder_factory.cc index 56d28bc2..1b01db88 100644 --- a/content/renderer/media/gpu/rtc_video_encoder_factory.cc +++ b/content/renderer/media/gpu/rtc_video_encoder_factory.cc
@@ -27,10 +27,9 @@ const int fps = profile.max_framerate_numerator; DCHECK_EQ(profile.max_framerate_denominator, 1U); - const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); if (profile.profile >= media::VP8PROFILE_MIN && profile.profile <= media::VP8PROFILE_MAX) { - if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding)) { + if (base::FeatureList::IsEnabled(features::kWebRtcHWVP8Encoding)) { codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( webrtc::kVideoCodecVP8, "VP8", width, height, fps)); }
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 4f920ce..b8c509a4 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -95,6 +95,7 @@ #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" +#include "third_party/WebKit/public/platform/WebThread.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h"
diff --git a/docs/android_build_instructions.md b/docs/android_build_instructions.md index edc51d77..c16d2751 100644 --- a/docs/android_build_instructions.md +++ b/docs/android_build_instructions.md
@@ -191,13 +191,13 @@ ### Build the full browser ```shell -ninja -C out/Release chrome_public_apk +ninja -C out/Default chrome_public_apk ``` And deploy it to your Android device: ```shell -CHROMIUM_OUTPUT_DIR=$gndir build/android/adb_install_apk.py $gndir/apks/ChromePublic.apk # for gn. +build/android/adb_install_apk.py out/Default/apks/ChromePublic.apk ``` The app will appear on the device as "Chromium". @@ -209,12 +209,12 @@ for details on the content module and content shell. ```shell -ninja -C out/Release content_shell_apk -build/android/adb_install_apk.py out/Release/apks/ContentShell.apk +ninja -C out/Default content_shell_apk +build/android/adb_install_apk.py out/Default/apks/ContentShell.apk ``` this will build and install an Android apk under -`out/Release/apks/ContentShell.apk`. (Where `Release` is the name of your build +`out/Default/apks/ContentShell.apk`. (Where `Release` is the name of your build directory.) If you use custom out dir instead of standard out/ dir, use
diff --git a/extensions/browser/image_loader.cc b/extensions/browser/image_loader.cc index 038e8be..cf2fea8 100644 --- a/extensions/browser/image_loader.cc +++ b/extensions/browser/image_loader.cc
@@ -14,7 +14,6 @@ #include "base/files/file_util.h" #include "base/strings/string_number_conversions.h" #include "base/task_scheduler/post_task.h" -#include "base/threading/sequenced_worker_pool.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/component_extension_resource_manager.h" #include "extensions/browser/extensions_browser_client.h" @@ -265,7 +264,6 @@ const std::vector<ImageRepresentation>& info_list, const ImageLoaderImageCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(!BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, base::TaskTraits().MayBlock().WithPriority( base::TaskPriority::USER_VISIBLE), @@ -280,7 +278,6 @@ const std::vector<ImageRepresentation>& info_list, const ImageLoaderImageFamilyCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(!BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, base::TaskTraits().MayBlock().WithPriority( base::TaskPriority::USER_VISIBLE),
diff --git a/extensions/shell/browser/shell_desktop_controller_aura.cc b/extensions/shell/browser/shell_desktop_controller_aura.cc index dfbecf8..a76f6237 100644 --- a/extensions/shell/browser/shell_desktop_controller_aura.cc +++ b/extensions/shell/browser/shell_desktop_controller_aura.cc
@@ -128,7 +128,7 @@ if (visible) { SetCursor(delegate->GetCursor(), delegate); } else { - gfx::NativeCursor invisible_cursor(ui::kCursorNone); + gfx::NativeCursor invisible_cursor(ui::CursorType::kNone); image_cursors_->SetPlatformCursor(&invisible_cursor); ApplyCursor(invisible_cursor); } @@ -308,7 +308,7 @@ new ShellNativeCursorManager(host_.get())))); cursor_manager_->SetDisplay( display::Screen::GetScreen()->GetPrimaryDisplay()); - cursor_manager_->SetCursor(ui::kCursorPointer); + cursor_manager_->SetCursor(ui::CursorType::kPointer); aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); user_activity_detector_.reset(new ui::UserActivityDetector);
diff --git a/gpu/config/software_rendering_list.json b/gpu/config/software_rendering_list.json index dced8ff6..23cc2b9 100644 --- a/gpu/config/software_rendering_list.json +++ b/gpu/config/software_rendering_list.json
@@ -645,17 +645,6 @@ ] }, { - "id": 82, - "description": "MediaCodec is still too buggy to use for encoding (b/11536167)", - "cr_bugs": [615108], - "os": { - "type": "android" - }, - "features": [ - "accelerated_video_encode" - ] - }, - { "id": 86, "description": "Intel Graphics Media Accelerator 3150 causes the GPU process to hang running WebGL", "cr_bugs": [305431],
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index 66c2e2e..7946208c8 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -139,10 +139,8 @@ "public/web_client.mm", "public/web_kit_constants.h", "public/web_state/context_menu_params.h", - "public/web_state/credential.h", "public/web_state/crw_web_controller_observer.h", "public/web_state/global_web_state_observer.h", - "public/web_state/js/credential_util.h", "public/web_state/js/crw_js_injection_evaluator.h", "public/web_state/js/crw_js_injection_manager.h", "public/web_state/js/crw_js_injection_receiver.h", @@ -183,7 +181,6 @@ "web_state/context_menu_params.mm", "web_state/context_menu_params_utils.h", "web_state/context_menu_params_utils.mm", - "web_state/credential.cc", "web_state/crw_pass_kit_downloader.h", "web_state/crw_pass_kit_downloader.mm", "web_state/error_translation_util.h", @@ -191,7 +188,6 @@ "web_state/global_web_state_event_tracker.h", "web_state/global_web_state_event_tracker.mm", "web_state/global_web_state_observer.cc", - "web_state/js/credential_util.mm", "web_state/js/crw_js_injection_manager.mm", "web_state/js/crw_js_injection_receiver.mm", "web_state/js/crw_js_plugin_placeholder_manager.h", @@ -608,7 +604,6 @@ "web_state/error_translation_util_unittest.mm", "web_state/js/common_js_unittest.mm", "web_state/js/context_menu_js_unittest.mm", - "web_state/js/credential_util_unittest.mm", "web_state/js/crw_js_injection_manager_unittest.mm", "web_state/js/crw_js_post_request_loader_unittest.mm", "web_state/js/crw_js_window_id_manager_unittest.mm",
diff --git a/ios/web/public/web_state/credential.h b/ios/web/public/web_state/credential.h deleted file mode 100644 index cb7d5b6..0000000 --- a/ios/web/public/web_state/credential.h +++ /dev/null
@@ -1,53 +0,0 @@ -// Copyright 2015 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. - -#ifndef IOS_WEB_PUBLIC_WEB_STATE_CREDENTIAL_H_ -#define IOS_WEB_PUBLIC_WEB_STATE_CREDENTIAL_H_ - -#include "base/strings/string16.h" -#include "url/gurl.h" -#include "url/origin.h" - -namespace web { - -// Indicates the specific type of a Credential object. -enum CredentialType { - CREDENTIAL_TYPE_EMPTY = 0, - CREDENTIAL_TYPE_PASSWORD, - CREDENTIAL_TYPE_FEDERATED, - CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED -}; - -// Represents an instance of the JavaScript Credential type. -struct Credential { - Credential(); - Credential(const Credential& other); - ~Credential(); - - // The specific type of this credential. - CredentialType type; - - // An identifier for the credential. - base::string16 id; - - // A human-understandable name corresponding to the credential. - base::string16 name; - - // The URL of the user's avatar. - GURL avatar_url; - - // The password for a local credential. - base::string16 password; - - // The federation URL for a federated credential. - url::Origin federation_origin; -}; - -// Determines whether two credentials are equal. -bool CredentialsEqual(const web::Credential& credential1, - const web::Credential& credential2); - -} // namespace web - -#endif // IOS_WEB_PUBLIC_WEB_STATE_CREDENTIAL_H_
diff --git a/ios/web/public/web_state/js/credential_util.h b/ios/web/public/web_state/js/credential_util.h deleted file mode 100644 index f18b274..0000000 --- a/ios/web/public/web_state/js/credential_util.h +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2015 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. - -#ifndef IOS_WEB_PUBLIC_WEB_STATE_JS_CREDENTIAL_UTIL_H_ -#define IOS_WEB_PUBLIC_WEB_STATE_JS_CREDENTIAL_UTIL_H_ - -namespace base { -class DictionaryValue; -} // namespace base - -namespace web { - -struct Credential; - -// Populates |credential| from |value|, returning true if successful and false -// otherwise. |value| must contain the following string->string key/value -// pairs: -// -// "type": one of "PasswordCredential" of "FederatedCredential" -// "id": a string (possibly empty) -// -// The following pairs are optional: -// -// "name": a string (possibly empty) -// "avatarURL": a valid URL as a string -// -// If "type" is "PasswordCredential", then |value| must contain -// -// "password" a string (possibly empty) -// -// If "type" is "FederatedCredential", then |value| must contain -// -// "federation": a valid URL as a string -// -// If passed a |value| that doesn't meet these restrictions, |credential| will -// not be modified and false will be returned. |credential| must not be null. -bool DictionaryValueToCredential(const base::DictionaryValue& value, - Credential* credential); - -// Serializes |credential| to |value|. -void CredentialToDictionaryValue(const Credential& credential, - base::DictionaryValue* value); - -} // namespace web - -#endif // IOS_WEB_PUBLIC_WEB_STATE_JS_CREDENTIAL_UTIL_H_
diff --git a/ios/web/public/web_state/web_state_observer.h b/ios/web/public/web_state/web_state_observer.h index 52fdb1ed..32954ee 100644 --- a/ios/web/public/web_state/web_state_observer.h +++ b/ios/web/public/web_state/web_state_observer.h
@@ -16,7 +16,6 @@ namespace web { -struct Credential; struct FaviconURL; class NavigationContext; struct LoadCommittedDetails; @@ -116,54 +115,6 @@ // possibly by other means). virtual void RenderProcessGone() {} - // Notifies the observer that the credential manager API was invoked from - // |source_url| to request a credential from the browser. If |unmediated| - // is true, the browser MUST NOT show any UI to the user. If this means that - // no credential will be returned to the page, so be it. Otherwise, the - // browser may show the user any UI that is necessary to get a Credential and - // return it to the page. |federations| specifies a list of acceptable - // federation providers. |user_interaction| indicates whether the API was - // invoked in response to a user interaction. Responses to the page should - // provide the specified |request_id|. - virtual void CredentialsRequested(int request_id, - const GURL& source_url, - bool unmediated, - const std::vector<std::string>& federations, - bool is_user_initiated) {} - - // Notifies the observer that the credential manager API was invoked from - // |source_url| to notify the browser that the user signed in. |credential| - // specifies the credential that was used to sign in. Responses to the page - // should provide the specified |request_id|. - virtual void SignedIn(int request_id, - const GURL& source_url, - const web::Credential& credential) {} - - // Notifies the observer that the credential manager API was invoked from - // |source_url| to notify the browser that the user signed in without - // specifying the credential that was used. Responses to the page should - // provide the specified |request_id|. - virtual void SignedIn(int request_id, const GURL& source_url) {} - - // Notifies the observer that the credential manager API was invoked from - // |source_url| to notify the browser that the user signed out. Responses - // to the page should provide the specified |request_id|. - virtual void SignedOut(int request_id, const GURL& source_url) {} - - // Notifies the observer that the credential manager API was invoked from - // |source_url| to notify the browser that the user failed to sign in. - // |credential| specifies the credential that failed to sign in. Responses - // to the page should provide the specified |request_id|. - virtual void SignInFailed(int request_id, - const GURL& source_url, - const web::Credential& credential) {} - - // Notifies the observer that the credential manager API was invoked from - // |source_url| to notify the browser that the user failed to sign in without - // specifying the credential that failed. Responses to the page should provide - // the specified |request_id|. - virtual void SignInFailed(int request_id, const GURL& source_url) {} - // Invoked when the WebState is being destroyed. Gives subclasses a chance // to cleanup. virtual void WebStateDestroyed() {}
diff --git a/ios/web/web_state/credential.cc b/ios/web/web_state/credential.cc deleted file mode 100644 index ac710a8..0000000 --- a/ios/web/web_state/credential.cc +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2015 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 "ios/web/public/web_state/credential.h" - -namespace web { - -Credential::Credential() : type(CREDENTIAL_TYPE_EMPTY) { -} - -Credential::Credential(const Credential& other) = default; - -Credential::~Credential() = default; - -bool CredentialsEqual(const web::Credential& credential1, - const web::Credential& credential2) { - return credential1.type == credential2.type && - credential1.id == credential2.id && - credential1.name == credential2.name && - credential1.avatar_url == credential2.avatar_url && - credential1.password == credential2.password && - credential1.federation_origin.Serialize() == - credential2.federation_origin.Serialize(); -} - -} // namespace web
diff --git a/ios/web/web_state/js/credential_util.mm b/ios/web/web_state/js/credential_util.mm deleted file mode 100644 index b4a2d74..0000000 --- a/ios/web/web_state/js/credential_util.mm +++ /dev/null
@@ -1,111 +0,0 @@ -// Copyright 2015 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 "ios/web/public/web_state/js/credential_util.h" - -#include "base/logging.h" -#include "base/strings/string16.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "ios/web/public/web_state/credential.h" -#include "url/gurl.h" -#include "url/origin.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -namespace { - -// "type" value for a DictionaryValue representation of PasswordCredential. -const char* kPasswordCredentialType = "PasswordCredential"; - -// "type" value for a DictionaryValue representation of FederatedCredential. -const char* kFederatedCredentialType = "FederatedCredential"; - -} // namespace - -namespace web { - -bool DictionaryValueToCredential(const base::DictionaryValue& value, - Credential* credential) { - DCHECK(credential); - - base::string16 type; - if (!value.GetString("type", &type)) - return false; - CredentialType credential_type; - if (type == base::ASCIIToUTF16(kPasswordCredentialType)) - credential_type = CredentialType::CREDENTIAL_TYPE_PASSWORD; - else if (type == base::ASCIIToUTF16(kFederatedCredentialType)) - credential_type = CredentialType::CREDENTIAL_TYPE_FEDERATED; - else - return false; - - base::string16 id; - if (!value.GetString("id", &id)) - return false; - - base::string16 name; - value.GetString("name", &name); - - base::string16 avatar; - GURL avatar_url; - if (value.GetString("avatarURL", &avatar)) { - avatar_url = GURL(avatar); - if (!avatar_url.is_valid()) - return false; - } - - base::string16 password; - if (credential_type == CredentialType::CREDENTIAL_TYPE_PASSWORD && - !value.GetString("password", &password)) { - return false; - } - - base::string16 federation; - GURL federation_url; - if (credential_type == CredentialType::CREDENTIAL_TYPE_FEDERATED) { - if (!value.GetString("federation", &federation)) - return false; - federation_url = GURL(federation); - if (!federation_url.is_valid()) - return false; - } - - credential->type = credential_type; - credential->id = id; - credential->name = name; - credential->avatar_url = avatar_url; - credential->password = password; - credential->federation_origin = url::Origin(federation_url); - return true; -} - -void CredentialToDictionaryValue(const Credential& credential, - base::DictionaryValue* value) { - DCHECK(value); - switch (credential.type) { - case CredentialType::CREDENTIAL_TYPE_EMPTY: - // Return an empty dictionary. This will cause "null" to be returned to - // the JavaScript Promise resolver. - value->Clear(); - return; - case CredentialType::CREDENTIAL_TYPE_PASSWORD: - value->SetString("type", kPasswordCredentialType); - value->SetString("password", credential.password); - break; - case CredentialType::CREDENTIAL_TYPE_FEDERATED: - value->SetString("type", kFederatedCredentialType); - value->SetString("federation", credential.federation_origin.Serialize()); - break; - default: - NOTREACHED(); - } - value->SetString("id", credential.id); - value->SetString("name", credential.name); - value->SetString("avatarURL", credential.avatar_url.spec()); -} - -} // web
diff --git a/ios/web/web_state/js/credential_util_unittest.mm b/ios/web/web_state/js/credential_util_unittest.mm deleted file mode 100644 index 6046fe1..0000000 --- a/ios/web/web_state/js/credential_util_unittest.mm +++ /dev/null
@@ -1,232 +0,0 @@ -// Copyright 2015 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 "ios/web/public/web_state/js/credential_util.h" - -#include <memory> - -#include "base/memory/ptr_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "ios/web/public/web_state/credential.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#import "testing/gtest_mac.h" -#include "testing/platform_test.h" -#include "url/gurl.h" -#include "url/origin.h" - -namespace web { -namespace { - -// "type" value for a DictionaryValue representation of PasswordCredential. -const char* kTestCredentialTypePassword = "PasswordCredential"; - -// "type" value for a DictionaryValue representation of FederatedCredential. -const char* kTestCredentialTypeFederated = "FederatedCredential"; - -// "id" value for a DictionaryValue representation of a credential. -const char* kTestCredentialID = "foo"; - -// "name" value for a DictionaryValue representation of a credential. -const char* kTestCredentialName = "Foo Bar"; - -// "avatarURL" value for a DictionaryValue representation of a credential. -const char* kTestCredentialAvatarURL = "https://foo.com/bar.jpg"; - -// "password" value for a DictionaryValue representation of a credential. -const char* kTestCredentialPassword = "baz"; - -// "federationURL" value for a DictionaryValue representation of a credential. -const char* kTestCredentialFederationURL = "https://foo.com/"; - -// Returns a Credential with Password type. -Credential GetTestPasswordCredential() { - Credential credential; - credential.type = CredentialType::CREDENTIAL_TYPE_PASSWORD; - credential.id = base::ASCIIToUTF16(kTestCredentialID); - credential.name = base::ASCIIToUTF16(kTestCredentialName); - credential.avatar_url = GURL(kTestCredentialAvatarURL); - credential.password = base::ASCIIToUTF16(kTestCredentialPassword); - return credential; -} - -// Returns a credential with Federated type. -Credential GetTestFederatedCredential() { - Credential credential; - credential.type = CredentialType::CREDENTIAL_TYPE_FEDERATED; - credential.id = base::ASCIIToUTF16(kTestCredentialID); - credential.name = base::ASCIIToUTF16(kTestCredentialName); - credential.avatar_url = GURL(kTestCredentialAvatarURL); - credential.federation_origin = - url::Origin(GURL(kTestCredentialFederationURL)); - return credential; -} - -// Returns a value representing the credential returned by -// |GetTestPasswordCredential()|. -std::unique_ptr<base::DictionaryValue> -GetTestPasswordCredentialDictionaryValue() { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); - value->SetString("type", kTestCredentialTypePassword); - value->SetString("id", kTestCredentialID); - value->SetString("name", kTestCredentialName); - value->SetString("avatarURL", kTestCredentialAvatarURL); - value->SetString("password", kTestCredentialPassword); - return value; -} - -// Returns a value representing the credential returned by -// |GetTestFederatedCredentialDictionaryValue()|. -std::unique_ptr<base::DictionaryValue> -GetTestFederatedCredentialDictionaryValue() { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); - value->SetString("type", kTestCredentialTypeFederated); - value->SetString("id", kTestCredentialID); - value->SetString("name", kTestCredentialName); - value->SetString("avatarURL", kTestCredentialAvatarURL); - value->SetString("federation", - url::Origin(GURL(kTestCredentialFederationURL)).Serialize()); - return value; -} - -// Tests that parsing an empty value fails. -TEST(CredentialUtilTest, ParsingEmptyValueFails) { - base::DictionaryValue value; - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(value, &credential)); -} - -// Tests that parsing a value with a bad type fails. -TEST(CredentialUtilTest, ParsingValueWithBadTypeFails) { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); - value->SetString("type", "FooCredential"); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a correctly-formed value representing a PasswordCredential -// succeeds. -TEST(CredentialUtilTest, ParsingPasswordCredentialSucceeds) { - Credential credential; - EXPECT_TRUE(DictionaryValueToCredential( - *GetTestPasswordCredentialDictionaryValue(), &credential)); - EXPECT_TRUE(CredentialsEqual(GetTestPasswordCredential(), credential)); -} - -// Tests that parsing a value representing a PasswordCredential but with no ID -// specified fails. -TEST(CredentialUtilTest, ParsingPasswordCredentialWithNoIDFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestPasswordCredentialDictionaryValue()); - value->RemoveWithoutPathExpansion("id", nullptr); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a value representing a PasswordCredential with a badly- -// formed avatarURL fails. -TEST(CredentialUtilTest, ParsingPasswordCredentialWithBadAvatarURLFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestPasswordCredentialDictionaryValue()); - value->SetString("avatarURL", "foo"); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a value representing a PasswordCredential with no password -// specified fails. -TEST(CredentialUtilTest, ParsingPasswordCredentialWithNoPasswordFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestPasswordCredentialDictionaryValue()); - value->Remove("password", nullptr); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a correctly-formed value representing a -// FederatedCredential succeeds. -TEST(CredentialUtilTest, ParsingFederatedCredentialSucceeds) { - Credential credential; - EXPECT_TRUE(DictionaryValueToCredential( - *GetTestFederatedCredentialDictionaryValue(), &credential)); - EXPECT_TRUE(CredentialsEqual(GetTestFederatedCredential(), credential)); -} - -// Tests that parsing a value representing a FederatedCredential with no ID -// fails. -TEST(CredentialUtilTest, ParsingFederatedCredentialWithNoIDFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestFederatedCredentialDictionaryValue()); - value->RemoveWithoutPathExpansion("id", nullptr); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a value representing a FederatedCredential with a badly- -// formed avatarURL fails. -TEST(CredentialUtilTest, ParsingFederatedCredentialWithBadAvatarURLFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestFederatedCredentialDictionaryValue()); - value->SetString("avatarURL", "foo"); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a value representing a FederatedCredential with no -// federation URL fails. -TEST(CredentialUtilTest, ParsingFederatedValueWithNoFederationURLFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestFederatedCredentialDictionaryValue()); - value->Remove("federation", nullptr); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that parsing a value representing a FederatedCredential with a badly- -// formed federationURL fails. -TEST(CredentialUtilTest, ParsingFederatedValueWithBadFederationURLFails) { - std::unique_ptr<base::DictionaryValue> value( - GetTestFederatedCredentialDictionaryValue()); - value->SetString("federation", "bar"); - Credential credential; - EXPECT_FALSE(DictionaryValueToCredential(*value, &credential)); -} - -// Tests that serializing a FederatedCredential to a DictionaryValue results -// in the expected structure. -TEST(CredentialUtilTest, SerializeFederatedCredential) { - base::DictionaryValue value; - Credential credential(GetTestFederatedCredential()); - CredentialToDictionaryValue(credential, &value); - EXPECT_TRUE(GetTestFederatedCredentialDictionaryValue()->Equals(&value)); -} - -// Tests that serializing a PasswordCredential to a DictionaryValue results in -// the -// expected structure. -TEST(CredentialUtilTest, SerializePasswordCredential) { - base::DictionaryValue value; - Credential credential(GetTestPasswordCredential()); - CredentialToDictionaryValue(credential, &value); - EXPECT_TRUE(GetTestPasswordCredentialDictionaryValue()->Equals(&value)); -} - -TEST(CredentialUtilTest, SerializeEmptyCredential) { - base::DictionaryValue value; - Credential credential; - CredentialToDictionaryValue(credential, &value); - EXPECT_TRUE(base::WrapUnique(new base::DictionaryValue)->Equals(&value)); -} - -TEST(CredentialUtilTest, SerializeEmptyCredentialIntoNonEmptyDictionary) { - base::DictionaryValue value; - value.SetString("foo", "bar"); - Credential credential; - CredentialToDictionaryValue(credential, &value); - EXPECT_TRUE(base::WrapUnique(new base::DictionaryValue)->Equals(&value)); -} - -} // namespace -} // namespace web
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 8dd3897..fef6a997 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -61,9 +61,7 @@ #import "ios/web/public/web_client.h" #include "ios/web/public/web_kit_constants.h" #import "ios/web/public/web_state/context_menu_params.h" -#include "ios/web/public/web_state/credential.h" #import "ios/web/public/web_state/crw_web_controller_observer.h" -#include "ios/web/public/web_state/js/credential_util.h" #import "ios/web/public/web_state/js/crw_js_injection_manager.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/page_display_state.h" @@ -851,18 +849,6 @@ // Handles 'form.activity' message. - (BOOL)handleFormActivityMessage:(base::DictionaryValue*)message context:(NSDictionary*)context; -// Handles 'navigator.credentials.request' message. -- (BOOL)handleCredentialsRequestedMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context; -// Handles 'navigator.credentials.notifySignedIn' message. -- (BOOL)handleSignedInMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context; -// Handles 'navigator.credentials.notifySignedOut' message. -- (BOOL)handleSignedOutMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context; -// Handles 'navigator.credentials.notifyFailedSignIn' message. -- (BOOL)handleSignInFailedMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context; // Handles 'window.error' message. - (BOOL)handleWindowErrorMessage:(base::DictionaryValue*)message context:(NSDictionary*)context; @@ -2377,14 +2363,6 @@ @selector(handleDocumentSubmitMessage:context:); (*handlers)["form.activity"] = @selector(handleFormActivityMessage:context:); - (*handlers)["navigator.credentials.request"] = - @selector(handleCredentialsRequestedMessage:context:); - (*handlers)["navigator.credentials.notifySignedIn"] = - @selector(handleSignedInMessage:context:); - (*handlers)["navigator.credentials.notifySignedOut"] = - @selector(handleSignedOutMessage:context:); - (*handlers)["navigator.credentials.notifyFailedSignIn"] = - @selector(handleSignInFailedMessage:context:); (*handlers)["window.error"] = @selector(handleWindowErrorMessage:context:); (*handlers)["window.hashchange"] = @selector(handleWindowHashChangeMessage:context:); @@ -2599,99 +2577,6 @@ return YES; } -- (BOOL)handleCredentialsRequestedMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context { - double request_id = -1; - if (!message->GetDouble("requestId", &request_id)) { - DLOG(WARNING) << "JS message parameter not found: requestId"; - return NO; - } - bool unmediated = false; - if (!message->GetBoolean("unmediated", &unmediated)) { - DLOG(WARNING) << "JS message parameter not found: unmediated"; - return NO; - } - base::ListValue* federations_value = nullptr; - if (!message->GetList("federations", &federations_value)) { - DLOG(WARNING) << "JS message parameter not found: federations"; - return NO; - } - std::vector<std::string> federations; - for (const auto& federation_value : *federations_value) { - std::string federation; - if (!federation_value.GetAsString(&federation)) { - DLOG(WARNING) << "JS message parameter 'federations' contains wrong type"; - return NO; - } - federations.push_back(federation); - } - DCHECK(context[kUserIsInteractingKey]); - _webStateImpl->OnCredentialsRequested( - static_cast<int>(request_id), net::GURLWithNSURL(context[kOriginURLKey]), - unmediated, federations, [context[kUserIsInteractingKey] boolValue]); - return YES; -} - -- (BOOL)handleSignedInMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context { - double request_id = -1; - if (!message->GetDouble("requestId", &request_id)) { - DLOG(WARNING) << "JS message parameter not found: requestId"; - return NO; - } - base::DictionaryValue* credential_data = nullptr; - web::Credential credential; - if (message->GetDictionary("credential", &credential_data)) { - if (!web::DictionaryValueToCredential(*credential_data, &credential)) { - DLOG(WARNING) << "JS message parameter 'credential' is invalid"; - return NO; - } - _webStateImpl->OnSignedIn(static_cast<int>(request_id), - net::GURLWithNSURL(context[kOriginURLKey]), - credential); - } else { - _webStateImpl->OnSignedIn(static_cast<int>(request_id), - net::GURLWithNSURL(context[kOriginURLKey])); - } - return YES; -} - -- (BOOL)handleSignedOutMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context { - double request_id = -1; - if (!message->GetDouble("requestId", &request_id)) { - DLOG(WARNING) << "JS message parameter not found: requestId"; - return NO; - } - _webStateImpl->OnSignedOut(static_cast<int>(request_id), - net::GURLWithNSURL(context[kOriginURLKey])); - return YES; -} - -- (BOOL)handleSignInFailedMessage:(base::DictionaryValue*)message - context:(NSDictionary*)context { - double request_id = -1; - if (!message->GetDouble("requestId", &request_id)) { - DLOG(WARNING) << "JS message parameter not found: requestId"; - return NO; - } - base::DictionaryValue* credential_data = nullptr; - web::Credential credential; - if (message->GetDictionary("credential", &credential_data)) { - if (!web::DictionaryValueToCredential(*credential_data, &credential)) { - DLOG(WARNING) << "JS message parameter 'credential' is invalid"; - return NO; - } - _webStateImpl->OnSignInFailed(static_cast<int>(request_id), - net::GURLWithNSURL(context[kOriginURLKey]), - credential); - } else { - _webStateImpl->OnSignInFailed(static_cast<int>(request_id), - net::GURLWithNSURL(context[kOriginURLKey])); - } - return YES; -} - - (BOOL)handleWindowErrorMessage:(base::DictionaryValue*)message context:(NSDictionary*)context { std::string errorMessage;
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h index 3a967b96..25d7d22 100644 --- a/ios/web/web_state/web_state_impl.h +++ b/ios/web/web_state/web_state_impl.h
@@ -39,7 +39,6 @@ class BrowserState; struct ContextMenuParams; -struct Credential; struct FaviconURL; struct LoadCommittedDetails; class NavigationManager; @@ -121,34 +120,6 @@ // Called when new FaviconURL candidates are received. void OnFaviconUrlUpdated(const std::vector<FaviconURL>& candidates); - // Called when the page requests a credential. - void OnCredentialsRequested(int request_id, - const GURL& source_url, - bool unmediated, - const std::vector<std::string>& federations, - bool user_interaction); - - // Called when the page sends a notification that the user signed in with - // |credential|. - void OnSignedIn(int request_id, - const GURL& source_url, - const web::Credential& credential); - - // Called when the page sends a notification that the user signed in. - void OnSignedIn(int request_id, const GURL& source_url); - - // Called when the page sends a notification that the user was signed out. - void OnSignedOut(int request_id, const GURL& source_url); - - // Called when the page sends a notification that the user failed to sign in - // with |credential|. - void OnSignInFailed(int request_id, - const GURL& source_url, - const web::Credential& credential); - - // Called when the page sends a notification that the user failed to sign in. - void OnSignInFailed(int request_id, const GURL& source_url); - // Returns the NavigationManager for this WebState. const NavigationManagerImpl& GetNavigationManagerImpl() const; NavigationManagerImpl& GetNavigationManagerImpl();
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm index 310def22..5b8cc73 100644 --- a/ios/web/web_state/web_state_impl.mm +++ b/ios/web/web_state/web_state_impl.mm
@@ -22,7 +22,6 @@ #include "ios/web/public/url_util.h" #import "ios/web/public/web_client.h" #import "ios/web/public/web_state/context_menu_params.h" -#include "ios/web/public/web_state/credential.h" #import "ios/web/public/web_state/ui/crw_content_view.h" #import "ios/web/public/web_state/web_state_delegate.h" #include "ios/web/public/web_state/web_state_observer.h" @@ -278,47 +277,6 @@ observer.FaviconUrlUpdated(candidates); } -void WebStateImpl::OnCredentialsRequested( - int request_id, - const GURL& source_url, - bool unmediated, - const std::vector<std::string>& federations, - bool user_interaction) { - for (auto& observer : observers_) { - observer.CredentialsRequested(request_id, source_url, unmediated, - federations, user_interaction); - } -} - -void WebStateImpl::OnSignedIn(int request_id, - const GURL& source_url, - const web::Credential& credential) { - for (auto& observer : observers_) - observer.SignedIn(request_id, source_url, credential); -} - -void WebStateImpl::OnSignedIn(int request_id, const GURL& source_url) { - for (auto& observer : observers_) - observer.SignedIn(request_id, source_url); -} - -void WebStateImpl::OnSignedOut(int request_id, const GURL& source_url) { - for (auto& observer : observers_) - observer.SignedOut(request_id, source_url); -} - -void WebStateImpl::OnSignInFailed(int request_id, - const GURL& source_url, - const web::Credential& credential) { - for (auto& observer : observers_) - observer.SignInFailed(request_id, source_url, credential); -} - -void WebStateImpl::OnSignInFailed(int request_id, const GURL& source_url) { - for (auto& observer : observers_) - observer.SignInFailed(request_id, source_url); -} - void WebStateImpl::OnDocumentSubmitted(const std::string& form_name, bool user_initiated) { for (auto& observer : observers_)
diff --git a/mash/simple_wm/move_event_handler.cc b/mash/simple_wm/move_event_handler.cc index 572e9c6..99582ed 100644 --- a/mash/simple_wm/move_event_handler.cc +++ b/mash/simple_wm/move_event_handler.cc
@@ -18,23 +18,23 @@ ui::mojom::CursorType CursorForWindowComponent(int window_component) { switch (window_component) { case HTBOTTOM: - return ui::mojom::CursorType::SOUTH_RESIZE; + return ui::mojom::CursorType::kSouthResize; case HTBOTTOMLEFT: - return ui::mojom::CursorType::SOUTH_WEST_RESIZE; + return ui::mojom::CursorType::kSouthWestResize; case HTBOTTOMRIGHT: - return ui::mojom::CursorType::SOUTH_EAST_RESIZE; + return ui::mojom::CursorType::kSouthEastResize; case HTLEFT: - return ui::mojom::CursorType::WEST_RESIZE; + return ui::mojom::CursorType::kWestResize; case HTRIGHT: - return ui::mojom::CursorType::EAST_RESIZE; + return ui::mojom::CursorType::kEastResize; case HTTOP: - return ui::mojom::CursorType::NORTH_RESIZE; + return ui::mojom::CursorType::kNorthResize; case HTTOPLEFT: - return ui::mojom::CursorType::NORTH_WEST_RESIZE; + return ui::mojom::CursorType::kNorthWestResize; case HTTOPRIGHT: - return ui::mojom::CursorType::NORTH_EAST_RESIZE; + return ui::mojom::CursorType::kNorthEastResize; default: - return ui::mojom::CursorType::CURSOR_NULL; + return ui::mojom::CursorType::kNull; } }
diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc index aa83b0a..94efcba 100644 --- a/media/blink/run_all_unittests.cc +++ b/media/blink/run_all_unittests.cc
@@ -11,6 +11,7 @@ #include "build/build_config.h" #include "media/base/media.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/WebThread.h" #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h" #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/WebKit/public/web/WebKit.h"
diff --git a/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc index 4784af2..dc401431 100644 --- a/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc +++ b/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc
@@ -16,8 +16,8 @@ map.insert(blink::Rect::New(1, 2, 3, 4), 123); blink::RectPtr key = blink::Rect::New(1, 2, 3, 4); - ASSERT_NE(map.end(), map.Find(key)); - ASSERT_EQ(123, map.Find(key)->value); + ASSERT_NE(map.end(), map.find(key)); + ASSERT_EQ(123, map.find(key)->value); map.erase(key); ASSERT_EQ(0u, map.size()); @@ -29,8 +29,8 @@ blink::ContainsHashablePtr key = blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)); - ASSERT_NE(map.end(), map.Find(key)); - ASSERT_EQ(123, map.Find(key)->value); + ASSERT_NE(map.end(), map.find(key)); + ASSERT_EQ(123, map.find(key)->value); map.erase(key); ASSERT_EQ(0u, map.size());
diff --git a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc index 779035f..5670cc2 100644 --- a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
@@ -610,11 +610,11 @@ std::unique_ptr<QuicReceivedPacket> ConstructClientAckAndRstStreamPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked) { + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked) { return client_maker_.MakeAckAndRstPacket( packet_number, !kIncludeVersion, stream_id_, QUIC_STREAM_CANCELLED, - largest_received, ack_least_unacked, stop_least_unacked, + largest_received, smallest_received, least_unacked, !kIncludeCongestionFeedback); } @@ -622,6 +622,7 @@ QuicPacketNumber packet_number, bool should_include_version, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, bool fin, QuicStreamOffset offset, @@ -629,7 +630,7 @@ QuicTestPacketMaker* maker) { std::unique_ptr<QuicReceivedPacket> packet(maker->MakeAckAndDataPacket( packet_number, should_include_version, stream_id_, largest_received, - least_unacked, fin, offset, data)); + smallest_received, least_unacked, fin, offset, data)); DVLOG(2) << "packet(" << packet_number << "): " << std::endl << QuicTextUtils::HexDump(packet->AsStringPiece()); return packet; @@ -638,18 +639,20 @@ std::unique_ptr<QuicReceivedPacket> ConstructClientAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return client_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, + smallest_received, least_unacked, !kIncludeCongestionFeedback); } std::unique_ptr<QuicReceivedPacket> ConstructServerAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return server_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, + smallest_received, least_unacked, !kIncludeCongestionFeedback); } @@ -722,7 +725,7 @@ AddWrite(ConstructSettingsPacket(2, SETTINGS_MAX_HEADER_LIST_SIZE, kDefaultMaxUncompressedHeaderSize, &header_stream_offset)); - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); Initialize(); @@ -741,7 +744,7 @@ ConfirmHandshake(); // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -823,7 +826,7 @@ 2, kClientDataStreamId2, kFin, DEFAULT_PRIORITY, nullptr, &offset)); AddWrite(ConstructSettingsPacket(3, SETTINGS_MAX_HEADER_LIST_SIZE, kDefaultMaxUncompressedHeaderSize, &offset)); - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); Initialize(); BidirectionalStreamRequestInfo request; @@ -849,7 +852,7 @@ ConfirmHandshake(); // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. offset = 0; @@ -896,7 +899,7 @@ AddWrite(ConstructClientMultipleDataFramesPacket(3, kIncludeVersion, !kFin, 0, {kBody1, kBody2})); // Ack server's data packet. - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); const char kBody3[] = "hello there"; const char kBody4[] = "another piece of small data"; const char kBody5[] = "really small"; @@ -933,7 +936,7 @@ delegate->WaitUntilNextCallback(); // OnDataSent // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1006,7 +1009,7 @@ 2, !kFin, DEFAULT_PRIORITY, &header_stream_offset, &spdy_request_headers_frame_length, {kBody1})); // Ack server's data packet. - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); const char kBody2[] = "really small"; QuicStreamOffset data_offset = strlen(kBody1); AddWrite(ConstructClientMultipleDataFramesPacket(4, !kIncludeVersion, kFin, @@ -1035,7 +1038,7 @@ delegate->WaitUntilNextCallback(); // OnDataSent // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1105,7 +1108,7 @@ 2, !kFin, DEFAULT_PRIORITY, &header_stream_offset, &spdy_request_headers_frame_length, two_writes)); // Ack server's data packet. - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); const char kBody3[] = "hello there"; const char kBody4[] = "another piece of small data"; const char kBody5[] = "really small"; @@ -1138,7 +1141,7 @@ delegate->WaitUntilNextCallback(); // OnDataSent // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1208,7 +1211,7 @@ &header_stream_offset)); AddWrite(ConstructDataPacket(3, kIncludeVersion, kFin, 0, kUploadData, &client_maker_)); - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); Initialize(); @@ -1232,7 +1235,7 @@ delegate->WaitUntilNextCallback(); // OnDataSent // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1286,7 +1289,7 @@ &spdy_request_headers_frame_length)); AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData, &client_maker_)); - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); Initialize(); @@ -1309,7 +1312,7 @@ delegate->WaitUntilNextCallback(); // OnDataSent // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1367,9 +1370,9 @@ AddWrite(ConstructSettingsPacket(2, SETTINGS_MAX_HEADER_LIST_SIZE, kDefaultMaxUncompressedHeaderSize, &header_stream_offset)); - AddWrite(ConstructAckAndDataPacket(3, !kIncludeVersion, 2, 1, !kFin, 0, + AddWrite(ConstructAckAndDataPacket(3, !kIncludeVersion, 2, 1, 1, !kFin, 0, kUploadData, &client_maker_)); - AddWrite(ConstructAckAndDataPacket(4, !kIncludeVersion, 3, 3, kFin, + AddWrite(ConstructAckAndDataPacket(4, !kIncludeVersion, 3, 3, 3, kFin, strlen(kUploadData), kUploadData, &client_maker_)); Initialize(); @@ -1388,7 +1391,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1412,8 +1415,8 @@ const char kResponseBody[] = "Hello world!"; // Server sends a data packet. - ProcessPacket(ConstructAckAndDataPacket(3, !kIncludeVersion, 2, 1, !kFin, 0, - kResponseBody, &server_maker_)); + ProcessPacket(ConstructAckAndDataPacket(3, !kIncludeVersion, 2, 1, 1, !kFin, + 0, kResponseBody, &server_maker_)); EXPECT_EQ(static_cast<int64_t>(strlen(kResponseBody)), cb.WaitForResult()); EXPECT_EQ(std::string(kResponseBody), delegate->data_received()); @@ -1425,7 +1428,7 @@ TestCompletionCallback cb2; rv = delegate->ReadData(cb2.callback()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); - ProcessPacket(ConstructAckAndDataPacket(4, !kIncludeVersion, 3, 1, kFin, + ProcessPacket(ConstructAckAndDataPacket(4, !kIncludeVersion, 3, 1, 1, kFin, strlen(kResponseBody), kResponseBody, &server_maker_)); @@ -1501,7 +1504,7 @@ kDefaultMaxUncompressedHeaderSize, &header_stream_offset)); // Why does QUIC ack Rst? Is this expected? - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); Initialize(); @@ -1519,7 +1522,7 @@ ConfirmHandshake(); // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1579,7 +1582,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1643,7 +1646,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1700,7 +1703,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1729,7 +1732,7 @@ AddWrite(ConstructSettingsPacket(2, SETTINGS_MAX_HEADER_LIST_SIZE, kDefaultMaxUncompressedHeaderSize, &header_stream_offset)); - AddWrite(ConstructClientAckPacket(3, 3, 1)); + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); AddWrite(ConstructClientRstStreamPacket(4)); Initialize(); @@ -1748,7 +1751,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200"); @@ -1782,7 +1785,7 @@ size_t spdy_request_headers_frame_length; AddWrite(ConstructRequestHeadersPacket(1, kFin, DEFAULT_PRIORITY, &spdy_request_headers_frame_length)); - AddWrite(ConstructClientAckPacket(2, 3, 1)); // Ack the data packet + AddWrite(ConstructClientAckPacket(2, 3, 1, 1)); // Ack the data packet AddWrite(ConstructClientAckAndRstStreamPacket(3, 4, 4, 1)); Initialize(); @@ -1801,7 +1804,7 @@ delegate->WaitUntilNextCallback(); // OnStreamReady // Server acks the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Server sends the response headers. SpdyHeaderBlock response_headers = ConstructResponseHeaders("200");
diff --git a/net/quic/chromium/quic_chromium_client_session_test.cc b/net/quic/chromium/quic_chromium_client_session_test.cc index 860db999..a3cf2e3d 100644 --- a/net/quic/chromium/quic_chromium_client_session_test.cc +++ b/net/quic/chromium/quic_chromium_client_session_test.cc
@@ -750,7 +750,7 @@ std::unique_ptr<QuicEncryptedPacket> server_ping( server_maker_.MakePingPacket(1, /*include_version=*/false)); std::unique_ptr<QuicEncryptedPacket> ack_and_data_out( - client_maker_.MakeAckAndDataPacket(3, false, 5, 1, 1, false, 0, + client_maker_.MakeAckAndDataPacket(3, false, 5, 1, 1, 1, false, 0, QuicStringPiece(data))); MockRead reads[] = { MockRead(SYNCHRONOUS, server_ping->data(), server_ping->length(), 0),
diff --git a/net/quic/chromium/quic_http_stream_test.cc b/net/quic/chromium/quic_http_stream_test.cc index 3fd43eaa9..1c8e37a 100644 --- a/net/quic/chromium/quic_http_stream_test.cc +++ b/net/quic/chromium/quic_http_stream_test.cc
@@ -490,11 +490,11 @@ std::unique_ptr<QuicReceivedPacket> ConstructAckAndRstStreamPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked) { + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked) { return client_maker_.MakeAckAndRstPacket( packet_number, !kIncludeVersion, stream_id_, QUIC_STREAM_CANCELLED, - largest_received, ack_least_unacked, stop_least_unacked, + largest_received, smallest_received, least_unacked, !kIncludeCongestionFeedback); } @@ -514,18 +514,20 @@ std::unique_ptr<QuicReceivedPacket> ConstructClientAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return client_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, + smallest_received, least_unacked, !kIncludeCongestionFeedback); } std::unique_ptr<QuicReceivedPacket> ConstructServerAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return server_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, + smallest_received, least_unacked, !kIncludeCongestionFeedback); } @@ -659,7 +661,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -711,7 +713,7 @@ AddWrite(InnerConstructRequestHeadersPacket( 3, kClientDataStreamId2, kIncludeVersion, kFin, DEFAULT_PRIORITY, &spdy_request_header_frame_length, &offset)); - AddWrite(ConstructClientAckPacket(4, 3, 1)); // Ack the responses. + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); // Ack the responses. Initialize(); @@ -734,7 +736,7 @@ stream2.SendRequest(headers_, &response_, callback2.callback())); // Ack both requests. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -790,7 +792,7 @@ AddWrite(InnerConstructRequestHeadersPacket( 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, &spdy_request_header_frame_length, &header_stream_offset)); - AddWrite(ConstructClientAckPacket(3, 3, 1)); // Ack the data packet. + AddWrite(ConstructClientAckPacket(3, 3, 1, 1)); // Ack the data packet. Initialize(); @@ -804,7 +806,7 @@ EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -898,7 +900,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -1029,7 +1031,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -1069,7 +1071,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -1135,7 +1137,7 @@ 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, &spdy_request_headers_frame_length, &header_stream_offset)); AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, kUploadData)); - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); Initialize(); @@ -1157,7 +1159,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack both packets in the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Send the response headers (but not the body). SetResponse("200 OK", string()); @@ -1209,7 +1211,7 @@ ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, kUploadData)); - AddWrite(ConstructClientAckPacket(5, 3, 1)); + AddWrite(ConstructClientAckPacket(5, 3, 1, 1)); Initialize(); ChunkedUploadDataStream upload_data_stream(0); @@ -1231,7 +1233,7 @@ EXPECT_THAT(callback_.WaitForResult(), IsOk()); // Ack both packets in the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Send the response headers (but not the body). SetResponse("200 OK", string()); @@ -1284,7 +1286,7 @@ AddWrite( ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, "")); - AddWrite(ConstructClientAckPacket(5, 3, 1)); + AddWrite(ConstructClientAckPacket(5, 3, 1, 1)); Initialize(); ChunkedUploadDataStream upload_data_stream(0); @@ -1305,7 +1307,7 @@ upload_data_stream.AppendData(nullptr, 0, true); EXPECT_THAT(callback_.WaitForResult(), IsOk()); - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Send the response headers (but not the body). SetResponse("200 OK", string()); @@ -1354,7 +1356,7 @@ 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, &spdy_request_headers_frame_length, &header_stream_offset)); AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, "")); - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); Initialize(); ChunkedUploadDataStream upload_data_stream(0); @@ -1374,7 +1376,7 @@ upload_data_stream.AppendData(nullptr, 0, true); EXPECT_THAT(callback_.WaitForResult(), IsOk()); - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); // Send the response headers (but not the body). SetResponse("200 OK", string()); @@ -1436,7 +1438,7 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -1491,7 +1493,7 @@ ConvertQuicPriorityToRequestPriority(reliable_stream->priority())); // Ack the request. - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), IsError(ERR_IO_PENDING)); @@ -2016,7 +2018,7 @@ AddWrite(InnerConstructRequestHeadersPacket( 3, stream_id_ + 2, !kIncludeVersion, kFin, DEFAULT_PRIORITY, &spdy_request_header_frame_length, &header_stream_offset)); - AddWrite(ConstructClientAckPacket(4, 3, 1)); + AddWrite(ConstructClientAckPacket(4, 3, 1, 1)); AddWrite(ConstructClientRstStreamCancelledPacket(5)); Initialize(); @@ -2085,7 +2087,7 @@ // client-initiated version of |promised_stream_| works as intended. // Ack the request. - ProcessPacket(ConstructServerAckPacket(2, 0, 0)); + ProcessPacket(ConstructServerAckPacket(2, 0, 0, 0)); SetResponse("404 Not Found", string()); size_t spdy_response_header_frame_length; @@ -2185,7 +2187,7 @@ int result = stream_->SendRequest(headers_, &response_, callback_.callback()); - ProcessPacket(ConstructServerAckPacket(1, 0, 0)); + ProcessPacket(ConstructServerAckPacket(1, 0, 0, 0)); SetResponse("200 OK", string()); EXPECT_THAT(result, IsError(ERR_IO_PENDING));
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc index 011e8eba..f2b6030 100644 --- a/net/quic/chromium/quic_network_transaction_unittest.cc +++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -289,59 +289,42 @@ std::unique_ptr<QuicEncryptedPacket> ConstructClientAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return client_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, least_unacked, true); + smallest_received, least_unacked, true); } std::unique_ptr<QuicEncryptedPacket> ConstructClientAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, QuicTime::Delta ack_delay_time) { return client_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, least_unacked, true, + smallest_received, least_unacked, true, ack_delay_time); } - std::unique_ptr<QuicEncryptedPacket> ConstructClientAckPacket( - QuicPacketNumber largest_received, - QuicPacketNumber least_unacked) { - return client_maker_.MakeAckPacket(2, largest_received, least_unacked, - least_unacked, true); - } - - std::unique_ptr<QuicEncryptedPacket> ConstructClientAckPacket( - QuicPacketNumber packet_number, - QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked) { - return client_maker_.MakeAckPacket(packet_number, largest_received, - ack_least_unacked, stop_least_unacked, - true); - } - std::unique_ptr<QuicEncryptedPacket> ConstructClientAckAndRstPacket( QuicPacketNumber num, QuicStreamId stream_id, QuicRstStreamErrorCode error_code, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked) { + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked) { return client_maker_.MakeAckAndRstPacket( - num, false, stream_id, error_code, largest_received, ack_least_unacked, - stop_least_unacked, true); + num, false, stream_id, error_code, largest_received, smallest_received, + least_unacked, true); } std::unique_ptr<QuicEncryptedPacket> - ConstructClientAckAndConnectionClosePacket( - QuicPacketNumber packet_number, - QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked) { + ConstructClientAckAndConnectionClosePacket(QuicPacketNumber packet_number, + QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked) { return client_maker_.MakeAckPacket(packet_number, largest_received, - ack_least_unacked, stop_least_unacked, - true); + smallest_received, least_unacked, true); } std::unique_ptr<QuicEncryptedPacket> @@ -349,12 +332,13 @@ QuicPacketNumber num, QuicTime::Delta delta_time_largest_observed, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, QuicErrorCode quic_error, const std::string& quic_error_details) { return client_maker_.MakeAckAndConnectionClosePacket( num, false, delta_time_largest_observed, largest_received, - least_unacked, quic_error, quic_error_details); + smallest_received, least_unacked, quic_error, quic_error_details); } std::unique_ptr<QuicEncryptedPacket> ConstructServerRstPacket( @@ -378,9 +362,10 @@ std::unique_ptr<QuicReceivedPacket> ConstructServerAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked) { return server_maker_.MakeAckPacket(packet_number, largest_received, - least_unacked, false); + smallest_received, least_unacked, false); } // Uses default QuicTestPacketMaker. @@ -801,7 +786,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more data to read mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -832,7 +817,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more data to read mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -863,7 +848,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more data to read mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -928,7 +913,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more data to read mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -957,7 +942,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -1000,7 +985,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -1054,7 +1039,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -1211,7 +1196,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -1250,7 +1235,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -1355,7 +1340,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -1384,7 +1369,7 @@ mock_quic_data.AddSynchronousRead(ConstructServerGoAwayPacket( 2, QUIC_ERROR_MIGRATING_PORT, "connection migration with port change only")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddSynchronousRead(ConstructServerDataPacket( 3, kClientDataStreamId1, false, true, 0, "hello!")); mock_quic_data.AddWrite(ConstructClientAckAndRstPacket( @@ -1574,7 +1559,7 @@ 12, kHeadersStreamId, true, false, settings_offset, settings_data)); // RTO 5 quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( - 13, true, QuicTime::Delta::Infinite(), 0, 1, QUIC_TOO_MANY_RTOS, + 13, true, QuicTime::Delta::Infinite(), 0, 1, 1, QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts")); quic_data.AddRead(ASYNC, OK); @@ -1677,7 +1662,7 @@ false, 0, request_data)); // RTO 5 quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( - 14, true, QuicTime::Delta::Infinite(), 0, 1, QUIC_TOO_MANY_RTOS, + 14, true, QuicTime::Delta::Infinite(), 0, 1, 1, QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts")); quic_data.AddRead(ASYNC, OK); @@ -1748,7 +1733,7 @@ ConstructServerRstPacket(1, false, 99, QUIC_STREAM_LAST_ERROR)); std::string quic_error_details = "Data for nonexistent stream"; quic_data.AddWrite(ConstructClientAckAndConnectionClosePacket( - 3, QuicTime::Delta::Zero(), 1, 1, QUIC_INVALID_STREAM_ID, + 3, QuicTime::Delta::Zero(), 1, 1, 1, QUIC_INVALID_STREAM_ID, quic_error_details)); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -2060,8 +2045,8 @@ quic_data.AddRead(ConstructServerResponseHeadersPacket( 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); // quic_data.AddWrite(ConstructClientAckPacket(3, 1, 1)); - quic_data.AddWrite( - ConstructClientAckPacket(3, 1, 1, QuicTime::Delta::FromMilliseconds(25))); + quic_data.AddWrite(ConstructClientAckPacket( + 3, 1, 1, 1, QuicTime::Delta::FromMilliseconds(25))); // TLP 1 quic_data.AddWrite(client_maker_.MakeDataPacket(4, kHeadersStreamId, false, @@ -2196,7 +2181,7 @@ 12, kHeadersStreamId, true, false, settings_offset, settings_data)); quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( - 13, true, QuicTime::Delta::Infinite(), 0, 1, QUIC_TOO_MANY_RTOS, + 13, true, QuicTime::Delta::Infinite(), 0, 1, 1, QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts")); quic_data.AddRead(ASYNC, OK); @@ -2325,7 +2310,7 @@ false, 0, request_data)); // RTO 5 quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( - 14, true, QuicTime::Delta::Infinite(), 0, 1, QUIC_TOO_MANY_RTOS, + 14, true, QuicTime::Delta::Infinite(), 0, 1, 1, QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts")); quic_data.AddRead(ASYNC, OK); @@ -2401,7 +2386,7 @@ ConstructServerRstPacket(1, false, 99, QUIC_STREAM_LAST_ERROR)); std::string quic_error_details = "Data for nonexistent stream"; quic_data.AddWrite(ConstructClientAckAndConnectionClosePacket( - 3, QuicTime::Delta::Zero(), 1, 1, QUIC_INVALID_STREAM_ID, + 3, QuicTime::Delta::Zero(), 1, 1, 1, QUIC_INVALID_STREAM_ID, quic_error_details)); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -2530,7 +2515,7 @@ GetResponseHeaders("200 OK", alt_svc_list), &response_header_offset)); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); // Second QUIC request data. // Connection pooling, using existing session, no need to include version @@ -2583,7 +2568,7 @@ GetResponseHeaders("200 OK", alt_svc_list), &response_header_offset)); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); // Second QUIC request data. // Connection pooling, using existing session, no need to include version @@ -2649,7 +2634,7 @@ &response_header_offset)); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); // Second request. mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( @@ -2719,7 +2704,7 @@ &response_header_offset)); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); // Second request. QuicTestPacketMaker client_maker2(version_, 0, &clock_, origin2.host(), @@ -2834,7 +2819,7 @@ &response_header_offset)); mock_quic_data.AddRead(ConstructServerDataPacket( 2, kClientDataStreamId1, false, true, 0, "hello from mail QUIC!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); // Second QUIC request data. mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( 4, kClientDataStreamId2, false, true, @@ -2923,7 +2908,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -2975,7 +2960,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, 0); // EOF mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3006,7 +2991,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -3102,7 +3087,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(2, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -3130,7 +3115,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(2, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read mock_quic_data.AddRead(ASYNC, 0); // EOF mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3202,7 +3187,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more data to read mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3311,7 +3296,7 @@ ConstructServerRstPacket(1, false, 99, QUIC_STREAM_LAST_ERROR)); std::string quic_error_details = "Data for nonexistent stream"; mock_quic_data.AddWrite(ConstructClientAckAndConnectionClosePacket( - 3, QuicTime::Delta::Zero(), 1, 1, QUIC_INVALID_STREAM_ID, + 3, QuicTime::Delta::Zero(), 1, 1, 1, QUIC_INVALID_STREAM_ID, quic_error_details)); mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3366,7 +3351,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerRstPacket( 2, false, kClientDataStreamId1, QUIC_STREAM_CANCELLED)); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more read data. mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3646,7 +3631,7 @@ mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( 1, kClientDataStreamId1, true, true, GetRequestHeaders("GET", "https", "/"))); - mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1, 1, 1)); mock_quic_data.AddSocketDataToFactory(&socket_factory_); // When the QUIC connection fails, we will try the request again over HTTP. @@ -3712,7 +3697,7 @@ mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( 1, kClientDataStreamId1, true, true, GetRequestHeaders("GET", "https", "/"))); - mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(2, 1, 1, 1)); mock_quic_data.AddSocketDataToFactory(&socket_factory_); // When the QUIC connection fails, we will try the request again over HTTP. @@ -3771,7 +3756,7 @@ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); // No more read data. mock_quic_data.AddSocketDataToFactory(&socket_factory_); @@ -4082,7 +4067,7 @@ mock_quic_data.AddRead(ConstructServerDataPacket( 2, kClientDataStreamId1, false, true, 0, "Main Resource Data")); - mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1)); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); mock_quic_data.AddRead(ASYNC, 0); // EOF @@ -4323,11 +4308,11 @@ std::unique_ptr<QuicEncryptedPacket> ConstructClientAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked, QuicTestPacketMaker* maker) { return maker->MakeAckPacket(packet_number, largest_received, - ack_least_unacked, stop_least_unacked, true); + smallest_received, least_unacked, true); } std::unique_ptr<QuicReceivedPacket> ConstructSettingsPacket(
diff --git a/net/quic/chromium/quic_test_packet_maker.cc b/net/quic/chromium/quic_test_packet_maker.cc index 9980a408..1ef4ac83 100644 --- a/net/quic/chromium/quic_test_packet_maker.cc +++ b/net/quic/chromium/quic_test_packet_maker.cc
@@ -83,8 +83,8 @@ QuicStreamId stream_id, QuicRstStreamErrorCode error_code, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked, bool send_feedback) { QuicPacketHeader header; header.public_header.connection_id = connection_id_; @@ -95,7 +95,7 @@ QuicAckFrame ack(MakeAckFrame(largest_received)); ack.ack_delay_time = QuicTime::Delta::Zero(); - for (QuicPacketNumber i = ack_least_unacked; i <= largest_received; ++i) { + for (QuicPacketNumber i = smallest_received; i <= largest_received; ++i) { ack.received_packet_times.push_back(std::make_pair(i, clock_->Now())); } if (largest_received > 0) { @@ -106,7 +106,7 @@ DVLOG(1) << "Adding frame: " << frames[0]; QuicStopWaitingFrame stop_waiting; - stop_waiting.least_unacked = stop_least_unacked; + stop_waiting.least_unacked = least_unacked; frames.push_back(QuicFrame(&stop_waiting)); DVLOG(1) << "Adding frame: " << frames[1]; @@ -131,6 +131,7 @@ bool include_version, QuicTime::Delta ack_delay_time, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, QuicErrorCode quic_error, const std::string& quic_error_details) { @@ -143,7 +144,7 @@ QuicAckFrame ack(MakeAckFrame(largest_received)); ack.ack_delay_time = ack_delay_time; - for (QuicPacketNumber i = least_unacked; i <= largest_received; ++i) { + for (QuicPacketNumber i = smallest_received; i <= largest_received; ++i) { ack.received_packet_times.push_back(std::make_pair(i, clock_->Now())); } if (largest_received > 0) { @@ -211,33 +212,21 @@ MakePacket(header, QuicFrame(&goaway))); } -// Sets both least_unacked fields in stop waiting frame and ack frame -// to be |least_unacked|. std::unique_ptr<QuicReceivedPacket> QuicTestPacketMaker::MakeAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, bool send_feedback) { - return MakeAckPacket(packet_number, largest_received, least_unacked, - least_unacked, send_feedback); + return MakeAckPacket(packet_number, largest_received, smallest_received, + least_unacked, send_feedback, QuicTime::Delta::Zero()); } std::unique_ptr<QuicReceivedPacket> QuicTestPacketMaker::MakeAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, - bool send_feedback) { - return MakeAckPacket(packet_number, largest_received, ack_least_unacked, - stop_least_unacked, send_feedback, - QuicTime::Delta::Zero()); -} - -std::unique_ptr<QuicReceivedPacket> QuicTestPacketMaker::MakeAckPacket( - QuicPacketNumber packet_number, - QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked, bool send_feedback, QuicTime::Delta ack_delay_time) { QuicPacketHeader header; @@ -249,7 +238,7 @@ QuicAckFrame ack(MakeAckFrame(largest_received)); ack.ack_delay_time = ack_delay_time; - for (QuicPacketNumber i = ack_least_unacked; i <= largest_received; ++i) { + for (QuicPacketNumber i = smallest_received; i <= largest_received; ++i) { ack.received_packet_times.push_back(std::make_pair(i, clock_->Now())); } if (largest_received > 0) { @@ -263,7 +252,7 @@ frames.push_back(ack_frame); QuicStopWaitingFrame stop_waiting; - stop_waiting.least_unacked = stop_least_unacked; + stop_waiting.least_unacked = least_unacked; frames.push_back(QuicFrame(&stop_waiting)); std::unique_ptr<QuicPacket> packet( @@ -322,6 +311,7 @@ bool include_version, QuicStreamId stream_id, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, bool fin, QuicStreamOffset offset, @@ -330,7 +320,7 @@ QuicAckFrame ack(MakeAckFrame(largest_received)); ack.ack_delay_time = QuicTime::Delta::Zero(); - for (QuicPacketNumber i = least_unacked; i <= largest_received; ++i) { + for (QuicPacketNumber i = smallest_received; i <= largest_received; ++i) { ack.received_packet_times.push_back(std::make_pair(i, clock_->Now())); } if (largest_received > 0) {
diff --git a/net/quic/chromium/quic_test_packet_maker.h b/net/quic/chromium/quic_test_packet_maker.h index a398bdd..6bfb4cc 100644 --- a/net/quic/chromium/quic_test_packet_maker.h +++ b/net/quic/chromium/quic_test_packet_maker.h
@@ -56,14 +56,15 @@ QuicStreamId stream_id, QuicRstStreamErrorCode error_code, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked, bool send_feedback); std::unique_ptr<QuicReceivedPacket> MakeAckAndConnectionClosePacket( QuicPacketNumber num, bool include_version, QuicTime::Delta delta_time_largest_observed, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, QuicErrorCode quic_error, const std::string& quic_error_details); @@ -76,19 +77,14 @@ std::unique_ptr<QuicReceivedPacket> MakeAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, bool send_feedback); std::unique_ptr<QuicReceivedPacket> MakeAckPacket( QuicPacketNumber packet_number, QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, - bool send_feedback); - std::unique_ptr<QuicReceivedPacket> MakeAckPacket( - QuicPacketNumber packet_number, - QuicPacketNumber largest_received, - QuicPacketNumber ack_least_unacked, - QuicPacketNumber stop_least_unacked, + QuicPacketNumber smallest_received, + QuicPacketNumber least_unacked, bool send_feedback, QuicTime::Delta ack_delay_time); std::unique_ptr<QuicReceivedPacket> MakeDataPacket( @@ -117,6 +113,7 @@ bool include_version, QuicStreamId stream_id, QuicPacketNumber largest_received, + QuicPacketNumber smallest_received, QuicPacketNumber least_unacked, bool fin, QuicStreamOffset offset,
diff --git a/net/spdy/core/spdy_deframer_visitor_test.cc b/net/spdy/core/spdy_deframer_visitor_test.cc index 1fe7b22..1df5ff9e 100644 --- a/net/spdy/core/spdy_deframer_visitor_test.cc +++ b/net/spdy/core/spdy_deframer_visitor_test.cc
@@ -179,25 +179,10 @@ EXPECT_TRUE(cf0.VerifyHasFrame(expected_ir)); // Confirm that mismatches are also detected. - expected_ir.set_weight(16); - EXPECT_FALSE(cf0.VerifyHasFrame(expected_ir)); - expected_ir.set_weight(17); - EXPECT_TRUE(cf0.VerifyHasFrame(expected_ir)); - - expected_ir.set_parent_stream_id(50); - EXPECT_FALSE(cf0.VerifyHasFrame(expected_ir)); - expected_ir.set_parent_stream_id(1); - EXPECT_TRUE(cf0.VerifyHasFrame(expected_ir)); - - expected_ir.set_stream_id(201); - EXPECT_FALSE(cf0.VerifyHasFrame(expected_ir)); - expected_ir.set_stream_id(101); - EXPECT_TRUE(cf0.VerifyHasFrame(expected_ir)); - - expected_ir.set_exclusive(false); - EXPECT_FALSE(cf0.VerifyHasFrame(expected_ir)); - expected_ir.set_exclusive(true); - EXPECT_TRUE(cf0.VerifyHasFrame(expected_ir)); + EXPECT_FALSE(cf0.VerifyHasFrame(SpdyPriorityIR(101, 1, 16, true))); + EXPECT_FALSE(cf0.VerifyHasFrame(SpdyPriorityIR(101, 50, 17, true))); + EXPECT_FALSE(cf0.VerifyHasFrame(SpdyPriorityIR(201, 1, 17, true))); + EXPECT_FALSE(cf0.VerifyHasFrame(SpdyPriorityIR(101, 1, 17, false))); } TEST_F(SpdyDeframerVisitorTest, DISABLED_RstStreamFrame) {
diff --git a/net/spdy/core/spdy_framer_test.cc b/net/spdy/core/spdy_framer_test.cc index 31aea0f..66e4f4a6 100644 --- a/net/spdy/core/spdy_framer_test.cc +++ b/net/spdy/core/spdy_framer_test.cc
@@ -2729,18 +2729,6 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kFrameData, arraysize(kFrameData)); - SpdyPriorityIR priority2(2); - priority2.set_parent_stream_id(1); - priority2.set_weight(17); - priority2.set_exclusive(true); - if (use_output_) { - output_.Reset(); - ASSERT_TRUE(framer.SerializeFrame(priority2, &output_)); - frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); - } else { - frame = framer.SerializeFrame(priority2); - } - CompareFrame(kDescription, frame, kFrameData, arraysize(kFrameData)); } TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) {
diff --git a/net/spdy/core/spdy_protocol.h b/net/spdy/core/spdy_protocol.h index 6113bd6c..ac831d9 100644 --- a/net/spdy/core/spdy_protocol.h +++ b/net/spdy/core/spdy_protocol.h
@@ -786,11 +786,6 @@ class NET_EXPORT_PRIVATE SpdyPriorityIR : public SpdyFrameWithStreamIdIR { public: - explicit SpdyPriorityIR(SpdyStreamId stream_id) - : SpdyFrameWithStreamIdIR(stream_id), - parent_stream_id_(0), - weight_(1), - exclusive_(false) {} SpdyPriorityIR(SpdyStreamId stream_id, SpdyStreamId parent_stream_id, int weight, @@ -800,11 +795,8 @@ weight_(weight), exclusive_(exclusive) {} SpdyStreamId parent_stream_id() const { return parent_stream_id_; } - void set_parent_stream_id(SpdyStreamId id) { parent_stream_id_ = id; } int weight() const { return weight_; } - void set_weight(uint8_t weight) { weight_ = weight; } bool exclusive() const { return exclusive_; } - void set_exclusive(bool exclusive) { exclusive_ = exclusive; } void Visit(SpdyFrameVisitor* visitor) const override;
diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index cb35bfe..f196463b 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn
@@ -57,6 +57,7 @@ sources = [ "audio_capturer.cc", "audio_capturer.h", + "audio_capturer_chromeos.cc", "audio_capturer_linux.cc", "audio_capturer_linux.h", "audio_capturer_mac.cc", @@ -70,18 +71,6 @@ "basic_desktop_environment.h", "branding.cc", "branding.h", - "chromeos/aura_desktop_capturer.cc", - "chromeos/aura_desktop_capturer.h", - "chromeos/clipboard_aura.cc", - "chromeos/clipboard_aura.h", - "chromeos/message_box.cc", - "chromeos/message_box.h", - "chromeos/mouse_cursor_monitor_aura.cc", - "chromeos/mouse_cursor_monitor_aura.h", - "chromeos/point_transformer.cc", - "chromeos/point_transformer.h", - "chromeos/skia_bitmap_desktop_frame.cc", - "chromeos/skia_bitmap_desktop_frame.h", "chromoting_host.cc", "chromoting_host.h", "chromoting_host_context.cc", @@ -206,20 +195,6 @@ "ipc_video_frame_capturer.h", "it2me_desktop_environment.cc", "it2me_desktop_environment.h", - "linux/audio_pipe_reader.cc", - "linux/audio_pipe_reader.h", - "linux/certificate_watcher.cc", - "linux/certificate_watcher.h", - "linux/unicode_to_keysym.cc", - "linux/unicode_to_keysym.h", - "linux/x11_character_injector.cc", - "linux/x11_character_injector.h", - "linux/x11_keyboard_impl.cc", - "linux/x11_keyboard_impl.h", - "linux/x11_util.cc", - "linux/x11_util.h", - "linux/x_server_clipboard.cc", - "linux/x_server_clipboard.h", "local_input_monitor.h", "local_input_monitor_chromeos.cc", "local_input_monitor_mac.mm", @@ -326,6 +301,7 @@ } if (is_linux && !is_chromeos) { + public_deps += [ "//remoting/host/linux" ] libs += [ "pam" ] } @@ -334,6 +310,7 @@ "//build/config/linux:x11", "//build/config/linux:xrandr", ] + deps += [ "//remoting/host/linux:x11" ] if (is_desktop_linux) { deps += [ "//build/config/linux/gtk" ] } @@ -344,17 +321,6 @@ "input_injector_x11.cc", "local_input_monitor_x11.cc", ] - if (is_linux) { - # These will already be filtered out on non-Linux. - sources -= [ - "linux/unicode_to_keysym.cc", - "linux/x11_keyboard_impl.cc", - "linux/x11_keyboard_impl.h", - "linux/x11_util.cc", - "linux/x_server_clipboard.cc", - "linux/x_server_clipboard.h", - ] - } } if (!use_ozone) { @@ -365,19 +331,15 @@ # TODO(GYP): crbug.com/481627. These should only be included # when enable_me2me_host is true. sources -= [ + "audio_capturer_linux.cc", + "audio_capturer_linux.h", + "continue_window_linux.cc", + "curtain_mode_linux.cc", + "disconnect_window_linux.cc", "me2me_desktop_environment.cc", "me2me_desktop_environment.h", ] - deps += [ - "//cc", - "//gpu/command_buffer/common", - "//ppapi/host", - "//skia", - "//ui/aura", - "//ui/compositor", - "//ui/events", - "//ui/views", - ] + deps += [ "//remoting/host/chromeos" ] if (use_ash) { deps += [ "//ash" ] @@ -392,17 +354,9 @@ "desktop_resizer_x11.cc", "input_injector_chromeos.cc", "input_injector_chromeos.h", - "linux/x_server_clipboard.cc", - "linux/x_server_clipboard.h", "local_input_monitor_x11.cc", ] } - - sources -= [ - "continue_window_linux.cc", - "curtain_mode_linux.cc", - "disconnect_window_linux.cc", - ] } if (is_mac) { @@ -411,9 +365,6 @@ "Carbon.framework", ] - # TODO(nicholss): When we can delete GYP builds, - # this flag and usage can be removed. - defines += [ "GN_BUILD=1" ] deps += [ ":remoting_version", "//third_party/google_toolbox_for_mac", @@ -479,8 +430,6 @@ sources = [ "audio_silence_detector_unittest.cc", "backoff_timer_unittest.cc", - "chromeos/aura_desktop_capturer_unittest.cc", - "chromeos/clipboard_aura_unittest.cc", "chromoting_host_context_unittest.cc", "chromoting_host_unittest.cc", "client_session_unittest.cc", @@ -502,11 +451,6 @@ "it2me/it2me_confirmation_dialog_proxy_unittest.cc", "it2me/it2me_host_unittest.cc", "it2me/it2me_native_messaging_host_unittest.cc", - "linux/audio_pipe_reader_unittest.cc", - "linux/certificate_watcher_unittest.cc", - "linux/unicode_to_keysym_unittest.cc", - "linux/x11_character_injector_unittest.cc", - "linux/x_server_clipboard_unittest.cc", "local_input_monitor_unittest.cc", "mouse_cursor_monitor_proxy_unittest.cc", "mouse_shape_pump_unittest.cc", @@ -530,15 +474,9 @@ "touch_injector_win_unittest.cc", ] - if (!use_x11 && is_linux) { - sources -= [ "linux/unicode_to_keysym_unittest.cc" ] - } if (use_ozone || is_chromeos) { sources -= [ "local_input_monitor_unittest.cc" ] } - if (is_chromeos) { - sources -= [ "linux/x_server_clipboard_unittest.cc" ] - } configs += [ "//remoting/build/config:version" ] @@ -555,6 +493,18 @@ "//testing/gmock", "//testing/gtest", ] + + if (is_linux && !is_chromeos) { + deps += [ "//remoting/host/linux:unit_tests" ] + } + + if (is_chromeos) { + deps += [ + "//remoting/host/chromeos:unit_tests", + "//remoting/host/linux", # for AudioPipeReader + ] + } + if (is_win) { deps += [ "//remoting/host/win:unit_tests" ] }
diff --git a/remoting/host/audio_capturer_chromeos.cc b/remoting/host/audio_capturer_chromeos.cc new file mode 100644 index 0000000..3e36317e --- /dev/null +++ b/remoting/host/audio_capturer_chromeos.cc
@@ -0,0 +1,19 @@ +// Copyright (c) 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 "base/logging.h" +#include "remoting/host/audio_capturer.h" + +namespace remoting { + +bool AudioCapturer::IsSupported() { + return false; +} + +std::unique_ptr<AudioCapturer> AudioCapturer::Create() { + NOTIMPLEMENTED(); + return nullptr; +} + +} // namespace remoting
diff --git a/remoting/host/chromeos/BUILD.gn b/remoting/host/chromeos/BUILD.gn new file mode 100644 index 0000000..018276a --- /dev/null +++ b/remoting/host/chromeos/BUILD.gn
@@ -0,0 +1,61 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") + +source_set("chromeos") { + sources = [ + "aura_desktop_capturer.cc", + "aura_desktop_capturer.h", + "clipboard_aura.cc", + "clipboard_aura.h", + "message_box.cc", + "message_box.h", + "mouse_cursor_monitor_aura.cc", + "mouse_cursor_monitor_aura.h", + "point_transformer.cc", + "point_transformer.h", + "skia_bitmap_desktop_frame.cc", + "skia_bitmap_desktop_frame.h", + ] + + public_deps = [ + "//cc", + "//gpu/command_buffer/common", + "//ppapi/host", + "//remoting/protocol", + "//skia", + "//third_party/webrtc/modules/desktop_capture", + "//ui/aura", + "//ui/compositor", + "//ui/events", + "//ui/views", + ] + + if (use_ash) { + public_deps += [ "//ash" ] + } +} + +# The host portions of the remoting unit tests. +source_set("unit_tests") { + testonly = true + + sources = [ + "aura_desktop_capturer_unittest.cc", + "clipboard_aura_unittest.cc", + ] + + configs += [ "//remoting/build/config:version" ] + + deps = [ + "//remoting/host", + "//remoting/host:test_support", + "//remoting/proto", + "//remoting/resources", + "//skia", + "//testing/gmock", + "//testing/gtest", + ] +}
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc index 9749ac7b..d828b33 100644 --- a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc +++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
@@ -69,14 +69,14 @@ std::unique_ptr<SkBitmap> cursor_bitmap(new SkBitmap()); gfx::Point cursor_hotspot; - if (cursor.native_type() == ui::kCursorNone) { + if (cursor.native_type() == ui::CursorType::kNone) { callback_->OnMouseCursor(CreateEmptyMouseCursor()); return; } if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) { LOG(ERROR) << "Failed to load bitmap for cursor type:" - << cursor.native_type(); + << static_cast<int>(cursor.native_type()); callback_->OnMouseCursor(CreateEmptyMouseCursor()); return; } @@ -92,7 +92,8 @@ if (cursor_hotspot.x() >= cursor_bitmap->width() || cursor_hotspot.y() >= cursor_bitmap->height()) { LOG(WARNING) << "Cursor hotspot is out of bounds for type: " - << cursor.native_type() << ". Setting to (0,0) instead"; + << static_cast<int>(cursor.native_type()) + << ". Setting to (0,0) instead"; cursor_hotspot.SetPoint(0, 0); }
diff --git a/remoting/host/linux/BUILD.gn b/remoting/host/linux/BUILD.gn index 0c7ed70e..8a76336 100644 --- a/remoting/host/linux/BUILD.gn +++ b/remoting/host/linux/BUILD.gn
@@ -56,22 +56,30 @@ "audio_pipe_reader.h", "certificate_watcher.cc", "certificate_watcher.h", - "unicode_to_keysym.cc", - "unicode_to_keysym.h", ] deps = [ "//remoting/protocol", "//third_party/webrtc/modules/desktop_capture", ] + public_deps = [] if (use_x11) { deps += [ ":x11" ] } + if (is_desktop_linux) { + deps += [ "//build/config/linux/gtk" ] + } } source_set("x11") { sources = [ + "unicode_to_keysym.cc", + "unicode_to_keysym.h", + "x11_character_injector.cc", + "x11_character_injector.h", + "x11_keyboard_impl.cc", + "x11_keyboard_impl.h", "x11_util.cc", "x11_util.h", "x_server_clipboard.cc", @@ -108,3 +116,39 @@ [ "VERSION=" + "$chrome_version_major" + "." + "$remoting_version_patch" + "." + "$chrome_version_build" + "." + "$chrome_version_patch" ] } + +source_set("unit_tests") { + testonly = true + + sources = [ + "audio_pipe_reader_unittest.cc", + "certificate_watcher_unittest.cc", + "unicode_to_keysym_unittest.cc", + "x11_character_injector_unittest.cc", + "x_server_clipboard_unittest.cc", + ] + + if (!use_x11) { + sources -= [ "unicode_to_keysym_unittest.cc" ] + } + + configs += [ "//remoting/build/config:version" ] + + deps = [ + "//remoting/host", + "//remoting/host:test_support", + "//remoting/host/it2me:common", + "//remoting/host/native_messaging", + "//remoting/host/security_key:unit_tests", + "//remoting/host/setup", + "//remoting/proto", + "//remoting/resources", + "//skia", + "//testing/gmock", + "//testing/gtest", + ] + + if (!is_ios) { + deps += [ "//components/policy/core/browser:test_support" ] + } +}
diff --git a/remoting/host/mac/constants_mac.cc b/remoting/host/mac/constants_mac.cc index 3b2f48d..ce66ef6 100644 --- a/remoting/host/mac/constants_mac.cc +++ b/remoting/host/mac/constants_mac.cc
@@ -4,9 +4,7 @@ #include "remoting/host/mac/constants_mac.h" -#if defined(GN_BUILD) #include "remoting/host/version.h" -#endif namespace remoting {
diff --git a/services/ui/public/interfaces/cursor/cursor.mojom b/services/ui/public/interfaces/cursor/cursor.mojom index 08a8802..30becc8b 100644 --- a/services/ui/public/interfaces/cursor/cursor.mojom +++ b/services/ui/public/interfaces/cursor/cursor.mojom
@@ -11,53 +11,53 @@ // Standard Cursor numbers. These are the same as Chrome's ui::Cursor and // blink's WebCursorInfo. enum CursorType { - // NULL is kept for compatibility with chrome declarations. In chrome code, it - // is treated exactly like POINTER, the default pointer. - CURSOR_NULL = 0, - POINTER, - CROSS, - HAND, - IBEAM, - WAIT, - HELP, - EAST_RESIZE, - NORTH_RESIZE, - NORTH_EAST_RESIZE, - NORTH_WEST_RESIZE, - SOUTH_RESIZE, - SOUTH_EAST_RESIZE, - SOUTH_WEST_RESIZE, - WEST_RESIZE, - NORTH_SOUTH_RESIZE, - EAST_WEST_RESIZE, - NORTH_EAST_SOUTH_WEST_RESIZE, - NORTH_WEST_SOUTH_EAST_RESIZE, - COLUMN_RESIZE, - ROW_RESIZE, - MIDDLE_PANNING, - EAST_PANNING, - NORTH_PANNING, - NORTH_EAST_PANNING, - NORTH_WEST_PANNING, - SOUTH_PANNING, - SOUTH_EAST_PANNING, - SOUTH_WEST_PANNING, - WEST_PANNING, - MOVE, - VERTICAL_TEXT, - CELL, - CONTEXT_MENU, - ALIAS, - PROGRESS, - NO_DROP, - COPY, - NONE, - NOT_ALLOWED, - ZOOM_IN, - ZOOM_OUT, - GRAB, - GRABBING, - CUSTOM + // kNull is kept for compatibility with chrome declarations. In chrome code, + // it is treated exactly like kPointer, the default pointer. + kNull = 0, + kPointer, + kCross, + kHand, + kIBeam, + kWait, + kHelp, + kEastResize, + kNorthResize, + kNorthEastResize, + kNorthWestResize, + kSouthResize, + kSouthEastResize, + kSouthWestResize, + kWestResize, + kNorthSouthResize, + kEastWestResize, + kNorthEastSouthWestResize, + kNorthWestSouthEastResize, + kColumnResize, + kRowResize, + kMiddlePanning, + kEastPanning, + kNorthPanning, + kNorthEastPanning, + kNorthWestPanning, + kSouthPanning, + kSouthEastPanning, + kSouthWestPanning, + kWestPanning, + kMove, + kVerticalText, + kCell, + kContextMenu, + kAlias, + kProgress, + kNoDrop, + kCopy, + kNone, + kNotAllowed, + kZoomIn, + kZoomOut, + kGrab, + kGrabbing, + kCustom }; // A description of a cursor.
diff --git a/services/ui/public/interfaces/cursor/cursor_struct_traits.cc b/services/ui/public/interfaces/cursor/cursor_struct_traits.cc index 609ab837..cde0e42 100644 --- a/services/ui/public/interfaces/cursor/cursor_struct_traits.cc +++ b/services/ui/public/interfaces/cursor/cursor_struct_traits.cc
@@ -6,6 +6,7 @@ #include "base/time/time.h" #include "mojo/common/common_custom_types_struct_traits.h" +#include "services/ui/public/interfaces/cursor/cursor.mojom.h" #include "skia/public/interfaces/bitmap_array_struct_traits.h" #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -15,6 +16,260 @@ namespace mojo { // static +ui::mojom::CursorType +EnumTraits<ui::mojom::CursorType, ui::CursorType>::ToMojom( + ui::CursorType input) { + switch (input) { + case ui::CursorType::kNull: + return ui::mojom::CursorType::kNull; + case ui::CursorType::kPointer: + return ui::mojom::CursorType::kPointer; + case ui::CursorType::kCross: + return ui::mojom::CursorType::kCross; + case ui::CursorType::kHand: + return ui::mojom::CursorType::kHand; + case ui::CursorType::kIBeam: + return ui::mojom::CursorType::kIBeam; + case ui::CursorType::kWait: + return ui::mojom::CursorType::kWait; + case ui::CursorType::kHelp: + return ui::mojom::CursorType::kHelp; + case ui::CursorType::kEastResize: + return ui::mojom::CursorType::kEastResize; + case ui::CursorType::kNorthResize: + return ui::mojom::CursorType::kNorthResize; + case ui::CursorType::kNorthEastResize: + return ui::mojom::CursorType::kNorthEastResize; + case ui::CursorType::kNorthWestResize: + return ui::mojom::CursorType::kNorthWestResize; + case ui::CursorType::kSouthResize: + return ui::mojom::CursorType::kSouthResize; + case ui::CursorType::kSouthEastResize: + return ui::mojom::CursorType::kSouthEastResize; + case ui::CursorType::kSouthWestResize: + return ui::mojom::CursorType::kSouthWestResize; + case ui::CursorType::kWestResize: + return ui::mojom::CursorType::kWestResize; + case ui::CursorType::kNorthSouthResize: + return ui::mojom::CursorType::kNorthSouthResize; + case ui::CursorType::kEastWestResize: + return ui::mojom::CursorType::kEastWestResize; + case ui::CursorType::kNorthEastSouthWestResize: + return ui::mojom::CursorType::kNorthEastSouthWestResize; + case ui::CursorType::kNorthWestSouthEastResize: + return ui::mojom::CursorType::kNorthWestSouthEastResize; + case ui::CursorType::kColumnResize: + return ui::mojom::CursorType::kColumnResize; + case ui::CursorType::kRowResize: + return ui::mojom::CursorType::kRowResize; + case ui::CursorType::kMiddlePanning: + return ui::mojom::CursorType::kMiddlePanning; + case ui::CursorType::kEastPanning: + return ui::mojom::CursorType::kEastPanning; + case ui::CursorType::kNorthPanning: + return ui::mojom::CursorType::kNorthPanning; + case ui::CursorType::kNorthEastPanning: + return ui::mojom::CursorType::kNorthEastPanning; + case ui::CursorType::kNorthWestPanning: + return ui::mojom::CursorType::kNorthWestPanning; + case ui::CursorType::kSouthPanning: + return ui::mojom::CursorType::kSouthPanning; + case ui::CursorType::kSouthEastPanning: + return ui::mojom::CursorType::kSouthEastPanning; + case ui::CursorType::kSouthWestPanning: + return ui::mojom::CursorType::kSouthWestPanning; + case ui::CursorType::kWestPanning: + return ui::mojom::CursorType::kWestPanning; + case ui::CursorType::kMove: + return ui::mojom::CursorType::kMove; + case ui::CursorType::kVerticalText: + return ui::mojom::CursorType::kVerticalText; + case ui::CursorType::kCell: + return ui::mojom::CursorType::kCell; + case ui::CursorType::kContextMenu: + return ui::mojom::CursorType::kContextMenu; + case ui::CursorType::kAlias: + return ui::mojom::CursorType::kAlias; + case ui::CursorType::kProgress: + return ui::mojom::CursorType::kProgress; + case ui::CursorType::kNoDrop: + return ui::mojom::CursorType::kNoDrop; + case ui::CursorType::kCopy: + return ui::mojom::CursorType::kCopy; + case ui::CursorType::kNone: + return ui::mojom::CursorType::kNone; + case ui::CursorType::kNotAllowed: + return ui::mojom::CursorType::kNotAllowed; + case ui::CursorType::kZoomIn: + return ui::mojom::CursorType::kZoomIn; + case ui::CursorType::kZoomOut: + return ui::mojom::CursorType::kZoomOut; + case ui::CursorType::kGrab: + return ui::mojom::CursorType::kGrab; + case ui::CursorType::kGrabbing: + return ui::mojom::CursorType::kGrabbing; + case ui::CursorType::kCustom: + return ui::mojom::CursorType::kCustom; + case ui::CursorType::kDndNone: + case ui::CursorType::kDndMove: + case ui::CursorType::kDndCopy: + case ui::CursorType::kDndLink: + // The mojom version is the same as the restricted Webcursor constants; + // don't allow system cursors to be transmitted. + NOTREACHED(); + return ui::mojom::CursorType::kNull; + } + NOTREACHED(); + return ui::mojom::CursorType::kNull; +} + +// static +bool EnumTraits<ui::mojom::CursorType, ui::CursorType>::FromMojom( + ui::mojom::CursorType input, + ui::CursorType* out) { + switch (input) { + case ui::mojom::CursorType::kNull: + *out = ui::CursorType::kNull; + return true; + case ui::mojom::CursorType::kPointer: + *out = ui::CursorType::kPointer; + return true; + case ui::mojom::CursorType::kCross: + *out = ui::CursorType::kCross; + return true; + case ui::mojom::CursorType::kHand: + *out = ui::CursorType::kHand; + return true; + case ui::mojom::CursorType::kIBeam: + *out = ui::CursorType::kIBeam; + return true; + case ui::mojom::CursorType::kWait: + *out = ui::CursorType::kWait; + return true; + case ui::mojom::CursorType::kHelp: + *out = ui::CursorType::kHelp; + return true; + case ui::mojom::CursorType::kEastResize: + *out = ui::CursorType::kEastResize; + return true; + case ui::mojom::CursorType::kNorthResize: + *out = ui::CursorType::kNorthResize; + return true; + case ui::mojom::CursorType::kNorthEastResize: + *out = ui::CursorType::kNorthEastResize; + return true; + case ui::mojom::CursorType::kNorthWestResize: + *out = ui::CursorType::kNorthWestResize; + return true; + case ui::mojom::CursorType::kSouthResize: + *out = ui::CursorType::kSouthResize; + return true; + case ui::mojom::CursorType::kSouthEastResize: + *out = ui::CursorType::kSouthEastResize; + return true; + case ui::mojom::CursorType::kSouthWestResize: + *out = ui::CursorType::kSouthWestResize; + return true; + case ui::mojom::CursorType::kWestResize: + *out = ui::CursorType::kWestResize; + return true; + case ui::mojom::CursorType::kNorthSouthResize: + *out = ui::CursorType::kNorthSouthResize; + return true; + case ui::mojom::CursorType::kEastWestResize: + *out = ui::CursorType::kEastWestResize; + return true; + case ui::mojom::CursorType::kNorthEastSouthWestResize: + *out = ui::CursorType::kNorthEastSouthWestResize; + return true; + case ui::mojom::CursorType::kNorthWestSouthEastResize: + *out = ui::CursorType::kNorthWestSouthEastResize; + return true; + case ui::mojom::CursorType::kColumnResize: + *out = ui::CursorType::kColumnResize; + return true; + case ui::mojom::CursorType::kRowResize: + *out = ui::CursorType::kRowResize; + return true; + case ui::mojom::CursorType::kMiddlePanning: + *out = ui::CursorType::kMiddlePanning; + return true; + case ui::mojom::CursorType::kEastPanning: + *out = ui::CursorType::kEastPanning; + return true; + case ui::mojom::CursorType::kNorthPanning: + *out = ui::CursorType::kNorthPanning; + return true; + case ui::mojom::CursorType::kNorthEastPanning: + *out = ui::CursorType::kNorthEastPanning; + return true; + case ui::mojom::CursorType::kNorthWestPanning: + *out = ui::CursorType::kNorthWestPanning; + return true; + case ui::mojom::CursorType::kSouthPanning: + *out = ui::CursorType::kSouthPanning; + return true; + case ui::mojom::CursorType::kSouthEastPanning: + *out = ui::CursorType::kSouthEastPanning; + return true; + case ui::mojom::CursorType::kSouthWestPanning: + *out = ui::CursorType::kSouthWestPanning; + return true; + case ui::mojom::CursorType::kWestPanning: + *out = ui::CursorType::kWestPanning; + return true; + case ui::mojom::CursorType::kMove: + *out = ui::CursorType::kMove; + return true; + case ui::mojom::CursorType::kVerticalText: + *out = ui::CursorType::kVerticalText; + return true; + case ui::mojom::CursorType::kCell: + *out = ui::CursorType::kCell; + return true; + case ui::mojom::CursorType::kContextMenu: + *out = ui::CursorType::kContextMenu; + return true; + case ui::mojom::CursorType::kAlias: + *out = ui::CursorType::kAlias; + return true; + case ui::mojom::CursorType::kProgress: + *out = ui::CursorType::kProgress; + return true; + case ui::mojom::CursorType::kNoDrop: + *out = ui::CursorType::kNoDrop; + return true; + case ui::mojom::CursorType::kCopy: + *out = ui::CursorType::kCopy; + return true; + case ui::mojom::CursorType::kNone: + *out = ui::CursorType::kNone; + return true; + case ui::mojom::CursorType::kNotAllowed: + *out = ui::CursorType::kNotAllowed; + return true; + case ui::mojom::CursorType::kZoomIn: + *out = ui::CursorType::kZoomIn; + return true; + case ui::mojom::CursorType::kZoomOut: + *out = ui::CursorType::kZoomOut; + return true; + case ui::mojom::CursorType::kGrab: + *out = ui::CursorType::kGrab; + return true; + case ui::mojom::CursorType::kGrabbing: + *out = ui::CursorType::kGrabbing; + return true; + case ui::mojom::CursorType::kCustom: + *out = ui::CursorType::kCustom; + return true; + } + + NOTREACHED(); + return false; +} + +// static const base::TimeDelta& StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::frame_delay( const ui::CursorData& c) { @@ -39,9 +294,12 @@ bool StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::Read( ui::mojom::CursorDataDataView data, ui::CursorData* out) { - ui::mojom::CursorType type = data.cursor_type(); - if (type != ui::mojom::CursorType::CUSTOM) { - *out = ui::CursorData(static_cast<int>(type)); + ui::CursorType type; + if (!data.ReadCursorType(&type)) + return false; + + if (type != ui::CursorType::kCustom) { + *out = ui::CursorData(type); return true; }
diff --git a/services/ui/public/interfaces/cursor/cursor_struct_traits.h b/services/ui/public/interfaces/cursor/cursor_struct_traits.h index a626051..e7e8fa2 100644 --- a/services/ui/public/interfaces/cursor/cursor_struct_traits.h +++ b/services/ui/public/interfaces/cursor/cursor_struct_traits.h
@@ -11,9 +11,15 @@ namespace mojo { template <> +struct EnumTraits<ui::mojom::CursorType, ui::CursorType> { + static ui::mojom::CursorType ToMojom(ui::CursorType input); + static bool FromMojom(ui::mojom::CursorType input, ui::CursorType* out); +}; + +template <> struct StructTraits<ui::mojom::CursorDataDataView, ui::CursorData> { - static ui::mojom::CursorType cursor_type(const ui::CursorData& c) { - return ui::mojom::CursorType(c.cursor_type()); + static ui::CursorType cursor_type(const ui::CursorData& c) { + return c.cursor_type(); } static const base::TimeDelta& frame_delay(const ui::CursorData& c); static const gfx::Point& hotspot_in_pixels(const ui::CursorData& c);
diff --git a/services/ui/public/interfaces/cursor/cursor_struct_traits_unittest.cc b/services/ui/public/interfaces/cursor/cursor_struct_traits_unittest.cc index fa0d041..db2c6c4 100644 --- a/services/ui/public/interfaces/cursor/cursor_struct_traits_unittest.cc +++ b/services/ui/public/interfaces/cursor/cursor_struct_traits_unittest.cc
@@ -48,11 +48,12 @@ // Tests numeric cursor ids. TEST_F(CursorStructTraitsTest, TestBuiltIn) { for (int i = 0; i < 43; ++i) { - ui::CursorData input(i); + ui::CursorType type = static_cast<ui::CursorType>(i); + ui::CursorData input(type); ui::CursorData output; ASSERT_TRUE(EchoCursorData(input, &output)); - EXPECT_TRUE(output.IsType(i)); + EXPECT_TRUE(output.IsType(type)); } } @@ -68,7 +69,7 @@ ui::CursorData output; ASSERT_TRUE(EchoCursorData(input, &output)); - EXPECT_EQ(kCursorCustom, output.cursor_type()); + EXPECT_EQ(CursorType::kCustom, output.cursor_type()); EXPECT_EQ(kScale, output.scale_factor()); EXPECT_EQ(kFrameDelay, output.frame_delay()); EXPECT_EQ(kHotspot, output.hotspot_in_pixels());
diff --git a/services/ui/ws/cursor_unittest.cc b/services/ui/ws/cursor_unittest.cc index 95266c5..ee0d8865 100644 --- a/services/ui/ws/cursor_unittest.cc +++ b/services/ui/ws/cursor_unittest.cc
@@ -108,81 +108,81 @@ TEST_F(CursorTest, ChangeByMouseMove) { ServerWindow* win = BuildServerWindow(); - win->SetPredefinedCursor(mojom::CursorType::IBEAM); - win->parent()->SetPredefinedCursor(mojom::CursorType::CELL); - EXPECT_EQ(mojom::CursorType::IBEAM, win->cursor()); - win->SetNonClientCursor(mojom::CursorType::EAST_RESIZE); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, win->non_client_cursor()); + win->SetPredefinedCursor(mojom::CursorType::kIBeam); + win->parent()->SetPredefinedCursor(mojom::CursorType::kCell); + EXPECT_EQ(mojom::CursorType::kIBeam, win->cursor()); + win->SetNonClientCursor(mojom::CursorType::kEastResize); + EXPECT_EQ(mojom::CursorType::kEastResize, win->non_client_cursor()); // Non client area MoveCursorTo(gfx::Point(15, 15)); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); // Client area, which comes from win->parent(). MoveCursorTo(gfx::Point(25, 25)); - EXPECT_EQ(mojom::CursorType::CELL, cursor()); + EXPECT_EQ(mojom::CursorType::kCell, cursor()); } TEST_F(CursorTest, ChangeByClientAreaChange) { ServerWindow* win = BuildServerWindow(); - win->parent()->SetPredefinedCursor(mojom::CursorType::CROSS); - win->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::IBEAM, mojom::CursorType(win->cursor())); - win->SetNonClientCursor(mojom::CursorType::EAST_RESIZE); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, win->non_client_cursor()); + win->parent()->SetPredefinedCursor(mojom::CursorType::kCross); + win->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kIBeam, mojom::CursorType(win->cursor())); + win->SetNonClientCursor(mojom::CursorType::kEastResize); + EXPECT_EQ(mojom::CursorType::kEastResize, win->non_client_cursor()); // Non client area before we move. MoveCursorTo(gfx::Point(15, 15)); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); // Changing the client area should cause a change. The cursor for the client // area comes from root ancestor, which is win->parent(). win->SetClientArea(gfx::Insets(1, 1), std::vector<gfx::Rect>()); - EXPECT_EQ(mojom::CursorType::CROSS, cursor()); + EXPECT_EQ(mojom::CursorType::kCross, cursor()); } TEST_F(CursorTest, NonClientCursorChange) { ServerWindow* win = BuildServerWindow(); - win->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::IBEAM, win->cursor()); - win->SetNonClientCursor(mojom::CursorType::EAST_RESIZE); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, win->non_client_cursor()); + win->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kIBeam, win->cursor()); + win->SetNonClientCursor(mojom::CursorType::kEastResize); + EXPECT_EQ(mojom::CursorType::kEastResize, win->non_client_cursor()); MoveCursorTo(gfx::Point(15, 15)); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); - win->SetNonClientCursor(mojom::CursorType::WEST_RESIZE); - EXPECT_EQ(mojom::CursorType::WEST_RESIZE, cursor()); + win->SetNonClientCursor(mojom::CursorType::kWestResize); + EXPECT_EQ(mojom::CursorType::kWestResize, cursor()); } TEST_F(CursorTest, IgnoreClientCursorChangeInNonClientArea) { ServerWindow* win = BuildServerWindow(); - win->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::IBEAM, win->cursor()); - win->SetNonClientCursor(mojom::CursorType::EAST_RESIZE); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, win->non_client_cursor()); + win->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kIBeam, win->cursor()); + win->SetNonClientCursor(mojom::CursorType::kEastResize); + EXPECT_EQ(mojom::CursorType::kEastResize, win->non_client_cursor()); MoveCursorTo(gfx::Point(15, 15)); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); - win->SetPredefinedCursor(mojom::CursorType::HELP); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + win->SetPredefinedCursor(mojom::CursorType::kHelp); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); } TEST_F(CursorTest, NonClientToClientByBoundsChange) { ServerWindow* win = BuildServerWindow(); - win->parent()->SetPredefinedCursor(mojom::CursorType::COPY); - win->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::IBEAM, win->cursor()); - win->SetNonClientCursor(mojom::CursorType::EAST_RESIZE); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, win->non_client_cursor()); + win->parent()->SetPredefinedCursor(mojom::CursorType::kCopy); + win->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kIBeam, win->cursor()); + win->SetNonClientCursor(mojom::CursorType::kEastResize); + EXPECT_EQ(mojom::CursorType::kEastResize, win->non_client_cursor()); // Non client area before we move. MoveCursorTo(gfx::Point(15, 15)); - EXPECT_EQ(mojom::CursorType::EAST_RESIZE, cursor()); + EXPECT_EQ(mojom::CursorType::kEastResize, cursor()); win->SetBounds(gfx::Rect(0, 0, 30, 30)); - EXPECT_EQ(mojom::CursorType::COPY, cursor()); + EXPECT_EQ(mojom::CursorType::kCopy, cursor()); } } // namespace test
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc index fa0ec946..98c6cfa 100644 --- a/services/ui/ws/display.cc +++ b/services/ui/ws/display.cc
@@ -37,8 +37,7 @@ namespace ws { Display::Display(WindowServer* window_server) - : window_server_(window_server), - last_cursor_(mojom::CursorType::CURSOR_NULL) { + : window_server_(window_server), last_cursor_(mojom::CursorType::kNull) { window_server_->window_manager_window_tree_factory_set()->AddObserver(this); window_server_->user_id_tracker()->AddObserver(this); }
diff --git a/services/ui/ws/drag_controller.cc b/services/ui/ws/drag_controller.cc index 3545ac2..d5bce60 100644 --- a/services/ui/ws/drag_controller.cc +++ b/services/ui/ws/drag_controller.cc
@@ -52,7 +52,7 @@ cursor_updater_(cursor_updater), drag_operations_(drag_operations), drag_pointer_id_(drag_pointer), - current_cursor_(ui::mojom::CursorType::NO_DROP), + current_cursor_(ui::mojom::CursorType::kNoDrop), source_window_(source_window), source_connection_(source_connection), mime_data_(mime_data), @@ -190,8 +190,8 @@ ui::mojom::CursorType DragController::CursorForEffectBitmask( DropEffectBitmask bitmask) { DropEffectBitmask combined = bitmask & drag_operations_; - return combined == ui::mojom::kDropEffectNone ? ui::mojom::CursorType::NO_DROP - : ui::mojom::CursorType::COPY; + return combined == ui::mojom::kDropEffectNone ? ui::mojom::CursorType::kNoDrop + : ui::mojom::CursorType::kCopy; } void DragController::SetCurrentTargetWindow(ServerWindow* current_target) { @@ -204,7 +204,7 @@ current_cursor_ = CursorForEffectBitmask(state.bitmask); } else { // Can't drop in empty areas. - current_cursor_ = ui::mojom::CursorType::NO_DROP; + current_cursor_ = ui::mojom::CursorType::kNoDrop; } cursor_updater_->OnDragCursorUpdated();
diff --git a/services/ui/ws/drag_controller_unittest.cc b/services/ui/ws/drag_controller_unittest.cc index 7bc192c0..6484f8c 100644 --- a/services/ui/ws/drag_controller_unittest.cc +++ b/services/ui/ws/drag_controller_unittest.cc
@@ -282,14 +282,14 @@ std::unique_ptr<DragTestWindow> window = BuildWindow(); StartDragOperation(window.get(), ui::mojom::kDropEffectMove); - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); DispatchDrag(window.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(1, 1)); EXPECT_EQ(QueuedType::ENTER, window->queue_response_type()); window->Respond(true); // (Even though we're doing a move, the cursor name is COPY.) - EXPECT_EQ(ui::mojom::CursorType::COPY, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kCopy, cursor()); DispatchDrag(window.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(2, 2)); EXPECT_EQ(QueuedType::OVER, window->queue_response_type()); @@ -538,7 +538,7 @@ std::unique_ptr<DragTestWindow> window1 = BuildWindow(); std::unique_ptr<DragTestWindow> window2 = BuildWindow(); StartDragOperation(window1.get(), ui::mojom::kDropEffectMove); - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); // Send some events to |window|. DispatchDrag(window2.get(), false, ui::EF_LEFT_MOUSE_BUTTON, @@ -548,13 +548,13 @@ DispatchDrag(window2.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(1, 1)); window2->Respond(true); - EXPECT_EQ(ui::mojom::CursorType::COPY, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kCopy, cursor()); // Force the destruction of |window.window|. window2.reset(); // The cursor no loner indicates that it can drop on |window2|. - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); } TEST_F(DragControllerTest, SourceWindowClosedWhileDrag) { @@ -640,20 +640,20 @@ std::unique_ptr<DragTestWindow> window = BuildWindow(); StartDragOperation(window.get(), ui::mojom::kDropEffectMove); - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); DispatchDrag(window.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(1, 1)); EXPECT_EQ(QueuedType::ENTER, window->queue_response_type()); window->Respond(true); - EXPECT_EQ(ui::mojom::CursorType::COPY, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kCopy, cursor()); DispatchDrag(window.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(2, 2)); EXPECT_EQ(QueuedType::OVER, window->queue_response_type()); // At this point, we respond with no available drag actions at this pixel. window->Respond(false); - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); } TEST_F(DragControllerTest, ResopnseFromOtherWindowDoesntChangeCursor) { @@ -668,7 +668,7 @@ DispatchDrag(window2.get(), false, ui::EF_LEFT_MOUSE_BUTTON, gfx::Point(1, 1)); - EXPECT_EQ(ui::mojom::CursorType::NO_DROP, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kNoDrop, cursor()); // Now enter |window1|, and respond. DispatchDrag(window1.get(), false, ui::EF_LEFT_MOUSE_BUTTON, @@ -676,13 +676,13 @@ EXPECT_EQ(QueuedType::ENTER, window1->queue_response_type()); window1->Respond(true); - EXPECT_EQ(ui::mojom::CursorType::COPY, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kCopy, cursor()); // Window 2 responding negatively to its queued messages shouldn't change the // cursor. window2->Respond(false); - EXPECT_EQ(ui::mojom::CursorType::COPY, cursor()); + EXPECT_EQ(ui::mojom::CursorType::kCopy, cursor()); } } // namespace ws
diff --git a/services/ui/ws/event_dispatcher.cc b/services/ui/ws/event_dispatcher.cc index a4710df..9edd3bc9 100644 --- a/services/ui/ws/event_dispatcher.cc +++ b/services/ui/ws/event_dispatcher.cc
@@ -91,13 +91,13 @@ return drag_controller_->current_cursor(); if (!mouse_cursor_source_window_) - return ui::mojom::CursorType::POINTER; + return ui::mojom::CursorType::kPointer; if (mouse_cursor_in_non_client_area_) return mouse_cursor_source_window_->non_client_cursor(); const ServerWindow* window = GetWindowForMouseCursor(); - return window ? window->cursor() : ui::mojom::CursorType::POINTER; + return window ? window->cursor() : ui::mojom::CursorType::kPointer; } bool EventDispatcher::SetCaptureWindow(ServerWindow* window,
diff --git a/services/ui/ws/platform_display_default.cc b/services/ui/ws/platform_display_default.cc index 08f8f9e2..93611c8 100644 --- a/services/ui/ws/platform_display_default.cc +++ b/services/ui/ws/platform_display_default.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "gpu/ipc/client/gpu_channel_host.h" #include "services/ui/display/screen_manager.h" +#include "services/ui/public/interfaces/cursor/cursor_struct_traits.h" #include "services/ui/ws/display_client_compositor_frame_sink.h" #include "services/ui/ws/server_window.h" #include "ui/base/cursor/image_cursors.h" @@ -108,9 +109,13 @@ // delegate to the window manager to load images from resource packs. // // We probably also need to deal with different DPIs. - ui::Cursor cursor(static_cast<int32_t>(cursor_id)); - image_cursors_->SetPlatformCursor(&cursor); - platform_window_->SetCursor(cursor.platform()); + ui::CursorType type; + if (mojo::EnumTraits<ui::mojom::CursorType, ui::CursorType>::FromMojom( + cursor_id, &type)) { + ui::Cursor cursor(type); + image_cursors_->SetPlatformCursor(&cursor); + platform_window_->SetCursor(cursor.platform()); + } } void PlatformDisplayDefault::UpdateTextInputState(
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc index ca67227d..2f59aac1 100644 --- a/services/ui/ws/server_window.cc +++ b/services/ui/ws/server_window.cc
@@ -32,10 +32,10 @@ transient_parent_(nullptr), modal_type_(MODAL_TYPE_NONE), visible_(false), - // Default to POINTER as CURSOR_NULL doesn't change the cursor, it leaves + // Default to kPointer as kNull doesn't change the cursor, it leaves // the last non-null cursor. - cursor_id_(mojom::CursorType::POINTER), - non_client_cursor_id_(mojom::CursorType::POINTER), + cursor_id_(mojom::CursorType::kPointer), + non_client_cursor_id_(mojom::CursorType::kPointer), opacity_(1), can_focus_(true), properties_(properties),
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc index dea18697..fe0428c 100644 --- a/services/ui/ws/test_utils.cc +++ b/services/ui/ws/test_utils.cc
@@ -530,7 +530,7 @@ // WindowServerTestHelper --------------------------------------------------- WindowServerTestHelper::WindowServerTestHelper() - : cursor_id_(mojom::CursorType::CURSOR_NULL), + : cursor_id_(mojom::CursorType::kNull), platform_display_factory_(&cursor_id_) { // Some tests create their own message loop, for example to add a task runner. if (!base::MessageLoop::current())
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc index b5a9234..ce0c8ce3c 100644 --- a/services/ui/ws/window_manager_state_unittest.cc +++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -649,8 +649,8 @@ window_tree()->AddWindow(FirstRootId(window_tree()), child_window_id); child_window->SetVisible(true); child_window->SetBounds(gfx::Rect(0, 0, 20, 20)); - child_window->parent()->SetPredefinedCursor(ui::mojom::CursorType::COPY); - EXPECT_EQ(ui::mojom::CursorType::COPY, display_test_api.last_cursor()); + child_window->parent()->SetPredefinedCursor(ui::mojom::CursorType::kCopy); + EXPECT_EQ(ui::mojom::CursorType::kCopy, display_test_api.last_cursor()); // Move the mouse outside the bounds of the child, so that the mouse is not // over any valid windows. Cursor should change to POINTER. ui::PointerEvent move( @@ -660,7 +660,7 @@ window_manager_state()->ProcessEvent(move, 0); // The event isn't over a valid target, which should trigger resetting the // cursor to POINTER. - EXPECT_EQ(ui::mojom::CursorType::POINTER, display_test_api.last_cursor()); + EXPECT_EQ(ui::mojom::CursorType::kPointer, display_test_api.last_cursor()); } } // namespace test
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc index 06f6762..602b3b9 100644 --- a/services/ui/ws/window_tree_client_unittest.cc +++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -1639,7 +1639,7 @@ changes2()->clear(); ASSERT_TRUE( - wt_client1()->SetPredefinedCursor(window_1_1, mojom::CursorType::IBEAM)); + wt_client1()->SetPredefinedCursor(window_1_1, mojom::CursorType::kIBeam)); wt_client2_->WaitForChangeCount(1u); EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4",
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc index cc10f3d..1d64d28 100644 --- a/services/ui/ws/window_tree_unittest.cc +++ b/services/ui/ws/window_tree_unittest.cc
@@ -475,11 +475,11 @@ DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); // Set the cursor on the parent as that is where the cursor is picked up from. - window->parent()->SetPredefinedCursor(mojom::CursorType::IBEAM); + window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam); // Because the cursor is over the window when SetCursor was called, we should // have immediately changed the cursor. - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); } TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) { @@ -492,11 +492,11 @@ // inside. DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); // Set the cursor on the parent as that is where the cursor is picked up from. - window->parent()->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); } TEST_F(WindowTreeTest, TouchesDontChangeCursor) { @@ -508,12 +508,12 @@ // Let's create a pointer event outside the window and then move the pointer // inside. DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); - window->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + window->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); // With a touch event, we shouldn't update the cursor. DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); } TEST_F(WindowTreeTest, DragOutsideWindow) { @@ -526,25 +526,25 @@ // change the cursor. DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); // Set the cursor on the parent as that is where the cursor is picked up from. - window->parent()->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); // Move the pointer to the inside of the window DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); // Start the drag. DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); // Move the cursor (mouse is still down) outside the window. DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); // Release the cursor. We should now adapt the cursor of the window // underneath the pointer. DispatchEventAndAckImmediately(CreateMouseUpEvent(5, 5)); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); } TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) { @@ -556,17 +556,17 @@ // Put the cursor just outside the bounds of the window. DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41)); // Sets the cursor on the root as that is where the cursor is picked up from. - window->parent()->SetPredefinedCursor(mojom::CursorType::IBEAM); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); // Expand the bounds of the window so they now include where the cursor now // is. window->SetBounds(gfx::Rect(20, 20, 25, 25)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); // Contract the bounds again. window->SetBounds(gfx::Rect(20, 20, 20, 20)); - EXPECT_EQ(mojom::CursorType::POINTER, cursor_id()); + EXPECT_EQ(mojom::CursorType::kPointer, cursor_id()); } TEST_F(WindowTreeTest, WindowReorderingChangesCursor) { @@ -583,14 +583,14 @@ mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS); embed_window2->set_event_targeting_policy( mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS); - embed_window1->SetPredefinedCursor(mojom::CursorType::IBEAM); - embed_window2->SetPredefinedCursor(mojom::CursorType::CROSS); + embed_window1->SetPredefinedCursor(mojom::CursorType::kIBeam); + embed_window2->SetPredefinedCursor(mojom::CursorType::kCross); DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); // Cursor should match that of top-most window, which is |embed_window2|. - EXPECT_EQ(mojom::CursorType::CROSS, cursor_id()); + EXPECT_EQ(mojom::CursorType::kCross, cursor_id()); // Move |embed_window1| on top, cursor should now match it. embed_window1->parent()->StackChildAtTop(embed_window1); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); } // Assertions around moving cursor between trees with roots. @@ -608,9 +608,9 @@ mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS); embed_window2->parent()->set_event_targeting_policy( mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS); - embed_window1->SetPredefinedCursor(mojom::CursorType::IBEAM); - embed_window2->SetPredefinedCursor(mojom::CursorType::CROSS); - embed_window1->parent()->SetPredefinedCursor(mojom::CursorType::COPY); + embed_window1->SetPredefinedCursor(mojom::CursorType::kIBeam); + embed_window2->SetPredefinedCursor(mojom::CursorType::kCross); + embed_window1->parent()->SetPredefinedCursor(mojom::CursorType::kCopy); // Create a child of |embed_window1|. ServerWindow* embed_window1_child = NewWindowInTreeWithParent( @@ -621,15 +621,15 @@ // Move mouse into |embed_window1|. DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); - EXPECT_EQ(mojom::CursorType::IBEAM, cursor_id()); + EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id()); // Move mouse into |embed_window2|. DispatchEventAndAckImmediately(CreateMouseMoveEvent(25, 25)); - EXPECT_EQ(mojom::CursorType::CROSS, cursor_id()); + EXPECT_EQ(mojom::CursorType::kCross, cursor_id()); // Move mouse into area between, which should use cursor set on parent. DispatchEventAndAckImmediately(CreateMouseMoveEvent(15, 15)); - EXPECT_EQ(mojom::CursorType::COPY, cursor_id()); + EXPECT_EQ(mojom::CursorType::kCopy, cursor_id()); } TEST_F(WindowTreeTest, EventAck) {
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 6d08ac4..2038d0d1 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -202,6 +202,10 @@ # define SK_IGNORE_ETC1_SUPPORT #endif +#ifndef SK_SUPPORT_GPU_REF_ENCODED_DATA +# define SK_SUPPORT_GPU_REF_ENCODED_DATA +#endif + #ifndef SK_IGNORE_GPU_DITHER # define SK_IGNORE_GPU_DITHER #endif
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority-expected.txt index efeeca04..b7db852 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority-expected.txt
@@ -2,15 +2,31 @@ Tests resource priorities. +sendSyncScriptRequest Request: empty-script.js?sync priority: High +sendAsyncScriptRequest Request: empty-script.js?async priority: Low -Request: abe.png?preceding priority: Low -Request: empty-script.js?preceded priority: Medium -Request: abe.png?precedingPreload priority: Low -Request: empty-script.js?precededByPreload priority: High +sendScriptRequestPrecededByImage +Request: abe.png?precedingScript priority: Low +Request: empty-script.js?precededByImage priority: Medium +sendScriptRequestPrecededByPreloadedImage +Request: abe.png?preloaded priority: Low +Request: empty-script.js?precededByPreloadedImage priority: High +Request: abe.png?followingPreload priority: Low +sendXHRSync Request: empty.html?xhr-sync priority: VeryHigh +sendXHRAsync Request: empty.html?xhr-async priority: High -Request: abe.png priority: Low -Request: style.css priority: VeryHigh +sendImageRequest +Request: abe.png?image priority: Low +sendStyleRequest +Request: style.css?style priority: VeryHigh +createIFrame Request: empty.html?iframe priority: VeryHigh +sendScriptsFromDocumentWriteAfterImage +Request: abe.png?precedingDocWrite priority: Low +Request: docwrite.js priority: Medium +Request: empty-script.js?docWritten-1 priority: High +Request: empty-script.js?docWritten-2 priority: High +Request: empty-script.js?docWritten-3 priority: High
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority.html b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority.html index 01023c0..025d4399 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resource-priority.html
@@ -33,7 +33,7 @@ function sendImageRequest() { var img = document.createElement("img"); - img.src = "resources/abe.png"; + img.src = "resources/abe.png?image"; document.body.appendChild(img); } @@ -41,7 +41,7 @@ { var link = document.createElement("link"); link.rel = "stylesheet"; - link.href = "resources/style.css"; + link.href = "resources/style.css?style"; document.head.appendChild(link); } @@ -49,8 +49,8 @@ { var iframe = document.createElement("iframe"); document.body.appendChild(iframe); - iframe.srcdoc = '<html><body><img src="resources/abe.png?preceding">' - + '<script src="http://localhost:8000/inspector/network/resources/empty-script.js?preceded"></s' + iframe.srcdoc = '<html><body><img src="resources/abe.png?precedingScript">' + + '<script src="http://localhost:8000/inspector/network/resources/empty-script.js?precededByImage"></s' + 'cript>;</body></html>'; } @@ -58,9 +58,18 @@ { var iframe = document.createElement("iframe"); document.body.appendChild(iframe); - iframe.srcdoc = '<html><body><link href="resources/abe.png?precedingPreload" rel=preload as=image>' - + '<script src="http://localhost:8000/inspector/network/resources/empty-script.js?precededByPreload"></s' - + 'cript><img src="resources/abe.png?precedingPreload"></body></html>'; + iframe.srcdoc = '<html><body><link href="resources/abe.png?preloaded" rel=preload as=image>' + + '<script src="http://localhost:8000/inspector/network/resources/empty-script.js?precededByPreloadedImage"></s' + + 'cript><img src="resources/abe.png?followingPreload"></body></html>'; +} + +function sendScriptsFromDocumentWriteAfterImage() +{ + var iframe = document.createElement("iframe"); + document.body.appendChild(iframe); + iframe.srcdoc = '<html><body><img src="resources/abe.png?precedingDocWrite">' + + '<script src="resources/docwrite.js"></s' + + 'cript></body></html>'; } function createIFrame() @@ -73,36 +82,41 @@ function test() { var actions = [ - "sendSyncScriptRequest", - "sendAsyncScriptRequest", - "sendScriptRequestPrecededByImage", - "sendScriptRequestPrecededByPreloadedImage", - "sendXHRSync", - "sendXHRAsync", - "sendImageRequest", - "sendStyleRequest", - "createIFrame" + {"fn": "sendSyncScriptRequest", "requests": 1}, + {"fn": "sendAsyncScriptRequest", "requests": 1}, + {"fn": "sendScriptRequestPrecededByImage", "requests": 2}, + {"fn": "sendScriptRequestPrecededByPreloadedImage", "requests": 3}, + {"fn": "sendXHRSync", "requests": 1}, + {"fn": "sendXHRAsync", "requests": 1}, + {"fn": "sendImageRequest", "requests": 1}, + {"fn": "sendStyleRequest", "requests": 1}, + {"fn": "createIFrame", "requests": 1}, + {"fn": "sendScriptsFromDocumentWriteAfterImage", "requests": 5}, ]; InspectorTest.networkManager.addEventListener(SDK.NetworkManager.Events.RequestStarted, onRequestStarted); var nextAction = 0; - performNextRequest(); + var expectedRequestCount = 0; + performNextAction(); - function performNextRequest() + function performNextAction() { if (nextAction >= actions.length) { InspectorTest.networkManager.removeEventListener(SDK.NetworkManager.Events.RequestStarted, onRequestStarted); InspectorTest.completeTest(); return; } - InspectorTest.evaluateInPage(actions[nextAction++] + "()"); + InspectorTest.addResult(actions[nextAction].fn); + expectedRequestCount = actions[nextAction].requests; + InspectorTest.evaluateInPage(actions[nextAction++].fn + "()"); } function onRequestStarted(event) { var request = event.data; InspectorTest.addResult("Request: " + request.name() + " priority: " + request.initialPriority()); - if (request.name().indexOf("preceded") == -1) - performNextRequest(); + expectedRequestCount--; + if (expectedRequestCount < 1) + performNextAction(); } } </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network/resources/docwrite.js b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resources/docwrite.js new file mode 100644 index 0000000..c6dd9f06 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network/resources/docwrite.js
@@ -0,0 +1,3 @@ +document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-1"></s' + 'cript>'); +document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-2"></s' + 'cript>'); +document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-3"></s' + 'cript>');
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color-expected.html b/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color-expected.html new file mode 100644 index 0000000..a2a04a43 --- /dev/null +++ b/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color-expected.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<style> +table { + border-collapse: collapse; + margin: 30px; +} +td { + width: 100px; + height: 50px; + border: 10px solid green; +} +body { + color: green; +} +</style> +All borders should change to green. +<table><tr><td></td></tr></table> +<table><tr><td></td></tr></table> +<!-- +TODO(wangxianzhu): Enable these after crbug.com/626748 is fixed. +<table><tr><td></td></tr></table> +<table><tr><td></td></tr></table> +--> +<table><tr><td></td></tr></table>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color.html b/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color.html new file mode 100644 index 0000000..0d5c3ae --- /dev/null +++ b/third_party/WebKit/LayoutTests/paint/invalidation/table/collapsed-border-current-color.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<style> +table { + border-collapse: collapse; + margin: 30px; +} +td { + width: 100px; + height: 50px; +} +.border { + border: 10px solid currentColor; +} +</style> +All borders should change to green. +<table class="border"><tr><td></td></tr></table> +<table><colgroup><col class="border"></colgroup><tr><td></td></tr></table> +<!-- +TODO(wangxianzhu): Enable these after crbug.com/626748 is fixed. +<table><tbody class="border"><tr><td></td></tr></tbody></table> +<table><tr class="border"><td></td></tr></table> +--> +<table><tr><td class="border"></td></tr></table> +<script src="../../../resources/run-after-layout-and-paint.js"></script> +<script> +runAfterLayoutAndPaint(function() { + document.body.style.color = 'green'; +}, true); +</script> +
diff --git a/third_party/WebKit/Source/bindings/bindings.gni b/third_party/WebKit/Source/bindings/bindings.gni index ad4c28d..6965ab9 100644 --- a/third_party/WebKit/Source/bindings/bindings.gni +++ b/third_party/WebKit/Source/bindings/bindings.gni
@@ -70,7 +70,6 @@ "core/v8/LocalWindowProxy.cpp", "core/v8/LocalWindowProxy.h", "core/v8/Maplike.h", - "core/v8/Microtask.cpp", "core/v8/Microtask.h", "core/v8/NativeValueTraits.h", "core/v8/NativeValueTraitsImpl.h",
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp index 2655591..97f2c12b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -151,7 +151,7 @@ #endif WorldMap& map = GetWorldMap(); - auto it = map.Find(world_id); + auto it = map.find(world_id); if (it != map.end()) { RefPtr<DOMWrapperWorld> world = it->value; DCHECK(world->IsIsolatedWorld()); @@ -172,7 +172,7 @@ SecurityOrigin* DOMWrapperWorld::IsolatedWorldSecurityOrigin() { DCHECK(this->IsIsolatedWorld()); IsolatedWorldSecurityOriginMap& origins = IsolatedWorldSecurityOrigins(); - IsolatedWorldSecurityOriginMap::iterator it = origins.Find(GetWorldId()); + IsolatedWorldSecurityOriginMap::iterator it = origins.find(GetWorldId()); return it == origins.end() ? 0 : it->value.Get(); } @@ -222,7 +222,7 @@ IsolatedWorldContentSecurityPolicyMap& policies = IsolatedWorldContentSecurityPolicies(); IsolatedWorldContentSecurityPolicyMap::iterator it = - policies.Find(GetWorldId()); + policies.find(GetWorldId()); return it == policies.end() ? false : it->value; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp index 4b6ed82..10e321d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp
@@ -80,10 +80,10 @@ !iterator_getter->IsFunction()) return nullptr; v8::Local<v8::Value> iterator; - if (!V8Call(V8ScriptRunner::CallFunction( - v8::Local<v8::Function>::Cast(iterator_getter), - execution_context, dictionary_object_, 0, nullptr, isolate_), - iterator)) + if (!V8ScriptRunner::CallFunction( + v8::Local<v8::Function>::Cast(iterator_getter), execution_context, + dictionary_object_, 0, nullptr, isolate_) + .ToLocal(&iterator)) return nullptr; if (!iterator->IsObject()) return nullptr;
diff --git a/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp b/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp index 2dfe5d1..70acbf3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp
@@ -64,7 +64,7 @@ if (!dictionary.Get(key, v8_value)) return false; - return V8Call(v8_value->BooleanValue(dictionary.V8Context()), value); + return v8_value->BooleanValue(dictionary.V8Context()).To(&value); } template <> @@ -75,7 +75,7 @@ if (!dictionary.Get(key, v8_value)) return false; - return V8Call(v8_value->Int32Value(dictionary.V8Context()), value); + return v8_value->Int32Value(dictionary.V8Context()).To(&value); } template <> @@ -90,7 +90,7 @@ } has_value = true; - return V8Call(v8_value->NumberValue(dictionary.V8Context()), value); + return v8_value->NumberValue(dictionary.V8Context()).To(&value); } template <> @@ -171,7 +171,7 @@ return false; int64_t int64_value; - if (!V8Call(v8_value->IntegerValue(dictionary.V8Context()), int64_value)) + if (!v8_value->IntegerValue(dictionary.V8Context()).To(&int64_value)) return false; value = int64_value; return true; @@ -186,7 +186,7 @@ return false; double double_value; - if (!V8Call(v8_value->NumberValue(dictionary.V8Context()), double_value)) + if (!v8_value->NumberValue(dictionary.V8Context()).To(&double_value)) return false; doubleToInteger(double_value, value); return true;
diff --git a/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp b/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp index 0aa7df2..a95c695a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp
@@ -88,7 +88,7 @@ DCHECK(!done_); v8::Local<v8::Value> value; - if (!V8Call(value_, value) || !value->IsObject()) + if (!value_.ToLocal(&value) || !value->IsObject()) return false; result = Dictionary(isolate_, value, exception_state); @@ -100,7 +100,7 @@ DCHECK(!done_); v8::Local<v8::Value> value; - if (!V8Call(value_, value)) + if (!value_.ToLocal(&value)) return false; V8StringResource<> string_value(value);
diff --git a/third_party/WebKit/Source/bindings/core/v8/Microtask.h b/third_party/WebKit/Source/bindings/core/v8/Microtask.h index 3da8fad..ce577a0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Microtask.h +++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.h
@@ -28,51 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Microtask_h -#define Microtask_h - -#include "core/CoreExport.h" -#include "platform/WebTaskRunner.h" -#include "platform/wtf/Allocator.h" -#include "platform/wtf/Functional.h" -#include "v8/include/v8.h" - -namespace blink { - -// C++ calls into script contexts which are "owned" by blink (created in a -// process where WebKit.cpp initializes v8) must declare their type: -// -// 1. Calls into page/author script from a frame -// 2. Calls into page/author script from a worker -// 3. Calls into internal script (typically setup/teardown work) -// -// Debug-time checking of this is enforced via v8::MicrotasksScope. -// -// Calls of type (1) should generally go through ScriptController, as inspector -// instrumentation is needed. ScriptController allocates V8RecursionScope for -// you. -// -// Calls of type (2) should always stack-allocate a -// v8::MicrotasksScope(kRunMicrtoasks) in the same block as the call into -// script. -// -// Calls of type (3) should stack allocate a -// v8::MicrotasksScope(kDoNotRunMicrotasks) -- this skips work that is spec'd to -// happen at the end of the outer-most script stack frame of calls into page -// script: -// http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint -class CORE_EXPORT Microtask { - STATIC_ONLY(Microtask); - - public: - static void PerformCheckpoint(v8::Isolate*); - - // TODO(jochen): Make all microtasks pass in the ScriptState they want to be - // executed in. Until then, all microtasks have to keep track of their - // ScriptState themselves. - static void EnqueueMicrotask(std::unique_ptr<WTF::Closure>); -}; - -} // namespace blink - -#endif // Microtask_h +// This file has moved to platform/bindings/Microtask.h +// TODO(adithyas): Remove this file. +#include "platform/bindings/Microtask.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp index ae0ebad..bd55d9a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
@@ -15,10 +15,10 @@ #include "core/events/PromiseRejectionEvent.h" #include "core/inspector/ThreadDebugger.h" #include "platform/WebTaskRunner.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Functional.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp index 341a948..8f03da4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp
@@ -128,15 +128,14 @@ try_catch.SetVerbose(true); v8::Local<v8::Script> script; - if (!V8Call( - V8ScriptRunner::CompileScript( - source, GetIsolate(), access_control_status, v8_cache_options), - script, try_catch)) + if (!V8ScriptRunner::CompileScript(source, GetIsolate(), + access_control_status, v8_cache_options) + .ToLocal(&script)) return result; - if (!V8Call(V8ScriptRunner::RunCompiledScript(GetIsolate(), script, - GetFrame()->GetDocument()), - result, try_catch)) + if (!V8ScriptRunner::RunCompiledScript(GetIsolate(), script, + GetFrame()->GetDocument()) + .ToLocal(&result)) return result; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp index d1ae401..3afb37a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
@@ -274,9 +274,9 @@ ExecutionContext* execution_context = ExecutionContext::From(script_state_.Get()); v8::Local<v8::Value> result; - if (!V8Call(V8ScriptRunner::CallAsConstructor(isolate, Constructor(), - execution_context, 0, nullptr), - result)) { + if (!V8ScriptRunner::CallAsConstructor(isolate, Constructor(), + execution_context, 0, nullptr) + .ToLocal(&result)) { return nullptr; } return V8Element::toImplWithTypeCheck(isolate, result);
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp index 7eceb55f..2068c1e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp
@@ -84,7 +84,7 @@ v8::Local<v8::Context> context = script_state_->GetContext(); v8::Local<v8::String> name_string = V8AtomicString(isolate, name); v8::TryCatch try_catch(isolate); - if (!V8Call(object->Get(context, name_string), value, try_catch)) { + if (!object->Get(context, name_string).ToLocal(&value)) { exception_state_.RethrowV8Exception(try_catch.Exception()); return false; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp index 544c0ad..941ace60 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
@@ -25,9 +25,9 @@ v8::TryCatch try_catch(isolate); try_catch.SetVerbose(true); v8::Local<v8::Module> module; - if (!V8Call(V8ScriptRunner::CompileModule(isolate, source, file_name, - access_control_status), - module, try_catch)) { + if (!V8ScriptRunner::CompileModule(isolate, source, file_name, + access_control_status) + .ToLocal(&module)) { // Compilation error is not used in Blink implementaion logic. // Note: Error message is delivered to user (e.g. console) by message // listeners set on v8::Isolate. See V8Initializer::initalizeMainThread(). @@ -68,10 +68,9 @@ // TODO(kouhei): We currently don't have a code-path which use return value of // EvaluateModule. Stop ignoring result once we have such path. v8::Local<v8::Value> result; - if (!V8Call( - V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), - script_state->GetContext(), isolate), - result, try_catch)) { + if (!V8ScriptRunner::EvaluateModule(module_->NewLocal(isolate), + script_state->GetContext(), isolate) + .ToLocal(&result)) { return; } }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index 6b1c919..eefd53a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -18,10 +18,10 @@ #include "platform/SharedBuffer.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/CachedMetadata.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Deque.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/text/TextEncodingRegistry.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index 81e77fe..fc0df14 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -16,9 +16,9 @@ #include "core/dom/MockScriptElementBase.h" #include "core/frame/Settings.h" #include "platform/heap/Handle.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h index 66e7dea..420ce172c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
@@ -142,23 +142,6 @@ return main_world_wrapper_ == other; } - // Provides a way to convert Node* to ScriptWrappable* without including - // "core/dom/Node.h". - // - // Example: - // void foo(const void*) { ... } // [1] - // void foo(ScriptWrappable*) { ... } // [2] - // class Node; - // Node* node; - // foo(node); // This calls [1] because there is no definition of Node - // // and compilers do not know that Node is a subclass of - // // ScriptWrappable. - // foo(ScriptWrappable::fromNode(node)); // This calls [2] as expected. - // - // The definition of fromNode is placed in Node.h because we'd like to - // inline calls to fromNode as much as possible. - static ScriptWrappable* FromNode(Node*); - bool SetReturnValue(v8::ReturnValue<v8::Value> return_value) { return_value.Set(main_world_wrapper_); return ContainsWrapper();
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp index a46ffa2..a959390 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
@@ -20,9 +20,9 @@ #include "core/html/imports/HTMLImportsController.h" #include "platform/heap/HeapCompact.h" #include "platform/heap/HeapPage.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/AutoReset.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink { @@ -260,7 +260,7 @@ // The write barrier may try to mark a wrapper because cleanup is still // delayed. Bail out in this case. We also allow unconditional marking which // requires us to bail out here when tracing is not in progress. - if (!tracing_in_progress_) + if (!tracing_in_progress_ || handle->IsEmpty()) return; handle->RegisterExternalReference(isolate_); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp index 7280f32..6c0d0c9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
@@ -95,10 +95,8 @@ int line_number = 0; int column_number = 0; - if (V8Call(message->GetLineNumber(isolate->GetCurrentContext()), - line_number) && - V8Call(message->GetStartColumn(isolate->GetCurrentContext()), - column_number)) + if (message->GetLineNumber(isolate->GetCurrentContext()).To(&line_number) && + message->GetStartColumn(isolate->GetCurrentContext()).To(&column_number)) ++column_number; if ((!script_id || !line_number) && stack_trace && !stack_trace->isEmpty())
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp index 3564c21d..ae58a62b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
@@ -266,9 +266,9 @@ } v8::PropertyAttribute property_attribute; - if (!V8Call(prototype_->GetPropertyAttributes( - context, V8String(isolate, "constructor")), - property_attribute) || + if (!prototype_ + ->GetPropertyAttributes(context, V8String(isolate, "constructor")) + .To(&property_attribute) || (property_attribute & v8::DontDelete)) { V0CustomElementException::ThrowException( V0CustomElementException::kConstructorPropertyNotConfigurable, type,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp index 5f2eb693..2e5daef 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp
@@ -100,7 +100,7 @@ DCHECK(!value->IsBoolean()); v8::TryCatch block(isolate); bool result = false; - if (!V8Call(value->BooleanValue(isolate->GetCurrentContext()), result, block)) + if (!value->BooleanValue(isolate->GetCurrentContext()).To(&result)) exception_state.RethrowV8Exception(block.Exception()); return result; } @@ -193,8 +193,8 @@ } else { // Can the value be converted to a number? v8::TryCatch block(isolate); - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()) + .ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -254,8 +254,8 @@ } else { // Can the value be converted to a number? v8::TryCatch block(isolate); - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()) + .ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -323,8 +323,7 @@ // Can the value be converted to a number? v8::TryCatch block(isolate); v8::Local<v8::Number> number_object; - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()).ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -347,8 +346,7 @@ return 0; int32_t result; - if (!V8Call(number_object->Int32Value(isolate->GetCurrentContext()), result, - block)) { + if (!number_object->Int32Value(isolate->GetCurrentContext()).To(&result)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -377,8 +375,7 @@ // Can the value be converted to a number? v8::TryCatch block(isolate); v8::Local<v8::Number> number_object; - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()).ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -401,8 +398,7 @@ return 0; uint32_t result; - if (!V8Call(number_object->Uint32Value(isolate->GetCurrentContext()), result, - block)) { + if (!number_object->Uint32Value(isolate->GetCurrentContext()).To(&result)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -418,8 +414,7 @@ v8::Local<v8::Number> number_object; // Can the value be converted to a number? v8::TryCatch block(isolate); - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()).ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -463,8 +458,7 @@ v8::Local<v8::Number> number_object; // Can the value be converted to a number? v8::TryCatch block(isolate); - if (!V8Call(value->ToNumber(isolate->GetCurrentContext()), number_object, - block)) { + if (!value->ToNumber(isolate->GetCurrentContext()).ToLocal(&number_object)) { exception_state.RethrowV8Exception(block.Exception()); return 0; } @@ -548,8 +542,8 @@ string_object = value.As<v8::String>(); } else { v8::TryCatch block(isolate); - if (!V8Call(value->ToString(isolate->GetCurrentContext()), string_object, - block)) { + if (!value->ToString(isolate->GetCurrentContext()) + .ToLocal(&string_object)) { exception_state.RethrowV8Exception(block.Exception()); return String(); } @@ -686,8 +680,8 @@ string_object = value.As<v8::String>(); } else { v8::TryCatch block(isolate); - if (!V8Call(value->ToString(isolate->GetCurrentContext()), string_object, - block)) { + if (!value->ToString(isolate->GetCurrentContext()) + .ToLocal(&string_object)) { exception_state.RethrowV8Exception(block.Exception()); return String(); } @@ -959,8 +953,8 @@ ExceptionState& exception_state) { v8::Local<v8::Value> parsed; v8::TryCatch try_catch(isolate); - if (!V8Call(v8::JSON::Parse(isolate, V8String(isolate, stringified_json)), - parsed, try_catch)) { + if (!v8::JSON::Parse(isolate, V8String(isolate, stringified_json)) + .ToLocal(&parsed)) { if (try_catch.HasCaught()) exception_state.RethrowV8Exception(try_catch.Exception()); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h index ce8237b..a5433d2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h
@@ -72,25 +72,12 @@ class NodeFilter; class XPathNSResolver; -template <typename CallbackInfo> -inline void V8SetReturnValue(const CallbackInfo& callback_info, Node* impl) { - V8SetReturnValue(callback_info, ScriptWrappable::FromNode(impl)); -} - template <typename CallbackInfo, typename T> inline void V8SetReturnValue(const CallbackInfo& callbackInfo, NotShared<T> notShared) { V8SetReturnValue(callbackInfo, notShared.View()); } -template <typename CallbackInfo> -inline void V8SetReturnValueFast(const CallbackInfo& callback_info, - Node* impl, - const ScriptWrappable* wrappable) { - V8SetReturnValueFast(callback_info, ScriptWrappable::FromNode(impl), - wrappable); -} - template <typename CallbackInfo, typename T> inline void V8SetReturnValueFast(const CallbackInfo& callbackInfo, NotShared<T> notShared,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h b/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h index d58ff26..215eca8 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h
@@ -59,47 +59,10 @@ ? alloca(value.As<v8::ArrayBufferView>()->ByteLength()) \ : nullptr) -// DEPRECATED: These v8Call macros are deprecated. -// Use To/ToLocal/ToChecked/ToLocalChecked instead. -// TODO(haraken): Remove these macros. -template <typename T> -inline bool V8Call(v8::Maybe<T> maybe, T& out_variable) { - if (maybe.IsNothing()) - return false; - out_variable = maybe.FromJust(); - return true; -} - // DEPRECATED inline bool V8CallBoolean(v8::Maybe<bool> maybe) { bool result; - return V8Call(maybe, result) && result; -} - -// DEPRECATED -template <typename T> -inline bool V8Call(v8::Maybe<T> maybe, - T& out_variable, - v8::TryCatch& try_catch) { - bool success = V8Call(maybe, out_variable); - DCHECK(success || try_catch.HasCaught()); - return success; -} - -// DEPRECATED -template <typename T> -inline bool V8Call(v8::MaybeLocal<T> maybe_local, v8::Local<T>& out_variable) { - return maybe_local.ToLocal(&out_variable); -} - -// DEPRECATED -template <typename T> -inline bool V8Call(v8::MaybeLocal<T> maybe_local, - v8::Local<T>& out_variable, - v8::TryCatch& try_catch) { - bool success = maybe_local.ToLocal(&out_variable); - DCHECK(success || try_catch.HasCaught()); - return success; + return maybe.To(&result) && result; } } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp index 91de2053..100516e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp
@@ -49,7 +49,7 @@ if (world_id) { DOMActivityLoggerMapForIsolatedWorld& loggers = DomActivityLoggersForIsolatedWorld(); - DOMActivityLoggerMapForIsolatedWorld::iterator it = loggers.Find(world_id); + DOMActivityLoggerMapForIsolatedWorld::iterator it = loggers.find(world_id); return it == loggers.end() ? 0 : it->value.get(); } @@ -57,7 +57,7 @@ return 0; DOMActivityLoggerMapForMainWorld& loggers = DomActivityLoggersForMainWorld(); - DOMActivityLoggerMapForMainWorld::iterator it = loggers.Find(extension_id); + DOMActivityLoggerMapForMainWorld::iterator it = loggers.find(extension_id); return it == loggers.end() ? 0 : it->value.get(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp b/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp index 24fc1d1b0..7315640 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp
@@ -102,9 +102,9 @@ // 6. Let prototype be Get(NewTarget, "prototype"). Rethrow any exceptions. v8::Local<v8::Value> prototype; v8::Local<v8::String> prototype_string = V8AtomicString(isolate, "prototype"); - if (!V8Call(new_target.As<v8::Object>()->Get(script_state->GetContext(), - prototype_string), - prototype)) { + if (!new_target.As<v8::Object>() + ->Get(script_state->GetContext(), prototype_string) + .ToLocal(&prototype)) { return; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h index f92ca96a6..55ef2a4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h
@@ -30,9 +30,9 @@ #include "core/CoreExport.h" #include "gin/public/v8_idle_task_runner.h" #include "platform/RuntimeEnabledFeatures.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 0b28c32..ca900dc4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -59,6 +59,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/AccessControlStatus.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/SecurityViolationReportingPolicy.h" #include "platform/wtf/AddressSanitizer.h" #include "platform/wtf/Assertions.h" @@ -67,7 +68,6 @@ #include "platform/wtf/text/WTFString.h" #include "platform/wtf/typed_arrays/ArrayBufferContents.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "v8/include/v8-debug.h" #include "v8/include/v8-profiler.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp index 12e7950..3f327bb 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp
@@ -30,10 +30,11 @@ if (maybe_value.IsEmpty()) return maybe_value; v8::Local<v8::Value> done_value; - if (!V8Call(result->Get(script_state->GetContext(), - V8String(script_state->GetIsolate(), "done")), - done_value) || - !V8Call(done_value->BooleanValue(script_state->GetContext()), *done)) { + if (!result + ->Get(script_state->GetContext(), + V8String(script_state->GetIsolate(), "done")) + .ToLocal(&done_value) || + !done_value->BooleanValue(script_state->GetContext()).To(done)) { return v8::MaybeLocal<v8::Value>(); } return maybe_value;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp b/third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp index 2391154..fc69c2e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp
@@ -123,8 +123,7 @@ DCHECK(!result.IsEmpty()); uint32_t uint32_value; - if (!V8Call(result->Uint32Value(script_state_->GetContext()), uint32_value, - exception_catcher)) { + if (!result->Uint32Value(script_state_->GetContext()).To(&uint32_value)) { exception_state.RethrowV8Exception(exception_catcher.Exception()); return NodeFilter::kFilterReject; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp index 1ac93cc0..92a5396b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -157,7 +157,7 @@ v8::Local<v8::Signature> signature, int length) { auto& map = SelectOperationTemplateMap(world); - auto result = map.Find(key); + auto result = map.find(key); if (result != map.end()) return result->value.Get(GetIsolate()); @@ -172,7 +172,7 @@ const DOMWrapperWorld& world, const void* key) { auto& map = SelectInterfaceTemplateMap(world); - auto result = map.Find(key); + auto result = map.find(key); if (result != map.end()) return result->value.Get(GetIsolate()); return v8::Local<v8::FunctionTemplate>(); @@ -190,7 +190,7 @@ const void* lookup_key, const char* const names[], size_t count) { - auto it = eternal_name_cache_.Find(lookup_key); + auto it = eternal_name_cache_.find(lookup_key); const Vector<v8::Eternal<v8::Name>>* vector = nullptr; if (UNLIKELY(it == eternal_name_cache_.end())) { v8::Isolate* isolate = this->GetIsolate(); @@ -238,7 +238,7 @@ const WrapperTypeInfo* untrusted_wrapper_type_info, v8::Local<v8::Value> value, V8FunctionTemplateMap& map) { - auto result = map.Find(untrusted_wrapper_type_info); + auto result = map.find(untrusted_wrapper_type_info); if (result == map.end()) return false; v8::Local<v8::FunctionTemplate> templ = result->value.Get(GetIsolate()); @@ -262,7 +262,7 @@ V8FunctionTemplateMap& map) { if (value.IsEmpty() || !value->IsObject()) return v8::Local<v8::Object>(); - auto result = map.Find(info); + auto result = map.find(info); if (result == map.end()) return v8::Local<v8::Object>(); v8::Local<v8::FunctionTemplate> templ = result->value.Get(GetIsolate());
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp index 7bb6e189..4957be6 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp
@@ -76,7 +76,7 @@ if (world.IsMainWorld()) { window_proxy = window_proxy_.Get(); } else { - IsolatedWorldMap::iterator iter = isolated_worlds_.Find(world.GetWorldId()); + IsolatedWorldMap::iterator iter = isolated_worlds_.find(world.GetWorldId()); if (iter != isolated_worlds_.end()) { window_proxy = iter->value.Get(); } else {
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp index bd49ff3d..f500bfe0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
@@ -257,10 +257,10 @@ v8::Local<v8::Script> compiled_script; v8::MaybeLocal<v8::Value> maybe_result; - if (V8Call(V8ScriptRunner::CompileScript( - script, file_name, String(), script_start_position, isolate_, - cache_handler, kSharableCrossOrigin, v8_cache_options), - compiled_script, block)) + if (V8ScriptRunner::CompileScript( + script, file_name, String(), script_start_position, isolate_, + cache_handler, kSharableCrossOrigin, v8_cache_options) + .ToLocal(&compiled_script)) maybe_result = V8ScriptRunner::RunCompiledScript(isolate_, compiled_script, global_scope_);
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp index c8c30e9..f091e55 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -135,7 +135,7 @@ static CSSPropertyID CssPropertyInfo(const AtomicString& name) { typedef HashMap<String, CSSPropertyID> CSSPropertyIDMap; DEFINE_STATIC_LOCAL(CSSPropertyIDMap, map, ()); - CSSPropertyIDMap::iterator iter = map.Find(name); + CSSPropertyIDMap::iterator iter = map.find(name); if (iter != map.end()) return iter->value;
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp index ffffdab..fbc6d6e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp
@@ -99,7 +99,7 @@ menu.AppendItem(item); } else { int32_t int32_id; - if (!V8Call(id->Int32Value(context), int32_id)) + if (!id->Int32Value(context).To(&int32_id)) return false; ContextMenuAction typed_id = static_cast<ContextMenuAction>( kContextMenuItemBaseCustomTag + int32_id);
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp index acd06af..e56c2f03 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp
@@ -107,10 +107,12 @@ TOSTRING_VOID(V8StringResource<>, type_arg, info[0]); bool can_bubble_arg = false; bool cancelable_arg = false; - if (!V8Call(info[1]->BooleanValue(info.GetIsolate()->GetCurrentContext()), - can_bubble_arg) || - !V8Call(info[2]->BooleanValue(info.GetIsolate()->GetCurrentContext()), - cancelable_arg)) + if (!info[1] + ->BooleanValue(info.GetIsolate()->GetCurrentContext()) + .To(&can_bubble_arg) || + !info[2] + ->BooleanValue(info.GetIsolate()->GetCurrentContext()) + .To(&cancelable_arg)) return; v8::Local<v8::Value> data_arg = info[3]; TOSTRING_VOID(V8StringResource<>, origin_arg, info[4]);
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp index 1bb3b01..4792bf4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
@@ -382,7 +382,7 @@ // is deserializing. // For example in sharedWorker.postMessage(...). BlobDataHandleMap& handles = serialized_script_value_->BlobDataHandles(); - BlobDataHandleMap::const_iterator it = handles.Find(uuid); + BlobDataHandleMap::const_iterator it = handles.find(uuid); if (it != handles.end()) return it->value; return BlobDataHandle::Create(uuid, type, size);
diff --git a/third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp index f26d82f..2326950 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp
@@ -178,7 +178,7 @@ } return; } - if (feature == "WebVR") { + if (feature == "WebVR1.1") { global_instance_object = script_state->GetContext()->Global(); V8WindowPartial::installGamepadExtensions( isolate, world, global_instance_object, v8::Local<v8::Object>(),
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp index 1d5f20a..2c84b44 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp
@@ -221,7 +221,7 @@ if (!V8CallBoolean(array->HasOwnProperty(context, i))) return nullptr; v8::Local<v8::Value> item; - if (!V8Call(array->Get(context, i), item, block)) { + if (!array->Get(context, i).ToLocal(&item)) { exception_state.RethrowV8Exception(block.Exception()); return nullptr; } @@ -343,7 +343,7 @@ v8::Local<v8::String> key = V8String(isolate, element); if (!V8CallBoolean(object->HasOwnProperty(context, key))) return nullptr; - if (!V8Call(object->Get(context, key), v8_value, block)) { + if (!object->Get(context, key).ToLocal(&v8_value)) { exception_state.RethrowV8Exception(block.Exception()); return nullptr; } @@ -522,7 +522,7 @@ v8::Local<v8::Object> object = value.As<v8::Object>(); v8::Local<v8::String> property = V8String(isolate, key_path_element); bool has_own_property; - if (!V8Call(object->HasOwnProperty(context, property), has_own_property)) + if (!object->HasOwnProperty(context, property).To(&has_own_property)) return false; if (has_own_property) { if (!object->Get(context, property).ToLocal(&value)) @@ -585,7 +585,7 @@ // If the value lacks an "own" property, it can be added - either as // an intermediate object or as the final value. bool has_own_property; - if (!V8Call(object->HasOwnProperty(context, property), has_own_property)) + if (!object->HasOwnProperty(context, property).To(&has_own_property)) return false; if (!has_own_property) return true;
diff --git a/third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl index 0d29ca1b..7ab3d72 100644 --- a/third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl
@@ -49,7 +49,7 @@ return true; } - const KeywordTable::iterator tableIterator = keywordTable().Find(id); + const KeywordTable::iterator tableIterator = keywordTable().find(id); if (tableIterator == keywordTable().end()) { return false; }
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp index 6badd80e..d1625d15 100644 --- a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
@@ -203,7 +203,7 @@ String unprefixed_property = RemoveSVGPrefix(property); QualifiedName attribute_name = SvgAttributeName(unprefixed_property); const AttributeNameMap& supported_attributes = GetSupportedAttributes(); - auto iter = supported_attributes.Find(attribute_name); + auto iter = supported_attributes.find(attribute_name); if (iter == supported_attributes.end() || !svg_element.PropertyFromAttribute(*iter->value)) return nullptr;
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp index 1349e89..b8c9331 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp
@@ -59,7 +59,7 @@ using ApplicableTypesMap = HashMap<PropertyHandle, std::unique_ptr<const InterpolationTypes>>; DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicable_types_map, ()); - auto entry = applicable_types_map.Find(property); + auto entry = applicable_types_map.find(property); bool found_entry = entry != applicable_types_map.end(); // Custom property interpolation types may change over time so don't trust the
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp index 885ebea..8e901cb 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp
@@ -191,7 +191,7 @@ zero_offset_easing = &keyframe->Easing(); for (const PropertyHandle& property : keyframe->Properties()) { - KeyframeGroupMap::iterator group_iter = keyframe_groups_->Find(property); + KeyframeGroupMap::iterator group_iter = keyframe_groups_->find(property); PropertySpecificKeyframeGroup* group; if (group_iter == keyframe_groups_->end()) { group = keyframe_groups_
diff --git a/third_party/WebKit/Source/core/animation/SVGInterpolationTypesMap.cpp b/third_party/WebKit/Source/core/animation/SVGInterpolationTypesMap.cpp index e80794b3a..938b719 100644 --- a/third_party/WebKit/Source/core/animation/SVGInterpolationTypesMap.cpp +++ b/third_party/WebKit/Source/core/animation/SVGInterpolationTypesMap.cpp
@@ -29,7 +29,7 @@ using ApplicableTypesMap = HashMap<PropertyHandle, std::unique_ptr<const InterpolationTypes>>; DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicable_types_map, ()); - auto entry = applicable_types_map.Find(property); + auto entry = applicable_types_map.find(property); if (entry != applicable_types_map.end()) return *entry->value.get();
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp index bf557a6d..44a2d70a 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
@@ -513,7 +513,7 @@ KeyframeEffectReadOnly* effect = ToKeyframeEffectReadOnly(animation->effect()); if (effect->HasActiveAnimationsOnCompositor(property) && - pending_update_.NewTransitions().Find(property) != + pending_update_.NewTransitions().find(property) != pending_update_.NewTransitions().end() && !animation->Limited()) { retargeted_compositor_transitions.insert( @@ -649,7 +649,7 @@ const RunningTransition* interrupted_transition = nullptr; if (state.active_transitions) { TransitionMap::const_iterator active_transition_iter = - state.active_transitions->Find(property); + state.active_transitions->find(property); if (active_transition_iter != state.active_transitions->end()) { const RunningTransition* running_transition = &active_transition_iter->value;
diff --git a/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.cpp b/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.cpp index 0529d61..6010344 100644 --- a/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.cpp
@@ -49,7 +49,7 @@ if (!size.IsEmpty()) sizes_.insert(size); - LayoutObjectSizeCountMap::iterator it = clients_.Find(layout_object); + LayoutObjectSizeCountMap::iterator it = clients_.find(layout_object); if (it == clients_.end()) { clients_.insert(layout_object, SizeAndCount(size, 1)); } else { @@ -66,7 +66,7 @@ void CSSImageGeneratorValue::RemoveClient(const LayoutObject* layout_object) { DCHECK(layout_object); - LayoutObjectSizeCountMap::iterator it = clients_.Find(layout_object); + LayoutObjectSizeCountMap::iterator it = clients_.find(layout_object); SECURITY_DCHECK(it != clients_.end()); IntSize removed_image_size; @@ -89,7 +89,7 @@ Image* CSSImageGeneratorValue::GetImage(const LayoutObject* layout_object, const IntSize& size) { - LayoutObjectSizeCountMap::iterator it = clients_.Find(layout_object); + LayoutObjectSizeCountMap::iterator it = clients_.find(layout_object); if (it != clients_.end()) { SizeAndCount& size_count = it->value; IntSize old_size = size_count.size;
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index 993b0652..889057e 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -967,8 +967,8 @@ size_t index, NamedLinesType type) const { auto iter = type == kNamedLines - ? ordered_named_grid_lines_.Find(index) - : ordered_named_auto_repeat_grid_lines_.Find(index); + ? ordered_named_grid_lines_.find(index) + : ordered_named_auto_repeat_grid_lines_.find(index); auto end_iter = type == kNamedLines ? ordered_named_grid_lines_.end() : ordered_named_auto_repeat_grid_lines_.end();
diff --git a/third_party/WebKit/Source/core/css/FontFaceCache.cpp b/third_party/WebKit/Source/core/css/FontFaceCache.cpp index 99aec0b2..c364fc6 100644 --- a/third_party/WebKit/Source/core/css/FontFaceCache.cpp +++ b/third_party/WebKit/Source/core/css/FontFaceCache.cpp
@@ -78,7 +78,7 @@ void FontFaceCache::Remove(const StyleRuleFontFace* font_face_rule) { StyleRuleToFontFace::iterator it = - style_rule_to_font_face_.Find(font_face_rule); + style_rule_to_font_face_.find(font_face_rule); if (it != style_rule_to_font_face_.end()) { RemoveFontFace(it->value.Get(), true); style_rule_to_font_face_.erase(it); @@ -87,13 +87,13 @@ void FontFaceCache::RemoveFontFace(FontFace* font_face, bool css_connected) { FamilyToTraitsMap::iterator font_faces_iter = - font_faces_.Find(font_face->family()); + font_faces_.find(font_face->family()); if (font_faces_iter == font_faces_.end()) return; TraitsMap* family_font_faces = font_faces_iter->value.Get(); TraitsMap::iterator family_font_faces_iter = - family_font_faces->Find(font_face->Traits().Bitfield()); + family_font_faces->find(font_face->Traits().Bitfield()); if (family_font_faces_iter == family_font_faces->end()) return; CSSSegmentedFontFace* segmented_font_face = family_font_faces_iter->value;
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp index 93ad62d..56a734e 100644 --- a/third_party/WebKit/Source/core/css/RuleFeature.cpp +++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -988,7 +988,7 @@ Element& element, const AtomicString& class_name) const { InvalidationSetMap::const_iterator it = - class_invalidation_sets_.Find(class_name); + class_invalidation_sets_.find(class_name); if (it == class_invalidation_sets_.end()) return; @@ -1015,7 +1015,7 @@ const AtomicString& class_name, unsigned min_direct_adjacent) const { InvalidationSetMap::const_iterator it = - class_invalidation_sets_.Find(class_name); + class_invalidation_sets_.find(class_name); if (it == class_invalidation_sets_.end()) return; @@ -1037,7 +1037,7 @@ InvalidationLists& invalidation_lists, Element& element, const AtomicString& id) const { - InvalidationSetMap::const_iterator it = id_invalidation_sets_.Find(id); + InvalidationSetMap::const_iterator it = id_invalidation_sets_.find(id); if (it == id_invalidation_sets_.end()) return; @@ -1061,7 +1061,7 @@ Element& element, const AtomicString& id, unsigned min_direct_adjacent) const { - InvalidationSetMap::const_iterator it = id_invalidation_sets_.Find(id); + InvalidationSetMap::const_iterator it = id_invalidation_sets_.find(id); if (it == id_invalidation_sets_.end()) return; @@ -1083,7 +1083,7 @@ Element& element, const QualifiedName& attribute_name) const { InvalidationSetMap::const_iterator it = - attribute_invalidation_sets_.Find(attribute_name.LocalName()); + attribute_invalidation_sets_.find(attribute_name.LocalName()); if (it == attribute_invalidation_sets_.end()) return; @@ -1110,7 +1110,7 @@ const QualifiedName& attribute_name, unsigned min_direct_adjacent) const { InvalidationSetMap::const_iterator it = - attribute_invalidation_sets_.Find(attribute_name.LocalName()); + attribute_invalidation_sets_.find(attribute_name.LocalName()); if (it == attribute_invalidation_sets_.end()) return; @@ -1133,7 +1133,7 @@ Element& element, CSSSelector::PseudoType pseudo) const { PseudoTypeInvalidationSetMap::const_iterator it = - pseudo_invalidation_sets_.Find(pseudo); + pseudo_invalidation_sets_.find(pseudo); if (it == pseudo_invalidation_sets_.end()) return;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index a0c3702..7611e9a 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1326,7 +1326,7 @@ look_ahead_column++; NamedGridAreaMap::iterator grid_area_it = - grid_area_map.Find(grid_area_name); + grid_area_map.find(grid_area_name); if (grid_area_it == grid_area_map.end()) { grid_area_map.insert(grid_area_name, GridArea(GridSpan::TranslatedDefiniteGridSpan(
diff --git a/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp b/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp index ee9c4fb..bfb82c1 100644 --- a/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp +++ b/third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp
@@ -62,7 +62,7 @@ const MatchedPropertiesVector& properties) { DCHECK(hash); - Cache::iterator it = cache_.Find(hash); + Cache::iterator it = cache_.find(hash); if (it == cache_.end()) return nullptr; CachedMatchedProperties* cache_item = it->value.Get();
diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp index 169053d..45b17a2 100644 --- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -142,7 +142,7 @@ if (keyframes_rule_map_.IsEmpty()) return nullptr; - KeyframesRuleMap::iterator it = keyframes_rule_map_.Find(animation_name); + KeyframesRuleMap::iterator it = keyframes_rule_map_.find(animation_name); if (it == keyframes_rule_map_.end()) return nullptr; @@ -153,7 +153,7 @@ AtomicString s(rule->GetName()); if (rule->IsVendorPrefixed()) { - KeyframesRuleMap::iterator it = keyframes_rule_map_.Find(s.Impl()); + KeyframesRuleMap::iterator it = keyframes_rule_map_.find(s.Impl()); if (it == keyframes_rule_map_.end()) keyframes_rule_map_.Set(s.Impl(), rule); else if (it->value->IsVendorPrefixed())
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleRuleUsageTracker.cpp b/third_party/WebKit/Source/core/css/resolver/StyleRuleUsageTracker.cpp index fc90f85..9a43869 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleRuleUsageTracker.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleRuleUsageTracker.cpp
@@ -21,7 +21,7 @@ return; if (!used_rules_.insert(std::make_pair(parent_sheet, rule)).is_new_entry) return; - auto it = used_rules_delta_.Find(parent_sheet); + auto it = used_rules_delta_.find(parent_sheet); if (it != used_rules_delta_.end()) { it->value.push_back(rule); } else {
diff --git a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp index 1f2629e..cc03ba02 100644 --- a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp +++ b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
@@ -100,7 +100,7 @@ // Count reached 0. should_update_timer = true; - auto it = added_selectors_.Find(selector); + auto it = added_selectors_.find(selector); if (it != added_selectors_.end()) added_selectors_.erase(it); else @@ -114,7 +114,7 @@ continue; should_update_timer = true; - auto it = removed_selectors_.Find(selector); + auto it = removed_selectors_.find(selector); if (it != removed_selectors_.end()) removed_selectors_.erase(it); else
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 09db9018..69ad410 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -236,6 +236,7 @@ #include "platform/network/ContentSecurityPolicyParsers.h" #include "platform/network/HTTPParsers.h" #include "platform/network/NetworkStateNotifier.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/text/PlatformLocale.h" #include "platform/text/SegmentedString.h" @@ -256,7 +257,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebPrerenderingSupport.h" -#include "public/platform/WebScheduler.h" #include "public/platform/modules/sensitive_input_visibility/sensitive_input_visibility_service.mojom-blink.h" #include "public/platform/site_engagement.mojom-blink.h"
diff --git a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp index cbe849e..b3e36d0 100644 --- a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp
@@ -95,7 +95,7 @@ DCHECK(key); DCHECK(element); - Map::iterator it = map_.Find(key); + Map::iterator it = map_.find(key); if (it == map_.end()) return; @@ -161,7 +161,7 @@ DEFINE_STATIC_LOCAL(HeapVector<Member<Element>>, empty_vector, (new HeapVector<Member<Element>>)); - Map::iterator it = map_.Find(key); + Map::iterator it = map_.find(key); if (it == map_.end()) return empty_vector;
diff --git a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h index 35e67a0..53a4e4c9 100644 --- a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h +++ b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h
@@ -115,7 +115,7 @@ } inline bool DocumentOrderedMap::ContainsMultiple(const AtomicString& id) const { - Map::const_iterator it = map_.Find(id); + Map::const_iterator it = map_.find(id); return it != map_.end() && it->value->count > 1; }
diff --git a/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp b/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp index cde8384b..f5280d5b 100644 --- a/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp +++ b/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp
@@ -15,7 +15,7 @@ IntersectionObservation* ElementIntersectionObserverData::GetObservationFor( IntersectionObserver& observer) { - auto i = intersection_observations_.Find(&observer); + auto i = intersection_observations_.find(&observer); if (i == intersection_observations_.end()) return nullptr; return i->value;
diff --git a/third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.cpp b/third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.cpp index cc9d156c..2328d73 100644 --- a/third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.cpp +++ b/third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.cpp
@@ -55,7 +55,7 @@ if (id.IsEmpty() || registry_.IsEmpty()) return; - IdToObserverSetMap::iterator iter = registry_.Find(id.Impl()); + IdToObserverSetMap::iterator iter = registry_.find(id.Impl()); ObserverSet* set = iter->value.Get(); set->erase(observer);
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp index 9c5d32c..df981b7 100644 --- a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp +++ b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
@@ -5,9 +5,9 @@ #include "core/dom/IdleDeadline.h" #include "core/timing/PerformanceBase.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp b/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp index 99b516e..d68f3ff8c 100644 --- a/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp +++ b/third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp
@@ -33,8 +33,10 @@ } void SuspendTimerQueue() override {} void ResumeTimerQueue() override {} - void AddPendingNavigation(WebScheduler::NavigatingFrameType) override {} - void RemovePendingNavigation(WebScheduler::NavigatingFrameType) override {} + void AddPendingNavigation( + scheduler::RendererScheduler::NavigatingFrameType) override {} + void RemovePendingNavigation( + scheduler::RendererScheduler::NavigatingFrameType) override {} private: DISALLOW_COPY_AND_ASSIGN(MockScheduler);
diff --git a/third_party/WebKit/Source/core/dom/ModuleMap.cpp b/third_party/WebKit/Source/core/dom/ModuleMap.cpp index 16b7898..ddab410e 100644 --- a/third_party/WebKit/Source/core/dom/ModuleMap.cpp +++ b/third_party/WebKit/Source/core/dom/ModuleMap.cpp
@@ -151,7 +151,7 @@ } ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const { - MapImpl::const_iterator it = map_.Find(url); + MapImpl::const_iterator it = map_.find(url); CHECK_NE(it, map_.end()); return it->value->GetModuleScript(); }
diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h index 369b8c5..8f02fe26 100644 --- a/third_party/WebKit/Source/core/dom/Node.h +++ b/third_party/WebKit/Source/core/dom/Node.h
@@ -993,12 +993,6 @@ ChildNeedsStyleRecalc(); } -// See the comment at the declaration of ScriptWrappable::fromNode in -// bindings/core/v8/ScriptWrappable.h about why this method is defined here. -inline ScriptWrappable* ScriptWrappable::FromNode(Node* node) { - return node; -} - // Allow equality comparisons of Nodes by reference or pointer, interchangeably. DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(Node)
diff --git a/third_party/WebKit/Source/core/dom/NthIndexCache.cpp b/third_party/WebKit/Source/core/dom/NthIndexCache.cpp index 9d1dd3c1fc2..9936c67 100644 --- a/third_party/WebKit/Source/core/dom/NthIndexCache.cpp +++ b/third_party/WebKit/Source/core/dom/NthIndexCache.cpp
@@ -189,7 +189,7 @@ unsigned index = 0; for (Element *sibling = &element; sibling; sibling = ElementTraversal::PreviousSibling(*sibling), index++) { - auto it = element_index_map_.Find(sibling); + auto it = element_index_map_.find(sibling); if (it != element_index_map_.end()) return it->value + index; } @@ -204,7 +204,7 @@ sibling = ElementTraversal::PreviousSibling( *sibling, HasTagName(element.TagQName())), index++) { - auto it = element_index_map_.Find(sibling); + auto it = element_index_map_.find(sibling); if (it != element_index_map_.end()) return it->value + index; }
diff --git a/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp b/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp index af20447..237fcaf0 100644 --- a/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp +++ b/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
@@ -36,11 +36,11 @@ #include "core/dom/Element.h" #include "core/html/HTMLInputElement.h" #include "platform/Timer.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/HashFunctions.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/text/CString.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp index f73ff640..b966b4c 100644 --- a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp +++ b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -108,7 +108,7 @@ const HashMap<String, String> attrs = ParseAttributes(data_, attrs_ok); if (!attrs_ok) return false; - HashMap<String, String>::const_iterator i = attrs.Find("type"); + HashMap<String, String>::const_iterator i = attrs.find("type"); String type; if (i != attrs.end()) type = i->value;
diff --git a/third_party/WebKit/Source/core/dom/ResizeObserver.cpp b/third_party/WebKit/Source/core/dom/ResizeObserver.cpp index 80d45a0..e7768d9 100644 --- a/third_party/WebKit/Source/core/dom/ResizeObserver.cpp +++ b/third_party/WebKit/Source/core/dom/ResizeObserver.cpp
@@ -44,7 +44,7 @@ auto observer_map = target ? target->ResizeObserverData() : nullptr; if (!observer_map) return; - auto observation = observer_map->Find(this); + auto observation = observer_map->find(this); if (observation != observer_map->end()) { observations_.erase((*observation).value); observer_map->erase(observation);
diff --git a/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp index 297890d7..e74a2c9 100644 --- a/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.cpp
@@ -33,7 +33,7 @@ << ", referrer.hash=" << ScriptModuleHash::GetHash(referrer) << ")"; // Step 1. Let referencing module script be referencingModule.[[HostDefined]]. - const auto it = record_to_module_script_map_.Find(referrer); + const auto it = record_to_module_script_map_.find(referrer); CHECK_NE(it, record_to_module_script_map_.end()) << "Failed to find referrer ModuleScript corresponding to the record"; ModuleScript* referrer_module = it->value;
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp index 9ca51ac1..0a9c58b 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -30,8 +30,8 @@ #include "core/dom/ScriptLoader.h" #include "core/dom/TaskRunnerHelper.h" #include "platform/heap/Handle.h" +#include "platform/scheduler/child/web_scheduler.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink { @@ -200,7 +200,7 @@ void ScriptRunner::MovePendingScript(ScriptRunner* new_runner, ScriptLoader* script_loader) { - auto it = pending_async_scripts_.Find(script_loader); + auto it = pending_async_scripts_.find(script_loader); if (it != pending_async_scripts_.end()) { new_runner->QueueScriptForExecution(script_loader, kAsync); pending_async_scripts_.erase(it);
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp index cf6caf0..3b439e45 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
@@ -7,9 +7,9 @@ #include "core/dom/MockScriptElementBase.h" #include "core/dom/ScriptLoader.h" #include "platform/heap/Handle.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "public/platform/Platform.h" -#include "public/platform/WebViewScheduler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp index c4f2b5d..b7fb3d2 100644 --- a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp
@@ -11,11 +11,11 @@ #include "core/probe/CoreProbes.h" #include "platform/Histogram.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/Functional.h" #include "platform/wtf/RefCounted.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebTraceLocation.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp index 753db0e..bab98d5 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
@@ -544,7 +544,7 @@ } HashMap<AtomicString, std::unique_ptr<SelectorQuery>>::iterator it = - entries_.Find(selectors); + entries_.find(selectors); if (it != entries_.end()) return it->value.get();
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp index 739ee05..d758f34fb 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp +++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -111,7 +111,7 @@ return &GetDocumentStyleSheetCollection(); StyleSheetCollectionMap::iterator it = - style_sheet_collection_map_.Find(&tree_scope); + style_sheet_collection_map_.find(&tree_scope); if (it == style_sheet_collection_map_.end()) return nullptr; return it->value.Get();
diff --git a/third_party/WebKit/Source/core/dom/UserActionElementSet.cpp b/third_party/WebKit/Source/core/dom/UserActionElementSet.cpp index 9657217..4c80c82 100644 --- a/third_party/WebKit/Source/core/dom/UserActionElementSet.cpp +++ b/third_party/WebKit/Source/core/dom/UserActionElementSet.cpp
@@ -62,7 +62,7 @@ unsigned flags) const { DCHECK(element->IsUserActionElement()); ElementFlagMap::const_iterator found = - elements_.Find(const_cast<Element*>(element)); + elements_.find(const_cast<Element*>(element)); if (found == elements_.end()) return false; return found->value & flags; @@ -70,11 +70,11 @@ inline void UserActionElementSet::ClearFlags(Element* element, unsigned flags) { if (!element->IsUserActionElement()) { - DCHECK(elements_.end() == elements_.Find(element)); + DCHECK(elements_.end() == elements_.find(element)); return; } - ElementFlagMap::iterator found = elements_.Find(element); + ElementFlagMap::iterator found = elements_.find(element); if (found == elements_.end()) { element->SetUserActionElement(false); return; @@ -91,7 +91,7 @@ } inline void UserActionElementSet::SetFlags(Element* element, unsigned flags) { - ElementFlagMap::iterator result = elements_.Find(element); + ElementFlagMap::iterator result = elements_.find(element); if (result != elements_.end()) { DCHECK(element->IsUserActionElement()); result->value |= flags;
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp index 28a45e7..c0dfb779 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
@@ -196,7 +196,7 @@ definition->EnqueueUpgradeReaction(candidate); // 16: when-defined promise processing - const auto& entry = when_defined_promise_map_.Find(name); + const auto& entry = when_defined_promise_map_.find(name); if (entry != when_defined_promise_map_.end()) { entry->value->Resolve(); when_defined_promise_map_.erase(entry); @@ -259,7 +259,7 @@ const AtomicString& name = candidate->localName(); if (NameIsDefined(name) || V0NameIsDefined(name)) return; - UpgradeCandidateMap::iterator it = upgrade_candidates_->Find(name); + UpgradeCandidateMap::iterator it = upgrade_candidates_->find(name); UpgradeCandidateSet* set; if (it != upgrade_candidates_->end()) { set = it->value; @@ -292,7 +292,7 @@ void CustomElementRegistry::CollectCandidates( const CustomElementDescriptor& desc, HeapVector<Member<Element>>* elements) { - UpgradeCandidateMap::iterator it = upgrade_candidates_->Find(desc.GetName()); + UpgradeCandidateMap::iterator it = upgrade_candidates_->find(desc.GetName()); if (it == upgrade_candidates_->end()) return; CustomElementUpgradeSorter sorter;
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp index f40ca1f..5a5f3ee 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp
@@ -73,7 +73,7 @@ void CustomElementUpgradeSorter::Sorted(HeapVector<Member<Element>>* result, Node* parent) { - ParentChildMap::iterator children_iterator = parent_child_map_->Find(parent); + ParentChildMap::iterator children_iterator = parent_child_map_->find(parent); if (children_iterator == parent_child_map_->end()) return; @@ -89,11 +89,11 @@ ShadowRoot* shadow_root = parent->IsElementNode() ? ToElement(parent)->AuthorShadowRoot() : nullptr; if (shadow_root) - Visit(result, *children, children->Find(shadow_root)); + Visit(result, *children, children->find(shadow_root)); for (Element* e = ElementTraversal::FirstChild(*parent); e && children->size() > 1; e = ElementTraversal::NextSibling(*e)) { - Visit(result, *children, children->Find(e)); + Visit(result, *children, children->find(e)); } if (children->size() == 1)
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp b/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp index e6a6a008..c7f5245 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp +++ b/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp
@@ -45,7 +45,7 @@ } void V0CustomElementObserver::NotifyElementWasDestroyed(Element* element) { - ElementObserverMap::iterator it = ElementObservers().Find(element); + ElementObserverMap::iterator it = ElementObservers().find(element); if (it == ElementObservers().end()) return; it->value->ElementWasDestroyed(element);
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp b/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp index 666e7166..416b7550 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp +++ b/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp
@@ -51,7 +51,7 @@ DCHECK(result.is_new_entry); UnresolvedDefinitionMap::iterator it = - unresolved_definitions_.Find(descriptor); + unresolved_definitions_.find(descriptor); ElementSet* elements; if (it == unresolved_definitions_.end()) elements = unresolved_definitions_.insert(descriptor, new ElementSet()) @@ -63,11 +63,11 @@ void V0CustomElementUpgradeCandidateMap::ElementWasDestroyed(Element* element) { V0CustomElementObserver::ElementWasDestroyed(element); - UpgradeCandidateMap::iterator candidate = upgrade_candidates_.Find(element); + UpgradeCandidateMap::iterator candidate = upgrade_candidates_.find(element); SECURITY_DCHECK(candidate != upgrade_candidates_.end()); UnresolvedDefinitionMap::iterator elements = - unresolved_definitions_.Find(candidate->value); + unresolved_definitions_.find(candidate->value); SECURITY_DCHECK(elements != unresolved_definitions_.end()); elements->value->erase(element); upgrade_candidates_.erase(candidate);
diff --git a/third_party/WebKit/Source/core/dom/shadow/DistributedNodes.cpp b/third_party/WebKit/Source/core/dom/shadow/DistributedNodes.cpp index 93411f6..415b5e0 100644 --- a/third_party/WebKit/Source/core/dom/shadow/DistributedNodes.cpp +++ b/third_party/WebKit/Source/core/dom/shadow/DistributedNodes.cpp
@@ -45,7 +45,7 @@ size_t DistributedNodes::Find(const Node* node) const { HeapHashMap<Member<const Node>, size_t>::const_iterator it = - indices_.Find(node); + indices_.find(node); if (it == indices_.end()) return kNotFound;
diff --git a/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp b/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp index ff25c27..3f0fff1e 100644 --- a/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp +++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp
@@ -145,7 +145,7 @@ DCHECK(key); DCHECK(!key->NeedsDistributionRecalc()); NodeToDestinationInsertionPoints::const_iterator it = - node_to_insertion_points_.Find(key); + node_to_insertion_points_.find(key); return it == node_to_insertion_points_.end() ? nullptr : it->value->back(); } @@ -154,7 +154,7 @@ DCHECK(key); DCHECK(!key->NeedsDistributionRecalc()); NodeToDestinationInsertionPoints::const_iterator it = - node_to_insertion_points_.Find(key); + node_to_insertion_points_.find(key); return it == node_to_insertion_points_.end() ? nullptr : it->value; }
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp index 0a20380..076e67b 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -482,7 +482,7 @@ return; DCHECK(!markers_.IsEmpty()); - MarkerMap::iterator iterator = markers_.Find(node); + MarkerMap::iterator iterator = markers_.find(node); if (iterator != markers_.end()) RemoveMarkersFromList(iterator, marker_types); } @@ -515,7 +515,7 @@ CopyKeysToVector(markers_, nodes_with_markers); unsigned size = nodes_with_markers.size(); for (unsigned i = 0; i < size; ++i) { - MarkerMap::iterator iterator = markers_.Find(nodes_with_markers[i]); + MarkerMap::iterator iterator = markers_.find(nodes_with_markers[i]); if (iterator != markers_.end()) RemoveMarkersFromList(iterator, marker_types); }
diff --git a/third_party/WebKit/Source/core/events/EventPath.cpp b/third_party/WebKit/Source/core/events/EventPath.cpp index 4f60a86..27e9af7 100644 --- a/third_party/WebKit/Source/core/events/EventPath.cpp +++ b/third_party/WebKit/Source/core/events/EventPath.cpp
@@ -170,9 +170,9 @@ root_tree = tree_scope_event_context.Get(); continue; } - DCHECK_NE(tree_scope_event_context_map.Find(parent), + DCHECK_NE(tree_scope_event_context_map.find(parent), tree_scope_event_context_map.end()); - tree_scope_event_context_map.Find(parent)->value->AddChild( + tree_scope_event_context_map.find(parent)->value->AddChild( *tree_scope_event_context.Get()); } DCHECK(root_tree); @@ -259,7 +259,7 @@ for (TreeScope* current = &scope; current; current = current->OlderShadowRootOrParentTreeScope()) { parent_tree_scopes.push_back(current); - RelatedTargetMap::const_iterator iter = related_target_map.Find(current); + RelatedTargetMap::const_iterator iter = related_target_map.find(current); if (iter != related_target_map.end() && iter->value) { related_node = iter->value; break;
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.cpp b/third_party/WebKit/Source/core/fileapi/FileReader.cpp index 9de8572..f36ed870 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReader.cpp +++ b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
@@ -141,7 +141,7 @@ } FinishReaderType RemoveReader(FileReader* reader) { - FileReaderHashSet::const_iterator hash_iter = running_readers_.Find(reader); + FileReaderHashSet::const_iterator hash_iter = running_readers_.find(reader); if (hash_iter != running_readers_.end()) { running_readers_.erase(hash_iter); return kRunPendingReaders;
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index 68b5d04..6f3db2e 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -3802,7 +3802,7 @@ if (!resizer_areas_) return; - ResizerAreaSet::iterator it = resizer_areas_->Find(&resizer_box); + ResizerAreaSet::iterator it = resizer_areas_->find(&resizer_box); if (it != resizer_areas_->end()) resizer_areas_->erase(it); }
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 60df1d23..4f9e243c 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -92,13 +92,13 @@ #include "platform/json/JSONValues.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/plugins/PluginData.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/text/TextStream.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/StdLibExtras.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/InterfaceRegistry.h" #include "public/platform/WebScreenInfo.h" -#include "public/platform/WebViewScheduler.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp index 13a5ff6..54d335f 100644 --- a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp +++ b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
@@ -7,9 +7,9 @@ #include "core/layout/ScrollAlignment.h" #include "platform/geometry/DoubleRect.h" #include "platform/geometry/LayoutRect.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/html/BUILD.gn b/third_party/WebKit/Source/core/html/BUILD.gn index 253fa3f..afa717b3 100644 --- a/third_party/WebKit/Source/core/html/BUILD.gn +++ b/third_party/WebKit/Source/core/html/BUILD.gn
@@ -483,8 +483,6 @@ "shadow/DetailsMarkerControl.h", "shadow/MediaControlElementTypes.cpp", "shadow/MediaControlElementTypes.h", - "shadow/MediaControlElements.cpp", - "shadow/MediaControlElements.h", "shadow/MediaRemotingElements.cpp", "shadow/MediaRemotingElements.h", "shadow/MediaRemotingInterstitial.cpp",
diff --git a/third_party/WebKit/Source/core/html/HTMLCollection.h b/third_party/WebKit/Source/core/html/HTMLCollection.h index 2517c97..7b435fe 100644 --- a/third_party/WebKit/Source/core/html/HTMLCollection.h +++ b/third_party/WebKit/Source/core/html/HTMLCollection.h
@@ -124,14 +124,14 @@ const HeapVector<Member<Element>>* GetElementsById( const AtomicString& id) const { - auto it = id_cache_.Find(id.Impl()); + auto it = id_cache_.find(id.Impl()); if (it == id_cache_.end()) return nullptr; return &it->value; } const HeapVector<Member<Element>>* GetElementsByName( const AtomicString& name) const { - auto it = name_cache_.Find(name.Impl()); + auto it = name_cache_.find(name.Impl()); if (it == name_cache_.end()) return nullptr; return &it->value;
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index 6bf0562..42d58c9 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -196,7 +196,7 @@ void AddElementToDocumentMap(HTMLMediaElement* element, Document* document) { DocumentElementSetMap& map = DocumentToElementSetMap(); WeakMediaElementSet* set = nullptr; - auto it = map.Find(document); + auto it = map.find(document); if (it == map.end()) { set = new WeakMediaElementSet; map.insert(document, set); @@ -209,7 +209,7 @@ void RemoveElementFromDocumentMap(HTMLMediaElement* element, Document* document) { DocumentElementSetMap& map = DocumentToElementSetMap(); - auto it = map.Find(document); + auto it = map.find(document); DCHECK(it != map.end()); WeakMediaElementSet* set = it->value; set->erase(element); @@ -411,7 +411,7 @@ // static void HTMLMediaElement::OnMediaControlsEnabledChange(Document* document) { - auto it = DocumentToElementSetMap().Find(document); + auto it = DocumentToElementSetMap().find(document); if (it == DocumentToElementSetMap().end()) return; DCHECK(it->value); @@ -3617,7 +3617,7 @@ void HTMLMediaElement::SetTextTrackKindUserPreferenceForAllMediaElements( Document* document) { - auto it = DocumentToElementSetMap().Find(document); + auto it = DocumentToElementSetMap().find(document); if (it == DocumentToElementSetMap().end()) return; DCHECK(it->value);
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp index 16bdf79..9848b3df5 100644 --- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -158,7 +158,7 @@ Node* HTMLSlotElement::DistributedNodeNextTo(const Node& node) const { DCHECK(SupportsDistribution()); - const auto& it = distributed_indices_.Find(&node); + const auto& it = distributed_indices_.find(&node); if (it == distributed_indices_.end()) return nullptr; size_t index = it->value; @@ -169,7 +169,7 @@ Node* HTMLSlotElement::DistributedNodePreviousTo(const Node& node) const { DCHECK(SupportsDistribution()); - const auto& it = distributed_indices_.Find(&node); + const auto& it = distributed_indices_.find(&node); if (it == distributed_indices_.end()) return nullptr; size_t index = it->value;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index 1f5bf32a1..c7e6464 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -14,12 +14,12 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/image-encoders/JPEGImageEncoder.h" #include "platform/image-encoders/PNGImageEncoder.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/threading/BackgroundTaskRunner.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/Functional.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h"
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp index 31deffbd..b10ef08 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
@@ -56,7 +56,7 @@ bool CanvasFontCache::GetFontUsingDefaultStyle(const String& font_string, Font& resolved_font) { HashMap<String, Font>::iterator i = - fonts_resolved_using_default_style_.Find(font_string); + fonts_resolved_using_default_style_.find(font_string); if (i != fonts_resolved_using_default_style_.end()) { ASSERT(font_lru_list_.Contains(font_string)); font_lru_list_.erase(font_string); @@ -75,13 +75,13 @@ document_->EnsureStyleResolver().ComputeFont(font_style.Get(), *parsed_style); fonts_resolved_using_default_style_.insert(font_string, font_style->GetFont()); - resolved_font = fonts_resolved_using_default_style_.Find(font_string)->value; + resolved_font = fonts_resolved_using_default_style_.find(font_string)->value; return true; } MutableStylePropertySet* CanvasFontCache::ParseFont(const String& font_string) { MutableStylePropertySet* parsed_style; - MutableStylePropertyMap::iterator i = fetched_fonts_.Find(font_string); + MutableStylePropertyMap::iterator i = fetched_fonts_.find(font_string); if (i != fetched_fonts_.end()) { ASSERT(font_lru_list_.Contains(font_string)); parsed_style = i->value; @@ -140,7 +140,7 @@ } bool CanvasFontCache::IsInCache(const String& font_string) { - return fetched_fonts_.Find(font_string) != fetched_fonts_.end(); + return fetched_fonts_.find(font_string) != fetched_fonts_.end(); } void CanvasFontCache::PruneAll() {
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.cpp b/third_party/WebKit/Source/core/html/forms/FormController.cpp index 4ce9561..f92668e 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.cpp +++ b/third_party/WebKit/Source/core/html/forms/FormController.cpp
@@ -257,7 +257,7 @@ const AtomicString& type, const FormControlState& state) { FormElementKey key(name.Impl(), type.Impl()); - FormElementStateMap::iterator it = state_for_new_form_elements_.Find(key); + FormElementStateMap::iterator it = state_for_new_form_elements_.find(key); if (it != state_for_new_form_elements_.end()) { it->value.push_back(state); } else { @@ -272,7 +272,7 @@ const AtomicString& type) { if (state_for_new_form_elements_.IsEmpty()) return FormControlState(); - FormElementStateMap::iterator it = state_for_new_form_elements_.Find( + FormElementStateMap::iterator it = state_for_new_form_elements_.find( FormElementKey(name.Impl(), type.Impl())); if (it == state_for_new_form_elements_.end()) return FormControlState(); @@ -371,7 +371,7 @@ ("No owner")); return form_key_for_no_owner; } - FormToKeyMap::const_iterator it = form_to_key_map_.Find(form); + FormToKeyMap::const_iterator it = form_to_key_map_.find(form); if (it != form_to_key_map_.end()) return it->value; @@ -485,7 +485,7 @@ if (!form_key_generator_) form_key_generator_ = FormKeyGenerator::Create(); SavedFormStateMap::iterator it = - saved_form_state_map_.Find(form_key_generator_->FormKey(control)); + saved_form_state_map_.find(form_key_generator_->FormKey(control)); if (it == saved_form_state_map_.end()) return FormControlState(); FormControlState state =
diff --git a/third_party/WebKit/Source/core/html/forms/InputType.cpp b/third_party/WebKit/Source/core/html/forms/InputType.cpp index dcad982..5f1912e 100644 --- a/third_party/WebKit/Source/core/html/forms/InputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/InputType.cpp
@@ -136,7 +136,7 @@ const AtomicString& type_name) { if (type_name.IsEmpty()) return InputTypeNames::text; - InputTypeFactoryMap::const_iterator it = FactoryMap()->Find(type_name); + InputTypeFactoryMap::const_iterator it = FactoryMap()->find(type_name); return it == FactoryMap()->end() ? InputTypeNames::text : it->key; }
diff --git a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp index 4e305ad3..4eed380a 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp +++ b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp
@@ -133,7 +133,7 @@ void RadioButtonGroup::RequiredAttributeChanged(HTMLInputElement* button) { DCHECK_EQ(button->type(), InputTypeNames::radio); - auto it = members_.Find(button); + auto it = members_.find(button); DCHECK_NE(it, members_.end()); bool was_valid = IsValid(); // Synchronize the 'required' flag for the button, along with @@ -145,7 +145,7 @@ void RadioButtonGroup::Remove(HTMLInputElement* button) { DCHECK_EQ(button->type(), InputTypeNames::radio); - auto it = members_.Find(button); + auto it = members_.find(button); if (it == members_.end()) return; bool was_valid = IsValid();
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp index 778b1dfe..505ebc50 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -100,7 +100,8 @@ const MediaValuesCached::MediaValuesCachedData& media_values_cached_data) { preload_scanner_.reset(new TokenPreloadScanner( document_url, std::move(cached_document_parameters), - media_values_cached_data)); + media_values_cached_data, + TokenPreloadScanner::ScannerType::kMainDocument)); } BackgroundHTMLParser::Configuration::Configuration()
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index 994fdea..2806615 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -54,11 +54,11 @@ #include "platform/heap/Handle.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/ResourceFetcher.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/AutoReset.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" #include "public/platform/WebLoadingBehaviorFlag.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink { @@ -722,7 +722,8 @@ // crbug.com/465478 if (preloader_) { if (!preload_scanner_) { - preload_scanner_ = CreatePreloadScanner(); + preload_scanner_ = CreatePreloadScanner( + TokenPreloadScanner::ScannerType::kMainDocument); preload_scanner_->AppendToEnd(input_.Current()); } ScanAndPreload(preload_scanner_.get()); @@ -797,8 +798,10 @@ if (IsPaused()) { // Check the document.write() output with a separate preload scanner as // the main scanner can't deal with insertions. - if (!insertion_preload_scanner_) - insertion_preload_scanner_ = CreatePreloadScanner(); + if (!insertion_preload_scanner_) { + insertion_preload_scanner_ = + CreatePreloadScanner(TokenPreloadScanner::ScannerType::kInsertion); + } insertion_preload_scanner_->AppendToEnd(source); ScanAndPreload(insertion_preload_scanner_.get()); } @@ -899,8 +902,10 @@ if (GetDocument()->Loader()->GetResponse().AppCacheID() != 0) return; - if (!preload_scanner_) - preload_scanner_ = CreatePreloadScanner(); + if (!preload_scanner_) { + preload_scanner_ = + CreatePreloadScanner(TokenPreloadScanner::ScannerType::kMainDocument); + } preload_scanner_->AppendToEnd(source); ScanAndPreload(preload_scanner_.get()); @@ -1256,11 +1261,12 @@ FetchQueuedPreloads(); } -std::unique_ptr<HTMLPreloadScanner> HTMLDocumentParser::CreatePreloadScanner() { +std::unique_ptr<HTMLPreloadScanner> HTMLDocumentParser::CreatePreloadScanner( + TokenPreloadScanner::ScannerType scanner_type) { return HTMLPreloadScanner::Create( options_, GetDocument()->Url(), CachedDocumentParameters::Create(GetDocument()), - MediaValuesCached::MediaValuesCachedData(*GetDocument())); + MediaValuesCached::MediaValuesCachedData(*GetDocument()), scanner_type); } void HTMLDocumentParser::ScanAndPreload(HTMLPreloadScanner* scanner) { @@ -1306,7 +1312,8 @@ int current_preload_count = GetDocument()->Loader()->Fetcher()->CountPreloads(); - std::unique_ptr<HTMLPreloadScanner> scanner = CreatePreloadScanner(); + std::unique_ptr<HTMLPreloadScanner> scanner = + CreatePreloadScanner(TokenPreloadScanner::ScannerType::kInsertion); scanner->AppendToEnd(SegmentedString(written_source)); ScanAndPreload(scanner.get());
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h index 28ef5ee..11ed0f8 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
@@ -223,7 +223,8 @@ IsExecutingScript(); } - std::unique_ptr<HTMLPreloadScanner> CreatePreloadScanner(); + std::unique_ptr<HTMLPreloadScanner> CreatePreloadScanner( + TokenPreloadScanner::ScannerType); // Let the given HTMLPreloadScanner scan the input it has, and then preloads // resources using the resulting PreloadRequests and |m_preloader|.
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp index 97e99a0..29e888e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
@@ -466,7 +466,7 @@ const WTF::StaticStringsTable& table = StringImpl::AllStaticStrings(); DCHECK(!table.IsEmpty()); - WTF::StaticStringsTable::const_iterator it = table.Find(hash); + WTF::StaticStringsTable::const_iterator it = table.find(hash); if (it == table.end()) return nullptr; // It's possible to have hash collisions between arbitrary strings and known
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp index 68a4d096..7b3767c 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
@@ -28,10 +28,10 @@ #include "core/dom/Document.h" #include "core/frame/FrameView.h" #include "core/html/parser/HTMLDocumentParser.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp index afbd3748..8b065f6a 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -136,7 +136,9 @@ STACK_ALLOCATED(); public: - StartTagScanner(const StringImpl* tag_impl, MediaValuesCached* media_values) + StartTagScanner(const StringImpl* tag_impl, + MediaValuesCached* media_values, + TokenPreloadScanner::ScannerType scanner_type) : tag_impl_(tag_impl), link_is_style_sheet_(false), link_is_preconnect_(false), @@ -151,7 +153,8 @@ cross_origin_(kCrossOriginAttributeNotSet), media_values_(media_values), referrer_policy_set_(false), - referrer_policy_(kReferrerPolicyDefault) { + referrer_policy_(kReferrerPolicyDefault), + scanner_type_(scanner_type) { if (Match(tag_impl_, imgTag) || Match(tag_impl_, sourceTag)) { source_size_ = SizesAttributeParser(media_values_, String()).length(); return; @@ -258,6 +261,8 @@ request->SetCharset(Charset()); request->SetDefer(defer_); request->SetIntegrityMetadata(integrity_metadata_); + if (scanner_type_ == ScannerType::kInsertion) + request->SetFromInsertionScanner(true); return request; } @@ -574,12 +579,14 @@ bool referrer_policy_set_; ReferrerPolicy referrer_policy_; IntegrityMetadataSet integrity_metadata_; + TokenPreloadScanner::ScannerType scanner_type_; }; TokenPreloadScanner::TokenPreloadScanner( const KURL& document_url, std::unique_ptr<CachedDocumentParameters> document_parameters, - const MediaValuesCached::MediaValuesCachedData& media_values_cached_data) + const MediaValuesCached::MediaValuesCachedData& media_values_cached_data, + const ScannerType scanner_type) : document_url_(document_url), in_style_(false), in_picture_(false), @@ -587,6 +594,7 @@ template_count_(0), document_parameters_(std::move(document_parameters)), media_values_(MediaValuesCached::Create(media_values_cached_data)), + scanner_type_(scanner_type), did_rewind_(false) { DCHECK(document_parameters_.get()); DCHECK(media_values_.Get()); @@ -854,7 +862,7 @@ return; } - StartTagScanner scanner(tag_impl, media_values_); + StartTagScanner scanner(tag_impl, media_values_, scanner_type_); scanner.ProcessAttributes(token.Attributes()); // TODO(yoav): ViewportWidth is currently racy and might be zero in some // cases, at least in tests. That problem will go away once @@ -888,10 +896,12 @@ const HTMLParserOptions& options, const KURL& document_url, std::unique_ptr<CachedDocumentParameters> document_parameters, - const MediaValuesCached::MediaValuesCachedData& media_values_cached_data) + const MediaValuesCached::MediaValuesCachedData& media_values_cached_data, + const TokenPreloadScanner::ScannerType scanner_type) : scanner_(document_url, std::move(document_parameters), - media_values_cached_data), + media_values_cached_data, + scanner_type), tokenizer_(HTMLTokenizer::Create(options)) {} HTMLPreloadScanner::~HTMLPreloadScanner() {}
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h index d5936af..9971f77b 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h
@@ -82,9 +82,12 @@ USING_FAST_MALLOC(TokenPreloadScanner); public: + enum class ScannerType { kMainDocument, kInsertion }; + TokenPreloadScanner(const KURL& document_url, std::unique_ptr<CachedDocumentParameters>, - const MediaValuesCached::MediaValuesCachedData&); + const MediaValuesCached::MediaValuesCachedData&, + const ScannerType); ~TokenPreloadScanner(); void Scan(const HTMLToken&, @@ -162,6 +165,7 @@ std::unique_ptr<CachedDocumentParameters> document_parameters_; Persistent<MediaValuesCached> media_values_; ClientHintsPreferences client_hints_preferences_; + ScannerType scanner_type_; bool did_rewind_ = false; @@ -177,11 +181,11 @@ const HTMLParserOptions& options, const KURL& document_url, std::unique_ptr<CachedDocumentParameters> document_parameters, - const MediaValuesCached::MediaValuesCachedData& - media_values_cached_data) { + const MediaValuesCached::MediaValuesCachedData& media_values_cached_data, + const TokenPreloadScanner::ScannerType scanner_type) { return WTF::WrapUnique(new HTMLPreloadScanner( options, document_url, std::move(document_parameters), - media_values_cached_data)); + media_values_cached_data, scanner_type)); } ~HTMLPreloadScanner(); @@ -194,7 +198,8 @@ HTMLPreloadScanner(const HTMLParserOptions&, const KURL& document_url, std::unique_ptr<CachedDocumentParameters>, - const MediaValuesCached::MediaValuesCachedData&); + const MediaValuesCached::MediaValuesCachedData&, + const TokenPreloadScanner::ScannerType); TokenPreloadScanner scanner_; SegmentedString source_;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerFuzzer.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerFuzzer.cpp index 794dcd55..60e5765 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerFuzzer.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerFuzzer.cpp
@@ -64,7 +64,8 @@ MockResourcePreloader preloader; std::unique_ptr<HTMLPreloadScanner> scanner = HTMLPreloadScanner::Create( - options, document_url, std::move(document_parameters), media_data); + options, document_url, std::move(document_parameters), media_data, + TokenPreloadScanner::ScannerType::kMainDocument); TextResourceDecoderForFuzzing decoder(fuzzed_data); CString bytes = fuzzed_data.ConsumeRemainingBytes();
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp index ca30bb2..3e746aad 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
@@ -189,7 +189,8 @@ scanner_ = HTMLPreloadScanner::Create( options, document_url, CachedDocumentParameters::Create(&dummy_page_holder_->GetDocument()), - CreateMediaValuesData()); + CreateMediaValuesData(), + TokenPreloadScanner::ScannerType::kMainDocument); } void SetUp() override { RunSetUp(kViewportEnabled); }
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp b/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp index aa0d19e..71c4353 100644 --- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp +++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp
@@ -77,7 +77,13 @@ params.SetCharset(charset_.IsEmpty() ? document->characterSet().GetString() : charset_); } - params.SetSpeculativePreload(true, discovery_time_); + FetchParameters::SpeculativePreloadType speculative_preload_type = + FetchParameters::SpeculativePreloadType::kInDocument; + if (from_insertion_scanner_) { + speculative_preload_type = + FetchParameters::SpeculativePreloadType::kInserted; + } + params.SetSpeculativePreloadType(speculative_preload_type, discovery_time_); return document->Loader()->StartPreload(resource_type_, params); }
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h index 5ce1490..cecfccbf 100644 --- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h +++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -98,6 +98,9 @@ const IntegrityMetadataSet& IntegrityMetadata() const { return integrity_metadata_; } + void SetFromInsertionScanner(const bool from_insertion_scanner) { + from_insertion_scanner_ = from_insertion_scanner; + } private: PreloadRequest(const String& initiator_name, @@ -122,7 +125,8 @@ client_hints_preferences_(client_hints_preferences), request_type_(request_type), referrer_policy_(referrer_policy), - referrer_source_(referrer_source) {} + referrer_source_(referrer_source), + from_insertion_scanner_(false) {} KURL CompleteURL(Document*); @@ -142,6 +146,7 @@ ReferrerPolicy referrer_policy_; ReferrerSource referrer_source_; IntegrityMetadataSet integrity_metadata_; + bool from_insertion_scanner_; }; typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream;
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp deleted file mode 100644 index 32fe370..0000000 --- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp +++ /dev/null
@@ -1,162 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "core/html/shadow/MediaControlElements.h" - -#include "bindings/core/v8/ExceptionState.h" -#include "core/InputTypeNames.h" -#include "core/dom/ClientRect.h" -#include "core/dom/TaskRunnerHelper.h" -#include "core/dom/Text.h" -#include "core/dom/shadow/ShadowRoot.h" -#include "core/events/KeyboardEvent.h" -#include "core/frame/LocalFrame.h" -#include "core/frame/UseCounter.h" -#include "core/html/HTMLVideoElement.h" -#include "core/html/media/MediaControls.h" -#include "core/html/shadow/ShadowElementNames.h" -#include "core/html/track/TextTrackList.h" -#include "core/input/EventHandler.h" -#include "core/layout/LayoutBoxModelObject.h" -#include "core/layout/api/LayoutSliderItem.h" -#include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" -#include "public/platform/Platform.h" -#include "public/platform/UserMetricsAction.h" - -namespace blink { - -using namespace HTMLNames; - -namespace { - -bool IsUserInteractionEvent(Event* event) { - const AtomicString& type = event->type(); - return type == EventTypeNames::mousedown || type == EventTypeNames::mouseup || - type == EventTypeNames::click || type == EventTypeNames::dblclick || - event->IsKeyboardEvent() || event->IsTouchEvent(); -} - -// Sliders (the volume control and timeline) need to capture some additional -// events used when dragging the thumb. -bool IsUserInteractionEventForSlider(Event* event, - LayoutObject* layout_object) { - // It is unclear if this can be converted to isUserInteractionEvent(), since - // mouse* events seem to be eaten during a drag anyway. crbug.com/516416 . - if (IsUserInteractionEvent(event)) - return true; - - // Some events are only captured during a slider drag. - LayoutSliderItem slider = LayoutSliderItem(ToLayoutSlider(layout_object)); - // TODO(crbug.com/695459#c1): LayoutSliderItem::inDragMode is incorrectly - // false for drags that start from the track instead of the thumb. - // Use SliderThumbElement::m_inDragMode and - // SliderContainerElement::m_touchStarted instead. - if (!slider.IsNull() && !slider.InDragMode()) - return false; - - const AtomicString& type = event->type(); - return type == EventTypeNames::mouseover || - type == EventTypeNames::mouseout || - type == EventTypeNames::mousemove || - type == EventTypeNames::pointerover || - type == EventTypeNames::pointerout || - type == EventTypeNames::pointermove; -} - -} // anonymous namespace - -MediaControlVolumeSliderElement::MediaControlVolumeSliderElement( - MediaControls& media_controls) - : MediaControlInputElement(media_controls, kMediaVolumeSlider) {} - -MediaControlVolumeSliderElement* MediaControlVolumeSliderElement::Create( - MediaControls& media_controls) { - MediaControlVolumeSliderElement* slider = - new MediaControlVolumeSliderElement(media_controls); - slider->EnsureUserAgentShadowRoot(); - slider->setType(InputTypeNames::range); - slider->setAttribute(stepAttr, "any"); - slider->setAttribute(maxAttr, "1"); - slider->SetShadowPseudoId( - AtomicString("-webkit-media-controls-volume-slider")); - return slider; -} - -void MediaControlVolumeSliderElement::DefaultEventHandler(Event* event) { - if (!isConnected() || !GetDocument().IsActive()) - return; - - MediaControlInputElement::DefaultEventHandler(event); - - if (event->type() == EventTypeNames::mousedown) - Platform::Current()->RecordAction( - UserMetricsAction("Media.Controls.VolumeChangeBegin")); - - if (event->type() == EventTypeNames::mouseup) - Platform::Current()->RecordAction( - UserMetricsAction("Media.Controls.VolumeChangeEnd")); - - if (event->type() == EventTypeNames::input) { - double volume = value().ToDouble(); - MediaElement().setVolume(volume); - MediaElement().setMuted(false); - if (LayoutObject* layout_object = this->GetLayoutObject()) - layout_object->SetShouldDoFullPaintInvalidation(); - } -} - -bool MediaControlVolumeSliderElement::WillRespondToMouseMoveEvents() { - if (!isConnected() || !GetDocument().IsActive()) - return false; - - return MediaControlInputElement::WillRespondToMouseMoveEvents(); -} - -bool MediaControlVolumeSliderElement::WillRespondToMouseClickEvents() { - if (!isConnected() || !GetDocument().IsActive()) - return false; - - return MediaControlInputElement::WillRespondToMouseClickEvents(); -} - -void MediaControlVolumeSliderElement::SetVolume(double volume) { - if (value().ToDouble() == volume) - return; - - setValue(String::Number(volume)); - if (LayoutObject* layout_object = this->GetLayoutObject()) - layout_object->SetShouldDoFullPaintInvalidation(); -} - -bool MediaControlVolumeSliderElement::KeepEventInNode(Event* event) { - return IsUserInteractionEventForSlider(event, GetLayoutObject()); -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.h b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.h deleted file mode 100644 index af98e73c..0000000 --- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.h +++ /dev/null
@@ -1,55 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MediaControlElements_h -#define MediaControlElements_h - -#include "core/html/shadow/MediaControlElementTypes.h" - -namespace blink { - -class CORE_EXPORT MediaControlVolumeSliderElement final - : public MediaControlInputElement { - public: - static MediaControlVolumeSliderElement* Create(MediaControls&); - - bool WillRespondToMouseMoveEvents() override; - bool WillRespondToMouseClickEvents() override; - void SetVolume(double); - - private: - explicit MediaControlVolumeSliderElement(MediaControls&); - - void DefaultEventHandler(Event*) override; - bool KeepEventInNode(Event*) override; -}; - -} // namespace blink - -#endif // MediaControlElements_h
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp index 27364c2b..b67374f 100644 --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -532,10 +532,10 @@ EventTarget** pending_pointer_capture_target) { PointerCapturingMap::const_iterator it; - it = pointer_capture_target_.Find(pointer_id); + it = pointer_capture_target_.find(pointer_id); EventTarget* pointer_capture_target_temp = (it != pointer_capture_target_.end()) ? it->value : nullptr; - it = pending_pointer_capture_target_.Find(pointer_id); + it = pending_pointer_capture_target_.find(pointer_id); EventTarget* pending_pointercapture_target_temp = (it != pending_pointer_capture_target_.end()) ? it->value : nullptr; @@ -556,7 +556,7 @@ ProcessPendingPointerCapture(pointer_event); PointerCapturingMap::const_iterator it = - pointer_capture_target_.Find(pointer_event->pointerId()); + pointer_capture_target_.find(pointer_event->pointerId()); if (EventTarget* pointercapture_target = (it != pointer_capture_target_.end()) ? it->value : nullptr) hit_test_target = pointercapture_target;
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp index bf8c9d6a..99328b9 100644 --- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp +++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -162,11 +162,11 @@ // Ensure this target's touch list exists, even if it ends up empty, so // it can always be passed to TouchEvent::Create below. TargetTouchesHeapMap::iterator target_touches_iterator = - touches_by_target.Find(touch_info.touch_node.Get()); + touches_by_target.find(touch_info.touch_node.Get()); if (target_touches_iterator == touches_by_target.end()) { touches_by_target.Set(touch_info.touch_node.Get(), TouchList::Create()); target_touches_iterator = - touches_by_target.Find(touch_info.touch_node.Get()); + touches_by_target.find(touch_info.touch_node.Get()); } // |touches| and |targetTouches| should only contain information about
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp index b3f155c..a5a76bf 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp
@@ -276,7 +276,7 @@ if (new_it.value.size() != 1) continue; - DiffTable::iterator old_it = old_table.Find(new_it.key); + DiffTable::iterator old_it = old_table.find(new_it.key); if (old_it == old_table.end() || old_it->value.size() != 1) continue; @@ -521,7 +521,7 @@ // whether new DOM has a digest with matching sha1. If it does, replace it // with the original DOM chunk. Chances are high that it will get merged back // into the original DOM during the further patching. - UnusedNodesMap::iterator it = unused_nodes_map_.Find(old_digest->sha1_); + UnusedNodesMap::iterator it = unused_nodes_map_.find(old_digest->sha1_); if (it != unused_nodes_map_.end()) { Digest* new_digest = it->value; Node* new_node = new_digest->node_;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp index a3d3fda..78b1fa9 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -856,7 +856,7 @@ return; NodeIdToForcedPseudoState::iterator it = - node_id_to_forced_pseudo_state_.Find(node_id); + node_id_to_forced_pseudo_state_.find(node_id); if (it == node_id_to_forced_pseudo_state_.end()) return; @@ -1572,7 +1572,7 @@ unsigned forced_pseudo_state = ComputePseudoClassMask(std::move(forced_pseudo_classes)); NodeIdToForcedPseudoState::iterator it = - node_id_to_forced_pseudo_state_.Find(node_id); + node_id_to_forced_pseudo_state_.find(node_id); unsigned current_forced_pseudo_state = it == node_id_to_forced_pseudo_state_.end() ? 0 : it->value; bool need_style_recalc = forced_pseudo_state != current_forced_pseudo_state; @@ -1784,7 +1784,7 @@ InspectorStyleSheetForInlineStyle* InspectorCSSAgent::AsInspectorStyleSheet( Element* element) { NodeToInspectorStyleSheet::iterator it = - node_to_inspector_style_sheet_.Find(element); + node_to_inspector_style_sheet_.find(element); if (it != node_to_inspector_style_sheet_.end()) return it->value.Get(); @@ -1893,7 +1893,7 @@ const String& style_sheet_id, InspectorStyleSheet*& result) { IdToInspectorStyleSheet::iterator it = - id_to_inspector_style_sheet_.Find(style_sheet_id); + id_to_inspector_style_sheet_.find(style_sheet_id); if (it == id_to_inspector_style_sheet_.end()) return Response::Error("No style sheet with given id found"); result = it->value.Get(); @@ -1911,7 +1911,7 @@ return response; } IdToInspectorStyleSheetForInlineStyle::iterator it = - id_to_inspector_style_sheet_for_inline_style_.Find(style_sheet_id); + id_to_inspector_style_sheet_for_inline_style_.find(style_sheet_id); if (it == id_to_inspector_style_sheet_for_inline_style_.end()) return Response::Error("No style sheet with given id found"); result = it->value.Get(); @@ -2051,7 +2051,7 @@ node_id_to_forced_pseudo_state_.erase(node_id); NodeToInspectorStyleSheet::iterator it = - node_to_inspector_style_sheet_.Find(node); + node_to_inspector_style_sheet_.find(node); if (it == node_to_inspector_style_sheet_.end()) return; @@ -2064,7 +2064,7 @@ return; NodeToInspectorStyleSheet::iterator it = - node_to_inspector_style_sheet_.Find(element); + node_to_inspector_style_sheet_.find(element); if (it == node_to_inspector_style_sheet_.end()) return; @@ -2349,7 +2349,7 @@ if (all_properties_empty) return -1; - ComputedStylesMap::iterator it = style_to_index_map.Find(style); + ComputedStylesMap::iterator it = style_to_index_map.find(style); if (it != style_to_index_map.end()) return it->value;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp index 5947465b..c60e354 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -542,7 +542,7 @@ if (!id) return nullptr; - HeapHashMap<int, Member<Node>>::iterator it = id_to_node_.Find(id); + HeapHashMap<int, Member<Node>>::iterator it = id_to_node_.find(id); if (it != id_to_node_.end()) return it->value; return nullptr; @@ -1088,7 +1088,7 @@ int from_index, int to_index, std::unique_ptr<protocol::Array<int>>* node_ids) { - SearchResults::iterator it = search_results_.Find(search_id); + SearchResults::iterator it = search_results_.find(search_id); if (it == search_results_.end()) return Response::Error("No search session with given id found");
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp index dcfa0c9..a6b6606b 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -414,7 +414,7 @@ } Response InspectorLayerTreeAgent::releaseSnapshot(const String& snapshot_id) { - SnapshotById::iterator it = snapshot_by_id_.Find(snapshot_id); + SnapshotById::iterator it = snapshot_by_id_.find(snapshot_id); if (it == snapshot_by_id_.end()) return Response::Error("Snapshot not found"); snapshot_by_id_.erase(it); @@ -424,7 +424,7 @@ Response InspectorLayerTreeAgent::GetSnapshotById( const String& snapshot_id, const PictureSnapshot*& result) { - SnapshotById::iterator it = snapshot_by_id_.Find(snapshot_id); + SnapshotById::iterator it = snapshot_by_id_.find(snapshot_id); if (it == snapshot_by_id_.end()) return Response::Error("Snapshot not found"); result = it->value.Get();
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 3047b35..c96fd4f 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -629,7 +629,7 @@ initiator_info); if (initiator_info.name == FetchInitiatorTypeNames::document) { FrameNavigationInitiatorMap::iterator it = - frame_navigation_initiator_map_.Find(frame_id); + frame_navigation_initiator_map_.find(frame_id); if (it != frame_navigation_initiator_map_.end()) initiator_object = it->value->clone(); } @@ -972,7 +972,7 @@ DelayedRemoveReplayXHR(xhr); ThreadableLoaderClientRequestIdMap::iterator it = - known_request_id_map_.Find(client); + known_request_id_map_.find(client); if (it == known_request_id_map_.end()) return; known_request_id_map_.erase(client); @@ -993,7 +993,7 @@ const AtomicString& method, const String& url) { ThreadableLoaderClientRequestIdMap::iterator it = - known_request_id_map_.Find(client); + known_request_id_map_.find(client); if (it == known_request_id_map_.end()) return; known_request_id_map_.erase(client); @@ -1012,7 +1012,7 @@ const AtomicString& event_id, const String& data) { ThreadableLoaderClientRequestIdMap::iterator it = - known_request_id_map_.Find(event_source); + known_request_id_map_.find(event_source); if (it == known_request_id_map_.end()) return; GetFrontend()->eventSourceMessageReceived(
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp index e737a2cf..f336232 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -1732,7 +1732,7 @@ size_t index = source_data_->Find(source_data); if (index == kNotFound) return nullptr; - IndexMap::iterator it = source_data_to_rule_.Find(index); + IndexMap::iterator it = source_data_to_rule_.find(index); if (it == source_data_to_rule_.end()) return nullptr; @@ -1755,7 +1755,7 @@ size_t index = cssom_flat_rules_.Find(rule); if (index == kNotFound) return nullptr; - IndexMap::iterator it = rule_to_source_data_.Find(index); + IndexMap::iterator it = rule_to_source_data_.find(index); if (it == rule_to_source_data_.end()) return nullptr;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp index a3d8cdd..0df47f1 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -128,7 +128,7 @@ void InspectorWorkerAgent::WorkerTerminated(WorkerInspectorProxy* proxy) { DCHECK(GetFrontend() && AutoAttachEnabled()); - if (connected_proxies_.Find(proxy->InspectorId()) == connected_proxies_.end()) + if (connected_proxies_.find(proxy->InspectorId()) == connected_proxies_.end()) return; AttachedWorkerIds()->remove(proxy->InspectorId()); GetFrontend()->detachedFromTarget(proxy->InspectorId());
diff --git a/third_party/WebKit/Source/core/layout/BUILD.gn b/third_party/WebKit/Source/core/layout/BUILD.gn index 21e945f5..f8c6a02 100644 --- a/third_party/WebKit/Source/core/layout/BUILD.gn +++ b/third_party/WebKit/Source/core/layout/BUILD.gn
@@ -249,6 +249,7 @@ "api/LayoutMenuListItem.h", "api/LayoutPartItem.h", "api/LayoutProgressItem.h", + "api/LayoutSliderItem.cpp", "api/LayoutSliderItem.h", "api/LayoutTextControlItem.h", "api/LayoutTextFragmentItem.h",
diff --git a/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.cpp b/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.cpp index a066c2a..1da8f4e 100644 --- a/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.cpp +++ b/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.cpp
@@ -43,7 +43,7 @@ } void DepthOrderedLayoutObjectList::Remove(LayoutObject& object) { - auto it = data_->objects_.Find(&object); + auto it = data_->objects_.find(&object); if (it == data_->objects_.end()) return; DCHECK(!object.GetFrameView()->IsInPerformLayout());
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp index 5925a60..44b4bb9 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
@@ -126,7 +126,7 @@ bool is_resizing) { if (inner_map) { inner_map->Set(layer, size); - object_layer_size_map_.Find(&object)->value.is_resizing = is_resizing; + object_layer_size_map_.find(&object)->value.is_resizing = is_resizing; } else { ObjectResizeInfo new_resize_info; new_resize_info.layer_size_map.Set(layer, size); @@ -189,7 +189,7 @@ } // Look ourselves up in the hashtables. - ObjectLayerSizeMap::iterator i = object_layer_size_map_.Find(&object); + ObjectLayerSizeMap::iterator i = object_layer_size_map_.find(&object); LayerSizeMap* inner_map = nullptr; bool object_is_resizing = false; if (i != object_layer_size_map_.end()) { @@ -199,7 +199,7 @@ LayoutSize old_size; bool is_first_resize = true; if (inner_map) { - LayerSizeMap::iterator j = inner_map->Find(layer); + LayerSizeMap::iterator j = inner_map->find(layer); if (j != inner_map->end()) { is_first_resize = false; old_size = j->value;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index 48702ae..a7bb1d94 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -950,7 +950,7 @@ DCHECK_EQ(o->ContainingBlock(), this); if (g_positioned_container_map) { - auto container_map_it = g_positioned_container_map->Find(o); + auto container_map_it = g_positioned_container_map->find(o); if (container_map_it != g_positioned_container_map->end()) { if (container_map_it->value == this) { DCHECK(HasPositionedObjects());
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index 562f5bb..45263de 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -62,7 +62,7 @@ PaintLayerScrollableArea* scrollable_area = ancestor_overflow_layer->GetScrollableArea(); - auto it = scrollable_area->GetStickyConstraintsMap().Find(obj->Layer()); + auto it = scrollable_area->GetStickyConstraintsMap().find(obj->Layer()); if (it == scrollable_area->GetStickyConstraintsMap().end()) return nullptr;
diff --git a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp index 1596633b..7b919b66 100644 --- a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp
@@ -521,7 +521,7 @@ void LayoutCounter::DestroyCounterNodes(LayoutObject& owner) { CounterMaps& maps = GetCounterMaps(); - CounterMaps::iterator maps_iterator = maps.Find(&owner); + CounterMaps::iterator maps_iterator = maps.find(&owner); if (maps_iterator == maps.end()) return; CounterMap* map = maps_iterator->value.get(); @@ -538,7 +538,7 @@ CounterMap* map = GetCounterMaps().at(&owner); if (!map) return; - CounterMap::iterator map_iterator = map->Find(identifier); + CounterMap::iterator map_iterator = map->find(identifier); if (map_iterator == map->end()) return; DestroyCounterNodeWithoutMapRemoval(identifier, map_iterator->value.Get()); @@ -650,7 +650,7 @@ new_counter_directives->begin(); it != new_map_end; ++it) { CounterDirectiveMap::const_iterator old_map_it = - old_counter_directives->Find(it->key); + old_counter_directives->find(it->key); if (old_map_it != old_map_end) { if (old_map_it->value == it->value) continue;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index 405ead0..cb68bd80 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -2494,7 +2494,7 @@ // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. const size_t kMaxRectsPerLayer = 100; - LayerHitTestRects::iterator iter = layer_rects.Find(current_layer); + LayerHitTestRects::iterator iter = layer_rects.find(current_layer); Vector<LayoutRect>* iter_value; if (iter == layer_rects.end()) iter_value = &layer_rects.insert(current_layer, Vector<LayoutRect>())
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp index 4d51fd4..80d0883 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -99,9 +99,12 @@ table_layout_ = WTF::MakeUnique<TableLayoutAlgorithmAuto>(this); } - // If border was changed, invalidate collapsed borders cache. - if (!NeedsLayout() && old_style && old_style->Border() != Style()->Border()) - InvalidateCollapsedBorders(); + if (!old_style) + return; + + LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + *this, *this, diff, *old_style); + if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *this, diff, *old_style)) MarkAllCellsWidthsDirtyAndOrNeedsLayout(kMarkDirtyAndNeedsLayout);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.cpp b/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.cpp index b0e06e87..f48eca2 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.cpp
@@ -10,6 +10,19 @@ namespace blink { +void LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + const LayoutObject& table_part, + LayoutTable& table, + const StyleDifference& diff, + const ComputedStyle& old_style) { + if (!table.CollapseBorders()) + return; + if (old_style.Border() != table_part.StyleRef().Border() || + (diff.TextDecorationOrColorChanged() && + table_part.StyleRef().HasBorderColorReferencingCurrentColor())) + table.InvalidateCollapsedBorders(); +} + bool LayoutTableBoxComponent::DoCellsHaveDirtyWidth( const LayoutObject& table_part, const LayoutTable& table,
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.h b/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.h index 7ba296f..69021f8 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.h +++ b/third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.h
@@ -15,8 +15,15 @@ class LayoutTable; // Common super class for LayoutTableCol, LayoutTableSection and LayoutTableRow. +// Also provides utility functions for all table parts. class CORE_EXPORT LayoutTableBoxComponent : public LayoutBox { public: + static void InvalidateCollapsedBordersOnStyleChange( + const LayoutObject& table_part, + LayoutTable&, + const StyleDifference&, + const ComputedStyle& old_style); + static bool DoCellsHaveDirtyWidth(const LayoutObject& table_part, const LayoutTable&, const StyleDifference&,
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp index 390d419..14dc866 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -476,26 +476,27 @@ LayoutBlockFlow::StyleDidChange(diff, old_style); SetHasBoxDecorationBackground(true); - if (Parent() && Section() && old_style && - Style()->Height() != old_style->Height()) + if (!old_style) + return; + + if (Parent() && Section() && Style()->Height() != old_style->Height()) Section()->RowLogicalHeightChanged(Row()); // Our intrinsic padding pushes us down to align with the baseline of other // cells on the row. If our vertical-align has changed then so will the // padding needed to align with other cells - clear it so we can recalculate // it from scratch. - if (old_style && Style()->VerticalAlign() != old_style->VerticalAlign()) + if (Style()->VerticalAlign() != old_style->VerticalAlign()) ClearIntrinsicPadding(); - // If border was changed, notify table. if (!Parent()) return; - LayoutTable* table = this->Table(); + LayoutTable* table = Table(); if (!table) return; - if (!table->SelfNeedsLayout() && !table->NormalChildNeedsLayout() && - old_style && old_style->Border() != Style()->Border()) - table->InvalidateCollapsedBorders(); + + LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + *this, *table, diff, *old_style); if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff, *old_style)) {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp index b509854..36ce08cb 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
@@ -55,15 +55,12 @@ if (!table) return; - // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle - // optimization? The optimization would be: if the first branch is taken then - // the next one can't be, so don't even check its condition. - if (!table->SelfNeedsLayout() && !table->NormalChildNeedsLayout() && - old_style->Border() != Style()->Border()) { - table->InvalidateCollapsedBorders(); - } else if ((old_style->LogicalWidth() != Style()->LogicalWidth()) || - LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff, - *old_style)) { + LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + *this, *table, diff, *old_style); + + if ((old_style->LogicalWidth() != Style()->LogicalWidth()) || + LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff, + *old_style)) { // TODO(dgrogan): Optimization opportunities: // (1) Only mark cells which are affected by this col, not every cell in the // table.
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp index 43ce123..60a3c3f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
@@ -71,9 +71,8 @@ if (!table) return; - if (!table->SelfNeedsLayout() && !table->NormalChildNeedsLayout() && - old_style->Border() != Style()->Border()) - table->InvalidateCollapsedBorders(); + LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + *this, *table, diff, *old_style); if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff, *old_style)) {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp index f56be8c7..1f42815a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -131,9 +131,8 @@ if (!table) return; - if (!table->SelfNeedsLayout() && !table->NormalChildNeedsLayout() && - old_style->Border() != Style()->Border()) - table->InvalidateCollapsedBorders(); + LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( + *this, *table, diff, *old_style); if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff, *old_style))
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp index 57cb8f8..edea760 100644 --- a/third_party/WebKit/Source/core/layout/LayoutText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -43,6 +43,7 @@ #include "core/layout/line/InlineTextBox.h" #include "platform/fonts/CharacterRange.h" #include "platform/geometry/FloatQuad.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/text/BidiResolver.h" #include "platform/text/Character.h" #include "platform/text/Hyphenation.h" @@ -51,7 +52,6 @@ #include "platform/wtf/text/StringBuffer.h" #include "platform/wtf/text/StringBuilder.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp index dc2e38a2..b002429 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp
@@ -39,7 +39,6 @@ #include "core/html/forms/SpinButtonElement.h" #include "core/html/forms/TextControlInnerElements.h" #include "core/html/parser/HTMLParserIdioms.h" -#include "core/html/shadow/MediaControlElements.h" #include "core/html/shadow/ShadowElementNames.h" #include "core/layout/LayoutBox.h" #include "core/layout/LayoutThemeMobile.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm index 2b0ec74..6835bd0 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -345,7 +345,7 @@ Color LayoutThemeMac::SystemColor(CSSValueID css_value_id) const { { - HashMap<int, RGBA32>::iterator it = system_color_cache_.Find(css_value_id); + HashMap<int, RGBA32>::iterator it = system_color_cache_.find(css_value_id); if (it != system_color_cache_.end()) return it->value; }
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp index ce898ee..15604e75 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -1243,7 +1243,7 @@ return false; ReverseFingerprintMap::iterator blocks_iter = - blocks_for_fingerprint_.Find(fingerprint); + blocks_for_fingerprint_.find(fingerprint); if (blocks_iter == blocks_for_fingerprint_.end()) return false; @@ -1253,7 +1253,7 @@ blocks_for_fingerprint_.erase(blocks_iter); SuperclusterMap::iterator supercluster_iter = - superclusters_.Find(fingerprint); + superclusters_.find(fingerprint); if (supercluster_iter != superclusters_.end()) { Supercluster* supercluster = supercluster_iter->value.get();
diff --git a/third_party/WebKit/Source/core/layout/VerticalPositionCache.h b/third_party/WebKit/Source/core/layout/VerticalPositionCache.h index 84f2f6e..b546c18d 100644 --- a/third_party/WebKit/Source/core/layout/VerticalPositionCache.h +++ b/third_party/WebKit/Source/core/layout/VerticalPositionCache.h
@@ -48,7 +48,7 @@ baseline_type == kAlphabeticBaseline ? alphabetic_positions_ : ideographic_positions_; const HashMap<LineLayoutItem, int>::const_iterator it = - map_to_check.Find(layout_object); + map_to_check.find(layout_object); if (it == map_to_check.end()) return kPositionUndefined; return it->value;
diff --git a/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.cpp b/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.cpp new file mode 100644 index 0000000..413de55 --- /dev/null +++ b/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.cpp
@@ -0,0 +1,35 @@ +// 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/layout/api/LayoutSliderItem.h" + +#include "core/layout/LayoutSlider.h" + +namespace blink { + +LayoutSliderItem::LayoutSliderItem(LayoutSlider* layout_slider) + : LayoutBlockItem(layout_slider) {} + +LayoutSliderItem::LayoutSliderItem(const LayoutBlockItem& item) + : LayoutBlockItem(item) { + SECURITY_DCHECK(!item || item.IsSlider()); +} + +LayoutSliderItem::LayoutSliderItem(std::nullptr_t) : LayoutBlockItem(nullptr) {} + +LayoutSliderItem::LayoutSliderItem() = default; + +bool LayoutSliderItem::InDragMode() const { + return ToSlider()->InDragMode(); +} + +LayoutSlider* LayoutSliderItem::ToSlider() { + return ToLayoutSlider(GetLayoutObject()); +} + +const LayoutSlider* LayoutSliderItem::ToSlider() const { + return ToLayoutSlider(GetLayoutObject()); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.h b/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.h index 1583de3..0e32e417 100644 --- a/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.h +++ b/third_party/WebKit/Source/core/layout/api/LayoutSliderItem.h
@@ -6,32 +6,27 @@ #define LayoutSliderItem_h #include "core/CoreExport.h" -#include "core/layout/LayoutSlider.h" #include "core/layout/api/LayoutBlockItem.h" namespace blink { -class LayoutSliderItem : public LayoutBlockItem { +class LayoutSlider; + +class CORE_EXPORT LayoutSliderItem : NON_EXPORTED_BASE(public LayoutBlockItem) { public: - explicit LayoutSliderItem(LayoutSlider* layout_slider) - : LayoutBlockItem(layout_slider) {} + explicit LayoutSliderItem(LayoutSlider*); - explicit LayoutSliderItem(const LayoutBlockItem& item) - : LayoutBlockItem(item) { - SECURITY_DCHECK(!item || item.IsSlider()); - } + explicit LayoutSliderItem(const LayoutBlockItem&); - explicit LayoutSliderItem(std::nullptr_t) : LayoutBlockItem(nullptr) {} + explicit LayoutSliderItem(std::nullptr_t); - LayoutSliderItem() = default; + LayoutSliderItem(); - CORE_EXPORT bool InDragMode() const { return ToSlider()->InDragMode(); } + bool InDragMode() const; private: - LayoutSlider* ToSlider() { return ToLayoutSlider(GetLayoutObject()); } - const LayoutSlider* ToSlider() const { - return ToLayoutSlider(GetLayoutObject()); - } + LayoutSlider* ToSlider(); + const LayoutSlider* ToSlider() const; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.cpp index e0dffdf..25cfd8a 100644 --- a/third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.cpp
@@ -50,7 +50,7 @@ new InlineToAbstractInlineTextBoxHashMap(); InlineToAbstractInlineTextBoxHashMap::const_iterator it = - g_abstract_inline_text_box_map_->Find(inline_text_box); + g_abstract_inline_text_box_map_->find(inline_text_box); if (it != g_abstract_inline_text_box_map_->end()) return it->value; @@ -65,7 +65,7 @@ return; InlineToAbstractInlineTextBoxHashMap::const_iterator it = - g_abstract_inline_text_box_map_->Find(inline_text_box); + g_abstract_inline_text_box_map_->find(inline_text_box); if (it != g_abstract_inline_text_box_map_->end()) { it->value->Detach(); g_abstract_inline_text_box_map_->erase(inline_text_box);
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp index 51c7e58..ecd674a 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -1051,7 +1051,7 @@ text_box->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); GlyphOverflowAndFallbackFontsMap::iterator it = - text_box_data_map.Find(text_box); + text_box_data_map.find(text_box); GlyphOverflow* glyph_overflow = it == text_box_data_map.end() ? nullptr : &it->value.second; bool is_flipped_line = style.IsFlippedLinesWritingMode();
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp index 7cd6004..a904d98 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -75,7 +75,7 @@ if (KnownToHaveNoOverflow() || !g_text_boxes_with_overflow) return LogicalFrameRect(); - const auto& it = g_text_boxes_with_overflow->Find(this); + const auto& it = g_text_boxes_with_overflow->find(this); if (it != g_text_boxes_with_overflow->end()) return it->value; @@ -94,7 +94,7 @@ InlineBox::Move(delta); if (!KnownToHaveNoOverflow() && g_text_boxes_with_overflow) { - const auto& it = g_text_boxes_with_overflow->Find(this); + const auto& it = g_text_boxes_with_overflow->find(this); if (it != g_text_boxes_with_overflow->end()) it->value.Move(IsHorizontal() ? delta : delta.TransposedSize()); }
diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp index dac6f05..1fc5957e 100644 --- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
@@ -598,7 +598,7 @@ Vector<const SimpleFontData*>* used_fonts = nullptr; if (box->IsText()) { GlyphOverflowAndFallbackFontsMap::iterator it = - text_box_data_map.Find(ToInlineTextBox(box)); + text_box_data_map.find(ToInlineTextBox(box)); used_fonts = it == text_box_data_map.end() ? 0 : &it->value.first; }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp index 6ed711c..7add8f7 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
@@ -144,7 +144,7 @@ return true; const SVGCharacterDataMap::const_iterator it = - character_data_map_.Find(static_cast<unsigned>(position + 1)); + character_data_map_.find(static_cast<unsigned>(position + 1)); if (it == character_data_map_.end()) return false;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp index 765f8c1..861e800 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp +++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp
@@ -41,7 +41,7 @@ if (iterator.Metrics().IsEmpty()) continue; - auto it = all_characters_map.Find(value_list_position + 1); + auto it = all_characters_map.find(value_list_position + 1); if (it != all_characters_map.end()) character_data_map.Set(iterator.CharacterOffset() + 1, it->value);
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp index f34e285..84654c80 100644 --- a/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp +++ b/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp
@@ -141,7 +141,7 @@ SVGCharacterDataMap& first_character_data_map = first_text_node.CharacterDataMap(); SVGCharacterDataMap::iterator it_first = - first_character_data_map.Find(first_text_box->Start() + 1); + first_character_data_map.find(first_text_box->Start() + 1); if (it_first == first_character_data_map.end()) return; LineLayoutSVGInlineText last_text_node = @@ -149,7 +149,7 @@ SVGCharacterDataMap& last_character_data_map = last_text_node.CharacterDataMap(); SVGCharacterDataMap::iterator it_last = - last_character_data_map.Find(last_text_box->Start() + 1); + last_character_data_map.find(last_text_box->Start() + 1); if (it_last == last_character_data_map.end()) return; // We only want to perform the swap if both inline boxes are absolutely
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 3eaf24d..d0011ef 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -78,11 +78,11 @@ #include "platform/mhtml/MHTMLArchive.h" #include "platform/network/NetworkStateNotifier.h" #include "platform/network/NetworkUtils.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/wtf/Vector.h" #include "public/platform/WebCachePolicy.h" #include "public/platform/WebInsecureRequestPolicy.h" -#include "public/platform/WebViewScheduler.h" #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index 0ff8cfa..b0199e0 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -52,11 +52,11 @@ #include "platform/SharedBuffer.h" #include "platform/UserGestureIndicator.h" #include "platform/loader/fetch/ResourceLoaderOptions.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" #include "public/platform/WebCachePolicy.h" -#include "public/platform/WebScheduler.h" namespace blink { @@ -339,9 +339,11 @@ NavigationScheduler::NavigationScheduler(LocalFrame* frame) : frame_(frame), - frame_type_(frame_->IsMainFrame() - ? WebScheduler::NavigatingFrameType::kMainFrame - : WebScheduler::NavigatingFrameType::kChildFrame) {} + frame_type_( + frame_->IsMainFrame() + ? scheduler::RendererScheduler::NavigatingFrameType::kMainFrame + : scheduler::RendererScheduler::NavigatingFrameType:: + kChildFrame) {} NavigationScheduler::~NavigationScheduler() { if (navigate_task_handle_.IsActive()) {
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.h b/third_party/WebKit/Source/core/loader/NavigationScheduler.h index 6ef93a78..85a793b 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.h +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.h
@@ -42,7 +42,7 @@ #include "platform/wtf/Noncopyable.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/text/WTFString.h" -#include "public/platform/WebScheduler.h" +#include "public/platform/scheduler/renderer/renderer_scheduler.h" namespace blink { @@ -94,7 +94,7 @@ Member<ScheduledNavigation> redirect_; // Exists because we can't deref m_frame in destructor. - WebScheduler::NavigatingFrameType frame_type_; + scheduler::RendererScheduler::NavigatingFrameType frame_type_; }; class NavigationDisablerForBeforeUnload {
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp index f0d1e40..9e0894e 100644 --- a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp
@@ -30,7 +30,7 @@ ModuleScriptLoader* loader) { DCHECK(loader->HasFinished()); - auto it = active_loaders_.Find(loader); + auto it = active_loaders_.find(loader); DCHECK_NE(it, active_loaders_.end()); active_loaders_.erase(it); }
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp index 7c9c6669b..e07dd3e 100644 --- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp
@@ -31,7 +31,7 @@ ModuleTreeLinker* fetcher) { DCHECK(fetcher->HasFinished()); - auto it = active_tree_linkers_.Find(fetcher); + auto it = active_tree_linkers_.find(fetcher); DCHECK_NE(it, active_tree_linkers_.end()); active_tree_linkers_.erase(it); }
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp index be249bb..80d66873 100644 --- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerTest.cpp
@@ -96,7 +96,7 @@ // Get AncestorList specified in |Modulator::FetchTreeInternal()| call for // request matching |url|. AncestorList GetAncestorListForTreeFetch(const KURL& url) const { - const auto& it = pending_tree_ancestor_list_.Find(url); + const auto& it = pending_tree_ancestor_list_.find(url); if (it == pending_tree_ancestor_list_.end()) return AncestorList(); return it->value; @@ -104,7 +104,7 @@ // Resolve |Modulator::FetchTreeInternal()| for given url. void ResolveDependentTreeFetch(const KURL& url, ResolveResult result) { - const auto& it = pending_tree_client_map_.Find(url); + const auto& it = pending_tree_client_map_.find(url); EXPECT_NE(pending_tree_client_map_.end(), it); auto pending_client = it->value; EXPECT_TRUE(pending_client); @@ -159,7 +159,7 @@ } ModuleScript* GetFetchedModuleScript(const KURL& url) override { - const auto& it = module_map_.Find(url); + const auto& it = module_map_.find(url); if (it == module_map_.end()) return nullptr; @@ -178,7 +178,7 @@ Vector<String> ModuleRequestsFromScriptModule( ScriptModule script_module) override { - const auto& it = dependency_module_requests_map_.Find(script_module); + const auto& it = dependency_module_requests_map_.find(script_module); if (it == dependency_module_requests_map_.end()) return Vector<String>();
diff --git a/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.cpp b/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.cpp index 4b4fb37..8df69eca 100644 --- a/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.cpp +++ b/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.cpp
@@ -196,7 +196,7 @@ const HTTPHeaderMap& request_headers) { DCHECK(IsMainThread()); CrossOriginPreflightResultHashMap::iterator cache_it = - preflight_hash_map_.Find(std::make_pair(origin, url)); + preflight_hash_map_.find(std::make_pair(origin, url)); if (cache_it == preflight_hash_map_.end()) return false;
diff --git a/third_party/WebKit/Source/core/page/ScopedPageSuspender.cpp b/third_party/WebKit/Source/core/page/ScopedPageSuspender.cpp index 0951116..77d42f0 100644 --- a/third_party/WebKit/Source/core/page/ScopedPageSuspender.cpp +++ b/third_party/WebKit/Source/core/page/ScopedPageSuspender.cpp
@@ -24,10 +24,10 @@ #include "core/loader/FrameLoader.h" #include "core/page/Page.h" #include "platform/heap/Handle.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/StdLibExtras.h" #include "platform/wtf/Vector.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/page/WindowFeatures.cpp b/third_party/WebKit/Source/core/page/WindowFeatures.cpp index 8c20632b..feee7d1 100644 --- a/third_party/WebKit/Source/core/page/WindowFeatures.cpp +++ b/third_party/WebKit/Source/core/page/WindowFeatures.cpp
@@ -233,7 +233,7 @@ bool WindowFeatures::BoolFeature(const DialogFeaturesMap& features, const char* key, bool default_value) { - DialogFeaturesMap::const_iterator it = features.Find(key); + DialogFeaturesMap::const_iterator it = features.find(key); if (it == features.end()) return default_value; const String& value = it->value; @@ -245,7 +245,7 @@ int min, int max, int default_value) { - DialogFeaturesMap::const_iterator it = features.Find(key); + DialogFeaturesMap::const_iterator it = features.find(key); if (it == features.end()) return default_value; bool ok;
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollCustomizationCallbacks.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollCustomizationCallbacks.cpp index fdea8a66..591894f 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollCustomizationCallbacks.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollCustomizationCallbacks.cpp
@@ -16,7 +16,7 @@ ScrollStateCallback* ScrollCustomizationCallbacks::GetDistributeScroll( Element* element) { - auto it = distribute_scroll_callbacks_.Find(element); + auto it = distribute_scroll_callbacks_.find(element); if (it == distribute_scroll_callbacks_.end()) return nullptr; return it->value.Get(); @@ -34,7 +34,7 @@ ScrollStateCallback* ScrollCustomizationCallbacks::GetApplyScroll( Element* element) { - auto it = apply_scroll_callbacks_.Find(element); + auto it = apply_scroll_callbacks_.find(element); if (it == apply_scroll_callbacks_.end()) return nullptr; return it->value.Get();
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index eb1b461d..be891866 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -569,7 +569,7 @@ if (owner_layout_item.IsNull()) continue; const PaintLayer* containing_layer = owner_layout_item.EnclosingLayer(); - LayerFrameMap::iterator iter = map->Find(containing_layer); + LayerFrameMap::iterator iter = map->find(containing_layer); if (iter == map->end()) map->insert(containing_layer, HeapVector<Member<const LocalFrame>>()) .stored_value->value.push_back(ToLocalFrame(child)); @@ -590,7 +590,7 @@ cur_layer->GetLayoutObject().GetFrameView()->ShouldThrottleRendering()) return; // Project any rects for the current layer - LayerHitTestRects::const_iterator layer_iter = layer_rects.Find(cur_layer); + LayerHitTestRects::const_iterator layer_iter = layer_rects.find(cur_layer); if (layer_iter != layer_rects.end()) { // Find the enclosing composited layer when it's in another document (for // non-composited iframes). @@ -604,7 +604,7 @@ composited_layer->GraphicsLayerBacking(&cur_layer->GetLayoutObject()); GraphicsLayerHitTestRects::iterator gl_iter = - graphics_rects.Find(graphics_layer); + graphics_rects.find(graphics_layer); Vector<LayoutRect>* gl_rects; if (gl_iter == graphics_rects.end()) gl_rects = &graphics_rects.insert(graphics_layer, Vector<LayoutRect>()) @@ -647,7 +647,7 @@ // If this layer has any frames of interest as a child of it, walk those (with // an updated frame map). - LayerFrameMap::iterator map_iter = layer_child_frame_map.Find(cur_layer); + LayerFrameMap::iterator map_iter = layer_child_frame_map.find(cur_layer); if (map_iter != layer_child_frame_map.end()) { for (size_t i = 0; i < map_iter->value.size(); i++) { const LocalFrame* child_frame = map_iter->value[i];
diff --git a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp b/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp index c058a37..64d2317 100644 --- a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp +++ b/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp
@@ -32,7 +32,6 @@ #include "core/html/TimeRanges.h" #include "core/html/media/MediaControls.h" #include "core/html/shadow/MediaControlElementTypes.h" -#include "core/html/shadow/MediaControlElements.h" #include "core/layout/LayoutBox.h" #include "core/paint/PaintInfo.h" #include "core/style/ComputedStyle.h"
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index b48cb92..018270e 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -3196,7 +3196,7 @@ rects.Set(this, rect); if (const PaintLayer* parent_layer = Parent()) { - LayerHitTestRects::iterator iter = rects.Find(parent_layer); + LayerHitTestRects::iterator iter = rects.find(parent_layer); if (iter == rects.end()) { rects.insert(parent_layer, Vector<LayoutRect>()) .stored_value->value.push_back(PhysicalBoundingBox(parent_layer));
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp index 685a18d..1ec7020 100644 --- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp +++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -144,36 +144,34 @@ DrawingRecorder recorder(graphics_context, client, static_cast<DisplayItem::Type>(display_item_type), border_rect); - Color cell_color = layout_table_cell_.ResolveColor(CSSPropertyColor); // We never paint diagonals at the joins. We simply let the border with the // highest precedence paint on top of borders with lower precedence. if (display_item_type & DisplayItem::kTableCollapsedBorderTop) { ObjectPainter::DrawLineForBoxSide( graphics_context, border_rect.X(), border_rect.Y(), border_rect.MaxX(), - border_rect.Y() + top_width, kBSTop, - top_border_value.GetColor().Resolve(cell_color), + border_rect.Y() + top_width, kBSTop, top_border_value.GetColor(), CollapsedBorderStyle(top_border_value.Style()), 0, 0, true); } if (display_item_type & DisplayItem::kTableCollapsedBorderBottom) { ObjectPainter::DrawLineForBoxSide( graphics_context, border_rect.X(), border_rect.MaxY() - bottom_width, border_rect.MaxX(), border_rect.MaxY(), kBSBottom, - bottom_border_value.GetColor().Resolve(cell_color), + bottom_border_value.GetColor(), CollapsedBorderStyle(bottom_border_value.Style()), 0, 0, true); } if (display_item_type & DisplayItem::kTableCollapsedBorderLeft) { ObjectPainter::DrawLineForBoxSide( graphics_context, border_rect.X(), border_rect.Y(), border_rect.X() + left_width, border_rect.MaxY(), kBSLeft, - left_border_value.GetColor().Resolve(cell_color), + left_border_value.GetColor(), CollapsedBorderStyle(left_border_value.Style()), 0, 0, true); } if (display_item_type & DisplayItem::kTableCollapsedBorderRight) { ObjectPainter::DrawLineForBoxSide( graphics_context, border_rect.MaxX() - right_width, border_rect.Y(), border_rect.MaxX(), border_rect.MaxY(), kBSRight, - right_border_value.GetColor().Resolve(cell_color), + right_border_value.GetColor(), CollapsedBorderStyle(right_border_value.Style()), 0, 0, true); } }
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp index 8e89138..7e78489 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp
@@ -54,9 +54,9 @@ v8::Local<v8::Value> value; v8::Local<v8::Value> item = v.V8Value(); if (!item->IsObject() || - !V8Call(V8UnpackIteratorResult(v.GetScriptState(), - item.As<v8::Object>(), &is_done_), - value)) { + !V8UnpackIteratorResult(v.GetScriptState(), item.As<v8::Object>(), + &is_done_) + .ToLocal(&value)) { is_valid_ = false; return; } @@ -134,13 +134,13 @@ v8::Local<v8::Script> script; v8::MicrotasksScope microtasks(scope->GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); - if (!V8Call(v8::String::NewFromUtf8(scope->GetIsolate(), s, - v8::NewStringType::kNormal), - source)) { + if (!v8::String::NewFromUtf8(scope->GetIsolate(), s, + v8::NewStringType::kNormal) + .ToLocal(&source)) { ADD_FAILURE(); return ScriptValue(); } - if (!V8Call(v8::Script::Compile(scope->GetContext(), source), script)) { + if (!v8::Script::Compile(scope->GetContext(), source).ToLocal(&script)) { ADD_FAILURE() << "Compilation fails"; return ScriptValue(); }
diff --git a/third_party/WebKit/Source/core/style/CollapsedBorderValue.h b/third_party/WebKit/Source/core/style/CollapsedBorderValue.h index b22e8f58..a315007 100644 --- a/third_party/WebKit/Source/core/style/CollapsedBorderValue.h +++ b/third_party/WebKit/Source/core/style/CollapsedBorderValue.h
@@ -36,17 +36,15 @@ public: CollapsedBorderValue() : color_(0), - color_is_current_color_(true), width_(0), style_(kBorderStyleNone), precedence_(kBorderPrecedenceOff), transparent_(false) {} CollapsedBorderValue(const BorderValue& border, - const StyleColor& color, + const Color& color, EBorderPrecedence precedence) - : color_(color.Resolve(Color())), - color_is_current_color_(color.IsCurrentColor()), + : color_(color), width_(border.NonZero() ? border.Width() : 0), style_(border.Style()), precedence_(precedence), @@ -55,10 +53,7 @@ unsigned Width() const { return style_ > kBorderStyleHidden ? width_ : 0; } EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); } bool Exists() const { return precedence_ != kBorderPrecedenceOff; } - StyleColor GetColor() const { - return color_is_current_color_ ? StyleColor::CurrentColor() - : StyleColor(color_); - } + Color GetColor() const { return color_; } bool IsTransparent() const { return transparent_; } EBorderPrecedence Precedence() const { return static_cast<EBorderPrecedence>(precedence_); @@ -87,8 +82,7 @@ private: Color color_; - unsigned color_is_current_color_ : 1; - unsigned width_ : 23; + unsigned width_ : 24; unsigned style_ : 4; // EBorderStyle unsigned precedence_ : 3; // EBorderPrecedence unsigned transparent_ : 1;
diff --git a/third_party/WebKit/Source/core/style/GridPositionsResolver.cpp b/third_party/WebKit/Source/core/style/GridPositionsResolver.cpp index 2fc1f2d3d..48a5e0b 100644 --- a/third_party/WebKit/Source/core/style/GridPositionsResolver.cpp +++ b/third_party/WebKit/Source/core/style/GridPositionsResolver.cpp
@@ -40,12 +40,12 @@ : grid_container_style.AutoRepeatNamedGridRowLines(); if (!grid_line_names.IsEmpty()) { - auto it = grid_line_names.Find(named_line); + auto it = grid_line_names.find(named_line); named_lines_indexes_ = it == grid_line_names.end() ? nullptr : &it->value; } if (!auto_repeat_grid_line_names.IsEmpty()) { - auto it = auto_repeat_grid_line_names.Find(named_line); + auto it = auto_repeat_grid_line_names.find(named_line); auto_repeat_named_lines_indexes_ = it == auto_repeat_grid_line_names.end() ? nullptr : &it->value; }
diff --git a/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp b/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp index d748ec1..a84a7e3 100644 --- a/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp +++ b/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp
@@ -43,7 +43,7 @@ CSSVariableData* StyleInheritedVariables::GetVariable( const AtomicString& name) const { - auto result = data_.Find(name); + auto result = data_.find(name); if (result == data_.end() && root_) return root_->GetVariable(name); if (result == data_.end()) @@ -59,7 +59,7 @@ const CSSValue* StyleInheritedVariables::RegisteredVariable( const AtomicString& name) const { - auto result = registered_data_.Find(name); + auto result = registered_data_.find(name); if (result != registered_data_.end()) return result->value.Get(); if (root_) @@ -69,7 +69,7 @@ void StyleInheritedVariables::RemoveVariable(const AtomicString& name) { data_.Set(name, nullptr); - auto iterator = registered_data_.Find(name); + auto iterator = registered_data_.find(name); if (iterator != registered_data_.end()) iterator->value = nullptr; }
diff --git a/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp b/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp index e4d987d0..1b6e995 100644 --- a/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp +++ b/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp
@@ -115,7 +115,7 @@ document_->RemoveClient(client); return; } - auto entry = clients_.Find(client); + auto entry = clients_.find(client); if (entry == clients_.end()) return; IdObserver* observer = entry->value;
diff --git a/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.cpp b/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.cpp index 6d650031..06b598f 100644 --- a/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.cpp +++ b/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.cpp
@@ -40,7 +40,7 @@ LayoutSVGResourceContainer* current_resource = LookupResource(*tree_scope_, id); // Lookup the currently registered resource. - auto it = resources_.Find(id); + auto it = resources_.find(id); if (it != resources_.end()) { // Is the local map up-to-date already? if (it->value == current_resource) @@ -65,7 +65,7 @@ DCHECK(resource); if (!resource->IsRegistered() || id.IsEmpty()) return; - auto it = resources_.Find(id); + auto it = resources_.find(id); // If this is not the currently registered resource for this id, then do // nothing. if (it == resources_.end() || it->value != resource)
diff --git a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp index 45454e95c..7e5e7c5 100644 --- a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp +++ b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
@@ -101,7 +101,7 @@ #endif ElementAttributePair key(target, attribute_name); - GroupedAnimationsMap::iterator it = scheduled_animations_.Find(key); + GroupedAnimationsMap::iterator it = scheduled_animations_.find(key); DCHECK_NE(it, scheduled_animations_.end()); AnimationsLinkedHashSet* scheduled = it->value.Get(); DCHECK(scheduled);
diff --git a/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h b/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h index 3566ad6..c2044687 100644 --- a/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h +++ b/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h
@@ -52,7 +52,7 @@ inline FilterEffectSet& EffectReferences(FilterEffect* effect) { // Only allowed for effects belongs to this builder. DCHECK(effect_references_.Contains(effect)); - return effect_references_.Find(effect)->value; + return effect_references_.find(effect)->value; } // Required to change the attributes of a filter during an
diff --git a/third_party/WebKit/Source/core/testing/DictionaryTest.cpp b/third_party/WebKit/Source/core/testing/DictionaryTest.cpp index f85dd44..2d7097f 100644 --- a/third_party/WebKit/Source/core/testing/DictionaryTest.cpp +++ b/third_party/WebKit/Source/core/testing/DictionaryTest.cpp
@@ -190,7 +190,7 @@ result.Append(','); v8::Local<v8::Value> value; - if (V8Call(iterator.GetValue(), value)) + if (iterator.GetValue().ToLocal(&value)) result.Append(ToCoreString(value->ToString())); }
diff --git a/third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp index 55ff947..64341631bc 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp
@@ -83,7 +83,7 @@ static void InsertPerformanceEntry(PerformanceEntryMap& performance_entry_map, PerformanceEntry& entry) { - PerformanceEntryMap::iterator it = performance_entry_map.Find(entry.name()); + PerformanceEntryMap::iterator it = performance_entry_map.find(entry.name()); if (it != performance_entry_map.end()) { it->value.push_back(&entry); } else { @@ -224,7 +224,7 @@ const String& name) { PerformanceEntryVector entries; - PerformanceEntryMap::const_iterator it = performance_entry_map.Find(name); + PerformanceEntryMap::const_iterator it = performance_entry_map.find(name); if (it != performance_entry_map.end()) entries.AppendVector(it->value);
diff --git a/third_party/WebKit/Source/core/timing/WorkerPerformance.cpp b/third_party/WebKit/Source/core/timing/WorkerPerformance.cpp index 5dedc36..5d00d95 100644 --- a/third_party/WebKit/Source/core/timing/WorkerPerformance.cpp +++ b/third_party/WebKit/Source/core/timing/WorkerPerformance.cpp
@@ -33,9 +33,9 @@ #include "core/timing/MemoryInfo.h" #include "core/workers/DedicatedWorkerGlobalScope.h" #include "core/workers/WorkerGlobalScope.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp b/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp index 43e094a..4e55b79f 100644 --- a/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp
@@ -86,7 +86,7 @@ } bool WorkerEventQueue::RemoveEvent(Event* event) { - auto found = pending_events_.Find(event); + auto found = pending_events_.find(event); if (found == pending_events_.end()) return false; pending_events_.erase(found);
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp index e72412e..7a9c20fd 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -53,12 +53,12 @@ #include "platform/InstanceCounters.h" #include "platform/loader/fetch/MemoryCache.h" #include "platform/network/ContentSecurityPolicyParsers.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/RefPtr.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebURLRequest.h" namespace blink { @@ -141,7 +141,7 @@ void WorkerGlobalScope::DeregisterEventListener( V8AbstractEventListener* event_listener) { - auto it = event_listeners_.Find(event_listener); + auto it = event_listeners_.find(event_listener); CHECK(it != event_listeners_.end() || closing_); event_listeners_.erase(it); }
diff --git a/third_party/WebKit/Source/core/xml/XPathFunctions.cpp b/third_party/WebKit/Source/core/xml/XPathFunctions.cpp index 6edc970c..8a2d2b8 100644 --- a/third_party/WebKit/Source/core/xml/XPathFunctions.cpp +++ b/third_party/WebKit/Source/core/xml/XPathFunctions.cpp
@@ -757,7 +757,7 @@ CreateFunctionMap(); HashMap<String, FunctionRec>::iterator function_map_iter = - g_function_map->Find(name); + g_function_map->find(name); FunctionRec* function_rec = nullptr; if (function_map_iter == g_function_map->end() ||
diff --git a/third_party/WebKit/Source/core/xml/XPathParser.cpp b/third_party/WebKit/Source/core/xml/XPathParser.cpp index 9abe1d3..1c9ab8d 100644 --- a/third_party/WebKit/Source/core/xml/XPathParser.cpp +++ b/third_party/WebKit/Source/core/xml/XPathParser.cpp
@@ -96,7 +96,7 @@ if (axis_names.IsEmpty()) SetUpAxisNamesMap(axis_names); - AxisNamesMap::iterator it = axis_names.Find(name); + AxisNamesMap::iterator it = axis_names.find(name); if (it == axis_names.end()) return false; type = it->value;
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index 9c66b2d..f4f659d9 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -947,7 +947,7 @@ attr_uri = ToAtomicString(attributes[i].uri); } else { const HashMap<AtomicString, AtomicString>::const_iterator it = - initial_prefix_to_namespace_map.Find(attr_prefix); + initial_prefix_to_namespace_map.find(attr_prefix); if (it != initial_prefix_to_namespace_map.end()) attr_uri = it->value; else
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp index 839bcaf..8dd5489 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
@@ -32,10 +32,10 @@ #include "core/inspector/InspectorTraceEvents.h" #include "core/probe/CoreProbes.h" #include "core/xmlhttprequest/XMLHttpRequest.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/text/AtomicString.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink {
diff --git a/third_party/WebKit/Source/devtools/front_end/css_tracker/cssTrackerListView.css b/third_party/WebKit/Source/devtools/front_end/css_tracker/cssTrackerListView.css deleted file mode 100644 index 50e33bb..0000000 --- a/third_party/WebKit/Source/devtools/front_end/css_tracker/cssTrackerListView.css +++ /dev/null
@@ -1,20 +0,0 @@ -.data-grid td .bar { - display: inline-block; - height: 8px; -} - -.data-grid .selected td .bar { - border: 0.5px solid white; -} - -.data-grid td .bar-slack-size { - background-color: rgb(150, 150, 200); -} - -.data-grid td .bar-unused-size { - background-color: #E57373; -} - -.data-grid td .bar-used-size { - background-color: #81C784; -}
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h index b0cfaca9..07b70bf 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMediaControls.h
@@ -29,7 +29,7 @@ #ifndef AXMediaControls_h #define AXMediaControls_h -#include "core/html/shadow/MediaControlElements.h" +#include "core/html/shadow/MediaControlElementTypes.h" #include "modules/accessibility/AXSlider.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp index a256d1c..72eb037 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -62,7 +62,7 @@ #include "core/html/TextControlElement.h" #include "core/html/forms/RadioInputType.h" #include "core/html/parser/HTMLParserIdioms.h" -#include "core/html/shadow/MediaControlElements.h" +#include "core/html/shadow/MediaControlElementTypes.h" #include "core/layout/LayoutBlockFlow.h" #include "core/layout/LayoutObject.h" #include "core/svg/SVGElement.h"
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp index c34f122..7d1aa49 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -464,7 +464,7 @@ const ComputedStyle* computed_style = canvas()->EnsureComputedStyle(); if (computed_style) { HashMap<String, Font>::iterator i = - fonts_resolved_using_current_style_.Find(new_font); + fonts_resolved_using_current_style_.find(new_font); if (i != fonts_resolved_using_current_style_.end()) { DCHECK(font_lru_list_.Contains(new_font)); font_lru_list_.erase(new_font);
diff --git a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp index 2913e3a..c746a6a 100644 --- a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp +++ b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp
@@ -182,8 +182,8 @@ v8::TryCatch exception_catcher(script_state->GetIsolate()); v8::Local<v8::Value> json_dictionary; - if (V8Call(v8::JSON::Parse(script_state->GetIsolate(), json_string), - json_dictionary, exception_catcher)) + if (v8::JSON::Parse(script_state->GetIsolate(), json_string) + .ToLocal(&json_dictionary)) resolver_->Resolve(json_dictionary); else resolver_->Reject(exception_catcher.Exception());
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp index 0be5906..77c2de5 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
@@ -86,8 +86,8 @@ v8::Local<v8::Function>::Cast(ctor_value.V8Value()); v8::Local<v8::Value> input_properties_value; - if (!V8Call(constructor->Get(context, V8String(isolate, "inputProperties")), - input_properties_value)) + if (!constructor->Get(context, V8String(isolate, "inputProperties")) + .ToLocal(&input_properties_value)) return; Vector<CSSPropertyID> native_invalidation_properties; @@ -116,8 +116,8 @@ Vector<CSSSyntaxDescriptor> input_argument_types; if (RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) { v8::Local<v8::Value> input_argument_type_values; - if (!V8Call(constructor->Get(context, V8String(isolate, "inputArguments")), - input_argument_type_values)) + if (!constructor->Get(context, V8String(isolate, "inputArguments")) + .ToLocal(&input_argument_type_values)) return; if (!IsUndefinedOrNull(input_argument_type_values)) { @@ -141,8 +141,8 @@ // Parse 'alpha' AKA hasAlpha property. v8::Local<v8::Value> alpha_value; - if (!V8Call(constructor->Get(context, V8String(isolate, "alpha")), - alpha_value)) + if (!constructor->Get(context, V8String(isolate, "alpha")) + .ToLocal(&alpha_value)) return; if (!IsUndefinedOrNull(alpha_value) && !alpha_value->IsBoolean()) { exception_state.ThrowTypeError( @@ -154,8 +154,8 @@ : true; v8::Local<v8::Value> prototype_value; - if (!V8Call(constructor->Get(context, V8String(isolate, "prototype")), - prototype_value)) + if (!constructor->Get(context, V8String(isolate, "prototype")) + .ToLocal(&prototype_value)) return; if (IsUndefinedOrNull(prototype_value)) { @@ -174,7 +174,8 @@ v8::Local<v8::Object>::Cast(prototype_value); v8::Local<v8::Value> paint_value; - if (!V8Call(prototype->Get(context, V8String(isolate, "paint")), paint_value)) + if (!prototype->Get(context, V8String(isolate, "paint")) + .ToLocal(&paint_value)) return; if (IsUndefinedOrNull(paint_value)) {
diff --git a/third_party/WebKit/Source/modules/fetch/Body.cpp b/third_party/WebKit/Source/modules/fetch/Body.cpp index cf2f3d4..8d58b1c9 100644 --- a/third_party/WebKit/Source/modules/fetch/Body.cpp +++ b/third_party/WebKit/Source/modules/fetch/Body.cpp
@@ -100,7 +100,7 @@ v8::Local<v8::String> input_string = V8String(isolate, string); v8::TryCatch trycatch(isolate); v8::Local<v8::Value> parsed; - if (V8Call(v8::JSON::Parse(isolate, input_string), parsed, trycatch)) + if (v8::JSON::Parse(isolate, input_string).ToLocal(&parsed)) Resolver()->Resolve(parsed); else Resolver()->Reject(trycatch.Exception());
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp index 00663bfc..de9a121d 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -41,14 +41,14 @@ v8::Local<v8::Script> script; v8::MicrotasksScope microtasks(script_state->GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); - if (!V8Call(v8::String::NewFromUtf8(script_state->GetIsolate(), s, - v8::NewStringType::kNormal), - source)) { + if (!v8::String::NewFromUtf8(script_state->GetIsolate(), s, + v8::NewStringType::kNormal) + .ToLocal(&source)) { ADD_FAILURE(); return ScriptValue(); } - if (!V8Call(v8::Script::Compile(script_state->GetContext(), source), - script)) { + if (!v8::Script::Compile(script_state->GetContext(), source) + .ToLocal(&script)) { ADD_FAILURE() << "Compilation fails"; return ScriptValue(); }
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp index de38e8e..3e2a658b 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -6,8 +6,8 @@ #include <memory> #include "bindings/core/v8/DOMWrapperWorld.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamBytesConsumerTest.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamBytesConsumerTest.cpp index 5771231..98b1d22b 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamBytesConsumerTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamBytesConsumerTest.cpp
@@ -58,14 +58,13 @@ v8::Local<v8::Script> script; v8::MicrotasksScope microtasks(GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); - if (!V8Call(v8::String::NewFromUtf8(GetIsolate(), s, - v8::NewStringType::kNormal), - source)) { + if (!v8::String::NewFromUtf8(GetIsolate(), s, v8::NewStringType::kNormal) + .ToLocal(&source)) { ADD_FAILURE(); return v8::MaybeLocal<v8::Value>(); } - if (!V8Call(v8::Script::Compile(GetScriptState()->GetContext(), source), - script)) { + if (!v8::Script::Compile(GetScriptState()->GetContext(), source) + .ToLocal(&script)) { ADD_FAILURE() << "Compilation fails"; return v8::MaybeLocal<v8::Value>(); }
diff --git a/third_party/WebKit/Source/modules/filesystem/DraggedIsolatedFileSystemImpl.cpp b/third_party/WebKit/Source/modules/filesystem/DraggedIsolatedFileSystemImpl.cpp index 6a49fe4..da11910b 100644 --- a/third_party/WebKit/Source/modules/filesystem/DraggedIsolatedFileSystemImpl.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DraggedIsolatedFileSystemImpl.cpp
@@ -47,7 +47,7 @@ DraggedIsolatedFileSystemImpl* dragged_isolated_file_system = From(host); if (!dragged_isolated_file_system) return nullptr; - auto it = dragged_isolated_file_system->filesystems_.Find(file_system_id); + auto it = dragged_isolated_file_system->filesystems_.find(file_system_id); if (it != dragged_isolated_file_system->filesystems_.end()) return it->value; return dragged_isolated_file_system->filesystems_
diff --git a/third_party/WebKit/Source/modules/geolocation/GeolocationWatchers.cpp b/third_party/WebKit/Source/modules/geolocation/GeolocationWatchers.cpp index 6d572519..cc90de7 100644 --- a/third_party/WebKit/Source/modules/geolocation/GeolocationWatchers.cpp +++ b/third_party/WebKit/Source/modules/geolocation/GeolocationWatchers.cpp
@@ -24,7 +24,7 @@ GeoNotifier* GeolocationWatchers::Find(int id) { DCHECK_GT(id, 0); - IdToNotifierMap::iterator iter = id_to_notifier_map_.Find(id); + IdToNotifierMap::iterator iter = id_to_notifier_map_.find(id); if (iter == id_to_notifier_map_.end()) return 0; return iter->value; @@ -32,7 +32,7 @@ void GeolocationWatchers::Remove(int id) { DCHECK_GT(id, 0); - IdToNotifierMap::iterator iter = id_to_notifier_map_.Find(id); + IdToNotifierMap::iterator iter = id_to_notifier_map_.find(id); if (iter == id_to_notifier_map_.end()) return; notifier_to_id_map_.erase(iter->value); @@ -40,7 +40,7 @@ } void GeolocationWatchers::Remove(GeoNotifier* notifier) { - NotifierToIdMap::iterator iter = notifier_to_id_map_.Find(notifier); + NotifierToIdMap::iterator iter = notifier_to_id_map_.find(notifier); if (iter == notifier_to_id_map_.end()) return; id_to_notifier_map_.erase(iter->value);
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp index 3310b07..092bc16 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
@@ -186,7 +186,7 @@ const WebVector<WebIDBObservation>& observations, const IDBDatabaseCallbacks::TransactionMap& transactions) { for (const auto& map_entry : observation_index_map) { - auto it = observers_.Find(map_entry.first); + auto it = observers_.find(map_entry.first); if (it != observers_.end()) { IDBObserver* observer = it->value; @@ -221,7 +221,7 @@ } const String& IDBDatabase::GetObjectStoreName(int64_t object_store_id) const { - const auto& it = metadata_.object_stores.Find(object_store_id); + const auto& it = metadata_.object_stores.find(object_store_id); DCHECK(it != metadata_.object_stores.end()); return it->value->name; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp index 9b053e1d..e535711 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -772,7 +772,7 @@ return nullptr; } - IDBIndexMap::iterator it = index_map_.Find(name); + IDBIndexMap::iterator it = index_map_.find(name); if (it != index_map_.end()) return it->value; @@ -826,7 +826,7 @@ BackendDB()->DeleteIndex(transaction_->Id(), Id(), index_id); metadata_->indexes.erase(index_id); - IDBIndexMap::iterator it = index_map_.Find(name); + IDBIndexMap::iterator it = index_map_.find(name); if (it != index_map_.end()) { transaction_->IndexDeleted(it->value); it->value->MarkDeleted(); @@ -1032,7 +1032,7 @@ BackendDB()->RenameIndex(transaction_->Id(), Id(), index_id, new_name); - auto metadata_iterator = metadata_->indexes.Find(index_id); + auto metadata_iterator = metadata_->indexes.find(index_id); DCHECK_NE(metadata_iterator, metadata_->indexes.end()) << "Invalid index_id"; const String& old_name = metadata_iterator->value->name;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index fd55b17..e95a91ea 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -201,7 +201,7 @@ return nullptr; } - IDBObjectStoreMap::iterator it = object_store_map_.Find(name); + IDBObjectStoreMap::iterator it = object_store_map_.find(name); if (it != object_store_map_.end()) return it->value; @@ -258,7 +258,7 @@ << "A finished transaction deleted an object store"; DCHECK_EQ(mode_, kWebIDBTransactionModeVersionChange) << "A non-versionchange transaction deleted an object store"; - IDBObjectStoreMap::iterator it = object_store_map_.Find(name); + IDBObjectStoreMap::iterator it = object_store_map_.find(name); if (it == object_store_map_.end()) { // No IDBObjectStore instance was created for the deleted store in this // transaction. This happens if IDBDatabase.deleteObjectStore() is called @@ -312,7 +312,7 @@ DCHECK(object_store_map_.Contains(object_store->name())) << "An index was deleted without accessing its object store"; - const auto& object_store_iterator = old_store_metadata_.Find(object_store); + const auto& object_store_iterator = old_store_metadata_.find(object_store); if (object_store_iterator == old_store_metadata_.end()) { // The index's object store was created in this transaction, so this // index was also created (and deleted) in this transaction, and will
diff --git a/third_party/WebKit/Source/modules/media_controls/BUILD.gn b/third_party/WebKit/Source/modules/media_controls/BUILD.gn index fcd79b6e..c51c6ff3 100644 --- a/third_party/WebKit/Source/modules/media_controls/BUILD.gn +++ b/third_party/WebKit/Source/modules/media_controls/BUILD.gn
@@ -50,5 +50,7 @@ "elements/MediaControlTimelineMetrics.h", "elements/MediaControlToggleClosedCaptionsButtonElement.cpp", "elements/MediaControlToggleClosedCaptionsButtonElement.h", + "elements/MediaControlVolumeSliderElement.cpp", + "elements/MediaControlVolumeSliderElement.h", ] }
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp index b31c8faa..a6289db 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -62,6 +62,7 @@ #include "modules/media_controls/elements/MediaControlTextTrackListElement.h" #include "modules/media_controls/elements/MediaControlTimelineElement.h" #include "modules/media_controls/elements/MediaControlToggleClosedCaptionsButtonElement.h" +#include "modules/media_controls/elements/MediaControlVolumeSliderElement.h" #include "platform/EventDispatchForbiddenScope.h" namespace blink { @@ -344,10 +345,8 @@ mute_button_ = new MediaControlMuteButtonElement(*this); panel_->AppendChild(mute_button_); - MediaControlVolumeSliderElement* slider = - MediaControlVolumeSliderElement::Create(*this); - volume_slider_ = slider; - panel_->AppendChild(slider); + volume_slider_ = new MediaControlVolumeSliderElement(*this); + panel_->AppendChild(volume_slider_); if (PreferHiddenVolumeControls(GetDocument())) volume_slider_->SetIsWanted(false);
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h index 562f668d..b14b75ee 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h
@@ -29,7 +29,6 @@ #include "core/html/HTMLDivElement.h" #include "core/html/media/MediaControls.h" -#include "core/html/shadow/MediaControlElements.h" #include "modules/ModulesExport.h" namespace blink { @@ -54,6 +53,7 @@ class MediaControlTextTrackListElement; class MediaControlTimelineElement; class MediaControlToggleClosedCaptionsButtonElement; +class MediaControlVolumeSliderElement; class ShadowRoot; // Default implementation of the core/ MediaControls interface used by
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp index a4f97cd..7e9c97be 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
@@ -24,6 +24,7 @@ #include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement.h" #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h" #include "modules/media_controls/elements/MediaControlTimelineElement.h" +#include "modules/media_controls/elements/MediaControlVolumeSliderElement.h" #include "platform/heap/Handle.h" #include "platform/testing/EmptyWebMediaPlayer.h" #include "platform/testing/HistogramTester.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp index ac411d9a..5dca0fe2 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp
@@ -6,11 +6,11 @@ #include "core/events/Event.h" #include "core/frame/LocalDOMWindow.h" -#include "core/html/shadow/MediaControlElements.h" #include "modules/media_controls/MediaControlsImpl.h" #include "modules/media_controls/elements/MediaControlCastButtonElement.h" #include "modules/media_controls/elements/MediaControlPanelElement.h" #include "modules/media_controls/elements/MediaControlTimelineElement.h" +#include "modules/media_controls/elements/MediaControlVolumeSliderElement.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlElementsHelper.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlElementsHelper.cpp index 554ed41..0771867 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlElementsHelper.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlElementsHelper.cpp
@@ -5,6 +5,7 @@ #include "modules/media_controls/elements/MediaControlElementsHelper.h" #include "core/events/Event.h" +#include "core/layout/LayoutSlider.h" #include "core/layout/api/LayoutSliderItem.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.cpp new file mode 100644 index 0000000..e51caa2 --- /dev/null +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.cpp
@@ -0,0 +1,81 @@ +// 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 "modules/media_controls/elements/MediaControlVolumeSliderElement.h" + +#include "core/HTMLNames.h" +#include "core/InputTypeNames.h" +#include "core/events/Event.h" +#include "core/html/HTMLMediaElement.h" +#include "core/layout/LayoutObject.h" +#include "modules/media_controls/MediaControlsImpl.h" +#include "modules/media_controls/elements/MediaControlElementsHelper.h" +#include "public/platform/Platform.h" + +namespace blink { + +MediaControlVolumeSliderElement::MediaControlVolumeSliderElement( + MediaControlsImpl& media_controls) + : MediaControlInputElement(media_controls, kMediaVolumeSlider) { + EnsureUserAgentShadowRoot(); + setType(InputTypeNames::range); + setAttribute(HTMLNames::stepAttr, "any"); + setAttribute(HTMLNames::maxAttr, "1"); + SetShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider")); +} + +void MediaControlVolumeSliderElement::DefaultEventHandler(Event* event) { + if (!isConnected() || !GetDocument().IsActive()) + return; + + MediaControlInputElement::DefaultEventHandler(event); + + if (event->type() == EventTypeNames::mousedown) { + Platform::Current()->RecordAction( + UserMetricsAction("Media.Controls.VolumeChangeBegin")); + } + + if (event->type() == EventTypeNames::mouseup) { + Platform::Current()->RecordAction( + UserMetricsAction("Media.Controls.VolumeChangeEnd")); + } + + if (event->type() == EventTypeNames::input) { + double volume = value().ToDouble(); + MediaElement().setVolume(volume); + MediaElement().setMuted(false); + if (LayoutObject* layout_object = this->GetLayoutObject()) + layout_object->SetShouldDoFullPaintInvalidation(); + } +} + +void MediaControlVolumeSliderElement::SetVolume(double volume) { + if (value().ToDouble() == volume) + return; + + setValue(String::Number(volume)); + if (LayoutObject* layout_object = this->GetLayoutObject()) + layout_object->SetShouldDoFullPaintInvalidation(); +} + +bool MediaControlVolumeSliderElement::WillRespondToMouseMoveEvents() { + if (!isConnected() || !GetDocument().IsActive()) + return false; + + return MediaControlInputElement::WillRespondToMouseMoveEvents(); +} + +bool MediaControlVolumeSliderElement::WillRespondToMouseClickEvents() { + if (!isConnected() || !GetDocument().IsActive()) + return false; + + return MediaControlInputElement::WillRespondToMouseClickEvents(); +} + +bool MediaControlVolumeSliderElement::KeepEventInNode(Event* event) { + return MediaControlElementsHelper::IsUserInteractionEventForSlider( + event, GetLayoutObject()); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.h b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.h new file mode 100644 index 0000000..1bb2b658 --- /dev/null +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlVolumeSliderElement.h
@@ -0,0 +1,33 @@ +// 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. + +#ifndef MediaControlVolumeSliderElement_h +#define MediaControlVolumeSliderElement_h + +#include "core/html/shadow/MediaControlElementTypes.h" + +namespace blink { + +class Event; +class MediaControlsImpl; + +class MediaControlVolumeSliderElement final : public MediaControlInputElement { + public: + explicit MediaControlVolumeSliderElement(MediaControlsImpl&); + + // TODO: who calls this? + void SetVolume(double); + + // MediaControlInputElement overrides. + bool WillRespondToMouseMoveEvents() override; + bool WillRespondToMouseClickEvents() override; + + private: + void DefaultEventHandler(Event*) override; + bool KeepEventInNode(Event*) override; +}; + +} // namespace blink + +#endif // MediaControlVolumeSliderElement_h
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp index 747c899..74c86f7 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
@@ -162,7 +162,7 @@ NotifyActionChange(action, ActionChangeType::kActionEnabled); } else { - if (action_handlers_.Find(action) == action_handlers_.end()) + if (action_handlers_.find(action) == action_handlers_.end()) return; action_handlers_.erase(action); @@ -225,7 +225,7 @@ UserGestureIndicator gesture_indicator( DocumentUserGestureToken::Create(document)); - auto iter = action_handlers_.Find(MojomActionToActionName(action)); + auto iter = action_handlers_.find(MojomActionToActionName(action)); if (iter == action_handlers_.end()) return;
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp index 3b51e3aa..b28a7669 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp +++ b/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp
@@ -55,7 +55,7 @@ void MediaSourceRegistry::UnregisterURL(const KURL& url) { DCHECK(IsMainThread()); PersistentHeapHashMap<String, Member<MediaSource>>::iterator iter = - media_sources_.Find(url.GetString()); + media_sources_.find(url.GetString()); if (iter == media_sources_.end()) return;
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index 8f276012..10c2e523 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -394,7 +394,7 @@ void MediaStreamTrack::UnregisterMediaStream(MediaStream* media_stream) { CHECK(!is_iterating_registered_media_streams_); HeapHashSet<Member<MediaStream>>::iterator iter = - registered_media_streams_.Find(media_stream); + registered_media_streams_.find(media_stream); CHECK(iter != registered_media_streams_.end()); registered_media_streams_.erase(iter); }
diff --git a/third_party/WebKit/Source/modules/nfc/NFC.cpp b/third_party/WebKit/Source/modules/nfc/NFC.cpp index 4a3d6ece..8193078 100644 --- a/third_party/WebKit/Source/modules/nfc/NFC.cpp +++ b/third_party/WebKit/Source/modules/nfc/NFC.cpp
@@ -512,7 +512,7 @@ device::nfc::mojom::blink::NFCRecordType::JSON) { v8::Local<v8::Value> json_object; v8::TryCatch try_catch(isolate); - if (!V8Call(v8::JSON::Parse(isolate, string), json_object, try_catch)) { + if (!v8::JSON::Parse(isolate, string).ToLocal(&json_object)) { return v8::Null(isolate); } @@ -762,7 +762,7 @@ void NFC::OnWatch(const WTF::Vector<uint32_t>& ids, device::nfc::mojom::blink::NFCMessagePtr message) { for (const auto& id : ids) { - auto it = callbacks_.Find(id); + auto it = callbacks_.find(id); if (it != callbacks_.end()) { MessageCallback* callback = it->value; ScriptState* script_state = callback->GetScriptState();
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp index f48a69e..753b236e 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
@@ -1185,7 +1185,7 @@ HeapVector<Member<RTCRtpReceiver>> rtp_receivers(web_rtp_receivers.size()); for (size_t i = 0; i < web_rtp_receivers.size(); ++i) { uintptr_t id = web_rtp_receivers[i]->Id(); - const auto it = rtp_receivers_.Find(id); + const auto it = rtp_receivers_.find(id); if (it != rtp_receivers_.end()) { rtp_receivers[i] = it->value; } else {
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp index 2318256..8e5a9bdb 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCRtpReceiver.cpp
@@ -42,7 +42,7 @@ } DCHECK_EQ(web_contributing_source->SourceType(), WebRTCRtpContributingSourceType::CSRC); - auto it = contributing_sources_by_source_id_.Find( + auto it = contributing_sources_by_source_id_.find( web_contributing_source->Source()); if (it == contributing_sources_by_source_id_.end()) { RTCRtpContributingSource* contributing_source =
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp index 41abaae..5ba5ff2 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp
@@ -33,7 +33,7 @@ RTCStatsResponse::RTCStatsResponse() {} RTCLegacyStatsReport* RTCStatsResponse::namedItem(const AtomicString& name) { - if (idmap_.Find(name) != idmap_.end()) + if (idmap_.find(name) != idmap_.end()) return result_[idmap_.at(name)]; return nullptr; }
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp index c367c3c3..ef8247b2 100644 --- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp +++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
@@ -130,7 +130,7 @@ return promise; } - auto iter = availability_callbacks_.Find(id); + auto iter = availability_callbacks_.find(id); if (iter == availability_callbacks_.end()) { resolver->Reject(DOMException::Create( kNotFoundError, "A callback with the given id is not found.")); @@ -222,7 +222,7 @@ void RemotePlayback::NotifyInitialAvailability(int callback_id) { // May not find the callback if the website cancels it fast enough. - auto iter = availability_callbacks_.Find(callback_id); + auto iter = availability_callbacks_.find(callback_id); if (iter == availability_callbacks_.end()) return;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp index b17ba667..6101669 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
@@ -15,9 +15,9 @@ #include "core/inspector/ConsoleMessage.h" #include "modules/serviceworkers/NavigatorServiceWorker.h" #include "modules/serviceworkers/ServiceWorkerContainer.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp index 39fdad6..5d11344 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
@@ -420,7 +420,7 @@ // |frame| must exist in the map. DCHECK(scheduled_suspends_.Contains(frame)); - SuspendMap::iterator it = scheduled_suspends_.Find(frame); + SuspendMap::iterator it = scheduled_suspends_.find(frame); it->value->Resolve(); scheduled_suspends_.erase(it);
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 8990bfa..b52bb98 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -468,7 +468,7 @@ { MutexLocker locker(GuidMutex()); - GuidVersionMap::iterator entry = GuidToVersionMap().Find(guid_); + GuidVersionMap::iterator entry = GuidToVersionMap().find(guid_); if (entry != GuidToVersionMap().end()) { // Map null string to empty string (see updateGuidVersionMap()). current_version =
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp index 30e54476..62bd8b4 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
@@ -128,7 +128,7 @@ if (!database_set) return; - DatabaseSet::iterator found = database_set->Find(database); + DatabaseSet::iterator found = database_set->find(database); if (found == database_set->end()) return; @@ -230,7 +230,7 @@ if (!database_set) return; - DatabaseSet::iterator found = database_set->Find(database); + DatabaseSet::iterator found = database_set->find(database); if (found == database_set->end()) return; }
diff --git a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.cpp b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.cpp index 2d5f410..323ce44 100644 --- a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.cpp
@@ -360,7 +360,7 @@ blink::Database* InspectorDatabaseAgent::DatabaseForId( const String& database_id) { - DatabaseResourcesHeapMap::iterator it = resources_.Find(database_id); + DatabaseResourcesHeapMap::iterator it = resources_.find(database_id); if (it == resources_.end()) return 0; return it->value->GetDatabase();
diff --git a/third_party/WebKit/Source/modules/webdatabase/QuotaTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/QuotaTracker.cpp index 4c507f6..6fda1f97 100644 --- a/third_party/WebKit/Source/modules/webdatabase/QuotaTracker.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/QuotaTracker.cpp
@@ -53,7 +53,7 @@ MutexLocker lock_data(data_guard_); DCHECK(database_sizes_.Contains(origin->ToRawString())); HashMap<String, SizeMap>::const_iterator it = - database_sizes_.Find(origin->ToRawString()); + database_sizes_.find(origin->ToRawString()); DCHECK(it->value.Contains(database_name)); *database_size = it->value.at(database_name);
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.cpp index 791b0e2..f93da7e8 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.cpp
@@ -225,7 +225,7 @@ db->ReportExecuteStatementResult(6, SQLError::kConstraintErr, result); error_ = SQLErrorData::Create( SQLError::kConstraintErr, - "could not execute statement due to a constaint failure", result, + "could not execute statement due to a constraint failure", result, database->LastErrorMsg()); return false; } else {
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp index 58316a4..f4a3d418 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp
@@ -75,7 +75,7 @@ String db_identifier = GetDatabaseIdentifier(transaction); CoordinationInfoHeapMap::iterator coordination_info_iterator = - coordination_info_map_.Find(db_identifier); + coordination_info_map_.find(db_identifier); if (coordination_info_iterator == coordination_info_map_.end()) { // No pending transactions for this DB CoordinationInfo& info = @@ -98,7 +98,7 @@ String db_identifier = GetDatabaseIdentifier(transaction); CoordinationInfoHeapMap::iterator coordination_info_iterator = - coordination_info_map_.Find(db_identifier); + coordination_info_map_.find(db_identifier); SECURITY_DCHECK(coordination_info_iterator != coordination_info_map_.end()); CoordinationInfo& info = coordination_info_iterator->value;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp index 9e810a0..6c260aff 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp
@@ -148,8 +148,7 @@ ImageBitmap* WebGL2RenderingContext::TransferToImageBitmap( ScriptState* script_state) { - NOTIMPLEMENTED(); - return nullptr; + return TransferToImageBitmapBase(script_state); } void WebGL2RenderingContext::RegisterContextExtensions() {
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp index 8d923cf..c19d315 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp
@@ -309,7 +309,7 @@ WebGLFramebuffer::WebGLAttachment* WebGLFramebuffer::GetAttachment( GLenum attachment) const { - const AttachmentMap::const_iterator it = attachments_.Find(attachment); + const AttachmentMap::const_iterator it = attachments_.find(attachment); return (it != attachments_.end()) ? it->value.Get() : 0; }
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp index 5b734642..08cff29 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp +++ b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
@@ -9,13 +9,13 @@ #include "platform/network/NetworkLog.h" #include "platform/network/WebSocketHandshakeRequest.h" #include "platform/network/WebSocketHandshakeResponse.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Functional.h" #include "platform/wtf/text/WTFString.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink { namespace {
diff --git a/third_party/WebKit/Source/modules/webusb/USB.cpp b/third_party/WebKit/Source/modules/webusb/USB.cpp index 3d30cc3..be6863a1 100644 --- a/third_party/WebKit/Source/modules/webusb/USB.cpp +++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -154,7 +154,7 @@ void USB::OnGetDevices(ScriptPromiseResolver* resolver, Vector<UsbDeviceInfoPtr> device_infos) { - auto request_entry = device_manager_requests_.Find(resolver); + auto request_entry = device_manager_requests_.find(resolver); if (request_entry == device_manager_requests_.end()) return; device_manager_requests_.erase(request_entry); @@ -168,7 +168,7 @@ void USB::OnGetPermission(ScriptPromiseResolver* resolver, UsbDeviceInfoPtr device_info) { - auto request_entry = chooser_service_requests_.Find(resolver); + auto request_entry = chooser_service_requests_.find(resolver); if (request_entry == chooser_service_requests_.end()) return; chooser_service_requests_.erase(request_entry);
diff --git a/third_party/WebKit/Source/modules/webusb/USBDevice.cpp b/third_party/WebKit/Source/modules/webusb/USBDevice.cpp index 172f1a87..5263db86d 100644 --- a/third_party/WebKit/Source/modules/webusb/USBDevice.cpp +++ b/third_party/WebKit/Source/modules/webusb/USBDevice.cpp
@@ -924,7 +924,7 @@ } bool USBDevice::MarkRequestComplete(ScriptPromiseResolver* resolver) { - auto request_entry = device_requests_.Find(resolver); + auto request_entry = device_requests_.find(resolver); if (request_entry == device_requests_.end()) return false; device_requests_.erase(request_entry);
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index 425c5052..cb0e0eb 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -470,6 +470,8 @@ "audio/ffmpeg/FFTFrameFFMPEG.cpp", "audio/ipp/FFTFrameIPP.cpp", "audio/mac/FFTFrameMac.cpp", + "bindings/Microtask.cpp", + "bindings/Microtask.h", "blob/BlobData.cpp", "blob/BlobData.h", "blob/BlobRegistry.cpp",
diff --git a/third_party/WebKit/Source/platform/Timer.cpp b/third_party/WebKit/Source/platform/Timer.cpp index 81fc2ac5..0d5cd7f 100644 --- a/third_party/WebKit/Source/platform/Timer.cpp +++ b/third_party/WebKit/Source/platform/Timer.cpp
@@ -31,12 +31,12 @@ #include <algorithm> #include <limits> #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/AddressSanitizer.h" #include "platform/wtf/Atomics.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/HashSet.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 54c96f0..9cbc0d2 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -7,16 +7,16 @@ #include <memory> #include <queue> #include "platform/scheduler/base/task_queue_impl.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scheduler/child/web_task_runner_impl.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/RefCounted.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" -#include "public/platform/WebViewScheduler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/WebScheduler.cpp b/third_party/WebKit/Source/platform/WebScheduler.cpp index 92acd20..4a9752fe 100644 --- a/third_party/WebKit/Source/platform/WebScheduler.cpp +++ b/third_party/WebKit/Source/platform/WebScheduler.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "public/platform/WebScheduler.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/WebFrameScheduler.h" #include "platform/wtf/Assertions.h"
diff --git a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp index f19c6a5..b605e84 100644 --- a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp +++ b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp
@@ -6,9 +6,9 @@ #include <memory> #include "platform/heap/SafePoint.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/Threading.h" -#include "public/platform/WebScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp index 3da3c45..bb1f4cc0 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp
@@ -74,7 +74,7 @@ MutexLocker locker(mutex); RefPtr<AudioBus> bus; - AudioBusMap::iterator iterator = audio_bus_map.Find(subject_name); + AudioBusMap::iterator iterator = audio_bus_map.find(subject_name); if (iterator == audio_bus_map.end()) { RefPtr<AudioBus> concatenated_impulse_responses( AudioBus::LoadPlatformResource(subject_name.Utf8().data(),
diff --git a/third_party/WebKit/Source/bindings/core/v8/Microtask.cpp b/third_party/WebKit/Source/platform/bindings/Microtask.cpp similarity index 97% rename from third_party/WebKit/Source/bindings/core/v8/Microtask.cpp rename to third_party/WebKit/Source/platform/bindings/Microtask.cpp index d52f6886..6275b88 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Microtask.cpp +++ b/third_party/WebKit/Source/platform/bindings/Microtask.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "bindings/core/v8/Microtask.h" +#include "platform/bindings/Microtask.h" #include "platform/ScriptForbiddenScope.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/bindings/Microtask.h b/third_party/WebKit/Source/platform/bindings/Microtask.h new file mode 100644 index 0000000..bdf7089c --- /dev/null +++ b/third_party/WebKit/Source/platform/bindings/Microtask.h
@@ -0,0 +1,78 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Google Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Microtask_h +#define Microtask_h + +#include "platform/PlatformExport.h" +#include "platform/WebTaskRunner.h" +#include "platform/wtf/Allocator.h" +#include "platform/wtf/Functional.h" +#include "v8/include/v8.h" + +namespace blink { + +// C++ calls into script contexts which are "owned" by blink (created in a +// process where WebKit.cpp initializes v8) must declare their type: +// +// 1. Calls into page/author script from a frame +// 2. Calls into page/author script from a worker +// 3. Calls into internal script (typically setup/teardown work) +// +// Debug-time checking of this is enforced via v8::MicrotasksScope. +// +// Calls of type (1) should generally go through ScriptController, as inspector +// instrumentation is needed. ScriptController allocates V8RecursionScope for +// you. +// +// Calls of type (2) should always stack-allocate a +// v8::MicrotasksScope(kRunMicrtoasks) in the same block as the call into +// script. +// +// Calls of type (3) should stack allocate a +// v8::MicrotasksScope(kDoNotRunMicrotasks) -- this skips work that is spec'd to +// happen at the end of the outer-most script stack frame of calls into page +// script: +// http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint +class PLATFORM_EXPORT Microtask { + STATIC_ONLY(Microtask); + + public: + static void PerformCheckpoint(v8::Isolate*); + + // TODO(jochen): Make all microtasks pass in the ScriptState they want to be + // executed in. Until then, all microtasks have to keep track of their + // ScriptState themselves. + static void EnqueueMicrotask(std::unique_ptr<WTF::Closure>); +}; + +} // namespace blink + +#endif // Microtask_h
diff --git a/third_party/WebKit/Source/platform/bindings/OWNERS b/third_party/WebKit/Source/platform/bindings/OWNERS new file mode 100644 index 0000000..bd84cc0e --- /dev/null +++ b/third_party/WebKit/Source/platform/bindings/OWNERS
@@ -0,0 +1,2 @@ +# Bindings OWNERS +file://third_party/WebKit/Source/bindings/OWNERS
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index 76efde5..6153149d 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -214,7 +214,7 @@ g_fallback_list_shaper_cache = new FallbackListShaperCache; FallbackListShaperCache::iterator it = - g_fallback_list_shaper_cache->Find(key); + g_fallback_list_shaper_cache->find(key); ShapeCache* result = nullptr; if (it == g_fallback_list_shaper_cache->end()) { result = new ShapeCache(); @@ -248,7 +248,7 @@ const FontPlatformData& platform_data) { FontVerticalDataCache& font_vertical_data_cache = FontVerticalDataCacheInstance(); - FontVerticalDataCache::iterator result = font_vertical_data_cache.Find(key); + FontVerticalDataCache::iterator result = font_vertical_data_cache.find(key); if (result != font_vertical_data_cache.end()) return result.Get()->value;
diff --git a/third_party/WebKit/Source/platform/fonts/FontDataCache.cpp b/third_party/WebKit/Source/platform/fonts/FontDataCache.cpp index 724d256..f278290 100644 --- a/third_party/WebKit/Source/platform/fonts/FontDataCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontDataCache.cpp
@@ -60,7 +60,7 @@ return nullptr; } - Cache::iterator result = cache_.Find(platform_data); + Cache::iterator result = cache_.find(platform_data); if (result == cache_.end()) { std::pair<RefPtr<SimpleFontData>, unsigned> new_value( SimpleFontData::Create(*platform_data, nullptr, false, @@ -100,7 +100,7 @@ void FontDataCache::Release(const SimpleFontData* font_data) { DCHECK(!font_data->IsCustomFont()); - Cache::iterator it = cache_.Find(&(font_data->PlatformData())); + Cache::iterator it = cache_.find(&(font_data->PlatformData())); DCHECK_NE(it, cache_.end()); if (it == cache_.end()) return;
diff --git a/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp b/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp index e36e57f1..58b8dda 100644 --- a/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp +++ b/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettings.cpp
@@ -62,7 +62,7 @@ ScriptFontFamilyMap& font_map, const AtomicString& family, UScriptCode script) { - ScriptFontFamilyMap::iterator it = font_map.Find(static_cast<int>(script)); + ScriptFontFamilyMap::iterator it = font_map.find(static_cast<int>(script)); if (family.IsEmpty()) { if (it == font_map.end()) return; @@ -78,7 +78,7 @@ const ScriptFontFamilyMap& font_map, UScriptCode script) const { ScriptFontFamilyMap::iterator it = - const_cast<ScriptFontFamilyMap&>(font_map).Find(static_cast<int>(script)); + const_cast<ScriptFontFamilyMap&>(font_map).find(static_cast<int>(script)); if (it != font_map.end()) { // Replace with the first available font if it starts with ",". if (!it->value.IsEmpty() && it->value[0] == ',')
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp index 1f0216ec..4b1a21b6 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -157,7 +157,7 @@ } HarfBuzzFace::~HarfBuzzFace() { - HarfBuzzFontCache::iterator result = GetHarfBuzzFontCache()->Find(unique_id_); + HarfBuzzFontCache::iterator result = GetHarfBuzzFontCache()->find(unique_id_); SECURITY_DCHECK(result != GetHarfBuzzFontCache()->end()); DCHECK_GT(result.Get()->value->RefCount(), 1); result.Get()->value->Deref();
diff --git a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp index 6d2ce53..c9ea688 100644 --- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp +++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
@@ -243,7 +243,7 @@ #if OS(WIN) if (sideloaded_fonts_) { HashMap<String, sk_sp<SkTypeface>>::iterator sideloaded_font = - sideloaded_fonts_->Find(name.data()); + sideloaded_fonts_->find(name.data()); if (sideloaded_font != sideloaded_fonts_->end()) return sideloaded_font->value; }
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index ae69049..9244154a 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -41,11 +41,11 @@ #include "platform/graphics/gpu/SharedContextRateLimiter.h" #include "platform/graphics/paint/PaintCanvas.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "public/platform/WebGraphicsContext3DProvider.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebTraceLocation.h" #include "skia/ext/texture_handle.h" #include "third_party/skia/include/core/SkColorSpaceXformCanvas.h"
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 17ba8fe6..332b050 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -38,12 +38,12 @@ #include "platform/graphics/paint/PaintFlags.h" #include "platform/graphics/test/FakeGLES2Interface.h" #include "platform/graphics/test/FakeWebGraphicsContext3DProvider.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/RefPtr.h" #include "public/platform/Platform.h" #include "public/platform/WebExternalBitmap.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "skia/ext/texture_handle.h"
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp index 8ba33a0..7ff18f7 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
@@ -140,7 +140,7 @@ // The corresponding mutation should reflect the changed values. EXPECT_EQ(1ul, mutations.map.size()); - const CompositorMutation& mutation = *mutations.map.Find(primary_id)->value; + const CompositorMutation& mutation = *mutations.map.find(primary_id)->value; EXPECT_TRUE(mutation.IsOpacityMutated()); EXPECT_TRUE(mutation.IsTransformMutated()); EXPECT_TRUE(mutation.IsScrollLeftMutated());
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index 6872a61..b021d59 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -648,7 +648,7 @@ if (rendering_context3d_) { RenderingContextMap::const_iterator it = - rendering_context_map.Find(rendering_context3d_); + rendering_context_map.find(rendering_context3d_); int context_id = rendering_context_map.size() + 1; if (it == rendering_context_map.end()) rendering_context_map.Set(rendering_context3d_, context_id);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index 30ef9b2..28b1a68 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -35,6 +35,7 @@ #include "platform/animation/CompositorFloatAnimationCurve.h" #include "platform/animation/CompositorTargetProperty.h" #include "platform/graphics/CompositorElementId.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollableArea.h" #include "platform/testing/FakeGraphicsLayer.h" #include "platform/testing/FakeGraphicsLayerClient.h" @@ -47,7 +48,6 @@ #include "public/platform/WebCompositorSupport.h" #include "public/platform/WebLayer.h" #include "public/platform/WebLayerTreeView.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp index bd1a528..03293e2 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -64,7 +64,7 @@ DCHECK(decoder); MutexLocker lock(mutex_); - DecoderCacheMap::iterator iter = decoder_cache_map_.Find( + DecoderCacheMap::iterator iter = decoder_cache_map_.find( DecoderCacheEntry::MakeCacheKey(generator, scaled_size, alpha_option)); if (iter == decoder_cache_map_.end()) return false; @@ -81,7 +81,7 @@ void ImageDecodingStore::UnlockDecoder(const ImageFrameGenerator* generator, const ImageDecoder* decoder) { MutexLocker lock(mutex_); - DecoderCacheMap::iterator iter = decoder_cache_map_.Find( + DecoderCacheMap::iterator iter = decoder_cache_map_.find( DecoderCacheEntry::MakeCacheKey(generator, decoder)); SECURITY_DCHECK(iter != decoder_cache_map_.end()); @@ -112,7 +112,7 @@ Vector<std::unique_ptr<CacheEntry>> cache_entries_to_delete; { MutexLocker lock(mutex_); - DecoderCacheMap::iterator iter = decoder_cache_map_.Find( + DecoderCacheMap::iterator iter = decoder_cache_map_.find( DecoderCacheEntry::MakeCacheKey(generator, decoder)); SECURITY_DCHECK(iter != decoder_cache_map_.end()); @@ -247,7 +247,7 @@ heap_memory_usage_in_bytes_ -= cache_entry_bytes; // Remove entry from identifier map. - typename V::iterator iter = identifier_map->Find(cache_entry->Generator()); + typename V::iterator iter = identifier_map->find(cache_entry->Generator()); DCHECK(iter != identifier_map->end()); iter->value.erase(cache_entry->CacheKey()); if (!iter->value.size()) @@ -281,7 +281,7 @@ V* identifier_map, const ImageFrameGenerator* generator, Vector<std::unique_ptr<CacheEntry>>* deletion_list) { - typename V::iterator iter = identifier_map->Find(generator); + typename V::iterator iter = identifier_map->find(generator); if (iter == identifier_map->end()) return;
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp index 0d0d62e..b692061 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp
@@ -40,7 +40,7 @@ OffscreenCanvasPlaceholder* OffscreenCanvasPlaceholder::GetPlaceholderById( unsigned placeholder_id) { - PlaceholderIdMap::iterator it = placeholderRegistry().Find(placeholder_id); + PlaceholderIdMap::iterator it = placeholderRegistry().find(placeholder_id); if (it == placeholderRegistry().end()) return nullptr; return it->value; @@ -56,7 +56,7 @@ void OffscreenCanvasPlaceholder::UnregisterPlaceholder() { if (!IsPlaceholderRegistered()) return; - DCHECK(placeholderRegistry().Find(placeholder_id_)->value == this); + DCHECK(placeholderRegistry().find(placeholder_id_)->value == this); placeholderRegistry().erase(placeholder_id_); placeholder_id_ = kNoPlaceholderId; }
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp index 8de8869..ab4e692 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
@@ -162,7 +162,7 @@ if (!transform_node) return kSecondaryRootNodeId; - auto it = transform_node_map_.Find(transform_node); + auto it = transform_node_map_.find(transform_node); if (it != transform_node_map_.end()) return it->value; @@ -221,7 +221,7 @@ if (!clip_node) return kSecondaryRootNodeId; - auto it = clip_node_map_.Find(clip_node); + auto it = clip_node_map_.find(clip_node); if (it != clip_node_map_.end()) return it->value; @@ -260,7 +260,7 @@ if (!scroll_node) return kSecondaryRootNodeId; - auto it = scroll_node_map_.Find(scroll_node); + auto it = scroll_node_map_.find(scroll_node); if (it != scroll_node_map_.end()) return it->value;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h index 35c078cc..c231f09 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h
@@ -262,7 +262,7 @@ void DestroyImageCHROMIUM(GLuint image_id) { image_sizes_.erase(image_id); // No textures should be bound to this. - CHECK(image_to_texture_map_.Find(image_id) == image_to_texture_map_.end()); + CHECK(image_to_texture_map_.find(image_id) == image_to_texture_map_.end()); image_sizes_.erase(image_id); DestroyImageMock(image_id); } @@ -271,7 +271,7 @@ void BindTexImage2DCHROMIUM(GLenum target, GLint image_id) { if (target == ImageCHROMIUMTextureTarget()) { texture_sizes_.Set(bound_textures_[target], - image_sizes_.Find(image_id)->value); + image_sizes_.find(image_id)->value); image_to_texture_map_.Set(image_id, bound_textures_[target]); BindTexImage2DMock(image_id); }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h index d773626a..76be310 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef SharedGpuContext_h +#define SharedGpuContext_h + #include "platform/PlatformExport.h" #include "platform/wtf/ThreadSpecific.h" @@ -60,3 +63,5 @@ }; } // blink + +#endif // SharedGpuContext_h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index 85d87fa6..fc8ebc1a 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -133,7 +133,7 @@ PaintController::SubsequenceMarkers* PaintController::GetSubsequenceMarkers( const DisplayItemClient& client) { - auto result = current_cached_subsequences_.Find(&client); + auto result = current_cached_subsequences_.find(&client); if (result == current_cached_subsequences_.end()) return nullptr; return &result->value; @@ -159,7 +159,7 @@ } } - DCHECK(new_cached_subsequences_.Find(&client) == + DCHECK(new_cached_subsequences_.find(&client) == new_cached_subsequences_.end()); new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end)); @@ -185,7 +185,7 @@ #if DCHECK_IS_ON() // Also remove the index pointing to the removed display item. - IndicesByClientMap::iterator it = new_display_item_indices_by_client_.Find( + IndicesByClientMap::iterator it = new_display_item_indices_by_client_.find( &new_display_item_list_.Last().Client()); if (it != new_display_item_indices_by_client_.end()) { Vector<size_t>& indices = it->value; @@ -326,7 +326,7 @@ const IndicesByClientMap& display_item_indices_by_client, const DisplayItemList& list) { IndicesByClientMap::const_iterator it = - display_item_indices_by_client.Find(&id.client); + display_item_indices_by_client.find(&id.client); if (it == display_item_indices_by_client.end()) return kNotFound; @@ -351,7 +351,7 @@ return; IndicesByClientMap::iterator it = - display_item_indices_by_client.Find(&display_item.Client()); + display_item_indices_by_client.find(&display_item.Client()); Vector<size_t>& indices = it == display_item_indices_by_client.end() ? display_item_indices_by_client @@ -688,7 +688,7 @@ // Add skipped old chunks into the index. if (old_chunk.id) { - auto it = out_of_order_chunk_indices_.Find(&old_chunk.id->client); + auto it = out_of_order_chunk_indices_.find(&old_chunk.id->client); Vector<size_t>& indices = it == out_of_order_chunk_indices_.end() ? out_of_order_chunk_indices_ @@ -701,7 +701,7 @@ } // Sequential matching reaches the end. Find from the out-of-order index. - auto it = out_of_order_chunk_indices_.Find(&new_chunk.id->client); + auto it = out_of_order_chunk_indices_.find(&new_chunk.id->client); if (it != out_of_order_chunk_indices_.end()) { for (size_t i : it->value) { if (new_chunk.Matches(old_chunks[i])) {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h b/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h index 3941afa1..945cc82 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h +++ b/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h
@@ -57,13 +57,13 @@ class PLATFORM_EXPORT RasterInvalidationTrackingMap { public: void AsJSON(TargetClass* key, JSONObject* json) { - auto it = invalidation_tracking_map_.Find(key); + auto it = invalidation_tracking_map_.find(key); if (it != invalidation_tracking_map_.end()) it->value.AsJSON(json); } void Remove(TargetClass* key) { - auto it = invalidation_tracking_map_.Find(key); + auto it = invalidation_tracking_map_.find(key); if (it != invalidation_tracking_map_.end()) invalidation_tracking_map_.erase(it); } @@ -74,7 +74,7 @@ } RasterInvalidationTracking* Find(TargetClass* key) { - auto it = invalidation_tracking_map_.Find(key); + auto it = invalidation_tracking_map_.find(key); if (it == invalidation_tracking_map_.end()) return nullptr; return &it->value;
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp index fddca3a..243e778f 100644 --- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -41,7 +41,7 @@ } void AddInteriorFixup(MovableReference* slot) { - auto it = interior_fixups_.Find(slot); + auto it = interior_fixups_.find(slot); // Ephemeron fixpoint iterations may cause repeated registrations. if (UNLIKELY(it != interior_fixups_.end())) { DCHECK(!it->value); @@ -66,7 +66,7 @@ #if DCHECK_IS_ON() DCHECK(HeapCompact::IsCompactableArena(ref_page->Arena()->ArenaIndex())); - auto it = fixups_.Find(reference); + auto it = fixups_.find(reference); DCHECK(it == fixups_.end() || it->value == slot); #endif @@ -127,7 +127,7 @@ continue; MovableReference* slot = reinterpret_cast<MovableReference*>(from + offset); - auto it = interior_fixups_.Find(slot); + auto it = interior_fixups_.find(slot); if (it == interior_fixups_.end()) continue; @@ -152,14 +152,14 @@ } void Relocate(Address from, Address to) { - auto it = fixups_.Find(from); + auto it = fixups_.find(from); DCHECK(it != fixups_.end()); #if DCHECK_IS_ON() BasePage* from_page = PageFromObject(from); DCHECK(relocatable_pages_.Contains(from_page)); #endif MovableReference* slot = reinterpret_cast<MovableReference*>(it->value); - auto interior = interior_fixups_.Find(slot); + auto interior = interior_fixups_.find(slot); if (interior != interior_fixups_.end()) { MovableReference* slot_location = reinterpret_cast<MovableReference*>(interior->value); @@ -201,7 +201,7 @@ *slot = to; size_t size = 0; - auto callback = fixup_callbacks_.Find(from); + auto callback = fixup_callbacks_.find(from); if (UNLIKELY(callback != fixup_callbacks_.end())) { size = HeapObjectHeader::FromPayload(to)->PayloadSize(); callback->value.second(callback->value.first, from, to, size);
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp index c451c59c..8eaca73 100644 --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -4116,10 +4116,10 @@ map->insert(key, IntVector()); map2->insert(key, IntDeque()); - HeapHashMap<void*, IntVector>::iterator it = map->Find(key); + HeapHashMap<void*, IntVector>::iterator it = map->find(key); EXPECT_EQ(0u, map->at(key).size()); - HeapHashMap<void*, IntDeque>::iterator it2 = map2->Find(key); + HeapHashMap<void*, IntDeque>::iterator it2 = map2->find(key); EXPECT_EQ(0u, map2->at(key).size()); it->value.push_back(IntWrapper::Create(42)); @@ -4175,7 +4175,7 @@ map->insert(key, IntSet()); - HeapHashMap<void*, IntSet>::iterator it = map->Find(key); + HeapHashMap<void*, IntSet>::iterator it = map->find(key); EXPECT_EQ(0u, map->at(key).size()); it->value.insert(IntWrapper::Create(42));
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 2f1eebb0..6512f5bf 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -47,6 +47,7 @@ #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" #include "platform/instrumentation/tracing/web_process_memory_dump.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/DataLog.h" #include "platform/wtf/PtrUtil.h" @@ -54,7 +55,6 @@ #include "platform/wtf/ThreadingPrimitives.h" #include "platform/wtf/allocator/Partitions.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h"
diff --git a/third_party/WebKit/Source/platform/json/JSONValues.cpp b/third_party/WebKit/Source/platform/json/JSONValues.cpp index 13e97b3..381f63d 100644 --- a/third_party/WebKit/Source/platform/json/JSONValues.cpp +++ b/third_party/WebKit/Source/platform/json/JSONValues.cpp
@@ -310,7 +310,7 @@ } JSONValue* JSONObject::Get(const String& name) const { - Dictionary::const_iterator it = data_.Find(name); + Dictionary::const_iterator it = data_.find(name); if (it == data_.end()) return nullptr; return it->value.get(); @@ -318,7 +318,7 @@ JSONObject::Entry JSONObject::at(size_t index) const { const String key = order_[index]; - return std::make_pair(key, data_.Find(key)->value.get()); + return std::make_pair(key, data_.find(key)->value.get()); } bool JSONObject::BooleanProperty(const String& name, bool default_value) const { @@ -353,7 +353,7 @@ void JSONObject::WriteJSON(StringBuilder* output) const { output->Append('{'); for (size_t i = 0; i < order_.size(); ++i) { - Dictionary::const_iterator it = data_.Find(order_[i]); + Dictionary::const_iterator it = data_.find(order_[i]); CHECK(it != data_.end()); if (i) output->Append(','); @@ -368,7 +368,7 @@ int depth) const { output->Append("{\n"); for (size_t i = 0; i < order_.size(); ++i) { - Dictionary::const_iterator it = data_.Find(order_[i]); + Dictionary::const_iterator it = data_.find(order_[i]); CHECK(it != data_.end()); if (i) output->Append(",\n"); @@ -386,7 +386,7 @@ std::unique_ptr<JSONObject> result = JSONObject::Create(); for (size_t i = 0; i < order_.size(); ++i) { String key = order_[i]; - Dictionary::const_iterator value = data_.Find(key); + Dictionary::const_iterator value = data_.find(key); DCHECK(value != data_.end() && value->value); result->SetValue(key, value->value->Clone()); }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp index 8cbba33..95cbd432 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp
@@ -39,7 +39,7 @@ : resource_request_(resource_request), charset_(charset), options_(ResourceFetcher::DefaultResourceOptions()), - speculative_preload_(false), + speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), preload_discovery_time_(0.0), defer_(kNoDefer), origin_restriction_(kUseDefaultOriginRestrictionForType), @@ -52,7 +52,7 @@ const ResourceLoaderOptions& options) : resource_request_(resource_request), options_(options), - speculative_preload_(false), + speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), preload_discovery_time_(0.0), defer_(kNoDefer), origin_restriction_(kUseDefaultOriginRestrictionForType), @@ -65,7 +65,7 @@ const FetchInitiatorInfo& initiator) : resource_request_(resource_request), options_(ResourceFetcher::DefaultResourceOptions()), - speculative_preload_(false), + speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), preload_discovery_time_(0.0), defer_(kNoDefer), origin_restriction_(kUseDefaultOriginRestrictionForType), @@ -129,9 +129,10 @@ } } -void FetchParameters::SetSpeculativePreload(bool speculative_preload, - double discovery_time) { - speculative_preload_ = speculative_preload; +void FetchParameters::SetSpeculativePreloadType( + SpeculativePreloadType speculative_preload_type, + double discovery_time) { + speculative_preload_type_ = speculative_preload_type; preload_discovery_time_ = discovery_time; }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h index a736299..f5b4842 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h
@@ -47,6 +47,11 @@ public: enum DeferOption { kNoDefer, kLazyLoad, kIdleLoad }; + enum class SpeculativePreloadType { + kNotSpeculative, + kInDocument, // The request was discovered in the main document + kInserted // The request was discovered in a document.write() + }; enum OriginRestriction { kUseDefaultOriginRestrictionForType, kRestrictToSameOrigin, @@ -103,9 +108,14 @@ return client_hint_preferences_; } - bool IsSpeculativePreload() const { return speculative_preload_; } - void SetSpeculativePreload(bool speculative_preload, - double discovery_time = 0); + bool IsSpeculativePreload() const { + return speculative_preload_type_ != SpeculativePreloadType::kNotSpeculative; + } + SpeculativePreloadType GetSpeculativePreloadType() const { + return speculative_preload_type_; + } + void SetSpeculativePreloadType(SpeculativePreloadType, + double discovery_time = 0); double PreloadDiscoveryTime() { return preload_discovery_time_; } @@ -162,7 +172,7 @@ ResourceRequest resource_request_; String charset_; ResourceLoaderOptions options_; - bool speculative_preload_; + SpeculativePreloadType speculative_preload_type_; double preload_discovery_time_; DeferOption defer_; OriginRestriction origin_restriction_;
diff --git a/third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp b/third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp index 9fc1cb7..2136580 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp
@@ -150,7 +150,7 @@ DCHECK(resource->Url().IsValid()); KURL url = RemoveFragmentIdentifierIfNeeded(resource->Url()); - ResourceMap::iterator it = resource_map->Find(url); + ResourceMap::iterator it = resource_map->find(url); if (it != resource_map->end()) { Resource* old_resource = it->value->GetResource(); CHECK_NE(old_resource, resource); @@ -173,7 +173,7 @@ return; KURL url = RemoveFragmentIdentifierIfNeeded(resource->Url()); - ResourceMap::iterator it = resources->Find(url); + ResourceMap::iterator it = resources->find(url); if (it == resources->end() || it->value->GetResource() != resource) return; RemoveInternal(resources, it);
diff --git a/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp index 4a230ac..f47eaff 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp
@@ -35,10 +35,10 @@ #include "platform/loader/fetch/MemoryCache.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceTimingInfo.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebURL.h" #include "public/platform/WebURLResponse.h"
diff --git a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp index cb136e1..b9ca511 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
@@ -44,6 +44,7 @@ #include "platform/loader/fetch/ResourceClientWalker.h" #include "platform/loader/fetch/ResourceLoader.h" #include "platform/network/HTTPParsers.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/KURL.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/MathExtras.h" @@ -53,7 +54,6 @@ #include "platform/wtf/text/StringBuilder.h" #include "public/platform/Platform.h" #include "public/platform/WebCachePolicy.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebSecurityOrigin.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index df468e2..79efbd9c 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -158,7 +158,7 @@ const ResourceRequest& resource_request, ResourcePriority::VisibilityStatus visibility, FetchParameters::DeferOption defer_option, - bool is_speculative_preload, + FetchParameters::SpeculativePreloadType speculative_preload_type, bool is_link_preload) { ResourceLoadPriority priority = TypeToPriority(type); @@ -189,7 +189,9 @@ // Preload late in document: Medium if (FetchParameters::kLazyLoad == defer_option) { priority = kResourceLoadPriorityLow; - } else if (is_speculative_preload && image_fetched_) { + } else if (speculative_preload_type == + FetchParameters::SpeculativePreloadType::kInDocument && + image_fetched_) { // Speculative preload is used as a signal for scripts at the bottom of // the document. priority = kResourceLoadPriorityMedium; @@ -515,7 +517,7 @@ resource_request.SetPriority(ComputeLoadPriority( factory.GetType(), params.GetResourceRequest(), ResourcePriority::kNotVisible, params.Defer(), - params.IsSpeculativePreload(), params.IsLinkPreload())); + params.GetSpeculativePreloadType(), params.IsLinkPreload())); InitializeResourceRequest(resource_request, factory.GetType(), params.Defer()); network_instrumentation::resourcePrioritySet(identifier, @@ -798,7 +800,7 @@ Resource* resource, const ResourceResponse& redirect_response, bool cross_origin) { - ResourceTimingInfoMap::iterator it = resource_timing_info_map_.Find(resource); + ResourceTimingInfoMap::iterator it = resource_timing_info_map_.find(resource); if (it != resource_timing_info_map_.end()) { it->value->AddRedirect(redirect_response, cross_origin); }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h index bd7e918..dafdd00 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
@@ -168,7 +168,8 @@ const ResourceRequest&, ResourcePriority::VisibilityStatus, FetchParameters::DeferOption = FetchParameters::kNoDefer, - bool is_speculative_preload = false, + FetchParameters::SpeculativePreloadType = + FetchParameters::SpeculativePreloadType::kNotSpeculative, bool is_link_preload = false); enum PrepareRequestResult { kAbort, kContinue, kBlock };
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm index ccca6e5..792166e 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm
@@ -34,13 +34,13 @@ #include "platform/geometry/IntRect.h" #include "platform/mac/BlockExceptions.h" #include "platform/mac/NSScrollerImpDetails.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollableArea.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/scroll/ScrollbarThemeMac.h" #include "platform/wtf/MathExtras.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" using namespace blink;
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp index a38c2ec..316f4cf 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp
@@ -99,7 +99,7 @@ AudioDestinationConsumer* consumer) { ASSERT(requires_consumer_); MutexLocker locker(audio_consumers_lock_); - auto it = audio_consumers_.Find(consumer); + auto it = audio_consumers_.find(consumer); if (it == audio_consumers_.end()) return false; audio_consumers_.erase(it);
diff --git a/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp b/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp index 774ac6b..c58813c 100644 --- a/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp +++ b/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp
@@ -109,7 +109,7 @@ } // New key/value, store the previous one if any. if (!key.IsEmpty()) { - if (key_value_pairs.Find(key) != key_value_pairs.end()) + if (key_value_pairs.find(key) != key_value_pairs.end()) DVLOG(1) << "Key duplicate found in MIME header. Key is '" << key << "', previous value replaced."; key_value_pairs.insert(key, value.ToString().StripWhiteSpace()); @@ -135,7 +135,7 @@ MIMEHeader* mime_header = MIMEHeader::Create(); KeyValueMap key_value_pairs = RetrieveKeyValuePairs(buffer); KeyValueMap::iterator mime_parameters_iterator = - key_value_pairs.Find("content-type"); + key_value_pairs.find("content-type"); if (mime_parameters_iterator != key_value_pairs.end()) { ParsedContentType parsed_content_type(mime_parameters_iterator->value, ParsedContentType::Mode::kRelaxed); @@ -158,17 +158,17 @@ } } - mime_parameters_iterator = key_value_pairs.Find("content-transfer-encoding"); + mime_parameters_iterator = key_value_pairs.find("content-transfer-encoding"); if (mime_parameters_iterator != key_value_pairs.end()) mime_header->content_transfer_encoding_ = ParseContentTransferEncoding(mime_parameters_iterator->value); - mime_parameters_iterator = key_value_pairs.Find("content-location"); + mime_parameters_iterator = key_value_pairs.find("content-location"); if (mime_parameters_iterator != key_value_pairs.end()) mime_header->content_location_ = mime_parameters_iterator->value; // See rfc2557 - section 8.3 - Use of the Content-ID header and CID URLs. - mime_parameters_iterator = key_value_pairs.Find("content-id"); + mime_parameters_iterator = key_value_pairs.find("content-id"); if (mime_parameters_iterator != key_value_pairs.end()) mime_header->content_id_ = mime_parameters_iterator->value;
diff --git a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h index abc9325..5a0ae4f7 100644 --- a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h +++ b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h
@@ -62,7 +62,7 @@ size_t size() const { return headers_.size(); } const_iterator begin() const { return headers_.begin(); } const_iterator end() const { return headers_.end(); } - const_iterator Find(const AtomicString& k) const { return headers_.Find(k); } + const_iterator Find(const AtomicString& k) const { return headers_.find(k); } void Clear() { headers_.clear(); } bool Contains(const AtomicString& k) const { return headers_.Contains(k); } const AtomicString& Get(const AtomicString& k) const {
diff --git a/third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp b/third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp index 65da95c1..800557c 100644 --- a/third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp +++ b/third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp
@@ -235,7 +235,7 @@ ObserverListMap& map, PassRefPtr<WebTaskRunner> task_runner) { MutexLocker locker(mutex_); - ObserverListMap::iterator it = map.Find(task_runner); + ObserverListMap::iterator it = map.find(task_runner); return it == map.end() ? nullptr : it->value.get(); }
diff --git a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp index fbab086..6755f4a 100644 --- a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp +++ b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
@@ -268,7 +268,7 @@ // and hence we don't need to care about non-ascii lowercasing. DCHECK(key.ToString().ContainsOnlyASCII()); String key_string = key.ToString().DeprecatedLower(); - if (mode_ == Mode::kStrict && map.Find(key_string) != map.end()) { + if (mode_ == Mode::kStrict && map.find(key_string) != map.end()) { DVLOG(1) << "Parameter " << key_string << " is defined multiple times."; return false; }
diff --git a/third_party/WebKit/public/platform/WebScheduler.h b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h similarity index 86% rename from third_party/WebKit/public/platform/WebScheduler.h rename to third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h index 9ebe578..99a3196 100644 --- a/third_party/WebKit/public/platform/WebScheduler.h +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WebScheduler_h -#define WebScheduler_h +#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_SCHEDULER_H_ +#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_SCHEDULER_H_ -#include "WebCommon.h" -#include "WebString.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" +#include "public/platform/WebString.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include "public/platform/WebViewScheduler.h" +#include "public/platform/scheduler/renderer/renderer_scheduler.h" #include <memory> @@ -86,14 +86,14 @@ // if the suspension count is zero and the current scheduler policy allows it. virtual void ResumeTimerQueue() = 0; - enum class NavigatingFrameType { kMainFrame, kChildFrame }; - // Tells the scheduler that a navigation task is pending. // TODO(alexclarke): Long term should this be a task trait? - virtual void AddPendingNavigation(NavigatingFrameType) = 0; + virtual void AddPendingNavigation( + scheduler::RendererScheduler::NavigatingFrameType) = 0; // Tells the scheduler that a navigation task is no longer pending. - virtual void RemovePendingNavigation(NavigatingFrameType) = 0; + virtual void RemovePendingNavigation( + scheduler::RendererScheduler::NavigatingFrameType) = 0; #ifdef INSIDE_BLINK // Helpers for posting bound functions as tasks. @@ -107,4 +107,4 @@ } // namespace blink -#endif // WebScheduler_h +#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_SCHEDULER_H_
diff --git a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc index 4fe93e9..553f8efe 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc
@@ -9,8 +9,8 @@ #include "base/single_thread_task_runner.h" #include "platform/scheduler/child/web_task_runner_impl.h" #include "platform/scheduler/child/worker_scheduler.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "public/platform/WebTraceLocation.h" -#include "public/platform/WebViewScheduler.h" namespace blink { namespace scheduler {
diff --git a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.h index a3fc829..c1745d9 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.h
@@ -11,8 +11,8 @@ #include "base/memory/ref_counted.h" #include "base/time/time.h" #include "platform/scheduler/base/task_queue.h" +#include "platform/scheduler/child/web_scheduler.h" #include "public/platform/WebCommon.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace blink { @@ -45,9 +45,10 @@ WebViewScheduler::WebViewSchedulerSettings*) override; void SuspendTimerQueue() override {} void ResumeTimerQueue() override {} - void AddPendingNavigation(WebScheduler::NavigatingFrameType type) override {} + void AddPendingNavigation( + scheduler::RendererScheduler::NavigatingFrameType type) override {} void RemovePendingNavigation( - WebScheduler::NavigatingFrameType type) override {} + scheduler::RendererScheduler::NavigatingFrameType type) override {} private: static void RunIdleTask(std::unique_ptr<WebThread::IdleTask> task,
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index 5f38fbdd..4ae63b51 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -1573,20 +1573,18 @@ UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); } -void RendererSchedulerImpl::AddPendingNavigation( - WebScheduler::NavigatingFrameType type) { +void RendererSchedulerImpl::AddPendingNavigation(NavigatingFrameType type) { helper_.CheckOnValidThread(); - if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame) { + if (type == NavigatingFrameType::kMainFrame) { GetMainThreadOnly().navigation_task_expected_count++; UpdatePolicy(); } } -void RendererSchedulerImpl::RemovePendingNavigation( - WebScheduler::NavigatingFrameType type) { +void RendererSchedulerImpl::RemovePendingNavigation(NavigatingFrameType type) { helper_.CheckOnValidThread(); DCHECK_GT(GetMainThreadOnly().navigation_task_expected_count, 0); - if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame && + if (type == NavigatingFrameType::kMainFrame && GetMainThreadOnly().navigation_task_expected_count > 0) { GetMainThreadOnly().navigation_task_expected_count--; UpdatePolicy();
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h index c6c937cd..b36150b 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h
@@ -101,8 +101,8 @@ void OnRendererForegrounded() override; void SuspendRenderer() override; void ResumeRenderer() override; - void AddPendingNavigation(WebScheduler::NavigatingFrameType type) override; - void RemovePendingNavigation(WebScheduler::NavigatingFrameType type) override; + void AddPendingNavigation(NavigatingFrameType type) override; + void RemovePendingNavigation(NavigatingFrameType type) override; void OnNavigationStarted() override; bool IsHighPriorityWorkAnticipated() override; bool ShouldYieldForHighPriorityWork() override;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc index 7422ede6..022f2cd8 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -2690,7 +2690,7 @@ SimulateExpensiveTasks(loading_task_runner_); ForceTouchStartToBeExpectedSoon(); scheduler_->AddPendingNavigation( - blink::WebScheduler::NavigatingFrameType::kChildFrame); + scheduler::RendererScheduler::NavigatingFrameType::kChildFrame); PostTestTasks(&run_order, "L1 D1"); RunUntilIdle(); @@ -2709,7 +2709,7 @@ SimulateExpensiveTasks(loading_task_runner_); ForceTouchStartToBeExpectedSoon(); scheduler_->AddPendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); PostTestTasks(&run_order, "L1 D1"); RunUntilIdle(); @@ -2726,7 +2726,7 @@ // After the nagigation has been cancelled, the expensive loading tasks should // get blocked. scheduler_->RemovePendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); run_order.clear(); PostTestTasks(&run_order, "L1 D1"); @@ -2751,9 +2751,9 @@ SimulateExpensiveTasks(loading_task_runner_); ForceTouchStartToBeExpectedSoon(); scheduler_->AddPendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); scheduler_->AddPendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); PostTestTasks(&run_order, "L1 D1"); RunUntilIdle(); @@ -2769,7 +2769,7 @@ run_order.clear(); scheduler_->RemovePendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); // Navigation task expected ref count non-zero so expensive tasks still not // blocked. PostTestTasks(&run_order, "L1 D1"); @@ -2786,7 +2786,7 @@ run_order.clear(); scheduler_->RemovePendingNavigation( - blink::WebScheduler::NavigatingFrameType::kMainFrame); + scheduler::RendererScheduler::NavigatingFrameType::kMainFrame); // Navigation task expected ref count is now zero, the expensive loading tasks // should get blocked. PostTestTasks(&run_order, "L1 D1");
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h index 9a8dd3f..8e8567b 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h
@@ -15,7 +15,7 @@ #include "platform/scheduler/base/cancelable_closure_holder.h" #include "platform/scheduler/base/time_domain.h" #include "platform/scheduler/renderer/budget_pool.h" -#include "public/platform/WebViewScheduler.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" namespace base { namespace trace_event {
diff --git a/third_party/WebKit/public/platform/WebViewScheduler.h b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler.h similarity index 90% rename from third_party/WebKit/public/platform/WebViewScheduler.h rename to third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler.h index e0c4d7f..07cbe577 100644 --- a/third_party/WebKit/public/platform/WebViewScheduler.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler.h
@@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WebViewScheduler_h -#define WebViewScheduler_h +#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_H_ +#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_H_ -#include "WebCommon.h" +#include "platform/wtf/Functional.h" #include "public/platform/BlameContext.h" +#include "public/platform/WebCommon.h" #include <memory> @@ -89,4 +90,4 @@ } // namespace blink -#endif // WebViewScheduler +#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_H_
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.h index ae28839..d869796 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.h
@@ -11,10 +11,11 @@ #include "base/macros.h" #include "platform/scheduler/base/task_queue.h" +#include "platform/scheduler/child/web_scheduler.h" +#include "platform/scheduler/child/web_task_runner_impl.h" #include "platform/scheduler/renderer/task_queue_throttler.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "public/platform/WebCommon.h" -#include "public/platform/WebScheduler.h" -#include "public/platform/WebViewScheduler.h" namespace base { namespace trace_event {
diff --git a/third_party/WebKit/Source/platform/scheduler/test/fake_renderer_scheduler.cc b/third_party/WebKit/Source/platform/scheduler/test/fake_renderer_scheduler.cc index 21322e8..c65d915 100644 --- a/third_party/WebKit/Source/platform/scheduler/test/fake_renderer_scheduler.cc +++ b/third_party/WebKit/Source/platform/scheduler/test/fake_renderer_scheduler.cc
@@ -75,11 +75,9 @@ void FakeRendererScheduler::ResumeRenderer() {} -void FakeRendererScheduler::AddPendingNavigation( - blink::WebScheduler::NavigatingFrameType type) {} +void FakeRendererScheduler::AddPendingNavigation(NavigatingFrameType type) {} -void FakeRendererScheduler::RemovePendingNavigation( - blink::WebScheduler::NavigatingFrameType type) {} +void FakeRendererScheduler::RemovePendingNavigation(NavigatingFrameType type) {} void FakeRendererScheduler::OnNavigationStarted() {}
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp index 2371117..7aac587 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -29,10 +29,10 @@ #include "platform/geometry/FloatPoint.h" #include "platform/geometry/IntRect.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h index 2fd5459..e2d1c5a 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h
@@ -7,12 +7,12 @@ #include <memory> #include "platform/heap/GarbageCollected.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollableArea.h" #include "platform/scroll/Scrollbar.h" #include "platform/scroll/ScrollbarThemeMock.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h index 4d74cf2..a7ade83 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h
@@ -35,13 +35,13 @@ #include <utility> #include "platform/PlatformExport.h" #include "platform/WebTaskRunner.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/Vector.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" namespace base {
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock_factory_impl.cc b/third_party/WebKit/Source/platform/testing/weburl_loader_mock_factory_impl.cc index 053278b..05151149 100644 --- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock_factory_impl.cc +++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock_factory_impl.cc
@@ -49,7 +49,7 @@ << response_info.file_path.MaybeAsASCII() << " does not exist."; } - DCHECK(url_to_response_info_.Find(url) == url_to_response_info_.end()); + DCHECK(url_to_response_info_.find(url) == url_to_response_info_.end()); url_to_response_info_.Set(url, response_info); } @@ -57,17 +57,17 @@ const WebURL& url, const WebURLResponse& response, const WebURLError& error) { - DCHECK(url_to_response_info_.Find(url) == url_to_response_info_.end()); + DCHECK(url_to_response_info_.find(url) == url_to_response_info_.end()); RegisterURL(url, response, WebString()); url_to_error_info_.Set(url, error); } void WebURLLoaderMockFactoryImpl::UnregisterURL(const blink::WebURL& url) { - URLToResponseMap::iterator iter = url_to_response_info_.Find(url); + URLToResponseMap::iterator iter = url_to_response_info_.find(url); DCHECK(iter != url_to_response_info_.end()); url_to_response_info_.erase(iter); - URLToErrorMap::iterator error_iter = url_to_error_info_.Find(url); + URLToErrorMap::iterator error_iter = url_to_error_info_.find(url); if (error_iter != url_to_error_info_.end()) url_to_error_info_.erase(error_iter); } @@ -110,7 +110,7 @@ } bool WebURLLoaderMockFactoryImpl::IsMockedURL(const blink::WebURL& url) { - return url_to_response_info_.Find(url) != url_to_response_info_.end(); + return url_to_response_info_.find(url) != url_to_response_info_.end(); } void WebURLLoaderMockFactoryImpl::CancelLoad(WebURLLoaderMock* loader) { @@ -146,12 +146,12 @@ WebURLError* error, WebData* data) { URLToErrorMap::const_iterator error_iter = - url_to_error_info_.Find(request.Url()); + url_to_error_info_.find(request.Url()); if (error_iter != url_to_error_info_.end()) *error = error_iter->value; URLToResponseMap::const_iterator iter = - url_to_response_info_.Find(request.Url()); + url_to_response_info_.find(request.Url()); if (iter == url_to_response_info_.end()) { // Non mocked URLs should not have been passed to the default URLLoader. NOTREACHED();
diff --git a/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp b/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp index e8c5c0d1..acab5e1 100644 --- a/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp
@@ -169,7 +169,7 @@ CreateSubtagScriptMap(script_name_code_map, kScriptNameCodeList, WTF_ARRAY_LENGTH(kScriptNameCodeList)); - const auto& it = script_name_code_map.Find(script_name); + const auto& it = script_name_code_map.find(script_name); if (it != script_name_code_map.end()) return it->value; return USCRIPT_INVALID_CODE; @@ -463,7 +463,7 @@ String canonical_locale = locale; canonical_locale.Replace('_', '-'); while (!canonical_locale.IsEmpty()) { - const auto& it = locale_script_map.Find(canonical_locale); + const auto& it = locale_script_map.find(canonical_locale); if (it != locale_script_map.end()) return it->value; size_t pos = canonical_locale.ReverseFind('-'); @@ -491,7 +491,7 @@ CreateSubtagScriptMap(region_script_map, kRegionScriptList, WTF_ARRAY_LENGTH(kRegionScriptList)); - const auto& it = region_script_map.Find(region); + const auto& it = region_script_map.find(region); return it != region_script_map.end() ? it->value : USCRIPT_COMMON; }
diff --git a/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp b/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp index 95da376..f5c263f 100644 --- a/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp +++ b/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp
@@ -149,7 +149,7 @@ hyphenation.Clear(); DEFINE_STATIC_LOCAL(LocaleMap, locale_fallback, (CreateLocaleFallbackMap())); - const auto& it = locale_fallback.Find(locale); + const auto& it = locale_fallback.find(locale); if (it != locale_fallback.end()) return LayoutLocale::Get(it->value)->GetHyphenation();
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp index 677e2f8..415260a 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -232,7 +232,7 @@ String source_string = source_origin.ToString(); OriginAccessMap& map = GetOriginAccessMap(); - OriginAccessMap::iterator it = map.Find(source_string); + OriginAccessMap::iterator it = map.find(source_string); if (it == map.end()) return;
diff --git a/third_party/WebKit/Source/platform/wtf/HashCountedSet.h b/third_party/WebKit/Source/platform/wtf/HashCountedSet.h index 5fc0cc81..47b2e8c 100644 --- a/third_party/WebKit/Source/platform/wtf/HashCountedSet.h +++ b/third_party/WebKit/Source/platform/wtf/HashCountedSet.h
@@ -76,7 +76,7 @@ const_iterator begin() const { return impl_.begin(); } const_iterator end() const { return impl_.end(); } - iterator find(const ValueType& value) { return impl_.Find(value); } + iterator find(const ValueType& value) { return impl_.find(value); } const_iterator find(const ValueType& value) const { return impl_.find(value); }
diff --git a/third_party/WebKit/Source/platform/wtf/HashMap.h b/third_party/WebKit/Source/platform/wtf/HashMap.h index 32f845fe..378e2a8b 100644 --- a/third_party/WebKit/Source/platform/wtf/HashMap.h +++ b/third_party/WebKit/Source/platform/wtf/HashMap.h
@@ -133,8 +133,8 @@ return static_cast<const HashMapValuesProxy&>(*this); } - iterator Find(KeyPeekInType); - const_iterator Find(KeyPeekInType) const; + iterator find(KeyPeekInType); + const_iterator find(KeyPeekInType) const; bool Contains(KeyPeekInType) const; MappedPeekType at(KeyPeekInType) const; @@ -447,8 +447,8 @@ typename X, typename Y> inline typename HashMap<T, U, V, W, X, Y>::iterator -HashMap<T, U, V, W, X, Y>::Find(KeyPeekInType key) { - return impl_.Find(key); +HashMap<T, U, V, W, X, Y>::find(KeyPeekInType key) { + return impl_.find(key); } template <typename T, @@ -458,8 +458,8 @@ typename X, typename Y> inline typename HashMap<T, U, V, W, X, Y>::const_iterator -HashMap<T, U, V, W, X, Y>::Find(KeyPeekInType key) const { - return impl_.Find(key); +HashMap<T, U, V, W, X, Y>::find(KeyPeekInType key) const { + return impl_.find(key); } template <typename T, @@ -615,7 +615,7 @@ typename X, typename Y> inline void HashMap<T, U, V, W, X, Y>::erase(KeyPeekInType key) { - erase(Find(key)); + erase(find(key)); } template <typename T, @@ -635,7 +635,7 @@ typename X, typename Y> auto HashMap<T, U, V, W, X, Y>::Take(KeyPeekInType key) -> MappedType { - iterator it = Find(key); + iterator it = find(key); if (it == end()) return MappedTraits::EmptyValue(); MappedType result = std::move(it->value); @@ -680,7 +680,7 @@ const_iterator a_end = a.end(); const_iterator b_end = b.end(); for (const_iterator it = a.begin(); it != a_end; ++it) { - const_iterator b_pos = b.Find(it->key); + const_iterator b_pos = b.find(it->key); if (b_pos == b_end || it->value != b_pos->value) return false; }
diff --git a/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp b/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp index 25e388c..b3e97ded 100644 --- a/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp
@@ -178,9 +178,9 @@ DummyRefCounted* raw_ptr = ptr.Get(); EXPECT_TRUE(map.Contains(raw_ptr)); - EXPECT_NE(map.end(), map.Find(raw_ptr)); + EXPECT_NE(map.end(), map.find(raw_ptr)); EXPECT_TRUE(map.Contains(ptr)); - EXPECT_NE(map.end(), map.Find(ptr)); + EXPECT_NE(map.end(), map.find(ptr)); EXPECT_EQ(1, DummyRefCounted::ref_invokes_count_); ptr.Clear(); @@ -266,15 +266,15 @@ EXPECT_EQ(0u, result.stored_value->value.size()); result.stored_value->value.push_back(11); - EXPECT_EQ(1u, map.Find(1)->value.size()); - EXPECT_EQ(11, map.Find(1)->value.front()); + EXPECT_EQ(1u, map.find(1)->value.size()); + EXPECT_EQ(11, map.find(1)->value.front()); IntVectorMap::AddResult result2 = map.insert(1, Vector<int>()); EXPECT_FALSE(result2.is_new_entry); EXPECT_EQ(1, result.stored_value->key); EXPECT_EQ(1u, result.stored_value->value.size()); EXPECT_EQ(11, result.stored_value->value.front()); - EXPECT_EQ(11, map.Find(1)->value.front()); + EXPECT_EQ(11, map.find(1)->value.front()); } class InstanceCounter { @@ -367,12 +367,12 @@ EXPECT_EQ(1, add_result.stored_value->key); EXPECT_EQ(10, add_result.stored_value->value.Value()); } - auto iter = map.Find(1); + auto iter = map.find(1); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key); EXPECT_EQ(10, iter->value.Value()); - iter = map.Find(2); + iter = map.find(2); EXPECT_TRUE(iter == map.end()); // Try to add more to trigger rehashing. @@ -383,12 +383,12 @@ EXPECT_EQ(i * 10, add_result.stored_value->value.Value()); } - iter = map.Find(1); + iter = map.find(1); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key); EXPECT_EQ(10, iter->value.Value()); - iter = map.Find(7); + iter = map.find(7); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(7, iter->key); EXPECT_EQ(70, iter->value.Value()); @@ -401,12 +401,12 @@ } map.erase(11); - iter = map.Find(11); + iter = map.find(11); EXPECT_TRUE(iter == map.end()); MoveOnly one_thirty(map.Take(13)); EXPECT_EQ(130, one_thirty.Value()); - iter = map.Find(13); + iter = map.find(13); EXPECT_TRUE(iter == map.end()); map.clear(); @@ -423,12 +423,12 @@ EXPECT_EQ(1, add_result.stored_value->key.Value()); EXPECT_EQ(10, add_result.stored_value->value); } - auto iter = map.Find(MoveOnly(1)); + auto iter = map.find(MoveOnly(1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.Value()); EXPECT_EQ(10, iter->value); - iter = map.Find(MoveOnly(2)); + iter = map.find(MoveOnly(2)); EXPECT_TRUE(iter == map.end()); for (int i = 2; i < 32; ++i) { @@ -438,12 +438,12 @@ EXPECT_EQ(i * 10, add_result.stored_value->value); } - iter = map.Find(MoveOnly(1)); + iter = map.find(MoveOnly(1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.Value()); EXPECT_EQ(10, iter->value); - iter = map.Find(MoveOnly(7)); + iter = map.find(MoveOnly(7)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(7, iter->key.Value()); EXPECT_EQ(70, iter->value); @@ -456,12 +456,12 @@ } map.erase(MoveOnly(11)); - iter = map.Find(MoveOnly(11)); + iter = map.find(MoveOnly(11)); EXPECT_TRUE(iter == map.end()); int one_thirty = map.Take(MoveOnly(13)); EXPECT_EQ(130, one_thirty); - iter = map.Find(MoveOnly(13)); + iter = map.find(MoveOnly(13)); EXPECT_TRUE(iter == map.end()); map.clear(); @@ -513,13 +513,13 @@ EXPECT_EQ(1, *add_result.stored_value->key); EXPECT_EQ(1, add_result.stored_value->value); } - auto iter = map.Find(one_pointer); + auto iter = map.find(one_pointer); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(one_pointer, iter->key.get()); EXPECT_EQ(1, iter->value); Pointer nonexistent(new int(42)); - iter = map.Find(nonexistent.get()); + iter = map.find(nonexistent.get()); EXPECT_TRUE(iter == map.end()); // Insert more to cause a rehash. @@ -530,7 +530,7 @@ EXPECT_EQ(i, add_result.stored_value->value); } - iter = map.Find(one_pointer); + iter = map.find(one_pointer); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(one_pointer, iter->key.get()); EXPECT_EQ(1, iter->value); @@ -538,7 +538,7 @@ EXPECT_EQ(1, map.Take(one_pointer)); // From now on, |onePointer| is a dangling pointer. - iter = map.Find(one_pointer); + iter = map.find(one_pointer); EXPECT_TRUE(iter == map.end()); } @@ -552,7 +552,7 @@ EXPECT_EQ(1, add_result.stored_value->key); EXPECT_EQ(1, *add_result.stored_value->value); } - auto iter = map.Find(1); + auto iter = map.find(1); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key); EXPECT_EQ(1, *iter->value); @@ -561,7 +561,7 @@ EXPECT_TRUE(one_pointer); EXPECT_EQ(1, *one_pointer); - iter = map.Find(42); + iter = map.find(42); EXPECT_TRUE(iter == map.end()); for (int i = 2; i < 32; ++i) { @@ -571,7 +571,7 @@ EXPECT_EQ(i, *add_result.stored_value->value); } - iter = map.Find(1); + iter = map.find(1); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key); EXPECT_EQ(1, *iter->value); @@ -583,7 +583,7 @@ Pointer empty(map.Take(42)); EXPECT_TRUE(!empty); - iter = map.Find(1); + iter = map.find(1); EXPECT_TRUE(iter == map.end()); { @@ -605,13 +605,13 @@ EXPECT_EQ(-1, add_result.stored_value->key.second); EXPECT_EQ(10, add_result.stored_value->value); } - auto iter = map.Find(Pair(MoveOnly(1), -1)); + auto iter = map.find(Pair(MoveOnly(1), -1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.first.Value()); EXPECT_EQ(-1, iter->key.second); EXPECT_EQ(10, iter->value); - iter = map.Find(Pair(MoveOnly(1), 0)); + iter = map.find(Pair(MoveOnly(1), 0)); EXPECT_TRUE(iter == map.end()); for (int i = 2; i < 32; ++i) { @@ -622,13 +622,13 @@ EXPECT_EQ(i * 10, add_result.stored_value->value); } - iter = map.Find(Pair(MoveOnly(1), -1)); + iter = map.find(Pair(MoveOnly(1), -1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.first.Value()); EXPECT_EQ(-1, iter->key.second); EXPECT_EQ(10, iter->value); - iter = map.Find(Pair(MoveOnly(7), -7)); + iter = map.find(Pair(MoveOnly(7), -7)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(7, iter->key.first.Value()); EXPECT_EQ(-7, iter->key.second); @@ -643,12 +643,12 @@ } map.erase(Pair(MoveOnly(11), -11)); - iter = map.Find(Pair(MoveOnly(11), -11)); + iter = map.find(Pair(MoveOnly(11), -11)); EXPECT_TRUE(iter == map.end()); int one_thirty = map.Take(Pair(MoveOnly(13), -13)); EXPECT_EQ(130, one_thirty); - iter = map.Find(Pair(MoveOnly(13), -13)); + iter = map.find(Pair(MoveOnly(13), -13)); EXPECT_TRUE(iter == map.end()); map.clear();
diff --git a/third_party/WebKit/Source/platform/wtf/HashSet.h b/third_party/WebKit/Source/platform/wtf/HashSet.h index 6b3395c..e6ca4af 100644 --- a/third_party/WebKit/Source/platform/wtf/HashSet.h +++ b/third_party/WebKit/Source/platform/wtf/HashSet.h
@@ -91,7 +91,7 @@ iterator begin() const; iterator end() const; - iterator Find(ValuePeekInType) const; + iterator find(ValuePeekInType) const; bool Contains(ValuePeekInType) const; // An alternate version of find() that finds the object by hashing and @@ -214,9 +214,9 @@ } template <typename T, typename U, typename V, typename W> -inline typename HashSet<T, U, V, W>::iterator HashSet<T, U, V, W>::Find( +inline typename HashSet<T, U, V, W>::iterator HashSet<T, U, V, W>::find( ValuePeekInType value) const { - return impl_.Find(value); + return impl_.find(value); } template <typename Value, @@ -278,7 +278,7 @@ template <typename T, typename U, typename V, typename W> inline void HashSet<T, U, V, W>::erase(ValuePeekInType value) { - erase(Find(value)); + erase(find(value)); } template <typename T, typename U, typename V, typename W> @@ -299,7 +299,7 @@ template <typename T, typename U, typename V, typename W> inline auto HashSet<T, U, V, W>::Take(ValuePeekInType value) -> ValueType { - return Take(Find(value)); + return Take(find(value)); } template <typename T, typename U, typename V, typename W>
diff --git a/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp b/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp index 6416469..e123ff0 100644 --- a/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp
@@ -102,7 +102,7 @@ EXPECT_FALSE(deleted1); EXPECT_EQ(1UL, set.size()); - OwnPtrSet::iterator it1 = set.Find(ptr1); + OwnPtrSet::iterator it1 = set.find(ptr1); EXPECT_NE(set.end(), it1); EXPECT_EQ(ptr1, (*it1).get()); @@ -115,7 +115,7 @@ EXPECT_FALSE(deleted2); EXPECT_EQ(2UL, set.size()); - OwnPtrSet::iterator it2 = set.Find(ptr2); + OwnPtrSet::iterator it2 = set.find(ptr2); EXPECT_NE(set.end(), it2); EXPECT_EQ(ptr2, (*it2).get()); @@ -190,9 +190,9 @@ DummyRefCounted* raw_ptr = ptr.Get(); EXPECT_TRUE(set.Contains(raw_ptr)); - EXPECT_NE(set.end(), set.Find(raw_ptr)); + EXPECT_NE(set.end(), set.find(raw_ptr)); EXPECT_TRUE(set.Contains(ptr)); - EXPECT_NE(set.end(), set.Find(ptr)); + EXPECT_NE(set.end(), set.find(ptr)); ptr.Clear(); EXPECT_FALSE(is_deleted); @@ -355,11 +355,11 @@ EXPECT_EQ(1, add_result.stored_value->Value()); EXPECT_EQ(1, add_result.stored_value->Id()); } - auto iter = set.Find(MoveOnly(1)); + auto iter = set.find(MoveOnly(1)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(1, iter->Value()); - iter = set.Find(MoveOnly(2)); + iter = set.find(MoveOnly(2)); EXPECT_TRUE(iter == set.end()); for (int i = 2; i < 32; ++i) { @@ -369,12 +369,12 @@ EXPECT_EQ(i, add_result.stored_value->Id()); } - iter = set.Find(MoveOnly(1)); + iter = set.find(MoveOnly(1)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(1, iter->Value()); EXPECT_EQ(1, iter->Id()); - iter = set.Find(MoveOnly(7)); + iter = set.find(MoveOnly(7)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(7, iter->Value()); EXPECT_EQ(7, iter->Id()); @@ -388,13 +388,13 @@ } set.erase(MoveOnly(11)); - iter = set.Find(MoveOnly(11)); + iter = set.find(MoveOnly(11)); EXPECT_TRUE(iter == set.end()); MoveOnly thirteen(set.Take(MoveOnly(13))); EXPECT_EQ(13, thirteen.Value()); EXPECT_EQ(13, thirteen.Id()); - iter = set.Find(MoveOnly(13)); + iter = set.find(MoveOnly(13)); EXPECT_TRUE(iter == set.end()); set.clear(); @@ -411,12 +411,12 @@ EXPECT_EQ(one_pointer, add_result.stored_value->get()); EXPECT_EQ(1, **add_result.stored_value); } - auto iter = set.Find(one_pointer); + auto iter = set.find(one_pointer); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(one_pointer, iter->get()); Pointer nonexistent(new int(42)); - iter = set.Find(nonexistent.get()); + iter = set.find(nonexistent.get()); EXPECT_TRUE(iter == set.end()); // Insert more to cause a rehash. @@ -426,7 +426,7 @@ EXPECT_EQ(i, **add_result.stored_value); } - iter = set.Find(one_pointer); + iter = set.find(one_pointer); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(one_pointer, iter->get()); @@ -437,7 +437,7 @@ Pointer empty(set.Take(nonexistent.get())); EXPECT_TRUE(!empty); - iter = set.Find(one_pointer); + iter = set.find(one_pointer); EXPECT_TRUE(iter == set.end()); // Re-insert to the deleted slot.
diff --git a/third_party/WebKit/Source/platform/wtf/HashTable.h b/third_party/WebKit/Source/platform/wtf/HashTable.h index dc5d7d6..5768f96 100644 --- a/third_party/WebKit/Source/platform/wtf/HashTable.h +++ b/third_party/WebKit/Source/platform/wtf/HashTable.h
@@ -742,8 +742,8 @@ template <typename HashTranslator, typename T, typename Extra> AddResult InsertPassingHashCode(T&& key, Extra&&); - iterator Find(KeyPeekInType key) { return Find<IdentityTranslatorType>(key); } - const_iterator Find(KeyPeekInType key) const { + iterator find(KeyPeekInType key) { return Find<IdentityTranslatorType>(key); } + const_iterator find(KeyPeekInType key) const { return Find<IdentityTranslatorType>(key); } bool Contains(KeyPeekInType key) const { @@ -1526,7 +1526,7 @@ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: erase(KeyPeekInType key) { - erase(Find(key)); + erase(find(key)); } template <typename Key,
diff --git a/third_party/WebKit/Source/platform/wtf/text/AtomicStringTable.cpp b/third_party/WebKit/Source/platform/wtf/text/AtomicStringTable.cpp index 4a53f2c..6b988c1 100644 --- a/third_party/WebKit/Source/platform/wtf/text/AtomicStringTable.cpp +++ b/third_party/WebKit/Source/platform/wtf/text/AtomicStringTable.cpp
@@ -213,7 +213,7 @@ void AtomicStringTable::Remove(StringImpl* string) { DCHECK(string->IsAtomic()); - auto iterator = table_.Find(string); + auto iterator = table_.find(string); CHECK_NE(iterator, table_.end()); table_.erase(iterator); }
diff --git a/third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp index f0e1d36..a9e61cbb 100644 --- a/third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp +++ b/third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp
@@ -424,7 +424,7 @@ DCHECK(string); DCHECK(length); - StaticStringsTable::const_iterator it = StaticStrings().Find(hash); + StaticStringsTable::const_iterator it = StaticStrings().find(hash); if (it != StaticStrings().end()) { DCHECK(!memcmp(string, it->value + 1, length * sizeof(LChar))); return it->value;
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index 8a65a6ac..0713ece 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -73,6 +73,7 @@ #include "platform/exported/WrappedResourceRequest.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/GraphicsLayer.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Optional.h" #include "platform/wtf/PtrUtil.h" @@ -85,7 +86,6 @@ #include "public/platform/WebInputEvent.h" #include "public/platform/WebRect.h" #include "public/platform/WebURLRequest.h" -#include "public/platform/WebViewScheduler.h" #include "public/web/WebAXObject.h" #include "public/web/WebAutofillClient.h" #include "public/web/WebColorChooser.h"
diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp index 5d142ca..0701c53 100644 --- a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp +++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
@@ -10,10 +10,10 @@ #include "core/page/Page.h" #include "platform/geometry/DoubleRect.h" #include "platform/graphics/Color.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "public/platform/Platform.h" #include "public/platform/WebFloatPoint.h" #include "public/platform/WebThread.h" -#include "public/platform/WebViewScheduler.h" #include "web/DevToolsEmulator.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h"
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index aa3ad81..6a48968 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -116,6 +116,8 @@ #include "platform/image-decoders/ImageDecoder.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/UniqueIdentifier.h" +#include "platform/scheduler/child/web_scheduler.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/wtf/AutoReset.h" @@ -129,11 +131,9 @@ #include "public/platform/WebGestureCurve.h" #include "public/platform/WebImage.h" #include "public/platform/WebLayerTreeView.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebTextInputInfo.h" #include "public/platform/WebURLRequest.h" #include "public/platform/WebVector.h" -#include "public/platform/WebViewScheduler.h" #include "public/web/WebAXObject.h" #include "public/web/WebActiveWheelFlingParameters.h" #include "public/web/WebAutofillClient.h"
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 61b1a3b..9f401996 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -40,6 +40,7 @@ #include "platform/geometry/IntRect.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/heap/Handle.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Compiler.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/RefCounted.h" @@ -53,7 +54,6 @@ #include "public/platform/WebLayer.h" #include "public/platform/WebPoint.h" #include "public/platform/WebRect.h" -#include "public/platform/WebScheduler.h" #include "public/platform/WebSize.h" #include "public/platform/WebString.h" #include "public/platform/WebVector.h"
diff --git a/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp index 17ba2cf..4f92a084 100644 --- a/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp +++ b/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp
@@ -2,12 +2,12 @@ // Use of this source code if governed by a BSD-style license that can be // found in LICENSE file. +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "public/platform/WebRTCError.h" #include "public/platform/WebRTCPeerConnectionHandler.h" #include "public/platform/WebRTCRtpReceiver.h" #include "public/platform/WebRTCSessionDescription.h" -#include "public/platform/WebViewScheduler.h" #include "public/web/WebScriptSource.h" #include "testing/gtest/include/gtest/gtest.h" #include "web/WebLocalFrameImpl.h"
diff --git a/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp b/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp index 5af3fcb..a61af48 100644 --- a/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp +++ b/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp
@@ -4,9 +4,9 @@ #include "base/message_loop/message_loop.h" #include "core/dom/TaskRunnerHelper.h" +#include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" -#include "public/platform/WebViewScheduler.h" #include "public/web/WebLocalFrame.h" #include "public/web/WebScriptExecutionCallback.h" #include "public/web/WebScriptSource.h"
diff --git a/third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp b/third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp index bcc3bb69..8d1de93 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp +++ b/third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp
@@ -41,7 +41,7 @@ void SimNetwork::DidReceiveResponse(WebURLLoaderClient* client, const WebURLResponse& response) { - auto it = requests_.Find(response.Url().GetString()); + auto it = requests_.find(response.Url().GetString()); if (it == requests_.end()) { client->DidReceiveResponse(response); return;
diff --git a/third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h b/third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h index 4ed25a0..0f0a7d8 100644 --- a/third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h +++ b/third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h
@@ -11,9 +11,7 @@ #include "base/message_loop/message_loop.h" #include "base/threading/thread.h" #include "public/platform/WebCommon.h" -#include "public/platform/WebInputEvent.h" #include "public/platform/WebInputEventResult.h" -#include "public/platform/WebScheduler.h" #include "public/platform/scheduler/child/child_scheduler.h" #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" #include "public/platform/scheduler/renderer/render_widget_scheduling_state.h" @@ -31,6 +29,7 @@ namespace blink { class WebThread; +class WebInputEvent; } namespace blink { @@ -130,16 +129,17 @@ // backgrounded. virtual void ResumeRenderer() = 0; + enum class NavigatingFrameType { kMainFrame, kChildFrame }; + // Tells the scheduler that a navigation task is pending. While any main-frame // navigation tasks are pending, the scheduler will ensure that loading tasks // are not blocked even if they are expensive. Must be called on the main // thread. - virtual void AddPendingNavigation(WebScheduler::NavigatingFrameType type) = 0; + virtual void AddPendingNavigation(NavigatingFrameType type) = 0; // Tells the scheduler that a navigation task is no longer pending. // Must be called on the main thread. - virtual void RemovePendingNavigation( - WebScheduler::NavigatingFrameType type) = 0; + virtual void RemovePendingNavigation(NavigatingFrameType type) = 0; // Tells the scheduler that a navigation has started. The scheduler will // prioritize loading tasks for a short duration afterwards.
diff --git a/third_party/WebKit/public/platform/scheduler/test/fake_renderer_scheduler.h b/third_party/WebKit/public/platform/scheduler/test/fake_renderer_scheduler.h index c539d2f8..4bcc9d80 100644 --- a/third_party/WebKit/public/platform/scheduler/test/fake_renderer_scheduler.h +++ b/third_party/WebKit/public/platform/scheduler/test/fake_renderer_scheduler.h
@@ -38,8 +38,8 @@ void OnRendererForegrounded() override; void SuspendRenderer() override; void ResumeRenderer() override; - void AddPendingNavigation(WebScheduler::NavigatingFrameType type) override; - void RemovePendingNavigation(WebScheduler::NavigatingFrameType type) override; + void AddPendingNavigation(NavigatingFrameType type) override; + void RemovePendingNavigation(NavigatingFrameType type) override; void OnNavigationStarted() override; bool IsHighPriorityWorkAnticipated() override; bool CanExceedIdleDeadlineIfRequired() const override;
diff --git a/third_party/WebKit/public/platform/scheduler/test/mock_renderer_scheduler.h b/third_party/WebKit/public/platform/scheduler/test/mock_renderer_scheduler.h index e88a4b0..7cea5445 100644 --- a/third_party/WebKit/public/platform/scheduler/test/mock_renderer_scheduler.h +++ b/third_party/WebKit/public/platform/scheduler/test/mock_renderer_scheduler.h
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "cc/output/begin_frame_args.h" +#include "public/platform/WebThread.h" #include "public/platform/scheduler/renderer/renderer_scheduler.h" #include "testing/gmock/include/gmock/gmock.h" @@ -42,9 +43,8 @@ MOCK_METHOD0(OnRendererForegrounded, void()); MOCK_METHOD0(SuspendRenderer, void()); MOCK_METHOD0(ResumeRenderer, void()); - MOCK_METHOD1(AddPendingNavigation, void(WebScheduler::NavigatingFrameType)); - MOCK_METHOD1(RemovePendingNavigation, - void(WebScheduler::NavigatingFrameType)); + MOCK_METHOD1(AddPendingNavigation, void(NavigatingFrameType)); + MOCK_METHOD1(RemovePendingNavigation, void(NavigatingFrameType)); MOCK_METHOD0(OnNavigationStarted, void()); MOCK_METHOD0(IsHighPriorityWorkAnticipated, bool()); MOCK_CONST_METHOD0(CanExceedIdleDeadlineIfRequired, bool());
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index de56120b..1c64fa2 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -82192,6 +82192,9 @@ </histogram> <histogram name="WinJumplist.CreateIconFilesCount"> + <obsolete> + Obsolete 04/20/2017 as we are no long recording this metric. + </obsolete> <owner>chengx@chromium.org</owner> <summary> Count of jumplist icons that will be created per jumplist update. It is @@ -82342,6 +82345,9 @@ </histogram> <histogram name="WinJumplist.UpdateJumpListDuration" units="ms"> + <obsolete> + Obsolete 04/20/2017 as it's no longer accurate due to the code change. + </obsolete> <owner>chengx@chromium.org</owner> <summary> Time spent in UpdateJumpList(). This method is called whenever there is a @@ -103606,6 +103612,7 @@ <int value="120429808" label="disable-new-profile-management"/> <int value="121684313" label="QuickUnlockPin:enabled"/> <int value="121858954" label="enable-supervised-user-safesites"/> + <int value="125581289" label="WebRtcHWVP8Encoding:disabled"/> <int value="125934378" label="enable-password-link"/> <int value="147373243" label="enable-deferred-image-decoding"/> <int value="157217034" label="enable-tab-for-desktop-share"/> @@ -103743,6 +103750,7 @@ <int value="691020108" label="NTPCondensedTileLayout:disabled"/> <int value="693012666" label="QuickUnlockPin:disabled"/> <int value="696600628" label="VibrateRequiresUserGesture:disabled"/> + <int value="698809951" label="WebRtcHWVP8Encoding:enabled"/> <int value="709850261" label="disable-touch-editing"/> <int value="711424932" label="enable-cloud-print-xps"/> <int value="715617684" label="OriginTrials:disabled"/>
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h index ae26188..ec0a6ac2 100644 --- a/ui/aura/mus/window_port_mus.h +++ b/ui/aura/mus/window_port_mus.h
@@ -286,7 +286,7 @@ cc::LocalSurfaceIdAllocator local_surface_id_allocator_; gfx::Size last_surface_size_; - ui::mojom::CursorType predefined_cursor_ = ui::mojom::CursorType::CURSOR_NULL; + ui::mojom::CursorType predefined_cursor_ = ui::mojom::CursorType::kNull; DISALLOW_COPY_AND_ASSIGN(WindowPortMus); };
diff --git a/ui/aura/test/test_cursor_client.cc b/ui/aura/test/test_cursor_client.cc index 54b0e07..f54f92d 100644 --- a/ui/aura/test/test_cursor_client.cc +++ b/ui/aura/test/test_cursor_client.cc
@@ -28,7 +28,7 @@ } gfx::NativeCursor TestCursorClient::GetCursor() const { - return ui::kCursorNull; + return ui::CursorType::kNull; } void TestCursorClient::ShowCursor() {
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index fcbb9af..8926357 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc
@@ -220,7 +220,7 @@ WindowTreeHost::WindowTreeHost(std::unique_ptr<WindowPort> window_port) : window_(new Window(nullptr, std::move(window_port))), - last_cursor_(ui::kCursorNull), + last_cursor_(ui::CursorType::kNull), input_method_(nullptr), owned_input_method_(false) {}
diff --git a/ui/aura/window_tree_host_platform.cc b/ui/aura/window_tree_host_platform.cc index 3b5cb68..1bd51f8 100644 --- a/ui/aura/window_tree_host_platform.cc +++ b/ui/aura/window_tree_host_platform.cc
@@ -59,8 +59,7 @@ std::unique_ptr<WindowPort> window_port) : WindowTreeHost(std::move(window_port)), widget_(gfx::kNullAcceleratedWidget), - current_cursor_(ui::kCursorNull) { -} + current_cursor_(ui::CursorType::kNull) {} void WindowTreeHostPlatform::SetPlatformWindow( std::unique_ptr<ui::PlatformWindow> window) {
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index efee254..af162588 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc
@@ -120,7 +120,7 @@ : xdisplay_(gfx::GetXDisplay()), xwindow_(0), x_root_window_(DefaultRootWindow(xdisplay_)), - current_cursor_(ui::kCursorNull), + current_cursor_(ui::CursorType::kNull), window_mapped_(false), bounds_(bounds), atom_cache_(xdisplay_, kAtomsToCache) {
diff --git a/ui/base/cursor/cursor.cc b/ui/base/cursor/cursor.cc index 8396355..2f55beb 100644 --- a/ui/base/cursor/cursor.cc +++ b/ui/base/cursor/cursor.cc
@@ -7,46 +7,42 @@ namespace ui { Cursor::Cursor() - : native_type_(0), + : native_type_(CursorType::kNull), platform_cursor_(0), - device_scale_factor_(0.0f) { -} + device_scale_factor_(0.0f) {} -Cursor::Cursor(int type) - : native_type_(type), - platform_cursor_(0), - device_scale_factor_(0.0f) { -} +Cursor::Cursor(CursorType type) + : native_type_(type), platform_cursor_(0), device_scale_factor_(0.0f) {} Cursor::Cursor(const Cursor& cursor) : native_type_(cursor.native_type_), platform_cursor_(cursor.platform_cursor_), device_scale_factor_(cursor.device_scale_factor_) { - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) RefCustomCursor(); } Cursor::~Cursor() { - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) UnrefCustomCursor(); } void Cursor::SetPlatformCursor(const PlatformCursor& platform) { - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) UnrefCustomCursor(); platform_cursor_ = platform; - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) RefCustomCursor(); } void Cursor::Assign(const Cursor& cursor) { if (*this == cursor) return; - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) UnrefCustomCursor(); native_type_ = cursor.native_type_; platform_cursor_ = cursor.platform_cursor_; - if (native_type_ == kCursorCustom) + if (native_type_ == CursorType::kCustom) RefCustomCursor(); device_scale_factor_ = cursor.device_scale_factor_; }
diff --git a/ui/base/cursor/cursor.h b/ui/base/cursor/cursor.h index c04bca7..05da7cd 100644 --- a/ui/base/cursor/cursor.h +++ b/ui/base/cursor/cursor.h
@@ -24,62 +24,63 @@ typedef void* PlatformCursor; #endif -// TODO(jamescook): Once we're on C++0x we could change these constants -// to an enum and forward declare it in native_widget_types.h. +enum class CursorType { + // Equivalent to a NULL HCURSOR on Windows. + kNull = 0, -// Equivalent to a NULL HCURSOR on Windows. -const int kCursorNull = 0; + // These cursors mirror WebKit cursors from WebCursorInfo, but are replicated + // here so we don't introduce a WebKit dependency. + kPointer = 1, + kCross = 2, + kHand = 3, + kIBeam = 4, + kWait = 5, + kHelp = 6, + kEastResize = 7, + kNorthResize = 8, + kNorthEastResize = 9, + kNorthWestResize = 10, + kSouthResize = 11, + kSouthEastResize = 12, + kSouthWestResize = 13, + kWestResize = 14, + kNorthSouthResize = 15, + kEastWestResize = 16, + kNorthEastSouthWestResize = 17, + kNorthWestSouthEastResize = 18, + kColumnResize = 19, + kRowResize = 20, + kMiddlePanning = 21, + kEastPanning = 22, + kNorthPanning = 23, + kNorthEastPanning = 24, + kNorthWestPanning = 25, + kSouthPanning = 26, + kSouthEastPanning = 27, + kSouthWestPanning = 28, + kWestPanning = 29, + kMove = 30, + kVerticalText = 31, + kCell = 32, + kContextMenu = 33, + kAlias = 34, + kProgress = 35, + kNoDrop = 36, + kCopy = 37, + kNone = 38, + kNotAllowed = 39, + kZoomIn = 40, + kZoomOut = 41, + kGrab = 42, + kGrabbing = 43, + kCustom = 44, -// These cursors mirror WebKit cursors from WebCursorInfo, but are replicated -// here so we don't introduce a WebKit dependency. -const int kCursorPointer = 1; -const int kCursorCross = 2; -const int kCursorHand = 3; -const int kCursorIBeam = 4; -const int kCursorWait = 5; -const int kCursorHelp = 6; -const int kCursorEastResize = 7; -const int kCursorNorthResize = 8; -const int kCursorNorthEastResize = 9; -const int kCursorNorthWestResize = 10; -const int kCursorSouthResize = 11; -const int kCursorSouthEastResize = 12; -const int kCursorSouthWestResize = 13; -const int kCursorWestResize = 14; -const int kCursorNorthSouthResize = 15; -const int kCursorEastWestResize = 16; -const int kCursorNorthEastSouthWestResize = 17; -const int kCursorNorthWestSouthEastResize = 18; -const int kCursorColumnResize = 19; -const int kCursorRowResize = 20; -const int kCursorMiddlePanning = 21; -const int kCursorEastPanning = 22; -const int kCursorNorthPanning = 23; -const int kCursorNorthEastPanning = 24; -const int kCursorNorthWestPanning = 25; -const int kCursorSouthPanning = 26; -const int kCursorSouthEastPanning = 27; -const int kCursorSouthWestPanning = 28; -const int kCursorWestPanning = 29; -const int kCursorMove = 30; -const int kCursorVerticalText = 31; -const int kCursorCell = 32; -const int kCursorContextMenu = 33; -const int kCursorAlias = 34; -const int kCursorProgress = 35; -const int kCursorNoDrop = 36; -const int kCursorCopy = 37; -const int kCursorNone = 38; -const int kCursorNotAllowed = 39; -const int kCursorZoomIn = 40; -const int kCursorZoomOut = 41; -const int kCursorGrab = 42; -const int kCursorGrabbing = 43; -const int kCursorCustom = 44; -const int kCursorDndNone = 45; -const int kCursorDndMove = 46; -const int kCursorDndCopy = 47; -const int kCursorDndLink = 48; + // These additional drag and drop cursors are not listed in WebCursorInfo. + kDndNone = 45, + kDndMove = 46, + kDndCopy = 47, + kDndLink = 48, +}; enum CursorSetType { CURSOR_SET_NORMAL, @@ -92,7 +93,7 @@ Cursor(); // Implicit constructor. - Cursor(int type); + Cursor(CursorType type); // Allow copy. Cursor(const Cursor& cursor); @@ -104,7 +105,7 @@ void RefCustomCursor(); void UnrefCustomCursor(); - int native_type() const { return native_type_; } + CursorType native_type() const { return native_type_; } PlatformCursor platform() const { return platform_cursor_; } float device_scale_factor() const { return device_scale_factor_; @@ -113,13 +114,13 @@ device_scale_factor_ = device_scale_factor; } - bool operator==(int type) const { return native_type_ == type; } + bool operator==(CursorType type) const { return native_type_ == type; } bool operator==(const Cursor& cursor) const { return native_type_ == cursor.native_type_ && platform_cursor_ == cursor.platform_cursor_ && device_scale_factor_ == cursor.device_scale_factor_; } - bool operator!=(int type) const { return native_type_ != type; } + bool operator!=(CursorType type) const { return native_type_ != type; } bool operator!=(const Cursor& cursor) const { return native_type_ != cursor.native_type_ || platform_cursor_ != cursor.platform_cursor_ || @@ -134,7 +135,7 @@ void Assign(const Cursor& cursor); // See definitions above. - int native_type_; + CursorType native_type_; PlatformCursor platform_cursor_;
diff --git a/ui/base/cursor/cursor_data.cc b/ui/base/cursor/cursor_data.cc index 20a6896f..c49400e 100644 --- a/ui/base/cursor/cursor_data.cc +++ b/ui/base/cursor/cursor_data.cc
@@ -9,15 +9,17 @@ namespace ui { -CursorData::CursorData() : cursor_type_(0), scale_factor_(0.0f) {} +CursorData::CursorData() + : cursor_type_(CursorType::kNull), scale_factor_(0.0f) {} -CursorData::CursorData(int type) : cursor_type_(type), scale_factor_(0.0f) {} +CursorData::CursorData(CursorType type) + : cursor_type_(type), scale_factor_(0.0f) {} CursorData::CursorData(const gfx::Point& hotspot_point, const std::vector<SkBitmap>& cursor_frames, float scale_factor, const base::TimeDelta& frame_delay) - : cursor_type_(kCursorCustom), + : cursor_type_(CursorType::kCustom), frame_delay_(frame_delay), scale_factor_(scale_factor), hotspot_(hotspot_point), @@ -32,7 +34,7 @@ CursorData& CursorData::operator=(const CursorData& cursor) = default; -bool CursorData::IsType(int cursor_type) const { +bool CursorData::IsType(CursorType cursor_type) const { return cursor_type_ == cursor_type; }
diff --git a/ui/base/cursor/cursor_data.h b/ui/base/cursor/cursor_data.h index 7cc019c..c3879692d 100644 --- a/ui/base/cursor/cursor_data.h +++ b/ui/base/cursor/cursor_data.h
@@ -15,6 +15,7 @@ class SkBitmap; namespace ui { +enum class CursorType; // The new Cursor class. (aka, Cursor2) // @@ -38,7 +39,7 @@ class UI_BASE_EXPORT CursorData { public: CursorData(); - explicit CursorData(int type); + explicit CursorData(CursorType type); CursorData(const gfx::Point& hostpot_point, const std::vector<SkBitmap>& cursor_frames, float scale_factor, @@ -48,14 +49,14 @@ CursorData& operator=(const CursorData& cursor); - int cursor_type() const { return cursor_type_; } + CursorType cursor_type() const { return cursor_type_; } const base::TimeDelta& frame_delay() const { return frame_delay_; } float scale_factor() const { return scale_factor_; } const gfx::Point& hotspot_in_pixels() const { return hotspot_; } const std::vector<SkBitmap>& cursor_frames() const { return cursor_frames_; } // Returns true if this CursorData instance is of |cursor_type|. - bool IsType(int cursor_type) const; + bool IsType(CursorType cursor_type) const; // Checks if the data in |rhs| was created from the same input data. // @@ -71,7 +72,7 @@ private: // A native type constant from cursor.h. - int cursor_type_; + CursorType cursor_type_; // The delay between cursor frames. base::TimeDelta frame_delay_;
diff --git a/ui/base/cursor/cursor_loader.h b/ui/base/cursor/cursor_loader.h index 0d53ac9..fca5e7d 100644 --- a/ui/base/cursor/cursor_loader.h +++ b/ui/base/cursor/cursor_loader.h
@@ -37,7 +37,7 @@ } // Creates a cursor from an image resource and puts it in the cursor map. - virtual void LoadImageCursor(int id, + virtual void LoadImageCursor(CursorType id, int resource_id, const gfx::Point& hot) = 0; @@ -46,7 +46,7 @@ // from left to right. Also, each frame is assumed to be square // (width == height). // |frame_delay_ms| is the delay between frames in millisecond. - virtual void LoadAnimatedCursor(int id, + virtual void LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) = 0;
diff --git a/ui/base/cursor/cursor_loader_ozone.cc b/ui/base/cursor/cursor_loader_ozone.cc index 1d74eec7..5f1ba8e 100644 --- a/ui/base/cursor/cursor_loader_ozone.cc +++ b/ui/base/cursor/cursor_loader_ozone.cc
@@ -16,7 +16,7 @@ CursorLoaderOzone::~CursorLoaderOzone() {} -void CursorLoaderOzone::LoadImageCursor(int id, +void CursorLoaderOzone::LoadImageCursor(CursorType id, int resource_id, const gfx::Point& hot) { SkBitmap bitmap; @@ -28,7 +28,7 @@ bitmap, hotspot, scale()); } -void CursorLoaderOzone::LoadAnimatedCursor(int id, +void CursorLoaderOzone::LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) { @@ -51,13 +51,13 @@ } void CursorLoaderOzone::SetPlatformCursor(gfx::NativeCursor* cursor) { - int native_type = cursor->native_type(); + CursorType native_type = cursor->native_type(); PlatformCursor platform; if (cursors_.count(native_type)) { // An image cursor is loaded for this type. platform = cursors_[native_type]; - } else if (native_type == kCursorCustom) { + } else if (native_type == CursorType::kCustom) { // The platform cursor was already set via WebCursor::GetPlatformCursor. platform = cursor->platform(); } else {
diff --git a/ui/base/cursor/cursor_loader_ozone.h b/ui/base/cursor/cursor_loader_ozone.h index 6cd67dc..00a2328 100644 --- a/ui/base/cursor/cursor_loader_ozone.h +++ b/ui/base/cursor/cursor_loader_ozone.h
@@ -19,10 +19,10 @@ ~CursorLoaderOzone() override; // CursorLoader overrides: - void LoadImageCursor(int id, + void LoadImageCursor(CursorType id, int resource_id, const gfx::Point& hot) override; - void LoadAnimatedCursor(int id, + void LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) override; @@ -31,7 +31,7 @@ private: // Pointers are owned by ResourceBundle and must not be freed here. - typedef std::map<int, PlatformCursor> ImageCursorMap; + typedef std::map<CursorType, PlatformCursor> ImageCursorMap; ImageCursorMap cursors_; DISALLOW_COPY_AND_ASSIGN(CursorLoaderOzone);
diff --git a/ui/base/cursor/cursor_loader_win.cc b/ui/base/cursor/cursor_loader_win.cc index 430cf7ec..2c20a19 100644 --- a/ui/base/cursor/cursor_loader_win.cc +++ b/ui/base/cursor/cursor_loader_win.cc
@@ -18,94 +18,94 @@ const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { switch (native_cursor.native_type()) { - case kCursorNull: + case CursorType::kNull: return IDC_ARROW; - case kCursorPointer: + case CursorType::kPointer: return IDC_ARROW; - case kCursorCross: + case CursorType::kCross: return IDC_CROSS; - case kCursorHand: + case CursorType::kHand: return IDC_HAND; - case kCursorIBeam: + case CursorType::kIBeam: return IDC_IBEAM; - case kCursorWait: + case CursorType::kWait: return IDC_WAIT; - case kCursorHelp: + case CursorType::kHelp: return IDC_HELP; - case kCursorEastResize: + case CursorType::kEastResize: return IDC_SIZEWE; - case kCursorNorthResize: + case CursorType::kNorthResize: return IDC_SIZENS; - case kCursorNorthEastResize: + case CursorType::kNorthEastResize: return IDC_SIZENESW; - case kCursorNorthWestResize: + case CursorType::kNorthWestResize: return IDC_SIZENWSE; - case kCursorSouthResize: + case CursorType::kSouthResize: return IDC_SIZENS; - case kCursorSouthEastResize: + case CursorType::kSouthEastResize: return IDC_SIZENWSE; - case kCursorSouthWestResize: + case CursorType::kSouthWestResize: return IDC_SIZENESW; - case kCursorWestResize: + case CursorType::kWestResize: return IDC_SIZEWE; - case kCursorNorthSouthResize: + case CursorType::kNorthSouthResize: return IDC_SIZENS; - case kCursorEastWestResize: + case CursorType::kEastWestResize: return IDC_SIZEWE; - case kCursorNorthEastSouthWestResize: + case CursorType::kNorthEastSouthWestResize: return IDC_SIZENESW; - case kCursorNorthWestSouthEastResize: + case CursorType::kNorthWestSouthEastResize: return IDC_SIZENWSE; - case kCursorMove: + case CursorType::kMove: return IDC_SIZEALL; - case kCursorProgress: + case CursorType::kProgress: return IDC_APPSTARTING; - case kCursorNoDrop: + case CursorType::kNoDrop: return IDC_NO; - case kCursorNotAllowed: + case CursorType::kNotAllowed: return IDC_NO; - case kCursorColumnResize: + case CursorType::kColumnResize: return MAKEINTRESOURCE(IDC_COLRESIZE); - case kCursorRowResize: + case CursorType::kRowResize: return MAKEINTRESOURCE(IDC_ROWRESIZE); - case kCursorMiddlePanning: + case CursorType::kMiddlePanning: return MAKEINTRESOURCE(IDC_PAN_MIDDLE); - case kCursorEastPanning: + case CursorType::kEastPanning: return MAKEINTRESOURCE(IDC_PAN_EAST); - case kCursorNorthPanning: + case CursorType::kNorthPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH); - case kCursorNorthEastPanning: + case CursorType::kNorthEastPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST); - case kCursorNorthWestPanning: + case CursorType::kNorthWestPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST); - case kCursorSouthPanning: + case CursorType::kSouthPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH); - case kCursorSouthEastPanning: + case CursorType::kSouthEastPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST); - case kCursorSouthWestPanning: + case CursorType::kSouthWestPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST); - case kCursorWestPanning: + case CursorType::kWestPanning: return MAKEINTRESOURCE(IDC_PAN_WEST); - case kCursorVerticalText: + case CursorType::kVerticalText: return MAKEINTRESOURCE(IDC_VERTICALTEXT); - case kCursorCell: + case CursorType::kCell: return MAKEINTRESOURCE(IDC_CELL); - case kCursorZoomIn: + case CursorType::kZoomIn: return MAKEINTRESOURCE(IDC_ZOOMIN); - case kCursorZoomOut: + case CursorType::kZoomOut: return MAKEINTRESOURCE(IDC_ZOOMOUT); - case kCursorGrab: + case CursorType::kGrab: return MAKEINTRESOURCE(IDC_HAND_GRAB); - case kCursorGrabbing: + case CursorType::kGrabbing: return MAKEINTRESOURCE(IDC_HAND_GRABBING); - case kCursorCopy: + case CursorType::kCopy: return MAKEINTRESOURCE(IDC_COPYCUR); - case kCursorAlias: + case CursorType::kAlias: return MAKEINTRESOURCE(IDC_ALIAS); - case kCursorNone: + case CursorType::kNone: return MAKEINTRESOURCE(IDC_CURSOR_NONE); - case kCursorContextMenu: - case kCursorCustom: + case CursorType::kContextMenu: + case CursorType::kCustom: NOTIMPLEMENTED(); return IDC_ARROW; default: @@ -126,13 +126,13 @@ CursorLoaderWin::~CursorLoaderWin() { } -void CursorLoaderWin::LoadImageCursor(int id, +void CursorLoaderWin::LoadImageCursor(CursorType id, int resource_id, const gfx::Point& hot) { // NOTIMPLEMENTED(); } -void CursorLoaderWin::LoadAnimatedCursor(int id, +void CursorLoaderWin::LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) { @@ -144,7 +144,7 @@ } void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { - if (cursor->native_type() != kCursorCustom) { + if (cursor->native_type() != CursorType::kCustom) { if (cursor->platform()) { cursor->SetPlatformCursor(cursor->platform()); } else {
diff --git a/ui/base/cursor/cursor_loader_win.h b/ui/base/cursor/cursor_loader_win.h index 270198b..ad68353 100644 --- a/ui/base/cursor/cursor_loader_win.h +++ b/ui/base/cursor/cursor_loader_win.h
@@ -17,8 +17,10 @@ ~CursorLoaderWin() override; // Overridden from CursorLoader: - void LoadImageCursor(int id, int resource_id, const gfx::Point& hot) override; - void LoadAnimatedCursor(int id, + void LoadImageCursor(CursorType id, + int resource_id, + const gfx::Point& hot) override; + void LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) override;
diff --git a/ui/base/cursor/cursor_loader_x11.cc b/ui/base/cursor/cursor_loader_x11.cc index 7febd85b..5e12a17d 100644 --- a/ui/base/cursor/cursor_loader_x11.cc +++ b/ui/base/cursor/cursor_loader_x11.cc
@@ -25,152 +25,156 @@ namespace { // Returns CSS cursor name from an Aura cursor ID. -const char* CursorCssNameFromId(int id) { +const char* CursorCssNameFromId(ui::CursorType id) { switch (id) { - case ui::kCursorMiddlePanning: + case ui::CursorType::kMiddlePanning: return "all-scroll"; - case ui::kCursorEastPanning: + case ui::CursorType::kEastPanning: return "e-resize"; - case ui::kCursorNorthPanning: + case ui::CursorType::kNorthPanning: return "n-resize"; - case ui::kCursorNorthEastPanning: + case ui::CursorType::kNorthEastPanning: return "ne-resize"; - case ui::kCursorNorthWestPanning: + case ui::CursorType::kNorthWestPanning: return "nw-resize"; - case ui::kCursorSouthPanning: + case ui::CursorType::kSouthPanning: return "s-resize"; - case ui::kCursorSouthEastPanning: + case ui::CursorType::kSouthEastPanning: return "se-resize"; - case ui::kCursorSouthWestPanning: + case ui::CursorType::kSouthWestPanning: return "sw-resize"; - case ui::kCursorWestPanning: + case ui::CursorType::kWestPanning: return "w-resize"; - case ui::kCursorNone: + case ui::CursorType::kNone: return "none"; - case ui::kCursorGrab: + case ui::CursorType::kGrab: return "grab"; - case ui::kCursorGrabbing: + case ui::CursorType::kGrabbing: return "grabbing"; #if defined(OS_CHROMEOS) - case ui::kCursorNull: - case ui::kCursorPointer: - case ui::kCursorNoDrop: - case ui::kCursorNotAllowed: - case ui::kCursorCopy: - case ui::kCursorMove: - case ui::kCursorEastResize: - case ui::kCursorNorthResize: - case ui::kCursorSouthResize: - case ui::kCursorWestResize: - case ui::kCursorNorthEastResize: - case ui::kCursorNorthWestResize: - case ui::kCursorSouthWestResize: - case ui::kCursorSouthEastResize: - case ui::kCursorIBeam: - case ui::kCursorAlias: - case ui::kCursorCell: - case ui::kCursorContextMenu: - case ui::kCursorCross: - case ui::kCursorHelp: - case ui::kCursorWait: - case ui::kCursorNorthSouthResize: - case ui::kCursorEastWestResize: - case ui::kCursorNorthEastSouthWestResize: - case ui::kCursorNorthWestSouthEastResize: - case ui::kCursorProgress: - case ui::kCursorColumnResize: - case ui::kCursorRowResize: - case ui::kCursorVerticalText: - case ui::kCursorZoomIn: - case ui::kCursorZoomOut: - case ui::kCursorHand: + case ui::CursorType::kNull: + case ui::CursorType::kPointer: + case ui::CursorType::kNoDrop: + case ui::CursorType::kNotAllowed: + case ui::CursorType::kCopy: + case ui::CursorType::kMove: + case ui::CursorType::kEastResize: + case ui::CursorType::kNorthResize: + case ui::CursorType::kSouthResize: + case ui::CursorType::kWestResize: + case ui::CursorType::kNorthEastResize: + case ui::CursorType::kNorthWestResize: + case ui::CursorType::kSouthWestResize: + case ui::CursorType::kSouthEastResize: + case ui::CursorType::kIBeam: + case ui::CursorType::kAlias: + case ui::CursorType::kCell: + case ui::CursorType::kContextMenu: + case ui::CursorType::kCross: + case ui::CursorType::kHelp: + case ui::CursorType::kWait: + case ui::CursorType::kNorthSouthResize: + case ui::CursorType::kEastWestResize: + case ui::CursorType::kNorthEastSouthWestResize: + case ui::CursorType::kNorthWestSouthEastResize: + case ui::CursorType::kProgress: + case ui::CursorType::kColumnResize: + case ui::CursorType::kRowResize: + case ui::CursorType::kVerticalText: + case ui::CursorType::kZoomIn: + case ui::CursorType::kZoomOut: + case ui::CursorType::kHand: + case ui::CursorType::kDndNone: + case ui::CursorType::kDndMove: + case ui::CursorType::kDndCopy: + case ui::CursorType::kDndLink: // In some environments, the image assets are not set (e.g. in // content-browsertests, content-shell etc.). return "left_ptr"; #else // defined(OS_CHROMEOS) - case ui::kCursorNull: + case ui::CursorType::kNull: return "left_ptr"; - case ui::kCursorPointer: + case ui::CursorType::kPointer: return "left_ptr"; - case ui::kCursorMove: + case ui::CursorType::kMove: // Returning "move" is the correct thing here, but Blink doesn't // make a distinction between move and all-scroll. Other // platforms use a cursor more consistent with all-scroll, so // use that. return "all-scroll"; - case ui::kCursorCross: + case ui::CursorType::kCross: return "crosshair"; - case ui::kCursorHand: + case ui::CursorType::kHand: return "pointer"; - case ui::kCursorIBeam: + case ui::CursorType::kIBeam: return "text"; - case ui::kCursorProgress: + case ui::CursorType::kProgress: return "progress"; - case ui::kCursorWait: + case ui::CursorType::kWait: return "wait"; - case ui::kCursorHelp: + case ui::CursorType::kHelp: return "help"; - case ui::kCursorEastResize: + case ui::CursorType::kEastResize: return "e-resize"; - case ui::kCursorNorthResize: + case ui::CursorType::kNorthResize: return "n-resize"; - case ui::kCursorNorthEastResize: + case ui::CursorType::kNorthEastResize: return "ne-resize"; - case ui::kCursorNorthWestResize: + case ui::CursorType::kNorthWestResize: return "nw-resize"; - case ui::kCursorSouthResize: + case ui::CursorType::kSouthResize: return "s-resize"; - case ui::kCursorSouthEastResize: + case ui::CursorType::kSouthEastResize: return "se-resize"; - case ui::kCursorSouthWestResize: + case ui::CursorType::kSouthWestResize: return "sw-resize"; - case ui::kCursorWestResize: + case ui::CursorType::kWestResize: return "w-resize"; - case ui::kCursorNorthSouthResize: + case ui::CursorType::kNorthSouthResize: return "ns-resize"; - case ui::kCursorEastWestResize: + case ui::CursorType::kEastWestResize: return "ew-resize"; - case ui::kCursorColumnResize: + case ui::CursorType::kColumnResize: return "col-resize"; - case ui::kCursorRowResize: + case ui::CursorType::kRowResize: return "row-resize"; - case ui::kCursorNorthEastSouthWestResize: + case ui::CursorType::kNorthEastSouthWestResize: return "nesw-resize"; - case ui::kCursorNorthWestSouthEastResize: + case ui::CursorType::kNorthWestSouthEastResize: return "nwse-resize"; - case ui::kCursorVerticalText: + case ui::CursorType::kVerticalText: return "vertical-text"; - case ui::kCursorZoomIn: + case ui::CursorType::kZoomIn: return "zoom-in"; - case ui::kCursorZoomOut: + case ui::CursorType::kZoomOut: return "zoom-out"; - case ui::kCursorCell: + case ui::CursorType::kCell: return "cell"; - case ui::kCursorContextMenu: + case ui::CursorType::kContextMenu: return "context-menu"; - case ui::kCursorAlias: + case ui::CursorType::kAlias: return "alias"; - case ui::kCursorNoDrop: + case ui::CursorType::kNoDrop: return "no-drop"; - case ui::kCursorCopy: + case ui::CursorType::kCopy: return "copy"; - case ui::kCursorNotAllowed: + case ui::CursorType::kNotAllowed: return "not-allowed"; - case ui::kCursorDndNone: + case ui::CursorType::kDndNone: return "dnd-none"; - case ui::kCursorDndMove: + case ui::CursorType::kDndMove: return "dnd-move"; - case ui::kCursorDndCopy: + case ui::CursorType::kDndCopy: return "dnd-copy"; - case ui::kCursorDndLink: + case ui::CursorType::kDndLink: return "dnd-link"; #endif // defined(OS_CHROMEOS) - case ui::kCursorCustom: + case ui::CursorType::kCustom: NOTREACHED(); return "left_ptr"; } - NOTREACHED() << "Case not handled for " << id; + NOTREACHED() << "Case not handled for " << static_cast<int>(id); return "left_ptr"; } @@ -235,7 +239,7 @@ UnloadAll(); } -void CursorLoaderX11::LoadImageCursor(int id, +void CursorLoaderX11::LoadImageCursor(CursorType id, int resource_id, const gfx::Point& hot) { SkBitmap bitmap; @@ -246,7 +250,7 @@ image_cursors_[id].reset(new ImageCursor(x_image, scale(), rotation())); } -void CursorLoaderX11::LoadAnimatedCursor(int id, +void CursorLoaderX11::LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) { @@ -283,28 +287,28 @@ void CursorLoaderX11::SetPlatformCursor(gfx::NativeCursor* cursor) { DCHECK(cursor); - if (*cursor == kCursorNone) { + if (*cursor == CursorType::kNone) { cursor->SetPlatformCursor(invisible_cursor_.get()); return; } - if (*cursor == kCursorCustom) + if (*cursor == CursorType::kCustom) return; cursor->set_device_scale_factor(scale()); cursor->SetPlatformCursor(CursorFromId(cursor->native_type())); } -const XcursorImage* CursorLoaderX11::GetXcursorImageForTest(int id) { +const XcursorImage* CursorLoaderX11::GetXcursorImageForTest(CursorType id) { return test::GetCachedXcursorImage(image_cursors_[id]->cursor); } bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) { - int type = native_cursor.native_type(); + CursorType type = native_cursor.native_type(); return image_cursors_.count(type) || animated_cursors_.count(type); } -::Cursor CursorLoaderX11::CursorFromId(int id) { +::Cursor CursorLoaderX11::CursorFromId(CursorType id) { const char* css_name = CursorCssNameFromId(id); auto font_it = font_cursors_.find(id);
diff --git a/ui/base/cursor/cursor_loader_x11.h b/ui/base/cursor/cursor_loader_x11.h index 5aa127d..925cd3a 100644 --- a/ui/base/cursor/cursor_loader_x11.h +++ b/ui/base/cursor/cursor_loader_x11.h
@@ -6,7 +6,7 @@ #define UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ #include <X11/Xcursor/Xcursor.h> -#include <unordered_map> +#include <map> #include "base/compiler_specific.h" #include "base/macros.h" @@ -23,15 +23,17 @@ ~CursorLoaderX11() override; // Overridden from CursorLoader: - void LoadImageCursor(int id, int resource_id, const gfx::Point& hot) override; - void LoadAnimatedCursor(int id, + void LoadImageCursor(CursorType id, + int resource_id, + const gfx::Point& hot) override; + void LoadAnimatedCursor(CursorType id, int resource_id, const gfx::Point& hot, int frame_delay_ms) override; void UnloadAll() override; void SetPlatformCursor(gfx::NativeCursor* cursor) override; - const XcursorImage* GetXcursorImageForTest(int id); + const XcursorImage* GetXcursorImageForTest(CursorType id); private: struct ImageCursor { @@ -49,22 +51,22 @@ bool IsImageCursor(gfx::NativeCursor native_cursor); // Loads a new cursor corresponding to |id|. - ::Cursor CursorFromId(int id); + ::Cursor CursorFromId(CursorType id); XDisplay* display_; // A map from a cursor native type to X cursor. - std::unordered_map<int, ::Cursor> font_cursors_; + std::map<CursorType, ::Cursor> font_cursors_; // A map to hold all image cursors. It maps the cursor ID to the X Cursor, the // display's scale factor, and the display's rotation. - typedef std::unordered_map<int, std::unique_ptr<ImageCursor>> ImageCursorMap; + typedef std::map<CursorType, std::unique_ptr<ImageCursor>> ImageCursorMap; ImageCursorMap image_cursors_; // A map to hold all animated cursors. It maps the cursor ID to the pair of // the X Cursor and the corresponding XcursorImages. We need a pointer to the // images so that we can free them on destruction. - typedef std::unordered_map<int, std::pair<::Cursor, XcursorImages*>> + typedef std::map<CursorType, std::pair<::Cursor, XcursorImages*>> AnimatedCursorMap; AnimatedCursorMap animated_cursors_;
diff --git a/ui/base/cursor/cursors_aura.cc b/ui/base/cursor/cursors_aura.cc index 1f29f29..0d8a73d 100644 --- a/ui/base/cursor/cursors_aura.cc +++ b/ui/base/cursor/cursors_aura.cc
@@ -27,7 +27,7 @@ }; struct CursorData { - int id; + CursorType id; int resource_id; HotPoint hot_1x; HotPoint hot_2x; @@ -42,102 +42,164 @@ }; const CursorData kNormalCursors[] = { - {ui::kCursorNull, IDR_AURA_CURSOR_PTR, {4, 4}, {7, 7}}, - {ui::kCursorPointer, IDR_AURA_CURSOR_PTR, {4, 4}, {7, 7}}, - {ui::kCursorNoDrop, IDR_AURA_CURSOR_NO_DROP, {9, 9}, {18, 18}}, - {ui::kCursorNotAllowed, IDR_AURA_CURSOR_NO_DROP, {9, 9}, {18, 18}}, - {ui::kCursorCopy, IDR_AURA_CURSOR_COPY, {9, 9}, {18, 18}}, - {ui::kCursorHand, IDR_AURA_CURSOR_HAND, {9, 4}, {19, 8}}, - {ui::kCursorMove, IDR_AURA_CURSOR_MOVE, {11, 11}, {23, 23}}, - {ui::kCursorNorthEastResize, IDR_AURA_CURSOR_NORTH_EAST_RESIZE, - {12, 11}, {25, 23}}, - {ui::kCursorSouthWestResize, IDR_AURA_CURSOR_SOUTH_WEST_RESIZE, - {12, 11}, {25, 23}}, - {ui::kCursorSouthEastResize, IDR_AURA_CURSOR_SOUTH_EAST_RESIZE, - {11, 11}, {24, 23}}, - {ui::kCursorNorthWestResize, IDR_AURA_CURSOR_NORTH_WEST_RESIZE, - {11, 11}, {24, 23}}, - {ui::kCursorNorthResize, IDR_AURA_CURSOR_NORTH_RESIZE, {11, 12}, {23, 23}}, - {ui::kCursorSouthResize, IDR_AURA_CURSOR_SOUTH_RESIZE, {11, 12}, {23, 23}}, - {ui::kCursorEastResize, IDR_AURA_CURSOR_EAST_RESIZE, {12, 11}, {25, 23}}, - {ui::kCursorWestResize, IDR_AURA_CURSOR_WEST_RESIZE, {12, 11}, {25, 23}}, - {ui::kCursorIBeam, IDR_AURA_CURSOR_IBEAM, {12, 12}, {24, 25}}, - {ui::kCursorAlias, IDR_AURA_CURSOR_ALIAS, {8, 6}, {15, 11}}, - {ui::kCursorCell, IDR_AURA_CURSOR_CELL, {11, 11}, {24, 23}}, - {ui::kCursorContextMenu, IDR_AURA_CURSOR_CONTEXT_MENU, {4, 4}, {8, 9}}, - {ui::kCursorCross, IDR_AURA_CURSOR_CROSSHAIR, {12, 12}, {25, 23}}, - {ui::kCursorHelp, IDR_AURA_CURSOR_HELP, {4, 4}, {8, 9}}, - {ui::kCursorVerticalText, IDR_AURA_CURSOR_XTERM_HORIZ, {12, 11}, {26, 23}}, - {ui::kCursorZoomIn, IDR_AURA_CURSOR_ZOOM_IN, {10, 10}, {20, 20}}, - {ui::kCursorZoomOut, IDR_AURA_CURSOR_ZOOM_OUT, {10, 10}, {20, 20}}, - {ui::kCursorRowResize, IDR_AURA_CURSOR_ROW_RESIZE, {11, 12}, {23, 23}}, - {ui::kCursorColumnResize, IDR_AURA_CURSOR_COL_RESIZE, {12, 11}, {25, 23}}, - {ui::kCursorEastWestResize, IDR_AURA_CURSOR_EAST_WEST_RESIZE, - {12, 11}, {25, 23}}, - {ui::kCursorNorthSouthResize, IDR_AURA_CURSOR_NORTH_SOUTH_RESIZE, - {11, 12}, {23, 23}}, - {ui::kCursorNorthEastSouthWestResize, - IDR_AURA_CURSOR_NORTH_EAST_SOUTH_WEST_RESIZE, {12, 11}, {25, 23}}, - {ui::kCursorNorthWestSouthEastResize, - IDR_AURA_CURSOR_NORTH_WEST_SOUTH_EAST_RESIZE, {11, 11}, {24, 23}}, - {ui::kCursorGrab, IDR_AURA_CURSOR_GRAB, {8, 5}, {16, 10}}, - {ui::kCursorGrabbing, IDR_AURA_CURSOR_GRABBING, {9, 9}, {18, 18}}, + {CursorType::kNull, IDR_AURA_CURSOR_PTR, {4, 4}, {7, 7}}, + {CursorType::kPointer, IDR_AURA_CURSOR_PTR, {4, 4}, {7, 7}}, + {CursorType::kNoDrop, IDR_AURA_CURSOR_NO_DROP, {9, 9}, {18, 18}}, + {CursorType::kNotAllowed, IDR_AURA_CURSOR_NO_DROP, {9, 9}, {18, 18}}, + {CursorType::kCopy, IDR_AURA_CURSOR_COPY, {9, 9}, {18, 18}}, + {CursorType::kHand, IDR_AURA_CURSOR_HAND, {9, 4}, {19, 8}}, + {CursorType::kMove, IDR_AURA_CURSOR_MOVE, {11, 11}, {23, 23}}, + {CursorType::kNorthEastResize, + IDR_AURA_CURSOR_NORTH_EAST_RESIZE, + {12, 11}, + {25, 23}}, + {CursorType::kSouthWestResize, + IDR_AURA_CURSOR_SOUTH_WEST_RESIZE, + {12, 11}, + {25, 23}}, + {CursorType::kSouthEastResize, + IDR_AURA_CURSOR_SOUTH_EAST_RESIZE, + {11, 11}, + {24, 23}}, + {CursorType::kNorthWestResize, + IDR_AURA_CURSOR_NORTH_WEST_RESIZE, + {11, 11}, + {24, 23}}, + {CursorType::kNorthResize, + IDR_AURA_CURSOR_NORTH_RESIZE, + {11, 12}, + {23, 23}}, + {CursorType::kSouthResize, + IDR_AURA_CURSOR_SOUTH_RESIZE, + {11, 12}, + {23, 23}}, + {CursorType::kEastResize, IDR_AURA_CURSOR_EAST_RESIZE, {12, 11}, {25, 23}}, + {CursorType::kWestResize, IDR_AURA_CURSOR_WEST_RESIZE, {12, 11}, {25, 23}}, + {CursorType::kIBeam, IDR_AURA_CURSOR_IBEAM, {12, 12}, {24, 25}}, + {CursorType::kAlias, IDR_AURA_CURSOR_ALIAS, {8, 6}, {15, 11}}, + {CursorType::kCell, IDR_AURA_CURSOR_CELL, {11, 11}, {24, 23}}, + {CursorType::kContextMenu, IDR_AURA_CURSOR_CONTEXT_MENU, {4, 4}, {8, 9}}, + {CursorType::kCross, IDR_AURA_CURSOR_CROSSHAIR, {12, 12}, {25, 23}}, + {CursorType::kHelp, IDR_AURA_CURSOR_HELP, {4, 4}, {8, 9}}, + {CursorType::kVerticalText, + IDR_AURA_CURSOR_XTERM_HORIZ, + {12, 11}, + {26, 23}}, + {CursorType::kZoomIn, IDR_AURA_CURSOR_ZOOM_IN, {10, 10}, {20, 20}}, + {CursorType::kZoomOut, IDR_AURA_CURSOR_ZOOM_OUT, {10, 10}, {20, 20}}, + {CursorType::kRowResize, IDR_AURA_CURSOR_ROW_RESIZE, {11, 12}, {23, 23}}, + {CursorType::kColumnResize, IDR_AURA_CURSOR_COL_RESIZE, {12, 11}, {25, 23}}, + {CursorType::kEastWestResize, + IDR_AURA_CURSOR_EAST_WEST_RESIZE, + {12, 11}, + {25, 23}}, + {CursorType::kNorthSouthResize, + IDR_AURA_CURSOR_NORTH_SOUTH_RESIZE, + {11, 12}, + {23, 23}}, + {CursorType::kNorthEastSouthWestResize, + IDR_AURA_CURSOR_NORTH_EAST_SOUTH_WEST_RESIZE, + {12, 11}, + {25, 23}}, + {CursorType::kNorthWestSouthEastResize, + IDR_AURA_CURSOR_NORTH_WEST_SOUTH_EAST_RESIZE, + {11, 11}, + {24, 23}}, + {CursorType::kGrab, IDR_AURA_CURSOR_GRAB, {8, 5}, {16, 10}}, + {CursorType::kGrabbing, IDR_AURA_CURSOR_GRABBING, {9, 9}, {18, 18}}, }; const CursorData kLargeCursors[] = { - // The 2x hotspots should be double of the 1x, even though the cursors are - // shown as same size as 1x (64x64), because in 2x dpi screen, the 1x large - // cursor assets (64x64) are internally enlarged to the double size (128x128) - // by ResourceBundleImageSource. - {ui::kCursorNull, IDR_AURA_CURSOR_BIG_PTR, {10, 10}, {20, 20}}, - {ui::kCursorPointer, IDR_AURA_CURSOR_BIG_PTR, {10, 10}, {20, 20}}, - {ui::kCursorNoDrop, IDR_AURA_CURSOR_BIG_NO_DROP, {10, 10}, {20, 20}}, - {ui::kCursorNotAllowed, IDR_AURA_CURSOR_BIG_NO_DROP, {10, 10}, {20, 20}}, - {ui::kCursorCopy, IDR_AURA_CURSOR_BIG_COPY, {10, 10}, {20, 20}}, - {ui::kCursorHand, IDR_AURA_CURSOR_BIG_HAND, {25, 7}, {50, 14}}, - {ui::kCursorMove, IDR_AURA_CURSOR_BIG_MOVE, {32, 31}, {64, 62}}, - {ui::kCursorNorthEastResize, IDR_AURA_CURSOR_BIG_NORTH_EAST_RESIZE, - {31, 28}, {62, 56}}, - {ui::kCursorSouthWestResize, IDR_AURA_CURSOR_BIG_SOUTH_WEST_RESIZE, - {31, 28}, {62, 56}}, - {ui::kCursorSouthEastResize, IDR_AURA_CURSOR_BIG_SOUTH_EAST_RESIZE, - {28, 28}, {56, 56}}, - {ui::kCursorNorthWestResize, IDR_AURA_CURSOR_BIG_NORTH_WEST_RESIZE, - {28, 28}, {56, 56}}, - {ui::kCursorNorthResize, IDR_AURA_CURSOR_BIG_NORTH_RESIZE, - {29, 32}, {58, 64}}, - {ui::kCursorSouthResize, IDR_AURA_CURSOR_BIG_SOUTH_RESIZE, - {29, 32}, {58, 64}}, - {ui::kCursorEastResize, IDR_AURA_CURSOR_BIG_EAST_RESIZE, {35, 29}, {70, 58}}, - {ui::kCursorWestResize, IDR_AURA_CURSOR_BIG_WEST_RESIZE, {35, 29}, {70, 58}}, - {ui::kCursorIBeam, IDR_AURA_CURSOR_BIG_IBEAM, {30, 32}, {60, 64}}, - {ui::kCursorAlias, IDR_AURA_CURSOR_BIG_ALIAS, {19, 11}, {38, 22}}, - {ui::kCursorCell, IDR_AURA_CURSOR_BIG_CELL, {30, 30}, {60, 60}}, - {ui::kCursorContextMenu, IDR_AURA_CURSOR_BIG_CONTEXT_MENU, - {11, 11}, {22, 22}}, - {ui::kCursorCross, IDR_AURA_CURSOR_BIG_CROSSHAIR, {31, 30}, {62, 60}}, - {ui::kCursorHelp, IDR_AURA_CURSOR_BIG_HELP, {10, 11}, {20, 22}}, - {ui::kCursorVerticalText, IDR_AURA_CURSOR_BIG_XTERM_HORIZ, - {32, 30}, {64, 60}}, - {ui::kCursorZoomIn, IDR_AURA_CURSOR_BIG_ZOOM_IN, {25, 26}, {50, 52}}, - {ui::kCursorZoomOut, IDR_AURA_CURSOR_BIG_ZOOM_OUT, {26, 26}, {52, 52}}, - {ui::kCursorRowResize, IDR_AURA_CURSOR_BIG_ROW_RESIZE, {29, 32}, {58, 64}}, - {ui::kCursorColumnResize, IDR_AURA_CURSOR_BIG_COL_RESIZE, {35, 29}, {70, 58}}, - {ui::kCursorEastWestResize, IDR_AURA_CURSOR_BIG_EAST_WEST_RESIZE, - {35, 29}, {70, 58}}, - {ui::kCursorNorthSouthResize, IDR_AURA_CURSOR_BIG_NORTH_SOUTH_RESIZE, - {29, 32}, {58, 64}}, - {ui::kCursorNorthEastSouthWestResize, - IDR_AURA_CURSOR_BIG_NORTH_EAST_SOUTH_WEST_RESIZE, {32, 30}, {64, 60}}, - {ui::kCursorNorthWestSouthEastResize, - IDR_AURA_CURSOR_BIG_NORTH_WEST_SOUTH_EAST_RESIZE, {32, 31}, {64, 62}}, - {ui::kCursorGrab, IDR_AURA_CURSOR_BIG_GRAB, {21, 11}, {42, 22}}, - {ui::kCursorGrabbing, IDR_AURA_CURSOR_BIG_GRABBING, {20, 12}, {40, 24}}, + // The 2x hotspots should be double of the 1x, even though the cursors are + // shown as same size as 1x (64x64), because in 2x dpi screen, the 1x large + // cursor assets (64x64) are internally enlarged to the double size + // (128x128) + // by ResourceBundleImageSource. + {CursorType::kNull, IDR_AURA_CURSOR_BIG_PTR, {10, 10}, {20, 20}}, + {CursorType::kPointer, IDR_AURA_CURSOR_BIG_PTR, {10, 10}, {20, 20}}, + {CursorType::kNoDrop, IDR_AURA_CURSOR_BIG_NO_DROP, {10, 10}, {20, 20}}, + {CursorType::kNotAllowed, IDR_AURA_CURSOR_BIG_NO_DROP, {10, 10}, {20, 20}}, + {CursorType::kCopy, IDR_AURA_CURSOR_BIG_COPY, {10, 10}, {20, 20}}, + {CursorType::kHand, IDR_AURA_CURSOR_BIG_HAND, {25, 7}, {50, 14}}, + {CursorType::kMove, IDR_AURA_CURSOR_BIG_MOVE, {32, 31}, {64, 62}}, + {CursorType::kNorthEastResize, + IDR_AURA_CURSOR_BIG_NORTH_EAST_RESIZE, + {31, 28}, + {62, 56}}, + {CursorType::kSouthWestResize, + IDR_AURA_CURSOR_BIG_SOUTH_WEST_RESIZE, + {31, 28}, + {62, 56}}, + {CursorType::kSouthEastResize, + IDR_AURA_CURSOR_BIG_SOUTH_EAST_RESIZE, + {28, 28}, + {56, 56}}, + {CursorType::kNorthWestResize, + IDR_AURA_CURSOR_BIG_NORTH_WEST_RESIZE, + {28, 28}, + {56, 56}}, + {CursorType::kNorthResize, + IDR_AURA_CURSOR_BIG_NORTH_RESIZE, + {29, 32}, + {58, 64}}, + {CursorType::kSouthResize, + IDR_AURA_CURSOR_BIG_SOUTH_RESIZE, + {29, 32}, + {58, 64}}, + {CursorType::kEastResize, + IDR_AURA_CURSOR_BIG_EAST_RESIZE, + {35, 29}, + {70, 58}}, + {CursorType::kWestResize, + IDR_AURA_CURSOR_BIG_WEST_RESIZE, + {35, 29}, + {70, 58}}, + {CursorType::kIBeam, IDR_AURA_CURSOR_BIG_IBEAM, {30, 32}, {60, 64}}, + {CursorType::kAlias, IDR_AURA_CURSOR_BIG_ALIAS, {19, 11}, {38, 22}}, + {CursorType::kCell, IDR_AURA_CURSOR_BIG_CELL, {30, 30}, {60, 60}}, + {CursorType::kContextMenu, + IDR_AURA_CURSOR_BIG_CONTEXT_MENU, + {11, 11}, + {22, 22}}, + {CursorType::kCross, IDR_AURA_CURSOR_BIG_CROSSHAIR, {31, 30}, {62, 60}}, + {CursorType::kHelp, IDR_AURA_CURSOR_BIG_HELP, {10, 11}, {20, 22}}, + {CursorType::kVerticalText, + IDR_AURA_CURSOR_BIG_XTERM_HORIZ, + {32, 30}, + {64, 60}}, + {CursorType::kZoomIn, IDR_AURA_CURSOR_BIG_ZOOM_IN, {25, 26}, {50, 52}}, + {CursorType::kZoomOut, IDR_AURA_CURSOR_BIG_ZOOM_OUT, {26, 26}, {52, 52}}, + {CursorType::kRowResize, + IDR_AURA_CURSOR_BIG_ROW_RESIZE, + {29, 32}, + {58, 64}}, + {CursorType::kColumnResize, + IDR_AURA_CURSOR_BIG_COL_RESIZE, + {35, 29}, + {70, 58}}, + {CursorType::kEastWestResize, + IDR_AURA_CURSOR_BIG_EAST_WEST_RESIZE, + {35, 29}, + {70, 58}}, + {CursorType::kNorthSouthResize, + IDR_AURA_CURSOR_BIG_NORTH_SOUTH_RESIZE, + {29, 32}, + {58, 64}}, + {CursorType::kNorthEastSouthWestResize, + IDR_AURA_CURSOR_BIG_NORTH_EAST_SOUTH_WEST_RESIZE, + {32, 30}, + {64, 60}}, + {CursorType::kNorthWestSouthEastResize, + IDR_AURA_CURSOR_BIG_NORTH_WEST_SOUTH_EAST_RESIZE, + {32, 31}, + {64, 62}}, + {CursorType::kGrab, IDR_AURA_CURSOR_BIG_GRAB, {21, 11}, {42, 22}}, + {CursorType::kGrabbing, IDR_AURA_CURSOR_BIG_GRABBING, {20, 12}, {40, 24}}, }; const CursorData kAnimatedCursors[] = { - {ui::kCursorWait, IDR_AURA_CURSOR_THROBBER, {7, 7}, {14, 14}}, - {ui::kCursorProgress, IDR_AURA_CURSOR_THROBBER, {7, 7}, {14, 14}}, + {CursorType::kWait, IDR_AURA_CURSOR_THROBBER, {7, 7}, {14, 14}}, + {CursorType::kProgress, IDR_AURA_CURSOR_THROBBER, {7, 7}, {14, 14}}, }; const CursorSet kCursorSets[] = { @@ -165,7 +227,7 @@ bool SearchTable(const CursorData* table, size_t table_length, - int id, + CursorType id, float scale_factor, int* resource_id, gfx::Point* point) { @@ -188,7 +250,7 @@ } // namespace bool GetCursorDataFor(CursorSetType cursor_set_id, - int id, + CursorType id, float scale_factor, int* resource_id, gfx::Point* point) { @@ -209,7 +271,7 @@ } bool GetAnimatedCursorDataFor(CursorSetType cursor_set_id, - int id, + CursorType id, float scale_factor, int* resource_id, gfx::Point* point) {
diff --git a/ui/base/cursor/cursors_aura.h b/ui/base/cursor/cursors_aura.h index e8eae0a..6ce2da6 100644 --- a/ui/base/cursor/cursors_aura.h +++ b/ui/base/cursor/cursors_aura.h
@@ -19,18 +19,18 @@ const int kAnimatedCursorFrameDelayMs = 25; // Returns data about |id|, where id is a cursor constant like -// ui::kCursorHelp. The IDR will be placed in |resource_id| and the hotspots -// for the different DPIs will be placed in |hot_1x| and |hot_2x|. Returns -// false if |id| is invalid. +// ui::CursorType::kHelp. The IDR will be placed in |resource_id| and the +// hotspots for the different DPIs will be placed in |hot_1x| and |hot_2x|. +// Returns false if |id| is invalid. bool UI_BASE_EXPORT GetCursorDataFor(CursorSetType cursor_set_id, - int id, + CursorType id, float scale_factor, int* resource_id, gfx::Point* point); // Like above, but for animated cursors. bool UI_BASE_EXPORT GetAnimatedCursorDataFor(CursorSetType cursor_set_id, - int id, + CursorType id, float scale_factor, int* resource_id, gfx::Point* point);
diff --git a/ui/base/cursor/image_cursors.cc b/ui/base/cursor/image_cursors.cc index 32ff6613..6b6eea7 100644 --- a/ui/base/cursor/image_cursors.cc +++ b/ui/base/cursor/image_cursors.cc
@@ -20,45 +20,43 @@ namespace { -const int kImageCursorIds[] = { - kCursorNull, - kCursorPointer, - kCursorNoDrop, - kCursorNotAllowed, - kCursorCopy, - kCursorHand, - kCursorMove, - kCursorNorthEastResize, - kCursorSouthWestResize, - kCursorSouthEastResize, - kCursorNorthWestResize, - kCursorNorthResize, - kCursorSouthResize, - kCursorEastResize, - kCursorWestResize, - kCursorIBeam, - kCursorAlias, - kCursorCell, - kCursorContextMenu, - kCursorCross, - kCursorHelp, - kCursorVerticalText, - kCursorZoomIn, - kCursorZoomOut, - kCursorRowResize, - kCursorColumnResize, - kCursorEastWestResize, - kCursorNorthSouthResize, - kCursorNorthEastSouthWestResize, - kCursorNorthWestSouthEastResize, - kCursorGrab, - kCursorGrabbing, +const CursorType kImageCursorIds[] = { + CursorType::kNull, + CursorType::kPointer, + CursorType::kNoDrop, + CursorType::kNotAllowed, + CursorType::kCopy, + CursorType::kHand, + CursorType::kMove, + CursorType::kNorthEastResize, + CursorType::kSouthWestResize, + CursorType::kSouthEastResize, + CursorType::kNorthWestResize, + CursorType::kNorthResize, + CursorType::kSouthResize, + CursorType::kEastResize, + CursorType::kWestResize, + CursorType::kIBeam, + CursorType::kAlias, + CursorType::kCell, + CursorType::kContextMenu, + CursorType::kCross, + CursorType::kHelp, + CursorType::kVerticalText, + CursorType::kZoomIn, + CursorType::kZoomOut, + CursorType::kRowResize, + CursorType::kColumnResize, + CursorType::kEastWestResize, + CursorType::kNorthSouthResize, + CursorType::kNorthEastSouthWestResize, + CursorType::kNorthWestSouthEastResize, + CursorType::kGrab, + CursorType::kGrabbing, }; -const int kAnimatedCursorIds[] = { - kCursorWait, - kCursorProgress -}; +const CursorType kAnimatedCursorIds[] = {CursorType::kWait, + CursorType::kProgress}; } // namespace
diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc index ab052ca..5ed4c7b 100644 --- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc +++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
@@ -20,7 +20,7 @@ return static_cast<PlatformCursor>(cursor); } -scoped_refptr<BitmapCursorOzone> CreateDefaultBitmapCursor(int type) { +scoped_refptr<BitmapCursorOzone> CreateDefaultBitmapCursor(CursorType type) { SkBitmap bitmap; gfx::Point hotspot; if (GetCursorBitmap(type, &bitmap, &hotspot)) @@ -73,7 +73,7 @@ return make_scoped_refptr(ToBitmapCursorOzone(platform_cursor)); } -PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) { +PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(CursorType type) { return GetDefaultCursorInternal(type).get(); } @@ -107,16 +107,16 @@ } scoped_refptr<BitmapCursorOzone> -BitmapCursorFactoryOzone::GetDefaultCursorInternal(int type) { - if (type == kCursorNone) +BitmapCursorFactoryOzone::GetDefaultCursorInternal(CursorType type) { + if (type == CursorType::kNone) return NULL; // NULL is used for hidden cursor. if (!default_cursors_.count(type)) { // Create new image cursor from default aura bitmap for this type. We hold a // ref forever because clients do not do refcounting for default cursors. scoped_refptr<BitmapCursorOzone> cursor = CreateDefaultBitmapCursor(type); - if (!cursor.get() && type != kCursorPointer) - cursor = GetDefaultCursorInternal(kCursorPointer); + if (!cursor.get() && type != CursorType::kPointer) + cursor = GetDefaultCursorInternal(CursorType::kPointer); DCHECK(cursor.get()) << "Failed to load default cursor bitmap"; default_cursors_[type] = cursor; }
diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h index de7352d..7a8a2d6 100644 --- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h +++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h
@@ -61,7 +61,7 @@ PlatformCursor platform_cursor); // CursorFactoryOzone: - PlatformCursor GetDefaultCursor(int type) override; + PlatformCursor GetDefaultCursor(CursorType type) override; PlatformCursor CreateImageCursor(const SkBitmap& bitmap, const gfx::Point& hotspot, float bitmap_dpi) override; @@ -74,10 +74,11 @@ private: // Get cached BitmapCursorOzone for a default cursor. - scoped_refptr<BitmapCursorOzone> GetDefaultCursorInternal(int type); + scoped_refptr<BitmapCursorOzone> GetDefaultCursorInternal(CursorType type); // Default cursors are cached & owned by the factory. - typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap; + typedef std::map<CursorType, scoped_refptr<BitmapCursorOzone>> + DefaultCursorMap; DefaultCursorMap default_cursors_; DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone);
diff --git a/ui/base/cursor/ozone/cursor_data_factory_ozone.cc b/ui/base/cursor/ozone/cursor_data_factory_ozone.cc index 7d900d4b..e0a68d95 100644 --- a/ui/base/cursor/ozone/cursor_data_factory_ozone.cc +++ b/ui/base/cursor/ozone/cursor_data_factory_ozone.cc
@@ -50,7 +50,7 @@ return ToCursorDataOzone(platform_cursor)->data(); } -PlatformCursor CursorDataFactoryOzone::GetDefaultCursor(int type) { +PlatformCursor CursorDataFactoryOzone::GetDefaultCursor(CursorType type) { // Unlike BitmapCursorFactoryOzone, we aren't making heavyweight bitmaps, but // we still have to cache these forever because objects that come out of the // GetDefaultCursor() method aren't treated as refcounted by the ozone @@ -89,8 +89,8 @@ } scoped_refptr<CursorDataOzone> CursorDataFactoryOzone::GetDefaultCursorInternal( - int type) { - if (type == kCursorNone) + CursorType type) { + if (type == CursorType::kNone) return nullptr; // nullptr is used for hidden cursor. if (!default_cursors_.count(type)) {
diff --git a/ui/base/cursor/ozone/cursor_data_factory_ozone.h b/ui/base/cursor/ozone/cursor_data_factory_ozone.h index 5db5d1e..d3ef8a1 100644 --- a/ui/base/cursor/ozone/cursor_data_factory_ozone.h +++ b/ui/base/cursor/ozone/cursor_data_factory_ozone.h
@@ -64,7 +64,7 @@ static const ui::CursorData& GetCursorData(PlatformCursor platform_cursor); // CursorFactoryOzone: - PlatformCursor GetDefaultCursor(int type) override; + PlatformCursor GetDefaultCursor(CursorType type) override; PlatformCursor CreateImageCursor(const SkBitmap& bitmap, const gfx::Point& hotspot, float bitmap_dpi) override; @@ -77,10 +77,10 @@ private: // Get cached BitmapCursorOzone for a default cursor. - scoped_refptr<CursorDataOzone> GetDefaultCursorInternal(int type); + scoped_refptr<CursorDataOzone> GetDefaultCursorInternal(CursorType type); // Default cursors are cached & owned by the factory. - typedef std::map<int, scoped_refptr<CursorDataOzone>> DefaultCursorMap; + typedef std::map<CursorType, scoped_refptr<CursorDataOzone>> DefaultCursorMap; DefaultCursorMap default_cursors_; DISALLOW_COPY_AND_ASSIGN(CursorDataFactoryOzone);
diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h index e2bb4636..517bd40 100644 --- a/ui/gfx/native_widget_types.h +++ b/ui/gfx/native_widget_types.h
@@ -46,6 +46,7 @@ } namespace ui { class Cursor; +enum class CursorType; class Event; } #endif // defined(USE_AURA) @@ -156,7 +157,7 @@ // A constant value to indicate that gfx::NativeCursor refers to no cursor. #if defined(USE_AURA) -const int kNullCursor = 0; +const ui::CursorType kNullCursor = static_cast<ui::CursorType>(0); #else const gfx::NativeCursor kNullCursor = static_cast<gfx::NativeCursor>(NULL); #endif
diff --git a/ui/ozone/platform/x11/x11_cursor_factory_ozone.cc b/ui/ozone/platform/x11/x11_cursor_factory_ozone.cc index 97106f1..0354647 100644 --- a/ui/ozone/platform/x11/x11_cursor_factory_ozone.cc +++ b/ui/ozone/platform/x11/x11_cursor_factory_ozone.cc
@@ -21,7 +21,7 @@ } // Gets default aura cursor bitmap/hotspot and creates a X11CursorOzone with it. -scoped_refptr<X11CursorOzone> CreateAuraX11Cursor(int type) { +scoped_refptr<X11CursorOzone> CreateAuraX11Cursor(CursorType type) { SkBitmap bitmap; gfx::Point hotspot; if (GetCursorBitmap(type, &bitmap, &hotspot)) { @@ -37,7 +37,7 @@ X11CursorFactoryOzone::~X11CursorFactoryOzone() {} -PlatformCursor X11CursorFactoryOzone::GetDefaultCursor(int type) { +PlatformCursor X11CursorFactoryOzone::GetDefaultCursor(CursorType type) { return ToPlatformCursor(GetDefaultCursorInternal(type).get()); } @@ -76,8 +76,8 @@ } scoped_refptr<X11CursorOzone> X11CursorFactoryOzone::GetDefaultCursorInternal( - int type) { - if (type == kCursorNone) + CursorType type) { + if (type == CursorType::kNone) return invisible_cursor_; // TODO(kylechar): Use predefined X cursors here instead. @@ -86,8 +86,8 @@ // pointer cursor then invisible cursor if this fails. scoped_refptr<X11CursorOzone> cursor = CreateAuraX11Cursor(type); if (!cursor.get()) { - if (type != kCursorPointer) { - cursor = GetDefaultCursorInternal(kCursorPointer); + if (type != CursorType::kPointer) { + cursor = GetDefaultCursorInternal(CursorType::kPointer); } else { NOTREACHED() << "Failed to load default cursor bitmap"; }
diff --git a/ui/ozone/platform/x11/x11_cursor_factory_ozone.h b/ui/ozone/platform/x11/x11_cursor_factory_ozone.h index a186a821..7b7ac64 100644 --- a/ui/ozone/platform/x11/x11_cursor_factory_ozone.h +++ b/ui/ozone/platform/x11/x11_cursor_factory_ozone.h
@@ -7,8 +7,8 @@ #include <X11/X.h> +#include <map> #include <memory> -#include <unordered_map> #include <vector> #include "base/macros.h" @@ -25,7 +25,7 @@ ~X11CursorFactoryOzone() override; // CursorFactoryOzone: - PlatformCursor GetDefaultCursor(int type) override; + PlatformCursor GetDefaultCursor(CursorType type) override; PlatformCursor CreateImageCursor(const SkBitmap& bitmap, const gfx::Point& hotspot, float bitmap_dpi) override; @@ -38,13 +38,13 @@ private: // Loads/caches default cursor or returns cached version. - scoped_refptr<X11CursorOzone> GetDefaultCursorInternal(int type); + scoped_refptr<X11CursorOzone> GetDefaultCursorInternal(CursorType type); // Holds a single instance of the invisible cursor. X11 has no way to hide // the cursor so an invisible cursor mimics that. scoped_refptr<X11CursorOzone> invisible_cursor_; - std::unordered_map<int, scoped_refptr<X11CursorOzone>> default_cursors_; + std::map<CursorType, scoped_refptr<X11CursorOzone>> default_cursors_; DISALLOW_COPY_AND_ASSIGN(X11CursorFactoryOzone); };
diff --git a/ui/ozone/public/cursor_factory_ozone.cc b/ui/ozone/public/cursor_factory_ozone.cc index fa075bb..356bd12 100644 --- a/ui/ozone/public/cursor_factory_ozone.cc +++ b/ui/ozone/public/cursor_factory_ozone.cc
@@ -26,7 +26,7 @@ return impl_; } -PlatformCursor CursorFactoryOzone::GetDefaultCursor(int type) { +PlatformCursor CursorFactoryOzone::GetDefaultCursor(CursorType type) { NOTIMPLEMENTED(); return NULL; }
diff --git a/ui/ozone/public/cursor_factory_ozone.h b/ui/ozone/public/cursor_factory_ozone.h index dbc3c751..18164baa 100644 --- a/ui/ozone/public/cursor_factory_ozone.h +++ b/ui/ozone/public/cursor_factory_ozone.h
@@ -29,7 +29,7 @@ // Return the default cursor of the specified type. The types are listed in // ui/base/cursor/cursor.h. Default cursors are managed by the implementation // and must live indefinitely; there's no way to know when to free them. - virtual PlatformCursor GetDefaultCursor(int type); + virtual PlatformCursor GetDefaultCursor(CursorType type); // Return a image cursor from the specified image & hotspot. Image cursors // are referenced counted and have an initial refcount of 1. Therefore, each
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 1a3ae27..2a15779b 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc
@@ -36,6 +36,7 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" #include "ui/views/window/client_view.h" +#include "ui/views/window/dialog_delegate.h" namespace views { @@ -532,6 +533,9 @@ if (footnote_container_) size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); + if (GetWidget()->widget_delegate()->AsDialogDelegate()) + size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); + return size; }
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc index 3474899..705e1774 100644 --- a/ui/views/bubble/bubble_frame_view_unittest.cc +++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -12,6 +12,7 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/views/bubble/bubble_border.h" +#include "ui/views/bubble/bubble_dialog_delegate.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/test/test_views.h" #include "ui/views/test/views_test_base.h" @@ -488,4 +489,83 @@ #endif } +namespace { + +class TestBubbleDialogDelegateView : public BubbleDialogDelegateView { + public: + TestBubbleDialogDelegateView() + : BubbleDialogDelegateView(nullptr, BubbleBorder::NONE) { + set_shadow(BubbleBorder::NO_ASSETS); + SetAnchorRect(gfx::Rect()); + } + ~TestBubbleDialogDelegateView() override {} + + using BubbleDialogDelegateView::SetAnchorView; + + // BubbleDialogDelegateView: + void DeleteDelegate() override { + // This delegate is owned by the test case itself, so it should not delete + // itself here. + } + + int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; } + + gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } + + private: + DISALLOW_COPY_AND_ASSIGN(TestBubbleDialogDelegateView); +}; + +class TestLayoutProvider : public LayoutProvider { + public: + TestLayoutProvider() : LayoutProvider() {} + ~TestLayoutProvider() override {} + + // LayoutProvider: + int GetSnappedDialogWidth(int min_width) const override { + return snap_to_ ? snap_to_ : min_width; + } + + void set_snap_to(int width) { snap_to_ = width; } + + private: + int snap_to_ = 0; + + DISALLOW_COPY_AND_ASSIGN(TestLayoutProvider); +}; + +} // namespace + +// This test ensures that if the installed LayoutProvider snaps dialog widths, +// BubbleFrameView correctly sizes itself to that width. +TEST_F(BubbleFrameViewTest, WidthSnaps) { + TestLayoutProvider provider; + TestBubbleDialogDelegateView delegate; + + Widget anchor; + Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); + params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + anchor.Init(params); + anchor.Show(); + + delegate.SetAnchorView(anchor.GetContentsView()); + delegate.set_margins(gfx::Insets()); + + Widget* w0 = BubbleDialogDelegateView::CreateBubble(&delegate); + w0->Show(); + EXPECT_EQ(delegate.GetPreferredSize().width(), + w0->GetWindowBoundsInScreen().width()); + w0->CloseNow(); + + constexpr int kTestWidth = 300; + provider.set_snap_to(kTestWidth); + + // The Widget's snapped width should exactly match the width returned by the + // LayoutProvider. + Widget* w1 = BubbleDialogDelegateView::CreateBubble(&delegate); + w1->Show(); + EXPECT_EQ(kTestWidth, w1->GetWindowBoundsInScreen().width()); + w1->CloseNow(); +} + } // namespace views
diff --git a/ui/views/controls/native/native_view_host_aura_unittest.cc b/ui/views/controls/native/native_view_host_aura_unittest.cc index e263d29..047ef98 100644 --- a/ui/views/controls/native/native_view_host_aura_unittest.cc +++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -158,12 +158,12 @@ TEST_F(NativeViewHostAuraTest, CursorForNativeView) { CreateHost(); - toplevel()->SetCursor(ui::kCursorHand); - child()->SetCursor(ui::kCursorWait); + toplevel()->SetCursor(ui::CursorType::kHand); + child()->SetCursor(ui::CursorType::kWait); ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0); - EXPECT_EQ(ui::kCursorWait, host()->GetCursor(move_event).native_type()); + EXPECT_EQ(ui::CursorType::kWait, host()->GetCursor(move_event).native_type()); DestroyHost(); }
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc index 208b9aa7..3cb034c 100644 --- a/ui/views/layout/layout_provider.cc +++ b/ui/views/layout/layout_provider.cc
@@ -77,4 +77,8 @@ return typography_provider_; } -} // namespace views \ No newline at end of file +int LayoutProvider::GetSnappedDialogWidth(int min_width) const { + return min_width; +} + +} // namespace views
diff --git a/ui/views/layout/layout_provider.h b/ui/views/layout/layout_provider.h index 197586b..f6b9640 100644 --- a/ui/views/layout/layout_provider.h +++ b/ui/views/layout/layout_provider.h
@@ -85,6 +85,10 @@ // font, weight, color, size, and line height. Never null. virtual const TypographyProvider& GetTypographyProvider() const; + // Returns the actual width to use for a dialog that requires at least + // |min_width|. + virtual int GetSnappedDialogWidth(int min_width) const; + private: DefaultTypographyProvider typography_provider_;
diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc index 8557a33..9e73b6a1 100644 --- a/ui/views/mus/desktop_window_tree_host_mus.cc +++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -144,7 +144,7 @@ SetCursor(delegate->GetCursor(), delegate); } else { aura::WindowPortMus::Get(window_)->SetPredefinedCursor( - ui::mojom::CursorType::NONE); + ui::mojom::CursorType::kNone); } }
diff --git a/ui/views/native_cursor_aura.cc b/ui/views/native_cursor_aura.cc index cafe684a..0ce238b 100644 --- a/ui/views/native_cursor_aura.cc +++ b/ui/views/native_cursor_aura.cc
@@ -9,23 +9,23 @@ namespace views { gfx::NativeCursor GetNativeIBeamCursor() { - return ui::kCursorIBeam; + return ui::CursorType::kIBeam; } gfx::NativeCursor GetNativeHandCursor() { - return ui::kCursorHand; + return ui::CursorType::kHand; } gfx::NativeCursor GetNativeColumnResizeCursor() { - return ui::kCursorColumnResize; + return ui::CursorType::kColumnResize; } gfx::NativeCursor GetNativeEastWestResizeCursor() { - return ui::kCursorEastWestResize; + return ui::CursorType::kEastWestResize; } gfx::NativeCursor GetNativeNorthSouthResizeCursor() { - return ui::kCursorNorthSouthResize; + return ui::CursorType::kNorthSouthResize; } } // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc index 1a8a4aa..3b288de 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -680,19 +680,19 @@ return; } - int cursor_type = ui::kCursorNull; + ui::CursorType cursor_type = ui::CursorType::kNull; switch (negotiated_operation_) { case ui::DragDropTypes::DRAG_NONE: - cursor_type = ui::kCursorDndNone; + cursor_type = ui::CursorType::kDndNone; break; case ui::DragDropTypes::DRAG_MOVE: - cursor_type = ui::kCursorDndMove; + cursor_type = ui::CursorType::kDndMove; break; case ui::DragDropTypes::DRAG_COPY: - cursor_type = ui::kCursorDndCopy; + cursor_type = ui::CursorType::kDndCopy; break; case ui::DragDropTypes::DRAG_LINK: - cursor_type = ui::kCursorDndLink; + cursor_type = ui::CursorType::kDndLink; break; } move_loop_->UpdateCursor(cursor_manager_->GetInitializedCursor(cursor_type)); @@ -849,9 +849,8 @@ // Windows has a specific method, DoDragDrop(), which performs the entire // drag. We have to emulate this, so we spin off a nested runloop which will // track all cursor movement and reroute events to a specific handler. - move_loop_->RunMoveLoop( - source_window, - cursor_manager_->GetInitializedCursor(ui::kCursorGrabbing)); + move_loop_->RunMoveLoop(source_window, cursor_manager_->GetInitializedCursor( + ui::CursorType::kGrabbing)); if (alive) { if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) {
diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc index 51ebef2..38242a73 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc
@@ -18,7 +18,8 @@ DesktopNativeCursorManager::~DesktopNativeCursorManager() { } -gfx::NativeCursor DesktopNativeCursorManager::GetInitializedCursor(int type) { +gfx::NativeCursor DesktopNativeCursorManager::GetInitializedCursor( + ui::CursorType type) { gfx::NativeCursor cursor(type); cursor_loader_->SetPlatformCursor(&cursor); return cursor; @@ -63,7 +64,7 @@ if (visible) { SetCursor(delegate->GetCursor(), delegate); } else { - gfx::NativeCursor invisible_cursor(ui::kCursorNone); + gfx::NativeCursor invisible_cursor(ui::CursorType::kNone); cursor_loader_->SetPlatformCursor(&invisible_cursor); for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) (*i)->SetCursor(invisible_cursor);
diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h index 9f78790..38881f8b 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h
@@ -38,7 +38,7 @@ // Builds a cursor and sets the internal platform representation. The return // value should not be cached. - gfx::NativeCursor GetInitializedCursor(int type); + gfx::NativeCursor GetInitializedCursor(ui::CursorType type); // Adds |host| to the set |hosts_|. void AddHost(aura::WindowTreeHost* host);
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc index 80a45ec..6476482a 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -178,12 +178,14 @@ // Verify that setting the cursor using one cursor client // will set it for all root windows. - EXPECT_EQ(ui::kCursorNone, cursor_client_a->GetCursor().native_type()); - EXPECT_EQ(ui::kCursorNone, cursor_client_b->GetCursor().native_type()); + EXPECT_EQ(ui::CursorType::kNone, cursor_client_a->GetCursor().native_type()); + EXPECT_EQ(ui::CursorType::kNone, cursor_client_b->GetCursor().native_type()); - cursor_client_b->SetCursor(ui::kCursorPointer); - EXPECT_EQ(ui::kCursorPointer, cursor_client_a->GetCursor().native_type()); - EXPECT_EQ(ui::kCursorPointer, cursor_client_b->GetCursor().native_type()); + cursor_client_b->SetCursor(ui::CursorType::kPointer); + EXPECT_EQ(ui::CursorType::kPointer, + cursor_client_a->GetCursor().native_type()); + EXPECT_EQ(ui::CursorType::kPointer, + cursor_client_b->GetCursor().native_type()); // Verify that hiding the cursor using one cursor client will // hide it for all root windows. Note that hiding the cursor
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc index 1258c61..4fc3ff2 100644 --- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc +++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
@@ -48,13 +48,12 @@ X11WholeScreenMoveLoop::X11WholeScreenMoveLoop(X11MoveLoopDelegate* delegate) : delegate_(delegate), in_move_loop_(false), - initial_cursor_(ui::kCursorNull), + initial_cursor_(ui::CursorType::kNull), should_reset_mouse_flags_(false), grab_input_window_(None), grabbed_pointer_(false), canceled_(false), - weak_factory_(this) { -} + weak_factory_(this) {} X11WholeScreenMoveLoop::~X11WholeScreenMoveLoop() {}
diff --git a/ui/wm/core/compound_event_filter.cc b/ui/wm/core/compound_event_filter.cc index 84ae29a..cd2db9a8 100644 --- a/ui/wm/core/compound_event_filter.cc +++ b/ui/wm/core/compound_event_filter.cc
@@ -68,23 +68,23 @@ int window_component) { switch (window_component) { case HTBOTTOM: - return ui::kCursorSouthResize; + return ui::CursorType::kSouthResize; case HTBOTTOMLEFT: - return ui::kCursorSouthWestResize; + return ui::CursorType::kSouthWestResize; case HTBOTTOMRIGHT: - return ui::kCursorSouthEastResize; + return ui::CursorType::kSouthEastResize; case HTLEFT: - return ui::kCursorWestResize; + return ui::CursorType::kWestResize; case HTRIGHT: - return ui::kCursorEastResize; + return ui::CursorType::kEastResize; case HTTOP: - return ui::kCursorNorthResize; + return ui::CursorType::kNorthResize; case HTTOPLEFT: - return ui::kCursorNorthWestResize; + return ui::CursorType::kNorthWestResize; case HTTOPRIGHT: - return ui::kCursorNorthEastResize; + return ui::CursorType::kNorthEastResize; default: - return ui::kCursorNull; + return ui::CursorType::kNull; } }
diff --git a/ui/wm/core/cursor_manager.cc b/ui/wm/core/cursor_manager.cc index 1c3c6c99..a411b78 100644 --- a/ui/wm/core/cursor_manager.cc +++ b/ui/wm/core/cursor_manager.cc
@@ -22,12 +22,11 @@ class CursorState { public: CursorState() - : cursor_(ui::kCursorNone), + : cursor_(ui::CursorType::kNone), visible_(true), cursor_set_(ui::CURSOR_SET_NORMAL), mouse_events_enabled_(true), - visible_on_mouse_events_enabled_(true) { - } + visible_on_mouse_events_enabled_(true) {} gfx::NativeCursor cursor() const { return cursor_; } void set_cursor(gfx::NativeCursor cursor) { cursor_ = cursor; }
diff --git a/ui/wm/core/cursor_manager_unittest.cc b/ui/wm/core/cursor_manager_unittest.cc index df18de83..91e3367009 100644 --- a/ui/wm/core/cursor_manager_unittest.cc +++ b/ui/wm/core/cursor_manager_unittest.cc
@@ -54,15 +54,15 @@ }; TEST_F(CursorManagerTest, ShowHideCursor) { - cursor_manager_.SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, cursor_manager_.GetCursor().native_type()); + cursor_manager_.SetCursor(ui::CursorType::kCopy); + EXPECT_EQ(ui::CursorType::kCopy, cursor_manager_.GetCursor().native_type()); cursor_manager_.ShowCursor(); EXPECT_TRUE(cursor_manager_.IsCursorVisible()); cursor_manager_.HideCursor(); EXPECT_FALSE(cursor_manager_.IsCursorVisible()); // The current cursor does not change even when the cursor is not shown. - EXPECT_EQ(ui::kCursorCopy, cursor_manager_.GetCursor().native_type()); + EXPECT_EQ(ui::CursorType::kCopy, cursor_manager_.GetCursor().native_type()); // Check if cursor visibility is locked. cursor_manager_.LockCursor(); @@ -105,15 +105,15 @@ // Verifies that LockCursor/UnlockCursor work correctly with // EnableMouseEvents and DisableMouseEvents TEST_F(CursorManagerTest, EnableDisableMouseEvents) { - cursor_manager_.SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, cursor_manager_.GetCursor().native_type()); + cursor_manager_.SetCursor(ui::CursorType::kCopy); + EXPECT_EQ(ui::CursorType::kCopy, cursor_manager_.GetCursor().native_type()); cursor_manager_.EnableMouseEvents(); EXPECT_TRUE(cursor_manager_.IsMouseEventsEnabled()); cursor_manager_.DisableMouseEvents(); EXPECT_FALSE(cursor_manager_.IsMouseEventsEnabled()); // The current cursor does not change even when the cursor is not shown. - EXPECT_EQ(ui::kCursorCopy, cursor_manager_.GetCursor().native_type()); + EXPECT_EQ(ui::CursorType::kCopy, cursor_manager_.GetCursor().native_type()); // Check if cursor enable state is locked. cursor_manager_.LockCursor();