diff --git a/DEPS b/DEPS index c2f8dac..abdf99f 100644 --- a/DEPS +++ b/DEPS
@@ -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': '677b02eacd6fe0d32040649858b5248d7dc402da', + 'catapult_revision': '28f796f29c9e269f992fbb1550b0e384a227f602', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -354,7 +354,7 @@ }, 'ios': { 'src/ios/third_party/earl_grey/src': - Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '9fc7647d0cfcca132bbb96996c537002425be7d7', + Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '83e8379d838e4ee4777aa803ed8615965e1cd3e7', 'src/ios/third_party/fishhook/src': Var('chromium_git') + '/external/github.com/facebook/fishhook.git' + '@' + 'd172d5247aa590c25d0b1885448bae76036ea22c',
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 9339118..0205c0b 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc
@@ -364,12 +364,9 @@ void AwContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } void AwContentBrowserClient::AllowCertificateError(
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index c6596ad..f49028d 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h
@@ -78,7 +78,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; void AllowCertificateError( content::WebContents* web_contents, int cert_error,
diff --git a/ash/accelerators/accelerator_router.cc b/ash/accelerators/accelerator_router.cc index 20e67d7..ee5b11f22 100644 --- a/ash/accelerators/accelerator_router.cc +++ b/ash/accelerators/accelerator_router.cc
@@ -6,7 +6,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/wm/window_state.h" #include "base/metrics/histogram_macros.h" #include "base/stl_util.h"
diff --git a/ash/autoclick/autoclick_unittest.cc b/ash/autoclick/autoclick_unittest.cc index 2bd15b10..0a0352da 100644 --- a/ash/autoclick/autoclick_unittest.cc +++ b/ash/autoclick/autoclick_unittest.cc
@@ -5,7 +5,6 @@ #include "ash/autoclick/autoclick_controller.h" #include "ash/public/cpp/config.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window.h"
diff --git a/ash/frame/custom_frame_view_ash_unittest.cc b/ash/frame/custom_frame_view_ash_unittest.cc index 33b4c71..f5b8ed8 100644 --- a/ash/frame/custom_frame_view_ash_unittest.cc +++ b/ash/frame/custom_frame_view_ash_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/frame/caption_buttons/frame_caption_button.h" #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/wm/maximize_mode/maximize_mode_controller.h" #include "ui/aura/client/aura_constants.h"
diff --git a/ash/metrics/user_metrics_recorder_unittest.cc b/ash/metrics/user_metrics_recorder_unittest.cc index 1074339f4..6806eeb7 100644 --- a/ash/metrics/user_metrics_recorder_unittest.cc +++ b/ash/metrics/user_metrics_recorder_unittest.cc
@@ -11,7 +11,6 @@ #include "ash/public/cpp/shelf_model.h" #include "ash/session/session_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_session_controller_client.h" #include "ash/test/user_metrics_recorder_test_api.h"
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 7e1fd70..14f72f2 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/session/session_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_session_controller_client.h" #include "ash/wm/system_modal_container_layout_manager.h"
diff --git a/ash/rotator/screen_rotation_animator_unittest.cc b/ash/rotator/screen_rotation_animator_unittest.cc index 3b8519e..fa40249 100644 --- a/ash/rotator/screen_rotation_animator_unittest.cc +++ b/ash/rotator/screen_rotation_animator_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/rotator/screen_rotation_animator_observer.h" #include "ash/rotator/test/screen_rotation_animator_test_api.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/overview/overview_button_tray.h" #include "ash/system/status_area_widget.h" #include "ash/test/ash_test_base.h"
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index b1358ff..c18c2140 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -25,7 +25,6 @@ #include "ash/shelf/shelf_tooltip_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/web_notification/web_notification_tray.h" #include "ash/test/ash_test_base.h" #include "ash/test/ash_test_helper.h"
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index 98ff8ce0..0d05732a 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_view.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/status_area_widget.h" #include "ash/test/ash_test_base.h" #include "ash/test/ash_test_helper.h"
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc index a1f17e64..e315cbc2 100644 --- a/ash/shelf/shelf_window_watcher_unittest.cc +++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -12,7 +12,6 @@ #include "ash/root_window_controller.h" #include "ash/session/session_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/wm/window_resizer.h" #include "ash/wm/window_state.h"
diff --git a/ash/shell/content/client/shell_content_browser_client.cc b/ash/shell/content/client/shell_content_browser_client.cc index 7cb284d..c54591a 100644 --- a/ash/shell/content/client/shell_content_browser_client.cc +++ b/ash/shell/content/client/shell_content_browser_client.cc
@@ -9,7 +9,6 @@ #include "ash/shell/content/client/shell_browser_main_parts.h" #include "base/command_line.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "storage/browser/quota/quota_settings.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -31,12 +30,9 @@ void ShellContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } } // namespace examples
diff --git a/ash/shell/content/client/shell_content_browser_client.h b/ash/shell/content/client/shell_content_browser_client.h index c91183e3..73eb45b 100644 --- a/ash/shell/content/client/shell_content_browser_client.h +++ b/ash/shell/content/client/shell_content_browser_client.h
@@ -31,7 +31,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; private: ShellBrowserMainParts* shell_browser_main_parts_;
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index dad834e..6b7d87f4 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc
@@ -16,7 +16,6 @@ #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_session_controller_client.h"
diff --git a/ash/system/display_scale/tray_scale.cc b/ash/system/display_scale/tray_scale.cc index 6ec7ce38..513e861 100644 --- a/ash/system/display_scale/tray_scale.cc +++ b/ash/system/display_scale/tray_scale.cc
@@ -7,7 +7,6 @@ #include "ash/ash_switches.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/root_window_controller.h" -#include "ash/shell_port.h" #include "ash/system/display_scale/scale_detailed_view.h" #include "ash/system/display_scale/scale_view.h" #include "ash/system/tray/system_tray.h"
diff --git a/ash/system/power/power_event_observer.cc b/ash/system/power/power_event_observer.cc index 9a773a6..8265952 100644 --- a/ash/system/power/power_event_observer.cc +++ b/ash/system/power/power_event_observer.cc
@@ -7,7 +7,6 @@ #include "ash/public/cpp/config.h" #include "ash/session/session_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/wm/power_button_controller.h" #include "chromeos/dbus/dbus_thread_manager.h"
diff --git a/ash/system/power/tablet_power_button_controller_unittest.cc b/ash/system/power/tablet_power_button_controller_unittest.cc index f5c1bc8..526c9349 100644 --- a/ash/system/power/tablet_power_button_controller_unittest.cc +++ b/ash/system/power/tablet_power_button_controller_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/public/cpp/config.h" #include "ash/session/session_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/lock_state_controller_test_api.h" #include "ash/test/test_session_controller_client.h"
diff --git a/ash/system/rotation/tray_rotation_lock.cc b/ash/system/rotation/tray_rotation_lock.cc index eab1074..b2c8a21 100644 --- a/ash/system/rotation/tray_rotation_lock.cc +++ b/ash/system/rotation/tray_rotation_lock.cc
@@ -7,7 +7,6 @@ #include "ash/display/screen_orientation_controller_chromeos.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/actionable_view.h" #include "ash/system/tray/system_tray.h"
diff --git a/ash/system/tray/system_tray_controller.cc b/ash/system/tray/system_tray_controller.cc index a3232bdb..9e8bc854 100644 --- a/ash/system/tray/system_tray_controller.cc +++ b/ash/system/tray/system_tray_controller.cc
@@ -6,7 +6,6 @@ #include "ash/root_window_controller.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/system/update/tray_update.h"
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index a1e8761..462e260 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc
@@ -7,7 +7,6 @@ #include "ash/session/session_controller.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/tray_constants.h"
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc index 82bdfe9..5e19bd8b 100644 --- a/ash/wm/default_state.cc +++ b/ash/wm/default_state.cc
@@ -8,7 +8,6 @@ #include "ash/root_window_controller.h" #include "ash/screen_util.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/wm/screen_pinning_controller.h" #include "ash/wm/window_animation_types.h" #include "ash/wm/window_parenting_utils.h"
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc index 4e611d7..5ee031d2 100644 --- a/ash/wm/mru_window_tracker.cc +++ b/ash/wm/mru_window_tracker.cc
@@ -8,7 +8,6 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/wm/focus_rules.h" #include "ash/wm/switchable_windows.h" #include "ash/wm/window_state.h"
diff --git a/ash/wm/native_cursor_manager_ash_mus.cc b/ash/wm/native_cursor_manager_ash_mus.cc index 279ae7e..b8ea0ea 100644 --- a/ash/wm/native_cursor_manager_ash_mus.cc +++ b/ash/wm/native_cursor_manager_ash_mus.cc
@@ -44,6 +44,11 @@ // event targeting issue. ShellPort::Get()->SetGlobalOverrideCursor(mojo_cursor); + // Make sure the local state is set properly, so that local queries show that + // we set the cursor. + for (aura::Window* root : Shell::Get()->GetAllRootWindows()) + root->GetHost()->SetCursor(cursor); + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller()
diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc index 23a7962..98939530 100644 --- a/ash/wm/panels/panel_window_resizer_unittest.cc +++ b/ash/wm/panels/panel_window_resizer_unittest.cc
@@ -13,7 +13,6 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/cursor_manager_test_api.h" #include "ash/test/shelf_view_test_api.h"
diff --git a/ash/wm/window_positioner_unittest.cc b/ash/wm/window_positioner_unittest.cc index d19f86ab..fd951b9 100644 --- a/ash/wm/window_positioner_unittest.cc +++ b/ash/wm/window_positioner_unittest.cc
@@ -9,7 +9,6 @@ #include "ash/scoped_root_window_for_new_windows.h" #include "ash/shell.h" #include "ash/shell/toplevel_window.h" -#include "ash/shell_port.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_shell_delegate.h" #include "ash/wm/window_positioner.h"
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index d9c70b42..d6392d1 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1075,7 +1075,6 @@ # TODO(hans): Make this list shorter eventually, http://crbug.com/504657 "-Wno-unknown-pragmas", # http://crbug.com/505314 "-Wno-microsoft-cast", # http://crbug.com/550065 - "-Wno-microsoft-enum-forward-reference", # http://crbug.com/718880 ] } } else {
diff --git a/chrome/VERSION b/chrome/VERSION index a02231d7..02cf3d71 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=61 MINOR=0 -BUILD=3140 +BUILD=3141 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java index 9225b049..da51d97 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
@@ -214,7 +214,9 @@ } @Override - public void onBottomControlsHeightChanged(int bottomControlsHeight) { } + public void onBottomControlsHeightChanged(int bottomControlsHeight) { + getBottomBarView().setTranslationY(mFullscreenManager.getBottomControlOffset()); + } @Override public void onContentOffsetChanged(float offset) { }
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc index d60e013b..169d341 100644 --- a/chrome/browser/banners/app_banner_manager.cc +++ b/chrome/browser/banners/app_banner_manager.cc
@@ -37,13 +37,6 @@ return InstallableParams(); } -// Returns whether or not the URLs match for everything except for the ref. -bool URLsAreForTheSamePage(const GURL& first, const GURL& second) { - return first.GetWithEmptyPath() == second.GetWithEmptyPath() && - first.path_piece() == second.path_piece() && - first.query_piece() == second.query_piece(); -} - } // anonymous namespace namespace banners { @@ -68,13 +61,11 @@ bool is_debug_mode) { content::WebContents* contents = web_contents(); - // Don't start a redundant banner request. Otherwise, if one is running, - // invalidate our weak pointers so it terminates. - if (is_active()) { - if (URLsAreForTheSamePage(validated_url, contents->GetLastCommittedURL())) - return; - else - weak_factory_.InvalidateWeakPtrs(); + // The only time we should start the pipeline while it is already running is + // if it's been triggered from devtools. + if (is_active_or_pending()) { + DCHECK(is_debug_mode); + weak_factory_.InvalidateWeakPtrs(); } UpdateState(State::ACTIVE); @@ -211,10 +202,8 @@ if (data.error_code != NO_ERROR_DETECTED) { ReportStatus(web_contents(), data.error_code); Stop(); - } - - if (!is_active()) return; + } DCHECK(!data.manifest_url.is_empty()); DCHECK(!data.manifest.IsEmpty()); @@ -268,10 +257,8 @@ ReportStatus(web_contents(), data.error_code); Stop(); - } - - if (!is_active()) return; + } DCHECK(data.is_installable); DCHECK(!data.primary_icon_url.is_empty()); @@ -428,14 +415,20 @@ // If the bypass flag is on, or if we require no engagement to trigger the // banner, the rest of the banner pipeline should operate as if the engagement // threshold has been met. - if (AppBannerSettingsHelper::HasSufficientEngagement(0)) + // Additionally, if the page already has enough engagement, trigger the + // pipeline immediately. + if (AppBannerSettingsHelper::HasSufficientEngagement(0) || + AppBannerSettingsHelper::HasSufficientEngagement( + GetSiteEngagementService()->GetScore(validated_url))) { has_sufficient_engagement_ = true; + } // Start the pipeline immediately if we pass (or bypass) the engagement check, // or if the feature to run the installability check on page load is enabled. - if (has_sufficient_engagement_ || - base::FeatureList::IsEnabled( - features::kCheckInstallabilityForBannerOnLoad)) { + if (!is_active_or_pending() && + (has_sufficient_engagement_ || + base::FeatureList::IsEnabled( + features::kCheckInstallabilityForBannerOnLoad))) { RequestAppBanner(validated_url, false /* is_debug_mode */); } } @@ -478,9 +471,10 @@ // directly to sending the banner prompt request. UpdateState(State::ACTIVE); SendBannerPromptRequest(); - } else if (load_finished_) { + } else if (load_finished_ && !is_active_or_pending()) { // This performs some simple tests and starts async checks to test // installability. It should be safe to start in response to user input. + // Don't call if we're already working on processing a banner request. RequestAppBanner(url, false /* is_debug_mode */); } }
diff --git a/chrome/browser/banners/app_banner_manager_browsertest.cc b/chrome/browser/banners/app_banner_manager_browsertest.cc index 61565d6..7fbb4d0 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest.cc +++ b/chrome/browser/banners/app_banner_manager_browsertest.cc
@@ -54,7 +54,9 @@ void clear_will_show() { will_show_.reset(); } - bool is_active() { return AppBannerManager::is_active(); } + bool is_active_or_pending() { + return AppBannerManager::is_active_or_pending(); + } bool is_complete() { return AppBannerManager::is_complete(); } @@ -153,7 +155,7 @@ bool expected_to_show) { RunBannerTest(browser, manager, url, engagement_scores, expected_code_for_histogram, expected_to_show, - base::string16()); + base::string16(), ui::PAGE_TRANSITION_TYPED); } void RunBannerTest(Browser* browser, @@ -162,7 +164,8 @@ const std::vector<double>& engagement_scores, InstallableStatusCode expected_code_for_histogram, bool expected_to_show, - const base::string16 expected_tab_title) { + const base::string16 expected_tab_title, + ui::PageTransition transition) { base::HistogramTester histograms; GURL test_url = embedded_test_server()->GetURL(url); @@ -179,7 +182,7 @@ ui_test_utils::NavigateToURL(browser, test_url); EXPECT_FALSE(manager->will_show()); - EXPECT_FALSE(manager->is_active()); + EXPECT_FALSE(manager->is_active_or_pending()); histograms.ExpectTotalCount(banners::kMinutesHistogram, 0); histograms.ExpectTotalCount(banners::kInstallableStatusCodeHistogram, @@ -195,11 +198,12 @@ base::RunLoop run_loop; manager->clear_will_show(); manager->Prepare(run_loop.QuitClosure()); - ui_test_utils::NavigateToURL(browser, test_url); + chrome::NavigateParams nav_params(browser, test_url, transition); + ui_test_utils::NavigateToURL(&nav_params); run_loop.Run(); EXPECT_EQ(expected_to_show, manager->will_show()); - EXPECT_FALSE(manager->is_active()); + EXPECT_FALSE(manager->is_active_or_pending()); // Check the tab title; this allows the test page to send data back out to // be inspected by the test case. @@ -238,7 +242,8 @@ CreateAppBannerManager(browser())); std::vector<double> engagement_scores{10}; RunBannerTest(browser(), manager.get(), "/banners/manifest_test_page.html", - engagement_scores, SHOWING_WEB_APP_BANNER, true); + engagement_scores, SHOWING_WEB_APP_BANNER, true, + base::string16(), ui::PAGE_TRANSITION_LINK); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, @@ -328,7 +333,8 @@ RunBannerTest(browser(), manager.get(), "/banners/beforeinstallprompt_test_page.html", engagement_scores, SHOWING_WEB_APP_BANNER, true, - base::ASCIIToUTF16("Got beforeinstallprompt: listener, attr")); + base::ASCIIToUTF16("Got beforeinstallprompt: listener, attr"), + ui::PAGE_TRANSITION_TYPED); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, CancelBannerDirect) { @@ -460,7 +466,6 @@ } EXPECT_FALSE(manager->will_show()); - EXPECT_FALSE(manager->is_active()); EXPECT_TRUE(manager->is_pending_engagement()); EXPECT_TRUE(manager->need_to_log_status()); @@ -477,7 +482,7 @@ } EXPECT_TRUE(manager->will_show()); - EXPECT_FALSE(manager->is_active()); + EXPECT_FALSE(manager->is_active_or_pending()); EXPECT_FALSE(manager->need_to_log_status()); EXPECT_TRUE(manager->is_complete()); @@ -508,7 +513,6 @@ } EXPECT_FALSE(manager->will_show()); - EXPECT_FALSE(manager->is_active()); EXPECT_TRUE(manager->is_pending_engagement()); EXPECT_TRUE(manager->need_to_log_status()); @@ -522,7 +526,7 @@ } EXPECT_FALSE(manager->will_show()); - EXPECT_FALSE(manager->is_active()); + EXPECT_FALSE(manager->is_active_or_pending()); EXPECT_FALSE(manager->need_to_log_status()); histograms.ExpectTotalCount(banners::kMinutesHistogram, 0);
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 4282bfe..1c680d2 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2177,17 +2177,14 @@ void ChromeContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { + storage::OptionalQuotaSettingsCallback callback) { if (g_default_quota_settings) { // For debugging tests harness can inject settings. - callback.Run(*g_default_quota_settings); + std::move(callback).Run(*g_default_quota_settings); return; } - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } void ChromeContentBrowserClient::AllowCertificateError(
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 045c17c..a91a3b0a 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -180,7 +180,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; void AllowCertificateError( content::WebContents* web_contents,
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index 97eb2c7c..470bb385 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc
@@ -9,7 +9,6 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/system/tray/system_tray.h" #include "ash/wallpaper/wallpaper_delegate.h" #include "base/bind.h"
diff --git a/chrome/browser/chromeos/policy/power_policy_browsertest.cc b/chrome/browser/chromeos/policy/power_policy_browsertest.cc index 32024d3..5726d26 100644 --- a/chrome/browser/chromeos/policy/power_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/power_policy_browsertest.cc
@@ -491,7 +491,11 @@ const char kExtensionId[] = "abcdefghijklmnopabcdefghijlkmnop"; extensions::PowerAPI::Get(browser()->profile()) ->AddRequest(kExtensionId, extensions::api::power::LEVEL_DISPLAY); - base::RunLoop().RunUntilIdle(); + + // The PowerAPI requests system wake lock asynchronously. + base::RunLoop run_loop; + power_manager_client_->SetPowerPolicyQuitClosure(run_loop.QuitClosure()); + run_loop.Run(); // Check that the lock is in effect (ignoring ac_idle_action, // battery_idle_action and reason).
diff --git a/chrome/browser/devtools/devtools_file_system_indexer.cc b/chrome/browser/devtools/devtools_file_system_indexer.cc index b538fe1..87891f9 100644 --- a/chrome/browser/devtools/devtools_file_system_indexer.cc +++ b/chrome/browser/devtools/devtools_file_system_indexer.cc
@@ -16,9 +16,13 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/macros.h" +#include "base/sequence_checker.h" #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/lazy_task_runner.h" +#include "base/task_scheduler/post_task.h" + #include "content/public/browser/browser_thread.h" using base::Bind; @@ -36,6 +40,14 @@ namespace { +base::SequencedTaskRunner* impl_task_runner() { + constexpr base::TaskTraits kBlockingTraits = {base::MayBlock(), + base::TaskPriority::BACKGROUND}; + base::LazySequencedTaskRunner g_sequenced_task_task_runner = + LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER(kBlockingTraits); + return g_sequenced_task_task_runner.Get().get(); +} + typedef int32_t Trigram; typedef char TrigramChar; typedef uint16_t FileId; @@ -62,7 +74,7 @@ void SetTrigramsForFile(const FilePath& file_path, const vector<Trigram>& index, const Time& time); - vector<FilePath> Search(string query); + vector<FilePath> Search(const string& query); void NormalizeVectors(); private: @@ -76,6 +88,7 @@ typedef map<FilePath, Time> IndexedFilesMap; IndexedFilesMap index_times_; vector<bool> is_normalized_; + SEQUENCE_CHECKER(sequence_checker_); DISALLOW_COPY_AND_ASSIGN(Index); }; @@ -140,7 +153,7 @@ } Time Index::LastModifiedTimeForFile(const FilePath& file_path) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); Time last_modified_time; if (index_times_.find(file_path) != index_times_.end()) last_modified_time = index_times_[file_path]; @@ -150,7 +163,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path, const vector<Trigram>& index, const Time& time) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); FileId file_id = GetFileId(file_path); vector<Trigram>::const_iterator it = index.begin(); for (; it != index.end(); ++it) { @@ -161,8 +174,8 @@ index_times_[file_path] = time; } -vector<FilePath> Index::Search(string query) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); +vector<FilePath> Index::Search(const string& query) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); const char* data = query.c_str(); vector<TrigramChar> trigram_chars; trigram_chars.reserve(query.size()); @@ -206,7 +219,7 @@ } FileId Index::GetFileId(const FilePath& file_path) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); string file_path_str = file_path.AsUTF8Unsafe(); if (file_ids_.find(file_path) != file_ids_.end()) return file_ids_[file_path]; @@ -215,7 +228,7 @@ } void Index::NormalizeVectors() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (size_t i = 0; i < kTrigramCount; ++i) { if (!is_normalized_[i]) { std::sort(index_[i].begin(), index_[i].end()); @@ -239,8 +252,7 @@ total_work_callback_(total_work_callback), worked_callback_(worked_callback), done_callback_(done_callback), - current_file_( - BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()), + current_file_(impl_task_runner()), files_indexed_(0), stopped_(false) { current_trigrams_set_.resize(kTrigramCount); @@ -251,24 +263,22 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&FileSystemIndexingJob::CollectFilesToIndex, this)); + impl_task_runner()->PostTask( + FROM_HERE, BindOnce(&FileSystemIndexingJob::CollectFilesToIndex, this)); } void DevToolsFileSystemIndexer::FileSystemIndexingJob::Stop() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&FileSystemIndexingJob::StopOnFileThread, this)); + impl_task_runner()->PostTask( + FROM_HERE, BindOnce(&FileSystemIndexingJob::StopOnImplSequence, this)); } -void DevToolsFileSystemIndexer::FileSystemIndexingJob::StopOnFileThread() { +void DevToolsFileSystemIndexer::FileSystemIndexingJob::StopOnImplSequence() { stopped_ = true; } void DevToolsFileSystemIndexer::FileSystemIndexingJob::CollectFilesToIndex() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK(impl_task_runner()->RunsTasksInCurrentSequence()); if (stopped_) return; if (!file_enumerator_) { @@ -291,13 +301,12 @@ if (current_last_modified_time > saved_last_modified_time) { file_path_times_[file_path] = current_last_modified_time; } - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&FileSystemIndexingJob::CollectFilesToIndex, this)); + impl_task_runner()->PostTask( + FROM_HERE, BindOnce(&FileSystemIndexingJob::CollectFilesToIndex, this)); } void DevToolsFileSystemIndexer::FileSystemIndexingJob::IndexFiles() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK(impl_task_runner()->RunsTasksInCurrentSequence()); if (stopped_) return; if (indexing_it_ == file_path_times_.end()) { @@ -373,7 +382,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::FinishFileIndexing( bool success) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK(impl_task_runner()->RunsTasksInCurrentSequence()); CloseFile(); if (success) { FilePath file_path = indexing_it_->first; @@ -387,12 +396,9 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::CloseFile() { if (current_file_.IsValid()) - current_file_.Close(Bind(&FileSystemIndexingJob::CloseCallback, this)); + current_file_.Close(base::FileProxy::StatusCallback()); } -void DevToolsFileSystemIndexer::FileSystemIndexingJob::CloseCallback( - base::File::Error error) {} - void DevToolsFileSystemIndexer::FileSystemIndexingJob::ReportWorked() { TimeTicks current_time = TimeTicks::Now(); bool should_send_worked_nitification = true; @@ -410,8 +416,7 @@ } } -DevToolsFileSystemIndexer::DevToolsFileSystemIndexer() { -} +DevToolsFileSystemIndexer::DevToolsFileSystemIndexer() {} DevToolsFileSystemIndexer::~DevToolsFileSystemIndexer() {} @@ -431,21 +436,22 @@ return indexing_job; } -void DevToolsFileSystemIndexer::SearchInPath(const string& file_system_path, - const string& query, - const SearchCallback& callback) { +void DevToolsFileSystemIndexer::SearchInPath( + const std::string& file_system_path, + const std::string& query, + const SearchCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&DevToolsFileSystemIndexer::SearchInPathOnFileThread, this, + impl_task_runner()->PostTask( + FROM_HERE, + BindOnce(&DevToolsFileSystemIndexer::SearchInPathOnImplSequence, this, file_system_path, query, callback)); } -void DevToolsFileSystemIndexer::SearchInPathOnFileThread( - const string& file_system_path, - const string& query, +void DevToolsFileSystemIndexer::SearchInPathOnImplSequence( + const std::string& file_system_path, + const std::string& query, const SearchCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK(impl_task_runner()->RunsTasksInCurrentSequence()); vector<FilePath> file_paths = g_trigram_index.Get().Search(query); vector<string> result; FilePath path = FilePath::FromUTF8Unsafe(file_system_path); @@ -455,5 +461,5 @@ result.push_back(it->AsUTF8Unsafe()); } BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - BindOnce(callback, result)); + BindOnce(callback, std::move(result))); }
diff --git a/chrome/browser/devtools/devtools_file_system_indexer.h b/chrome/browser/devtools/devtools_file_system_indexer.h index c747467..0d88ac69 100644 --- a/chrome/browser/devtools/devtools_file_system_indexer.h +++ b/chrome/browser/devtools/devtools_file_system_indexer.h
@@ -46,7 +46,7 @@ virtual ~FileSystemIndexingJob(); void Start(); - void StopOnFileThread(); + void StopOnImplSequence(); void CollectFilesToIndex(); void IndexFiles(); void StartFileIndexing(base::File::Error error); @@ -56,7 +56,6 @@ int bytes_read); void FinishFileIndexing(bool success); void CloseFile(); - void CloseCallback(base::File::Error error); void ReportWorked(); base::FilePath file_system_path_; @@ -98,9 +97,9 @@ virtual ~DevToolsFileSystemIndexer(); - void SearchInPathOnFileThread(const std::string& file_system_path, - const std::string& query, - const SearchCallback& callback); + void SearchInPathOnImplSequence(const std::string& file_system_path, + const std::string& query, + const SearchCallback& callback); DISALLOW_COPY_AND_ASSIGN(DevToolsFileSystemIndexer); };
diff --git a/chrome/browser/resource_coordinator/DEPS b/chrome/browser/resource_coordinator/DEPS index 0fecc23..537cfa8 100644 --- a/chrome/browser/resource_coordinator/DEPS +++ b/chrome/browser/resource_coordinator/DEPS
@@ -2,6 +2,5 @@ # TODO(mash): Remove. http://crbug.com/723881 "+ash/multi_profile_uma.h", "+ash/shell.h", - "+ash/shell_port.h", "+services/resource_coordinator/public", ]
diff --git a/chrome/browser/resource_coordinator/tab_manager.cc b/chrome/browser/resource_coordinator/tab_manager.cc index f08d3ddc..85c08294 100644 --- a/chrome/browser/resource_coordinator/tab_manager.cc +++ b/chrome/browser/resource_coordinator/tab_manager.cc
@@ -56,7 +56,7 @@ #if defined(OS_CHROMEOS) #include "ash/multi_profile_uma.h" -#include "ash/shell_port.h" +#include "ash/shell.h" #include "chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.h" #include "components/user_manager/user_manager.h" #endif @@ -527,7 +527,7 @@ #if defined(OS_CHROMEOS) // Record the discarded tab in relation to the amount of simultaneously // logged in users. - if (ash::ShellPort::HasInstance()) { + if (ash::Shell::HasInstance()) { ash::MultiProfileUMA::RecordDiscardedTab( user_manager::UserManager::Get()->GetLoggedInUsers().size()); }
diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.html b/chrome/browser/resources/settings/internet_page/internet_detail_page.html index f6fc57f..2e30ea9 100644 --- a/chrome/browser/resources/settings/internet_page/internet_detail_page.html +++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.html
@@ -49,14 +49,6 @@ -webkit-margin-start: var(--settings-controlled-by-spacing); } - .indented { - -webkit-margin-start: var(--settings-box-row-padding); - } - - .settings-box.stretch { - align-items: stretch; - } - .settings-box:first-of-type { border-top: none; } @@ -132,77 +124,74 @@ </div> </div> </template> + <template is="dom-if" if="[[!isSecondaryUser_]]"> - <!-- Top level properties --> - <div class="layout vertical"> - <!-- Prefer this network. --> - <template is="dom-if" if="[[showPreferNetwork_(networkProperties)]]"> - <div class="settings-box"> - <div id="preferNetworkToggleLabel"class="start"> - $i18n{networkPrefer} - </div> - <cr-policy-network-indicator - property="[[networkProperties.Priority]]"> - </cr-policy-network-indicator> - <paper-toggle-button checked="{{preferNetwork_}}" - disabled="[[isNetworkPolicyEnforced( - networkProperties.Priority)]]" - aria-labelledby="preferNetworkToggleLabel"> - </paper-toggle-button> + <!-- Prefer this network. --> + <template is="dom-if" if="[[showPreferNetwork_(networkProperties)]]"> + <div class="settings-box"> + <div id="preferNetworkToggleLabel"class="start"> + $i18n{networkPrefer} </div> - </template> - <!-- Autoconnect. --> - <template is="dom-if" if="[[showAutoConnect_(networkProperties)]]"> - <div class="settings-box"> - <div id="autoConnectToggleLabel" class="start"> - $i18n{networkAutoConnect} - </div> - <cr-policy-network-indicator - property="[[getManagedAutoConnect_(networkProperties)]]"> - </cr-policy-network-indicator> - <paper-toggle-button checked="{{autoConnect_}}" - disabled="[[!enableAutoConnect_(networkProperties, - globalPolicy)]]" - aria-labelledby="autoConnectToggleLabel"> - </paper-toggle-button> + <cr-policy-network-indicator + property="[[networkProperties.Priority]]"> + </cr-policy-network-indicator> + <paper-toggle-button checked="{{preferNetwork_}}" + disabled="[[isNetworkPolicyEnforced(networkProperties.Priority)]]" + aria-labelledby="preferNetworkToggleLabel"> + </paper-toggle-button> + </div> + </template> + <!-- Autoconnect. --> + <template is="dom-if" if="[[showAutoConnect_(networkProperties)]]"> + <div class="settings-box"> + <div id="autoConnectToggleLabel" class="start"> + $i18n{networkAutoConnect} </div> - </template> - <!-- Data roaming (Cellular only). --> - <template is="dom-if" if="[[isCellular_(networkProperties)]]"> - <div class="settings-box"> - <settings-toggle-button id="allowDataRoaming" class="start" - pref="{{prefs.cros.signed.data_roaming_enabled}}" - label="$i18n{networkAllowDataRoaming}"> - </settings-toggle-button> - </div> - </template> - <!-- SIM Info (Cellular only). --> - <template is="dom-if" if="[[showCellularSim_(networkProperties)]]"> - <div class="settings-box single-column stretch"> - <network-siminfo - editable on-siminfo-change="onNetworkPropertyChange_" - network-properties="[[networkProperties]]" - networking-private="[[networkingPrivate]]"> - </network-siminfo> - </div> - </template> - <!-- IP Address. --> - <template is="dom-if" if="[[IPAddress_]]"> - <div class="settings-box two-line single-column stretch"> - <div>$i18n{networkIPAddress}</div> - <div class="secondary">[[IPAddress_]]</div> - </div> - </template> - <!-- Properties to always show if present. --> - <template is="dom-if" if="[[hasInfoFields_(networkProperties)]]"> - <div class="settings-box single-column stretch"> - <network-property-list - fields="[[getInfoFields_(networkProperties)]]" - property-dict="[[networkProperties]]"> - </network-property-list> - </div> - </template> - </div> + <cr-policy-network-indicator + property="[[getManagedAutoConnect_(networkProperties)]]"> + </cr-policy-network-indicator> + <paper-toggle-button checked="{{autoConnect_}}" + disabled="[[!enableAutoConnect_(networkProperties, + globalPolicy)]]" + aria-labelledby="autoConnectToggleLabel"> + </paper-toggle-button> + </div> + </template> + <!-- Data roaming (Cellular only). --> + <template is="dom-if" if="[[isCellular_(networkProperties)]]"> + <div class="settings-box"> + <settings-toggle-button id="allowDataRoaming" class="start" + pref="{{prefs.cros.signed.data_roaming_enabled}}" + label="$i18n{networkAllowDataRoaming}"> + </settings-toggle-button> + </div> + </template> + <!-- SIM Info (Cellular only). --> + <template is="dom-if" if="[[showCellularSim_(networkProperties)]]"> + <div class="settings-box single-column stretch"> + <network-siminfo + editable on-siminfo-change="onNetworkPropertyChange_" + network-properties="[[networkProperties]]" + networking-private="[[networkingPrivate]]"> + </network-siminfo> + </div> + </template> + <!-- IP Address. --> + <template is="dom-if" if="[[IPAddress_]]"> + <div class="settings-box two-line single-column stretch"> + <div>$i18n{networkIPAddress}</div> + <div class="secondary">[[IPAddress_]]</div> + </div> + </template> + <!-- Properties to always show if present. --> + <template is="dom-if" if="[[hasInfoFields_(networkProperties)]]"> + <div class="settings-box single-column stretch"> + <network-property-list + fields="[[getInfoFields_(networkProperties)]]" + property-dict="[[networkProperties]]"> + </network-property-list> + </div> + </template> <template is="dom-if" if="[[showAdvanced_(networkProperties)]]"> <!-- Advanced toggle. --> @@ -215,22 +204,20 @@ <!-- Advanced section --> <iron-collapse opened="[[advancedExpanded_]]"> - <div class="layout vertical indented"> - <div class="settings-box single-column stretch" - hidden$="[[!hasAdvancedOrDeviceFields_(networkProperties)]]"> - <!-- Advanced properties --> - <network-property-list - hidden$="[[!hasAdvancedFields_(networkProperties)]]" - fields="[[getAdvancedFields_(networkProperties)]]" - property-dict="[[networkProperties]]"> - </network-property-list> - <!-- Device properties --> - <network-property-list - hidden$="[[!hasDeviceFields_(networkProperties)]]" - fields="[[getDeviceFields_(networkProperties)]]" - property-dict="[[networkProperties]]"> - </network-property-list> - </div> + <div class="settings-box single-column stretch indented" + hidden$="[[!hasAdvancedOrDeviceFields_(networkProperties)]]"> + <!-- Advanced properties --> + <network-property-list + hidden$="[[!hasAdvancedFields_(networkProperties)]]" + fields="[[getAdvancedFields_(networkProperties)]]" + property-dict="[[networkProperties]]"> + </network-property-list> + <!-- Device properties --> + <network-property-list + hidden$="[[!hasDeviceFields_(networkProperties)]]" + fields="[[getDeviceFields_(networkProperties)]]" + property-dict="[[networkProperties]]"> + </network-property-list> </div> </iron-collapse> </template> @@ -245,7 +232,7 @@ </div> <iron-collapse opened="[[networkExpanded_]]"> - <div class="layout vertical indented"> + <div class="settings-box single-column stretch"> <!-- APN --> <template is="dom-if" if="[[isCellular_(networkProperties)]]"> <network-apnlist editable on-apn-change="onNetworkPropertyChange_" @@ -276,7 +263,7 @@ </div> <iron-collapse opened="[[proxyExpanded_]]"> - <div class="layout vertical indented"> + <div class="settings-box single-column stretch"> <network-proxy editable prefs="{{prefs}}" on-proxy-change="onProxyChange_" network-properties="[[networkProperties]]">
diff --git a/chrome/browser/resources/settings/internet_page/internet_shared_css.html b/chrome/browser/resources/settings/internet_page/internet_shared_css.html index b1254a3..f4581f0 100644 --- a/chrome/browser/resources/settings/internet_page/internet_shared_css.html +++ b/chrome/browser/resources/settings/internet_page/internet_shared_css.html
@@ -34,6 +34,14 @@ -webkit-margin-start: calc(12px + 8px); } + .settings-box.indented { + -webkit-margin-start: var(--settings-box-row-padding); + } + + .settings-box.stretch { + align-items: stretch; + } + .title { font-size: 107.69%; /* 14px / 13px */ font-weight: 500;
diff --git a/chrome/browser/resources/settings/internet_page/network_ip_config.html b/chrome/browser/resources/settings/internet_page/network_ip_config.html index 520a7289..18cf1ff 100644 --- a/chrome/browser/resources/settings/internet_page/network_ip_config.html +++ b/chrome/browser/resources/settings/internet_page/network_ip_config.html
@@ -14,8 +14,8 @@ aria-labelledby="autoIPConfigLabel"> </paper-toggle-button> </div> - <div class="settings-box continuation" - hidden$="[[!showIPEditFields_(editable, automatic_)]]"> + <div class="settings-box single-column continuation indented stretch" + hidden$="[[!networkProperties.IPConfigs]]"> <network-property-list fields="[[ipConfigFields_]]" property-dict="[[ipConfig_]]" edit-field-types="[[getIPEditFields_(editable, automatic_)]]"
diff --git a/chrome/browser/resources/settings/internet_page/network_ip_config.js b/chrome/browser/resources/settings/internet_page/network_ip_config.js index da9aefaf..d84e8ea4 100644 --- a/chrome/browser/resources/settings/internet_page/network_ip_config.js +++ b/chrome/browser/resources/settings/internet_page/network_ip_config.js
@@ -162,14 +162,6 @@ }, /** - * @return {boolean} - * @private - */ - showIPEditFields_: function() { - return this.editable && !this.automatic_; - }, - - /** * @return {Object} An object with the edit type for each editable field. * @private */
diff --git a/chrome/browser/resources/settings/internet_page/network_nameservers.html b/chrome/browser/resources/settings/internet_page/network_nameservers.html index 9d1c492..a7178a8 100644 --- a/chrome/browser/resources/settings/internet_page/network_nameservers.html +++ b/chrome/browser/resources/settings/internet_page/network_nameservers.html
@@ -28,7 +28,7 @@ </div> </div> - <div class="settings-box continuation single-column" + <div class="settings-box continuation single-column indented" hidden$="[[!nameservers_.length]]"> <template is="dom-repeat" items="[[nameservers_]]"> <paper-input-container no-label-float>
diff --git a/chrome/browser/resources/settings/internet_page/network_proxy.html b/chrome/browser/resources/settings/internet_page/network_proxy.html index f0586e4..d9568a7 100644 --- a/chrome/browser/resources/settings/internet_page/network_proxy.html +++ b/chrome/browser/resources/settings/internet_page/network_proxy.html
@@ -44,6 +44,10 @@ margin: 10px 0; } + .settings-box:first-of-type { + border-top: none; + } + #manualProxy { @apply(--settings-list-frame-padding); }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 8db0a9e..f68de58 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -12,7 +12,6 @@ #include "ash/resources/grit/ash_resources.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/system_tray_delegate.h" #include "base/memory/ptr_util.h"
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 863ba2c..7c570fd 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -16,7 +16,6 @@ #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/test/shelf_view_test_api.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h"
diff --git a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc index 606071ef..ee39a321 100644 --- a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc
@@ -9,7 +9,6 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shell_port.h" #include "ash/wallpaper/wallpaper_delegate.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/window_positioner.h"
diff --git a/chrome/common/extensions/api/idltest.idl b/chrome/common/extensions/api/idltest.idl index 4bb0ab5e0a..03b21d4b 100644 --- a/chrome/common/extensions/api/idltest.idl +++ b/chrome/common/extensions/api/idltest.idl
@@ -17,8 +17,9 @@ // I think because ArrayBufferView isn't an instantiable type. The best // we might be able to do is have a 'choices' list including all the // typed array subclasses like Uint8Array, Uint16Array, Float32Array, etc. - static void sendArrayBufferView([instanceOf=Uint8Array] object input, - LongArrayCallback cb); + static void sendArrayBufferView( + [instanceOf=Uint8Array] ArrayBufferView input, + LongArrayCallback cb); static void getArrayBuffer(ArrayBufferCallback cb); // This function should not have C++ code autogenerated (the variable name
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index 9fe372d..a3d1a8f 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -1368,6 +1368,21 @@ else: self.fail('unexpected cookie: %s' % json.dumps(cookie)) + def testCookiePath(self): + self._driver.Load(self.GetHttpUrlForFile( + '/chromedriver/long_url/empty.html')) + self._driver.AddCookie({'name': 'a', 'value': 'b'}) + self._driver.AddCookie({ + 'name': 'x', 'value': 'y', 'path': '/chromedriver/long_url'}) + cookies = self._driver.GetCookies() + self.assertEquals(2, len(cookies)) + for cookie in cookies: + self.assertIn('path', cookie) + if cookie['name'] == 'a': + self.assertEquals('/' , cookie['path']) + if cookie['name'] == 'x': + self.assertEquals('/chromedriver/long_url' , cookie['path']) + def testGetUrlOnInvalidUrl(self): # Make sure we don't return 'data:text/html,chromewebdata' (see # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1272). RFC 6761
diff --git a/chrome/test/chromedriver/test/test_expectations b/chrome/test/chromedriver/test/test_expectations index 9b6a856..e73db7a 100644 --- a/chrome/test/chromedriver/test/test_expectations +++ b/chrome/test/chromedriver/test/test_expectations
@@ -117,6 +117,24 @@ 'WindowSwitchingTest.testCanCallGetWindowHandlesAfterClosingAWindow', 'BasicKeyboardInterfaceTest.testBasicKeyboardInput', 'CombinedInputActionsTest.testChordControlCutAndPaste', + 'CorrectEventFiringTest.testShouldFireMouseOverEventWhenClicking', + 'CorrectEventFiringTest.testSendingKeysToAFocusedElementShouldNotBlurThatElement', + 'CorrectEventFiringTest.testShouldFireTwoClickEventsWhenClickingOnALabel', + 'CorrectEventFiringTest.testShouldIssueClickEvents', + 'CorrectEventFiringTest.testShouldFireMouseMoveEventWhenClicking', + 'JavascriptEnabledDriverTest.testShouldBeAbleToSubmitFormsByCausingTheOnClickEventToFire', + 'JavascriptEnabledDriverTest.testShouldBeAbleToClickIfEvenSomethingHorribleHappens', + 'JavascriptEnabledDriverTest.testShouldBeAbleToClickOnSubmitButtons', + 'JavascriptEnabledDriverTest.testShouldBeAbleToSwitchToFocusedElement', + 'JavascriptEnabledDriverTest.testChangeEventIsFiredAppropriatelyWhenFocusIsLost', + 'BasicKeyboardInterfaceTest.testSendingKeysWithShiftPressed', + 'BasicKeyboardInterfaceTest.testBasicKeyboardInputOnActiveElement', + 'BasicKeyboardInterfaceTest.testSendingKeyUp', + 'BasicKeyboardInterfaceTest.testSendingKeyDownOnly', + 'BasicMouseInterfaceTest.testShouldClickElementInIFrame', + 'CombinedInputActionsTest.testCanClickOnLinks', + 'CombinedInputActionsTest.testCanClickOnLinksWithAnOffset', + 'CombinedInputActionsTest.testMouseMovementWorksWhenNavigatingToAnotherPage', ] _REVISION_NEGATIVE_FILTER['58'] = ( _REVISION_NEGATIVE_FILTER['HEAD'] + [
diff --git a/chrome/test/data/extensions/api_test/window_open/argument_overflow/test.js b/chrome/test/data/extensions/api_test/window_open/argument_overflow/test.js index 0b99bc26..20fe732 100644 --- a/chrome/test/data/extensions/api_test/window_open/argument_overflow/test.js +++ b/chrome/test/data/extensions/api_test/window_open/argument_overflow/test.js
@@ -6,8 +6,12 @@ try { chrome.windows.create({ "left": value }, function() { }); } catch (e) { - chrome.test.assertTrue(e.message.indexOf( - "Value must fit in a 32-bit signed integer.") != -1); + var jsBindingsError = 'Value must fit in a 32-bit signed integer.'; + var nativeBindingsError = 'Invalid type: expected integer, found number.'; + chrome.test.assertTrue( + e.message.indexOf(jsBindingsError) != -1 || + e.message.indexOf(nativeBindingsError) != -1, + e.message); chrome.test.succeed(); return; }
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc index 3c0c461..a3ff43d 100644 --- a/chromecast/browser/cast_content_browser_client.cc +++ b/chromecast/browser/cast_content_browser_client.cc
@@ -391,13 +391,11 @@ void CastContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } + void CastContentBrowserClient::AllowCertificateError( content::WebContents* web_contents, int cert_error,
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h index 64eb5c7..e1c0a970 100644 --- a/chromecast/browser/cast_content_browser_client.h +++ b/chromecast/browser/cast_content_browser_client.h
@@ -127,7 +127,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; void AllowCertificateError( content::WebContents* web_contents, int cert_error,
diff --git a/chromeos/dbus/fake_power_manager_client.cc b/chromeos/dbus/fake_power_manager_client.cc index 9034cca..3f5ab42 100644 --- a/chromeos/dbus/fake_power_manager_client.cc +++ b/chromeos/dbus/fake_power_manager_client.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback.h" #include "base/location.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -93,6 +94,9 @@ const power_manager::PowerManagementPolicy& policy) { policy_ = policy; ++num_set_policy_calls_; + + if (power_policy_quit_closure_) + std::move(power_policy_quit_closure_).Run(); } void FakePowerManagerClient::SetIsProjecting(bool is_projecting) { @@ -209,4 +213,9 @@ --num_pending_suspend_readiness_callbacks_; } +void FakePowerManagerClient::SetPowerPolicyQuitClosure( + base::OnceClosure quit_closure) { + power_policy_quit_closure_ = std::move(quit_closure); +} + } // namespace chromeos
diff --git a/chromeos/dbus/fake_power_manager_client.h b/chromeos/dbus/fake_power_manager_client.h index c59a7e9..09d87bac 100644 --- a/chromeos/dbus/fake_power_manager_client.h +++ b/chromeos/dbus/fake_power_manager_client.h
@@ -8,6 +8,7 @@ #include <deque> #include <string> +#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" @@ -98,6 +99,11 @@ void UpdatePowerProperties( const power_manager::PowerSupplyProperties& power_props); + // The PowerAPI requests system wake lock asynchronously. Test can run a + // RunLoop and set the quit closure by this function to make sure the wake + // lock has been created. + void SetPowerPolicyQuitClosure(base::OnceClosure quit_closure); + private: // Callback that will be run by asynchronous suspend delays to report // readiness. @@ -142,6 +148,9 @@ // Delegate for managing power consumption of Chrome's renderer processes. base::WeakPtr<RenderProcessManagerDelegate> render_process_manager_delegate_; + // If non-empty, called by SetPowerPolicy(). + base::OnceClosure power_policy_quit_closure_; + // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<FakePowerManagerClient> weak_ptr_factory_;
diff --git a/components/feature_engagement_tracker/OWNERS b/components/feature_engagement_tracker/OWNERS index 6768d1d7..6b65e37 100644 --- a/components/feature_engagement_tracker/OWNERS +++ b/components/feature_engagement_tracker/OWNERS
@@ -1,2 +1,5 @@ dtrainor@chromium.org nyquist@chromium.org + +# COMPONENT: Internals>FeatureEngagementTracker +
diff --git a/components/viz/host/BUILD.gn b/components/viz/host/BUILD.gn index cfc7f81..53a3de2a3 100644 --- a/components/viz/host/BUILD.gn +++ b/components/viz/host/BUILD.gn
@@ -6,9 +6,9 @@ defines = [ "VIZ_HOST_IMPLEMENTATION" ] sources = [ - "frame_sink_manager_host.cc", - "frame_sink_manager_host.h", "frame_sink_observer.h", + "host_frame_sink_manager.cc", + "host_frame_sink_manager.h", "viz_host_export.h", ] @@ -23,7 +23,7 @@ testonly = true sources = [ - "frame_sink_manager_host_unittests.cc", + "host_frame_sink_manager_unittests.cc", ] deps = [
diff --git a/components/viz/host/frame_sink_manager_host.cc b/components/viz/host/host_frame_sink_manager.cc similarity index 75% rename from components/viz/host/frame_sink_manager_host.cc rename to components/viz/host/host_frame_sink_manager.cc index 2f3eeeb..3ae198d9 100644 --- a/components/viz/host/frame_sink_manager_host.cc +++ b/components/viz/host/host_frame_sink_manager.cc
@@ -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 "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include <utility> @@ -11,11 +11,11 @@ namespace viz { -FrameSinkManagerHost::FrameSinkManagerHost() : binding_(this) {} +HostFrameSinkManager::HostFrameSinkManager() : binding_(this) {} -FrameSinkManagerHost::~FrameSinkManagerHost() = default; +HostFrameSinkManager::~HostFrameSinkManager() = default; -void FrameSinkManagerHost::BindManagerClientAndSetManagerPtr( +void HostFrameSinkManager::BindManagerClientAndSetManagerPtr( cc::mojom::FrameSinkManagerClientRequest request, cc::mojom::FrameSinkManagerPtr ptr) { DCHECK(!binding_.is_bound()); @@ -23,15 +23,15 @@ frame_sink_manager_ptr_ = std::move(ptr); } -void FrameSinkManagerHost::AddObserver(FrameSinkObserver* observer) { +void HostFrameSinkManager::AddObserver(FrameSinkObserver* observer) { observers_.AddObserver(observer); } -void FrameSinkManagerHost::RemoveObserver(FrameSinkObserver* observer) { +void HostFrameSinkManager::RemoveObserver(FrameSinkObserver* observer) { observers_.RemoveObserver(observer); } -void FrameSinkManagerHost::CreateCompositorFrameSink( +void HostFrameSinkManager::CreateCompositorFrameSink( const cc::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkClientPtr client) { @@ -44,7 +44,7 @@ mojo::MakeRequest(&data.private_interface), std::move(client)); } -void FrameSinkManagerHost::DestroyCompositorFrameSink( +void HostFrameSinkManager::DestroyCompositorFrameSink( const cc::FrameSinkId& frame_sink_id) { auto iter = frame_sink_data_map_.find(frame_sink_id); DCHECK(iter != frame_sink_data_map_.end()); @@ -57,7 +57,7 @@ frame_sink_data_map_.erase(iter); } -void FrameSinkManagerHost::RegisterFrameSinkHierarchy( +void HostFrameSinkManager::RegisterFrameSinkHierarchy( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& child_frame_sink_id) { // Register and store the parent. @@ -66,7 +66,7 @@ frame_sink_data_map_[child_frame_sink_id].parent = parent_frame_sink_id; } -void FrameSinkManagerHost::UnregisterFrameSinkHierarchy( +void HostFrameSinkManager::UnregisterFrameSinkHierarchy( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& child_frame_sink_id) { auto iter = frame_sink_data_map_.find(child_frame_sink_id); @@ -86,20 +86,20 @@ frame_sink_data_map_.erase(iter); } -void FrameSinkManagerHost::OnSurfaceCreated( +void HostFrameSinkManager::OnSurfaceCreated( const cc::SurfaceInfo& surface_info) { for (auto& observer : observers_) observer.OnSurfaceCreated(surface_info); } -FrameSinkManagerHost::FrameSinkData::FrameSinkData() = default; +HostFrameSinkManager::FrameSinkData::FrameSinkData() = default; -FrameSinkManagerHost::FrameSinkData::FrameSinkData(FrameSinkData&& other) = +HostFrameSinkManager::FrameSinkData::FrameSinkData(FrameSinkData&& other) = default; -FrameSinkManagerHost::FrameSinkData::~FrameSinkData() = default; +HostFrameSinkManager::FrameSinkData::~FrameSinkData() = default; -FrameSinkManagerHost::FrameSinkData& FrameSinkManagerHost::FrameSinkData:: +HostFrameSinkManager::FrameSinkData& HostFrameSinkManager::FrameSinkData:: operator=(FrameSinkData&& other) = default; } // namespace viz
diff --git a/components/viz/host/frame_sink_manager_host.h b/components/viz/host/host_frame_sink_manager.h similarity index 89% rename from components/viz/host/frame_sink_manager_host.h rename to components/viz/host/host_frame_sink_manager.h index 1a18467..5fcd0a2a 100644 --- a/components/viz/host/frame_sink_manager_host.h +++ b/components/viz/host/host_frame_sink_manager.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_VIZ_HOST_FRAME_SINK_MANAGER_HOST_H_ -#define COMPONENTS_VIZ_HOST_FRAME_SINK_MANAGER_HOST_H_ +#ifndef COMPONENTS_VIZ_HOST_HOST_FRAME_SINK_MANAGER_H_ +#define COMPONENTS_VIZ_HOST_HOST_FRAME_SINK_MANAGER_H_ #include "base/compiler_specific.h" #include "base/containers/flat_map.h" @@ -19,17 +19,17 @@ namespace cc { class SurfaceInfo; class SurfaceManager; -} +} // namespace cc namespace viz { -// Browser side implementation of mojom::FrameSinkManager, to be used from the +// Browser side wrapper of mojom::FrameSinkManager, to be used from the // UI thread. Manages frame sinks and is intended to replace SurfaceManager. -class VIZ_HOST_EXPORT FrameSinkManagerHost +class VIZ_HOST_EXPORT HostFrameSinkManager : NON_EXPORTED_BASE(cc::mojom::FrameSinkManagerClient) { public: - FrameSinkManagerHost(); - ~FrameSinkManagerHost() override; + HostFrameSinkManager(); + ~HostFrameSinkManager() override; // Binds |this| as a FrameSinkManagerClient to the |request|. May only be // called once. @@ -98,9 +98,9 @@ // Local observers to that receive OnSurfaceCreated() messages from IPC. base::ObserverList<FrameSinkObserver> observers_; - DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerHost); + DISALLOW_COPY_AND_ASSIGN(HostFrameSinkManager); }; } // namespace viz -#endif // COMPONENTS_VIZ_HOST_FRAME_SINK_MANAGER_HOST_H_ +#endif // COMPONENTS_VIZ_HOST_HOST_FRAME_SINK_MANAGER_H_
diff --git a/components/viz/host/frame_sink_manager_host_unittests.cc b/components/viz/host/host_frame_sink_manager_unittests.cc similarity index 86% rename from components/viz/host/frame_sink_manager_host_unittests.cc rename to components/viz/host/host_frame_sink_manager_unittests.cc index d2c939d..b113e87 100644 --- a/components/viz/host/frame_sink_manager_host_unittests.cc +++ b/components/viz/host/host_frame_sink_manager_unittests.cc
@@ -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 "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include <memory> #include <utility> @@ -95,21 +95,21 @@ } // namespace -class FrameSinkManagerHostTest : public testing::Test { +class HostFrameSinkManagerTest : public testing::Test { public: - FrameSinkManagerHostTest() = default; - ~FrameSinkManagerHostTest() override = default; + HostFrameSinkManagerTest() = default; + ~HostFrameSinkManagerTest() override = default; - FrameSinkManagerHost& manager_host() { return *manager_host_; } + HostFrameSinkManager& host_manager() { return *host_manager_; } MockFrameSinkManagerImpl& manager_impl() { return *manager_impl_; } // testing::Test: void SetUp() override { manager_impl_ = base::MakeUnique<MockFrameSinkManagerImpl>(); - manager_host_ = base::MakeUnique<FrameSinkManagerHost>(); + host_manager_ = base::MakeUnique<HostFrameSinkManager>(); - // Connect FrameSinkManagerHost and MojoFrameSinkManager. + // Connect HostFrameSinkManager and FrameSinkManagerImpl. cc::mojom::FrameSinkManagerClientPtr host_mojo; cc::mojom::FrameSinkManagerClientRequest host_mojo_request = mojo::MakeRequest(&host_mojo); @@ -118,30 +118,30 @@ mojo::MakeRequest(&manager_mojo); manager_impl_->BindAndSetClient(std::move(manager_impl_request), std::move(host_mojo)); - manager_host_->BindManagerClientAndSetManagerPtr( + host_manager_->BindManagerClientAndSetManagerPtr( std::move(host_mojo_request), std::move(manager_mojo)); } private: base::MessageLoop message_loop_; - std::unique_ptr<FrameSinkManagerHost> manager_host_; + std::unique_ptr<HostFrameSinkManager> host_manager_; std::unique_ptr<MockFrameSinkManagerImpl> manager_impl_; - DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerHostTest); + DISALLOW_COPY_AND_ASSIGN(HostFrameSinkManagerTest); }; // Verify that when destroying a CompositorFrameSink with registered FrameSink // hierarchy, the hierarchy is automatically unregistered. -TEST_F(FrameSinkManagerHostTest, UnregisterHierarchyOnDestroy) { +TEST_F(HostFrameSinkManagerTest, UnregisterHierarchyOnDestroy) { base::RunLoop run_loop; cc::mojom::CompositorFrameSinkPtr frame_sink; StubCompositorFrameSinkClient frame_sink_client; - manager_host().CreateCompositorFrameSink(kFrameSinkId1, + host_manager().CreateCompositorFrameSink(kFrameSinkId1, mojo::MakeRequest(&frame_sink), frame_sink_client.GetInterfacePtr()); - manager_host().RegisterFrameSinkHierarchy(kFrameSinkId2, kFrameSinkId1); - manager_host().DestroyCompositorFrameSink(kFrameSinkId1); + host_manager().RegisterFrameSinkHierarchy(kFrameSinkId2, kFrameSinkId1); + host_manager().DestroyCompositorFrameSink(kFrameSinkId1); // Register is called explicitly. EXPECT_CALL(manager_impl(),
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn index f42cb4d..b8dde84 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn
@@ -32,13 +32,13 @@ "frame_sinks/frame_eviction_manager.h", "frame_sinks/frame_evictor.cc", "frame_sinks/frame_evictor.h", + "frame_sinks/frame_sink_manager_impl.cc", + "frame_sinks/frame_sink_manager_impl.h", "frame_sinks/gpu_compositor_frame_sink.cc", "frame_sinks/gpu_compositor_frame_sink.h", "frame_sinks/gpu_compositor_frame_sink_delegate.h", "frame_sinks/gpu_root_compositor_frame_sink.cc", "frame_sinks/gpu_root_compositor_frame_sink.h", - "frame_sinks/mojo_frame_sink_manager.cc", - "frame_sinks/mojo_frame_sink_manager.h", "viz_service_export.h", ]
diff --git a/components/viz/service/display_compositor/display_provider.h b/components/viz/service/display_compositor/display_provider.h index 2b26b2fb..07442d16 100644 --- a/components/viz/service/display_compositor/display_provider.h +++ b/components/viz/service/display_compositor/display_provider.h
@@ -18,7 +18,7 @@ namespace viz { // Handles creating new cc::Displays and related classes for -// MojoFrameSinkManager. +// FrameSinkManagerImpl. class DisplayProvider { public: virtual ~DisplayProvider() {}
diff --git a/components/viz/service/frame_sinks/mojo_frame_sink_manager.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc similarity index 83% rename from components/viz/service/frame_sinks/mojo_frame_sink_manager.cc rename to components/viz/service/frame_sinks/frame_sink_manager_impl.cc index 01eb0318..3518468 100644 --- a/components/viz/service/frame_sinks/mojo_frame_sink_manager.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -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 "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include <utility> @@ -18,7 +18,7 @@ namespace viz { -MojoFrameSinkManager::MojoFrameSinkManager(bool use_surface_references, +FrameSinkManagerImpl::FrameSinkManagerImpl(bool use_surface_references, DisplayProvider* display_provider) : manager_(use_surface_references ? cc::SurfaceManager::LifetimeType::REFERENCES @@ -31,14 +31,14 @@ manager_.SetDependencyTracker(dependency_tracker_.get()); } -MojoFrameSinkManager::~MojoFrameSinkManager() { +FrameSinkManagerImpl::~FrameSinkManagerImpl() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); manager_.SetDependencyTracker(nullptr); dependency_tracker_.reset(); manager_.RemoveObserver(this); } -void MojoFrameSinkManager::BindPtrAndSetClient( +void FrameSinkManagerImpl::BindPtrAndSetClient( cc::mojom::FrameSinkManagerRequest request, cc::mojom::FrameSinkManagerClientPtr client) { DCHECK(!binding_.is_bound()); @@ -46,7 +46,7 @@ client_ = std::move(client); } -void MojoFrameSinkManager::CreateRootCompositorFrameSink( +void FrameSinkManagerImpl::CreateRootCompositorFrameSink( const cc::FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, @@ -70,7 +70,7 @@ std::move(display_private_request)); } -void MojoFrameSinkManager::CreateCompositorFrameSink( +void FrameSinkManagerImpl::CreateCompositorFrameSink( const cc::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -84,30 +84,30 @@ std::move(private_request), std::move(client)); } -void MojoFrameSinkManager::RegisterFrameSinkHierarchy( +void FrameSinkManagerImpl::RegisterFrameSinkHierarchy( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& child_frame_sink_id) { manager_.RegisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } -void MojoFrameSinkManager::UnregisterFrameSinkHierarchy( +void FrameSinkManagerImpl::UnregisterFrameSinkHierarchy( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& child_frame_sink_id) { manager_.UnregisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } -void MojoFrameSinkManager::DropTemporaryReference( +void FrameSinkManagerImpl::DropTemporaryReference( const cc::SurfaceId& surface_id) { manager_.DropTemporaryReference(surface_id); } -void MojoFrameSinkManager::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) { +void FrameSinkManagerImpl::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) { compositor_frame_sinks_.erase(sink_id); } -void MojoFrameSinkManager::OnSurfaceCreated( +void FrameSinkManagerImpl::OnSurfaceCreated( const cc::SurfaceInfo& surface_info) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_GT(surface_info.device_scale_factor(), 0.0f); @@ -121,22 +121,22 @@ client_->OnSurfaceCreated(surface_info); } -bool MojoFrameSinkManager::OnSurfaceDamaged(const cc::SurfaceId& surface_id, +bool FrameSinkManagerImpl::OnSurfaceDamaged(const cc::SurfaceId& surface_id, const cc::BeginFrameAck& ack) { return false; } -void MojoFrameSinkManager::OnSurfaceDiscarded(const cc::SurfaceId& surface_id) { +void FrameSinkManagerImpl::OnSurfaceDiscarded(const cc::SurfaceId& surface_id) { } -void MojoFrameSinkManager::OnSurfaceDestroyed(const cc::SurfaceId& surface_id) { +void FrameSinkManagerImpl::OnSurfaceDestroyed(const cc::SurfaceId& surface_id) { } -void MojoFrameSinkManager::OnSurfaceDamageExpected( +void FrameSinkManagerImpl::OnSurfaceDamageExpected( const cc::SurfaceId& surface_id, const cc::BeginFrameArgs& args) {} -void MojoFrameSinkManager::OnClientConnectionLost( +void FrameSinkManagerImpl::OnClientConnectionLost( const cc::FrameSinkId& frame_sink_id, bool destroy_compositor_frame_sink) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); @@ -147,9 +147,9 @@ // client instance to create a new CompositorFrameSink. } -void MojoFrameSinkManager::OnSurfaceWillDraw(const cc::SurfaceId& surface_id) {} +void FrameSinkManagerImpl::OnSurfaceWillDraw(const cc::SurfaceId& surface_id) {} -void MojoFrameSinkManager::OnPrivateConnectionLost( +void FrameSinkManagerImpl::OnPrivateConnectionLost( const cc::FrameSinkId& frame_sink_id, bool destroy_compositor_frame_sink) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
diff --git a/components/viz/service/frame_sinks/mojo_frame_sink_manager.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h similarity index 90% rename from components/viz/service/frame_sinks/mojo_frame_sink_manager.h rename to components/viz/service/frame_sinks/frame_sink_manager_impl.h index 1cb0666..2b0a8ede 100644 --- a/components/viz/service/frame_sinks/mojo_frame_sink_manager.h +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_VIZ_SERVICE_FRAME_SINKS_MOJO_FRAME_SINK_MANAGER_H_ -#define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_MOJO_FRAME_SINK_MANAGER_H_ +#ifndef COMPONENTS_VIZ_SERVICE_FRAME_SINKS_FRAME_SINK_MANAGER_IMPL_H_ +#define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_FRAME_SINK_MANAGER_IMPL_H_ #include <stdint.h> @@ -25,7 +25,7 @@ class DisplayProvider; -// MojoFrameSinkManager manages state associated with CompositorFrameSinks. It +// FrameSinkManagerImpl manages state associated with CompositorFrameSinks. It // provides a Mojo interface to create CompositorFrameSinks, manages BeginFrame // hierarchy and manages surface lifetime. // @@ -33,14 +33,14 @@ // will be true after the mus process split. For non-mus Chrome this will be // created in the browser process, at least until GPU implementations can be // unified. -class VIZ_SERVICE_EXPORT MojoFrameSinkManager +class VIZ_SERVICE_EXPORT FrameSinkManagerImpl : public cc::SurfaceObserver, public NON_EXPORTED_BASE(GpuCompositorFrameSinkDelegate), public NON_EXPORTED_BASE(cc::mojom::FrameSinkManager) { public: - MojoFrameSinkManager(bool use_surface_references, + FrameSinkManagerImpl(bool use_surface_references, DisplayProvider* display_provider); - ~MojoFrameSinkManager() override; + ~FrameSinkManagerImpl() override; cc::SurfaceManager* surface_manager() { return &manager_; } @@ -115,9 +115,9 @@ cc::mojom::FrameSinkManagerClientPtr client_; mojo::Binding<cc::mojom::FrameSinkManager> binding_; - DISALLOW_COPY_AND_ASSIGN(MojoFrameSinkManager); + DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerImpl); }; } // namespace viz -#endif // COMPONENTS_VIZ_SERVICE_FRAME_SINKS_MOJO_FRAME_SINK_MANAGER_H_ +#endif // COMPONENTS_VIZ_SERVICE_FRAME_SINKS_FRAME_SINK_MANAGER_IMPL_H_
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index faa820a8..592fafa 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -53,9 +53,9 @@ #include "components/tracing/common/trace_config_file.h" #include "components/tracing/common/trace_to_console.h" #include "components/tracing/common/tracing_switches.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/service/display_compositor/host_shared_bitmap_manager.h" -#include "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/compositor/surface_utils.h" @@ -1202,7 +1202,7 @@ #if !defined(OS_ANDROID) frame_sink_manager_.reset(); - frame_sink_manager_host_.reset(); + host_frame_sink_manager_.reset(); #endif #if defined(USE_AURA) || defined(OS_MACOSX) @@ -1458,14 +1458,14 @@ #if !defined(OS_ANDROID) if (!service_manager::ServiceManagerIsRemote()) { - frame_sink_manager_host_ = base::MakeUnique<viz::FrameSinkManagerHost>(); + host_frame_sink_manager_ = base::MakeUnique<viz::HostFrameSinkManager>(); - // TODO(danakj): Don't make a MojoFrameSinkManager when display is in the + // TODO(danakj): Don't make a FrameSinkManagerImpl when display is in the // Gpu process, instead get the mojo pointer from the Gpu process. frame_sink_manager_ = - base::MakeUnique<viz::MojoFrameSinkManager>(false, nullptr); + base::MakeUnique<viz::FrameSinkManagerImpl>(false, nullptr); surface_utils::ConnectWithInProcessFrameSinkManager( - frame_sink_manager_host_.get(), frame_sink_manager_.get()); + host_frame_sink_manager_.get(), frame_sink_manager_.get()); } #endif
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index b50b639..7bd02b5c 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h
@@ -82,8 +82,8 @@ #endif namespace viz { -class FrameSinkManagerHost; -class MojoFrameSinkManager; +class HostFrameSinkManager; +class FrameSinkManagerImpl; } namespace content { @@ -171,10 +171,10 @@ } #if !defined(OS_ANDROID) - // TODO(fsamuel): We should find an object to own FrameSinkManagerHost on all + // TODO(fsamuel): We should find an object to own HostFrameSinkManager on all // platforms including Android. See http://crbug.com/732507. - viz::FrameSinkManagerHost* frame_sink_manager_host() const { - return frame_sink_manager_host_.get(); + viz::HostFrameSinkManager* host_frame_sink_manager() const { + return host_frame_sink_manager_.get(); } // TODO(crbug.com/657959): This will be removed once there are no users, as @@ -346,13 +346,13 @@ std::unique_ptr<memory_instrumentation::CoordinatorImpl> memory_instrumentation_coordinator_; #if !defined(OS_ANDROID) - std::unique_ptr<viz::FrameSinkManagerHost> frame_sink_manager_host_; + std::unique_ptr<viz::HostFrameSinkManager> host_frame_sink_manager_; // This is owned here so that SurfaceManager will be accessible in process // when display is in the same process. Other than using SurfaceManager, // access to |in_process_frame_sink_manager_| should happen via - // |frame_sink_manager_host_| instead which uses Mojo. See + // |host_frame_sink_manager_| instead which uses Mojo. See // http://crbug.com/657959. - std::unique_ptr<viz::MojoFrameSinkManager> frame_sink_manager_; + std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager_; #endif // DO NOT add members here. Add them to the right categories above.
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index c7fbe80..13e2bf1 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -30,7 +30,7 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/surface_manager.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/service/display_compositor/compositor_overlay_candidate_validator.h" #include "components/viz/service/display_compositor/gl_helper.h" #include "components/viz/service/display_compositor/host_shared_bitmap_manager.h" @@ -730,9 +730,9 @@ return BrowserMainLoop::GetInstance()->GetSurfaceManager(); } -viz::FrameSinkManagerHost* -GpuProcessTransportFactory::GetFrameSinkManagerHost() { - return BrowserMainLoop::GetInstance()->frame_sink_manager_host(); +viz::HostFrameSinkManager* +GpuProcessTransportFactory::GetHostFrameSinkManager() { + return BrowserMainLoop::GetInstance()->host_frame_sink_manager(); } void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor,
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h index 201240dc..d9c0b77 100644 --- a/content/browser/compositor/gpu_process_transport_factory.h +++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -18,7 +18,7 @@ #include "build/build_config.h" #include "cc/output/renderer_settings.h" #include "cc/surfaces/frame_sink_id_allocator.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "content/browser/compositor/image_transport_factory.h" #include "gpu/ipc/client/gpu_channel_host.h" #include "ui/compositor/compositor.h" @@ -64,7 +64,7 @@ void RemoveCompositor(ui::Compositor* compositor) override; cc::FrameSinkId AllocateFrameSinkId() override; cc::SurfaceManager* GetSurfaceManager() override; - viz::FrameSinkManagerHost* GetFrameSinkManagerHost() override; + viz::HostFrameSinkManager* GetHostFrameSinkManager() override; void SetDisplayVisible(ui::Compositor* compositor, bool visible) override; void ResizeDisplay(ui::Compositor* compositor, const gfx::Size& size) override;
diff --git a/content/browser/compositor/surface_utils.cc b/content/browser/compositor/surface_utils.cc index 18a0f9e..0eb40e61 100644 --- a/content/browser/compositor/surface_utils.cc +++ b/content/browser/compositor/surface_utils.cc
@@ -10,9 +10,9 @@ #include "build/build_config.h" #include "cc/output/copy_output_result.h" #include "cc/resources/single_release_callback.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/service/display_compositor/gl_helper.h" -#include "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "content/browser/browser_main_loop.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -175,11 +175,11 @@ #endif } -viz::FrameSinkManagerHost* GetFrameSinkManagerHost() { +viz::HostFrameSinkManager* GetHostFrameSinkManager() { #if defined(OS_ANDROID) - return CompositorImpl::GetFrameSinkManagerHost(); + return CompositorImpl::GetHostFrameSinkManager(); #else - return BrowserMainLoop::GetInstance()->frame_sink_manager_host(); + return BrowserMainLoop::GetInstance()->host_frame_sink_manager(); #endif } @@ -214,8 +214,8 @@ namespace surface_utils { -void ConnectWithInProcessFrameSinkManager(viz::FrameSinkManagerHost* host, - viz::MojoFrameSinkManager* manager) { +void ConnectWithInProcessFrameSinkManager(viz::HostFrameSinkManager* host, + viz::FrameSinkManagerImpl* manager) { // A mojo pointer to |host| which is the FrameSinkManager's client. cc::mojom::FrameSinkManagerClientPtr host_mojo; // A mojo pointer to |manager|.
diff --git a/content/browser/compositor/surface_utils.h b/content/browser/compositor/surface_utils.h index 29e2e78..cf6a677 100644 --- a/content/browser/compositor/surface_utils.h +++ b/content/browser/compositor/surface_utils.h
@@ -19,8 +19,8 @@ } // namespace cc namespace viz { -class FrameSinkManagerHost; -class MojoFrameSinkManager; +class HostFrameSinkManager; +class FrameSinkManagerImpl; } namespace content { @@ -29,7 +29,7 @@ CONTENT_EXPORT cc::SurfaceManager* GetSurfaceManager(); -CONTENT_EXPORT viz::FrameSinkManagerHost* GetFrameSinkManagerHost(); +CONTENT_EXPORT viz::HostFrameSinkManager* GetHostFrameSinkManager(); void CopyFromCompositingSurfaceHasResult( const gfx::Size& dst_size_in_pixel, @@ -40,8 +40,8 @@ namespace surface_utils { CONTENT_EXPORT void ConnectWithInProcessFrameSinkManager( - viz::FrameSinkManagerHost* host, - viz::MojoFrameSinkManager* manager); + viz::HostFrameSinkManager* host, + viz::FrameSinkManagerImpl* manager); } // namespace surface_utils
diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.cc b/content/browser/compositor/test/no_transport_image_transport_factory.cc index 01118da..65e9f97 100644 --- a/content/browser/compositor/test/no_transport_image_transport_factory.cc +++ b/content/browser/compositor/test/no_transport_image_transport_factory.cc
@@ -19,9 +19,9 @@ NoTransportImageTransportFactory::NoTransportImageTransportFactory() : frame_sink_manager_(false /* use surface references */, nullptr), - context_factory_(&frame_sink_manager_host_, + context_factory_(&host_frame_sink_manager_, frame_sink_manager_.surface_manager()) { - surface_utils::ConnectWithInProcessFrameSinkManager(&frame_sink_manager_host_, + surface_utils::ConnectWithInProcessFrameSinkManager(&host_frame_sink_manager_, &frame_sink_manager_); // The context factory created here is for unit tests, thus using a higher
diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.h b/content/browser/compositor/test/no_transport_image_transport_factory.h index 93f7c05..e0e3766 100644 --- a/content/browser/compositor/test/no_transport_image_transport_factory.h +++ b/content/browser/compositor/test/no_transport_image_transport_factory.h
@@ -10,8 +10,8 @@ #include "base/macros.h" #include "build/build_config.h" #include "cc/surfaces/surface_manager.h" -#include "components/viz/host/frame_sink_manager_host.h" -#include "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/host/host_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "content/browser/compositor/image_transport_factory.h" #include "ui/compositor/test/in_process_context_factory.h" @@ -44,8 +44,8 @@ private: // The FrameSinkManager implementation lives in-process here for tests. - viz::MojoFrameSinkManager frame_sink_manager_; - viz::FrameSinkManagerHost frame_sink_manager_host_; + viz::FrameSinkManagerImpl frame_sink_manager_; + viz::HostFrameSinkManager host_frame_sink_manager_; ui::InProcessContextFactory context_factory_; scoped_refptr<cc::ContextProvider> context_provider_; std::unique_ptr<viz::GLHelper> gl_helper_;
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 1be87de..abe9a4fc 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -117,6 +117,10 @@ #include "services/resource_coordinator/public/cpp/resource_coordinator_interface.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/interface_provider.h" +#include "services/shape_detection/public/interfaces/barcodedetection.mojom.h" +#include "services/shape_detection/public/interfaces/constants.mojom.h" +#include "services/shape_detection/public/interfaces/facedetection_provider.mojom.h" +#include "services/shape_detection/public/interfaces/textdetection.mojom.h" #include "third_party/WebKit/public/platform/WebFeaturePolicy.h" #include "ui/accessibility/ax_tree.h" #include "ui/accessibility/ax_tree_id_registry.h" @@ -334,6 +338,18 @@ *rfph = RenderFrameProxyHost::FromID(process_id, routing_id); } +// Forwards service requests to Service Manager since the renderer cannot launch +// out-of-process services on its own. +template <typename R> +void ForwardShapeDetectionRequest(const service_manager::BindSourceInfo&, + R request) { + // TODO(beng): This should really be using the per-profile connector. + service_manager::Connector* connector = + ServiceManagerConnection::GetForProcess()->GetConnector(); + connector->BindInterface(shape_detection::mojom::kServiceName, + std::move(request)); +} + } // namespace // static @@ -2880,6 +2896,16 @@ GetInterfaceRegistry()->AddInterface(base::Bind( &KeyboardLockServiceImpl::CreateMojoService)); + + GetInterfaceRegistry()->AddInterface( + base::Bind(&ForwardShapeDetectionRequest< + shape_detection::mojom::BarcodeDetectionRequest>)); + GetInterfaceRegistry()->AddInterface( + base::Bind(&ForwardShapeDetectionRequest< + shape_detection::mojom::FaceDetectionProviderRequest>)); + GetInterfaceRegistry()->AddInterface( + base::Bind(&ForwardShapeDetectionRequest< + shape_detection::mojom::TextDetectionRequest>)); } void RenderFrameHostImpl::ResetWaitingState() {
diff --git a/content/browser/media/media_browsertest.cc b/content/browser/media/media_browsertest.cc index 0cdfc5e..2d523d4 100644 --- a/content/browser/media/media_browsertest.cc +++ b/content/browser/media/media_browsertest.cc
@@ -34,6 +34,11 @@ // Lower case event name as set by Utils.failTest(). const char MediaBrowserTest::kError[] = "error"; +#if defined(OS_ANDROID) +// Title set by android cleaner page after short timeout. +const char kClean[] = "CLEAN"; +#endif + void MediaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { command_line->AppendSwitch(switches::kIgnoreAutoplayRestrictionsForTests); } @@ -66,6 +71,19 @@ AddTitlesToAwait(&title_watcher); NavigateToURL(shell(), gurl); base::string16 result = title_watcher.WaitAndGetTitle(); + +#if defined(OS_ANDROID) + // We only do this cleanup on Android, as a workaround for a test-only OOM + // bug. See http://crbug.com/727542 + const base::string16 cleaner_title = base::ASCIIToUTF16(kClean); + TitleWatcher clean_title_watcher(shell()->web_contents(), cleaner_title); + GURL cleaner_url = content::GetFileUrlWithQuery( + media::GetTestDataFilePath("cleaner.html"), ""); + NavigateToURL(shell(), cleaner_url); + base::string16 cleaner_result = clean_title_watcher.WaitAndGetTitle(); + EXPECT_EQ(cleaner_result, cleaner_title); +#endif + return base::UTF16ToASCII(result); }
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 1fe7626..801425c5 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -46,11 +46,11 @@ #include "cc/surfaces/frame_sink_id_allocator.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_settings.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/service/display_compositor/compositor_overlay_candidate_validator_android.h" #include "components/viz/service/display_compositor/gl_helper.h" #include "components/viz/service/display_compositor/host_shared_bitmap_manager.h" -#include "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "content/browser/compositor/surface_utils.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" @@ -99,23 +99,23 @@ struct CompositorDependencies { CompositorDependencies() : frame_sink_id_allocator(kDefaultClientId) { - // TODO(danakj): Don't make a MojoFrameSinkManager when display is in the + // TODO(danakj): Don't make a FrameSinkManagerImpl when display is in the // Gpu process, instead get the mojo pointer from the Gpu process. frame_sink_manager = - base::MakeUnique<viz::MojoFrameSinkManager>(false, nullptr); + base::MakeUnique<viz::FrameSinkManagerImpl>(false, nullptr); surface_utils::ConnectWithInProcessFrameSinkManager( - &frame_sink_manager_host, frame_sink_manager.get()); + &host_frame_sink_manager, frame_sink_manager.get()); } SingleThreadTaskGraphRunner task_graph_runner; - viz::FrameSinkManagerHost frame_sink_manager_host; + viz::HostFrameSinkManager host_frame_sink_manager; cc::FrameSinkIdAllocator frame_sink_id_allocator; // This is owned here so that SurfaceManager will be accessible in process // when display is in the same process. Other than using SurfaceManager, // access to |in_process_frame_sink_manager_| should happen via - // |frame_sink_manager_host_| instead which uses Mojo. See + // |host_frame_sink_manager_| instead which uses Mojo. See // http://crbug.com/657959. - std::unique_ptr<viz::MojoFrameSinkManager> frame_sink_manager; + std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager; #if BUILDFLAG(ENABLE_VULKAN) scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; @@ -419,8 +419,8 @@ } // static -viz::FrameSinkManagerHost* CompositorImpl::GetFrameSinkManagerHost() { - return &g_compositor_dependencies.Get().frame_sink_manager_host; +viz::HostFrameSinkManager* CompositorImpl::GetHostFrameSinkManager() { + return &g_compositor_dependencies.Get().host_frame_sink_manager; } // static
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index f4c897a2..b7db712 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -43,7 +43,7 @@ } namespace viz { -class FrameSinkManagerHost; +class HostFrameSinkManager; } namespace content { @@ -65,7 +65,7 @@ static bool IsInitialized(); static cc::SurfaceManager* GetSurfaceManager(); - static viz::FrameSinkManagerHost* GetFrameSinkManagerHost(); + static viz::HostFrameSinkManager* GetHostFrameSinkManager(); static cc::FrameSinkId AllocateFrameSinkId(); // ui::ResourceProvider implementation.
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl.cc b/content/browser/renderer_host/offscreen_canvas_provider_impl.cc index 58acfb70..0dd63956 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl.cc
@@ -10,9 +10,9 @@ namespace content { OffscreenCanvasProviderImpl::OffscreenCanvasProviderImpl( - viz::FrameSinkManagerHost* frame_sink_manager_host, + viz::HostFrameSinkManager* host_frame_sink_manager, uint32_t renderer_client_id) - : frame_sink_manager_host_(frame_sink_manager_host), + : host_frame_sink_manager_(host_frame_sink_manager), renderer_client_id_(renderer_client_id) {} OffscreenCanvasProviderImpl::~OffscreenCanvasProviderImpl() = default; @@ -42,7 +42,7 @@ base::Unretained(this), frame_sink_id); canvas_map_[frame_sink_id] = base::MakeUnique<OffscreenCanvasSurfaceImpl>( - frame_sink_manager_host_, parent_frame_sink_id, frame_sink_id, + host_frame_sink_manager_, parent_frame_sink_id, frame_sink_id, std::move(client), std::move(request), std::move(destroy_callback)); }
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl.h b/content/browser/renderer_host/offscreen_canvas_provider_impl.h index 4547a63e..69ed7978 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl.h
@@ -14,7 +14,7 @@ #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom.h" namespace viz { -class FrameSinkManagerHost; +class HostFrameSinkManager; } namespace content { @@ -26,7 +26,7 @@ : public blink::mojom::OffscreenCanvasProvider { public: OffscreenCanvasProviderImpl( - viz::FrameSinkManagerHost* frame_sink_manager_host, + viz::HostFrameSinkManager* host_frame_sink_manager, uint32_t renderer_client_id); ~OffscreenCanvasProviderImpl() override; @@ -50,7 +50,7 @@ // callback to each OffscreenCanvasSurfaceImpl so they can destroy themselves. void DestroyOffscreenCanvasSurface(cc::FrameSinkId frame_sink_id); - viz::FrameSinkManagerHost* const frame_sink_manager_host_; + viz::HostFrameSinkManager* const host_frame_sink_manager_; // FrameSinkIds for offscreen canvas must use the renderer client id. const uint32_t renderer_client_id_;
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc index 8e565bc..05246d3 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc
@@ -148,21 +148,21 @@ ImageTransportFactory::InitializeForUnitTests( base::MakeUnique<NoTransportImageTransportFactory>()); #endif - frame_sink_manager_host_ = base::MakeUnique<viz::FrameSinkManagerHost>(); + host_frame_sink_manager_ = base::MakeUnique<viz::HostFrameSinkManager>(); // The FrameSinkManager implementation is in-process here for tests. frame_sink_manager_ = - base::MakeUnique<viz::MojoFrameSinkManager>(false, nullptr); + base::MakeUnique<viz::FrameSinkManagerImpl>(false, nullptr); surface_utils::ConnectWithInProcessFrameSinkManager( - frame_sink_manager_host_.get(), frame_sink_manager_.get()); + host_frame_sink_manager_.get(), frame_sink_manager_.get()); provider_ = base::MakeUnique<OffscreenCanvasProviderImpl>( - frame_sink_manager_host_.get(), kRendererClientId); + host_frame_sink_manager_.get(), kRendererClientId); } void TearDown() override { provider_.reset(); frame_sink_manager_.reset(); - frame_sink_manager_host_.reset(); + host_frame_sink_manager_.reset(); #if !defined(OS_ANDROID) ImageTransportFactory::Terminate(); #endif @@ -172,8 +172,8 @@ // A MessageLoop is required for mojo bindings which are used to // connect to graphics services. base::MessageLoop message_loop_; - std::unique_ptr<viz::FrameSinkManagerHost> frame_sink_manager_host_; - std::unique_ptr<viz::MojoFrameSinkManager> frame_sink_manager_; + std::unique_ptr<viz::HostFrameSinkManager> host_frame_sink_manager_; + std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager_; std::unique_ptr<OffscreenCanvasProviderImpl> provider_; };
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc index 10b6866..745e0b1 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
@@ -9,19 +9,19 @@ #include "base/memory/ptr_util.h" #include "cc/surfaces/surface_manager.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "content/browser/compositor/surface_utils.h" namespace content { OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( - viz::FrameSinkManagerHost* frame_sink_manager_host, + viz::HostFrameSinkManager* host_frame_sink_manager, const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request, DestroyCallback destroy_callback) - : frame_sink_manager_host_(frame_sink_manager_host), + : host_frame_sink_manager_(host_frame_sink_manager), client_(std::move(client)), binding_(this, std::move(request)), destroy_callback_(std::move(destroy_callback)), @@ -30,16 +30,16 @@ binding_.set_connection_error_handler( base::Bind(&OffscreenCanvasSurfaceImpl::OnSurfaceConnectionClosed, base::Unretained(this))); - frame_sink_manager_host_->AddObserver(this); + host_frame_sink_manager_->AddObserver(this); } OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { if (has_created_compositor_frame_sink_) { - frame_sink_manager_host_->UnregisterFrameSinkHierarchy( + host_frame_sink_manager_->UnregisterFrameSinkHierarchy( parent_frame_sink_id_, frame_sink_id_); - frame_sink_manager_host_->DestroyCompositorFrameSink(frame_sink_id_); + host_frame_sink_manager_->DestroyCompositorFrameSink(frame_sink_id_); } - frame_sink_manager_host_->RemoveObserver(this); + host_frame_sink_manager_->RemoveObserver(this); } void OffscreenCanvasSurfaceImpl::CreateCompositorFrameSink( @@ -50,10 +50,10 @@ return; } - frame_sink_manager_host_->CreateCompositorFrameSink( + host_frame_sink_manager_->CreateCompositorFrameSink( frame_sink_id_, std::move(request), std::move(client)); - frame_sink_manager_host_->RegisterFrameSinkHierarchy(parent_frame_sink_id_, + host_frame_sink_manager_->RegisterFrameSinkHierarchy(parent_frame_sink_id_, frame_sink_id_); has_created_compositor_frame_sink_ = true; }
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_impl.h index f1d1eb8..c060e56d 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
@@ -9,8 +9,8 @@ #include "base/compiler_specific.h" #include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/surface_info.h" -#include "components/viz/host/frame_sink_manager_host.h" #include "components/viz/host/frame_sink_observer.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/binding.h" #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom.h" @@ -26,7 +26,7 @@ using DestroyCallback = base::OnceCallback<void()>; OffscreenCanvasSurfaceImpl( - viz::FrameSinkManagerHost* frame_sink_manager_host, + viz::HostFrameSinkManager* host_frame_sink_manager, const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, @@ -64,7 +64,7 @@ // |destroy_callback_|. void OnSurfaceConnectionClosed(); - viz::FrameSinkManagerHost* const frame_sink_manager_host_; + viz::HostFrameSinkManager* const host_frame_sink_manager_; blink::mojom::OffscreenCanvasSurfaceClientPtr client_; mojo::Binding<blink::mojom::OffscreenCanvasSurface> binding_;
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 3f18fa9..a473cb2 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1648,7 +1648,7 @@ // The client id gets converted to a uint32_t in FrameSinkId. uint32_t renderer_client_id = base::checked_cast<uint32_t>(id_); offscreen_canvas_provider_ = base::MakeUnique<OffscreenCanvasProviderImpl>( - GetFrameSinkManagerHost(), renderer_client_id); + GetHostFrameSinkManager(), renderer_client_id); } offscreen_canvas_provider_->Add(std::move(request)); }
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index a98bb20..446cce0 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -990,9 +990,9 @@ } void StoragePartitionImpl::GetQuotaSettings( - const storage::OptionalQuotaSettingsCallback& callback) { + storage::OptionalQuotaSettingsCallback callback) { GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, - callback); + std::move(callback)); } } // namespace content
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index cf6d28c3..9a50b97 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -225,7 +225,7 @@ // Function used by the quota system to ask the embedder for the // storage configuration info. - void GetQuotaSettings(const storage::OptionalQuotaSettingsCallback& callback); + void GetQuotaSettings(storage::OptionalQuotaSettingsCallback callback); base::FilePath partition_path_; scoped_refptr<net::URLRequestContextGetter> url_request_context_;
diff --git a/content/browser/webrtc/webrtc_internals_unittest.cc b/content/browser/webrtc/webrtc_internals_unittest.cc index 69b41bd..6e4fb8a5 100644 --- a/content/browser/webrtc/webrtc_internals_unittest.cc +++ b/content/browser/webrtc/webrtc_internals_unittest.cc
@@ -55,6 +55,8 @@ void RequestWakeLock() override { has_wakelock_ = true; } void CancelWakeLock() override { has_wakelock_ = false; } void AddClient(device::mojom::WakeLockRequest request) override {} + void ChangeType(device::mojom::WakeLockType type, + ChangeTypeCallback callback) override {} void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override {} bool HasWakeLock() {
diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json index aa398ecb..c0d4b95 100644 --- a/content/public/app/mojo/content_browser_manifest.json +++ b/content/public/app/mojo/content_browser_manifest.json
@@ -118,6 +118,9 @@ "mojom::MediaDevicesDispatcherHost", "payments::mojom::PaymentRequest", "resource_coordinator::mojom::CoordinationUnit", + "shape_detection::mojom::BarcodeDetection", + "shape_detection::mojom::FaceDetectionProvider", + "shape_detection::mojom::TextDetection", "ui::mojom::Gpu" ] },
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 4aa3f4c..529f49fa 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -228,9 +228,9 @@ void ContentBrowserClient::GetQuotaSettings( BrowserContext* context, StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { + storage::OptionalQuotaSettingsCallback callback) { // By default, no quota is provided, embedders should override. - callback.Run(storage::GetNoQuotaSettings()); + std::move(callback).Run(storage::GetNoQuotaSettings()); } void ContentBrowserClient::AllowCertificateError(
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 6fddeb9..e9a675c9 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -459,7 +459,7 @@ virtual void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback); + storage::OptionalQuotaSettingsCallback callback); // Informs the embedder that a certificate error has occured. If // |overridable| is true and if |strict_enforcement| is false, the user
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc index 3a4cb12..c035f502 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc
@@ -144,10 +144,10 @@ void LayoutTestContentBrowserClient::GetQuotaSettings( BrowserContext* context, StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { + storage::OptionalQuotaSettingsCallback callback) { // The 1GB limit is intended to give a large headroom to tests that need to // build up a large data set and issue many concurrent reads or writes. - callback.Run(storage::GetHardCodedSettings(1024 * 1024 * 1024)); + std::move(callback).Run(storage::GetHardCodedSettings(1024 * 1024 * 1024)); } bool LayoutTestContentBrowserClient::DoesSiteRequireDedicatedProcess(
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h index 904f51da..310c727 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.h +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h
@@ -42,7 +42,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; bool DoesSiteRequireDedicatedProcess(BrowserContext* browser_context, const GURL& effective_site_url) override;
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index c1a2808..5f111b86 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc
@@ -325,8 +325,8 @@ void ShellContentBrowserClient::GetQuotaSettings( BrowserContext* context, StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - callback.Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); + storage::OptionalQuotaSettingsCallback callback) { + std::move(callback).Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); } void ShellContentBrowserClient::SelectClientCertificate(
diff --git a/content/shell/browser/shell_content_browser_client.h b/content/shell/browser/shell_content_browser_client.h index 5bee942..effcaff 100644 --- a/content/shell/browser/shell_content_browser_client.h +++ b/content/shell/browser/shell_content_browser_client.h
@@ -56,7 +56,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; void SelectClientCertificate( WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info,
diff --git a/content/test/data/media/shape_detection_test.html b/content/test/data/media/shape_detection_test.html index 6f0983696..bacf3811 100644 --- a/content/test/data/media/shape_detection_test.html +++ b/content/test/data/media/shape_detection_test.html
@@ -28,7 +28,7 @@ window.domAutomationController.send(results); }) .catch(error => { - console.error(error.mesage); + console.error(error.message); window.domAutomationController.send(error.message); }); }
diff --git a/content/test/test_content_browser_client.cc b/content/test/test_content_browser_client.cc index 52a7ba6..1ffd033 100644 --- a/content/test/test_content_browser_client.cc +++ b/content/test/test_content_browser_client.cc
@@ -27,8 +27,8 @@ void TestContentBrowserClient::GetQuotaSettings( BrowserContext* context, StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - callback.Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); + storage::OptionalQuotaSettingsCallback callback) { + std::move(callback).Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); } } // namespace content
diff --git a/content/test/test_content_browser_client.h b/content/test/test_content_browser_client.h index 6511df27..23e3449 100644 --- a/content/test/test_content_browser_client.h +++ b/content/test/test_content_browser_client.h
@@ -23,7 +23,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; private: // Temporary directory for GetDefaultDownloadDirectory.
diff --git a/device/wake_lock/public/interfaces/wake_lock.mojom b/device/wake_lock/public/interfaces/wake_lock.mojom index 36e98bee..97352c7f 100644 --- a/device/wake_lock/public/interfaces/wake_lock.mojom +++ b/device/wake_lock/public/interfaces/wake_lock.mojom
@@ -4,6 +4,30 @@ module device.mojom; +enum WakeLockType { + // Prevent the application from being suspended. On some platforms, apps may + // be suspended when they are not visible to the user. This type of block + // requests that the app continue to run in that case, and on all platforms + // prevents the system from sleeping. + // Example use cases: downloading a file, playing audio. + PreventAppSuspension = 0, + + // Prevent the display from going to sleep. This also has the side effect of + // preventing the system from sleeping, but does not necessarily prevent the + // app from being suspended on some platforms if the user hides it. + // Example use case: playing video. + PreventDisplaySleep = 1, +}; + +enum WakeLockReason { + // Audio is being played. + ReasonAudioPlayback = 0, + // Video is being played. + ReasonVideoPlayback = 1, + // WakeLock for some other reason. + ReasonOther = 2, +}; + // WakeLock receives wake lock preferences from its client. interface WakeLock { // Requests that a wake lock be applied on behalf of this client. Has no @@ -23,6 +47,16 @@ // previously called RequestWakelock() cancel their requests. AddClient(WakeLock& wake_lock); + // Change the wake lock type. Has no effect if the current wakelock is shared + // by more than one client (by AddClient()). Has no effect on Android. + // If the wake lock is in "active" state (by RequestWakeLock()), it requests + // a wakelock with new type first before cancels the old one to ensure that + // there isn't a brief period where the old wake lock is cancelled while the + // new wake lock is not requested. If the wake lock is in "non-active" state, + // it only changes the type. + // Returns true if the wake lock type is successfully changed. + ChangeType(WakeLockType type) => (bool result); + // Test-only method that returns whether a wake lock is currently active. HasWakeLockForTests() => (bool result); };
diff --git a/device/wake_lock/public/interfaces/wake_lock_context.mojom b/device/wake_lock/public/interfaces/wake_lock_context.mojom index ef37076a..9991887f 100644 --- a/device/wake_lock/public/interfaces/wake_lock_context.mojom +++ b/device/wake_lock/public/interfaces/wake_lock_context.mojom
@@ -6,30 +6,6 @@ import "device/wake_lock/public/interfaces/wake_lock.mojom"; -enum WakeLockType { - // Prevent the application from being suspended. On some platforms, apps may - // be suspended when they are not visible to the user. This type of block - // requests that the app continue to run in that case, and on all platforms - // prevents the system from sleeping. - // Example use cases: downloading a file, playing audio. - PreventAppSuspension = 0, - - // Prevent the display from going to sleep. This also has the side effect of - // preventing the system from sleeping, but does not necessarily prevent the - // app from being suspended on some platforms if the user hides it. - // Example use case: playing video. - PreventDisplaySleep = 1, -}; - -enum WakeLockReason { - // Audio is being played. - ReasonAudioPlayback = 0, - // Video is being played. - ReasonVideoPlayback = 1, - // WakeLock for some other reason. - ReasonOther = 2, -}; - // Context in which WakeLock instances operate. interface WakeLockContext { // Gets a WakeLock within this context.
diff --git a/device/wake_lock/wake_lock.cc b/device/wake_lock/wake_lock.cc index 483b411..2bef9ed 100644 --- a/device/wake_lock/wake_lock.cc +++ b/device/wake_lock/wake_lock.cc
@@ -70,6 +70,7 @@ WakeLock::~WakeLock() {} void WakeLock::AddClient(mojom::WakeLockRequest request) { + DCHECK(main_task_runner_->RunsTasksInCurrentSequence()); binding_set_.AddBinding(this, std::move(request), base::MakeUnique<bool>(false)); } @@ -102,6 +103,31 @@ UpdateWakeLock(); } +void WakeLock::ChangeType(mojom::WakeLockType type, + ChangeTypeCallback callback) { + DCHECK(main_task_runner_->RunsTasksInCurrentSequence()); + +#if defined(OS_ANDROID) + LOG(ERROR) << "WakeLock::ChangeType() has no effect on Android."; + std::move(callback).Run(false); + return; +#endif + if (binding_set_.size() > 1) { + LOG(ERROR) << "WakeLock::ChangeType() is not allowed when the current wake " + "lock is shared by more than one clients."; + std::move(callback).Run(false); + return; + } + + mojom::WakeLockType old_type = type_; + type_ = type; + + if (type_ != old_type && wake_lock_) + SwapWakeLock(); + + std::move(callback).Run(true); +} + void WakeLock::HasWakeLockForTests(HasWakeLockForTestsCallback callback) { std::move(callback).Run(!!wake_lock_); } @@ -149,6 +175,19 @@ wake_lock_.reset(); } +void WakeLock::SwapWakeLock() { + DCHECK(wake_lock_); + + auto new_wake_lock = base::MakeUnique<PowerSaveBlocker>( + ToPowerSaveBlockerType(type_), ToPowerSaveBlockerReason(reason_), + *description_, main_task_runner_, file_task_runner_); + + // Do a swap to ensure that there isn't a brief period where the old + // powersaveblocker is unblocked while the new powersaveblocker is not + // created. + wake_lock_.swap(new_wake_lock); +} + void WakeLock::OnConnectionError() { // If this client has an outstanding wake lock request, decrease the // num_lock_requests and call UpdateWakeLock(). @@ -157,8 +196,9 @@ UpdateWakeLock(); } - if (binding_set_.empty()) + if (binding_set_.empty()) { base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); + } } } // namespace device
diff --git a/device/wake_lock/wake_lock.h b/device/wake_lock/wake_lock.h index 53c7b3b..4686570 100644 --- a/device/wake_lock/wake_lock.h +++ b/device/wake_lock/wake_lock.h
@@ -34,6 +34,8 @@ void RequestWakeLock() override; void CancelWakeLock() override; void AddClient(mojom::WakeLockRequest request) override; + void ChangeType(mojom::WakeLockType type, + ChangeTypeCallback callback) override; void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; protected: @@ -43,6 +45,7 @@ virtual void UpdateWakeLock(); virtual void CreateWakeLock(); virtual void RemoveWakeLock(); + virtual void SwapWakeLock(); void OnConnectionError();
diff --git a/device/wake_lock/wake_lock_for_testing.cc b/device/wake_lock/wake_lock_for_testing.cc index 0e737d5..776bd56 100644 --- a/device/wake_lock/wake_lock_for_testing.cc +++ b/device/wake_lock/wake_lock_for_testing.cc
@@ -54,4 +54,8 @@ has_wake_lock_ = false; } +void WakeLockForTesting::SwapWakeLock() { + DCHECK(has_wake_lock_); +} + } // namespace device
diff --git a/device/wake_lock/wake_lock_for_testing.h b/device/wake_lock/wake_lock_for_testing.h index 0242ae4..3de901ca 100644 --- a/device/wake_lock/wake_lock_for_testing.h +++ b/device/wake_lock/wake_lock_for_testing.h
@@ -36,6 +36,7 @@ void UpdateWakeLock() override; void CreateWakeLock() override; void RemoveWakeLock() override; + void SwapWakeLock() override; bool has_wake_lock_;
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index d128bd6..61e91c65 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -568,7 +568,7 @@ "//components/user_prefs", "//content/test:test_support", "//device/bluetooth:mocks", - "//device/power_save_blocker", + "//device/wake_lock/public/interfaces", "//extensions:extensions_browser_resources", "//extensions:test_support", "//extensions/common",
diff --git a/extensions/browser/api/BUILD.gn b/extensions/browser/api/BUILD.gn index 6ca6a911..22db2bf 100644 --- a/extensions/browser/api/BUILD.gn +++ b/extensions/browser/api/BUILD.gn
@@ -103,7 +103,6 @@ "//device/base", "//device/bluetooth", "//device/hid", - "//device/power_save_blocker", "//device/serial", ]
diff --git a/extensions/browser/api/DEPS b/extensions/browser/api/DEPS index 93ccbfe4..1151e87 100644 --- a/extensions/browser/api/DEPS +++ b/extensions/browser/api/DEPS
@@ -2,6 +2,8 @@ "+components/device_event_log", "+device/base", "+device/hid", + "+device/wake_lock/public/interfaces", + "+services/device/public/interfaces", "+storage/browser/fileapi", "+storage/common/fileapi", ]
diff --git a/extensions/browser/api/power/BUILD.gn b/extensions/browser/api/power/BUILD.gn index 94d6cdb..f5735aeb 100644 --- a/extensions/browser/api/power/BUILD.gn +++ b/extensions/browser/api/power/BUILD.gn
@@ -14,7 +14,11 @@ ] deps = [ + "//content/public/common", + "//device/wake_lock/public/interfaces", "//extensions/common/api", + "//mojo/public/cpp/bindings", + "//services/device/public/interfaces:constants", ] public_deps = [
diff --git a/extensions/browser/api/power/power_api.cc b/extensions/browser/api/power/power_api.cc index 308e390a..c56e40d 100644 --- a/extensions/browser/api/power/power_api.cc +++ b/extensions/browser/api/power/power_api.cc
@@ -7,42 +7,37 @@ #include "base/bind.h" #include "base/lazy_instance.h" #include "content/public/browser/browser_thread.h" -#include "device/power_save_blocker/power_save_blocker.h" +#include "content/public/common/service_manager_connection.h" +#include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/api/power.h" #include "extensions/common/extension.h" +#include "mojo/public/cpp/bindings/interface_request.h" +#include "services/device/public/interfaces/constants.mojom.h" +#include "services/service_manager/public/cpp/connector.h" namespace extensions { namespace { -const char kPowerSaveBlockerDescription[] = "extension"; +const char kWakeLockDescription[] = "extension"; -device::PowerSaveBlocker::PowerSaveBlockerType LevelToPowerSaveBlockerType( - api::power::Level level) { +device::mojom::WakeLockType LevelToWakeLockType(api::power::Level level) { switch (level) { case api::power::LEVEL_SYSTEM: - return device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension; + return device::mojom::WakeLockType::PreventAppSuspension; case api::power::LEVEL_DISPLAY: // fallthrough case api::power::LEVEL_NONE: - return device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; + return device::mojom::WakeLockType::PreventDisplaySleep; } NOTREACHED() << "Unhandled level " << level; - return device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; + return device::mojom::WakeLockType::PreventDisplaySleep; } base::LazyInstance<BrowserContextKeyedAPIFactory<PowerAPI>>::DestructorAtExit g_factory = LAZY_INSTANCE_INITIALIZER; -std::unique_ptr<device::PowerSaveBlocker> CreatePowerSaveBlocker( - device::PowerSaveBlocker::PowerSaveBlockerType type, - device::PowerSaveBlocker::Reason reason, - const std::string& description, - scoped_refptr<base::SequencedTaskRunner> ui_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) { - return std::unique_ptr<device::PowerSaveBlocker>(new device::PowerSaveBlocker( - type, reason, description, ui_task_runner, file_task_runner)); -} +void DoNothing(bool b) {} } // namespace @@ -72,30 +67,41 @@ void PowerAPI::AddRequest(const std::string& extension_id, api::power::Level level) { extension_levels_[extension_id] = level; - UpdatePowerSaveBlocker(); + UpdateWakeLock(); } void PowerAPI::RemoveRequest(const std::string& extension_id) { extension_levels_.erase(extension_id); - UpdatePowerSaveBlocker(); + UpdateWakeLock(); } -void PowerAPI::SetCreateBlockerFunctionForTesting( - const CreateBlockerFunction& function) { - create_blocker_function_ = - !function.is_null() ? function : base::Bind(&CreatePowerSaveBlocker); +void PowerAPI::SetWakeLockFunctionsForTesting( + const ActivateWakeLockFunction& activate_function, + const CancelWakeLockFunction& cancel_function) { + activate_wake_lock_function_ = + !activate_function.is_null() + ? activate_function + : base::Bind(&PowerAPI::ActivateWakeLock, base::Unretained(this)); + cancel_wake_lock_function_ = + !cancel_function.is_null() + ? cancel_function + : base::Bind(&PowerAPI::CancelWakeLock, base::Unretained(this)); } void PowerAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, const Extension* extension, UnloadedExtensionReason reason) { RemoveRequest(extension->id()); - UpdatePowerSaveBlocker(); + UpdateWakeLock(); } PowerAPI::PowerAPI(content::BrowserContext* context) : browser_context_(context), - create_blocker_function_(base::Bind(&CreatePowerSaveBlocker)), + activate_wake_lock_function_( + base::Bind(&PowerAPI::ActivateWakeLock, base::Unretained(this))), + cancel_wake_lock_function_( + base::Bind(&PowerAPI::CancelWakeLock, base::Unretained(this))), + is_wake_lock_active_(false), current_level_(api::power::LEVEL_SYSTEM) { ExtensionRegistry::Get(browser_context_)->AddObserver(this); } @@ -103,9 +109,9 @@ PowerAPI::~PowerAPI() { } -void PowerAPI::UpdatePowerSaveBlocker() { +void PowerAPI::UpdateWakeLock() { if (extension_levels_.empty()) { - power_save_blocker_.reset(); + cancel_wake_lock_function_.Run(); return; } @@ -116,21 +122,9 @@ new_level = it->second; } - // If the level changed and we need to create a new blocker, do a swap - // to ensure that there isn't a brief period where power management is - // unblocked. - if (!power_save_blocker_ || new_level != current_level_) { - device::PowerSaveBlocker::PowerSaveBlockerType type = - LevelToPowerSaveBlockerType(new_level); - std::unique_ptr<device::PowerSaveBlocker> new_blocker( - create_blocker_function_.Run( - type, device::PowerSaveBlocker::kReasonOther, - kPowerSaveBlockerDescription, - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::UI), - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::FILE))); - power_save_blocker_.swap(new_blocker); + if (!is_wake_lock_active_ || new_level != current_level_) { + device::mojom::WakeLockType type = LevelToWakeLockType(new_level); + activate_wake_lock_function_.Run(type); current_level_ = new_level; } } @@ -139,7 +133,42 @@ // Unregister here rather than in the d'tor; otherwise this call will recreate // the already-deleted ExtensionRegistry. ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); - power_save_blocker_.reset(); + cancel_wake_lock_function_.Run(); +} + +void PowerAPI::ActivateWakeLock(device::mojom::WakeLockType type) { + GetWakeLock()->ChangeType(type, base::Bind(&DoNothing)); + if (!is_wake_lock_active_) { + GetWakeLock()->RequestWakeLock(); + is_wake_lock_active_ = true; + } +} + +void PowerAPI::CancelWakeLock() { + if (is_wake_lock_active_) { + GetWakeLock()->CancelWakeLock(); + is_wake_lock_active_ = false; + } +} + +device::mojom::WakeLock* PowerAPI::GetWakeLock() { + // Here is a lazy binding, and will not reconnect after connection error. + if (wake_lock_) + return wake_lock_.get(); + + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); + + DCHECK(content::ServiceManagerConnection::GetForProcess()); + auto* connector = + content::ServiceManagerConnection::GetForProcess()->GetConnector(); + device::mojom::WakeLockProviderPtr wake_lock_provider; + connector->BindInterface(device::mojom::kServiceName, + mojo::MakeRequest(&wake_lock_provider)); + wake_lock_provider->GetWakeLockWithoutContext( + LevelToWakeLockType(current_level_), + device::mojom::WakeLockReason::ReasonOther, kWakeLockDescription, + std::move(request)); + return wake_lock_.get(); } } // namespace extensions
diff --git a/extensions/browser/api/power/power_api.h b/extensions/browser/api/power/power_api.h index 8f6c1e8..b793cec 100644 --- a/extensions/browser/api/power/power_api.h +++ b/extensions/browser/api/power/power_api.h
@@ -12,7 +12,7 @@ #include "base/callback.h" #include "base/macros.h" #include "base/single_thread_task_runner.h" -#include "device/power_save_blocker/power_save_blocker.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/extension_registry_observer.h" @@ -54,13 +54,9 @@ class PowerAPI : public BrowserContextKeyedAPI, public extensions::ExtensionRegistryObserver { public: - typedef base::Callback<std::unique_ptr<device::PowerSaveBlocker>( - device::PowerSaveBlocker::PowerSaveBlockerType, - device::PowerSaveBlocker::Reason, - const std::string&, - scoped_refptr<base::SequencedTaskRunner> ui_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)> - CreateBlockerFunction; + typedef base::Callback<void(device::mojom::WakeLockType)> + ActivateWakeLockFunction; + typedef base::Callback<void()> CancelWakeLockFunction; static PowerAPI* Get(content::BrowserContext* context); @@ -82,10 +78,11 @@ // extension id without a lock will do nothing. void RemoveRequest(const std::string& extension_id); - // Replaces the function that will be called to create PowerSaveBlocker - // objects. Passing an empty callback will revert to the default. - void SetCreateBlockerFunctionForTesting( - const CreateBlockerFunction& function); + // Replaces the functions that will be called to activate and cancel the wake + // lock. Passing empty callbacks will revert to the default. + void SetWakeLockFunctionsForTesting( + const ActivateWakeLockFunction& activate_function, + const CancelWakeLockFunction& cancel_function); // Overridden from extensions::ExtensionRegistryObserver. void OnExtensionUnloaded(content::BrowserContext* browser_context, @@ -98,9 +95,9 @@ explicit PowerAPI(content::BrowserContext* context); ~PowerAPI() override; - // Updates |power_save_blocker_| and |current_level_| after iterating + // Updates wake lock status and |current_level_| after iterating // over |extension_levels_|. - void UpdatePowerSaveBlocker(); + void UpdateWakeLock(); // BrowserContextKeyedAPI implementation. static const char* service_name() { return "PowerAPI"; } @@ -108,17 +105,31 @@ static const bool kServiceIsCreatedWithBrowserContext = false; void Shutdown() override; + // Activates the wake lock with the type. |is_wake_lock_active_| is set true. + void ActivateWakeLock(device::mojom::WakeLockType type); + + // Cancels the current wake lock if it is in active state. + // |is_wake_lock_active_| is set false. + void CancelWakeLock(); + + // Returns the raw pointer of the bound |wake_lock_|. This function is used + // only inside ActivateWakeLock() and CancelWakeLock() to perform the wake + // lock mojo calls. The |wake_lock_| is bound and the wake lock mojo pipe is + // created only once at the first time the GetWakeLock() is called. + device::mojom::WakeLock* GetWakeLock(); + content::BrowserContext* browser_context_; - // Function that should be called to create PowerSaveBlocker objects. + // Functions that should be called to activate and cancel the wake lock. // Tests can change this to record what would've been done instead of // actually changing the system power-saving settings. - CreateBlockerFunction create_blocker_function_; + ActivateWakeLockFunction activate_wake_lock_function_; + CancelWakeLockFunction cancel_wake_lock_function_; - std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; + device::mojom::WakeLockPtr wake_lock_; + bool is_wake_lock_active_; - // Current level used by |power_save_blocker_|. Meaningless if - // |power_save_blocker_| is NULL. + // Current level used by wake lock. api::power::Level current_level_; // Outstanding requests.
diff --git a/extensions/browser/api/power/power_api_unittest.cc b/extensions/browser/api/power/power_api_unittest.cc index 8015ff4..6879ebc 100644 --- a/extensions/browser/api/power/power_api_unittest.cc +++ b/extensions/browser/api/power/power_api_unittest.cc
@@ -10,9 +10,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" -#include "device/power_save_blocker/power_save_blocker.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "extensions/browser/api_test_utils.h" #include "extensions/browser/api_unittest.h" #include "extensions/common/extension.h" @@ -22,65 +21,42 @@ namespace { -// Args commonly passed to PowerSaveBlockerStubManager::CallFunction(). +// Args commonly passed to FakeWakeLockManager::CallFunction(). const char kDisplayArgs[] = "[\"display\"]"; const char kSystemArgs[] = "[\"system\"]"; const char kEmptyArgs[] = "[]"; // Different actions that can be performed as a result of a -// PowerSaveBlocker being created or destroyed. +// wake lock being activated or cancelled. enum Request { BLOCK_APP_SUSPENSION, UNBLOCK_APP_SUSPENSION, BLOCK_DISPLAY_SLEEP, UNBLOCK_DISPLAY_SLEEP, - // Returned by PowerSaveBlockerStubManager::PopFirstRequest() when no + // Returned by FakeWakeLockManager::PopFirstRequest() when no // requests are present. NONE, }; -// Stub implementation of device::PowerSaveBlocker that just runs a callback on -// destruction. -class PowerSaveBlockerStub : public device::PowerSaveBlocker { +// Tests instantiate this class to make PowerAPI's calls to simulate activate +// and cancel the wake locks and record the actions that would've been performed +// instead of actually blocking and unblocking power management. +class FakeWakeLockManager { public: - PowerSaveBlockerStub( - base::Closure unblock_callback, - scoped_refptr<base::SequencedTaskRunner> ui_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner) - : PowerSaveBlocker(PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, - PowerSaveBlocker::kReasonOther, - "test", - ui_task_runner, - blocking_task_runner), - unblock_callback_(unblock_callback) {} - - ~PowerSaveBlockerStub() override { unblock_callback_.Run(); } - - private: - base::Closure unblock_callback_; - - DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerStub); -}; - -// Manages PowerSaveBlockerStub objects. Tests can instantiate this class -// to make PowerAPI's calls to create PowerSaveBlockers record the -// actions that would've been performed instead of actually blocking and -// unblocking power management. -class PowerSaveBlockerStubManager { - public: - explicit PowerSaveBlockerStubManager(content::BrowserContext* context) - : browser_context_(context), - weak_ptr_factory_(this) { - // Use base::Unretained since callbacks with return values can't use - // weak pointers. + explicit FakeWakeLockManager(content::BrowserContext* context) + : browser_context_(context), is_active_(false) { PowerAPI::Get(browser_context_) - ->SetCreateBlockerFunctionForTesting(base::Bind( - &PowerSaveBlockerStubManager::CreateStub, base::Unretained(this))); + ->SetWakeLockFunctionsForTesting( + base::Bind(&FakeWakeLockManager::ActivateWakeLock, + base::Unretained(this)), + base::Bind(&FakeWakeLockManager::CancelWakeLock, + base::Unretained(this))); } - ~PowerSaveBlockerStubManager() { + ~FakeWakeLockManager() { PowerAPI::Get(browser_context_) - ->SetCreateBlockerFunctionForTesting(PowerAPI::CreateBlockerFunction()); + ->SetWakeLockFunctionsForTesting(PowerAPI::ActivateWakeLockFunction(), + PowerAPI::CancelWakeLockFunction()); } // Removes and returns the first item from |requests_|. Returns NONE if @@ -95,42 +71,67 @@ } private: - // Creates a new PowerSaveBlockerStub of type |type|. - std::unique_ptr<device::PowerSaveBlocker> CreateStub( - device::PowerSaveBlocker::PowerSaveBlockerType type, - device::PowerSaveBlocker::Reason reason, - const std::string& description, - scoped_refptr<base::SequencedTaskRunner> ui_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner) { - Request unblock_request = NONE; - switch (type) { - case device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension: - requests_.push_back(BLOCK_APP_SUSPENSION); - unblock_request = UNBLOCK_APP_SUSPENSION; - break; - case device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep: - requests_.push_back(BLOCK_DISPLAY_SLEEP); - unblock_request = UNBLOCK_DISPLAY_SLEEP; - break; + // Activates a new fake wake lock with type |type|. + void ActivateWakeLock(device::mojom::WakeLockType type) { + if (is_active_) { + if (type == type_) + return; + + // Has an active wake lock already, perform ChangeType: + switch (type) { + case device::mojom::WakeLockType::PreventAppSuspension: + requests_.push_back(BLOCK_APP_SUSPENSION); + requests_.push_back(UNBLOCK_DISPLAY_SLEEP); + break; + case device::mojom::WakeLockType::PreventDisplaySleep: + requests_.push_back(BLOCK_DISPLAY_SLEEP); + requests_.push_back(UNBLOCK_APP_SUSPENSION); + break; + } + + type_ = type; + return; } - return std::unique_ptr<device::PowerSaveBlocker>(new PowerSaveBlockerStub( - base::Bind(&PowerSaveBlockerStubManager::AppendRequest, - weak_ptr_factory_.GetWeakPtr(), unblock_request), - ui_task_runner, blocking_task_runner)); + + // Wake lock is not active, so activate it: + if (!is_active_) { + switch (type) { + case device::mojom::WakeLockType::PreventAppSuspension: + requests_.push_back(BLOCK_APP_SUSPENSION); + break; + case device::mojom::WakeLockType::PreventDisplaySleep: + requests_.push_back(BLOCK_DISPLAY_SLEEP); + break; + } + + type_ = type; + is_active_ = true; + } } - void AppendRequest(Request request) { - requests_.push_back(request); + void CancelWakeLock() { + if (!is_active_) + return; + switch (type_) { + case device::mojom::WakeLockType::PreventAppSuspension: + requests_.push_back(UNBLOCK_APP_SUSPENSION); + break; + case device::mojom::WakeLockType::PreventDisplaySleep: + requests_.push_back(UNBLOCK_DISPLAY_SLEEP); + break; + } + is_active_ = false; } content::BrowserContext* browser_context_; + device::mojom::WakeLockType type_; + bool is_active_; + // Requests in chronological order. std::deque<Request> requests_; - base::WeakPtrFactory<PowerSaveBlockerStubManager> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerStubManager); + DISALLOW_COPY_AND_ASSIGN(FakeWakeLockManager); }; } // namespace @@ -139,7 +140,7 @@ public: void SetUp() override { ApiUnitTest::SetUp(); - manager_.reset(new PowerSaveBlockerStubManager(browser_context())); + manager_.reset(new FakeWakeLockManager(browser_context())); } void TearDown() override { @@ -178,7 +179,7 @@ UnloadedExtensionReason::UNINSTALL); } - std::unique_ptr<PowerSaveBlockerStubManager> manager_; + std::unique_ptr<FakeWakeLockManager> manager_; }; TEST_F(PowerAPITest, RequestAndRelease) { @@ -264,20 +265,20 @@ EXPECT_EQ(NONE, manager_->PopFirstRequest()); // Create a second extension that blocks system suspend. No additional - // PowerSaveBlocker is needed; the blocker from the first extension + // wake lock is needed; the wake lock from the first extension // already covers the behavior requested by the second extension. scoped_refptr<Extension> extension2(test_util::CreateEmptyExtension("id2")); ASSERT_TRUE(CallFunction(REQUEST, kSystemArgs, extension2.get())); EXPECT_EQ(NONE, manager_->PopFirstRequest()); - // When the first extension is unloaded, a new app-suspension blocker - // should be created before the display-sleep blocker is destroyed. + // When the first extension is unloaded, a new app-suspension wake lock + // should be requested before the display-sleep wake lock is cancelled. UnloadExtension(extension()); EXPECT_EQ(BLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); EXPECT_EQ(UNBLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); EXPECT_EQ(NONE, manager_->PopFirstRequest()); - // Make the first extension block display-sleep again. + // Make the first extension request display-sleep wake lock again. ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
diff --git a/extensions/renderer/api_test_base.cc b/extensions/renderer/api_test_base.cc index b4f6342f..9f87585b 100644 --- a/extensions/renderer/api_test_base.cc +++ b/extensions/renderer/api_test_base.cc
@@ -222,6 +222,9 @@ FAIL() << "Failed to run test \"" << test_name << "\""; } }; + + ASSERT_FALSE( + env()->module_system()->Require("testBody").ToLocalChecked().IsEmpty()); env()->module_system()->CallModuleMethodSafe( "testBody", test_name, 0, nullptr, base::Bind(callback, &did_run, quit_closure, test_name));
diff --git a/extensions/renderer/bindings/api_bindings_system.cc b/extensions/renderer/bindings/api_bindings_system.cc index f3b0790..8279b48 100644 --- a/extensions/renderer/bindings/api_bindings_system.cc +++ b/extensions/renderer/bindings/api_bindings_system.cc
@@ -90,7 +90,7 @@ std::string api_name = type_name.substr(0, dot); // If we've already instantiated the binding, the type should have been in // there. - DCHECK(api_bindings_.find(api_name) == api_bindings_.end()); + DCHECK(api_bindings_.find(api_name) == api_bindings_.end()) << api_name; api_bindings_[api_name] = CreateNewAPIBinding(api_name); }
diff --git a/extensions/renderer/bindings/api_signature.cc b/extensions/renderer/bindings/api_signature.cc index 5c2eb5f..9b4f775 100644 --- a/extensions/renderer/bindings/api_signature.cc +++ b/extensions/renderer/bindings/api_signature.cc
@@ -210,8 +210,7 @@ return true; } - if (!spec.ParseArgument(context_, value, type_refs_, GetBuffer(), - &parse_error_)) { + if (!spec.IsCorrectType(value, type_refs_, &parse_error_)) { if (!spec.optional()) { *error_ = api_errors::ArgumentError(spec.name(), parse_error_); return false; @@ -221,6 +220,12 @@ return true; } + if (!spec.ParseArgument(context_, value, type_refs_, GetBuffer(), + &parse_error_)) { + *error_ = api_errors::ArgumentError(spec.name(), parse_error_); + return false; + } + ConsumeArgument(); AddParsedArgument(value); return true;
diff --git a/extensions/renderer/bindings/api_signature_unittest.cc b/extensions/renderer/bindings/api_signature_unittest.cc index 03b152e0..eaa7180 100644 --- a/extensions/renderer/bindings/api_signature_unittest.cc +++ b/extensions/renderer/bindings/api_signature_unittest.cc
@@ -123,6 +123,21 @@ return base::MakeUnique<APISignature>(std::move(specs)); } +std::unique_ptr<APISignature> OptionalObjectAndCallback() { + SpecVector specs; + specs.push_back( + ArgumentSpecBuilder(ArgumentType::OBJECT, "obj") + .AddProperty( + "prop1", + ArgumentSpecBuilder(ArgumentType::INTEGER).MakeOptional().Build()) + .MakeOptional() + .Build()); + specs.push_back(ArgumentSpecBuilder(ArgumentType::FUNCTION, "callback") + .MakeOptional() + .Build()); + return base::MakeUnique<APISignature>(std::move(specs)); +} + } // namespace class APISignatureTest : public APIBindingTest { @@ -302,6 +317,21 @@ ArgumentError("any", UnserializableValue())); ExpectFailure(*signature, "[4]", MissingRequiredArgument("any")); } + + { + auto signature = OptionalObjectAndCallback(); + ExpectPass(*signature, "[{prop1: 1}]", "[{'prop1':1}]", false); + ExpectPass(*signature, "[]", "[null]", false); + ExpectPass(*signature, "[null]", "[null]", false); + ExpectFailure( + *signature, "[{prop1: 'str'}]", + ArgumentError("obj", PropertyError("prop1", InvalidType(kTypeInteger, + kTypeString)))); + ExpectFailure( + *signature, "[{prop1: 'str'}, function() {}]", + ArgumentError("obj", PropertyError("prop1", InvalidType(kTypeInteger, + kTypeString)))); + } } TEST_F(APISignatureTest, TypeRefsTest) {
diff --git a/extensions/renderer/bindings/argument_spec.cc b/extensions/renderer/bindings/argument_spec.cc index cd105bf..d97263da 100644 --- a/extensions/renderer/bindings/argument_spec.cc +++ b/extensions/renderer/bindings/argument_spec.cc
@@ -166,10 +166,6 @@ // Additional properties are always optional. additional_properties_->optional_ = true; } - std::string instance_of; - if (dict->GetString("isInstanceOf", &instance_of)) { - instance_of_ = instance_of; - } } else if (type_ == ArgumentType::LIST) { const base::DictionaryValue* item_value = nullptr; CHECK(dict->GetDictionary("items", &item_value)); @@ -201,80 +197,132 @@ // API), but it could potentially make sense for lists or functions as well. if (type_ == ArgumentType::OBJECT || type_ == ArgumentType::ANY) dict->GetBoolean("preserveNull", &preserve_null_); + + if (type_ == ArgumentType::OBJECT || type_ == ArgumentType::BINARY) { + std::string instance_of; + if (dict->GetString("isInstanceOf", &instance_of)) + instance_of_ = instance_of; + } } ArgumentSpec::~ArgumentSpec() {} +bool ArgumentSpec::IsCorrectType(v8::Local<v8::Value> value, + const APITypeReferenceMap& refs, + std::string* error) const { + bool is_valid_type = false; + + switch (type_) { + case ArgumentType::INTEGER: + is_valid_type = value->IsInt32(); + break; + case ArgumentType::DOUBLE: + is_valid_type = value->IsNumber(); + break; + case ArgumentType::BOOLEAN: + is_valid_type = value->IsBoolean(); + break; + case ArgumentType::STRING: + is_valid_type = value->IsString(); + break; + case ArgumentType::OBJECT: + // Don't allow functions or arrays (even though they are technically + // objects). This is to make it easier to match otherwise-ambiguous + // signatures. For instance, if an API method has an optional object + // parameter and then an optional callback, we wouldn't necessarily be + // able to match the arguments if we allowed functions as objects. + // TODO(devlin): What about other subclasses of Object, like Map and Set? + is_valid_type = + value->IsObject() && !value->IsFunction() && !value->IsArray(); + break; + case ArgumentType::LIST: + is_valid_type = value->IsArray(); + break; + case ArgumentType::BINARY: + is_valid_type = value->IsArrayBuffer() || value->IsArrayBufferView(); + break; + case ArgumentType::FUNCTION: + is_valid_type = value->IsFunction(); + break; + case ArgumentType::ANY: + is_valid_type = true; + break; + case ArgumentType::REF: { + DCHECK(ref_); + const ArgumentSpec* reference = refs.GetSpec(ref_.value()); + DCHECK(reference) << ref_.value(); + is_valid_type = reference->IsCorrectType(value, refs, error); + break; + } + case ArgumentType::CHOICES: + for (const auto& choice : choices_) { + if (choice->IsCorrectType(value, refs, error)) { + is_valid_type = true; + break; + } + } + break; + } + + if (!is_valid_type) + *error = GetInvalidTypeError(value); + return is_valid_type; +} + bool ArgumentSpec::ParseArgument(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const APITypeReferenceMap& refs, std::unique_ptr<base::Value>* out_value, std::string* error) const { - if (type_ == ArgumentType::FUNCTION) { - if (!value->IsFunction()) { - *error = GetInvalidTypeError(value); - return false; - } - - if (out_value) { - // Certain APIs (contextMenus) have functions as parameters other than the - // callback (contextMenus uses it for an onclick listener). Our generated - // types have adapted to consider functions "objects" and serialize them - // as dictionaries. - // TODO(devlin): It'd be awfully nice to get rid of this eccentricity. - *out_value = base::MakeUnique<base::DictionaryValue>(); - } - return true; - } - - if (type_ == ArgumentType::REF) { - DCHECK(ref_); - const ArgumentSpec* reference = refs.GetSpec(ref_.value()); - DCHECK(reference) << ref_.value(); - return reference->ParseArgument(context, value, refs, out_value, error); - } - - if (type_ == ArgumentType::CHOICES) { - for (const auto& choice : choices_) { - if (choice->ParseArgument(context, value, refs, out_value, error)) - return true; - } - *error = api_errors::InvalidChoice(); + // Note: for top-level arguments (i.e., those passed directly to the function, + // as opposed to a property on an object, or the item of an array), we will + // have already checked the type. Doing so again should be nearly free, but + // if we do find this to be an issue, we could avoid the second call. + if (!IsCorrectType(value, refs, error)) return false; + + switch (type_) { + case ArgumentType::INTEGER: + case ArgumentType::DOUBLE: + case ArgumentType::BOOLEAN: + case ArgumentType::STRING: + return ParseArgumentToFundamental(context, value, out_value, error); + case ArgumentType::OBJECT: + return ParseArgumentToObject(context, value.As<v8::Object>(), refs, + out_value, error); + case ArgumentType::LIST: + return ParseArgumentToArray(context, value.As<v8::Array>(), refs, + out_value, error); + case ArgumentType::BINARY: + return ParseArgumentToAny(context, value, out_value, error); + case ArgumentType::FUNCTION: + if (out_value) { + // Certain APIs (contextMenus) have functions as parameters other than + // the callback (contextMenus uses it for an onclick listener). Our + // generated types have adapted to consider functions "objects" and + // serialize them as dictionaries. + // TODO(devlin): It'd be awfully nice to get rid of this eccentricity. + *out_value = base::MakeUnique<base::DictionaryValue>(); + } + return true; + case ArgumentType::REF: { + DCHECK(ref_); + const ArgumentSpec* reference = refs.GetSpec(ref_.value()); + DCHECK(reference) << ref_.value(); + return reference->ParseArgument(context, value, refs, out_value, error); + } + case ArgumentType::CHOICES: { + for (const auto& choice : choices_) { + if (choice->ParseArgument(context, value, refs, out_value, error)) + return true; + } + *error = api_errors::InvalidChoice(); + return false; + } + case ArgumentType::ANY: + return ParseArgumentToAny(context, value, out_value, error); } - if (IsFundamentalType()) - return ParseArgumentToFundamental(context, value, out_value, error); - if (type_ == ArgumentType::OBJECT) { - // Don't allow functions or arrays (even though they are technically - // objects). This is to make it easier to match otherwise-ambiguous - // signatures. For instance, if an API method has an optional object - // parameter and then an optional callback, we wouldn't necessarily be able - // to match the arguments if we allowed functions as objects. - if (!value->IsObject() || value->IsFunction() || value->IsArray()) { - *error = GetInvalidTypeError(value); - return false; - } - v8::Local<v8::Object> object = value.As<v8::Object>(); - return ParseArgumentToObject(context, object, refs, out_value, error); - } - if (type_ == ArgumentType::LIST) { - if (!value->IsArray()) { - *error = GetInvalidTypeError(value); - return false; - } - v8::Local<v8::Array> array = value.As<v8::Array>(); - return ParseArgumentToArray(context, array, refs, out_value, error); - } - if (type_ == ArgumentType::BINARY) { - if (!value->IsArrayBuffer() && !value->IsArrayBufferView()) { - *error = GetInvalidTypeError(value); - return false; - } - return ParseArgumentToAny(context, value, out_value, error); - } - if (type_ == ArgumentType::ANY) - return ParseArgumentToAny(context, value, out_value, error); NOTREACHED(); return false; } @@ -328,24 +376,14 @@ return type_name_; } -bool ArgumentSpec::IsFundamentalType() const { - return type_ == ArgumentType::INTEGER || type_ == ArgumentType::DOUBLE || - type_ == ArgumentType::BOOLEAN || type_ == ArgumentType::STRING; -} - bool ArgumentSpec::ParseArgumentToFundamental( v8::Local<v8::Context> context, v8::Local<v8::Value> value, std::unique_ptr<base::Value>* out_value, std::string* error) const { - DCHECK(IsFundamentalType()); - switch (type_) { case ArgumentType::INTEGER: { - if (!value->IsInt32()) { - *error = GetInvalidTypeError(value); - return false; - } + DCHECK(value->IsInt32()); int int_val = value.As<v8::Int32>()->Value(); if (!CheckFundamentalBounds(int_val, minimum_, maximum_, error)) return false; @@ -354,10 +392,7 @@ return true; } case ArgumentType::DOUBLE: { - if (!value->IsNumber()) { - *error = GetInvalidTypeError(value); - return false; - } + DCHECK(value->IsNumber()); double double_val = value.As<v8::Number>()->Value(); if (!CheckFundamentalBounds(double_val, minimum_, maximum_, error)) return false; @@ -366,10 +401,7 @@ return true; } case ArgumentType::STRING: { - if (!value->IsString()) { - *error = GetInvalidTypeError(value); - return false; - } + DCHECK(value->IsString()); v8::Local<v8::String> v8_string = value.As<v8::String>(); size_t length = static_cast<size_t>(v8_string->Length()); @@ -404,10 +436,7 @@ return true; } case ArgumentType::BOOLEAN: { - if (!value->IsBoolean()) { - *error = GetInvalidTypeError(value); - return false; - } + DCHECK(value->IsBoolean()); if (out_value) { *out_value = base::MakeUnique<base::Value>(value.As<v8::Boolean>()->Value());
diff --git a/extensions/renderer/bindings/argument_spec.h b/extensions/renderer/bindings/argument_spec.h index 4425568..3f33256 100644 --- a/extensions/renderer/bindings/argument_spec.h +++ b/extensions/renderer/bindings/argument_spec.h
@@ -50,6 +50,12 @@ explicit ArgumentSpec(ArgumentType type); ~ArgumentSpec(); + // Returns true if the given |value| is of the correct type to match this + // spec. If it is not, populates |error|. + bool IsCorrectType(v8::Local<v8::Value> value, + const APITypeReferenceMap& refs, + std::string* error) const; + // Returns true if the passed |value| matches this specification. If // |out_value| is non-null, converts the value to a base::Value and populates // |out_value|. Otherwise, no conversion is performed. @@ -93,9 +99,6 @@ // Initializes this object according to |type_string| and |dict|. void InitializeType(const base::DictionaryValue* dict); - // Returns true if this argument refers to a fundamental type. - bool IsFundamentalType() const; - // Conversion functions. These should only be used if the spec is of the given // type (otherwise, they will DCHECK). bool ParseArgumentToFundamental(v8::Local<v8::Context> context,
diff --git a/extensions/renderer/bindings/argument_spec_unittest.cc b/extensions/renderer/bindings/argument_spec_unittest.cc index 85a0a70..a12b487 100644 --- a/extensions/renderer/bindings/argument_spec_unittest.cc +++ b/extensions/renderer/bindings/argument_spec_unittest.cc
@@ -483,7 +483,8 @@ ArgumentSpec spec(*ValueFromString(kSimpleChoices)); ExpectSuccess(spec, "'alpha'", "'alpha'"); ExpectSuccess(spec, "42", "42"); - ExpectFailure(spec, "true", InvalidChoice()); + const char kChoicesType[] = "[string|integer]"; + ExpectFailure(spec, "true", InvalidType(kChoicesType, kTypeBoolean)); } { @@ -498,9 +499,11 @@ ExpectSuccess(spec, "['alpha']", "['alpha']"); ExpectSuccess(spec, "['alpha', 'beta']", "['alpha','beta']"); ExpectSuccess(spec, "({prop1: 'alpha'})", "{'prop1':'alpha'}"); + + const char kChoicesType[] = "[array|object]"; ExpectFailure(spec, "({prop1: 1})", InvalidChoice()); - ExpectFailure(spec, "'alpha'", InvalidChoice()); - ExpectFailure(spec, "42", InvalidChoice()); + ExpectFailure(spec, "'alpha'", InvalidType(kChoicesType, kTypeString)); + ExpectFailure(spec, "42", InvalidType(kChoicesType, kTypeInteger)); } }
diff --git a/extensions/renderer/json_schema_unittest.cc b/extensions/renderer/json_schema_unittest.cc index 789ec96..f36c0c5 100644 --- a/extensions/renderer/json_schema_unittest.cc +++ b/extensions/renderer/json_schema_unittest.cc
@@ -25,6 +25,15 @@ protected: void TestFunction(const std::string& test_name) { + { + ModuleSystem::NativesEnabledScope natives_enabled_scope( + env()->module_system()); + ASSERT_FALSE(env() + ->module_system() + ->Require("json_schema_test") + .ToLocalChecked() + .IsEmpty()); + } env()->module_system()->CallModuleMethodSafe("json_schema_test", test_name); }
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc index 2349218a..07ec45a 100644 --- a/extensions/renderer/module_system.cc +++ b/extensions/renderer/module_system.cc
@@ -239,8 +239,8 @@ if (!ToV8String(GetIsolate(), module_name, &v8_module_name)) return v8::MaybeLocal<v8::Object>(); v8::EscapableHandleScope handle_scope(GetIsolate()); - v8::Local<v8::Value> value = RequireForJsInner( - v8_module_name); + v8::Local<v8::Value> value = + RequireForJsInner(v8_module_name, true /* create */); if (value.IsEmpty() || !value->IsObject()) return v8::MaybeLocal<v8::Object>(); return handle_scope.Escape(value.As<v8::Object>()); @@ -253,11 +253,12 @@ return; } v8::Local<v8::String> module_name = args[0].As<v8::String>(); - args.GetReturnValue().Set(RequireForJsInner(module_name)); + args.GetReturnValue().Set(RequireForJsInner(module_name, true /* create */)); } v8::Local<v8::Value> ModuleSystem::RequireForJsInner( - v8::Local<v8::String> module_name) { + v8::Local<v8::String> module_name, + bool create) { v8::EscapableHandleScope handle_scope(GetIsolate()); v8::Local<v8::Context> v8_context = context()->v8_context(); v8::Context::Scope context_scope(v8_context); @@ -280,6 +281,9 @@ !exports->IsUndefined()) return handle_scope.Escape(exports); + if (!create) + return v8::Undefined(GetIsolate()); + exports = LoadModule(*v8::String::Utf8Value(module_name)); SetPrivateProperty(v8_context, modules, module_name, exports); return handle_scope.Escape(exports); @@ -325,7 +329,12 @@ v8::Local<v8::Function> function = GetModuleFunction(module_name, method_name); if (function.IsEmpty()) { - NOTREACHED() << "GetModuleFunction() returns empty function handle"; + // This can legitimately happen when the module hasn't been loaded in the + // context (since GetModuleFunction() does not load an unloaded module). + // Typically, we won't do this, but we can in the case of, e.g., dispatching + // events (where we'll try to dispatch to each context in a process). In + // these cases, though, we can know that there are no listeners registered, + // since the event module hasn't been loaded. return; } @@ -601,7 +610,7 @@ if (overridden_native_handlers_.count(native_name) > 0u) { v8::Local<v8::Value> value = RequireForJsInner( - ToV8StringUnsafe(GetIsolate(), native_name.c_str())); + ToV8StringUnsafe(GetIsolate(), native_name.c_str()), true /* create */); if (value.IsEmpty() || !value->IsObject()) return v8::MaybeLocal<v8::Object>(); return value.As<v8::Object>(); @@ -858,22 +867,28 @@ const std::string& method_name) { v8::Local<v8::String> v8_module_name; v8::Local<v8::String> v8_method_name; - v8::Local<v8::Function> function; if (!ToV8String(GetIsolate(), module_name.c_str(), &v8_module_name) || !ToV8String(GetIsolate(), method_name.c_str(), &v8_method_name)) { - return function; + return v8::Local<v8::Function>(); } v8::Local<v8::Value> module; - { - NativesEnabledScope natives_enabled(this); - module = RequireForJsInner(v8_module_name); - } + // Important: don't create the module if it doesn't exist. Doing so would + // force a call into JS, which is something we want to avoid in case it has + // been suspended. Additionally, we should only be calling module methods for + // modules that have been instantiated. + bool create = false; + module = RequireForJsInner(v8_module_name, create); + + // RequireForJsInner() returns Undefined in the case of a module not being + // loaded, since we don't create it here. + if (!module.IsEmpty() && module->IsUndefined()) + return v8::Local<v8::Function>(); if (module.IsEmpty() || !module->IsObject()) { Fatal(context_, "Failed to get module " + module_name + " to call " + method_name); - return function; + return v8::Local<v8::Function>(); } v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(module); @@ -881,11 +896,10 @@ if (!GetProperty(context()->v8_context(), object, v8_method_name, &value) || !value->IsFunction()) { Fatal(context_, module_name + "." + method_name + " is not a function"); - return function; + return v8::Local<v8::Function>(); } - function = v8::Local<v8::Function>::Cast(value); - return function; + return v8::Local<v8::Function>::Cast(value); } } // namespace extensions
diff --git a/extensions/renderer/module_system.h b/extensions/renderer/module_system.h index 977be61..b75a9e77 100644 --- a/extensions/renderer/module_system.h +++ b/extensions/renderer/module_system.h
@@ -183,7 +183,12 @@ void HandleException(const v8::TryCatch& try_catch); void RequireForJs(const v8::FunctionCallbackInfo<v8::Value>& args); - v8::Local<v8::Value> RequireForJsInner(v8::Local<v8::String> module_name); + + // Returns the module with the given |module_name|. If |create| is true, the + // module will be loaded if it hasn't been already. Otherwise, the module + // will only be returned if it has already been loaded. + v8::Local<v8::Value> RequireForJsInner(v8::Local<v8::String> module_name, + bool create); typedef v8::MaybeLocal<v8::Object>(ModuleSystem::*RequireFunction)( const std::string&); @@ -237,6 +242,7 @@ void ClobberExistingNativeHandler(const std::string& name); // Returns the v8::Function associated with the given module and method name. + // This will *not* load a module if it hasn't been loaded already. v8::Local<v8::Function> GetModuleFunction(const std::string& module_name, const std::string& method_name);
diff --git a/extensions/renderer/utils_unittest.cc b/extensions/renderer/utils_unittest.cc index 31f856b..53f07faf 100644 --- a/extensions/renderer/utils_unittest.cc +++ b/extensions/renderer/utils_unittest.cc
@@ -11,7 +11,7 @@ namespace { class UtilsUnittest : public ModuleSystemTest { - private: + public: void SetUp() override { ModuleSystemTest::SetUp(); @@ -29,6 +29,26 @@ gin::Dictionary::CreateEmpty(env()->isolate())); chrome.Set("runtime", chrome_runtime); } + + void RunTest(const std::string& test_name) { RunTestImpl(test_name, false); } + + void RunTestWithPromises(const std::string& test_name) { + RunTestImpl(test_name, true); + } + + private: + void RunTestImpl(const std::string& test_name, bool run_promises) { + ModuleSystem::NativesEnabledScope natives_enabled_scope( + env()->module_system()); + ASSERT_FALSE(env() + ->module_system() + ->Require("utils_unittest") + .ToLocalChecked() + .IsEmpty()); + env()->module_system()->CallModuleMethodSafe("utils_unittest", test_name); + if (run_promises) + RunResolvedPromises(); + } }; TEST_F(UtilsUnittest, TestNothing) { @@ -36,42 +56,23 @@ } TEST_F(UtilsUnittest, SuperClass) { - ModuleSystem::NativesEnabledScope natives_enabled_scope( - env()->module_system()); - env()->module_system()->CallModuleMethodSafe("utils_unittest", - "testSuperClass"); + RunTest("testSuperClass"); } TEST_F(UtilsUnittest, PromiseNoResult) { - ModuleSystem::NativesEnabledScope natives_enabled_scope( - env()->module_system()); - env()->module_system()->CallModuleMethodSafe("utils_unittest", - "testPromiseNoResult"); - RunResolvedPromises(); + RunTestWithPromises("testPromiseNoResult"); } TEST_F(UtilsUnittest, PromiseOneResult) { - ModuleSystem::NativesEnabledScope natives_enabled_scope( - env()->module_system()); - env()->module_system()->CallModuleMethodSafe("utils_unittest", - "testPromiseOneResult"); - RunResolvedPromises(); + RunTestWithPromises("testPromiseOneResult"); } TEST_F(UtilsUnittest, PromiseTwoResults) { - ModuleSystem::NativesEnabledScope natives_enabled_scope( - env()->module_system()); - env()->module_system()->CallModuleMethodSafe("utils_unittest", - "testPromiseTwoResults"); - RunResolvedPromises(); + RunTestWithPromises("testPromiseTwoResults"); } TEST_F(UtilsUnittest, PromiseError) { - ModuleSystem::NativesEnabledScope natives_enabled_scope( - env()->module_system()); - env()->module_system()->CallModuleMethodSafe("utils_unittest", - "testPromiseError"); - RunResolvedPromises(); + RunTestWithPromises("testPromiseError"); } } // namespace
diff --git a/extensions/renderer/v8_schema_registry.cc b/extensions/renderer/v8_schema_registry.cc index 87117f6..bdb9536d 100644 --- a/extensions/renderer/v8_schema_registry.cc +++ b/extensions/renderer/v8_schema_registry.cc
@@ -67,7 +67,7 @@ std::string type; if (args[0]->IsArray()) type = "array"; - else if (args[0]->IsArrayBuffer()) + else if (args[0]->IsArrayBuffer() || args[0]->IsArrayBufferView()) type = "binary"; else type = "object";
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index adb9ea1..bec0f90 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -126,12 +126,9 @@ void ShellContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
diff --git a/extensions/shell/browser/shell_content_browser_client.h b/extensions/shell/browser/shell_content_browser_client.h index 2effd2a..a0ec248 100644 --- a/extensions/shell/browser/shell_content_browser_client.h +++ b/extensions/shell/browser/shell_content_browser_client.h
@@ -46,7 +46,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; bool IsHandledURL(const GURL& url) override; void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json index db82d19..d7fcf69 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json
@@ -1,6 +1,6 @@ { "name": "gpu driver bug list", - "version": "10.15", + "version": "10.16", "entries": [ { "id": 1, @@ -2524,6 +2524,18 @@ "features": [ "disable_delayed_copy_nv12" ] + }, + { + "id": 234, + "description": "Disable EGL_EXT_image_flush_external on NVIDIA", + "cr_bugs": [727462], + "os": { + "type": "chromeos" + }, + "gl_vendor": "NVIDIA.*", + "disabled_extensions": [ + "EGL_EXT_image_flush_external" + ] } ], "comment": [
diff --git a/headless/lib/browser/headless_content_browser_client.cc b/headless/lib/browser/headless_content_browser_client.cc index 943026d..2f2cc780 100644 --- a/headless/lib/browser/headless_content_browser_client.cc +++ b/headless/lib/browser/headless_content_browser_client.cc
@@ -13,9 +13,7 @@ #include "base/json/json_reader.h" #include "base/memory/ptr_util.h" #include "base/path_service.h" -#include "base/task_scheduler/post_task.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_dispatcher_host.h" @@ -183,12 +181,9 @@ void HeadlessContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } #if defined(OS_POSIX) && !defined(OS_MACOSX)
diff --git a/headless/lib/browser/headless_content_browser_client.h b/headless/lib/browser/headless_content_browser_client.h index 78c14df..7bb377f 100644 --- a/headless/lib/browser/headless_content_browser_client.h +++ b/headless/lib/browser/headless_content_browser_client.h
@@ -28,7 +28,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; #if defined(OS_POSIX) && !defined(OS_MACOSX) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line,
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm index 0ae98530..db2e038c 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
@@ -430,12 +430,19 @@ SwitchToNormalMode(); + // Turn off synchronization of GREYAssert to test the pending states. + [[GREYConfiguration sharedInstance] + setValue:@(NO) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; GREYAssert( [[GREYCondition conditionWithName:@"Wait for tab to restart loading." block:^BOOL() { return chrome_test_util::IsLoading(); }] waitWithTimeout:kWaitElementTimeout], @"Tab did not start loading."); + [[GREYConfiguration sharedInstance] + setValue:@(YES) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; // This method is not synced on EarlGrey. chrome_test_util::SelectTabAtIndexInCurrentMode(0);
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_test_util.mm b/ios/chrome/browser/metrics/tab_usage_recorder_test_util.mm index cc29e2f..2c15bd4c 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder_test_util.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder_test_util.mm
@@ -83,12 +83,21 @@ [[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()] performAction:grey_tap()]; } + + // Turn off synchronization of GREYAssert to test the pending states. + [[GREYConfiguration sharedInstance] + setValue:@(NO) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; ConditionBlock condition = ^bool { return !chrome_test_util::IsIncognitoMode(); }; GREYAssert( testing::WaitUntilConditionOrTimeout(kWaitElementTimeout, condition), @"Waiting switch to normal mode."); + + [[GREYConfiguration sharedInstance] + setValue:@(YES) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; } } // namespace tab_usage_recorder_test_util
diff --git a/ios/chrome/browser/ui/settings/BUILD.gn b/ios/chrome/browser/ui/settings/BUILD.gn index 3dd812c5..7635b63 100644 --- a/ios/chrome/browser/ui/settings/BUILD.gn +++ b/ios/chrome/browser/ui/settings/BUILD.gn
@@ -376,6 +376,7 @@ "//ios/chrome/test/app:test_support", "//ios/chrome/test/earl_grey:test_support", "//ios/public/provider/chrome/browser/signin:test_support", + "//ios/testing:ios_test_support", "//ios/testing/earl_grey:earl_grey_support", "//ios/third_party/earl_grey", "//ios/web",
diff --git a/ios/chrome/browser/ui/settings/settings_egtest.mm b/ios/chrome/browser/ui/settings/settings_egtest.mm index bf4a1fe..8c9bce1 100644 --- a/ios/chrome/browser/ui/settings/settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/settings_egtest.mm
@@ -39,6 +39,7 @@ #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h" +#import "ios/testing/wait_util.h" #import "ios/web/public/test/http_server/http_server.h" #include "ios/web/public/test/http_server/http_server_util.h" #import "ios/web/public/test/web_view_interaction_test_util.h" @@ -436,6 +437,18 @@ // Login to page and click to save password and check that its saved. [ChromeEarlGrey loadURL:URL]; chrome_test_util::TapWebViewElementWithId("Login"); + + GREYCondition* condition = [GREYCondition + conditionWithName:@"Wait for save button" + block:^BOOL { + NSError* error = nil; + [[EarlGrey selectElementWithMatcher:SavePasswordButton()] + assertWithMatcher:grey_notNil() + error:&error]; + return !error; + }]; + GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout], + @"Failed waiting for save button"); [[EarlGrey selectElementWithMatcher:SavePasswordButton()] performAction:grey_tap()]; }
diff --git a/ios/chrome/browser/web/browsing_egtest.mm b/ios/chrome/browser/web/browsing_egtest.mm index ac51f9bc..e35c430 100644 --- a/ios/chrome/browser/web/browsing_egtest.mm +++ b/ios/chrome/browser/web/browsing_egtest.mm
@@ -131,11 +131,6 @@ notPartOfOmnibox, nil); } -// Matcher for a Go button that is interactable. -id<GREYMatcher> GoButtonMatcher() { - return grey_allOf(grey_accessibilityID(@"Go"), grey_interactable(), nil); -} - // Tests that page successfully reloads. - (void)testReload { // Set up test HTTP server responses. @@ -374,31 +369,11 @@ [[EarlGrey selectElementWithMatcher:OmniboxText(destURL.GetContent())] assertWithMatcher:grey_notNil()]; - [self goBack]; + [ChromeEarlGrey goBack]; [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] assertWithMatcher:grey_notNil()]; } -// TODO(crbug.com/638674): Evaluate if this can move to shared code -// Navigates back to the previous webpage. -- (void)goBack { - GenericChromeCommand* backCommand = - [[GenericChromeCommand alloc] initWithTag:IDC_BACK]; - chrome_test_util::RunCommandWithActiveViewController(backCommand); - - [ChromeEarlGrey waitForPageToFinishLoading]; -} - -// Navigates forward to a previous webpage. -// TODO(crbug.com/638674): Evaluate if this can move to shared code -- (void)goForward { - GenericChromeCommand* forwardCommand = - [[GenericChromeCommand alloc] initWithTag:IDC_FORWARD]; - chrome_test_util::RunCommandWithActiveViewController(forwardCommand); - - [ChromeEarlGrey waitForPageToFinishLoading]; -} - // Tests that a link with WebUI URL does not trigger a load. WebUI pages may // have increased power and using the same web process (which may potentially // be controlled by an attacker) is dangerous. @@ -435,48 +410,6 @@ chrome_test_util::AssertMainTabCount(1U); } -// Tests that pressing the button on a POST-based form with same-page action -// does not change the page and that the back button works as expected -// afterwards. -- (void)testBrowsingPostToSamePage { -// TODO(crbug.com/714303): Re-enable this test on devices. -#if !TARGET_IPHONE_SIMULATOR - EARL_GREY_TEST_DISABLED(@"Test disabled on device."); -#endif - - // Create map of canned responses and set up the test HTML server. - std::map<GURL, std::string> responses; - const GURL firstURL = web::test::HttpServer::MakeUrl("http://first"); - const GURL formURL = web::test::HttpServer::MakeUrl("http://form"); - // This is just a page with some text. - responses[firstURL] = "foo"; - // This is a page with at button that posts to the current URL. - responses[formURL] = - "<form method='post'>" - "<input value='button' type='submit' id='button'></form>"; - web::test::SetUpSimpleHttpServer(responses); - - // Open the first URL so it's in history. - [ChromeEarlGrey loadURL:firstURL]; - - // Open the second URL, tap the button, and verify the browser navigates to - // the expected URL. - [ChromeEarlGrey loadURL:formURL]; - chrome_test_util::TapWebViewElementWithId("button"); - [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] - assertWithMatcher:grey_notNil()]; - - // Go back once and verify the browser navigates to the form URL. - [self goBack]; - [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] - assertWithMatcher:grey_notNil()]; - - // Go back a second time and verify the browser navigates to the first URL. - [self goBack]; - [[EarlGrey selectElementWithMatcher:OmniboxText(firstURL.GetContent())] - assertWithMatcher:grey_notNil()]; -} - // Tests that evaluating user JavaScript that causes navigation correctly // modifies history. - (void)testBrowsingUserJavaScriptNavigation { @@ -509,7 +442,7 @@ [[EarlGrey selectElementWithMatcher:OmniboxText(targetURL.GetContent())] assertWithMatcher:grey_notNil()]; - [self goBack]; + [ChromeEarlGrey goBack]; [[EarlGrey selectElementWithMatcher:OmniboxText(startURL.GetContent())] assertWithMatcher:grey_notNil()]; } @@ -544,108 +477,12 @@ // Verify that the JavaScript did not affect history by going back and then // forward again. - [self goBack]; + [ChromeEarlGrey goBack]; [[EarlGrey selectElementWithMatcher:OmniboxText(firstURL.GetContent())] assertWithMatcher:grey_notNil()]; - [self goForward]; + [ChromeEarlGrey goForward]; [[EarlGrey selectElementWithMatcher:OmniboxText(secondURL.GetContent())] assertWithMatcher:grey_notNil()]; } -// Tap the text field indicated by |ID| to open the keyboard, and then -// press the keyboard's "Go" button to submit the form. -- (void)submitFormUsingKeyboardGoButtonWithInputID:(const std::string&)ID { - // Disable EarlGrey's synchronization since it is blocked by opening the - // keyboard from a web view. - [[GREYConfiguration sharedInstance] - setValue:@NO - forConfigKey:kGREYConfigKeySynchronizationEnabled]; - - // Wait for web view to be interactable before tapping. - GREYCondition* interactableCondition = [GREYCondition - conditionWithName:@"Wait for web view to be interactable." - block:^BOOL { - NSError* error = nil; - id<GREYMatcher> webViewMatcher = WebViewInWebState( - chrome_test_util::GetCurrentWebState()); - [[EarlGrey selectElementWithMatcher:webViewMatcher] - assertWithMatcher:grey_interactable() - error:&error]; - return !error; - }]; - GREYAssert( - [interactableCondition waitWithTimeout:testing::kWaitForUIElementTimeout], - @"Web view did not become interactable."); - - web::WebState* currentWebState = chrome_test_util::GetCurrentWebState(); - [[EarlGrey selectElementWithMatcher:web::WebViewInWebState(currentWebState)] - performAction:web::WebViewTapElement(currentWebState, ID)]; - - // Wait until the keyboard shows up before tapping. - GREYCondition* condition = [GREYCondition - conditionWithName:@"Wait for the keyboard to show up." - block:^BOOL { - NSError* error = nil; - [[EarlGrey selectElementWithMatcher:GoButtonMatcher()] - assertWithMatcher:grey_notNil() - error:&error]; - return (error == nil); - }]; - GREYAssert([condition waitWithTimeout:10], - @"No keyboard with 'Go' button showed up."); - - [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] - performAction:grey_tap()]; - - // Reenable synchronization now that the keyboard has been closed. - [[GREYConfiguration sharedInstance] - setValue:@YES - forConfigKey:kGREYConfigKeySynchronizationEnabled]; -} - -// Tests that submitting a POST-based form by tapping the 'Go' button on the -// keyboard navigates to the correct URL and the back button works as expected -// afterwards. -// TODO(crbug.com/711108): Move test to forms_egtest.mm. -- (void)testBrowsingPostEntryWithKeyboard { -// TODO(crbug.com/704618): Re-enable this test on devices. -#if !TARGET_IPHONE_SIMULATOR - EARL_GREY_TEST_DISABLED(@"Test disabled on device."); -#endif - - // Create map of canned responses and set up the test HTML server. - std::map<GURL, std::string> responses; - const GURL URL = - web::test::HttpServer::MakeUrl("http://postEntryWithKeyboard"); - const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo"); - // This is a page this an input text field and a button that posts to the - // destination. - responses[URL] = base::StringPrintf( - "hello!" - "<form action='%s' method='post'>" - "<input value='textfield' id='textfield' type='text'></label>" - "<input type='submit'></form>", - destinationURL.spec().c_str()); - // This is the page that should be showing at the end of the test. - responses[destinationURL] = "baz!"; - web::test::SetUpSimpleHttpServer(responses); - - // Open the URL, focus the textfield,and submit via keyboard. - [ChromeEarlGrey loadURL:URL]; - [ChromeEarlGrey waitForWebViewContainingText:"hello!"]; - - [self submitFormUsingKeyboardGoButtonWithInputID:"textfield"]; - - // Verify that the browser navigates to the expected URL. - [ChromeEarlGrey waitForWebViewContainingText:"baz!"]; - [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] - assertWithMatcher:grey_notNil()]; - - // Go back and verify that the browser navigates to the original URL. - [self goBack]; - [ChromeEarlGrey waitForWebViewContainingText:"hello!"]; - [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] - assertWithMatcher:grey_notNil()]; -} - @end
diff --git a/ios/chrome/browser/web/forms_egtest.mm b/ios/chrome/browser/web/forms_egtest.mm index 4c712c5..00c468f 100644 --- a/ios/chrome/browser/web/forms_egtest.mm +++ b/ios/chrome/browser/web/forms_egtest.mm
@@ -17,6 +17,8 @@ #import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h" #import "ios/testing/wait_util.h" +#import "ios/web/public/test/earl_grey/web_view_actions.h" +#import "ios/web/public/test/earl_grey/web_view_matchers.h" #include "ios/web/public/test/http_server/data_response_provider.h" #import "ios/web/public/test/http_server/http_server.h" #include "ios/web/public/test/http_server/http_server_util.h" @@ -55,12 +57,17 @@ return web::test::HttpServer::MakeUrl("http://form"); } +// GURL of a page with a form that posts data to |GetDestinationUrl|. +const GURL GetFormPostOnSamePageUrl() { + return web::test::HttpServer::MakeUrl("http://form"); +} + // GURL of the page to which the |GetFormUrl| posts data to. const GURL GetDestinationUrl() { return web::test::HttpServer::MakeUrl("http://destination"); } -#pragma mark - TestFormRedirectResponseProvider +#pragma mark - TestFormResponseProvider // URL that redirects to |GetDestinationUrl| with a 302. const GURL GetRedirectUrl() { @@ -72,8 +79,8 @@ return web::test::HttpServer::MakeUrl("http://formRedirect"); } -// A ResponseProvider that provides html response or a redirect. -class TestFormRedirectResponseProvider : public web::DataResponseProvider { +// A ResponseProvider that provides html response, post response or a redirect. +class TestFormResponseProvider : public web::DataResponseProvider { public: // TestResponseProvider implementation. bool CanHandleRequest(const Request& request) override; @@ -83,14 +90,14 @@ std::string* response_body) override; }; -bool TestFormRedirectResponseProvider::CanHandleRequest( - const Request& request) { +bool TestFormResponseProvider::CanHandleRequest(const Request& request) { const GURL& url = request.url; return url == GetDestinationUrl() || url == GetRedirectUrl() || - url == GetRedirectFormUrl(); + url == GetRedirectFormUrl() || url == GetFormPostOnSamePageUrl() || + url == GetGenericUrl(); } -void TestFormRedirectResponseProvider::GetResponseHeadersAndBody( +void TestFormResponseProvider::GetResponseHeadersAndBody( const Request& request, scoped_refptr<net::HttpResponseHeaders>* headers, std::string* response_body) { @@ -102,6 +109,21 @@ } *headers = web::ResponseProvider::GetDefaultResponseHeaders(); + if (url == GetGenericUrl()) { + *response_body = "A generic page"; + return; + } + if (url == GetFormPostOnSamePageUrl()) { + if (request.method == "POST") { + *response_body = request.method + std::string(" ") + request.body; + } else { + *response_body = + "<form method='post'>" + "<input value='button' type='submit' id='button'></form>"; + } + return; + } + if (url == GetRedirectFormUrl()) { *response_body = base::StringPrintf(kFormHtmlTemplate, GetRedirectUrl().spec().c_str()); @@ -121,6 +143,11 @@ @implementation FormsTestCase +// Matcher for a Go button that is interactable. +id<GREYMatcher> GoButtonMatcher() { + return grey_allOf(grey_accessibilityID(@"Go"), grey_interactable(), nil); +} + // Waits for view with Tab History accessibility ID. - (void)waitForTabHistoryView { GREYCondition* condition = [GREYCondition @@ -327,8 +354,7 @@ // Tests that a POST followed by a redirect does not show the popup. - (void)testRepostFormCancellingAfterRedirect { - web::test::SetUpHttpServer( - base::MakeUnique<TestFormRedirectResponseProvider>()); + web::test::SetUpHttpServer(base::MakeUnique<TestFormResponseProvider>()); const GURL destinationURL = GetDestinationUrl(); [ChromeEarlGrey loadURL:GetRedirectFormUrl()]; @@ -355,4 +381,115 @@ assertWithMatcher:grey_notNil()]; } +// Tests that pressing the button on a POST-based form with same-page action +// does not change the page URL and that the back button works as expected +// afterwards. +- (void)testPostFormToSamePage { +// TODO(crbug.com/714303): Re-enable this test on devices. +#if !TARGET_IPHONE_SIMULATOR + EARL_GREY_TEST_DISABLED(@"Test disabled on device."); +#endif + + web::test::SetUpHttpServer(base::MakeUnique<TestFormResponseProvider>()); + const GURL formURL = GetFormPostOnSamePageUrl(); + + // Open the first URL so it's in history. + [ChromeEarlGrey loadURL:GetGenericUrl()]; + + // Open the second URL, tap the button, and verify the browser navigates to + // the expected URL. + [ChromeEarlGrey loadURL:formURL]; + chrome_test_util::TapWebViewElementWithId("button"); + [ChromeEarlGrey waitForWebViewContainingText:"POST"]; + [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] + assertWithMatcher:grey_notNil()]; + + // Go back once and verify the browser navigates to the form URL. + [ChromeEarlGrey goBack]; + [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] + assertWithMatcher:grey_notNil()]; + + // Go back a second time and verify the browser navigates to the first URL. + [ChromeEarlGrey goBack]; + [[EarlGrey selectElementWithMatcher:OmniboxText(GetGenericUrl().GetContent())] + assertWithMatcher:grey_notNil()]; +} + +// Tests that submitting a POST-based form by tapping the 'Go' button on the +// keyboard navigates to the correct URL and the back button works as expected +// afterwards. +- (void)testPostFormEntryWithKeyboard { +// TODO(crbug.com/704618): Re-enable this test on devices. +#if !TARGET_IPHONE_SIMULATOR + EARL_GREY_TEST_DISABLED(@"Test disabled on device."); +#endif + + [self setUpFormTestSimpleHttpServer]; + const GURL destinationURL = GetDestinationUrl(); + + [ChromeEarlGrey loadURL:GetFormUrl()]; + [self submitFormUsingKeyboardGoButtonWithInputID:"textfield"]; + + // Verify that the browser navigates to the expected URL. + [ChromeEarlGrey waitForWebViewContainingText:"bar!"]; + [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] + assertWithMatcher:grey_notNil()]; + + // Go back and verify that the browser navigates to the original URL. + [ChromeEarlGrey goBack]; + [[EarlGrey selectElementWithMatcher:OmniboxText(GetFormUrl().GetContent())] + assertWithMatcher:grey_notNil()]; +} + +// Tap the text field indicated by |ID| to open the keyboard, and then +// press the keyboard's "Go" button to submit the form. +- (void)submitFormUsingKeyboardGoButtonWithInputID:(const std::string&)ID { + // Disable EarlGrey's synchronization since it is blocked by opening the + // keyboard from a web view. + [[GREYConfiguration sharedInstance] + setValue:@NO + forConfigKey:kGREYConfigKeySynchronizationEnabled]; + + // Wait for web view to be interactable before tapping. + GREYCondition* interactableCondition = [GREYCondition + conditionWithName:@"Wait for web view to be interactable." + block:^BOOL { + NSError* error = nil; + id<GREYMatcher> webViewMatcher = WebViewInWebState( + chrome_test_util::GetCurrentWebState()); + [[EarlGrey selectElementWithMatcher:webViewMatcher] + assertWithMatcher:grey_interactable() + error:&error]; + return !error; + }]; + GREYAssert( + [interactableCondition waitWithTimeout:testing::kWaitForUIElementTimeout], + @"Web view did not become interactable."); + + web::WebState* currentWebState = chrome_test_util::GetCurrentWebState(); + [[EarlGrey selectElementWithMatcher:web::WebViewInWebState(currentWebState)] + performAction:web::WebViewTapElement(currentWebState, ID)]; + + // Wait until the keyboard shows up before tapping. + GREYCondition* condition = [GREYCondition + conditionWithName:@"Wait for the keyboard to show up." + block:^BOOL { + NSError* error = nil; + [[EarlGrey selectElementWithMatcher:GoButtonMatcher()] + assertWithMatcher:grey_notNil() + error:&error]; + return (error == nil); + }]; + GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout], + @"No keyboard with 'Go' button showed up."); + + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] + performAction:grey_tap()]; + + // Reenable synchronization now that the keyboard has been closed. + [[GREYConfiguration sharedInstance] + setValue:@YES + forConfigKey:kGREYConfigKeySynchronizationEnabled]; +} + @end
diff --git a/ios/chrome/browser/web/visible_url_egtest.mm b/ios/chrome/browser/web/visible_url_egtest.mm index 31ee7e8..c83999d 100644 --- a/ios/chrome/browser/web/visible_url_egtest.mm +++ b/ios/chrome/browser/web/visible_url_egtest.mm
@@ -230,6 +230,11 @@ PurgeCachedWebViewPages(); [self setServerPaused:YES]; + // Re-enable synchronization here to synchronize EarlGrey LongPress and Tap + // actions. + [[GREYConfiguration sharedInstance] + setValue:@(YES) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; // Go back in history and verify that URL2 (committed URL) is displayed even // though URL1 is a pending URL. [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] @@ -238,6 +243,11 @@ base::SysUTF16ToNSString(web::GetDisplayTitleForUrl(_testURL1)); [[EarlGrey selectElementWithMatcher:grey_text(URL1Title)] performAction:grey_tap()]; + + [[GREYConfiguration sharedInstance] + setValue:@(NO) + forConfigKey:kGREYConfigKeySynchronizationEnabled]; + GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], @"Last request URL: %@", self.lastRequestURLSpec); [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())]
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm index 6e7da506..af378f1 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -107,8 +107,6 @@ + (void)loadURL:(const GURL&)URL { chrome_test_util::LoadUrl(URL); - // Make sure that the page started loading. - GREYAssert(chrome_test_util::IsLoading(), @"Page did not start loading."); [ChromeEarlGrey waitForPageToFinishLoading]; web::WebState* webState = chrome_test_util::GetCurrentWebState();
diff --git a/ios/third_party/earl_grey/BUILD.gn b/ios/third_party/earl_grey/BUILD.gn index 516531a..bd211b6a 100644 --- a/ios/third_party/earl_grey/BUILD.gn +++ b/ios/third_party/earl_grey/BUILD.gn
@@ -24,6 +24,8 @@ "src/EarlGrey/Action/GREYBaseAction.m", "src/EarlGrey/Action/GREYChangeStepperAction.h", "src/EarlGrey/Action/GREYChangeStepperAction.m", + "src/EarlGrey/Action/GREYMultiFingerSwipeAction.h", + "src/EarlGrey/Action/GREYMultiFingerSwipeAction.m", "src/EarlGrey/Action/GREYPathGestureUtils.h", "src/EarlGrey/Action/GREYPathGestureUtils.m", "src/EarlGrey/Action/GREYPickerAction.h", @@ -112,15 +114,12 @@ "src/EarlGrey/Common/GREYError.m", "src/EarlGrey/Common/GREYErrorConstants.h", "src/EarlGrey/Common/GREYErrorConstants.m", - "src/EarlGrey/Common/GREYExposed.h", "src/EarlGrey/Common/GREYFailureFormatter.h", "src/EarlGrey/Common/GREYFailureFormatter.m", - "src/EarlGrey/Common/GREYFailureScreenshotter+Internal.h", "src/EarlGrey/Common/GREYFailureScreenshotter.h", "src/EarlGrey/Common/GREYFailureScreenshotter.m", "src/EarlGrey/Common/GREYLogger.h", "src/EarlGrey/Common/GREYLogger.m", - "src/EarlGrey/Common/GREYObjectFormatter+Internal.h", "src/EarlGrey/Common/GREYObjectFormatter.h", "src/EarlGrey/Common/GREYObjectFormatter.m", "src/EarlGrey/Common/GREYScreenshotUtil+Internal.h", @@ -134,7 +133,6 @@ "src/EarlGrey/Common/GREYTestCaseInvocation.m", "src/EarlGrey/Common/GREYTestHelper.h", "src/EarlGrey/Common/GREYTestHelper.m", - "src/EarlGrey/Common/GREYVisibilityChecker+Internal.h", "src/EarlGrey/Common/GREYVisibilityChecker.h", "src/EarlGrey/Common/GREYVisibilityChecker.m", "src/EarlGrey/Common/GREYWeakObjectContainer.h",
diff --git a/ios/web/public/test/earl_grey/web_view_actions.mm b/ios/web/public/test/earl_grey/web_view_actions.mm index 710ddd0..e5569e74 100644 --- a/ios/web/public/test/earl_grey/web_view_actions.mm +++ b/ios/web/public/test/earl_grey/web_view_actions.mm
@@ -23,8 +23,9 @@ namespace { -// Long press duration to trigger context menu. -const NSTimeInterval kContextMenuLongPressDuration = 0.3; +// Long press duration to trigger context menu. EarlGrey LongPress action uses +// 0.7 secs. Use the same number to be consistent. +const NSTimeInterval kContextMenuLongPressDuration = 0.7; // Duration to wait for verification of JavaScript action. // TODO(crbug.com/670910): Reduce duration if the time required for verification
diff --git a/ios/web/public/web_ui_ios_data_source.h b/ios/web/public/web_ui_ios_data_source.h index edfcd8ab5..8feebb25 100644 --- a/ios/web/public/web_ui_ios_data_source.h +++ b/ios/web/public/web_ui_ios_data_source.h
@@ -9,10 +9,6 @@ #include "base/strings/string16.h" #include "base/supports_user_data.h" -namespace base { -class DictionaryValue; -} - namespace web { class BrowserState; @@ -38,9 +34,6 @@ // dictionary. virtual void AddLocalizedString(const std::string& name, int ids) = 0; - virtual void AddLocalizedStrings( - const base::DictionaryValue& localized_strings) = 0; - // Adds a boolean keyed to its name to our dictionary. virtual void AddBoolean(const std::string& name, bool value) = 0;
diff --git a/ios/web/shell/test/earl_grey/shell_earl_grey.mm b/ios/web/shell/test/earl_grey/shell_earl_grey.mm index ed21c5b..4a08d771 100644 --- a/ios/web/shell/test/earl_grey/shell_earl_grey.mm +++ b/ios/web/shell/test/earl_grey/shell_earl_grey.mm
@@ -21,9 +21,6 @@ + (void)loadURL:(const GURL&)URL { web::shell_test_util::LoadUrl(URL); - // Make sure that the page started loading. - GREYAssert(web::shell_test_util::IsLoading(), @"Page did not start loading."); - GREYCondition* condition = [GREYCondition conditionWithName:@"Wait for page to complete loading." block:^BOOL {
diff --git a/ios/web/webui/web_ui_ios_data_source_impl.h b/ios/web/webui/web_ui_ios_data_source_impl.h index 1adf587..db93781 100644 --- a/ios/web/webui/web_ui_ios_data_source_impl.h +++ b/ios/web/webui/web_ui_ios_data_source_impl.h
@@ -16,7 +16,6 @@ #include "ios/web/public/web_ui_ios_data_source.h" #include "ios/web/webui/url_data_manager_ios.h" #include "ios/web/webui/url_data_source_ios_impl.h" -#include "ui/base/template_expressions.h" namespace web { @@ -27,8 +26,6 @@ void AddString(const std::string& name, const base::string16& value) override; void AddString(const std::string& name, const std::string& value) override; void AddLocalizedString(const std::string& name, int ids) override; - void AddLocalizedStrings( - const base::DictionaryValue& localized_strings) override; void AddBoolean(const std::string& name, bool value) override; void SetJsonPath(const std::string& path) override; void AddResourcePath(const std::string& path, int resource_id) override; @@ -42,10 +39,8 @@ void SendLocalizedStringsAsJSON( const URLDataSourceIOS::GotDataCallback& callback); - // Completes a request to |path| by sending the file specified by |idr| as the - // response. - void SendFromResourceBundle(const std::string& path, - const URLDataSourceIOS::GotDataCallback& callback, + // Completes a request by sending the file specified by |idr|. + void SendFromResourceBundle(const URLDataSourceIOS::GotDataCallback& callback, int idr); private: @@ -56,9 +51,6 @@ explicit WebUIIOSDataSourceImpl(const std::string& source_name); - // Adds the locale to the load time data defaults. May be called repeatedly. - void EnsureLoadTimeDataDefaultsAdded(); - // Methods that match URLDataSource which are called by // InternalDataSource. std::string GetSource() const; @@ -73,14 +65,8 @@ int default_resource_; std::string json_path_; std::map<std::string, int> path_to_idr_map_; - // The replacements are initiallized in the main thread and then used in the - // IO thread. The map is safe to read from multiple threads as long as no - // futher changes are made to it after initialization. - ui::TemplateReplacements replacements_; - // The |replacements_| is intended to replace |localized_strings_|. base::DictionaryValue localized_strings_; bool deny_xframe_options_; - bool load_time_data_defaults_added_; bool replace_existing_source_; DISALLOW_COPY_AND_ASSIGN(WebUIIOSDataSourceImpl);
diff --git a/ios/web/webui/web_ui_ios_data_source_impl.mm b/ios/web/webui/web_ui_ios_data_source_impl.mm index 189722f..b51e26f 100644 --- a/ios/web/webui/web_ui_ios_data_source_impl.mm +++ b/ios/web/webui/web_ui_ios_data_source_impl.mm
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/memory/ref_counted_memory.h" #include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" #import "ios/web/public/web_client.h" #include "ui/base/webui/jstemplate_builder.h" #include "ui/base/webui/web_ui_util.h" @@ -66,7 +65,6 @@ source_name_(source_name), default_resource_(-1), deny_xframe_options_(true), - load_time_data_defaults_added_(true), replace_existing_source_(true) {} WebUIIOSDataSourceImpl::~WebUIIOSDataSourceImpl() {} @@ -74,27 +72,16 @@ void WebUIIOSDataSourceImpl::AddString(const std::string& name, const base::string16& value) { localized_strings_.SetString(name, value); - replacements_[name] = base::UTF16ToUTF8(value); } void WebUIIOSDataSourceImpl::AddString(const std::string& name, const std::string& value) { localized_strings_.SetString(name, value); - replacements_[name] = value; } void WebUIIOSDataSourceImpl::AddLocalizedString(const std::string& name, int ids) { localized_strings_.SetString(name, GetWebClient()->GetLocalizedString(ids)); - replacements_[name] = - base::UTF16ToUTF8(GetWebClient()->GetLocalizedString(ids)); -} - -void WebUIIOSDataSourceImpl::AddLocalizedStrings( - const base::DictionaryValue& localized_strings) { - localized_strings_.MergeDictionary(&localized_strings); - ui::TemplateReplacementsFromDictionaryValue(localized_strings, - &replacements_); } void WebUIIOSDataSourceImpl::AddBoolean(const std::string& name, bool value) { @@ -141,22 +128,9 @@ return "text/html"; } -void WebUIIOSDataSourceImpl::EnsureLoadTimeDataDefaultsAdded() { - if (!load_time_data_defaults_added_) - return; - - load_time_data_defaults_added_ = false; - base::DictionaryValue defaults; - webui::SetLoadTimeDataDefaults(web::GetWebClient()->GetApplicationLocale(), - &defaults); - AddLocalizedStrings(defaults); -} - void WebUIIOSDataSourceImpl::StartDataRequest( const std::string& path, const URLDataSourceIOS::GotDataCallback& callback) { - EnsureLoadTimeDataDefaultsAdded(); - if (!json_path_.empty() && path == json_path_) { SendLocalizedStringsAsJSON(callback); return; @@ -168,30 +142,24 @@ if (result != path_to_idr_map_.end()) resource_id = result->second; DCHECK_NE(resource_id, -1); - SendFromResourceBundle(path, callback, resource_id); + SendFromResourceBundle(callback, resource_id); } void WebUIIOSDataSourceImpl::SendLocalizedStringsAsJSON( const URLDataSourceIOS::GotDataCallback& callback) { std::string template_data; + webui::SetLoadTimeDataDefaults(web::GetWebClient()->GetApplicationLocale(), + &localized_strings_); + webui::AppendJsonJS(&localized_strings_, &template_data); callback.Run(base::RefCountedString::TakeString(&template_data)); } void WebUIIOSDataSourceImpl::SendFromResourceBundle( - const std::string& path, const URLDataSourceIOS::GotDataCallback& callback, int idr) { scoped_refptr<base::RefCountedMemory> response( GetWebClient()->GetDataResourceBytes(idr)); - - if (response.get() && GetMimeType(path) == "text/html") { - std::string replaced = ui::ReplaceTemplateExpressions( - base::StringPiece(response->front_as<char>(), response->size()), - replacements_); - response = base::RefCountedString::TakeString(&replaced); - } - callback.Run(response); }
diff --git a/media/test/data/cleaner.html b/media/test/data/cleaner.html new file mode 100644 index 0000000..76f7050 --- /dev/null +++ b/media/test/data/cleaner.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<script type="text/javascript"> +// The "cleaning" is done by navigating to the page after a test has run in +// another page (e.g. player.html). This is only done on android as a workaround +// for MediaCodec memory leaks that result from fast shutdown of GPU process +// between tests. Navigating to this page destroys media resources used in the +// previous page and the timeout gives MediaCodec a chance to clean up. +// See http://crbug.com/727542 +setTimeout(function() { + document.title = 'CLEAN'; +}, 200); +</script> \ No newline at end of file
diff --git a/mojo/public/cpp/bindings/binding_set.h b/mojo/public/cpp/bindings/binding_set.h index addd319d..6b447ea 100644 --- a/mojo/public/cpp/bindings/binding_set.h +++ b/mojo/public/cpp/bindings/binding_set.h
@@ -127,6 +127,8 @@ bool empty() const { return bindings_.empty(); } + size_t size() const { return bindings_.size(); } + // Implementations may call this when processing a dispatched message or // error. During the extent of message or error dispatch, this will return the // context associated with the specific binding which received the message or
diff --git a/remoting/host/win/BUILD.gn b/remoting/host/win/BUILD.gn index c1ae49c..e91354bc 100644 --- a/remoting/host/win/BUILD.gn +++ b/remoting/host/win/BUILD.gn
@@ -115,6 +115,12 @@ "//remoting/build/config:version", ] + if (is_clang) { + # TODO(thakis): Remove this once midl.exe no longer produces nonstandard + # C++ (see the enums in com_imported_mstscax.tlh). + cflags = [ "-Wno-microsoft-enum-forward-reference" ] + } + defines = [ "WEBRTC_CHROMIUM_BUILD" ] deps = [
diff --git a/services/device/wake_lock/wake_lock_unittest.cc b/services/device/wake_lock/wake_lock_unittest.cc index 309fca5..0712a66 100644 --- a/services/device/wake_lock/wake_lock_unittest.cc +++ b/services/device/wake_lock/wake_lock_unittest.cc
@@ -32,11 +32,28 @@ mojo::MakeRequest(&wake_lock_)); } + void OnChangeType(base::Closure quit_closure, bool result) { + result_ = result; + quit_closure.Run(); + } + void OnHasWakeLock(base::Closure quit_closure, bool has_wakelock) { has_wakelock_ = has_wakelock; quit_closure.Run(); } + bool ChangeType(device::mojom::WakeLockType type) { + result_ = false; + + base::RunLoop run_loop; + wake_lock_->ChangeType( + type, base::Bind(&WakeLockTest::OnChangeType, base::Unretained(this), + run_loop.QuitClosure())); + run_loop.Run(); + + return result_; + } + bool HasWakeLock() { has_wakelock_ = false; @@ -50,6 +67,7 @@ } bool has_wakelock_; + bool result_; mojom::WakeLockProviderPtr wake_lock_provider_; mojom::WakeLockPtr wake_lock_; @@ -95,6 +113,41 @@ EXPECT_FALSE(HasWakeLock()); } +// Test Change Type. ChangeType() has no effect when wake lock is shared by +// multiple clients. Has no effect on Android either. +TEST_F(WakeLockTest, ChangeType) { + EXPECT_FALSE(HasWakeLock()); +#if !defined(OS_ANDROID) + // Call ChangeType() on a wake lock that is in inactive status. + EXPECT_TRUE(ChangeType(device::mojom::WakeLockType::PreventAppSuspension)); + EXPECT_TRUE(ChangeType(device::mojom::WakeLockType::PreventDisplaySleep)); + EXPECT_FALSE(HasWakeLock()); // still inactive. + + wake_lock_->RequestWakeLock(); + EXPECT_TRUE(HasWakeLock()); + // Call ChangeType() on a wake lock that is in active status. + EXPECT_TRUE(ChangeType(device::mojom::WakeLockType::PreventAppSuspension)); + EXPECT_TRUE(ChangeType(device::mojom::WakeLockType::PreventDisplaySleep)); + EXPECT_TRUE(HasWakeLock()); // still active. + + // Send multiple requests, should be coalesced as usual. + wake_lock_->RequestWakeLock(); + wake_lock_->RequestWakeLock(); + + mojom::WakeLockPtr wake_lock_1; + wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_1)); + // Not allowed to change type when shared by multiple clients. + EXPECT_FALSE(ChangeType(device::mojom::WakeLockType::PreventAppSuspension)); + + wake_lock_->CancelWakeLock(); + wake_lock_1->CancelWakeLock(); + EXPECT_FALSE(HasWakeLock()); +#else // OS_ANDROID: + EXPECT_FALSE(ChangeType(device::mojom::WakeLockType::PreventAppSuspension)); + EXPECT_FALSE(ChangeType(device::mojom::WakeLockType::PreventDisplaySleep)); +#endif +} + // WakeLockProvider connection broken doesn't affect WakeLock. TEST_F(WakeLockTest, OnWakeLockProviderConnectionError) { EXPECT_FALSE(HasWakeLock());
diff --git a/services/ui/gpu/gpu_main.cc b/services/ui/gpu/gpu_main.cc index dd40807..5f4d90b 100644 --- a/services/ui/gpu/gpu_main.cc +++ b/services/ui/gpu/gpu_main.cc
@@ -10,7 +10,7 @@ #include "base/power_monitor/power_monitor_device_source.h" #include "base/single_thread_task_runner.h" #include "components/viz/service/display_compositor/gpu_display_provider.h" -#include "components/viz/service/frame_sinks/mojo_frame_sink_manager.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "gpu/command_buffer/common/activity_flags.h" #include "gpu/ipc/common/gpu_memory_buffer_support.h" #include "gpu/ipc/gpu_in_process_thread_service.h" @@ -190,7 +190,7 @@ display_provider_ = base::MakeUnique<viz::GpuDisplayProvider>( gpu_command_service_, gpu_service_->gpu_channel_manager()); - frame_sink_manager_ = base::MakeUnique<viz::MojoFrameSinkManager>( + frame_sink_manager_ = base::MakeUnique<viz::FrameSinkManagerImpl>( true, display_provider_.get()); frame_sink_manager_->BindPtrAndSetClient(std::move(request), std::move(client));
diff --git a/services/ui/gpu/gpu_main.h b/services/ui/gpu/gpu_main.h index bfc3c27..b3afca9 100644 --- a/services/ui/gpu/gpu_main.h +++ b/services/ui/gpu/gpu_main.h
@@ -19,7 +19,7 @@ namespace viz { class DisplayProvider; -class MojoFrameSinkManager; +class FrameSinkManagerImpl; } namespace ui { @@ -82,7 +82,7 @@ pending_frame_sink_manager_client_info_; // Provides mojo interfaces for creating and managing FrameSinks. - std::unique_ptr<viz::MojoFrameSinkManager> frame_sink_manager_; + std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager_; std::unique_ptr<viz::DisplayProvider> display_provider_; std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
diff --git a/services/ui/ws/server_window_delegate.h b/services/ui/ws/server_window_delegate.h index d9ed330a..af136ba8 100644 --- a/services/ui/ws/server_window_delegate.h +++ b/services/ui/ws/server_window_delegate.h
@@ -25,7 +25,7 @@ class ServerWindowDelegate { public: // Returns a frame sink manager interface pointer. There is only one - // MojoFrameSinkManager running in the system. + // FrameSinkManagerImpl running in the system. virtual cc::mojom::FrameSinkManager* GetFrameSinkManager() = 0; // Returns the root of the window tree to which this |window| is attached.
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index 903ad138..e87ee9d6 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc
@@ -1585,9 +1585,10 @@ namespace { void DidGetSettingsThreadAdapter(base::TaskRunner* task_runner, - const OptionalQuotaSettingsCallback& callback, + OptionalQuotaSettingsCallback callback, base::Optional<QuotaSettings> settings) { - task_runner->PostTask(FROM_HERE, base::Bind(callback, std::move(settings))); + task_runner->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), std::move(settings))); } } // namespace @@ -1605,13 +1606,13 @@ // UI thread and plumb the resulting value back to this thread. get_settings_task_runner_->PostTask( FROM_HERE, - base::Bind( + base::BindOnce( get_settings_function_, - base::Bind( - &DidGetSettingsThreadAdapter, - base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), - base::Bind(&QuotaManager::DidGetSettings, - weak_factory_.GetWeakPtr(), base::TimeTicks::Now())))); + base::BindOnce(&DidGetSettingsThreadAdapter, + base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), + base::BindOnce(&QuotaManager::DidGetSettings, + weak_factory_.GetWeakPtr(), + base::TimeTicks::Now())))); } void QuotaManager::DidGetSettings(base::TimeTicks start_ticks,
diff --git a/storage/browser/quota/quota_settings.cc b/storage/browser/quota/quota_settings.cc index d428822..8f4a4a33 100644 --- a/storage/browser/quota/quota_settings.cc +++ b/storage/browser/quota/quota_settings.cc
@@ -9,6 +9,8 @@ #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" #include "base/sys_info.h" +#include "base/task_scheduler/post_task.h" +#include "base/threading/thread_restrictions.h" #define UMA_HISTOGRAM_MBYTES(name, sample) \ UMA_HISTOGRAM_CUSTOM_COUNTS((name), static_cast<int>((sample) / kMBytes), 1, \ @@ -24,11 +26,10 @@ return value + (value * (random_percent / 100.0)); } -} // anonymous namespace - base::Optional<storage::QuotaSettings> CalculateNominalDynamicSettings( const base::FilePath& partition_path, bool is_incognito) { + base::ThreadRestrictions::AssertIOAllowed(); const int64_t kMBytes = 1024 * 1024; const int kRandomizedPercentage = 10; @@ -115,3 +116,17 @@ } } // namespace + +void GetNominalDynamicSettings(const base::FilePath& partition_path, + bool is_incognito, + OptionalQuotaSettingsCallback callback) { + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + base::BindOnce(&CalculateNominalDynamicSettings, partition_path, + is_incognito), + std::move(callback)); +} + +} // namespace storage
diff --git a/storage/browser/quota/quota_settings.h b/storage/browser/quota/quota_settings.h index 19236ca..a95ef47 100644 --- a/storage/browser/quota/quota_settings.h +++ b/storage/browser/quota/quota_settings.h
@@ -61,22 +61,23 @@ // GetQuotaSettingsFunc invocation. If the embedder cannot // produce a settings values, base::nullopt can be returned. using OptionalQuotaSettingsCallback = - base::Callback<void(base::Optional<QuotaSettings>)>; + base::OnceCallback<void(base::Optional<QuotaSettings>)>; // Function type used to query the embedder about the quota manager settings. // This function is invoked on the UI thread. using GetQuotaSettingsFunc = - base::Callback<void(const OptionalQuotaSettingsCallback& callback)>; + base::RepeatingCallback<void(OptionalQuotaSettingsCallback callback)>; -// Returns settings based on the size of the volume containing the storage +// Posts a background task to calculate and report quota settings to the +// |callback| function based on the size of the volume containing the storage // partition and a guestimate of the size required for the OS. The refresh // interval is 60 seconds to accomodate changes to the size of the volume. // Except, in the case of incognito, the poolize and quota values are based // on the amount of physical memory and the rerfresh interval is max'd out. STORAGE_EXPORT -base::Optional<storage::QuotaSettings> CalculateNominalDynamicSettings( - const base::FilePath& partition_path, - bool is_incognito); +void GetNominalDynamicSettings(const base::FilePath& partition_path, + bool is_incognito, + OptionalQuotaSettingsCallback callback); // Returns settings with a poolsize of zero and no per host quota. inline QuotaSettings GetNoQuotaSettings() {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 64a4974..47a80eb 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -778,218 +778,218 @@ "gtest_tests": [ { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "accessibility_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "angle_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "app_shell_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "aura_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "base_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "blink_heap_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "blink_platform_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false, + "can_use_on_swarming_builders": true, "shards": 10 }, "test": "browser_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "cacheinvalidation_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "capture_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "cast_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "cc_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "chromedriver_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "components_browsertests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "components_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "compositor_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "content_browsertests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "content_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "crypto_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "dbus_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "device_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "display_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "events_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "extensions_browsertests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "extensions_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gcm_unit_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gfx_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gin_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gl_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gn_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "google_apis_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gpu_ipc_service_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "gpu_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "interactive_ui_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "ipc_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "jingle_unittests" }, @@ -1001,157 +1001,157 @@ }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "media_blink_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "media_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "midi_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "mojo_common_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "mojo_public_bindings_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "mojo_public_system_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "mojo_system_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "nacl_loader_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "native_theme_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "net_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "pdf_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "ppapi_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "printing_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "remoting_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "sandbox_linux_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "skia_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "sql_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "storage_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "ui_base_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "ui_touch_selection_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "unit_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "url_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "views_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "webkit_unit_tests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "wm_unittests" }, { "swarming": { - "can_use_on_swarming_builders": false + "can_use_on_swarming_builders": true }, "test": "wtf_unittests" }
diff --git a/testing/buildbot/filters/ash_unittests_mus.filter b/testing/buildbot/filters/ash_unittests_mus.filter index ab6e24f..1ca5b15 100644 --- a/testing/buildbot/filters/ash_unittests_mus.filter +++ b/testing/buildbot/filters/ash_unittests_mus.filter
@@ -1,8 +1,6 @@ # TODO: fix these. They fail because wm::CursorManager isn't created. # http://crbug.com/734806. # The following fail as they use wm::CursorManager: --NativeCursorManagerAshTest.LockCursor --ExtendedDesktopTest.TestCursor -LockStateControllerTest.LegacyLockAndShutDown -LockStateControllerTest.RequestShutdownFromLockScreen -LockStateControllerTest.RequestShutdownFromLoginScreen
diff --git a/third_party/WebKit/LayoutTests/MSANExpectations b/third_party/WebKit/LayoutTests/MSANExpectations index 7e789f00..3a330c7 100644 --- a/third_party/WebKit/LayoutTests/MSANExpectations +++ b/third_party/WebKit/LayoutTests/MSANExpectations
@@ -41,6 +41,7 @@ crbug.com/671556 [ Linux ] virtual/mojo-loading/http/tests/security/xssAuditor/report-script-tag.html [ Timeout Pass ] crbug.com/736370 [ Linux ] external/wpt/editing/run/removeformat.html [ Timeout ] +crbug.com/736554 [ Linux ] external/wpt/IndexedDB/nested-cloning-large-multiple.html [ Timeout ] # Intentionally failed allocations, via partitionAllocGenericFlags() crbug.com/577889 [ Linux ] fast/js/typed-array-allocation-failure.html [ Crash ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 56b257b..54d501b4 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2906,6 +2906,9 @@ crbug.com/733448 http/tests/inspector/extensions/extensions-network.html [ Failure Pass ] crbug.com/733524 [ Mac ] virtual/mojo-loading/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php [ Timeout Pass ] +# Sheriff failures 2017-06-23 +crbug.com/736548 [ Mac ] css2.1/t040304-c64-uri-00-a-g.html [ Failure Pass ] + # Rebaselining a newly-passing test fixed by v8 crbug.com/v8/6504 fast/js/mozilla/strict/B.1.2.html [ NeedsManualRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt index 30df5d2..854ee12e 100644 --- a/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt +++ b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -31,7 +31,7 @@ }, { "name": "Scrolling Contents Layer", - "bounds": [185, 265], + "bounds": [185, 290], "shouldFlattenTransform": false }, {
diff --git a/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.png b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.png new file mode 100644 index 0000000..4554713c --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.txt b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.txt new file mode 100644 index 0000000..44c49d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite-expected.txt
@@ -0,0 +1,9 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x176 + LayoutBlockFlow {HTML} at (0,0) size 800x176 + LayoutBlockFlow {BODY} at (8,8) size 784x160 + LayoutBlockFlow {DIV} at (0,0) size 40x40 + LayoutBlockFlow {DIV} at (0,40) size 40x40 + LayoutBlockFlow {DIV} at (0,80) size 40x40 + LayoutBlockFlow {DIV} at (0,120) size 40x40
diff --git a/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite.html b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite.html new file mode 100644 index 0000000..d72d1c84 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/previews/client-lofi-sprite.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<body> + <!-- This test verifies if CSS sprite image is shown, instead of placeholder image. --> + <div id="sprite1"></div> + <div id="sprite2"></div> + <div id="sprite3"></div> + <div id="sprite4"></div> + <script> + window.internals.settings.setFetchImagePlaceholders(true); + document.getElementById("sprite1").style.cssText = 'width: 40px; height: 40px; background: url(https://127.0.0.1:8443/resources/square200.png) 0 0;'; + document.getElementById("sprite2").style.cssText = 'width: 40px; height: 40px; background: url(https://127.0.0.1:8443/resources/square200.png) 0 10px;'; + document.getElementById("sprite3").style.cssText = 'width: 40px; height: 40px; background: url(https://127.0.0.1:8443/resources/square200.png) 10px 0;'; + document.getElementById("sprite4").style.cssText = 'width: 40px; height: 40px; background: url(https://127.0.0.1:8443/resources/square200.png) 10px 10px;'; + </script> +</body>
diff --git a/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt b/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt index 810a4b6..70e711d 100644 --- a/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt
@@ -9,6 +9,7 @@ ConnectToNodeJSDirectly : 20 ConnectToNodeJSFromFrontend : 19 ConsoleEvaluated : 8 + CoverageStarted : 28 CpuProfileNodeExcluded : 23 CpuProfileNodeFocused : 22 CpuThrottlingEnabled : 21
diff --git a/third_party/WebKit/LayoutTests/overflow/overflow-transform-perspective.html b/third_party/WebKit/LayoutTests/overflow/overflow-transform-perspective.html new file mode 100644 index 0000000..172e1022 --- /dev/null +++ b/third_party/WebKit/LayoutTests/overflow/overflow-transform-perspective.html
@@ -0,0 +1,19 @@ +<!doctype HTML> +<style> +.container { + width: 100px; + height: 100px; + perspective: 100px; + overflow: scroll; +} +.target { + transform: rotateY(-45deg); + width: 90px; + height: 80px; + background-image: linear-gradient(to right, red 0% ,green 50% , blue 50%); +} +</style> +The result should have horizontal and vertical scrollbars. +<div class="container" style=""> + <div class="target"></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..9b31940b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..399f0da --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x136 + LayoutBlockFlow {HTML} at (0,0) size 800x136 + LayoutBlockFlow {BODY} at (8,8) size 784x120 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 355x19 + text run at (0,0) width 355: "The result should have horizontal and vertical scrollbars." +layer at (8,28) size 100x100 clip at (8,28) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutBlockFlow {DIV} at (0,20) size 100x100 +layer at (8,28) size 90x80 backgroundClip at (8,28) size 85x85 clip at (8,28) size 85x85 + LayoutBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..9b31940b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..4e1aa4e --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x136 + LayoutNGBlockFlow {HTML} at (0,0) size 800x136 + LayoutNGBlockFlow {BODY} at (8,8) size 784x120 + LayoutNGBlockFlow (anonymous) at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 355x19 + text run at (0,0) width 355: "The result should have horizontal and vertical scrollbars." +layer at (8,28) size 100x100 clip at (8,28) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutNGBlockFlow {DIV} at (0,20) size 100x100 +layer at (8,28) size 90x80 backgroundClip at (8,28) size 85x85 clip at (8,28) size 85x85 + LayoutNGBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..c00ff81 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..c00ff81 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..6c74176 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..10002ea5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x134 + LayoutBlockFlow {HTML} at (0,0) size 800x134 + LayoutBlockFlow {BODY} at (8,8) size 784x118 + LayoutBlockFlow (anonymous) at (0,0) size 784x18 + LayoutText {#text} at (0,0) size 364x18 + text run at (0,0) width 364: "The result should have horizontal and vertical scrollbars." +layer at (8,26) size 100x100 clip at (8,26) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutBlockFlow {DIV} at (0,18) size 100x100 +layer at (8,26) size 90x80 backgroundClip at (8,26) size 85x85 clip at (8,26) size 85x85 + LayoutBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..6c74176 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..3e4e0da5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x134 + LayoutNGBlockFlow {HTML} at (0,0) size 800x134 + LayoutNGBlockFlow {BODY} at (8,8) size 784x118 + LayoutNGBlockFlow (anonymous) at (0,0) size 784x18 + LayoutText {#text} at (0,0) size 364x18 + text run at (0,0) width 364: "The result should have horizontal and vertical scrollbars." +layer at (8,26) size 100x100 clip at (8,26) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutNGBlockFlow {DIV} at (0,18) size 100x100 +layer at (8,26) size 90x80 backgroundClip at (8,26) size 85x85 clip at (8,26) size 85x85 + LayoutNGBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..1c69be2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..bfb1c63 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x136 + LayoutBlockFlow {HTML} at (0,0) size 800x136 + LayoutBlockFlow {BODY} at (8,8) size 784x120 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 335x19 + text run at (0,0) width 335: "The result should have horizontal and vertical scrollbars." +layer at (8,28) size 100x100 clip at (8,28) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutBlockFlow {DIV} at (0,20) size 100x100 +layer at (8,28) size 90x80 backgroundClip at (8,28) size 85x85 clip at (8,28) size 85x85 + LayoutBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png new file mode 100644 index 0000000..1c69be2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt new file mode 100644 index 0000000..cc43b82 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/layout_ng/overflow/overflow-transform-perspective-expected.txt
@@ -0,0 +1,12 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x136 + LayoutNGBlockFlow {HTML} at (0,0) size 800x136 + LayoutNGBlockFlow {BODY} at (8,8) size 784x120 + LayoutNGBlockFlow (anonymous) at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 335x19 + text run at (0,0) width 335: "The result should have horizontal and vertical scrollbars." +layer at (8,28) size 100x100 clip at (8,28) size 85x85 scrollWidth 89 scrollHeight 94 + LayoutNGBlockFlow {DIV} at (0,20) size 100x100 +layer at (8,28) size 90x80 backgroundClip at (8,28) size 85x85 clip at (8,28) size 85x85 + LayoutNGBlockFlow {DIV} at (0,0) size 90x80
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js index 129c660ee..4f9dd625a 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js
@@ -5,15 +5,19 @@ ['services/shape_detection/public/interfaces/barcodedetection.mojom', 'mojo/public/js/bindings', 'mojo/public/js/core', + 'content/public/renderer/frame_interfaces', 'content/public/renderer/interfaces', - ], (barcodeDetection, bindings, mojo, interfaces) => { + ], (barcodeDetection, bindings, mojo, frameInterfaces, processInterfaces) => { class MockBarcodeDetection { constructor() { this.bindingSet_ = new bindings.BindingSet( barcodeDetection.BarcodeDetection); - interfaces.addInterfaceOverrideForTesting( + frameInterfaces.addInterfaceOverrideForTesting( + barcodeDetection.BarcodeDetection.name, + handle => this.bindingSet_.addBinding(this, handle)); + processInterfaces.addInterfaceOverrideForTesting( barcodeDetection.BarcodeDetection.name, handle => this.bindingSet_.addBinding(this, handle)); }
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js index 773c04c8..e587cbf 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
@@ -6,15 +6,20 @@ 'services/shape_detection/public/interfaces/facedetection_provider.mojom', 'mojo/public/js/bindings', 'mojo/public/js/core', + 'content/public/renderer/frame_interfaces', 'content/public/renderer/interfaces', - ], (faceDetection, faceDetectionProvider, bindings, mojo, interfaces) => { + ], (faceDetection, faceDetectionProvider, bindings, mojo, frameInterfaces, + processInterfaces) => { class MockFaceDetectionProvider { constructor() { this.bindingSet_ = new bindings.BindingSet( faceDetectionProvider.FaceDetectionProvider); - interfaces.addInterfaceOverrideForTesting( + frameInterfaces.addInterfaceOverrideForTesting( + faceDetectionProvider.FaceDetectionProvider.name, + handle => this.bindingSet_.addBinding(this, handle)); + processInterfaces.addInterfaceOverrideForTesting( faceDetectionProvider.FaceDetectionProvider.name, handle => this.bindingSet_.addBinding(this, handle)); }
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-textdetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-textdetection.js index a622605..a92054e 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-textdetection.js +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-textdetection.js
@@ -5,14 +5,18 @@ ['services/shape_detection/public/interfaces/textdetection.mojom', 'mojo/public/js/bindings', 'mojo/public/js/core', + 'content/public/renderer/frame_interfaces', 'content/public/renderer/interfaces', - ], (textDetection, bindings, mojo, interfaces) => { + ], (textDetection, bindings, mojo, frameInterfaces, processInterfaces) => { class MockTextDetection { constructor() { this.bindingSet_ = new bindings.BindingSet(textDetection.TextDetection); - interfaces.addInterfaceOverrideForTesting( + frameInterfaces.addInterfaceOverrideForTesting( + textDetection.TextDetection.name, + handle => this.bindingSet_.addBinding(this, handle)); + processInterfaces.addInterfaceOverrideForTesting( textDetection.TextDetection.name, handle => this.bindingSet_.addBinding(this, handle)); }
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt deleted file mode 100644 index 30df5d2..0000000 --- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt +++ /dev/null
@@ -1,87 +0,0 @@ -{ - "layers": [ - { - "name": "LayoutView #document", - "bounds": [800, 600], - "contentsOpaque": true, - "drawsContent": true - }, - { - "name": "LayoutBlockFlow (positioned) DIV class='container'", - "position": [8, 8], - "bounds": [200, 200], - "shouldFlattenTransform": false, - "drawsContent": true - }, - { - "name": "Child Transform Layer", - "bounds": [200, 200], - "shouldFlattenTransform": false, - "transform": [ - [1, 0, 0, 0], - [0, 1, 0, 0], - [0, 0, 1, -0.01], - [0, 0, 0, 1] - ] - }, - { - "name": "Scrolling Layer", - "bounds": [185, 185], - "shouldFlattenTransform": false - }, - { - "name": "Scrolling Contents Layer", - "bounds": [185, 265], - "shouldFlattenTransform": false - }, - { - "name": "LayoutBlockFlow (positioned) DIV class='child first'", - "position": [0, 65], - "bounds": [60, 200], - "contentsOpaque": true, - "drawsContent": true, - "backgroundColor": "#008000", - "transform": [ - [1, 0, 0, 0], - [0, 1, 0, 0], - [0, 0, 1, 0], - [0, 0, 10, 1] - ] - }, - { - "name": "LayoutBlockFlow (positioned) DIV class='child second'", - "position": [65, 65], - "bounds": [60, 200], - "contentsOpaque": true, - "drawsContent": true, - "backgroundColor": "#0000FF", - "transform": [ - [1, 0, 0, 0], - [0, 1, 0, 0], - [0, 0, 1, 0], - [0, 0, 20, 1] - ] - }, - { - "name": "Overflow Controls Host Layer", - "bounds": [200, 200] - }, - { - "name": "Horizontal Scrollbar Layer", - "position": [0, 185], - "bounds": [185, 15] - }, - { - "name": "Vertical Scrollbar Layer", - "position": [185, 0], - "bounds": [15, 185] - }, - { - "name": "Scroll Corner Layer", - "position": [185, 185], - "bounds": [15, 15], - "drawsContent": true - } - ] -} -
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index a2b64cc6..628c88a8 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -1264,6 +1264,8 @@ "dom/shadow/ShadowDOMV0Test.cpp", "dom/shadow/SlotScopedTraversalTest.cpp", "editing/CaretDisplayItemClientTest.cpp", + "editing/KeyboardTest.cpp", + "editing/LinkSelectionTest.cpp", "editing/TextFinderTest.cpp", "events/EventPathTest.cpp", "events/EventTargetTest.cpp",
diff --git a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp index adce4fb..ec23b00 100644 --- a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
@@ -66,8 +66,8 @@ return nullptr; if (value->IsImageValue()) { - StyleImage* style_image_resource = - ToCSSImageValue(value)->CacheImage(document); + StyleImage* style_image_resource = ToCSSImageValue(value)->CacheImage( + document, FetchParameters::kAllowPlaceholder); if (!style_image_resource) return nullptr;
diff --git a/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp b/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp index 565dc73..08fe561 100644 --- a/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp
@@ -101,6 +101,7 @@ StyleImage* CSSImageSetValue::CacheImage( const Document& document, float device_scale_factor, + FetchParameters::PlaceholderImageRequestType placeholder_image_request_type, CrossOriginAttributeValue cross_origin) { if (!images_in_set_.size()) FillImageSet(); @@ -122,7 +123,8 @@ cross_origin); } - if (document.GetFrame()) + if (document.GetFrame() && + placeholder_image_request_type == FetchParameters::kAllowPlaceholder) document.GetFrame()->MaybeAllowImagePlaceholder(params); if (ImageResourceContent* cached_image =
diff --git a/third_party/WebKit/Source/core/css/CSSImageSetValue.h b/third_party/WebKit/Source/core/css/CSSImageSetValue.h index 5954a337..8703940 100644 --- a/third_party/WebKit/Source/core/css/CSSImageSetValue.h +++ b/third_party/WebKit/Source/core/css/CSSImageSetValue.h
@@ -28,6 +28,7 @@ #include "core/css/CSSValueList.h" #include "platform/CrossOriginAttributeValue.h" +#include "platform/loader/fetch/FetchParameters.h" #include "platform/weborigin/Referrer.h" #include "platform/wtf/Allocator.h" @@ -46,6 +47,7 @@ StyleImage* CacheImage( const Document&, float device_scale_factor, + FetchParameters::PlaceholderImageRequestType, CrossOriginAttributeValue = kCrossOriginAttributeNotSet); String CustomCSSText() const;
diff --git a/third_party/WebKit/Source/core/css/CSSImageValue.cpp b/third_party/WebKit/Source/core/css/CSSImageValue.cpp index 367a9f0..b330467 100644 --- a/third_party/WebKit/Source/core/css/CSSImageValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSImageValue.cpp
@@ -53,8 +53,10 @@ CSSImageValue::~CSSImageValue() {} -StyleImage* CSSImageValue::CacheImage(const Document& document, - CrossOriginAttributeValue cross_origin) { +StyleImage* CSSImageValue::CacheImage( + const Document& document, + FetchParameters::PlaceholderImageRequestType placeholder_image_request_type, + CrossOriginAttributeValue cross_origin) { if (!cached_image_) { if (absolute_url_.IsEmpty()) ReResolveURL(document); @@ -72,7 +74,8 @@ cross_origin); } - if (document.GetFrame()) + if (document.GetFrame() && + placeholder_image_request_type == FetchParameters::kAllowPlaceholder) document.GetFrame()->MaybeAllowImagePlaceholder(params); if (ImageResourceContent* cached_image =
diff --git a/third_party/WebKit/Source/core/css/CSSImageValue.h b/third_party/WebKit/Source/core/css/CSSImageValue.h index d088d685..b9e7b30 100644 --- a/third_party/WebKit/Source/core/css/CSSImageValue.h +++ b/third_party/WebKit/Source/core/css/CSSImageValue.h
@@ -24,6 +24,7 @@ #include "core/CoreExport.h" #include "core/css/CSSValue.h" #include "platform/CrossOriginAttributeValue.h" +#include "platform/loader/fetch/FetchParameters.h" #include "platform/weborigin/Referrer.h" #include "platform/wtf/RefPtr.h" @@ -63,6 +64,7 @@ } StyleImage* CacheImage( const Document&, + FetchParameters::PlaceholderImageRequestType, CrossOriginAttributeValue = kCrossOriginAttributeNotSet); const String& Url() const { return absolute_url_; }
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index e53765f..f1e73d0d 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -954,7 +954,6 @@ { name: "box-sizing", field_template: "keyword", - type_name: "EBoxSizing", default_value: "content-box", keywords: ["content-box", "border-box"], field_group: "box", @@ -1175,7 +1174,6 @@ default_value: "show", field_template: "keyword", keywords: ["show", "hide"], - type_name: "EEmptyCells", }, { name: "fill", @@ -1221,7 +1219,6 @@ }, { name: "flex-direction", - type_name: "EFlexDirection", field_template: "keyword", default_value: "row", field_group: "rare-non-inherited->flexible-box", @@ -1249,7 +1246,6 @@ }, { name: "flex-wrap", - type_name: "EFlexWrap", field_template: "keyword", default_value: "nowrap", field_group: "rare-non-inherited->flexible-box", @@ -1442,7 +1438,6 @@ }, { name: "isolation", - type_name: "EIsolation", field_template: "keyword", keywords: ["auto", "isolate"], field_group: "rare-non-inherited", @@ -2873,7 +2868,6 @@ }, { name: "-webkit-box-lines", - type_name: "EBoxLines", field_template: "keyword", keywords: ["single", "multiple"], default_value: "single", @@ -2890,7 +2884,6 @@ }, { name: "-webkit-box-orient", - type_name: "EBoxOrient", field_template: "keyword", keywords: ["horizontal", "vertical"], default_value: "horizontal", @@ -2898,7 +2891,6 @@ }, { name: "-webkit-box-pack", - type_name: "EBoxPack", field_template: "keyword", keywords: ["start", "center", "end", "justify"], default_value: "start",
diff --git a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp index 88e90dd..64c5618e 100644 --- a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp +++ b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
@@ -40,6 +40,8 @@ #include "core/style/StyleInvalidImage.h" #include "core/style/StylePendingImage.h" #include "core/svg/SVGElementProxy.h" +#include "platform/Length.h" +#include "platform/loader/fetch/FetchParameters.h" #include "platform/loader/fetch/ResourceFetcher.h" namespace blink { @@ -114,12 +116,26 @@ } } +static bool ComputedStyleMayBeCSSSpriteBackgroundImage( + const ComputedStyle& style) { + // Simple heuristic to guess if CSS background image is used to create CSS + // sprites. For a legit background image it's very likely the X and the Y + // position will not be explicitly specifed. For CSS sprite image, + // background X or Y position will probably be specified. + const FillLayer& background = style.BackgroundLayers(); + return style.HasBackgroundImage() && + (background.XPosition().IsFixed() || background.YPosition().IsFixed()); +} + StyleImage* ElementStyleResources::LoadPendingImage( ComputedStyle* style, StylePendingImage* pending_image, + FetchParameters::PlaceholderImageRequestType placeholder_image_request_type, CrossOriginAttributeValue cross_origin) { - if (CSSImageValue* image_value = pending_image->CssImageValue()) - return image_value->CacheImage(*document_, cross_origin); + if (CSSImageValue* image_value = pending_image->CssImageValue()) { + return image_value->CacheImage(*document_, placeholder_image_request_type, + cross_origin); + } if (CSSPaintValue* paint_value = pending_image->CssPaintValue()) { StyleGeneratedImage* image = StyleGeneratedImage::Create(*paint_value); @@ -133,9 +149,11 @@ return StyleGeneratedImage::Create(*image_generator_value); } - if (CSSImageSetValue* image_set_value = pending_image->CssImageSetValue()) + if (CSSImageSetValue* image_set_value = pending_image->CssImageSetValue()) { return image_set_value->CacheImage(*document_, device_scale_factor_, + placeholder_image_request_type, cross_origin); + } NOTREACHED(); return nullptr; @@ -166,9 +184,13 @@ for (FillLayer* background_layer = &style->AccessBackgroundLayers(); background_layer; background_layer = background_layer->Next()) { if (background_layer->GetImage() && - background_layer->GetImage()->IsPendingImage()) + background_layer->GetImage()->IsPendingImage()) { background_layer->SetImage(LoadPendingImage( - style, ToStylePendingImage(background_layer->GetImage()))); + style, ToStylePendingImage(background_layer->GetImage()), + ComputedStyleMayBeCSSSpriteBackgroundImage(*style) + ? FetchParameters::kDisallowPlaceholder + : FetchParameters::kAllowPlaceholder)); + } } break; } @@ -178,10 +200,12 @@ content_data; content_data = content_data->Next()) { if (content_data->IsImage()) { StyleImage* image = ToImageContentData(content_data)->GetImage(); - if (image->IsPendingImage()) + if (image->IsPendingImage()) { ToImageContentData(content_data) ->SetImage( - LoadPendingImage(style, ToStylePendingImage(image))); + LoadPendingImage(style, ToStylePendingImage(image), + FetchParameters::kAllowPlaceholder)); + } } } break; @@ -191,9 +215,12 @@ for (size_t i = 0; i < cursor_list->size(); ++i) { CursorData& current_cursor = cursor_list->at(i); if (StyleImage* image = current_cursor.GetImage()) { - if (image->IsPendingImage()) + if (image->IsPendingImage()) { + // cursor images shouldn't be replaced with placeholders current_cursor.SetImage( - LoadPendingImage(style, ToStylePendingImage(image))); + LoadPendingImage(style, ToStylePendingImage(image), + FetchParameters::kDisallowPlaceholder)); + } } } } @@ -201,16 +228,22 @@ } case CSSPropertyListStyleImage: { if (style->ListStyleImage() && - style->ListStyleImage()->IsPendingImage()) + style->ListStyleImage()->IsPendingImage()) { + // List style images shouldn't be replaced with placeholders style->SetListStyleImage(LoadPendingImage( - style, ToStylePendingImage(style->ListStyleImage()))); + style, ToStylePendingImage(style->ListStyleImage()), + FetchParameters::kDisallowPlaceholder)); + } break; } case CSSPropertyBorderImageSource: { if (style->BorderImageSource() && - style->BorderImageSource()->IsPendingImage()) + style->BorderImageSource()->IsPendingImage()) { + // Border images shouldn't be replaced with placeholders style->SetBorderImageSource(LoadPendingImage( - style, ToStylePendingImage(style->BorderImageSource()))); + style, ToStylePendingImage(style->BorderImageSource()), + FetchParameters::kDisallowPlaceholder)); + } break; } case CSSPropertyWebkitBoxReflect: { @@ -219,7 +252,8 @@ if (mask_image.GetImage() && mask_image.GetImage()->IsPendingImage()) { StyleImage* loaded_image = LoadPendingImage( - style, ToStylePendingImage(mask_image.GetImage())); + style, ToStylePendingImage(mask_image.GetImage()), + FetchParameters::kAllowPlaceholder); reflection->SetMask(NinePieceImage( loaded_image, mask_image.ImageSlices(), mask_image.Fill(), mask_image.BorderSlices(), mask_image.Outset(), @@ -230,27 +264,33 @@ } case CSSPropertyWebkitMaskBoxImageSource: { if (style->MaskBoxImageSource() && - style->MaskBoxImageSource()->IsPendingImage()) + style->MaskBoxImageSource()->IsPendingImage()) { style->SetMaskBoxImageSource(LoadPendingImage( - style, ToStylePendingImage(style->MaskBoxImageSource()))); + style, ToStylePendingImage(style->MaskBoxImageSource()), + FetchParameters::kAllowPlaceholder)); + } break; } case CSSPropertyWebkitMaskImage: { for (FillLayer* mask_layer = &style->AccessMaskLayers(); mask_layer; mask_layer = mask_layer->Next()) { if (mask_layer->GetImage() && - mask_layer->GetImage()->IsPendingImage()) + mask_layer->GetImage()->IsPendingImage()) { mask_layer->SetImage(LoadPendingImage( - style, ToStylePendingImage(mask_layer->GetImage()))); + style, ToStylePendingImage(mask_layer->GetImage()), + FetchParameters::kAllowPlaceholder)); + } } break; } case CSSPropertyShapeOutside: if (style->ShapeOutside() && style->ShapeOutside()->GetImage() && - style->ShapeOutside()->GetImage()->IsPendingImage()) + style->ShapeOutside()->GetImage()->IsPendingImage()) { style->ShapeOutside()->SetImage(LoadPendingImage( style, ToStylePendingImage(style->ShapeOutside()->GetImage()), + FetchParameters::kAllowPlaceholder, kCrossOriginAttributeAnonymous)); + } break; default: NOTREACHED();
diff --git a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.h b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.h index f84ac75..2be3f2ef 100644 --- a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.h +++ b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.h
@@ -29,6 +29,7 @@ #include "platform/CrossOriginAttributeValue.h" #include "platform/graphics/Color.h" #include "platform/heap/Handle.h" +#include "platform/loader/fetch/FetchParameters.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/Noncopyable.h" @@ -71,6 +72,7 @@ StyleImage* LoadPendingImage( ComputedStyle*, StylePendingImage*, + FetchParameters::PlaceholderImageRequestType, CrossOriginAttributeValue = kCrossOriginAttributeNotSet); Member<Document> document_;
diff --git a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp b/third_party/WebKit/Source/core/editing/KeyboardTest.cpp similarity index 99% rename from third_party/WebKit/Source/web/tests/KeyboardTest.cpp rename to third_party/WebKit/Source/core/editing/KeyboardTest.cpp index 7364b94..2d35f72 100644 --- a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp +++ b/third_party/WebKit/Source/core/editing/KeyboardTest.cpp
@@ -28,6 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <memory> #include "core/editing/EditingBehavior.h" #include "core/editing/Editor.h" #include "core/events/EventTarget.h" @@ -37,7 +38,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebInputEvent.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink {
diff --git a/third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp b/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp similarity index 100% rename from third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp rename to third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp index 3ed223c..a1a4ff05 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
@@ -51,4 +51,16 @@ ASSERT_EQ(item_element->OffsetWidth(), 150); } +TEST_F(LayoutBlockTest, OverflowWithTransformAndPerspective) { + SetBodyInnerHTML( + "<div id='target' style='width: 100px; height: 100px; overflow: scroll;" + " perspective: 200px;'>" + " <div style='transform: rotateY(-45deg); width: 140px; height: 100px'>" + " </div>" + "</div>"); + LayoutBox* scroller = + ToLayoutBox(GetDocument().getElementById("target")->GetLayoutObject()); + EXPECT_EQ(119.5, scroller->LayoutOverflowRect().Width().ToFloat()); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 79862137..89f7578 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -5128,7 +5128,7 @@ // care about it. LayoutOverflowRectForPropagation takes care of this and just // propagates the border box rect instead. LayoutRect child_layout_overflow_rect = - child.LayoutOverflowRectForPropagation(); + child.LayoutOverflowRectForPropagation(this); child_layout_overflow_rect.Move(delta); AddLayoutOverflow(child_layout_overflow_rect); @@ -5360,15 +5360,17 @@ } DISABLE_CFI_PERF -LayoutRect LayoutBox::LogicalLayoutOverflowRectForPropagation() const { - LayoutRect rect = LayoutOverflowRectForPropagation(); +LayoutRect LayoutBox::LogicalLayoutOverflowRectForPropagation( + LayoutObject* container) const { + LayoutRect rect = LayoutOverflowRectForPropagation(container); if (!Parent()->StyleRef().IsHorizontalWritingMode()) return rect.TransposedRect(); return rect; } DISABLE_CFI_PERF -LayoutRect LayoutBox::LayoutOverflowRectForPropagation() const { +LayoutRect LayoutBox::LayoutOverflowRectForPropagation( + LayoutObject* container) const { // Only propagate interior layout overflow if we don't clip it. LayoutRect rect = BorderBoxRect(); // We want to include the margin, but only when it adds height. Quirky margins @@ -5388,11 +5390,19 @@ // positioning and transforms to it, and then convert it back. FlipForWritingMode(rect); - if (has_transform) - rect = Layer()->CurrentTransform().MapRect(rect); + LayoutSize container_offset; if (IsInFlowPositioned()) - rect.Move(OffsetForInFlowPosition()); + container_offset = OffsetForInFlowPosition(); + + if (ShouldUseTransformFromContainer(container)) { + TransformationMatrix t; + GetTransformFromContainer(container ? container : Container(), + container_offset, t); + rect = t.MapRect(rect); + } else { + rect.Move(container_offset); + } // Now we need to flip back. FlipForWritingMode(rect);
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h index f1b11d15..7f2ed16 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.h +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -1240,8 +1240,9 @@ LayoutRect VisualOverflowRectForPropagation() const { return RectForOverflowPropagation(VisualOverflowRect()); } - LayoutRect LogicalLayoutOverflowRectForPropagation() const; - LayoutRect LayoutOverflowRectForPropagation() const; + LayoutRect LogicalLayoutOverflowRectForPropagation( + LayoutObject* container) const; + LayoutRect LayoutOverflowRectForPropagation(LayoutObject* container) const; bool HasOverflowModel() const { return overflow_.get(); } bool HasSelfVisualOverflow() const {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp index 4b68ff6..635a88a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
@@ -328,7 +328,7 @@ AddContentsVisualOverflow(cell_visual_overflow_rect); LayoutRect cell_layout_overflow_rect = - cell->LayoutOverflowRectForPropagation(); + cell->LayoutOverflowRectForPropagation(this); cell_layout_overflow_rect.Move(cell_row_offset); AddLayoutOverflow(cell_layout_overflow_rect); }
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutBox.h b/third_party/WebKit/Source/core/layout/api/LineLayoutBox.h index 2d49673..665f0d91 100644 --- a/third_party/WebKit/Source/core/layout/api/LineLayoutBox.h +++ b/third_party/WebKit/Source/core/layout/api/LineLayoutBox.h
@@ -79,7 +79,7 @@ return ToBox()->LogicalVisualOverflowRectForPropagation(); } LayoutRect LogicalLayoutOverflowRectForPropagation() const { - return ToBox()->LogicalLayoutOverflowRectForPropagation(); + return ToBox()->LogicalLayoutOverflowRectForPropagation(nullptr); } void SetLocation(const LayoutPoint& location) {
diff --git a/third_party/WebKit/Source/devtools/front_end/coverage/CoverageView.js b/third_party/WebKit/Source/devtools/front_end/coverage/CoverageView.js index f3136a5e..78ef4f7 100644 --- a/third_party/WebKit/Source/devtools/front_end/coverage/CoverageView.js +++ b/third_party/WebKit/Source/devtools/front_end/coverage/CoverageView.js
@@ -119,6 +119,7 @@ return; if (!this._model) this._model = new Coverage.CoverageModel(mainTarget); + Host.userMetrics.actionTaken(Host.UserMetrics.Action.CoverageStarted); if (!this._model.start()) return; this._decorationManager = new Coverage.CoverageDecorationManager(this._model);
diff --git a/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js b/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js index 1583f51f..473c5785 100644 --- a/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js +++ b/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js
@@ -90,6 +90,7 @@ SelectCommandFromCommandMenu: 25, ChangeInspectedNodeInElementsPanel: 26, StyleRuleCopied: 27, + CoverageStarted: 28, }; Host.UserMetrics._PanelCodes = {
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationController.h b/third_party/WebKit/Source/modules/presentation/PresentationController.h index 69cebf5f..99fcbd0 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationController.h +++ b/third_party/WebKit/Source/modules/presentation/PresentationController.h
@@ -96,15 +96,11 @@ // client can't be used. WebPresentationClient* client_; - // Default PresentationRequest used by the embedder. - // Member<PresentationRequest> m_defaultRequest; + // The Presentation instance associated with that frame. WeakMember<Presentation> presentation_; // The presentation connections associated with that frame. - // TODO(mlamouri): the PresentationController will keep any created - // connections alive until the frame is detached. These should be weak ptr - // so that the connection can be GC'd. - HeapHashSet<Member<PresentationConnection>> connections_; + HeapHashSet<WeakMember<PresentationConnection>> connections_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp index df25107b..eafffd8 100644 --- a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp
@@ -5,22 +5,35 @@ #include "modules/shapedetection/BarcodeDetector.h" #include "core/dom/DOMException.h" +#include "core/frame/LocalFrame.h" +#include "core/frame/LocalFrameClient.h" #include "core/geometry/DOMRect.h" #include "core/html/canvas/CanvasImageSource.h" +#include "core/workers/WorkerThread.h" #include "modules/imagecapture/Point2D.h" #include "modules/shapedetection/DetectedBarcode.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/Platform.h" +#include "services/service_manager/public/cpp/interface_provider.h" namespace blink { -BarcodeDetector* BarcodeDetector::Create() { - return new BarcodeDetector(); +BarcodeDetector* BarcodeDetector::Create(ExecutionContext* context) { + return new BarcodeDetector(context); } -BarcodeDetector::BarcodeDetector() : ShapeDetector() { - Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(&barcode_service_)); +BarcodeDetector::BarcodeDetector(ExecutionContext* context) : ShapeDetector() { + auto request = mojo::MakeRequest(&barcode_service_); + if (context->IsDocument()) { + LocalFrame* frame = ToDocument(context)->GetFrame(); + if (frame) + frame->Client()->GetInterfaceProvider()->GetInterface(std::move(request)); + } else if (context->IsWorkerGlobalScope()) { + WorkerThread* thread = ToWorkerGlobalScope(context)->GetThread(); + if (thread) + thread->GetInterfaceProvider()->GetInterface(std::move(request)); + } + barcode_service_.set_connection_error_handler(ConvertToBaseCallback( WTF::Bind(&BarcodeDetector::OnBarcodeServiceConnectionError, WrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.h b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.h index 12af152..e95066b 100644 --- a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.h +++ b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.h
@@ -15,17 +15,19 @@ namespace blink { +class ExecutionContext; + class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - static BarcodeDetector* Create(); + static BarcodeDetector* Create(ExecutionContext*); DECLARE_VIRTUAL_TRACE(); private: - BarcodeDetector(); + explicit BarcodeDetector(ExecutionContext*); ~BarcodeDetector() override = default; ScriptPromise DoDetect(ScriptPromiseResolver*,
diff --git a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.idl b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.idl index 4ce6c9fa..42690b59 100644 --- a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.idl +++ b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.idl
@@ -6,6 +6,7 @@ [ Constructor, + ConstructorCallWith=ExecutionContext, Exposed=(Window,Worker), MeasureAs=ShapeDetection_BarcodeDetectorConstructor, RuntimeEnabled=ShapeDetection
diff --git a/third_party/WebKit/Source/modules/shapedetection/DEPS b/third_party/WebKit/Source/modules/shapedetection/DEPS index 2ebe46d3..cf411198 100644 --- a/third_party/WebKit/Source/modules/shapedetection/DEPS +++ b/third_party/WebKit/Source/modules/shapedetection/DEPS
@@ -4,7 +4,8 @@ "+modules/canvas2d", "+modules/imagecapture/Point2D.h", "+modules/shapedetection", - "+services/shape_detection", + "+services/shape_detection/public/interfaces", + "+services/service_manager/public/cpp", "+skia/public/interfaces/bitmap.mojom-blink.h", "+third_party/skia/include/core/SkImage.h", "+third_party/skia/include/core/SkImageInfo.h",
diff --git a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp index 148fed7..cca2570 100644 --- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
@@ -5,31 +5,46 @@ #include "modules/shapedetection/FaceDetector.h" #include "core/dom/DOMException.h" +#include "core/frame/LocalFrame.h" +#include "core/frame/LocalFrameClient.h" #include "core/geometry/DOMRect.h" #include "core/html/canvas/CanvasImageSource.h" +#include "core/workers/WorkerThread.h" #include "modules/imagecapture/Point2D.h" #include "modules/shapedetection/DetectedFace.h" #include "modules/shapedetection/FaceDetectorOptions.h" #include "modules/shapedetection/Landmark.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/Platform.h" +#include "services/service_manager/public/cpp/interface_provider.h" #include "services/shape_detection/public/interfaces/facedetection_provider.mojom-blink.h" namespace blink { -FaceDetector* FaceDetector::Create(const FaceDetectorOptions& options) { - return new FaceDetector(options); +FaceDetector* FaceDetector::Create(ExecutionContext* context, + const FaceDetectorOptions& options) { + return new FaceDetector(context, options); } -FaceDetector::FaceDetector(const FaceDetectorOptions& options) +FaceDetector::FaceDetector(ExecutionContext* context, + const FaceDetectorOptions& options) : ShapeDetector() { - shape_detection::mojom::blink::FaceDetectorOptionsPtr face_detector_options = + auto face_detector_options = shape_detection::mojom::blink::FaceDetectorOptions::New(); face_detector_options->max_detected_faces = options.maxDetectedFaces(); face_detector_options->fast_mode = options.fastMode(); + shape_detection::mojom::blink::FaceDetectionProviderPtr provider; - Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(&provider)); + auto request = mojo::MakeRequest(&provider); + if (context->IsDocument()) { + LocalFrame* frame = ToDocument(context)->GetFrame(); + if (frame) + frame->Client()->GetInterfaceProvider()->GetInterface(std::move(request)); + } else if (context->IsWorkerGlobalScope()) { + WorkerThread* thread = ToWorkerGlobalScope(context)->GetThread(); + if (thread) + thread->GetInterfaceProvider()->GetInterface(std::move(request)); + } provider->CreateFaceDetection(mojo::MakeRequest(&face_service_), std::move(face_detector_options));
diff --git a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h index 19dae40fb..13f190e1 100644 --- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h +++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h
@@ -15,6 +15,7 @@ namespace blink { +class ExecutionContext; class FaceDetectorOptions; class MODULES_EXPORT FaceDetector final : public ShapeDetector, @@ -22,12 +23,12 @@ DEFINE_WRAPPERTYPEINFO(); public: - static FaceDetector* Create(const FaceDetectorOptions&); + static FaceDetector* Create(ExecutionContext*, const FaceDetectorOptions&); DECLARE_VIRTUAL_TRACE(); private: - explicit FaceDetector(const FaceDetectorOptions&); + FaceDetector(ExecutionContext*, const FaceDetectorOptions&); ~FaceDetector() override = default; ScriptPromise DoDetect(ScriptPromiseResolver*,
diff --git a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl index 5bd12370..6b3b8ab 100644 --- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl +++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl
@@ -6,6 +6,7 @@ [ Constructor(optional FaceDetectorOptions faceDetectorOptions), + ConstructorCallWith=ExecutionContext, Exposed=(Window,Worker), MeasureAs=ShapeDetection_FaceDetectorConstructor, RuntimeEnabled=ShapeDetection
diff --git a/third_party/WebKit/Source/modules/shapedetection/TextDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/TextDetector.cpp index 45e49a0..82ba130c 100644 --- a/third_party/WebKit/Source/modules/shapedetection/TextDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/TextDetector.cpp
@@ -5,21 +5,34 @@ #include "modules/shapedetection/TextDetector.h" #include "core/dom/DOMException.h" +#include "core/frame/LocalFrame.h" +#include "core/frame/LocalFrameClient.h" #include "core/geometry/DOMRect.h" #include "core/html/canvas/CanvasImageSource.h" +#include "core/workers/WorkerThread.h" #include "modules/shapedetection/DetectedText.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/Platform.h" +#include "services/service_manager/public/cpp/interface_provider.h" namespace blink { -TextDetector* TextDetector::Create() { - return new TextDetector(); +TextDetector* TextDetector::Create(ExecutionContext* context) { + return new TextDetector(context); } -TextDetector::TextDetector() : ShapeDetector() { - Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(&text_service_)); +TextDetector::TextDetector(ExecutionContext* context) : ShapeDetector() { + auto request = mojo::MakeRequest(&text_service_); + if (context->IsDocument()) { + LocalFrame* frame = ToDocument(context)->GetFrame(); + if (frame) + frame->Client()->GetInterfaceProvider()->GetInterface(std::move(request)); + } else if (context->IsWorkerGlobalScope()) { + WorkerThread* thread = ToWorkerGlobalScope(context)->GetThread(); + if (thread) + thread->GetInterfaceProvider()->GetInterface(std::move(request)); + } + text_service_.set_connection_error_handler(ConvertToBaseCallback(WTF::Bind( &TextDetector::OnTextServiceConnectionError, WrapWeakPersistent(this)))); }
diff --git a/third_party/WebKit/Source/modules/shapedetection/TextDetector.h b/third_party/WebKit/Source/modules/shapedetection/TextDetector.h index 4d21cc6..663e264 100644 --- a/third_party/WebKit/Source/modules/shapedetection/TextDetector.h +++ b/third_party/WebKit/Source/modules/shapedetection/TextDetector.h
@@ -15,17 +15,19 @@ namespace blink { +class ExecutionContext; + class MODULES_EXPORT TextDetector final : public ShapeDetector, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - static TextDetector* Create(); + static TextDetector* Create(ExecutionContext*); DECLARE_VIRTUAL_TRACE(); private: - TextDetector(); + explicit TextDetector(ExecutionContext*); ~TextDetector() override = default; ScriptPromise DoDetect(ScriptPromiseResolver*,
diff --git a/third_party/WebKit/Source/modules/shapedetection/TextDetector.idl b/third_party/WebKit/Source/modules/shapedetection/TextDetector.idl index 11b3630..56df055b 100644 --- a/third_party/WebKit/Source/modules/shapedetection/TextDetector.idl +++ b/third_party/WebKit/Source/modules/shapedetection/TextDetector.idl
@@ -6,6 +6,7 @@ [ Constructor, + ConstructorCallWith=ExecutionContext, Exposed=(Window,Worker), MeasureAs=ShapeDetection_TextDetectorConstructor, RuntimeEnabled=ShapeDetection
diff --git a/third_party/WebKit/Source/web/BUILD.gn b/third_party/WebKit/Source/web/BUILD.gn index f719686..a576e36f 100644 --- a/third_party/WebKit/Source/web/BUILD.gn +++ b/third_party/WebKit/Source/web/BUILD.gn
@@ -94,10 +94,8 @@ "tests/FakeWebPlugin.h", "tests/HTMLImportSheetsTest.cpp", "tests/ImeOnFocusTest.cpp", - "tests/KeyboardTest.cpp", "tests/LayoutGeometryMapTest.cpp", "tests/LinkElementLoadingTest.cpp", - "tests/LinkSelectionTest.cpp", "tests/ListenerLeakTest.cpp", "tests/LocalFrameClientImplTest.cpp", "tests/MHTMLTest.cpp",
diff --git a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp index 000d999..619b338c 100644 --- a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
@@ -51,6 +51,8 @@ void RequestWakeLock() override { registry_->SetWakeLockStatus(true); } void CancelWakeLock() override { registry_->SetWakeLockStatus(false); } void AddClient(device::mojom::blink::WakeLockRequest wake_lock) override {} + void ChangeType(device::mojom::WakeLockType type, + ChangeTypeCallback callback) override {} void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override {} mojo::Binding<WakeLock> binding_;
diff --git a/third_party/khronos/EGL/eglext.h b/third_party/khronos/EGL/eglext.h index d07a7b7..c59a9b3 100644 --- a/third_party/khronos/EGL/eglext.h +++ b/third_party/khronos/EGL/eglext.h
@@ -1198,21 +1198,16 @@ #define EGL_NATIVE_SURFACE_TIZEN 0x32A1 #endif /* EGL_TIZEN_image_native_surface */ -/* Chromium-specific Added support for EGL_EXT_image_flush_external extension */ #ifndef EGL_EXT_image_flush_external #define EGL_EXT_image_flush_external 1 +#define EGL_IMAGE_EXTERNAL_FLUSH_EXT 0x32A2 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEFLUSHEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEINVALIDATEEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY -eglImageFlushExternalEXT(EGLDisplay dpy, - EGLImageKHR image, - const EGLint* attrib_list); -#else -typedef EGLBoolean(EGLAPIENTRYP PFNGLEGLIMAGEFLUSHEXTERNALEXT)( - EGLDisplay dpy, - EGLImageKHR image, - const EGLint* attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglImageFlushExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglImageInvalidateExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list); #endif -#endif +#endif /* EGL_EXT_image_flush_external */ #ifndef EGL_ANGLE_stream_producer_d3d_texture_nv12 #define EGL_ANGLE_stream_producer_d3d_texture_nv12
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py index 7bbe842..f68ba0a8 100755 --- a/tools/json_schema_compiler/idl_schema.py +++ b/tools/json_schema_compiler/idl_schema.py
@@ -315,6 +315,10 @@ elif self.typeref == 'ArrayBuffer': properties['type'] = 'binary' properties['isInstanceOf'] = 'ArrayBuffer' + elif self.typeref == 'ArrayBufferView': + properties['type'] = 'binary' + # We force the APIs to specify instanceOf since ArrayBufferView isn't an + # instantiable type, therefore we don't specify isInstanceOf here. elif self.typeref == 'FileEntry': properties['type'] = 'object' properties['isInstanceOf'] = 'FileEntry'
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 7fbe92c0..3b10a50 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -7550,6 +7550,7 @@ <int value="25" label="Command menu command executed"/> <int value="26" label="Change inspected node in elements panel"/> <int value="27" label="Style rule copied"/> + <int value="28" label="Coverage started"/> </enum> <enum name="DevToolsPanel">
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index b3bdf81e..a416ebd1 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc
@@ -14,7 +14,7 @@ #include "base/power_monitor/power_monitor_device_source.h" #include "base/run_loop.h" #include "build/build_config.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "third_party/skia/include/core/SkBlendMode.h" #include "ui/aura/client/default_capture_client.h" #include "ui/aura/client/window_parenting_client.h" @@ -138,7 +138,7 @@ #endif // The ContextFactory must exist before any Compositors are created. - viz::FrameSinkManagerHost frame_sink_manager; + viz::HostFrameSinkManager frame_sink_manager; cc::SurfaceManager surface_manager; auto context_factory = base::MakeUnique<ui::InProcessContextFactory>( &frame_sink_manager, &surface_manager);
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 205c66b..3245d5e 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h
@@ -62,7 +62,7 @@ } namespace viz { -class FrameSinkManagerHost; +class HostFrameSinkManager; } namespace ui { @@ -109,7 +109,7 @@ virtual cc::SurfaceManager* GetSurfaceManager() = 0; // Gets the frame sink manager host instance. - virtual viz::FrameSinkManagerHost* GetFrameSinkManagerHost() = 0; + virtual viz::HostFrameSinkManager* GetHostFrameSinkManager() = 0; // Inform the display corresponding to this compositor if it is visible. When // false it does not need to produce any frames. Visibility is reset for each
diff --git a/ui/compositor/test/context_factories_for_test.cc b/ui/compositor/test/context_factories_for_test.cc index e6e320d..f506bbf 100644 --- a/ui/compositor/test/context_factories_for_test.cc +++ b/ui/compositor/test/context_factories_for_test.cc
@@ -6,7 +6,7 @@ #include "base/command_line.h" #include "base/sys_info.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "ui/compositor/compositor.h" #include "ui/compositor/compositor_switches.h" #include "ui/compositor/test/in_process_context_factory.h" @@ -14,7 +14,7 @@ namespace { -static viz::FrameSinkManagerHost* g_frame_sink_manager = nullptr; +static viz::HostFrameSinkManager* g_frame_sink_manager = nullptr; static cc::SurfaceManager* g_surface_manager = nullptr; static ui::InProcessContextFactory* g_implicit_factory = nullptr; static gl::DisableNullDrawGLBindings* g_disable_null_draw = nullptr; @@ -35,7 +35,7 @@ enable_pixel_output = true; if (enable_pixel_output) g_disable_null_draw = new gl::DisableNullDrawGLBindings; - g_frame_sink_manager = new viz::FrameSinkManagerHost; + g_frame_sink_manager = new viz::HostFrameSinkManager; g_surface_manager = new cc::SurfaceManager; g_implicit_factory = new InProcessContextFactory(g_frame_sink_manager, g_surface_manager);
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index 3d83f10..fcb27bc 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -23,7 +23,7 @@ #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/local_surface_id_allocator.h" #include "cc/test/pixel_test_output_surface.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" @@ -135,7 +135,7 @@ }; InProcessContextFactory::InProcessContextFactory( - viz::FrameSinkManagerHost* frame_sink_manager, + viz::HostFrameSinkManager* frame_sink_manager, cc::SurfaceManager* surface_manager) : frame_sink_id_allocator_(kDefaultClientId), use_test_surface_(true), @@ -321,7 +321,7 @@ return surface_manager_; } -viz::FrameSinkManagerHost* InProcessContextFactory::GetFrameSinkManagerHost() { +viz::HostFrameSinkManager* InProcessContextFactory::GetHostFrameSinkManager() { return frame_sink_manager_; }
diff --git a/ui/compositor/test/in_process_context_factory.h b/ui/compositor/test/in_process_context_factory.h index 12f64ac..151c86be 100644 --- a/ui/compositor/test/in_process_context_factory.h +++ b/ui/compositor/test/in_process_context_factory.h
@@ -24,7 +24,7 @@ } namespace viz { -class FrameSinkManagerHost; +class HostFrameSinkManager; } namespace ui { @@ -33,11 +33,11 @@ class InProcessContextFactory : public ContextFactory, public ContextFactoryPrivate { public: - // Both |frame_sink_manager_host| and |surface_manager| must outlive the + // Both |host_frame_sink_manager| and |surface_manager| must outlive the // ContextFactory. // TODO(crbug.com/657959): |surface_manager| should go away and we should use - // the LayerTreeFrameSink from the FrameSinkManagerHost. - InProcessContextFactory(viz::FrameSinkManagerHost* frame_sink_manager_host, + // the LayerTreeFrameSink from the HostFrameSinkManager. + InProcessContextFactory(viz::HostFrameSinkManager* host_frame_sink_manager, cc::SurfaceManager* surface_manager); ~InProcessContextFactory() override; @@ -69,7 +69,7 @@ cc::TaskGraphRunner* GetTaskGraphRunner() override; cc::FrameSinkId AllocateFrameSinkId() override; cc::SurfaceManager* GetSurfaceManager() override; - viz::FrameSinkManagerHost* GetFrameSinkManagerHost() override; + viz::HostFrameSinkManager* GetHostFrameSinkManager() override; void SetDisplayVisible(ui::Compositor* compositor, bool visible) override; void ResizeDisplay(ui::Compositor* compositor, const gfx::Size& size) override; @@ -101,7 +101,7 @@ cc::FrameSinkIdAllocator frame_sink_id_allocator_; bool use_test_surface_; double refresh_rate_ = 60.0; - viz::FrameSinkManagerHost* frame_sink_manager_; + viz::HostFrameSinkManager* frame_sink_manager_; cc::SurfaceManager* surface_manager_; base::ObserverList<ContextFactoryObserver> observer_list_;
diff --git a/ui/gl/gl_image_native_pixmap.cc b/ui/gl/gl_image_native_pixmap.cc index e2c0c4c..3f05795 100644 --- a/ui/gl/gl_image_native_pixmap.cc +++ b/ui/gl/gl_image_native_pixmap.cc
@@ -133,9 +133,16 @@ gfx::BufferFormat format) { DCHECK(!pixmap_); if (pixmap->GetEGLClientBuffer()) { - EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + std::vector<EGLint> attrs; + attrs.push_back(EGL_IMAGE_PRESERVED_KHR); + attrs.push_back(EGL_TRUE); + if (has_image_flush_external_) { + attrs.push_back(EGL_IMAGE_EXTERNAL_FLUSH_EXT); + attrs.push_back(EGL_TRUE); + } + attrs.push_back(EGL_NONE); if (!GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, - pixmap->GetEGLClientBuffer(), attrs)) { + pixmap->GetEGLClientBuffer(), &attrs[0])) { return false; } } else if (pixmap->AreDmaBufFdsValid()) { @@ -189,6 +196,10 @@ attrs.push_back(static_cast<uint32_t>(modifier >> 32)); } } + if (has_image_flush_external_) { + attrs.push_back(EGL_IMAGE_EXTERNAL_FLUSH_EXT); + attrs.push_back(EGL_TRUE); + } attrs.push_back(EGL_NONE); if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, @@ -233,13 +244,10 @@ return; EGLDisplay display = gl::GLSurfaceEGL::GetHardwareDisplay(); - const EGLAttrib attribs[] = { - EGL_NONE, - }; - if (!eglImageFlushExternalEXT(display, egl_image_, attribs)) { - LOG(ERROR) << "Failed to flush rendering"; - return; - } + EGLAttrib attrs[] = { EGL_NONE }; + EGLBoolean rv = eglImageFlushExternalEXT(display, egl_image_, attrs); + LOG_IF(ERROR, !rv) << "Failed to flush rendering"; + DCHECK_EQ(rv, static_cast<EGLBoolean>(EGL_TRUE)); } void GLImageNativePixmap::OnMemoryDump(
diff --git a/ui/gl/test/gl_image_test_template.h b/ui/gl/test/gl_image_test_template.h index fdd9983..168d32e 100644 --- a/ui/gl/test/gl_image_test_template.h +++ b/ui/gl/test/gl_image_test_template.h
@@ -212,6 +212,28 @@ REGISTER_TYPED_TEST_CASE_P(GLImageTest, Create); template <typename GLImageTestDelegate> +class GLImageFlushTest : public GLImageTest<GLImageTestDelegate> {}; + +TYPED_TEST_CASE_P(GLImageFlushTest); + +TYPED_TEST_P(GLImageFlushTest, Flush) { + const gfx::Size image_size(256, 256); + const uint8_t* image_color = this->delegate_.GetImageColor(); + + // Create a solid color green image of preferred format. + scoped_refptr<GLImage> image = + this->delegate_.CreateSolidColorImage(image_size, image_color); + ASSERT_TRUE(image); + + // Flush image. This must succeed in order for a GLImage to be conformant. + image->Flush(); +} + +// The GLImageTest test case verifies the flush behaviour that is expected from +// a GLImage in order to be conformant. +REGISTER_TYPED_TEST_CASE_P(GLImageFlushTest, Flush); + +template <typename GLImageTestDelegate> class GLImageOddSizeTest : public GLImageTest<GLImageTestDelegate> {}; // This test verifies that odd-sized GLImages can be created and destroyed.
diff --git a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc index 525ba66..e78a216 100644 --- a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc +++ b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc
@@ -85,6 +85,10 @@ GLImageTest, GLImageScanoutType); +INSTANTIATE_TYPED_TEST_CASE_P(GLImageNativePixmapScanout, + GLImageFlushTest, + GLImageScanoutType); + using GLImageReadWriteType = testing::Types< GLImageNativePixmapTestDelegate<gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, gfx::BufferFormat::R_8>>;
diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc index 5138585..67138c38 100644 --- a/ui/views/examples/examples_main.cc +++ b/ui/views/examples/examples_main.cc
@@ -16,7 +16,7 @@ #include "base/run_loop.h" #include "base/test/test_discardable_memory_allocator.h" #include "build/build_config.h" -#include "components/viz/host/frame_sink_manager_host.h" +#include "components/viz/host/host_frame_sink_manager.h" #include "ui/base/ime/input_method_initializer.h" #include "ui/base/material_design/material_design_controller.h" #include "ui/base/resource/resource_bundle.h" @@ -67,7 +67,7 @@ gl::init::InitializeGLOneOff(); // The ContextFactory must exist before any Compositors are created. - viz::FrameSinkManagerHost frame_sink_manager_; + viz::HostFrameSinkManager frame_sink_manager_; cc::SurfaceManager surface_manager_; auto context_factory = base::MakeUnique<ui::InProcessContextFactory>( &frame_sink_manager_, &surface_manager_);
diff --git a/ui/views_content_client/views_content_browser_client.cc b/ui/views_content_client/views_content_browser_client.cc index f8c5a854..325bac3 100644 --- a/ui/views_content_client/views_content_browser_client.cc +++ b/ui/views_content_client/views_content_browser_client.cc
@@ -5,7 +5,6 @@ #include "ui/views_content_client/views_content_browser_client.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "storage/browser/quota/quota_settings.h" #include "ui/views_content_client/views_content_client_main_parts.h" @@ -31,12 +30,9 @@ void ViewsContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) { - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&storage::CalculateNominalDynamicSettings, - partition->GetPath(), context->IsOffTheRecord()), - callback); + storage::OptionalQuotaSettingsCallback callback) { + storage::GetNominalDynamicSettings( + partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); } } // namespace ui
diff --git a/ui/views_content_client/views_content_browser_client.h b/ui/views_content_client/views_content_browser_client.h index 017ae63..acb422cc 100644 --- a/ui/views_content_client/views_content_browser_client.h +++ b/ui/views_content_client/views_content_browser_client.h
@@ -25,7 +25,7 @@ void GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, - const storage::OptionalQuotaSettingsCallback& callback) override; + storage::OptionalQuotaSettingsCallback callback) override; private: ViewsContentClientMainParts* views_content_main_parts_;