diff --git a/DEPS b/DEPS index 290c30f..ff356f2a 100644 --- a/DEPS +++ b/DEPS
@@ -105,7 +105,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '4e85e80a5a32f11b850830f7bf6ee45ca195d137', + 'skia_revision': 'c91fe3ab1c5dd109e436768f848dda6814755ae6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -117,7 +117,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'cdf50444934ca7456d2b8c34023e3918910a886d', + 'angle_revision': '71a151fd11ae46e15fc09142458c2ae6b0f777df', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -129,7 +129,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '55f82fcc12972bdf405a28c3c428e11e889e8ce1', + 'pdfium_revision': 'ae82b696f236bc5bd1375532bcf867fcc6aa9126', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -540,7 +540,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '7869e579e31ed252585d9e681d8d78b0d6349fca', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'f028e346c07f827b578869bd7c4347b79b8168ad', 'condition': 'checkout_linux', }, @@ -555,7 +555,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + 'f05c58b1e0caa619384eef965fbde28a0c8e57e2', + 'url': Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + 'ec6d4902f36cabef3ad932c79530ac34b55e831a', 'condition': 'checkout_linux', }, @@ -565,7 +565,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '406de133efaf58aeb4e3ebf6ee1f36bea137fa2b', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'a4dec94a1aa32ca213e43c0a5d58d6d073e0d1b2', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -913,7 +913,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'da32244d8116647b428c602fba80e8f3715a857a', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'e9d405363cbf976d3a9afd9efe74ce67d61ff84a', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', @@ -1032,7 +1032,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'a5c263cc63ffc2cc189b5214074c8792067c1853', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '43d0b98fe5adc4d566c7d862a576cc16ceab3fb4', + Var('webrtc_git') + '/src.git' + '@' + 'deee55b3d5223be4a7e5116cccbf22d1a132fac3', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/ash/wallpaper/wallpaper_controller.cc b/ash/wallpaper/wallpaper_controller.cc index 9771320b..0d001ea 100644 --- a/ash/wallpaper/wallpaper_controller.cc +++ b/ash/wallpaper/wallpaper_controller.cc
@@ -42,6 +42,7 @@ #include "chromeos/chromeos_switches.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/scoped_user_pref_update.h" +#include "services/data_decoder/public/cpp/decode_image.h" #include "ui/display/manager/display_manager.h" #include "ui/display/manager/managed_display_info.h" #include "ui/display/screen.h" @@ -161,14 +162,13 @@ } // Resizes |image| to a resolution which is nearest to |preferred_width| and -// |preferred_height| while respecting the |layout| choice. |output_skia| is -// optional (may be null). Returns true on success. -bool ResizeImage(const gfx::ImageSkia& image, - WallpaperLayout layout, - int preferred_width, - int preferred_height, - scoped_refptr<base::RefCountedBytes>* output, - gfx::ImageSkia* output_skia) { +// |preferred_height| while respecting the |layout| choice. Encodes the image to +// JPEG and saves to |output|. Returns true on success. +bool ResizeAndEncodeImage(const gfx::ImageSkia& image, + WallpaperLayout layout, + int preferred_width, + int preferred_height, + scoped_refptr<base::RefCountedBytes>* output) { int width = image.width(); int height = image.height(); int resized_width; @@ -205,33 +205,25 @@ SkBitmap bitmap = *(resized_image.bitmap()); gfx::JPEGCodec::Encode(bitmap, kDefaultEncodingQuality, &(*output)->data()); - - if (output_skia) { - resized_image.MakeThreadSafe(); - *output_skia = resized_image; - } - return true; } // Resizes |image| to a resolution which is nearest to |preferred_width| and // |preferred_height| while respecting the |layout| choice and saves the -// resized wallpaper to |path|. |output_skia| is optional (may be -// null). Returns true on success. +// resized wallpaper to |path|. Returns true on success. bool ResizeAndSaveWallpaper(const gfx::ImageSkia& image, const base::FilePath& path, WallpaperLayout layout, int preferred_width, - int preferred_height, - gfx::ImageSkia* output_skia) { + int preferred_height) { if (layout == WALLPAPER_LAYOUT_CENTER) { if (base::PathExists(path)) base::DeleteFile(path, false); return false; } scoped_refptr<base::RefCountedBytes> data; - if (!ResizeImage(image, layout, preferred_width, preferred_height, &data, - output_skia)) { + if (!ResizeAndEncodeImage(image, layout, preferred_width, preferred_height, + &data)) { return false; } @@ -312,9 +304,11 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), base::Passed(gfx::ImageSkia()))); - } else { - DecodeWallpaper(*data, std::move(callback)); + return; } + // This image was once encoded to JPEG by |ResizeAndEncodeImage|. + DecodeWallpaper(*data, data_decoder::mojom::ImageCodec::ROBUST_JPEG, + std::move(callback)); } // Deletes a list of wallpaper files in |file_list|. @@ -381,13 +375,11 @@ // resized wallpaper is not generated (i.e. chrome shutdown before resized // wallpaper is saved). ResizeAndSaveWallpaper(*image, original_path, WALLPAPER_LAYOUT_STRETCH, - image->width(), image->height(), nullptr); + image->width(), image->height()); ResizeAndSaveWallpaper(*image, small_wallpaper_path, layout, - kSmallWallpaperMaxWidth, kSmallWallpaperMaxHeight, - nullptr); + kSmallWallpaperMaxWidth, kSmallWallpaperMaxHeight); ResizeAndSaveWallpaper(*image, large_wallpaper_path, layout, - kLargeWallpaperMaxWidth, kLargeWallpaperMaxHeight, - nullptr); + kLargeWallpaperMaxWidth, kLargeWallpaperMaxHeight); } // Checks if kiosk app is running. Note: it returns false either when there's @@ -442,13 +434,13 @@ *image, GetOnlineWallpaperPath(url, WallpaperController::WALLPAPER_RESOLUTION_LARGE), - layout, image->width(), image->height(), nullptr); + layout, image->width(), image->height()); ResizeAndSaveWallpaper( *image, GetOnlineWallpaperPath(url, WallpaperController::WALLPAPER_RESOLUTION_SMALL), WALLPAPER_LAYOUT_CENTER_CROPPED, kSmallWallpaperMaxWidth, - kSmallWallpaperMaxHeight, nullptr); + kSmallWallpaperMaxHeight); } // Implementation of |WallpaperController::GetOfflineWallpaper|. @@ -961,10 +953,16 @@ base::BindOnce(&WallpaperController::OnOnlineWallpaperDecoded, weak_factory_.GetWeakPtr(), params, /*save_file=*/true, std::move(callback)); - if (bypass_decode_for_testing_) + if (bypass_decode_for_testing_) { std::move(decoded_callback).Run(CreateSolidColorWallpaper()); - else - DecodeWallpaper(image_data, std::move(decoded_callback)); + return; + } + // Use default codec because 1) online wallpapers may have various formats, + // 2) the image data comes from the Chrome OS wallpaper picker and is + // trusted (third-party wallpaper apps use |SetThirdPartyWallpaper|), 3) the + // code path is never used on login screen (enforced by the check above). + DecodeWallpaper(image_data, data_decoder::mojom::ImageCodec::DEFAULT, + std::move(decoded_callback)); } void WallpaperController::SetDefaultWallpaper( @@ -1020,10 +1018,14 @@ base::Passed(&user_info), wallpaper_files_id, kPolicyWallpaperFile, POLICY, WALLPAPER_LAYOUT_CENTER_CROPPED, show_wallpaper); - if (bypass_decode_for_testing_) + if (bypass_decode_for_testing_) { std::move(callback).Run(CreateSolidColorWallpaper()); - else - DecodeWallpaper(data, std::move(callback)); + return; + } + // The default codec cannot be used here because the image data is provided by + // user and thus not trusted. In addition, only JPEG |data| is accepted. + DecodeWallpaper(data, data_decoder::mojom::ImageCodec::ROBUST_JPEG, + std::move(callback)); } void WallpaperController::SetDeviceWallpaperPolicyEnforced(bool enforced) {
diff --git a/ash/wallpaper/wallpaper_utils/wallpaper_decoder.cc b/ash/wallpaper/wallpaper_utils/wallpaper_decoder.cc index 24f5a91..98f37c5 100644 --- a/ash/wallpaper/wallpaper_utils/wallpaper_decoder.cc +++ b/ash/wallpaper/wallpaper_utils/wallpaper_decoder.cc
@@ -7,7 +7,6 @@ #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ipc/ipc_channel.h" -#include "services/data_decoder/public/cpp/decode_image.h" namespace ash { namespace { @@ -31,6 +30,7 @@ } // namespace void DecodeWallpaper(const std::string& image_data, + const data_decoder::mojom::ImageCodec& image_codec, OnWallpaperDecoded callback) { // The connector for the mojo service manager is null in unit tests. if (!Shell::Get()->shell_delegate()->GetShellConnector()) { @@ -40,9 +40,8 @@ std::vector<uint8_t> image_bytes(image_data.begin(), image_data.end()); data_decoder::DecodeImage( Shell::Get()->shell_delegate()->GetShellConnector(), - std::move(image_bytes), data_decoder::mojom::ImageCodec::ROBUST_JPEG, - false /* shrink_to_fit */, kMaxImageSizeInBytes, - gfx::Size() /* desired_image_frame_size */, + std::move(image_bytes), image_codec, /*shrink_to_fit=*/true, + kMaxImageSizeInBytes, /*desired_image_frame_size=*/gfx::Size(), base::BindOnce(&ConvertToImageSkia, std::move(callback))); }
diff --git a/ash/wallpaper/wallpaper_utils/wallpaper_decoder.h b/ash/wallpaper/wallpaper_utils/wallpaper_decoder.h index ba5ac494..33690a1 100644 --- a/ash/wallpaper/wallpaper_utils/wallpaper_decoder.h +++ b/ash/wallpaper/wallpaper_utils/wallpaper_decoder.h
@@ -7,6 +7,7 @@ #include "base/callback_forward.h" #include "base/memory/scoped_refptr.h" +#include "services/data_decoder/public/cpp/decode_image.h" namespace gfx { class ImageSkia; @@ -20,6 +21,7 @@ // Do an async wallpaper decode; |on_decoded| is run on the calling thread when // the decode has finished. void DecodeWallpaper(const std::string& image_data, + const data_decoder::mojom::ImageCodec& image_codec, OnWallpaperDecoded callback); } // namespace ash
diff --git a/base/files/file_path_watcher_unittest.cc b/base/files/file_path_watcher_unittest.cc index bc5d9025..2db742a9 100644 --- a/base/files/file_path_watcher_unittest.cc +++ b/base/files/file_path_watcher_unittest.cc
@@ -188,16 +188,12 @@ bool recursive_watch) WARN_UNUSED_RESULT; bool WaitForEvents() WARN_UNUSED_RESULT { - return WaitForEventsWithTimeout(TestTimeouts::action_timeout()); - } - - bool WaitForEventsWithTimeout(TimeDelta timeout) WARN_UNUSED_RESULT { RunLoop run_loop; collector_->Reset(run_loop.QuitClosure()); // Make sure we timeout if we don't get notified. ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, run_loop.QuitClosure(), timeout); + FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout()); run_loop.Run(); return collector_->Success(); } @@ -857,7 +853,10 @@ // We should not get notified in this case as it hasn't affected our ability // to access the file. ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, false)); - ASSERT_FALSE(WaitForEventsWithTimeout(TestTimeouts::tiny_timeout())); + loop_.task_runner()->PostDelayedTask( + FROM_HERE, RunLoop::QuitCurrentWhenIdleClosureDeprecated(), + TestTimeouts::tiny_timeout()); + ASSERT_FALSE(WaitForEvents()); ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, true)); // We should get notified in this case because filepathwatcher can no
diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc index cb74ca3..156bb49 100644 --- a/base/message_loop/message_loop_unittest.cc +++ b/base/message_loop/message_loop_unittest.cc
@@ -1627,8 +1627,6 @@ ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, BindOnce(&FuncThatQuitsNow)); - run_loop.allow_quit_current_deprecated_ = true; - RunLoop outer_run_loop; outer_run_loop.Run();
diff --git a/base/run_loop.cc b/base/run_loop.cc index d2d4ccb..3882f64 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc
@@ -152,7 +152,6 @@ base::Closure RunLoop::QuitClosure() { // TODO(gab): Fix bad usage and enable this check, http://crbug.com/715235. // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - allow_quit_current_deprecated_ = false; // Need to use ProxyToTaskRunner() as WeakPtrs vended from // |weak_factory_| may only be accessed on |origin_task_runner_|. @@ -164,7 +163,6 @@ base::Closure RunLoop::QuitWhenIdleClosure() { // TODO(gab): Fix bad usage and enable this check, http://crbug.com/715235. // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - allow_quit_current_deprecated_ = false; // Need to use ProxyToTaskRunner() as WeakPtrs vended from // |weak_factory_| may only be accessed on |origin_task_runner_|. @@ -203,29 +201,17 @@ // static void RunLoop::QuitCurrentDeprecated() { DCHECK(IsRunningOnCurrentThread()); - Delegate* delegate = tls_delegate.Get().Get(); - CHECK(delegate->active_run_loops_.top()->allow_quit_current_deprecated_) - << "Please migrate off QuitCurrentDeprecated(), e.g. to QuitClosure()."; - delegate->active_run_loops_.top()->Quit(); + tls_delegate.Get().Get()->active_run_loops_.top()->Quit(); } // static void RunLoop::QuitCurrentWhenIdleDeprecated() { DCHECK(IsRunningOnCurrentThread()); - Delegate* delegate = tls_delegate.Get().Get(); - CHECK(delegate->active_run_loops_.top()->allow_quit_current_deprecated_) - << "Please migrate off QuitCurrentWhenIdleDeprecated(), e.g. to " - "QuitWhenIdleClosure()."; - delegate->active_run_loops_.top()->QuitWhenIdle(); + tls_delegate.Get().Get()->active_run_loops_.top()->QuitWhenIdle(); } // static Closure RunLoop::QuitCurrentWhenIdleClosureDeprecated() { - // TODO(https://crbug.com/844016): Migrate call-sites and enable this check. - // Delegate* delegate = tls_delegate.Get().Get(); - // CHECK(delegate->active_run_loops_.top()->allow_quit_current_deprecated_) - // << "Please migrate off QuitCurrentWhenIdleClosureDeprecated(), e.g to " - // "QuitWhenIdleClosure()."; return Bind(&RunLoop::QuitCurrentWhenIdleDeprecated); }
diff --git a/base/run_loop.h b/base/run_loop.h index 2582a69..719f928a 100644 --- a/base/run_loop.h +++ b/base/run_loop.h
@@ -248,8 +248,6 @@ }; private: - FRIEND_TEST_ALL_PREFIXES(MessageLoopTypedTest, RunLoopQuitOrderAfter); - #if defined(OS_ANDROID) // Android doesn't support the blocking RunLoop::Run, so it calls // BeforeRun and AfterRun directly. @@ -285,11 +283,6 @@ // rather than pushed to Delegate to support nested RunLoops. bool quit_when_idle_received_ = false; - // True if use of QuitCurrent*Deprecated() is allowed. Taking a Quit*Closure() - // from a RunLoop implicitly sets this to false, so QuitCurrent*Deprecated() - // cannot be used while that RunLoop is being Run(). - bool allow_quit_current_deprecated_ = true; - // RunLoop is not thread-safe. Its state/methods, unless marked as such, may // not be accessed from any other sequence than the thread it was constructed // on. Exception: RunLoop can be safely accessed from one other sequence (or
diff --git a/base/task/sequence_manager/time_domain.h b/base/task/sequence_manager/time_domain.h index 2112eda..eff7613 100644 --- a/base/task/sequence_manager/time_domain.h +++ b/base/task/sequence_manager/time_domain.h
@@ -85,7 +85,7 @@ private: friend class internal::TaskQueueImpl; friend class TaskQueueManagerImpl; - friend class MockTimeDomain; + friend class TestTimeDomain; // Called when the TimeDomain is registered. // TODO(kraynov): Pass SequenceManager in the constructor.
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index 8d8dbd2..5c7e5b1 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py
@@ -844,9 +844,9 @@ if not args.all and not args.devices: self._parser.error(_GenerateMissingAllFlagMessage(devices)) - if self.supports_incremental: - incremental_apk_exists = False + incremental_apk_exists = False + if self.supports_incremental: if args.incremental_json: with open(args.incremental_json) as f: install_dict = json.load(f)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index bc69a9e..a2523f5c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -269,6 +269,8 @@ public static final String WEB_PAYMENTS_METHOD_SECTION_ORDER_V2 = "WebPaymentsMethodSectionOrderV2"; public static final String WEB_PAYMENTS_MODIFIERS = "WebPaymentsModifiers"; + public static final String WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD = + "ReturnGooglePayInBasicCard"; public static final String WEB_PAYMENTS_SINGLE_APP_UI_SKIP = "WebPaymentsSingleAppUiSkip"; public static final String WEBVR_AUTOPRESENT_FROM_INTENT = "WebVrAutopresentFromIntent"; public static final String WEBVR_CARDBOARD_SUPPORT = "WebVrCardboardSupport";
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java index 86ae6ae..93af017 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
@@ -685,10 +685,12 @@ /** * Gets the credit cards to suggest when filling a form or completing a transaction. The cards * will have been processed to be more relevant to the user. + * @param includeServerCards Whether server cards should be included in the response. */ - public List<CreditCard> getCreditCardsToSuggest() { + public List<CreditCard> getCreditCardsToSuggest(boolean includeServerCards) { ThreadUtils.assertOnUiThread(); - return getCreditCards(nativeGetCreditCardGUIDsToSuggest(mPersonalDataManagerAndroid)); + return getCreditCards( + nativeGetCreditCardGUIDsToSuggest(mPersonalDataManagerAndroid, includeServerCards)); } private List<CreditCard> getCreditCards(String[] creditCardGUIDs) { @@ -983,7 +985,7 @@ private native String[] nativeGetCreditCardGUIDsForSettings( long nativePersonalDataManagerAndroid); private native String[] nativeGetCreditCardGUIDsToSuggest( - long nativePersonalDataManagerAndroid); + long nativePersonalDataManagerAndroid, boolean includeServerCards); private native CreditCard nativeGetCreditCardByGUID(long nativePersonalDataManagerAndroid, String guid); private native CreditCard nativeGetCreditCardForNumber(long nativePersonalDataManagerAndroid,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java index 484d578..a0bd1af1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java
@@ -8,6 +8,7 @@ import android.text.TextUtils; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.autofill.CardType; import org.chromium.chrome.browser.autofill.PersonalDataManager; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; @@ -47,7 +48,9 @@ String unusedIFRameOrigin, byte[][] unusedCertificateChain, Map<String, PaymentDetailsModifier> modifiers, final InstrumentsCallback callback) { PersonalDataManager pdm = PersonalDataManager.getInstance(); - List<CreditCard> cards = pdm.getCreditCardsToSuggest(); + List<CreditCard> cards = + pdm.getCreditCardsToSuggest(/*includeServerCards=*/ChromeFeatureList.isEnabled( + ChromeFeatureList.WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD)); final List<PaymentInstrument> instruments = new ArrayList<>(cards.size()); if (methodDataMap.containsKey(BasicCardUtils.BASIC_CARD_METHOD_NAME)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java index 990b9ce..ba251df 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
@@ -1221,8 +1221,8 @@ mNtpSearchBoxTranslation.set(0, 0); mLocationBar.setTranslationY(0); if (!mUrlFocusChangeInProgress) { - mToolbarButtonsContainer.setTranslationY(0); - if (mHomeButton != null) mHomeButton.setTranslationY(0); + mToolbarButtonsContainer.setAlpha(1.f); + if (mHomeButton != null) mHomeButton.setAlpha(1.f); } if (!(mLocationBar.useModernDesign() && mUrlFocusChangeInProgress)) { @@ -1269,7 +1269,7 @@ Math.max(0, (mNtpSearchBoxBounds.top - mLocationBar.getTop())); mLocationBar.setTranslationY(locationBarTranslationY); - updateButtonsTranslationY(); + updateButtonsAlphaForNtp(); // Linearly interpolate between the bounds of the search box on the NTP and the omnibox // background bounds. |shrinkage| is the scaling factor for the offset -- if it's 1, we are @@ -1317,14 +1317,17 @@ } /** - * Update the y translation of the buttons to make it appear as if they were scrolling with - * the new tab page. + * Update the alpha of the toolbar buttons to make them disappear as the new tab page is + * scrolled. */ - private void updateButtonsTranslationY() { - int transY = mTabSwitcherState == STATIC_TAB ? Math.min(mNtpSearchBoxTranslation.y, 0) : 0; + private void updateButtonsAlphaForNtp() { + float transitionPercent = ((float) mNtpSearchBoxTranslation.y / (float) getHeight()); + float alpha = mTabSwitcherState == STATIC_TAB + ? MathUtils.clamp(1.f + transitionPercent, 0.f, 1.f) + : 1.f; - mToolbarButtonsContainer.setTranslationY(transY); - if (mHomeButton != null) mHomeButton.setTranslationY(transY); + mToolbarButtonsContainer.setAlpha(alpha); + if (mHomeButton != null) mHomeButton.setAlpha(alpha); } private void setAncestorsShouldClipChildren(boolean clip) { @@ -1976,7 +1979,7 @@ } } - updateButtonsTranslationY(); + updateButtonsAlphaForNtp(); mAnimateNormalToolbar = showToolbar; if (mTabSwitcherModeAnimation != null) mTabSwitcherModeAnimation.start(); @@ -2117,31 +2120,35 @@ float toolbarButtonTranslationX = MathUtils.flipSignIf( URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP, isRtl) * density; - final View menuButtonWrapper = getMenuButtonWrapper(); - if (menuButtonWrapper != null) { - animator = ObjectAnimator.ofFloat( - menuButtonWrapper, TRANSLATION_X, toolbarButtonTranslationX); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); - animators.add(animator); + // When the location bar is shown in the NTP, toolbar button animation is handled in + // #updateButtonsAlphaForNtp(). + if (!isLocationBarShownInNTP()) { + final View menuButtonWrapper = getMenuButtonWrapper(); + if (menuButtonWrapper != null) { + animator = ObjectAnimator.ofFloat( + menuButtonWrapper, TRANSLATION_X, toolbarButtonTranslationX); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); + animators.add(animator); - animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 0); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); - animators.add(animator); - } + animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 0); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); + animators.add(animator); + } - if (mToggleTabStackButton != null) { - animator = ObjectAnimator.ofFloat( - mToggleTabStackButton, TRANSLATION_X, toolbarButtonTranslationX); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); - animators.add(animator); + if (mToggleTabStackButton != null) { + animator = ObjectAnimator.ofFloat( + mToggleTabStackButton, TRANSLATION_X, toolbarButtonTranslationX); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); + animators.add(animator); - animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 0); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); - animators.add(animator); + animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 0); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); + animators.add(animator); + } } if (mLocationBar.useModernDesign()) { @@ -2158,33 +2165,37 @@ animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); + // When the location bar is shown in the NTP, toolbar button animation is handled in + // #updateButtonsAlphaForNtp(). final View menuButtonWrapper = getMenuButtonWrapper(); - if (menuButtonWrapper != null) { - animator = ObjectAnimator.ofFloat(menuButtonWrapper, TRANSLATION_X, 0); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); - animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); - animators.add(animator); + if (!isLocationBarShownInNTP()) { + if (menuButtonWrapper != null) { + animator = ObjectAnimator.ofFloat(menuButtonWrapper, TRANSLATION_X, 0); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); + animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); + animators.add(animator); - animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 1); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); - animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); - animators.add(animator); - } + animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 1); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); + animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); + animators.add(animator); + } - if (mToggleTabStackButton != null) { - animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); - animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); - animators.add(animator); + if (mToggleTabStackButton != null) { + animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); + animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); + animators.add(animator); - animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 1); - animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); - animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); - animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); - animators.add(animator); + animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 1); + animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); + animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); + animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); + animators.add(animator); + } } for (int i = 0; i < mLocationBar.getChildCount(); i++) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/AndroidUiGestureTarget.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/AndroidUiGestureTarget.java index 7477b58..610be94 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/AndroidUiGestureTarget.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/AndroidUiGestureTarget.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.vr_shell; +import android.os.Handler; import android.view.InputDevice; import android.view.MotionEvent; import android.view.View; @@ -39,6 +40,19 @@ } @CalledByNative + private void setDelayedEvent(int x, int y, int action, long timeInMs, int delayMs) { + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mMotionEventSynthesizer.setPointer( + 0 /* index */, x, y, 0 /* id */, MotionEvent.TOOL_TYPE_STYLUS); + mMotionEventSynthesizer.inject(action, 1 /* pointerCount */, timeInMs + delayMs, + InputDevice.SOURCE_CLASS_POINTER); + } + }, delayMs); + } + + @CalledByNative private long getNativeObject() { return mNativePointer; }
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 8564116..d9000ed3 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -1870,6 +1870,7 @@ "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressWithoutPhoneTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBlobUrlTest.java", + "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java index 0a13d1a..dca5d32 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
@@ -83,7 +83,9 @@ List<CreditCard> getCreditCardsToSuggest() throws ExecutionException { return ThreadUtils.runOnUiThreadBlocking( - () -> PersonalDataManager.getInstance().getCreditCardsToSuggest()); + () + -> PersonalDataManager.getInstance().getCreditCardsToSuggest( + /*includeServerCards=*/true)); } List<CreditCard> getCreditCardsForSettings() throws ExecutionException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java new file mode 100644 index 0000000..296fa98 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java
@@ -0,0 +1,77 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.payments; + +import android.support.test.filters.MediumTest; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.autofill.AutofillTestHelper; +import org.chromium.chrome.browser.autofill.CardType; +import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; +import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; +import org.chromium.chrome.browser.payments.PaymentRequestTestRule.MainActivityStartCallback; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; + +/** + * A payment integration test for checking whether user can make a payment via a credit card, + * depending on whether Google Pay cards are returned in basic-card. + */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +public class PaymentRequestCanMakePaymentGooglePayTest implements MainActivityStartCallback { + @Rule + public PaymentRequestTestRule mPaymentRequestTestRule = + new PaymentRequestTestRule("payment_request_can_make_payment_query_test.html", this); + + @Override + public void onMainActivityStarted() + throws InterruptedException, ExecutionException, TimeoutException { + // The user has a valid server credit card with a billing address on file. This is + // sufficient for canMakePayment() to return true. + AutofillTestHelper helper = new AutofillTestHelper(); + String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", + true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", + "US", "310-310-6000", "jon.doe@gmail.com", "en-US")); + helper.addServerCreditCard(new CreditCard("4754d21d-8773-40b6-b4be-5f7486be834f", + "https://example.com", false /* isLocal */, true /* isCached */, "Jon Doe", + "4111111111111111", "1111", "12", "2050", "visa", R.drawable.visa_card, + CardType.UNKNOWN, billingAddressId, "" /* serverId */)); + } + + @Test + @MediumTest + @Feature({"Payments"}) + @CommandLineFlags. + Add("enable-features=" + ChromeFeatureList.WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD) + public void testGooglePayServerCardsAllowed() + throws InterruptedException, ExecutionException, TimeoutException { + mPaymentRequestTestRule.openPageAndClickBuyAndWait( + mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); + mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); + } + + @Test + @MediumTest + @Feature({"Payments"}) + @CommandLineFlags. + Add("disable-features=" + ChromeFeatureList.WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD) + public void testGooglePayServerCardsNotAllowed() + throws InterruptedException, ExecutionException, TimeoutException { + mPaymentRequestTestRule.openPageAndClickBuyAndWait( + mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); + mPaymentRequestTestRule.expectResultContains(new String[] {"false"}); + } +}
diff --git a/chrome/app/app-Info.plist b/chrome/app/app-Info.plist index 94f0c91..d37d934f 100644 --- a/chrome/app/app-Info.plist +++ b/chrome/app/app-Info.plist
@@ -350,5 +350,7 @@ </array> <key>NSUserNotificationAlertStyle</key> <string>banner</string> + <key>NSRequiresAquaSystemAppearance</key> + <true/> </dict> </plist>
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index db72510e..4ee17c2 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -4539,16 +4539,6 @@ <message name="IDS_ARC_OPT_IN_DIALOG_METRICS_DISABLED" desc="Message in the opt-in dialog for Android apps in case metrics are disabled on the device. User has an option to active them using opt-in dialog"> Send system data. Automatically send diagnostic and device and app usage data to Google. You can change this at any time in your device <ph name="BEGIN_LINK1"><a href="#" id="settings-link"></ph>settings<ph name="END_LINK1"></a><ex></a></ex></ph>. If you turned on additional Web & App Activity, this information will be stored with your account so you can manage it in My Activity. <ph name="BEGIN_LINK2"><a href="#" id="learn-more-link-metrics"></ph>Learn More<ph name="END_LINK2"></a><ex></a></ex></ph> </message> - <message name="IDS_ARC_NOTIFICATION_METRICS_ENABLED_MANAGED_TITLE" desc="Title of notification shown to managed users who don't see the opt-in dialog as all settings are managed."> - Send system data - </message> - <message name="IDS_ARC_NOTIFICATION_METRICS_ENABLED_MANAGED_MESSAGE" desc="Message of notification shown to managed users who don't see the opt-in dialog as all settings are managed."> - This device currently automatically sends diagnostic and device and app usage data to Google. This setting is enforced by the owner. If you turned on additional Web & App Activity, this information will be stored with your account so you can manage it in My Activity. - - This is general information about your device and how you use it (such as battery level, app usage, and network connectivity). The data will be used to improve Google's products and services for everyone. Some aggregated information will help partners, such as Android developers, make their apps and products better, too. - Turning off this feature doesn't affect your device's ability to send the information needed for essential services such as system updates and security. - You can control this feature from Settings > Google. Select Usage & diagnostics from the menu. - </message> <message name="IDS_ARC_OPT_IN_DIALOG_BACKUP_RESTORE" desc="Message in the opt-in dialog for users to enable Backup and Restore for Android apps."> Back up to Google Drive. Easily restore your data or switch device at any time. Your backup includes app data. <ph name="BEGIN_LINK1"><a href="#" id="learn-more-link-backup-restore"></ph>Learn More<ph name="END_LINK1"></a><ex></a></ex></ph> </message>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 3c28ec26..917d76b 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -4220,6 +4220,9 @@ <message name="IDS_SETTINGS_RESET_CLEANUP_DETAILS_EXTENSIONS" desc="Introduces a bullet list containing the names of extensions to be removed by Chrome."> Extensions: </message> + <message name="IDS_SETTINGS_RESET_CLEANUP_DETAILS_EXTENSION_UNKNOWN" desc="Text for a list item among a list of extensions, where we could not determine the name of the extension being cleaned up."> + Unknown extension with ID <ph name="EXTENSION_ID">$1<ex>exampleextensionababababcdcdcdcd</ex></ph> + </message> <message name="IDS_SETTINGS_RESET_CLEANUP_DETAILS_FILES_AND_PROGRAMS" desc="Introduces a bullet list containing the names of files and programs to be removed by Chrome."> Files and programs: </message>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 431a762..930d415e 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1447,6 +1447,10 @@ {"top-chrome-md", flag_descriptions::kTopChromeMd, flag_descriptions::kTopChromeMdDescription, kOsDesktop, MULTI_VALUE_TYPE(kTopChromeMaterialDesignChoices)}, + {"close-buttons-inactive-tabs", + flag_descriptions::kCloseButtonsInactiveTabs, + flag_descriptions::kCloseButtonsInactiveTabsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kCloseButtonsInactiveTabs)}, {"site-settings", flag_descriptions::kSiteSettings, flag_descriptions::kSiteSettingsDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kSiteSettings)},
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index c9e01882..84c0651 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -131,6 +131,7 @@ &kVrBrowsingFeedback, &kVrBrowsingInCustomTab, &kVrBrowsingNativeAndroidUi, + &payments::features::kReturnGooglePayInBasicCard, &payments::features::kWebPaymentsMethodSectionOrderV2, &payments::features::kWebPaymentsModifiers, &payments::features::kWebPaymentsSingleAppUiSkip,
diff --git a/chrome/browser/android/download/download_manager_service.cc b/chrome/browser/android/download/download_manager_service.cc index ca8ed7d..cb1e79b0e 100644 --- a/chrome/browser/android/download/download_manager_service.cc +++ b/chrome/browser/android/download/download_manager_service.cc
@@ -204,6 +204,15 @@ } } +void DownloadManagerService::OpenDownload(download::DownloadItem* download, + int source) { + JNIEnv* env = base::android::AttachCurrentThread(); + ScopedJavaLocalRef<jobject> j_item = + JNI_DownloadManagerService_CreateJavaDownloadItem(env, download); + + Java_DownloadManagerService_openDownloadItem(env, java_ref_, j_item, source); +} + void DownloadManagerService::OpenDownload( JNIEnv* env, jobject obj, @@ -222,10 +231,7 @@ if (!item) return; - ScopedJavaLocalRef<jobject> j_item = - JNI_DownloadManagerService_CreateJavaDownloadItem(env, item); - - Java_DownloadManagerService_openDownloadItem(env, java_ref_, j_item, source); + OpenDownload(item, source); } void DownloadManagerService::ResumeDownload(
diff --git a/chrome/browser/android/download/download_manager_service.h b/chrome/browser/android/download/download_manager_service.h index 9a502396..2f6ce51 100644 --- a/chrome/browser/android/download/download_manager_service.h +++ b/chrome/browser/android/download/download_manager_service.h
@@ -57,6 +57,9 @@ // Called to Initialize this object. void Init(JNIEnv* env, jobject obj); + // Called to open a given download item. + void OpenDownload(download::DownloadItem* download, int source); + // Called to open a download item whose GUID is equal to |jdownload_guid|. void OpenDownload(JNIEnv* env, jobject obj,
diff --git a/chrome/browser/android/download/service/download_background_task.cc b/chrome/browser/android/download/service/download_background_task.cc index 720f35c..e46375c 100644 --- a/chrome/browser/android/download/service/download_background_task.cc +++ b/chrome/browser/android/download/service/download_background_task.cc
@@ -32,13 +32,13 @@ DCHECK(profile); TaskFinishedCallback finish_callback = - base::Bind(&CallTaskFinishedCallback, - base::android::ScopedJavaGlobalRef<jobject>(jcallback)); + base::BindOnce(&CallTaskFinishedCallback, + base::android::ScopedJavaGlobalRef<jobject>(jcallback)); DownloadService* download_service = DownloadServiceFactory::GetForBrowserContext(profile); download_service->OnStartScheduledTask( - static_cast<DownloadTaskType>(task_type), finish_callback); + static_cast<DownloadTaskType>(task_type), std::move(finish_callback)); } // static
diff --git a/chrome/browser/android/download/service/download_task_scheduler.cc b/chrome/browser/android/download/service/download_task_scheduler.cc index c9addd3..e11a3e4c 100644 --- a/chrome/browser/android/download/service/download_task_scheduler.cc +++ b/chrome/browser/android/download/service/download_task_scheduler.cc
@@ -18,8 +18,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) { + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) { JNIEnv* env = base::android::AttachCurrentThread(); Java_DownloadTaskScheduler_scheduleTask( env, static_cast<jint>(task_type), require_unmetered_network,
diff --git a/chrome/browser/android/download/service/download_task_scheduler.h b/chrome/browser/android/download/service/download_task_scheduler.h index 1ca0aab..ec4624cc 100644 --- a/chrome/browser/android/download/service/download_task_scheduler.h +++ b/chrome/browser/android/download/service/download_task_scheduler.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_ANDROID_DOWNLOAD_SERVICE_DOWNLOAD_TASK_SCHEDULER_H_ #include <jni.h> +#include <stdint.h> #include <memory> #include "base/macros.h" @@ -27,8 +28,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) override; + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) override; void CancelTask(DownloadTaskType task_type) override; private:
diff --git a/chrome/browser/android/vr/android_ui_gesture_target.cc b/chrome/browser/android/vr/android_ui_gesture_target.cc index 4d5821d..fef7600 100644 --- a/chrome/browser/android/vr/android_ui_gesture_target.cc +++ b/chrome/browser/android/vr/android_ui_gesture_target.cc
@@ -16,6 +16,9 @@ using base::android::JavaRef; using content::MotionEventAction; +static constexpr int kFrameDurationMs = 16; +static constexpr int kScrollEventsPerFrame = 2; + namespace vr { AndroidUiGestureTarget::AndroidUiGestureTarget(JNIEnv* env, @@ -77,12 +80,21 @@ SetPointer(scroll_x_, scroll_y_); Inject(content::MOTION_EVENT_ACTION_END, event_time_ms); break; - case blink::WebGestureEvent::kGestureScrollUpdate: - scroll_x_ += (scroll_ratio_ * gesture->data.scroll_update.delta_x); - scroll_y_ += (scroll_ratio_ * gesture->data.scroll_update.delta_y); + case blink::WebGestureEvent::kGestureScrollUpdate: { + float scale = scroll_ratio_ / kScrollEventsPerFrame; + scroll_x_ += gesture->data.scroll_update.delta_x * scale; + scroll_y_ += gesture->data.scroll_update.delta_y * scale; + SetPointer(scroll_x_, scroll_y_); Inject(content::MOTION_EVENT_ACTION_MOVE, event_time_ms); + + scroll_x_ += gesture->data.scroll_update.delta_x * scale; + scroll_y_ += gesture->data.scroll_update.delta_y * scale; + SetDelayedEvent(scroll_x_, scroll_y_, content::MOTION_EVENT_ACTION_MOVE, + event_time_ms, kFrameDurationMs / kScrollEventsPerFrame); + break; + } case blink::WebGestureEvent::kGestureTapDown: SetPointer(gesture->PositionInWidget().x, gesture->PositionInWidget().y); Inject(content::MOTION_EVENT_ACTION_START, event_time_ms); @@ -146,6 +158,21 @@ y * scale_factor_); } +void AndroidUiGestureTarget::SetDelayedEvent(int x, + int y, + MotionEventAction action, + int64_t time_ms, + int delay_ms) { + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); + if (obj.is_null()) + return; + + Java_AndroidUiGestureTarget_setDelayedEvent(env, obj, x * scale_factor_, + y * scale_factor_, action, + time_ms, delay_ms); +} + // static AndroidUiGestureTarget* AndroidUiGestureTarget::FromJavaObject( const JavaRef<jobject>& obj) {
diff --git a/chrome/browser/android/vr/android_ui_gesture_target.h b/chrome/browser/android/vr/android_ui_gesture_target.h index 76587f3b..3021564 100644 --- a/chrome/browser/android/vr/android_ui_gesture_target.h +++ b/chrome/browser/android/vr/android_ui_gesture_target.h
@@ -34,6 +34,11 @@ private: void Inject(content::MotionEventAction action, int64_t time_ms); void SetPointer(int x, int y); + void SetDelayedEvent(int x, + int y, + content::MotionEventAction action, + int64_t time_ms, + int delay_ms); int scroll_x_ = 0; int scroll_y_ = 0;
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device.cc b/chrome/browser/android/vr/arcore_device/arcore_device.cc index 5284b91..f090c42 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_device.cc
@@ -138,8 +138,9 @@ is_arcore_gl_thread_initialized_ = true; } -void ARCoreDevice::RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { +void ARCoreDevice::RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { DCHECK(IsOnMainThread()); // TODO(https://crbug.com/849568): Instead of splitting the initialization @@ -159,8 +160,8 @@ GetWeakPtr(), std::move(callback)); SatisfyRequestSessionPreconditions( - options.render_process_id, options.render_frame_id, - options.has_user_activation, std::move(preconditions_complete_callback)); + options->render_process_id, options->render_frame_id, + options->has_user_activation, std::move(preconditions_complete_callback)); } void ARCoreDevice::SatisfyRequestSessionPreconditions( @@ -380,7 +381,7 @@ } void ARCoreDevice::OnRequestSessionPreconditionsComplete( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool success) { DCHECK(IsOnMainThread()); DCHECK(is_arcore_gl_thread_initialized_); @@ -403,7 +404,7 @@ } void ARCoreDevice::OnARCoreGlInitializationComplete( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool success) { DCHECK(IsOnMainThread()); DCHECK(is_arcore_gl_thread_initialized_);
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device.h b/chrome/browser/android/vr/arcore_device/arcore_device.h index 79334c6..a8d271e 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device.h +++ b/chrome/browser/android/vr/arcore_device/arcore_device.h
@@ -34,8 +34,9 @@ // VRDeviceBase implementation. void PauseTracking() override; void ResumeTracking() override; - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; base::WeakPtr<ARCoreDevice> GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); @@ -102,10 +103,11 @@ base::OnceCallback<void(bool)> callback, bool was_android_camera_permission_granted); void OnRequestSessionPreconditionsComplete( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool success); - void OnARCoreGlInitializationComplete(VRDeviceRequestSessionCallback callback, - bool success); + void OnARCoreGlInitializationComplete( + mojom::XRRuntime::RequestSessionCallback callback, + bool success); scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; std::unique_ptr<vr::MailboxToSurfaceBridge> mailbox_bridge_;
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device_provider.cc b/chrome/browser/android/vr/arcore_device/arcore_device_provider.cc index 3dcd896..fe9666fa6 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device_provider.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_device_provider.cc
@@ -13,12 +13,15 @@ ARCoreDeviceProvider::~ARCoreDeviceProvider() = default; void ARCoreDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, device::VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { arcore_device_ = base::WrapUnique(new ARCoreDevice()); - add_device_callback.Run(arcore_device_->GetId(), arcore_device_.get()); + add_device_callback.Run(arcore_device_->GetId(), + arcore_device_->GetVRDisplayInfo(), + arcore_device_->BindXRRuntimePtr()); initialized_ = true; std::move(initialization_complete).Run(); }
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device_provider.h b/chrome/browser/android/vr/arcore_device/arcore_device_provider.h index 0bb559a3..48317db 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device_provider.h +++ b/chrome/browser/android/vr/arcore_device/arcore_device_provider.h
@@ -19,8 +19,9 @@ ARCoreDeviceProvider(); ~ARCoreDeviceProvider() override; void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override; bool Initialized() override;
diff --git a/chrome/browser/android/vr/vr_shell.cc b/chrome/browser/android/vr/vr_shell.cc index af245ef..e7d3870c 100644 --- a/chrome/browser/android/vr/vr_shell.cc +++ b/chrome/browser/android/vr/vr_shell.cc
@@ -707,10 +707,11 @@ void VrShell::ConnectPresentingService( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options) { - PostToGlThread(FROM_HERE, base::BindOnce(&VrShellGl::ConnectPresentingService, - gl_thread_->GetVrShellGl(), - std::move(display_info), options)); + device::mojom::XRDeviceRuntimeSessionOptionsPtr options) { + PostToGlThread(FROM_HERE, + base::BindOnce(&VrShellGl::ConnectPresentingService, + gl_thread_->GetVrShellGl(), + std::move(display_info), std::move(options))); } void VrShell::SetHistoryButtonsEnabled(JNIEnv* env,
diff --git a/chrome/browser/android/vr/vr_shell.h b/chrome/browser/android/vr/vr_shell.h index 11c045a..509b67fe 100644 --- a/chrome/browser/android/vr/vr_shell.h +++ b/chrome/browser/android/vr/vr_shell.h
@@ -251,7 +251,7 @@ void ConnectPresentingService( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options); + device::mojom::XRDeviceRuntimeSessionOptionsPtr options); // device::GvrGamepadDataProvider implementation. void UpdateGamepadData(device::GvrGamepadData) override;
diff --git a/chrome/browser/android/vr/vr_shell_delegate.cc b/chrome/browser/android/vr/vr_shell_delegate.cc index e44e416..e16f091 100644 --- a/chrome/browser/android/vr/vr_shell_delegate.cc +++ b/chrome/browser/android/vr/vr_shell_delegate.cc
@@ -175,7 +175,7 @@ void VrShellDelegate::OnPresentResult( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback, bool success) { DVLOG(1) << __FUNCTION__ << ": success=" << success; @@ -191,7 +191,7 @@ pending_successful_present_request_ = true; on_present_result_callback_ = base::BindOnce( &VrShellDelegate::OnPresentResult, base::Unretained(this), - std::move(display_info), options, std::move(callback)); + std::move(display_info), std::move(options), std::move(callback)); return; } @@ -206,7 +206,8 @@ DVLOG(1) << __FUNCTION__ << ": connecting presenting service"; request_present_response_callback_ = std::move(callback); - vr_shell_->ConnectPresentingService(std::move(display_info), options); + vr_shell_->ConnectPresentingService(std::move(display_info), + std::move(options)); } void VrShellDelegate::SendRequestPresentReply( @@ -298,7 +299,7 @@ void VrShellDelegate::StartWebXRPresentation( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback) { if (!on_present_result_callback_.is_null() || !request_present_response_callback_.is_null()) { @@ -308,9 +309,9 @@ return; } - on_present_result_callback_ = - base::BindOnce(&VrShellDelegate::OnPresentResult, base::Unretained(this), - std::move(display_info), options, std::move(callback)); + on_present_result_callback_ = base::BindOnce( + &VrShellDelegate::OnPresentResult, base::Unretained(this), + std::move(display_info), std::move(options), std::move(callback)); // If/When VRShell is ready for use it will call SetPresentResult. JNIEnv* env = AttachCurrentThread();
diff --git a/chrome/browser/android/vr/vr_shell_delegate.h b/chrome/browser/android/vr/vr_shell_delegate.h index fda45b6..0f6f05a 100644 --- a/chrome/browser/android/vr/vr_shell_delegate.h +++ b/chrome/browser/android/vr/vr_shell_delegate.h
@@ -82,7 +82,7 @@ void SetDeviceId(unsigned int device_id) override; void StartWebXRPresentation( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback) override; void OnListeningForActivateChanged(bool listening) override; @@ -90,7 +90,7 @@ void SetListeningForActivate(bool listening); void OnPresentResult( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback, bool success);
diff --git a/chrome/browser/android/vr/vr_shell_gl.cc b/chrome/browser/android/vr/vr_shell_gl.cc index db20d3e..138287d4 100644 --- a/chrome/browser/android/vr/vr_shell_gl.cc +++ b/chrome/browser/android/vr/vr_shell_gl.cc
@@ -413,7 +413,6 @@ content_overlay_surface_texture_ = gl::SurfaceTexture::Create(content_overlay_texture_id_); ui_surface_texture_ = gl::SurfaceTexture::Create(ui_texture_id); - webvr_surface_texture_ = gl::SurfaceTexture::Create(webvr_texture_id_); content_surface_ = std::make_unique<gl::ScopedJavaSurface>(content_surface_texture_.get()); @@ -437,8 +436,6 @@ weak_ptr_factory_.GetWeakPtr())); ui_surface_texture_->SetFrameAvailableCallback(base::BindRepeating( &VrShellGl::OnUiFrameAvailable, weak_ptr_factory_.GetWeakPtr())); - webvr_surface_texture_->SetFrameAvailableCallback(base::BindRepeating( - &VrShellGl::OnWebVRFrameAvailable, weak_ptr_factory_.GetWeakPtr())); content_surface_texture_->SetDefaultBufferSize( content_tex_buffer_size_.width(), content_tex_buffer_size_.height()); @@ -516,9 +513,25 @@ WebVrTryStartAnimatingFrame(false); } +void VrShellGl::CreateSurfaceBridge(gl::SurfaceTexture* surface_texture) { + DCHECK(!mailbox_bridge_); + mailbox_bridge_ready_ = false; + mailbox_bridge_ = std::make_unique<MailboxToSurfaceBridge>(); + if (surface_texture) { + mailbox_bridge_->CreateSurface(surface_texture); + } + mailbox_bridge_->CreateAndBindContextProvider(base::BindOnce( + &VrShellGl::OnGpuProcessConnectionReady, weak_ptr_factory_.GetWeakPtr())); +} + void VrShellGl::CreateOrResizeWebVRSurface(const gfx::Size& size) { DVLOG(2) << __FUNCTION__ << ": size=" << size.width() << "x" << size.height(); if (!webvr_surface_texture_) { + if (webxr_use_shared_buffer_draw_) { + // We don't have a surface in SharedBuffer mode, just update the size. + webvr_surface_size_ = size; + return; + } DLOG(ERROR) << "No WebVR surface texture available"; return; } @@ -542,12 +555,7 @@ if (mailbox_bridge_) { mailbox_bridge_->ResizeSurface(size.width(), size.height()); } else { - mailbox_bridge_ready_ = false; - mailbox_bridge_ = std::make_unique<MailboxToSurfaceBridge>(); - mailbox_bridge_->CreateSurface(webvr_surface_texture_.get()); - mailbox_bridge_->CreateAndBindContextProvider( - base::BindOnce(&VrShellGl::OnGpuProcessConnectionReady, - weak_ptr_factory_.GetWeakPtr())); + CreateSurfaceBridge(webvr_surface_texture_.get()); } } @@ -833,7 +841,7 @@ void VrShellGl::ConnectPresentingService( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options) { + device::mojom::XRDeviceRuntimeSessionOptionsPtr options) { ClosePresentationBindings(); device::mojom::VRPresentationProviderPtr provider; @@ -845,12 +853,27 @@ DVLOG(1) << __FUNCTION__ << ": resize initial to " << webvr_size.width() << "x" << webvr_size.height(); - CreateOrResizeWebVRSurface(webvr_size); + // Decide which transport mechanism we want to use. This sets + // the webxr_use_* options as a side effect. + device::mojom::VRDisplayFrameTransportOptionsPtr transport_options = + GetWebVrFrameTransportOptions(options); + + if (webxr_use_shared_buffer_draw_) { + CreateSurfaceBridge(nullptr); + } else { + if (!webvr_surface_texture_) { + webvr_surface_texture_ = gl::SurfaceTexture::Create(webvr_texture_id_); + webvr_surface_texture_->SetFrameAvailableCallback(base::BindRepeating( + &VrShellGl::OnWebVRFrameAvailable, weak_ptr_factory_.GetWeakPtr())); + } + CreateOrResizeWebVRSurface(webvr_size); + } + ScheduleOrCancelWebVrFrameTimeout(); browser_->SendRequestPresentReply(true, mojo::MakeRequest(&submit_client_), std::move(provider), - GetWebVrFrameTransportOptions(options)); + std::move(transport_options)); } void VrShellGl::OnSwapContents(int new_content_id) { @@ -1035,7 +1058,7 @@ device::mojom::VRDisplayFrameTransportOptionsPtr VrShellGl::GetWebVrFrameTransportOptions( - const device::XRDeviceRuntimeSessionOptions& options) { + const device::mojom::XRDeviceRuntimeSessionOptionsPtr& options) { DVLOG(1) << __FUNCTION__; MetricsUtilAndroid::XRRenderPath render_path = @@ -1063,7 +1086,7 @@ if (gl::GLFence::IsGpuFenceSupported()) { webxr_use_gpu_fence_ = true; if (base::AndroidHardwareBufferCompat::IsSupportAvailable() && - !options.use_legacy_webvr_render_path) { + !options->use_legacy_webvr_render_path) { // Currently, SharedBuffer mode is only supported for WebXR via // XRWebGlDrawingBuffer, WebVR 1.1 doesn't use that. webxr_use_shared_buffer_draw_ = true;
diff --git a/chrome/browser/android/vr/vr_shell_gl.h b/chrome/browser/android/vr/vr_shell_gl.h index 038c8ef4..3d93bc2 100644 --- a/chrome/browser/android/vr/vr_shell_gl.h +++ b/chrome/browser/android/vr/vr_shell_gl.h
@@ -292,6 +292,7 @@ } void SetWebVrMode(bool enabled); + void CreateSurfaceBridge(gl::SurfaceTexture* surface_texture); void CreateOrResizeWebVRSurface(const gfx::Size& size); void WebVrCreateOrResizeSharedBufferImage(WebXrSharedBuffer* buffer, const gfx::Size& size); @@ -306,7 +307,7 @@ void ConnectPresentingService( device::mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options); + device::mojom::XRDeviceRuntimeSessionOptionsPtr options); void set_is_exiting(bool exiting) { is_exiting_ = exiting; } @@ -331,8 +332,11 @@ private: void GvrInit(gvr_context* gvr_api); + device::mojom::VRDisplayFrameTransportOptionsPtr - GetWebVrFrameTransportOptions(const device::XRDeviceRuntimeSessionOptions&); + GetWebVrFrameTransportOptions( + const device::mojom::XRDeviceRuntimeSessionOptionsPtr&); + void InitializeRenderer(); void UpdateViewports(); void OnGpuProcessConnectionReady();
diff --git a/chrome/browser/android/webapk/webapk_install_service.cc b/chrome/browser/android/webapk/webapk_install_service.cc index 5b79eaf..ad45aaa 100644 --- a/chrome/browser/android/webapk/webapk_install_service.cc +++ b/chrome/browser/android/webapk/webapk_install_service.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/android/webapk/webapk_install_service.h" +#include <utility> + #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "base/bind.h" @@ -60,9 +62,9 @@ void WebApkInstallService::UpdateAsync( const base::FilePath& update_request_path, - const FinishCallback& finish_callback) { + FinishCallback finish_callback) { WebApkInstaller::UpdateAsync(browser_context_, update_request_path, - finish_callback); + std::move(finish_callback)); } void WebApkInstallService::OnFinishedInstall(
diff --git a/chrome/browser/android/webapk/webapk_install_service.h b/chrome/browser/android/webapk/webapk_install_service.h index a928d705..5f66f384 100644 --- a/chrome/browser/android/webapk/webapk_install_service.h +++ b/chrome/browser/android/webapk/webapk_install_service.h
@@ -54,7 +54,7 @@ // from the WebAPK server. // - the package name of the WebAPK. using FinishCallback = - base::Callback<void(WebApkInstallResult, bool, const std::string&)>; + base::OnceCallback<void(WebApkInstallResult, bool, const std::string&)>; static WebApkInstallService* Get(content::BrowserContext* browser_context); @@ -78,7 +78,7 @@ // |update_request_path| is the path of the file with the update request. // Calls |finish_callback| once the update completed or failed. void UpdateAsync(const base::FilePath& update_request_path, - const FinishCallback& finish_callback); + FinishCallback finish_callback); private: // Observes the lifetime of a WebContents.
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc index 526e1325..6839fd3 100644 --- a/chrome/browser/android/webapk/webapk_installer.cc +++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -312,20 +312,20 @@ const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& finish_callback) { + FinishCallback finish_callback) { // The installer will delete itself when it is done. WebApkInstaller* installer = new WebApkInstaller(context); installer->InstallAsync(shortcut_info, primary_icon, badge_icon, - finish_callback); + std::move(finish_callback)); } // static void WebApkInstaller::UpdateAsync(content::BrowserContext* context, const base::FilePath& update_request_path, - const FinishCallback& finish_callback) { + FinishCallback finish_callback) { // The installer will delete itself when it is done. WebApkInstaller* installer = new WebApkInstaller(context); - installer->UpdateAsync(update_request_path, finish_callback); + installer->UpdateAsync(update_request_path, std::move(finish_callback)); } // static @@ -333,16 +333,17 @@ const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& callback) { - installer->InstallAsync(shortcut_info, primary_icon, badge_icon, callback); + FinishCallback callback) { + installer->InstallAsync(shortcut_info, primary_icon, badge_icon, + std::move(callback)); } // static void WebApkInstaller::UpdateAsyncForTesting( WebApkInstaller* installer, const base::FilePath& update_request_path, - const FinishCallback& finish_callback) { - installer->UpdateAsync(update_request_path, finish_callback); + FinishCallback finish_callback) { + installer->UpdateAsync(update_request_path, std::move(finish_callback)); } void WebApkInstaller::SetTimeoutMs(int timeout_ms) { @@ -365,13 +366,14 @@ const std::string& version, const std::map<std::string, std::string>& icon_url_to_murmur2_hash, bool is_manifest_stale, - const base::Callback<void(std::unique_ptr<std::string>)>& callback) { + base::OnceCallback<void(std::unique_ptr<std::string>)> callback) { base::PostTaskAndReplyWithResult( GetBackgroundTaskRunner().get(), FROM_HERE, - base::Bind(&BuildProtoInBackground, shortcut_info, primary_icon, - badge_icon, package_name, version, icon_url_to_murmur2_hash, - is_manifest_stale, WebApkUpdateReason::NONE), - callback); + base::BindOnce(&BuildProtoInBackground, shortcut_info, primary_icon, + badge_icon, package_name, version, + icon_url_to_murmur2_hash, is_manifest_stale, + WebApkUpdateReason::NONE), + std::move(callback)); } // static @@ -385,13 +387,14 @@ const std::map<std::string, std::string>& icon_url_to_murmur2_hash, bool is_manifest_stale, WebApkUpdateReason update_reason, - const base::Callback<void(bool)> callback) { + base::OnceCallback<void(bool)> callback) { base::PostTaskAndReplyWithResult( GetBackgroundTaskRunner().get(), FROM_HERE, - base::Bind(&StoreUpdateRequestToFileInBackground, update_request_path, - shortcut_info, primary_icon, badge_icon, package_name, version, - icon_url_to_murmur2_hash, is_manifest_stale, update_reason), - callback); + base::BindOnce(&StoreUpdateRequestToFileInBackground, update_request_path, + shortcut_info, primary_icon, badge_icon, package_name, + version, icon_url_to_murmur2_hash, is_manifest_stale, + update_reason), + std::move(callback)); } void WebApkInstaller::InstallOrUpdateWebApk(const std::string& package_name, @@ -422,7 +425,7 @@ void WebApkInstaller::OnResult(WebApkInstallResult result) { weak_ptr_factory_.InvalidateWeakPtrs(); - finish_callback_.Run(result, relax_updates_, webapk_package_); + std::move(finish_callback_).Run(result, relax_updates_, webapk_package_); if (task_type_ == WebApkInstaller::INSTALL) { if (result == WebApkInstallResult::SUCCESS) { @@ -456,14 +459,14 @@ void WebApkInstaller::InstallAsync(const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& finish_callback) { + FinishCallback finish_callback) { install_duration_timer_.reset(new base::ElapsedTimer()); install_shortcut_info_.reset(new ShortcutInfo(shortcut_info)); install_primary_icon_ = primary_icon; install_badge_icon_ = badge_icon; short_name_ = shortcut_info.short_name; - finish_callback_ = finish_callback; + finish_callback_ = std::move(finish_callback); task_type_ = INSTALL; CheckFreeSpace(); @@ -498,15 +501,15 @@ } void WebApkInstaller::UpdateAsync(const base::FilePath& update_request_path, - const FinishCallback& finish_callback) { - finish_callback_ = finish_callback; + FinishCallback finish_callback) { + finish_callback_ = std::move(finish_callback); task_type_ = UPDATE; base::PostTaskAndReplyWithResult( GetBackgroundTaskRunner().get(), FROM_HERE, - base::Bind(&ReadFileInBackground, update_request_path), - base::Bind(&WebApkInstaller::OnReadUpdateRequest, - weak_ptr_factory_.GetWeakPtr())); + base::BindOnce(&ReadFileInBackground, update_request_path), + base::BindOnce(&WebApkInstaller::OnReadUpdateRequest, + weak_ptr_factory_.GetWeakPtr())); } void WebApkInstaller::OnReadUpdateRequest( @@ -629,8 +632,8 @@ BuildProto(*install_shortcut_info_, install_primary_icon_, install_badge_icon_, "" /* package_name */, "" /* version */, icon_url_to_murmur2_hash, false /* is_manifest_stale */, - base::Bind(&WebApkInstaller::SendRequest, - weak_ptr_factory_.GetWeakPtr())); + base::BindOnce(&WebApkInstaller::SendRequest, + weak_ptr_factory_.GetWeakPtr())); } void WebApkInstaller::SendRequest(
diff --git a/chrome/browser/android/webapk/webapk_installer.h b/chrome/browser/android/webapk/webapk_installer.h index 7c342be..b0d7aefa 100644 --- a/chrome/browser/android/webapk/webapk_installer.h +++ b/chrome/browser/android/webapk/webapk_installer.h
@@ -8,6 +8,7 @@ #include <jni.h> #include <map> #include <memory> +#include <string> #include "base/android/scoped_java_ref.h" #include "base/callback.h" @@ -58,7 +59,7 @@ const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& finish_callback); + FinishCallback finish_callback); // Creates a self-owned WebApkInstaller instance and talks to the Chrome // WebAPK server to update a WebAPK on the server and locally requests the @@ -66,7 +67,7 @@ // |update_request_path| is the path of the file with the update request. static void UpdateAsync(content::BrowserContext* context, const base::FilePath& update_request_path, - const FinishCallback& callback); + FinishCallback callback); // Calls the private function |InstallAsync| for testing. // Should be used only for testing. @@ -74,13 +75,13 @@ const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& callback); + FinishCallback callback); // Calls the private function |UpdateAsync| for testing. // Should be used only for testing. static void UpdateAsyncForTesting(WebApkInstaller* installer, const base::FilePath& update_request_path, - const FinishCallback& callback); + FinishCallback callback); // Sets the timeout for the server requests. void SetTimeoutMs(int timeout_ms); @@ -108,7 +109,7 @@ const std::string& version, const std::map<std::string, std::string>& icon_url_to_murmur2_hash, bool is_manifest_stale, - const base::Callback<void(std::unique_ptr<std::string>)>& callback); + base::OnceCallback<void(std::unique_ptr<std::string>)> callback); // Builds the WebAPK proto for an update or an install request and stores it // to |update_request_path|. Runs |callback| with a boolean indicating @@ -123,7 +124,7 @@ const std::map<std::string, std::string>& icon_url_to_murmur2_hash, bool is_manifest_stale, WebApkUpdateReason update_reason, - const base::Callback<void(bool)> callback); + base::OnceCallback<void(bool)> callback); protected: explicit WebApkInstaller(content::BrowserContext* browser_context); @@ -156,14 +157,14 @@ void InstallAsync(const ShortcutInfo& shortcut_info, const SkBitmap& primary_icon, const SkBitmap& badge_icon, - const FinishCallback& finish_callback); + FinishCallback finish_callback); // Talks to the Chrome WebAPK server to update a WebAPK on the server and to // the Google Play server to install the downloaded WebAPK. // |update_request_path| is the path of the file with the update request. // Calls |finish_callback| once the update completed or failed. void UpdateAsync(const base::FilePath& update_request_path, - const FinishCallback& finish_callback); + FinishCallback finish_callback); // Called once there is sufficient space on the user's device to install a // WebAPK. The user may already have had sufficient space on their device
diff --git a/chrome/browser/android/webapk/webapk_installer_unittest.cc b/chrome/browser/android/webapk/webapk_installer_unittest.cc index f244d7097..776d530 100644 --- a/chrome/browser/android/webapk/webapk_installer_unittest.cc +++ b/chrome/browser/android/webapk/webapk_installer_unittest.cc
@@ -4,9 +4,7 @@ #include "chrome/browser/android/webapk/webapk_installer.h" -#include <jni.h> -#include <memory> -#include <string> +#include <utility> #include "base/android/scoped_java_ref.h" #include "base/bind.h" @@ -116,8 +114,8 @@ info.best_badge_icon_url = best_badge_icon_url_; WebApkInstaller::InstallAsyncForTesting( CreateWebApkInstaller(), info, SkBitmap(), SkBitmap(), - base::Bind(&WebApkInstallerRunner::OnCompleted, - base::Unretained(this))); + base::BindOnce(&WebApkInstallerRunner::OnCompleted, + base::Unretained(this))); run_loop.Run(); } @@ -128,8 +126,8 @@ WebApkInstaller::UpdateAsyncForTesting( CreateWebApkInstaller(), update_request_path, - base::Bind(&WebApkInstallerRunner::OnCompleted, - base::Unretained(this))); + base::BindOnce(&WebApkInstallerRunner::OnCompleted, + base::Unretained(this))); run_loop.Run(); } @@ -183,7 +181,8 @@ update_request_path, ShortcutInfo((GURL())), SkBitmap(), SkBitmap(), "", "", std::map<std::string, std::string>(), false, WebApkUpdateReason::PRIMARY_ICON_HASH_DIFFERS, - base::Bind(&UpdateRequestStorer::OnComplete, base::Unretained(this))); + base::BindOnce(&UpdateRequestStorer::OnComplete, + base::Unretained(this))); run_loop.Run(); } @@ -233,8 +232,8 @@ WebApkInstaller::BuildProto( info, primary_icon, badge_icon, "" /* package_name */, "" /* version */, icon_url_to_murmur2_hash, is_manifest_stale, - base::Bind(&BuildProtoRunner::OnBuiltWebApkProto, - base::Unretained(this))); + base::BindOnce(&BuildProtoRunner::OnBuiltWebApkProto, + base::Unretained(this))); base::RunLoop run_loop; on_completed_callback_ = run_loop.QuitClosure(); @@ -289,7 +288,7 @@ void SetUp() override { test_server_.AddDefaultHandlers(base::FilePath(kTestDataDir)); - test_server_.RegisterRequestHandler(base::Bind( + test_server_.RegisterRequestHandler(base::BindRepeating( &WebApkInstallerTest::HandleWebApkRequest, base::Unretained(this))); ASSERT_TRUE(test_server_.Start()); @@ -439,7 +438,7 @@ // Test that an HTTP response which cannot be parsed as a webapk::WebApkResponse // is handled properly. TEST_F(WebApkInstallerTest, UnparsableCreateWebApkResponse) { - SetWebApkResponseBuilder(base::Bind(&BuildUnparsableWebApkResponse)); + SetWebApkResponseBuilder(base::BindRepeating(&BuildUnparsableWebApkResponse)); std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); runner->RunInstallWebApk(); @@ -466,7 +465,7 @@ // - The most up to date version of the WebAPK on the server is identical to the // one installed on the client. TEST_F(WebApkInstallerTest, UpdateSuccessWithEmptyTokenInResponse) { - SetWebApkResponseBuilder(base::Bind(&BuildValidWebApkResponse, "")); + SetWebApkResponseBuilder(base::BindRepeating(&BuildValidWebApkResponse, "")); ScopedTempFile scoped_file; base::FilePath update_request_path = scoped_file.GetFilePath();
diff --git a/chrome/browser/android/webapk/webapk_update_manager.cc b/chrome/browser/android/webapk/webapk_update_manager.cc index 93f3d881..2aecc2c7 100644 --- a/chrome/browser/android/webapk/webapk_update_manager.cc +++ b/chrome/browser/android/webapk/webapk_update_manager.cc
@@ -128,8 +128,8 @@ base::FilePath(update_request_path), info, primary_icon, badge_icon, webapk_package, std::to_string(java_webapk_version), icon_url_to_murmur2_hash, java_is_manifest_stale, update_reason, - base::Bind(&OnStoredUpdateRequest, - ScopedJavaGlobalRef<jobject>(java_callback))); + base::BindOnce(&OnStoredUpdateRequest, + ScopedJavaGlobalRef<jobject>(java_callback))); } // static JNI method.
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc index 063a2a22..97c2fa15 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.cc +++ b/chrome/browser/autofill/android/personal_data_manager_android.cc
@@ -475,10 +475,11 @@ base::android::ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( JNIEnv* env, - const base::android::JavaParamRef<jobject>& unused_obj) { - return GetCreditCardGUIDs(env, - personal_data_manager_->GetCreditCardsToSuggest( - /*include_server_cards=*/true)); + const base::android::JavaParamRef<jobject>& unused_obj, + bool include_server_cards) { + return GetCreditCardGUIDs( + env, + personal_data_manager_->GetCreditCardsToSuggest(include_server_cards)); } ScopedJavaLocalRef<jobject> PersonalDataManagerAndroid::GetCreditCardByGUID(
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.h b/chrome/browser/autofill/android/personal_data_manager_android.h index b64fe258..b33bfc6 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.h +++ b/chrome/browser/autofill/android/personal_data_manager_android.h
@@ -126,7 +126,8 @@ // PersonalDataManager::GetCreditCardsToSuggest for more details. base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDsToSuggest( JNIEnv* env, - const base::android::JavaParamRef<jobject>& unused_obj); + const base::android::JavaParamRef<jobject>& unused_obj, + bool include_server_cards); // Returns the credit card with the specified |jguid|, or NULL if there is // no credit card with the specified |jguid|.
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index a21e4d3..496e7aa 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc
@@ -101,7 +101,7 @@ #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" -#include "components/previews/core/previews_features.h" +#include "components/previews/core/previews_experiments.h" #include "components/rappor/public/rappor_utils.h" #include "components/rappor/rappor_service_impl.h" #include "components/sessions/core/session_id_generator.h" @@ -1299,7 +1299,7 @@ DCHECK(!optimization_guide_service_); created_optimization_guide_service_ = true; - if (!base::FeatureList::IsEnabled(previews::features::kOptimizationHints)) + if (!previews::params::IsOptimizationHintsEnabled()) return; optimization_guide_service_ =
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 08cbf4e..e21d6c4 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3702,7 +3702,11 @@ std::vector<service_manager::Identity> ChromeContentBrowserClient::GetStartupServices() { +#if defined(OS_ANDROID) return {service_manager::Identity("download_manager")}; +#else + return {}; +#endif } void ChromeContentBrowserClient::OpenURL(
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc index c692eb5..64753d1c 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -12,7 +12,6 @@ #include "base/logging.h" #include "base/strings/string16.h" #include "base/strings/string_split.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/chromeos/arc/arc_migration_guide_notification.h" @@ -35,8 +34,6 @@ #include "chrome/browser/ui/app_list/arc/arc_pai_starter.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/simple_message_box.h" -#include "chrome/grit/generated_resources.h" #include "chromeos/chromeos_switches.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -53,7 +50,6 @@ #include "components/prefs/pref_service.h" #include "components/session_manager/core/session_manager.h" #include "content/public/browser/browser_thread.h" -#include "ui/base/l10n/l10n_util.h" #include "ui/display/types/display_constants.h" namespace arc { @@ -94,27 +90,6 @@ return chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); } -void ShowUMAConsentMessageBox() { - session_manager::SessionManager* manager = - session_manager::SessionManager::Get(); - // SessionManager may not be available in unittests. - // TODO(lgcheng@) Temporarily drop this warning if login screen is still - // present. Fix this when we have full spec what EDU requests. - if (!manager || - manager->session_state() != session_manager::SessionState::ACTIVE) { - LOG(ERROR) << "Login screen is still present. Dropping request to show UMA " - "consent message box"; - return; - } - - chrome::ShowWarningMessageBox( - nullptr, - l10n_util::GetStringUTF16( - IDS_ARC_NOTIFICATION_METRICS_ENABLED_MANAGED_TITLE), - l10n_util::GetStringUTF16( - IDS_ARC_NOTIFICATION_METRICS_ENABLED_MANAGED_MESSAGE)); -} - // Returns true if launching the Play Store on OptIn succeeded is needed. // Launch Play Store app, except for the following cases: // * When Opt-in verification is disabled (for tests); @@ -801,13 +776,11 @@ } if (!IsArcTermsOfServiceNegotiationNeeded(profile_)) { - // Show a notification about stats reporting if enabled in the case where - // it isn't shown during ToS negotiation. if (IsArcStatsReportingEnabled() && !profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { - VLOG(1) << "Showing stats reporting notification"; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(&ShowUMAConsentMessageBox)); + // Don't enable stats reporting for users who are not shown the reporting + // notice during ARC setup. + profile_->GetPrefs()->SetBoolean(prefs::kArcSkippedReportingNotice, true); } // Moves to next state, Android management check, immediately, as if
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc index 8545c27e..428655e8 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc
@@ -526,6 +526,15 @@ // reporting notice during ARC setup. return; } + if (consent && initial_sync && + profile_->GetPrefs()->GetBoolean(prefs::kArcSkippedReportingNotice)) { + // Explicitly leave reporting off for users who did not get a reporting + // notice during setup, but otherwise would have reporting on due to the + // result of |IsArcStatsReportingEnabled()| during setup. Typically this is + // due to the fact that ArcSessionManager was able to skip the setup UI for + // managed users. + consent = false; + } base::DictionaryValue extras; extras.SetBoolean("reportingConsent", consent); SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_REPORTING_CONSENT",
diff --git a/chrome/browser/chromeos/child_accounts/screen_time_controller.cc b/chrome/browser/chromeos/child_accounts/screen_time_controller.cc index 42b26ded..2086d347 100644 --- a/chrome/browser/chromeos/child_accounts/screen_time_controller.cc +++ b/chrome/browser/chromeos/child_accounts/screen_time_controller.cc
@@ -40,13 +40,16 @@ // The notifier id representing the app. constexpr char kTimeLimitNotifierId[] = "family-link"; -// Dictionary keys for prefs::kScreenTimeLastState. Time relavant states are -// not saved because processor should not count on them as they could become -// invalid easiliy. +// Dictionary keys for prefs::kScreenTimeLastState. constexpr char kScreenStateLocked[] = "locked"; constexpr char kScreenStateCurrentPolicyType[] = "active_policy"; constexpr char kScreenStateTimeUsageLimitEnabled[] = "time_usage_limit_enabled"; +constexpr char kScreenStateRemainingUsage[] = "remaining_usage"; +constexpr char kScreenStateUsageLimitStarted[] = "usage_limit_started"; +constexpr char kScreenStateNextStateChangeTime[] = "next_state_change_time"; constexpr char kScreenStateNextPolicyType[] = "next_active_policy"; +constexpr char kScreenStateNextUnlockTime[] = "next_unlock_time"; +constexpr char kScreenStateLastStateChanged[] = "last_state_changed"; } // namespace @@ -99,14 +102,11 @@ SaveCurrentStateToPref(state); if (state.is_locked) { - base::Time reset_time = usage_time_limit::GetExpectedResetTime( - time_limit->CreateDeepCopy(), now); - LockScreen(true /*force_lock_by_policy*/, reset_time); + DCHECK(!state.next_unlock_time.is_null()); + LockScreen(true /*force_lock_by_policy*/, state.next_unlock_time); } else { - if (state.active_policy == - usage_time_limit::ActivePolicies::kNoActivePolicy) - RefreshScreenLimit(); - LockScreen(false /*force_lock_by_policy*/, base::Time() /*come_back_time*/); + LockScreen(false /*force_lock_by_policy*/, + base::Time() /*next_unlock_time*/); base::Optional<TimeLimitNotificationType> notification_type; switch (state.next_state_active_policy) { @@ -149,10 +149,22 @@ base::BindRepeating(&ScreenTimeController::CheckTimeLimit, base::Unretained(this))); } + + // Schedule timer to refresh the screen time usage. + base::Time reset_time = + usage_time_limit::GetExpectedResetTime(time_limit->CreateDeepCopy(), now); + if (reset_time <= now) { + RefreshScreenLimit(); + } else { + reset_screen_time_timer_.Start( + FROM_HERE, reset_time - now, + base::BindRepeating(&ScreenTimeController::RefreshScreenLimit, + base::Unretained(this))); + } } void ScreenTimeController::LockScreen(bool force_lock_by_policy, - base::Time come_back_time) { + base::Time next_unlock_time) { bool is_locked = session_manager::SessionManager::Get()->IsScreenLocked(); // No-op if the screen is currently not locked and policy does not force the // lock. @@ -172,7 +184,7 @@ ->GetAccountId(); LoginScreenClient::Get()->login_screen()->SetAuthEnabledForUser( account_id, !force_lock_by_policy, - force_lock_by_policy ? come_back_time : base::Optional<base::Time>()); + force_lock_by_policy ? next_unlock_time : base::Optional<base::Time>()); } void ScreenTimeController::ShowNotification( @@ -222,6 +234,7 @@ warning_notification_timer_.Stop(); exit_notification_timer_.Stop(); save_screen_time_timer_.Stop(); + reset_screen_time_timer_.Stop(); } void ScreenTimeController::SaveScreenTimeProgressBeforeExit() { @@ -252,9 +265,19 @@ base::Value(static_cast<int>(state.active_policy))); state_dict->SetKey(kScreenStateTimeUsageLimitEnabled, base::Value(state.is_time_usage_limit_enabled)); + state_dict->SetKey(kScreenStateRemainingUsage, + base::Value(state.remaining_usage.InMinutes())); + state_dict->SetKey(kScreenStateUsageLimitStarted, + base::Value(state.time_usage_limit_started.ToDoubleT())); + state_dict->SetKey(kScreenStateNextStateChangeTime, + base::Value(state.next_state_change_time.ToDoubleT())); state_dict->SetKey( kScreenStateNextPolicyType, base::Value(static_cast<int>(state.next_state_active_policy))); + state_dict->SetKey(kScreenStateNextUnlockTime, + base::Value(state.next_unlock_time.ToDoubleT())); + state_dict->SetKey(kScreenStateLastStateChanged, + base::Value(state.last_state_changed.ToDoubleT())); pref_service_->Set(prefs::kScreenTimeLastState, *state_dict); pref_service_->CommitPendingWrite(); @@ -295,6 +318,30 @@ return base::nullopt; result.is_time_usage_limit_enabled = time_usage_limit_enabled->GetBool(); + // Verify remaining_usage from the pref is a int value. + const base::Value* remaining_usage = + last_state->FindKey(kScreenStateRemainingUsage); + if (!remaining_usage || !remaining_usage->is_int()) + return base::nullopt; + result.remaining_usage = + base::TimeDelta::FromMinutes(remaining_usage->GetInt()); + + // Verify time_usage_limit_started from the pref is a double value. + const base::Value* time_usage_limit_started = + last_state->FindKey(kScreenStateUsageLimitStarted); + if (!time_usage_limit_started || !time_usage_limit_started->is_double()) + return base::nullopt; + result.time_usage_limit_started = + base::Time::FromDoubleT(time_usage_limit_started->GetDouble()); + + // Verify next_state_change_time from the pref is a double value. + const base::Value* next_state_change_time = + last_state->FindKey(kScreenStateNextStateChangeTime); + if (!next_state_change_time || !next_state_change_time->is_double()) + return base::nullopt; + result.next_state_change_time = + base::Time::FromDoubleT(next_state_change_time->GetDouble()); + // Verify next policy type is a value of usage_time_limit::ActivePolicies. const base::Value* next_active_policy = last_state->FindKey(kScreenStateNextPolicyType); @@ -307,6 +354,22 @@ result.next_state_active_policy = static_cast<usage_time_limit::ActivePolicies>( next_active_policy->GetInt()); + + // Verify next_unlock_time from the pref is a double value. + const base::Value* next_unlock_time = + last_state->FindKey(kScreenStateNextUnlockTime); + if (!next_unlock_time || !next_unlock_time->is_double()) + return base::nullopt; + result.next_unlock_time = + base::Time::FromDoubleT(next_unlock_time->GetDouble()); + + // Verify last_state_changed from the pref is a double value. + const base::Value* last_state_changed = + last_state->FindKey(kScreenStateLastStateChanged); + if (!last_state_changed || !last_state_changed->is_double()) + return base::nullopt; + result.last_state_changed = + base::Time::FromDoubleT(last_state_changed->GetDouble()); return result; }
diff --git a/chrome/browser/chromeos/child_accounts/screen_time_controller.h b/chrome/browser/chromeos/child_accounts/screen_time_controller.h index a203ebb..38d2286 100644 --- a/chrome/browser/chromeos/child_accounts/screen_time_controller.h +++ b/chrome/browser/chromeos/child_accounts/screen_time_controller.h
@@ -50,8 +50,8 @@ // Show and update the lock screen when necessary. // |force_lock_by_policy|: If true, force to lock the screen based on the // screen time policy. - // |come_back_time|: When the screen is available again. - void LockScreen(bool force_lock_by_policy, base::Time come_back_time); + // |next_unlock_time|: When the screen is available again. + void LockScreen(bool force_lock_by_policy, base::Time next_unlock_time); // Show a notification indicating the remaining screen time. void ShowNotification(ScreenTimeController::TimeLimitNotificationType type, @@ -90,6 +90,7 @@ base::OneShotTimer exit_notification_timer_; base::OneShotTimer next_state_timer_; base::RepeatingTimer save_screen_time_timer_; + base::OneShotTimer reset_screen_time_timer_; // Timestamp to keep track of the screen start time for the current active // screen. This timestamp is periodically updated by
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h index 9b453567..04fccf4 100644 --- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h
@@ -229,8 +229,7 @@ void Shutdown() override; // Exposes the profile to which the service is attached to subclasses. - const Profile* profile() const { return profile_; } - Profile* profile() { return profile_; } + Profile* profile() const { return profile_; } // Opens an Easy Unlock Setup app window. void OpenSetupApp();
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.cc index 12c19668..0fd297ff 100644 --- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.cc +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.cc
@@ -31,8 +31,7 @@ #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/gcm/gcm_profile_service_factory.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/common/chrome_features.h" #include "chrome/common/extensions/api/easy_unlock_private.h" #include "chrome/common/extensions/extension_constants.h" @@ -44,7 +43,6 @@ #include "chromeos/components/proximity_auth/proximity_auth_system.h" #include "chromeos/components/proximity_auth/screenlock_bridge.h" #include "chromeos/components/proximity_auth/switches.h" -#include "components/cryptauth/cryptauth_access_token_fetcher.h" #include "components/cryptauth/cryptauth_client_impl.h" #include "components/cryptauth/cryptauth_enrollment_manager.h" #include "components/cryptauth/cryptauth_enrollment_utils.h" @@ -66,6 +64,7 @@ #include "extensions/browser/event_router.h" #include "extensions/common/constants.h" #include "google_apis/gaia/gaia_auth_util.h" +#include "services/identity/public/cpp/identity_manager.h" namespace chromeos { @@ -337,13 +336,16 @@ } AccountId EasyUnlockServiceRegular::GetAccountId() const { - const SigninManagerBase* signin_manager = - SigninManagerFactory::GetForProfileIfExists(profile()); - // |profile| has to be a signed-in profile with SigninManager already + identity::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(profile()); + // |profile| has to be a signed-in profile with IdentityManager already // created. Otherwise, just crash to collect stack. - DCHECK(signin_manager); - const AccountInfo account_info = - signin_manager->GetAuthenticatedAccountInfo(); + DCHECK(identity_manager); + const AccountInfo account_info = identity_manager->GetPrimaryAccountInfo(); + // A regular signed-in (i.e., non-login) profile should always have an email. + // TODO(crbug.com/857494): Enable this DCHECK once all browser tests create + // correctly signed in profiles. + // DCHECK(!account_info.email.empty()); return account_info.email.empty() ? EmptyAccountId() : AccountId::FromUserEmailGaiaId(
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc index 165d3add..3ed2a558 100644 --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/chromeos/settings/device_identity_provider.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h" #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" +#include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_content_client.h" @@ -33,6 +34,7 @@ #include "components/user_manager/user.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace policy { @@ -300,6 +302,12 @@ } if (!device_invalidation_service_) { + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory; + if (g_browser_process->system_network_context_manager()) { + // system_network_context_manager() can be null during unit tests. + url_loader_factory = g_browser_process->system_network_context_manager() + ->GetSharedURLLoaderFactory(); + } // If no other connected invalidation service was found and no device-global // invalidation service exists, create one. device_invalidation_service_.reset( @@ -310,7 +318,8 @@ std::unique_ptr<invalidation::TiclSettingsProvider>( new TiclDeviceSettingsProvider), g_browser_process->gcm_driver(), - g_browser_process->system_request_context())); + g_browser_process->system_request_context(), + std::move(url_loader_factory))); device_invalidation_service_->Init( std::unique_ptr<syncer::InvalidationStateTracker>( new invalidation::InvalidatorStorage(
diff --git a/chrome/browser/component_updater/optimization_hints_component_installer.cc b/chrome/browser/component_updater/optimization_hints_component_installer.cc index 9a871e3b..f368fbc3 100644 --- a/chrome/browser/component_updater/optimization_hints_component_installer.cc +++ b/chrome/browser/component_updater/optimization_hints_component_installer.cc
@@ -17,7 +17,7 @@ #include "components/optimization_guide/optimization_guide_constants.h" #include "components/optimization_guide/optimization_guide_service.h" #include "components/prefs/pref_service.h" -#include "components/previews/core/previews_features.h" +#include "components/previews/core/previews_experiments.h" using component_updater::ComponentUpdateService; @@ -133,7 +133,7 @@ void RegisterOptimizationHintsComponent(ComponentUpdateService* cus, PrefService* profile_prefs) { - if (!base::FeatureList::IsEnabled(previews::features::kOptimizationHints)) { + if (!previews::params::IsOptimizationHintsEnabled()) { return; } if (!profile_prefs || !profile_prefs->GetBoolean(prefs::kDataSaverEnabled)) {
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 19b1f3443..307ee73 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -640,6 +640,15 @@ MaybeSendDangerousDownloadOpenedReport(download, false /* show_download_in_folder */); +#if defined(OS_ANDROID) + // TODO(shaktisahu@): Pull out to static helper method once + // DownloadManagerService goes away. Put the helper method in the download + // component. + DownloadManagerService::GetInstance()->OpenDownload(download, + 0 /* download source */); + return; +#endif + if (!DownloadItemModel(download).ShouldPreferOpeningInBrowser()) { RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_PLATFORM); OpenDownloadUsingPlatformHandler(download);
diff --git a/chrome/browser/download/download_offline_content_provider.cc b/chrome/browser/download/download_offline_content_provider.cc index 7ff301b..8416621e 100644 --- a/chrome/browser/download/download_offline_content_provider.cc +++ b/chrome/browser/download/download_offline_content_provider.cc
@@ -48,9 +48,11 @@ manager_->GetBrowserContext()->IsOffTheRecord())); } +// TODO(shaktisahu) : Pass DownloadOpenSource. void DownloadOfflineContentProvider::OpenItem(const ContentId& id) { - // TODO(crbug.com/855727): Provide implementation. - NOTIMPLEMENTED(); + download::DownloadItem* item = manager_->GetDownloadByGuid(id.id); + if (item) + item->OpenDownload(); } void DownloadOfflineContentProvider::RemoveItem(const ContentId& id) {
diff --git a/chrome/browser/download/download_task_scheduler_impl.cc b/chrome/browser/download/download_task_scheduler_impl.cc index 463e2b0b..ba7a3828 100644 --- a/chrome/browser/download/download_task_scheduler_impl.cc +++ b/chrome/browser/download/download_task_scheduler_impl.cc
@@ -26,8 +26,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) { + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) { // We only rely on this for cleanup tasks. Since this doesn't restart Chrome, // for download tasks it doesn't do much and we handle them outside of task // scheduler. @@ -52,8 +52,8 @@ download::DownloadService* download_service = DownloadServiceFactory::GetForBrowserContext(context_); download_service->OnStartScheduledTask( - task_type, base::Bind(&DownloadTaskSchedulerImpl::OnTaskFinished, - weak_factory_.GetWeakPtr())); + task_type, base::BindOnce(&DownloadTaskSchedulerImpl::OnTaskFinished, + weak_factory_.GetWeakPtr())); } void DownloadTaskSchedulerImpl::OnTaskFinished(bool reschedule) {
diff --git a/chrome/browser/download/download_task_scheduler_impl.h b/chrome/browser/download/download_task_scheduler_impl.h index dddc77e..7f35d67 100644 --- a/chrome/browser/download/download_task_scheduler_impl.h +++ b/chrome/browser/download/download_task_scheduler_impl.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TASK_SCHEDULER_IMPL_H_ #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TASK_SCHEDULER_IMPL_H_ +#include <stdint.h> #include <map> #include "base/cancelable_callback.h" @@ -29,8 +30,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) override; + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) override; void CancelTask(download::DownloadTaskType task_type) override; private:
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc index aa044a3..ed7082b 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
@@ -435,21 +435,14 @@ chrome::GetTabAlertStateForContents(contents); if (alert_state != last_alert_state_) { last_alert_state_ = alert_state; - if (on_tab_changed_) - std::move(on_tab_changed_).Run(); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); } } - void WaitForTabChange() { - base::RunLoop run_loop; - on_tab_changed_ = run_loop.QuitClosure(); - run_loop.Run(); - } - private: Browser* const browser_; TabAlertState last_alert_state_; - base::OnceClosure on_tab_changed_; }; IndicatorChangeObserver observer(browser()); @@ -469,7 +462,7 @@ EXPECT_EQ(TabAlertState::TAB_CAPTURING, observer.last_alert_state()); return; } - observer.WaitForTabChange(); + content::RunMessageLoop(); } }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 227e1769..fcf6ad3 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -183,6 +183,10 @@ "Enables a site-wide permission in the UI which controls access to the " "asynchronous clipboard web API"; +const char kCloseButtonsInactiveTabs[] = "Close buttons on inactive tabs"; +const char kCloseButtonsInactiveTabsDescription[] = + "Shows close buttons on inactive tabs in non-touch mode."; + const char kCloudImportName[] = "Cloud Import"; const char kCloudImportDescription[] = "Allows the cloud-import feature.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 10f093a..9a4c8f3 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -137,6 +137,9 @@ extern const char kClipboardContentSettingName[]; extern const char kClipboardContentSettingDescription[]; +extern const char kCloseButtonsInactiveTabs[]; +extern const char kCloseButtonsInactiveTabsDescription[]; + extern const char kCloudImportName[]; extern const char kCloudImportDescription[];
diff --git a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc index 2b88349..28a08207 100644 --- a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc +++ b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc
@@ -29,7 +29,9 @@ #include "components/prefs/pref_registry.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_manager.h" +#include "content/public/browser/storage_partition.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #if defined(OS_ANDROID) #include "components/invalidation/impl/invalidation_service_android.h" @@ -127,7 +129,9 @@ std::unique_ptr<TiclSettingsProvider>( new TiclProfileSettingsProvider(profile->GetPrefs())), gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver(), - profile->GetRequestContext())); + profile->GetRequestContext(), + content::BrowserContext::GetDefaultStoragePartition(profile) + ->GetURLLoaderFactoryForBrowserProcess())); service->Init(std::unique_ptr<syncer::InvalidationStateTracker>( new InvalidatorStorage(profile->GetPrefs())));
diff --git a/chrome/browser/media/cast_remoting_connector.cc b/chrome/browser/media/cast_remoting_connector.cc index cf1a9e28..70b6cb7 100644 --- a/chrome/browser/media/cast_remoting_connector.cc +++ b/chrome/browser/media/cast_remoting_connector.cc
@@ -199,6 +199,10 @@ &CastRemotingConnector::OnMirrorServiceStopped, base::Unretained(this))); } +void CastRemotingConnector::ResetRemotingPermission() { + remoting_allowed_.reset(); +} + void CastRemotingConnector::OnMirrorServiceStopped() { DCHECK_CURRENTLY_ON(BrowserThread::UI); VLOG(2) << __func__; @@ -226,7 +230,7 @@ DCHECK(bridges_.find(bridge) == bridges_.end()); bridges_.insert(bridge); - if (remoter_ && !active_bridge_) + if (remoter_ && !active_bridge_ && remoting_allowed_.value_or(true)) bridge->OnSinkAvailable(sink_metadata_); } @@ -269,11 +273,44 @@ } active_bridge_ = bridge; - remoter_->Start(); - // Assume the remoting session is always started successfully. If any failure - // occurs, OnError() will be called. - bridge->OnStarted(); + if (remoting_allowed_.has_value()) { + StartRemotingIfPermitted(); + } else { + base::OnceCallback<void(bool)> dialog_result_callback(base::BindOnce( + [](base::WeakPtr<CastRemotingConnector> connector, bool is_allowed) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (!connector) + return; + connector->remoting_allowed_ = is_allowed; + connector->StartRemotingIfPermitted(); + }, + weak_factory_.GetWeakPtr())); + + // TODO(http://crbug.com/849020): Show the remoting dialog to get user's + // permission. + std::move(dialog_result_callback).Run(true); + } +} + +void CastRemotingConnector::StartRemotingIfPermitted() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + if (!active_bridge_) + return; + + if (remoting_allowed_.value()) { + remoter_->Start(); + + // Assume the remoting session is always started successfully. If any + // failure occurs, OnError() will be called. + active_bridge_->OnStarted(); + } else { + // TODO(xjz): Add an extra reason for this failure. + active_bridge_->OnStartFailed(RemotingStartFailReason::ROUTE_TERMINATED); + active_bridge_->OnSinkGone(); + active_bridge_ = nullptr; + } } void CastRemotingConnector::StartRemotingDataStreams( @@ -432,8 +469,10 @@ media::mojom::RemotingSinkFeature::RENDERING); #endif - for (RemotingBridge* notifyee : bridges_) - notifyee->OnSinkAvailable(sink_metadata_); + if (remoting_allowed_.value_or(true)) { + for (RemotingBridge* notifyee : bridges_) + notifyee->OnSinkAvailable(sink_metadata_); + } } void CastRemotingConnector::OnError() {
diff --git a/chrome/browser/media/cast_remoting_connector.h b/chrome/browser/media/cast_remoting_connector.h index 131ef96..397c2be 100644 --- a/chrome/browser/media/cast_remoting_connector.h +++ b/chrome/browser/media/cast_remoting_connector.h
@@ -8,6 +8,7 @@ #include <set> #include "base/memory/weak_ptr.h" +#include "base/optional.h" #include "base/supports_user_data.h" #include "components/sessions/core/session_id.h" #include "media/mojo/interfaces/mirror_service_remoting.mojom.h" @@ -93,6 +94,9 @@ media::mojom::MirrorServiceRemotingSourceRequest source_request, media::mojom::MirrorServiceRemoterPtr remoter); + // Called at the start of mirroring to reset the permission. + void ResetRemotingPermission(); + private: // Allow unit tests access to the private constructor and CreateBridge() // method, since unit tests don't have a complete browser (i.e., with a @@ -146,6 +150,10 @@ void EstimateTransmissionCapacity( media::mojom::Remoter::EstimateTransmissionCapacityCallback callback); + // Called after permission check. Either call |remoter_| to start remoting or + // notify the source that start fails due to no permission. + void StartRemotingIfPermitted(); + // Called when RTP streams are started. void OnDataStreamsStarted( mojo::ScopedDataPipeConsumerHandle audio_pipe, @@ -183,6 +191,10 @@ mojo::Binding<media::mojom::MirrorServiceRemotingSource> binding_; media::mojom::MirrorServiceRemoterPtr remoter_; + // Permission is checked the first time remoting requested to start for each + // casting session. + base::Optional<bool> remoting_allowed_; + // Produces weak pointers that are only valid for the current remoting // session. This is used to cancel any outstanding callbacks when a remoting // session is stopped.
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index e52b49a..e1968ce 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -89,6 +89,7 @@ #endif #if BUILDFLAG(USE_PROPRIETARY_CODECS) const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\""; +const char kMp4AacAudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) // Sessions to load. @@ -114,6 +115,7 @@ #endif const char kDefaultEmePlayer[] = "eme_player.html"; +const char kDefaultMseOnlyEmePlayer[] = "mse_different_containers.html"; // The type of video src used to load media. enum class SrcType { SRC, MSE }; @@ -129,14 +131,6 @@ // Whether the video should be played once or twice. enum class PlayCount { ONCE, TWICE }; -// Format of a container when testing different streams. -enum class EncryptedContainer { - CLEAR_WEBM, - CLEAR_MP4, - ENCRYPTED_WEBM, - ENCRYPTED_MP4 -}; - // Base class for encrypted media tests. class EncryptedMediaTestBase : public MediaBrowserTest { public: @@ -217,6 +211,35 @@ EXPECT_TRUE(receivedKeyMessage); } + void RunEncryptedMediaMultipleFileTest(const std::string& key_system, + const std::string& video_media_file, + const std::string& video_media_type, + const std::string& audio_media_file, + const std::string& audio_media_type, + const std::string& expected_title) { + if (!IsPlayBackPossible(key_system)) { + DVLOG(0) << "Skipping test - Test requires video playback."; + return; + } + + base::StringPairs query_params; + query_params.emplace_back("keySystem", key_system); + query_params.emplace_back("runEncrypted", "1"); + if (!video_media_file.empty()) { + DCHECK(!video_media_type.empty()); + query_params.emplace_back("videoFile", video_media_file); + query_params.emplace_back("videoFormat", video_media_type); + } + if (!audio_media_file.empty()) { + DCHECK(!audio_media_type.empty()); + query_params.emplace_back("audioFile", audio_media_file); + query_params.emplace_back("audioFormat", audio_media_type); + } + + RunEncryptedMediaTestPage(kDefaultMseOnlyEmePlayer, key_system, + query_params, expected_title); + } + // Starts a license server if available for the |key_system| and adds a // 'licenseServerURL' query parameter to |query_params|. void StartLicenseServerIfNeeded(const std::string& key_system, @@ -346,18 +369,6 @@ expected_title); } -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - void TestMp4EncryptionPlayback(const std::string& key_system, - const std::string& media_file, - const std::string& media_type, - const std::string& expected_title) { - // MP4 playback is only supported with MSE. - RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system, - SrcType::MSE, kNoSessionToLoad, false, - PlayCount::ONCE, expected_title); - } -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) - protected: void SetUpCommandLine(base::CommandLine* command_line) override { EncryptedMediaTestBase::SetUpCommandLine(command_line); @@ -462,45 +473,19 @@ query_params, kUnitTestSuccess); } - std::string ConvertContainerFormat(EncryptedContainer format) { - switch (format) { - case EncryptedContainer::CLEAR_MP4: - return "CLEAR_MP4"; - case EncryptedContainer::CLEAR_WEBM: - return "CLEAR_WEBM"; - case EncryptedContainer::ENCRYPTED_MP4: - return "ENCRYPTED_MP4"; - case EncryptedContainer::ENCRYPTED_WEBM: - return "ENCRYPTED_WEBM"; - } - NOTREACHED(); - return "UNKNOWN"; - } - - void TestDifferentContainers(EncryptedContainer video_format, - EncryptedContainer audio_format) { + void TestDifferentContainers(const std::string& video_media_file, + const std::string& video_media_type, + const std::string& audio_media_file, + const std::string& audio_media_type) { // MP4 without MSE is not support yet, http://crbug.com/170793. - if ((video_format == EncryptedContainer::ENCRYPTED_MP4 || - audio_format == EncryptedContainer::ENCRYPTED_MP4) && - CurrentSourceType() != SrcType::MSE) { + if (CurrentSourceType() != SrcType::MSE) { DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; return; } - if (!IsPlayBackPossible(CurrentKeySystem())) { - DVLOG(0) << "Skipping test - Test requires video playback."; - return; - } - - base::StringPairs query_params; - query_params.emplace_back("keySystem", CurrentKeySystem()); - query_params.emplace_back("runEncrypted", "1"); - query_params.push_back( - std::make_pair("videoFormat", ConvertContainerFormat(video_format))); - query_params.push_back( - std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); - RunEncryptedMediaTestPage("mse_different_containers.html", - CurrentKeySystem(), query_params, media::kEnded); + RunEncryptedMediaMultipleFileTest(CurrentKeySystem(), video_media_file, + video_media_type, audio_media_file, + audio_media_type, media::kEnded); } void DisableEncryptedMedia() { @@ -705,26 +690,38 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { - TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, - EncryptedContainer::CLEAR_WEBM); + TestDifferentContainers("bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, + "bear-320x240-audio-only.webm", kWebMVorbisAudioOnly); } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_ClearVideo_WEBM_EncryptedAudio_MP4) { - TestDifferentContainers(EncryptedContainer::CLEAR_WEBM, - EncryptedContainer::ENCRYPTED_MP4); + TestDifferentContainers("bear-320x240-video-only.webm", kWebMVp8VideoOnly, + "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly); } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) { - TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, - EncryptedContainer::ENCRYPTED_MP4); + TestDifferentContainers("bear-320x240-v_enc-v.webm", kWebMVp8VideoOnly, + "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly); +} + +IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, + Playback_EncryptedVideo_CBCS_EncryptedAudio_CENC) { + TestDifferentContainers("bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly); +} + +IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, + Playback_EncryptedVideo_CENC_EncryptedAudio_CBCS) { + TestDifferentContainers("bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cbcs.mp4", kMp4AacAudioOnly); } #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -// Test both CDM_9 and CDM_10. +// Test CDM_9 through CDM_11. static_assert(media::CheckSupportedCdmInterfaceVersions(9, 11), "Mismatch between implementation and test coverage"); INSTANTIATE_TEST_CASE_P(CDM_9, ECKEncryptedMediaTest, Values(9)); @@ -803,24 +800,38 @@ #if BUILDFLAG(USE_PROPRIETARY_CODECS) +IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoOnly_MP4_CBCS) { + // 'cbcs' decryption is only supported on CDM 10 or later as long as + // the appropriate buildflag is enabled. + std::string expected_result = + GetCdmInterfaceVersion() >= 10 && BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) + ? media::kEnded + : media::kError; + RunEncryptedMediaTest( + kDefaultEmePlayer, "bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, + kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE, kNoSessionToLoad, + false, PlayCount::ONCE, expected_result); +} + // Encryption Scheme tests. ClearKey key system is covered in // content/browser/media/encrypted_media_browsertest.cc. IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENC) { - TestMp4EncryptionPlayback(kExternalClearKeyKeySystem, - "bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, - media::kEnded); + RunEncryptedMediaMultipleFileTest( + kExternalClearKeyKeySystem, "bear-640x360-v_frag-cenc.mp4", + kMp4Avc1VideoOnly, "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly, + media::kEnded); } IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CBC1) { - TestMp4EncryptionPlayback(kExternalClearKeyKeySystem, - "bear-640x360-v_frag-cbc1.mp4", kMp4Avc1VideoOnly, - media::kError); + RunEncryptedMediaMultipleFileTest( + kExternalClearKeyKeySystem, "bear-640x360-v_frag-cbc1.mp4", + kMp4Avc1VideoOnly, std::string(), std::string(), media::kError); } IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENS) { - TestMp4EncryptionPlayback(kExternalClearKeyKeySystem, - "bear-640x360-v_frag-cens.mp4", kMp4Avc1VideoOnly, - media::kError); + RunEncryptedMediaMultipleFileTest( + kExternalClearKeyKeySystem, "bear-640x360-v_frag-cens.mp4", + kMp4Avc1VideoOnly, std::string(), std::string(), media::kError); } IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CBCS) { @@ -830,9 +841,10 @@ GetCdmInterfaceVersion() >= 10 && BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) ? media::kEnded : media::kError; - TestMp4EncryptionPlayback(kExternalClearKeyKeySystem, - "bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, - expected_result); + RunEncryptedMediaMultipleFileTest( + kExternalClearKeyKeySystem, "bear-640x360-v_frag-cbcs.mp4", + kMp4Avc1VideoOnly, "bear-640x360-a_frag-cbcs.mp4", kMp4AacAudioOnly, + expected_result); } #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc index 9b1079b..8268c4d1 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -230,7 +230,9 @@ if (IsTabMirroringMediaSource(MediaSource(source_id))) { // Ensure the CastRemotingConnector is created before mirroring starts. - CastRemotingConnector::Get(web_contents); + CastRemotingConnector* const connector = + CastRemotingConnector::Get(web_contents); + connector->ResetRemotingPermission(); } MediaRouterMetrics::RecordMediaSinkType(sink->icon_type());
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc index 4182082c..8eafdacd 100644 --- a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc +++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
@@ -718,12 +718,21 @@ const base::TimeDelta WebRtcEventLogManagerTestCacheClearing::kEpsion = base::TimeDelta::FromHours(1); -class WebRtcEventLogManagerTestWithRemoteLoggingDisabled +class WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled : public WebRtcEventLogManagerTestBase { public: - WebRtcEventLogManagerTestWithRemoteLoggingDisabled() { + WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled() { + // Show that the feature is not active if not explicitly ENABLED. + const bool disable = GetParam(); + if (disable) { // Otherwise, left to default value. + scoped_feature_list_.InitAndDisableFeature( + features::kWebRtcRemoteEventLog); + } event_log_manager_ = WebRtcEventLogManager::CreateSingletonInstance(); } + + ~WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled() override = + default; }; class WebRtcEventLogManagerTestUploadSuppressionDisablingFlag @@ -737,20 +746,6 @@ } }; -class WebRtcEventLogManagerWhenRemoteLoggingDisabledOrNotEnabled - : public WebRtcEventLogManagerTestBase { - public: - WebRtcEventLogManagerWhenRemoteLoggingDisabledOrNotEnabled() { - // Show that the feature is not active if not explicitly ENABLED. - const bool disable = GetParam(); - if (disable) { // Otherwise, left to default value. - scoped_feature_list_.InitAndDisableFeature( - features::kWebRtcRemoteEventLog); - } - event_log_manager_ = WebRtcEventLogManager::CreateSingletonInstance(); - } -}; - namespace { class PeerConnectionTrackerProxyForTesting @@ -3120,36 +3115,36 @@ WaitForPendingTasks(&run_loop); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityPeerConnectionAdded) { EXPECT_TRUE(PeerConnectionAdded(rph_->GetID(), kLid)); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityPeerConnectionRemoved) { const auto key = GetPeerConnectionKey(rph_.get(), kLid); ASSERT_TRUE(PeerConnectionAdded(key.render_process_id, key.lid)); EXPECT_TRUE(PeerConnectionRemoved(key.render_process_id, key.lid)); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityPeerConnectionStopped) { PeerConnectionStopped(rph_->GetID(), kLid); // No crash. } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityEnableLocalLogging) { ASSERT_TRUE(PeerConnectionAdded(rph_->GetID(), kLid)); ASSERT_TRUE(EnableLocalLogging()); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityDisableLocalLogging) { ASSERT_TRUE(EnableLocalLogging()); EXPECT_TRUE(DisableLocalLogging()); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityStartRemoteLogging) { const auto key = GetPeerConnectionKey(rph_.get(), kLid); ASSERT_TRUE(PeerConnectionAdded(key.render_process_id, key.lid)); @@ -3159,7 +3154,7 @@ EXPECT_EQ(error_message, kStartRemoteLoggingFailureFeatureDisabled); } -TEST_F(WebRtcEventLogManagerTestWithRemoteLoggingDisabled, +TEST_P(WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, SanityOnWebRtcEventLogWrite) { const auto key = GetPeerConnectionKey(rph_.get(), kLid); ASSERT_TRUE(PeerConnectionAdded(key.render_process_id, key.lid)); @@ -3168,6 +3163,11 @@ std::make_pair(false, false)); } +INSTANTIATE_TEST_CASE_P( + ExplicitlyDisable, + WebRtcEventLogManagerTestWithRemoteLoggingDisabledOrNotEnabled, + ::testing::Bool()); + TEST_F(WebRtcEventLogManagerTestUploadSuppressionDisablingFlag, UploadingNotSuppressedByActivePeerConnections) { SuppressUploading(); @@ -3192,24 +3192,6 @@ WaitForPendingTasks(&run_loop); } -TEST_P(WebRtcEventLogManagerWhenRemoteLoggingDisabledOrNotEnabled, - RemoteBoundLoggingDisabled) { - const auto key = GetPeerConnectionKey(rph_.get(), kLid); - ASSERT_TRUE(PeerConnectionAdded(key.render_process_id, key.lid)); - EXPECT_FALSE(StartRemoteLogging(key.render_process_id, GetUniqueId(key))); -} - -// Sanity -TEST_P(WebRtcEventLogManagerWhenRemoteLoggingDisabledOrNotEnabled, - LocalLoggingStillAllowed) { - ASSERT_TRUE(EnableLocalLogging()); -} - -INSTANTIATE_TEST_CASE_P( - ExplicitlyDisable, - WebRtcEventLogManagerWhenRemoteLoggingDisabledOrNotEnabled, - ::testing::Bool()); - #else // defined(OS_ANDROID) class WebRtcEventLogManagerTestOnMobileDevices
diff --git a/chrome/browser/net/network_context_configuration_browsertest.cc b/chrome/browser/net/network_context_configuration_browsertest.cc index 6b2cc3b..5bf2c4a 100644 --- a/chrome/browser/net/network_context_configuration_browsertest.cc +++ b/chrome/browser/net/network_context_configuration_browsertest.cc
@@ -11,6 +11,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/guid.h" #include "base/location.h" +#include "base/path_service.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -27,6 +28,7 @@ #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_content_client.h" +#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" @@ -1110,6 +1112,36 @@ .empty()); } +// Make sure file uploads work. +IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, UploadFile) { + std::unique_ptr<network::ResourceRequest> request = + std::make_unique<network::ResourceRequest>(); + request->method = "POST"; + request->url = embedded_test_server()->GetURL("/echo"); + content::SimpleURLLoaderTestHelper simple_loader_helper; + std::unique_ptr<network::SimpleURLLoader> simple_loader = + network::SimpleURLLoader::Create(std::move(request), + TRAFFIC_ANNOTATION_FOR_TESTS); + base::FilePath dir_test_data; + base::PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data); + base::FilePath path = + dir_test_data.Append(base::FilePath(FILE_PATH_LITERAL("simple.html"))); + simple_loader->AttachFileForUpload(path, "text/html"); + + simple_loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie( + loader_factory(), simple_loader_helper.GetCallback()); + simple_loader_helper.WaitForCallback(); + + ASSERT_TRUE(simple_loader->ResponseInfo()); + ASSERT_TRUE(simple_loader->ResponseInfo()->headers); + EXPECT_EQ(200, simple_loader->ResponseInfo()->headers->response_code()); + ASSERT_TRUE(simple_loader_helper.response_body()); + base::ScopedAllowBlockingForTesting allow_blocking; + std::string expected_response; + base::ReadFileToString(path, &expected_response); + EXPECT_EQ(expected_response.c_str(), *simple_loader_helper.response_body()); +} + class NetworkContextConfigurationFixedPortBrowserTest : public NetworkContextConfigurationBrowserTest { public:
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc index 6b88548..fe59b997 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc
@@ -35,6 +35,7 @@ #include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "net/net_buildflags.h" #include "services/network/network_service.h" +#include "services/network/public/cpp/cross_thread_shared_url_loader_factory_info.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "url/gurl.h" @@ -220,9 +221,8 @@ // SharedURLLoaderFactory implementation: std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override { - NOTREACHED() << "This isn't supported. SharedURLLoaderFactory can only be" - " used on the UI thread."; - return nullptr; + return std::make_unique<network::CrossThreadSharedURLLoaderFactoryInfo>( + this); } void Shutdown() { manager_ = nullptr; }
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js index 9a772ee..1625e187 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
@@ -328,6 +328,11 @@ // Editable selection. if (anchor.state[StateType.EDITABLE]) { + // Ignore selection changes we triggered. + if (evt.eventFrom == 'action' && + !DesktopAutomationHandler.announceActions) + return; + anchor = AutomationUtil.getEditableRoot(anchor) || anchor; this.onEditableChanged_( new CustomAutomationEvent(evt.type, anchor, evt.eventFrom));
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/gesture_command_data.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/gesture_command_data.js index a87d6da..f6cf73c 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/gesture_command_data.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/gesture_command_data.js
@@ -48,8 +48,8 @@ command: 'nextWord', keyOverride: {keyCode: 40 /* right */, modifiers: {ctrl: true}} }, - 'swipeUp3': {command: 'scrollBackward'}, - 'swipeDown3': {command: 'scrollForward'}, + 'swipeUp3': {command: 'scrollForward'}, + 'swipeDown3': {command: 'scrollBackward'}, 'tap2': {command: 'stopSpeech'}, 'tap4': {command: 'showPanelMenuMostRecent'}, };
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/css/wallpaper_manager.css b/chrome/browser/resources/chromeos/wallpaper_manager/css/wallpaper_manager.css index f8081b0..d0a55dbb 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/css/wallpaper_manager.css +++ b/chrome/browser/resources/chromeos/wallpaper_manager/css/wallpaper_manager.css
@@ -484,6 +484,7 @@ border-radius: 4px; height: 160px; margin-bottom: 8px; + outline: none; width: 160px; } @@ -495,6 +496,11 @@ background-color: rgba(26, 115, 232, 0.08); } +.v2 .image-picker [role=listitem]:not([selected]):focus { + border: 2px solid rgba(26, 115, 232, 0.4); + box-sizing: border-box; +} + .v2 .image-picker [role=listitem].daily-refresh-item { pointer-events: none; } @@ -540,17 +546,18 @@ display: block; height: 24px; position: absolute; + top: 4px; width: 24px; } .v2 #minimize-button { background-image: url(../images/ui/button_minimize.png); - right: 48px; + right: 52px; } .v2 #close-button { background-image: url(../images/ui/button_close.png); - right: 8px; + right: 12px; } .v2 .bottom-bar { @@ -651,6 +658,7 @@ .v2 .top-header-contents .more-options > div:focus, .v2 #current-wallpaper-more-options > div:focus { border: 2px solid rgba(26, 115, 232, 0.4); + box-sizing: border-box; outline: none; }
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js index 4f2dbff..8fcf2ed 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js
@@ -86,10 +86,19 @@ } var imageEl = cr.doc.createElement('img'); - // On the new picker, do not show the image until |cropImageToFitGrid_| is - // done. - if (loadTimeData.getBoolean('useNewWallpaperPicker')) + if (loadTimeData.getBoolean('useNewWallpaperPicker')) { + // On the new picker, do not show the image until |cropImageToFitGrid_| + // is done. imageEl.hidden = true; + imageEl.setAttribute('aria-hidden', 'true'); + this.setAttribute('aria-label', this.dataItem.ariaLabel); + this.tabIndex = 0; + this.addEventListener('keypress', e => { + if (e.keyCode == 13) + this.parentNode.selectedItem = this.dataItem; + }); + } + imageEl.classList.add('thumbnail'); cr.defineProperty(imageEl, 'offline', cr.PropertyKind.BOOL_ATTR); imageEl.offline = this.dataItem.availableOffline; @@ -579,6 +588,8 @@ // updateActiveThumb_(). this.checkmark_ = cr.doc.createElement('div'); this.checkmark_.classList.add('check'); + this.checkmark_.setAttribute( + 'aria-label', loadTimeData.getString('setSuccessfullyMessage')); this.dataModel = new ArrayDataModel([]); this.thumbnailList_ = new ArrayDataModel([]); this.useNewWallpaperPicker_ =
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js index e19b210..1a4fea87 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -306,6 +306,7 @@ collectionName: collectionsInfo[index]['collectionName'], collectionId: collectionId, + ariaLabel: imagesInfo[i]['displayText'][0], // The display order of the collections. collectionIndex: index, previewable: true @@ -349,6 +350,7 @@ * @private */ WallpaperManager.prototype.showCollection_ = function(index) { + this.wallpaperGrid_.dataModel = null; var collectionId = this.collectionsInfo_[index]['collectionId']; if (!(collectionId in this.imagesInfoMap_)) { console.error('Attempt to display images with an unknown collection id.'); @@ -807,37 +809,38 @@ currentWallpaperInfo => { // Initialize the "more options" buttons. var isOnlineWallpaper = !!currentWallpaperInfo; + var isDefaultWallpaper = !this.currentWallpaper_; var visibleItemList = []; $('refresh').hidden = !isOnlineWallpaper || !this.dailyRefreshInfo_ || !this.dailyRefreshInfo_.enabled; if (!$('refresh').hidden) { - this.addEventToButton_($('refresh'), true, () => { + this.addEventToButton_($('refresh'), () => { this.pendingDailyRefreshInfo_ = this.dailyRefreshInfo_; this.setDailyRefreshWallpaper_(); }); visibleItemList.push($('refresh')); } - $('explore').hidden = !isOnlineWallpaper; + $('explore').hidden = + !isOnlineWallpaper || !currentWallpaperInfo.authorWebsite; if (!$('explore').hidden) { - this.addEventToButton_($('explore'), true, () => { + this.addEventToButton_($('explore'), () => { window.open(currentWallpaperInfo.authorWebsite); }); visibleItemList.push($('explore')); } - $('center').hidden = isOnlineWallpaper; + $('center').hidden = isOnlineWallpaper || isDefaultWallpaper; if (!$('center').hidden) { this.addEventToButton_( - $('center'), true, - this.setCustomWallpaperLayout_.bind(this, 'CENTER')); + $('center'), this.setCustomWallpaperLayout_.bind(this, 'CENTER')); visibleItemList.push($('center')); } - $('center-cropped').hidden = isOnlineWallpaper; + $('center-cropped').hidden = isOnlineWallpaper || isDefaultWallpaper; if (!$('center-cropped').hidden) { this.addEventToButton_( - $('center-cropped'), true, + $('center-cropped'), this.setCustomWallpaperLayout_.bind(this, 'CENTER_CROPPED')); visibleItemList.push($('center-cropped')); } @@ -848,7 +851,7 @@ visibleItemList[0].offsetHeight) / 2 + 'px'; - } else { + } else if (visibleItemList.length == 2) { // There are at most two visible elements. var topMargin = ($('current-wallpaper-info-bar').offsetHeight - visibleItemList[0].offsetHeight - @@ -871,13 +874,11 @@ .classList.toggle('online-wallpaper', isOnlineWallpaper); // Clear the existing contents (needed if the wallpaper changes while // the picker is open). - $('current-wallpaper-title').innerHTML = ''; $('current-wallpaper-description').innerHTML = ''; if (isOnlineWallpaper) { // Set the image title and description. $('current-wallpaper-title').textContent = currentWallpaperInfo.displayText[0]; - $('current-wallpaper-description').innerHTML = ''; $('current-wallpaper-description') .classList.toggle( 'small-font', currentWallpaperInfo.displayText.length > 2); @@ -1131,7 +1132,7 @@ } var layoutButton = this.document_.querySelector( layout == 'CENTER' ? '.center-button' : '.center-cropped-button'); - this.addEventToButton_(layoutButton, true, () => { + this.addEventToButton_(layoutButton, () => { chrome.wallpaperPrivate.setCustomWallpaper( imageData, layout, false /*generateThumbnail=*/, selectedItem.baseURL, true /*previewMode=*/, @@ -1301,14 +1302,13 @@ this.showSuccessMessageAndQuit_(); }); }; - this.addEventToButton_( - $('confirm-preview-wallpaper'), true, onConfirmClicked); + this.addEventToButton_($('confirm-preview-wallpaper'), onConfirmClicked); var onRefreshClicked = () => { if (optOnRefreshClicked) optOnRefreshClicked(); }; - this.addEventToButton_($('refresh-wallpaper'), true, onRefreshClicked); + this.addEventToButton_($('refresh-wallpaper'), onRefreshClicked); // Enable swiping to show the previous/next preview wallpaper. var onTouchStarted = e => { @@ -1420,7 +1420,7 @@ this.onCategoriesChange_(); }); }; - this.addEventToButton_($('cancel-preview-wallpaper'), true, onCancelClicked); + this.addEventToButton_($('cancel-preview-wallpaper'), onCancelClicked); $('message-container').style.visibility = 'hidden'; }; @@ -1503,7 +1503,9 @@ if (!this.selectedItem_ || this.selectedItem_.source == 'ADDNEW') return; - if (this.selectedItem_.baseURL && !this.wallpaperGrid_.inProgramSelection) { + if (this.selectedItem_.baseURL && + (this.useNewWallpaperPicker_ || + !this.wallpaperGrid_.inProgramSelection)) { if (this.selectedItem_.source == Constants.WallpaperSourceEnum.Custom) { var items = {}; var key = this.selectedItem_.baseURL; @@ -1923,6 +1925,8 @@ source: Constants.WallpaperSourceEnum.Custom, availableOffline: true, collectionName: str('customCategoryLabel'), + // Use file name as aria-label. + ariaLabel: imagePath.split(/[/\\]/).pop(), previewable: true }; wallpapersDataModel.push(wallpaperInfo); @@ -2171,6 +2175,7 @@ var enabled = dailyRefreshInfo.enabled && dailyRefreshInfo.collectionId === collectionId; dailyRefreshSlider.classList.toggle('checked', enabled); + dailyRefreshSlider.setAttribute('aria-checked', enabled); }); }; @@ -2187,7 +2192,7 @@ this.dailyRefreshSliderMap_[collectionId] = dailyRefreshSlider; this.updateDailyRefreshSliderStates_(this.dailyRefreshInfo_); - this.addEventToButton_(dailyRefreshSlider, false, () => { + dailyRefreshSlider.addEventListener('click', () => { var isSliderEnabled = dailyRefreshSlider.classList.contains('checked'); var isCollectionEnabled = collectionId === this.dailyRefreshInfo_.collectionId; @@ -2227,6 +2232,14 @@ toggleRippleAnimation(false); }, 360); }); + dailyRefreshSlider.addEventListener('keypress', e => { + if (e.keyCode == 13) + dailyRefreshSlider.click(); + }); + dailyRefreshSlider.addEventListener('mousedown', e => { + e.preventDefault(); + }); + dailyRefreshSlider.setAttribute('aria-label', str('surpriseMeLabel')); }; /** @@ -2343,23 +2356,20 @@ /** * Helper function to register event listener for the button. * @param {Object} button The button object. - * @param {boolean} createNewButton If true, replace the button with a clone - * before registering the event listener. * @param {function} eventListener The function to be called when the button is * clicked or the Enter key is pressed. */ -WallpaperManager.prototype.addEventToButton_ = function( - button, createNewButton, eventListener) { - if (createNewButton) { - var newButton = button.cloneNode(true); - button.parentNode.replaceChild(newButton, button); - button = newButton; - } +WallpaperManager.prototype.addEventToButton_ = function(button, eventListener) { + // Replace the button with a clone to clear all previous event listeners. + var newButton = button.cloneNode(true); + button.parentNode.replaceChild(newButton, button); + button = newButton; button.addEventListener('click', eventListener); button.addEventListener('keypress', e => { if (e.keyCode == 13) button.click(); }); + button.setAttribute('role', 'button'); // The button should receive tab focus. button.tabIndex = 0; // Prevent showing the focused style of the button (e.g. an outline) when
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/main.html b/chrome/browser/resources/chromeos/wallpaper_manager/main.html index 585d11d..58530b47b 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/main.html +++ b/chrome/browser/resources/chromeos/wallpaper_manager/main.html
@@ -106,7 +106,7 @@ <div id="category-container"> <div id="wallpaper-set-by-message"></div> <div id="current-wallpaper-info-bar"> - <img id="current-wallpaper-image"></img> + <img id="current-wallpaper-image" aria-hidden="true"></img> <div id="current-wallpaper-more-info"> <div id="currently-set-message" i18n-content="currentlySetLabel"></div> @@ -132,7 +132,7 @@ </div> </div> </div> - <grid id="wallpaper-grid" class="image-picker"></grid> + <grid id="wallpaper-grid" class="image-picker" tabIndex="-1"></grid> <div id="spinner-container" hidden></div> <div class="progress-bar" hidden> <div class="progress-track"></div> @@ -192,8 +192,9 @@ <div id="spinner" hidden></div> <div id="daily-refresh-banner-template" hidden> <div class="daily-refresh-banner"> - <div class="daily-refresh-label" i18n-content="surpriseMeLabel"></div> - <span class="daily-refresh-slider"> + <div class="daily-refresh-label" i18n-content="surpriseMeLabel" + aria-hidden="true"></div> + <span role="checkbox" tabIndex="0" class="daily-refresh-slider"> <div class="ripple-circle"></div></span> </div> </div>
diff --git a/chrome/browser/resources/settings/people_page/sync_browser_proxy.js b/chrome/browser/resources/settings/people_page/sync_browser_proxy.js index e6197c0..2da1f55 100644 --- a/chrome/browser/resources/settings/people_page/sync_browser_proxy.js +++ b/chrome/browser/resources/settings/people_page/sync_browser_proxy.js
@@ -225,7 +225,7 @@ /** @override */ signOut(deleteProfile) { - chrome.send('SyncSetupStopSyncing', [deleteProfile]); + chrome.send('SyncSetupSignout', [deleteProfile]); } /** @override */
diff --git a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html index a12b55de..ce81da6 100644 --- a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html +++ b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html
@@ -188,7 +188,7 @@ <div class="settings-box two-line last"> <cr-input class="browse-file-input" readonly value="[[newUserPPD_]]" label="$i18n{selectDriver}" invalid="[[invalidPPD_]]" - error-message="$i18n{selectDriverErrorMessage}"> + error-message="$i18n{selectDriverErrorMessage}" tabindex="-1"> <paper-button class="browse-button" on-click="onBrowseFile_" slot="suffix"> $i18n{selectDriverButtonText}
diff --git a/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html b/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html index dd4ff79..0852b6f 100644 --- a/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html +++ b/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html
@@ -93,7 +93,7 @@ </drop-down-search-box> </div> <div class="settings-box two-line last"> - <cr-input class="browse-file-input" readonly + <cr-input class="browse-file-input" readonly tabindex="-1" value="[[newUserPPD_]]" label="$i18n{selectDriver}" error-message="$i18n{selectDriverErrorMessage}" invalid="[[invalidPPD_]]">
diff --git a/chrome/browser/safe_browsing/download_protection/two_phase_uploader_unittest.cc b/chrome/browser/safe_browsing/download_protection/two_phase_uploader_unittest.cc index 0f5e7754..1dfc7e3 100644 --- a/chrome/browser/safe_browsing/download_protection/two_phase_uploader_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/two_phase_uploader_unittest.cc
@@ -19,6 +19,8 @@ #include "content/public/test/test_utils.h" #include "net/base/net_errors.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "services/network/network_service.h" +#include "services/network/test/test_network_service_client.h" #include "services/network/test/test_shared_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" @@ -67,8 +69,16 @@ public: TwoPhaseUploaderTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { + // A NetworkServiceClient is needed for uploads to work. + network::mojom::NetworkServiceClientPtr network_service_client_ptr; + network_service_client_ = + std::make_unique<network::TestNetworkServiceClient>( + mojo::MakeRequest(&network_service_client_ptr)); + network_service_ = network::NetworkService::CreateForTesting(); + network_service_->SetClient(std::move(network_service_client_ptr)); shared_url_loader_factory_ = - base::MakeRefCounted<network::TestSharedURLLoaderFactory>(); + base::MakeRefCounted<network::TestSharedURLLoaderFactory>( + network_service_.get()); } protected: @@ -76,6 +86,8 @@ const scoped_refptr<base::SequencedTaskRunner> task_runner_ = base::CreateSequencedTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::BACKGROUND}); + std::unique_ptr<network::TestNetworkServiceClient> network_service_client_; + std::unique_ptr<network::NetworkService> network_service_; scoped_refptr<network::TestSharedURLLoaderFactory> shared_url_loader_factory_; };
diff --git a/chrome/browser/signin/chrome_signin_client_unittest.cc b/chrome/browser/signin/chrome_signin_client_unittest.cc index 78c68fd..49046ce 100644 --- a/chrome/browser/signin/chrome_signin_client_unittest.cc +++ b/chrome/browser/signin/chrome_signin_client_unittest.cc
@@ -21,6 +21,7 @@ #include "chrome/test/base/testing_profile.h" #include "components/signin/core/browser/profile_management_switches.h" #include "content/public/browser/network_connection_tracker.h" +#include "content/public/test/mock_network_connection_tracker.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,61 +31,12 @@ namespace { -class MockNetworkConnectionTrackerNeverOffline - : public content::NetworkConnectionTracker { - public: - MockNetworkConnectionTrackerNeverOffline() - : content::NetworkConnectionTracker() {} - ~MockNetworkConnectionTrackerNeverOffline() override {} - - bool GetConnectionType(network::mojom::ConnectionType* type, - ConnectionTypeCallback callback) override { - *type = network::mojom::ConnectionType::CONNECTION_3G; - return true; - } -}; - -class MockNetworkConnectionTrackerGetConnectionTypeAsync - : public content::NetworkConnectionTracker { - public: - MockNetworkConnectionTrackerGetConnectionTypeAsync() - : content::NetworkConnectionTracker() {} - ~MockNetworkConnectionTrackerGetConnectionTypeAsync() override {} - - void CompleteCallback() { - OnInitialConnectionType(network::mojom::ConnectionType::CONNECTION_3G); - } -}; - -class MockNetworkConnectionTrackerOfflineUntilChange - : public content::NetworkConnectionTracker { - public: - MockNetworkConnectionTrackerOfflineUntilChange() - : content::NetworkConnectionTracker(), online_(false) {} - ~MockNetworkConnectionTrackerOfflineUntilChange() override {} - - bool GetConnectionType(network::mojom::ConnectionType* type, - ConnectionTypeCallback callback) override { - if (online_) { - *type = network::mojom::ConnectionType::CONNECTION_3G; - } else { - *type = network::mojom::ConnectionType::CONNECTION_NONE; - } - return true; - } - void GoOnline() { - online_ = true; - OnNetworkChanged(network::mojom::ConnectionType::CONNECTION_3G); - } - private: - bool online_; -}; - class CallbackTester { public: CallbackTester() : called_(0) {} void Increment(); + void IncrementAndUnblock(base::RunLoop* run_loop); bool WasCalledExactlyOnce(); private: @@ -95,6 +47,11 @@ called_++; } +void CallbackTester::IncrementAndUnblock(base::RunLoop* run_loop) { + Increment(); + run_loop->QuitWhenIdle(); +} + bool CallbackTester::WasCalledExactlyOnce() { return called_ == 1; } @@ -125,7 +82,8 @@ }; TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsImmediatelyWithNetwork) { - Initialize(std::make_unique<MockNetworkConnectionTrackerNeverOffline>()); + Initialize(std::make_unique<content::MockNetworkConnectionTracker>( + true, network::mojom::ConnectionType::CONNECTION_3G)); CallbackTester tester; signin_client()->DelayNetworkCall( base::Bind(&CallbackTester::Increment, base::Unretained(&tester))); @@ -133,32 +91,35 @@ } TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsAfterGetConnectionType) { - auto tracker = - std::make_unique<MockNetworkConnectionTrackerGetConnectionTypeAsync>(); - MockNetworkConnectionTrackerGetConnectionTypeAsync* mock = tracker.get(); + auto tracker = std::make_unique<content::MockNetworkConnectionTracker>( + false, network::mojom::ConnectionType::CONNECTION_3G); Initialize(std::move(tracker)); + base::RunLoop run_loop; CallbackTester tester; - signin_client()->DelayNetworkCall(base::Bind(&CallbackTester::Increment, - base::Unretained(&tester))); + signin_client()->DelayNetworkCall( + base::Bind(&CallbackTester::IncrementAndUnblock, + base::Unretained(&tester), &run_loop)); ASSERT_FALSE(tester.WasCalledExactlyOnce()); - mock->CompleteCallback(); - base::RunLoop().RunUntilIdle(); + run_loop.Run(); // Wait for IncrementAndUnblock(). ASSERT_TRUE(tester.WasCalledExactlyOnce()); } TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsAfterNetworkChange) { - auto tracker = - std::make_unique<MockNetworkConnectionTrackerOfflineUntilChange>(); - MockNetworkConnectionTrackerOfflineUntilChange* mock = tracker.get(); + auto tracker = std::make_unique<content::MockNetworkConnectionTracker>( + true, network::mojom::ConnectionType::CONNECTION_NONE); + content::MockNetworkConnectionTracker* mock = tracker.get(); Initialize(std::move(tracker)); + base::RunLoop run_loop; CallbackTester tester; - signin_client()->DelayNetworkCall(base::Bind(&CallbackTester::Increment, - base::Unretained(&tester))); + signin_client()->DelayNetworkCall( + base::Bind(&CallbackTester::IncrementAndUnblock, + base::Unretained(&tester), &run_loop)); + ASSERT_FALSE(tester.WasCalledExactlyOnce()); - mock->GoOnline(); - base::RunLoop().RunUntilIdle(); + mock->SetConnectionType(network::mojom::ConnectionType::CONNECTION_3G); + run_loop.Run(); // Wait for IncrementAndUnblock(). ASSERT_TRUE(tester.WasCalledExactlyOnce()); }
diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc index 65a4edd..9f88497 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
@@ -137,6 +137,7 @@ SCOPED_TRACE(testing::Message() << location.ToString()); EXPECT_EQ(expect, status); ++callback_count_; + base::RunLoop::QuitCurrentWhenIdleDeprecated(); } bool CreateTempFile(base::FilePath* path) { @@ -408,7 +409,7 @@ URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); file_system_.operation_runner()->Cancel( id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); - content::RunAllTasksUntilIdle(); + base::RunLoop().Run(); EXPECT_EQ(2, callback_count_); }
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc index 1f12f78..90011c3 100644 --- a/chrome/browser/translate/chrome_translate_client.cc +++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -220,7 +220,7 @@ return translate_manager_.get(); } -void ChromeTranslateClient::ShowTranslateUI( +bool ChromeTranslateClient::ShowTranslateUI( translate::TranslateStep step, const std::string& source_language, const std::string& target_language, @@ -241,7 +241,7 @@ InfoBarService::FromWebContents(web_contents()), web_contents()->GetBrowserContext()->IsOffTheRecord(), step, source_language, target_language, error_type, triggered_from_menu); - return; + return true; } #endif @@ -249,7 +249,7 @@ if (step == translate::TRANSLATE_STEP_BEFORE_TRANSLATE && translate_manager_->ShouldSuppressBubbleUI(triggered_from_menu, source_language)) { - return; + return false; } ShowTranslateBubbleResult result = ShowBubble(step, error_type); @@ -258,6 +258,8 @@ translate_manager_->RecordTranslateEvent( BubbleResultToTranslateEvent(result)); } + + return true; } translate::TranslateDriver* ChromeTranslateClient::GetTranslateDriver() {
diff --git a/chrome/browser/translate/chrome_translate_client.h b/chrome/browser/translate/chrome_translate_client.h index dccb0e69..fc52e93 100644 --- a/chrome/browser/translate/chrome_translate_client.h +++ b/chrome/browser/translate/chrome_translate_client.h
@@ -102,7 +102,7 @@ void RecordLanguageDetectionEvent( const translate::LanguageDetectionDetails& details) const override; - void ShowTranslateUI(translate::TranslateStep step, + bool ShowTranslateUI(translate::TranslateStep step, const std::string& source_language, const std::string& target_language, translate::TranslateErrors::Type error_type,
diff --git a/chrome/browser/ui/views/harmony/chrome_layout_provider.cc b/chrome/browser/ui/views/harmony/chrome_layout_provider.cc index f192468b..07a5f07 100644 --- a/chrome/browser/ui/views/harmony/chrome_layout_provider.cc +++ b/chrome/browser/ui/views/harmony/chrome_layout_provider.cc
@@ -47,10 +47,6 @@ gfx::Insets ChromeLayoutProvider::GetInsetsMetric(int metric) const { switch (metric) { - case ChromeInsetsMetric::INSETS_OMNIBOX: { - int left_inset = ui::MaterialDesignController::IsRefreshUi() ? 2 : 0; - return gfx::Insets(3, left_inset, 3, 3); - } case ChromeInsetsMetric::INSETS_TOAST: return gfx::Insets(0, 8); case INSETS_BOOKMARKS_BAR_BUTTON:
diff --git a/chrome/browser/ui/views/harmony/chrome_layout_provider.h b/chrome/browser/ui/views/harmony/chrome_layout_provider.h index 1738375..f9c9e73 100644 --- a/chrome/browser/ui/views/harmony/chrome_layout_provider.h +++ b/chrome/browser/ui/views/harmony/chrome_layout_provider.h
@@ -14,10 +14,8 @@ #include "ui/views/layout/layout_provider.h" enum ChromeInsetsMetric { - // Padding applied around the text in the omnibox's editable area. - INSETS_OMNIBOX = views::VIEWS_INSETS_END, // Padding around buttons on the bookmarks bar. - INSETS_BOOKMARKS_BAR_BUTTON, + INSETS_BOOKMARKS_BAR_BUTTON = views::VIEWS_INSETS_END, // Margins used by toasts. INSETS_TOAST, };
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index ddc550f..862d453 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -156,6 +156,10 @@ zoom::ZoomEventManager::GetForBrowserContext(profile) ->AddZoomEventManagerObserver(this); + + // TODO(tommycli): This is a placeholder duration. Replace this with the real + // value once UX decides. + text_indent_animation_.SetSlideDuration(200); } LocationBarView::~LocationBarView() { @@ -481,8 +485,18 @@ keyword_hint_view_->SetVisible(false); const int item_padding = GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING); - LocationBarLayout leading_decorations(LocationBarLayout::LEFT_EDGE, - item_padding, item_padding); + + constexpr int kTextIndentDp = 12; + int leading_edit_item_padding = + ui::MaterialDesignController::IsRefreshUi() + ? text_indent_animation_.CurrentValueBetween(0, kTextIndentDp) + : item_padding; + // We always subtract the left padding of the OmniboxView itself to allow for + // an extended I-beam click target without affecting actual layout. + leading_edit_item_padding -= omnibox_view_->GetInsets().left(); + + LocationBarLayout leading_decorations( + LocationBarLayout::LEFT_EDGE, item_padding, leading_edit_item_padding); LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, item_padding, item_padding); @@ -1217,13 +1231,22 @@ //////////////////////////////////////////////////////////////////////////////// // LocationBarView, private gfx::AnimationDelegate implementation: void LocationBarView::AnimationProgressed(const gfx::Animation* animation) { - GetWidget()->non_client_view()->Layout(); + if (animation == &size_animation_) { + GetWidget()->non_client_view()->Layout(); + } else if (animation == &text_indent_animation_) { + Layout(); + SchedulePaint(); + } else { + NOTREACHED(); + } } void LocationBarView::AnimationEnded(const gfx::Animation* animation) { - AnimationProgressed(animation); - if (animation->GetCurrentValue() == 0) - SetVisible(false); + if (animation == &size_animation_) { + AnimationProgressed(animation); + if (animation->GetCurrentValue() == 0) + SetVisible(false); + } } //////////////////////////////////////////////////////////////////////////////// @@ -1246,8 +1269,12 @@ if (focus_ring_) focus_ring_->SchedulePaint(); - if (ui::MaterialDesignController::IsRefreshUi()) - omnibox_view_->UpdateTextIndent(); + if (ui::MaterialDesignController::IsRefreshUi()) { + if (GetOmniboxPopupView()->IsOpen()) + text_indent_animation_.Show(); + else + text_indent_animation_.Hide(); + } } const ToolbarModel* LocationBarView::GetToolbarModel() const {
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 57cf3b0..644f36e 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -469,6 +469,9 @@ // Animation to control showing / hiding the location bar. gfx::SlideAnimation size_animation_{this}; + // Animation to indent the text when opening the suggestions dropdown. + gfx::SlideAnimation text_indent_animation_{this}; + // Whether we're in popup mode. This value also controls whether the location // bar is read-only. const bool is_popup_mode_;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc index 64a3616..3ce83bf8 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
@@ -428,11 +428,19 @@ } image_view->SetBounds(x, y, kRefreshImageBoxSize, child_area.height()); const int text_width = child_area.width() - kTextIndent; - const int text_height = content_view_->GetLineHeight(); - content_view_->SetBounds(x + kTextIndent, y, text_width, text_height); - description_view_->SetBounds( - x + kTextIndent, y + text_height, text_width, - description_view_->GetHeightForWidth(text_width)); + if (description_view_->text().empty()) { + // This vertically centers content in the rare case that no description is + // provided. + content_view_->SetBounds(x + kTextIndent, y, text_width, + child_area.height()); + description_view_->SetSize(gfx::Size()); + } else { + const int text_height = content_view_->GetLineHeight(); + content_view_->SetBounds(x + kTextIndent, y, text_width, text_height); + description_view_->SetBounds( + x + kTextIndent, y + text_height, text_width, + description_view_->GetHeightForWidth(text_width)); + } } void OmniboxMatchCellView::LayoutSplit(int icon_view_width, int text_indent) {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc index b230051..8b89ae6 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc
@@ -184,6 +184,13 @@ result_view_->GetColor(OmniboxPart::RESULTS_TEXT_DIMMED)); } +const base::string16& OmniboxTextView::text() const { + static const base::string16 kEmptyString; + if (!render_text_) + return kEmptyString; + return render_text_->text(); +} + void OmniboxTextView::SetText(const base::string16& text) { render_text_.reset(); render_text_ = CreateRenderText(text);
diff --git a/chrome/browser/ui/views/omnibox/omnibox_text_view.h b/chrome/browser/ui/views/omnibox/omnibox_text_view.h index 884e9ba..f83c606 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_text_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_text_view.h
@@ -40,6 +40,9 @@ // that the non-dimmed text stands out more). void Dim(); + // Returns the render text, or an empty string if there is none. + const base::string16& text() const; + // Sets the render text with default rendering for the given |text|. The // |classifications| are used to style the text. An ImageLine incorporates // both the text and the styling.
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 4318363b..5b33329 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -55,6 +55,7 @@ #include "ui/events/event.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font_list.h" +#include "ui/gfx/geometry/insets.h" #include "ui/gfx/selection_model.h" #include "ui/strings/grit/ui_strings.h" #include "ui/views/accessibility/view_accessibility.h" @@ -174,8 +175,8 @@ // Override the default FocusableBorder from Textfield, since the // LocationBarView will indicate the focus state. - SetBorder(views::CreateEmptyBorder( - ChromeLayoutProvider::Get()->GetInsetsMetric(INSETS_OMNIBOX))); + constexpr gfx::Insets kTextfieldInsets(3); + SetBorder(views::CreateEmptyBorder(kTextfieldInsets)); #if defined(OS_CHROMEOS) chromeos::input_method::InputMethodManager::Get()-> @@ -239,20 +240,6 @@ } } -void OmniboxViewViews::UpdateTextIndent() { - DCHECK(ui::MaterialDesignController::IsRefreshUi()); - - gfx::Insets insets = - ChromeLayoutProvider::Get()->GetInsetsMetric(INSETS_OMNIBOX); - if (model()->popup_model()->IsOpen()) - insets += gfx::Insets(0, 8 /* left */, 0, 0); - - SetBorder(views::CreateEmptyBorder(insets)); - - // This is necessary to reposition the internal RenderText. - OnBoundsChanged(gfx::Rect()); -} - bool OmniboxViewViews::IsHovered() const { return hovered_; }
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index 83ad19a..bf7e7a4 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h
@@ -91,10 +91,6 @@ // "Search Google or type a URL" when the Omnibox is empty and unfocused. void InstallPlaceholderText(); - // If the Omnibox popup is open, updates the text indent to match the popup. - // Otherwise, resets the text indent to default. - void UpdateTextIndent(); - // Returns true if the omnibox is currently hovered. bool IsHovered() const;
diff --git a/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc index cae347c..2915fee7 100644 --- a/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/credit_card.h" +#include "components/payments/core/features.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_test_utils.h" @@ -67,6 +68,48 @@ ExpectBodyContains({"false"}); } +// Visa is required, and user has a masked visa instrument, and Google Pay cards +// in basic-card is disabled. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, + CanMakePayment_Supported_GooglePayCardsDisabled) { + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndDisableFeature( + payments::features::kReturnGooglePayInBasicCard); + NavigateTo("/payment_request_can_make_payment_query_test.html"); + autofill::CreditCard card = autofill::test::GetMaskedServerCard(); + card.SetNumber(base::ASCIIToUTF16("4111111111111111")); // We need a visa. + card.SetNetworkForMaskedCard(autofill::kVisaCard); + autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); + AddAutofillProfile(billing_address); + card.set_billing_address_id(billing_address.guid()); + AddCreditCard(card); + + CallCanMakePayment(); + + ExpectBodyContains({"false"}); +} + +// Visa is required, and user has a masked visa instrument, and Google Pay cards +// in basic-card is enabled. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, + CanMakePayment_Supported_GooglePayCardsEnabled) { + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndEnableFeature( + payments::features::kReturnGooglePayInBasicCard); + NavigateTo("/payment_request_can_make_payment_query_test.html"); + autofill::CreditCard card = autofill::test::GetMaskedServerCard(); + card.SetNumber(base::ASCIIToUTF16("4111111111111111")); // We need a visa. + card.SetNetworkForMaskedCard(autofill::kVisaCard); + autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); + AddAutofillProfile(billing_address); + card.set_billing_address_id(billing_address.guid()); + AddCreditCard(card); + + CallCanMakePayment(); + + ExpectBodyContains({"true"}); +} + // Pages without a valid SSL certificate always get "false" from // .canMakePayment(). IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, @@ -368,7 +411,8 @@ QueryQuotaForPaymentAppsInIncognitoMode) { NavigateTo("/payment_request_payment_method_identifier_test.html"); base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature(features::kServiceWorkerPaymentApps); + scoped_feature_list.InitAndEnableFeature( + ::features::kServiceWorkerPaymentApps); SetIncognito();
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 4a8122c..6287f573 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -874,14 +874,6 @@ return gfx::Size(GetStandardWidth(), GetLayoutConstant(TAB_HEIGHT)); } -void Tab::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { - // If this hierarchy changed has resulted in us being part of a widget - // hierarchy for the first time, we can now get at the theme provider, and - // should recalculate the button color. - if (details.is_add) - OnButtonColorMaybeChanged(); -} - void Tab::PaintChildren(const views::PaintInfo& info) { // Clip children to 1 dp inside the tab's fill path. This has no effect // except when the tab is too narrow to completely show even one icon, at @@ -912,6 +904,10 @@ PaintTab(canvas, clip); } +void Tab::AddedToWidget() { + OnButtonColorMaybeChanged(); +} + void Tab::OnThemeChanged() { OnButtonColorMaybeChanged(); }
diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h index 96ba6fa..f1643bf 100644 --- a/chrome/browser/ui/views/tabs/tab.h +++ b/chrome/browser/ui/views/tabs/tab.h
@@ -90,10 +90,9 @@ gfx::Point* origin) const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; gfx::Size CalculatePreferredSize() const override; - void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) override; void PaintChildren(const views::PaintInfo& info) override; void OnPaint(gfx::Canvas* canvas) override; + void AddedToWidget() override; void OnThemeChanged() override; TabController* controller() const { return controller_; }
diff --git a/chrome/browser/ui/views/tabs/tab_close_button.cc b/chrome/browser/ui/views/tabs/tab_close_button.cc index 5b4e71fe..ff8fb34 100644 --- a/chrome/browser/ui/views/tabs/tab_close_button.cc +++ b/chrome/browser/ui/views/tabs/tab_close_button.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_controller.h" +#include "chrome/common/chrome_features.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/material_design/material_design_controller.h" @@ -170,7 +171,8 @@ SkAlpha TabCloseButton::GetOpacity() { Tab* tab = static_cast<Tab*>(parent()); - if (!MD::IsRefreshUi() || IsMouseHovered() || tab->IsActive()) + if (base::FeatureList::IsEnabled(features::kCloseButtonsInactiveTabs) || + IsMouseHovered() || tab->IsActive()) return SK_AlphaOPAQUE; const double animation_value = tab->hover_controller()->GetAnimationValue(); return gfx::Tween::IntValueBetween(animation_value, SK_AlphaTRANSPARENT,
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 5bde091..a19c349 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -35,6 +35,7 @@ #include "chrome/browser/ui/views/tabs/tab_strip_layout.h" #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" #include "chrome/browser/ui/views/touch_uma/touch_uma.h" +#include "chrome/common/chrome_features.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" #include "third_party/skia/include/core/SkColorFilter.h" @@ -836,9 +837,14 @@ } bool TabStrip::ShouldHideCloseButtonForTab(Tab* tab) const { - if (tab->IsActive()) - return SingleTabMode(); - return touch_layout_ != nullptr || MD::IsRefreshUi(); + if (tab->IsActive()) { + // For single-tab mode, the close button looks like it's floating oddly in + // space for LEADING/TRAILING NTBs, so hide in that case. + return SingleTabMode() && + controller_->GetNewTabButtonPosition() != AFTER_TABS; + } + return touch_layout_ || + !base::FeatureList::IsEnabled(features::kCloseButtonsInactiveTabs); } bool TabStrip::ShouldShowCloseButtonOnHover() { @@ -2411,7 +2417,7 @@ const int active_tab_index = controller_->GetActiveIndex(); if (IsValidModelIndex(active_tab_index)) tab_at(active_tab_index)->Layout(); - new_tab_button_->FrameColorsChanged(); + FrameColorsChanged(); for (TabStripObserver& observer : observers_) observer.OnSingleTabModeChanged(); }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index f0b8f3d..dc51870 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -769,10 +769,8 @@ home_->SetImage(views::Button::STATE_NORMAL, gfx::CreateVectorIcon(home_image, normal_color)); -#if !defined(OS_CHROMEOS) if (avatar_) avatar_->UpdateIcon(); -#endif // !defined(OS_CHROMEOS) app_menu_button_->UpdateIcon(false);
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc index d6b9a8c..dd7cd07 100644 --- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -379,7 +379,15 @@ } void CoreOobeHandler::HandleSkipToLoginForTesting(const base::ListValue* args) { - LoginScreenContext context(args); + LoginScreenContext context; + + // Parse |args|. + if (args->GetSize() > 0) { + std::string email; + if (args->GetString(0, &email)) + context.set_email(email); + } + if (WizardController::default_controller()) WizardController::default_controller()->SkipToLoginForTesting(context); }
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index ff385713..e9cd7c6 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -663,8 +663,7 @@ signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); LoginScreenContext actual_context(context); - actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); - signin_screen_handler_->Show(actual_context); + signin_screen_handler_->Show(actual_context, core_handler_->show_oobe_ui()); } void OobeUI::ForwardAccelerator(std::string accelerator_name) {
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 5d2df72..390f6c0 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -246,23 +246,7 @@ // LoginScreenContext implementation ------------------------------------------ -LoginScreenContext::LoginScreenContext() { - Init(); -} - -LoginScreenContext::LoginScreenContext(const base::ListValue* args) { - Init(); - - if (!args || args->GetSize() == 0) - return; - std::string email; - if (args->GetString(0, &email)) - email_ = email; -} - -void LoginScreenContext::Init() { - oobe_ui_ = false; -} +LoginScreenContext::LoginScreenContext() = default; // SigninScreenHandler implementation ------------------------------------------ @@ -579,11 +563,12 @@ &SigninScreenHandler::HandleNewNoteLaunchAnimationDone); } -void SigninScreenHandler::Show(const LoginScreenContext& context) { +void SigninScreenHandler::Show(const LoginScreenContext& context, + bool oobe_ui) { CHECK(delegate_); // Just initialize internal fields from context and call ShowImpl(). - oobe_ui_ = context.oobe_ui(); + oobe_ui_ = oobe_ui; std::string email; email = context.email();
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h index 552dcc7..ce8ed8db 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -81,19 +81,13 @@ class LoginScreenContext { public: LoginScreenContext(); - explicit LoginScreenContext(const base::ListValue* args); void set_email(const std::string& email) { email_ = email; } const std::string& email() const { return email_; } - void set_oobe_ui(bool oobe_ui) { oobe_ui_ = oobe_ui; } - bool oobe_ui() const { return oobe_ui_; } - private: - void Init(); - + // Optional email to prefill in gaia signin. std::string email_; - bool oobe_ui_; }; // An interface for WebUILoginDisplay to call SigninScreenHandler. @@ -232,7 +226,7 @@ input_method::InputMethodManager::State* ime_state); // Shows the sign in screen. - void Show(const LoginScreenContext& context); + void Show(const LoginScreenContext& context, bool oobe_ui); // Sets delegate to be used by the handler. It is guaranteed that valid // delegate is set before Show() method will be called.
diff --git a/chrome/browser/ui/webui/eoc_internals/eoc_internals_page_handler.cc b/chrome/browser/ui/webui/eoc_internals/eoc_internals_page_handler.cc index b6e6934..681186d2 100644 --- a/chrome/browser/ui/webui/eoc_internals/eoc_internals_page_handler.cc +++ b/chrome/browser/ui/webui/eoc_internals/eoc_internals_page_handler.cc
@@ -20,15 +20,16 @@ using contextual_suggestions::ContextualSuggestionsResult; namespace { -std::string GetAreChromeFlagsSetupString() { +bool AreChromeFlagsSetup() { return (base::FeatureList::IsEnabled( contextual_suggestions::kContextualSuggestionsBottomSheet) || base::FeatureList::IsEnabled( contextual_suggestions::kContextualSuggestionsButton)) && - base::FeatureList::IsEnabled( - chrome::android::kChromeModernDesign) - ? "true" - : "false"; + base::FeatureList::IsEnabled(chrome::android::kChromeModernDesign); +} + +std::string GetAreChromeFlagsSetupString() { + return AreChromeFlagsSetup() ? "true" : "false"; } } // namespace @@ -88,6 +89,11 @@ void EocInternalsPageHandler::ClearCachedMetricEvents( ClearCachedMetricEventsCallback callback) { + if (!AreChromeFlagsSetup()) { + std::move(callback).Run(); + return; + } + contextual_content_suggestions_service_->GetDebuggingReporter() ->ClearEvents(); std::move(callback).Run(); @@ -140,6 +146,11 @@ void EocInternalsPageHandler::ClearCachedSuggestionResults( ClearCachedSuggestionResultsCallback callback) { + if (!AreChromeFlagsSetup()) { + std::move(callback).Run(); + return; + } + contextual_content_suggestions_service_->ClearCachedResultsForDebugging(); std::move(callback).Run(); }
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc index c6481bc..debbb37 100644 --- a/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/signin/chrome_signin_helper.h" +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_error_controller_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_promo.h" @@ -42,6 +43,7 @@ #include "components/browser_sync/profile_sync_service.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/profile_management_switches.h" +#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_header_helper.h" #include "components/signin/core/browser/signin_metrics.h" @@ -251,9 +253,8 @@ base::Unretained(this))); #else web_ui()->RegisterMessageCallback( - "SyncSetupStopSyncing", - base::BindRepeating(&PeopleHandler::HandleStopSyncing, - base::Unretained(this))); + "SyncSetupSignout", base::BindRepeating(&PeopleHandler::HandleSignout, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "SyncSetupStartSignIn", base::BindRepeating(&PeopleHandler::HandleStartSignin, @@ -708,19 +709,30 @@ DisplayGaiaLogin(signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS); } -void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { +void PeopleHandler::HandleSignout(const base::ListValue* args) { bool delete_profile = false; args->GetBoolean(0, &delete_profile); - if (!SigninManagerFactory::GetForProfile(profile_)->IsSignoutProhibited()) { - if (GetSyncService()) - ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); + SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); + if (signin_manager->IsSignoutProhibited()) { + // If the user cannot signout, the profile must be destroyed. + DCHECK(delete_profile); + } else { + if (signin_manager->IsAuthenticated()) { + if (GetSyncService()) + ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); - signin_metrics::SignoutDelete delete_metric = - delete_profile ? signin_metrics::SignoutDelete::DELETED - : signin_metrics::SignoutDelete::KEEPING; - SigninManagerFactory::GetForProfile(profile_) - ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); + signin_metrics::SignoutDelete delete_metric = + delete_profile ? signin_metrics::SignoutDelete::DELETED + : signin_metrics::SignoutDelete::KEEPING; + signin_manager->SignOutAndRemoveAllAccounts( + signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); + } else { + DCHECK(!delete_profile) + << "Deleting the profile should only be offered the user is syncing."; + ProfileOAuth2TokenServiceFactory::GetForProfile(profile_) + ->RevokeAllCredentials(); + } } if (delete_profile) {
diff --git a/chrome/browser/ui/webui/settings/people_handler.h b/chrome/browser/ui/webui/settings/people_handler.h index b39378b97..bfedcdc 100644 --- a/chrome/browser/ui/webui/settings/people_handler.h +++ b/chrome/browser/ui/webui/settings/people_handler.h
@@ -174,7 +174,7 @@ void HandleRequestPinLoginState(const base::ListValue* args); #endif void HandleStartSignin(const base::ListValue* args); - void HandleStopSyncing(const base::ListValue* args); + void HandleSignout(const base::ListValue* args); void HandleGetSyncStatus(const base::ListValue* args); void HandleManageOtherPeople(const base::ListValue* args);
diff --git a/chrome/browser/vr/gesture_detector.cc b/chrome/browser/vr/gesture_detector.cc index d1d94a5..11b1def 100644 --- a/chrome/browser/vr/gesture_detector.cc +++ b/chrome/browser/vr/gesture_detector.cc
@@ -11,7 +11,11 @@ namespace { -constexpr float kDisplacementScaleFactor = 300.0f; +constexpr float kDisplacementScaleFactor = 215.0f; + +// This varies on the range [0, 1] and represents how much we favor predicted +// positions over measured positions. +constexpr float kSmoothingBias = 0.4f; constexpr int kMaxNumOfExtrapolations = 2; @@ -50,7 +54,8 @@ UpdateOverallVelocity(touch_info); auto gesture_list = std::make_unique<GestureList>(); - auto gesture = GetGestureFromTouchInfo(touch_info, force_cancel); + auto gesture = + GetGestureFromTouchInfo(touch_info, force_cancel, current_timestamp); gesture->SetSourceDevice(blink::kWebGestureDeviceTouchpad); if (gesture->GetType() == blink::WebInputEvent::kGestureScrollEnd) @@ -63,7 +68,8 @@ std::unique_ptr<blink::WebGestureEvent> GestureDetector::GetGestureFromTouchInfo(const TouchInfo& touch_info, - bool force_cancel) { + bool force_cancel, + base::TimeTicks current_timestamp) { auto gesture = std::make_unique<blink::WebGestureEvent>(); gesture->SetTimeStamp(touch_info.touch_point.timestamp); @@ -78,12 +84,14 @@ break; // User is scrolling on touchpad case SCROLLING: - HandleScrollingState(touch_info, force_cancel, gesture.get()); + HandleScrollingState(touch_info, force_cancel, current_timestamp, + gesture.get()); break; // The user has finished scrolling, but we'll hallucinate a few points // before really finishing. case POST_SCROLL: - HandlePostScrollingState(touch_info, force_cancel, gesture.get()); + HandlePostScrollingState(touch_info, force_cancel, current_timestamp, + gesture.get()); break; default: NOTREACHED(); @@ -135,6 +143,7 @@ void GestureDetector::HandleScrollingState(const TouchInfo& touch_info, bool force_cancel, + base::TimeTicks current_timestamp, blink::WebGestureEvent* gesture) { if (force_cancel) { gesture->SetType(blink::WebInputEvent::kGestureScrollEnd); @@ -147,13 +156,14 @@ if (touch_position_changed_) { gesture->SetType(blink::WebInputEvent::kGestureScrollUpdate); UpdateGestureParameters(touch_info); - UpdateGestureWithScrollDelta(gesture); + UpdateGestureWithScrollDelta(gesture, current_timestamp); } } void GestureDetector::HandlePostScrollingState( const TouchInfo& touch_info, bool force_cancel, + base::TimeTicks current_timestamp, blink::WebGestureEvent* gesture) { if (extrapolated_touch_ == 0 || force_cancel) { gesture->SetType(blink::WebInputEvent::kGestureScrollEnd); @@ -161,16 +171,40 @@ } else { gesture->SetType(blink::WebInputEvent::kGestureScrollUpdate); UpdateGestureParameters(touch_info); - UpdateGestureWithScrollDelta(gesture); + UpdateGestureWithScrollDelta(gesture, current_timestamp); } } void GestureDetector::UpdateGestureWithScrollDelta( - blink::WebGestureEvent* gesture) { + blink::WebGestureEvent* gesture, + base::TimeTicks current_timestamp) { gesture->data.scroll_update.delta_x = state_->displacement.x() * kDisplacementScaleFactor; gesture->data.scroll_update.delta_y = state_->displacement.y() * kDisplacementScaleFactor; + + // Attempt to smooth the scroll deltas. This depends on a velocity vector. + // If we have one, we will use it to compute a predicted scroll and, + // ultimately, we will produce a scroll update that blends the predicted and + // measured scroll deltas per |kSmoothingBias|. + if (!state_->overall_velocity.IsZero()) { + gfx::PointF predicted_point; + float duration = (current_timestamp - last_timestamp_).InSecondsF(); + predicted_point.set_x(state_->overall_velocity.x() * duration * + kDisplacementScaleFactor); + predicted_point.set_y(state_->overall_velocity.y() * duration * + kDisplacementScaleFactor); + + gfx::PointF measured_point(gesture->data.scroll_update.delta_x, + gesture->data.scroll_update.delta_y); + + gfx::Vector2dF delta = + ScaleVector2d(predicted_point - measured_point, kSmoothingBias); + gfx::PointF interpolated_point = measured_point + delta; + + gesture->data.scroll_update.delta_x = interpolated_point.x(); + gesture->data.scroll_update.delta_y = interpolated_point.y(); + } } bool GestureDetector::UpdateCurrentTouchPoint(const TouchInfo& touch_info) {
diff --git a/chrome/browser/vr/gesture_detector.h b/chrome/browser/vr/gesture_detector.h index 07df080..f279730 100644 --- a/chrome/browser/vr/gesture_detector.h +++ b/chrome/browser/vr/gesture_detector.h
@@ -62,7 +62,8 @@ std::unique_ptr<blink::WebGestureEvent> GetGestureFromTouchInfo( const TouchInfo& input_touch_info, - bool force_cancel); + bool force_cancel, + base::TimeTicks current_timestamp); void HandleWaitingState(const TouchInfo& touch_info, blink::WebGestureEvent* gesture); @@ -71,12 +72,15 @@ blink::WebGestureEvent* gesture); void HandleScrollingState(const TouchInfo& touch_info, bool force_cancel, + base::TimeTicks current_timestamp, blink::WebGestureEvent* gesture); void HandlePostScrollingState(const TouchInfo& touch_info, bool force_cancel, + base::TimeTicks current_timestamp, blink::WebGestureEvent* gesture); - void UpdateGestureWithScrollDelta(blink::WebGestureEvent* gesture); + void UpdateGestureWithScrollDelta(blink::WebGestureEvent* gesture, + base::TimeTicks current_timestamp); // If the user is touching the touch pad and the touch point is different from // before, update the touch point and return true. Otherwise, return false.
diff --git a/chrome/browser/vr/service/browser_xr_device.cc b/chrome/browser/vr/service/browser_xr_device.cc index 0e0f75b6..40dfbdb9 100644 --- a/chrome/browser/vr/service/browser_xr_device.cc +++ b/chrome/browser/vr/service/browser_xr_device.cc
@@ -9,17 +9,33 @@ namespace vr { -BrowserXrDevice::BrowserXrDevice(device::VRDevice* device, bool is_fallback) - : device_(device), is_fallback_(is_fallback), weak_ptr_factory_(this) { - device_->SetVRDeviceEventListener(this); - display_info_ = device->GetVRDisplayInfo(); +BrowserXrDevice::BrowserXrDevice(device::mojom::XRRuntimePtr device, + device::mojom::VRDisplayInfoPtr display_info, + bool is_fallback) + : device_(std::move(device)), + display_info_(std::move(display_info)), + is_fallback_(is_fallback), + binding_(this), + weak_ptr_factory_(this) { + device::mojom::XRRuntimeEventListenerPtr listener; + binding_.Bind(mojo::MakeRequest(&listener)); + + // Unretained is safe because we are calling through an InterfacePtr we own, + // so we won't be called after device_ is destroyed. + device_->ListenToDeviceChanges( + std::move(listener), + base::BindOnce(&BrowserXrDevice::OnInitialDevicePropertiesReceived, + base::Unretained(this))); } -BrowserXrDevice::~BrowserXrDevice() { - device_->SetVRDeviceEventListener(nullptr); +void BrowserXrDevice::OnInitialDevicePropertiesReceived( + device::mojom::VRDisplayInfoPtr display_info) { + OnDisplayInfoChanged(std::move(display_info)); } -void BrowserXrDevice::OnChanged( +BrowserXrDevice::~BrowserXrDevice() = default; + +void BrowserXrDevice::OnDisplayInfoChanged( device::mojom::VRDisplayInfoPtr vr_device_info) { display_info_ = vr_device_info.Clone(); for (VRDisplayHost* display : displays_) { @@ -29,7 +45,6 @@ void BrowserXrDevice::StopExclusiveSession() { if (exclusive_session_controller_) { - exclusive_session_controller_->StopSession(); exclusive_session_controller_ = nullptr; presenting_display_host_ = nullptr; } @@ -42,8 +57,9 @@ } } -void BrowserXrDevice::OnActivate(device::mojom::VRDisplayEventReason reason, - base::OnceCallback<void(bool)> on_handled) { +void BrowserXrDevice::OnDeviceActivated( + device::mojom::VRDisplayEventReason reason, + base::OnceCallback<void(bool)> on_handled) { if (listening_for_activation_display_host_) { listening_for_activation_display_host_->OnActivate(reason, std::move(on_handled)); @@ -52,7 +68,7 @@ } } -void BrowserXrDevice::OnDeactivate(device::mojom::VRDisplayEventReason reason) { +void BrowserXrDevice::OnDeviceIdle(device::mojom::VRDisplayEventReason reason) { for (VRDisplayHost* display : displays_) { display->OnDeactivate(reason); } @@ -72,7 +88,7 @@ if (display == listening_for_activation_display_host_) { // Not listening for activation. listening_for_activation_display_host_ = nullptr; - GetDevice()->SetListeningForActivate(false); + device_->SetListeningForActivate(false); } } @@ -84,32 +100,32 @@ void BrowserXrDevice::RequestSession( VRDisplayHost* display, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback) { device_->RequestSession( - options, base::BindOnce(&BrowserXrDevice::OnRequestSessionResult, - weak_ptr_factory_.GetWeakPtr(), display, options, - std::move(callback))); + options->Clone(), base::BindOnce(&BrowserXrDevice::OnRequestSessionResult, + weak_ptr_factory_.GetWeakPtr(), display, + options->Clone(), std::move(callback))); } void BrowserXrDevice::OnRequestSessionResult( VRDisplayHost* display, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback, device::mojom::XRPresentationConnectionPtr connection, - device::XrSessionController* exclusive_session_controller) { + device::mojom::XRSessionControllerPtr exclusive_session_controller) { if (connection && (displays_.find(display) != displays_.end())) { - if (options.exclusive) { + if (options->exclusive) { presenting_display_host_ = display; - exclusive_session_controller_ = exclusive_session_controller; + exclusive_session_controller_ = std::move(exclusive_session_controller); } std::move(callback).Run(std::move(connection)); } else { std::move(callback).Run(nullptr); if (connection) { - // The device has been removed, but we still got connection, so make sure - // to clean up this weird state. - exclusive_session_controller_ = exclusive_session_controller; + // The device has been removed, but we still got a connection, so make + // sure to clean up this weird state. + exclusive_session_controller_ = std::move(exclusive_session_controller); StopExclusiveSession(); } }
diff --git a/chrome/browser/vr/service/browser_xr_device.h b/chrome/browser/vr/service/browser_xr_device.h index edf70b0..03ada27 100644 --- a/chrome/browser/vr/service/browser_xr_device.h +++ b/chrome/browser/vr/service/browser_xr_device.h
@@ -5,7 +5,10 @@ #ifndef CHROME_BROWSER_VR_SERVICE_BROWSER_XR_DEVICE_H_ #define CHROME_BROWSER_VR_SERVICE_BROWSER_XR_DEVICE_H_ +#include "device/vr/public/mojom/isolated_xr_service.mojom.h" +#include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/vr_device.h" +#include "mojo/public/cpp/bindings/binding.h" namespace vr { @@ -15,19 +18,14 @@ // There is one BrowserXrDevice per VRDevice (ie - one per runtime). // It manages browser-side handling of state, like which VRDisplayHost is // listening for device activation. -class BrowserXrDevice : public device::VRDeviceEventListener { +class BrowserXrDevice : public device::mojom::XRRuntimeEventListener { public: - explicit BrowserXrDevice(device::VRDevice* device, bool is_fallback); + explicit BrowserXrDevice(device::mojom::XRRuntimePtr device, + device::mojom::VRDisplayInfoPtr info, + bool is_fallback); ~BrowserXrDevice() override; - device::VRDevice* GetDevice() { return device_; } - - // device::VRDeviceEventListener - void OnChanged(device::mojom::VRDisplayInfoPtr vr_device_info) override; - void OnExitPresent() override; - void OnActivate(device::mojom::VRDisplayEventReason reason, - base::OnceCallback<void(bool)> on_handled) override; - void OnDeactivate(device::mojom::VRDisplayEventReason reason) override; + device::mojom::XRRuntime* GetRuntime() { return device_.get(); } // Methods called by VRDisplayHost to interact with the device. void OnDisplayHostAdded(VRDisplayHost* display); @@ -35,7 +33,7 @@ void ExitPresent(VRDisplayHost* display); void RequestSession( VRDisplayHost* display, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback); VRDisplayHost* GetPresentingDisplayHost() { return presenting_display_host_; } void UpdateListeningForActivate(VRDisplayHost* display); @@ -47,18 +45,27 @@ bool IsFallbackDevice() { return is_fallback_; } private: + // device::XRRuntimeEventListener + void OnDisplayInfoChanged( + device::mojom::VRDisplayInfoPtr vr_device_info) override; + void OnExitPresent() override; + void OnDeviceActivated(device::mojom::VRDisplayEventReason reason, + base::OnceCallback<void(bool)> on_handled) override; + void OnDeviceIdle(device::mojom::VRDisplayEventReason reason) override; + + void OnInitialDevicePropertiesReceived( + device::mojom::VRDisplayInfoPtr display_info); void StopExclusiveSession(); void OnListeningForActivate(bool is_listening); void OnRequestSessionResult( VRDisplayHost* display, - const device::XRDeviceRuntimeSessionOptions& options, + device::mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback, device::mojom::XRPresentationConnectionPtr connection, - device::XrSessionController* exclusive_session_controller); + device::mojom::XRSessionControllerPtr exclusive_session_controller); - // Not owned by this class, but valid while BrowserXrDevice is alive. - device::VRDevice* device_; - device::XrSessionController* exclusive_session_controller_ = nullptr; + device::mojom::XRRuntimePtr device_; + device::mojom::XRSessionControllerPtr exclusive_session_controller_; std::set<VRDisplayHost*> displays_; device::mojom::VRDisplayInfoPtr display_info_; @@ -67,6 +74,8 @@ VRDisplayHost* presenting_display_host_ = nullptr; bool is_fallback_; + mojo::Binding<device::mojom::XRRuntimeEventListener> binding_; + base::WeakPtrFactory<BrowserXrDevice> weak_ptr_factory_; };
diff --git a/chrome/browser/vr/service/vr_device_manager.cc b/chrome/browser/vr/service/vr_device_manager.cc index 9d5d916..e142f69 100644 --- a/chrome/browser/vr/service/vr_device_manager.cc +++ b/chrome/browser/vr/service/vr_device_manager.cc
@@ -138,7 +138,8 @@ void VRDeviceManager::AddDevice(bool is_fallback, unsigned int id, - device::VRDevice* device) { + device::mojom::VRDisplayInfoPtr info, + device::mojom::XRRuntimePtr runtime) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(devices_.find(id) == devices_.end()); @@ -152,7 +153,8 @@ service->RemoveDevice(device); } - devices_[id] = std::make_unique<BrowserXrDevice>(device, is_fallback); + devices_[id] = std::make_unique<BrowserXrDevice>( + std::move(runtime), std::move(info), is_fallback); if (!is_fallback || devices_.size() == 1) { BrowserXrDevice* device_to_add = devices_[id].get(); for (VRServiceImpl* service : services_) @@ -183,7 +185,7 @@ #endif } -device::VRDevice* VRDeviceManager::GetDevice(unsigned int id) { +device::mojom::XRRuntime* VRDeviceManager::GetRuntime(unsigned int id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (id == 0) @@ -193,7 +195,7 @@ if (iter == devices_.end()) return nullptr; - return iter->second->GetDevice(); + return iter->second->GetRuntime(); } void VRDeviceManager::InitializeProviders() {
diff --git a/chrome/browser/vr/service/vr_device_manager.h b/chrome/browser/vr/service/vr_device_manager.h index 32c5c786..bf16da6d 100644 --- a/chrome/browser/vr/service/vr_device_manager.h +++ b/chrome/browser/vr/service/vr_device_manager.h
@@ -57,7 +57,7 @@ ProviderList fallback_providers); // Used by tests to check on device state. - device::VRDevice* GetDevice(unsigned int id); + device::mojom::XRRuntime* GetRuntime(unsigned int id); size_t NumberOfConnectedServices(); @@ -66,7 +66,10 @@ void OnProviderInitialized(); bool AreAllProvidersInitialized(); - void AddDevice(bool is_fallback, unsigned int id, device::VRDevice* device); + void AddDevice(bool is_fallback, + unsigned int id, + device::mojom::VRDisplayInfoPtr info, + device::mojom::XRRuntimePtr runtime); void RemoveDevice(unsigned int id); ProviderList providers_;
diff --git a/chrome/browser/vr/service/vr_device_manager_unittest.cc b/chrome/browser/vr/service/vr_device_manager_unittest.cc index 48a54df..a37564b4 100644 --- a/chrome/browser/vr/service/vr_device_manager_unittest.cc +++ b/chrome/browser/vr/service/vr_device_manager_unittest.cc
@@ -35,7 +35,7 @@ } // Expose this test-only method as public for tests. - using VRDeviceManager::GetDevice; + using VRDeviceManager::GetRuntime; }; class VRServiceImplForTesting : public VRServiceImpl { @@ -118,26 +118,10 @@ EXPECT_TRUE(Provider()->Initialized()); // GetDeviceByIndex should return nullptr if an invalid index in queried. - device::VRDevice* queried_device = DeviceManager()->GetDevice(1); + device::mojom::XRRuntime* queried_device = DeviceManager()->GetRuntime(1); EXPECT_EQ(nullptr, queried_device); } -TEST_F(VRDeviceManagerTest, GetDevicesTest) { - device::FakeVRDevice* device1 = new device::FakeVRDevice(1); - Provider()->AddDevice(base::WrapUnique(device1)); - // VRDeviceManager will query devices as a side effect. - auto service_1 = BindService(); - // Should have successfully returned one device. - EXPECT_EQ(device1, DeviceManager()->GetDevice(device1->GetId())); - - device::FakeVRDevice* device2 = new device::FakeVRDevice(2); - Provider()->AddDevice(base::WrapUnique(device2)); - auto service_2 = BindService(); - // Querying the WebVRDevice index should return the correct device. - EXPECT_EQ(device1, DeviceManager()->GetDevice(device1->GetId())); - EXPECT_EQ(device2, DeviceManager()->GetDevice(device2->GetId())); -} - // Ensure that services are registered with the device manager as they are // created and removed from the device manager as their connections are closed. TEST_F(VRDeviceManagerTest, DeviceManagerRegistration) {
diff --git a/chrome/browser/vr/service/vr_display_host.cc b/chrome/browser/vr/service/vr_display_host.cc index dcb74c3..ed9787b 100644 --- a/chrome/browser/vr/service/vr_display_host.cc +++ b/chrome/browser/vr/service/vr_display_host.cc
@@ -37,13 +37,13 @@ return true; } -device::XRDeviceRuntimeSessionOptions GetRuntimeOptions( +device::mojom::XRDeviceRuntimeSessionOptionsPtr GetRuntimeOptions( device::mojom::XRSessionOptions* options) { - device::XRDeviceRuntimeSessionOptions runtime_options = - device::XRDeviceRuntimeSessionOptions(); - runtime_options.exclusive = options->exclusive; - runtime_options.has_user_activation = options->has_user_activation; - runtime_options.use_legacy_webvr_render_path = + device::mojom::XRDeviceRuntimeSessionOptionsPtr runtime_options = + device::mojom::XRDeviceRuntimeSessionOptions::New(); + runtime_options->exclusive = options->exclusive; + runtime_options->has_user_activation = options->has_user_activation; + runtime_options->use_legacy_webvr_render_path = options->use_legacy_webvr_render_path; return runtime_options; } @@ -60,19 +60,36 @@ in_focused_frame_( render_frame_host ? render_frame_host->GetView()->HasFocus() : false), render_frame_host_(render_frame_host), - binding_(this) { - device::mojom::VRDisplayHostPtr display; - binding_.Bind(mojo::MakeRequest(&display)); - display_ = std::make_unique<device::VRDisplayImpl>( - device->GetDevice(), std::move(service_client), std::move(display_info), - std::move(display), mojo::MakeRequest(&client_)); - display_->SetFrameDataRestricted(!in_focused_frame_); + binding_(this), + weak_ptr_factory_(this) { + device::mojom::VRMagicWindowProviderPtr magic_window_provider; + device->GetRuntime()->RequestMagicWindowSession( + mojo::MakeRequest(&magic_window_provider), + mojo::MakeRequest(&magic_window_controller_), + base::BindOnce(&VRDisplayHost::OnMagicWindowSessionCreated, + weak_ptr_factory_.GetWeakPtr())); + + // Tell blink that we are available. + device::mojom::VRDisplayHostPtr display_host; + binding_.Bind(mojo::MakeRequest(&display_host)); + + service_client->OnDisplayConnected( + std::move(magic_window_provider), std::move(display_host), + mojo::MakeRequest(&client_), browser_device_->GetVRDisplayInfo()); + + // Tell the BrowserXrDevice about us. browser_device_->OnDisplayHostAdded(this); } +void VRDisplayHost::OnMagicWindowSessionCreated(bool success) { + if (success) { + // Start giving out magic window data if we are focused. + magic_window_controller_->SetFrameDataRestricted(!in_focused_frame_); + } +} + VRDisplayHost::~VRDisplayHost() { browser_device_->OnDisplayHostRemoved(this); - display_->StopSession(); } void VRDisplayHost::RequestSession(device::mojom::XRSessionOptionsPtr options, @@ -97,21 +114,21 @@ } auto runtime_options = GetRuntimeOptions(options.get()); - - runtime_options.render_process_id = + runtime_options->render_process_id = render_frame_host_ ? render_frame_host_->GetProcess()->GetID() : -1; - runtime_options.render_frame_id = + runtime_options->render_frame_id = render_frame_host_ ? render_frame_host_->GetRoutingID() : -1; // AR currently uses a non-exclusive session but we still want to call request // session on it. - if (runtime_options.exclusive || + if (runtime_options->exclusive || base::FeatureList::IsEnabled(features::kWebXrHitTest)) { if (!triggered_by_displayactive) { ReportRequestPresent(); } - browser_device_->RequestSession(this, runtime_options, std::move(callback)); + browser_device_->RequestSession(this, std::move(runtime_options), + std::move(callback)); } else { // TODO(offenwanger) When the XRMagicWindowProvider or equivalent is // returned here, clean out this dummy code. @@ -169,7 +186,8 @@ void VRDisplayHost::SetInFocusedFrame(bool in_focused_frame) { in_focused_frame_ = in_focused_frame; browser_device_->UpdateListeningForActivate(this); - display_->SetFrameDataRestricted(!in_focused_frame_); + if (magic_window_controller_) + magic_window_controller_->SetFrameDataRestricted(!in_focused_frame_); } void VRDisplayHost::OnChanged(device::mojom::VRDisplayInfoPtr vr_device_info) {
diff --git a/chrome/browser/vr/service/vr_display_host.h b/chrome/browser/vr/service/vr_display_host.h index bc0db36e..acd354b 100644 --- a/chrome/browser/vr/service/vr_display_host.h +++ b/chrome/browser/vr/service/vr_display_host.h
@@ -62,12 +62,12 @@ bool IsAnotherHostPresenting(); bool InternalSupportsSession(device::mojom::XRSessionOptions* options); + void OnMagicWindowSessionCreated(bool success); // TODO(https://crbug.com/837538): Instead, check before returning this // object. bool IsSecureContextRequirementSatisfied(); - std::unique_ptr<device::VRDisplayImpl> display_; BrowserXrDevice* browser_device_ = nullptr; bool in_focused_frame_ = false; bool listening_for_activate_ = false; @@ -76,6 +76,10 @@ mojo::Binding<device::mojom::VRDisplayHost> binding_; device::mojom::VRDisplayClientPtr client_; + device::mojom::XRSessionControllerPtr magic_window_controller_; + + base::WeakPtrFactory<VRDisplayHost> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(VRDisplayHost); };
diff --git a/chrome/browser/vr/service/vr_service_impl.cc b/chrome/browser/vr/service/vr_service_impl.cc index a35f55da..20fc2a2 100644 --- a/chrome/browser/vr/service/vr_service_impl.cc +++ b/chrome/browser/vr/service/vr_service_impl.cc
@@ -67,7 +67,6 @@ } void VRServiceImpl::InitializationComplete() { - DCHECK(!set_client_callback_.is_null()); base::ResetAndReturn(&set_client_callback_).Run(); } @@ -77,8 +76,7 @@ // Client should always be set as this is called through SetClient. DCHECK(client_); DCHECK(displays_.find(device) == displays_.end()); - device::mojom::VRDisplayInfoPtr display_info = - device->GetDevice()->GetVRDisplayInfo(); + device::mojom::VRDisplayInfoPtr display_info = device->GetVRDisplayInfo(); DCHECK(display_info); if (!display_info) return;
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 1c1dae1c..95d4d08 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -176,6 +176,10 @@ const base::Feature kClipboardContentSetting{"ClipboardContentSetting", base::FEATURE_ENABLED_BY_DEFAULT}; +// Whether inactive tabs show their close buttons by default for non-touch mode. +const base::Feature kCloseButtonsInactiveTabs{"CloseButtonsInactiveTabs", + base::FEATURE_ENABLED_BY_DEFAULT}; + #if defined(OS_CHROMEOS) // Enable project Crostini, Linux VMs on Chrome OS. const base::Feature kCrostini{"Crostini", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 653b2ae..c701fb7 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -86,6 +86,8 @@ extern const base::Feature kClipboardContentSetting; +extern const base::Feature kCloseButtonsInactiveTabs; + #if defined(OS_MACOSX) extern const base::Feature kContentFullscreen; #endif
diff --git a/chrome/common/mac/mock_launchd.cc b/chrome/common/mac/mock_launchd.cc index f2d33cc..f6fe40c6 100644 --- a/chrome/common/mac/mock_launchd.cc +++ b/chrome/common/mac/mock_launchd.cc
@@ -227,8 +227,8 @@ bool MockLaunchd::RemoveJob(CFStringRef label, CFErrorRef* error) { remove_called_ = true; - if (quit_closure_) - std::move(quit_closure_).Run(); + main_task_runner_->PostTask( + FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); return true; } @@ -237,8 +237,8 @@ CFStringRef name, CFStringRef session_type) { restart_called_ = true; - if (quit_closure_) - std::move(quit_closure_).Run(); + main_task_runner_->PostTask( + FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); return true; }
diff --git a/chrome/common/mac/mock_launchd.h b/chrome/common/mac/mock_launchd.h index 59a6e76..d590d286 100644 --- a/chrome/common/mac/mock_launchd.h +++ b/chrome/common/mac/mock_launchd.h
@@ -10,7 +10,6 @@ #include <memory> #include <string> -#include "base/callback.h" #include "base/files/file_path.h" #include "base/mac/scoped_cftyperef.h" #include "base/memory/scoped_refptr.h" @@ -36,10 +35,6 @@ bool as_service); ~MockLaunchd() override; - void set_quit_closure(base::OnceClosure quit_closure) { - quit_closure_ = std::move(quit_closure); - } - CFDictionaryRef CopyJobDictionary(CFStringRef label) override; CFDictionaryRef CopyDictionaryByCheckingIn(CFErrorRef* error) override; bool RemoveJob(CFStringRef label, CFErrorRef* error) override; @@ -68,7 +63,6 @@ base::FilePath file_; std::string pipe_name_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; - base::OnceClosure quit_closure_; std::unique_ptr<MultiProcessLock> running_lock_; bool create_socket_; bool as_service_;
diff --git a/chrome/common/service_process_util_mac_unittest.mm b/chrome/common/service_process_util_mac_unittest.mm index 38b3b54..ad399a3d 100644 --- a/chrome/common/service_process_util_mac_unittest.mm +++ b/chrome/common/service_process_util_mac_unittest.mm
@@ -50,7 +50,6 @@ &bundle_path_, &executable_path_)); mock_launchd_.reset( new MockLaunchd(executable_path_, loop_.task_runner(), false, false)); - mock_launchd_->set_quit_closure(run_loop_.QuitClosure()); scoped_launchd_instance_.reset( new Launchd::ScopedInstance(mock_launchd_.get())); ASSERT_TRUE(service_process_state_.Initialize());
diff --git a/chrome/elevation_service/elevation_service_idl.idl b/chrome/elevation_service/elevation_service_idl.idl index 4963bda..66edc23 100644 --- a/chrome/elevation_service/elevation_service_idl.idl +++ b/chrome/elevation_service/elevation_service_idl.idl
@@ -9,19 +9,16 @@ object, oleautomation, uuid(A949CB4E-C4F9-44C4-B213-6BF8AA9AC69C), - helpstring("IRegisteredCommandElevator Interface"), + helpstring("IElevator Interface"), pointer_default(unique) ] -interface IRegisteredCommandElevator : IUnknown +interface IElevator : IUnknown { - // Runs a command elevated. + // Returns the class factory for a specific elevator. // - // @param event_id Unique id for the command - // @param caller_proc_id The process id of the calling process - // @param proc_handle The process handle valid in the caller's context - HRESULT LaunchCommand([in, string] const WCHAR* cmd_id, - [in] DWORD caller_proc_id, - [out] ULONG_PTR* proc_handle); + // @param elevator_id Unique id for the elevator. + HRESULT GetElevatorFactory([in, string] const WCHAR* elevator_id, + [out] IClassFactory** factory); }; [ @@ -32,5 +29,5 @@ library ElevatorLib { importlib("stdole2.tlb"); - interface IRegisteredCommandElevator; + interface IElevator; };
diff --git a/chrome/elevation_service/elevator.cc b/chrome/elevation_service/elevator.cc index 01275cc..33a65b99 100644 --- a/chrome/elevation_service/elevator.cc +++ b/chrome/elevation_service/elevator.cc
@@ -9,188 +9,25 @@ #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "base/win/scoped_process_information.h" +#include "chrome/elevation_service/service_main.h" #include "chrome/install_static/install_util.h" namespace elevation_service { -namespace { +IFACEMETHODIMP Elevator::GetElevatorFactory(const base::char16* elevator_id, + IClassFactory** factory) { + DCHECK(elevator_id); + DCHECK(factory); -// This registry key contains the commands that the Elevator can run. -constexpr base::char16 kCommandsRegistryKey[] = L"Commands"; -constexpr base::char16 kPathAndName[] = L"PathAndName"; -constexpr base::char16 kArguments[] = L"Arguments"; + *factory = nullptr; -HRESULT HRESULTFromLastError() { - const DWORD error_code = ::GetLastError(); - return (error_code != ERROR_SUCCESS) ? HRESULT_FROM_WIN32(error_code) : - E_FAIL; -} + elevation_service::ServiceMain* service = + elevation_service::ServiceMain::GetInstance(); + Microsoft::WRL::ComPtr<IClassFactory> f = + service->GetElevatorFactory(elevator_id); + f.CopyTo(factory); -// TODO(ganesh): we need to have the installer write into the proper key for the -// bitness (i.e., no KEY_WOW64 specifier) and make sure it deletes a stale value -// in the opposite bitness hive to cover cases where a 32-bit install is updated -// to 64-bit. -HRESULT GetCommandToLaunch(base::StringPiece16 cmd_id, - base::FilePath* path_and_name, - base::string16* args) { - base::win::RegKey key; - - auto registry_key_path = - install_static::GetRegistryPath() + L"\\" + kCommandsRegistryKey + L"\\"; - cmd_id.AppendToString(®istry_key_path); - - LONG result = - key.Open(HKEY_LOCAL_MACHINE, registry_key_path.c_str(), KEY_QUERY_VALUE); - if (result != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(result); - - base::string16 string_path_and_name; - result = key.ReadValue(kPathAndName, &string_path_and_name); - if (result != ERROR_SUCCESS) - return HRESULT_FROM_WIN32(result); - - *path_and_name = base::FilePath(string_path_and_name); - if (!path_and_name->IsAbsolute()) - return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); - - result = key.ReadValue(kArguments, args); - if (result != ERROR_FILE_NOT_FOUND) - return HRESULT_FROM_WIN32(result); - - return S_OK; -} - -HRESULT StartProcess(const base::FilePath& path_and_name, - const base::string16& args, - PROCESS_INFORMATION* pi) { - DCHECK(pi); - - STARTUPINFO si = {sizeof(si)}; - si.dwFlags = STARTF_FORCEOFFFEEDBACK; - - // We have had problems in the past with subprocs preventing chrome from being - // uninstalled because their cwd was within Google\Chrome\Application\. Hence, - // making the starting directory the Temp directory. This should be - // \\Windows\\Temp for the Service. - const base::char16* starting_directory = nullptr; - base::FilePath temp_dir; - if (base::GetTempDir(&temp_dir)) - starting_directory = temp_dir.value().c_str(); - - base::string16 command_line = L"\"" + path_and_name.value() + L"\" " + args; - command_line.push_back(L'\0'); - bool success = - ::CreateProcess(path_and_name.value().c_str(), // Application path/name - &command_line[0], // Command line - nullptr, // Process handle not inheritable - nullptr, // Thread handle not inheritable - false, // Set handle inheritance to FALSE - 0, // No creation flags - nullptr, // Use parent's environment block - starting_directory, // Use TMP - &si, // Pointer to STARTUPINFO struct - pi); // Pointer to PROCESS_INFORMATION structure - - if (!success) { - HRESULT hr = HRESULTFromLastError(); - LOG(ERROR) << "StartProcess::CreateProcess failed; hr: " << hr - << ", command_line: " << path_and_name << ", args:" << args; - return hr; - } - - return S_OK; -} - -HRESULT OpenCallingProcess(DWORD proc_id, base::Process* process) { - DCHECK(process); - - HRESULT hr = ::CoImpersonateClient(); - if (FAILED(hr)) - return hr; - - *process = base::Process::OpenWithAccess(proc_id, PROCESS_DUP_HANDLE); - hr = process->IsValid() ? S_OK : HRESULTFromLastError(); - - ::CoRevertToSelf(); - return hr; -} - -HRESULT LaunchCmd(const base::FilePath& path_and_name, - const base::string16& args, - const base::Process& calling_process, - base::win::ScopedHandle* proc_handle) { - DCHECK(!path_and_name.empty()); - DCHECK(proc_handle); - - PROCESS_INFORMATION process_info = {}; - HRESULT hr = StartProcess(path_and_name, args, &process_info); - if (FAILED(hr)) { - LOG(ERROR) << "failed to launch app: " << path_and_name << ", args:" << args - << "; hr: " << hr; - return hr; - } - base::win::ScopedProcessInformation pi(process_info); - - // DuplicateHandle call will close the source handle regardless of any error - // status returned. - DCHECK(pi.process_handle()); - - HANDLE duplicate_proc_handle = nullptr; - - constexpr DWORD desired_access = - PROCESS_QUERY_LIMITED_INFORMATION | SYNCHRONIZE; - bool res = ::DuplicateHandle( - ::GetCurrentProcess(), // Current process. - pi.TakeProcessHandle(), // Process handle to duplicate. - calling_process.Handle(), // Process receiving the handle. - &duplicate_proc_handle, // Duplicated handle. - desired_access, // Access requested for the new handle. - FALSE, // Don't inherit the new handle. - DUPLICATE_CLOSE_SOURCE) != 0; // Closes the source handle. - if (!res) { - hr = HRESULTFromLastError(); - LOG(ERROR) << "failed to duplicate the handle; hr: " << hr; - return hr; - } - - proc_handle->Set(duplicate_proc_handle); - - return S_OK; -} - -} // namespace - -IFACEMETHODIMP Elevator::LaunchCommand(const WCHAR* cmd_id, - DWORD caller_proc_id, - ULONG_PTR* proc_handle) { - DCHECK(cmd_id); - DCHECK(proc_handle); - - const base::StringPiece16 id = cmd_id; - if (id.empty() || id.find(L'\\') != base::StringPiece16::npos || !proc_handle) - return E_INVALIDARG; - - base::Process calling_process; - HRESULT hr = OpenCallingProcess(caller_proc_id, &calling_process); - if (FAILED(hr)) { - LOG(ERROR) << "failed to open caller's handle; hr: " << hr - << ", cmd_id: " << cmd_id << ", pid: " << caller_proc_id; - return hr; - } - - base::FilePath path_and_name; - base::string16 args; - hr = GetCommandToLaunch(id, &path_and_name, &args); - if (FAILED(hr)) - return hr; - - base::win::ScopedHandle scoped_proc_handle; - hr = LaunchCmd(path_and_name, args, calling_process, &scoped_proc_handle); - if (FAILED(hr)) - return hr; - - *proc_handle = reinterpret_cast<ULONG_PTR>(scoped_proc_handle.Take()); - return hr; + return *factory ? S_OK : E_INVALIDARG; } Elevator::~Elevator() = default;
diff --git a/chrome/elevation_service/elevator.h b/chrome/elevation_service/elevator.h index 75eca65..2e0faf4 100644 --- a/chrome/elevation_service/elevator.h +++ b/chrome/elevation_service/elevator.h
@@ -11,6 +11,7 @@ #include <wrl/module.h> #include "base/macros.h" +#include "base/strings/string16.h" #include "chrome/elevation_service/elevation_service_idl.h" namespace elevation_service { @@ -18,12 +19,12 @@ class Elevator : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, - IRegisteredCommandElevator> { + IElevator> { public: Elevator() = default; - IFACEMETHOD(LaunchCommand) - (const WCHAR* cmd_id, DWORD caller_proc_id, ULONG_PTR* proc_handle); + IFACEMETHOD(GetElevatorFactory)(const base::char16* elevator_id, + IClassFactory** factory); private: ~Elevator() override;
diff --git a/chrome/elevation_service/service_main.cc b/chrome/elevation_service/service_main.cc index 13165af8..594da9c5 100644 --- a/chrome/elevation_service/service_main.cc +++ b/chrome/elevation_service/service_main.cc
@@ -63,6 +63,9 @@ auto& module = Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::Create( this, &ServiceMain::SignalExit); + // Register the Elevator class factories. + RegisterElevatorFactories(); + // We hand-register a unique CLSID for each Chrome channel. Microsoft::WRL::ComPtr<IUnknown> factory; unsigned int flags = Microsoft::WRL::ModuleType::OutOfProc; @@ -109,6 +112,9 @@ module.UnregisterCOMObject(nullptr, cookies_, base::size(cookies_)); if (FAILED(hr)) LOG(ERROR) << "NotificationActivator unregistration failed; hr: " << hr; + + // Unregister the Elevator class factories. + UnregisterElevatorFactories(); } bool ServiceMain::IsExitSignaled() { @@ -245,4 +251,27 @@ exit_signal_.Signal(); } +void ServiceMain::RegisterElevatorFactories() { + // Elevators will register their class factories here by calling + // RegisterElevatorFactory(). +} + +void ServiceMain::UnregisterElevatorFactories() { + factories_.clear(); +} + +void ServiceMain::RegisterElevatorFactory(const base::string16& id, + IClassFactory* factory) { + DCHECK(factory); + DCHECK(!base::ContainsKey(factories_, id)); + + factories_.emplace(id, factory); +} + +Microsoft::WRL::ComPtr<IClassFactory> ServiceMain::GetElevatorFactory( + const base::string16& id) { + auto it = factories_.find(id); + return it != factories_.end() ? it->second : nullptr; +} + } // namespace elevation_service
diff --git a/chrome/elevation_service/service_main.h b/chrome/elevation_service/service_main.h index 60084d7..3c26209 100644 --- a/chrome/elevation_service/service_main.h +++ b/chrome/elevation_service/service_main.h
@@ -6,7 +6,9 @@ #define CHROME_ELEVATION_SERVICE_SERVICE_MAIN_H_ #include <windows.h> +#include <wrl/implements.h> +#include "base/containers/flat_map.h" #include "base/no_destructor.h" #include "base/synchronization/waitable_event.h" @@ -41,6 +43,10 @@ // to exit. bool IsExitSignaled(); + // Returns the class factory for the elevator with the specified id. + Microsoft::WRL::ComPtr<IClassFactory> GetElevatorFactory( + const base::string16& id); + private: ServiceMain(); ~ServiceMain(); @@ -80,6 +86,14 @@ // Called when the last object is released or if the service is asked to exit. void SignalExit(); + // Registers class factories for all supported elevators. + void RegisterElevatorFactories(); + void UnregisterElevatorFactories(); + + // Registers |factory| as the factory for the elevator identified by |id|. + void RegisterElevatorFactory(const base::string16& id, + IClassFactory* factory); + // The action routine to be executed. int (ServiceMain::*run_routine_)(); @@ -93,6 +107,11 @@ // service control manager asks the service to exit. base::WaitableEvent exit_signal_; + using FactoryMap = base::flat_map<base::string16, + Microsoft::WRL::ComPtr<IClassFactory>>; + // The map containing all the Elevator class factories. + FactoryMap factories_; + friend class base::NoDestructor<ServiceMain>; DISALLOW_COPY_AND_ASSIGN(ServiceMain);
diff --git a/chromeos/components/tether/connect_tethering_operation.cc b/chromeos/components/tether/connect_tethering_operation.cc index f5e9af5..585dc16 100644 --- a/chromeos/components/tether/connect_tethering_operation.cc +++ b/chromeos/components/tether/connect_tethering_operation.cc
@@ -213,7 +213,7 @@ observer.OnConnectTetheringFailure(remote_device_, error_code); } -uint32_t ConnectTetheringOperation::GetTimeoutSeconds() { +uint32_t ConnectTetheringOperation::GetMessageTimeoutSeconds() { return setup_required_ ? ConnectTetheringOperation::kSetupRequiredResponseTimeoutSeconds : ConnectTetheringOperation::
diff --git a/chromeos/components/tether/connect_tethering_operation.h b/chromeos/components/tether/connect_tethering_operation.h index 2258aa8c..95ccb1e 100644 --- a/chromeos/components/tether/connect_tethering_operation.h +++ b/chromeos/components/tether/connect_tethering_operation.h
@@ -109,7 +109,7 @@ void OnOperationFinished() override; MessageType GetMessageTypeForConnection() override; void OnMessageSent(int sequence_number) override; - uint32_t GetTimeoutSeconds() override; + uint32_t GetMessageTimeoutSeconds() override; void NotifyConnectTetheringRequestSent(); void NotifyObserversOfSuccessfulResponse(const std::string& ssid,
diff --git a/chromeos/components/tether/connect_tethering_operation_unittest.cc b/chromeos/components/tether/connect_tethering_operation_unittest.cc index 2479583..317b353 100644 --- a/chromeos/components/tether/connect_tethering_operation_unittest.cc +++ b/chromeos/components/tether/connect_tethering_operation_unittest.cc
@@ -213,7 +213,7 @@ kSetupNotRequiredResponseTimeoutSeconds; EXPECT_EQ(expected_response_timeout_seconds, - operation_->GetTimeoutSeconds()); + operation_->GetMessageTimeoutSeconds()); } const std::string connect_tethering_request_string_;
diff --git a/chromeos/components/tether/message_transfer_operation.cc b/chromeos/components/tether/message_transfer_operation.cc index b3d4689..445739f 100644 --- a/chromeos/components/tether/message_transfer_operation.cc +++ b/chromeos/components/tether/message_transfer_operation.cc
@@ -145,6 +145,7 @@ for (const auto& remote_device : remote_devices_) { if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) { + StartConnectionTimerForDevice(remote_device); remote_device_to_connection_attempt_delegate_map_[remote_device] = std::make_unique<ConnectionAttemptDelegate>( this, remote_device, @@ -159,7 +160,7 @@ if (connection_manager_->GetStatusForDevice(remote_device.GetDeviceId(), &status) && status == cryptauth::SecureChannel::Status::AUTHENTICATED) { - StartTimerForDevice(remote_device); + StartMessageTimerForDevice(remote_device); OnDeviceAuthenticated(remote_device); } } @@ -184,7 +185,7 @@ switch (new_status) { case cryptauth::SecureChannel::Status::AUTHENTICATED: - StartTimerForDevice(*remote_device); + StartMessageTimerForDevice(*remote_device); OnDeviceAuthenticated(*remote_device); break; case cryptauth::SecureChannel::Status::DISCONNECTED: @@ -273,8 +274,8 @@ } } -uint32_t MessageTransferOperation::GetTimeoutSeconds() { - return MessageTransferOperation::kDefaultTimeoutSeconds; +uint32_t MessageTransferOperation::GetMessageTimeoutSeconds() { + return MessageTransferOperation::kDefaultMessageTimeoutSeconds; } void MessageTransferOperation::OnConnectionAttemptFailure( @@ -294,7 +295,14 @@ remote_device_to_client_channel_observer_map_[remote_device] = std::make_unique<ClientChannelObserver>(this, remote_device, std::move(channel)); - StartTimerForDevice(remote_device); + + // Stop the timer which was started from StartConnectionTimerForDevice() since + // the connection has now been established. Start another timer now via + // StartMessageTimerForDevice() while waiting for messages to be sent to and + // received by |remote_device|. + StopTimerForDeviceIfRunning(remote_device); + StartMessageTimerForDevice(remote_device); + OnDeviceAuthenticated(remote_device); } @@ -376,8 +384,19 @@ } } -void MessageTransferOperation::StartTimerForDevice( +void MessageTransferOperation::StartConnectionTimerForDevice( cryptauth::RemoteDeviceRef remote_device) { + StartTimerForDevice(remote_device, kConnectionTimeoutSeconds); +} + +void MessageTransferOperation::StartMessageTimerForDevice( + cryptauth::RemoteDeviceRef remote_device) { + StartTimerForDevice(remote_device, GetMessageTimeoutSeconds()); +} + +void MessageTransferOperation::StartTimerForDevice( + cryptauth::RemoteDeviceRef remote_device, + uint32_t timeout_seconds) { PA_LOG(INFO) << "Starting timer for operation with message type " << message_type_for_connection_ << " from device with ID " << remote_device.GetTruncatedDeviceIdForLogs() << "."; @@ -385,7 +404,7 @@ remote_device_to_timer_map_.emplace(remote_device, timer_factory_->CreateOneShotTimer()); remote_device_to_timer_map_[remote_device]->Start( - FROM_HERE, base::TimeDelta::FromSeconds(GetTimeoutSeconds()), + FROM_HERE, base::TimeDelta::FromSeconds(timeout_seconds), base::Bind(&MessageTransferOperation::OnTimeout, weak_ptr_factory_.GetWeakPtr(), remote_device)); }
diff --git a/chromeos/components/tether/message_transfer_operation.h b/chromeos/components/tether/message_transfer_operation.h index 6b012b52..5966079 100644 --- a/chromeos/components/tether/message_transfer_operation.h +++ b/chromeos/components/tether/message_transfer_operation.h
@@ -101,11 +101,11 @@ // Returns the type of message that this operation intends to send. virtual MessageType GetMessageTypeForConnection() = 0; - // The number of seconds that this operation should wait before unregistering - // a device after it has been authenticated if it has not been explicitly - // unregistered. If ShouldOperationUseTimeout() returns false, this method is - // never used. - virtual uint32_t GetTimeoutSeconds(); + // The number of seconds that this operation should wait to let messages be + // sent and received before unregistering a device after it has been + // authenticated if it has not been explicitly unregistered. If + // ShouldOperationUseTimeout() returns false, this method is never used. + virtual uint32_t GetMessageTimeoutSeconds(); cryptauth::RemoteDeviceRefList& remote_devices() { return remote_devices_; } @@ -156,11 +156,16 @@ std::unique_ptr<secure_channel::ClientChannel> client_channel_; }; - // The default number of seconds an operation should wait before a timeout - // occurs. Once this amount of time passes, the connection will be closed. - // Classes deriving from MessageTransferOperation should override - // GetTimeoutSeconds() if they desire a different duration. - static constexpr const uint32_t kDefaultTimeoutSeconds = 10; + // The maximum expected time to connect to a remote device, if it can be + // connected to. This number has been determined by examining metrics. + static constexpr const uint32_t kConnectionTimeoutSeconds = 15; + + // The default number of seconds an operation should wait to send and receive + // messages before a timeout occurs. Once this amount of time passes, the + // connection will be closed. Classes deriving from MessageTransferOperation + // should override GetMessageTimeoutSeconds() if they desire a different + // duration. + static constexpr const uint32_t kDefaultMessageTimeoutSeconds = 10; struct ConnectAttemptCounts { uint32_t empty_scan_attempts = 0; @@ -179,7 +184,17 @@ void HandleDeviceDisconnection( cryptauth::RemoteDeviceRef remote_device, BleConnectionManager::StateChangeDetail status_change_detail); - void StartTimerForDevice(cryptauth::RemoteDeviceRef remote_device); + + // Start the timer while waiting for a connection to |remote_device|. See + // |kConnectionTimeoutSeconds|. + void StartConnectionTimerForDevice(cryptauth::RemoteDeviceRef remote_device); + + // Start the timer while waiting for messages to be sent to and received by + // |remote_device|. See |kDefaultMessageTimeoutSeconds|. + void StartMessageTimerForDevice(cryptauth::RemoteDeviceRef remote_device); + + void StartTimerForDevice(cryptauth::RemoteDeviceRef remote_device, + uint32_t timeout_seconds); void StopTimerForDeviceIfRunning(cryptauth::RemoteDeviceRef remote_device); void OnTimeout(cryptauth::RemoteDeviceRef remote_device); base::Optional<cryptauth::RemoteDeviceRef> GetRemoteDevice(
diff --git a/chromeos/components/tether/message_transfer_operation_unittest.cc b/chromeos/components/tether/message_transfer_operation_unittest.cc index 3cc94f7..dd05ab66 100644 --- a/chromeos/components/tether/message_transfer_operation_unittest.cc +++ b/chromeos/components/tether/message_transfer_operation_unittest.cc
@@ -96,7 +96,7 @@ last_sequence_number_ = sequence_number; } - uint32_t GetTimeoutSeconds() override { return timeout_seconds_; } + uint32_t GetMessageTimeoutSeconds() override { return timeout_seconds_; } void set_timeout_seconds(uint32_t timeout_seconds) { timeout_seconds_ = timeout_seconds; @@ -148,6 +148,10 @@ return device_id_to_timer_map_[device_id_for_next_timer_]; } + void ClearTimerForDeviceId(const std::string& device_id) { + device_id_to_timer_map_.erase(device_id_for_next_timer_); + } + void set_device_id_for_next_timer( const std::string& device_id_for_next_timer) { device_id_for_next_timer_ = device_id_for_next_timer; @@ -200,8 +204,15 @@ } void ConstructOperation(cryptauth::RemoteDeviceRefList remote_devices) { + test_timer_factory_ = new TestTimerFactory(); + if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) { for (auto remote_device : remote_devices) { + // Prepare for connection timeout timers to be made for each remote + // device. + test_timer_factory_->set_device_id_for_next_timer( + remote_device.GetDeviceId()); + auto fake_connection_attempt = std::make_unique<secure_channel::FakeConnectionAttempt>(); remote_device_to_fake_connection_attempt_map_[remote_device] = @@ -212,7 +223,6 @@ } } - test_timer_factory_ = new TestTimerFactory(); operation_ = base::WrapUnique(new TestOperation( remote_devices, fake_device_sync_client_.get(), fake_secure_channel_client_.get(), fake_ble_connection_manager_.get())); @@ -236,6 +246,11 @@ VerifyOperationStartedAndFinished(true /* has_started */, false /* has_finished */); + + if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) { + for (const auto& remote_device : operation_->remote_devices()) + VerifyConnectionTimerCreatedForDevice(remote_device); + } } void VerifyOperationStartedAndFinished(bool has_started, bool has_finished) { @@ -286,6 +301,12 @@ VerifyTimerCreatedForDevice(remote_device, kTestTimeoutSeconds); } + void VerifyConnectionTimerCreatedForDevice( + cryptauth::RemoteDeviceRef remote_device) { + VerifyTimerCreatedForDevice( + remote_device, MessageTransferOperation::kConnectionTimeoutSeconds); + } + void VerifyTimerCreatedForDevice(cryptauth::RemoteDeviceRef remote_device, uint32_t timeout_seconds) { EXPECT_TRUE(GetTimerForDevice(remote_device)); @@ -383,7 +404,18 @@ } TEST_F(MessageTransferOperationTest, - MultiDeviceApiEnabled_TestAuthenticatesButTimesOut) { + MultiDeviceApiEnabled_TestTimesOutBeforeAuthentication) { + SetMultiDeviceApiEnabled(); + + ConstructOperation(cryptauth::RemoteDeviceRefList{test_devices_[0]}); + InitializeOperation(); + + GetTimerForDevice(test_devices_[0])->Fire(); + EXPECT_TRUE(operation_->has_operation_finished()); +} + +TEST_F(MessageTransferOperationTest, + MultiDeviceApiEnabled_TestAuthenticatesButThenTimesOut) { SetMultiDeviceApiEnabled(); ConstructOperation(cryptauth::RemoteDeviceRefList{test_devices_[0]}); @@ -432,6 +464,9 @@ ConstructOperation(test_devices_); InitializeOperation(); + for (const auto& remote_device : test_devices_) + test_timer_factory_->ClearTimerForDeviceId(remote_device.GetDeviceId()); + // Authenticate |test_devices_[0]|'s channel. CreateAuthenticatedChannelForDevice(test_devices_[0]); EXPECT_TRUE(operation_->HasDeviceAuthenticated(test_devices_[0]));
diff --git a/chromeos/printing/ppd_line_reader.cc b/chromeos/printing/ppd_line_reader.cc index a086425..445687e6 100644 --- a/chromeos/printing/ppd_line_reader.cc +++ b/chromeos/printing/ppd_line_reader.cc
@@ -9,6 +9,7 @@ #include <utility> #include "base/strings/string_util.h" +#include "net/base/completion_once_callback.h" #include "net/base/io_buffer.h" #include "net/filter/gzip_header.h" #include "net/filter/gzip_source_stream.h" @@ -44,7 +45,7 @@ // This source always reads sychronously, so never uses the callback. int Read(net::IOBuffer* dest_buffer, int buffer_size, - const net::CompletionCallback&) override { + net::CompletionOnceCallback) override { int read_size = src_.size() - read_ofs_; if (read_size > buffer_size) { read_size = buffer_size;
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.cc b/chromeos/services/assistant/assistant_manager_service_impl.cc index d031cc8..62bb327 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl.cc
@@ -25,6 +25,7 @@ #include "chromeos/system/version_loader.h" #include "libassistant/shared/internal_api/assistant_manager_delegate.h" #include "libassistant/shared/internal_api/assistant_manager_internal.h" +#include "libassistant/shared/internal_api/media_manager.h" #include "services/service_manager/public/cpp/connector.h" #include "url/gurl.h" @@ -96,6 +97,18 @@ /* user_id: */ "0", access_token)}); } +void AssistantManagerServiceImpl::RegisterFallbackMediaHandler() { + // Register handler for media actions. + auto* media_manager = assistant_manager_internal_->GetMediaManager(); + media_manager->RegisterFallbackMediaHandler( + [this](std::string play_media_args_proto) { + std::string url = GetWebUrlFromMediaArgs(play_media_args_proto); + if (!url.empty()) { + OnOpenUrl(url); + } + }); +} + void AssistantManagerServiceImpl::EnableListening(bool enable) { assistant_manager_->EnableListening(enable); } @@ -368,6 +381,7 @@ assistant_manager_internal_->RegisterActionModule(action_module_.get()); assistant_manager_internal_->SetAssistantManagerDelegate(this); assistant_manager_->AddConversationStateListener(this); + assistant_manager_->AddDeviceStateListener(this); SetAccessToken(access_token); @@ -468,6 +482,10 @@ callback.Run(result); } +void AssistantManagerServiceImpl::OnStartFinished() { + RegisterFallbackMediaHandler(); +} + void AssistantManagerServiceImpl::OnConversationTurnStartedOnMainThread() { subscribers_.ForAllPtrs([](auto* ptr) { ptr->OnInteractionStarted(); }); }
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.h b/chromeos/services/assistant/assistant_manager_service_impl.h index 27ef556..fe1b08d 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.h +++ b/chromeos/services/assistant/assistant_manager_service_impl.h
@@ -24,6 +24,7 @@ #include "libassistant/contrib/core/macros.h" #include "libassistant/shared/internal_api/assistant_manager_delegate.h" #include "libassistant/shared/public/conversation_state_listener.h" +#include "libassistant/shared/public/device_state_listener.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/interface_ptr_set.h" #include "services/device/public/mojom/battery_monitor.mojom.h" @@ -53,7 +54,8 @@ public AssistantEventObserver, public assistant_client::ConversationStateListener, public assistant_client::AssistantManagerDelegate, - public ash::mojom::VoiceInteractionObserver { + public ash::mojom::VoiceInteractionObserver, + public assistant_client::DeviceStateListener { public: AssistantManagerServiceImpl(service_manager::Connector* connector, device::mojom::BatteryMonitorPtr battery_monitor, @@ -122,6 +124,9 @@ void OnAssistantFeatureAllowedChanged( ash::mojom::AssistantAllowedState state) override {} + // AddDeviceStateListener overrides + void OnStartFinished() override; + private: void StartAssistantInternal(const std::string& access_token, const std::string& arc_version); @@ -161,6 +166,7 @@ void IsVoiceInteractionSetupCompleted( ash::mojom::VoiceInteractionController::IsSetupCompletedCallback callback); + void RegisterFallbackMediaHandler(); void SendContextQueryAndRunCallback(RequestScreenContextCallback callback); @@ -174,14 +180,13 @@ State state_ = State::STOPPED; PlatformApiImpl platform_api_; std::unique_ptr<action::CrosActionModule> action_module_; + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; std::unique_ptr<assistant_client::AssistantManager> assistant_manager_; std::unique_ptr<AssistantSettingsManagerImpl> assistant_settings_manager_; mojom::DeviceActionsPtr device_actions_; assistant_client::AssistantManagerInternal* assistant_manager_internal_; std::unique_ptr<CrosDisplayConnection> display_connection_; mojo::InterfacePtrSet<mojom::AssistantEventSubscriber> subscribers_; - scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; - ash::mojom::VoiceInteractionControllerPtr voice_interaction_controller_; mojo::Binding<ash::mojom::VoiceInteractionObserver> voice_interaction_observer_binding_;
diff --git a/components/arc/arc_prefs.cc b/components/arc/arc_prefs.cc index 6ff3744..83940cc 100644 --- a/components/arc/arc_prefs.cc +++ b/components/arc/arc_prefs.cc
@@ -70,6 +70,9 @@ "arc.set_notifications_enabled_deferred"; // A preference that indicates status of Android sign-in. const char kArcSignedIn[] = "arc.signedin"; +// A preference that indicates that ARC skipped the setup UI flows that +// contain a notice related to reporting of diagnostic information. +const char kArcSkippedReportingNotice[] = "arc.skipped.reporting.notice"; // A preference that indicates an ARC comaptible filesystem was chosen for // the user directory (i.e., the user finished required migration.) const char kArcCompatibleFilesystemChosen[] = @@ -125,6 +128,7 @@ registry->RegisterListPref(kArcFastAppReinstallPackages); registry->RegisterBooleanPref(kArcPolicyComplianceReported, false); registry->RegisterBooleanPref(kArcSignedIn, false); + registry->RegisterBooleanPref(kArcSkippedReportingNotice, false); registry->RegisterBooleanPref(kArcTermsAccepted, false); registry->RegisterBooleanPref(kArcTermsShownInOobe, false); registry->RegisterBooleanPref(kArcVoiceInteractionValuePropAccepted, false);
diff --git a/components/arc/arc_prefs.h b/components/arc/arc_prefs.h index 90f2e6e..7cf72c63 100644 --- a/components/arc/arc_prefs.h +++ b/components/arc/arc_prefs.h
@@ -31,6 +31,7 @@ ARC_EXPORT extern const char kArcPushInstallAppsPending[]; ARC_EXPORT extern const char kArcSetNotificationsEnabledDeferred[]; ARC_EXPORT extern const char kArcSignedIn[]; +ARC_EXPORT extern const char kArcSkippedReportingNotice[]; ARC_EXPORT extern const char kArcSupervisionTransition[]; ARC_EXPORT extern const char kArcCompatibleFilesystemChosen[]; ARC_EXPORT extern const char kArcVoiceInteractionValuePropAccepted[];
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 4022543b..20e5e15 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -1259,6 +1259,25 @@ return pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled); } +bool PersonalDataManager::ShouldSuggestServerCards() const { + if (!IsAutofillWalletImportEnabled()) + return false; + + if (is_syncing_for_test_) + return true; + + // Check if the feature to offer server cards on auth error is enabled. + if (base::FeatureList::IsEnabled( + features::kAutofillEnablePaymentsInteractionsOnAuthError)) { + return true; + } + + // Server cards should be suggested if the sync service active. + return syncer::GetUploadToGoogleState( + sync_service_, syncer::ModelType::AUTOFILL_WALLET_DATA) == + syncer::UploadState::ACTIVE; +} + std::string PersonalDataManager::CountryCodeForCurrentTimezone() const { return base::CountryCodeForCurrentTimezone(); } @@ -2283,25 +2302,6 @@ return true; } -bool PersonalDataManager::ShouldSuggestServerCards() const { - if (!IsAutofillWalletImportEnabled()) - return false; - - if (is_syncing_for_test_) - return true; - - // Check if the feature to offer server cards on auth error is enabled. - if (base::FeatureList::IsEnabled( - features::kAutofillEnablePaymentsInteractionsOnAuthError)) { - return true; - } - - // Server cards should be suggested if the sync service active. - return syncer::GetUploadToGoogleState( - sync_service_, syncer::ModelType::AUTOFILL_WALLET_DATA) == - syncer::UploadState::ACTIVE; -} - void PersonalDataManager::ApplyAddressFixesAndCleanups() { RemoveOrphanAutofillTableRows(); // One-time fix, otherwise NOP. ApplyDedupingRoutine(); // Once per major version, otherwise NOP.
diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index 5194ebd2..4b6fe280 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h
@@ -451,6 +451,9 @@ // Returns the value of the AutofillWalletImportEnabled pref. virtual bool IsAutofillWalletImportEnabled() const; + // Whether the server cards are enabled and should be suggested to the user. + virtual bool ShouldSuggestServerCards() const; + // Overrideable for testing. virtual std::string CountryCodeForCurrentTimezone() const; @@ -608,9 +611,6 @@ // manually using the UI. void MaybeCreateTestCreditCards(); - // Whether the server cards are enabled and should be suggested to the user. - bool ShouldSuggestServerCards() const; - // Applies various fixes and cleanups on autofill addresses. void ApplyAddressFixesAndCleanups();
diff --git a/components/autofill/core/browser/test_personal_data_manager.cc b/components/autofill/core/browser/test_personal_data_manager.cc index 59f9398..a41f2ea 100644 --- a/components/autofill/core/browser/test_personal_data_manager.cc +++ b/components/autofill/core/browser/test_personal_data_manager.cc
@@ -191,6 +191,10 @@ return PersonalDataManager::IsAutofillWalletImportEnabled(); } +bool TestPersonalDataManager::ShouldSuggestServerCards() const { + return IsAutofillCreditCardEnabled() && IsAutofillWalletImportEnabled(); +} + std::string TestPersonalDataManager::CountryCodeForCurrentTimezone() const { return timezone_country_code_;
diff --git a/components/autofill/core/browser/test_personal_data_manager.h b/components/autofill/core/browser/test_personal_data_manager.h index 411c07a..da51e52 100644 --- a/components/autofill/core/browser/test_personal_data_manager.h +++ b/components/autofill/core/browser/test_personal_data_manager.h
@@ -46,6 +46,7 @@ bool IsAutofillEnabled() const override; bool IsAutofillCreditCardEnabled() const override; bool IsAutofillWalletImportEnabled() const override; + bool ShouldSuggestServerCards() const override; std::string CountryCodeForCurrentTimezone() const override; bool IsDataLoaded() const override;
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index d3264e4..fa033fd7 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -146,23 +146,8 @@ _cronet_version_header_include_dir = "$target_gen_dir/cronet_version_header" -proto_library("cronet_android_cert_proto") { - visibility = [ "//components/cronet/android/*" ] - - sources = [ - "//components/cronet/android/cert/proto/cert_verification.proto", - ] - - deps = [ - "//third_party/protobuf:protobuf_lite", - ] - - extra_configs = [ "//build/config/compiler:wexit_time_destructors" ] -} - source_set("cronet_static") { deps = [ - ":cronet_android_cert_proto", ":cronet_jni_headers", ":cronet_jni_registration", "//base", @@ -178,8 +163,6 @@ "//url:url_features", ] sources = [ - "//components/cronet/android/cert/cert_verifier_cache_serializer.cc", - "//components/cronet/android/cert/cert_verifier_cache_serializer.h", "//components/cronet/android/cronet_bidirectional_stream_adapter.cc", "//components/cronet/android/cronet_bidirectional_stream_adapter.h", "//components/cronet/android/cronet_library_loader.cc", @@ -879,12 +862,7 @@ } test("cronet_unittests_android") { - sources = [ - "//components/cronet/android/cert/cert_verifier_cache_serializer_unittest.cc", - ] - deps = [ - ":cronet_android_cert_proto", ":cronet_impl_native_base_java", ":cronet_static", "//base",
diff --git a/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java b/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java index 8c0a3b1..c8b91961 100644 --- a/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java +++ b/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java
@@ -127,18 +127,6 @@ } /** - * Initializes CachingCertVerifier's cache with certVerifierData which has - * the results of certificate verification. - * @param certVerifierData a serialized representation of certificate - * verification results. - * @return the builder to facilitate chaining. - */ - public Builder setCertVerifierData(String certVerifierData) { - mBuilderDelegate.setCertVerifierData(certVerifierData); - return this; - } - - /** * Sets experimental options to be used in Cronet. * * @param options JSON formatted experimental options. @@ -386,21 +374,6 @@ public void removeRequestFinishedListener(RequestFinishedInfo.Listener listener) {} /** - * Returns serialized representation of certificate verifier's cache - * which contains the list of hosts/certificates and the certificate - * verification results. May block until data is received from the network - * thread (will timeout after the specified timeout). In case of timeout, it - * returns the previous saved value. - * - * @param timeout in milliseconds. If timeout is 0, it will use default value. - * @return serialized representation of certificate verification results - * data. - */ - public String getCertVerifierData(long timeout) { - return ""; - } - - /** * Returns the HTTP RTT estimate (in milliseconds) computed by the network * quality estimator. Set to {@link #CONNECTION_METRIC_UNKNOWN} if the value * is unavailable. This must be called after
diff --git a/components/cronet/android/cert/cert_verifier_cache_serializer.cc b/components/cronet/android/cert/cert_verifier_cache_serializer.cc deleted file mode 100644 index 4b0d2480..0000000 --- a/components/cronet/android/cert/cert_verifier_cache_serializer.cc +++ /dev/null
@@ -1,356 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/cronet/android/cert/cert_verifier_cache_serializer.h" - -#include <string> -#include <vector> - -#include "base/logging.h" -#include "base/strings/string_piece.h" -#include "base/time/time.h" -#include "components/cronet/android/cert/proto/cert_verification.pb.h" -#include "net/base/hash_value.h" -#include "net/cert/caching_cert_verifier.h" -#include "net/cert/cert_verify_result.h" -#include "net/cert/x509_certificate.h" -#include "net/cert/x509_util.h" - -namespace cronet { - -namespace { - -// Map from each unique certificate to certificate number. -typedef std::map<std::string, size_t> SerializedCertMap; -// Map from certificate number to each unique certificate. -typedef std::map<size_t, std::string> DeserializedCertMap; - -// Determine if |cert_handle| was already serialized. If so, simply return a -// reference to that entry. Otherwise, add a new entry to the set of certs to -// be serialized (|serialized_certs|). -size_t SerializeCertHandle(const CRYPTO_BUFFER* cert_handle, - SerializedCertMap* serialized_certs) { - auto result = serialized_certs->insert( - {std::string(net::x509_util::CryptoBufferAsStringPiece(cert_handle)), - serialized_certs->size() + 1}); - return result.first->second; -} - -// Update |certificate| with certificate number and updates |serialized_certs| -// with DER-encoded representation of certificate if the certicate is not in -// |serialized_certs|. Returns true if data is serialized correctly. -void SerializeCertificate(net::X509Certificate* cert, - SerializedCertMap* serialized_certs, - cronet_pb::CertVerificationCertificate* certificate) { - certificate->add_cert_numbers( - SerializeCertHandle(cert->cert_buffer(), serialized_certs)); - for (const auto& intermediate : cert->intermediate_buffers()) { - certificate->add_cert_numbers( - SerializeCertHandle(intermediate.get(), serialized_certs)); - } -} - -// Deserializes |certificate| using the certificate database provided in -// |deserialized_certs|. Returns the parsed certificate on success, or nullptr -// if deserialization failed. -scoped_refptr<net::X509Certificate> DeserializeCertificate( - const cronet_pb::CertVerificationCertificate& certificate, - const DeserializedCertMap& deserialized_certs) { - if (0 == certificate.cert_numbers_size()) - return nullptr; - std::vector<base::StringPiece> der_cert_pieces( - certificate.cert_numbers_size()); - for (int i = 0; i < certificate.cert_numbers_size(); ++i) { - size_t cert_number = certificate.cert_numbers(i); - DeserializedCertMap::const_iterator it = - deserialized_certs.find(cert_number); - if (it == deserialized_certs.end()) - return nullptr; - der_cert_pieces[i] = base::StringPiece(it->second); - } - return net::X509Certificate::CreateFromDERCertChain(der_cert_pieces); -} - -// Serializes |params| into |request_params|, updating |serialized_certs| with -// the set of raw certificates that will be needed to deserialize the -// certificate in |request_params| via DeserializeCertificate(). -void SerializeRequestParams( - const net::CertVerifier::RequestParams& params, - SerializedCertMap* serialized_certs, - cronet_pb::CertVerificationRequestParams* request_params) { - cronet_pb::CertVerificationCertificate* certificate = - request_params->mutable_certificate(); - SerializeCertificate(params.certificate().get(), serialized_certs, - certificate); - request_params->set_hostname(params.hostname()); - request_params->set_flags(params.flags()); - request_params->set_ocsp_response(params.ocsp_response()); - for (const auto& cert : params.additional_trust_anchors()) { - certificate = request_params->add_additional_trust_anchors(); - SerializeCertificate(cert.get(), serialized_certs, certificate); - } -} - -// Serializes |result| into |cached_result|, updating |serialized_certs| with -// the set of raw certificates that will be needed to deserialize the -// certificate in |cached_result| via DeserializeCertificate(). -void SerializeCachedResult( - const net::CertVerifyResult& result, - SerializedCertMap* serialized_certs, - cronet_pb::CertVerificationCachedResult* cached_result) { - cronet_pb::CertVerificationResult* cert_verification_result = - cached_result->mutable_result(); - cronet_pb::CertVerificationCertificate* certificate = - cert_verification_result->mutable_verified_cert(); - SerializeCertificate(result.verified_cert.get(), serialized_certs, - certificate); - cert_verification_result->set_cert_status(result.cert_status); - cert_verification_result->set_has_md2(result.has_md2); - cert_verification_result->set_has_md4(result.has_md4); - cert_verification_result->set_has_md5(result.has_md5); - cert_verification_result->set_has_sha1(result.has_sha1); - cert_verification_result->set_has_sha1_leaf(result.has_sha1_leaf); - for (const auto& value : result.public_key_hashes) - cert_verification_result->add_public_key_hashes(value.ToString()); - cert_verification_result->set_is_issued_by_known_root( - result.is_issued_by_known_root); - cert_verification_result->set_is_issued_by_additional_trust_anchor( - result.is_issued_by_additional_trust_anchor); -} - -// Deserializes |cached_result| using the certificate database provided in -// |deserialized_certs|. Returns the parsed net::CertVerifyResult on success, or -// nullptr if deserialization failed. -bool DeserializeCachedResult( - const cronet_pb::CertVerificationCachedResult& cached_result, - const DeserializedCertMap& deserialized_certs, - int* error, - net::CertVerifyResult* result) { - if (!cached_result.has_error() || !cached_result.has_result()) - return false; - - const cronet_pb::CertVerificationResult& cert_verification_result = - cached_result.result(); - if (!cert_verification_result.has_verified_cert() || - !cert_verification_result.has_cert_status()) { - return false; - } - - *error = cached_result.error(); - - result->verified_cert = DeserializeCertificate( - cert_verification_result.verified_cert(), deserialized_certs); - if (!result->verified_cert) - return false; - - for (int i = 0; i < cert_verification_result.public_key_hashes_size(); ++i) { - const std::string& public_key_hash = - cert_verification_result.public_key_hashes(i); - net::HashValue hash; - if (!hash.FromString(public_key_hash)) - return false; - result->public_key_hashes.push_back(hash); - } - result->cert_status = cert_verification_result.cert_status(); - result->has_md2 = cert_verification_result.has_md2(); - result->has_md4 = cert_verification_result.has_md4(); - result->has_md5 = cert_verification_result.has_md5(); - result->has_sha1 = cert_verification_result.has_sha1(); - result->has_sha1_leaf = cert_verification_result.has_sha1_leaf(); - result->is_issued_by_known_root = - cert_verification_result.is_issued_by_known_root(); - result->is_issued_by_additional_trust_anchor = - cert_verification_result.is_issued_by_additional_trust_anchor(); - return true; -} - -// Serializes |params|, |error|, |verify_result| and |verification_time| into -// |cert_cache|, updating |serialized_certs| with the set of raw certificates -// that will be needed to deserialize the certificate in |cert_cache| via -// DeserializeCertificate(). -void SerializeCachedEntry(const net::CachingCertVerifier::RequestParams& params, - int error, - const net::CertVerifyResult& verify_result, - base::Time verification_time, - cronet_pb::CertVerificationCache* cert_cache, - SerializedCertMap* serialized_certs) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache->add_cache_entry(); - - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - SerializeRequestParams(params, serialized_certs, request_params); - - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - SerializeCachedResult(verify_result, serialized_certs, cached_result); - cached_result->set_error(error); - - cache_entry->set_verification_time(verification_time.ToInternalValue()); -} - -class CacheVisitor : public net::CachingCertVerifier::CacheVisitor { - public: - CacheVisitor() : failed_to_serialize_(false) {} - ~CacheVisitor() override {} - - bool VisitEntry(const net::CachingCertVerifier::RequestParams& params, - int error, - const net::CertVerifyResult& verify_result, - base::Time verification_time, - base::Time expiration_time) override { - SerializeCachedEntry(params, error, verify_result, verification_time, - &cert_cache_, &serialized_certs_); - return true; - } - - void Reset() { - cert_cache_ = cronet_pb::CertVerificationCache(); - failed_to_serialize_ = true; - } - - void SerializeCerts() { - for (const auto& cert : serialized_certs_) { - cronet_pb::CertVerificationCertificateData* cert_entry = - cert_cache_.add_cert_entry(); - cert_entry->set_cert(cert.first); - cert_entry->set_cert_number(cert.second); - } - } - - const cronet_pb::CertVerificationCache& cert_cache() const { - return cert_cache_; - } - - bool failed_to_serialize() const { return failed_to_serialize_; } - - cronet_pb::CertVerificationCache cert_cache_; - SerializedCertMap serialized_certs_; - bool failed_to_serialize_; -}; - -struct CertVerifierCacheEntry { - CertVerifierCacheEntry(const net::CertVerifier::RequestParams& params, - int error, - const net::CertVerifyResult& result, - base::Time verification_time) - : params(params), - error(error), - result(result), - verification_time(verification_time) {} - - net::CertVerifier::RequestParams params; - int error; - net::CertVerifyResult result; - base::Time verification_time; -}; - -} // namespace - -cronet_pb::CertVerificationCache SerializeCertVerifierCache( - const net::CachingCertVerifier& verifier) { - CacheVisitor visitor; - verifier.VisitEntries(&visitor); - - if (!visitor.failed_to_serialize()) - visitor.SerializeCerts(); - return visitor.cert_cache(); -} - -bool DeserializeCertVerifierCache( - const cronet_pb::CertVerificationCache& cert_cache, - net::CachingCertVerifier* verifier) { - DeserializedCertMap deserialized_certs; - - if (cert_cache.cert_entry_size() == 0u || - cert_cache.cache_entry_size() == 0u) { - return false; - } - - // Build |deserialized_certs|'s certificate map. - for (int i = 0; i < cert_cache.cert_entry_size(); ++i) { - const cronet_pb::CertVerificationCertificateData& cert_entry = - cert_cache.cert_entry(i); - if (!cert_entry.has_cert() || !cert_entry.has_cert_number()) - return false; - deserialized_certs.insert({cert_entry.cert_number(), cert_entry.cert()}); - } - - std::vector<std::unique_ptr<CertVerifierCacheEntry>> - cert_verifier_cache_entries; - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - const cronet_pb::CertVerificationCacheEntry& cache_entry = - cert_cache.cache_entry(i); - - // Verify |cache_entry|'s data. - if (!cache_entry.has_request_params() || - !cache_entry.has_verification_time() || - !cache_entry.has_cached_result()) { - return false; - } - - const cronet_pb::CertVerificationRequestParams& request_params = - cache_entry.request_params(); - - // Verify |request_params|'s data. - if (!request_params.has_certificate() || !request_params.has_hostname() || - request_params.hostname().empty() || !request_params.has_flags() || - !request_params.has_ocsp_response()) { - return false; - } - - // Deserialize |request_params|'s certificate using the certificate database - // provided in |deserialized_certs|. - scoped_refptr<net::X509Certificate> certificate = DeserializeCertificate( - request_params.certificate(), deserialized_certs); - if (!certificate) - return false; - - // Deserialize |request_params|'s trust anchor certificates using the - // certificate database provided in |deserialized_certs|. - net::CertificateList additional_trust_anchors; - for (int i = 0; i < request_params.additional_trust_anchors_size(); ++i) { - const cronet_pb::CertVerificationCertificate& certificate = - request_params.additional_trust_anchors(i); - scoped_refptr<net::X509Certificate> cert = - DeserializeCertificate(certificate, deserialized_certs); - if (!cert) - return false; - additional_trust_anchors.push_back(cert); - } - - net::CertVerifier::RequestParams params( - certificate, request_params.hostname(), request_params.flags(), - request_params.ocsp_response(), additional_trust_anchors); - - // Deserialize |cached_result| into |result|. - const cronet_pb::CertVerificationCachedResult& cached_result = - cache_entry.cached_result(); - net::CertVerifyResult result; - int error; - if (!DeserializeCachedResult(cached_result, deserialized_certs, &error, - &result)) { - return false; - } - - base::Time verification_time = - base::Time::FromInternalValue(cache_entry.verification_time()); - // We are deserializing the data that was persisted in the past and thus - // |verification_time| can not be in the future. - if (verification_time.is_null() || verification_time >= base::Time::Now()) - return false; - - std::unique_ptr<CertVerifierCacheEntry> cert_verifier_cache_entry( - new CertVerifierCacheEntry(params, error, result, verification_time)); - cert_verifier_cache_entries.push_back(std::move(cert_verifier_cache_entry)); - } - - for (const auto& entry : cert_verifier_cache_entries) { - verifier->AddEntry(entry->params, entry->error, entry->result, - entry->verification_time); - } - return true; -} - -} // namespace cronet
diff --git a/components/cronet/android/cert/cert_verifier_cache_serializer.h b/components/cronet/android/cert/cert_verifier_cache_serializer.h deleted file mode 100644 index 42e4175..0000000 --- a/components/cronet/android/cert/cert_verifier_cache_serializer.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_CRONET_ANDROID_CERT_CERT_VERIFIER_CACHE_SERIALIZER_H_ -#define COMPONENTS_CRONET_ANDROID_CERT_CERT_VERIFIER_CACHE_SERIALIZER_H_ - -namespace cronet_pb { -class CertVerificationCache; -} // namespace cronet_pb - -namespace net { -class CachingCertVerifier; -} // namespace net - -namespace cronet { - -// Iterates through |verifier|'s cache and returns serialized data. This can be -// used to populate a new net::CachingCertVerifier with -// |DeserializeCertVerifierCache()|. -cronet_pb::CertVerificationCache SerializeCertVerifierCache( - const net::CachingCertVerifier& verifier); - -// Populates |verifier|'s cache. Returns true if the |cert_cache| is -// deserialized correctly. -bool DeserializeCertVerifierCache( - const cronet_pb::CertVerificationCache& cert_cache, - net::CachingCertVerifier* verifier); - -} // namespace cronet - -#endif // COMPONENTS_CRONET_ANDROID_CERT_CERT_VERIFIER_CACHE_SERIALIZER_H_
diff --git a/components/cronet/android/cert/cert_verifier_cache_serializer_unittest.cc b/components/cronet/android/cert/cert_verifier_cache_serializer_unittest.cc deleted file mode 100644 index 84366d3..0000000 --- a/components/cronet/android/cert/cert_verifier_cache_serializer_unittest.cc +++ /dev/null
@@ -1,679 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/cronet/android/cert/cert_verifier_cache_serializer.h" - -#include <memory> -#include <string> - -#include "base/android/path_utils.h" -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "components/cronet/android/cert/proto/cert_verification.pb.h" -#include "net/base/net_errors.h" -#include "net/base/test_completion_callback.h" -#include "net/cert/caching_cert_verifier.h" -#include "net/cert/cert_verifier.h" -#include "net/cert/cert_verify_result.h" -#include "net/cert/mock_cert_verifier.h" -#include "net/cert/x509_certificate.h" -#include "net/cert/x509_util.h" -#include "net/log/net_log_with_source.h" -#include "net/test/cert_test_util.h" -#include "net/test/test_data_directory.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace cronet { - -namespace { - -// Helper function that verifies the cerificate with the given |cert_name| -// against the given |hostname| using the given |verifier|. Result from the cert -// verification is ignored. -void VerifyCert(const std::string& cert_name, - const std::string& hostname, - net::CachingCertVerifier* verifier, - net::CertVerifyResult* verify_result) { - // Set up server certs. - scoped_refptr<net::X509Certificate> cert( - net::ImportCertFromFile(net::GetTestCertsDirectory(), cert_name)); - ASSERT_TRUE(cert); - - net::TestCompletionCallback callback; - std::unique_ptr<net::CertVerifier::Request> request; - - ignore_result(callback.GetResult(verifier->Verify( - net::CertVerifier::RequestParams(cert.get(), hostname, 0, std::string(), - net::CertificateList()), - nullptr, verify_result, callback.callback(), &request, - net::NetLogWithSource()))); -} - -} // namespace - -TEST(CertVerifierCacheSerializerTest, RestoreEmptyData) { - // Restoring empty data should fail. - cronet_pb::CertVerificationCache cert_cache; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier)); -} - -TEST(CertVerifierCacheSerializerTest, SerializeCache) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - // Verify atleast one certificate is serialized. - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); -} - -// Create a new Verifier and restoring the data into it should succeed. -TEST(CertVerifierCacheSerializerTest, RestoreMultipleEntriesIntoNewVerifier) { - scoped_refptr<net::X509Certificate> ok_cert( - net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem")); - ASSERT_TRUE(ok_cert); - - const scoped_refptr<net::X509Certificate> root_cert = - net::ImportCertFromFile(net::GetTestCertsDirectory(), "root_ca_cert.pem"); - ASSERT_TRUE(root_cert); - - net::TestCompletionCallback callback; - std::unique_ptr<net::CertVerifier::Request> request; - - // Verify www.example.com host's certificate. - std::string example_hostname("www.example.com"); - net::CertVerifyResult verifier1_result1; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE(VerifyCert("ok_cert.pem", example_hostname, &verifier, - &verifier1_result1)); - - // Verify www2.example.com host's certificate. - std::string example2_hostname("www2.example.com"); - net::CertVerifyResult verifier1_result2; - - // Create a certificate that contains both a leaf and an intermediate/root and - // use that certificate for www2.example.com. - std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> chain; - chain.push_back(net::x509_util::DupCryptoBuffer(root_cert->cert_buffer())); - const scoped_refptr<net::X509Certificate> combined_cert = - net::X509Certificate::CreateFromBuffer( - net::x509_util::DupCryptoBuffer(ok_cert->cert_buffer()), - std::move(chain)); - ASSERT_TRUE(combined_cert); - - ignore_result(callback.GetResult(verifier.Verify( - net::CertVerifier::RequestParams(combined_cert, example2_hostname, 0, - std::string(), net::CertificateList()), - nullptr, &verifier1_result2, callback.callback(), &request, - net::NetLogWithSource()))); - - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - // Verify two certificates are serialized. - DCHECK_EQ(2, cert_cache.cert_entry_size()); - DCHECK_EQ(2, cert_cache.cache_entry_size()); - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - - // Populate |verifier2|'s cache. - EXPECT_TRUE(DeserializeCertVerifierCache(cert_cache, &verifier2)); - - // Verify the cert for www.example.com with |verifier2|. - net::CertVerifyResult verifier2_result1; - ASSERT_NO_FATAL_FAILURE(VerifyCert("ok_cert.pem", example_hostname, - &verifier2, &verifier2_result1)); - - // CertVerifyResult for www.example.com with |verifier2| should match - // what was serialized with |verifier|. - EXPECT_EQ(verifier2_result1, verifier1_result1); - - // Verify the cert for www2.example.com with |verifier2|. - net::CertVerifyResult verifier2_result2; - ignore_result(callback.GetResult(verifier2.Verify( - net::CertVerifier::RequestParams(combined_cert, example2_hostname, 0, - std::string(), net::CertificateList()), - nullptr, &verifier2_result2, callback.callback(), &request, - net::NetLogWithSource()))); - - // CertVerifyResult for www2.example.com with |verifier2| should match - // what was serialized with |verifier|. - EXPECT_EQ(verifier2_result2, verifier1_result2); -} - -// A corrupted cert_entry in the serialized data should fail to be deserialized. -// Should not deserialize a corrupted cert_entry. -TEST(CertVerifierCacheSerializerTest, DeserializeCorruptedCerts) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - cert_cache.clear_cert_entry(); - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |cache_entry| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |cert_entry|. -TEST(CertVerifierCacheSerializerTest, DeserializeCorruptedCacheEntry) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - // Corrupt |cache_entry|. - cert_cache.clear_cache_entry(); - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |request_params| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |request_params|. -TEST(CertVerifierCacheSerializerTest, DeserializeCorruptedRequestParams) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - // Corrupt |request_params|. - cache_entry->clear_request_params(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |certificate| in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize a corrupted |certificate|. -TEST(CertVerifierCacheSerializerTest, DeserializeRequestParamsNoCertificate) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - // Corrupt certificate. - request_params->clear_certificate(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |hostname| in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize a corrupted |hostname|. -TEST(CertVerifierCacheSerializerTest, DeserializeRequestParamsNoHostname) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - // Corrupt hostname. - request_params->clear_hostname(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// An invalid |hostname| in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize an invalid |hostname|. -TEST(CertVerifierCacheSerializerTest, DeserializeRequestParamsEmptyHostname) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - // Set bogus hostname. - request_params->set_hostname(""); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |flags| in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize a corrupted |flags|. -TEST(CertVerifierCacheSerializerTest, DeserializeRequestParamsNoFlags) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - // Corrupt flags. - request_params->clear_flags(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |ocsp_response| in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize a corrupted |ocsp_response|. -TEST(CertVerifierCacheSerializerTest, DeserializeRequestParamsNoOcspResponse) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - // Corrupt |ocsp_response|. - request_params->clear_ocsp_response(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// An empty certificate number in |request_params| in the serialized data should -// fail to be deserialized. Should not deserialize an empty certificate number. -TEST(CertVerifierCacheSerializerTest, - DeserializeRequestParamsCertificateNoCertNumbers) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - cronet_pb::CertVerificationCertificate* certificate = - request_params->mutable_certificate(); - // Corrupt certificate number. - certificate->clear_cert_numbers(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// An invalid certificate number in |request_params| in the serialized data -// should fail to be deserialized. Should not deserialize an invalid certificate -// number. -TEST(CertVerifierCacheSerializerTest, - DeserializeCorruptedRequestParamsCertNumbers) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - cronet_pb::CertVerificationCertificate* certificate = - request_params->mutable_certificate(); - // Set bogus certificate number. - certificate->set_cert_numbers(0, 100); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted certificate number in |additional_trust_anchors| of -// |request_params| in the serialized data should fail to be deserialized. -// Should not deserialize a corrupted certificate number. -TEST(CertVerifierCacheSerializerTest, - DeserializeRequestParamsCertificateNoTrustAnchors) { - net::CertificateList ca_cert_list = net::CreateCertificateListFromFile( - net::GetTestCertsDirectory(), "root_ca_cert.pem", - net::X509Certificate::FORMAT_AUTO); - ASSERT_EQ(1U, ca_cert_list.size()); - scoped_refptr<net::X509Certificate> ca_cert(ca_cert_list[0]); - - net::CertificateList cert_list = net::CreateCertificateListFromFile( - net::GetTestCertsDirectory(), "ok_cert.pem", - net::X509Certificate::FORMAT_AUTO); - ASSERT_EQ(1U, cert_list.size()); - scoped_refptr<net::X509Certificate> cert(cert_list[0]); - - // Now add the |ca_cert| to the |trust_anchors|, and verification should pass. - net::CertificateList trust_anchors; - trust_anchors.push_back(ca_cert); - - net::CertVerifyResult verify_result; - net::TestCompletionCallback callback; - std::unique_ptr<net::CertVerifier::Request> request; - - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - // Verify the |cert| with |trust_anchors|. - ignore_result(callback.GetResult(verifier.Verify( - net::CertVerifier::RequestParams(cert, "www.example.com", 0, - std::string(), trust_anchors), - nullptr, &verify_result, callback.callback(), &request, - net::NetLogWithSource()))); - - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(2, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationRequestParams* request_params = - cache_entry->mutable_request_params(); - for (int j = 0; j < request_params->additional_trust_anchors_size(); ++j) { - cronet_pb::CertVerificationCertificate* certificate = - request_params->mutable_additional_trust_anchors(j); - // Corrupt the certificate number in |additional_trust_anchors|. - certificate->clear_cert_numbers(); - } - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |cached_result| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |cached_result|. -TEST(CertVerifierCacheSerializerTest, DeserializeCorruptedCachedResult) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - // Corrupt the |cached_result|. - cache_entry->clear_cached_result(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |error| in the serialized data should fail to be deserialized. -// Should not deserialize a corrupted |error|. -TEST(CertVerifierCacheSerializerTest, DeserializeCachedResultNoError) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - // Corrupt |error|. - cached_result->clear_error(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |result| in the serialized data should fail to be deserialized. -// Should not deserialize a corrupted |result|. -TEST(CertVerifierCacheSerializerTest, DeserializeCachedResultNoResult) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - // Corrupt the |result|. - cached_result->clear_result(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |cert_status| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |cert_status|. -TEST(CertVerifierCacheSerializerTest, DeserializeCachedResultNoCertStatus) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - cronet_pb::CertVerificationResult* result = cached_result->mutable_result(); - // Corrupt the |cert_status|. - result->clear_cert_status(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |verification_time| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |verification_time|. -TEST(CertVerifierCacheSerializerTest, DeserializeCachedResultNoVerifiedCert) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - cronet_pb::CertVerificationResult* result = cached_result->mutable_result(); - // Corrupt the |verified_cert|. - result->clear_verified_cert(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |verified_cert| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |verified_cert|. -TEST(CertVerifierCacheSerializerTest, - DeserializeCachedResultNoVerifiedCertNumber) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - cronet_pb::CertVerificationResult* result = cached_result->mutable_result(); - result->clear_verified_cert(); - // Corrupt the verified cert's certificate number. - cronet_pb::CertVerificationCertificate* certificate = - result->mutable_verified_cert(); - certificate->clear_cert_numbers(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// An invalid certificate number of |verified_cert| in the serialized data -// should fail to be deserialized. Should not deserialize an invalid certificate -// number. -TEST(CertVerifierCacheSerializerTest, - DeserializeCorruptedCachedResultVerifiedCertNumber) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - cronet_pb::CertVerificationResult* result = cached_result->mutable_result(); - cronet_pb::CertVerificationCertificate* certificate = - result->mutable_verified_cert(); - // Set bogus certificate number for |verified_cert|. - certificate->set_cert_numbers(0, 100); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |public_key_hashes| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |public_key_hashes|. -TEST(CertVerifierCacheSerializerTest, - DeserializeCorruptedCachedResultPublicKeyHashes) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - cronet_pb::CertVerificationCachedResult* cached_result = - cache_entry->mutable_cached_result(); - cronet_pb::CertVerificationResult* result = cached_result->mutable_result(); - // Set bogus |public_key_hashes|. - result->add_public_key_hashes(""); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -// A corrupted |verification_time| in the serialized data should fail to be -// deserialized. Should not deserialize a corrupted |verification_time|. -TEST(CertVerifierCacheSerializerTest, DeserializeCorruptedVerificationTime) { - net::CertVerifyResult verify_result; - net::CachingCertVerifier verifier(std::make_unique<net::MockCertVerifier>()); - ASSERT_NO_FATAL_FAILURE( - VerifyCert("ok_cert.pem", "www.example.com", &verifier, &verify_result)); - cronet_pb::CertVerificationCache cert_cache = - SerializeCertVerifierCache(verifier); - DCHECK_EQ(1, cert_cache.cert_entry_size()); - DCHECK_EQ(1, cert_cache.cache_entry_size()); - - for (int i = 0; i < cert_cache.cache_entry_size(); ++i) { - cronet_pb::CertVerificationCacheEntry* cache_entry = - cert_cache.mutable_cache_entry(i); - // Corrupt |verification_time|. - cache_entry->clear_verification_time(); - } - - net::CachingCertVerifier verifier2(std::make_unique<net::MockCertVerifier>()); - EXPECT_FALSE(DeserializeCertVerifierCache(cert_cache, &verifier2)); -} - -} // namespace cronet
diff --git a/components/cronet/android/cert/proto/cert_verification.proto b/components/cronet/android/cert/proto/cert_verification.proto deleted file mode 100644 index 16320fa..0000000 --- a/components/cronet/android/cert/proto/cert_verification.proto +++ /dev/null
@@ -1,77 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// -// WARNING: This is experimental code, please don't use it. -// - -syntax = "proto2"; - -option optimize_for = LITE_RUNTIME; - -package cronet_pb; - -message CertVerificationCertificate { - // Certficate number associated with each unique certificate. - repeated uint32 cert_numbers = 1; -}; - -// Protobuf for input parameters of a certificate verification request. -message CertVerificationRequestParams { - optional CertVerificationCertificate certificate = 1; - optional string hostname = 2; - optional int32 flags = 3; - optional string ocsp_response = 4; - repeated CertVerificationCertificate additional_trust_anchors = 5; -}; - -// Protobuf for the result of certificate verification. -message CertVerificationResult { - optional CertVerificationCertificate verified_cert = 1; - - optional uint32 cert_status = 2; - - // Properties of the certificate chain. - optional bool has_md2 = 3; - optional bool has_md4 = 4; - optional bool has_md5 = 5; - optional bool has_sha1 = 6; - optional bool has_sha1_leaf = 7; - - repeated string public_key_hashes = 8; - optional bool is_issued_by_known_root = 9; - optional bool is_issued_by_additional_trust_anchor = 10; - optional bool common_name_fallback_used = 11 [deprecated = true]; -}; - -// Protobuf for CertVerificationResult and the error. -message CertVerificationCachedResult { - // The return value of CertVerifier::Verify. - optional int64 error = 1; - // The output of CertVerifier::Verify. - optional CertVerificationResult result = 2; -} - -// Each cache entry for certificate verification request, verification result -// and it's time of verification. -message CertVerificationCacheEntry { - optional CertVerificationRequestParams request_params = 1; - optional CertVerificationCachedResult cached_result = 2; - optional int64 verification_time = 3; -}; - -// Protobuf for each unique certificate. -message CertVerificationCertificateData { - // DER encoded certificate. - optional string cert = 1; - // Certficate number associated with the certificate. - optional uint32 cert_number = 2; -}; - -message CertVerificationCache { - // Set of unique certificates. - repeated CertVerificationCertificateData cert_entry = 1; - // CachingCertVerifier's cache entries. - repeated CertVerificationCacheEntry cache_entry = 2; -};
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index 55df2cb..bcdbbba05 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -33,8 +33,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/values.h" -#include "components/cronet/android/cert/cert_verifier_cache_serializer.h" -#include "components/cronet/android/cert/proto/cert_verification.pb.h" #include "components/cronet/android/cronet_library_loader.h" #include "components/cronet/cronet_prefs_manager.h" #include "components/cronet/histogram_manager.h" @@ -133,37 +131,6 @@ context_ = nullptr; } -void CronetURLRequestContextAdapter::OnInitCertVerifierData( - net::CertVerifier* cert_verifier, - const std::string& cert_verifier_data) { - SCOPED_UMA_HISTOGRAM_TIMER("Net.Cronet.CertVerifierCache.DeserializeTime"); - std::string data; - cronet_pb::CertVerificationCache cert_verification_cache; - if (base::Base64Decode(cert_verifier_data, &data) && - cert_verification_cache.ParseFromString(data)) { - DeserializeCertVerifierCache( - cert_verification_cache, - reinterpret_cast<net::CachingCertVerifier*>(cert_verifier)); - } -} - -void CronetURLRequestContextAdapter::OnSaveCertVerifierData( - net::CertVerifier* cert_verifier) { - std::string encoded_data; - if (cert_verifier) { - SCOPED_UMA_HISTOGRAM_TIMER("Net.Cronet.CertVerifierCache.SerializeTime"); - std::string data; - cronet_pb::CertVerificationCache cert_cache = SerializeCertVerifierCache( - *reinterpret_cast<net::CachingCertVerifier*>(cert_verifier)); - cert_cache.SerializeToString(&data); - base::Base64Encode(data, &encoded_data); - } - JNIEnv* env = base::android::AttachCurrentThread(); - Java_CronetUrlRequestContext_onGetCertVerifierData( - env, jcronet_url_request_context_, - base::android::ConvertUTF8ToJavaString(env, encoded_data)); -} - void CronetURLRequestContextAdapter::OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType effective_connection_type) { Java_CronetUrlRequestContext_onEffectiveConnectionTypeChanged( @@ -251,12 +218,6 @@ context_->StopNetLog(); } -void CronetURLRequestContextAdapter::GetCertVerifierData( - JNIEnv* env, - const JavaParamRef<jobject>& jcaller) { - context_->GetCertVerifierData(); -} - int CronetURLRequestContextAdapter::default_load_flags() const { return context_->default_load_flags(); } @@ -277,8 +238,7 @@ const JavaParamRef<jstring>& jexperimental_quic_connection_options, jlong jmock_cert_verifier, jboolean jenable_network_quality_estimator, - jboolean jbypass_public_key_pinning_for_local_trust_anchors, - const JavaParamRef<jstring>& jcert_verifier_data) { + jboolean jbypass_public_key_pinning_for_local_trust_anchors) { return reinterpret_cast<jlong>(new URLRequestContextConfig( jquic_enabled, ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id), @@ -293,8 +253,7 @@ base::WrapUnique( reinterpret_cast<net::CertVerifier*>(jmock_cert_verifier)), jenable_network_quality_estimator, - jbypass_public_key_pinning_for_local_trust_anchors, - ConvertNullableJavaStringToUTF8(env, jcert_verifier_data))); + jbypass_public_key_pinning_for_local_trust_anchors)); } // Add a QUIC hint to a URLRequestContextConfig.
diff --git a/components/cronet/android/cronet_url_request_context_adapter.h b/components/cronet/android/cronet_url_request_context_adapter.h index f86a8e5e..18d93f1 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.h +++ b/components/cronet/android/cronet_url_request_context_adapter.h
@@ -85,11 +85,6 @@ void StopNetLog(JNIEnv* env, const base::android::JavaParamRef<jobject>& jcaller); - // Posts a task to Network thread to get serialized results of certificate - // verifications of |context_|'s |cert_verifier|. - void GetCertVerifierData(JNIEnv* env, - const base::android::JavaParamRef<jobject>& jcaller); - // Default net::LOAD flags used to create requests. int default_load_flags() const; @@ -126,9 +121,6 @@ // CronetURLRequestContext::Callback void OnInitNetworkThread() override; void OnDestroyNetworkThread() override; - void OnInitCertVerifierData(net::CertVerifier* cert_verifier, - const std::string& cert_verifier_data) override; - void OnSaveCertVerifierData(net::CertVerifier* cert_verifier) override; void OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType effective_connection_type) override; void OnRTTOrThroughputEstimatesComputed(
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java b/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java index 84923d01..5d8dab1 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java
@@ -92,7 +92,6 @@ private String mExperimentalOptions; protected long mMockCertVerifier; private boolean mNetworkQualityEstimatorEnabled; - private String mCertVerifierData; private int mThreadPriority = INVALID_THREAD_PRIORITY; /** @@ -377,21 +376,11 @@ } @Override - public CronetEngineBuilderImpl setCertVerifierData(String certVerifierData) { - mCertVerifierData = certVerifierData; - return this; - } - - @Override public CronetEngineBuilderImpl enableNetworkQualityEstimator(boolean value) { mNetworkQualityEstimatorEnabled = value; return this; } - String certVerifierData() { - return mCertVerifierData; - } - @Override public CronetEngineBuilderImpl setThreadPriority(int priority) { if (priority > THREAD_PRIORITY_LOWEST || priority < -20) {
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java b/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java index 13f61011..58fa82a 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java
@@ -132,14 +132,6 @@ new HashMap<RequestFinishedInfo.Listener, VersionSafeCallbacks.RequestFinishedInfoListener>(); - /** - * Synchronize access to mCertVerifierData. - */ - private ConditionVariable mWaitGetCertVerifierDataComplete = new ConditionVariable(); - - /** Holds CertVerifier data. */ - private String mCertVerifierData; - private volatile ConditionVariable mStopNetLogCompleted; /** Set of storage paths currently in use. */ @@ -202,8 +194,7 @@ builder.brotliEnabled(), builder.cacheDisabled(), builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.experimentalOptions(), builder.mockCertVerifier(), builder.networkQualityEstimatorEnabled(), - builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(), - builder.certVerifierData()); + builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled()); for (CronetEngineBuilderImpl.QuicHint quicHint : builder.quicHints()) { nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.mPort, quicHint.mAlternatePort); @@ -331,22 +322,6 @@ mStopNetLogCompleted.open(); } - @Override - public String getCertVerifierData(long timeout) { - if (timeout < 0) { - throw new IllegalArgumentException("timeout must be a positive value"); - } else if (timeout == 0) { - timeout = 100; - } - mWaitGetCertVerifierDataComplete.close(); - synchronized (mLock) { - checkHaveAdapter(); - nativeGetCertVerifierData(mUrlRequestContextAdapter); - } - mWaitGetCertVerifierDataComplete.block(timeout); - return mCertVerifierData; - } - // This method is intentionally non-static to ensure Cronet native library // is loaded by class constructor. @Override @@ -665,13 +640,6 @@ } } - @SuppressWarnings("unused") - @CalledByNative - private void onGetCertVerifierData(String certVerifierData) { - mCertVerifierData = certVerifierData; - mWaitGetCertVerifierDataComplete.open(); - } - void reportFinished(final RequestFinishedInfo requestInfo) { ArrayList<VersionSafeCallbacks.RequestFinishedInfoListener> currentListeners; synchronized (mFinishedListenerLock) { @@ -705,7 +673,7 @@ boolean brotliEnabled, boolean disableCache, int httpCacheMode, long httpCacheMaxSize, String experimentalOptions, long mockCertVerifier, boolean enableNetworkQualityEstimator, - boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerifierData); + boolean bypassPublicKeyPinningForLocalTrustAnchors); private static native void nativeAddQuicHint( long urlRequestContextConfig, String host, int port, int alternatePort); @@ -733,9 +701,6 @@ private native void nativeStopNetLog(long nativePtr); @NativeClassQualifiedName("CronetURLRequestContextAdapter") - private native void nativeGetCertVerifierData(long nativePtr); - - @NativeClassQualifiedName("CronetURLRequestContextAdapter") private native void nativeInitRequestContextOnInitThread(long nativePtr); @NativeClassQualifiedName("CronetURLRequestContextAdapter")
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/JavaCronetEngine.java b/components/cronet/android/java/src/org/chromium/net/impl/JavaCronetEngine.java index 6bd74782..18aff72 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/JavaCronetEngine.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/JavaCronetEngine.java
@@ -115,11 +115,6 @@ public void stopNetLog() {} @Override - public String getCertVerifierData(long timeout) { - return ""; - } - - @Override public byte[] getGlobalMetricsDeltas() { return new byte[0]; }
diff --git a/components/cronet/android/test/cronet_url_request_context_config_test.cc b/components/cronet/android/test/cronet_url_request_context_config_test.cc index 2059820..0c046a8 100644 --- a/components/cronet/android/test/cronet_url_request_context_config_test.cc +++ b/components/cronet/android/test/cronet_url_request_context_config_test.cc
@@ -38,7 +38,6 @@ CHECK_NE(config->quic_user_agent_id.find("Cronet/" CRONET_VERSION), std::string::npos); CHECK_EQ(config->load_disable_cache, false); - CHECK_EQ(config->cert_verifier_data, "test_cert_verifier_data"); CHECK_EQ(config->http_cache, URLRequestContextConfig::HttpCacheType::MEMORY); CHECK_EQ(config->http_cache_max_size, 54321); CHECK_EQ(config->user_agent, "efgh");
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamQuicTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamQuicTest.java index 42c9a37..cf02c31 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamQuicTest.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamQuicTest.java
@@ -5,7 +5,6 @@ package org.chromium.net; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -395,41 +394,4 @@ assertTrue("actual error " + quicException.getQuicDetailedErrorCode(), 0 < quicException.getQuicDetailedErrorCode()); } - - @Test - @SmallTest - @Feature({"Cronet"}) - @OnlyRunNativeCronet - // Test that certificate verify results are serialized and deserialized correctly. - public void testSerializeDeserialize() throws Exception { - setUp(QuicBidirectionalStreams.ENABLED); - String path = "/simple.txt"; - String quicURL = QuicTestServer.getServerURL() + path; - TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCallback(); - BidirectionalStream stream = - mCronetEngine - .newBidirectionalStreamBuilder(quicURL, callback, callback.getExecutor()) - .setHttpMethod("GET") - .build(); - stream.start(); - callback.blockForDone(); - assertTrue(stream.isDone()); - assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); - assertEquals("This is a simple text file served by QUIC.\n", callback.mResponseAsString); - assertEquals("quic/1+spdy/3", callback.mResponseInfo.getNegotiatedProtocol()); - - String serialized_data = mCronetEngine.getCertVerifierData(100); - assertFalse(serialized_data.isEmpty()); - - // Create a new builder and verify that the |serialized_data| is deserialized correctly. - ExperimentalCronetEngine.Builder builder = - new ExperimentalCronetEngine.Builder(getContext()); - builder.enableQuic(true); - CronetTestUtil.setMockCertVerifierForTesting( - builder, QuicTestServer.createMockCertVerifier()); - builder.setCertVerifierData(serialized_data); - - String deserialized_data = builder.build().getCertVerifierData(100); - assertEquals(deserialized_data, serialized_data); - } }
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java index 4aedb07..c95bbe0 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java
@@ -1127,32 +1127,6 @@ @Test @SmallTest @Feature({"Cronet"}) - public void testEmptyGetCertVerifierData() { - // Immediately make a request after initializing the engine. - ExperimentalCronetEngine cronetEngine = - new ExperimentalCronetEngine.Builder(getContext()).build(); - TestUrlRequestCallback callback = new TestUrlRequestCallback(); - UrlRequest.Builder urlRequestBuilder = - cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getExecutor()); - urlRequestBuilder.build().start(); - callback.blockForDone(); - assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); - - try { - cronetEngine.getCertVerifierData(-1); - fail("Should throw an exception"); - } catch (Exception e) { - assertEquals("timeout must be a positive value", e.getMessage()); - } - // Because mUrl is http, getCertVerifierData() will return empty data. - String data = cronetEngine.getCertVerifierData(100); - assertTrue(data.isEmpty()); - cronetEngine.shutdown(); - } - - @Test - @SmallTest - @Feature({"Cronet"}) public void testInitEngineStartTwoRequests() throws Exception { // Make two requests after initializing the context. CronetEngine cronetEngine = new CronetEngine.Builder(getContext()).build(); @@ -1262,7 +1236,6 @@ builder.enableHttp2(false); builder.enableQuic(true); builder.addQuicHint("example.com", 12, 34); - builder.setCertVerifierData("test_cert_verifier_data"); builder.enableHttpCache(HTTP_CACHE_IN_MEMORY, 54321); builder.setUserAgent("efgh"); builder.setExperimentalOptions("ijkl");
diff --git a/components/cronet/cronet_url_request_context.cc b/components/cronet/cronet_url_request_context.cc index bf917b2..ca0a2ac 100644 --- a/components/cronet/cronet_url_request_context.cc +++ b/components/cronet/cronet_url_request_context.cc
@@ -382,12 +382,6 @@ } } - // If there is a cert_verifier, then populate its cache with - // |cert_verifier_data|. - if (!config->cert_verifier_data.empty() && context_->cert_verifier()) - callback_->OnInitCertVerifierData(context_->cert_verifier(), - config->cert_verifier_data); - // Iterate through PKP configuration for every host. for (const auto& pkp : config->pkp_list) { // Add the host pinning. @@ -502,20 +496,6 @@ base::Unretained(network_tasks_))); } -void CronetURLRequestContext::GetCertVerifierData() { - PostTaskToNetworkThread( - FROM_HERE, - base::BindOnce( - &CronetURLRequestContext::NetworkTasks::GetCertVerifierData, - base::Unretained(network_tasks_))); -} - -void CronetURLRequestContext::NetworkTasks::GetCertVerifierData() { - DCHECK_CALLED_ON_VALID_THREAD(network_thread_checker_); - callback_->OnSaveCertVerifierData( - is_context_initialized_ ? context_->cert_verifier() : nullptr); -} - int CronetURLRequestContext::default_load_flags() const { return default_load_flags_; }
diff --git a/components/cronet/cronet_url_request_context.h b/components/cronet/cronet_url_request_context.h index 3bd40c2..8bfd27dd 100644 --- a/components/cronet/cronet_url_request_context.h +++ b/components/cronet/cronet_url_request_context.h
@@ -31,7 +31,6 @@ namespace net { enum EffectiveConnectionType; -class CertVerifier; class NetLog; class ProxyConfigService; class URLRequestContext; @@ -59,16 +58,6 @@ // Invoked on network thread immediately prior to destruction. virtual void OnDestroyNetworkThread() = 0; - // Invoked on network thread to initialze |cert_verifier| using - // |cert_verifier_data|. - virtual void OnInitCertVerifierData( - net::CertVerifier* cert_verifier, - const std::string& cert_verifier_data) = 0; - - // Invoked on network thread to save |cert_verifier| data for use in - // OnInitCertVerifierData(). - virtual void OnSaveCertVerifierData(net::CertVerifier* cert_verifier) = 0; - // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver forwarder. virtual void OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType effective_connection_type) = 0; @@ -137,10 +126,6 @@ // flush any remaining writes to disk. void StopNetLog(); - // Posts a task to Network thread to get serialized results of certificate - // verifications of |context_|'s |cert_verifier|. - void GetCertVerifierData(); - // Default net::LOAD flags used to create requests. int default_load_flags() const; @@ -184,10 +169,6 @@ void RunTaskAfterContextInit( base::OnceClosure task_to_run_after_context_init); - // Serializes results of certificate verifications of |context_|'s - // |cert_verifier|. - void GetCertVerifierData(); - // Configures the network quality estimator to observe requests to // localhost, to use smaller responses when estimating throughput, and to // disable the device offline checks when computing the effective connection
diff --git a/components/cronet/native/engine.cc b/components/cronet/native/engine.cc index d63b07a..90f60f7 100644 --- a/components/cronet/native/engine.cc +++ b/components/cronet/native/engine.cc
@@ -265,9 +265,6 @@ // CronetURLRequestContext::Callback implementation: void OnInitNetworkThread() override; void OnDestroyNetworkThread() override; - void OnInitCertVerifierData(net::CertVerifier* cert_verifier, - const std::string& cert_verifier_data) override; - void OnSaveCertVerifierData(net::CertVerifier* cert_verifier) override; void OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType effective_connection_type) override; void OnRTTOrThroughputEstimatesComputed( @@ -313,13 +310,6 @@ DCHECK_CALLED_ON_VALID_THREAD(network_thread_checker_); } -void Cronet_EngineImpl::Callback::OnInitCertVerifierData( - net::CertVerifier* cert_verifier, - const std::string& cert_verifier_data) {} - -void Cronet_EngineImpl::Callback::OnSaveCertVerifierData( - net::CertVerifier* cert_verifier) {} - void Cronet_EngineImpl::Callback::OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType effective_connection_type) { NOTIMPLEMENTED();
diff --git a/components/cronet/stale_host_resolver_unittest.cc b/components/cronet/stale_host_resolver_unittest.cc index 63930bb..d7cda2a 100644 --- a/components/cronet/stale_host_resolver_unittest.cc +++ b/components/cronet/stale_host_resolver_unittest.cc
@@ -569,9 +569,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log;
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index abc1b79c..82a2901 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -165,8 +165,7 @@ const std::string& experimental_options, std::unique_ptr<net::CertVerifier> mock_cert_verifier, bool enable_network_quality_estimator, - bool bypass_public_key_pinning_for_local_trust_anchors, - const std::string& cert_verifier_data) + bool bypass_public_key_pinning_for_local_trust_anchors) : enable_quic(enable_quic), quic_user_agent_id(quic_user_agent_id), enable_spdy(enable_spdy), @@ -181,7 +180,6 @@ enable_network_quality_estimator(enable_network_quality_estimator), bypass_public_key_pinning_for_local_trust_anchors( bypass_public_key_pinning_for_local_trust_anchors), - cert_verifier_data(cert_verifier_data), experimental_options(experimental_options) {} URLRequestContextConfig::~URLRequestContextConfig() {} @@ -603,7 +601,7 @@ http_cache_max_size, load_disable_cache, storage_path, accept_language, user_agent, experimental_options, std::move(mock_cert_verifier), enable_network_quality_estimator, - bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); + bypass_public_key_pinning_for_local_trust_anchors); } } // namespace cronet
diff --git a/components/cronet/url_request_context_config.h b/components/cronet/url_request_context_config.h index fd27dc4..a09a36b 100644 --- a/components/cronet/url_request_context_config.h +++ b/components/cronet/url_request_context_config.h
@@ -108,9 +108,7 @@ // Enable network quality estimator. bool enable_network_quality_estimator, // Enable bypassing of public key pinning for local trust anchors - bool bypass_public_key_pinning_for_local_trust_anchors, - // Certificate verifier cache data. - const std::string& cert_verifier_data); + bool bypass_public_key_pinning_for_local_trust_anchors); ~URLRequestContextConfig(); // Configures |context_builder| based on |this|. @@ -149,9 +147,6 @@ // Enable public key pinning bypass for local trust anchors. const bool bypass_public_key_pinning_for_local_trust_anchors; - // Data to populte CertVerifierCache. - const std::string cert_verifier_data; - // App-provided list of servers that support QUIC. std::vector<std::unique_ptr<QuicHint>> quic_hints; @@ -245,9 +240,6 @@ // Enable public key pinning bypass for local trust anchors. bool bypass_public_key_pinning_for_local_trust_anchors = true; - // Data to populate CertVerifierCache. - std::string cert_verifier_data = ""; - private: DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); };
diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index a5dfb7a..f045720e3 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc
@@ -76,9 +76,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -170,9 +168,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -231,9 +227,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -293,9 +287,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -355,9 +347,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -410,9 +400,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -466,9 +454,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -521,9 +507,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -574,9 +558,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log; @@ -634,9 +616,7 @@ // Enable network quality estimator. false, // Enable Public Key Pinning bypass for local trust anchors. - true, - // Certificate verifier cache data. - ""); + true); net::URLRequestContextBuilder builder; net::NetLog net_log;
diff --git a/components/discardable_memory/OWNERS b/components/discardable_memory/OWNERS index 157836ab..08bb2dd 100644 --- a/components/discardable_memory/OWNERS +++ b/components/discardable_memory/OWNERS
@@ -1 +1,2 @@ reveman@chromium.org +penghuang@chromium.org
diff --git a/components/download/internal/background_service/controller.h b/components/download/internal/background_service/controller.h index e4725da..6c35850 100644 --- a/components/download/internal/background_service/controller.h +++ b/components/download/internal/background_service/controller.h
@@ -102,7 +102,7 @@ // See DownloadService::OnStartScheduledTask. virtual void OnStartScheduledTask(DownloadTaskType task_type, - const TaskFinishedCallback& callback) = 0; + TaskFinishedCallback callback) = 0; // See DownloadService::OnStopScheduledTask. virtual bool OnStopScheduledTask(DownloadTaskType task_type) = 0;
diff --git a/components/download/internal/background_service/controller_impl.cc b/components/download/internal/background_service/controller_impl.cc index 2150eca..2d4d780 100644 --- a/components/download/internal/background_service/controller_impl.cc +++ b/components/download/internal/background_service/controller_impl.cc
@@ -5,9 +5,8 @@ #include "components/download/internal/background_service/controller_impl.h" #include <inttypes.h> - -#include <string> -#include <vector> +#include <algorithm> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" @@ -304,10 +303,9 @@ return entry ? entry->client : DownloadClient::INVALID; } -void ControllerImpl::OnStartScheduledTask( - DownloadTaskType task_type, - const TaskFinishedCallback& callback) { - task_finished_callbacks_[task_type] = callback; +void ControllerImpl::OnStartScheduledTask(DownloadTaskType task_type, + TaskFinishedCallback callback) { + task_finished_callbacks_[task_type] = std::move(callback); switch (controller_state_) { case State::READY:
diff --git a/components/download/internal/background_service/controller_impl.h b/components/download/internal/background_service/controller_impl.h index 8c3b3754..379d8c6 100644 --- a/components/download/internal/background_service/controller_impl.h +++ b/components/download/internal/background_service/controller_impl.h
@@ -8,6 +8,8 @@ #include <map> #include <memory> #include <set> +#include <string> +#include <vector> #include "base/cancelable_callback.h" #include "base/macros.h" @@ -78,7 +80,7 @@ const SchedulingParams& params) override; DownloadClient GetOwnerOfDownload(const std::string& guid) override; void OnStartScheduledTask(DownloadTaskType task_type, - const TaskFinishedCallback& callback) override; + TaskFinishedCallback callback) override; bool OnStopScheduledTask(DownloadTaskType task_type) override; private:
diff --git a/components/download/internal/background_service/controller_impl_unittest.cc b/components/download/internal/background_service/controller_impl_unittest.cc index 65576aa..228181c 100644 --- a/components/download/internal/background_service/controller_impl_unittest.cc +++ b/components/download/internal/background_service/controller_impl_unittest.cc
@@ -4,8 +4,10 @@ #include "components/download/internal/background_service/controller_impl.h" +#include <stdint.h> #include <algorithm> #include <memory> +#include <utility> #include "base/bind.h" #include "base/guid.h" @@ -104,7 +106,7 @@ // TaskScheduler implementation. MOCK_METHOD6(ScheduleTask, - void(DownloadTaskType, bool, bool, int, long, long)); + void(DownloadTaskType, bool, bool, int, int64_t, int64_t)); MOCK_METHOD1(CancelTask, void(DownloadTaskType)); }; @@ -496,7 +498,7 @@ store_->TriggerInit(true, std::make_unique<std::vector<Entry>>(entries)); file_monitor_->TriggerInit(true); controller_->OnStartScheduledTask(DownloadTaskType::CLEANUP_TASK, - base::Bind(&NotifyTaskFinished)); + base::BindOnce(&NotifyTaskFinished)); task_runner_->RunUntilIdle(); controller_->OnStopScheduledTask(DownloadTaskType::CLEANUP_TASK); @@ -1025,7 +1027,7 @@ base::Time now = base::Time::Now(); done_dentry.completion_time = now; - long start_time = 0; + int64_t start_time = 0; EXPECT_CALL(*task_scheduler_, ScheduleTask(DownloadTaskType::CLEANUP_TASK, _, _, _, _, _)) .WillOnce(SaveArg<4>(&start_time)); @@ -1889,7 +1891,7 @@ // Simulate a task start, which should limit our calls to Reschedule() because // we are in a task. controller_->OnStartScheduledTask(DownloadTaskType::DOWNLOAD_TASK, - base::Bind(&NotifyTaskFinished)); + base::BindOnce(&NotifyTaskFinished)); // Set up new expectations to start a new download. ON_CALL(*scheduler_, Next(_, _)) @@ -1954,7 +1956,7 @@ ScheduleTask(DownloadTaskType::CLEANUP_TASK, _, _, _, _, _)) .Times(0); controller_->OnStartScheduledTask(DownloadTaskType::CLEANUP_TASK, - base::Bind(&NotifyTaskFinished)); + base::BindOnce(&NotifyTaskFinished)); // Trigger download succeed events, which should not schedule a cleanup until // the existing cleanup has finished.
diff --git a/components/download/internal/background_service/download_service_impl.cc b/components/download/internal/background_service/download_service_impl.cc index 3ed181b..9ea5ff7 100644 --- a/components/download/internal/background_service/download_service_impl.cc +++ b/components/download/internal/background_service/download_service_impl.cc
@@ -4,6 +4,8 @@ #include "components/download/internal/background_service/download_service_impl.h" +#include <utility> + #include "base/bind.h" #include "base/strings/string_util.h" #include "components/download/internal/background_service/controller.h" @@ -31,17 +33,16 @@ return service_config_; } -void DownloadServiceImpl::OnStartScheduledTask( - DownloadTaskType task_type, - const TaskFinishedCallback& callback) { +void DownloadServiceImpl::OnStartScheduledTask(DownloadTaskType task_type, + TaskFinishedCallback callback) { if (startup_completed_) { - controller_->OnStartScheduledTask(task_type, callback); + controller_->OnStartScheduledTask(task_type, std::move(callback)); return; } - pending_tasks_[task_type] = - base::Bind(&Controller::OnStartScheduledTask, - base::Unretained(controller_.get()), task_type, callback); + pending_tasks_[task_type] = base::BindOnce( + &Controller::OnStartScheduledTask, base::Unretained(controller_.get()), + task_type, base::Passed(&callback)); } bool DownloadServiceImpl::OnStopScheduledTask(DownloadTaskType task_type) { @@ -53,7 +54,7 @@ if (iter != pending_tasks_.end()) { // We still need to run the callback in order to properly cleanup and notify // the system by running the respective task finished callbacks. - iter->second.Run(); + std::move(iter->second).Run(); pending_tasks_.erase(iter); } @@ -81,9 +82,9 @@ if (startup_completed_) { controller_->StartDownload(download_params); } else { - pending_actions_.push_back(base::Bind(&Controller::StartDownload, - base::Unretained(controller_.get()), - download_params)); + pending_actions_.push_back( + base::BindOnce(&Controller::StartDownload, + base::Unretained(controller_.get()), download_params)); } } @@ -93,7 +94,7 @@ if (startup_completed_) { controller_->PauseDownload(guid); } else { - pending_actions_.push_back(base::Bind( + pending_actions_.push_back(base::BindOnce( &Controller::PauseDownload, base::Unretained(controller_.get()), guid)); } } @@ -104,9 +105,9 @@ if (startup_completed_) { controller_->ResumeDownload(guid); } else { - pending_actions_.push_back(base::Bind(&Controller::ResumeDownload, - base::Unretained(controller_.get()), - guid)); + pending_actions_.push_back( + base::BindOnce(&Controller::ResumeDownload, + base::Unretained(controller_.get()), guid)); } } @@ -116,9 +117,9 @@ if (startup_completed_) { controller_->CancelDownload(guid); } else { - pending_actions_.push_back(base::Bind(&Controller::CancelDownload, - base::Unretained(controller_.get()), - guid)); + pending_actions_.push_back( + base::BindOnce(&Controller::CancelDownload, + base::Unretained(controller_.get()), guid)); } } @@ -130,9 +131,9 @@ if (startup_completed_) { controller_->ChangeDownloadCriteria(guid, params); } else { - pending_actions_.push_back(base::Bind(&Controller::ChangeDownloadCriteria, - base::Unretained(controller_.get()), - guid, params)); + pending_actions_.push_back( + base::BindOnce(&Controller::ChangeDownloadCriteria, + base::Unretained(controller_.get()), guid, params)); } } @@ -142,14 +143,14 @@ void DownloadServiceImpl::OnControllerInitialized() { while (!pending_actions_.empty()) { - auto callback = pending_actions_.front(); - callback.Run(); + auto callback = std::move(pending_actions_.front()); pending_actions_.pop_front(); + std::move(callback).Run(); } while (!pending_tasks_.empty()) { auto iter = pending_tasks_.begin(); - iter->second.Run(); + std::move(iter->second).Run(); pending_tasks_.erase(iter); }
diff --git a/components/download/internal/background_service/download_service_impl.h b/components/download/internal/background_service/download_service_impl.h index 888bcd93..b99b3f1 100644 --- a/components/download/internal/background_service/download_service_impl.h +++ b/components/download/internal/background_service/download_service_impl.h
@@ -34,7 +34,7 @@ // DownloadService implementation. const ServiceConfig& GetConfig() override; void OnStartScheduledTask(DownloadTaskType task_type, - const TaskFinishedCallback& callback) override; + TaskFinishedCallback callback) override; bool OnStopScheduledTask(DownloadTaskType task_type) override; ServiceStatus GetStatus() override; void StartDownload(const DownloadParams& download_params) override; @@ -56,8 +56,8 @@ std::unique_ptr<Controller> controller_; ServiceConfigImpl service_config_; - base::circular_deque<base::Closure> pending_actions_; - std::map<DownloadTaskType, base::Closure> pending_tasks_; + base::circular_deque<base::OnceClosure> pending_actions_; + std::map<DownloadTaskType, base::OnceClosure> pending_tasks_; bool startup_completed_; DISALLOW_COPY_AND_ASSIGN(DownloadServiceImpl);
diff --git a/components/download/internal/background_service/empty_task_scheduler.cc b/components/download/internal/background_service/empty_task_scheduler.cc index 79faee5..445d622 100644 --- a/components/download/internal/background_service/empty_task_scheduler.cc +++ b/components/download/internal/background_service/empty_task_scheduler.cc
@@ -14,8 +14,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) {} + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) {} void EmptyTaskScheduler::CancelTask(DownloadTaskType task_type) {}
diff --git a/components/download/internal/background_service/empty_task_scheduler.h b/components/download/internal/background_service/empty_task_scheduler.h index df32d19..814ade7 100644 --- a/components/download/internal/background_service/empty_task_scheduler.h +++ b/components/download/internal/background_service/empty_task_scheduler.h
@@ -5,9 +5,10 @@ #ifndef COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_EMPTY_TASK_SCHEDULER_H_ #define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_EMPTY_TASK_SCHEDULER_H_ -#include "components/download/public/background_service/task_scheduler.h" +#include <stdint.h> #include "base/macros.h" +#include "components/download/public/background_service/task_scheduler.h" namespace download { @@ -23,8 +24,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) override; + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) override; void CancelTask(DownloadTaskType task_type) override; DISALLOW_COPY_AND_ASSIGN(EmptyTaskScheduler);
diff --git a/components/download/internal/background_service/scheduler/scheduler_impl_unittest.cc b/components/download/internal/background_service/scheduler/scheduler_impl_unittest.cc index d39cfc3..10b5fafe 100644 --- a/components/download/internal/background_service/scheduler/scheduler_impl_unittest.cc +++ b/components/download/internal/background_service/scheduler/scheduler_impl_unittest.cc
@@ -4,6 +4,7 @@ #include "components/download/internal/background_service/scheduler/scheduler_impl.h" +#include <stdint.h> #include <memory> #include "base/strings/string_number_conversions.h" @@ -26,7 +27,7 @@ ~MockTaskScheduler() override = default; MOCK_METHOD6(ScheduleTask, - void(DownloadTaskType, bool, bool, int, long, long)); + void(DownloadTaskType, bool, bool, int, int64_t, int64_t)); MOCK_METHOD1(CancelTask, void(DownloadTaskType)); };
diff --git a/components/download/internal/background_service/test/mock_controller.h b/components/download/internal/background_service/test/mock_controller.h index 33053d9..5de4983 100644 --- a/components/download/internal/background_service/test/mock_controller.h +++ b/components/download/internal/background_service/test/mock_controller.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_TEST_MOCK_CONTROLLER_H_ #define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_TEST_MOCK_CONTROLLER_H_ +#include <string> + #include "base/macros.h" #include "components/download/internal/background_service/controller.h" #include "components/download/internal/background_service/startup_status.h" @@ -30,7 +32,7 @@ void(const std::string&, const SchedulingParams&)); MOCK_METHOD1(GetOwnerOfDownload, DownloadClient(const std::string&)); MOCK_METHOD2(OnStartScheduledTask, - void(DownloadTaskType, const TaskFinishedCallback&)); + void(DownloadTaskType, TaskFinishedCallback)); MOCK_METHOD1(OnStopScheduledTask, bool(DownloadTaskType task_type)); void TriggerInitCompleted();
diff --git a/components/download/internal/common/download_db_cache.cc b/components/download/internal/common/download_db_cache.cc index 69cab6b..b514e4e 100644 --- a/components/download/internal/common/download_db_cache.cc +++ b/components/download/internal/common/download_db_cache.cc
@@ -134,7 +134,7 @@ return; } - std::unique_ptr<std::vector<DownloadDBEntry>> entries; + auto entries = std::make_unique<std::vector<DownloadDBEntry>>(); for (auto it = entries_.begin(); it != entries_.end(); ++it) { entries->emplace_back(it->second); }
diff --git a/components/download/internal/common/in_progress_download_manager.cc b/components/download/internal/common/in_progress_download_manager.cc index 1d1017f..cd9c07ee 100644 --- a/components/download/internal/common/in_progress_download_manager.cc +++ b/components/download/internal/common/in_progress_download_manager.cc
@@ -484,8 +484,11 @@ void InProgressDownloadManager::OnInitialized( std::unique_ptr<std::vector<DownloadDBEntry>> entries) { - for (const auto& entry : *entries) - in_progress_downloads_.emplace_back(CreateDownloadItemImpl(this, entry)); + for (const auto& entry : *entries) { + auto item = CreateDownloadItemImpl(this, entry); + item->AddObserver(download_db_cache_.get()); + in_progress_downloads_.emplace_back(std::move(item)); + } is_initialized_ = true; for (auto& callback : on_initialized_callbacks_) std::move(*callback).Run();
diff --git a/components/download/public/background_service/download_service.h b/components/download/public/background_service/download_service.h index 91793af5..736666e0 100644 --- a/components/download/public/background_service/download_service.h +++ b/components/download/public/background_service/download_service.h
@@ -25,7 +25,7 @@ struct DownloadParams; struct SchedulingParams; -using TaskFinishedCallback = base::Callback<void(bool)>; +using TaskFinishedCallback = base::OnceCallback<void(bool)>; // A service responsible for helping facilitate the scheduling and downloading // of file content from the web. See |DownloadParams| for more details on the @@ -62,7 +62,7 @@ // or OnStopScheduledTask is invoked by the system. Do not call this method // directly. virtual void OnStartScheduledTask(DownloadTaskType task_type, - const TaskFinishedCallback& callback) = 0; + TaskFinishedCallback callback) = 0; // Callback method to run by the service if the system decides to stop the // task. Returns true if the task needs to be rescheduled. Any pending
diff --git a/components/download/public/background_service/task_scheduler.h b/components/download/public/background_service/task_scheduler.h index 26afbf49..409af4b 100644 --- a/components/download/public/background_service/task_scheduler.h +++ b/components/download/public/background_service/task_scheduler.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_TASK_SCHEDULER_H_ #define COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_TASK_SCHEDULER_H_ +#include <stdint.h> + #include "components/download/public/background_service/download_task_types.h" namespace download { @@ -23,8 +25,8 @@ bool require_unmetered_network, bool require_charging, int optimal_battery_percentage, - long window_start_time_seconds, - long window_end_time_seconds) = 0; + int64_t window_start_time_seconds, + int64_t window_end_time_seconds) = 0; // Cancels a pre-scheduled task of type |task_type|. virtual void CancelTask(DownloadTaskType task_type) = 0;
diff --git a/components/download/public/background_service/test/mock_download_service.h b/components/download/public/background_service/test/mock_download_service.h index 7bf3efd..babbde77 100644 --- a/components/download/public/background_service/test/mock_download_service.h +++ b/components/download/public/background_service/test/mock_download_service.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_TEST_MOCK_DOWNLOAD_SERVICE_H_ #define COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_TEST_MOCK_DOWNLOAD_SERVICE_H_ +#include <string> + #include "base/macros.h" #include "components/download/public/background_service/download_params.h" #include "components/download/public/background_service/download_service.h" @@ -22,8 +24,7 @@ // DownloadService implementation. MOCK_METHOD0(GetConfig, const ServiceConfig&()); MOCK_METHOD2(OnStartScheduledTask, - void(DownloadTaskType task_type, - const TaskFinishedCallback& callback)); + void(DownloadTaskType task_type, TaskFinishedCallback callback)); MOCK_METHOD1(OnStopScheduledTask, bool(DownloadTaskType task_type)); MOCK_METHOD0(GetStatus, ServiceStatus()); MOCK_METHOD1(StartDownload, void(const DownloadParams& download_params));
diff --git a/components/download/public/background_service/test/test_download_service.cc b/components/download/public/background_service/test/test_download_service.cc index b3ecbb6f..b2cd8516 100644 --- a/components/download/public/background_service/test/test_download_service.cc +++ b/components/download/public/background_service/test/test_download_service.cc
@@ -4,8 +4,6 @@ #include "components/download/public/background_service/test/test_download_service.h" -#include <memory> - #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" #include "components/download/public/background_service/client.h" @@ -55,9 +53,8 @@ return *service_config_; } -void TestDownloadService::OnStartScheduledTask( - DownloadTaskType task_type, - const TaskFinishedCallback& callback) {} +void TestDownloadService::OnStartScheduledTask(DownloadTaskType task_type, + TaskFinishedCallback callback) {} bool TestDownloadService::OnStopScheduledTask(DownloadTaskType task_type) { return true;
diff --git a/components/download/public/background_service/test/test_download_service.h b/components/download/public/background_service/test/test_download_service.h index 0c6002c0..19880c5 100644 --- a/components/download/public/background_service/test/test_download_service.h +++ b/components/download/public/background_service/test/test_download_service.h
@@ -6,6 +6,8 @@ #define COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_TEST_TEST_DOWNLOAD_SERVICE_H_ #include <list> +#include <memory> +#include <string> #include "base/optional.h" #include "components/download/public/background_service/client.h" @@ -21,13 +23,13 @@ // Implementation of DownloadService used for testing. class TestDownloadService : public DownloadService { public: - explicit TestDownloadService(); + TestDownloadService(); ~TestDownloadService() override; // DownloadService implementation. const ServiceConfig& GetConfig() override; void OnStartScheduledTask(DownloadTaskType task_type, - const TaskFinishedCallback& callback) override; + TaskFinishedCallback callback) override; bool OnStopScheduledTask(DownloadTaskType task_type) override; DownloadService::ServiceStatus GetStatus() override; void StartDownload(const DownloadParams& download_params) override;
diff --git a/components/invalidation/impl/gcm_network_channel.cc b/components/invalidation/impl/gcm_network_channel.cc index fce5c31..7137da9 100644 --- a/components/invalidation/impl/gcm_network_channel.cc +++ b/components/invalidation/impl/gcm_network_channel.cc
@@ -22,8 +22,9 @@ #include "net/base/load_flags.h" #include "net/http/http_status_code.h" #include "net/traffic_annotation/network_traffic_annotation.h" -#include "net/url_request/url_fetcher.h" -#include "net/url_request/url_request_status.h" +#include "services/network/public/cpp/resource_request.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/simple_url_loader.h" #if !defined(OS_ANDROID) // channel_common.proto defines ANDROID constant that conflicts with Android @@ -113,9 +114,9 @@ } // namespace GCMNetworkChannel::GCMNetworkChannel( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, std::unique_ptr<GCMNetworkChannelDelegate> delegate) - : request_context_getter_(request_context_getter), + : url_loader_factory_(std::move(url_loader_factory)), delegate_(std::move(delegate)), register_backoff_entry_(new net::BackoffEntry(&kRegisterBackoffPolicy)), gcm_channel_online_(false), @@ -256,46 +257,55 @@ "features that depend on it. It makes sense to control top level " "features that use InvalidationService." })"); - fetcher_ = - net::URLFetcher::Create(BuildUrl(registration_id_), net::URLFetcher::POST, - this, traffic_annotation); - data_use_measurement::DataUseUserData::AttachToFetcher( - fetcher_.get(), data_use_measurement::DataUseUserData::INVALIDATION); - fetcher_->SetRequestContext(request_context_getter_.get()); - fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | - net::LOAD_DO_NOT_SAVE_COOKIES); - const std::string auth_header("Authorization: Bearer " + access_token_); - fetcher_->AddExtraRequestHeader(auth_header); + + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = BuildUrl(registration_id_); + resource_request->load_flags = + net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES; + resource_request->method = "POST"; + resource_request->headers.SetHeader(net::HttpRequestHeaders::kAuthorization, + "Bearer " + access_token_); if (!echo_token_.empty()) { - const std::string echo_header("echo-token: " + echo_token_); - fetcher_->AddExtraRequestHeader(echo_header); + resource_request->headers.SetHeader("echo-token", echo_token_); } - fetcher_->SetUploadData("application/x-protobuffer", cached_message_); - fetcher_->Start(); + simple_url_loader_ = network::SimpleURLLoader::Create( + std::move(resource_request), traffic_annotation); + simple_url_loader_->AttachStringForUpload(cached_message_, + "application/x-protobuffer"); + // TODO(https://crbug.com/808498): Re-add data use measurement once + // SimpleURLLoader supports it. + // ID=data_use_measurement::DataUseUserData::INVALIDATION + simple_url_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie( + url_loader_factory_.get(), + base::BindOnce(&GCMNetworkChannel::OnSimpleLoaderComplete, + base::Unretained(this))); // Clear message to prevent accidentally resending it in the future. cached_message_.clear(); } -void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { +void GCMNetworkChannel::OnSimpleLoaderComplete( + std::unique_ptr<std::string> response_body) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_EQ(fetcher_.get(), source); - // Free fetcher at the end of function. - std::unique_ptr<net::URLFetcher> fetcher = std::move(fetcher_); - net::URLRequestStatus status = fetcher->GetStatus(); + int net_error = simple_url_loader_->NetError(); + bool is_success = (net_error == net::OK); + int response_code = -1; + if (simple_url_loader_->ResponseInfo() && + simple_url_loader_->ResponseInfo()->headers) { + response_code = + simple_url_loader_->ResponseInfo()->headers->response_code(); + } + simple_url_loader_.reset(); diagnostic_info_.last_post_response_code_ = - status.is_success() ? source->GetResponseCode() : status.error(); + (response_code / 100 != 2 || is_success) ? response_code : net_error; - if (status.is_success() && - fetcher->GetResponseCode() == net::HTTP_UNAUTHORIZED) { - DVLOG(1) << "URLFetcher failure: HTTP_UNAUTHORIZED"; + if (response_code == net::HTTP_UNAUTHORIZED) { + DVLOG(1) << "SimpleURLLoader failure: HTTP_UNAUTHORIZED"; delegate_->InvalidateToken(access_token_); } - if (!status.is_success() || - (fetcher->GetResponseCode() != net::HTTP_OK && - fetcher->GetResponseCode() != net::HTTP_NO_CONTENT)) { - DVLOG(1) << "URLFetcher failure"; + if (!response_body) { + DVLOG(1) << "SimpleURLLoader failure"; RecordOutgoingMessageStatus(POST_FAILURE); // POST failed. Notify that http channel doesn't work. UpdateHttpChannelState(false); @@ -305,7 +315,7 @@ RecordOutgoingMessageStatus(OUTGOING_MESSAGE_SUCCESS); // Successfully sent message. Http channel works. UpdateHttpChannelState(true); - DVLOG(2) << "URLFetcher success"; + DVLOG(2) << "SimpleURLLoader success"; } void GCMNetworkChannel::OnIncomingMessage(const std::string& message,
diff --git a/components/invalidation/impl/gcm_network_channel.h b/components/invalidation/impl/gcm_network_channel.h index f82bb0e..09c29b5 100644 --- a/components/invalidation/impl/gcm_network_channel.h +++ b/components/invalidation/impl/gcm_network_channel.h
@@ -16,11 +16,15 @@ #include "components/invalidation/public/invalidation_export.h" #include "net/base/backoff_entry.h" #include "net/base/network_change_notifier.h" -#include "net/url_request/url_fetcher_delegate.h" #include "url/gurl.h" class GoogleServiceAuthError; +namespace network { +class SharedURLLoaderFactory; +class SimpleURLLoader; +} // namespace network + namespace syncer { class GCMNetworkChannel; @@ -48,11 +52,10 @@ // messages through GCMService. class INVALIDATION_EXPORT GCMNetworkChannel : public SyncNetworkChannel, - public net::URLFetcherDelegate, public net::NetworkChangeNotifier::NetworkChangeObserver { public: GCMNetworkChannel( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, std::unique_ptr<GCMNetworkChannelDelegate> delegate); ~GCMNetworkChannel() override; @@ -69,9 +72,6 @@ void RequestDetailedStatus( base::Callback<void(const base::DictionaryValue&)> callback) override; - // URLFetcherDelegate implementation. - void OnURLFetchComplete(const net::URLFetcher* source) override; - // NetworkChangeObserver implementation. void OnNetworkChanged( net::NetworkChangeNotifier::ConnectionType connection_type) override; @@ -97,7 +97,10 @@ void UpdateGcmChannelState(bool online); void UpdateHttpChannelState(bool online); - scoped_refptr<net::URLRequestContextGetter> request_context_getter_; + // Callback is called when |simple_url_loader_| completes a network request. + void OnSimpleLoaderComplete(std::unique_ptr<std::string> response_body); + + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; std::unique_ptr<GCMNetworkChannelDelegate> delegate_; // Message is saved until all conditions are met: there is valid @@ -113,7 +116,7 @@ std::string registration_id_; std::unique_ptr<net::BackoffEntry> register_backoff_entry_; - std::unique_ptr<net::URLFetcher> fetcher_; + std::unique_ptr<network::SimpleURLLoader> simple_url_loader_; // cacheinvalidation client receives echo_token with incoming message from // GCM and shuld include it in headers with outgoing message over http.
diff --git a/components/invalidation/impl/gcm_network_channel_unittest.cc b/components/invalidation/impl/gcm_network_channel_unittest.cc index 51b69a6..4432980 100644 --- a/components/invalidation/impl/gcm_network_channel_unittest.cc +++ b/components/invalidation/impl/gcm_network_channel_unittest.cc
@@ -11,16 +11,22 @@ #include "base/run_loop.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" +#include "base/test/bind_test_util.h" #include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "google_apis/gaia/google_service_auth_error.h" -#include "net/url_request/test_url_fetcher_factory.h" -#include "net/url_request/url_request_test_util.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { +namespace { +const char kURL[] = "http://test.url.com/"; +} + class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate { public: TestGCMNetworkChannelDelegate() @@ -86,9 +92,9 @@ class TestGCMNetworkChannel : public GCMNetworkChannel { public: TestGCMNetworkChannel( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, std::unique_ptr<GCMNetworkChannelDelegate> delegate) - : GCMNetworkChannel(request_context_getter, std::move(delegate)) { + : GCMNetworkChannel(std::move(url_loader_factory), std::move(delegate)) { ResetRegisterBackoffEntryForTest(&kTestBackoffPolicy); } @@ -96,62 +102,43 @@ // On Android GCMNetworkChannel::BuildUrl hits NOTREACHED(). I still want // tests to run. GURL BuildUrl(const std::string& registration_id) override { - return GURL("http://test.url.com"); + return GURL(kURL); } }; class GCMNetworkChannelTest; -// Test needs to capture setting echo-token header on http request. -// This class is going to do that. -class TestNetworkChannelURLFetcher : public net::FakeURLFetcher { - public: - TestNetworkChannelURLFetcher(GCMNetworkChannelTest* test, - const GURL& url, - net::URLFetcherDelegate* delegate, - const std::string& response_data, - net::HttpStatusCode response_code, - net::URLRequestStatus::Status status) - : net::FakeURLFetcher(url, - delegate, - response_data, - response_code, - status), - test_(test) {} - - void AddExtraRequestHeader(const std::string& header_line) override; - - private: - GCMNetworkChannelTest* test_; -}; - class GCMNetworkChannelTest : public ::testing::Test, public SyncNetworkChannel::Observer { public: GCMNetworkChannelTest() : delegate_(nullptr), - url_fetchers_created_count_(0), - last_invalidator_state_(TRANSIENT_INVALIDATION_ERROR) {} + last_invalidator_state_(TRANSIENT_INVALIDATION_ERROR), + test_shared_loader_factory_( + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &test_url_loader_factory_)) {} ~GCMNetworkChannelTest() override {} void SetUp() override { - request_context_getter_ = new net::TestURLRequestContextGetter( - base::ThreadTaskRunnerHandle::Get()); + network_request_count_ = 0; + test_url_loader_factory()->SetInterceptor(base::BindLambdaForTesting( + [&](const network::ResourceRequest& request) { + EXPECT_EQ(kURL, request.url); + ++network_request_count_; + request.headers.GetHeader("echo-token", &last_echo_token_); + })); // Ownership of delegate goes to GCNMentworkChannel but test needs pointer // to it. delegate_ = new TestGCMNetworkChannelDelegate(); std::unique_ptr<GCMNetworkChannelDelegate> delegate(delegate_); gcm_network_channel_.reset(new TestGCMNetworkChannel( - request_context_getter_, std::move(delegate))); + test_shared_loader_factory_, std::move(delegate))); gcm_network_channel_->AddObserver(this); gcm_network_channel_->SetMessageReceiver( invalidation::NewPermanentCallback( this, &GCMNetworkChannelTest::OnIncomingMessage)); - url_fetcher_factory_.reset(new net::FakeURLFetcherFactory( - nullptr, base::Bind(&GCMNetworkChannelTest::CreateURLFetcher, - base::Unretained(this)))); } void TearDown() override { gcm_network_channel_->RemoveObserver(this); } @@ -176,38 +163,20 @@ return delegate_; } - int url_fetchers_created_count() { - return url_fetchers_created_count_; - } - - net::FakeURLFetcherFactory* url_fetcher_factory() { - return url_fetcher_factory_.get(); - } - - std::unique_ptr<net::FakeURLFetcher> CreateURLFetcher( - const GURL& url, - net::URLFetcherDelegate* delegate, - const std::string& response_data, - net::HttpStatusCode response_code, - net::URLRequestStatus::Status status) { - ++url_fetchers_created_count_; - return std::unique_ptr<net::FakeURLFetcher>( - new TestNetworkChannelURLFetcher(this, url, delegate, response_data, - response_code, status)); - } - - void set_last_echo_token(const std::string& echo_token) { - last_echo_token_ = echo_token; - } - const std::string& get_last_echo_token() { return last_echo_token_; } + int get_network_request_count() { return network_request_count_; } + InvalidatorState get_last_invalidator_state() { return last_invalidator_state_; } + network::TestURLLoaderFactory* test_url_loader_factory() { + return &test_url_loader_factory_; + } + void RunLoopUntilIdle() { base::RunLoop run_loop; run_loop.RunUntilIdle(); @@ -217,34 +186,17 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; TestGCMNetworkChannelDelegate* delegate_; std::unique_ptr<GCMNetworkChannel> gcm_network_channel_; - scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; - std::unique_ptr<net::FakeURLFetcherFactory> url_fetcher_factory_; - int url_fetchers_created_count_; + int network_request_count_; std::string last_echo_token_; InvalidatorState last_invalidator_state_; + network::TestURLLoaderFactory test_url_loader_factory_; + scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; }; -void TestNetworkChannelURLFetcher::AddExtraRequestHeader( - const std::string& header_line) { - net::FakeURLFetcher::AddExtraRequestHeader(header_line); - std::string header_name("echo-token: "); - std::string echo_token; - if (base::StartsWith(header_line, header_name, - base::CompareCase::INSENSITIVE_ASCII)) { - echo_token = header_line; - base::ReplaceFirstSubstringAfterOffset( - &echo_token, 0, header_name, std::string()); - test_->set_last_echo_token(echo_token); - } -} - TEST_F(GCMNetworkChannelTest, HappyCase) { EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state()); EXPECT_FALSE(delegate()->message_callback.is_null()); - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - std::string(), - net::HTTP_NO_CONTENT, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_NO_CONTENT); // Emulate gcm connection state to be online. delegate()->connection_state_callback.Run(true); @@ -257,23 +209,26 @@ // SendMessage should have triggered RequestToken. No HTTP request should be // started yet. EXPECT_FALSE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); // Return valid access token. This should trigger HTTP request. delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); + EXPECT_EQ(INVALIDATIONS_ENABLED, get_last_invalidator_state()); // Return another access token. Message should be cleared by now and shouldn't // be sent. delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token2"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); EXPECT_EQ(INVALIDATIONS_ENABLED, get_last_invalidator_state()); } TEST_F(GCMNetworkChannelTest, FailedRegister) { + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_NO_CONTENT); + // After construction GCMNetworkChannel should have called Register. EXPECT_FALSE(delegate()->register_callback.is_null()); EXPECT_EQ(1, delegate()->register_call_count_); @@ -291,14 +246,11 @@ network_channel()->SendMessage("abra.cadabra"); // SendMessage shouldn't trigger RequestToken. EXPECT_TRUE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(0, url_fetchers_created_count()); + EXPECT_EQ(get_network_request_count(), 0); } TEST_F(GCMNetworkChannelTest, RegisterFinishesAfterSendMessage) { - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - "", - net::HTTP_NO_CONTENT, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_NO_CONTENT); // After construction GCMNetworkChannel should have called Register. EXPECT_FALSE(delegate()->register_callback.is_null()); @@ -306,21 +258,24 @@ network_channel()->SendMessage("abra.cadabra"); // SendMessage shouldn't trigger RequestToken. EXPECT_TRUE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); // Return valid registration id. delegate()->register_callback.Run("registration.id", gcm::GCMClient::SUCCESS); EXPECT_FALSE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); + // Return valid access token. This should trigger HTTP request. delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); } TEST_F(GCMNetworkChannelTest, RequestTokenFailure) { + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_NO_CONTENT); + // After construction GCMNetworkChannel should have called Register. EXPECT_FALSE(delegate()->register_callback.is_null()); // Return valid registration id. @@ -330,21 +285,18 @@ // SendMessage should have triggered RequestToken. No HTTP request should be // started yet. EXPECT_FALSE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); // RequestToken returns failure. delegate()->request_token_callback.Run( GoogleServiceAuthError::FromConnectionError(1), ""); // Should be no HTTP requests. - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); } TEST_F(GCMNetworkChannelTest, AuthErrorFromServer) { // Setup fake response to return AUTH_ERROR. - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - "", - net::HTTP_UNAUTHORIZED, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_UNAUTHORIZED); // After construction GCMNetworkChannel should have called Register. EXPECT_FALSE(delegate()->register_callback.is_null()); @@ -355,12 +307,12 @@ // SendMessage should have triggered RequestToken. No HTTP request should be // started yet. EXPECT_FALSE(delegate()->request_token_callback.is_null()); - EXPECT_EQ(url_fetchers_created_count(), 0); + EXPECT_EQ(get_network_request_count(), 0); // Return valid access token. This should trigger HTTP request. delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); EXPECT_EQ(delegate()->invalidated_token, "access.token"); } @@ -384,10 +336,8 @@ TEST_F(GCMNetworkChannelTest, ChannelState) { EXPECT_FALSE(delegate()->message_callback.is_null()); // POST will fail. - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - std::string(), - net::HTTP_SERVICE_UNAVAILABLE, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", + net::HTTP_SERVICE_UNAVAILABLE); delegate()->connection_state_callback.Run(true); delegate()->register_callback.Run("registration.id", gcm::GCMClient::SUCCESS); @@ -397,21 +347,18 @@ delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); // Failing HTTP POST should cause TRANSIENT_INVALIDATION_ERROR. EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, get_last_invalidator_state()); // Setup POST to succeed. - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - "", - net::HTTP_NO_CONTENT, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_NO_CONTENT); network_channel()->SendMessage("abra.cadabra"); EXPECT_FALSE(delegate()->request_token_callback.is_null()); delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 2); + EXPECT_EQ(get_network_request_count(), 2); // Successful post should set invalidator state to enabled. EXPECT_EQ(INVALIDATIONS_ENABLED, get_last_invalidator_state()); // Network changed event shouldn't affect invalidator state. @@ -441,10 +388,7 @@ } TEST_F(GCMNetworkChannelTest, EchoToken) { - url_fetcher_factory()->SetFakeResponse(GURL("http://test.url.com"), - std::string(), - net::HTTP_OK, - net::URLRequestStatus::SUCCESS); + test_url_loader_factory()->AddResponse(kURL, "", net::HTTP_OK); // After construction GCMNetworkChannel should have called Register. // Return valid registration id. delegate()->register_callback.Run("registration.id", gcm::GCMClient::SUCCESS); @@ -454,7 +398,7 @@ delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 1); + EXPECT_EQ(get_network_request_count(), 1); EXPECT_TRUE(get_last_echo_token().empty()); // Trigger response. @@ -465,7 +409,7 @@ delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 2); + EXPECT_EQ(get_network_request_count(), 2); EXPECT_EQ("echo.token", get_last_echo_token()); // Trigger response with empty echo token. @@ -476,7 +420,7 @@ delegate()->request_token_callback.Run( GoogleServiceAuthError::AuthErrorNone(), "access.token"); RunLoopUntilIdle(); - EXPECT_EQ(url_fetchers_created_count(), 3); + EXPECT_EQ(get_network_request_count(), 3); // Echo_token should be from second message. EXPECT_EQ("echo.token", get_last_echo_token()); }
diff --git a/components/invalidation/impl/non_blocking_invalidator.cc b/components/invalidation/impl/non_blocking_invalidator.cc index 8bcb8ecc..def0460 100644 --- a/components/invalidation/impl/non_blocking_invalidator.cc +++ b/components/invalidation/impl/non_blocking_invalidator.cc
@@ -20,6 +20,7 @@ #include "components/invalidation/public/invalidation_handler.h" #include "components/invalidation/public/object_id_invalidation_map.h" #include "jingle/notifier/listener/push_client.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace syncer { @@ -324,10 +325,11 @@ } NetworkChannelCreator NonBlockingInvalidator::MakeGCMNetworkChannelCreator( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + std::unique_ptr<network::SharedURLLoaderFactoryInfo> + url_loader_factory_info, std::unique_ptr<GCMNetworkChannelDelegate> delegate) { return base::Bind(&SyncNetworkChannel::CreateGCMNetworkChannel, - request_context_getter, + base::Passed(&url_loader_factory_info), base::Passed(&delegate)); }
diff --git a/components/invalidation/impl/non_blocking_invalidator.h b/components/invalidation/impl/non_blocking_invalidator.h index 47c844c..37814aa 100644 --- a/components/invalidation/impl/non_blocking_invalidator.h +++ b/components/invalidation/impl/non_blocking_invalidator.h
@@ -28,6 +28,10 @@ class SingleThreadTaskRunner; } // namespace base +namespace network { +class SharedURLLoaderFactoryInfo; +} // namespace network + namespace syncer { class SyncNetworkChannel; class GCMNetworkChannelDelegate; @@ -72,7 +76,8 @@ static NetworkChannelCreator MakePushClientChannelCreator( const notifier::NotifierOptions& notifier_options); static NetworkChannelCreator MakeGCMNetworkChannelCreator( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + std::unique_ptr<network::SharedURLLoaderFactoryInfo> + url_loader_factory_info, std::unique_ptr<GCMNetworkChannelDelegate> delegate); // These methods are forwarded to the invalidation_state_tracker_.
diff --git a/components/invalidation/impl/sync_system_resources.cc b/components/invalidation/impl/sync_system_resources.cc index e5498e44..cf24cb896 100644 --- a/components/invalidation/impl/sync_system_resources.cc +++ b/components/invalidation/impl/sync_system_resources.cc
@@ -26,6 +26,7 @@ #include "google/cacheinvalidation/deps/callback.h" #include "google/cacheinvalidation/include/types.h" #include "jingle/notifier/listener/push_client.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace syncer { @@ -179,10 +180,14 @@ } std::unique_ptr<SyncNetworkChannel> SyncNetworkChannel::CreateGCMNetworkChannel( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + std::unique_ptr<network::SharedURLLoaderFactoryInfo> + url_loader_factory_info, std::unique_ptr<GCMNetworkChannelDelegate> delegate) { - return std::make_unique<GCMNetworkChannel>(request_context_getter, - std::move(delegate)); + DCHECK(url_loader_factory_info); + return std::make_unique<GCMNetworkChannel>( + network::SharedURLLoaderFactory::Create( + std::move(url_loader_factory_info)), + std::move(delegate)); } void SyncNetworkChannel::NotifyNetworkStatusChange(bool online) {
diff --git a/components/invalidation/impl/sync_system_resources.h b/components/invalidation/impl/sync_system_resources.h index 8a77ec57..eb869b9 100644 --- a/components/invalidation/impl/sync_system_resources.h +++ b/components/invalidation/impl/sync_system_resources.h
@@ -24,6 +24,10 @@ #include "google/cacheinvalidation/include/system-resources.h" #include "jingle/notifier/base/notifier_options.h" +namespace network { +class SharedURLLoaderFactoryInfo; +} // namespace network + namespace syncer { class GCMNetworkChannelDelegate; @@ -135,7 +139,8 @@ static std::unique_ptr<SyncNetworkChannel> CreatePushClientChannel( const notifier::NotifierOptions& notifier_options); static std::unique_ptr<SyncNetworkChannel> CreateGCMNetworkChannel( - scoped_refptr<net::URLRequestContextGetter> request_context_getter, + std::unique_ptr<network::SharedURLLoaderFactoryInfo> + url_loader_factory_info, std::unique_ptr<GCMNetworkChannelDelegate> delegate); // Get the count of how many valid received messages were received.
diff --git a/components/invalidation/impl/ticl_invalidation_service.cc b/components/invalidation/impl/ticl_invalidation_service.cc index b973f049a..03b9d445 100644 --- a/components/invalidation/impl/ticl_invalidation_service.cc +++ b/components/invalidation/impl/ticl_invalidation_service.cc
@@ -20,6 +20,7 @@ #include "components/invalidation/public/object_id_invalidation_map.h" #include "google_apis/gaia/gaia_constants.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" static const char* kOAuth2Scopes[] = { GaiaConstants::kGoogleTalkOAuth2Scope @@ -60,7 +61,8 @@ std::unique_ptr<IdentityProvider> identity_provider, std::unique_ptr<TiclSettingsProvider> settings_provider, gcm::GCMDriver* gcm_driver, - const scoped_refptr<net::URLRequestContextGetter>& request_context) + const scoped_refptr<net::URLRequestContextGetter>& request_context, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) : user_agent_(user_agent), identity_provider_(std::move(identity_provider)), settings_provider_(std::move(settings_provider)), @@ -68,7 +70,8 @@ request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy), network_channel_type_(GCM_NETWORK_CHANNEL), gcm_driver_(gcm_driver), - request_context_(request_context) {} + request_context_(request_context), + url_loader_factory_(std::move(url_loader_factory)) {} TiclInvalidationService::~TiclInvalidationService() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -368,7 +371,8 @@ gcm_driver_, identity_provider_.get())); network_channel_creator = syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( - request_context_, gcm_invalidation_bridge_->CreateDelegate()); + url_loader_factory_->Clone(), + gcm_invalidation_bridge_->CreateDelegate()); break; } default: {
diff --git a/components/invalidation/impl/ticl_invalidation_service.h b/components/invalidation/impl/ticl_invalidation_service.h index 8b18fe13..2c411c91 100644 --- a/components/invalidation/impl/ticl_invalidation_service.h +++ b/components/invalidation/impl/ticl_invalidation_service.h
@@ -31,6 +31,10 @@ class URLRequestContextGetter; } +namespace network { +class SharedURLLoaderFactory; +} + namespace syncer { class InvalidationStateTracker; class Invalidator; @@ -60,7 +64,8 @@ std::unique_ptr<IdentityProvider> identity_provider, std::unique_ptr<TiclSettingsProvider> settings_provider, gcm::GCMDriver* gcm_driver, - const scoped_refptr<net::URLRequestContextGetter>& request_context); + const scoped_refptr<net::URLRequestContextGetter>& request_context, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); ~TiclInvalidationService() override; void Init(std::unique_ptr<syncer::InvalidationStateTracker> @@ -143,6 +148,7 @@ gcm::GCMDriver* gcm_driver_; std::unique_ptr<GCMInvalidationBridge> gcm_invalidation_bridge_; scoped_refptr<net::URLRequestContextGetter> request_context_; + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; // The invalidation logger object we use to record state changes // and invalidations.
diff --git a/components/invalidation/impl/ticl_invalidation_service_unittest.cc b/components/invalidation/impl/ticl_invalidation_service_unittest.cc index cb74060..7ffc97ab 100644 --- a/components/invalidation/impl/ticl_invalidation_service_unittest.cc +++ b/components/invalidation/impl/ticl_invalidation_service_unittest.cc
@@ -22,6 +22,7 @@ #include "components/invalidation/impl/profile_identity_provider.h" #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" namespace invalidation { @@ -70,7 +71,7 @@ "TestUserAgent", std::make_unique<ProfileIdentityProvider>(&token_service_), std::unique_ptr<TiclSettingsProvider>(new FakeTiclSettingsProvider), - gcm_driver_.get(), nullptr)); + gcm_driver_.get(), nullptr, nullptr)); } void InitializeInvalidationService() {
diff --git a/components/invalidation/impl/ticl_profile_settings_provider_unittest.cc b/components/invalidation/impl/ticl_profile_settings_provider_unittest.cc index 0ad4661..f4ffbbcc 100644 --- a/components/invalidation/impl/ticl_profile_settings_provider_unittest.cc +++ b/components/invalidation/impl/ticl_profile_settings_provider_unittest.cc
@@ -23,6 +23,7 @@ #include "components/sync_preferences/testing_pref_service_syncable.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_test_util.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" namespace invalidation { @@ -67,7 +68,7 @@ new ProfileIdentityProvider(&token_service_)), std::unique_ptr<TiclSettingsProvider>( new TiclProfileSettingsProvider(&pref_service_)), - &gcm_driver_, request_context_getter_)); + &gcm_driver_, request_context_getter_, nullptr /* url_loader_factory */)); invalidation_service_->Init(std::unique_ptr<syncer::InvalidationStateTracker>( new syncer::FakeInvalidationStateTracker)); }
diff --git a/components/navigation_interception/intercept_navigation_throttle.cc b/components/navigation_interception/intercept_navigation_throttle.cc index da7f874..020abc93 100644 --- a/components/navigation_interception/intercept_navigation_throttle.cc +++ b/components/navigation_interception/intercept_navigation_throttle.cc
@@ -78,28 +78,40 @@ content::NavigationThrottle::ThrottleCheckResult InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation(bool is_redirect) { - pending_checks_++; if (ShouldCheckAsynchronously()) { + pending_checks_++; ui_task_runner_->PostTask( - FROM_HERE, base::BindOnce(&InterceptNavigationThrottle::RunCheck, + FROM_HERE, base::BindOnce(&InterceptNavigationThrottle::RunCheckAsync, weak_factory_.GetWeakPtr(), GetNavigationParams(is_redirect))); return content::NavigationThrottle::PROCEED; } - RunCheck(GetNavigationParams(is_redirect)); - return should_ignore_ ? content::NavigationThrottle::CANCEL_AND_IGNORE - : content::NavigationThrottle::PROCEED; + // No need to set |should_ignore_| since if it is true, we'll cancel the + // navigation immediately. + return should_ignore_callback_.Run(navigation_handle()->GetWebContents(), + GetNavigationParams(is_redirect)) + ? content::NavigationThrottle::CANCEL_AND_IGNORE + : content::NavigationThrottle::PROCEED; + // Careful, |this| can be deleted at this point. } -void InterceptNavigationThrottle::RunCheck(const NavigationParams& params) { - should_ignore_ |= should_ignore_callback_.Run( - navigation_handle()->GetWebContents(), params); +void InterceptNavigationThrottle::RunCheckAsync( + const NavigationParams& params) { + DCHECK(base::FeatureList::IsEnabled(kAsyncCheck)); DCHECK_GT(pending_checks_, 0); pending_checks_--; - if (!deferring_ || pending_checks_ > 0) + bool final_deferred_check = deferring_ && pending_checks_ == 0; + auto weak_this = weak_factory_.GetWeakPtr(); + bool should_ignore = should_ignore_callback_.Run( + navigation_handle()->GetWebContents(), params); + if (!weak_this) return; - if (should_ignore_) { + should_ignore_ |= should_ignore; + if (!final_deferred_check) + return; + + if (should_ignore) { CancelDeferredNavigation(content::NavigationThrottle::CANCEL_AND_IGNORE); } else { Resume();
diff --git a/components/navigation_interception/intercept_navigation_throttle.h b/components/navigation_interception/intercept_navigation_throttle.h index b7ac2de..0b154bc 100644 --- a/components/navigation_interception/intercept_navigation_throttle.h +++ b/components/navigation_interception/intercept_navigation_throttle.h
@@ -50,7 +50,7 @@ ThrottleCheckResult WillFinish(); ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect); - void RunCheck(const NavigationParams& params); + void RunCheckAsync(const NavigationParams& params); bool ShouldCheckAsynchronously() const; @@ -59,11 +59,14 @@ // This callback should be called at the start of navigation and every // redirect, until |should_ignore_| is true. + // Note: the callback can delete |this|. CheckCallback should_ignore_callback_; // Note that the CheckCallback currently has thread affinity on the Java side. scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + // The remaining members are only set for asynchronous checking. + // // How many outbound pending checks are running. Normally this will be either // 0 or 1, but making this a bool makes too many assumptions about the nature // of Chrome's task queues (e.g. we could be scheduled after the task which
diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc index cbd25b4..d9d493bb 100644 --- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc +++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
@@ -72,20 +72,21 @@ } } - std::unique_ptr<content::NavigationThrottle> CreateThrottle( + static std::unique_ptr<content::NavigationThrottle> CreateThrottle( + InterceptNavigationThrottle::CheckCallback callback, content::NavigationHandle* handle) { - return std::make_unique<InterceptNavigationThrottle>( - handle, base::BindRepeating( - &MockInterceptCallbackReceiver::ShouldIgnoreNavigation, - base::Unretained(mock_callback_receiver_.get()))); + return std::make_unique<InterceptNavigationThrottle>(handle, callback); } std::unique_ptr<content::TestNavigationThrottleInserter> CreateThrottleInserter() { return std::make_unique<content::TestNavigationThrottleInserter>( web_contents(), - base::BindRepeating(&InterceptNavigationThrottleTest::CreateThrottle, - base::Unretained(this))); + base::BindRepeating( + &InterceptNavigationThrottleTest::CreateThrottle, + base::BindRepeating( + &MockInterceptCallbackReceiver::ShouldIgnoreNavigation, + base::Unretained(mock_callback_receiver_.get())))); } NavigationThrottle::ThrottleCheckResult SimulateNavigation( @@ -201,6 +202,35 @@ EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, result); } +// Regression test for https://crbug.com/856737. There is some java code that +// runs in the CheckCallback that can synchronously tear down the navigation +// while the throttle is running. +// TODO(csharrison): We should probably make that code async to avoid these +// sorts of situations. However, it might not be possible if we implement +// WebViewClient#shouldOverrideUrlLoading with this class which can end up +// calling loadUrl() within the callback. See https://crbug.com/794020 for more +// details. +TEST_P(InterceptNavigationThrottleTest, IgnoreCallbackDeletesNavigation) { + NavigateAndCommit(GURL("about:blank")); + + auto ignore_callback = [](content::WebContents* contents, + const NavigationParams& params) { + contents->GetController().GoToIndex(0); + return true; + }; + auto inserter = std::make_unique<content::TestNavigationThrottleInserter>( + web_contents(), + base::BindRepeating(&InterceptNavigationThrottleTest::CreateThrottle, + base::BindRepeating(ignore_callback))); + + // Intercepting a navigation and forcing a synchronous re-navigation should + // not crash. + auto navigation = content::NavigationSimulator::CreateBrowserInitiated( + GURL("https://intercept.test/"), web_contents()); + navigation->Start(); + base::RunLoop().RunUntilIdle(); +} + INSTANTIATE_TEST_CASE_P(, InterceptNavigationThrottleTest, testing::Values(true, false));
diff --git a/components/offline_pages/core/prefetch/test_download_service.cc b/components/offline_pages/core/prefetch/test_download_service.cc index 9b6d5fc0..df0ab3c 100644 --- a/components/offline_pages/core/prefetch/test_download_service.cc +++ b/components/offline_pages/core/prefetch/test_download_service.cc
@@ -78,7 +78,7 @@ void TestDownloadService::OnStartScheduledTask( download::DownloadTaskType task_type, - const download::TaskFinishedCallback& callback) { + download::TaskFinishedCallback callback) { NOTIMPLEMENTED(); } bool TestDownloadService::OnStopScheduledTask(
diff --git a/components/offline_pages/core/prefetch/test_download_service.h b/components/offline_pages/core/prefetch/test_download_service.h index 445d269b..d5ef24dc 100644 --- a/components/offline_pages/core/prefetch/test_download_service.h +++ b/components/offline_pages/core/prefetch/test_download_service.h
@@ -6,6 +6,7 @@ #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_DOWNLOAD_SERVICE_H_ #include <list> +#include <string> #include "base/files/scoped_temp_dir.h" #include "base/optional.h" @@ -19,14 +20,13 @@ // Implementation of DownloadService used for testing. class TestDownloadService : public download::DownloadService { public: - explicit TestDownloadService(); + TestDownloadService(); ~TestDownloadService() override; // DownloadService implementation. const download::ServiceConfig& GetConfig() override; - void OnStartScheduledTask( - download::DownloadTaskType task_type, - const download::TaskFinishedCallback& callback) override; + void OnStartScheduledTask(download::DownloadTaskType task_type, + download::TaskFinishedCallback callback) override; bool OnStopScheduledTask(download::DownloadTaskType task_type) override; DownloadService::ServiceStatus GetStatus() override; void StartDownload(const download::DownloadParams& download_params) override;
diff --git a/components/payments/content/payment_request_state.cc b/components/payments/content/payment_request_state.cc index 6377d67..cb0941cf 100644 --- a/components/payments/content/payment_request_state.cc +++ b/components/payments/content/payment_request_state.cc
@@ -20,6 +20,7 @@ #include "components/payments/content/payment_response_helper.h" #include "components/payments/content/service_worker_payment_instrument.h" #include "components/payments/core/autofill_payment_instrument.h" +#include "components/payments/core/features.h" #include "components/payments/core/journey_logger.h" #include "components/payments/core/payment_instrument.h" #include "components/payments/core/payment_request_data_util.h" @@ -53,7 +54,7 @@ payment_request_delegate_(payment_request_delegate), profile_comparator_(app_locale, *spec), weak_ptr_factory_(this) { - if (base::FeatureList::IsEnabled(features::kServiceWorkerPaymentApps)) { + if (base::FeatureList::IsEnabled(::features::kServiceWorkerPaymentApps)) { get_all_instruments_finished_ = false; ServiceWorkerPaymentAppFactory::GetInstance()->GetAllPaymentApps( web_contents, @@ -415,7 +416,8 @@ // by their respective AutofillPaymentInstrument. const std::vector<autofill::CreditCard*>& cards = personal_data_manager_->GetCreditCardsToSuggest( - /*include_server_cards=*/true); + /*include_server_cards=*/base::FeatureList::IsEnabled( + payments::features::kReturnGooglePayInBasicCard)); for (autofill::CreditCard* card : cards) AddAutofillPaymentInstrument(/*selected=*/false, *card); }
diff --git a/components/payments/core/features.cc b/components/payments/core/features.cc index bda32a2f..5e9a313b3 100644 --- a/components/payments/core/features.cc +++ b/components/payments/core/features.cc
@@ -7,6 +7,9 @@ namespace payments { namespace features { +const base::Feature kReturnGooglePayInBasicCard{ + "ReturnGooglePayInBasicCard", base::FEATURE_ENABLED_BY_DEFAULT}; + #if defined(OS_IOS) const base::Feature kWebPayments{"WebPayments", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/components/payments/core/features.h b/components/payments/core/features.h index 279475c..50e411e 100644 --- a/components/payments/core/features.h +++ b/components/payments/core/features.h
@@ -11,6 +11,9 @@ namespace payments { namespace features { +// Used to control whether Google Pay cards are returned for basic-card. +extern const base::Feature kReturnGooglePayInBasicCard; + #if defined(OS_IOS) // Used to control the state of the Payment Request API feature. extern const base::Feature kWebPayments;
diff --git a/components/translate/core/browser/mock_translate_client.h b/components/translate/core/browser/mock_translate_client.h index 49baf7e..899a248 100644 --- a/components/translate/core/browser/mock_translate_client.h +++ b/components/translate/core/browser/mock_translate_client.h
@@ -53,7 +53,7 @@ void(const LanguageDetectionDetails&)); MOCK_METHOD5(ShowTranslateUI, - void(translate::TranslateStep, + bool(translate::TranslateStep, const std::string&, const std::string&, TranslateErrors::Type,
diff --git a/components/translate/core/browser/translate_browser_metrics.h b/components/translate/core/browser/translate_browser_metrics.h index 219b36e..86f5d0d 100644 --- a/components/translate/core/browser/translate_browser_metrics.h +++ b/components/translate/core/browser/translate_browser_metrics.h
@@ -47,6 +47,8 @@ INITIATION_STATUS_ABORTED_BY_TOO_OFTEN_DENIED, INITIATION_STATUS_ABORTED_BY_MATCHES_PREVIOUS_LANGUAGE, INITIATION_STATUS_CREATE_INFOBAR, + INITIATION_STATUS_SHOW_ICON, + INITIATION_STATUS_SUPPRESS_INFOBAR, // Insert new items here. INITIATION_STATUS_MAX, };
diff --git a/components/translate/core/browser/translate_client.h b/components/translate/core/browser/translate_client.h index 75fb592..541e6ee 100644 --- a/components/translate/core/browser/translate_client.h +++ b/components/translate/core/browser/translate_client.h
@@ -73,8 +73,10 @@ #endif // Called when the embedder should present UI to the user corresponding to the - // user's current |step|. - virtual void ShowTranslateUI(translate::TranslateStep step, + // user's current |step|. Returns false if the method decided not to show the + // UI (e.g. because of TranslateRanker overrides, or same-language + // navigation). + virtual bool ShowTranslateUI(translate::TranslateStep step, const std::string& source_language, const std::string& target_language, TranslateErrors::Type error_type,
diff --git a/components/translate/core/browser/translate_manager.cc b/components/translate/core/browser/translate_manager.cc index 8938a18..0ec4b7e 100644 --- a/components/translate/core/browser/translate_manager.cc +++ b/components/translate/core/browser/translate_manager.cc
@@ -265,29 +265,42 @@ return; } - if (!should_offer_translation) { + // Show the omnibar icon if we've gotten this far. + language_state_.SetTranslateEnabled(true); + TranslateBrowserMetrics::ReportInitiationStatus( + TranslateBrowserMetrics::INITIATION_STATUS_SHOW_ICON); + + // Will be true if we've decided to show the infobar/bubble UI to the user. + bool did_show_ui = false; + + if (should_offer_translation) { + TranslateBrowserMetrics::ReportInitiationStatus( + TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR); + + // If the source language matches the UI language, it means the translation + // prompt is being forced by an experiment. Report this so the count of how + // often it happens can be tracked to suppress the experiment as necessary. + if (language_code == + TranslateDownloadManager::GetLanguageCode( + TranslateDownloadManager::GetInstance()->application_locale())) { + translate_prefs->ReportForceTriggerOnEnglishPages(); + } + + // Prompts the user if they want the page translated. + did_show_ui = translate_client_->ShowTranslateUI( + translate::TRANSLATE_STEP_BEFORE_TRANSLATE, language_code, target_lang, + TranslateErrors::NONE, false); + + } else { TranslateBrowserMetrics::ReportInitiationStatus( TranslateBrowserMetrics::INITIATION_STATUS_ABORTED_BY_RANKER); RecordTranslateEvent(metrics::TranslateEventProto::DISABLED_BY_RANKER); - return; } - TranslateBrowserMetrics::ReportInitiationStatus( - TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR); - - // If the source language matches the UI language, it means the translation - // prompt is being forced by an experiment. Report this so the count of how - // often it happens can be tracked to suppress the experiment as necessary. - if (language_code == - TranslateDownloadManager::GetLanguageCode( - TranslateDownloadManager::GetInstance()->application_locale())) { - translate_prefs->ReportForceTriggerOnEnglishPages(); + if (!did_show_ui) { + TranslateBrowserMetrics::ReportInitiationStatus( + TranslateBrowserMetrics::INITIATION_STATUS_SUPPRESS_INFOBAR); } - - // Prompts the user if they want the page translated. - translate_client_->ShowTranslateUI(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, - language_code, target_lang, - TranslateErrors::NONE, false); } void TranslateManager::TranslatePage(const std::string& original_source_lang, @@ -581,7 +594,6 @@ // the same language as the previous page. In the new UI, // continue offering translation after the user navigates // to another page. - language_state_.SetTranslateEnabled(true); if (!language_state_.HasLanguageChanged() && !ShouldOverrideDecision( metrics::TranslateEventProto::MATCHES_PREVIOUS_LANGUAGE)) {
diff --git a/components/translate/core/browser/translate_manager_unittest.cc b/components/translate/core/browser/translate_manager_unittest.cc index 84a4f61..843b54b1 100644 --- a/components/translate/core/browser/translate_manager_unittest.cc +++ b/components/translate/core/browser/translate_manager_unittest.cc
@@ -104,6 +104,10 @@ namespace testing { +using namespace ::testing; +using namespace base; +using namespace translate::TranslateBrowserMetrics; + class TranslateManagerTest : public ::testing::Test { protected: TranslateManagerTest() @@ -338,6 +342,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); translate_manager_.reset(new translate::TranslateManager( &mock_translate_client_, &mock_translate_ranker_, &mock_language_model_)); @@ -349,9 +355,9 @@ EXPECT_EQ("hi", TranslateManager::GetTargetLanguage( &translate_prefs_, &mock_language_model_, {"en"})); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); } TEST_F(TranslateManagerTest, @@ -372,6 +378,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); translate_manager_.reset(new translate::TranslateManager( &mock_translate_client_, &mock_translate_ranker_, &mock_language_model_)); @@ -406,6 +414,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); translate_manager_.reset(new translate::TranslateManager( &mock_translate_client_, &mock_translate_ranker_, &mock_language_model_)); @@ -416,20 +426,17 @@ network_notifier_.SimulateOnline(); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); // Initiate translation again. No other UI should be shown because the // threshold has been reached. translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectBucketCount( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); - histogram_tester.ExpectBucketCount( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SIMILAR_LANGUAGES, - 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SIMILAR_LANGUAGES, 1), + Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); } TEST_F(TranslateManagerTest, @@ -450,6 +457,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); translate_manager_.reset(new translate::TranslateManager( &mock_translate_client_, &mock_translate_ranker_, &mock_language_model_)); @@ -460,18 +469,18 @@ network_notifier_.SimulateOnline(); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); translate_manager_->TranslatePage("en", "hi", false); // Initiate translation again. The UI should be shown because Translation was // accepted by the user. translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 2); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 2), + Bucket(INITIATION_STATUS_SHOW_ICON, 2))); } TEST_F(TranslateManagerTest, ShouldHonorExperimentRankerEnforcement_Enforce) { @@ -488,6 +497,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); // Simulate that Ranker decides to suppress the translation UI. This should be // honored since "enforce_ranker" is "true" in the experiment params. @@ -503,10 +514,10 @@ EXPECT_EQ("hi", TranslateManager::GetTargetLanguage( &translate_prefs_, &mock_language_model_, {"en"})); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_ABORTED_BY_RANKER, - 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_ABORTED_BY_RANKER, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1), + Bucket(INITIATION_STATUS_SUPPRESS_INFOBAR, 1))); } TEST_F(TranslateManagerTest, @@ -524,6 +535,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); // Simulate that Ranker decides to suppress the translation UI. This should // not be honored since "enforce_ranker" is "true" in the experiment params. @@ -539,9 +552,9 @@ EXPECT_EQ("hi", TranslateManager::GetTargetLanguage( &translate_prefs_, &mock_language_model_, {"en"})); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); } TEST_F(TranslateManagerTest, LanguageAddedToAcceptLanguagesAfterTranslation) { @@ -555,6 +568,8 @@ TranslateAcceptLanguages accept_langugages(&prefs_, accept_languages_prefs); ON_CALL(mock_translate_client_, GetTranslateAcceptLanguages()) .WillByDefault(Return(&accept_langugages)); + ON_CALL(mock_translate_client_, ShowTranslateUI(_, _, _, _, _)) + .WillByDefault(Return(true)); translate_manager_.reset(new translate::TranslateManager( &mock_translate_client_, &mock_translate_ranker_, &mock_language_model_)); @@ -571,9 +586,9 @@ network_notifier_.SimulateOnline(); translate_manager_->InitiateTranslation("en"); - histogram_tester.ExpectUniqueSample( - kInitiationStatusName, - translate::TranslateBrowserMetrics::INITIATION_STATUS_SHOW_INFOBAR, 1); + EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName), + ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 1), + Bucket(INITIATION_STATUS_SHOW_ICON, 1))); translate_manager_->TranslatePage("en", "hi", false);
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index b5cf4a7..14662967 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -1509,6 +1509,11 @@ RunHtmlTest(FILE_PATH_LITERAL("landmark.html")); } +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, + AccessibilityLayoutTableInButton) { + RunHtmlTest(FILE_PATH_LITERAL("layout-table-in-button.html")); +} + IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityLegend) { RunHtmlTest(FILE_PATH_LITERAL("legend.html")); }
diff --git a/content/browser/accessibility/hit_testing_browsertest.cc b/content/browser/accessibility/hit_testing_browsertest.cc index acecaae..1e2e9d69 100644 --- a/content/browser/accessibility/hit_testing_browsertest.cc +++ b/content/browser/accessibility/hit_testing_browsertest.cc
@@ -3,9 +3,11 @@ // found in the LICENSE file. #include "base/logging.h" +#include "build/build_config.h" #include "content/browser/accessibility/browser_accessibility.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/use_zoom_for_dsf_policy.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" @@ -59,6 +61,28 @@ return HitTestAndWaitForResultWithEvent(point, ax::mojom::Event::kHover); } + BrowserAccessibility* TapAndWaitForResult(const gfx::Point& point) { + WebContentsImpl* web_contents = + static_cast<WebContentsImpl*>(shell()->web_contents()); + FrameTree* frame_tree = web_contents->GetFrameTree(); + + AccessibilityNotificationWaiter event_waiter(shell()->web_contents(), + ui::kAXModeComplete, + ax::mojom::Event::kClicked); + for (FrameTreeNode* node : frame_tree->Nodes()) + event_waiter.ListenToAdditionalFrame(node->current_frame_host()); + + SimulateTapAt(shell()->web_contents(), point); + event_waiter.WaitForNotification(); + + RenderFrameHostImpl* target_frame = event_waiter.event_render_frame_host(); + BrowserAccessibilityManager* target_manager = + target_frame->browser_accessibility_manager(); + int event_target_id = event_waiter.event_target_id(); + BrowserAccessibility* hit_node = target_manager->GetFromID(event_target_id); + return hit_node; + } + BrowserAccessibility* CallCachingAsyncHitTest(const gfx::Point& point) { WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); @@ -78,6 +102,18 @@ hover_waiter.WaitForNotification(); return result; } + + RenderWidgetHostImpl* GetRenderWidgetHost() { + return RenderWidgetHostImpl::From(shell() + ->web_contents() + ->GetRenderWidgetHostView() + ->GetRenderWidgetHost()); + } + + void SynchronizeThreads() { + MainThreadFrameObserver observer(GetRenderWidgetHost()); + observer.Wait(); + } }; IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, @@ -129,8 +165,15 @@ // wait for the hover event in response, verifying we hit the // correct object. - // (50, 50) -> "Button" + // (26, 26) -> "Button" BrowserAccessibility* hit_node; + hit_node = HitTestAndWaitForResult(gfx::Point(26, 26)); + ASSERT_TRUE(hit_node != nullptr); + ASSERT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + ASSERT_EQ("Button", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (50, 50) -> "Button" hit_node = HitTestAndWaitForResult(gfx::Point(50, 50)); ASSERT_TRUE(hit_node != nullptr); ASSERT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); @@ -199,42 +242,197 @@ BrowserAccessibility* hit_node; hit_node = CallCachingAsyncHitTest(gfx::Point(50, 50)); ASSERT_TRUE(hit_node != nullptr); - ASSERT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); hit_node = CallCachingAsyncHitTest(gfx::Point(50, 50)); - ASSERT_EQ("Button", + EXPECT_EQ("Button", hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); // (50, 305) -> div in first iframe hit_node = CallCachingAsyncHitTest(gfx::Point(50, 305)); ASSERT_TRUE(hit_node != nullptr); - ASSERT_NE(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); + EXPECT_NE(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); hit_node = CallCachingAsyncHitTest(gfx::Point(50, 305)); - ASSERT_EQ(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); + EXPECT_EQ(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); // (50, 350) -> "Ordinary Button" hit_node = CallCachingAsyncHitTest(gfx::Point(50, 350)); ASSERT_TRUE(hit_node != nullptr); - ASSERT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); hit_node = CallCachingAsyncHitTest(gfx::Point(50, 350)); - ASSERT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); - ASSERT_EQ("Ordinary Button", + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Ordinary Button", hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); // (50, 455) -> "Scrolled Button" hit_node = CallCachingAsyncHitTest(gfx::Point(50, 455)); ASSERT_TRUE(hit_node != nullptr); - ASSERT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); hit_node = CallCachingAsyncHitTest(gfx::Point(50, 455)); - ASSERT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); - ASSERT_EQ("Scrolled Button", + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Scrolled Button", hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); // (50, 505) -> div in second iframe hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); ASSERT_TRUE(hit_node != nullptr); - ASSERT_NE(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); + EXPECT_NE(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); - ASSERT_EQ(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); + EXPECT_EQ(ax::mojom::Role::kGenericContainer, hit_node->GetRole()); } +#if !defined(OS_ANDROID) && !defined(OS_MACOSX) +IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, + HitTestingWithPinchZoom) { + ASSERT_TRUE(embedded_test_server()->Start()); + + NavigateToURL(shell(), GURL(url::kAboutBlankURL)); + + AccessibilityNotificationWaiter waiter(shell()->web_contents(), + ui::kAXModeComplete, + ax::mojom::Event::kLoadComplete); + + const char url_str[] = + "data:text/html," + "<!doctype html>" + "<html>" + "<head><title>Accessibility Test</title>" + "<style>body {margin: 0px;}" + "button {display: block; height: 50px; width: 50px}</style>" + "</head>" + "<body>" + "<button>Button 1</button>" + "<button>Button 2</button>" + "</body></html>"; + + GURL url(url_str); + NavigateToURL(shell(), url); + SynchronizeThreads(); + waiter.WaitForNotification(); + + BrowserAccessibility* hit_node; + + // Use a tap event instead of a hittest to make sure that we are using + // px as input, rather than dips. + + // (10, 10) -> "Button 1" + hit_node = TapAndWaitForResult(gfx::Point(10, 10)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 1", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (60, 60) -> No button there + hit_node = TapAndWaitForResult(gfx::Point(60, 60)); + EXPECT_TRUE(hit_node == nullptr); + + // (10, 60) -> "Button 2" + hit_node = TapAndWaitForResult(gfx::Point(10, 60)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 2", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + content::TestPageScaleObserver scale_observer(shell()->web_contents()); + const gfx::Rect contents_rect = shell()->web_contents()->GetContainerBounds(); + const gfx::Point pinch_position(contents_rect.x(), contents_rect.y()); + SimulateGesturePinchSequence(shell()->web_contents(), pinch_position, 2.0f, + blink::kWebGestureDeviceTouchscreen); + scale_observer.WaitForPageScaleUpdate(); + + // (10, 10) -> "Button 1" + hit_node = TapAndWaitForResult(gfx::Point(10, 10)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 1", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (60, 60) -> "Button 1" + hit_node = TapAndWaitForResult(gfx::Point(60, 60)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 1", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (10, 60) -> "Button 1" + hit_node = TapAndWaitForResult(gfx::Point(10, 60)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 1", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (10, 110) -> "Button 2" + hit_node = TapAndWaitForResult(gfx::Point(10, 110)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 2", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (190, 190) -> "Button 2" + hit_node = TapAndWaitForResult(gfx::Point(90, 190)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button 2", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); +} + +IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, + HitTestingWithPinchZoomAndIframes) { + ASSERT_TRUE(embedded_test_server()->Start()); + + NavigateToURL(shell(), GURL(url::kAboutBlankURL)); + + AccessibilityNotificationWaiter waiter(shell()->web_contents(), + ui::kAXModeComplete, + ax::mojom::Event::kLoadComplete); + + GURL url(embedded_test_server()->GetURL( + "/accessibility/html/iframe-coordinates.html")); + NavigateToURL(shell(), url); + SynchronizeThreads(); + waiter.WaitForNotification(); + + WaitForAccessibilityTreeToContainNodeWithName(shell()->web_contents(), + "Ordinary Button"); + WaitForAccessibilityTreeToContainNodeWithName(shell()->web_contents(), + "Scrolled Button"); + + content::TestPageScaleObserver scale_observer(shell()->web_contents()); + const gfx::Rect contents_rect = shell()->web_contents()->GetContainerBounds(); + const gfx::Point pinch_position(contents_rect.x(), contents_rect.y()); + + SimulateGesturePinchSequence(shell()->web_contents(), pinch_position, 1.25f, + blink::kWebGestureDeviceTouchscreen); + scale_observer.WaitForPageScaleUpdate(); + + BrowserAccessibility* hit_node; + + // (26, 26) -> No button because of pinch. + hit_node = TapAndWaitForResult(gfx::Point(26, 26)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_NE(ax::mojom::Role::kButton, hit_node->GetRole()); + + // (63, 63) -> "Button" + hit_node = TapAndWaitForResult(gfx::Point(63, 63)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Button", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (63, 438) -> "Ordinary Button" + hit_node = TapAndWaitForResult(gfx::Point(63, 438)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Ordinary Button", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); + + // (63, 569) -> "Scrolled Button" + hit_node = TapAndWaitForResult(gfx::Point(63, 569)); + ASSERT_TRUE(hit_node != nullptr); + EXPECT_EQ(ax::mojom::Role::kButton, hit_node->GetRole()); + EXPECT_EQ("Scrolled Button", + hit_node->GetStringAttribute(ax::mojom::StringAttribute::kName)); +} + +#endif // !defined(OS_ANDROID) && !defined(OS_MACOSX) + } // namespace content
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc index 242deb5..d7fe71e 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper.cc +++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -153,7 +153,9 @@ if (base::FeatureList::IsEnabled(features::kMojoSessionStorage)) { mojo_session_state_ = new SessionStorageContextMojo( - mojo_task_runner_, connector, local_partition_path, + mojo_task_runner_, connector, + profile_path.empty() ? base::nullopt + : base::make_optional(local_partition_path), std::string(kSessionStorageDirectory)); }
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc index c928870..bcb4be63 100644 --- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -4108,6 +4108,7 @@ GURL error_url(embedded_test_server()->GetURL("/empty.html")); std::unique_ptr<URLLoaderInterceptor> url_interceptor = SetupRequestFailForURL(error_url); + auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); // Start with a successful navigation to a document. EXPECT_TRUE(NavigateToURL(shell(), url)); @@ -4132,7 +4133,6 @@ EXPECT_EQ(GURL(kUnreachableWebDataURL), error_site_instance->GetSiteURL()); // Verify that the error page process is locked to origin - auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); EXPECT_EQ( GURL(kUnreachableWebDataURL), policy->GetOriginLock(error_site_instance->GetProcess()->GetID())); @@ -4143,6 +4143,10 @@ EXPECT_TRUE(NavigateToURL(shell(), url)); success_site_instance = shell()->web_contents()->GetMainFrame()->GetSiteInstance(); + EXPECT_NE( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); { NavigationHandleObserver observer(shell()->web_contents(), error_url); @@ -4161,6 +4165,11 @@ EXPECT_NE(success_site_instance->GetProcess()->GetID(), error_site_instance->GetProcess()->GetID()); EXPECT_EQ(GURL(kUnreachableWebDataURL), error_site_instance->GetSiteURL()); + + // Verify that the error page process is locked to origin + EXPECT_EQ( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock(error_site_instance->GetProcess()->GetID())); } } @@ -4233,6 +4242,11 @@ new_shell->web_contents()->GetMainFrame()->GetSiteInstance(); EXPECT_NE(main_site_instance, error_site_instance); EXPECT_EQ(GURL(kUnreachableWebDataURL), error_site_instance->GetSiteURL()); + + // Verify that the error page process is locked to origin + EXPECT_EQ(GURL(kUnreachableWebDataURL), + ChildProcessSecurityPolicyImpl::GetInstance()->GetOriginLock( + error_site_instance->GetProcess()->GetID())); } // Test to verify that windows that are not part of the same @@ -4280,6 +4294,12 @@ new_shell->web_contents()->GetSiteInstance())); EXPECT_EQ(shell()->web_contents()->GetSiteInstance()->GetProcess(), new_shell->web_contents()->GetSiteInstance()->GetProcess()); + + // Verify that the process is locked to origin + EXPECT_EQ( + GURL(kUnreachableWebDataURL), + ChildProcessSecurityPolicyImpl::GetInstance()->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); } // Test to verify that reloading an error page once the error condition has @@ -4298,6 +4318,7 @@ NavigationControllerImpl& nav_controller = static_cast<NavigationControllerImpl&>( shell()->web_contents()->GetController()); + auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); // Start with a successful navigation to a document and verify there is // only one entry in session history. @@ -4313,6 +4334,10 @@ EXPECT_EQ( GURL(kUnreachableWebDataURL), shell()->web_contents()->GetMainFrame()->GetSiteInstance()->GetSiteURL()); + EXPECT_EQ( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); // Reload the error page after clearing the error condition, such that the // navigation is successful and verify that no new entry was added to @@ -4328,6 +4353,10 @@ EXPECT_NE( GURL(kUnreachableWebDataURL), shell()->web_contents()->GetMainFrame()->GetSiteInstance()->GetSiteURL()); + EXPECT_NE( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); // Test the same scenario as above, but this time initiated by the // renderer process. @@ -4337,6 +4366,10 @@ EXPECT_EQ( GURL(kUnreachableWebDataURL), shell()->web_contents()->GetMainFrame()->GetSiteInstance()->GetSiteURL()); + EXPECT_EQ( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); url_interceptor.reset(); { @@ -4349,6 +4382,10 @@ EXPECT_NE( GURL(kUnreachableWebDataURL), shell()->web_contents()->GetMainFrame()->GetSiteInstance()->GetSiteURL()); + EXPECT_NE( + GURL(kUnreachableWebDataURL), + policy->GetOriginLock( + shell()->web_contents()->GetSiteInstance()->GetProcess()->GetID())); } // A NavigationThrottle implementation that blocks all outgoing navigation @@ -4406,6 +4443,9 @@ shell()->web_contents()->GetMainFrame()->GetSiteInstance(); EXPECT_TRUE(observer.is_error()); EXPECT_EQ(GURL(kUnreachableWebDataURL), error_site_instance->GetSiteURL()); + EXPECT_EQ(GURL(kUnreachableWebDataURL), + ChildProcessSecurityPolicyImpl::GetInstance()->GetOriginLock( + error_site_instance->GetProcess()->GetID())); EXPECT_FALSE(ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( error_site_instance->GetProcess()->GetID())); }
diff --git a/content/browser/loader/data_pipe_to_source_stream.cc b/content/browser/loader/data_pipe_to_source_stream.cc index 8a5c372..4a3694f 100644 --- a/content/browser/loader/data_pipe_to_source_stream.cc +++ b/content/browser/loader/data_pipe_to_source_stream.cc
@@ -4,6 +4,8 @@ #include "content/browser/loader/data_pipe_to_source_stream.h" +#include <utility> + #include "base/auto_reset.h" #include "net/base/io_buffer.h" @@ -30,7 +32,7 @@ int DataPipeToSourceStream::Read(net::IOBuffer* buf, int buf_size, - const net::CompletionCallback& callback) { + net::CompletionOnceCallback callback) { base::AutoReset<bool>(&inside_read_, true); if (!body_.get()) { @@ -56,7 +58,7 @@ return 0; case MOJO_RESULT_SHOULD_WAIT: // Data is not available yet. - pending_callback_ = callback; + pending_callback_ = std::move(callback); output_buf_ = buf; output_buf_size_ = buf_size; handle_watcher_.ArmOrNotify();
diff --git a/content/browser/loader/data_pipe_to_source_stream.h b/content/browser/loader/data_pipe_to_source_stream.h index e45d248..f77287f 100644 --- a/content/browser/loader/data_pipe_to_source_stream.h +++ b/content/browser/loader/data_pipe_to_source_stream.h
@@ -8,6 +8,7 @@ #include "content/common/content_export.h" #include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/simple_watcher.h" +#include "net/base/completion_once_callback.h" #include "net/filter/source_stream.h" namespace content { @@ -19,7 +20,7 @@ int Read(net::IOBuffer* buf, int buf_size, - const net::CompletionCallback& callback) override; + net::CompletionOnceCallback callback) override; std::string Description() const override; private: @@ -33,7 +34,7 @@ scoped_refptr<net::IOBuffer> output_buf_; int output_buf_size_ = 0; - net::CompletionCallback pending_callback_; + net::CompletionOnceCallback pending_callback_; DISALLOW_COPY_AND_ASSIGN(DataPipeToSourceStream); };
diff --git a/content/browser/media/encrypted_media_browsertest.cc b/content/browser/media/encrypted_media_browsertest.cc index 7096e1e..db7a34ef 100644 --- a/content/browser/media/encrypted_media_browsertest.cc +++ b/content/browser/media/encrypted_media_browsertest.cc
@@ -56,6 +56,7 @@ "video/mp4; codecs=\"vp09.00.10.08.01.02.02.02.00\""; #if BUILDFLAG(USE_PROPRIETARY_CODECS) const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\""; +const char kMp4AacAudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) // EME-specific test results and errors. @@ -63,6 +64,7 @@ const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; const char kDefaultEmePlayer[] = "eme_player.html"; +const char kDefaultMseOnlyEmePlayer[] = "mse_different_containers.html"; // The type of video src used to load media. enum class SrcType { SRC, MSE }; @@ -92,15 +94,14 @@ void TestSimplePlayback(const std::string& encrypted_media, const std::string& media_type) { - RunSimpleEncryptedMediaTest(encrypted_media, media_type, CurrentKeySystem(), - CurrentSourceType()); + RunSimplePlaybackTest(encrypted_media, media_type, CurrentKeySystem(), + CurrentSourceType()); } void TestFrameSizeChange() { - RunEncryptedMediaTest("encrypted_frame_size_change.html", - "frame_size_change-av_enc-v.webm", - kWebMVorbisAudioVp8Video, CurrentKeySystem(), - CurrentSourceType(), media::kEnded); + RunTest("encrypted_frame_size_change.html", + "frame_size_change-av_enc-v.webm", kWebMVorbisAudioVp8Video, + CurrentKeySystem(), CurrentSourceType(), media::kEnded); } void TestConfigChange(ConfigChangeType config_change_type) { @@ -121,12 +122,12 @@ true); } - void RunEncryptedMediaTest(const std::string& html_page, - const std::string& media_file, - const std::string& media_type, - const std::string& key_system, - SrcType src_type, - const std::string& expectation) { + void RunTest(const std::string& html_page, + const std::string& media_file, + const std::string& media_type, + const std::string& key_system, + SrcType src_type, + const std::string& expectation) { base::StringPairs query_params; query_params.emplace_back("mediaFile", media_file); query_params.emplace_back("mediaType", media_type); @@ -136,24 +137,40 @@ RunMediaTestPage(html_page, query_params, expectation, true); } - void RunSimpleEncryptedMediaTest(const std::string& media_file, - const std::string& media_type, - const std::string& key_system, - SrcType src_type) { - RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system, - src_type, media::kEnded); + void RunSimplePlaybackTest(const std::string& media_file, + const std::string& media_type, + const std::string& key_system, + SrcType src_type) { + RunTest(kDefaultEmePlayer, media_file, media_type, key_system, src_type, + media::kEnded); } - void TestMp4EncryptionPlayback(const std::string& media_file, - const std::string& media_type, - const std::string& expected_title) { + void RunMultipleFileTest(const std::string& video_file, + const std::string& video_type, + const std::string& audio_file, + const std::string& audio_type, + const std::string& expected_title) { if (CurrentSourceType() != SrcType::MSE) { DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; return; } - RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, - CurrentKeySystem(), SrcType::MSE, expected_title); + base::StringPairs query_params; + query_params.emplace_back("keySystem", CurrentKeySystem()); + query_params.emplace_back("runEncrypted", "1"); + if (!video_file.empty()) { + DCHECK(!video_type.empty()); + query_params.emplace_back("videoFile", video_file); + query_params.emplace_back("videoFormat", video_type); + } + if (!audio_file.empty()) { + DCHECK(!audio_type.empty()); + query_params.emplace_back("audioFile", audio_file); + query_params.emplace_back("audioFormat", audio_type); + } + + RunMediaTestPage(kDefaultMseOnlyEmePlayer, query_params, expected_title, + true); } protected: @@ -258,8 +275,8 @@ } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4_FLAC) { - TestMp4EncryptionPlayback("bear-flac-cenc.mp4", kMp4FlacAudioOnly, - media::kEnded); + RunMultipleFileTest(std::string(), std::string(), "bear-flac-cenc.mp4", + kMp4FlacAudioOnly, media::kEnded); } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) { @@ -302,32 +319,54 @@ #if BUILDFLAG(USE_PROPRIETARY_CODECS) IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENC) { - TestMp4EncryptionPlayback("bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, - media::kEnded); + RunMultipleFileTest("bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly, + media::kEnded); } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBC1) { - TestMp4EncryptionPlayback("bear-640x360-v_frag-cbc1.mp4", kMp4Avc1VideoOnly, - media::kError); + RunMultipleFileTest("bear-640x360-v_frag-cbc1.mp4", kMp4Avc1VideoOnly, + std::string(), std::string(), media::kError); } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENS) { - TestMp4EncryptionPlayback("bear-640x360-v_frag-cens.mp4", kMp4Avc1VideoOnly, - media::kError); + RunMultipleFileTest("bear-640x360-v_frag-cens.mp4", kMp4Avc1VideoOnly, + std::string(), std::string(), media::kError); } +#if !defined(OS_ANDROID) +// TODO(crbug.com/813845): Enable CBCS support on Chrome for Android. IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBCS) { std::string expected_result = BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) ? media::kEnded : media::kError; - TestMp4EncryptionPlayback("bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, - expected_result); + RunMultipleFileTest("bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cbcs.mp4", kMp4AacAudioOnly, + expected_result); } + +IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, + Playback_Encryption_CBCS_Video_CENC_Audio) { + std::string expected_result = + BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) ? media::kEnded : media::kError; + RunMultipleFileTest("bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cenc.mp4", kMp4AacAudioOnly, + expected_result); +} + +IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, + Playback_Encryption_CENC_Video_CBCS_Audio) { + std::string expected_result = + BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) ? media::kEnded : media::kError; + RunMultipleFileTest("bear-640x360-v_frag-cenc.mp4", kMp4Avc1VideoOnly, + "bear-640x360-a_frag-cbcs.mp4", kMp4AacAudioOnly, + expected_result); +} +#endif // !defined(OS_ANDROID) #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { - RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", - kWebMVorbisAudioOnly, "com.example.foo", SrcType::MSE, - kEmeNotSupportedError); + RunTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMVorbisAudioOnly, + "com.example.foo", SrcType::MSE, kEmeNotSupportedError); } } // namespace content
diff --git a/content/browser/media/media_source_browsertest.cc b/content/browser/media/media_source_browsertest.cc index 5e3cb000..a7d782ba 100644 --- a/content/browser/media/media_source_browsertest.cc +++ b/content/browser/media/media_source_browsertest.cc
@@ -26,10 +26,17 @@ const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; const char kMp4FlacAudioOnly[] = "audio/mp4; codecs=\"flac\""; -#if BUILDFLAG(USE_PROPRIETARY_CODECS) && \ - BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) +const char kMp4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\"'"; + +#if !defined(OS_ANDROID) +const char kMp4VideoOnly[] = "video/mp4; codecs=\"avc1.4D4041\"'"; +#endif // !defined(OS_ANDROID) + +#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) const char kMp2tAudioVideo[] = "video/mp2t; codecs=\"mp4a.40.2, avc1.42E01E\""; -#endif +#endif // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) namespace content { @@ -103,8 +110,12 @@ #if !defined(OS_ANDROID) IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) { base::StringPairs query_params; - query_params.push_back(std::make_pair("videoFormat", "CLEAR_MP4")); - query_params.push_back(std::make_pair("audioFormat", "CLEAR_WEBM")); + query_params.push_back( + std::make_pair("videoFile", "bear-640x360-v_frag.mp4")); + query_params.push_back(std::make_pair("videoFormat", kMp4VideoOnly)); + query_params.push_back( + std::make_pair("audioFile", "bear-320x240-audio-only.webm")); + query_params.push_back(std::make_pair("audioFormat", kWebMAudioOnly)); RunMediaTestPage("mse_different_containers.html", query_params, media::kEnded, true); } @@ -112,8 +123,12 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) { base::StringPairs query_params; - query_params.push_back(std::make_pair("videoFormat", "CLEAR_WEBM")); - query_params.push_back(std::make_pair("audioFormat", "CLEAR_MP4")); + query_params.push_back( + std::make_pair("videoFile", "bear-320x240-video-only.webm")); + query_params.push_back(std::make_pair("videoFormat", kWebMVideoOnly)); + query_params.push_back( + std::make_pair("audioFile", "bear-640x360-a_frag.mp4")); + query_params.push_back(std::make_pair("audioFormat", kMp4AudioOnly)); RunMediaTestPage("mse_different_containers.html", query_params, media::kEnded, true); }
diff --git a/content/browser/network_service_client.cc b/content/browser/network_service_client.cc index b59e3ac..afeafe6 100644 --- a/content/browser/network_service_client.cc +++ b/content/browser/network_service_client.cc
@@ -5,6 +5,7 @@ #include "content/browser/network_service_client.h" #include "base/optional.h" +#include "base/task_scheduler/post_task.h" #include "content/browser/devtools/devtools_url_loader_interceptor.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/ssl/ssl_client_auth_handler.h" @@ -14,12 +15,14 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/global_request_id.h" #include "content/public/browser/login_delegate.h" #include "content/public/browser/resource_request_info.h" #include "content/public/common/resource_type.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "net/ssl/client_cert_store.h" +#include "services/network/public/mojom/network_context.mojom.h" namespace content { namespace { @@ -269,6 +272,38 @@ scoped_refptr<LoginDelegate> login_delegate_; }; +void HandleFileUploadRequest( + uint32_t process_id, + bool async, + const std::vector<base::FilePath>& file_paths, + NetworkServiceClient::OnFileUploadRequestedCallback callback, + scoped_refptr<base::TaskRunner> task_runner) { + std::vector<base::File> files; + uint32_t file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ | + (async ? base::File::FLAG_ASYNC : 0); + ChildProcessSecurityPolicy* cpsp = ChildProcessSecurityPolicy::GetInstance(); + for (const auto& file_path : file_paths) { + if (process_id != network::mojom::kBrowserProcessId && + !cpsp->CanReadFile(process_id, file_path)) { + task_runner->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), net::ERR_ACCESS_DENIED, + std::vector<base::File>())); + return; + } + files.emplace_back(file_path, file_flags); + if (!files.back().IsValid()) { + task_runner->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), + net::FileErrorToNetError(files.back().error_details()), + std::vector<base::File>())); + return; + } + } + task_runner->PostTask(FROM_HERE, base::BindOnce(std::move(callback), net::OK, + std::move(files))); +} + } // namespace NetworkServiceClient::NetworkServiceClient( @@ -362,7 +397,11 @@ bool async, const std::vector<base::FilePath>& file_paths, OnFileUploadRequestedCallback callback) { - // TODO(crbug.com/845612): implement this + base::PostTaskWithTraits( + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, + base::BindOnce(&HandleFileUploadRequest, process_id, async, file_paths, + std::move(callback), + base::SequencedTaskRunnerHandle::Get())); } void NetworkServiceClient::OnCookiesRead(int process_id,
diff --git a/content/browser/network_service_client.h b/content/browser/network_service_client.h index 02db5d5..68c0af0a 100644 --- a/content/browser/network_service_client.h +++ b/content/browser/network_service_client.h
@@ -6,13 +6,15 @@ #define CONTENT_BROWSER_NETWORK_SERVICE_IMPL_H_ #include "base/macros.h" +#include "content/common/content_export.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/network/public/mojom/network_service.mojom.h" #include "url/gurl.h" namespace content { -class NetworkServiceClient : public network::mojom::NetworkServiceClient { +class CONTENT_EXPORT NetworkServiceClient + : public network::mojom::NetworkServiceClient { public: explicit NetworkServiceClient(network::mojom::NetworkServiceClientRequest network_service_client_request);
diff --git a/content/browser/network_service_client_unittest.cc b/content/browser/network_service_client_unittest.cc new file mode 100644 index 0000000..37bf2ef --- /dev/null +++ b/content/browser/network_service_client_unittest.cc
@@ -0,0 +1,192 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/network_service_client.h" + +#include "base/files/file.h" +#include "base/files/file_path.h" +#include "base/files/scoped_temp_dir.h" +#include "base/test/scoped_task_environment.h" +#include "content/browser/child_process_security_policy_impl.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +namespace { + +struct UploadResponse { + UploadResponse() + : callback(base::BindOnce(&UploadResponse::OnComplete, + base::Unretained(this))) {} + + void OnComplete(int error_code, std::vector<base::File> opened_files) { + this->error_code = error_code; + this->opened_files = std::move(opened_files); + } + + network::mojom::NetworkServiceClient::OnFileUploadRequestedCallback callback; + int error_code; + std::vector<base::File> opened_files; +}; + +void GrantAccess(const base::FilePath& file, int process_id) { + ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(process_id, file); +} + +void CreateFile(const base::FilePath& path, const char* content) { + base::File file(path, base::File::FLAG_CREATE | base::File::FLAG_WRITE); + ASSERT_TRUE(file.IsValid()); + int content_size = strlen(content); + int bytes_written = file.Write(0, content, content_size); + EXPECT_EQ(bytes_written, content_size); +} + +void ValidateFileContents(base::File& file, const char* expected_content) { + int expected_length = strlen(expected_content); + ASSERT_EQ(file.GetLength(), expected_length); + char content[expected_length]; + file.Read(0, content, expected_length); + EXPECT_EQ(0, strncmp(content, expected_content, expected_length)); +} + +const int kBrowserProcessId = 0; +const int kRendererProcessId = 1; +const char kFileContent1[] = "test file content one"; +const char kFileContent2[] = "test file content two"; + +} // namespace + +class NetworkServiceClientTest : public testing::Test { + public: + NetworkServiceClientTest() : client_(mojo::MakeRequest(&client_ptr_)) {} + + void SetUp() override { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + ChildProcessSecurityPolicyImpl::GetInstance()->Add(kRendererProcessId); + } + + void TearDown() override { + ChildProcessSecurityPolicyImpl::GetInstance()->Remove(kRendererProcessId); + } + + protected: + base::test::ScopedTaskEnvironment scoped_task_environment_; + network::mojom::NetworkServiceClientPtr client_ptr_; + NetworkServiceClient client_; + base::ScopedTempDir temp_dir_; +}; + +TEST_F(NetworkServiceClientTest, UploadNoFiles) { + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, true, {}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::OK, response.error_code); + EXPECT_EQ(0U, response.opened_files.size()); +} + +TEST_F(NetworkServiceClientTest, UploadOneValidAsyncFile) { + base::FilePath path = temp_dir_.GetPath().AppendASCII("filename"); + CreateFile(path, kFileContent1); + GrantAccess(path, kRendererProcessId); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, true, {path}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::OK, response.error_code); + ASSERT_EQ(1U, response.opened_files.size()); + EXPECT_TRUE(response.opened_files[0].async()); +} + +TEST_F(NetworkServiceClientTest, UploadOneValidFile) { + base::FilePath path = temp_dir_.GetPath().AppendASCII("filename"); + CreateFile(path, kFileContent1); + GrantAccess(path, kRendererProcessId); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, false, {path}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::OK, response.error_code); + ASSERT_EQ(1U, response.opened_files.size()); + EXPECT_FALSE(response.opened_files[0].async()); + ValidateFileContents(response.opened_files[0], kFileContent1); +} + +TEST_F(NetworkServiceClientTest, UploadTwoValidFiles) { + base::FilePath path1 = temp_dir_.GetPath().AppendASCII("filename1"); + base::FilePath path2 = temp_dir_.GetPath().AppendASCII("filename2"); + CreateFile(path1, kFileContent1); + CreateFile(path2, kFileContent2); + GrantAccess(path1, kRendererProcessId); + GrantAccess(path2, kRendererProcessId); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::OK, response.error_code); + ASSERT_EQ(2U, response.opened_files.size()); + ValidateFileContents(response.opened_files[0], kFileContent1); + ValidateFileContents(response.opened_files[1], kFileContent2); +} + +TEST_F(NetworkServiceClientTest, UploadOneUnauthorizedFile) { + base::FilePath path = temp_dir_.GetPath().AppendASCII("filename"); + CreateFile(path, kFileContent1); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, false, {path}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::ERR_ACCESS_DENIED, response.error_code); + EXPECT_EQ(0U, response.opened_files.size()); +} + +TEST_F(NetworkServiceClientTest, UploadOneValidFileAndOneUnauthorized) { + base::FilePath path1 = temp_dir_.GetPath().AppendASCII("filename1"); + base::FilePath path2 = temp_dir_.GetPath().AppendASCII("filename2"); + CreateFile(path1, kFileContent1); + CreateFile(path2, kFileContent2); + GrantAccess(path1, kRendererProcessId); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::ERR_ACCESS_DENIED, response.error_code); + EXPECT_EQ(0U, response.opened_files.size()); +} + +TEST_F(NetworkServiceClientTest, UploadOneValidFileAndOneNotFound) { + base::FilePath path1 = temp_dir_.GetPath().AppendASCII("filename1"); + base::FilePath path2 = temp_dir_.GetPath().AppendASCII("filename2"); + CreateFile(path1, kFileContent1); + GrantAccess(path1, kRendererProcessId); + GrantAccess(path2, kRendererProcessId); + + UploadResponse response; + client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::ERR_FILE_NOT_FOUND, response.error_code); + EXPECT_EQ(0U, response.opened_files.size()); +} + +TEST_F(NetworkServiceClientTest, UploadFromBrowserProcess) { + base::FilePath path = temp_dir_.GetPath().AppendASCII("filename"); + CreateFile(path, kFileContent1); + // No grant necessary for browser process. + + UploadResponse response; + client_.OnFileUploadRequested(kBrowserProcessId, false, {path}, + std::move(response.callback)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(net::OK, response.error_code); + ASSERT_EQ(1U, response.opened_files.size()); + ValidateFileContents(response.opened_files[0], kFileContent1); +} + +} // namespace content
diff --git a/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc b/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc index 3359409..7111ab6 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc +++ b/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc
@@ -8,6 +8,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" namespace { @@ -79,44 +80,12 @@ } }; -namespace { - -class TestPageScaleObserver : public WebContentsObserver { - public: - explicit TestPageScaleObserver(WebContents* web_contents) - : WebContentsObserver(web_contents) {} - - void OnPageScaleFactorChanged(float page_scale_factor) override { - last_scale_ = page_scale_factor; - seen_page_scale_change_ = true; - if (done_callback_) - std::move(done_callback_).Run(); - } - - float WaitForPageScaleUpdate() { - if (!seen_page_scale_change_) { - base::RunLoop run_loop; - done_callback_ = run_loop.QuitClosure(); - run_loop.Run(); - } - seen_page_scale_change_ = false; - return last_scale_; - } - - private: - base::OnceClosure done_callback_; - bool seen_page_scale_change_ = false; - float last_scale_ = 0.f; -}; - -} // namespace - // Performing a touchpad pinch gesture should change the page scale. IN_PROC_BROWSER_TEST_F(TouchpadPinchBrowserTest, TouchpadPinchChangesPageScale) { LoadURL(); - TestPageScaleObserver scale_observer(shell()->web_contents()); + content::TestPageScaleObserver scale_observer(shell()->web_contents()); const gfx::Rect contents_rect = shell()->web_contents()->GetContainerBounds(); const gfx::Point pinch_position(contents_rect.width() / 2, @@ -135,7 +104,7 @@ content::ExecuteScript(shell()->web_contents(), "setListener(false);")); SynchronizeThreads(); - TestPageScaleObserver scale_observer(shell()->web_contents()); + content::TestPageScaleObserver scale_observer(shell()->web_contents()); const gfx::Rect contents_rect = shell()->web_contents()->GetContainerBounds(); const gfx::Point pinch_position(contents_rect.width() / 2, @@ -165,7 +134,8 @@ // Perform an initial pinch so we can figure out the page scale we're // starting with for the test proper. - TestPageScaleObserver starting_scale_observer(shell()->web_contents()); + content::TestPageScaleObserver starting_scale_observer( + shell()->web_contents()); const gfx::Rect contents_rect = shell()->web_contents()->GetContainerBounds(); const gfx::Point pinch_position(contents_rect.width() / 2, contents_rect.height() / 2); @@ -199,7 +169,7 @@ "setListener(false);")); SynchronizeThreads(); - TestPageScaleObserver scale_observer(shell()->web_contents()); + content::TestPageScaleObserver scale_observer(shell()->web_contents()); SimulateGesturePinchSequence(shell()->web_contents(), pinch_position, 2.0, blink::kWebGestureDeviceTouchpad); ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index e6a58a1..a7a74a8 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -3513,35 +3513,6 @@ #endif } -namespace { - -class TestPageScaleObserver : public WebContentsObserver { - public: - explicit TestPageScaleObserver(WebContents* web_contents) - : WebContentsObserver(web_contents) {} - - void OnPageScaleFactorChanged(float page_scale_factor) override { - seen_page_scale_change_ = true; - if (done_callback_) - std::move(done_callback_).Run(); - } - - void WaitForPageScaleUpdate() { - if (!seen_page_scale_change_) { - base::RunLoop run_loop; - done_callback_ = run_loop.QuitClosure(); - run_loop.Run(); - } - seen_page_scale_change_ = false; - } - - private: - base::OnceClosure done_callback_; - bool seen_page_scale_change_ = false; -}; - -} // namespace - // Test that performing a touchpad pinch over an OOPIF offers the synthetic // wheel events to the child and causes the page scale factor to change for // the main frame (given that the child did not consume the wheel). @@ -3580,7 +3551,7 @@ const gfx::Point point_in_child(gfx::ToCeiledInt(100 * scale_factor), gfx::ToCeiledInt(100 * scale_factor)); - TestPageScaleObserver scale_observer(shell()->web_contents()); + content::TestPageScaleObserver scale_observer(shell()->web_contents()); SendTouchpadPinchSequenceWithExpectedTarget( rwhv_parent, point_in_child, router->touchpad_gesture_target_.target, rwhv_child);
diff --git a/content/public/test/mock_network_connection_tracker.cc b/content/public/test/mock_network_connection_tracker.cc new file mode 100644 index 0000000..8e85aab4 --- /dev/null +++ b/content/public/test/mock_network_connection_tracker.cc
@@ -0,0 +1,36 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/test/mock_network_connection_tracker.h" + +#include "base/logging.h" +#include "base/threading/thread_task_runner_handle.h" + +namespace content { + +MockNetworkConnectionTracker::MockNetworkConnectionTracker( + bool respond_synchronously, + network::mojom::ConnectionType initial_type) + : respond_synchronously_(respond_synchronously), type_(initial_type) {} + +bool MockNetworkConnectionTracker::GetConnectionType( + network::mojom::ConnectionType* type, + ConnectionTypeCallback callback) { + if (respond_synchronously_) { + *type = type_; + return true; + } + + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), type_)); + return false; +} + +void MockNetworkConnectionTracker::SetConnectionType( + network::mojom::ConnectionType type) { + type_ = type; + OnNetworkChanged(type_); +} + +} // namespace content
diff --git a/content/public/test/mock_network_connection_tracker.h b/content/public/test/mock_network_connection_tracker.h new file mode 100644 index 0000000..60ea5f6 --- /dev/null +++ b/content/public/test/mock_network_connection_tracker.h
@@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_TEST_MOCK_NETWORK_CONNECTION_TRACKER_H_ +#define CONTENT_PUBLIC_TEST_MOCK_NETWORK_CONNECTION_TRACKER_H_ + +#include "content/public/browser/network_connection_tracker.h" + +namespace content { + +// Allows unit tests to set the network connection type. +// GetConnectionType() can be set to respond synchronously or asynchronously, +// so that it may be tested that tested units are able to correctly handle +// either. +class MockNetworkConnectionTracker : public content::NetworkConnectionTracker { + public: + MockNetworkConnectionTracker(bool respond_synchronously, + network::mojom::ConnectionType initial_type); + ~MockNetworkConnectionTracker() override = default; + + bool GetConnectionType(network::mojom::ConnectionType* type, + ConnectionTypeCallback callback) override; + + void SetConnectionType(network::mojom::ConnectionType); + + private: + // Whether GetConnectionType() will respond synchronously. + bool respond_synchronously_; + + // Keep local copy of the type, for when a synchronous response is requested. + network::mojom::ConnectionType type_; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_MOCK_NETWORK_CONNECTION_TRACKER_H_
diff --git a/content/public/test/navigation_simulator.cc b/content/public/test/navigation_simulator.cc index 5542a04..ceaadd84 100644 --- a/content/public/test/navigation_simulator.cc +++ b/content/public/test/navigation_simulator.cc
@@ -896,8 +896,9 @@ web_contents_->GetMainFrame()->GetRoutingID())); state_ = FAILED; return false; - } else if (web_contents_->GetMainFrame()->GetNavigationHandle() == - handle_) { + } else if (handle_ && + web_contents_->GetMainFrame()->GetNavigationHandle() == + handle_) { DCHECK(!IsURLHandledByNetworkStack(handle_->GetURL())); return true; } else if (web_contents_->GetMainFrame()
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index 66f556e..942ff89 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc
@@ -29,6 +29,7 @@ #include "content/test/test_render_view_host_factory.h" #include "content/test/test_render_widget_host_factory.h" #include "content/test/test_web_contents.h" +#include "net/base/network_change_notifier.h" #include "ui/base/material_design/material_design_controller.h" #include "ui/base/test/material_design_controller_test_api.h" @@ -247,6 +248,12 @@ } void RenderViewHostTestHarness::SetUp() { + // Create and own a NetworkChangeNotifier so that it will not be created + // during the initialization of the global leaky singleton NetworkService. The + // global NetworkService's NetworkChangeNotifier can affect subsequent unit + // tests. + network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); + // ContentTestSuiteBase might have already initialized // MaterialDesignController in unit_tests suite. ui::test::MaterialDesignControllerTestAPI::Uninitialize();
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index 7c4655c..580dfaa 100644 --- a/content/public/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h
@@ -34,6 +34,10 @@ class Screen; } +namespace net { +class NetworkChangeNotifier; +} + namespace ui { class ScopedOleInitializer; } @@ -265,6 +269,8 @@ private: std::unique_ptr<TestBrowserThreadBundle> thread_bundle_; + std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; + std::unique_ptr<ContentBrowserSanityChecker> sanity_checker_; std::unique_ptr<BrowserContext> browser_context_;
diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc index 4718286..5a0e070 100644 --- a/content/public/test/test_utils.cc +++ b/content/public/test/test_utils.cc
@@ -460,6 +460,28 @@ run_loop_.Quit(); } +TestPageScaleObserver::TestPageScaleObserver(WebContents* web_contents) + : WebContentsObserver(web_contents) {} + +TestPageScaleObserver::~TestPageScaleObserver() {} + +void TestPageScaleObserver::OnPageScaleFactorChanged(float page_scale_factor) { + last_scale_ = page_scale_factor; + seen_page_scale_change_ = true; + if (done_callback_) + std::move(done_callback_).Run(); +} + +float TestPageScaleObserver::WaitForPageScaleUpdate() { + if (!seen_page_scale_change_) { + base::RunLoop run_loop; + done_callback_ = run_loop.QuitClosure(); + run_loop.Run(); + } + seen_page_scale_change_ = false; + return last_scale_; +} + GURL EffectiveURLContentBrowserClient::GetEffectiveURL( BrowserContext* browser_context, const GURL& url) {
diff --git a/content/public/test/test_utils.h b/content/public/test/test_utils.h index cc04b7b..46666670 100644 --- a/content/public/test/test_utils.h +++ b/content/public/test/test_utils.h
@@ -332,6 +332,23 @@ DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); }; +// Watches a web contents for page scales. +class TestPageScaleObserver : public WebContentsObserver { + public: + explicit TestPageScaleObserver(WebContents* web_contents); + ~TestPageScaleObserver() override; + float WaitForPageScaleUpdate(); + + private: + void OnPageScaleFactorChanged(float page_scale_factor) override; + + base::OnceClosure done_callback_; + bool seen_page_scale_change_ = false; + float last_scale_ = 0.f; + + DISALLOW_COPY_AND_ASSIGN(TestPageScaleObserver); +}; + // A custom ContentBrowserClient that simulates GetEffectiveURL() translation // for a single URL. class EffectiveURLContentBrowserClient : public ContentBrowserClient {
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc index b07970f..04a742a7 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -39,6 +39,7 @@ #include "third_party/blink/public/web/web_view.h" #include "ui/accessibility/ax_enum_util.h" #include "ui/accessibility/ax_role_properties.h" +#include "ui/gfx/geometry/vector2d_f.h" using base::ASCIIToUTF16; using base::UTF16ToUTF8; @@ -469,8 +470,24 @@ src.GetRelativeBounds(offset_container, bounds_in_container, container_transform, &clips_children); dst->location = bounds_in_container; +#if !defined(OS_ANDROID) && !defined(OS_MACOSX) + if (src.Equals(root())) { + WebView* web_view = render_frame_->GetRenderView()->GetWebView(); + std::unique_ptr<gfx::Transform> container_transform_gfx = + std::make_unique<gfx::Transform>(container_transform); + container_transform_gfx->Scale(web_view->PageScaleFactor(), + web_view->PageScaleFactor()); + container_transform_gfx->Translate( + gfx::Vector2dF(-web_view->VisualViewportOffset().x, + -web_view->VisualViewportOffset().y)); + if (!container_transform_gfx->IsIdentity()) + dst->transform = std::move(container_transform_gfx); + } else if (!container_transform.isIdentity()) + dst->transform = base::WrapUnique(new gfx::Transform(container_transform)); +#else if (!container_transform.isIdentity()) dst->transform = base::WrapUnique(new gfx::Transform(container_transform)); +#endif // !defined(OS_ANDROID) && !defined(OS_MACOSX) if (!offset_container.IsDetached()) dst->offset_container_id = offset_container.AxID(); if (clips_children)
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index f786b201..854774a 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -95,6 +95,8 @@ "../public/test/mock_browsing_data_remover_delegate.h", "../public/test/mock_download_manager.cc", "../public/test/mock_download_manager.h", + "../public/test/mock_network_connection_tracker.cc", + "../public/test/mock_network_connection_tracker.h", "../public/test/mock_notification_observer.cc", "../public/test/mock_notification_observer.h", "../public/test/mock_permission_manager.cc", @@ -1417,6 +1419,7 @@ "../browser/memory/test_memory_monitor.h", "../browser/net/network_quality_observer_impl_unittest.cc", "../browser/net/quota_policy_cookie_store_unittest.cc", + "../browser/network_service_client_unittest.cc", "../browser/notification_service_impl_unittest.cc", "../browser/notifications/blink_notification_service_impl_unittest.cc", "../browser/notifications/notification_database_data_unittest.cc",
diff --git a/content/test/data/accessibility/html/layout-table-in-button-expected-blink.txt b/content/test/data/accessibility/html/layout-table-in-button-expected-blink.txt new file mode 100644 index 0000000..9f8a298d --- /dev/null +++ b/content/test/data/accessibility/html/layout-table-in-button-expected-blink.txt
@@ -0,0 +1,8 @@ +rootWebArea +++button name='Conversation with Foo. 0 unread messages.' +++++layoutTable +++++++layoutTableRow +++++++++layoutTableCell name='Conversation with Foo. 0 unread messages.' +++++++++++genericContainer name='Conversation with Foo. 0 unread messages.' +++++++++++++staticText name='Foo' +++++++++++++++inlineTextBox name='Foo'
diff --git a/content/test/data/accessibility/html/layout-table-in-button.html b/content/test/data/accessibility/html/layout-table-in-button.html new file mode 100644 index 0000000..ccd64a4d --- /dev/null +++ b/content/test/data/accessibility/html/layout-table-in-button.html
@@ -0,0 +1,11 @@ +<div tabindex=-1 role=button> + <div style="display: table"> + <div style="display: table-row"> + <div style="display: table-cell"> + <div aria-label="Conversation with Foo. 0 unread messages."> + <span>Foo</span> + </div> + </div> + </div> + </div> +</div>
diff --git a/device/vr/android/gvr/gvr_delegate_provider.h b/device/vr/android/gvr/gvr_delegate_provider.h index db8c90b..2e5f84f 100644 --- a/device/vr/android/gvr/gvr_delegate_provider.h +++ b/device/vr/android/gvr/gvr_delegate_provider.h
@@ -22,7 +22,7 @@ virtual void SetDeviceId(unsigned int device_id) = 0; virtual void StartWebXRPresentation( mojom::VRDisplayInfoPtr display_info, - const device::XRDeviceRuntimeSessionOptions& options, + mojom::XRDeviceRuntimeSessionOptionsPtr options, device::mojom::VRDisplayHost::RequestSessionCallback callback) = 0; virtual void ExitWebVRPresent() = 0; virtual void OnListeningForActivateChanged(bool listening) = 0;
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc index b3ccb4c..6bed504 100644 --- a/device/vr/android/gvr/gvr_device.cc +++ b/device/vr/android/gvr/gvr_device.cc
@@ -143,7 +143,9 @@ } GvrDevice::GvrDevice() - : VRDeviceBase(VRDeviceId::GVR_DEVICE_ID), weak_ptr_factory_(this) { + : VRDeviceBase(VRDeviceId::GVR_DEVICE_ID), + exclusive_controller_binding_(this), + weak_ptr_factory_(this) { GvrDelegateProvider* delegate_provider = GetGvrDelegateProvider(); if (!delegate_provider || delegate_provider->ShouldDisableGvrDevice()) return; @@ -167,19 +169,20 @@ Java_NonPresentingGvrContext_shutdown(env, non_presenting_context_); } -void GvrDevice::RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { +void GvrDevice::RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { GvrDelegateProvider* delegate_provider = GetGvrDelegateProvider(); if (!delegate_provider) { std::move(callback).Run(nullptr, nullptr); return; } - if (options.exclusive) { + if (options->exclusive) { // StartWebXRPresentation is async as we may trigger a DON (Device ON) flow // that pauses Chrome. delegate_provider->StartWebXRPresentation( - GetVRDisplayInfo(), options, + GetVRDisplayInfo(), std::move(options), base::BindOnce(&GvrDevice::OnRequestSessionResult, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } else { @@ -192,7 +195,7 @@ } void GvrDevice::OnRequestSessionResult( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, mojom::XRPresentationConnectionPtr connection) { if (!connection) { std::move(callback).Run(nullptr, nullptr); @@ -201,20 +204,33 @@ OnStartPresenting(); - std::move(callback).Run(std::move(connection), this); + mojom::XRSessionControllerPtr session_controller; + // Close the binding to ensure any previous sessions were closed. + // TODO(billorr): Only do this in OnPresentingControllerMojoConnectionError. + exclusive_controller_binding_.Close(); + exclusive_controller_binding_.Bind(mojo::MakeRequest(&session_controller)); + + // Unretained is safe because the error handler won't be called after the + // binding has been destroyed. + exclusive_controller_binding_.set_connection_error_handler( + base::BindOnce(&GvrDevice::OnPresentingControllerMojoConnectionError, + base::Unretained(this))); + + std::move(callback).Run(std::move(connection), std::move(session_controller)); } -// XrSessionController +// XRSessionController void GvrDevice::SetFrameDataRestricted(bool restricted) { // Presentation sessions can not currently be restricted. DCHECK(false); } -void GvrDevice::StopSession() { +void GvrDevice::OnPresentingControllerMojoConnectionError() { GvrDelegateProvider* delegate_provider = GetGvrDelegateProvider(); if (delegate_provider) delegate_provider->ExitWebVRPresent(); OnExitPresent(); + exclusive_controller_binding_.Close(); } void GvrDevice::OnMagicWindowFrameDataRequest(
diff --git a/device/vr/android/gvr/gvr_device.h b/device/vr/android/gvr/gvr_device.h index 945b266..289cbea 100644 --- a/device/vr/android/gvr/gvr_device.h +++ b/device/vr/android/gvr/gvr_device.h
@@ -18,16 +18,16 @@ class GvrDelegateProvider; -// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT GvrDevice : public VRDeviceBase, - public XrSessionController { + public mojom::XRSessionController { public: static std::unique_ptr<GvrDevice> Create(); ~GvrDevice() override; // VRDeviceBase - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; void PauseTracking() override; void ResumeTracking() override; @@ -44,12 +44,13 @@ void OnMagicWindowFrameDataRequest( mojom::VRMagicWindowProvider::GetFrameDataCallback callback) override; - void OnRequestSessionResult(VRDeviceRequestSessionCallback callback, + void OnRequestSessionResult(mojom::XRRuntime::RequestSessionCallback callback, mojom::XRPresentationConnectionPtr connection); - // XrSessionController + // XRSessionController void SetFrameDataRestricted(bool restricted) override; - void StopSession() override; + + void OnPresentingControllerMojoConnectionError(); GvrDevice(); GvrDelegateProvider* GetGvrDelegateProvider(); @@ -57,6 +58,8 @@ base::android::ScopedJavaGlobalRef<jobject> non_presenting_context_; std::unique_ptr<gvr::GvrApi> gvr_api_; + mojo::Binding<mojom::XRSessionController> exclusive_controller_binding_; + base::WeakPtrFactory<GvrDevice> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(GvrDevice);
diff --git a/device/vr/android/gvr/gvr_device_provider.cc b/device/vr/android/gvr/gvr_device_provider.cc index 3d2660f4..ea77025b 100644 --- a/device/vr/android/gvr/gvr_device_provider.cc +++ b/device/vr/android/gvr/gvr_device_provider.cc
@@ -12,12 +12,15 @@ GvrDeviceProvider::~GvrDeviceProvider() = default; void GvrDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { vr_device_ = GvrDevice::Create(); if (vr_device_) - add_device_callback.Run(vr_device_->GetId(), vr_device_.get()); + add_device_callback.Run(vr_device_->GetId(), vr_device_->GetVRDisplayInfo(), + vr_device_->BindXRRuntimePtr()); initialized_ = true; std::move(initialization_complete).Run(); }
diff --git a/device/vr/android/gvr/gvr_device_provider.h b/device/vr/android/gvr/gvr_device_provider.h index 4b8665e2..c833e473 100644 --- a/device/vr/android/gvr/gvr_device_provider.h +++ b/device/vr/android/gvr/gvr_device_provider.h
@@ -21,8 +21,9 @@ ~GvrDeviceProvider() override; void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override;
diff --git a/device/vr/oculus/oculus_device.cc b/device/vr/oculus/oculus_device.cc index d356eef..43e102c3 100644 --- a/device/vr/oculus/oculus_device.cc +++ b/device/vr/oculus/oculus_device.cc
@@ -87,6 +87,7 @@ : VRDeviceBase(VRDeviceId::OCULUS_DEVICE_ID), session_(session), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), + exclusive_controller_binding_(this), weak_ptr_factory_(this) { SetVRDisplayInfo(CreateVRDisplayInfo(GetId(), session_)); @@ -95,8 +96,9 @@ OculusDevice::~OculusDevice() {} -void OculusDevice::RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { +void OculusDevice::RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { if (!render_loop_->IsRunning()) render_loop_->Start(); @@ -110,12 +112,12 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback)); render_loop_->task_runner()->PostTask( FROM_HERE, base::BindOnce(&OculusRenderLoop::RequestSession, - render_loop_->GetWeakPtr(), options, + render_loop_->GetWeakPtr(), std::move(options), std::move(on_request_present_result))); } void OculusDevice::OnRequestSessionResult( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool result, mojom::VRSubmitFrameClientRequest request, mojom::VRPresentationProviderPtrInfo provider_info, @@ -131,20 +133,31 @@ connection->client_request = std::move(request); connection->provider = std::move(provider_info); connection->transport_options = std::move(transport_options); - std::move(callback).Run(std::move(connection), this); + + mojom::XRSessionControllerPtr session_controller; + exclusive_controller_binding_.Bind(mojo::MakeRequest(&session_controller)); + + // Unretained is safe because the error handler won't be called after the + // binding has been destroyed. + exclusive_controller_binding_.set_connection_error_handler( + base::BindOnce(&OculusDevice::OnPresentingControllerMojoConnectionError, + base::Unretained(this))); + + std::move(callback).Run(std::move(connection), std::move(session_controller)); } -// XrSessionController +// XRSessionController void OculusDevice::SetFrameDataRestricted(bool restricted) { // Presentation sessions can not currently be restricted. DCHECK(false); } -void OculusDevice::StopSession() { +void OculusDevice::OnPresentingControllerMojoConnectionError() { render_loop_->task_runner()->PostTask( FROM_HERE, base::BindOnce(&OculusRenderLoop::ExitPresent, render_loop_->GetWeakPtr())); OnExitPresent(); + exclusive_controller_binding_.Close(); } void OculusDevice::OnMagicWindowFrameDataRequest(
diff --git a/device/vr/oculus/oculus_device.h b/device/vr/oculus/oculus_device.h index cd49aae..46bbcf9 100644 --- a/device/vr/oculus/oculus_device.h +++ b/device/vr/oculus/oculus_device.h
@@ -18,33 +18,37 @@ class OculusRenderLoop; -class OculusDevice : public VRDeviceBase, public XrSessionController { +class OculusDevice : public VRDeviceBase, public mojom::XRSessionController { public: explicit OculusDevice(ovrSession session, ovrGraphicsLuid luid); ~OculusDevice() override; // VRDeviceBase - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; void OnMagicWindowFrameDataRequest( mojom::VRMagicWindowProvider::GetFrameDataCallback callback) override; void OnRequestSessionResult( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool result, mojom::VRSubmitFrameClientRequest request, mojom::VRPresentationProviderPtrInfo provider_info, mojom::VRDisplayFrameTransportOptionsPtr transport_options); private: - // XrSessionController + // XRSessionController void SetFrameDataRestricted(bool restricted) override; - void StopSession() override; + + void OnPresentingControllerMojoConnectionError(); std::unique_ptr<OculusRenderLoop> render_loop_; mojom::VRDisplayInfoPtr display_info_; ovrSession session_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; + mojo::Binding<mojom::XRSessionController> exclusive_controller_binding_; + base::WeakPtrFactory<OculusDevice> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(OculusDevice);
diff --git a/device/vr/oculus/oculus_device_provider.cc b/device/vr/oculus/oculus_device_provider.cc index c107fb69..ead1375 100644 --- a/device/vr/oculus/oculus_device_provider.cc +++ b/device/vr/oculus/oculus_device_provider.cc
@@ -23,12 +23,15 @@ } void OculusVRDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { CreateDevice(); if (device_) - add_device_callback.Run(device_->GetId(), device_.get()); + add_device_callback.Run(device_->GetId(), device_->GetVRDisplayInfo(), + device_->BindXRRuntimePtr()); initialized_ = true; std::move(initialization_complete).Run(); }
diff --git a/device/vr/oculus/oculus_device_provider.h b/device/vr/oculus/oculus_device_provider.h index f6590e53..d2279fc7 100644 --- a/device/vr/oculus/oculus_device_provider.h +++ b/device/vr/oculus/oculus_device_provider.h
@@ -24,8 +24,9 @@ ~OculusVRDeviceProvider() override; void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override;
diff --git a/device/vr/oculus/oculus_render_loop.cc b/device/vr/oculus/oculus_render_loop.cc index 0400f8d8..0a841e0 100644 --- a/device/vr/oculus/oculus_render_loop.cc +++ b/device/vr/oculus/oculus_render_loop.cc
@@ -193,9 +193,9 @@ }; void OculusRenderLoop::RequestSession( - const XRDeviceRuntimeSessionOptions& options, + mojom::XRDeviceRuntimeSessionOptionsPtr options, RequestSessionCallback callback) { - DCHECK(options.exclusive); + DCHECK(options->exclusive); #if defined(OS_WIN) if (!texture_helper_.SetAdapterLUID(*reinterpret_cast<LUID*>(&luid_)) || !texture_helper_.EnsureInitialized()) {
diff --git a/device/vr/oculus/oculus_render_loop.h b/device/vr/oculus/oculus_render_loop.h index 57d90b5d..6b15b7c 100644 --- a/device/vr/oculus/oculus_render_loop.h +++ b/device/vr/oculus/oculus_render_loop.h
@@ -34,7 +34,7 @@ OculusRenderLoop(ovrSession session, ovrGraphicsLuid luid); ~OculusRenderLoop() override; - void RequestSession(const XRDeviceRuntimeSessionOptions& options, + void RequestSession(mojom::XRDeviceRuntimeSessionOptionsPtr options, RequestSessionCallback callback); void ExitPresent(); base::WeakPtr<OculusRenderLoop> GetWeakPtr();
diff --git a/device/vr/openvr/openvr_device.cc b/device/vr/openvr/openvr_device.cc index e8cd06a..26ccb674 100644 --- a/device/vr/openvr/openvr_device.cc +++ b/device/vr/openvr/openvr_device.cc
@@ -148,6 +148,7 @@ : VRDeviceBase(VRDeviceId::OPENVR_DEVICE_ID), vr_system_(vr), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), + exclusive_controller_binding_(this), weak_ptr_factory_(this) { DCHECK(vr_system_); SetVRDisplayInfo(CreateVRDisplayInfo(vr_system_, GetId())); @@ -169,8 +170,9 @@ render_loop_->Stop(); } -void OpenVRDevice::RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { +void OpenVRDevice::RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { if (!render_loop_->IsRunning()) render_loop_->Start(); @@ -184,12 +186,12 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback)); render_loop_->task_runner()->PostTask( FROM_HERE, base::BindOnce(&OpenVRRenderLoop::RequestSession, - render_loop_->GetWeakPtr(), options, + render_loop_->GetWeakPtr(), std::move(options), std::move(my_callback))); } void OpenVRDevice::OnRequestSessionResult( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool result, mojom::VRSubmitFrameClientRequest request, mojom::VRPresentationProviderPtrInfo provider_info, @@ -205,7 +207,17 @@ connection->client_request = std::move(request); connection->provider = std::move(provider_info); connection->transport_options = std::move(transport_options); - std::move(callback).Run(std::move(connection), this); + + mojom::XRSessionControllerPtr session_controller; + exclusive_controller_binding_.Bind(mojo::MakeRequest(&session_controller)); + + // Use of Unretained is safe because the callback will only occur if the + // binding is not destroyed. + exclusive_controller_binding_.set_connection_error_handler( + base::BindOnce(&OpenVRDevice::OnPresentingControllerMojoConnectionError, + base::Unretained(this))); + + std::move(callback).Run(std::move(connection), std::move(session_controller)); using ViewerMap = std::map<std::string, VrViewerType>; CR_DEFINE_STATIC_LOCAL(ViewerMap, viewer_types, @@ -223,18 +235,19 @@ base::UmaHistogramSparse("VRViewerType", static_cast<int>(type)); } -// XrSessionController +// XRSessionController void OpenVRDevice::SetFrameDataRestricted(bool restricted) { // Presentation sessions can not currently be restricted. DCHECK(false); } -void OpenVRDevice::StopSession() { +void OpenVRDevice::OnPresentingControllerMojoConnectionError() { render_loop_->task_runner()->PostTask( FROM_HERE, base::Bind(&OpenVRRenderLoop::ExitPresent, render_loop_->GetWeakPtr())); render_loop_->Stop(); OnExitPresent(); + exclusive_controller_binding_.Close(); } void OpenVRDevice::OnMagicWindowFrameDataRequest(
diff --git a/device/vr/openvr/openvr_device.h b/device/vr/openvr/openvr_device.h index dd7e0edd..ba6cec3 100644 --- a/device/vr/openvr/openvr_device.h +++ b/device/vr/openvr/openvr_device.h
@@ -21,7 +21,7 @@ class OpenVRRenderLoop; -class OpenVRDevice : public VRDeviceBase, public XrSessionController { +class OpenVRDevice : public VRDeviceBase, public mojom::XRSessionController { public: OpenVRDevice(vr::IVRSystem* vr); ~OpenVRDevice() override; @@ -29,13 +29,14 @@ void Shutdown(); // VRDeviceBase - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; void OnPollingEvents(); void OnRequestSessionResult( - VRDeviceRequestSessionCallback callback, + mojom::XRRuntime::RequestSessionCallback callback, bool result, mojom::VRSubmitFrameClientRequest request, mojom::VRPresentationProviderPtrInfo provider_info, @@ -46,9 +47,10 @@ void OnMagicWindowFrameDataRequest( mojom::VRMagicWindowProvider::GetFrameDataCallback callback) override; - // XrSessionController + // XRSessionController void SetFrameDataRestricted(bool restricted) override; - void StopSession() override; + + void OnPresentingControllerMojoConnectionError(); // TODO (BillOrr): This should not be a unique_ptr because the render_loop_ // binds to VRVSyncProvider requests, so its lifetime should be tied to the @@ -58,6 +60,8 @@ vr::IVRSystem* vr_system_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; + mojo::Binding<mojom::XRSessionController> exclusive_controller_binding_; + base::WeakPtrFactory<OpenVRDevice> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(OpenVRDevice);
diff --git a/device/vr/openvr/openvr_device_provider.cc b/device/vr/openvr/openvr_device_provider.cc index a4c7d8b..ad99918 100644 --- a/device/vr/openvr/openvr_device_provider.cc +++ b/device/vr/openvr/openvr_device_provider.cc
@@ -52,12 +52,15 @@ } void OpenVRDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { CreateDevice(); if (device_) - add_device_callback.Run(device_->GetId(), device_.get()); + add_device_callback.Run(device_->GetId(), device_->GetVRDisplayInfo(), + device_->BindXRRuntimePtr()); initialized_ = true; std::move(initialization_complete).Run(); }
diff --git a/device/vr/openvr/openvr_device_provider.h b/device/vr/openvr/openvr_device_provider.h index 588672c..69b5cd4 100644 --- a/device/vr/openvr/openvr_device_provider.h +++ b/device/vr/openvr/openvr_device_provider.h
@@ -24,8 +24,9 @@ ~OpenVRDeviceProvider() override; void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override;
diff --git a/device/vr/openvr/openvr_render_loop.cc b/device/vr/openvr/openvr_render_loop.cc index f719de7a..4c8e959 100644 --- a/device/vr/openvr/openvr_render_loop.cc +++ b/device/vr/openvr/openvr_render_loop.cc
@@ -146,9 +146,9 @@ }; void OpenVRRenderLoop::RequestSession( - const XRDeviceRuntimeSessionOptions& options, + mojom::XRDeviceRuntimeSessionOptionsPtr options, RequestSessionCallback callback) { - DCHECK(options.exclusive); + DCHECK(options->exclusive); #if defined(OS_WIN) int32_t adapter_index; vr::VRSystem()->GetDXGIOutputInfo(&adapter_index);
diff --git a/device/vr/openvr/openvr_render_loop.h b/device/vr/openvr/openvr_render_loop.h index b0b94cf..ab4264ff 100644 --- a/device/vr/openvr/openvr_render_loop.h +++ b/device/vr/openvr/openvr_render_loop.h
@@ -33,7 +33,7 @@ OpenVRRenderLoop(vr::IVRSystem* vr); ~OpenVRRenderLoop() override; - void RequestSession(const XRDeviceRuntimeSessionOptions& options, + void RequestSession(mojom::XRDeviceRuntimeSessionOptionsPtr options, RequestSessionCallback callback); void ExitPresent(); base::WeakPtr<OpenVRRenderLoop> GetWeakPtr();
diff --git a/device/vr/orientation/orientation_device.cc b/device/vr/orientation/orientation_device.cc index 08ad889..c0c0882 100644 --- a/device/vr/orientation/orientation_device.cc +++ b/device/vr/orientation/orientation_device.cc
@@ -139,9 +139,9 @@ } void VROrientationDevice::RequestSession( - const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { - DCHECK(!options.exclusive); + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { + DCHECK(!options->exclusive); // TODO(offenwanger): Perform a check to see if sensors are available when // RequestSession is called for non-exclusive sessions. std::move(callback).Run(nullptr, nullptr);
diff --git a/device/vr/orientation/orientation_device.h b/device/vr/orientation/orientation_device.h index 210bd52c..f9f3b19 100644 --- a/device/vr/orientation/orientation_device.h +++ b/device/vr/orientation/orientation_device.h
@@ -43,8 +43,9 @@ ~VROrientationDevice() override; // VRDevice - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; // VRDeviceBase void OnMagicWindowFrameDataRequest(
diff --git a/device/vr/orientation/orientation_device_provider.cc b/device/vr/orientation/orientation_device_provider.cc index f0966c8..7f327156 100644 --- a/device/vr/orientation/orientation_device_provider.cc +++ b/device/vr/orientation/orientation_device_provider.cc
@@ -21,11 +21,14 @@ VROrientationDeviceProvider::~VROrientationDeviceProvider() = default; void VROrientationDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { if (device_ && device_->IsAvailable()) { - add_device_callback.Run(device_->GetId(), device_.get()); + add_device_callback.Run(device_->GetId(), device_->GetVRDisplayInfo(), + device_->BindXRRuntimePtr()); return; } @@ -51,7 +54,8 @@ // If the device successfully connected to the orientation APIs, provide it. if (device_->IsAvailable()) { - add_device_callback_.Run(device_->GetId(), device_.get()); + add_device_callback_.Run(device_->GetId(), device_->GetVRDisplayInfo(), + device_->BindXRRuntimePtr()); } initialized_ = true;
diff --git a/device/vr/orientation/orientation_device_provider.h b/device/vr/orientation/orientation_device_provider.h index e56a0d4d..d7772325 100644 --- a/device/vr/orientation/orientation_device_provider.h +++ b/device/vr/orientation/orientation_device_provider.h
@@ -24,8 +24,9 @@ ~VROrientationDeviceProvider() override; void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override; @@ -40,7 +41,9 @@ std::unique_ptr<VROrientationDevice> device_; - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback_; + base::RepeatingCallback< + void(unsigned int, mojom::VRDisplayInfoPtr, mojom::XRRuntimePtr)> + add_device_callback_; base::OnceClosure initialized_callback_; DISALLOW_COPY_AND_ASSIGN(VROrientationDeviceProvider);
diff --git a/device/vr/orientation/orientation_device_provider_unittest.cc b/device/vr/orientation/orientation_device_provider_unittest.cc index cc74d9d..bccfdc3 100644 --- a/device/vr/orientation/orientation_device_provider_unittest.cc +++ b/device/vr/orientation/orientation_device_provider_unittest.cc
@@ -83,21 +83,25 @@ return init_params; } - base::RepeatingCallback<void(unsigned int, VRDevice*)> + base::RepeatingCallback< + void(unsigned int, mojom::VRDisplayInfoPtr, mojom::XRRuntimePtr device)> DeviceAndIdCallbackFailIfCalled() { - return base::BindRepeating( - [](unsigned int id, VRDevice* device) { FAIL(); }); + return base::BindRepeating([](unsigned int id, mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr device) { FAIL(); }); }; base::RepeatingCallback<void(unsigned int)> DeviceIdCallbackFailIfCalled() { return base::BindRepeating([](unsigned int id) { FAIL(); }); }; - base::RepeatingCallback<void(unsigned int, VRDevice*)> + base::RepeatingCallback< + void(unsigned int, mojom::VRDisplayInfoPtr, mojom::XRRuntimePtr device)> DeviceAndIdCallbackMustBeCalled(base::RunLoop* loop) { return base::BindRepeating( - [](base::OnceClosure quit_closure, unsigned int id, VRDevice* device) { + [](base::OnceClosure quit_closure, unsigned int id, + mojom::VRDisplayInfoPtr info, mojom::XRRuntimePtr device) { ASSERT_TRUE(device); + ASSERT_TRUE(info); std::move(quit_closure).Run(); }, loop->QuitClosure()); @@ -176,48 +180,4 @@ EXPECT_TRUE(provider_->Initialized()); } -TEST_F(VROrientationDeviceProviderTest, SecondInitializationSuccessTest) { - base::RunLoop wait_for_device; - base::RunLoop wait_for_init; - - provider_->Initialize(DeviceAndIdCallbackMustBeCalled(&wait_for_device), - DeviceIdCallbackFailIfCalled(), - ClosureMustBeCalled(&wait_for_init)); - - InitializeDevice(FakeInitParams()); - - // Wait for the initialization to finish. - wait_for_init.Run(); - wait_for_device.Run(); - - base::RunLoop second_wait_for_device; - - EXPECT_TRUE(provider_->Initialized()); - - // If we run initialize again, we should only call add device. - provider_->Initialize( - DeviceAndIdCallbackMustBeCalled(&second_wait_for_device), - DeviceIdCallbackFailIfCalled(), ClosureFailIfCalled()); - - second_wait_for_device.Run(); -} - -TEST_F(VROrientationDeviceProviderTest, SecondInitializationFailureTest) { - base::RunLoop wait_for_init; - - provider_->Initialize(DeviceAndIdCallbackFailIfCalled(), - DeviceIdCallbackFailIfCalled(), - ClosureMustBeCalled(&wait_for_init)); - - InitializeDevice(nullptr); - - wait_for_init.Run(); - - EXPECT_TRUE(provider_->Initialized()); - - // If we call again on a failure, nothing should be called. - provider_->Initialize(DeviceAndIdCallbackFailIfCalled(), - DeviceIdCallbackFailIfCalled(), ClosureFailIfCalled()); -} - } // namespace device
diff --git a/device/vr/public/mojom/BUILD.gn b/device/vr/public/mojom/BUILD.gn index c9befd61..06cc4f23 100644 --- a/device/vr/public/mojom/BUILD.gn +++ b/device/vr/public/mojom/BUILD.gn
@@ -9,6 +9,7 @@ macro_prefix = "DEVICE_VR_MOJO_BINDINGS" sources = [ + "isolated_xr_service.mojom", "vr_service.mojom", ]
diff --git a/device/vr/public/mojom/README.md b/device/vr/public/mojom/README.md new file mode 100644 index 0000000..273b0d5e --- /dev/null +++ b/device/vr/public/mojom/README.md
@@ -0,0 +1,57 @@ +# Overview +At a high level, AR/VR (collectively known as XR) APIs are wrapped in +XRRuntimes. + +Some XRRuntimes must live in the browser process, while others must not live in +the browser process. The ones that cannot live in the browser, are hosted in a +service. + +# Renderer <-> Browser interfaces (defined in vr_service.mojom) +VRService - lives in the browser process, corresponds to a single frame. Root +object to obtain other XR objects. + +VRDisplayHost - lives in the browser process. Allows a client to start a +session (either immersive/exclusive/presenting or magic window). + +VRServiceClient - lives in the renderer process. Is notified when VRDisplays +are connected. + +VRDisplayClient - lives in the renderer process. Is notified when display +settings change. + +# Renderer <-> Device interfaces (defined in vr_service.mojom) +These interfaces allow communication betwee an XRRuntime and the renderer +process. They may live in the browser process or may live in the isolated +service. + +## Presentation-related: +Presentation is exclusive access to a headset where a site may display +a stereo view to the user. + +VRPresentationProvider - lives in the XRDevice process. Implements the details +for a presentation session, such as submitting frames to the underlying VR API. + +VRSubmitFrameClient - lives in the renderer process. Is notified when various +rendering events occur, so it can reclaim/reuse textures. + +## Magic-window related: +Magic window is a mode where a site may request poses, but renders through the +normal Chrome compositor pipeline. + +VRMagicWindowProvider - lives in the XRDevice process. Provides a way to obtain +poses. + +# Browser <-> Device interfaces (defined in isolated_xr_service.mojom) +The XRDevice process may be the browser process or an isolated service for +different devices implementations. A device provider in the browser will choose +to start the isolated device service when appropriate. + +XRRuntime - an abstraction over a XR API. Lives in the XRDevice process. +Exposes a way for the browser to register for events, and start sessions (Magic +Window or Presentation). + +XRSessionController - Lives in the XRDevice process. Allows the browser to +pause or stop a session (MagicWindow or Presentation). + +XRRuntimeEventListener - Lives in the browser process. Exposes runtime events +to the browser.
diff --git a/device/vr/public/mojom/isolated_xr_service.mojom b/device/vr/public/mojom/isolated_xr_service.mojom new file mode 100644 index 0000000..eddbf817 --- /dev/null +++ b/device/vr/public/mojom/isolated_xr_service.mojom
@@ -0,0 +1,82 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module device.mojom; + +import "device/vr/public/mojom/vr_service.mojom"; + +// The XRSessionController lives in the vr device service, and corresponds to a +// VRPresentationProvider or a VRMagicWindowProvider. The client is the browser +// process, which will pause or stop sessions depending events/state such as +// focus or other tabs requesting presentation. +// Sessions are stopped by closing the mojo connection. +interface XRSessionController { + // A session may be paused temporarily for example when a non-presenting + // tab loses focus. When paused, a session will hand out null poses. + // Eventually we may hand out poses at a throttled rate instead. + SetFrameDataRestricted(bool restricted); +}; + +// The XRRuntimeEventListener lives in the vr device service, and allows the +// browser to listen to state changes about a device. +interface XRRuntimeEventListener { + // A device has changed its display information. + OnDisplayInfoChanged(device.mojom.VRDisplayInfo display_info); + + // A device has indicated that it is in use. + OnDeviceActivated(device.mojom.VRDisplayEventReason reason) => + (bool will_not_present); + + // A device has indicated that it is idle. + OnDeviceIdle(device.mojom.VRDisplayEventReason reason); + + // Called when the device exits presentation. + OnExitPresent(); +}; + +struct XRDeviceRuntimeSessionOptions { + bool exclusive; + + // The following options are used for permission requests. + // TODO(crbug.com/854655): remove these fields, and do permission checks in + // the browser process before calling out to devices. + int32 render_process_id; + int32 render_frame_id; + + // A flag to indicate if there has been a user activation when the request + // session is made. + bool has_user_activation; + + // This flag ensures that render path's that are only supported in WebXR are + // not used for WebVR 1.1. + bool use_legacy_webvr_render_path; +}; + +// An XRRuntime may live in the browser process or a utility process. The +// browser process is the client, and may in turn expose device information to +// render processes using vr_service interfaces, such as VRDisplayHost. +interface XRRuntime { + // Attempt to start a presentation session. Clients may submit graphics to be + // displayed in the headset. Called by the browser process, but the + // VRPresentationProvider may be passed to the renderer process to allow + // submitting graphics without going through an extra IPC hop through the + // browser process. + RequestSession(XRDeviceRuntimeSessionOptions options) => ( + device.mojom.XRPresentationConnection? connection, + XRSessionController? controller); + + // Attempt to start a "magic window" session. Magic window sessions allow + // Clients to obtain poses (device position and orientation), but rendering + // goes through the standard Chrome compositor. + RequestMagicWindowSession(device.mojom.VRMagicWindowProvider& session, + device.mojom.XRSessionController& controller) => + (bool success); + + // The browser may register for changes to a device. Initial VRDisplayInfo + // will immediately be returned to the listener to prevent races. + ListenToDeviceChanges(XRRuntimeEventListener listener) => + (VRDisplayInfo display_info); + + SetListeningForActivate(bool listen_for_activation); +};
diff --git a/device/vr/test/fake_vr_device.cc b/device/vr/test/fake_vr_device.cc index 89c332f..4a5740d 100644 --- a/device/vr/test/fake_vr_device.cc +++ b/device/vr/test/fake_vr_device.cc
@@ -7,7 +7,7 @@ namespace device { FakeVRDevice::FakeVRDevice(unsigned int id) - : VRDeviceBase(static_cast<VRDeviceId>(id)) { + : VRDeviceBase(static_cast<VRDeviceId>(id)), controller_binding_(this) { SetVRDisplayInfo(InitBasicDevice()); } @@ -50,14 +50,27 @@ return eye; } -void FakeVRDevice::RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) { +void FakeVRDevice::RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) { OnStartPresenting(); - std::move(callback).Run(mojom::XRPresentationConnection::New(), this); + + mojom::XRSessionControllerPtr exclusive_session_controller; + controller_binding_.Bind(mojo::MakeRequest(&exclusive_session_controller)); + + // Unretained is safe because the error handler won't be called after + // controller_binding_ is destroyed. + controller_binding_.set_connection_error_handler( + base::BindOnce(&FakeVRDevice::OnPresentingControllerMojoConnectionError, + base::Unretained(this))); + + std::move(callback).Run(mojom::XRPresentationConnection::New(), + std::move(exclusive_session_controller)); } -void FakeVRDevice::StopSession() { +void FakeVRDevice::OnPresentingControllerMojoConnectionError() { OnExitPresent(); + controller_binding_.Close(); } void FakeVRDevice::OnMagicWindowFrameDataRequest(
diff --git a/device/vr/test/fake_vr_device.h b/device/vr/test/fake_vr_device.h index bd87c660..cfe8601 100644 --- a/device/vr/test/fake_vr_device.h +++ b/device/vr/test/fake_vr_device.h
@@ -15,21 +15,25 @@ // TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT FakeVRDevice : public VRDeviceBase, - public XrSessionController { + public mojom::XRSessionController { public: FakeVRDevice(unsigned int id); ~FakeVRDevice() override; - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override; + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override; void SetPose(mojom::VRPosePtr pose) { pose_ = std::move(pose); } - void StopSession() override; void SetFrameDataRestricted(bool restricted) override {} using VRDeviceBase::IsPresenting; // Make it public for tests. + void StopSession() { OnPresentingControllerMojoConnectionError(); } + private: + void OnPresentingControllerMojoConnectionError(); + void OnMagicWindowFrameDataRequest( mojom::VRMagicWindowProvider::GetFrameDataCallback callback) override; @@ -38,6 +42,8 @@ mojom::VRPosePtr pose_; + mojo::Binding<mojom::XRSessionController> controller_binding_; + DISALLOW_COPY_AND_ASSIGN(FakeVRDevice); };
diff --git a/device/vr/test/fake_vr_device_provider.cc b/device/vr/test/fake_vr_device_provider.cc index 437d307a..dc4d097 100644 --- a/device/vr/test/fake_vr_device_provider.cc +++ b/device/vr/test/fake_vr_device_provider.cc
@@ -13,17 +13,19 @@ FakeVRDeviceProvider::~FakeVRDeviceProvider() {} -void FakeVRDeviceProvider::AddDevice(std::unique_ptr<VRDevice> device) { +void FakeVRDeviceProvider::AddDevice(std::unique_ptr<VRDeviceBase> device) { VRDeviceBase* device_base = static_cast<VRDeviceBase*>(device.get()); devices_.push_back(std::move(device)); if (initialized_) - add_device_callback_.Run(device_base->GetId(), devices_.back().get()); + add_device_callback_.Run(device_base->GetId(), + device_base->GetVRDisplayInfo(), + device_base->BindXRRuntimePtr()); } void FakeVRDeviceProvider::RemoveDevice(unsigned int device_id) { auto it = std::find_if( devices_.begin(), devices_.end(), - [device_id](const std::unique_ptr<VRDevice>& device) { + [device_id](const std::unique_ptr<VRDeviceBase>& device) { return static_cast<VRDeviceBase*>(device.get())->GetId() == device_id; }); if (initialized_) @@ -32,15 +34,19 @@ } void FakeVRDeviceProvider::Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) { add_device_callback_ = std::move(add_device_callback); remove_device_callback_ = std::move(remove_device_callback); - for (std::unique_ptr<VRDevice>& device : devices_) { - add_device_callback_.Run(static_cast<VRDeviceBase*>(device.get())->GetId(), - device.get()); + for (std::unique_ptr<VRDeviceBase>& device : devices_) { + auto* device_base = static_cast<VRDeviceBase*>(device.get()); + add_device_callback_.Run(device_base->GetId(), + device_base->GetVRDisplayInfo(), + device_base->BindXRRuntimePtr()); } initialized_ = true; std::move(initialization_complete).Run();
diff --git a/device/vr/test/fake_vr_device_provider.h b/device/vr/test/fake_vr_device_provider.h index dcb03cf4..81924fa 100644 --- a/device/vr/test/fake_vr_device_provider.h +++ b/device/vr/test/fake_vr_device_provider.h
@@ -7,7 +7,7 @@ #include <vector> -#include "device/vr/vr_device.h" +#include "device/vr/vr_device_base.h" #include "device/vr/vr_device_provider.h" #include "device/vr/vr_export.h" @@ -21,20 +21,23 @@ // Adds devices to the provider with the given device, which will be // returned when GetDevices is queried. - void AddDevice(std::unique_ptr<VRDevice> device); + void AddDevice(std::unique_ptr<VRDeviceBase> device); void RemoveDevice(unsigned int device_id); void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) override; bool Initialized() override; private: - std::vector<std::unique_ptr<VRDevice>> devices_; + std::vector<std::unique_ptr<VRDeviceBase>> devices_; bool initialized_; - base::RepeatingCallback<void(unsigned int, VRDevice*)> add_device_callback_; + base::RepeatingCallback< + void(unsigned int, mojom::VRDisplayInfoPtr, mojom::XRRuntimePtr)> + add_device_callback_; base::RepeatingCallback<void(unsigned int)> remove_device_callback_; DISALLOW_COPY_AND_ASSIGN(FakeVRDeviceProvider);
diff --git a/device/vr/test/mock_vr_display_impl.cc b/device/vr/test/mock_vr_display_impl.cc index 38c3cfe..4c63aeb 100644 --- a/device/vr/test/mock_vr_display_impl.cc +++ b/device/vr/test/mock_vr_display_impl.cc
@@ -6,18 +6,13 @@ namespace device { -MockVRDisplayImpl::MockVRDisplayImpl(device::VRDevice* device, - mojom::VRServiceClient* service_client, - mojom::VRDisplayInfoPtr display_info, - mojom::VRDisplayHostPtr display_host, - mojom::VRDisplayClientRequest request, - bool in_frame_focused) - : VRDisplayImpl(device, - std::move(service_client), - std::move(display_info), - std::move(display_host), - std::move(request)) { - SetFrameDataRestricted(!in_frame_focused); +MockVRDisplayImpl::MockVRDisplayImpl( + device::VRDeviceBase* device, + mojom::VRMagicWindowProviderRequest session, + mojom::XRSessionControllerRequest controller, + bool is_frame_focused) + : VRDisplayImpl(device, std::move(session), std::move(controller)) { + SetFrameDataRestricted(!is_frame_focused); } MockVRDisplayImpl::~MockVRDisplayImpl() = default;
diff --git a/device/vr/test/mock_vr_display_impl.h b/device/vr/test/mock_vr_display_impl.h index 9a1663f..32d0e1b8 100644 --- a/device/vr/test/mock_vr_display_impl.h +++ b/device/vr/test/mock_vr_display_impl.h
@@ -13,11 +13,9 @@ class MockVRDisplayImpl : public VRDisplayImpl { public: - MockVRDisplayImpl(device::VRDevice* device, - mojom::VRServiceClient* service_client, - mojom::VRDisplayInfoPtr display_info, - mojom::VRDisplayHostPtr display_host, - mojom::VRDisplayClientRequest request, + MockVRDisplayImpl(device::VRDeviceBase* device, + mojom::VRMagicWindowProviderRequest session, + mojom::XRSessionControllerRequest controller, bool in_frame_focused); ~MockVRDisplayImpl() override;
diff --git a/device/vr/vr_device.h b/device/vr/vr_device.h index a44859e8..aaa2294f 100644 --- a/device/vr/vr_device.h +++ b/device/vr/vr_device.h
@@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/macros.h" +#include "device/vr/public/mojom/isolated_xr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/vr_export.h" @@ -44,73 +45,6 @@ COUNT, }; -const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; - -class VRDeviceEventListener { - public: - virtual ~VRDeviceEventListener() {} - - virtual void OnChanged(mojom::VRDisplayInfoPtr vr_device_info) = 0; - virtual void OnExitPresent() = 0; - virtual void OnActivate(mojom::VRDisplayEventReason reason, - base::OnceCallback<void(bool)> on_handled) = 0; - virtual void OnDeactivate(mojom::VRDisplayEventReason reason) = 0; -}; - -class XrSessionController { - public: - // Give out null frame data and hittest results when restricted. - virtual void SetFrameDataRestricted(bool restricted) = 0; - - // Break binding connection. - virtual void StopSession() = 0; -}; - -struct XRDeviceRuntimeSessionOptions { - bool exclusive; - - // The following options are used for permission requests. - int render_process_id; - int render_frame_id; - - // A flag to indicate if there has been a user activation when the request - // session is made. - bool has_user_activation; - - // This flag ensures that render path's that are only supported in WebXR are - // not used for WebVR 1.1. - bool use_legacy_webvr_render_path; -}; - -// Represents one of the platform's VR devices. Owned by the respective -// VRDeviceProvider. -// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. -class DEVICE_VR_EXPORT VRDevice { - public: - using VRDeviceRequestSessionCallback = - base::OnceCallback<void(mojom::XRPresentationConnectionPtr, - XrSessionController*)>; - - virtual ~VRDevice() {} - - virtual void PauseTracking() = 0; - virtual void ResumeTracking() = 0; - virtual mojom::VRDisplayInfoPtr GetVRDisplayInfo() = 0; - virtual void SetMagicWindowEnabled(bool enabled) = 0; - virtual void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) = 0; - virtual void SetListeningForActivate(bool is_listening) = 0; - - // TODO(mthiesse): The browser should handle browser-side exiting of - // presentation before device/ is even aware presentation is being exited. - // Then the browser should call StopSession() on Device, which does device/ - // exiting of presentation before notifying displays. This is currently messy - // because browser-side notions of presentation are mostly Android-specific. - virtual void OnExitPresent() = 0; - - virtual void SetVRDeviceEventListener(VRDeviceEventListener* listener) = 0; -}; - } // namespace device #endif // DEVICE_VR_VR_DEVICE_H
diff --git a/device/vr/vr_device_base.cc b/device/vr/vr_device_base.cc index c681be11..cd7c8e0 100644 --- a/device/vr/vr_device_base.cc +++ b/device/vr/vr_device_base.cc
@@ -10,7 +10,7 @@ namespace device { VRDeviceBase::VRDeviceBase(VRDeviceId id) - : id_(static_cast<unsigned int>(id)) {} + : id_(static_cast<unsigned int>(id)), runtime_binding_(this) {} VRDeviceBase::~VRDeviceBase() = default; @@ -45,8 +45,11 @@ magic_window_enabled_ = enabled; } -void VRDeviceBase::SetVRDeviceEventListener(VRDeviceEventListener* listener) { - listener_ = listener; +void VRDeviceBase::ListenToDeviceChanges( + mojom::XRRuntimeEventListenerPtr listener, + mojom::XRRuntime::ListenToDeviceChangesCallback callback) { + listener_ = std::move(listener); + std::move(callback).Run(display_info_.Clone()); } void VRDeviceBase::GetFrameData( @@ -83,13 +86,19 @@ return; if (listener_) - listener_->OnChanged(display_info_.Clone()); + listener_->OnDisplayInfoChanged(display_info_.Clone()); } void VRDeviceBase::OnActivate(mojom::VRDisplayEventReason reason, base::Callback<void(bool)> on_handled) { if (listener_) - listener_->OnActivate(reason, std::move(on_handled)); + listener_->OnDeviceActivated(reason, std::move(on_handled)); +} + +mojom::XRRuntimePtr VRDeviceBase::BindXRRuntimePtr() { + mojom::XRRuntimePtr runtime; + runtime_binding_.Bind(mojo::MakeRequest(&runtime)); + return runtime; } bool VRDeviceBase::ShouldPauseTrackingWhenFrameDataRestricted() { @@ -121,4 +130,20 @@ std::move(callback).Run(base::nullopt); } +void VRDeviceBase::RequestMagicWindowSession( + mojom::VRMagicWindowProviderRequest provider_request, + mojom::XRSessionControllerRequest controller_request, + mojom::XRRuntime::RequestMagicWindowSessionCallback callback) { + magic_window_sessions_.push_back(std::make_unique<VRDisplayImpl>( + this, std::move(provider_request), std::move(controller_request))); + std::move(callback).Run(true); +} + +void VRDeviceBase::EndMagicWindowSession(VRDisplayImpl* session) { + base::EraseIf(magic_window_sessions_, + [&](const std::unique_ptr<VRDisplayImpl>& item) { + return item.get() == session; + }); +} + } // namespace device
diff --git a/device/vr/vr_device_base.h b/device/vr/vr_device_base.h index 564163c..008293e 100644 --- a/device/vr/vr_device_base.h +++ b/device/vr/vr_device_base.h
@@ -10,25 +10,25 @@ #include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/vr_device.h" #include "device/vr/vr_export.h" +#include "mojo/public/cpp/bindings/binding.h" #include "ui/display/display.h" namespace device { +class VRDisplayImpl; + // Represents one of the platform's VR devices. Owned by the respective // VRDeviceProvider. // TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. -class DEVICE_VR_EXPORT VRDeviceBase : public VRDevice { +class DEVICE_VR_EXPORT VRDeviceBase : public mojom::XRRuntime { public: explicit VRDeviceBase(VRDeviceId id); ~VRDeviceBase() override; // VRDevice Implementation - void PauseTracking() override; - void ResumeTracking() override; - void OnExitPresent() override; - mojom::VRDisplayInfoPtr GetVRDisplayInfo() final; - void SetMagicWindowEnabled(bool enabled) final; - void SetVRDeviceEventListener(VRDeviceEventListener* listener) final; + void ListenToDeviceChanges( + mojom::XRRuntimeEventListenerPtr listener, + mojom::XRRuntime::ListenToDeviceChangesCallback callback) final; void SetListeningForActivate(bool is_listening) override; void GetFrameData( @@ -44,6 +44,7 @@ unsigned int GetId() const; bool HasExclusiveSession(); + void EndMagicWindowSession(VRDisplayImpl* session); // TODO(https://crbug.com/845283): This method is a temporary solution // until a XR related refactor lands. It allows to keep using the @@ -51,6 +52,24 @@ // existing VR functionality. virtual bool ShouldPauseTrackingWhenFrameDataRestricted(); + // Devices may be paused/resumed when focus changes by VRDisplayImpl or + // GVR delegate. + virtual void PauseTracking(); + virtual void ResumeTracking(); + void SetMagicWindowEnabled(bool enabled); + + mojom::VRDisplayInfoPtr GetVRDisplayInfo(); + + // Used by providers to bind devices. + mojom::XRRuntimePtr BindXRRuntimePtr(); + + // TODO(mthiesse): The browser should handle browser-side exiting of + // presentation before device/ is even aware presentation is being exited. + // Then the browser should call StopSession() on Device, which does device/ + // exiting of presentation before notifying displays. This is currently messy + // because browser-side notions of presentation are mostly Android-specific. + virtual void OnExitPresent(); + protected: // Devices tell VRDeviceBase when they start presenting. It will be paired // with an OnExitPresent when the device stops presenting. @@ -59,7 +78,6 @@ void SetVRDisplayInfo(mojom::VRDisplayInfoPtr display_info); void OnActivate(mojom::VRDisplayEventReason reason, base::Callback<void(bool)> on_handled); - private: // TODO(https://crbug.com/842227): Rename methods to HandleOnXXX virtual void OnListeningForActivate(bool listening); @@ -70,7 +88,13 @@ display::Display::Rotation rotation, mojom::VRMagicWindowProvider::GetFrameDataCallback callback); - VRDeviceEventListener* listener_ = nullptr; + // XRRuntime + void RequestMagicWindowSession( + mojom::VRMagicWindowProviderRequest provider_request, + mojom::XRSessionControllerRequest controller_request, + mojom::XRRuntime::RequestMagicWindowSessionCallback callback) override; + + mojom::XRRuntimeEventListenerPtr listener_; mojom::VRDisplayInfoPtr display_info_; @@ -79,6 +103,10 @@ unsigned int id_; bool magic_window_enabled_ = true; + mojo::Binding<mojom::XRRuntime> runtime_binding_; + + std::vector<std::unique_ptr<VRDisplayImpl>> magic_window_sessions_; + DISALLOW_COPY_AND_ASSIGN(VRDeviceBase); };
diff --git a/device/vr/vr_device_base_unittest.cc b/device/vr/vr_device_base_unittest.cc index 8119b29..5025d3ed 100644 --- a/device/vr/vr_device_base_unittest.cc +++ b/device/vr/vr_device_base_unittest.cc
@@ -34,8 +34,9 @@ bool ListeningForActivate() { return listening_for_activate; } - void RequestSession(const XRDeviceRuntimeSessionOptions& options, - VRDeviceRequestSessionCallback callback) override {} + void RequestSession( + mojom::XRDeviceRuntimeSessionOptionsPtr options, + mojom::XRRuntime::RequestSessionCallback callback) override {} private: void OnListeningForActivate(bool listening) override { @@ -47,23 +48,38 @@ DISALLOW_COPY_AND_ASSIGN(VRDeviceBaseForTesting); }; -class StubVRDeviceEventListener : public VRDeviceEventListener { +class StubVRDeviceEventListener : public mojom::XRRuntimeEventListener { public: + StubVRDeviceEventListener() : binding_(this) {} ~StubVRDeviceEventListener() override {} MOCK_METHOD1(DoOnChanged, void(mojom::VRDisplayInfo* vr_device_info)); - void OnChanged(mojom::VRDisplayInfoPtr vr_device_info) override { + void OnDisplayInfoChanged(mojom::VRDisplayInfoPtr vr_device_info) override { DoOnChanged(vr_device_info.get()); } - MOCK_METHOD2(OnActivate, + MOCK_METHOD2(DoOnDeviceActivated, void(mojom::VRDisplayEventReason, base::OnceCallback<void(bool)>)); + void OnDeviceActivated(mojom::VRDisplayEventReason reason, + base::OnceCallback<void(bool)> callback) override { + DoOnDeviceActivated(reason, base::DoNothing()); + // For now keep the test simple, and just call the callback: + std::move(callback).Run(true); + } MOCK_METHOD0(OnExitPresent, void()); MOCK_METHOD0(OnBlur, void()); MOCK_METHOD0(OnFocus, void()); - MOCK_METHOD1(OnDeactivate, void(mojom::VRDisplayEventReason)); + MOCK_METHOD1(OnDeviceIdle, void(mojom::VRDisplayEventReason)); + + mojom::XRRuntimeEventListenerPtr BindPtr() { + mojom::XRRuntimeEventListenerPtr ret; + binding_.Bind(mojo::MakeRequest(&ret)); + return ret; + } + + mojo::Binding<mojom::XRRuntimeEventListener> binding_; }; } // namespace @@ -80,9 +96,10 @@ } std::unique_ptr<MockVRDisplayImpl> MakeMockDisplay(VRDeviceBase* device) { - mojom::VRDisplayClientPtr display_client; + mojom::VRMagicWindowProviderPtr session; + mojom::XRSessionControllerPtr controller; return std::make_unique<testing::NiceMock<MockVRDisplayImpl>>( - device, client(), nullptr, nullptr, mojo::MakeRequest(&display_client), + device, mojo::MakeRequest(&session), mojo::MakeRequest(&controller), false); } @@ -96,6 +113,7 @@ mojom::VRDisplayInfoPtr MakeVRDisplayInfo(unsigned int device_id) { mojom::VRDisplayInfoPtr display_info = mojom::VRDisplayInfo::New(); display_info->index = device_id; + display_info->capabilities = mojom::VRDisplayCapabilities::New(); return display_info; } @@ -113,9 +131,12 @@ TEST_F(VRDeviceTest, DeviceChangedDispatched) { auto device = MakeVRDevice(); StubVRDeviceEventListener listener; - device->SetVRDeviceEventListener(&listener); + device->ListenToDeviceChanges( + listener.BindPtr(), + base::DoNothing()); // TODO: consider getting initial info EXPECT_CALL(listener, DoOnChanged(testing::_)).Times(1); device->SetVRDisplayInfoForTest(MakeVRDisplayInfo(device->GetId())); + base::RunLoop().RunUntilIdle(); } TEST_F(VRDeviceTest, DisplayActivateRegsitered) { @@ -123,14 +144,17 @@ device::mojom::VRDisplayEventReason::MOUNTED; auto device = MakeVRDevice(); StubVRDeviceEventListener listener; - device->SetVRDeviceEventListener(&listener); + device->ListenToDeviceChanges( + listener.BindPtr(), + base::DoNothing()); // TODO: consider getting initial data EXPECT_FALSE(device->ListeningForActivate()); device->SetListeningForActivate(true); EXPECT_TRUE(device->ListeningForActivate()); - EXPECT_CALL(listener, OnActivate(mounted, testing::_)).Times(1); + EXPECT_CALL(listener, DoOnDeviceActivated(mounted, testing::_)).Times(1); device->FireDisplayActivate(); + base::RunLoop().RunUntilIdle(); } TEST_F(VRDeviceTest, NoMagicWindowPosesWhileBrowsing) {
diff --git a/device/vr/vr_device_provider.h b/device/vr/vr_device_provider.h index 8d72a88..26732491 100644 --- a/device/vr/vr_device_provider.h +++ b/device/vr/vr_device_provider.h
@@ -8,11 +8,10 @@ #include <vector> #include "base/callback.h" +#include "device/vr/public/mojom/isolated_xr_service.mojom.h" namespace device { -class VRDevice; - class VRDeviceProvider { public: VRDeviceProvider() {} @@ -20,8 +19,9 @@ // If the VR API requires initialization that should happen here. virtual void Initialize( - base::RepeatingCallback<void(unsigned int, VRDevice*)> - add_device_callback, + base::RepeatingCallback<void(unsigned int, + mojom::VRDisplayInfoPtr, + mojom::XRRuntimePtr)> add_device_callback, base::RepeatingCallback<void(unsigned int)> remove_device_callback, base::OnceClosure initialization_complete) = 0;
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc index cedee476..cc408278 100644 --- a/device/vr/vr_display_impl.cc +++ b/device/vr/vr_display_impl.cc
@@ -15,17 +15,20 @@ namespace device { -VRDisplayImpl::VRDisplayImpl(VRDevice* device, - mojom::VRServiceClient* service_client, - mojom::VRDisplayInfoPtr display_info, - mojom::VRDisplayHostPtr display_host, - mojom::VRDisplayClientRequest client_request) - : binding_(this), device_(static_cast<VRDeviceBase*>(device)) { - mojom::VRMagicWindowProviderPtr magic_window_provider; - binding_.Bind(mojo::MakeRequest(&magic_window_provider)); - service_client->OnDisplayConnected( - std::move(magic_window_provider), std::move(display_host), - std::move(client_request), std::move(display_info)); +VRDisplayImpl::VRDisplayImpl( + VRDeviceBase* device, + mojom::VRMagicWindowProviderRequest magic_window_request, + mojom::XRSessionControllerRequest session_request) + : magic_window_binding_(this), + session_controller_binding_(this), + device_(device) { + magic_window_binding_.Bind(std::move(magic_window_request)); + session_controller_binding_.Bind(std::move(session_request)); + + // Unretained is safe because the binding will close when we are destroyed, + // so we won't receive any more callbacks after that. + session_controller_binding_.set_connection_error_handler(base::BindOnce( + &VRDisplayImpl::OnMojoConnectionError, base::Unretained(this))); } VRDisplayImpl::~VRDisplayImpl() = default; @@ -74,7 +77,7 @@ device_->RequestHitTest(std::move(ray), std::move(callback)); } -// XrSessionController +// XRSessionController void VRDisplayImpl::SetFrameDataRestricted(bool frame_data_restricted) { restrict_frame_data_ = frame_data_restricted; if (device_->ShouldPauseTrackingWhenFrameDataRestricted()) { @@ -86,8 +89,10 @@ } } -void VRDisplayImpl::StopSession() { - binding_.Close(); +void VRDisplayImpl::OnMojoConnectionError() { + magic_window_binding_.Close(); + session_controller_binding_.Close(); + device_->EndMagicWindowSession(this); // This call will destroy us. } } // namespace device
diff --git a/device/vr/vr_display_impl.h b/device/vr/vr_display_impl.h index 3f905c6..4ab80c61 100644 --- a/device/vr/vr_display_impl.h +++ b/device/vr/vr_display_impl.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "device/vr/public/mojom/isolated_xr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/vr_device.h" #include "device/vr/vr_export.h" @@ -19,27 +20,22 @@ class VRDeviceBase; -// Browser process representation of a VRDevice within a WebVR site session -// (see VRServiceImpl). VRDisplayImpl receives/sends VR device events -// from/to mojom::VRDisplayClient (the render process representation of a VR -// device). -// VRDisplayImpl objects are owned by their respective VRServiceImpl instances. -// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. +// VR device process implementation of a VRMagicWindowProvider within a WebVR +// or WebXR site session. +// VRDisplayImpl objects are owned by their respective XRRuntime instances. +// TODO(offenwanger): Rename this. class DEVICE_VR_EXPORT VRDisplayImpl : public mojom::VRMagicWindowProvider, - public XrSessionController { + public mojom::XRSessionController { public: - VRDisplayImpl(VRDevice* device, - mojom::VRServiceClient* service_client, - mojom::VRDisplayInfoPtr display_info, - mojom::VRDisplayHostPtr display_host, - mojom::VRDisplayClientRequest client_request); + VRDisplayImpl(VRDeviceBase* device, + mojom::VRMagicWindowProviderRequest, + mojom::XRSessionControllerRequest); ~VRDisplayImpl() override; - // XrSessionController - void SetFrameDataRestricted(bool paused) override; - void StopSession() override; + device::VRDeviceBase* device() { return device_; }; - private: + // Accessible to tests. + protected: // mojom::VRMagicWindowProvider void GetFrameData(GetFrameDataCallback callback) override; void UpdateSessionGeometry(const gfx::Size& frame_size, @@ -47,9 +43,14 @@ void RequestHitTest(mojom::XRRayPtr ray, RequestHitTestCallback callback) override; - mojo::Binding<mojom::VRMagicWindowProvider> binding_; - device::VRDeviceBase* device_; + // mojom::XRSessionController + void SetFrameDataRestricted(bool paused) override; + void OnMojoConnectionError(); + + mojo::Binding<mojom::VRMagicWindowProvider> magic_window_binding_; + mojo::Binding<mojom::XRSessionController> session_controller_binding_; + device::VRDeviceBase* device_; bool restrict_frame_data_ = true; // TODO(offenwanger) When device tracks it's own sessions, let it track this
diff --git a/device/vr/vr_display_impl_unittest.cc b/device/vr/vr_display_impl_unittest.cc index 2d15240b..e20d720 100644 --- a/device/vr/vr_display_impl_unittest.cc +++ b/device/vr/vr_display_impl_unittest.cc
@@ -21,9 +21,12 @@ VRDisplayImplTest() {} ~VRDisplayImplTest() override {} void onDisplaySynced() {} - void onPresentComplete(device::mojom::XRPresentationConnectionPtr connection, - XrSessionController* exclusive_session_controller) { + void onPresentComplete( + device::mojom::XRPresentationConnectionPtr connection, + mojom::XRSessionControllerPtr exclusive_session_controller) { is_request_presenting_success_ = connection ? true : false; + + exclusive_session_controller_ = std::move(exclusive_session_controller); } protected: @@ -34,23 +37,27 @@ client_ = std::make_unique<FakeVRServiceClient>(mojo::MakeRequest(&proxy)); } - std::unique_ptr<VRDisplayImpl> MakeDisplay() { - mojom::VRDisplayClientPtr display_client; + std::unique_ptr<VRDisplayImpl> MakeDisplay( + mojom::XRSessionControllerPtr* controller) { + mojom::VRMagicWindowProviderPtr session; auto display = std::make_unique<VRDisplayImpl>( - device(), client(), device()->GetVRDisplayInfo(), nullptr, - mojo::MakeRequest(&display_client)); - display->SetFrameDataRestricted(true); + device(), mojo::MakeRequest(&session), mojo::MakeRequest(controller)); + static_cast<mojom::XRSessionController*>(display.get()) + ->SetFrameDataRestricted(true); return display; } void RequestSession(VRDisplayImpl* display_impl) { device_->RequestSession( - XRDeviceRuntimeSessionOptions(), + mojom::XRDeviceRuntimeSessionOptionsPtr(), base::BindOnce(&VRDisplayImplTest::onPresentComplete, base::Unretained(this))); } - void ExitPresent() { device_->StopSession(); } + void ExitPresent() { + device_->StopSession(); + exclusive_session_controller_ = nullptr; + } bool presenting() { return device_->IsPresenting(); } VRDeviceBase* device() { return device_.get(); } @@ -60,15 +67,20 @@ bool is_request_presenting_success_ = false; std::unique_ptr<FakeVRDevice> device_; std::unique_ptr<FakeVRServiceClient> client_; + mojom::XRSessionControllerPtr exclusive_session_controller_; DISALLOW_COPY_AND_ASSIGN(VRDisplayImplTest); }; TEST_F(VRDisplayImplTest, DevicePresentationIsolation) { - std::unique_ptr<VRDisplayImpl> display_1 = MakeDisplay(); - display_1->SetFrameDataRestricted(false); - std::unique_ptr<VRDisplayImpl> display_2 = MakeDisplay(); - display_2->SetFrameDataRestricted(false); + mojom::XRSessionControllerPtr controller1; + std::unique_ptr<VRDisplayImpl> display_1 = MakeDisplay(&controller1); + static_cast<mojom::XRSessionController*>(display_1.get()) + ->SetFrameDataRestricted(false); + mojom::XRSessionControllerPtr controller2; + std::unique_ptr<VRDisplayImpl> display_2 = MakeDisplay(&controller2); + static_cast<mojom::XRSessionController*>(display_2.get()) + ->SetFrameDataRestricted(false); // When not presenting either service should be able to access the device. EXPECT_FALSE(device()->HasExclusiveSession());
diff --git a/gpu/OWNERS b/gpu/OWNERS index d76d04b..57ab7ae8 100644 --- a/gpu/OWNERS +++ b/gpu/OWNERS
@@ -8,5 +8,6 @@ # GPU memory buffer implementations. per-file *gpu_memory_buffer*=reveman@chromium.org +per-file *gpu_memory_buffer*=dcastagna@chromium.org # COMPONENT: Internals>GPU>Internals
diff --git a/gpu/command_buffer/OWNERS b/gpu/command_buffer/OWNERS index 95fbe52..3a9a508 100644 --- a/gpu/command_buffer/OWNERS +++ b/gpu/command_buffer/OWNERS
@@ -5,6 +5,6 @@ # GPU memory buffer tests. per-file *gpu_memory_buffer*=reveman@chromium.org - +per-file *gpu_memory_buffer*=dcastagna@chromium.org # COMPONENT: Internals>GPU>Internals
diff --git a/gpu/ipc/client/OWNERS b/gpu/ipc/client/OWNERS index 9422fa59..6759040c 100644 --- a/gpu/ipc/client/OWNERS +++ b/gpu/ipc/client/OWNERS
@@ -1,5 +1,6 @@ # GPU memory buffer interface. per-file gpu_memory_buffer*=reveman@chromium.org +per-file gpu_memory_buffer*=dcastagna@chromium.org # IOSurface usage. per-file *io_surface*=ccameron@chromium.org
diff --git a/gpu/perftests/OWNERS b/gpu/perftests/OWNERS index 157836ab..c7cef4f 100644 --- a/gpu/perftests/OWNERS +++ b/gpu/perftests/OWNERS
@@ -1 +1 @@ -reveman@chromium.org +dcastagna@chromium.org
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index acdad034..bc5a68a 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -54,7 +54,6 @@ #include "ios/chrome/browser/ui/main/main_feature_flags.h" #import "ios/chrome/browser/ui/toolbar/public/features.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" -#include "ios/chrome/browser/ui/user_feedback_features.h" #include "ios/chrome/browser/web/features.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" @@ -286,13 +285,6 @@ flag_descriptions::kMailtoHandlingWithGoogleUIName, flag_descriptions::kMailtoHandlingWithGoogleUIDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kMailtoHandledWithGoogleUI)}, - {"feedback-kit-v2", flag_descriptions::kFeedbackKitV2Name, - flag_descriptions::kFeedbackKitV2Description, flags_ui::kOsIos, - FEATURE_VALUE_TYPE(kFeedbackKitV2)}, - {"feedback-kit-v2-sso-service", - flag_descriptions::kFeedbackKitV2WithSSOServiceName, - flag_descriptions::kFeedbackKitV2WithSSOServiceDescription, - flags_ui::kOsIos, FEATURE_VALUE_TYPE(kFeedbackKitV2WithSSOService)}, {"new-clear-browsing-data-ui", flag_descriptions::kNewClearBrowsingDataUIName, flag_descriptions::kNewClearBrowsingDataUIDescription, flags_ui::kOsIos,
diff --git a/ios/chrome/browser/experimental_flags.mm b/ios/chrome/browser/experimental_flags.mm index 572ce86..1923016f 100644 --- a/ios/chrome/browser/experimental_flags.mm +++ b/ios/chrome/browser/experimental_flags.mm
@@ -25,7 +25,6 @@ #include "ios/chrome/browser/browsing_data/browsing_data_features.h" #include "ios/chrome/browser/chrome_switches.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" -#include "ios/chrome/browser/ui/user_feedback_features.h" #include "ios/web/public/web_view_creation_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -114,11 +113,11 @@ } bool IsNewFeedbackKitEnabled() { - return base::FeatureList::IsEnabled(kFeedbackKitV2); + return true; } bool IsNewFeedbackKitEnabledWithSSOService() { - return base::FeatureList::IsEnabled(kFeedbackKitV2WithSSOService); + return true; } bool IsThirdPartyKeyboardWorkaroundEnabled() {
diff --git a/ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provider_factory.mm b/ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provider_factory.mm index 6fd6728..fca4adb 100644 --- a/ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provider_factory.mm +++ b/ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provider_factory.mm
@@ -25,6 +25,7 @@ #include "ios/chrome/browser/signin/signin_manager_factory.h" #include "ios/web/public/web_client.h" #include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -76,7 +77,8 @@ browser_state->GetPrefs()), IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state) ->driver(), - browser_state->GetRequestContext())); + browser_state->GetRequestContext(), + browser_state->GetSharedURLLoaderFactory())); service->Init( std::make_unique<InvalidatorStorage>(browser_state->GetPrefs()));
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index 8fae883..9b9c30c 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -140,13 +140,6 @@ const char kExternalSearchName[] = "External Search"; const char kExternalSearchDescription[] = "Enable support for External Search."; -const char kFeedbackKitV2Name[] = "FeedbackKit V2"; -const char kFeedbackKitV2Description[] = "Enable use of FeedbackKit V2."; -const char kFeedbackKitV2WithSSOServiceName[] = - "FeedbackKit V2 with SSOService configured for FeedbackKit"; -const char kFeedbackKitV2WithSSOServiceDescription[] = - "Send SSOService with configuration for FeedbackKit V2."; - const char kFullscreenViewportAdjustmentExperimentName[] = "Fullscreen Viewport Adjustment Mode"; const char kFullscreenViewportAdjustmentExperimentDescription[] =
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index 4af6aae..ba2e51fd 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -117,12 +117,6 @@ extern const char kExternalSearchName[]; extern const char kExternalSearchDescription[]; -// Title and description for the flags to enable use of FeedbackKit V2. -extern const char kFeedbackKitV2Name[]; -extern const char kFeedbackKitV2Description[]; -extern const char kFeedbackKitV2WithSSOServiceName[]; -extern const char kFeedbackKitV2WithSSOServiceDescription[]; - // Title and description for the command line switch used to determine the // active fullscreen viewport adjustment mode. extern const char kFullscreenViewportAdjustmentExperimentName[];
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm index 8e97015..f9ae6baa 100644 --- a/ios/chrome/browser/payments/payment_request.mm +++ b/ios/chrome/browser/payments/payment_request.mm
@@ -522,7 +522,8 @@ std::vector<std::unique_ptr<IOSPaymentInstrument>> native_app_instruments) { const std::vector<autofill::CreditCard*>& credit_cards_to_suggest = personal_data_manager_->GetCreditCardsToSuggest( - /*include_server_cards=*/true); + /*include_server_cards=*/base::FeatureList::IsEnabled( + payments::features::kReturnGooglePayInBasicCard)); // Return early if the user has no stored credit cards or installed payment // apps.
diff --git a/ios/chrome/browser/payments/payment_request_unittest.mm b/ios/chrome/browser/payments/payment_request_unittest.mm index 159224f7..1fb492c 100644 --- a/ios/chrome/browser/payments/payment_request_unittest.mm +++ b/ios/chrome/browser/payments/payment_request_unittest.mm
@@ -319,6 +319,64 @@ EXPECT_EQ("unionpay", payment_request.supported_card_networks()[1]); } +TEST_F(PaymentRequestTest, GooglePayCardsInBasicCard_Allowed) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(features::kReturnGooglePayInBasicCard); + + WebPaymentRequest web_payment_request; + PaymentMethodData method_datum; + method_datum.supported_methods.push_back("basic-card"); + method_datum.supported_networks.push_back("mastercard"); + web_payment_request.method_data.push_back(method_datum); + + // Add a mastercard with billing address. + autofill::AutofillProfile address = autofill::test::GetFullProfile(); + test_personal_data_manager_.AddProfile(address); + autofill::CreditCard credit_card = autofill::test::GetMaskedServerCard(); + credit_card.set_card_type(autofill::CreditCard::CardType::CARD_TYPE_CREDIT); + credit_card.set_billing_address_id(address.guid()); + test_personal_data_manager_.AddServerCreditCard(credit_card); + + TestPaymentRequest payment_request(web_payment_request, + chrome_browser_state_.get(), &web_state_, + &test_personal_data_manager_); + + // The card is available in the payment request, and added to the + // PersonalDataManager. + EXPECT_EQ(1U, payment_request.payment_methods().size()); + // The card is expected to have been added to the PersonalDataManager. + EXPECT_EQ(1U, test_personal_data_manager_.GetCreditCards().size()); +} + +TEST_F(PaymentRequestTest, GooglePayCardsInBasicCard_NotAllowed) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kReturnGooglePayInBasicCard); + + WebPaymentRequest web_payment_request; + PaymentMethodData method_datum; + method_datum.supported_methods.push_back("basic-card"); + method_datum.supported_networks.push_back("mastercard"); + web_payment_request.method_data.push_back(method_datum); + + // Add a mastercard with billing address. + autofill::AutofillProfile address = autofill::test::GetFullProfile(); + test_personal_data_manager_.AddProfile(address); + autofill::CreditCard credit_card = autofill::test::GetMaskedServerCard(); + credit_card.set_card_type(autofill::CreditCard::CardType::CARD_TYPE_CREDIT); + credit_card.set_billing_address_id(address.guid()); + test_personal_data_manager_.AddServerCreditCard(credit_card); + + TestPaymentRequest payment_request(web_payment_request, + chrome_browser_state_.get(), &web_state_, + &test_personal_data_manager_); + + // The card is not available in the payment request, but added to the + // PersonalDataManager. + EXPECT_TRUE(payment_request.payment_methods().empty()); + // The card is expected to have been added to the PersonalDataManager. + EXPECT_EQ(1U, test_personal_data_manager_.GetCreditCards().size()); +} + // Tests that an autofill payment instrumnt e.g., credit cards can be added // to the list of available payment methods. TEST_F(PaymentRequestTest, CreateAndAddAutofillPaymentInstrument) { @@ -1150,7 +1208,7 @@ autofill::CreditCard credit_card = autofill::test::GetMaskedServerCardAmex(); credit_card.set_card_type(autofill::CreditCard::CardType::CARD_TYPE_CREDIT); credit_card.set_billing_address_id(address.guid()); - test_personal_data_manager_.AddCreditCard(credit_card); + test_personal_data_manager_.AddServerCreditCard(credit_card); WebPaymentRequest web_payment_request = payment_request_test_util::CreateTestWebPaymentRequest();
diff --git a/ios/chrome/browser/translate/chrome_ios_translate_client.h b/ios/chrome/browser/translate/chrome_ios_translate_client.h index 64a3f35..15befec2 100644 --- a/ios/chrome/browser/translate/chrome_ios_translate_client.h +++ b/ios/chrome/browser/translate/chrome_ios_translate_client.h
@@ -71,7 +71,7 @@ std::unique_ptr<infobars::InfoBar> CreateInfoBar( std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const override; - void ShowTranslateUI(translate::TranslateStep step, + bool ShowTranslateUI(translate::TranslateStep step, const std::string& source_language, const std::string& target_language, translate::TranslateErrors::Type error_type,
diff --git a/ios/chrome/browser/translate/chrome_ios_translate_client.mm b/ios/chrome/browser/translate/chrome_ios_translate_client.mm index 547afd1..d6282ace 100644 --- a/ios/chrome/browser/translate/chrome_ios_translate_client.mm +++ b/ios/chrome/browser/translate/chrome_ios_translate_client.mm
@@ -161,7 +161,7 @@ } } -void ChromeIOSTranslateClient::ShowTranslateUI( +bool ChromeIOSTranslateClient::ShowTranslateUI( translate::TranslateStep step, const std::string& source_language, const std::string& target_language, @@ -178,6 +178,8 @@ InfoBarManagerImpl::FromWebState(web_state_), web_state_->GetBrowserState()->IsOffTheRecord(), step, source_language, target_language, error_type, triggered_from_menu); + + return true; } translate::IOSTranslateDriver* ChromeIOSTranslateClient::GetTranslateDriver() {
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index e2e8aa78..77990d1f 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -88,8 +88,6 @@ sources = [ "ui_feature_flags.cc", "ui_feature_flags.h", - "user_feedback_features.cc", - "user_feedback_features.h", ] deps = [ "//base",
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 2a389427..3eb7a75d 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -1609,7 +1609,6 @@ #pragma mark - UIViewController -// Perform additional set up after loading the view, typically from a nib. - (void)viewDidLoad { CGRect initialViewsRect = self.view.bounds; if (!self.usesFullscreenContainer) { @@ -2403,6 +2402,7 @@ aboveSubview:self.primaryToolbarCoordinator.viewController.view]; } NSArray<GuideName*>* guideNames = @[ + kContentAreaGuide, kOmniboxGuide, kBackButtonGuide, kForwardButtonGuide, @@ -2413,6 +2413,33 @@ kVoiceSearchButtonGuide, ]; AddNamedGuidesToView(guideNames, self.view); + + // Configure the content area guide. + NamedGuide* contentAreaGuide = + [NamedGuide guideWithName:kContentAreaGuide view:self.view]; + + // Constrain top to bottom of top toolbar. + UIView* primaryToolbarView = + self.primaryToolbarCoordinator.viewController.view; + [contentAreaGuide.topAnchor + constraintEqualToAnchor:primaryToolbarView.bottomAnchor] + .active = YES; + + LayoutSides contentSides = LayoutSides::kLeading | LayoutSides::kTrailing; + if (self.secondaryToolbarCoordinator) { + // If there's a bottom toolbar, the content area guide is constrained to + // its top. + UIView* secondaryToolbarView = + self.secondaryToolbarCoordinator.viewController.view; + [contentAreaGuide.bottomAnchor + constraintEqualToAnchor:secondaryToolbarView.topAnchor] + .active = YES; + } else { + // Otherwise, the content area guide is constrained to self.view's bootom + // along with its sides; + contentSides = contentSides | LayoutSides::kBottom; + } + AddSameConstraintsToSides(self.view, contentAreaGuide, contentSides); } if (initialLayout) { [self.primaryToolbarCoordinator.viewController
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index 466e7ca0a..e6d00c7 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -167,9 +167,6 @@ initWithRootViewController:controller browserState:browserState delegate:delegate]; - if (!experimental_flags::IsNewFeedbackKitEnabled()) { - [controller navigationItem].rightBarButtonItem = [nc cancelButton]; - } return nc; }
diff --git a/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm b/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm index 28462c1..9f734cd 100644 --- a/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm +++ b/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm
@@ -21,7 +21,10 @@ @property(nonatomic, weak) UIImageView* iconView; @property(nonatomic, weak) TopAlignedImageView* snapshotView; @property(nonatomic, weak) UILabel* titleLabel; -@property(nonatomic, weak) UIButton* closeButton; +@property(nonatomic, weak) UIImageView* closeIconView; +// Since the close icon dimensions are smaller than the recommended tap target +// size, use an overlaid tap target button. +@property(nonatomic, weak) UIButton* closeTapTargetButton; @property(nonatomic, weak) UIView* border; @end @@ -38,7 +41,8 @@ @synthesize iconView = _iconView; @synthesize snapshotView = _snapshotView; @synthesize titleLabel = _titleLabel; -@synthesize closeButton = _closeButton; +@synthesize closeIconView = _closeIconView; +@synthesize closeTapTargetButton = _closeTapTargetButton; @synthesize border = _border; // |-dequeueReusableCellWithReuseIdentifier:forIndexPath:| calls this method to @@ -53,10 +57,23 @@ UIView* topBar = [self setupTopBar]; TopAlignedImageView* snapshotView = [[TopAlignedImageView alloc] init]; snapshotView.translatesAutoresizingMaskIntoConstraints = NO; + + UIButton* closeTapTargetButton = + [UIButton buttonWithType:UIButtonTypeCustom]; + closeTapTargetButton.translatesAutoresizingMaskIntoConstraints = NO; + [closeTapTargetButton addTarget:self + action:@selector(closeButtonTapped:) + forControlEvents:UIControlEventTouchUpInside]; + closeTapTargetButton.accessibilityIdentifier = + kGridCellCloseButtonIdentifier; + [contentView addSubview:topBar]; [contentView addSubview:snapshotView]; + [contentView addSubview:closeTapTargetButton]; _topBar = topBar; _snapshotView = snapshotView; + _closeTapTargetButton = closeTapTargetButton; + NSArray* constraints = @[ [topBar.topAnchor constraintEqualToAnchor:contentView.topAnchor], [topBar.leadingAnchor constraintEqualToAnchor:contentView.leadingAnchor], @@ -70,6 +87,14 @@ constraintEqualToAnchor:contentView.trailingAnchor], [snapshotView.bottomAnchor constraintEqualToAnchor:contentView.bottomAnchor], + [closeTapTargetButton.topAnchor + constraintEqualToAnchor:contentView.topAnchor], + [closeTapTargetButton.trailingAnchor + constraintEqualToAnchor:contentView.trailingAnchor], + [closeTapTargetButton.widthAnchor + constraintEqualToConstant:kGridCellCloseTapTargetWidthHeight], + [closeTapTargetButton.heightAnchor + constraintEqualToConstant:kGridCellCloseTapTargetWidthHeight], ]; [NSLayoutConstraint activateConstraints:constraints]; } @@ -123,7 +148,7 @@ self.topBar.backgroundColor = UIColorFromRGB(kGridLightThemeCellHeaderColor); self.titleLabel.textColor = UIColorFromRGB(kGridLightThemeCellTitleColor); - self.closeButton.tintColor = + self.closeIconView.tintColor = UIColorFromRGB(kGridLightThemeCellCloseButtonTintColor); self.border.layer.borderColor = UIColorFromRGB(kGridLightThemeCellSelectionColor).CGColor; @@ -132,7 +157,7 @@ self.topBar.backgroundColor = UIColorFromRGB(kGridDarkThemeCellHeaderColor); self.titleLabel.textColor = UIColorFromRGB(kGridDarkThemeCellTitleColor); - self.closeButton.tintColor = + self.closeIconView.tintColor = UIColorFromRGB(kGridDarkThemeCellCloseButtonTintColor); self.border.layer.borderColor = UIColorFromRGB(kGridDarkThemeCellSelectionColor).CGColor; @@ -185,24 +210,18 @@ titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; titleLabel.adjustsFontForContentSizeCategory = YES; - UIButton* closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; - closeButton.translatesAutoresizingMaskIntoConstraints = NO; - UIImage* closeImage = [[UIImage imageNamed:@"grid_cell_close_button"] + UIImageView* closeIconView = [[UIImageView alloc] init]; + closeIconView.translatesAutoresizingMaskIntoConstraints = NO; + closeIconView.contentMode = UIViewContentModeCenter; + closeIconView.image = [[UIImage imageNamed:@"grid_cell_close_button"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - [closeButton setImage:closeImage forState:UIControlStateNormal]; - closeButton.contentEdgeInsets = UIEdgeInsetsMake( - 0, kGridCellCloseButtonContentInset, 0, kGridCellCloseButtonContentInset); - [closeButton addTarget:self - action:@selector(closeButtonTapped:) - forControlEvents:UIControlEventTouchUpInside]; - closeButton.accessibilityIdentifier = kGridCellCloseButtonIdentifier; [topBar addSubview:iconView]; [topBar addSubview:titleLabel]; - [topBar addSubview:closeButton]; + [topBar addSubview:closeIconView]; _iconView = iconView; _titleLabel = titleLabel; - _closeButton = closeButton; + _closeIconView = closeIconView; NSArray* constraints = @[ [iconView.leadingAnchor @@ -216,21 +235,23 @@ constant:kGridCellHeaderLeadingInset], [titleLabel.centerYAnchor constraintEqualToAnchor:topBar.centerYAnchor], [titleLabel.trailingAnchor - constraintLessThanOrEqualToAnchor:closeButton.leadingAnchor + constraintLessThanOrEqualToAnchor:closeIconView.leadingAnchor constant:kGridCellCloseButtonContentInset], - [closeButton.topAnchor constraintEqualToAnchor:topBar.topAnchor], - [closeButton.bottomAnchor constraintEqualToAnchor:topBar.bottomAnchor], - [closeButton.trailingAnchor constraintEqualToAnchor:topBar.trailingAnchor], + [closeIconView.topAnchor constraintEqualToAnchor:topBar.topAnchor], + [closeIconView.bottomAnchor constraintEqualToAnchor:topBar.bottomAnchor], + [closeIconView.trailingAnchor + constraintEqualToAnchor:topBar.trailingAnchor + constant:-kGridCellCloseButtonContentInset], ]; [NSLayoutConstraint activateConstraints:constraints]; [titleLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; - [closeButton + [closeIconView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; - [closeButton setContentHuggingPriority:UILayoutPriorityRequired - forAxis:UILayoutConstraintAxisHorizontal]; + [closeIconView setContentHuggingPriority:UILayoutPriorityRequired + forAxis:UILayoutConstraintAxisHorizontal]; return topBar; }
diff --git a/ios/chrome/browser/ui/tab_grid/grid/grid_constants.h b/ios/chrome/browser/ui/tab_grid/grid/grid_constants.h index 824bae8..8a9dda23 100644 --- a/ios/chrome/browser/ui/tab_grid/grid/grid_constants.h +++ b/ios/chrome/browser/ui/tab_grid/grid/grid_constants.h
@@ -72,6 +72,7 @@ // The cell header contains the icon, title, and close button. extern const CGFloat kGridCellHeaderHeight; extern const CGFloat kGridCellHeaderLeadingInset; +extern const CGFloat kGridCellCloseTapTargetWidthHeight; extern const CGFloat kGridCellCloseButtonContentInset; extern const CGFloat kGridCellIconDiameter; extern const CGFloat kGridCellSelectionRingGapWidth;
diff --git a/ios/chrome/browser/ui/tab_grid/grid/grid_constants.mm b/ios/chrome/browser/ui/tab_grid/grid/grid_constants.mm index 9b27224..b6508d7 100644 --- a/ios/chrome/browser/ui/tab_grid/grid/grid_constants.mm +++ b/ios/chrome/browser/ui/tab_grid/grid/grid_constants.mm
@@ -69,6 +69,7 @@ // The cell header contains the icon, title, and close button. const CGFloat kGridCellHeaderHeight = 32.0f; const CGFloat kGridCellHeaderLeadingInset = 5.0f; +const CGFloat kGridCellCloseTapTargetWidthHeight = 44.0f; const CGFloat kGridCellCloseButtonContentInset = 8.5f; const CGFloat kGridCellIconDiameter = 22.0f; const CGFloat kGridCellSelectionRingGapWidth = 2.0f;
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm index a7bc05ee..c89b443 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
@@ -158,22 +158,22 @@ } // The content inset of the tab grids must be modified so that the toolbars // do not obscure the tabs. This may change depending on orientation. - UIEdgeInsets contentInset = UIEdgeInsetsZero; + CGFloat bottomInset = self.configuration == TabGridConfigurationBottomToolbar + ? self.bottomToolbar.intrinsicContentSize.height + : 0; + UIEdgeInsets contentInset = UIEdgeInsetsMake( + self.topToolbar.intrinsicContentSize.height, 0, bottomInset, 0); if (@available(iOS 11, *)) { - // Beginning with iPhoneX, there could be unsafe areas on the side margins - // and bottom. - contentInset = self.view.safeAreaInsets; + self.incognitoTabsViewController.additionalSafeAreaInsets = contentInset; + self.regularTabsViewController.additionalSafeAreaInsets = contentInset; + self.remoteTabsViewController.additionalSafeAreaInsets = contentInset; } else { - // Previously only the top had unsafe areas. - contentInset.top = self.topLayoutGuide.length; + // Must manually account for status bar in pre-iOS 11. + contentInset.top += self.topLayoutGuide.length; + self.incognitoTabsViewController.gridView.contentInset = contentInset; + self.regularTabsViewController.gridView.contentInset = contentInset; + self.remoteTabsViewController.tableView.contentInset = contentInset; } - contentInset.top += self.topToolbar.intrinsicContentSize.height; - if (self.view.frame.size.width < self.view.frame.size.height) { - contentInset.bottom += self.bottomToolbar.intrinsicContentSize.height; - } - self.incognitoTabsViewController.gridView.contentInset = contentInset; - self.regularTabsViewController.gridView.contentInset = contentInset; - self.remoteTabsViewController.tableView.contentInset = contentInset; } - (void)viewWillTransitionToSize:(CGSize)size @@ -413,12 +413,6 @@ kTabGridIncognitoTabsEmptyStateIdentifier; viewController.theme = GridThemeDark; viewController.delegate = self; - if (@available(iOS 11, *)) { - // Adjustments are made in |-viewWillLayoutSubviews|. Automatic adjustments - // do not work well with the scrollview. - viewController.gridView.contentInsetAdjustmentBehavior = - UIScrollViewContentInsetAdjustmentNever; - } NSArray* constraints = @[ [viewController.view.topAnchor constraintEqualToAnchor:contentView.topAnchor], @@ -447,12 +441,6 @@ kTabGridRegularTabsEmptyStateIdentifier; viewController.theme = GridThemeLight; viewController.delegate = self; - if (@available(iOS 11, *)) { - // Adjustments are made in |-viewWillLayoutSubviews|. Automatic adjustments - // do not work well with the scrollview. - viewController.gridView.contentInsetAdjustmentBehavior = - UIScrollViewContentInsetAdjustmentNever; - } NSArray* constraints = @[ [viewController.view.topAnchor constraintEqualToAnchor:contentView.topAnchor], @@ -473,6 +461,7 @@ // TODO(crbug.com/804589) : Dark style on remote tabs. // The styler must be set before the view controller is loaded. ChromeTableViewStyler* styler = [[ChromeTableViewStyler alloc] init]; + styler.tableViewSectionHeaderBlurEffect = nil; styler.tableViewBackgroundColor = UIColorFromRGB(kGridBackgroundColor); styler.cellTitleColor = UIColorFromRGB(kGridDarkThemeCellTitleColor); styler.headerFooterTitleColor = UIColorFromRGB(kGridDarkThemeCellTitleColor); @@ -484,12 +473,6 @@ [self addChildViewController:viewController]; [contentView addSubview:viewController.view]; [viewController didMoveToParentViewController:self]; - if (@available(iOS 11, *)) { - // Adjustments are made in |-viewWillLayoutSubviews|. Automatic adjustments - // do not work well with the scrollview. - viewController.tableView.contentInsetAdjustmentBehavior = - UIScrollViewContentInsetAdjustmentNever; - } NSArray* constraints = @[ [viewController.view.topAnchor constraintEqualToAnchor:contentView.topAnchor],
diff --git a/ios/chrome/browser/ui/user_feedback_features.cc b/ios/chrome/browser/ui/user_feedback_features.cc deleted file mode 100644 index d2fefd9..0000000 --- a/ios/chrome/browser/ui/user_feedback_features.cc +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ios/chrome/browser/ui/user_feedback_features.h" - -const base::Feature kFeedbackKitV2{"FeedbackKitV2", - base::FEATURE_ENABLED_BY_DEFAULT}; - -const base::Feature kFeedbackKitV2WithSSOService{ - "FeedbackKitV2WithSSOService", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/ui/user_feedback_features.h b/ios/chrome/browser/ui/user_feedback_features.h deleted file mode 100644 index 9491a81..0000000 --- a/ios/chrome/browser/ui/user_feedback_features.h +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_CHROME_BROWSER_UI_USER_FEEDBACK_FEATURES_H_ -#define IOS_CHROME_BROWSER_UI_USER_FEEDBACK_FEATURES_H_ - -#include "base/feature_list.h" - -// Feature flag to enable FeedbackKit V2 -extern const base::Feature kFeedbackKitV2; - -// Feature flag to send SSOService to FeedbackKit V2. This feature flag is -// used only if kFeedbackKitV2 is enabled. -extern const base::Feature kFeedbackKitV2WithSSOService; - -#endif // IOS_CHROME_BROWSER_UI_USER_FEEDBACK_FEATURES_H_
diff --git a/ios/chrome/browser/ui/util/layout_guide_names.h b/ios/chrome/browser/ui/util/layout_guide_names.h index 5ffbcbd..f0d61ea 100644 --- a/ios/chrome/browser/ui/util/layout_guide_names.h +++ b/ios/chrome/browser/ui/util/layout_guide_names.h
@@ -12,6 +12,8 @@ // The list of well-known UILayoutGuides. When adding a new guide to the app, // create a constant for it below. +// A guide that is constrained to match the frame of the tab's content area. +extern GuideName* const kContentAreaGuide; // A guide that is constrained to match the frame of the secondary toolbar. extern GuideName* const kSecondaryToolbar; // A guide that is constrained to match the frame the secondary toolbar would
diff --git a/ios/chrome/browser/ui/util/layout_guide_names.mm b/ios/chrome/browser/ui/util/layout_guide_names.mm index d527da3..5c1c0ab1 100644 --- a/ios/chrome/browser/ui/util/layout_guide_names.mm +++ b/ios/chrome/browser/ui/util/layout_guide_names.mm
@@ -8,6 +8,7 @@ #error "This file requires ARC support." #endif +GuideName* const kContentAreaGuide = @"ContentAreaGuide"; GuideName* const kSecondaryToolbar = @"kSecondaryToolbar"; GuideName* const kSecondaryToolbarNoFullscreen = @"kSecondaryToolbarNoFullscreen";
diff --git a/ios/chrome/browser/ui/util/named_guide_util.h b/ios/chrome/browser/ui/util/named_guide_util.h index 147ca8a..798e1cd 100644 --- a/ios/chrome/browser/ui/util/named_guide_util.h +++ b/ios/chrome/browser/ui/util/named_guide_util.h
@@ -7,7 +7,7 @@ #import "ios/chrome/browser/ui/util/layout_guide_names.h" -// Adds NamedGuides with the GuideNames in |names| to |view|. +// Creates NamedGuides with the GuideNames in |names| and adds them to |view|. void AddNamedGuidesToView(NSArray<GuideName*>* names, UIView* view); // Sets the constrained views for the NamedGuides indicated by the keys of
diff --git a/ios/chrome/browser/web/font_size_tab_helper.mm b/ios/chrome/browser/web/font_size_tab_helper.mm index ee5e526..3515d60 100644 --- a/ios/chrome/browser/web/font_size_tab_helper.mm +++ b/ios/chrome/browser/web/font_size_tab_helper.mm
@@ -6,6 +6,7 @@ #import <UIKit/UIKit.h> +#include "base/metrics/histogram_macros.h" #import "base/strings/sys_string_conversions.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -63,6 +64,7 @@ UIContentSizeCategory category = UIApplication.sharedApplication.preferredContentSizeCategory; NSNumber* font_size = font_size_map[category]; + UMA_HISTOGRAM_BOOLEAN("Accessibility.iOS.NewLargerTextCategory", !font_size); return font_size ? font_size.intValue : 100; }
diff --git a/ios/chrome/browser/web/font_size_tab_helper_unittest.mm b/ios/chrome/browser/web/font_size_tab_helper_unittest.mm index 1bc6507..05cb698 100644 --- a/ios/chrome/browser/web/font_size_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/font_size_tab_helper_unittest.mm
@@ -7,6 +7,7 @@ #import <UIKit/UIKit.h> #include "base/strings/utf_string_conversions.h" +#include "base/test/metrics/histogram_tester.h" #import "ios/web/public/test/fakes/test_web_state.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -46,6 +47,7 @@ UIContentSizeCategory preferred_content_size_category_ = UIContentSizeCategoryLarge; id application_ = nil; + base::HistogramTester histogram_tester_; DISALLOW_COPY_AND_ASSIGN(FontSizeTabHelperTest); }; @@ -59,19 +61,25 @@ web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 1); // Change PreferredContentSizeCategory and send - // UIContentSizeCategoryDidChangeNotification. + // UIContentSizeCategoryDidChangeNotification. preferred_content_size_category_ = UIContentSizeCategoryExtraLarge; SendUIContentSizeCategoryDidChangeNotification(); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(110)", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 2); web_state_.ClearLastExecutedJavascript(); // Reload web page. web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(110)", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 3); } // Tests that a web page's font size is set properly in a procedure started @@ -84,6 +92,8 @@ web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(110)", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 1); web_state_.ClearLastExecutedJavascript(); // Change PreferredContentSizeCategory and send @@ -92,10 +102,46 @@ SendUIContentSizeCategoryDidChangeNotification(); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(120)", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 2); web_state_.ClearLastExecutedJavascript(); // Reload web page. web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(120)", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", false, 3); +} + +// Tests that UMA log is sent when +// |UIApplication.sharedApplication.preferredContentSizeCategory| returns an +// unrecognizable category. +TEST_F(FontSizeTabHelperTest, PageLoadedWithUnrecognizableFontSize) { + std::string last_executed_js; + preferred_content_size_category_ = @"This is a new Category"; + + // Load web page. + web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); + last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); + EXPECT_EQ("", last_executed_js); + histogram_tester_.ExpectUniqueSample( + "Accessibility.iOS.NewLargerTextCategory", true, 1); + + // Change PreferredContentSizeCategory and send + // UIContentSizeCategoryDidChangeNotification. + preferred_content_size_category_ = UIContentSizeCategoryExtraExtraLarge; + SendUIContentSizeCategoryDidChangeNotification(); + last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); + EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(120)", last_executed_js); + histogram_tester_.ExpectBucketCount("Accessibility.iOS.NewLargerTextCategory", + false, 1); + web_state_.ClearLastExecutedJavascript(); + + // Reload web page. + web_state_.OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS); + last_executed_js = base::UTF16ToUTF8(web_state_.GetLastExecutedJavascript()); + EXPECT_EQ("__gCrWeb.accessibility.adjustFontSize(120)", last_executed_js); + histogram_tester_.ExpectBucketCount("Accessibility.iOS.NewLargerTextCategory", + false, 2); }
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index 4c81183..eaed6c3 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -391,6 +391,7 @@ "//ios/web/web_state:error_translation_util", "//ios/web/web_state:navigation_context", "//ios/web/web_state:session_certificate_policy_cache", + "//ios/web/web_state:web_frame", "//ios/web/web_state:web_view_internal_creation_util", "//ios/web/web_state:wk_web_view_security_util", "//net:test_support", @@ -409,6 +410,7 @@ "web_state/page_display_state_unittest.mm", "web_state/session_certificate_policy_cache_impl_unittest.mm", "web_state/session_certificate_policy_cache_storage_builder_unittest.mm", + "web_state/web_frame_impl_unittest.mm", "web_state/web_state_delegate_bridge_unittest.mm", "web_state/web_state_impl_unittest.mm", "web_state/web_state_observer_bridge_unittest.mm",
diff --git a/ios/web/public/BUILD.gn b/ios/web/public/BUILD.gn index fd75ade..4c36d0b 100644 --- a/ios/web/public/BUILD.gn +++ b/ios/web/public/BUILD.gn
@@ -84,6 +84,7 @@ "web_state/ui/crw_web_view_proxy.h", "web_state/ui/crw_web_view_scroll_view_proxy.h", "web_state/url_verification_constants.h", + "web_state/web_frame.h", "web_state/web_state.h", "web_state/web_state_delegate.h", "web_state/web_state_delegate_bridge.h",
diff --git a/ios/web/public/web_state/web_frame.h b/ios/web/public/web_state/web_frame.h new file mode 100644 index 0000000..fcba564 --- /dev/null +++ b/ios/web/public/web_state/web_frame.h
@@ -0,0 +1,35 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_FRAME_H_ +#define IOS_WEB_PUBLIC_WEB_STATE_WEB_FRAME_H_ + +#include <string> + +#include "base/macros.h" +#include "url/gurl.h" + +namespace web { + +class WebFrame { + public: + // The frame identifier which uniquely identifies this frame across the + // application's lifetime. + virtual std::string GetFrameId() const = 0; + // Whether or not the receiver represents the main frame of the webpage. + virtual bool IsMainFrame() const = 0; + // The security origin associated with this frame. + virtual GURL GetSecurityOrigin() const = 0; + + virtual ~WebFrame() {} + + protected: + WebFrame() {} + + DISALLOW_COPY_AND_ASSIGN(WebFrame); +}; + +} // namespace web + +#endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_FRAME_H_
diff --git a/ios/web/web_state/BUILD.gn b/ios/web/web_state/BUILD.gn index 0768b04..86a9014 100644 --- a/ios/web/web_state/BUILD.gn +++ b/ios/web/web_state/BUILD.gn
@@ -162,3 +162,18 @@ configs += [ "//build/config/compiler:enable_arc" ] } + +source_set("web_frame") { + deps = [ + "//base", + "//ios/web/public", + "//url", + ] + + sources = [ + "web_frame_impl.h", + "web_frame_impl.mm", + ] + + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/web/web_state/web_frame_impl.h b/ios/web/web_state/web_frame_impl.h new file mode 100644 index 0000000..77ee82c --- /dev/null +++ b/ios/web/web_state/web_frame_impl.h
@@ -0,0 +1,51 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_WEB_WEB_STATE_WEB_FRAME_IMPL_H_ +#define IOS_WEB_WEB_STATE_WEB_FRAME_IMPL_H_ + +#include "ios/web/public/web_state/web_frame.h" + +#include <string> + +#include "base/macros.h" +#include "url/gurl.h" + +namespace web { + +class WebState; + +class WebFrameImpl : public WebFrame { + public: + WebFrameImpl(const std::string& frame_id, + bool is_main_frame, + GURL security_origin, + web::WebState* web_state); + ~WebFrameImpl() override; + + // The associated web state. + WebState* GetWebState(); + + // WebFrame implementation + std::string GetFrameId() const override; + bool IsMainFrame() const override; + GURL GetSecurityOrigin() const override; + + private: + // The frame identifier which uniquely identifies this frame across the + // application's lifetime. + std::string frame_id_; + // Whether or not the receiver represents the main frame. + bool is_main_frame_ = false; + // The security origin associated with this frame. + GURL security_origin_; + // The associated web state. + web::WebState* web_state_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(WebFrameImpl); +}; + +} // namespace web + +#endif // IOS_WEB_WEB_STATE_WEB_FRAME_IMPL_H_
diff --git a/ios/web/web_state/web_frame_impl.mm b/ios/web/web_state/web_frame_impl.mm new file mode 100644 index 0000000..62b221f --- /dev/null +++ b/ios/web/web_state/web_frame_impl.mm
@@ -0,0 +1,42 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ios/web/web_state/web_frame_impl.h" + +#include "url/gurl.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace web { + +WebFrameImpl::WebFrameImpl(const std::string& frame_id, + bool is_main_frame, + GURL security_origin, + web::WebState* web_state) + : frame_id_(frame_id), + is_main_frame_(is_main_frame), + security_origin_(security_origin), + web_state_(web_state) {} + +WebFrameImpl::~WebFrameImpl() = default; + +WebState* WebFrameImpl::GetWebState() { + return web_state_; +} + +std::string WebFrameImpl::GetFrameId() const { + return frame_id_; +} + +bool WebFrameImpl::IsMainFrame() const { + return is_main_frame_; +} + +GURL WebFrameImpl::GetSecurityOrigin() const { + return security_origin_; +} + +} // namespace web
diff --git a/ios/web/web_state/web_frame_impl_unittest.mm b/ios/web/web_state/web_frame_impl_unittest.mm new file mode 100644 index 0000000..33e4f724 --- /dev/null +++ b/ios/web/web_state/web_frame_impl_unittest.mm
@@ -0,0 +1,49 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ios/web/web_state/web_frame_impl.h" + +#import "ios/web/public/test/fakes/test_web_state.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +const char kFrameId[] = "frameId"; +} // namespace + +namespace web { + +using WebFrameImplTest = PlatformTest; + +// Tests creation of a WebFrame for the main frame. +TEST_F(WebFrameImplTest, CreateWebFrameForMainFrame) { + TestWebState test_web_state; + GURL security_origin; + WebFrameImpl web_frame(kFrameId, /*is_main_frame=*/true, security_origin, + &test_web_state); + + EXPECT_EQ(&test_web_state, web_frame.GetWebState()); + EXPECT_TRUE(web_frame.IsMainFrame()); + EXPECT_EQ(security_origin, web_frame.GetSecurityOrigin()); + EXPECT_EQ(kFrameId, web_frame.GetFrameId()); +} + +// Tests creation of a WebFrame for a frame which is not the main frame. +TEST_F(WebFrameImplTest, CreateWebFrameForIFrame) { + TestWebState test_web_state; + GURL security_origin; + WebFrameImpl web_frame(kFrameId, /*is_main_frame=*/false, security_origin, + &test_web_state); + + EXPECT_EQ(&test_web_state, web_frame.GetWebState()); + EXPECT_FALSE(web_frame.IsMainFrame()); + EXPECT_EQ(security_origin, web_frame.GetSecurityOrigin()); + EXPECT_EQ(kFrameId, web_frame.GetFrameId()); +} + +} // namespace web
diff --git a/ios/web_view/internal/translate/web_view_translate_client.h b/ios/web_view/internal/translate/web_view_translate_client.h index 660a9e4..f1180de 100644 --- a/ios/web_view/internal/translate/web_view_translate_client.h +++ b/ios/web_view/internal/translate/web_view_translate_client.h
@@ -74,7 +74,7 @@ std::unique_ptr<infobars::InfoBar> CreateInfoBar( std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const override; - void ShowTranslateUI(translate::TranslateStep step, + bool ShowTranslateUI(translate::TranslateStep step, const std::string& source_language, const std::string& target_language, translate::TranslateErrors::Type error_type,
diff --git a/ios/web_view/internal/translate/web_view_translate_client.mm b/ios/web_view/internal/translate/web_view_translate_client.mm index df1ecdb..c4e131ab 100644 --- a/ios/web_view/internal/translate/web_view_translate_client.mm +++ b/ios/web_view/internal/translate/web_view_translate_client.mm
@@ -76,7 +76,7 @@ return nullptr; } -void WebViewTranslateClient::ShowTranslateUI( +bool WebViewTranslateClient::ShowTranslateUI( translate::TranslateStep step, const std::string& source_language, const std::string& target_language, @@ -87,6 +87,7 @@ targetLanguage:target_language errorType:error_type triggeredFromMenu:triggered_from_menu]; + return true; } translate::IOSTranslateDriver* WebViewTranslateClient::GetTranslateDriver() {
diff --git a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java index c43e123..de1fcec 100644 --- a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java +++ b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
@@ -166,9 +166,12 @@ // Inner class to extend a Photo Session state change listener. // Error paths must signal notifyTakePhotoError(). private class CrPhotoSessionListener extends CameraCaptureSession.StateCallback { + private final ImageReader mImageReader; private final CaptureRequest mPhotoRequest; private final long mCallbackId; - CrPhotoSessionListener(CaptureRequest photoRequest, long callbackId) { + CrPhotoSessionListener( + ImageReader imageReader, CaptureRequest photoRequest, long callbackId) { + mImageReader = imageReader; mPhotoRequest = photoRequest; mCallbackId = callbackId; } @@ -198,6 +201,11 @@ notifyTakePhotoError(mCallbackId); return; } + + @Override + public void onClosed(CameraCaptureSession session) { + mImageReader.close(); + } }; // Internal class implementing an ImageReader listener for encoded Photos. @@ -1145,7 +1153,7 @@ final CaptureRequest photoRequest = photoRequestBuilder.build(); final CrPhotoSessionListener sessionListener = - new CrPhotoSessionListener(photoRequest, callbackId); + new CrPhotoSessionListener(imageReader, photoRequest, callbackId); try { mCameraDevice.createCaptureSession(surfaceList, sessionListener, backgroundHandler); } catch (CameraAccessException | IllegalArgumentException | SecurityException ex) {
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc index 785fc1b..cf6b4b0 100644 --- a/media/capture/video/android/video_capture_device_android.cc +++ b/media/capture/video/android/video_capture_device_android.cc
@@ -466,11 +466,13 @@ std::unique_ptr<TakePhotoCallback> heap_callback( new TakePhotoCallback(std::move(callback))); const intptr_t callback_id = reinterpret_cast<intptr_t>(heap_callback.get()); - if (!Java_VideoCapture_takePhoto(env, j_capture_, callback_id)) - return; - { - base::AutoLock lock(photo_callbacks_lock_); + // We need lock here because asynchronous response to + // Java_VideoCapture_takePhoto(), i.e. a call to OnPhotoTaken, arrives from a + // separate thread, and it can arrive before |photo_callbacks_.push_back()| + // has executed. + base::AutoLock lock(photo_callbacks_lock_); + if (Java_VideoCapture_takePhoto(env, j_capture_, callback_id)) { photo_callbacks_.push_back(std::move(heap_callback)); } }
diff --git a/media/test/data/README b/media/test/data/README index e3024a04..6fa70473 100644 --- a/media/test/data/README +++ b/media/test/data/README
@@ -138,6 +138,10 @@ shaka/packager/tools/pssh/pssh-box.py --widevine-system-id --key-id 30313233343536373839303132333435 --hex shaka/packager/tools/pssh/pssh-box.py --common-system-id --key-id 30313233343536373839303132333435 --hex +bear-640x360-a_frag-cbcs.mp4 +- Same as previous instructions, except source is bear-640x360-a_frag.mp4 + and no clear lead (i.e. --clear_lead 0). + bear-flac-cenc.mp4 - Encrypted version of bear-flac.mp4, encrypted by Shaka Packager using key ID [1] and key [2]. Sample encryption information stored in
diff --git a/media/test/data/bear-640x360-a_frag-cbcs.mp4 b/media/test/data/bear-640x360-a_frag-cbcs.mp4 new file mode 100644 index 0000000..92f542c --- /dev/null +++ b/media/test/data/bear-640x360-a_frag-cbcs.mp4 Binary files differ
diff --git a/media/test/data/eme_player_js/player_utils.js b/media/test/data/eme_player_js/player_utils.js index 06db4fe..1962dd37 100644 --- a/media/test/data/eme_player_js/player_utils.js +++ b/media/test/data/eme_player_js/player_utils.js
@@ -234,23 +234,11 @@ } else { // Some tests (e.g. mse_different_containers.html) specify audio and // video codecs seperately. - if (player.testConfig.videoFormat == 'ENCRYPTED_MP4' || - player.testConfig.videoFormat == 'CLEAR_MP4') { - config.videoCapabilities = - [{contentType: 'video/mp4; codecs="avc1.4D000C"'}]; - } else if ( - player.testConfig.videoFormat == 'ENCRYPTED_WEBM' || - player.testConfig.videoFormat == 'CLEAR_WEBM') { - config.videoCapabilities = [{contentType: 'video/webm; codecs="vp8"'}]; + if (player.testConfig.videoFormat) { + config.videoCapabilities = [{contentType: player.testConfig.videoFormat}]; } - if (player.testConfig.audioFormat == 'ENCRYPTED_MP4' || - player.testConfig.audioFormat == 'CLEAR_MP4') { - config.audioCapabilities = - [{contentType: 'audio/mp4; codecs="mp4a.40.2"'}]; - } else if ( - player.testConfig.audioFormat == 'ENCRYPTED_WEBM' || - player.testConfig.audioFormat == 'CLEAR_WEBM') { - config.audioCapabilities = [{contentType: 'audio/webm; codecs="vorbis"'}]; + if (player.testConfig.audioFormat) { + config.audioCapabilities = [{contentType: player.testConfig.audioFormat}]; } }
diff --git a/media/test/data/mse_different_containers.html b/media/test/data/mse_different_containers.html index ae9c8a3..0f17c33 100644 --- a/media/test/data/mse_different_containers.html +++ b/media/test/data/mse_different_containers.html
@@ -6,32 +6,16 @@ <video></video> <script src='eme_player_js/app_loader.js' type='text/javascript'></script> <script type="text/javascript"> - // Specify possible content for clear and encrypted streams in both MP4 - // and WEBM format. For testing we don't care if the audio matches the - // video or if the length of each container is the same. - var VIDEO_MP4_MEDIA_TYPE = 'video/mp4; codecs="avc1.4D4041"'; - var VIDEO_WEBM_MEDIA_TYPE = 'video/webm; codecs="vp8"'; - var VIDEO_MP4_CLEAR_FILE = 'bear-640x360-v_frag.mp4'; - var VIDEO_WEBM_CLEAR_FILE = 'bear-320x240-video-only.webm'; - var VIDEO_MP4_ENCRYPTED_FILE = 'bear-640x360-v_frag-cenc.mp4'; - var VIDEO_WEBM_ENCRYPTED_FILE = 'bear-320x240-v_enc-v.webm'; - var AUDIO_MP4_MEDIA_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; - var AUDIO_WEBM_MEDIA_TYPE = 'audio/webm; codecs="vorbis"'; - var AUDIO_MP4_CLEAR_FILE = 'bear-640x360-a_frag.mp4'; - var AUDIO_WEBM_CLEAR_FILE = 'bear-320x240-audio-only.webm'; - var AUDIO_MP4_ENCRYPTED_FILE = 'bear-640x360-a_frag-cenc.mp4'; - var AUDIO_WEBM_ENCRYPTED_FILE = 'bear-a_enc-a.webm'; - - var media_types = []; - var media_files = []; - - // The time in secs to play the streams. - var PLAY_TIME_SEC = 0.1; + // The time in secs to play the streams. Several encrypted streams have + // 1/2 second clear leads, so play at least a second to ensure that the + // encrypted content is handled. + var PLAY_TIME_SEC = 1.0; var video = document.querySelector('video'); function onTimeUpdate() { + Utils.timeLog('timeupdate @ ' + video.currentTime); if (video.currentTime < PLAY_TIME_SEC) return; @@ -39,44 +23,9 @@ video.removeEventListener('ended', Utils.failTest); Utils.installTitleEventHandler(video, 'ended'); - // Seek to end to save test execution time. - video.currentTime = 1000; - } - - function addVideoStream(format) { - if (format == 'CLEAR_MP4') { - media_types = media_types.concat(VIDEO_MP4_MEDIA_TYPE); - media_files = media_files.concat(VIDEO_MP4_CLEAR_FILE); - } else if (format == 'CLEAR_WEBM') { - media_types = media_types.concat(VIDEO_WEBM_MEDIA_TYPE); - media_files = media_files.concat(VIDEO_WEBM_CLEAR_FILE); - } else if (format == 'ENCRYPTED_MP4') { - media_types = media_types.concat(VIDEO_MP4_MEDIA_TYPE); - media_files = media_files.concat(VIDEO_MP4_ENCRYPTED_FILE); - } else if (format == 'ENCRYPTED_WEBM') { - media_types = media_types.concat(VIDEO_WEBM_MEDIA_TYPE); - media_files = media_files.concat(VIDEO_WEBM_ENCRYPTED_FILE); - } else { - Utils.failTest('Unrecognized video type.'); - } - } - - function addAudioStream(format) { - if (format == 'CLEAR_MP4') { - media_types = media_types.concat(AUDIO_MP4_MEDIA_TYPE); - media_files = media_files.concat(AUDIO_MP4_CLEAR_FILE); - } else if (format == 'CLEAR_WEBM') { - media_types = media_types.concat(AUDIO_WEBM_MEDIA_TYPE); - media_files = media_files.concat(AUDIO_WEBM_CLEAR_FILE); - } else if (format == 'ENCRYPTED_MP4') { - media_types = media_types.concat(AUDIO_MP4_MEDIA_TYPE); - media_files = media_files.concat(AUDIO_MP4_ENCRYPTED_FILE); - } else if (format == 'ENCRYPTED_WEBM') { - media_types = media_types.concat(AUDIO_WEBM_MEDIA_TYPE); - media_files = media_files.concat(AUDIO_WEBM_ENCRYPTED_FILE); - } else { - Utils.failTest('Unrecognized audio type.'); - } + // Seek to end to save test execution time. Most of the test videos + // (e.g. the bear videos) are about 2.5 seconds long. + video.currentTime = 3000; } function runTest() { @@ -85,8 +34,17 @@ var testConfig = new TestConfig(); testConfig.loadQueryParams(); - addVideoStream(testConfig.videoFormat); - addAudioStream(testConfig.audioFormat); + + var media_types = []; + var media_files = []; + if (testConfig.videoFormat) { + media_types = media_types.concat(testConfig.videoFormat); + media_files = media_files.concat(testConfig.videoFile); + } + if (testConfig.audioFormat) { + media_types = media_types.concat(testConfig.audioFormat); + media_files = media_files.concat(testConfig.audioFile); + } var mediaSource = MediaSourceUtils.loadMediaSource(media_files, media_types);
diff --git a/mojo/edk/BUILD.gn b/mojo/edk/BUILD.gn index 7798fa33..ae98e91 100644 --- a/mojo/edk/BUILD.gn +++ b/mojo/edk/BUILD.gn
@@ -80,12 +80,10 @@ "system/message_pipe_dispatcher.h", "system/node_controller.h", "system/options_validation.h", - "system/platform_handle.h", "system/platform_handle_dispatcher.h", "system/platform_handle_utils.h", "system/platform_shared_memory_mapping.h", "system/request_context.h", - "system/scoped_platform_handle.h", "system/scoped_process_handle.h", "system/shared_buffer_dispatcher.h", "system/user_message_impl.h", @@ -111,7 +109,6 @@ "system/node_channel.cc", "system/node_channel.h", "system/node_controller.cc", - "system/platform_handle.cc", "system/platform_handle_dispatcher.cc", "system/platform_handle_in_transit.cc", "system/platform_handle_in_transit.h",
diff --git a/mojo/edk/system/broker.h b/mojo/edk/system/broker.h index 477f97a..ba37ebb 100644 --- a/mojo/edk/system/broker.h +++ b/mojo/edk/system/broker.h
@@ -9,7 +9,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/writable_shared_memory_region.h" #include "base/synchronization/lock.h" -#include "mojo/edk/system/scoped_platform_handle.h" +#include "mojo/public/cpp/platform/platform_channel_endpoint.h" +#include "mojo/public/cpp/platform/platform_handle.h" namespace mojo { namespace edk { @@ -19,14 +20,14 @@ class Broker { public: // Note: This is blocking, and will wait for the first message over - // |platform_handle|. - explicit Broker(ScopedInternalPlatformHandle platform_handle); + // the endpoint handle in |handle|. + explicit Broker(PlatformHandle handle); ~Broker(); // Returns the platform handle that should be used to establish a NodeChannel // to the process which is inviting us to join its network. This is the first // handle read off the Broker channel upon construction. - ScopedInternalPlatformHandle GetInviterInternalPlatformHandle(); + PlatformChannelEndpoint GetInviterEndpoint(); // Request a shared buffer from the broker process. Blocks the current thread. base::WritableSharedMemoryRegion GetWritableSharedMemoryRegion( @@ -34,11 +35,11 @@ private: // Handle to the broker process, used for synchronous IPCs. - ScopedInternalPlatformHandle sync_channel_; + PlatformHandle sync_channel_; - // Handle to the inviter process which is recieved in the first first message - // over |sync_channel_|. - ScopedInternalPlatformHandle inviter_channel_; + // Channel endpoint connected to the inviter process. Recieved in the first + // first message over |sync_channel_|. + PlatformChannelEndpoint inviter_endpoint_; // Lock to only allow one sync message at a time. This avoids having to deal // with message ordering since we can only have one request at a time
diff --git a/mojo/edk/system/broker_host.cc b/mojo/edk/system/broker_host.cc index 41a938f..d935133 100644 --- a/mojo/edk/system/broker_host.cc +++ b/mojo/edk/system/broker_host.cc
@@ -13,7 +13,6 @@ #include "build/build_config.h" #include "mojo/edk/system/broker_messages.h" #include "mojo/edk/system/platform_handle_utils.h" -#include "mojo/edk/system/scoped_platform_handle.h" #if defined(OS_WIN) #include <windows.h> @@ -23,7 +22,7 @@ namespace edk { BrokerHost::BrokerHost(base::ProcessHandle client_process, - ScopedInternalPlatformHandle platform_handle, + ConnectionParams connection_params, const ProcessErrorCallback& process_error_callback) : process_error_callback_(process_error_callback) #if defined(OS_WIN) @@ -31,11 +30,12 @@ client_process_(ScopedProcessHandle::CloneFrom(client_process)) #endif { - CHECK(platform_handle.is_valid()); + CHECK(connection_params.endpoint().is_valid() || + connection_params.server_endpoint().is_valid()); base::MessageLoopCurrent::Get()->AddDestructionObserver(this); - channel_ = Channel::Create(this, ConnectionParams(std::move(platform_handle)), + channel_ = Channel::Create(this, std::move(connection_params), base::ThreadTaskRunnerHandle::Get()); channel_->Start(); } @@ -62,7 +62,7 @@ #endif } -bool BrokerHost::SendChannel(ScopedInternalPlatformHandle handle) { +bool BrokerHost::SendChannel(PlatformHandle handle) { CHECK(handle.is_valid()); CHECK(channel_); @@ -76,8 +76,7 @@ CreateBrokerMessage(BrokerMessageType::INIT, 1, nullptr); #endif std::vector<PlatformHandleInTransit> handles(1); - handles[0] = PlatformHandleInTransit( - ScopedInternalPlatformHandleToPlatformHandle(std::move(handle))); + handles[0] = PlatformHandleInTransit(std::move(handle)); // This may legitimately fail on Windows if the client process is in another // session, e.g., is an elevated process.
diff --git a/mojo/edk/system/broker_host.h b/mojo/edk/system/broker_host.h index a92a0811..9cb0d8a 100644 --- a/mojo/edk/system/broker_host.h +++ b/mojo/edk/system/broker_host.h
@@ -14,9 +14,10 @@ #include "base/strings/string_piece.h" #include "mojo/edk/embedder/process_error_callback.h" #include "mojo/edk/system/channel.h" +#include "mojo/edk/system/connection_params.h" #include "mojo/edk/system/platform_handle_in_transit.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/scoped_process_handle.h" +#include "mojo/public/cpp/platform/platform_handle.h" namespace mojo { namespace edk { @@ -27,11 +28,11 @@ public base::MessageLoopCurrent::DestructionObserver { public: BrokerHost(base::ProcessHandle client_process, - ScopedInternalPlatformHandle handle, + ConnectionParams connection_params, const ProcessErrorCallback& process_error_callback); // Send |handle| to the client, to be used to establish a NodeChannel to us. - bool SendChannel(ScopedInternalPlatformHandle handle); + bool SendChannel(PlatformHandle handle); #if defined(OS_WIN) // Sends a named channel to the client. Like above, but for named pipes.
diff --git a/mojo/edk/system/broker_posix.cc b/mojo/edk/system/broker_posix.cc index 45a513ea..815ce9f69 100644 --- a/mojo/edk/system/broker_posix.cc +++ b/mojo/edk/system/broker_posix.cc
@@ -16,7 +16,6 @@ #include "mojo/edk/system/broker_messages.h" #include "mojo/edk/system/channel.h" #include "mojo/edk/system/platform_handle_utils.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/public/cpp/platform/socket_utils_posix.h" namespace mojo { @@ -25,17 +24,17 @@ namespace { Channel::MessagePtr WaitForBrokerMessage( - const ScopedInternalPlatformHandle& platform_handle, + int socket_fd, BrokerMessageType expected_type, size_t expected_num_handles, size_t expected_data_size, - std::vector<ScopedInternalPlatformHandle>* incoming_handles) { + std::vector<PlatformHandle>* incoming_handles) { Channel::MessagePtr message(new Channel::Message( sizeof(BrokerMessageHeader) + expected_data_size, expected_num_handles)); std::vector<base::ScopedFD> incoming_fds; - ssize_t read_result = SocketRecvmsg( - platform_handle.get().handle, const_cast<void*>(message->data()), - message->data_num_bytes(), &incoming_fds, true /* block */); + ssize_t read_result = + SocketRecvmsg(socket_fd, const_cast<void*>(message->data()), + message->data_num_bytes(), &incoming_fds, true /* block */); bool error = false; if (read_result < 0) { PLOG(ERROR) << "Recvmsg error"; @@ -58,39 +57,38 @@ return nullptr; } - incoming_handles->resize(incoming_fds.size()); - for (size_t i = 0; i < incoming_fds.size(); ++i) { - incoming_handles->at(i) = ScopedInternalPlatformHandle( - InternalPlatformHandle(incoming_fds[i].release())); - } + incoming_handles->reserve(incoming_fds.size()); + for (size_t i = 0; i < incoming_fds.size(); ++i) + incoming_handles->emplace_back(std::move(incoming_fds[i])); return message; } } // namespace -Broker::Broker(ScopedInternalPlatformHandle platform_handle) - : sync_channel_(std::move(platform_handle)) { +Broker::Broker(PlatformHandle handle) : sync_channel_(std::move(handle)) { CHECK(sync_channel_.is_valid()); + int fd = sync_channel_.GetFD().get(); // Mark the channel as blocking. - int flags = fcntl(sync_channel_.get().handle, F_GETFL); + int flags = fcntl(fd, F_GETFL); PCHECK(flags != -1); - flags = fcntl(sync_channel_.get().handle, F_SETFL, flags & ~O_NONBLOCK); + flags = fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); PCHECK(flags != -1); // Wait for the first message, which should contain a handle. - std::vector<ScopedInternalPlatformHandle> incoming_platform_handles; - if (WaitForBrokerMessage(sync_channel_, BrokerMessageType::INIT, 1, 0, + std::vector<PlatformHandle> incoming_platform_handles; + if (WaitForBrokerMessage(fd, BrokerMessageType::INIT, 1, 0, &incoming_platform_handles)) { - inviter_channel_ = std::move(incoming_platform_handles[0]); + inviter_endpoint_ = + PlatformChannelEndpoint(std::move(incoming_platform_handles[0])); } } Broker::~Broker() = default; -ScopedInternalPlatformHandle Broker::GetInviterInternalPlatformHandle() { - return std::move(inviter_channel_); +PlatformChannelEndpoint Broker::GetInviterEndpoint() { + return std::move(inviter_endpoint_); } base::WritableSharedMemoryRegion Broker::GetWritableSharedMemoryRegion( @@ -102,7 +100,7 @@ BrokerMessageType::BUFFER_REQUEST, 0, 0, &buffer_request); buffer_request->size = num_bytes; ssize_t write_result = - SocketWrite(sync_channel_.get().handle, out_message->data(), + SocketWrite(sync_channel_.GetFD().get(), out_message->data(), out_message->data_num_bytes()); if (write_result < 0) { PLOG(ERROR) << "Error sending sync broker message"; @@ -122,23 +120,17 @@ constexpr size_t kNumExpectedHandles = 2; #endif - std::vector<ScopedInternalPlatformHandle> incoming_platform_handles; + std::vector<PlatformHandle> handles; Channel::MessagePtr message = WaitForBrokerMessage( - sync_channel_, BrokerMessageType::BUFFER_RESPONSE, kNumExpectedHandles, - sizeof(BufferResponseData), &incoming_platform_handles); + sync_channel_.GetFD().get(), BrokerMessageType::BUFFER_RESPONSE, + kNumExpectedHandles, sizeof(BufferResponseData), &handles); if (message) { const BufferResponseData* data; if (!GetBrokerMessageData(message.get(), &data)) return base::WritableSharedMemoryRegion(); - PlatformHandle handles[2]; - handles[0] = ScopedInternalPlatformHandleToPlatformHandle( - std::move(incoming_platform_handles[0])); - if (incoming_platform_handles.size() > 1) { - handles[1] = ScopedInternalPlatformHandleToPlatformHandle( - std::move(incoming_platform_handles[1])); - } - + if (handles.size() == 1) + handles.emplace_back(); return base::WritableSharedMemoryRegion::Deserialize( base::subtle::PlatformSharedMemoryRegion::Take( CreateSharedMemoryRegionHandleFromPlatformHandles(
diff --git a/mojo/edk/system/broker_win.cc b/mojo/edk/system/broker_win.cc index 33fcd481..f73b3a7 100644 --- a/mojo/edk/system/broker_win.cc +++ b/mojo/edk/system/broker_win.cc
@@ -14,9 +14,7 @@ #include "mojo/edk/system/broker.h" #include "mojo/edk/system/broker_messages.h" #include "mojo/edk/system/channel.h" -#include "mojo/edk/system/platform_handle.h" #include "mojo/edk/system/platform_handle_utils.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/public/cpp/platform/named_platform_channel.h" namespace mojo { @@ -29,28 +27,27 @@ bool TakeHandlesFromBrokerMessage(Channel::Message* message, size_t num_handles, - ScopedInternalPlatformHandle* out_handles) { + PlatformHandle* out_handles) { if (message->num_handles() != num_handles) { DLOG(ERROR) << "Received unexpected number of handles in broker message"; return false; } - std::vector<ScopedInternalPlatformHandle> handles = - message->TakeInternalHandles(); + std::vector<PlatformHandleInTransit> handles = message->TakeHandles(); DCHECK_EQ(handles.size(), num_handles); DCHECK(out_handles); for (size_t i = 0; i < num_handles; ++i) - out_handles[i] = std::move(handles[i]); + out_handles[i] = handles[i].TakeHandle(); return true; } -Channel::MessagePtr WaitForBrokerMessage(InternalPlatformHandle platform_handle, +Channel::MessagePtr WaitForBrokerMessage(HANDLE pipe_handle, BrokerMessageType expected_type) { char buffer[kMaxBrokerMessageSize]; DWORD bytes_read = 0; - BOOL result = ::ReadFile(platform_handle.handle, buffer, - kMaxBrokerMessageSize, &bytes_read, nullptr); + BOOL result = ::ReadFile(pipe_handle, buffer, kMaxBrokerMessageSize, + &bytes_read, nullptr); if (!result) { // The pipe may be broken if the browser side has been closed, e.g. during // browser shutdown. In that case the ReadFile call will fail and we @@ -86,18 +83,20 @@ } // namespace -Broker::Broker(ScopedInternalPlatformHandle handle) - : sync_channel_(std::move(handle)) { +Broker::Broker(PlatformHandle handle) : sync_channel_(std::move(handle)) { CHECK(sync_channel_.is_valid()); - Channel::MessagePtr message = - WaitForBrokerMessage(sync_channel_.get(), BrokerMessageType::INIT); + Channel::MessagePtr message = WaitForBrokerMessage( + sync_channel_.GetHandle().Get(), BrokerMessageType::INIT); // If we fail to read a message (broken pipe), just return early. The inviter // handle will be null and callers must handle this gracefully. if (!message) return; - if (!TakeHandlesFromBrokerMessage(message.get(), 1, &inviter_channel_)) { + PlatformHandle endpoint_handle; + if (TakeHandlesFromBrokerMessage(message.get(), 1, &endpoint_handle)) { + inviter_endpoint_ = PlatformChannelEndpoint(std::move(endpoint_handle)); + } else { // If the message has no handles, we expect it to carry pipe name instead. const BrokerMessageHeader* header = static_cast<const BrokerMessageHeader*>(message->payload()); @@ -110,18 +109,15 @@ const base::char16* name_data = reinterpret_cast<const base::char16*>(data + 1); CHECK(data->pipe_name_length); - inviter_channel_ = PlatformHandleToScopedInternalPlatformHandle( - NamedPlatformChannel::ConnectToServer( - base::StringPiece16(name_data, data->pipe_name_length).as_string()) - .TakePlatformHandle()); - inviter_channel_.get().needs_connection = true; + inviter_endpoint_ = NamedPlatformChannel::ConnectToServer( + base::StringPiece16(name_data, data->pipe_name_length).as_string()); } } Broker::~Broker() {} -ScopedInternalPlatformHandle Broker::GetInviterInternalPlatformHandle() { - return std::move(inviter_channel_); +PlatformChannelEndpoint Broker::GetInviterEndpoint() { + return std::move(inviter_endpoint_); } base::WritableSharedMemoryRegion Broker::GetWritableSharedMemoryRegion( @@ -132,27 +128,27 @@ BrokerMessageType::BUFFER_REQUEST, 0, 0, &buffer_request); buffer_request->size = base::checked_cast<uint32_t>(num_bytes); DWORD bytes_written = 0; - BOOL result = ::WriteFile(sync_channel_.get().handle, out_message->data(), - static_cast<DWORD>(out_message->data_num_bytes()), - &bytes_written, nullptr); + BOOL result = + ::WriteFile(sync_channel_.GetHandle().Get(), out_message->data(), + static_cast<DWORD>(out_message->data_num_bytes()), + &bytes_written, nullptr); if (!result || static_cast<size_t>(bytes_written) != out_message->data_num_bytes()) { PLOG(ERROR) << "Error sending sync broker message"; return base::WritableSharedMemoryRegion(); } - ScopedInternalPlatformHandle handle; + PlatformHandle handle; Channel::MessagePtr response = WaitForBrokerMessage( - sync_channel_.get(), BrokerMessageType::BUFFER_RESPONSE); + sync_channel_.GetHandle().Get(), BrokerMessageType::BUFFER_RESPONSE); if (response && TakeHandlesFromBrokerMessage(response.get(), 1, &handle)) { BufferResponseData* data; if (!GetBrokerMessageData(response.get(), &data)) return base::WritableSharedMemoryRegion(); return base::WritableSharedMemoryRegion::Deserialize( base::subtle::PlatformSharedMemoryRegion::Take( - CreateSharedMemoryRegionHandleFromPlatformHandles( - ScopedInternalPlatformHandleToPlatformHandle(std::move(handle)), - PlatformHandle()), + CreateSharedMemoryRegionHandleFromPlatformHandles(std::move(handle), + PlatformHandle()), base::subtle::PlatformSharedMemoryRegion::Mode::kWritable, num_bytes, base::UnguessableToken::Deserialize(data->guid_high,
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc index bba6ce4..1083f9d 100644 --- a/mojo/edk/system/channel.cc +++ b/mojo/edk/system/channel.cc
@@ -18,8 +18,6 @@ #include "build/build_config.h" #include "mojo/edk/system/configuration.h" #include "mojo/edk/system/core.h" -#include "mojo/edk/system/platform_handle.h" -#include "mojo/edk/system/platform_handle_utils.h" #if defined(OS_MACOSX) && !defined(OS_IOS) #include "base/mac/mach_logging.h" @@ -373,17 +371,6 @@ return reinterpret_cast<Header*>(data_); } -void Channel::Message::SetHandles( - std::vector<ScopedInternalPlatformHandle> new_handles) { - std::vector<PlatformHandleInTransit> handles; - handles.reserve(new_handles.size()); - for (auto& h : new_handles) { - handles.emplace_back(PlatformHandleInTransit( - ScopedInternalPlatformHandleToPlatformHandle(std::move(h)))); - } - SetHandles(std::move(handles)); -} - void Channel::Message::SetHandles(std::vector<PlatformHandle> new_handles) { std::vector<PlatformHandleInTransit> handles; handles.reserve(new_handles.size()); @@ -467,18 +454,6 @@ return std::move(handle_vector_); } -std::vector<ScopedInternalPlatformHandle> -Channel::Message::TakeInternalHandles() { - auto handles = TakeHandles(); - std::vector<ScopedInternalPlatformHandle> internal_handles; - internal_handles.reserve(handles.size()); - for (auto& h : handles) { - internal_handles.emplace_back( - PlatformHandleToScopedInternalPlatformHandle(h.TakeHandle())); - } - return internal_handles; -} - std::vector<PlatformHandleInTransit> Channel::Message::TakeHandlesForTransport() { #if defined(OS_WIN)
diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h index 70b0ec3c..7f505bf 100644 --- a/mojo/edk/system/channel.h +++ b/mojo/edk/system/channel.h
@@ -14,7 +14,6 @@ #include "build/build_config.h" #include "mojo/edk/system/connection_params.h" #include "mojo/edk/system/platform_handle_in_transit.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/scoped_process_handle.h" #include "mojo/public/cpp/platform/platform_handle.h" @@ -91,7 +90,7 @@ #if defined(OS_MACOSX) && !defined(OS_IOS) struct MachPortsEntry { - // Index of Mach port in the original vector of InternalPlatformHandles. + // Index of Mach port in the original vector of PlatformHandleInTransits. uint16_t index; // Mach port name. @@ -186,11 +185,9 @@ // Note: SetHandles() and TakeHandles() invalidate any previous value of // handles(). - void SetHandles(std::vector<ScopedInternalPlatformHandle> new_handles); void SetHandles(std::vector<PlatformHandle> new_handles); void SetHandles(std::vector<PlatformHandleInTransit> new_handles); std::vector<PlatformHandleInTransit> TakeHandles(); - std::vector<ScopedInternalPlatformHandle> TakeInternalHandles(); // Version of TakeHandles that returns a vector of platform handles suitable // for transfer over an underlying OS mechanism. i.e. file descriptors over // a unix domain socket. Any handle that cannot be transferred this way,
diff --git a/mojo/edk/system/channel_fuchsia.cc b/mojo/edk/system/channel_fuchsia.cc index 07f06c4..9cb10ab 100644 --- a/mojo/edk/system/channel_fuchsia.cc +++ b/mojo/edk/system/channel_fuchsia.cc
@@ -21,6 +21,7 @@ #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop_current.h" #include "base/message_loop/message_pump_for_io.h" +#include "base/stl_util.h" #include "base/synchronization/lock.h" #include "base/task_runner.h" #include "mojo/edk/system/platform_handle_in_transit.h" @@ -32,10 +33,9 @@ const size_t kMaxBatchReadCapacity = 256 * 1024; -bool UnwrapInternalPlatformHandle( - PlatformHandleInTransit handle, - Channel::Message::HandleInfoEntry* info_out, - std::vector<PlatformHandleInTransit>* handles_out) { +bool UnwrapPlatformHandle(PlatformHandleInTransit handle, + Channel::Message::HandleInfoEntry* info_out, + std::vector<PlatformHandleInTransit>* handles_out) { DCHECK(handle.handle().is_valid()); if (!handle.handle().is_valid_fd()) { @@ -84,7 +84,7 @@ return true; } -PlatformHandle WrapInternalPlatformHandles( +PlatformHandle WrapPlatformHandles( Channel::Message::HandleInfoEntry info, base::circular_deque<base::ScopedZxHandle>* handles) { PlatformHandle out_handle; @@ -173,8 +173,8 @@ std::vector<PlatformHandleInTransit> in_handles = std::move(handles_); handles_.reserve(in_handles.size()); for (size_t i = 0; i < in_handles.size(); i++) { - if (!UnwrapInternalPlatformHandle(std::move(in_handles[i]), - &handles_info[i], &handles_)) + if (!UnwrapPlatformHandle(std::move(in_handles[i]), &handles_info[i], + &handles_)) return std::vector<PlatformHandleInTransit>(); } return std::move(handles_); @@ -197,7 +197,7 @@ scoped_refptr<base::TaskRunner> io_task_runner) : Channel(delegate), self_(this), - handle_(connection_params.TakeChannelHandle()), + handle_(connection_params.TakeEndpoint().TakePlatformHandle()), io_task_runner_(io_task_runner) { CHECK(handle_.is_valid()); } @@ -277,7 +277,7 @@ handles->reserve(num_handles); for (size_t i = 0; i < num_handles; ++i) { handles->emplace_back( - WrapInternalPlatformHandles(handles_info[i], &incoming_handles_)); + WrapPlatformHandles(handles_info[i], &incoming_handles_)); } return true; } @@ -295,7 +295,7 @@ read_watch_.reset( new base::MessagePumpForIO::ZxHandleWatchController(FROM_HERE)); base::MessageLoopCurrentForIO::Get()->WatchZxHandle( - handle_.get().as_handle(), true /* persistent */, + handle_.GetHandle().get(), true /* persistent */, ZX_CHANNEL_READABLE | ZX_CHANNEL_PEER_CLOSED, read_watch_.get(), this); } @@ -304,7 +304,7 @@ read_watch_.reset(); if (leak_handle_) - ignore_result(handle_.release()); + handle_.release(); handle_.reset(); // May destroy the |this| if it was the last reference. @@ -321,7 +321,7 @@ // base::MessagePumpForIO::ZxHandleWatcher: void OnZxHandleSignalled(zx_handle_t handle, zx_signals_t signals) override { DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); - CHECK_EQ(handle, handle_.get().as_handle()); + CHECK_EQ(handle, handle_.GetHandle().get()); DCHECK((ZX_CHANNEL_READABLE | ZX_CHANNEL_PEER_CLOSED) & signals); // We always try to read message(s), even if ZX_CHANNEL_PEER_CLOSED, since @@ -342,8 +342,8 @@ zx_handle_t handles[ZX_CHANNEL_MAX_MSG_HANDLES] = {}; zx_status_t read_result = zx_channel_read( - handle_.get().as_handle(), 0, buffer, handles, buffer_capacity, - arraysize(handles), &bytes_read, &handles_read); + handle_.GetHandle().get(), 0, buffer, handles, buffer_capacity, + base::size(handles), &bytes_read, &handles_read); if (read_result == ZX_OK) { for (size_t i = 0; i < handles_read; ++i) { incoming_handles_.push_back(base::ScopedZxHandle(handles[i])); @@ -355,7 +355,7 @@ break; } } else if (read_result == ZX_ERR_BUFFER_TOO_SMALL) { - DCHECK_LE(handles_read, arraysize(handles)); + DCHECK_LE(handles_read, base::size(handles)); next_read_size = bytes_read; } else if (read_result == ZX_ERR_SHOULD_WAIT) { break; @@ -389,7 +389,7 @@ zx_handle_t handles[ZX_CHANNEL_MAX_MSG_HANDLES] = {}; size_t handles_count = outgoing_handles.size(); - DCHECK_LE(handles_count, arraysize(handles)); + DCHECK_LE(handles_count, base::size(handles)); for (size_t i = 0; i < handles_count; ++i) { DCHECK(outgoing_handles[i].handle().is_valid()); handles[i] = outgoing_handles[i].handle().GetHandle().get(); @@ -398,7 +398,7 @@ write_bytes = std::min(message_view.data_num_bytes(), static_cast<size_t>(ZX_CHANNEL_MAX_MSG_BYTES)); zx_status_t result = - zx_channel_write(handle_.get().as_handle(), 0, message_view.data(), + zx_channel_write(handle_.GetHandle().get(), 0, message_view.data(), write_bytes, handles, handles_count); // zx_channel_write() consumes |handles| whether or not it succeeds, so // release() our copies now, to avoid them being double-closed. @@ -440,7 +440,7 @@ // Keeps the Channel alive at least until explicit shutdown on the IO thread. scoped_refptr<Channel> self_; - ScopedInternalPlatformHandle handle_; + PlatformHandle handle_; scoped_refptr<base::TaskRunner> io_task_runner_; // These members are only used on the IO thread.
diff --git a/mojo/edk/system/channel_posix.cc b/mojo/edk/system/channel_posix.cc index 623ef3a..59060f4 100644 --- a/mojo/edk/system/channel_posix.cc +++ b/mojo/edk/system/channel_posix.cc
@@ -22,7 +22,6 @@ #include "base/task_runner.h" #include "build/build_config.h" #include "mojo/edk/system/core.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/public/cpp/platform/socket_utils_posix.h" #if !defined(OS_NACL) @@ -102,12 +101,13 @@ ChannelPosix(Delegate* delegate, ConnectionParams connection_params, scoped_refptr<base::TaskRunner> io_task_runner) - : Channel(delegate), - self_(this), - handle_(connection_params.TakeChannelHandle()), - io_task_runner_(io_task_runner) - { - CHECK(handle_.is_valid()); + : Channel(delegate), self_(this), io_task_runner_(io_task_runner) { + if (connection_params.server_endpoint().is_valid()) + server_ = connection_params.TakeServerEndpoint(); + else + socket_ = connection_params.TakeEndpoint().TakePlatformHandle().TakeFD(); + + CHECK(server_.is_valid() || socket_.is_valid()); } void Start() override { @@ -284,15 +284,15 @@ read_watcher_.reset( new base::MessagePumpForIO::FdWatchController(FROM_HERE)); base::MessageLoopCurrent::Get()->AddDestructionObserver(this); - if (handle_.get().needs_connection) { + if (server_.is_valid()) { base::MessageLoopCurrentForIO::Get()->WatchFileDescriptor( - handle_.get().handle, false /* persistent */, + server_.platform_handle().GetFD().get(), false /* persistent */, base::MessagePumpForIO::WATCH_READ, read_watcher_.get(), this); } else { write_watcher_.reset( new base::MessagePumpForIO::FdWatchController(FROM_HERE)); base::MessageLoopCurrentForIO::Get()->WatchFileDescriptor( - handle_.get().handle, true /* persistent */, + socket_.get(), true /* persistent */, base::MessagePumpForIO::WATCH_READ, read_watcher_.get(), this); base::AutoLock lock(write_lock_); FlushOutgoingMessagesNoLock(); @@ -312,7 +312,7 @@ if (io_task_runner_->RunsTasksInCurrentSequence()) { pending_write_ = true; base::MessageLoopCurrentForIO::Get()->WatchFileDescriptor( - handle_.get().handle, false /* persistent */, + socket_.get(), false /* persistent */, base::MessagePumpForIO::WATCH_WRITE, write_watcher_.get(), this); } else { io_task_runner_->PostTask( @@ -326,9 +326,13 @@ read_watcher_.reset(); write_watcher_.reset(); - if (leak_handle_) - ignore_result(handle_.release()); - handle_.reset(); + if (leak_handle_) { + ignore_result(socket_.release()); + server_.TakePlatformHandle().release(); + } else { + socket_.reset(); + ignore_result(server_.TakePlatformHandle()); + } #if defined(OS_MACOSX) fds_to_close_.clear(); #endif @@ -406,26 +410,25 @@ // base::MessagePumpForIO::FdWatcher: void OnFileCanReadWithoutBlocking(int fd) override { - CHECK_EQ(fd, handle_.get().handle); - if (handle_.get().needs_connection) { + if (server_.is_valid()) { + CHECK_EQ(fd, server_.platform_handle().GetFD().get()); #if !defined(OS_NACL) read_watcher_.reset(); base::MessageLoopCurrent::Get()->RemoveDestructionObserver(this); - base::ScopedFD accept_fd; - AcceptSocketConnection(handle_.get().handle, &accept_fd); - if (!accept_fd.is_valid()) { + AcceptSocketConnection(server_.platform_handle().GetFD().get(), &socket_); + ignore_result(server_.TakePlatformHandle()); + if (!socket_.is_valid()) { OnError(Error::kConnectionFailed); return; } - handle_ = ScopedInternalPlatformHandle( - InternalPlatformHandle(accept_fd.release())); StartOnIOThread(); #else NOTREACHED(); #endif return; } + CHECK_EQ(fd, socket_.get()); bool validation_error = false; bool read_error = false; @@ -439,8 +442,8 @@ DCHECK_GT(buffer_capacity, 0u); std::vector<base::ScopedFD> incoming_fds; - ssize_t read_result = SocketRecvmsg(handle_.get().handle, buffer, - buffer_capacity, &incoming_fds); + ssize_t read_result = + SocketRecvmsg(socket_.get(), buffer, buffer_capacity, &incoming_fds); for (auto& fd : incoming_fds) incoming_fds_.emplace_back(std::move(fd)); @@ -485,7 +488,7 @@ // cannot be written, it's queued and a wait is initiated to write the message // ASAP on the I/O thread. bool WriteNoLock(MessageView message_view) { - if (handle_.get().needs_connection) { + if (server_.is_valid()) { outgoing_messages_.emplace_front(std::move(message_view)); return true; } @@ -502,7 +505,7 @@ for (size_t i = 0; i < handles.size(); ++i) fds[i] = handles[i].TakeHandle().TakeFD(); // TODO: Handle lots of handles. - result = SendmsgWithHandles(handle_.get().handle, &iov, 1, fds); + result = SendmsgWithHandles(socket_.get(), &iov, 1, fds); if (result >= 0) { #if defined(OS_MACOSX) // There is a bug on OSX which makes it dangerous to close @@ -534,7 +537,7 @@ } } } else { - result = SocketWrite(handle_.get().handle, message_view.data(), + result = SocketWrite(socket_.get(), message_view.data(), message_view.data_num_bytes()); } @@ -687,7 +690,14 @@ // Keeps the Channel alive at least until explicit shutdown on the IO thread. scoped_refptr<Channel> self_; - ScopedInternalPlatformHandle handle_; + // We may be initialized with a server socket, in which case this will be + // valid until it accepts an incoming connection. + PlatformChannelServerEndpoint server_; + + // The socket over which to communicate. May be passed in at construction time + // or accepted over |server_|. + base::ScopedFD socket_; + scoped_refptr<base::TaskRunner> io_task_runner_; // These watchers must only be accessed on the IO thread.
diff --git a/mojo/edk/system/channel_unittest.cc b/mojo/edk/system/channel_unittest.cc index 74ee1c9e..87a8db99 100644 --- a/mojo/edk/system/channel_unittest.cc +++ b/mojo/edk/system/channel_unittest.cc
@@ -184,7 +184,7 @@ class ChannelTestShutdownAndWriteDelegate : public Channel::Delegate { public: ChannelTestShutdownAndWriteDelegate( - ScopedInternalPlatformHandle handle, + PlatformChannelEndpoint endpoint, scoped_refptr<base::TaskRunner> task_runner, scoped_refptr<Channel> client_channel, std::unique_ptr<base::Thread> client_thread, @@ -192,7 +192,7 @@ : quit_closure_(std::move(quit_closure)), client_channel_(std::move(client_channel)), client_thread_(std::move(client_thread)) { - channel_ = Channel::Create(this, ConnectionParams(std::move(handle)), + channel_ = Channel::Create(this, ConnectionParams(std::move(endpoint)), std::move(task_runner)); channel_->Start(); } @@ -249,11 +249,9 @@ client_thread->StartWithOptions( base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); - scoped_refptr<Channel> client_channel = Channel::Create( - nullptr, - ConnectionParams(PlatformHandleToScopedInternalPlatformHandle( - channel.TakeRemoteEndpoint().TakePlatformHandle())), - client_thread->task_runner()); + scoped_refptr<Channel> client_channel = + Channel::Create(nullptr, ConnectionParams(channel.TakeRemoteEndpoint()), + client_thread->task_runner()); client_channel->Start(); // On the "client" IO thread, create and write a message. @@ -268,10 +266,9 @@ // is received. base::RunLoop run_loop; ChannelTestShutdownAndWriteDelegate server_delegate( - PlatformHandleToScopedInternalPlatformHandle( - channel.TakeLocalEndpoint().TakePlatformHandle()), - message_loop.task_runner(), std::move(client_channel), - std::move(client_thread), run_loop.QuitClosure()); + channel.TakeLocalEndpoint(), message_loop.task_runner(), + std::move(client_channel), std::move(client_thread), + run_loop.QuitClosure()); run_loop.Run(); }
diff --git a/mojo/edk/system/channel_win.cc b/mojo/edk/system/channel_win.cc index 620a9d55..5573be3 100644 --- a/mojo/edk/system/channel_win.cc +++ b/mojo/edk/system/channel_win.cc
@@ -21,8 +21,8 @@ #include "base/process/process_handle.h" #include "base/synchronization/lock.h" #include "base/task_runner.h" +#include "base/win/scoped_handle.h" #include "base/win/win_util.h" -#include "mojo/edk/system/scoped_platform_handle.h" namespace mojo { namespace edk { @@ -34,13 +34,20 @@ public base::MessagePumpForIO::IOHandler { public: ChannelWin(Delegate* delegate, - ScopedInternalPlatformHandle handle, + ConnectionParams connection_params, scoped_refptr<base::TaskRunner> io_task_runner) - : Channel(delegate), - self_(this), - handle_(std::move(handle)), - io_task_runner_(io_task_runner) { - CHECK(handle_.is_valid()); + : Channel(delegate), self_(this), io_task_runner_(io_task_runner) { + if (connection_params.server_endpoint().is_valid()) { + handle_ = connection_params.TakeServerEndpoint() + .TakePlatformHandle() + .TakeHandle(); + needs_connection_ = true; + } else { + handle_ = + connection_params.TakeEndpoint().TakePlatformHandle().TakeHandle(); + } + + CHECK(handle_.IsValid()); } void Start() override { @@ -130,12 +137,11 @@ void StartOnIOThread() { base::MessageLoopCurrent::Get()->AddDestructionObserver(this); - base::MessageLoopCurrentForIO::Get()->RegisterIOHandler( - handle_.get().handle, this); + base::MessageLoopCurrentForIO::Get()->RegisterIOHandler(handle_.Get(), + this); - if (handle_.get().needs_connection) { - BOOL ok = ConnectNamedPipe(handle_.get().handle, - &connect_context_.overlapped); + if (needs_connection_) { + BOOL ok = ::ConnectNamedPipe(handle_.Get(), &connect_context_.overlapped); if (ok) { PLOG(ERROR) << "Unexpected success while waiting for pipe connection"; OnError(Error::kConnectionFailed); @@ -177,11 +183,12 @@ // BUG(crbug.com/583525): This function is expected to be called once, and // |handle_| should be valid at this point. - CHECK(handle_.is_valid()); - CancelIo(handle_.get().handle); + CHECK(handle_.IsValid()); + CancelIo(handle_.Get()); if (leak_handle_) - ignore_result(handle_.release()); - handle_.reset(); + ignore_result(handle_.Take()); + else + handle_.Close(); // Allow |this| to be destroyed as soon as no IO is pending. self_ = nullptr; @@ -280,12 +287,9 @@ char* buffer = GetReadBuffer(&buffer_capacity); DCHECK_GT(buffer_capacity, 0u); - BOOL ok = ReadFile(handle_.get().handle, - buffer, - static_cast<DWORD>(buffer_capacity), - NULL, - &read_context_.overlapped); - + BOOL ok = + ::ReadFile(handle_.Get(), buffer, static_cast<DWORD>(buffer_capacity), + NULL, &read_context_.overlapped); if (ok || GetLastError() == ERROR_IO_PENDING) { is_read_pending_ = true; AddRef(); @@ -298,10 +302,9 @@ // cannot be written, it's queued and a wait is initiated to write the message // ASAP on the I/O thread. bool WriteNoLock(const Channel::MessagePtr& message) { - BOOL ok = WriteFile(handle_.get().handle, message->data(), + BOOL ok = WriteFile(handle_.Get(), message->data(), static_cast<DWORD>(message->data_num_bytes()), NULL, &write_context_.overlapped); - if (ok || GetLastError() == ERROR_IO_PENDING) { is_write_pending_ = true; AddRef(); @@ -334,7 +337,12 @@ // Keeps the Channel alive at least until explicit shutdown on the IO thread. scoped_refptr<Channel> self_; - ScopedInternalPlatformHandle handle_; + // The pipe handle this Channel uses for communication. + base::win::ScopedHandle handle_; + + // Indicates whether |handle_| must wait for a connection. + bool needs_connection_ = false; + const scoped_refptr<base::TaskRunner> io_task_runner_; base::MessagePumpForIO::IOContext connect_context_; @@ -362,8 +370,7 @@ Delegate* delegate, ConnectionParams connection_params, scoped_refptr<base::TaskRunner> io_task_runner) { - return new ChannelWin(delegate, connection_params.TakeChannelHandle(), - io_task_runner); + return new ChannelWin(delegate, std::move(connection_params), io_task_runner); } } // namespace edk
diff --git a/mojo/edk/system/connection_params.cc b/mojo/edk/system/connection_params.cc index e34292b..bd64a1c 100644 --- a/mojo/edk/system/connection_params.cc +++ b/mojo/edk/system/connection_params.cc
@@ -11,19 +11,21 @@ namespace mojo { namespace edk { -ConnectionParams::ConnectionParams(ScopedInternalPlatformHandle channel) - : channel_(std::move(channel)) {} +ConnectionParams::ConnectionParams() = default; -ConnectionParams::ConnectionParams(ConnectionParams&& params) { - *this = std::move(params); -} +ConnectionParams::ConnectionParams(PlatformChannelEndpoint endpoint) + : endpoint_(std::move(endpoint)) {} + +ConnectionParams::ConnectionParams( + PlatformChannelServerEndpoint server_endpoint) + : server_endpoint_(std::move(server_endpoint)) {} + +ConnectionParams::ConnectionParams(ConnectionParams&&) = default; + +ConnectionParams::~ConnectionParams() = default; ConnectionParams& ConnectionParams::operator=(ConnectionParams&& params) = default; -ScopedInternalPlatformHandle ConnectionParams::TakeChannelHandle() { - return std::move(channel_); -} - } // namespace edk } // namespace mojo
diff --git a/mojo/edk/system/connection_params.h b/mojo/edk/system/connection_params.h index cbcf3f47..e435a44 100644 --- a/mojo/edk/system/connection_params.h +++ b/mojo/edk/system/connection_params.h
@@ -7,8 +7,9 @@ #include "base/macros.h" #include "build/build_config.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" +#include "mojo/public/cpp/platform/platform_channel_endpoint.h" +#include "mojo/public/cpp/platform/platform_channel_server_endpoint.h" namespace mojo { namespace edk { @@ -16,15 +17,28 @@ // A set of parameters used when establishing a connection to another process. class MOJO_SYSTEM_IMPL_EXPORT ConnectionParams { public: - explicit ConnectionParams(ScopedInternalPlatformHandle channel); + ConnectionParams(); + explicit ConnectionParams(PlatformChannelEndpoint endpoint); + explicit ConnectionParams(PlatformChannelServerEndpoint server_endpoint); + ConnectionParams(ConnectionParams&&); + ~ConnectionParams(); - ConnectionParams(ConnectionParams&& params); - ConnectionParams& operator=(ConnectionParams&& params); + ConnectionParams& operator=(ConnectionParams&&); - ScopedInternalPlatformHandle TakeChannelHandle(); + const PlatformChannelEndpoint& endpoint() const { return endpoint_; } + const PlatformChannelServerEndpoint& server_endpoint() const { + return server_endpoint_; + } + + PlatformChannelEndpoint TakeEndpoint() { return std::move(endpoint_); } + + PlatformChannelServerEndpoint TakeServerEndpoint() { + return std::move(server_endpoint_); + } private: - ScopedInternalPlatformHandle channel_; + PlatformChannelEndpoint endpoint_; + PlatformChannelServerEndpoint server_endpoint_; DISALLOW_COPY_AND_ASSIGN(ConnectionParams); };
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc index ed656c3..dceb004 100644 --- a/mojo/edk/system/core.cc +++ b/mojo/edk/system/core.cc
@@ -1340,13 +1340,18 @@ if (!endpoint.is_valid()) return MOJO_RESULT_INVALID_ARGUMENT; - auto endpoint_handle = - PlatformHandleToScopedInternalPlatformHandle(std::move(endpoint)); - + ConnectionParams connection_params; #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_FUCHSIA)) - if (transport_endpoint->type == MOJO_INVITATION_TRANSPORT_TYPE_CHANNEL_SERVER) - endpoint_handle.get().needs_connection = true; + if (transport_endpoint->type == + MOJO_INVITATION_TRANSPORT_TYPE_CHANNEL_SERVER) { + connection_params = + ConnectionParams(PlatformChannelServerEndpoint(std::move(endpoint))); + } #endif + if (!connection_params.server_endpoint().is_valid()) { + connection_params = + ConnectionParams(PlatformChannelEndpoint(std::move(endpoint))); + } // At this point everything else has been validated, so we can take ownership // of the dispatcher. @@ -1358,14 +1363,13 @@ if (result != MOJO_RESULT_OK) { // Release ownership of the endpoint platform handle, per the API // contract. The caller retains ownership on failure. - ignore_result(endpoint_handle.release()); + connection_params.TakeEndpoint().TakePlatformHandle().release(); + connection_params.TakeServerEndpoint().TakePlatformHandle().release(); return result; } DCHECK_EQ(removed_dispatcher.get(), invitation_dispatcher); } - ConnectionParams connection_params(std::move(endpoint_handle)); - std::vector<std::pair<std::string, ports::PortRef>> attached_ports; InvitationDispatcher::PortMapping attached_port_map = invitation_dispatcher->TakeAttachedPorts(); @@ -1429,19 +1433,23 @@ return MOJO_RESULT_INVALID_ARGUMENT; } - auto endpoint_handle = - PlatformHandleToScopedInternalPlatformHandle(std::move(endpoint)); - + ConnectionParams connection_params; #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_FUCHSIA)) - if (transport_endpoint->type == MOJO_INVITATION_TRANSPORT_TYPE_CHANNEL_SERVER) - endpoint_handle.get().needs_connection = true; + if (transport_endpoint->type == + MOJO_INVITATION_TRANSPORT_TYPE_CHANNEL_SERVER) { + connection_params = + ConnectionParams(PlatformChannelServerEndpoint(std::move(endpoint))); + } #endif + if (!connection_params.server_endpoint().is_valid()) { + connection_params = + ConnectionParams(PlatformChannelEndpoint(std::move(endpoint))); + } bool is_isolated = options && (options->flags & MOJO_ACCEPT_INVITATION_FLAG_ISOLATED); NodeController* const node_controller = GetNodeController(); RequestContext request_context; - ConnectionParams connection_params(std::move(endpoint_handle)); if (is_isolated) { // For an isolated invitation, we simply mint a new port pair here and send // one name to the remote endpoint while stashing the other in the accepted
diff --git a/mojo/edk/system/core.h b/mojo/edk/system/core.h index b6b38a82..207da18 100644 --- a/mojo/edk/system/core.h +++ b/mojo/edk/system/core.h
@@ -20,7 +20,6 @@ #include "mojo/edk/system/handle_signals_state.h" #include "mojo/edk/system/handle_table.h" #include "mojo/edk/system/node_controller.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/public/c/system/buffer.h" #include "mojo/public/c/system/data_pipe.h"
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc index 957cf6a..9e98ca8 100644 --- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc +++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -299,7 +299,7 @@ bool DataPipeConsumerDispatcher::EndSerialize( void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* platform_handles) { + PlatformHandle* platform_handles) { SerializedState* state = static_cast<SerializedState*>(destination); memcpy(&state->options, &options_, sizeof(MojoCreateDataPipeOptions)); memset(state->padding, 0, sizeof(state->padding)); @@ -327,9 +327,7 @@ if (!handle.is_valid() || ignored_handle.is_valid()) return false; - platform_handles[0] = - PlatformHandleToScopedInternalPlatformHandle(std::move(handle)); - + platform_handles[0] = std::move(handle); return true; } @@ -364,7 +362,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles) { if (num_ports != 1 || num_handles != 1 || num_bytes != sizeof(SerializedState)) { @@ -382,10 +380,8 @@ if (node_controller->node()->GetPort(ports[0], &port) != ports::OK) return nullptr; - auto buffer_handle = - ScopedInternalPlatformHandleToPlatformHandle(std::move(handles[0])); auto region_handle = CreateSharedMemoryRegionHandleFromPlatformHandles( - std::move(buffer_handle), PlatformHandle()); + std::move(handles[0]), PlatformHandle()); auto region = base::subtle::PlatformSharedMemoryRegion::Take( std::move(region_handle), base::subtle::PlatformSharedMemoryRegion::Mode::kUnsafe,
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.h b/mojo/edk/system/data_pipe_consumer_dispatcher.h index e8788483..3e0ca59 100644 --- a/mojo/edk/system/data_pipe_consumer_dispatcher.h +++ b/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -17,7 +17,6 @@ #include "base/synchronization/lock.h" #include "mojo/edk/system/dispatcher.h" #include "mojo/edk/system/ports/port_ref.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/edk/system/watcher_set.h" @@ -58,7 +57,7 @@ uint32_t* num_handles) override; bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) override; + PlatformHandle* handles) override; bool BeginTransit() override; void CompleteTransitAndClose() override; void CancelTransit() override; @@ -68,7 +67,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles); private:
diff --git a/mojo/edk/system/data_pipe_control_message.cc b/mojo/edk/system/data_pipe_control_message.cc index 4a6639d..9c0be7c 100644 --- a/mojo/edk/system/data_pipe_control_message.cc +++ b/mojo/edk/system/data_pipe_control_message.cc
@@ -6,7 +6,6 @@ #include "mojo/edk/system/node_controller.h" #include "mojo/edk/system/ports/event.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/user_message_impl.h" namespace mojo {
diff --git a/mojo/edk/system/data_pipe_control_message.h b/mojo/edk/system/data_pipe_control_message.h index 04636a60..19e218f 100644 --- a/mojo/edk/system/data_pipe_control_message.h +++ b/mojo/edk/system/data_pipe_control_message.h
@@ -10,7 +10,6 @@ #include <memory> #include "mojo/edk/system/ports/port_ref.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/public/c/system/macros.h" namespace mojo {
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc index 2408dbb0..e10db6bb 100644 --- a/mojo/edk/system/data_pipe_producer_dispatcher.cc +++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -258,7 +258,7 @@ bool DataPipeProducerDispatcher::EndSerialize( void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* platform_handles) { + PlatformHandle* platform_handles) { SerializedState* state = static_cast<SerializedState*>(destination); memcpy(&state->options, &options_, sizeof(MojoCreateDataPipeOptions)); memset(state->padding, 0, sizeof(state->padding)); @@ -286,8 +286,7 @@ if (!handle.is_valid() || ignored_handle.is_valid()) return false; - platform_handles[0] = - PlatformHandleToScopedInternalPlatformHandle(std::move(handle)); + platform_handles[0] = std::move(handle); return true; } @@ -324,7 +323,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles) { if (num_ports != 1 || num_handles != 1 || num_bytes != sizeof(SerializedState)) { @@ -342,10 +341,8 @@ if (node_controller->node()->GetPort(ports[0], &port) != ports::OK) return nullptr; - auto buffer_handle = - ScopedInternalPlatformHandleToPlatformHandle(std::move(handles[0])); auto region_handle = CreateSharedMemoryRegionHandleFromPlatformHandles( - std::move(buffer_handle), PlatformHandle()); + std::move(handles[0]), PlatformHandle()); auto region = base::subtle::PlatformSharedMemoryRegion::Take( std::move(region_handle), base::subtle::PlatformSharedMemoryRegion::Mode::kUnsafe,
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.h b/mojo/edk/system/data_pipe_producer_dispatcher.h index 53ad975..2500d754 100644 --- a/mojo/edk/system/data_pipe_producer_dispatcher.h +++ b/mojo/edk/system/data_pipe_producer_dispatcher.h
@@ -17,7 +17,6 @@ #include "base/synchronization/lock.h" #include "mojo/edk/system/dispatcher.h" #include "mojo/edk/system/ports/port_ref.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/edk/system/watcher_set.h" @@ -57,7 +56,7 @@ uint32_t* num_handles) override; bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) override; + PlatformHandle* handles) override; bool BeginTransit() override; void CompleteTransitAndClose() override; void CancelTransit() override; @@ -67,7 +66,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles); private:
diff --git a/mojo/edk/system/dispatcher.cc b/mojo/edk/system/dispatcher.cc index 6d9f875..58e3ade 100644 --- a/mojo/edk/system/dispatcher.cc +++ b/mojo/edk/system/dispatcher.cc
@@ -133,7 +133,7 @@ bool Dispatcher::EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) { + PlatformHandle* handles) { LOG(ERROR) << "Attempting to serialize a non-transferrable dispatcher."; return true; } @@ -153,7 +153,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* platform_handles, + PlatformHandle* platform_handles, size_t num_platform_handles) { switch (type) { case Type::MESSAGE_PIPE:
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h index 42352440..0a1e433 100644 --- a/mojo/edk/system/dispatcher.h +++ b/mojo/edk/system/dispatcher.h
@@ -17,10 +17,8 @@ #include "base/strings/string_piece.h" #include "base/synchronization/lock.h" #include "mojo/edk/system/handle_signals_state.h" -#include "mojo/edk/system/platform_handle.h" #include "mojo/edk/system/ports/name.h" #include "mojo/edk/system/ports/port_ref.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/edk/system/watch.h" #include "mojo/public/c/system/buffer.h" @@ -28,6 +26,7 @@ #include "mojo/public/c/system/message_pipe.h" #include "mojo/public/c/system/trap.h" #include "mojo/public/c/system/types.h" +#include "mojo/public/cpp/platform/platform_handle.h" namespace mojo { namespace edk { @@ -177,13 +176,13 @@ // will close. // // NOTE: Transit MAY still fail after this call returns. Implementations - // should not assume InternalPlatformHandle ownership has transferred until + // should not assume PlatformHandle ownership has transferred until // CompleteTransitAndClose() is called. In other words, if CancelTransit() is - // called, the implementation should retain its InternalPlatformHandles in - // working condition. + // called, the implementation should retain its PlatformHandles in working + // condition. virtual bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles); + PlatformHandle* handles); // Does whatever is necessary to begin transit of the dispatcher. This // should return |true| if transit is OK, or false if the underlying resource @@ -200,14 +199,13 @@ virtual void CancelTransit(); // Deserializes a specific dispatcher type from an incoming message. - static scoped_refptr<Dispatcher> Deserialize( - Type type, - const void* bytes, - size_t num_bytes, - const ports::PortName* ports, - size_t num_ports, - ScopedInternalPlatformHandle* platform_handles, - size_t platform_handle_count); + static scoped_refptr<Dispatcher> Deserialize(Type type, + const void* bytes, + size_t num_bytes, + const ports::PortName* ports, + size_t num_ports, + PlatformHandle* platform_handles, + size_t platform_handle_count); protected: friend class base::RefCountedThreadSafe<Dispatcher>;
diff --git a/mojo/edk/system/invitation_dispatcher.h b/mojo/edk/system/invitation_dispatcher.h index b6c1dc5..24dab09f 100644 --- a/mojo/edk/system/invitation_dispatcher.h +++ b/mojo/edk/system/invitation_dispatcher.h
@@ -13,7 +13,6 @@ #include "base/synchronization/lock.h" #include "mojo/edk/system/dispatcher.h" #include "mojo/edk/system/ports/port_ref.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" namespace mojo {
diff --git a/mojo/edk/system/mach_port_relay.cc b/mojo/edk/system/mach_port_relay.cc index 7e61336..208d2dc3 100644 --- a/mojo/edk/system/mach_port_relay.cc +++ b/mojo/edk/system/mach_port_relay.cc
@@ -13,7 +13,6 @@ #include "base/mac/scoped_mach_port.h" #include "base/metrics/histogram_macros.h" #include "base/process/process.h" -#include "mojo/edk/system/scoped_platform_handle.h" namespace mojo { namespace edk {
diff --git a/mojo/edk/system/mach_port_relay.h b/mojo/edk/system/mach_port_relay.h index 436cbad9..37b98ba 100644 --- a/mojo/edk/system/mach_port_relay.h +++ b/mojo/edk/system/mach_port_relay.h
@@ -12,7 +12,6 @@ #include "base/process/port_provider_mac.h" #include "base/synchronization/lock.h" #include "mojo/edk/system/channel.h" -#include "mojo/edk/system/scoped_platform_handle.h" namespace mojo { namespace edk {
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc index 219ad4c..3063d87 100644 --- a/mojo/edk/system/message_pipe_dispatcher.cc +++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -223,10 +223,9 @@ *num_handles = 0; } -bool MessagePipeDispatcher::EndSerialize( - void* destination, - ports::PortName* ports, - ScopedInternalPlatformHandle* handles) { +bool MessagePipeDispatcher::EndSerialize(void* destination, + ports::PortName* ports, + PlatformHandle* handles) { SerializedState* state = static_cast<SerializedState*>(destination); state->pipe_id = pipe_id_; state->endpoint = static_cast<int8_t>(endpoint_); @@ -266,7 +265,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles) { if (num_ports != 1 || num_handles || num_bytes != sizeof(SerializedState)) return nullptr;
diff --git a/mojo/edk/system/message_pipe_dispatcher.h b/mojo/edk/system/message_pipe_dispatcher.h index 64ad3d7..0c252a5d 100644 --- a/mojo/edk/system/message_pipe_dispatcher.h +++ b/mojo/edk/system/message_pipe_dispatcher.h
@@ -61,18 +61,17 @@ uint32_t* num_handles) override; bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) override; + PlatformHandle* handles) override; bool BeginTransit() override; void CompleteTransitAndClose() override; void CancelTransit() override; - static scoped_refptr<Dispatcher> Deserialize( - const void* data, - size_t num_bytes, - const ports::PortName* ports, - size_t num_ports, - ScopedInternalPlatformHandle* handles, - size_t num_handles); + static scoped_refptr<Dispatcher> Deserialize(const void* data, + size_t num_bytes, + const ports::PortName* ports, + size_t num_ports, + PlatformHandle* handles, + size_t num_handles); private: class PortObserverThunk;
diff --git a/mojo/edk/system/message_pipe_perftest.cc b/mojo/edk/system/message_pipe_perftest.cc index a74a58ba..3e26742 100644 --- a/mojo/edk/system/message_pipe_perftest.cc +++ b/mojo/edk/system/message_pipe_perftest.cc
@@ -17,7 +17,6 @@ #include "base/threading/thread.h" #include "mojo/edk/embedder/embedder.h" #include "mojo/edk/system/handle_signals_state.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/test_utils.h" #include "mojo/edk/test/mojo_test_base.h" #include "mojo/edk/test/test_utils.h"
diff --git a/mojo/edk/system/multiprocess_message_pipe_unittest.cc b/mojo/edk/system/multiprocess_message_pipe_unittest.cc index 4e43891..572a2d75e 100644 --- a/mojo/edk/system/multiprocess_message_pipe_unittest.cc +++ b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
@@ -23,7 +23,6 @@ #include "base/strings/string_split.h" #include "build/build_config.h" #include "mojo/edk/system/handle_signals_state.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/test_utils.h" #include "mojo/edk/test/mojo_test_base.h" #include "mojo/edk/test/test_utils.h" @@ -402,7 +401,7 @@ }); } -DEFINE_TEST_CLIENT_WITH_PIPE(CheckInternalPlatformHandleFile, +DEFINE_TEST_CLIENT_WITH_PIPE(CheckPlatformHandleFile, MultiprocessMessagePipeTest, h) { HandleSignalsState hss; @@ -450,12 +449,11 @@ : public MultiprocessMessagePipeTest, public testing::WithParamInterface<size_t> {}; -TEST_P(MultiprocessMessagePipeTestWithPipeCount, - InternalPlatformHandlePassing) { +TEST_P(MultiprocessMessagePipeTestWithPipeCount, PlatformHandlePassing) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - RunTestClient("CheckInternalPlatformHandleFile", [&](MojoHandle h) { + RunTestClient("CheckPlatformHandleFile", [&](MojoHandle h) { std::vector<MojoHandle> handles; size_t pipe_count = GetParam();
diff --git a/mojo/edk/system/node_channel.cc b/mojo/edk/system/node_channel.cc index 4d1fcbe3..315610c 100644 --- a/mojo/edk/system/node_channel.cc +++ b/mojo/edk/system/node_channel.cc
@@ -15,7 +15,6 @@ #include "mojo/edk/system/channel.h" #include "mojo/edk/system/configuration.h" #include "mojo/edk/system/core.h" -#include "mojo/edk/system/platform_handle_utils.h" #include "mojo/edk/system/request_context.h" namespace mojo { @@ -283,10 +282,9 @@ void NodeChannel::AddBrokerClient(const ports::NodeName& client_name, ScopedProcessHandle process_handle) { AddBrokerClientData* data; - std::vector<ScopedInternalPlatformHandle> handles; + std::vector<PlatformHandle> handles; #if defined(OS_WIN) - handles.emplace_back(ScopedInternalPlatformHandle( - InternalPlatformHandle(process_handle.release()))); + handles.emplace_back(base::win::ScopedHandle(process_handle.release())); #endif Channel::MessagePtr message = CreateMessage(MessageType::ADD_BROKER_CLIENT, sizeof(AddBrokerClientData), @@ -300,13 +298,12 @@ WriteChannelMessage(std::move(message)); } -void NodeChannel::BrokerClientAdded( - const ports::NodeName& client_name, - ScopedInternalPlatformHandle broker_channel) { +void NodeChannel::BrokerClientAdded(const ports::NodeName& client_name, + PlatformHandle broker_channel) { BrokerClientAddedData* data; - std::vector<ScopedInternalPlatformHandle> handles; + std::vector<PlatformHandle> handles; if (broker_channel.is_valid()) - handles.push_back(std::move(broker_channel)); + handles.emplace_back(std::move(broker_channel)); Channel::MessagePtr message = CreateMessage(MessageType::BROKER_CLIENT_ADDED, sizeof(BrokerClientAddedData), handles.size(), &data); @@ -315,13 +312,12 @@ WriteChannelMessage(std::move(message)); } -void NodeChannel::AcceptBrokerClient( - const ports::NodeName& broker_name, - ScopedInternalPlatformHandle broker_channel) { +void NodeChannel::AcceptBrokerClient(const ports::NodeName& broker_name, + PlatformHandle broker_channel) { AcceptBrokerClientData* data; - std::vector<ScopedInternalPlatformHandle> handles; + std::vector<PlatformHandle> handles; if (broker_channel.is_valid()) - handles.push_back(std::move(broker_channel)); + handles.emplace_back(std::move(broker_channel)); Channel::MessagePtr message = CreateMessage(MessageType::ACCEPT_BROKER_CLIENT, sizeof(AcceptBrokerClientData), handles.size(), &data); @@ -350,11 +346,11 @@ } void NodeChannel::Introduce(const ports::NodeName& name, - ScopedInternalPlatformHandle channel_handle) { + PlatformHandle channel_handle) { IntroductionData* data; - std::vector<ScopedInternalPlatformHandle> handles; + std::vector<PlatformHandle> handles; if (channel_handle.is_valid()) - handles.push_back(std::move(channel_handle)); + handles.emplace_back(std::move(channel_handle)); Channel::MessagePtr message = CreateMessage( MessageType::INTRODUCE, sizeof(IntroductionData), handles.size(), &data); message->SetHandles(std::move(handles)); @@ -400,10 +396,9 @@ // above stated assumption. We should not leak handles in cases where we // outlive the broker, as we may continue existing and eventually accept a new // broker invitation. - std::vector<ScopedInternalPlatformHandle> handles = - message->TakeInternalHandles(); + std::vector<PlatformHandleInTransit> handles = message->TakeHandles(); for (auto& handle : handles) - ignore_result(handle.release()); + handle.TakeHandle().release(); #else DCHECK(message->has_mach_ports()); @@ -413,8 +408,7 @@ // moves them back to the relayed message. This is necessary because the // message may contain fds which need to be attached to the outer message so // that they can be transferred to the broker. - std::vector<ScopedInternalPlatformHandle> handles = - message->TakeInternalHandles(); + std::vector<PlatformHandleInTransit> handles = message->TakeHandles(); size_t num_bytes = sizeof(RelayEventMessageData) + message->data_num_bytes(); RelayEventMessageData* data; Channel::MessagePtr relay_message = CreateMessage( @@ -462,21 +456,13 @@ ShutDown(); } -void NodeChannel::OnChannelMessage( - const void* payload, - size_t payload_size, - std::vector<PlatformHandle> platform_handles) { +void NodeChannel::OnChannelMessage(const void* payload, + size_t payload_size, + std::vector<PlatformHandle> handles) { DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); RequestContext request_context(RequestContext::Source::SYSTEM); - std::vector<ScopedInternalPlatformHandle> handles; - handles.reserve(platform_handles.size()); - for (auto& h : platform_handles) { - handles.emplace_back( - PlatformHandleToScopedInternalPlatformHandle(std::move(h))); - } - // Ensure this NodeChannel stays alive through the extent of this method. The // delegate may have the only other reference to this object and it may choose // to drop it here in response to, e.g., a malformed message. @@ -518,7 +504,7 @@ break; } delegate_->OnAddBrokerClient(remote_node_name_, data->client_name, - handles.at(0).release().handle); + handles[0].ReleaseHandle()); #else if (!handles.empty()) { DLOG(ERROR) << "Dropping invalid AddBrokerClient message."; @@ -540,7 +526,7 @@ break; } delegate_->OnBrokerClientAdded(remote_node_name_, data->client_name, - std::move(handles.at(0))); + std::move(handles[0])); return; } break; @@ -549,14 +535,14 @@ case MessageType::ACCEPT_BROKER_CLIENT: { const AcceptBrokerClientData* data; if (GetMessagePayload(payload, payload_size, &data)) { - ScopedInternalPlatformHandle broker_channel; + PlatformHandle broker_channel; if (handles.size() > 1) { DLOG(ERROR) << "Dropping invalid AcceptBrokerClient message."; break; } - if (handles.size() == 1) { - broker_channel = std::move(handles.at(0)); - } + if (handles.size() == 1) + broker_channel = std::move(handles[0]); + delegate_->OnAcceptBrokerClient(remote_node_name_, data->broker_name, std::move(broker_channel)); return; @@ -604,10 +590,10 @@ DLOG(ERROR) << "Dropping invalid introduction message."; break; } - ScopedInternalPlatformHandle channel_handle; - if (handles.size() == 1) { - channel_handle = std::move(handles.at(0)); - } + PlatformHandle channel_handle; + if (handles.size() == 1) + channel_handle = std::move(handles[0]); + delegate_->OnIntroduce(remote_node_name_, data->name, std::move(channel_handle)); return;
diff --git a/mojo/edk/system/node_channel.h b/mojo/edk/system/node_channel.h index 2109cd2..cec96fb 100644 --- a/mojo/edk/system/node_channel.h +++ b/mojo/edk/system/node_channel.h
@@ -20,7 +20,6 @@ #include "mojo/edk/system/channel.h" #include "mojo/edk/system/connection_params.h" #include "mojo/edk/system/ports/name.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/scoped_process_handle.h" namespace mojo { @@ -42,14 +41,12 @@ virtual void OnAddBrokerClient(const ports::NodeName& from_node, const ports::NodeName& client_name, base::ProcessHandle process_handle) = 0; - virtual void OnBrokerClientAdded( - const ports::NodeName& from_node, - const ports::NodeName& client_name, - ScopedInternalPlatformHandle broker_channel) = 0; - virtual void OnAcceptBrokerClient( - const ports::NodeName& from_node, - const ports::NodeName& broker_name, - ScopedInternalPlatformHandle broker_channel) = 0; + virtual void OnBrokerClientAdded(const ports::NodeName& from_node, + const ports::NodeName& client_name, + PlatformHandle broker_channel) = 0; + virtual void OnAcceptBrokerClient(const ports::NodeName& from_node, + const ports::NodeName& broker_name, + PlatformHandle broker_channel) = 0; virtual void OnEventMessage(const ports::NodeName& from_node, Channel::MessagePtr message) = 0; virtual void OnRequestPortMerge(const ports::NodeName& from_node, @@ -59,7 +56,7 @@ const ports::NodeName& name) = 0; virtual void OnIntroduce(const ports::NodeName& from_node, const ports::NodeName& name, - ScopedInternalPlatformHandle channel_handle) = 0; + PlatformHandle channel_handle) = 0; virtual void OnBroadcast(const ports::NodeName& from_node, Channel::MessagePtr message) = 0; #if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) @@ -123,14 +120,13 @@ void AddBrokerClient(const ports::NodeName& client_name, ScopedProcessHandle process_handle); void BrokerClientAdded(const ports::NodeName& client_name, - ScopedInternalPlatformHandle broker_channel); + PlatformHandle broker_channel); void AcceptBrokerClient(const ports::NodeName& broker_name, - ScopedInternalPlatformHandle broker_channel); + PlatformHandle broker_channel); void RequestPortMerge(const ports::PortName& connector_port_name, const std::string& token); void RequestIntroduction(const ports::NodeName& name); - void Introduce(const ports::NodeName& name, - ScopedInternalPlatformHandle channel_handle); + void Introduce(const ports::NodeName& name, PlatformHandle channel_handle); void SendChannelMessage(Channel::MessagePtr message); void Broadcast(Channel::MessagePtr message);
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc index 974854a7..9af0caad 100644 --- a/mojo/edk/system/node_controller.cc +++ b/mojo/edk/system/node_controller.cc
@@ -23,7 +23,6 @@ #include "mojo/edk/system/broker_host.h" #include "mojo/edk/system/configuration.h" #include "mojo/edk/system/core.h" -#include "mojo/edk/system/platform_handle_utils.h" #include "mojo/edk/system/request_context.h" #include "mojo/edk/system/user_message_impl.h" #include "mojo/public/cpp/platform/named_platform_channel.h" @@ -205,12 +204,13 @@ #if !defined(OS_MACOSX) && !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA) // Use the bootstrap channel for the broker and receive the node's channel // synchronously as the first message from the broker. + DCHECK(connection_params.endpoint().is_valid()); base::ElapsedTimer timer; - broker_.reset(new Broker(connection_params.TakeChannelHandle())); - ScopedInternalPlatformHandle platform_handle = - broker_->GetInviterInternalPlatformHandle(); + broker_ = std::make_unique<Broker>( + connection_params.TakeEndpoint().TakePlatformHandle()); + PlatformChannelEndpoint endpoint = broker_->GetInviterEndpoint(); - if (!platform_handle.is_valid()) { + if (!endpoint.is_valid()) { // Most likely the inviter's side of the channel has already been closed and // the broker was unable to negotiate a NodeChannel pipe. In this case we // can cancel our connection to our inviter. @@ -218,7 +218,7 @@ CancelPendingPortMerges(); return; } - connection_params = ConnectionParams(std::move(platform_handle)); + connection_params = ConnectionParams(std::move(endpoint)); #endif io_task_runner_->PostTask( @@ -324,16 +324,13 @@ #if !defined(OS_MACOSX) && !defined(OS_NACL) && !defined(OS_FUCHSIA) PlatformChannel node_channel; - ScopedInternalPlatformHandle server_handle = - PlatformHandleToScopedInternalPlatformHandle( - node_channel.TakeLocalEndpoint().TakePlatformHandle()); + ConnectionParams node_connection_params(node_channel.TakeLocalEndpoint()); // BrokerHost owns itself. - BrokerHost* broker_host = new BrokerHost( - target_process.get(), connection_params.TakeChannelHandle(), - process_error_callback); - bool channel_ok = - broker_host->SendChannel(PlatformHandleToScopedInternalPlatformHandle( - node_channel.TakeRemoteEndpoint().TakePlatformHandle())); + BrokerHost* broker_host = + new BrokerHost(target_process.get(), std::move(connection_params), + process_error_callback); + bool channel_ok = broker_host->SendChannel( + node_channel.TakeRemoteEndpoint().TakePlatformHandle()); #if defined(OS_WIN) if (!channel_ok) { @@ -341,9 +338,8 @@ // session boundary. In that case we fall back to a named pipe. NamedPlatformChannel::Options options; NamedPlatformChannel named_channel(options); - server_handle = PlatformHandleToScopedInternalPlatformHandle( - named_channel.TakeServerEndpoint().TakePlatformHandle()); - server_handle.get().needs_connection = true; + node_connection_params = + ConnectionParams(named_channel.TakeServerEndpoint()); broker_host->SendNamedChannel(named_channel.GetServerName()); } #else @@ -351,7 +347,7 @@ #endif // defined(OS_WIN) scoped_refptr<NodeChannel> channel = - NodeChannel::Create(this, ConnectionParams(std::move(server_handle)), + NodeChannel::Create(this, std::move(node_connection_params), io_task_runner_, process_error_callback); #else // !defined(OS_MACOSX) && !defined(OS_NACL) @@ -807,7 +803,7 @@ if (!inviter) { // Yes, we're the broker. We can initialize the client directly. - channel->AcceptBrokerClient(name_, ScopedInternalPlatformHandle()); + channel->AcceptBrokerClient(name_, PlatformHandle()); } else { // We aren't the broker, so wait for a broker connection. base::AutoLock lock(broker_lock_); @@ -834,9 +830,7 @@ } PlatformChannel broker_channel; - ConnectionParams connection_params( - PlatformHandleToScopedInternalPlatformHandle( - broker_channel.TakeLocalEndpoint().TakePlatformHandle())); + ConnectionParams connection_params(broker_channel.TakeLocalEndpoint()); scoped_refptr<NodeChannel> client = NodeChannel::Create(this, std::move(connection_params), io_task_runner_, ProcessErrorCallback()); @@ -857,15 +851,12 @@ << " from peer " << from_node; sender->BrokerClientAdded( - client_name, - PlatformHandleToScopedInternalPlatformHandle( - broker_channel.TakeRemoteEndpoint().TakePlatformHandle())); + client_name, broker_channel.TakeRemoteEndpoint().TakePlatformHandle()); } -void NodeController::OnBrokerClientAdded( - const ports::NodeName& from_node, - const ports::NodeName& client_name, - ScopedInternalPlatformHandle broker_channel) { +void NodeController::OnBrokerClientAdded(const ports::NodeName& from_node, + const ports::NodeName& client_name, + PlatformHandle broker_channel) { scoped_refptr<NodeChannel> client = GetPeerChannel(client_name); if (!client) { DLOG(ERROR) << "BrokerClientAdded for unknown client " << client_name; @@ -883,10 +874,9 @@ client->AcceptBrokerClient(from_node, std::move(broker_channel)); } -void NodeController::OnAcceptBrokerClient( - const ports::NodeName& from_node, - const ports::NodeName& broker_name, - ScopedInternalPlatformHandle broker_channel) { +void NodeController::OnAcceptBrokerClient(const ports::NodeName& from_node, + const ports::NodeName& broker_name, + PlatformHandle broker_channel) { DCHECK(!GetConfiguration().is_broker_process); // This node should already have an inviter in bootstrap mode. @@ -920,9 +910,10 @@ broker = inviter; } else { DCHECK(broker_channel.is_valid()); - broker = - NodeChannel::Create(this, ConnectionParams(std::move(broker_channel)), - io_task_runner_, ProcessErrorCallback()); + broker = NodeChannel::Create( + this, + ConnectionParams(PlatformChannelEndpoint(std::move(broker_channel))), + io_task_runner_, ProcessErrorCallback()); AddPeer(broker_name, broker, true /* start_channel */); } @@ -1039,21 +1030,19 @@ scoped_refptr<NodeChannel> new_friend = GetPeerChannel(name); if (!new_friend) { // We don't know who they're talking about! - requestor->Introduce(name, ScopedInternalPlatformHandle()); + requestor->Introduce(name, PlatformHandle()); } else { PlatformChannel new_channel; - requestor->Introduce( - name, PlatformHandleToScopedInternalPlatformHandle( - new_channel.TakeLocalEndpoint().TakePlatformHandle())); + requestor->Introduce(name, + new_channel.TakeLocalEndpoint().TakePlatformHandle()); new_friend->Introduce( - from_node, PlatformHandleToScopedInternalPlatformHandle( - new_channel.TakeRemoteEndpoint().TakePlatformHandle())); + from_node, new_channel.TakeRemoteEndpoint().TakePlatformHandle()); } } void NodeController::OnIntroduce(const ports::NodeName& from_node, const ports::NodeName& name, - ScopedInternalPlatformHandle channel_handle) { + PlatformHandle channel_handle) { DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); if (!channel_handle.is_valid()) { @@ -1065,9 +1054,10 @@ return; } - scoped_refptr<NodeChannel> channel = - NodeChannel::Create(this, ConnectionParams(std::move(channel_handle)), - io_task_runner_, ProcessErrorCallback()); + scoped_refptr<NodeChannel> channel = NodeChannel::Create( + this, + ConnectionParams(PlatformChannelEndpoint(std::move(channel_handle))), + io_task_runner_, ProcessErrorCallback()); DVLOG(1) << "Adding new peer " << name << " via broker introduction."; AddPeer(name, channel, true /* start_channel */);
diff --git a/mojo/edk/system/node_controller.h b/mojo/edk/system/node_controller.h index c0ae2c9..406d84f1 100644 --- a/mojo/edk/system/node_controller.h +++ b/mojo/edk/system/node_controller.h
@@ -27,9 +27,9 @@ #include "mojo/edk/system/ports/name.h" #include "mojo/edk/system/ports/node.h" #include "mojo/edk/system/ports/node_delegate.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/scoped_process_handle.h" #include "mojo/edk/system/system_impl_export.h" +#include "mojo/public/cpp/platform/platform_handle.h" namespace base { class PortProvider; @@ -195,14 +195,12 @@ void OnAddBrokerClient(const ports::NodeName& from_node, const ports::NodeName& client_name, base::ProcessHandle process_handle) override; - void OnBrokerClientAdded( - const ports::NodeName& from_node, - const ports::NodeName& client_name, - ScopedInternalPlatformHandle broker_channel) override; - void OnAcceptBrokerClient( - const ports::NodeName& from_node, - const ports::NodeName& broker_name, - ScopedInternalPlatformHandle broker_channel) override; + void OnBrokerClientAdded(const ports::NodeName& from_node, + const ports::NodeName& client_name, + PlatformHandle broker_channel) override; + void OnAcceptBrokerClient(const ports::NodeName& from_node, + const ports::NodeName& broker_name, + PlatformHandle broker_channel) override; void OnEventMessage(const ports::NodeName& from_node, Channel::MessagePtr message) override; void OnRequestPortMerge(const ports::NodeName& from_node, @@ -212,7 +210,7 @@ const ports::NodeName& name) override; void OnIntroduce(const ports::NodeName& from_node, const ports::NodeName& name, - ScopedInternalPlatformHandle channel_handle) override; + PlatformHandle channel_handle) override; void OnBroadcast(const ports::NodeName& from_node, Channel::MessagePtr message) override; #if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS))
diff --git a/mojo/edk/system/platform_handle.cc b/mojo/edk/system/platform_handle.cc deleted file mode 100644 index 4333626..0000000 --- a/mojo/edk/system/platform_handle.cc +++ /dev/null
@@ -1,68 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/edk/system/platform_handle.h" - -#include "build/build_config.h" - -#if defined(OS_WIN) -#include <windows.h> -#elif defined(OS_FUCHSIA) -#include <unistd.h> -#include <zircon/status.h> -#include <zircon/syscalls.h> -#elif defined(OS_POSIX) -#include <unistd.h> -#endif - -#include "base/logging.h" - -#if defined(OS_WIN) -#include "base/optional.h" -#include "mojo/edk/system/scoped_process_handle.h" -#endif - -namespace mojo { -namespace edk { - -void InternalPlatformHandle::CloseIfNecessary() { - if (!is_valid()) - return; - -#if defined(OS_WIN) - bool success = !!CloseHandle(handle); - DPCHECK(success); - handle = INVALID_HANDLE_VALUE; -#elif defined(OS_FUCHSIA) - if (handle != ZX_HANDLE_INVALID) { - zx_status_t result = zx_handle_close(handle); - DCHECK_EQ(ZX_OK, result) << "CloseIfNecessary(zx_handle_close): " - << zx_status_get_string(result); - handle = ZX_HANDLE_INVALID; - } - if (fd >= 0) { - bool success = (close(fd) == 0); - DPCHECK(success); - fd = -1; - } -#elif defined(OS_POSIX) - if (type == Type::POSIX) { - bool success = (close(handle) == 0); - DPCHECK(success); - handle = -1; - } -#if defined(OS_MACOSX) && !defined(OS_IOS) - else if (type == Type::MACH) { - kern_return_t rv = mach_port_deallocate(mach_task_self(), port); - DPCHECK(rv == KERN_SUCCESS); - port = MACH_PORT_NULL; - } -#endif // defined(OS_MACOSX) && !defined(OS_IOS) -#else -#error "Platform not yet supported." -#endif // defined(OS_WIN) -} - -} // namespace edk -} // namespace mojo
diff --git a/mojo/edk/system/platform_handle.h b/mojo/edk/system/platform_handle.h deleted file mode 100644 index 841de97b..0000000 --- a/mojo/edk/system/platform_handle.h +++ /dev/null
@@ -1,114 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_EDK_SYSTEM_PLATFORM_HANDLE_H_ -#define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_H_ - -#include "build/build_config.h" -#include "mojo/edk/system/system_impl_export.h" - -#if defined(OS_WIN) -#include <windows.h> - -#include "base/process/process_handle.h" -#elif defined(OS_FUCHSIA) -#include <lib/fdio/limits.h> -#include <zircon/syscalls.h> -#elif defined(OS_MACOSX) && !defined(OS_IOS) -#include <mach/mach.h> -#endif - -#include "base/logging.h" - -namespace mojo { -namespace edk { - -#if defined(OS_WIN) -struct MOJO_SYSTEM_IMPL_EXPORT InternalPlatformHandle { - InternalPlatformHandle() : InternalPlatformHandle(INVALID_HANDLE_VALUE) {} - explicit InternalPlatformHandle(HANDLE handle) : handle(handle) {} - - void CloseIfNecessary(); - - bool is_valid() const { return handle != INVALID_HANDLE_VALUE; } - - HANDLE handle; - - // A Windows HANDLE may be an unconnected named pipe. In this case, we need to - // wait for a connection before communicating on the pipe. - bool needs_connection = false; -}; -#elif defined(OS_FUCHSIA) -// TODO(fuchsia): Find a clean way to share this with the POSIX version. -// |zx_handle_t| is a typedef of |int|, so we only allow InternalPlatformHandle -// to be created via explicit For<type>() creator functions. -struct MOJO_SYSTEM_IMPL_EXPORT InternalPlatformHandle { - public: - static InternalPlatformHandle ForHandle(zx_handle_t handle) { - InternalPlatformHandle platform_handle; - platform_handle.handle = handle; - return platform_handle; - } - static InternalPlatformHandle ForFd(int fd) { - InternalPlatformHandle platform_handle; - DCHECK_LT(fd, FDIO_MAX_FD); - platform_handle.fd = fd; - return platform_handle; - } - - void CloseIfNecessary(); - bool is_valid() const { return is_valid_fd() || is_valid_handle(); } - bool is_valid_handle() const { return handle != ZX_HANDLE_INVALID && fd < 0; } - zx_handle_t as_handle() const { return handle; } - bool is_valid_fd() const { return fd >= 0 && handle == ZX_HANDLE_INVALID; } - int as_fd() const { return fd; } - - private: - zx_handle_t handle = ZX_HANDLE_INVALID; - int fd = -1; -}; -#elif defined(OS_POSIX) -struct MOJO_SYSTEM_IMPL_EXPORT InternalPlatformHandle { - InternalPlatformHandle() {} - explicit InternalPlatformHandle(int handle) : handle(handle) {} -#if defined(OS_MACOSX) && !defined(OS_IOS) - explicit InternalPlatformHandle(mach_port_t port) - : type(Type::MACH), port(port) {} -#endif - - void CloseIfNecessary(); - - bool is_valid() const { -#if defined(OS_MACOSX) && !defined(OS_IOS) - if (type == Type::MACH) - return port != MACH_PORT_NULL; -#endif - return handle != -1; - } - - enum class Type { - POSIX, -#if defined(OS_MACOSX) && !defined(OS_IOS) - MACH, -#endif - }; - Type type = Type::POSIX; - - int handle = -1; - - // A POSIX handle may be a listen handle that can accept a connection. - bool needs_connection = false; - -#if defined(OS_MACOSX) && !defined(OS_IOS) - mach_port_t port = MACH_PORT_NULL; -#endif -}; -#else -#error "Platform not yet supported." -#endif - -} // namespace edk -} // namespace mojo - -#endif // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/system/platform_handle_dispatcher.cc b/mojo/edk/system/platform_handle_dispatcher.cc index 16b12a7..1048144 100644 --- a/mojo/edk/system/platform_handle_dispatcher.cc +++ b/mojo/edk/system/platform_handle_dispatcher.cc
@@ -5,7 +5,6 @@ #include "mojo/edk/system/platform_handle_dispatcher.h" #include "base/synchronization/lock.h" -#include "mojo/edk/system/platform_handle_utils.h" namespace mojo { namespace edk { @@ -41,15 +40,13 @@ *num_handles = 1; } -bool PlatformHandleDispatcher::EndSerialize( - void* destination, - ports::PortName* ports, - ScopedInternalPlatformHandle* handles) { +bool PlatformHandleDispatcher::EndSerialize(void* destination, + ports::PortName* ports, + PlatformHandle* handles) { base::AutoLock lock(lock_); if (is_closed_) return false; - handles[0] = - PlatformHandleToScopedInternalPlatformHandle(std::move(platform_handle_)); + handles[0] = std::move(platform_handle_); return true; } @@ -78,13 +75,12 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles) { if (num_bytes || num_ports || num_handles != 1) return nullptr; - return PlatformHandleDispatcher::Create( - ScopedInternalPlatformHandleToPlatformHandle(std::move(handles[0]))); + return PlatformHandleDispatcher::Create(std::move(handles[0])); } PlatformHandleDispatcher::PlatformHandleDispatcher(
diff --git a/mojo/edk/system/platform_handle_dispatcher.h b/mojo/edk/system/platform_handle_dispatcher.h index d5b3b32..c6180b0 100644 --- a/mojo/edk/system/platform_handle_dispatcher.h +++ b/mojo/edk/system/platform_handle_dispatcher.h
@@ -30,7 +30,7 @@ uint32_t* num_handles) override; bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) override; + PlatformHandle* handles) override; bool BeginTransit() override; void CompleteTransitAndClose() override; void CancelTransit() override; @@ -40,7 +40,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* handles, + PlatformHandle* handles, size_t num_handles); private:
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc index 1625f5d..3e3c777 100644 --- a/mojo/edk/system/platform_handle_dispatcher_unittest.cc +++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -12,8 +12,6 @@ #include "base/files/scoped_file.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" -#include "mojo/edk/system/platform_handle_utils.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/test/test_utils.h" #include "mojo/public/cpp/system/platform_handle.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,7 +87,7 @@ EXPECT_EQ(0u, num_ports); EXPECT_EQ(1u, num_handles); - ScopedInternalPlatformHandle received_handle; + PlatformHandle received_handle; EXPECT_TRUE(dispatcher->EndSerialize(nullptr, nullptr, &received_handle)); dispatcher->CompleteTransitAndClose();
diff --git a/mojo/edk/system/platform_handle_utils.cc b/mojo/edk/system/platform_handle_utils.cc index 0602eab..8c09818 100644 --- a/mojo/edk/system/platform_handle_utils.cc +++ b/mojo/edk/system/platform_handle_utils.cc
@@ -21,63 +21,6 @@ namespace mojo { namespace edk { -PlatformHandle ScopedInternalPlatformHandleToPlatformHandle( - ScopedInternalPlatformHandle handle) { -#if defined(OS_FUCHSIA) - if (handle.get().is_valid_fd()) - return PlatformHandle(base::ScopedFD(handle.release().as_fd())); - else - return PlatformHandle(base::ScopedZxHandle(handle.release().as_handle())); -#elif defined(OS_POSIX) - if (handle.get().type == InternalPlatformHandle::Type::POSIX) { - return PlatformHandle(base::ScopedFD(handle.release().handle)); - } -#elif defined(OS_WIN) - return PlatformHandle(base::win::ScopedHandle(handle.release().handle)); -#endif - -#if defined(OS_MACOSX) && !defined(OS_IOS) - if (handle.get().type == InternalPlatformHandle::Type::MACH) { - return PlatformHandle( - base::mac::ScopedMachSendRight(handle.release().port)); - } -#endif - - return PlatformHandle(); -} - -ScopedInternalPlatformHandle PlatformHandleToScopedInternalPlatformHandle( - PlatformHandle handle) { -#if defined(OS_FUCHSIA) - if (handle.is_fd()) { - return ScopedInternalPlatformHandle( - InternalPlatformHandle::ForFd(handle.ReleaseFD())); - } else if (handle.is_handle()) { - return ScopedInternalPlatformHandle( - InternalPlatformHandle::ForHandle(handle.ReleaseHandle())); - } -#elif defined(OS_POSIX) - if (handle.is_fd()) { - return ScopedInternalPlatformHandle( - InternalPlatformHandle(handle.ReleaseFD())); - } -#elif defined(OS_WIN) - if (handle.is_handle()) { - return ScopedInternalPlatformHandle( - InternalPlatformHandle(handle.ReleaseHandle())); - } -#endif - -#if defined(OS_MACOSX) && !defined(OS_IOS) - if (handle.is_mach_port()) { - return ScopedInternalPlatformHandle( - InternalPlatformHandle(handle.ReleaseMachPort())); - } -#endif - - return ScopedInternalPlatformHandle(); -} - void ExtractPlatformHandlesFromSharedMemoryRegionHandle( base::subtle::PlatformSharedMemoryRegion::ScopedPlatformHandle handle, PlatformHandle* extracted_handle,
diff --git a/mojo/edk/system/platform_handle_utils.h b/mojo/edk/system/platform_handle_utils.h index 2a145a6..f04f223 100644 --- a/mojo/edk/system/platform_handle_utils.h +++ b/mojo/edk/system/platform_handle_utils.h
@@ -6,7 +6,6 @@ #define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_UTILS_H_ #include "base/memory/platform_shared_memory_region.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/public/c/system/platform_handle.h" #include "mojo/public/c/system/types.h" @@ -15,13 +14,6 @@ namespace mojo { namespace edk { -// Conversion between an internal handle type and the public PlatformHandle. -MOJO_SYSTEM_IMPL_EXPORT PlatformHandle -ScopedInternalPlatformHandleToPlatformHandle( - ScopedInternalPlatformHandle handle); -MOJO_SYSTEM_IMPL_EXPORT ScopedInternalPlatformHandle -PlatformHandleToScopedInternalPlatformHandle(PlatformHandle handle); - // Converts a base shared memory platform handle into one (maybe two on POSIX) // PlatformHandle(s). MOJO_SYSTEM_IMPL_EXPORT void ExtractPlatformHandlesFromSharedMemoryRegionHandle(
diff --git a/mojo/edk/system/platform_wrapper_unittest.cc b/mojo/edk/system/platform_wrapper_unittest.cc index f7770ba..c87ff5a 100644 --- a/mojo/edk/system/platform_wrapper_unittest.cc +++ b/mojo/edk/system/platform_wrapper_unittest.cc
@@ -38,7 +38,7 @@ #define SHARED_BUFFER_PLATFORM_HANDLE_TYPE SIMPLE_PLATFORM_HANDLE_TYPE #endif -uint64_t InternalPlatformHandleValueFromPlatformFile(base::PlatformFile file) { +uint64_t PlatformHandleValueFromPlatformFile(base::PlatformFile file) { #if defined(OS_WIN) return reinterpret_cast<uint64_t>(file); #elif defined(OS_POSIX) || defined(OS_FUCHSIA) @@ -46,7 +46,7 @@ #endif } -base::PlatformFile PlatformFileFromInternalPlatformHandleValue(uint64_t value) { +base::PlatformFile PlatformFileFromPlatformHandleValue(uint64_t value) { #if defined(OS_WIN) return reinterpret_cast<base::PlatformFile>(value); #elif defined(OS_POSIX) || defined(OS_FUCHSIA) @@ -60,7 +60,7 @@ using PlatformWrapperTest = test::MojoTestBase; -TEST_F(PlatformWrapperTest, WrapInternalPlatformHandle) { +TEST_F(PlatformWrapperTest, WrapPlatformHandle) { // Create a temporary file and write a message to it. base::FilePath temp_file_path; ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path)); @@ -81,7 +81,7 @@ os_file.struct_size = sizeof(MojoPlatformHandle); os_file.type = SIMPLE_PLATFORM_HANDLE_TYPE; os_file.value = - InternalPlatformHandleValueFromPlatformFile(file.TakePlatformFile()); + PlatformHandleValueFromPlatformFile(file.TakePlatformFile()); EXPECT_EQ(MOJO_RESULT_OK, MojoWrapPlatformHandle(&os_file, nullptr, &wrapped_handle)); @@ -101,8 +101,7 @@ ASSERT_EQ(MOJO_RESULT_OK, MojoUnwrapPlatformHandle(wrapped_handle, nullptr, &platform_handle)); EXPECT_EQ(SIMPLE_PLATFORM_HANDLE_TYPE, platform_handle.type); - base::File file( - PlatformFileFromInternalPlatformHandleValue(platform_handle.value)); + base::File file(PlatformFileFromPlatformHandleValue(platform_handle.value)); // Expect to read the same message from the file. std::vector<char> data(message.size());
diff --git a/mojo/edk/system/scoped_platform_handle.h b/mojo/edk/system/scoped_platform_handle.h deleted file mode 100644 index 5385e41..0000000 --- a/mojo/edk/system/scoped_platform_handle.h +++ /dev/null
@@ -1,65 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_EDK_SYSTEM_SCOPED_PLATFORM_HANDLE_H_ -#define MOJO_EDK_SYSTEM_SCOPED_PLATFORM_HANDLE_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "mojo/edk/system/platform_handle.h" -#include "mojo/edk/system/system_impl_export.h" -#include "mojo/public/c/system/macros.h" - -namespace mojo { -namespace edk { - -class MOJO_SYSTEM_IMPL_EXPORT ScopedInternalPlatformHandle { - public: - ScopedInternalPlatformHandle() {} - explicit ScopedInternalPlatformHandle(InternalPlatformHandle handle) - : handle_(handle) {} - ~ScopedInternalPlatformHandle() { handle_.CloseIfNecessary(); } - - // Move-only constructor and operator=. - ScopedInternalPlatformHandle(ScopedInternalPlatformHandle&& other) - : handle_(other.release()) {} - - ScopedInternalPlatformHandle& operator=( - ScopedInternalPlatformHandle&& other) { - reset(other.release()); - return *this; - } - - const InternalPlatformHandle& get() const { return handle_; } - InternalPlatformHandle& get() { return handle_; } - - void swap(ScopedInternalPlatformHandle& other) { - InternalPlatformHandle temp = handle_; - handle_ = other.handle_; - other.handle_ = temp; - } - - InternalPlatformHandle release() WARN_UNUSED_RESULT { - InternalPlatformHandle rv = handle_; - handle_ = InternalPlatformHandle(); - return rv; - } - - void reset(InternalPlatformHandle handle = InternalPlatformHandle()) { - handle_.CloseIfNecessary(); - handle_ = handle; - } - - bool is_valid() const { return handle_.is_valid(); } - - private: - InternalPlatformHandle handle_; - - DISALLOW_COPY_AND_ASSIGN(ScopedInternalPlatformHandle); -}; - -} // namespace edk -} // namespace mojo - -#endif // MOJO_EDK_SYSTEM_SCOPED_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc index 15bff51..7028873 100644 --- a/mojo/edk/system/shared_buffer_dispatcher.cc +++ b/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -122,7 +122,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* platform_handles, + PlatformHandle* platform_handles, size_t num_platform_handles) { if (num_bytes != sizeof(SerializedState)) { LOG(ERROR) << "Invalid serialized shared buffer dispatcher (bad size)"; @@ -147,8 +147,7 @@ MOJO_PLATFORM_SHARED_MEMORY_REGION_ACCESS_MODE_WRITABLE) { if (num_platform_handles != 2) return nullptr; - handles[1] = ScopedInternalPlatformHandleToPlatformHandle( - std::move(platform_handles[1])); + handles[1] = std::move(platform_handles[1]); } else { if (num_platform_handles != 1) return nullptr; @@ -157,8 +156,7 @@ if (num_platform_handles != 1) return nullptr; #endif - handles[0] = ScopedInternalPlatformHandleToPlatformHandle( - std::move(platform_handles[0])); + handles[0] = std::move(platform_handles[0]); base::UnguessableToken guid = base::UnguessableToken::Deserialize( serialized_state->guid_high, serialized_state->guid_low); @@ -323,10 +321,9 @@ #endif } -bool SharedBufferDispatcher::EndSerialize( - void* destination, - ports::PortName* ports, - ScopedInternalPlatformHandle* handles) { +bool SharedBufferDispatcher::EndSerialize(void* destination, + ports::PortName* ports, + PlatformHandle* handles) { SerializedState* serialized_state = static_cast<SerializedState*>(destination); base::AutoLock lock(lock_); @@ -363,10 +360,8 @@ ExtractPlatformHandlesFromSharedMemoryRegionHandle( region.PassPlatformHandle(), &platform_handles[0], &platform_handles[1]); - handles[0] = PlatformHandleToScopedInternalPlatformHandle( - std::move(platform_handles[0])); - handles[1] = PlatformHandleToScopedInternalPlatformHandle( - std::move(platform_handles[1])); + handles[0] = std::move(platform_handles[0]); + handles[1] = std::move(platform_handles[1]); return true; } #endif @@ -375,8 +370,7 @@ PlatformHandle ignored_handle; ExtractPlatformHandlesFromSharedMemoryRegionHandle( region.PassPlatformHandle(), &platform_handle, &ignored_handle); - handles[0] = - PlatformHandleToScopedInternalPlatformHandle(std::move(platform_handle)); + handles[0] = std::move(platform_handle); return true; }
diff --git a/mojo/edk/system/shared_buffer_dispatcher.h b/mojo/edk/system/shared_buffer_dispatcher.h index 5875fe2..8b38c84 100644 --- a/mojo/edk/system/shared_buffer_dispatcher.h +++ b/mojo/edk/system/shared_buffer_dispatcher.h
@@ -13,7 +13,6 @@ #include "base/macros.h" #include "base/memory/platform_shared_memory_region.h" #include "mojo/edk/system/dispatcher.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" namespace mojo { @@ -60,7 +59,7 @@ size_t num_bytes, const ports::PortName* ports, size_t num_ports, - ScopedInternalPlatformHandle* platform_handles, + PlatformHandle* platform_handles, size_t num_handles); // Passes the underlying PlatformSharedMemoryRegion. This dispatcher must be @@ -88,7 +87,7 @@ uint32_t* num_platform_handles) override; bool EndSerialize(void* destination, ports::PortName* ports, - ScopedInternalPlatformHandle* handles) override; + PlatformHandle* handles) override; bool BeginTransit() override; void CompleteTransitAndClose() override; void CancelTransit() override;
diff --git a/mojo/edk/system/user_message_impl.cc b/mojo/edk/system/user_message_impl.cc index 78533c7..78d93fc2 100644 --- a/mojo/edk/system/user_message_impl.cc +++ b/mojo/edk/system/user_message_impl.cc
@@ -20,7 +20,6 @@ #include "mojo/edk/system/core.h" #include "mojo/edk/system/node_channel.h" #include "mojo/edk/system/node_controller.h" -#include "mojo/edk/system/platform_handle_utils.h" #include "mojo/edk/system/ports/event.h" #include "mojo/edk/system/ports/message_filter.h" #include "mojo/edk/system/ports/node.h" @@ -153,7 +152,7 @@ DispatcherHeader* new_dispatcher_headers; char* new_dispatcher_data; size_t total_num_dispatchers = num_new_dispatchers; - std::vector<ScopedInternalPlatformHandle> handles; + std::vector<PlatformHandle> handles; if (original_message) { DCHECK(original_header); size_t original_dispatcher_headers_size = @@ -177,9 +176,12 @@ memcpy(dispatcher_data, original_dispatcher_data, original_dispatcher_data_size); new_dispatcher_data = dispatcher_data + original_dispatcher_data_size; - auto handles = original_message->TakeInternalHandles(); - if (!handles.empty()) + auto handles_in_transit = original_message->TakeHandles(); + if (!handles_in_transit.empty()) { handles.resize(num_handles); + for (size_t i = 0; i < handles_in_transit.size(); ++i) + handles[i] = handles_in_transit[i].TakeHandle(); + } memcpy(reinterpret_cast<char*>(header) + header_size, reinterpret_cast<char*>(original_header) + original_header_size, original_payload_size); @@ -191,9 +193,8 @@ reinterpret_cast<char*>(new_dispatcher_headers + num_new_dispatchers); } - if (handles.empty() && num_new_handles) { + if (handles.empty() && num_new_handles) handles.resize(num_new_handles); - } header->num_dispatchers = base::CheckedNumeric<uint32_t>(total_num_dispatchers).ValueOrDie(); @@ -241,7 +242,7 @@ // retain ownership when message creation fails, so these are not actually // leaking. for (auto& handle : handles) - ignore_result(handle.release()); + handle.release(); // Leave the original message in place on failure if applicable. if (original_message) @@ -583,8 +584,13 @@ dispatcher_headers + header->num_dispatchers); size_t port_index = 0; size_t platform_handle_index = 0; - std::vector<ScopedInternalPlatformHandle> msg_handles = - channel_message_->TakeInternalHandles(); + std::vector<PlatformHandleInTransit> handles_in_transit = + channel_message_->TakeHandles(); + std::vector<PlatformHandle> msg_handles(handles_in_transit.size()); + for (size_t i = 0; i < handles_in_transit.size(); ++i) { + DCHECK(!handles_in_transit[i].owning_process().is_valid()); + msg_handles[i] = handles_in_transit[i].TakeHandle(); + } for (size_t i = 0; i < header->num_dispatchers; ++i) { const DispatcherHeader& dh = dispatcher_headers[i]; auto type = static_cast<Dispatcher::Type>(dh.type); @@ -611,7 +617,7 @@ return MOJO_RESULT_ABORTED; } - ScopedInternalPlatformHandle* out_handles = + PlatformHandle* out_handles = !msg_handles.empty() ? msg_handles.data() + platform_handle_index : nullptr; dispatchers[i].dispatcher = Dispatcher::Deserialize(
diff --git a/mojo/edk/system/user_message_impl.h b/mojo/edk/system/user_message_impl.h index 8634ba4..6a91e64f 100644 --- a/mojo/edk/system/user_message_impl.h +++ b/mojo/edk/system/user_message_impl.h
@@ -17,7 +17,6 @@ #include "mojo/edk/system/ports/name.h" #include "mojo/edk/system/ports/port_ref.h" #include "mojo/edk/system/ports/user_message.h" -#include "mojo/edk/system/scoped_platform_handle.h" #include "mojo/edk/system/system_impl_export.h" #include "mojo/public/c/system/message_pipe.h" #include "mojo/public/c/system/types.h"
diff --git a/mojo/edk/test/test_utils.h b/mojo/edk/test/test_utils.h index 53c2c3b..6576d5c 100644 --- a/mojo/edk/test/test_utils.h +++ b/mojo/edk/test/test_utils.h
@@ -20,7 +20,7 @@ // Gets a (scoped) |PlatformHandle| from the given (scoped) |FILE|. PlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp); -// Gets a (scoped) |FILE| from a (scoped) |InternalPlatformHandle|. +// Gets a (scoped) |FILE| from a (scoped) |PlatformHandle|. base::ScopedFILE FILEFromPlatformHandle(PlatformHandle h, const char* mode); } // namespace test
diff --git a/net/cert/caching_cert_verifier.cc b/net/cert/caching_cert_verifier.cc index db3c6de..82f83ca4 100644 --- a/net/cert/caching_cert_verifier.cc +++ b/net/cert/caching_cert_verifier.cc
@@ -177,23 +177,6 @@ start_time + base::TimeDelta::FromSeconds(kTTLSecs))); } -void CachingCertVerifier::VisitEntries(CacheVisitor* visitor) const { - DCHECK(visitor); - - CacheValidityPeriod now(base::Time::Now()); - CacheExpirationFunctor expiration_cmp; - - for (CertVerificationCache::Iterator it(cache_); it.HasNext(); it.Advance()) { - if (!expiration_cmp(now, it.expiration())) - continue; - if (!visitor->VisitEntry(it.key(), it.value().error, it.value().result, - it.expiration().verification_time, - it.expiration().expiration_time)) { - break; - } - } -} - void CachingCertVerifier::OnCertDBChanged() { ClearCache(); }
diff --git a/net/cert/caching_cert_verifier.h b/net/cert/caching_cert_verifier.h index bae0396..b634af6 100644 --- a/net/cert/caching_cert_verifier.h +++ b/net/cert/caching_cert_verifier.h
@@ -34,21 +34,6 @@ class NET_EXPORT CachingCertVerifier : public CertVerifier, public CertDatabase::Observer { public: - // Visitor class to allow read-only inspection of the verification cache. - class NET_EXPORT CacheVisitor { - public: - virtual ~CacheVisitor() {} - - // Called once for each entry in the cache, providing details about the - // cached entry. - // Returns true to continue iteration, or false to abort. - virtual bool VisitEntry(const RequestParams& params, - int error, - const CertVerifyResult& verify_result, - base::Time verification_time, - base::Time expiration_time) = 0; - }; - // Creates a CachingCertVerifier that will use |verifier| to perform the // actual verifications if they're not already cached or if the cached // item has expired. @@ -76,13 +61,6 @@ const CertVerifyResult& verify_result, base::Time verification_time); - // Iterates through all of the non-expired entries in the cache, calling - // VisitEntry on |visitor| for each, until either all entries are - // iterated through or the |visitor| aborts. - // Note: During this call, it is not safe to call any non-const methods - // on the CachingCertVerifier. - void VisitEntries(CacheVisitor* visitor) const; - private: FRIEND_TEST_ALL_PREFIXES(CachingCertVerifierTest, CacheHit); FRIEND_TEST_ALL_PREFIXES(CachingCertVerifierTest, Visitor);
diff --git a/net/cert/caching_cert_verifier_unittest.cc b/net/cert/caching_cert_verifier_unittest.cc index 11e0917..a178b14 100644 --- a/net/cert/caching_cert_verifier_unittest.cc +++ b/net/cert/caching_cert_verifier_unittest.cc
@@ -30,23 +30,6 @@ namespace net { -namespace { - -class MockCacheVisitor : public CachingCertVerifier::CacheVisitor { - public: - MockCacheVisitor() = default; - ~MockCacheVisitor() override = default; - - MOCK_METHOD5(VisitEntry, - bool(const CachingCertVerifier::RequestParams& params, - int error, - const CertVerifyResult& result, - base::Time verification_time, - base::Time expiration_time)); -}; - -} // namespace - class CachingCertVerifierTest : public ::testing::Test { public: CachingCertVerifierTest() : verifier_(std::make_unique<MockCertVerifier>()) {} @@ -91,72 +74,6 @@ ASSERT_EQ(1u, verifier_.GetCacheSize()); } -TEST_F(CachingCertVerifierTest, Visitor) { - base::FilePath certs_dir = GetTestCertsDirectory(); - scoped_refptr<X509Certificate> test_cert( - ImportCertFromFile(certs_dir, "ok_cert.pem")); - ASSERT_TRUE(test_cert.get()); - - TestCompletionCallback callback; - std::unique_ptr<CertVerifier::Request> request; - - // Add some entries to the cache - CertVerifier::RequestParams params1(test_cert, "www.example.com", 0, - std::string(), CertificateList()); - CertVerifyResult result1; - int error1 = callback.GetResult( - verifier_.Verify(params1, nullptr, &result1, callback.callback(), - &request, NetLogWithSource())); - ASSERT_TRUE(IsCertificateError(error1)); - ASSERT_EQ(1u, verifier_.requests()); - ASSERT_EQ(0u, verifier_.cache_hits()); - ASSERT_EQ(1u, verifier_.GetCacheSize()); - - CertVerifier::RequestParams params2(test_cert, "www.example.net", 0, - std::string(), CertificateList()); - CertVerifyResult result2; - int error2 = callback.GetResult( - verifier_.Verify(params2, nullptr, &result2, callback.callback(), - &request, NetLogWithSource())); - ASSERT_TRUE(IsCertificateError(error2)); - ASSERT_EQ(2u, verifier_.requests()); - ASSERT_EQ(0u, verifier_.cache_hits()); - ASSERT_EQ(2u, verifier_.GetCacheSize()); - - CertVerifier::RequestParams params3(test_cert, "www.example.org", 0, - std::string(), CertificateList()); - CertVerifyResult result3; - int error3 = callback.GetResult( - verifier_.Verify(params3, nullptr, &result3, callback.callback(), - &request, NetLogWithSource())); - ASSERT_TRUE(IsCertificateError(error3)); - ASSERT_EQ(3u, verifier_.requests()); - ASSERT_EQ(0u, verifier_.cache_hits()); - ASSERT_EQ(3u, verifier_.GetCacheSize()); - - // Iterate through all entries. - { - MockCacheVisitor mock_visitor; - EXPECT_CALL(mock_visitor, VisitEntry(params1, error1, _, _, _)) - .WillOnce(Return(true)); - EXPECT_CALL(mock_visitor, VisitEntry(params2, error2, _, _, _)) - .WillOnce(Return(true)); - EXPECT_CALL(mock_visitor, VisitEntry(params3, error3, _, _, _)) - .WillOnce(Return(true)); - verifier_.VisitEntries(&mock_visitor); - } - - // Now perform partial iteration - { - MockCacheVisitor mock_visitor; - ::testing::InSequence sequence; - EXPECT_CALL(mock_visitor, VisitEntry(_, _, _, _, _)).WillOnce(Return(true)); - EXPECT_CALL(mock_visitor, VisitEntry(_, _, _, _, _)) - .WillOnce(Return(false)); - verifier_.VisitEntries(&mock_visitor); - } -} - TEST_F(CachingCertVerifierTest, AddsEntries) { base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> test_cert(
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc index 80aab10..834d2f3c 100644 --- a/net/cert/cert_verify_proc_unittest.cc +++ b/net/cert/cert_verify_proc_unittest.cc
@@ -11,33 +11,56 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/macros.h" +#include "base/rand_util.h" #include "base/sha1.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" +#include "base/threading/thread.h" #include "build/build_config.h" +#include "crypto/openssl_util.h" +#include "crypto/rsa_private_key.h" #include "crypto/sha2.h" #include "net/base/net_errors.h" #include "net/cert/asn1_util.h" +#include "net/cert/cert_net_fetcher.h" #include "net/cert/cert_status_flags.h" #include "net/cert/cert_verifier.h" #include "net/cert/cert_verify_proc_builtin.h" #include "net/cert/cert_verify_result.h" #include "net/cert/crl_set.h" #include "net/cert/ev_root_ca_metadata.h" +#include "net/cert/internal/parse_certificate.h" #include "net/cert/internal/signature_algorithm.h" +#include "net/cert/pem_tokenizer.h" #include "net/cert/test_root_certs.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_util.h" +#include "net/cert_net/cert_net_fetcher_impl.h" #include "net/der/input.h" #include "net/der/parser.h" +#include "net/proxy_resolution/proxy_config.h" +#include "net/proxy_resolution/proxy_config_service_fixed.h" #include "net/test/cert_test_util.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_request.h" +#include "net/test/embedded_test_server/http_response.h" #include "net/test/gtest_util.h" #include "net/test/test_certificate_data.h" #include "net/test/test_data_directory.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_builder.h" +#include "net/url_request/url_request_context_getter.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/mem.h" + +#if defined(USE_NSS_CERTS) +#include "net/cert_net/nss_ocsp.h" +#endif #if defined(OS_ANDROID) #include "base/android/build_info.h" @@ -2121,6 +2144,686 @@ } } +std::string MakeRandomHexString(size_t num_bytes) { + std::vector<char> rand_bytes; + rand_bytes.resize(num_bytes); + + base::RandBytes(&rand_bytes[0], rand_bytes.size()); + return base::HexEncode(&rand_bytes[0], rand_bytes.size()); +} + +// This is the same as CertVerifyProcInternalTest, but it additionally sets up +// networking capabilities for the cert verifiers, and a test server that can be +// used to serve mock responses for AIA/OCSP/CRL. +// +// An actual HTTP test server is used rather than simply mocking the network +// layer, since the certificate fetching networking layer is not mockable for +// all of the cert verifier implementations. +// +// The approach taken in this test fixture is to generate certificates +// on the fly so they use randomly chosen URLs, subjects, and serial +// numbers, in order to defeat global caching effects from the platform +// verifiers. Moreover, the AIA needs to be chosen dynamically since the +// test server's port number cannot be known statically. +class CertVerifyProcInternalWithNetFetchingTest + : public CertVerifyProcInternalTest { + protected: + CertVerifyProcInternalWithNetFetchingTest() + : scoped_task_environment_( + base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT) {} + + void SetUp() override { + CertVerifyProcInternalTest::SetUp(); + + // Create a network thread to be used for network fetches, and wait for + // initialization to complete on that thread. + base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); + network_thread_ = std::make_unique<base::Thread>("network_thread"); + CHECK(network_thread_->StartWithOptions(options)); + + base::WaitableEvent initialization_complete_event( + base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); + network_thread_->task_runner()->PostTask( + FROM_HERE, base::BindOnce(&SetUpOnNetworkThread, &context_, + &initialization_complete_event)); + initialization_complete_event.Wait(); + + EXPECT_FALSE(test_server_.Started()); + + // Register a single request handler with the EmbeddedTestServer, that in + // turn dispatches to the internally managed registry of request handlers. + // + // This allows registering subsequent handlers dynamically during the course + // of the test, since EmbeddedTestServer requires its handlers be registered + // prior to Start(). + test_server_.RegisterRequestHandler(base::BindRepeating( + &CertVerifyProcInternalWithNetFetchingTest::DispatchToRequestHandler, + base::Unretained(this))); + EXPECT_TRUE(test_server_.Start()); + } + + void TearDown() override { + // Do cleanup on network thread. + network_thread_->task_runner()->PostTask( + FROM_HERE, base::BindOnce(&ShutdownOnNetworkThread, &context_)); + network_thread_->Stop(); + network_thread_.reset(); + + CertVerifyProcInternalTest::TearDown(); + } + + // Registers a handler with the test server that responds with the given + // Content-Type and response body for GET requests to |relative_path|. + void RegisterSimpleTestServerHandler(std::string relative_path, + std::string content_type, + std::string content) { + base::AutoLock lock(request_handlers_lock_); + request_handlers_.push_back( + base::BindRepeating(&SimpleTestServerHandler, std::move(relative_path), + std::move(content_type), std::move(content))); + } + + // Returns a random URL path (starting with /) that has the given suffix. + static std::string MakeRandomPath(base::StringPiece suffix) { + return "/" + MakeRandomHexString(12) + suffix.as_string(); + } + + // Returns a URL to |relative_path| for the current test server. + GURL GetTestServerAbsoluteUrl(const std::string& relative_path) { + return test_server_.GetURL(relative_path); + } + + private: + std::unique_ptr<test_server::HttpResponse> DispatchToRequestHandler( + const test_server::HttpRequest& request) { + // Called on the embedded test server's IO thread. + base::AutoLock lock(request_handlers_lock_); + for (const auto& handler : request_handlers_) { + auto response = handler.Run(request); + if (response) + return response; + } + + return nullptr; + } + + // Serves (|content_type|, |content|) in response to GET requests for + // |relative_url|. + static std::unique_ptr<test_server::HttpResponse> SimpleTestServerHandler( + const std::string& relative_url, + const std::string& content_type, + const std::string& content, + const test_server::HttpRequest& request) { + if (request.relative_url != relative_url) + return nullptr; + + auto http_response = std::make_unique<test_server::BasicHttpResponse>(); + + http_response->set_code(net::HTTP_OK); + http_response->set_content_type(content_type); + http_response->set_content(content); + return http_response; + } + + static void SetUpOnNetworkThread( + std::unique_ptr<URLRequestContext>* context, + base::WaitableEvent* initialization_complete_event) { + URLRequestContextBuilder url_request_context_builder; + url_request_context_builder.set_user_agent("cert_verify_proc_unittest/0.1"); + url_request_context_builder.set_proxy_config_service( + std::make_unique<ProxyConfigServiceFixed>(ProxyConfigWithAnnotation())); + *context = url_request_context_builder.Build(); + +#if defined(USE_NSS_CERTS) + SetURLRequestContextForNSSHttpIO(context->get()); +#endif + SetGlobalCertNetFetcherForTesting(CreateCertNetFetcher(context->get())); + initialization_complete_event->Signal(); + } + + static void ShutdownOnNetworkThread( + std::unique_ptr<URLRequestContext>* context) { +#if defined(USE_NSS_CERTS) + SetURLRequestContextForNSSHttpIO(nullptr); +#endif + ShutdownGlobalCertNetFetcher(); + context->reset(); + } + + base::test::ScopedTaskEnvironment scoped_task_environment_; + + std::unique_ptr<base::Thread> network_thread_; + + // Owned by this thread, but initialized, used, and shutdown on the network + // thread. + std::unique_ptr<URLRequestContext> context_; + + EmbeddedTestServer test_server_; + + // The list of registered handlers. Can only be accessed when the lock is + // held, as this data is shared between the embedded server's IO thread, and + // the test main thread. + base::Lock request_handlers_lock_; + std::vector<test_server::EmbeddedTestServer::HandleRequestCallback> + request_handlers_; +}; + +// CertBuilder is a helper class to dynamically create a test certificate. +// +// CertBuilder is initialized using an existing certificate, from which it +// copies most properties (see InitFromCert for details). +// +// The subject, serial number, and key for the final certificate are chosen +// randomly. Using a randomized subject and serial number is important to defeat +// certificate caching done by NSS, which otherwise can make test outcomes +// dependent on ordering. +class CertBuilder { + public: + // Initializes the CertBuilder using |orig_cert|. If |issuer| is null + // then the generated certificate will be self-signed. Otherwise, it + // will be signed using |issuer|. + CertBuilder(CRYPTO_BUFFER* orig_cert, CertBuilder* issuer) : issuer_(issuer) { + if (!issuer_) + issuer_ = this; + + crypto::EnsureOpenSSLInit(); + InitFromCert(der::Input(x509_util::CryptoBufferAsStringPiece(orig_cert))); + } + + // Sets a value for the indicated X.509 (v3) extension. + void SetExtension(const der::Input& oid, + std::string value, + bool critical = false) { + auto& extension_value = extensions_[oid.AsString()]; + extension_value.critical = critical; + extension_value.value = std::move(value); + + Invalidate(); + } + + // Sets an AIA extension with a single caIssuers access method. + void SetCaIssuersUrl(const GURL& url) { + std::string url_spec = url.spec(); + + // From RFC 5280: + // + // AuthorityInfoAccessSyntax ::= + // SEQUENCE SIZE (1..MAX) OF AccessDescription + // + // AccessDescription ::= SEQUENCE { + // accessMethod OBJECT IDENTIFIER, + // accessLocation GeneralName } + bssl::ScopedCBB cbb; + CBB aia, ca_issuer, access_method, access_location; + ASSERT_TRUE(CBB_init(cbb.get(), url_spec.size())); + ASSERT_TRUE(CBB_add_asn1(cbb.get(), &aia, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&aia, &ca_issuer, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&ca_issuer, &access_method, CBS_ASN1_OBJECT)); + ASSERT_TRUE( + AddBytesToCBB(&access_method, AdCaIssuersOid().AsStringPiece())); + ASSERT_TRUE(CBB_add_asn1(&ca_issuer, &access_location, + CBS_ASN1_CONTEXT_SPECIFIC | 6)); + ASSERT_TRUE(AddBytesToCBB(&access_location, url_spec)); + + SetExtension(AuthorityInfoAccessOid(), FinishCBB(cbb.get())); + } + + // Sets the SAN for the certificate to a single dNSName. + void SetSubjectAltName(const std::string& dns_name) { + // From RFC 5280: + // + // SubjectAltName ::= GeneralNames + // + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + // + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // ... } + bssl::ScopedCBB cbb; + CBB general_names, general_name; + ASSERT_TRUE(CBB_init(cbb.get(), dns_name.size())); + ASSERT_TRUE(CBB_add_asn1(cbb.get(), &general_names, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&general_names, &general_name, + CBS_ASN1_CONTEXT_SPECIFIC | 2)); + ASSERT_TRUE(AddBytesToCBB(&general_name, dns_name)); + + SetExtension(SubjectAltNameOid(), FinishCBB(cbb.get())); + } + + void SetRandomSerialNumber() { + serial_number_ = base::RandUint64(); + Invalidate(); + } + + // Returns a CRYPTO_BUFFER to the generated certificate. + CRYPTO_BUFFER* GetCertBuffer() { + if (!cert_) + GenerateCertificate(); + return cert_.get(); + } + + bssl::UniquePtr<CRYPTO_BUFFER> DupCertBuffer() { + return x509_util::DupCryptoBuffer(GetCertBuffer()); + } + + // Returns the subject of the generated certificate. + const std::string& GetSubject() { + if (subject_tlv_.empty()) + GenerateSubject(); + return subject_tlv_; + } + + // Returns the (RSA) key for the generated certificate. + EVP_PKEY* GetKey() { + if (!key_) + GenerateKey(); + return key_.get(); + } + + // Returns an X509Certificate for the generated certificate. + scoped_refptr<X509Certificate> GetX509Certificate() { + return X509Certificate::CreateFromBuffer(DupCertBuffer(), {}); + } + + // Returns a copy of the certificate's DER. + std::string GetDER() { + return x509_util::CryptoBufferAsStringPiece(GetCertBuffer()).as_string(); + } + + private: + // Marks the generated certificate DER as invalid, so it will need to + // be re-generated next time the DER is accessed. + void Invalidate() { cert_.reset(); } + + // Sets the |key_| to a 2048-bit RSA key. + void GenerateKey() { + ASSERT_FALSE(key_); + + auto private_key = crypto::RSAPrivateKey::Create(2048); + key_.reset(private_key->key()); + EVP_PKEY_up_ref(key_.get()); + } + + // Adds bytes (specified as a StringPiece) to the given CBB. + static bool AddBytesToCBB(CBB* cbb, base::StringPiece bytes) { + return CBB_add_bytes(cbb, reinterpret_cast<const uint8_t*>(bytes.data()), + bytes.size()); + } + + // Finalizes the CBB to a std::string. + static std::string FinishCBB(CBB* cbb) { + size_t cbb_len; + uint8_t* cbb_bytes; + + if (!CBB_finish(cbb, &cbb_bytes, &cbb_len)) { + ADD_FAILURE() << "CBB_finish() failed"; + return std::string(); + } + + bssl::UniquePtr<uint8_t> delete_bytes(cbb_bytes); + return std::string(reinterpret_cast<char*>(cbb_bytes), cbb_len); + } + + // Generates a random subject for the certificate, comprised of just a CN. + void GenerateSubject() { + ASSERT_TRUE(subject_tlv_.empty()); + + // Use a random common name comprised of 12 bytes in hex. + std::string common_name = MakeRandomHexString(12); + + // See RFC 4519. + static const uint8_t kCommonName[] = {0x55, 0x04, 0x03}; + + // See RFC 5280, section 4.1.2.4. + bssl::ScopedCBB cbb; + CBB rdns, rdn, attr, type, value; + ASSERT_TRUE(CBB_init(cbb.get(), 64)); + ASSERT_TRUE(CBB_add_asn1(cbb.get(), &rdns, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&rdns, &rdn, CBS_ASN1_SET)); + ASSERT_TRUE(CBB_add_asn1(&rdn, &attr, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&attr, &type, CBS_ASN1_OBJECT)); + ASSERT_TRUE(CBB_add_bytes(&type, kCommonName, sizeof(kCommonName))); + ASSERT_TRUE(CBB_add_asn1(&attr, &value, CBS_ASN1_UTF8STRING)); + ASSERT_TRUE(AddBytesToCBB(&value, common_name)); + + subject_tlv_ = FinishCBB(cbb.get()); + } + + // Returns the serial number for the generated certificate. + uint64_t GetSerialNumber() { + if (!serial_number_) + serial_number_ = base::RandUint64(); + return serial_number_; + } + + // Parses |cert| and copies the following properties: + // * All extensions (dropping any duplicates) + // * Signature algorithm (from Certificate) + // * Validity (expiration) + void InitFromCert(const der::Input& cert) { + extensions_.clear(); + Invalidate(); + + // From RFC 5280, section 4.1 + // Certificate ::= SEQUENCE { + // tbsCertificate TBSCertificate, + // signatureAlgorithm AlgorithmIdentifier, + // signatureValue BIT STRING } + + // TBSCertificate ::= SEQUENCE { + // version [0] EXPLICIT Version DEFAULT v1, + // serialNumber CertificateSerialNumber, + // signature AlgorithmIdentifier, + // issuer Name, + // validity Validity, + // subject Name, + // subjectPublicKeyInfo SubjectPublicKeyInfo, + // issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + // -- If present, version MUST be v2 or v3 + // subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + // -- If present, version MUST be v2 or v3 + // extensions [3] EXPLICIT Extensions OPTIONAL + // -- If present, version MUST be v3 + // } + der::Parser parser(cert); + der::Parser certificate; + der::Parser tbs_certificate; + ASSERT_TRUE(parser.ReadSequence(&certificate)); + ASSERT_TRUE(certificate.ReadSequence(&tbs_certificate)); + + // version + bool unused; + ASSERT_TRUE(tbs_certificate.SkipOptionalTag( + der::kTagConstructed | der::kTagContextSpecific | 0, &unused)); + // serialNumber + ASSERT_TRUE(tbs_certificate.SkipTag(der::kInteger)); + + // signature + der::Input signature_algorithm_tlv; + ASSERT_TRUE(tbs_certificate.ReadRawTLV(&signature_algorithm_tlv)); + signature_algorithm_tlv_ = signature_algorithm_tlv.AsString(); + + // issuer + ASSERT_TRUE(tbs_certificate.SkipTag(der::kSequence)); + + // validity + der::Input validity_tlv; + ASSERT_TRUE(tbs_certificate.ReadRawTLV(&validity_tlv)); + validity_tlv_ = validity_tlv.AsString(); + + // subject + ASSERT_TRUE(tbs_certificate.SkipTag(der::kSequence)); + // subjectPublicKeyInfo + ASSERT_TRUE(tbs_certificate.SkipTag(der::kSequence)); + // issuerUniqueID + ASSERT_TRUE(tbs_certificate.SkipOptionalTag( + der::ContextSpecificPrimitive(1), &unused)); + // subjectUniqueID + ASSERT_TRUE(tbs_certificate.SkipOptionalTag( + der::ContextSpecificPrimitive(2), &unused)); + + // extensions + bool has_extensions = false; + der::Input extensions_tlv; + ASSERT_TRUE(tbs_certificate.ReadOptionalTag( + der::ContextSpecificConstructed(3), &extensions_tlv, &has_extensions)); + if (has_extensions) { + std::map<der::Input, ParsedExtension> parsed_extensions; + ASSERT_TRUE(ParseExtensions(extensions_tlv, &parsed_extensions)); + + for (const auto& parsed_extension : parsed_extensions) { + SetExtension(parsed_extension.second.oid, + parsed_extension.second.value.AsString(), + parsed_extension.second.critical); + } + } + } + + // Assembles the CertBuilder into a TBSCertificate. + void BuildTBSCertificate(std::string* out) { + bssl::ScopedCBB cbb; + CBB tbs_cert, version, extensions_context, extensions; + + ASSERT_TRUE(CBB_init(cbb.get(), 64)); + ASSERT_TRUE(CBB_add_asn1(cbb.get(), &tbs_cert, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE( + CBB_add_asn1(&tbs_cert, &version, + CBS_ASN1_CONTEXT_SPECIFIC | CBS_ASN1_CONSTRUCTED | 0)); + // Always use v3 certificates. + ASSERT_TRUE(CBB_add_asn1_uint64(&version, 2)); + ASSERT_TRUE(CBB_add_asn1_uint64(&tbs_cert, GetSerialNumber())); + ASSERT_TRUE(AddSignatureAlgorithm(&tbs_cert)); + ASSERT_TRUE(AddBytesToCBB(&tbs_cert, issuer_->GetSubject())); + ASSERT_TRUE(AddBytesToCBB(&tbs_cert, validity_tlv_)); + ASSERT_TRUE(AddBytesToCBB(&tbs_cert, GetSubject())); + ASSERT_TRUE(EVP_marshal_public_key(&tbs_cert, GetKey())); + + // Serialize all the extensions. + if (!extensions_.empty()) { + ASSERT_TRUE( + CBB_add_asn1(&tbs_cert, &extensions_context, + CBS_ASN1_CONTEXT_SPECIFIC | CBS_ASN1_CONSTRUCTED | 3)); + ASSERT_TRUE( + CBB_add_asn1(&extensions_context, &extensions, CBS_ASN1_SEQUENCE)); + + // Extension ::= SEQUENCE { + // extnID OBJECT IDENTIFIER, + // critical BOOLEAN DEFAULT FALSE, + // extnValue OCTET STRING + // -- contains the DER encoding of an ASN.1 value + // -- corresponding to the extension type identified + // -- by extnID + // } + for (const auto& extension_it : extensions_) { + CBB extension_seq, oid, extn_value; + ASSERT_TRUE( + CBB_add_asn1(&extensions, &extension_seq, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(CBB_add_asn1(&extension_seq, &oid, CBS_ASN1_OBJECT)); + ASSERT_TRUE(AddBytesToCBB(&oid, extension_it.first)); + if (extension_it.second.critical) { + ASSERT_TRUE(CBB_add_asn1_bool(&extension_seq, true)); + } + + ASSERT_TRUE( + CBB_add_asn1(&extension_seq, &extn_value, CBS_ASN1_OCTETSTRING)); + ASSERT_TRUE(AddBytesToCBB(&extn_value, extension_it.second.value)); + ASSERT_TRUE(CBB_flush(&extensions)); + } + } + + *out = FinishCBB(cbb.get()); + } + + bool AddSignatureAlgorithm(CBB* cbb) { + return AddBytesToCBB(cbb, signature_algorithm_tlv_); + } + + void GenerateCertificate() { + ASSERT_FALSE(cert_); + + std::string tbs_cert; + BuildTBSCertificate(&tbs_cert); + const uint8_t* tbs_cert_bytes = + reinterpret_cast<const uint8_t*>(tbs_cert.data()); + + // Determine the correct digest algorithm to use (assumes RSA PKCS#1 + // signatures). + auto signature_algorithm = SignatureAlgorithm::Create( + der::Input(&signature_algorithm_tlv_), nullptr); + ASSERT_TRUE(signature_algorithm); + ASSERT_EQ(SignatureAlgorithmId::RsaPkcs1, signature_algorithm->algorithm()); + const EVP_MD* md = nullptr; + + switch (signature_algorithm->digest()) { + case DigestAlgorithm::Sha256: + md = EVP_sha256(); + break; + + case DigestAlgorithm::Sha1: + md = EVP_sha1(); + break; + + default: + ASSERT_TRUE(false) << "Only rsaEncryptionWithSha256 or " + "rsaEnryptionWithSha1 are supported"; + break; + } + + // Sign the TBSCertificate and write the entire certificate. + bssl::ScopedCBB cbb; + CBB cert, signature; + bssl::ScopedEVP_MD_CTX ctx; + uint8_t* sig_out; + size_t sig_len; + + ASSERT_TRUE(CBB_init(cbb.get(), tbs_cert.size())); + ASSERT_TRUE(CBB_add_asn1(cbb.get(), &cert, CBS_ASN1_SEQUENCE)); + ASSERT_TRUE(AddBytesToCBB(&cert, tbs_cert)); + ASSERT_TRUE(AddSignatureAlgorithm(&cert)); + ASSERT_TRUE(CBB_add_asn1(&cert, &signature, CBS_ASN1_BITSTRING)); + ASSERT_TRUE(CBB_add_u8(&signature, 0 /* no unused bits */)); + ASSERT_TRUE( + EVP_DigestSignInit(ctx.get(), nullptr, md, nullptr, issuer_->GetKey())); + ASSERT_TRUE(EVP_DigestSign(ctx.get(), nullptr, &sig_len, tbs_cert_bytes, + tbs_cert.size())); + ASSERT_TRUE(CBB_reserve(&signature, &sig_out, sig_len)); + ASSERT_TRUE(EVP_DigestSign(ctx.get(), sig_out, &sig_len, tbs_cert_bytes, + tbs_cert.size())); + ASSERT_TRUE(CBB_did_write(&signature, sig_len)); + + auto cert_der = FinishCBB(cbb.get()); + cert_ = x509_util::CreateCryptoBuffer( + reinterpret_cast<const uint8_t*>(cert_der.data()), cert_der.size()); + } + + struct ExtensionValue { + bool critical = false; + std::string value; + }; + + std::string validity_tlv_; + std::string subject_tlv_; + std::string signature_algorithm_tlv_; + uint64_t serial_number_ = 0; + + std::map<std::string, ExtensionValue> extensions_; + + bssl::UniquePtr<CRYPTO_BUFFER> cert_; + bssl::UniquePtr<EVP_PKEY> key_; + + CertBuilder* issuer_ = nullptr; +}; + +INSTANTIATE_TEST_CASE_P(, + CertVerifyProcInternalWithNetFetchingTest, + testing::ValuesIn(kAllCertVerifiers), + VerifyProcTypeToName); + +// Tries verifying a certificate chain that is missing an intermediate. The +// intermediate is available via AIA, however the server responds with a 404. +// +// NOTE: This test is separate from IntermediateFromAia200 as a different URL +// needs to be used to avoid having the result depend on globally cached success +// or failure of the fetch. +TEST_P(CertVerifyProcInternalWithNetFetchingTest, IntermediateFromAia404) { + const char kHostname[] = "www.example.com"; + + base::FilePath certs_dir = + GetTestNetDataDirectory() + .AppendASCII("verify_certificate_chain_unittest") + .AppendASCII("target-and-intermediate"); + + CertificateList orig_certs = CreateCertificateListFromFile( + certs_dir, "chain.pem", X509Certificate::FORMAT_AUTO); + ASSERT_EQ(3U, orig_certs.size()); + + // Build a slightly modified variant of |orig_certs|, in which the leaf points + // to an AIA for obtaining the missing intermediate. This URL is however NOT + // registered on the test server, so will result in a 404. + CertBuilder root(orig_certs[2]->cert_buffer(), nullptr); + CertBuilder intermediate(orig_certs[1]->cert_buffer(), &root); + CertBuilder leaf(orig_certs[0]->cert_buffer(), &intermediate); + + GURL ca_issuers_url = GetTestServerAbsoluteUrl(MakeRandomPath(".cer")); + leaf.SetCaIssuersUrl(ca_issuers_url); + leaf.SetSubjectAltName(kHostname); + + // Trust the root certificate. + auto root_cert = root.GetX509Certificate(); + ScopedTestRoot scoped_root(root_cert.get()); + + // The chain being verified is solely the leaf certificate (missing the + // intermediate and root). + scoped_refptr<X509Certificate> chain = leaf.GetX509Certificate(); + ASSERT_TRUE(chain.get()); + ASSERT_EQ(0u, chain->intermediate_buffers().size()); + + const int flags = 0; + int error; + CertVerifyResult verify_result; + + // Verifying the chain should succeed as the intermediate is missing, and + // cannot be fetched via AIA. + error = Verify(chain.get(), kHostname, flags, nullptr, CertificateList(), + &verify_result); + EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); +} + +// Tries verifying a certificate chain that is missing an intermediate. The +// intermediate is available via AIA. +TEST_P(CertVerifyProcInternalWithNetFetchingTest, IntermediateFromAia200) { + const char kHostname[] = "www.example.com"; + + base::FilePath certs_dir = + GetTestNetDataDirectory() + .AppendASCII("verify_certificate_chain_unittest") + .AppendASCII("target-and-intermediate"); + + CertificateList orig_certs = CreateCertificateListFromFile( + certs_dir, "chain.pem", X509Certificate::FORMAT_AUTO); + ASSERT_EQ(3U, orig_certs.size()); + + // Build a slightly modified variant of |orig_certs|. + CertBuilder root(orig_certs[2]->cert_buffer(), nullptr); + CertBuilder intermediate(orig_certs[1]->cert_buffer(), &root); + CertBuilder leaf(orig_certs[0]->cert_buffer(), &intermediate); + + // Make the leaf certificate have an AIA (CA Issuers) that points to the + // embedded test server. This uses a random URL for predictable behavior in + // the presence of global caching. + std::string ca_issuers_relative_path = MakeRandomPath(".cer"); + GURL ca_issuers_url = GetTestServerAbsoluteUrl(ca_issuers_relative_path); + leaf.SetCaIssuersUrl(ca_issuers_url); + leaf.SetSubjectAltName(kHostname); + + // Setup the test server to reply with the correct intermediate. + RegisterSimpleTestServerHandler( + ca_issuers_relative_path, "application/pkix-cert", intermediate.GetDER()); + + // Trust the root certificate. + auto root_cert = root.GetX509Certificate(); + ScopedTestRoot scoped_root(root_cert.get()); + + // The chain being verified is solely the leaf certificate (missing the + // intermediate and root). + scoped_refptr<X509Certificate> chain = leaf.GetX509Certificate(); + ASSERT_TRUE(chain.get()); + ASSERT_EQ(0u, chain->intermediate_buffers().size()); + + const int flags = 0; + int error; + CertVerifyResult verify_result; + + // Verifying the chain should succeed as the missing intermediate can be + // fetched via AIA. + error = Verify(chain.get(), kHostname, flags, nullptr, CertificateList(), + &verify_result); + EXPECT_THAT(error, IsOk()); +} + TEST(CertVerifyProcTest, RejectsMD2) { scoped_refptr<X509Certificate> cert( ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"));
diff --git a/net/filter/filter_source_stream.cc b/net/filter/filter_source_stream.cc index cf9b46e..6e2664f 100644 --- a/net/filter/filter_source_stream.cc +++ b/net/filter/filter_source_stream.cc
@@ -4,6 +4,8 @@ #include "net/filter/filter_source_stream.h" +#include <utility> + #include "base/bind.h" #include "base/callback_helpers.h" #include "base/logging.h" @@ -40,7 +42,7 @@ int FilterSourceStream::Read(IOBuffer* read_buffer, int read_buffer_size, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { DCHECK_EQ(STATE_NONE, next_state_); DCHECK(read_buffer); DCHECK_LT(0, read_buffer_size); @@ -61,7 +63,7 @@ int rv = DoLoop(OK); if (rv == ERR_IO_PENDING) - callback_ = callback; + callback_ = std::move(callback); return rv; }
diff --git a/net/filter/filter_source_stream.h b/net/filter/filter_source_stream.h index 4855dfc..be55a50 100644 --- a/net/filter/filter_source_stream.h +++ b/net/filter/filter_source_stream.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "net/base/completion_callback.h" +#include "net/base/completion_once_callback.h" #include "net/base/net_errors.h" #include "net/base/net_export.h" #include "net/filter/source_stream.h" @@ -34,7 +34,7 @@ int Read(IOBuffer* read_buffer, int read_buffer_size, - const CompletionCallback& callback) override; + CompletionOnceCallback callback) override; std::string Description() const override; @@ -110,7 +110,7 @@ // Not null if there is a pending Read. scoped_refptr<IOBuffer> output_buffer_; int output_buffer_size_; - CompletionCallback callback_; + CompletionOnceCallback callback_; // Reading from |upstream_| has returned 0 byte or an error code. bool upstream_end_reached_;
diff --git a/net/filter/fuzzed_source_stream.cc b/net/filter/fuzzed_source_stream.cc index 626675d..142a1849 100644 --- a/net/filter/fuzzed_source_stream.cc +++ b/net/filter/fuzzed_source_stream.cc
@@ -5,6 +5,7 @@ #include "net/filter/fuzzed_source_stream.h" #include <algorithm> +#include <utility> #include "base/test/fuzzed_data_provider.h" #include "base/threading/thread_task_runner_handle.h" @@ -32,7 +33,7 @@ int FuzzedSourceStream::Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { DCHECK(!read_pending_); DCHECK(!end_returned_); DCHECK_LE(0, buf_len); @@ -59,9 +60,9 @@ read_pending_ = true; // |this| is owned by the caller so use base::Unretained is safe. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(&FuzzedSourceStream::OnReadComplete, base::Unretained(this), - callback, data, pending_read_buf, result)); + FROM_HERE, base::BindOnce(&FuzzedSourceStream::OnReadComplete, + base::Unretained(this), std::move(callback), + data, pending_read_buf, result)); return ERR_IO_PENDING; } @@ -69,7 +70,7 @@ return ""; } -void FuzzedSourceStream::OnReadComplete(const CompletionCallback& callback, +void FuzzedSourceStream::OnReadComplete(CompletionOnceCallback callback, const std::string& fuzzed_data, scoped_refptr<IOBuffer> read_buf, int result) { @@ -82,7 +83,7 @@ end_returned_ = true; } read_pending_ = false; - callback.Run(result); + std::move(callback).Run(result); } } // namespace net
diff --git a/net/filter/fuzzed_source_stream.h b/net/filter/fuzzed_source_stream.h index 6a969474..4b26829 100644 --- a/net/filter/fuzzed_source_stream.h +++ b/net/filter/fuzzed_source_stream.h
@@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "net/base/completion_callback.h" +#include "net/base/completion_once_callback.h" #include "net/filter/source_stream.h" namespace base { @@ -32,11 +32,11 @@ // SourceStream implementation int Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) override; + CompletionOnceCallback callback) override; std::string Description() const override; private: - void OnReadComplete(const CompletionCallback& callback, + void OnReadComplete(CompletionOnceCallback callback, const std::string& fuzzed_data, scoped_refptr<IOBuffer> read_buf, int result);
diff --git a/net/filter/gzip_source_stream_unittest.cc b/net/filter/gzip_source_stream_unittest.cc index c45e542..3c4f1c7 100644 --- a/net/filter/gzip_source_stream_unittest.cc +++ b/net/filter/gzip_source_stream_unittest.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/bit_cast.h" #include "base/callback.h" -#include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/test_completion_callback.h" #include "net/filter/filter_source_stream_test_util.h"
diff --git a/net/filter/mock_source_stream.cc b/net/filter/mock_source_stream.cc index 7dceef2..d225c7b 100644 --- a/net/filter/mock_source_stream.cc +++ b/net/filter/mock_source_stream.cc
@@ -4,6 +4,8 @@ #include "net/filter/mock_source_stream.h" +#include <utility> + #include "base/logging.h" #include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,7 +27,7 @@ int MockSourceStream::Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { DCHECK(!awaiting_completion_); DCHECK(!results_.empty()); @@ -38,7 +40,7 @@ awaiting_completion_ = true; dest_buffer_ = dest_buffer; dest_buffer_size_ = buffer_size; - callback_ = callback; + callback_ = std::move(callback); return ERR_IO_PENDING; } @@ -93,7 +95,7 @@ DCHECK_GE(dest_buffer_size_, r.len); memcpy(dest_buffer_->data(), r.data, r.len); dest_buffer_ = nullptr; - callback_.Run(r.error == OK ? r.len : r.error); + std::move(callback_).Run(r.error == OK ? r.len : r.error); } } // namespace net
diff --git a/net/filter/mock_source_stream.h b/net/filter/mock_source_stream.h index d329d96a2..9e341b0 100644 --- a/net/filter/mock_source_stream.h +++ b/net/filter/mock_source_stream.h
@@ -10,7 +10,7 @@ #include "base/containers/queue.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "net/base/completion_callback.h" +#include "net/base/completion_once_callback.h" #include "net/base/net_errors.h" #include "net/filter/source_stream.h" @@ -33,7 +33,7 @@ // SourceStream implementation int Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) override; + CompletionOnceCallback callback) override; std::string Description() const override; // Enqueues a result to be returned by |Read|. This method does not make a @@ -72,7 +72,7 @@ base::queue<QueuedResult> results_; bool awaiting_completion_; scoped_refptr<IOBuffer> dest_buffer_; - CompletionCallback callback_; + CompletionOnceCallback callback_; int dest_buffer_size_; DISALLOW_COPY_AND_ASSIGN(MockSourceStream);
diff --git a/net/filter/source_stream.h b/net/filter/source_stream.h index be30c14..12d834d 100644 --- a/net/filter/source_stream.h +++ b/net/filter/source_stream.h
@@ -10,7 +10,7 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "net/base/completion_callback.h" +#include "net/base/completion_once_callback.h" #include "net/base/net_errors.h" #include "net/base/net_export.h" @@ -48,7 +48,7 @@ // asynchronously to ensure it does not get freed mid-read. virtual int Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) = 0; + CompletionOnceCallback callback) = 0; // Returns a string that represents stream. This is for UMA and NetLog // logging.
diff --git a/net/tools/content_decoder_tool/content_decoder_tool.cc b/net/tools/content_decoder_tool/content_decoder_tool.cc index 6ff7eb1..97e345b 100644 --- a/net/tools/content_decoder_tool/content_decoder_tool.cc +++ b/net/tools/content_decoder_tool/content_decoder_tool.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/strings/string_util.h" +#include "net/base/completion_once_callback.h" #include "net/base/io_buffer.h" #include "net/base/test_completion_callback.h" #include "net/filter/brotli_source_stream.h" @@ -35,7 +36,7 @@ // SourceStream implementation. int Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) override { + CompletionOnceCallback callback) override { if (input_stream_->eof()) return OK; if (input_stream_) {
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 6344fa0..9bdff67 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc
@@ -63,9 +63,10 @@ // SourceStream implementation: int Read(IOBuffer* dest_buffer, int buffer_size, - const CompletionCallback& callback) override { + CompletionOnceCallback callback) override { DCHECK(job_); - return job_->ReadRawDataHelper(dest_buffer, buffer_size, callback); + return job_->ReadRawDataHelper(dest_buffer, buffer_size, + std::move(callback)); } std::string Description() const override { return std::string(); } @@ -512,7 +513,7 @@ // Notify SourceStream. DCHECK(!read_raw_callback_.is_null()); - base::ResetAndReturn(&read_raw_callback_).Run(result); + std::move(read_raw_callback_).Run(result); // |this| may be destroyed at this point. } @@ -657,7 +658,7 @@ int URLRequestJob::ReadRawDataHelper(IOBuffer* buf, int buf_size, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { DCHECK(!raw_read_buffer_); // Keep a pointer to the read buffer, so URLRequestJob::GatherRawReadStats() @@ -673,7 +674,7 @@ // GatherRawReadStats so we can account for the completed read. GatherRawReadStats(result); } else { - read_raw_callback_ = callback; + read_raw_callback_ = std::move(callback); } return result; }
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index cad145da..7a223958 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h
@@ -15,6 +15,7 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/power_monitor/power_observer.h" +#include "net/base/completion_once_callback.h" #include "net/base/host_port_pair.h" #include "net/base/load_states.h" #include "net/base/net_error_details.h" @@ -359,7 +360,7 @@ // synchronously. int ReadRawDataHelper(IOBuffer* buf, int buf_size, - const CompletionCallback& callback); + CompletionOnceCallback callback); // Returns OK if |new_url| is a valid redirect target and an error code // otherwise. @@ -455,7 +456,7 @@ // Non-null if ReadRawData() returned ERR_IO_PENDING, and the read has not // completed. - CompletionCallback read_raw_callback_; + CompletionOnceCallback read_raw_callback_; base::WeakPtrFactory<URLRequestJob> weak_factory_;
diff --git a/services/network/BUILD.gn b/services/network/BUILD.gn index d2bd8f39..2e45760 100644 --- a/services/network/BUILD.gn +++ b/services/network/BUILD.gn
@@ -274,6 +274,8 @@ "test/test_data_pipe_getter.cc", "test/test_data_pipe_getter.h", "test/test_network_context.h", + "test/test_network_service_client.cc", + "test/test_network_service_client.h", "test/test_shared_url_loader_factory.cc", "test/test_shared_url_loader_factory.h", "test/test_url_loader_client.cc",
diff --git a/services/network/OWNERS b/services/network/OWNERS index c83eda8..3bec1a2f 100644 --- a/services/network/OWNERS +++ b/services/network/OWNERS
@@ -1,6 +1,7 @@ jam@chromium.org kinuko@chromium.org mmenke@chromium.org +morlovich@chromium.org reillyg@chromium.org scottmg@chromium.org tsepez@chromium.org
diff --git a/services/network/public/cpp/shared_url_loader_factory.cc b/services/network/public/cpp/shared_url_loader_factory.cc index 8c7656f..2262abbb 100644 --- a/services/network/public/cpp/shared_url_loader_factory.cc +++ b/services/network/public/cpp/shared_url_loader_factory.cc
@@ -9,6 +9,7 @@ // static scoped_refptr<SharedURLLoaderFactory> SharedURLLoaderFactory::Create( std::unique_ptr<SharedURLLoaderFactoryInfo> info) { + DCHECK(info); return info->CreateFactory(); }
diff --git a/services/network/public/cpp/simple_url_loader_unittest.cc b/services/network/public/cpp/simple_url_loader_unittest.cc index 4f7734c9..8eb6f97 100644 --- a/services/network/public/cpp/simple_url_loader_unittest.cc +++ b/services/network/public/cpp/simple_url_loader_unittest.cc
@@ -48,6 +48,7 @@ #include "services/network/public/cpp/url_loader_completion_status.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" +#include "services/network/test/test_network_service_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -548,6 +549,11 @@ network_service_ptr->CreateNetworkContext( mojo::MakeRequest(&network_context_), std::move(context_params)); + network::mojom::NetworkServiceClientPtr network_service_client_ptr; + network_service_client_ = std::make_unique<TestNetworkServiceClient>( + mojo::MakeRequest(&network_service_client_ptr)); + network_service_ptr->SetClient(std::move(network_service_client_ptr)); + mojom::URLLoaderFactoryParamsPtr params = mojom::URLLoaderFactoryParams::New(); params->process_id = mojom::kBrowserProcessId; @@ -592,6 +598,7 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<network::mojom::NetworkService> network_service_; + std::unique_ptr<network::mojom::NetworkServiceClient> network_service_client_; network::mojom::NetworkContextPtr network_context_; network::mojom::URLLoaderFactoryPtr url_loader_factory_;
diff --git a/services/network/test/test_network_service_client.cc b/services/network/test/test_network_service_client.cc new file mode 100644 index 0000000..43e8789 --- /dev/null +++ b/services/network/test/test_network_service_client.cc
@@ -0,0 +1,107 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/network/test/test_network_service_client.h" + +#include "base/task_scheduler/post_task.h" + +namespace network { + +TestNetworkServiceClient::TestNetworkServiceClient() + : enable_uploads_(true), binding_(nullptr) {} + +TestNetworkServiceClient::TestNetworkServiceClient( + mojom::NetworkServiceClientRequest request) + : enable_uploads_(true), binding_(this, std::move(request)) {} + +TestNetworkServiceClient::~TestNetworkServiceClient() {} + +void TestNetworkServiceClient::DisableUploads() { + enable_uploads_ = false; +} + +void TestNetworkServiceClient::EnableUploads() { + enable_uploads_ = true; +} + +void TestNetworkServiceClient::OnAuthRequired( + uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + const GURL& url, + const GURL& site_for_cookies, + bool first_auth_attempt, + const scoped_refptr<net::AuthChallengeInfo>& auth_info, + int32_t resource_type, + const base::Optional<ResourceResponseHead>& head, + mojom::AuthChallengeResponderPtr auth_challenge_responder) { + NOTREACHED(); +} + +void TestNetworkServiceClient::OnCertificateRequested( + uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojom::NetworkServiceClient::OnCertificateRequestedCallback callback) { + NOTREACHED(); +} + +void TestNetworkServiceClient::OnSSLCertificateError( + uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + int32_t resource_type, + const GURL& url, + const net::SSLInfo& ssl_info, + bool fatal, + OnSSLCertificateErrorCallback response) { + NOTREACHED(); +} + +void TestNetworkServiceClient::OnCookiesRead(int process_id, + int routing_id, + const GURL& url, + const GURL& first_party_url, + const net::CookieList& cookie_list, + bool blocked_by_policy) { + NOTREACHED(); +} + +void TestNetworkServiceClient::OnCookieChange( + int process_id, + int routing_id, + const GURL& url, + const GURL& first_party_url, + const net::CanonicalCookie& cookie, + bool blocked_by_policy) { + NOTREACHED(); +} + +void TestNetworkServiceClient::OnFileUploadRequested( + uint32_t process_id, + bool async, + const std::vector<base::FilePath>& file_paths, + OnFileUploadRequestedCallback callback) { + if (!enable_uploads_) { + std::move(callback).Run(net::ERR_ACCESS_DENIED, std::vector<base::File>()); + return; + } + base::ScopedAllowBlockingForTesting allow_blocking; + uint32_t file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ | + (async ? base::File::FLAG_ASYNC : 0); + std::vector<base::File> files; + for (base::FilePath path : file_paths) { + files.emplace_back(path, file_flags); + if (!files.back().IsValid()) { + std::move(callback).Run( + net::FileErrorToNetError(files.back().error_details()), + std::vector<base::File>()); + return; + } + } + std::move(callback).Run(net::OK, std::move(files)); +} + +} // namespace network
diff --git a/services/network/test/test_network_service_client.h b/services/network/test/test_network_service_client.h new file mode 100644 index 0000000..d6b0bf63 --- /dev/null +++ b/services/network/test/test_network_service_client.h
@@ -0,0 +1,78 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_NETWORK_TEST_TEST_NETWORK_SERVICE_CLIENT_H_ +#define SERVICES_NETWORK_TEST_TEST_NETWORK_SERVICE_CLIENT_H_ + +#include "mojo/public/cpp/bindings/binding.h" +#include "services/network/public/mojom/network_service.mojom.h" + +namespace network { + +// A helper class with a basic NetworkServiceClient implementation for use in +// unittests, which may need an implementation (for things like file uploads), +// but don't have the real implementation available. +class TestNetworkServiceClient : public network::mojom::NetworkServiceClient { + public: + TestNetworkServiceClient(); + explicit TestNetworkServiceClient(mojom::NetworkServiceClientRequest request); + ~TestNetworkServiceClient() override; + + void DisableUploads(); + void EnableUploads(); + + // network::mojom::NetworkServiceClient implementation: + void OnAuthRequired( + uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + const GURL& url, + const GURL& site_for_cookies, + bool first_auth_attempt, + const scoped_refptr<net::AuthChallengeInfo>& auth_info, + int32_t resource_type, + const base::Optional<ResourceResponseHead>& head, + mojom::AuthChallengeResponderPtr auth_challenge_responder) override; + void OnCertificateRequested( + uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojom::NetworkServiceClient::OnCertificateRequestedCallback callback) + override; + void OnSSLCertificateError(uint32_t process_id, + uint32_t routing_id, + uint32_t request_id, + int32_t resource_type, + const GURL& url, + const net::SSLInfo& ssl_info, + bool fatal, + OnSSLCertificateErrorCallback response) override; + void OnCookiesRead(int process_id, + int routing_id, + const GURL& url, + const GURL& first_party_url, + const net::CookieList& cookie_list, + bool blocked_by_policy) override; + void OnCookieChange(int process_id, + int routing_id, + const GURL& url, + const GURL& first_party_url, + const net::CanonicalCookie& cookie, + bool blocked_by_policy) override; + void OnFileUploadRequested(uint32_t process_id, + bool async, + const std::vector<base::FilePath>& file_paths, + OnFileUploadRequestedCallback callback) override; + + private: + bool enable_uploads_; + mojo::Binding<mojom::NetworkServiceClient> binding_; + + DISALLOW_COPY_AND_ASSIGN(TestNetworkServiceClient); +}; + +} // namespace network + +#endif // SERVICES_NETWORK_TEST_TEST_NETWORK_SERVICE_CLIENT_H_
diff --git a/services/network/test/test_shared_url_loader_factory.cc b/services/network/test/test_shared_url_loader_factory.cc index f7bc84c..729f97b 100644 --- a/services/network/test/test_shared_url_loader_factory.cc +++ b/services/network/test/test_shared_url_loader_factory.cc
@@ -11,11 +11,13 @@ namespace network { -TestSharedURLLoaderFactory::TestSharedURLLoaderFactory() { +TestSharedURLLoaderFactory::TestSharedURLLoaderFactory( + NetworkService* network_service) { url_request_context_ = std::make_unique<net::TestURLRequestContext>(); mojom::NetworkContextPtr network_context; network_context_ = std::make_unique<NetworkContext>( - nullptr, mojo::MakeRequest(&network_context), url_request_context_.get()); + network_service, mojo::MakeRequest(&network_context), + url_request_context_.get()); mojom::URLLoaderFactoryParamsPtr params = mojom::URLLoaderFactoryParams::New(); params->process_id = mojom::kBrowserProcessId;
diff --git a/services/network/test/test_shared_url_loader_factory.h b/services/network/test/test_shared_url_loader_factory.h index d75836b..2e2d46b 100644 --- a/services/network/test/test_shared_url_loader_factory.h +++ b/services/network/test/test_shared_url_loader_factory.h
@@ -15,6 +15,7 @@ namespace network { class NetworkContext; +class NetworkService; // A helper class to create a full functioning SharedURLLoaderFactory. This is // backed by a real URLLoader implementation. Use this in unittests which have a @@ -23,7 +24,8 @@ // across threads. class TestSharedURLLoaderFactory : public SharedURLLoaderFactory { public: - TestSharedURLLoaderFactory(); + explicit TestSharedURLLoaderFactory( + NetworkService* network_service = nullptr); // URLLoaderFactory implementation: void CreateLoaderAndStart(mojom::URLLoaderRequest loader,
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index eb0e1c0b..66f9b01a 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -121,8 +121,10 @@ public: FileElementReader(ResourceRequestBody* resource_request_body, base::TaskRunner* task_runner, - const DataElement& element) + const DataElement& element, + base::File&& file) : net::UploadFileElementReader(task_runner, + std::move(file), element.path(), element.offset(), element.length(), @@ -167,6 +169,7 @@ // TODO: copied from content/browser/loader/upload_data_stream_builder.cc. std::unique_ptr<net::UploadDataStream> CreateUploadDataStream( ResourceRequestBody* body, + std::vector<base::File>& opened_files, base::SequencedTaskRunner* file_task_runner) { // In the case of a chunked upload, there will just be one element. if (body->elements()->size() == 1 && @@ -177,6 +180,7 @@ .ReleaseChunkedDataPipeGetter()); } + auto opened_file = opened_files.begin(); std::vector<std::unique_ptr<net::UploadElementReader>> element_readers; for (const auto& element : *body->elements()) { switch (element.type()) { @@ -185,8 +189,9 @@ std::make_unique<BytesElementReader>(body, element)); break; case DataElement::TYPE_FILE: + DCHECK(opened_file != opened_files.end()); element_readers.push_back(std::make_unique<FileElementReader>( - body, file_task_runner, element)); + body, file_task_runner, element, std::move(*opened_file++))); break; case DataElement::TYPE_RAW_FILE: element_readers.push_back(std::make_unique<RawFileElementReader>( @@ -212,6 +217,7 @@ break; } } + DCHECK(opened_file == opened_files.end()); return std::make_unique<net::ElementsUploadDataStream>( std::move(element_readers), body->identifier()); @@ -349,23 +355,6 @@ throttling_token_ = network::ScopedThrottlingToken::MaybeCreate( url_request_->net_log().source().id, request.throttling_profile_id); - // Resolve elements from request_body and prepare upload data. - if (request.request_body.get()) { - scoped_refptr<base::SequencedTaskRunner> task_runner = - base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); - url_request_->set_upload( - CreateUploadDataStream(request.request_body.get(), task_runner.get())); - - if (request.enable_upload_progress) { - upload_progress_tracker_ = std::make_unique<UploadProgressTracker>( - FROM_HERE, - base::BindRepeating(&URLLoader::SendUploadProgress, - base::Unretained(this)), - url_request_.get()); - } - } - url_request_->set_initiator(request.request_initiator); if (request.update_first_party_url_on_redirect) { @@ -385,6 +374,83 @@ if (keepalive_ && keepalive_statistics_recorder_) keepalive_statistics_recorder_->OnLoadStarted(factory_params_->process_id); + // Resolve elements from request_body and prepare upload data. + if (request.request_body.get()) { + OpenFilesForUpload(request); + return; + } + ScheduleStart(); +} + +void URLLoader::OpenFilesForUpload(const ResourceRequest& request) { + std::vector<base::FilePath> paths; + for (const auto& element : *request.request_body.get()->elements()) { + if (element.type() == DataElement::TYPE_FILE) + paths.push_back(element.path()); + } + if (paths.empty()) { + SetUpUpload(request, net::OK, std::vector<base::File>()); + return; + } + if (!network_service_client_) { + // Defer calling NotifyCompleted to make sure the URLLoader finishes + // initializing before getting deleted. + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&URLLoader::NotifyCompleted, base::Unretained(this), + net::ERR_ACCESS_DENIED)); + return; + } + url_request_->LogBlockedBy("Opening Files"); + network_service_client_->OnFileUploadRequested( + factory_params_->process_id, true /* async */, paths, + base::BindOnce(&OnFilesForUploadOpened, weak_ptr_factory_.GetWeakPtr(), + request)); +} + +// static +void URLLoader::OnFilesForUploadOpened(base::WeakPtr<URLLoader> self, + const ResourceRequest& request, + int error_code, + std::vector<base::File> opened_files) { + // If the URLLoader was already deleted, move the opened_files vector onto a + // sequence that can block so it gets destroyed there. + if (self) { + self->url_request_->LogUnblocked(); + self->SetUpUpload(request, error_code, std::move(opened_files)); + } else { + base::PostTaskWithTraits( + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, + base::BindOnce(base::DoNothing::Once<std::vector<base::File>>(), + std::move(opened_files))); + } +} + +void URLLoader::SetUpUpload(const ResourceRequest& request, + int error_code, + std::vector<base::File> opened_files) { + if (error_code != net::OK) { + DCHECK(opened_files.empty()); + NotifyCompleted(error_code); + return; + } + scoped_refptr<base::SequencedTaskRunner> task_runner = + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); + url_request_->set_upload(CreateUploadDataStream( + request.request_body.get(), opened_files, task_runner.get())); + + if (request.enable_upload_progress) { + upload_progress_tracker_ = std::make_unique<UploadProgressTracker>( + FROM_HERE, + base::BindRepeating(&URLLoader::SendUploadProgress, + base::Unretained(this)), + url_request_.get()); + } + ScheduleStart(); +} + +void URLLoader::ScheduleStart() { bool defer = false; if (resource_scheduler_client_) { resource_scheduler_request_handle_ =
diff --git a/services/network/url_loader.h b/services/network/url_loader.h index 5530d4f..45fd09f 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h
@@ -125,6 +125,15 @@ DISALLOW_COPY_AND_ASSIGN(UnownedPointer); }; + static void OnFilesForUploadOpened(base::WeakPtr<URLLoader> self, + const ResourceRequest& request, + int error_code, + std::vector<base::File> opened_files); + void OpenFilesForUpload(const ResourceRequest& request); + void SetUpUpload(const ResourceRequest& request, + int error_code, + const std::vector<base::File> opened_files); + void ScheduleStart(); void ReadMore(); void DidRead(int num_bytes, bool completed_synchronously); void NotifyCompleted(int error_code); @@ -167,8 +176,8 @@ int resource_type_; bool is_load_timing_enabled_; - // URLLoaderFactory is guaranteed to outlive URLLoader, so it is safe to store - // a raw pointer to mojom::URLLoaderFactoryParams. + // URLLoaderFactory is guaranteed to outlive URLLoader, so it is safe to + // store a raw pointer to mojom::URLLoaderFactoryParams. const mojom::URLLoaderFactoryParams* const factory_params_; uint32_t render_frame_id_;
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index 35ceef4..ebf4495 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -50,6 +50,7 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/resource_scheduler_client.h" #include "services/network/test/test_data_pipe_getter.h" +#include "services/network/test/test_network_service_client.h" #include "services/network/test/test_url_loader_client.h" #include "services/network/test_chunked_data_pipe_getter.h" #include "services/network/url_loader.h" @@ -332,6 +333,10 @@ if (send_ssl_for_cert_error_) options |= mojom::kURLLoadOptionSendSSLInfoForCertificateError; + std::unique_ptr<TestNetworkServiceClient> network_service_client; + if (allow_file_uploads_) + network_service_client = std::make_unique<TestNetworkServiceClient>(); + if (request_body_) request.request_body = request_body_; @@ -342,7 +347,7 @@ params.process_id = mojom::kBrowserProcessId; params.is_corb_enabled = false; url_loader = std::make_unique<URLLoader>( - context(), nullptr /* network_service_client */, + context(), network_service_client.get(), DeleteLoaderCallback(&delete_run_loop, &url_loader), mojo::MakeRequest(&loader), options, request, false, client_.CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, @@ -487,6 +492,10 @@ } // Configure how Load() works. + void allow_file_uploads() { + DCHECK(!ran_); + allow_file_uploads_ = true; + } void set_sniff() { DCHECK(!ran_); sniff_ = true; @@ -599,6 +608,7 @@ scoped_refptr<ResourceSchedulerClient> resource_scheduler_client_; // Options applied to the created request in Load(). + bool allow_file_uploads_ = false; bool sniff_ = false; bool send_ssl_with_response_ = false; bool send_ssl_for_cert_error_ = false; @@ -1224,6 +1234,7 @@ } TEST_F(URLLoaderTest, UploadFile) { + allow_file_uploads(); base::FilePath file_path = GetTestFilePath("simple_page.html"); std::string expected_body; @@ -1241,6 +1252,7 @@ } TEST_F(URLLoaderTest, UploadFileWithRange) { + allow_file_uploads(); base::FilePath file_path = GetTestFilePath("simple_page.html"); std::string expected_body; @@ -1258,6 +1270,107 @@ EXPECT_EQ(expected_body, response_body); } +TEST_F(URLLoaderTest, UploadTwoFiles) { + allow_file_uploads(); + base::FilePath file_path1 = GetTestFilePath("simple_page.html"); + base::FilePath file_path2 = GetTestFilePath("hello.html"); + + std::string expected_body1; + std::string expected_body2; + ASSERT_TRUE(base::ReadFileToString(file_path1, &expected_body1)) + << "File not found: " << file_path1.value(); + ASSERT_TRUE(base::ReadFileToString(file_path2, &expected_body2)) + << "File not found: " << file_path2.value(); + + scoped_refptr<ResourceRequestBody> request_body(new ResourceRequestBody()); + request_body->AppendFileRange( + file_path1, 0, std::numeric_limits<uint64_t>::max(), base::Time()); + request_body->AppendFileRange( + file_path2, 0, std::numeric_limits<uint64_t>::max(), base::Time()); + set_request_body(std::move(request_body)); + + std::string response_body; + EXPECT_EQ(net::OK, Load(test_server()->GetURL("/echo"), &response_body)); + EXPECT_EQ(expected_body1 + expected_body2, response_body); +} + +TEST_F(URLLoaderTest, UploadInvalidFile) { + // Don't call allow_file_uploads(); + base::FilePath file_path = GetTestFilePath("simple_page.html"); + + scoped_refptr<ResourceRequestBody> request_body(new ResourceRequestBody()); + request_body->AppendFileRange( + file_path, 0, std::numeric_limits<uint64_t>::max(), base::Time()); + set_request_body(std::move(request_body)); + + EXPECT_EQ(net::ERR_ACCESS_DENIED, Load(test_server()->GetURL("/echo"))); +} + +class CallbackSavingNetworkServiceClient : public TestNetworkServiceClient { + public: + void OnFileUploadRequested(uint32_t process_id, + bool async, + const std::vector<base::FilePath>& file_paths, + OnFileUploadRequestedCallback callback) override { + file_upload_requested_callback_ = std::move(callback); + if (quit_closure_for_on_file_upload_requested_) + quit_closure_for_on_file_upload_requested_.Run(); + } + + void RunUntilUploadRequested(OnFileUploadRequestedCallback* callback) { + if (!file_upload_requested_callback_) { + base::RunLoop run_loop; + quit_closure_for_on_file_upload_requested_ = run_loop.QuitClosure(); + run_loop.Run(); + quit_closure_for_on_file_upload_requested_.Reset(); + } + *callback = std::move(file_upload_requested_callback_); + } + + private: + base::Closure quit_closure_for_on_file_upload_requested_; + OnFileUploadRequestedCallback file_upload_requested_callback_; +}; + +TEST_F(URLLoaderTest, UploadFileCanceled) { + base::FilePath file_path = GetTestFilePath("simple_page.html"); + std::vector<base::File> opened_file; + opened_file.emplace_back(file_path, base::File::FLAG_OPEN | + base::File::FLAG_READ | + base::File::FLAG_ASYNC); + ASSERT_TRUE(opened_file.back().IsValid()); + + ResourceRequest request = + CreateResourceRequest("POST", test_server()->GetURL("/echo")); + request.request_body = new ResourceRequestBody(); + request.request_body->AppendFileRange( + file_path, 0, std::numeric_limits<uint64_t>::max(), base::Time()); + + base::RunLoop delete_run_loop; + mojom::URLLoaderPtr loader; + static mojom::URLLoaderFactoryParams params; + params.process_id = mojom::kBrowserProcessId; + params.is_corb_enabled = false; + auto network_service_client = + std::make_unique<CallbackSavingNetworkServiceClient>(); + std::unique_ptr<URLLoader> url_loader = std::make_unique<URLLoader>( + context(), network_service_client.get(), + DeleteLoaderCallback(&delete_run_loop, &url_loader), + mojo::MakeRequest(&loader), 0, request, false, + client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms, + 0 /* request_id */, resource_scheduler_client(), nullptr, + nullptr /* network_usage_accumulator */); + + mojom::NetworkServiceClient::OnFileUploadRequestedCallback callback; + network_service_client->RunUntilUploadRequested(&callback); + + // Check we can call the callback from a deleted URLLoader without crashing. + url_loader.reset(); + base::RunLoop().RunUntilIdle(); + std::move(callback).Run(net::OK, std::move(opened_file)); + base::RunLoop().RunUntilIdle(); +} + TEST_F(URLLoaderTest, UploadRawFile) { base::FilePath file_path = GetTestFilePath("simple_page.html");
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc index ee21ae4..fc90ab0 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc
@@ -67,7 +67,8 @@ CoordinatorImpl::CoordinatorImpl(service_manager::Connector* connector) : next_dump_id_(0), - client_process_timeout_(base::TimeDelta::FromSeconds(15)) { + client_process_timeout_(base::TimeDelta::FromSeconds(15)), + weak_ptr_factory_(this) { process_map_ = std::make_unique<ProcessMap>(connector); DCHECK(!g_coordinator_impl); g_coordinator_impl = this; @@ -217,7 +218,7 @@ in_progress_vm_region_requests_[dump_guid].get(); auto os_callback = base::BindRepeating(&CoordinatorImpl::OnOSMemoryDumpForVMRegions, - base::Unretained(this), dump_guid); + weak_ptr_factory_.GetWeakPtr(), dump_guid); QueuedRequestDispatcher::SetUpAndDispatchVmRegionRequest(request_ptr, clients, pids, os_callback); FinalizeVmRegionDumpIfAllManagersReplied(dump_guid); @@ -230,7 +231,7 @@ mojom::ClientProcess* client_process = client_process_ptr.get(); client_process_ptr.set_connection_error_handler( base::BindOnce(&CoordinatorImpl::UnregisterClientProcess, - base::Unretained(this), client_process)); + weak_ptr_factory_.GetWeakPtr(), client_process)); auto identity = GetClientIdentityForCurrentRequest(); auto client_info = std::make_unique<ClientInfo>( std::move(identity), std::move(client_process_ptr), process_type); @@ -278,7 +279,7 @@ FROM_HERE, base::BindOnce( &CoordinatorImpl::FinalizeVmRegionDumpIfAllManagersReplied, - base::Unretained(this), pair.second->dump_guid)); + weak_ptr_factory_.GetWeakPtr(), pair.second->dump_guid)); } size_t num_deleted = clients_.erase(client_process); @@ -383,17 +384,19 @@ clients.emplace_back(kv.second->client.get(), pid, kv.second->process_type); } - auto chrome_callback = base::Bind( - &CoordinatorImpl::OnChromeMemoryDumpResponse, base::Unretained(this)); - auto os_callback = base::Bind(&CoordinatorImpl::OnOSMemoryDumpResponse, - base::Unretained(this), request->dump_guid); + auto chrome_callback = + base::Bind(&CoordinatorImpl::OnChromeMemoryDumpResponse, + weak_ptr_factory_.GetWeakPtr()); + auto os_callback = + base::Bind(&CoordinatorImpl::OnOSMemoryDumpResponse, + weak_ptr_factory_.GetWeakPtr(), request->dump_guid); QueuedRequestDispatcher::SetUpAndDispatch(request, clients, chrome_callback, os_callback); base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&CoordinatorImpl::OnQueuedRequestTimedOut, - base::Unretained(this), request->dump_guid), + weak_ptr_factory_.GetWeakPtr(), request->dump_guid), client_process_timeout_); if (request->args.add_to_trace && heap_profiler_) { @@ -409,13 +412,14 @@ .IsArgumentFilterEnabled(); heap_profiler_->DumpProcessesForTracing( strip_path_from_mapped_files, - base::BindRepeating(&CoordinatorImpl::OnDumpProcessesForTracing, - base::Unretained(this), request->dump_guid)); + base::BindRepeating(&CoordinatorImpl::OnDumpProcessesForTracing, + weak_ptr_factory_.GetWeakPtr(), + request->dump_guid)); base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&CoordinatorImpl::OnHeapDumpTimeOut, - base::Unretained(this), request->dump_guid), + weak_ptr_factory_.GetWeakPtr(), request->dump_guid), kHeapDumpTimeout); } @@ -606,7 +610,7 @@ base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&CoordinatorImpl::PerformNextQueuedGlobalMemoryDump, - base::Unretained(this))); + weak_ptr_factory_.GetWeakPtr())); } }
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h index 3929175..04814d1d 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h
@@ -201,6 +201,7 @@ mojom::HeapProfilerPtr heap_profiler_; THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<CoordinatorImpl> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(CoordinatorImpl); };
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index ccd5a8d8..9e54e19 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -173,6 +173,32 @@ } ] }, + "test": "mojo_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-14.04", + "pool": "Chrome-CrOS-VM" + } + ] + }, + "test": "ozone_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-14.04", + "pool": "Chrome-CrOS-VM" + } + ] + }, "test": "pdf_unittests" }, {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 555b864..5ebce484 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -335,6 +335,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "angle_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "app_shell_unittests" }, { @@ -407,12 +413,24 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_app_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chromedriver_unittests" }, { "swarming": { "can_use_on_swarming_builders": true }, + "test": "components_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "components_unittests" }, { @@ -478,12 +496,24 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "device_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "display_unittests" }, { "swarming": { "can_use_on_swarming_builders": true }, + "test": "extensions_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "extensions_unittests" }, { @@ -508,6 +538,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gn_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "google_apis_unittests" }, { @@ -557,6 +593,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mac_installer_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "media_blink_unittests" }, { @@ -647,6 +689,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "services_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "shell_dialogs_unittests" }, { @@ -659,6 +707,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "snapshot_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "sql_unittests" }, { @@ -735,6 +789,13 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "telemetry_gpu_unittests", "name": "telemetry_gpu_unittests", "swarming": { @@ -2360,6 +2421,18 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "app_shell_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, + "test": "aura_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "base_unittests" }, { @@ -2466,6 +2539,12 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "chrome_elf_unittests" }, { @@ -2500,6 +2579,12 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "compositor_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "content_browsertests" }, { @@ -2669,6 +2754,12 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "install_static_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "installer_util_unittests" }, { @@ -2829,6 +2920,12 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "services_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "setup_unittests" }, { @@ -2925,6 +3022,12 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "wm_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" }, { @@ -4574,6 +4677,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "angle_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "app_shell_unittests" }, { @@ -4682,6 +4794,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_app_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chromedriver_unittests" }, { @@ -4691,6 +4812,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "components_browsertests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "components_unittests" }, { @@ -4777,6 +4907,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "device_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "display_unittests" }, { @@ -4786,6 +4925,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "extensions_browsertests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "extensions_unittests" }, { @@ -4822,6 +4970,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gn_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "google_apis_unittests" }, { @@ -4895,6 +5052,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mac_installer_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "media_blink_unittests" }, { @@ -5030,6 +5196,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "services_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "shell_dialogs_unittests" }, { @@ -5048,6 +5223,15 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "snapshot_unittests" + }, + { + "args": [ + "--enable-features=ViewsBrowserWindows" + ], + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "sql_unittests" }, {
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index f7dfaabb..cb4c14d 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -2236,6 +2236,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -2864,6 +2871,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": {
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index f322c1a..15f8e08 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -466,6 +466,13 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -1005,6 +1012,13 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -1995,6 +2009,19 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a2e", + "os": "Mac-10.12.6" + } + ] + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -2584,7 +2611,6 @@ } }, { - "experiment_percentage": 100, "isolate_name": "content_shell_crash_test", "name": "content_shell_crash_test", "swarming": { @@ -3121,6 +3147,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": {
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index 4ab8b7a..41214adf 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -1994,336 +1994,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.gpu_rasterization.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -2390,1062 +2060,6 @@ }, { "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build199-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -3512,270 +2126,6 @@ }, { "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build201-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "KOT49H", - "device_os_flavor": "google", - "device_type": "hammerhead", - "id": "build200-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -7227,336 +5577,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.gpu_rasterization.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -7623,1062 +5643,6 @@ }, { "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build211-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -8745,270 +5709,6 @@ }, { "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build213-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_flavor": "google", - "device_type": "bullhead", - "id": "build212-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -11378,171 +8078,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.gpu_rasterization.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -11576,534 +8111,6 @@ }, { "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build188-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.key_silk_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build188-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.pathological_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.simple_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build188-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build188-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -12137,138 +8144,6 @@ }, { "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build190-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "bullhead", - "id": "build189-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -13890,171 +9765,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.gpu_rasterization.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -14088,534 +9798,6 @@ }, { "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build202-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.key_silk_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build202-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.pathological_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.simple_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build202-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build202-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -14649,138 +9831,6 @@ }, { "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build204-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=android-webview", - "--output-format=histograms", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "MOB30K", - "device_os_flavor": "aosp", - "device_type": "shamu", - "id": "build203-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf-webview" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -17390,336 +12440,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.gpu_rasterization.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -17786,1062 +12506,6 @@ }, { "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_silk_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_silk_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device1", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.pathological_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.pathological_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.simple_mobile_sites", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.simple_mobile_sites.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.sync_scroll.key_mobile_sites_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.sync_scroll.key_mobile_sites_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build191-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device3", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device5", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "smoothness.tough_pinch_zoom_cases", "-v", "--upload-results", @@ -18908,270 +12572,6 @@ }, { "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device7", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device4", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build193-b7--device2", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=android-chromium", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "LMY47W", - "device_os_flavor": "google", - "device_type": "sprout", - "id": "build192-b7--device6", - "os": "Android", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -22429,1246 +15829,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build197-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build197-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build195-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build195-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build197-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build197-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build194-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build196-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build198-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build195-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build195-b7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -26409,1246 +18569,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build118-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build118-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build120-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build117-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build119-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build121-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build118-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912", - "id": "build118-a7", - "os": "Windows-10", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -30455,1246 +21375,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build205-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build205-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build203-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build203-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build205-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build205-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build202-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build204-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build206-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build203-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:1cb3", - "id": "build203-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results", @@ -34480,1246 +24160,6 @@ }, { "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "scheduler.tough_scheduling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "scheduler.tough_scheduling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.polymer", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.polymer.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build200-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build200-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.gpu_rasterization_and_decoding.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.image_decoding_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.image_decoding_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.key_desktop_move_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.key_desktop_move_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.maps", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.maps.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build198-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.top_25_smooth", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.top_25_smooth.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build198-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_animation_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_animation_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build200-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_canvas_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_canvas_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build200-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_filters_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_filters_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_image_decode_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_image_decode_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build197-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_path_rendering_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_path_rendering_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_scrolling_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_scrolling_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build199-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_texture_upload_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_texture_upload_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_ad_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_ad_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build201-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=histograms" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build198-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ - "smoothness.tough_webgl_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=histograms", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.tough_webgl_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build198-m7", - "os": "Windows-2008ServerR2-SP1", - "pool": "chrome.tests.perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 1200, - "upload_test_results": true - } - }, - { - "args": [ "speedometer", "-v", "--upload-results",
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index a28b929..560a50d 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -646,6 +646,13 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -1909,6 +1916,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -2601,6 +2615,13 @@ } }, { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": { @@ -3308,6 +3329,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "metrics_python_tests", "name": "metrics_python_tests", "swarming": {
diff --git a/testing/buildbot/client.v8.chromium.json b/testing/buildbot/client.v8.chromium.json index c1b8bfb..4d98e7c6 100644 --- a/testing/buildbot/client.v8.chromium.json +++ b/testing/buildbot/client.v8.chromium.json
@@ -480,6 +480,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "telemetry_gpu_unittests", "name": "telemetry_gpu_unittests", "swarming": {
diff --git a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter index 1aa1e64f..b75fb54 100644 --- a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
@@ -57,9 +57,10 @@ -ExtensionManagementTest.ExternalUrlUpdate -ExtensionManagementTest.PolicyOverridesUserInstall -# These try to resolver host names using ResourceContext, using the old +# These try to resolve host names using ResourceContext, using the old # in-process HostResolver API. Neither works when the network service is -# enabled, so they'll need to be moved over to a new API. +# enabled, so they'll need to be moved over to a new API. See +# pepper_host_resolver_message_filter.cc. # https://crubug.com/821021 -OutOfProcessPPAPITest.TCPServerSocketPrivate -OutOfProcessPPAPITest.TCPSocket @@ -71,12 +72,6 @@ -PPAPINaClPNaClNonSfiTest.TCPServerSocketPrivate -PPAPINaClPNaClNonSfiTest.TCPSocket -PPAPINaClPNaClNonSfiTest.TCPSocketPrivate -# This test fails flakily. Only enable it once -# SocketExtensionWithDnsLookupFunction::StartDnsLookup uses the Mojo -# HostResolver API. --SocketApiTest.SocketUDPExtension - -# Uncategorized PPAPI timeouts or test failures. -OutOfProcessPPAPITest.HostResolver -OutOfProcessPPAPITest.HostResolverPrivate_Resolve -OutOfProcessPPAPITest.HostResolverPrivate_ResolveIPv4 @@ -119,6 +114,10 @@ -PPAPINaClPNaClNonSfiTest.UDPSocket_SetOption_1_0 -PPAPINaClPNaClNonSfiTest.UDPSocket_SetOption_1_1 -PPAPINaClPNaClNonSfiTest.UDPSocketPrivate_Connect +# This test fails flakily. Only enable it once +# SocketExtensionWithDnsLookupFunction::StartDnsLookup uses the Mojo +# HostResolver API. +-SocketApiTest.SocketUDPExtension # These tests use URLFetchers directly. # https://crbug.com/853798 @@ -266,9 +265,13 @@ -ExtensionWebRequestApiTest.WebRequestTestOSDD # Note WebRequestUnloadImmediately is disabled on Linux -ExtensionWebRequestApiTest.WebRequestUnloadImmediately -# http://crbug.com/841827 + +# WebRequest implementation needs to handle extension +# installation/uninstallation events. +# http://crbug.com/857577 -BackgroundXhrTest.HttpAuth -BackgroundXhrTest.TlsClientAuth + # http://crbug.com/853733 -DeclarativeNetRequestBrowserTest.PageAllowingAPI_BrowserRequests/0
diff --git a/testing/buildbot/filters/surface_sync.content_browsertests.filter b/testing/buildbot/filters/surface_sync.content_browsertests.filter index f739bd2..dca9230 100644 --- a/testing/buildbot/filters/surface_sync.content_browsertests.filter +++ b/testing/buildbot/filters/surface_sync.content_browsertests.filter
@@ -5,7 +5,3 @@ # Flaky failures with incorrect Input event acks. https://crbug.com/855532 -TouchInputBrowserTest.TouchHandlerConsume -TouchInputBrowserTest.TouchHandlerNoConsume - -# TODO(fsamuel) triage consistent failure with relatively empty logs. -# https://crubg.com/855920 --ScrollLatencyBrowserTest.SmoothWheelScroll
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index c95193d..8c562ec 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -57,9 +57,6 @@ }, 'angle_unittests': { 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', # chromium.gpu.fyi # On Android, these are already run on the main waterfall. 'Android FYI Release (Nexus 5X)', @@ -72,18 +69,6 @@ }, }, }, - 'app_shell_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, - 'aura_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, 'base_unittests': { 'modifications': { # chromium.android @@ -386,19 +371,6 @@ 'Mac', ], }, - 'chrome_app_unittests': { - 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', - ], - }, - 'chrome_elf_import_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, 'chrome_public_test_apk': { 'remove_gtest_from': [ # chromium.android.fyi @@ -635,9 +607,6 @@ # chromium.chromiumos 'linux-chromeos-dbg', 'linux-chromeos-rel', - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', # On chromium.linux, unclear why these aren't run on the Cast bots. 'Cast Audio Linux', 'Cast Linux', @@ -736,12 +705,6 @@ }, }, }, - 'compositor_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, 'content_browsertests': { 'modifications': { # chromium.android @@ -897,35 +860,6 @@ 'Linux Chromium OS ASan LSan Tests (1)', ], }, - 'content_shell_crash_test': { - 'remove_from': [ - # chromium.fyi - 'Chromium Mac 10.13', - # On chromium.linux, unclear why these only run on "Linux Tests". - 'Linux Tests (dbg)(1)', - 'Linux Tests (dbg)(1)(32)', - # On chromium.mac, unclear why these only run on "Mac10.13 Tests". - 'Mac10.10 Tests', - 'Mac10.11 Tests', - 'Mac10.12 Tests', - 'Mac10.13 Tests (dbg)', - # crbug.com/846729 - re-enable when this passes reliably. - 'Win7 Tests (1)', - # On chromium.win, unclear why these only run on "Win7 Tests (1)". - 'Win 7 Tests x64 (1)', - 'Win10 Tests x64 (dbg)', - 'Win7 Tests (dbg)(1)', - # client.v8.chromium - 'Linux - Future (dbg)', - ], - 'modifications': { - 'Mac10.13 Tests': { - # Remove this once the tests is not flaky on Mac os 10.13 - # See crbug.com/813163 - 'experiment_percentage': 100, - }, - } - }, 'content_shell_test_apk': { 'remove_gtest_from': [ # chromium.android.fyi @@ -1103,9 +1037,6 @@ }, 'device_unittests': { 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', # chromium.win 'Win7 Tests (dbg)(1)', ], @@ -1166,9 +1097,6 @@ }, 'extensions_browsertests': { 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', # On chromium.mac, unclear why these aren't run. 'Mac10.10 Tests', 'Mac10.11 Tests', @@ -1378,13 +1306,6 @@ 'Linux ChromiumOS MSan Tests', ], }, - 'gn_unittests': { - 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', - ], - }, 'headless_browsertests': { 'remove_from': [ # chromium.clang @@ -1430,12 +1351,6 @@ 'Win V8 FYI Release (NVIDIA)', ], }, - 'install_static_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, 'interactive_ui_tests': { 'modifications': { # chromium.win @@ -1531,13 +1446,6 @@ 'Mojo ChromiumOS', ], }, - 'mac_installer_unittests': { - 'remove_from': [ - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', - ], - }, 'media_blink_unittests': { 'modifications': { 'Lollipop Tablet Tester': { @@ -1797,10 +1705,6 @@ # chromium.gpu.fyi # The face and barcode detection tests fail on the Mac Pros. 'Mac Pro FYI Release (AMD)', - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', - 'Win 10 Fast Ring', # On chromium.linux, unclear why these aren't run on Cast. 'Cast Audio Linux', 'Cast Linux', @@ -1969,9 +1873,6 @@ # chromium.chromiumos 'linux-chromeos-dbg', 'linux-chromeos-rel', - # chromium.fyi - 'mac-views-rel', - 'Chromium Mac 10.13', ], }, 'sql_unittests': { @@ -2980,10 +2881,4 @@ }, }, }, - 'wm_unittests': { - 'remove_from': [ - # chromium.fyi - 'Win 10 Fast Ring', - ], - }, }
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 9ed3c3e3..fc51931d 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -357,6 +357,8 @@ 'jingle_unittests': {}, 'latency_unittests': {}, 'midi_unittests': {}, + 'mojo_unittests': {}, + 'ozone_unittests': {}, 'pdf_unittests': {}, 'printing_unittests': {}, 'sql_unittests': {},
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index e9cc20f..58c9505 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -69,7 +69,6 @@ crbug.com/591099 compositing/squashing/add-remove-squashed-layers.html [ Failure ] crbug.com/591099 css1/box_properties/float_on_text_elements.html [ Failure ] crbug.com/591099 css1/classification/list_style_image.html [ Failure ] -crbug.com/591099 css2.1/t0510-c25-pseudo-elmnt-00-c.html [ Failure ] crbug.com/591099 css2.1/t1202-counter-04-b.html [ Failure ] crbug.com/591099 css2.1/t1202-counters-04-b.html [ Failure ] crbug.com/591099 css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html [ Failure ] @@ -546,7 +545,6 @@ crbug.com/591099 fast/dom/HTMLAreaElement/area-download.html [ Failure ] crbug.com/714962 fast/dom/Range/getBoundingClientRect-linebreak-character.html [ Failure ] crbug.com/591099 fast/dom/Window/window-lookup-precedence.html [ Failure ] -crbug.com/714962 fast/dom/elementFromPoint-relative-to-viewport.html [ Failure ] crbug.com/591099 fast/dom/nodesFromRect/nodesFromRect-basic.html [ Failure ] crbug.com/591099 fast/dynamic/first-letter-after-list-marker.html [ Failure ] crbug.com/591099 fast/dynamic/text-combine.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 5cd1f04..0085ce5 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -4729,7 +4729,8 @@ # Sheriff 2018-06-28 crbug.com/857414 [ Win Mac10.10 Mac10.11 ] http/tests/devtools/sources/debugger-breakpoints/event-listener-breakpoints-webaudio.js [ Pass Timeout ] -crbug.com/857520 [ Mac Win7 ] external/wpt/accelerometer/Accelerometer-iframe-access.https.html [ Failure ] +crbug.com/857520 [ Mac Win ] external/wpt/accelerometer/Accelerometer-iframe-access.https.html [ Failure ] # Sheriff 2018-06-29 crbug.com/859064 [ Mac10.13 ] http/tests/devtools/console-resource-errors.js [ Failure ] +crbug.com/859169 [ Win7 ] http/tests/devtools/layers/layer-scroll-rects-get.js [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index ffde73b..a103957 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -111434,6 +111434,11 @@ {} ] ], + "css/css-box/META.yml": [ + [ + {} + ] + ], "css/css-box/parsing/min-height-invalid-expected.txt": [ [ {} @@ -160029,6 +160034,16 @@ {} ] ], + "payment-handler/idlharness.https.any-expected.txt": [ + [ + {} + ] + ], + "payment-handler/idlharness.https.any.worker-expected.txt": [ + [ + {} + ] + ], "payment-handler/interfaces.https.any-expected.txt": [ [ {} @@ -236263,6 +236278,16 @@ {} ] ], + "payment-handler/idlharness.https.any.js": [ + [ + "/payment-handler/idlharness.https.any.html", + {} + ], + [ + "/payment-handler/idlharness.https.any.worker.html", + {} + ] + ], "payment-handler/interfaces.https.any.js": [ [ "/payment-handler/interfaces.https.any.html", @@ -296500,6 +296525,10 @@ "ceb5773fc9d6264d1f9210d8675b7bf48764d296", "reftest" ], + "css/css-box/META.yml": [ + "0c04c53f67a7543645b3c0cc46980a8cff69fb6b", + "support" + ], "css/css-box/parsing/clear-invalid.html": [ "ee593f2639cdfb9a26edad7eb5de002e4d077850", "testharness" @@ -375513,7 +375542,7 @@ "support" ], "interfaces/payment-handler.idl": [ - "6d9157e515e419c7a2fffc61a1f8e3b23a4550ba", + "c47c18345c06d87b7b9fe318b22d51413603f626", "support" ], "interfaces/payment-request.idl": [ @@ -385696,8 +385725,20 @@ "7a361f57439425d5ec5c583ad363d9acf9fa7e1d", "testharness" ], + "payment-handler/idlharness.https.any-expected.txt": [ + "afb19c408478dd57eff3f2eff6c29b71e268dee0", + "support" + ], + "payment-handler/idlharness.https.any.js": [ + "8e4dd8217ba62a2078813c1d73b187725bcfe4d8", + "testharness" + ], + "payment-handler/idlharness.https.any.worker-expected.txt": [ + "6225a7115ac0393c27c63058cf4cab44ee7e0f90", + "support" + ], "payment-handler/interfaces.https.any-expected.txt": [ - "9cdc2a2ce98bf6b06ff7c4816f30d00c2add7b0f", + "1a4bb9030ae8d70762a8abd8bb859dd93f21dd64", "support" ], "payment-handler/interfaces.https.any.js": [ @@ -385705,7 +385746,7 @@ "testharness" ], "payment-handler/interfaces.https.any.worker-expected.txt": [ - "3b98367c319505acf40aa79361394c0585d11a02", + "36037373a50c453de3a560f7268b73212e83fc1b", "support" ], "payment-handler/manifest.json": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-box/META.yml b/third_party/WebKit/LayoutTests/external/wpt/css/css-box/META.yml new file mode 100644 index 0000000..fac979a5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-box/META.yml
@@ -0,0 +1,4 @@ +suggested_reviewers: + - dbaron + - dholbert + - mstensho
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-logical/logical-box-border-shorthands-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/css-logical/logical-box-border-shorthands-expected.txt index c89bcbb..be33641 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-logical/logical-box-border-shorthands-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-logical/logical-box-border-shorthands-expected.txt
@@ -1,34 +1,34 @@ This is a testharness.js-based test. -FAIL Test that logical border-* properties are supported. assert_equals: logical properties in inline style, border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: horizontal-tb; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: horizontal-tb; direction: ltr; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: horizontal-tb; direction: ltr; ', border-left expected "5px groove rgb(5, 5, 5)" but got "1px solid rgb(1, 1, 1)" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: horizontal-tb; direction: ltr; ', border-left expected "5px groove rgb(5, 5, 5)" but got "1px solid rgb(1, 1, 1)" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: horizontal-tb; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: horizontal-tb; direction: rtl; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: horizontal-tb; direction: rtl; ', border-inline-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: horizontal-tb; direction: rtl; ', border-inline-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-rl; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: vertical-rl; direction: rtl; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: vertical-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: vertical-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-rl; direction: rtl; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-rl; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: vertical-rl; direction: ltr; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: vertical-rl; direction: ltr; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: vertical-rl; direction: ltr; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-rl; direction: ltr; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-rl; direction: ltr; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-rl; direction: ltr; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-lr; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: vertical-lr; direction: rtl; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: vertical-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: vertical-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-lr; direction: ltr; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-lr; direction: ltr; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-lr; direction: ltr; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-lr; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: vertical-lr; direction: ltr; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: vertical-lr; direction: ltr; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: vertical-lr; direction: ltr; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-lr; direction: rtl; ', border-inline-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" -FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "" +PASS Test that logical border-* properties are supported. +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: horizontal-tb; direction: ltr; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: ltr; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: ltr; '. +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: horizontal-tb; direction: rtl; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: rtl; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: horizontal-tb; direction: rtl; '. +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-rl; direction: rtl; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: rtl; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: rtl; '. +FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-rl; direction: rtl; ', border-bottom expected "1px solid rgb(1, 1, 1)" but got "4px double rgb(4, 4, 4)" +FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "4px double rgb(4, 4, 4)" +FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-rl; direction: rtl; ', border-block-end expected "1px solid rgb(1, 1, 1)" but got "4px double rgb(4, 4, 4)" +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-rl; direction: ltr; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: ltr; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-rl; direction: ltr; '. +FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-rl; direction: ltr; ', border-top expected "1px solid rgb(1, 1, 1)" but got "3px dotted rgb(3, 3, 3)" +FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-rl; direction: ltr; ', border-left expected "1px solid rgb(1, 1, 1)" but got "5px groove rgb(5, 5, 5)" +FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-rl; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-rl; direction: ltr; ', border-left expected "1px solid rgb(1, 1, 1)" but got "5px groove rgb(5, 5, 5)" +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-lr; direction: rtl; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: rtl; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: rtl; '. +FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-lr; direction: ltr; ', border-bottom expected "1px solid rgb(1, 1, 1)" but got "4px double rgb(4, 4, 4)" +FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-lr; direction: ltr; ', border-left expected "1px solid rgb(1, 1, 1)" but got "5px groove rgb(5, 5, 5)" +FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: ltr; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-lr; direction: ltr; ', border-left expected "1px solid rgb(1, 1, 1)" but got "5px groove rgb(5, 5, 5)" +PASS Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: vertical-lr; direction: ltr; '. +PASS Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: ltr; '. +PASS Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: vertical-lr; direction: ltr; '. +FAIL Test that logical border-* properties share computed values with their physical associates, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: logical properties on one declaration, writing mode properties on another, 'writing-mode: sideways-lr; direction: rtl; ', border-top expected "1px solid rgb(1, 1, 1)" but got "3px dotted rgb(3, 3, 3)" +FAIL Test that border-* properties honor order of appearance when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: 'border-inline-start' last on single declaration, 'writing-mode: sideways-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "3px dotted rgb(3, 3, 3)" +FAIL Test that border-* properties honor selector specificty when both logical and physical associates are declared, with 'writing-mode: sideways-lr; direction: rtl; '. assert_equals: 'border-inline-start', two declarations, 'writing-mode: sideways-lr; direction: rtl; ', border-block-start expected "1px solid rgb(1, 1, 1)" but got "3px dotted rgb(3, 3, 3)" Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/interfaces/payment-handler.idl b/third_party/WebKit/LayoutTests/external/wpt/interfaces/payment-handler.idl index ec42e21..e14a54b 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/interfaces/payment-handler.idl +++ b/third_party/WebKit/LayoutTests/external/wpt/interfaces/payment-handler.idl
@@ -1,15 +1,25 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content of this file was automatically extracted from the +// "Payment Handler API" spec. +// See: https://w3c.github.io/payment-handler/ + +partial interface ServiceWorkerRegistration { + [SameObject] + readonly attribute PaymentManager paymentManager; +}; [SecureContext, Exposed=(Window,Worker)] interface PaymentManager { [SameObject] readonly attribute PaymentInstruments instruments; [Exposed=Window] static Promise<PermissionState> requestPermission(); + attribute DOMString userHint; }; [SecureContext, Exposed=(Window,Worker)] interface PaymentInstruments { Promise<boolean> delete(DOMString instrumentKey); - Promise<PaymentInstrument> get(DOMString instrumentKey); + Promise<any> get(DOMString instrumentKey); Promise<sequence<DOMString>> keys(); Promise<boolean> has(DOMString instrumentKey); Promise<void> set(DOMString instrumentKey, @@ -27,25 +37,31 @@ DOMString sizes; DOMString type; }; +partial interface ServiceWorkerGlobalScope { + attribute EventHandler oncanmakepayment; +}; [Constructor(DOMString type, CanMakePaymentEventInit eventInitDict), Exposed=ServiceWorker] interface CanMakePaymentEvent : ExtendableEvent { - readonly attribute USVString topLevelOrigin; + readonly attribute USVString topOrigin; readonly attribute USVString paymentRequestOrigin; readonly attribute FrozenArray<PaymentMethodData> methodData; readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; void respondWith(Promise<boolean> canMakePaymentResponse); }; dictionary CanMakePaymentEventInit : ExtendableEventInit { - USVString topLevelOrigin; + USVString topOrigin; USVString paymentRequestOrigin; sequence<PaymentMethodData> methodData; sequence<PaymentDetailsModifier> modifiers; }; +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onpaymentrequest; +}; [Constructor(DOMString type, PaymentRequestEventInit eventInitDict), Exposed=ServiceWorker] interface PaymentRequestEvent : ExtendableEvent { - readonly attribute USVString topLevelOrigin; + readonly attribute USVString topOrigin; readonly attribute USVString paymentRequestOrigin; readonly attribute DOMString paymentRequestId; readonly attribute FrozenArray<PaymentMethodData> methodData; @@ -53,10 +69,10 @@ readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; readonly attribute DOMString instrumentKey; Promise<WindowClient?> openWindow(USVString url); - void respondWith(Promise<PaymentHandlerResponse> handlerResponse); + void respondWith(Promise<PaymentHandlerResponse> handlerResponsePromise); }; dictionary PaymentRequestEventInit : ExtendableEventInit { - USVString topLevelOrigin; + USVString topOrigin; USVString paymentRequestOrigin; DOMString paymentRequestId; sequence<PaymentMethodData> methodData;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any-expected.txt new file mode 100644 index 0000000..466143b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any-expected.txt
@@ -0,0 +1,44 @@ +This is a testharness.js-based test. +PASS payment-handler interfaces. +PASS Partial interface ServiceWorkerRegistration: original interface defined +PASS Partial interface ServiceWorkerGlobalScope: original interface defined +PASS Partial interface ServiceWorkerGlobalScope[2]: original interface defined +PASS PaymentManager interface: existence and properties of interface object +PASS PaymentManager interface object length +PASS PaymentManager interface object name +PASS PaymentManager interface: existence and properties of interface prototype object +PASS PaymentManager interface: existence and properties of interface prototype object's "constructor" property +PASS PaymentManager interface: existence and properties of interface prototype object's @@unscopables property +PASS PaymentManager interface: attribute instruments +PASS Unscopable handled correctly for instruments property on PaymentManager +FAIL PaymentManager interface: operation requestPermission() assert_own_property: interface object missing static operation expected property "requestPermission" missing +PASS Unscopable handled correctly for requestPermission() on PaymentManager +PASS PaymentManager interface: attribute userHint +PASS Unscopable handled correctly for userHint property on PaymentManager +PASS PaymentInstruments interface: existence and properties of interface object +PASS PaymentInstruments interface object length +PASS PaymentInstruments interface object name +PASS PaymentInstruments interface: existence and properties of interface prototype object +PASS PaymentInstruments interface: existence and properties of interface prototype object's "constructor" property +PASS PaymentInstruments interface: existence and properties of interface prototype object's @@unscopables property +PASS PaymentInstruments interface: operation delete(DOMString) +PASS Unscopable handled correctly for delete(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation get(DOMString) +PASS Unscopable handled correctly for get(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation keys() +PASS Unscopable handled correctly for keys() on PaymentInstruments +PASS PaymentInstruments interface: operation has(DOMString) +PASS Unscopable handled correctly for has(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation set(DOMString, PaymentInstrument) +PASS Unscopable handled correctly for set(DOMString, PaymentInstrument) on PaymentInstruments +PASS PaymentInstruments interface: operation clear() +PASS Unscopable handled correctly for clear() on PaymentInstruments +PASS CanMakePaymentEvent interface: existence and properties of interface object +PASS PaymentRequestEvent interface: existence and properties of interface object +PASS ServiceWorkerRegistration interface: attribute paymentManager +PASS Unscopable handled correctly for paymentManager property on ServiceWorkerRegistration +PASS ServiceWorkerGlobalScope interface: existence and properties of interface object +PASS ExtendableEvent interface: existence and properties of interface object +PASS WorkerGlobalScope interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.js b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.js new file mode 100644 index 0000000..049c3f4e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.js
@@ -0,0 +1,19 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/payment-handler/ + +promise_test(async () => { + const srcs = ['payment-handler', 'ServiceWorker', 'dedicated-workers', 'dom']; + const [idl, sw, dw, dom] = await Promise.all( + srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + + const idlArray = new IdlArray(); + idlArray.add_idls(idl); + idlArray.add_dependency_idls(sw); + idlArray.add_dependency_idls(dw); + idlArray.add_dependency_idls(dom); + idlArray.test(); +}, 'payment-handler interfaces.');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.worker-expected.txt new file mode 100644 index 0000000..c973e01c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/idlharness.https.any.worker-expected.txt
@@ -0,0 +1,42 @@ +This is a testharness.js-based test. +PASS payment-handler interfaces. +PASS Partial interface ServiceWorkerRegistration: original interface defined +PASS Partial interface ServiceWorkerGlobalScope: original interface defined +PASS Partial interface ServiceWorkerGlobalScope[2]: original interface defined +FAIL PaymentManager interface: existence and properties of interface object assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface object length assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface object name assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +FAIL PaymentManager interface: attribute instruments assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +PASS Unscopable handled correctly for instruments property on PaymentManager +FAIL PaymentManager interface: member requestPermission Cannot use 'in' operator to search for 'requestPermission' in undefined +FAIL PaymentManager interface: attribute userHint assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +PASS Unscopable handled correctly for userHint property on PaymentManager +PASS PaymentInstruments interface: existence and properties of interface object +PASS PaymentInstruments interface object length +PASS PaymentInstruments interface object name +PASS PaymentInstruments interface: existence and properties of interface prototype object +PASS PaymentInstruments interface: existence and properties of interface prototype object's "constructor" property +PASS PaymentInstruments interface: existence and properties of interface prototype object's @@unscopables property +PASS PaymentInstruments interface: operation delete(DOMString) +PASS Unscopable handled correctly for delete(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation get(DOMString) +PASS Unscopable handled correctly for get(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation keys() +PASS Unscopable handled correctly for keys() on PaymentInstruments +PASS PaymentInstruments interface: operation has(DOMString) +PASS Unscopable handled correctly for has(DOMString) on PaymentInstruments +PASS PaymentInstruments interface: operation set(DOMString, PaymentInstrument) +PASS Unscopable handled correctly for set(DOMString, PaymentInstrument) on PaymentInstruments +PASS PaymentInstruments interface: operation clear() +PASS Unscopable handled correctly for clear() on PaymentInstruments +PASS CanMakePaymentEvent interface: existence and properties of interface object +PASS PaymentRequestEvent interface: existence and properties of interface object +PASS ServiceWorkerRegistration interface: attribute paymentManager +PASS Unscopable handled correctly for paymentManager property on ServiceWorkerRegistration +PASS ServiceWorkerGlobalScope interface: existence and properties of interface object +PASS ExtendableEvent interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any-expected.txt index face3c1..8ad3a4c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any-expected.txt
@@ -1,5 +1,8 @@ This is a testharness.js-based test. PASS Payment handler interfaces. +FAIL Partial interface ServiceWorkerRegistration: original interface defined assert_true: Original interface should be defined expected true got false +FAIL Partial interface ServiceWorkerGlobalScope: original interface defined assert_true: Original interface should be defined expected true got false +FAIL Partial interface ServiceWorkerGlobalScope[2]: original interface defined assert_true: Original interface should be defined expected true got false PASS PaymentManager interface: existence and properties of interface object PASS PaymentManager interface object length PASS PaymentManager interface object name @@ -10,6 +13,8 @@ PASS Unscopable handled correctly for instruments property on PaymentManager FAIL PaymentManager interface: operation requestPermission() assert_own_property: interface object missing static operation expected property "requestPermission" missing PASS Unscopable handled correctly for requestPermission() on PaymentManager +PASS PaymentManager interface: attribute userHint +PASS Unscopable handled correctly for userHint property on PaymentManager PASS PaymentInstruments interface: existence and properties of interface object PASS PaymentInstruments interface object length PASS PaymentInstruments interface object name
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any.worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any.worker-expected.txt index 49c3855..348837a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any.worker-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/interfaces.https.any.worker-expected.txt
@@ -1,5 +1,8 @@ This is a testharness.js-based test. PASS Payment handler interfaces. +FAIL Partial interface ServiceWorkerRegistration: original interface defined assert_true: Original interface should be defined expected true got false +FAIL Partial interface ServiceWorkerGlobalScope: original interface defined assert_true: Original interface should be defined expected true got false +FAIL Partial interface ServiceWorkerGlobalScope[2]: original interface defined assert_true: Original interface should be defined expected true got false FAIL PaymentManager interface: existence and properties of interface object assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing FAIL PaymentManager interface object length assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing FAIL PaymentManager interface object name assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing @@ -9,6 +12,8 @@ FAIL PaymentManager interface: attribute instruments assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing PASS Unscopable handled correctly for instruments property on PaymentManager FAIL PaymentManager interface: member requestPermission Cannot use 'in' operator to search for 'requestPermission' in undefined +FAIL PaymentManager interface: attribute userHint assert_own_property: self does not have own property "PaymentManager" expected property "PaymentManager" missing +PASS Unscopable handled correctly for userHint property on PaymentManager PASS PaymentInstruments interface: existence and properties of interface object PASS PaymentInstruments interface object length PASS PaymentInstruments interface object name
diff --git a/third_party/WebKit/LayoutTests/fast/events/drag-on-mouse-move-cancelled.html b/third_party/WebKit/LayoutTests/fast/events/drag-on-mouse-move-cancelled.html new file mode 100644 index 0000000..24c5de3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/drag-on-mouse-move-cancelled.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<p id="text"> +TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT +</p> +<script> + var testElem = document.getElementById("text"); + testElem.addEventListener("mousemove", function(event) { + event.preventDefault(); + }, false); + + var testCancelledMouseMoveSelect = async_test('Tests whether cancelled mousemove can start text selection.'); + + if (window.chrome && chrome.gpuBenchmarking) { + var rect = testElem.getBoundingClientRect(); + var text_x = rect.left; + var text_y = rect.top + rect.height / 2; + + var pointerActions = + [{source: "mouse", + actions: [ + { name: "pointerDown", x: text_x + 10, y: text_y }, + { name: "pointerMove", x: text_x + 50, y: text_y }, + { name: "pointerMove", x: text_x + 150, y: text_y }, + { name: "pointerMove", x: text_x + 200, y: text_y }, + { name: "pointerUp" }]}]; + chrome.gpuBenchmarking.pointerActionSequence(pointerActions, () => { + testCancelledMouseMoveSelect.step(function() { + assert_greater_than(window.getSelection().toString().length, 0); + }) + testCancelledMouseMoveSelect.done(); + }); + + } +</script> +
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css2.1/t0510-c25-pseudo-elmnt-00-c-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css2.1/t0510-c25-pseudo-elmnt-00-c-expected.txt new file mode 100644 index 0000000..2832e79 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css2.1/t0510-c25-pseudo-elmnt-00-c-expected.txt
@@ -0,0 +1,16 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x116 + LayoutNGBlockFlow {HTML} at (0,0) size 800x116 + LayoutNGBlockFlow {BODY} at (8,8) size 784x92 + LayoutNGBlockFlow {DIV} at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 253x19 + text run at (0,0) width 253: "There should be two lines of text below." + LayoutNGBlockFlow {P} at (0,36) size 784x20 [color=#FF0000] + LayoutInline (anonymous) at (0,0) size 222x19 + LayoutText {#text} at (0,0) size 222x19 + text run at (0,0) width 222: "This line should be white on green." + LayoutNGBlockFlow {P} at (0,72) size 784x20 [color=#FF0000] + LayoutInline (anonymous) at (0,0) size 222x19 + LayoutText {#text} at (0,0) size 222x19 + text run at (0,0) width 222: "This line should be white on green."
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/html/css3-modsel-179a-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/html/css3-modsel-179a-expected.txt index 2c5b632..e835e22 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/html/css3-modsel-179a-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/html/css3-modsel-179a-expected.txt
@@ -5,6 +5,6 @@ LayoutNGBlockFlow {BODY} at (8,16) size 784x96 LayoutNGBlockFlow {P} at (0,0) size 784x96 [color=#008000] LayoutInline (anonymous) at (0,0) size 163x19 - LayoutBR {BR} at (0,44) size 0x0 + LayoutBR {BR} at (0,1) size 0x0 LayoutText {#text} at (0,76) size 163x19 text run at (0,76) width 163: "This line should be green."
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xhtml/css3-modsel-179a-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xhtml/css3-modsel-179a-expected.txt index e8910d1..355c0ae 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xhtml/css3-modsel-179a-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xhtml/css3-modsel-179a-expected.txt
@@ -5,6 +5,6 @@ LayoutNGBlockFlow {body} at (8,16) size 784x96 LayoutNGBlockFlow {p} at (0,0) size 784x96 [color=#008000] LayoutInline (anonymous) at (0,0) size 163x19 - LayoutBR {br} at (0,44) size 0x0 + LayoutBR {br} at (0,1) size 0x0 LayoutText {#text} at (0,76) size 163x19 text run at (0,76) width 163: "This line should be green."
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xml/css3-modsel-179a-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xml/css3-modsel-179a-expected.txt index 4ef9c98e..e2bbd7c64 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xml/css3-modsel-179a-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/css3/selectors3/xml/css3-modsel-179a-expected.txt
@@ -4,6 +4,6 @@ LayoutNGBlockFlow {test} at (0,0) size 800x128 LayoutNGBlockFlow {p} at (0,16) size 800x96 [color=#008000] LayoutInline (anonymous) at (0,0) size 163x19 - LayoutBR {br} at (0,44) size 0x0 + LayoutBR {br} at (0,1) size 0x0 LayoutText {#text} at (0,76) size 163x19 text run at (0,76) width 163: "This line should be green."
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-absolute-child-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-absolute-child-expected.txt index 967eef9..d99eb0e2 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-absolute-child-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-absolute-child-expected.txt
@@ -7,7 +7,7 @@ "backgroundColor": "#FFFFFF", "paintInvalidations": [ { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [135, 127, 400, 50], "reason": "paint property change" }, @@ -22,7 +22,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [58, 50, 204, 204], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-relative-position-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-relative-position-expected.txt index 3c41809..5a8b4d00 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-relative-position-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/position/transform-relative-position-expected.txt
@@ -12,7 +12,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [108, 152, 202, 202], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/transform/transform-replaced-shadows-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/transform/transform-replaced-shadows-expected.txt index d97ef9e..701b881 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/transform/transform-replaced-shadows-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/transform/transform-replaced-shadows-expected.txt
@@ -7,7 +7,7 @@ "backgroundColor": "#FFFFFF", "paintInvalidations": [ { - "object": "LayoutImage IMG id='box'", + "object": "LayoutImage IMG id='box' class='smaller'", "rect": [0, 28, 266, 278], "reason": "paint property change" },
diff --git a/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash-expected.txt new file mode 100644 index 0000000..e0c78e74 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash-expected.txt
@@ -0,0 +1,2 @@ +Blocked access to external URL http://www.example.org/ +Test passes if it does not crash.
diff --git a/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash.html b/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash.html new file mode 100644 index 0000000..0f09c95 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/object/remote-frame-crash.html
@@ -0,0 +1,14 @@ +<!doctype HTML> +<object style="all: inherit;" id="target" data="http://www.example.org/"/> +Test passes if it does not crash. +<script> +if (window.testRunner) { + window.testRunner.waitUntilDone(); + window.testRunner.dumpAsText(); +} +function go() { + target.setAttribute("classid", "test"); + window.testRunner.notifyDone(); +} +requestAnimationFrame(() => requestAnimationFrame(go)); +</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/position/fixed-scale-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/position/fixed-scale-expected.txt index bf80e83..4da7dc9 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/position/fixed-scale-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/position/fixed-scale-expected.txt
@@ -23,7 +23,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (positioned) DIV id='t' class='green'", + "object": "LayoutBlockFlow (positioned) DIV id='t' class='green translated'", "rect": [125, 325, 50, 50], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-child-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-child-expected.txt index 08f3a5f..7aa0dfce 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-child-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-child-expected.txt
@@ -18,7 +18,7 @@ "backgroundColor": "#FFFFFF", "paintInvalidations": [ { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [135, 127, 400, 50], "reason": "paint property change" }, @@ -33,7 +33,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [58, 50, 204, 204], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt similarity index 96% rename from third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt rename to third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt index 00b6d90..725cd953 100644 --- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt
@@ -23,7 +23,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [118, 232, 202, 202], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-relative-position-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-relative-position-expected.txt similarity index 96% rename from third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-relative-position-expected.txt rename to third_party/WebKit/LayoutTests/paint/invalidation/position/transform-relative-position-expected.txt index 305da3e..92106c83 100644 --- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/position/transform-relative-position-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/position/transform-relative-position-expected.txt
@@ -23,7 +23,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [108, 152, 202, 202], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt index bcb53375..9f740a1 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt
@@ -35,7 +35,7 @@ { "object": "LayoutSVGRect rect id='filtered'", "rect": [140, 100, 36, 36], - "reason": "style change" + "reason": "appeared" }, { "object": "LayoutSVGContainer g",
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/transform/transform-replaced-shadows-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/transform/transform-replaced-shadows-expected.txt index 631b587..8361ae35 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/transform/transform-replaced-shadows-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/transform/transform-replaced-shadows-expected.txt
@@ -18,7 +18,7 @@ "backgroundColor": "#FFFFFF", "paintInvalidations": [ { - "object": "LayoutImage IMG id='box'", + "object": "LayoutImage IMG id='box' class='smaller'", "rect": [0, 28, 266, 278], "reason": "paint property change" },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt index 280aef3..803f7db8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-absolute-in-positioned-container-expected.txt
@@ -23,7 +23,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [118, 228, 202, 202], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-relative-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-relative-position-expected.txt index c2e9e3e..53c373a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-relative-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/position/transform-relative-position-expected.txt
@@ -23,7 +23,7 @@ "reason": "paint property change" }, { - "object": "LayoutBlockFlow (relative positioned) DIV id='box'", + "object": "LayoutBlockFlow (relative positioned) DIV id='box' class='rotated'", "rect": [108, 150, 202, 202], "reason": "paint property change" }
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt index f55ad8c..412866d 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt
@@ -32,9 +32,11 @@ baselineShift blockSize border +borderBlockEnd borderBlockEndColor borderBlockEndStyle borderBlockEndWidth +borderBlockStart borderBlockStartColor borderBlockStartStyle borderBlockStartWidth @@ -52,9 +54,11 @@ borderImageSlice borderImageSource borderImageWidth +borderInlineEnd borderInlineEndColor borderInlineEndStyle borderInlineEndWidth +borderInlineStart borderInlineStartColor borderInlineStartStyle borderInlineStartWidth
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-property-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-property-listing-expected.txt index de490e9..f67af1f 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-property-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-property-listing-expected.txt
@@ -359,22 +359,6 @@ zoom [SHORTHANDS] - -webkit-border-after - border-block-end-color - border-block-end-style - border-block-end-width - -webkit-border-before - border-block-start-color - border-block-start-style - border-block-start-width - -webkit-border-end - border-inline-end-color - border-inline-end-style - border-inline-end-width - -webkit-border-start - border-inline-start-color - border-inline-start-style - border-inline-start-width -webkit-column-break-after break-after -webkit-column-break-before @@ -455,6 +439,14 @@ border-top-color border-top-style border-top-width + border-block-end + border-block-end-color + border-block-end-style + border-block-end-width + border-block-start + border-block-start-color + border-block-start-style + border-block-start-width border-bottom border-bottom-color border-bottom-style @@ -470,6 +462,14 @@ border-image-slice border-image-source border-image-width + border-inline-end + border-inline-end-color + border-inline-end-style + border-inline-end-width + border-inline-start + border-inline-start-color + border-inline-start-style + border-inline-start-width border-left border-left-color border-left-style @@ -692,12 +692,16 @@ background-origin -webkit-background-size background-size + -webkit-border-after + border-block-end -webkit-border-after-color border-block-end-color -webkit-border-after-style border-block-end-style -webkit-border-after-width border-block-end-width + -webkit-border-before + border-block-start -webkit-border-before-color border-block-start-color -webkit-border-before-style @@ -708,6 +712,8 @@ border-bottom-left-radius -webkit-border-bottom-right-radius border-bottom-right-radius + -webkit-border-end + border-inline-end -webkit-border-end-color border-inline-end-color -webkit-border-end-style @@ -716,6 +722,8 @@ border-inline-end-width -webkit-border-radius border-radius + -webkit-border-start + border-inline-start -webkit-border-start-color border-inline-start-color -webkit-border-start-style
diff --git a/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt b/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt index 31a8426..a32a51fb 100644 --- a/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt
@@ -33,9 +33,11 @@ baselineShift blockSize border +borderBlockEnd borderBlockEndColor borderBlockEndStyle borderBlockEndWidth +borderBlockStart borderBlockStartColor borderBlockStartStyle borderBlockStartWidth @@ -53,9 +55,11 @@ borderImageSlice borderImageSource borderImageWidth +borderInlineEnd borderInlineEndColor borderInlineEndStyle borderInlineEndWidth +borderInlineStart borderInlineStartColor borderInlineStartStyle borderInlineStartWidth
diff --git a/third_party/WebKit/LayoutTests/webexposed/css-property-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/css-property-listing-expected.txt index 0ad911c0..21f978e1 100644 --- a/third_party/WebKit/LayoutTests/webexposed/css-property-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/css-property-listing-expected.txt
@@ -370,22 +370,6 @@ zoom [SHORTHANDS] - -webkit-border-after - border-block-end-color - border-block-end-style - border-block-end-width - -webkit-border-before - border-block-start-color - border-block-start-style - border-block-start-width - -webkit-border-end - border-inline-end-color - border-inline-end-style - border-inline-end-width - -webkit-border-start - border-inline-start-color - border-inline-start-style - border-inline-start-width -webkit-column-break-after break-after -webkit-column-break-before @@ -466,6 +450,14 @@ border-top-color border-top-style border-top-width + border-block-end + border-block-end-color + border-block-end-style + border-block-end-width + border-block-start + border-block-start-color + border-block-start-style + border-block-start-width border-bottom border-bottom-color border-bottom-style @@ -481,6 +473,14 @@ border-image-slice border-image-source border-image-width + border-inline-end + border-inline-end-color + border-inline-end-style + border-inline-end-width + border-inline-start + border-inline-start-color + border-inline-start-style + border-inline-start-width border-left border-left-color border-left-style @@ -705,12 +705,16 @@ background-origin -webkit-background-size background-size + -webkit-border-after + border-block-end -webkit-border-after-color border-block-end-color -webkit-border-after-style border-block-end-style -webkit-border-after-width border-block-end-width + -webkit-border-before + border-block-start -webkit-border-before-color border-block-start-color -webkit-border-before-style @@ -721,6 +725,8 @@ border-bottom-left-radius -webkit-border-bottom-right-radius border-bottom-right-radius + -webkit-border-end + border-inline-end -webkit-border-end-color border-inline-end-color -webkit-border-end-style @@ -729,6 +735,8 @@ border-inline-end-width -webkit-border-radius border-radius + -webkit-border-start + border-inline-start -webkit-border-start-color border-inline-start-color -webkit-border-start-style
diff --git a/third_party/blink/public/mojom/use_counter/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/css_property_id.mojom index b1ffdd4..13a6afe 100644 --- a/third_party/blink/public/mojom/use_counter/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/css_property_id.mojom
@@ -4,7 +4,7 @@ module blink.mojom; -const int32 kMaximumCSSSampleId = 613; +const int32 kMaximumCSSSampleId = 617; // This CSSSampleId represents page load for CSS histograms. It is recorded once // per page visit for each CSS histogram being logged on the blink side and the
diff --git a/third_party/blink/renderer/core/css/BUILD.gn b/third_party/blink/renderer/core/css/BUILD.gn index 12ff24d..1dee664 100644 --- a/third_party/blink/renderer/core/css/BUILD.gn +++ b/third_party/blink/renderer/core/css/BUILD.gn
@@ -756,10 +756,14 @@ "properties/shorthands/background_custom.cc", "properties/shorthands/background_position_custom.cc", "properties/shorthands/background_repeat_custom.cc", + "properties/shorthands/border_block_end_custom.cc", + "properties/shorthands/border_block_start_custom.cc", "properties/shorthands/border_bottom_custom.cc", "properties/shorthands/border_color_custom.cc", "properties/shorthands/border_custom.cc", "properties/shorthands/border_image_custom.cc", + "properties/shorthands/border_inline_end_custom.cc", + "properties/shorthands/border_inline_start_custom.cc", "properties/shorthands/border_left_custom.cc", "properties/shorthands/border_radius_custom.cc", "properties/shorthands/border_right_custom.cc", @@ -804,10 +808,6 @@ "properties/shorthands/scroll_padding_inline_custom.cc", "properties/shorthands/text_decoration_custom.cc", "properties/shorthands/transition_custom.cc", - "properties/shorthands/webkit_border_after_custom.cc", - "properties/shorthands/webkit_border_before_custom.cc", - "properties/shorthands/webkit_border_end_custom.cc", - "properties/shorthands/webkit_border_start_custom.cc", "properties/shorthands/webkit_column_break_after_custom.cc", "properties/shorthands/webkit_column_break_before_custom.cc", "properties/shorthands/webkit_column_break_inside_custom.cc",
diff --git a/third_party/blink/renderer/core/css/CSSProperties.json5 b/third_party/blink/renderer/core/css/CSSProperties.json5 index 99d42e2..ed8ce36 100644 --- a/third_party/blink/renderer/core/css/CSSProperties.json5 +++ b/third_party/blink/renderer/core/css/CSSProperties.json5
@@ -4520,6 +4520,30 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, { + name: "border-block-end", + longhands: [ + "border-block-end-width", "border-block-end-style", + "border-block-end-color" + ], + property_methods: ["ParseShorthand"], + direction_aware_options: { + logical_side: "after", + shorthand_for_physical_side: "BorderDirections", + }, + }, + { + name: "border-block-start", + longhands: [ + "border-block-start-width", "border-block-start-style", + "border-block-start-color" + ], + property_methods: ["ParseShorthand"], + direction_aware_options: { + logical_side: "before", + shorthand_for_physical_side: "BorderDirections", + }, + }, + { name: "border-bottom", longhands: [ "border-bottom-width", "border-bottom-style", "border-bottom-color" @@ -4543,6 +4567,30 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, { + name: "border-inline-end", + longhands: [ + "border-inline-end-width", "border-inline-end-style", + "border-inline-end-color" + ], + property_methods: ["ParseShorthand"], + direction_aware_options: { + logical_side: "end", + shorthand_for_physical_side: "BorderDirections", + }, + }, + { + name: "border-inline-start", + longhands: [ + "border-inline-start-width", "border-inline-start-style", + "border-inline-start-color" + ], + property_methods: ["ParseShorthand"], + direction_aware_options: { + logical_side: "start", + shorthand_for_physical_side: "BorderDirections", + }, + }, + { name: "border-left", longhands: [ "border-left-width", "border-left-style", "border-left-color" @@ -4808,51 +4856,19 @@ }, { name: "-webkit-border-after", - longhands: [ - "border-block-end-width", "border-block-end-style", - "border-block-end-color" - ], - property_methods: ["ParseShorthand"], - direction_aware_options: { - logical_side: "after", - shorthand_for_physical_side: "BorderDirections", - }, + alias_for: "border-block-end", }, { name: "-webkit-border-before", - longhands: [ - "border-block-start-width", "border-block-start-style", - "border-block-start-color" - ], - property_methods: ["ParseShorthand"], - direction_aware_options: { - logical_side: "before", - shorthand_for_physical_side: "BorderDirections", - }, + alias_for: "border-block-start", }, { name: "-webkit-border-end", - longhands: [ - "border-inline-end-width", "border-inline-end-style", - "border-inline-end-color" - ], - property_methods: ["ParseShorthand"], - direction_aware_options: { - logical_side: "end", - shorthand_for_physical_side: "BorderDirections", - }, + alias_for: "border-inline-end", }, { name: "-webkit-border-start", - longhands: [ - "border-inline-start-width", "border-inline-start-style", - "border-inline-start-color" - ], - property_methods: ["ParseShorthand"], - direction_aware_options: { - logical_side: "start", - shorthand_for_physical_side: "BorderDirections", - }, + alias_for: "border-inline-start", }, { name: "-webkit-column-break-after",
diff --git a/third_party/blink/renderer/core/css/parser/css_proto_converter.cc b/third_party/blink/renderer/core/css/parser/css_proto_converter.cc index 8e5952d..03175244 100644 --- a/third_party/blink/renderer/core/css/parser/css_proto_converter.cc +++ b/third_party/blink/renderer/core/css/parser/css_proto_converter.cc
@@ -1454,6 +1454,10 @@ "border-inline-end-width", "border-inline-end-style", "border-inline-end-color", + "border-block-start", + "border-block-end", + "border-inline-start", + "border-inline-end", "INVALID_PROPERTY", };
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc similarity index 77% copy from third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc copy to third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc index 23630c2..8e9665a 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc
@@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_end.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderEnd::ParseShorthand( +bool BorderBlockEnd::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderEndShorthand(), important, context, range, properties); + borderBlockEndShorthand(), important, context, range, properties); } } // namespace CSSShorthand
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc similarity index 77% copy from third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc copy to third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc index 23630c2..22f2730 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc
@@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_start.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderEnd::ParseShorthand( +bool BorderBlockStart::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderEndShorthand(), important, context, range, properties); + borderBlockStartShorthand(), important, context, range, properties); } } // namespace CSSShorthand
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc similarity index 78% rename from third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc rename to third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc index 23630c2..53c9c7d7 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc
@@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_end.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderEnd::ParseShorthand( +bool BorderInlineEnd::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderEndShorthand(), important, context, range, properties); + borderInlineEndShorthand(), important, context, range, properties); } } // namespace CSSShorthand
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc similarity index 78% rename from third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after_custom.cc rename to third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc index f9667447..7440a22 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc
@@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_start.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderAfter::ParseShorthand( +bool BorderInlineStart::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderAfterShorthand(), important, context, range, properties); + borderInlineStartShorthand(), important, context, range, properties); } } // namespace CSSShorthand
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before_custom.cc deleted file mode 100644 index 2c6c48c..0000000 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before_custom.cc +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/style_property_shorthand.h" - -namespace blink { -namespace CSSShorthand { - -bool WebkitBorderBefore::ParseShorthand( - bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&, - HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderBeforeShorthand(), important, context, range, properties); -} - -} // namespace CSSShorthand -} // namespace blink
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start_custom.cc deleted file mode 100644 index bb8814c0..0000000 --- a/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start_custom.cc +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/style_property_shorthand.h" - -namespace blink { -namespace CSSShorthand { - -bool WebkitBorderStart::ParseShorthand( - bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&, - HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderStartShorthand(), important, context, range, properties); -} - -} // namespace CSSShorthand -} // namespace blink
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/third_party/blink/renderer/core/css/resolver/style_resolver.cc index 71cf9e9..4dc51b8 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc
@@ -1352,9 +1352,11 @@ case CSSPropertyBackgroundRepeatX: case CSSPropertyBackgroundRepeatY: case CSSPropertyBackgroundSize: + case CSSPropertyBorderBlockEnd: case CSSPropertyBorderBlockEndColor: case CSSPropertyBorderBlockEndStyle: case CSSPropertyBorderBlockEndWidth: + case CSSPropertyBorderBlockStart: case CSSPropertyBorderBlockStartColor: case CSSPropertyBorderBlockStartStyle: case CSSPropertyBorderBlockStartWidth: @@ -1368,9 +1370,11 @@ case CSSPropertyBorderImageSlice: case CSSPropertyBorderImageSource: case CSSPropertyBorderImageWidth: + case CSSPropertyBorderInlineEnd: case CSSPropertyBorderInlineEndColor: case CSSPropertyBorderInlineEndStyle: case CSSPropertyBorderInlineEndWidth: + case CSSPropertyBorderInlineStart: case CSSPropertyBorderInlineStartColor: case CSSPropertyBorderInlineStartStyle: case CSSPropertyBorderInlineStartWidth: @@ -1426,12 +1430,8 @@ case CSSPropertyTextTransform: case CSSPropertyTextUnderlinePosition: case CSSPropertyVerticalAlign: - case CSSPropertyWebkitBorderAfter: - case CSSPropertyWebkitBorderBefore: - case CSSPropertyWebkitBorderEnd: case CSSPropertyWebkitBorderHorizontalSpacing: case CSSPropertyWebkitBorderImage: - case CSSPropertyWebkitBorderStart: case CSSPropertyWebkitBorderVerticalSpacing: case CSSPropertyWebkitFontSmoothing: case CSSPropertyWebkitMarginAfterCollapse:
diff --git a/third_party/blink/renderer/core/css/style_property_serializer.cc b/third_party/blink/renderer/core/css/style_property_serializer.cc index 38f7f21..17cefa36 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.cc +++ b/third_party/blink/renderer/core/css/style_property_serializer.cc
@@ -433,6 +433,14 @@ return GetShorthandValue(borderBottomShorthand()); case CSSPropertyBorderLeft: return GetShorthandValue(borderLeftShorthand()); + case CSSPropertyBorderBlockStart: + return GetShorthandValue(borderBlockStartShorthand()); + case CSSPropertyBorderBlockEnd: + return GetShorthandValue(borderBlockEndShorthand()); + case CSSPropertyBorderInlineStart: + return GetShorthandValue(borderInlineStartShorthand()); + case CSSPropertyBorderInlineEnd: + return GetShorthandValue(borderInlineEndShorthand()); case CSSPropertyOutline: return GetShorthandValue(outlineShorthand()); case CSSPropertyBorderColor:
diff --git a/third_party/blink/renderer/core/dom/ax_object_cache.h b/third_party/blink/renderer/core/dom/ax_object_cache.h index ea4bae3..911d194 100644 --- a/third_party/blink/renderer/core/dom/ax_object_cache.h +++ b/third_party/blink/renderer/core/dom/ax_object_cache.h
@@ -91,6 +91,7 @@ Node* new_focused_node) = 0; virtual void HandleInitialFocus() = 0; virtual void HandleEditableTextContentChanged(Node*) = 0; + virtual void HandleScaleAndLocationChanged(Document*) = 0; virtual void HandleTextMarkerDataAdded(Node* start, Node* end) = 0; virtual void HandleTextFormControlChanged(Node*) = 0; virtual void HandleValueChanged(Node*) = 0;
diff --git a/third_party/blink/renderer/core/editing/caret_display_item_client_test.cc b/third_party/blink/renderer/core/editing/caret_display_item_client_test.cc index 8fd80cdd..19cc6e4 100644 --- a/third_party/blink/renderer/core/editing/caret_display_item_client_test.cc +++ b/third_party/blink/renderer/core/editing/caret_display_item_client_test.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/editing/caret_display_item_client.h" +#include "testing/gmock/include/gmock/gmock.h" #include "third_party/blink/renderer/core/editing/frame_selection.h" #include "third_party/blink/renderer/core/editing/selection_template.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -15,6 +16,8 @@ namespace blink { +using ::testing::UnorderedElementsAre; + class CaretDisplayItemClientTest : public PaintAndRasterInvalidationTest { protected: void SetUp() override { @@ -86,14 +89,11 @@ EXPECT_EQ(1, caret_visual_rect.Width()); EXPECT_EQ(block->Location(), caret_visual_rect.Location()); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect), - (*raster_invalidations)[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[0].client); - EXPECT_EQ(PaintInvalidationReason::kAppeared, - (*raster_invalidations)[0].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect), + PaintInvalidationReason::kAppeared})); std::unique_ptr<JSONArray> object_invalidations = GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); @@ -116,18 +116,15 @@ EXPECT_EQ(caret_visual_rect.Y(), new_caret_visual_rect.Y()); EXPECT_LT(caret_visual_rect.X(), new_caret_visual_rect.X()); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect), - (*raster_invalidations)[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[0].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, - (*raster_invalidations)[0].reason); - EXPECT_EQ(EnclosingIntRect(new_caret_visual_rect), - (*raster_invalidations)[1].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[1].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, - (*raster_invalidations)[1].reason); + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect), + PaintInvalidationReason::kCaret}, + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(new_caret_visual_rect), + PaintInvalidationReason::kCaret})); object_invalidations = GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); @@ -144,18 +141,18 @@ EXPECT_FALSE(block->ShouldPaintCursorCaret()); EXPECT_EQ(LayoutRect(), GetCaretDisplayItemClient().VisualRect()); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(EnclosingIntRect(old_caret_visual_rect), - (*raster_invalidations)[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[0].client); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(old_caret_visual_rect), + PaintInvalidationReason::kDisappeared})); - object_invalidations = - GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); - ASSERT_EQ(1u, object_invalidations->size()); - JSONObject::Cast(object_invalidations->at(0))->Get("object")->AsString(&s); - EXPECT_EQ("Caret", s); - GetDocument().View()->SetTracksPaintInvalidations(false); + object_invalidations = + GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); + ASSERT_EQ(1u, object_invalidations->size()); + JSONObject::Cast(object_invalidations->at(0))->Get("object")->AsString(&s); + EXPECT_EQ("Caret", s); + GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) { @@ -165,8 +162,8 @@ auto* block_element1 = AppendBlock("Block1"); auto* block_element2 = AppendBlock("Block2"); UpdateAllLifecyclePhases(); - auto* block1 = ToLayoutBlock(block_element1->GetLayoutObject()); - auto* block2 = ToLayoutBlock(block_element2->GetLayoutObject()); + auto* block1 = ToLayoutBlockFlow(block_element1->GetLayoutObject()); + auto* block2 = ToLayoutBlockFlow(block_element2->GetLayoutObject()); // Focus the body. GetDocument().body()->focus(); @@ -193,17 +190,14 @@ EXPECT_FALSE(block1->ShouldPaintCursorCaret()); EXPECT_TRUE(block2->ShouldPaintCursorCaret()); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect1), - (*raster_invalidations)[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[0].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, (*raster_invalidations)[0].reason); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect2), - (*raster_invalidations)[1].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), (*raster_invalidations)[1].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect1), + PaintInvalidationReason::kCaret}, + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect2), + PaintInvalidationReason::kCaret})); std::unique_ptr<JSONArray> object_invalidations = GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); @@ -222,20 +216,14 @@ EXPECT_TRUE(block1->ShouldPaintCursorCaret()); EXPECT_FALSE(block2->ShouldPaintCursorCaret()); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect2), - (*raster_invalidations)[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), - (*raster_invalidations)[0].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, - (*raster_invalidations)[0].reason); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect1), - (*raster_invalidations)[1].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), - (*raster_invalidations)[1].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, - (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect1), + PaintInvalidationReason::kCaret}, + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect2), + PaintInvalidationReason::kCaret})); object_invalidations = GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); @@ -334,17 +322,15 @@ EXPECT_EQ(caret_visual_rect.Y(), new_caret_visual_rect.Y()); EXPECT_LT(caret_visual_rect.X(), new_caret_visual_rect.X()); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations.size()); - EXPECT_EQ(EnclosingIntRect(caret_visual_rect), - raster_invalidations[0].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, raster_invalidations[0].reason); - EXPECT_EQ(EnclosingIntRect(new_caret_visual_rect), - raster_invalidations[1].rect); - EXPECT_EQ(&GetCaretDisplayItemClient(), raster_invalidations[1].client); - EXPECT_EQ(PaintInvalidationReason::kCaret, raster_invalidations[1].reason); + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(caret_visual_rect), + PaintInvalidationReason::kCaret}, + RasterInvalidationInfo{&GetCaretDisplayItemClient(), "Caret", + EnclosingIntRect(new_caret_visual_rect), + PaintInvalidationReason::kCaret})); auto object_invalidations = GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON();
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index 10f273c..d1e3567d 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -39,6 +39,7 @@ #include "build/build_config.h" #include "cc/layers/picture_layer.h" +#include "cc/trees/layer_tree_host.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/page/launching_process_state.h" @@ -1611,12 +1612,12 @@ EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); EXPECT_EQ(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Height()); } @@ -1643,12 +1644,12 @@ EXPECT_EQ(viewport_width / 2, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); EXPECT_EQ(viewport_height / 2, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Height()); } @@ -1704,12 +1705,12 @@ EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); EXPECT_EQ(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Height()); } @@ -1733,7 +1734,7 @@ EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); } @@ -1757,13 +1758,13 @@ EXPECT_EQ(980, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); EXPECT_EQ(980.0 / viewport_width * viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Height()); } @@ -1927,7 +1928,7 @@ web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() - ->ContentsSize() + ->Size() .Width()); EXPECT_EQ(enforced_page_scale_factor, web_view_helper.GetWebView()->PageScaleFactor()); @@ -2221,8 +2222,8 @@ LocalFrameView* frame_view = static_cast<WebLocalFrameImpl*>(local_frame)->GetFrameView(); - EXPECT_EQ(nullptr, frame_view->HorizontalScrollbar()); - EXPECT_EQ(nullptr, frame_view->VerticalScrollbar()); + EXPECT_EQ(nullptr, frame_view->LayoutViewport()->HorizontalScrollbar()); + EXPECT_EQ(nullptr, frame_view->LayoutViewport()->VerticalScrollbar()); } TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations) { @@ -2470,8 +2471,9 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); LocalFrameView* view = web_view_helper.LocalMainFrame()->GetFrameView(); - EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); - EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); + EXPECT_FALSE(view->LayoutViewport()->UserInputScrollable(kVerticalScrollbar)); + EXPECT_FALSE( + view->LayoutViewport()->UserInputScrollable(kHorizontalScrollbar)); } TEST_F(WebFrameTest, OverflowHiddenDisablesScrollingWithSetCanHaveScrollbars) { @@ -2489,12 +2491,14 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); LocalFrameView* view = web_view_helper.LocalMainFrame()->GetFrameView(); - EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); - EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); + EXPECT_FALSE(view->LayoutViewport()->UserInputScrollable(kVerticalScrollbar)); + EXPECT_FALSE( + view->LayoutViewport()->UserInputScrollable(kHorizontalScrollbar)); web_view_helper.LocalMainFrame()->SetCanHaveScrollbars(true); - EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); - EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); + EXPECT_FALSE(view->LayoutViewport()->UserInputScrollable(kVerticalScrollbar)); + EXPECT_FALSE( + view->LayoutViewport()->UserInputScrollable(kHorizontalScrollbar)); } TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) { @@ -2679,12 +2683,12 @@ int viewport_width_minus_scrollbar = viewport_width; int viewport_height_minus_scrollbar = viewport_height; - if (view->VerticalScrollbar() && - !view->VerticalScrollbar()->IsOverlayScrollbar()) + if (view->LayoutViewport()->VerticalScrollbar() && + !view->LayoutViewport()->VerticalScrollbar()->IsOverlayScrollbar()) viewport_width_minus_scrollbar -= 15; - if (view->HorizontalScrollbar() && - !view->HorizontalScrollbar()->IsOverlayScrollbar()) + if (view->LayoutViewport()->HorizontalScrollbar() && + !view->LayoutViewport()->HorizontalScrollbar()->IsOverlayScrollbar()) viewport_height_minus_scrollbar -= 15; web_view_helper.GetWebView()->SetPageScaleFactor(2); @@ -3420,14 +3424,10 @@ } void SimulatePageScale(WebViewImpl* web_view_impl, float& scale) { - ScrollOffset scroll_delta = - ToScrollOffset( - web_view_impl->FakePageScaleAnimationTargetPositionForTesting()) - - web_view_impl->MainFrameImpl()->GetFrameView()->GetScrollOffset(); float scale_delta = web_view_impl->FakePageScaleAnimationPageScaleForTesting() / web_view_impl->PageScaleFactor(); - web_view_impl->ApplyViewportDeltas(WebFloatSize(), FloatSize(scroll_delta), + web_view_impl->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), scale_delta, 0); scale = web_view_impl->PageScaleFactor(); } @@ -6274,66 +6274,15 @@ } #endif -class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { - public: - CompositedSelectionBoundsTestLayerTreeView() : selection_cleared_(false) {} - ~CompositedSelectionBoundsTestLayerTreeView() override = default; - - // WebLayerTreeView: - void RegisterSelection(const WebSelection& selection) override { - selection_ = std::make_unique<WebSelection>(selection); - } - void ClearSelection() override { - selection_cleared_ = true; - selection_.reset(); - } - - bool GetAndResetSelectionCleared() { - bool selection_cleared = selection_cleared_; - selection_cleared_ = false; - return selection_cleared; - } - - const WebSelection* Selection() const { return selection_.get(); } - const WebSelectionBound* Start() const { - return selection_ ? &selection_->Start() : nullptr; - } - const WebSelectionBound* end() const { - return selection_ ? &selection_->end() : nullptr; - } - - private: - bool selection_cleared_; - std::unique_ptr<WebSelection> selection_; -}; - -class CompositedSelectionBoundsTestWebViewClient - : public FrameTestHelpers::TestWebViewClient { - public: - ~CompositedSelectionBoundsTestWebViewClient() override = default; - WebLayerTreeView* InitializeLayerTreeView() override { - return &test_layer_tree_view_; - } - - CompositedSelectionBoundsTestLayerTreeView& SelectionLayerTreeView() { - return test_layer_tree_view_; - } - - private: - CompositedSelectionBoundsTestLayerTreeView test_layer_tree_view_; -}; - class CompositedSelectionBoundsTest : public WebFrameTest, private ScopedCompositedSelectionUpdateForTest { protected: CompositedSelectionBoundsTest() - : ScopedCompositedSelectionUpdateForTest(true), - fake_selection_layer_tree_view_( - fake_selection_web_view_client_.SelectionLayerTreeView()) { + : ScopedCompositedSelectionUpdateForTest(true) { RegisterMockedHttpURLLoad("Ahem.ttf"); - web_view_helper_.Initialize(nullptr, &fake_selection_web_view_client_); + web_view_helper_.Initialize(nullptr, &web_view_client_); web_view_helper_.GetWebView()->GetSettings()->SetDefaultFontSize(12); web_view_helper_.GetWebView()->SetDefaultPageScaleLimits(1, 1); web_view_helper_.Resize(WebSize(640, 480)); @@ -6346,14 +6295,13 @@ base_url_ + test_file); web_view_helper_.GetWebView()->UpdateAllLifecyclePhases(); - const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); - const WebSelectionBound* select_start = - fake_selection_layer_tree_view_.Start(); - const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); + cc::LayerTreeHost* layer_tree_host = + web_view_client_.compositor()->layer_tree_host(); + const cc::LayerSelection& selection = layer_tree_host->selection(); - EXPECT_FALSE(selection); - EXPECT_FALSE(select_start); - EXPECT_FALSE(select_end); + ASSERT_EQ(selection, cc::LayerSelection()); + ASSERT_EQ(selection.start, cc::LayerSelectionBound()); + ASSERT_EQ(selection.end, cc::LayerSelectionBound()); } void RunTest(const char* test_file) { @@ -6447,16 +6395,13 @@ ->GetEventHandler() .HandleGestureEvent(gesture_event); - const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); - const WebSelectionBound* select_start = - fake_selection_layer_tree_view_.Start(); - const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); + cc::LayerTreeHost* layer_tree_host = + web_view_client_.compositor()->layer_tree_host(); + const cc::LayerSelection& selection = layer_tree_host->selection(); - ASSERT_TRUE(selection); - ASSERT_TRUE(select_start); - ASSERT_TRUE(select_end); - - EXPECT_FALSE(selection->IsNone()); + ASSERT_NE(selection, cc::LayerSelection()); + ASSERT_NE(selection.start, cc::LayerSelectionBound()); + ASSERT_NE(selection.end, cc::LayerSelectionBound()); blink::Node* layer_owner_node_for_start = V8Node::ToImplWithTypeCheck( v8::Isolate::GetCurrent(), expected_result.Get(0)); @@ -6464,12 +6409,11 @@ EXPECT_EQ(GetExpectedLayerForSelection(layer_owner_node_for_start) ->CcLayer() ->id(), - select_start->layer_id); + selection.start.layer_id); - EXPECT_EQ(start_edge_top_in_layer_x, select_start->edge_top_in_layer.x); - EXPECT_EQ(start_edge_top_in_layer_y, select_start->edge_top_in_layer.y); - EXPECT_EQ(start_edge_bottom_in_layer_x, - select_start->edge_bottom_in_layer.x); + EXPECT_EQ(start_edge_top_in_layer_x, selection.start.edge_top.x()); + EXPECT_EQ(start_edge_top_in_layer_y, selection.start.edge_top.y()); + EXPECT_EQ(start_edge_bottom_in_layer_x, selection.start.edge_bottom.x()); blink::Node* layer_owner_node_for_end = V8Node::ToImplWithTypeCheck( v8::Isolate::GetCurrent(), @@ -6478,11 +6422,11 @@ ASSERT_TRUE(layer_owner_node_for_end); EXPECT_EQ( GetExpectedLayerForSelection(layer_owner_node_for_end)->CcLayer()->id(), - select_end->layer_id); + selection.end.layer_id); - EXPECT_EQ(end_edge_top_in_layer_x, select_end->edge_top_in_layer.x); - EXPECT_EQ(end_edge_top_in_layer_y, select_end->edge_top_in_layer.y); - EXPECT_EQ(end_edge_bottom_in_layer_x, select_end->edge_bottom_in_layer.x); + EXPECT_EQ(end_edge_top_in_layer_x, selection.end.edge_top.x()); + EXPECT_EQ(end_edge_top_in_layer_y, selection.end.edge_top.y()); + EXPECT_EQ(end_edge_bottom_in_layer_x, selection.end.edge_bottom.x()); // Platform differences can introduce small stylistic deviations in // y-axis positioning, the details of which aren't relevant to @@ -6497,10 +6441,10 @@ } int y_bottom_deviation = - start_edge_bottom_in_layer_y - select_start->edge_bottom_in_layer.y; + start_edge_bottom_in_layer_y - selection.start.edge_bottom.y(); EXPECT_GE(y_bottom_epsilon, std::abs(y_bottom_deviation)); EXPECT_EQ(y_bottom_deviation, - end_edge_bottom_in_layer_y - select_end->edge_bottom_in_layer.y); + end_edge_bottom_in_layer_y - selection.end.edge_bottom.y()); if (expected_result.Length() >= 15) { bool start_hidden = expected_result.Get(context, 13) @@ -6512,8 +6456,8 @@ .As<v8::Boolean>() ->Value(); - EXPECT_EQ(start_hidden, select_start->hidden); - EXPECT_EQ(end_hidden, select_end->hidden); + EXPECT_EQ(start_hidden, selection.start.hidden); + EXPECT_EQ(end_hidden, selection.end.hidden); } } @@ -6539,8 +6483,7 @@ : clm->MainGraphicsLayer(); } - CompositedSelectionBoundsTestWebViewClient fake_selection_web_view_client_; - CompositedSelectionBoundsTestLayerTreeView& fake_selection_layer_tree_view_; + FrameTestHelpers::TestWebViewClient web_view_client_; FrameTestHelpers::WebViewHelper web_view_helper_; }; @@ -8949,44 +8892,16 @@ EXPECT_FLOAT_EQ(5.0, web_view_impl->MaximumPageScaleFactor()); } -namespace { - -class TestFullscreenWebLayerTreeView : public WebLayerTreeView { - public: - TestFullscreenWebLayerTreeView() = default; - ~TestFullscreenWebLayerTreeView() override = default; - - // WebLayerTreeView: - void SetBackgroundColor(SkColor color) override { - has_transparent_background = SkColorGetA(color) < SK_AlphaOPAQUE; - } - bool has_transparent_background = false; -}; - -class TestFullscreenWebViewClient : public FrameTestHelpers::TestWebViewClient { - public: - TestFullscreenWebViewClient() = default; - ~TestFullscreenWebViewClient() override = default; - - // FrameTestHelpers::TestWebViewClient: - WebLayerTreeView* InitializeLayerTreeView() override { - return &test_fullscreen_layer_tree_view; - } - TestFullscreenWebLayerTreeView test_fullscreen_layer_tree_view; -}; - -} // namespace - TEST_F(WebFrameTest, OverlayFullscreenVideo) { ScopedForceOverlayFullscreenVideoForTest force_overlay_fullscreen_video(true); RegisterMockedHttpURLLoad("fullscreen_video.html"); - TestFullscreenWebViewClient web_view_client; + FrameTestHelpers::TestWebViewClient web_view_client; FrameTestHelpers::WebViewHelper web_view_helper; WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( base_url_ + "fullscreen_video.html", nullptr, &web_view_client); - const TestFullscreenWebLayerTreeView& layer_tree_view = - web_view_client.test_fullscreen_layer_tree_view; + const cc::LayerTreeHost* layer_tree_host = + web_view_client.compositor()->layer_tree_host(); LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame(); std::unique_ptr<UserGestureIndicator> gesture = @@ -8995,18 +8910,18 @@ ToHTMLVideoElement(frame->GetDocument()->getElementById("video")); EXPECT_TRUE(video->UsesOverlayFullscreenVideo()); EXPECT_FALSE(video->IsFullscreen()); - EXPECT_FALSE(layer_tree_view.has_transparent_background); + EXPECT_EQ(SkColorGetA(layer_tree_host->background_color()), SK_AlphaOPAQUE); video->webkitEnterFullscreen(); web_view_impl->DidEnterFullscreen(); web_view_impl->UpdateAllLifecyclePhases(); EXPECT_TRUE(video->IsFullscreen()); - EXPECT_TRUE(layer_tree_view.has_transparent_background); + EXPECT_LT(SkColorGetA(layer_tree_host->background_color()), SK_AlphaOPAQUE); web_view_impl->DidExitFullscreen(); web_view_impl->UpdateAllLifecyclePhases(); EXPECT_FALSE(video->IsFullscreen()); - EXPECT_FALSE(layer_tree_view.has_transparent_background); + EXPECT_EQ(SkColorGetA(layer_tree_host->background_color()), SK_AlphaOPAQUE); } TEST_F(WebFrameTest, LayoutBlockPercentHeightDescendants) {
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc index 598c128f..c7d4501 100644 --- a/third_party/blink/renderer/core/exported/web_view_test.cc +++ b/third_party/blink/renderer/core/exported/web_view_test.cc
@@ -2321,6 +2321,7 @@ ASSERT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().height); ASSERT_EQ(0, web_view_impl->MainFrameImpl() ->GetFrameView() + ->LayoutViewport() ->MaximumScrollOffset() .Height()); @@ -2361,6 +2362,7 @@ ASSERT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().height); ASSERT_EQ(0, web_view_impl->MainFrameImpl() ->GetFrameView() + ->LayoutViewport() ->MaximumScrollOffset() .Height()); @@ -2376,6 +2378,7 @@ ASSERT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().height); ASSERT_EQ(0, web_view_impl->MainFrameImpl() ->GetFrameView() + ->LayoutViewport() ->MaximumScrollOffset() .Height()); @@ -4926,7 +4929,7 @@ // The visual viewport should now proivde the scrollbars instead of the view. EXPECT_TRUE(frame_view->VisualViewportSuppliesScrollbars()); - EXPECT_EQ(nullptr, frame_view->VerticalScrollbar()); + EXPECT_EQ(nullptr, frame_view->LayoutViewport()->VerticalScrollbar()); web_view->DisableDeviceEmulation();
diff --git a/third_party/blink/renderer/core/frame/browser_controls_test.cc b/third_party/blink/renderer/core/frame/browser_controls_test.cc index eeb15f1..f3ece76 100644 --- a/third_party/blink/renderer/core/frame/browser_controls_test.cc +++ b/third_party/blink/renderer/core/frame/browser_controls_test.cc
@@ -43,6 +43,7 @@ #include "third_party/blink/renderer/core/frame/visual_viewport.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/geometry/dom_rect.h" +#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" @@ -729,8 +730,7 @@ // The layout size on the LocalFrameView should not include the browser // controls. - EXPECT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); // Hide the browser controls. VerticalScroll(-100.f); @@ -746,8 +746,7 @@ EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); // The layout size should not change as a result of browser controls hiding. - EXPECT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); } // Ensure that browser controls do not affect the layout by showing and hiding @@ -770,8 +769,7 @@ VerticalScroll(-100.f); web_view->ResizeWithBrowserControls(WebSize(400, 400), 100.f, 0, false); web_view->UpdateAllLifecyclePhases(); - ASSERT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + ASSERT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); // Now lock the controls in a hidden state. The layout and elements should // resize without a WebView::resize. @@ -781,8 +779,7 @@ EXPECT_FLOAT_EQ(200.f, abs_pos->getBoundingClientRect()->height()); EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); - EXPECT_EQ(400, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(400, GetFrame()->View()->GetLayoutSize().Height()); // Unlock the controls, the sizes should change even though the controls are // still hidden. @@ -792,8 +789,7 @@ EXPECT_FLOAT_EQ(150.f, abs_pos->getBoundingClientRect()->height()); EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); - EXPECT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); // Now lock the controls in a shown state. web_view->UpdateBrowserControlsState(kWebBrowserControlsShown, @@ -803,8 +799,7 @@ EXPECT_FLOAT_EQ(150.f, abs_pos->getBoundingClientRect()->height()); EXPECT_FLOAT_EQ(150.f, fixed_pos->getBoundingClientRect()->height()); - EXPECT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); // Shown -> Hidden web_view->ResizeWithBrowserControls(WebSize(400, 400), 100.f, 0, false); @@ -814,16 +809,14 @@ EXPECT_FLOAT_EQ(200.f, abs_pos->getBoundingClientRect()->height()); EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); - EXPECT_EQ(400, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(400, GetFrame()->View()->GetLayoutSize().Height()); // Go from Unlocked and showing, to locked and hidden but issue the resize // before the constraint update to check for race issues. web_view->UpdateBrowserControlsState(kWebBrowserControlsBoth, kWebBrowserControlsShown, false); web_view->ResizeWithBrowserControls(WebSize(400, 300), 100.f, 0, true); - ASSERT_EQ(300, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + ASSERT_EQ(300, GetFrame()->View()->GetLayoutSize().Height()); web_view->UpdateAllLifecyclePhases(); web_view->ResizeWithBrowserControls(WebSize(400, 400), 100.f, 0, false); @@ -833,8 +826,7 @@ EXPECT_FLOAT_EQ(200.f, abs_pos->getBoundingClientRect()->height()); EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); - EXPECT_EQ(400, - GetFrame()->View()->GetLayoutSize(kIncludeScrollbars).Height()); + EXPECT_EQ(400, GetFrame()->View()->GetLayoutSize().Height()); } // Ensure that browser controls do not affect vh units. @@ -1032,7 +1024,8 @@ GenerateEvent(WebInputEvent::kGestureScrollUpdate, 0, 80)); GetVisualViewport().ClampToBoundaries(); - view->SetScrollOffset(view->GetScrollOffset(), kProgrammaticScroll); + view->LayoutViewport()->SetScrollOffset( + view->LayoutViewport()->GetScrollOffset(), kProgrammaticScroll); ASSERT_EQ(80.f, web_view->GetBrowserControls().ContentOffset()); EXPECT_EQ(expected_root_offset, root_viewport->GetScrollOffset().Height()); @@ -1174,7 +1167,7 @@ // Ensure there is a raster invalidation of the bottom of the layer. const auto& raster_invalidations = GetFrame() - ->View() + ->ContentLayoutObject() ->Layer() ->GetCompositedLayerMapping() ->ScrollingContentsLayer()
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.cc b/third_party/blink/renderer/core/frame/frame_test_helpers.cc index 6153638..f0d73336 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.cc +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.cc
@@ -365,6 +365,14 @@ test_web_view_client_->ClearAnimationScheduled(); } +void WebViewHelper::SetViewportSize(const WebSize& size) { + content::RenderWidgetCompositor* compositor = + test_web_view_client_->compositor(); + compositor->SetViewportSizeAndScale( + static_cast<gfx::Size>(size), /*device_scale_factor=*/1.f, + compositor->layer_tree_host()->local_surface_id_from_parent()); +} + void WebViewHelper::InitializeWebView(TestWebViewClient* web_view_client, class WebView* opener) { owned_test_web_view_client_ = CreateDefaultClientIfNeeded(web_view_client); @@ -461,14 +469,7 @@ self_owned_.reset(); } -void TestWebViewClient::SetViewportSize(const WebSize& size) { - // TODO(ccameron): This likely causes surface invariant violations. - compositor_->SetViewportSizeAndScale( - static_cast<gfx::Size>(size), /*device_scale_factor=*/1.f, - compositor_->layer_tree_host()->local_surface_id_from_parent()); -} - -WebLayerTreeView* TestWebViewClient::InitializeLayerTreeView() { +content::RenderWidgetCompositor* RenderWidgetCompositorFactory::Initialize() { cc::LayerTreeSettings settings; // Use synchronous compositing so that the MessageLoop becomes idle and the // test makes progress. @@ -489,23 +490,12 @@ } WebLayerTreeView* TestWebWidgetClient::InitializeLayerTreeView() { - cc::LayerTreeSettings settings; - // Use synchronous compositing so that the MessageLoop becomes idle and the - // test makes progress. - settings.single_thread_proxy_scheduler = false; - // For web contents, layer transforms should scale up the contents of layers - // to keep content always crisp when possible. - settings.layer_transforms_should_scale_layer_contents = true; - // BlinkGenPropertyTrees should imply layer lists in the compositor. Some - // code across the boundaries makes assumptions based on this so ensure tests - // run using this configuration as well. - if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) - settings.use_layer_lists = true; + return compositor_factory_.Initialize(); +} - compositor_ = std::make_unique<content::RenderWidgetCompositor>( - &delegate_, &compositor_deps_); - compositor_->Initialize(settings); - return compositor_.get(); +WebLayerTreeView* TestWebViewClient::InitializeLayerTreeView() { + compositor_ = compositor_factory_.Initialize(); + return compositor_; } } // namespace FrameTestHelpers
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.h b/third_party/blink/renderer/core/frame/frame_test_helpers.h index 498c0f5..ddab7b2 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.h +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.h
@@ -161,6 +161,18 @@ scoped_refptr<SecurityOrigin> = nullptr, TestWebRemoteFrameClient* = nullptr); +// A class that constructs and owns a content::RenderWidgetCompositor for blink +// unit tests. +class RenderWidgetCompositorFactory { + public: + content::RenderWidgetCompositor* Initialize(); + + private: + content::StubRenderWidgetCompositorDelegate delegate_; + content::FakeCompositorDependencies compositor_deps_; + std::unique_ptr<content::RenderWidgetCompositor> compositor_; +}; + class TestWebWidgetClient : public WebWidgetClient { public: ~TestWebWidgetClient() override = default; @@ -169,16 +181,14 @@ WebLayerTreeView* InitializeLayerTreeView() override; private: - content::StubRenderWidgetCompositorDelegate delegate_; - content::FakeCompositorDependencies compositor_deps_; - std::unique_ptr<content::RenderWidgetCompositor> compositor_; + RenderWidgetCompositorFactory compositor_factory_; }; class TestWebViewClient : public WebViewClient { public: ~TestWebViewClient() override = default; - void SetViewportSize(const WebSize& size); + content::RenderWidgetCompositor* compositor() { return compositor_; } // WebViewClient: WebLayerTreeView* InitializeLayerTreeView() override; @@ -189,9 +199,8 @@ bool CanUpdateLayout() override { return true; } private: - content::StubRenderWidgetCompositorDelegate delegate_; - content::FakeCompositorDependencies compositor_deps_; - std::unique_ptr<content::RenderWidgetCompositor> compositor_; + content::RenderWidgetCompositor* compositor_ = nullptr; + RenderWidgetCompositorFactory compositor_factory_; bool animation_scheduled_ = false; }; @@ -253,9 +262,7 @@ WebLocalFrameImpl* LocalMainFrame() const; WebRemoteFrameImpl* RemoteMainFrame() const; - void SetViewportSize(const WebSize& size) { - test_web_view_client_->SetViewportSize(size); - } + void SetViewportSize(const WebSize& size); private: void InitializeWebView(TestWebViewClient*, class WebView* opener);
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index d2fd4bb7..9225696 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -980,7 +980,7 @@ if (first_layout_) { first_layout_ = false; - last_viewport_size_ = GetLayoutSize(kIncludeScrollbars); + last_viewport_size_ = GetLayoutSize(); last_zoom_factor_ = GetLayoutView()->Style()->Zoom(); ScrollbarMode h_mode; @@ -1143,7 +1143,7 @@ } FloatSize LocalFrameView::ViewportSizeForMediaQueries() const { - FloatSize viewport_size(GetLayoutSize(kIncludeScrollbars)); + FloatSize viewport_size(GetLayoutSize()); if (!frame_->GetDocument() || !frame_->GetDocument()->Printing()) viewport_size.Scale(1 / GetFrame().PageZoomFactor()); return viewport_size; @@ -1683,13 +1683,6 @@ fragment_anchor_ = nullptr; } -IntSize LocalFrameView::GetLayoutSize( - IncludeScrollbarsInRect scrollbar_inclusion) const { - return scrollbar_inclusion == kExcludeScrollbars - ? ExcludeScrollbars(layout_size_) - : layout_size_; -} - void LocalFrameView::SetLayoutSize(const IntSize& size) { DCHECK(!LayoutSizeFixedToFrameSize()); if (frame_->GetDocument() && @@ -2208,7 +2201,7 @@ auto* layout_view = GetLayoutView(); if (!layout_view) return false; - return (GetLayoutSize(kIncludeScrollbars) != last_viewport_size_ || + return (GetLayoutSize() != last_viewport_size_ || layout_view->StyleRef().Zoom() != last_zoom_factor_); } @@ -2222,7 +2215,7 @@ if (!WasViewportResized()) return; - last_viewport_size_ = GetLayoutSize(kIncludeScrollbars); + last_viewport_size_ = GetLayoutSize(); last_zoom_factor_ = layout_view->StyleRef().Zoom(); if (RuntimeEnabledFeatures::VisualViewportAPIEnabled()) @@ -3034,7 +3027,7 @@ UkmMetricNames::kCompositing); paint_artifact_compositor_->Update( - paint_controller_->GetPaintArtifact(), composited_element_ids, + paint_controller_->GetPaintArtifactShared(), composited_element_ids, frame_->GetPage()->GetVisualViewport().GetPageScaleNode()); } @@ -3509,10 +3502,6 @@ ? new Vector<ObjectPaintInvalidation> : nullptr); if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { - if (!paint_controller_) - paint_controller_ = PaintController::Create(); - paint_controller_->SetTracksRasterInvalidations( - track_paint_invalidations); if (paint_artifact_compositor_) { paint_artifact_compositor_->SetTracksRasterInvalidations( track_paint_invalidations); @@ -4176,7 +4165,7 @@ } int LocalFrameView::ViewportWidth() const { - int viewport_width = GetLayoutSize(kIncludeScrollbars).Width(); + int viewport_width = GetLayoutSize().Width(); return AdjustForAbsoluteZoom::AdjustInt(viewport_width, GetLayoutView()); }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index ed834c5e..a795336 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -184,9 +184,7 @@ // Methods for getting/setting the size Blink should use to layout the // contents. - // NOTE: Scrollbar exclusion is based on the LocalFrameView's scrollbars. To - // exclude scrollbars on the root PaintLayer, use LayoutView::layoutSize. - IntSize GetLayoutSize(IncludeScrollbarsInRect = kExcludeScrollbars) const; + IntSize GetLayoutSize() const { return layout_size_; } void SetLayoutSize(const IntSize&); // If this is set to false, the layout size will need to be explicitly set by
diff --git a/third_party/blink/renderer/core/frame/use_counter.cc b/third_party/blink/renderer/core/frame/use_counter.cc index 3a8908c0..6bf1a6a 100644 --- a/third_party/blink/renderer/core/frame/use_counter.cc +++ b/third_party/blink/renderer/core/frame/use_counter.cc
@@ -383,7 +383,7 @@ return 180; case CSSPropertyAliasWebkitBackgroundSize: return 181; - case CSSPropertyWebkitBorderAfter: + case CSSPropertyAliasWebkitBorderAfter: return 182; case CSSPropertyAliasWebkitBorderAfterColor: return 183; @@ -391,7 +391,7 @@ return 184; case CSSPropertyAliasWebkitBorderAfterWidth: return 185; - case CSSPropertyWebkitBorderBefore: + case CSSPropertyAliasWebkitBorderBefore: return 186; case CSSPropertyAliasWebkitBorderBeforeColor: return 187; @@ -399,7 +399,7 @@ return 188; case CSSPropertyAliasWebkitBorderBeforeWidth: return 189; - case CSSPropertyWebkitBorderEnd: + case CSSPropertyAliasWebkitBorderEnd: return 190; case CSSPropertyAliasWebkitBorderEndColor: return 191; @@ -414,7 +414,7 @@ return 196; case CSSPropertyAliasWebkitBorderRadius: return 197; - case CSSPropertyWebkitBorderStart: + case CSSPropertyAliasWebkitBorderStart: return 198; case CSSPropertyAliasWebkitBorderStartColor: return 199; @@ -1178,6 +1178,14 @@ return 612; case CSSPropertyBorderInlineStartWidth: return 613; + case CSSPropertyBorderBlockStart: + return 614; + case CSSPropertyBorderBlockEnd: + return 615; + case CSSPropertyBorderInlineStart: + return 616; + case CSSPropertyBorderInlineEnd: + return 617; // 1. Add new features above this line (don't change the assigned numbers of // the existing items). // 2. Update kMaximumCSSSampleId (defined in
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index 274af02..41a7997 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -325,8 +325,13 @@ void VisualViewport::SetScaleAndLocation(float scale, const FloatPoint& location) { - if (DidSetScaleOrLocation(scale, location)) + if (DidSetScaleOrLocation(scale, location)) { NotifyRootFrameViewport(); + Document* document = MainFrame()->GetDocument(); + if (AXObjectCache* cache = document->ExistingAXObjectCache()) { + cache->HandleScaleAndLocationChanged(document); + } + } } double VisualViewport::VisibleWidthCSSPx() const {
diff --git a/third_party/blink/renderer/core/frame/visual_viewport_test.cc b/third_party/blink/renderer/core/frame/visual_viewport_test.cc index 26476df..593d72c 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport_test.cc
@@ -373,7 +373,8 @@ // After resizing the scale changes 2.0 -> 4.0 EXPECT_FLOAT_SIZE_EQ(FloatSize(50, 25), visual_viewport.VisibleRect().Size()); - EXPECT_EQ(ScrollOffset(0, 0), GetFrame()->View()->GetScrollOffset()); + EXPECT_EQ(ScrollOffset(0, 0), + GetFrame()->View()->LayoutViewport()->GetScrollOffset()); EXPECT_FLOAT_SIZE_EQ(FloatSize(150, 0), visual_viewport.GetScrollOffset()); }
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 3cf23ce..171b0e3 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -124,8 +124,10 @@ // Invalidate compositing inputs, because a remote frame child can cause the // owner to become composited. - if (auto* box = GetLayoutBox()) - box->Layer()->SetNeedsCompositingInputsUpdate(); + if (auto* box = GetLayoutBox()) { + if (auto* layer = box->Layer()) + layer->SetNeedsCompositingInputsUpdate(); + } SetNeedsStyleRecalc(kLocalStyleChange, StyleChangeReasonForTracing::Create( StyleChangeReason::kFrame));
diff --git a/third_party/blink/renderer/core/input/event_handler.cc b/third_party/blink/renderer/core/input/event_handler.cc index aa5560a9..caa6627 100644 --- a/third_party/blink/renderer/core/input/event_handler.cc +++ b/third_party/blink/renderer/core/input/event_handler.cc
@@ -980,7 +980,11 @@ event_result = DispatchMousePointerEvent( WebInputEvent::kPointerMove, mev.InnerNode(), mev.CanvasRegionId(), mev.Event(), coalesced_events); - if (event_result != WebInputEventResult::kNotHandled) + // https://w3c.github.io/uievents/#event-type-mousemove + // Since there is no default action for the mousemove event issue a + // mouse dragged event irrespective of whether the event is cancelled. + if (event_result != WebInputEventResult::kNotHandled && + event_result != WebInputEventResult::kHandledApplication) return event_result; return mouse_event_manager_->HandleMouseDraggedEvent(mev);
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index 76f362b..7dd4d6b 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -3403,6 +3403,7 @@ StyleCacheState type, const LayoutObject* layout_object, ComputedStyle* style) { + DCHECK(layout_object); const LayoutObject* layout_object_for_first_line_style = layout_object; if (layout_object->IsBeforeOrAfterContent()) layout_object_for_first_line_style = layout_object->Parent(); @@ -3417,10 +3418,25 @@ return first_line_block->GetUncachedPseudoStyle( PseudoStyleRequest(kPseudoIdFirstLine), style); } - } else if (!layout_object_for_first_line_style->IsAnonymous() && - layout_object_for_first_line_style->IsLayoutInline() && - !layout_object_for_first_line_style->GetNode() - ->IsFirstLetterPseudoElement()) { + } else if (layout_object_for_first_line_style->IsLayoutInline()) { + if (layout_object_for_first_line_style->IsAnonymous()) { + // Anonymous inline box for ::first-line should inherit background. + if (ToLayoutInline(layout_object_for_first_line_style) + ->IsFirstLineAnonymous()) { + // TODO(kojii): This function must return a style that is referred by + // someone else, and that we can't create an inherited style here. + // Returning parent's style seems to work for now. + return FirstLineStyleForCachedUncachedType( + type, layout_object->Parent(), style); + } + // TODO(kojii): This does not look correct, but creating a first-line + // style for anonymous inline box does not seem easy for now. + return nullptr; + } + if (layout_object_for_first_line_style->GetNode() + ->IsFirstLetterPseudoElement()) { + return nullptr; + } const ComputedStyle* parent_style = layout_object_for_first_line_style->Parent()->FirstLineStyle(); if (parent_style != layout_object_for_first_line_style->Parent()->Style()) {
diff --git a/third_party/blink/renderer/core/layout/layout_view.cc b/third_party/blink/renderer/core/layout/layout_view.cc index 4b80440..797b6e8e 100644 --- a/third_party/blink/renderer/core/layout/layout_view.cc +++ b/third_party/blink/renderer/core/layout/layout_view.cc
@@ -741,7 +741,7 @@ if (!frame_view_) return IntSize(); - IntSize result = frame_view_->GetLayoutSize(kIncludeScrollbars); + IntSize result = frame_view_->GetLayoutSize(); if (scrollbar_inclusion == kExcludeScrollbars) result = frame_view_->LayoutViewport()->ExcludeScrollbars(result); return result;
diff --git a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc index 30b94002..3c8c9d9e 100644 --- a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc +++ b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc
@@ -326,27 +326,28 @@ return LayoutBlockFlow::NodeAtPoint(result, location_in_container, accumulated_offset, action); } - LayoutPoint offset = PaintFragment()->PhysicalFragment().IsPlacedByLayoutNG() - ? PaintFragment()->Offset().ToLayoutPoint() - : Base::Location(); - LayoutPoint adjusted_location = accumulated_offset + offset; + // In LayoutBox::NodeAtPoint() and subclass overrides, it is guaranteed that + // |accumulated_offset + Location()| equals the physical offset of the current + // LayoutBox in the paint layer, regardless of writing mode or whether the box + // was placed by NG or legacy. + const LayoutPoint physical_offset = accumulated_offset + Base::Location(); if (!RootScrollerUtil::IsEffective(*this)) { // Check if we need to do anything at all. // If we have clipping, then we can't have any spillout. LayoutRect overflow_box = Base::HasOverflowClip() ? Base::BorderBoxRect() : Base::VisualOverflowRect(); - overflow_box.MoveBy(adjusted_location); + overflow_box.MoveBy(physical_offset); if (!location_in_container.Intersects(overflow_box)) return false; } if (Base::IsInSelfHitTestingPhase(action) && Base::HasOverflowClip() && Base::HitTestOverflowControl(result, location_in_container, - adjusted_location)) + physical_offset)) return true; return NGBlockFlowPainter(*this).NodeAtPoint(result, location_in_container, - adjusted_location, action); + physical_offset, action); } template <typename Base>
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc index 076ffc87..5379dec7 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc
@@ -66,19 +66,6 @@ ToLayoutInline(layout_object_)->IsFirstLineAnonymous(); } -const ComputedStyle& NGPhysicalBoxFragment::StyleForBackground() const { - if (!IsFirstLineAnonymousInlineBox()) - return Style(); - - // TODO(kojii): Ideally, the first-line anonymous can return a synthesized - // style that has background inherited from the ::first-line style. Doing so - // is a bit complicated, and fortunately paint code can handle background - // properties and geometry from different style objects. - LayoutObject* container = GetLayoutObject()->Parent(); - DCHECK(container && container->IsLayoutBlockFlow()); - return container->FirstLineStyleRef(); -} - const NGBaseline* NGPhysicalBoxFragment::Baseline( const NGBaselineRequest& request) const { for (const auto& baseline : baselines_) {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h index e656612..f3f8a86 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
@@ -33,9 +33,6 @@ // True if this is an anonymous inline box for ::first-line. bool IsFirstLineAnonymousInlineBox() const; - // Return the style to use for background painting. - const ComputedStyle& StyleForBackground() const; - const NGBaseline* Baseline(const NGBaselineRequest&) const; const NGPixelSnappedPhysicalBoxStrut& Padding() const { return padding_; }
diff --git a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc index edda98a..8af7d56 100644 --- a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc
@@ -276,7 +276,8 @@ GetWebView()->HandleInputEvent(GenerateTouchGestureEvent( WebInputEvent::kGestureScrollUpdate, 0, -100)); EXPECT_FLOAT_EQ(100, container->scrollTop()); - EXPECT_FLOAT_EQ(0, MainFrameView()->GetScrollOffset().Height()); + EXPECT_FLOAT_EQ( + 0, MainFrameView()->LayoutViewport()->GetScrollOffset().Height()); } { @@ -288,7 +289,8 @@ GetWebView()->HandleInputEvent(GenerateTouchGestureEvent( WebInputEvent::kGestureScrollUpdate, 0, -500)); EXPECT_FLOAT_EQ(maximum_scroll, container->scrollTop()); - EXPECT_FLOAT_EQ(0, MainFrameView()->GetScrollOffset().Height()); + EXPECT_FLOAT_EQ( + 0, MainFrameView()->LayoutViewport()->GetScrollOffset().Height()); Mock::VerifyAndClearExpectations(&client); } @@ -300,7 +302,8 @@ GetWebView()->HandleInputEvent( GenerateTouchGestureEvent(WebInputEvent::kGestureScrollUpdate, 0, -20)); EXPECT_FLOAT_EQ(maximum_scroll, container->scrollTop()); - EXPECT_FLOAT_EQ(0, MainFrameView()->GetScrollOffset().Height()); + EXPECT_FLOAT_EQ( + 0, MainFrameView()->LayoutViewport()->GetScrollOffset().Height()); Mock::VerifyAndClearExpectations(&client); } @@ -319,7 +322,8 @@ GetWebView()->HandleInputEvent( GenerateTouchGestureEvent(WebInputEvent::kGestureScrollUpdate, 0, -30)); EXPECT_FLOAT_EQ(maximum_scroll, container->scrollTop()); - EXPECT_FLOAT_EQ(0, MainFrameView()->GetScrollOffset().Height()); + EXPECT_FLOAT_EQ( + 0, MainFrameView()->LayoutViewport()->GetScrollOffset().Height()); Mock::VerifyAndClearExpectations(&client); GetWebView()->HandleInputEvent(
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc index 5764d92..05023ea 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc
@@ -1010,7 +1010,7 @@ EXPECT_EQ(child_graphics_layer->Size(), IntSize(region_child_frame.bounds().size())); } else { - EXPECT_EQ(child_frame->GetFrameView()->ContentsSize(), + EXPECT_EQ(child_frame->GetFrameView()->Size(), IntRect(region_child_frame.bounds()).Size()); } }
diff --git a/third_party/blink/renderer/core/paint/box_decoration_data.cc b/third_party/blink/renderer/core/paint/box_decoration_data.cc index 831b8c8..54c6339 100644 --- a/third_party/blink/renderer/core/paint/box_decoration_data.cc +++ b/third_party/blink/renderer/core/paint/box_decoration_data.cc
@@ -19,7 +19,7 @@ } BoxDecorationData::BoxDecorationData(const NGPhysicalBoxFragment& fragment) - : BoxDecorationData(fragment.StyleForBackground()) { + : BoxDecorationData(fragment.Style()) { bleed_avoidance = ComputeBleedAvoidance(fragment.GetLayoutObject()); }
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc index 14624c7..bc5f7298 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
@@ -189,7 +189,7 @@ kProgrammaticScroll); GetDocument().View()->UpdateAllLifecyclePhases(); - PaintLayer* paint_layer = GetDocument().View()->Layer(); + PaintLayer* paint_layer = GetDocument().GetLayoutView()->Layer(); ASSERT_TRUE(paint_layer->GraphicsLayerBacking()); EXPECT_EQ(IntRect(0, 4000, 800, 7016), RecomputeInterestRect(paint_layer->GraphicsLayerBacking()));
diff --git a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc index f5401bc5..cd3944e 100644 --- a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc +++ b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc
@@ -9,6 +9,9 @@ namespace blink { +using ::testing::MatchesRegex; +using ::testing::UnorderedElementsAre; + void SetUpHTML(PaintAndRasterInvalidationTest& test) { test.SetBodyInnerHTML(R"HTML( <style> @@ -62,7 +65,7 @@ target->setAttribute(HTMLNames::styleAttr, "height: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_THAT(GetCcLayerClient()->TakeDebugInfo(GetCcLayer())->ToString(), - testing::MatchesRegex( + MatchesRegex( "\\{\"layer_name\":.*\"annotated_invalidation_rects\":\\[" "\\{\"geometry_rect\":\\[8,108,100,100\\]," "\"reason\":\"incremental\"," @@ -71,7 +74,7 @@ target->setAttribute(HTMLNames::styleAttr, "height: 200px; width: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_THAT(GetCcLayerClient()->TakeDebugInfo(GetCcLayer())->ToString(), - testing::MatchesRegex( + MatchesRegex( "\\{\"layer_name\":.*\"annotated_invalidation_rects\":\\[" "\\{\"geometry_rect\":\\[108,8,100,200\\]," "\"reason\":\"incremental\"," @@ -89,164 +92,159 @@ TEST_P(PaintAndRasterInvalidationTest, IncrementalInvalidationExpand) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations.size()); - EXPECT_EQ(IntRect(50, 0, 50, 200), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); - EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[1].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(50, 0, 50, 200), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 100, 100, 100), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, IncrementalInvalidationShrink) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 20px; height: 80px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations.size()); - EXPECT_EQ(IntRect(20, 0, 30, 100), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); - EXPECT_EQ(IntRect(0, 80, 50, 20), raster_invalidations[1].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(20, 0, 30, 100), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 80, 50, 20), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, IncrementalInvalidationMixed) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 80px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations.size()); - EXPECT_EQ(IntRect(50, 0, 50, 80), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); - EXPECT_EQ(IntRect(0, 80, 50, 20), raster_invalidations[1].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(50, 0, 50, 80), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 80, 50, 20), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, SubpixelVisualRectChagne) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 100.6px; height: 70.3px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 50, 100), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); - EXPECT_EQ(IntRect(0, 0, 101, 71), (*raster_invalidations)[1].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 50, 100), + PaintInvalidationReason::kGeometry}, + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 101, 71), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 50px; height: 100px"); GetDocument().View()->UpdateAllLifecyclePhases(); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 101, 71), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); - EXPECT_EQ(IntRect(0, 0, 50, 100), (*raster_invalidations)[1].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 50, 100), + PaintInvalidationReason::kGeometry}, + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 101, 71), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, SubpixelVisualRectChangeWithTransform) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); target->setAttribute(HTMLNames::classAttr, "background transform"); GetDocument().View()->UpdateAllLifecyclePhases(); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 100.6px; height: 70.3px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 100, 200), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); - EXPECT_EQ(IntRect(0, 0, 202, 142), (*raster_invalidations)[1].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 100, 200), + PaintInvalidationReason::kGeometry}, + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 202, 142), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "width: 50px; height: 100px"); GetDocument().View()->UpdateAllLifecyclePhases(); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(2u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 202, 142), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); - EXPECT_EQ(IntRect(0, 0, 100, 200), (*raster_invalidations)[1].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 100, 200), + PaintInvalidationReason::kGeometry}, + RasterInvalidationInfo{object, object->DebugName(), + IntRect(0, 0, 202, 142), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, SubpixelWithinPixelsChange) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); - LayoutObject* target_object = target->GetLayoutObject(); - EXPECT_EQ(LayoutRect(0, 0, 50, 100), - target_object->FirstFragment().VisualRect()); + LayoutObject* object = target->GetLayoutObject(); + EXPECT_EQ(LayoutRect(0, 0, 50, 100), object->FirstFragment().VisualRect()); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "margin-top: 0.6px; width: 50px; height: 99.3px"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_EQ(LayoutRect(0, 0, 50, 100), - target_object->FirstFragment().VisualRect()); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 50, 100), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); + EXPECT_EQ(LayoutRect(0, 0, 50, 100), object->FirstFragment().VisualRect()); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 0, 50, 100), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "margin-top: 0.6px; width: 49.3px; height: 98.5px"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_EQ(LayoutRect(0, 0, 50, 100), - target_object->FirstFragment().VisualRect()); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 50, 100), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); + EXPECT_EQ(LayoutRect(0, 0, 50, 100), object->FirstFragment().VisualRect()); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 0, 50, 100), + PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); } TEST_P(PaintAndRasterInvalidationTest, ResizeRotated) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); target->setAttribute(HTMLNames::styleAttr, "transform: rotate(45deg)"); GetDocument().View()->UpdateAllLifecyclePhases(); @@ -254,15 +252,13 @@ target->setAttribute(HTMLNames::styleAttr, "transform: rotate(45deg); width: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); auto expected_rect = EnclosingIntRect( TransformationMatrix().Rotate(45).MapRect(FloatRect(50, 0, 150, 100))); expected_rect.Intersect(IntRect(0, 0, 800, 600)); - EXPECT_EQ(expected_rect, (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - (*raster_invalidations)[0].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + object, object->DebugName(), expected_rect, + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -276,20 +272,19 @@ "red'></div>"); GetDocument().View()->UpdateAllLifecyclePhases(); Element* child = GetDocument().getElementById("child"); + auto* child_object = child->GetLayoutObject(); GetDocument().View()->SetTracksPaintInvalidations(true); child->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 50px; background: red"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); auto expected_rect = EnclosingIntRect( TransformationMatrix().Rotate(45).MapRect(FloatRect(50, 0, 50, 50))); expected_rect.Intersect(IntRect(0, 0, 800, 600)); - EXPECT_EQ(expected_rect, (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - (*raster_invalidations)[0].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + child_object, child_object->DebugName(), expected_rect, + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -308,16 +303,12 @@ GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "height: 3000px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 2000, 800, 1000), raster_invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>( - ViewScrollingContentsDisplayItemClient()), - raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); - + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + ViewScrollingContentsDisplayItemClient(), + ViewScrollingContentsDisplayItemClient()->DebugName(), + IntRect(0, 2000, 800, 1000), PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); // Resize the viewport. No paint invalidation. @@ -345,16 +336,13 @@ target->setAttribute(HTMLNames::styleAttr, "height: 3000px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 0, 800, 3000), raster_invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>( - ViewScrollingContentsDisplayItemClient()), - raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, - raster_invalidations[0].reason); - + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + ViewScrollingContentsDisplayItemClient(), + ViewScrollingContentsDisplayItemClient()->DebugName(), + IntRect(0, 0, 800, 3000), + PaintInvalidationReason::kBackgroundOnScrollingContentsLayer})); GetDocument().View()->SetTracksPaintInvalidations(false); // Resize the viewport. No paint invalidation. @@ -400,15 +388,12 @@ GetDocument().View()->UpdateAllLifecyclePhases(); // The iframe doesn't have anything visible by itself, so we only issue raster // invalidation for the frame contents. - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations.size()); - EXPECT_EQ( - static_cast<const DisplayItemClient*>(content->GetLayoutObject()->View()), - raster_invalidations[0].client); - EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + content->GetLayoutObject()->View(), + content->GetLayoutObject()->View()->DebugName(), + IntRect(0, 100, 100, 100), PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -442,29 +427,24 @@ GetDocument().View()->SetTracksPaintInvalidations(true); content->setAttribute(HTMLNames::styleAttr, "height: 500px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto* raster_invalidations = - &GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(IntRect(0, 0, 100, 100), (*raster_invalidations)[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>(frame_layout_view), - (*raster_invalidations)[0].client); - EXPECT_EQ(PaintInvalidationReason::kBackground, - (*raster_invalidations)[0].reason); + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + frame_layout_view, frame_layout_view->DebugName(), + IntRect(0, 0, 100, 100), PaintInvalidationReason::kBackground})); GetDocument().View()->SetTracksPaintInvalidations(false); // Resize the iframe. GetDocument().View()->SetTracksPaintInvalidations(true); iframe->setAttribute(HTMLNames::styleAttr, "height: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); - raster_invalidations = &GetRasterInvalidationTracking()->Invalidations(); // The iframe doesn't have anything visible by itself, so we only issue raster // invalidation for the frame contents. - ASSERT_EQ(1u, raster_invalidations->size()); - EXPECT_EQ(static_cast<const DisplayItemClient*>(frame_layout_view), - (*raster_invalidations)[0].client); - EXPECT_EQ(IntRect(0, 0, 100, 200), (*raster_invalidations)[0].rect); - EXPECT_EQ(PaintInvalidationReason::kGeometry, - (*raster_invalidations)[0].reason); + EXPECT_THAT( + GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + frame_layout_view, frame_layout_view->DebugName(), + IntRect(0, 0, 100, 200), PaintInvalidationReason::kGeometry})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -509,15 +489,11 @@ // No invalidation on the container layer. EXPECT_FALSE(container_raster_invalidation_tracking()->HasInvalidations()); // Incremental invalidation of background on contents layer. - const auto& contents_raster_invalidations = - contents_raster_invalidation_tracking()->Invalidations(); - ASSERT_EQ(1u, contents_raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 500, 500, 500), contents_raster_invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>( - target_obj->Layer()->GraphicsLayerBacking()), - contents_raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - contents_raster_invalidations[0].reason); + const auto* client = target_obj->Layer()->GraphicsLayerBacking(); + EXPECT_THAT(contents_raster_invalidation_tracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + client, client->DebugName(), IntRect(0, 500, 500, 500), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); // Resize the container. @@ -561,14 +537,11 @@ container_layer->GetRasterInvalidationTracking()->HasInvalidations()); // Full invalidation of background on contents layer because the gradient // background is resized. - const auto& contents_raster_invalidations = - contents_layer->GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, contents_raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 0, 500, 1000), contents_raster_invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>(contents_layer), - contents_raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, - contents_raster_invalidations[0].reason); + EXPECT_THAT( + contents_layer->GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + contents_layer, contents_layer->DebugName(), IntRect(0, 0, 500, 1000), + PaintInvalidationReason::kBackgroundOnScrollingContentsLayer})); GetDocument().View()->SetTracksPaintInvalidations(false); // Resize the container. @@ -588,6 +561,7 @@ NonCompositedBackgroundAttachmentLocalResize) { SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); + auto* object = target->GetLayoutObject(); target->setAttribute(HTMLNames::classAttr, "background local-background"); target->SetInnerHTMLFromString( "<div id=child style='width: 500px; height: 500px'></div>", @@ -608,14 +582,10 @@ GetDocument().View()->SetTracksPaintInvalidations(true); target->setAttribute(HTMLNames::styleAttr, "height: 200px"); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 100, 50, 100), raster_invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>(target->GetLayoutObject()), - raster_invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kIncremental, - raster_invalidations[0].reason); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + object, object->DebugName(), IntRect(0, 100, 50, 100), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -640,15 +610,12 @@ ToLayoutBoxModelObject(target->GetLayoutObject()); GraphicsLayer* scrolling_contents_layer = target_object->Layer()->GraphicsLayerBacking(); - const auto& invalidations = + EXPECT_THAT( scrolling_contents_layer->GetRasterInvalidationTracking() - ->Invalidations(); - - ASSERT_EQ(1u, invalidations.size()); - EXPECT_EQ(IntRect(50, 0, 50, 500), invalidations[0].rect); - EXPECT_EQ(static_cast<const DisplayItemClient*>(scrolling_contents_layer), - invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kIncremental, invalidations[0].reason); + ->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + scrolling_contents_layer, scrolling_contents_layer->DebugName(), + IntRect(50, 0, 50, 500), PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksPaintInvalidations(false); } @@ -746,13 +713,12 @@ // Scroll target into view. GetDocument().domWindow()->scrollTo(0, 4000); GetDocument().View()->UpdateAllLifecyclePhases(); - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - ASSERT_EQ(1u, raster_invalidations.size()); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + target, target->DebugName(), IntRect(0, 4000, 100, 100), + PaintInvalidationReason::kFull})); EXPECT_EQ(PaintInvalidationReason::kNone, target->FullPaintInvalidationReason()); - EXPECT_EQ(IntRect(0, 4000, 100, 100), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kFull, raster_invalidations[0].reason); EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); GetDocument().View()->SetTracksPaintInvalidations(false); }; @@ -798,27 +764,23 @@ // Should invalidate raster for real_rect only. if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // SPv2 creates composited layers for the rect and its mask. - const auto& rect_raster_invalidations = - GetRasterInvalidationTracking(1)->Invalidations(); - ASSERT_EQ(1u, rect_raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 0, 7, 8), rect_raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kFull, - rect_raster_invalidations[0].reason); - const auto& mask_raster_invalidations = - GetRasterInvalidationTracking(2)->Invalidations(); - ASSERT_EQ(1u, mask_raster_invalidations.size()); - EXPECT_EQ(IntRect(0, 0, 7, 8), mask_raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kFull, - mask_raster_invalidations[0].reason); + EXPECT_THAT(GetRasterInvalidationTracking(1)->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + real_rect, real_rect->DebugName(), IntRect(0, 0, 7, 8), + PaintInvalidationReason::kFull})); + EXPECT_THAT(GetRasterInvalidationTracking(2)->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + real_rect, real_rect->DebugName(), IntRect(0, 0, 7, 8), + PaintInvalidationReason::kFull})); } else { - const auto& raster_invalidations = - GetRasterInvalidationTracking()->Invalidations(); - // The first is for the rect itself, the second is for its mask. - ASSERT_EQ(2u, raster_invalidations.size()); - EXPECT_EQ(IntRect(155, 166, 7, 8), raster_invalidations[0].rect); - EXPECT_EQ(PaintInvalidationReason::kFull, raster_invalidations[0].reason); - EXPECT_EQ(IntRect(155, 166, 7, 8), raster_invalidations[1].rect); - EXPECT_EQ(PaintInvalidationReason::kFull, raster_invalidations[1].reason); + EXPECT_THAT(GetRasterInvalidationTracking(1)->Invalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{real_rect, real_rect->DebugName(), + IntRect(155, 166, 7, 8), + PaintInvalidationReason::kFull}, + RasterInvalidationInfo{real_rect, real_rect->DebugName(), + IntRect(155, 166, 7, 8), + PaintInvalidationReason::kFull})); } GetDocument().View()->SetTracksPaintInvalidations(false);
diff --git a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h index c7e276d..c5ba86ed 100644 --- a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h +++ b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h
@@ -39,7 +39,8 @@ size_t index = 0) const { if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { return static_cast<ContentLayerClientImpl*>(GetCcLayerClient(index)) - ->GetRasterInvalidationTrackingForTesting(); + ->GetRasterInvalidator() + .GetTracking(); } return GetLayoutView() .Layer()
diff --git a/third_party/blink/renderer/core/paint/paint_controller_paint_test.h b/third_party/blink/renderer/core/paint/paint_controller_paint_test.h index 62a434ee..9b284a2 100644 --- a/third_party/blink/renderer/core/paint/paint_controller_paint_test.h +++ b/third_party/blink/renderer/core/paint/paint_controller_paint_test.h
@@ -74,16 +74,17 @@ return GetLayoutView(); } - void Commit() { + void CommitAndFinishCycle() { // Only root graphics layer is supported. RootPaintController().CommitNewDisplayItems(); + RootPaintController().FinishCycle(); GetDocument().View()->Lifecycle().AdvanceTo(DocumentLifecycle::kPaintClean); } void Paint(const IntRect* interest_rect = nullptr) { // Only root graphics layer is supported. if (PaintWithoutCommit(interest_rect)) - Commit(); + CommitAndFinishCycle(); } bool DisplayItemListContains(const DisplayItemList& display_item_list,
diff --git a/third_party/blink/renderer/core/paint/paint_layer_painter_test.cc b/third_party/blink/renderer/core/paint/paint_layer_painter_test.cc index e127181..1890a0d 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_painter_test.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_painter_test.cc
@@ -162,7 +162,7 @@ EXPECT_TRUE(PaintWithoutCommit()); EXPECT_EQ(6, NumCachedNewItems()); - Commit(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 7, @@ -253,7 +253,7 @@ // pair. EXPECT_EQ(5, NumCachedNewItems()); - Commit(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 6, @@ -334,7 +334,7 @@ EXPECT_TRUE(PaintWithoutCommit(&interest_rect)); EXPECT_EQ(4, NumCachedNewItems()); - Commit(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 5,
diff --git a/third_party/blink/renderer/core/paint/paint_layer_test.cc b/third_party/blink/renderer/core/paint/paint_layer_test.cc index 4c219bf..0a4aab2 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_test.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_test.cc
@@ -1260,7 +1260,7 @@ TEST_P(PaintLayerTest, FrameViewContentSize) { SetBodyInnerHTML( "<style> body { width: 1200px; height: 900px; margin: 0 } </style>"); - EXPECT_EQ(IntSize(800, 600), GetDocument().View()->ContentsSize()); + EXPECT_EQ(IntSize(800, 600), GetDocument().View()->Size()); } TEST_P(PaintLayerTest, ReferenceClipPathWithPageZoom) {
diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm index dc11558..ed7918e 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm +++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm
@@ -642,7 +642,7 @@ LocalCurrentGraphicsContext local_context( paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); - NSView* view = ThemeMac::EnsuredView(document.View()); + NSView* view = ThemeMac::EnsuredView(document.View()->Size()); [checkbox_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState) [checkbox_cell cr_drawFocusRingWithFrame:NSRect(inflated_rect) inView:view]; @@ -684,7 +684,7 @@ LocalCurrentGraphicsContext local_context( paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); BEGIN_BLOCK_OBJC_EXCEPTIONS - NSView* view = ThemeMac::EnsuredView(document.View()); + NSView* view = ThemeMac::EnsuredView(document.View()->Size()); [radio_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState) [radio_cell cr_drawFocusRingWithFrame:NSRect(inflated_rect) inView:view]; @@ -741,7 +741,7 @@ LocalCurrentGraphicsContext local_context( paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); - NSView* view = ThemeMac::EnsuredView(document.View()); + NSView* view = ThemeMac::EnsuredView(document.View()->Size()); [button_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState)
diff --git a/third_party/blink/renderer/core/scheduler/frame_throttling_test.cc b/third_party/blink/renderer/core/scheduler/frame_throttling_test.cc index 02a8327..097abd1 100644 --- a/third_party/blink/renderer/core/scheduler/frame_throttling_test.cc +++ b/third_party/blink/renderer/core/scheduler/frame_throttling_test.cc
@@ -714,8 +714,14 @@ // frame. EXPECT_EQ(DocumentLifecycle::kPaintClean, frame_element->contentDocument()->Lifecycle().GetState()); - EXPECT_TRUE( - frame_element->contentDocument()->View()->UsesCompositedScrolling()); + // TODO(szager): Re-enable this check for SPv2 when it properly sets the + // bits for composited scrolling. + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { + EXPECT_TRUE(frame_element->contentDocument() + ->View() + ->LayoutViewport() + ->UsesCompositedScrolling()); + } } TEST_P(FrameThrottlingTest, UnthrottleByTransformingWithoutLayout) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index e815f6e..be9081c 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -3165,9 +3165,6 @@ case kIframeRole: case kImageRole: case kInputTimeRole: - case kLayoutTableRole: - case kLayoutTableColumnRole: - case kLayoutTableRowRole: case kListBoxRole: case kLogRole: case kMainRole: @@ -3227,6 +3224,9 @@ case kImageMapRole: case kInlineTextBoxRole: case kLabelRole: + case kLayoutTableRole: + case kLayoutTableColumnRole: + case kLayoutTableRowRole: case kLegendRole: case kListRole: case kListItemRole:
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 54a39bad..a06314c 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -1147,6 +1147,12 @@ PostNotification(obj, kAXValueChanged); } +void AXObjectCacheImpl::HandleScaleAndLocationChanged(Document* document) { + if (!document) + return; + PostNotification(document, kAXLocationChanged); +} + void AXObjectCacheImpl::HandleTextFormControlChanged(Node* node) { HandleEditableTextContentChanged(node); }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h index 2d0686d..84522986 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h
@@ -141,6 +141,7 @@ void HandleInitialFocus() override; void HandleTextFormControlChanged(Node*) override; void HandleEditableTextContentChanged(Node*) override; + void HandleScaleAndLocationChanged(Document*) override; void HandleTextMarkerDataAdded(Node* start, Node* end) override; void HandleValueChanged(Node*) override; void HandleUpdateActiveMenuOption(LayoutMenuList*, int option_index) override;
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 1d7cb99..c74ad2d 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1005,6 +1005,8 @@ "graphics/paint/display_item_client.h", "graphics/paint/display_item_list.cc", "graphics/paint/display_item_list.h", + "graphics/paint/display_item_raster_invalidator.cc", + "graphics/paint/display_item_raster_invalidator.h", "graphics/paint/drawing_display_item.cc", "graphics/paint/drawing_display_item.h", "graphics/paint/drawing_recorder.cc", @@ -1796,6 +1798,7 @@ "graphics/high_contrast_image_classifier_test.cc", "graphics/paint/cull_rect_test.cc", "graphics/paint/display_item_client_test.cc", + "graphics/paint/display_item_raster_invalidator_test.cc", "graphics/paint/display_item_test.cc", "graphics/paint/drawing_display_item_test.cc", "graphics/paint/drawing_recorder_test.cc",
diff --git a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc index 24a73038..e3429e1a 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc
@@ -180,13 +180,18 @@ } scoped_refptr<cc::PictureLayer> ContentLayerClientImpl::UpdateCcPictureLayer( - const PaintArtifact& paint_artifact, + scoped_refptr<const PaintArtifact> paint_artifact, const PaintChunkSubset& paint_chunks, const gfx::Rect& layer_bounds, const PropertyTreeState& layer_state) { + if (paint_chunks[0].is_cacheable) + id_.emplace(paint_chunks[0].id); + else + id_ = base::nullopt; + // TODO(wangxianzhu): Avoid calling DebugName() in official release build. debug_name_ = paint_chunks[0].id.client.DebugName(); - const auto& display_item_list = paint_artifact.GetDisplayItemList(); + const auto& display_item_list = paint_artifact->GetDisplayItemList(); #if DCHECK_IS_ON() paint_chunk_debug_data_ = JSONArray::Create(); @@ -194,7 +199,7 @@ auto json = JSONObject::Create(); json->SetString("data", chunk.ToString()); json->SetArray("displayItems", - paint_artifact.GetDisplayItemList().SubsequenceAsJSON( + paint_artifact->GetDisplayItemList().SubsequenceAsJSON( chunk.begin_index, chunk.end_index, DisplayItemList::kSkipNonDrawings | DisplayItemList::kShownOnlyDisplayItemTypes));
diff --git a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.h b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.h index 8af3e1ee..18f8981 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.h +++ b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.h
@@ -49,12 +49,8 @@ cc::Layer*) override; void DidChangeScrollbarsHiddenIfOverlay(bool) override {} - void SetTracksRasterInvalidations(bool should_track) { - raster_invalidator_.SetTracksRasterInvalidations(should_track); - } - bool Matches(const PaintChunk& paint_chunk) const { - return raster_invalidator_.Matches(paint_chunk); + return id_ && paint_chunk.Matches(*id_); } struct LayerAsJSONContext { @@ -69,17 +65,15 @@ std::unique_ptr<JSONObject> LayerAsJSON(LayerAsJSONContext&) const; scoped_refptr<cc::PictureLayer> UpdateCcPictureLayer( - const PaintArtifact&, + scoped_refptr<const PaintArtifact>, const PaintChunkSubset&, const gfx::Rect& layer_bounds, const PropertyTreeState&); - const RasterInvalidationTracking* GetRasterInvalidationTrackingForTesting() - const { - return raster_invalidator_.GetTracking(); - } + RasterInvalidator& GetRasterInvalidator() { return raster_invalidator_; } private: + base::Optional<PaintChunk::Id> id_; scoped_refptr<cc::PictureLayer> cc_picture_layer_; scoped_refptr<cc::DisplayItemList> cc_display_item_list_; RasterInvalidator raster_invalidator_;
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc index dbdf929..7d8fccd 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
@@ -67,7 +67,7 @@ void PaintArtifactCompositor::SetTracksRasterInvalidations(bool should_track) { for (auto& client : content_layer_clients_) - client->SetTracksRasterInvalidations(should_track); + client->GetRasterInvalidator().SetTracksRasterInvalidations(should_track); } void PaintArtifactCompositor::WillBeRemovedFromFrame() { @@ -220,26 +220,27 @@ } auto client = std::make_unique<ContentLayerClientImpl>(); - client->SetTracksRasterInvalidations(tracks_raster_invalidations_); + client->GetRasterInvalidator().SetTracksRasterInvalidations( + tracks_raster_invalidations_); return client; } scoped_refptr<cc::Layer> PaintArtifactCompositor::CompositedLayerForPendingLayer( - const PaintArtifact& paint_artifact, + scoped_refptr<const PaintArtifact> paint_artifact, const PendingLayer& pending_layer, gfx::Vector2dF& layer_offset, Vector<std::unique_ptr<ContentLayerClientImpl>>& new_content_layer_clients, Vector<scoped_refptr<cc::Layer>>& new_scroll_hit_test_layers) { auto paint_chunks = - paint_artifact.GetPaintChunkSubset(pending_layer.paint_chunk_indices); + paint_artifact->GetPaintChunkSubset(pending_layer.paint_chunk_indices); DCHECK(paint_chunks.size()); const PaintChunk& first_paint_chunk = paint_chunks[0]; DCHECK(first_paint_chunk.size()); // If the paint chunk is a foreign layer, just return that layer. if (scoped_refptr<cc::Layer> foreign_layer = ForeignLayerForPaintChunk( - paint_artifact, first_paint_chunk, layer_offset)) { + *paint_artifact, first_paint_chunk, layer_offset)) { DCHECK_EQ(paint_chunks.size(), 1u); if (extra_data_for_testing_enabled_) extra_data_for_testing_->content_layers.push_back(foreign_layer); @@ -248,7 +249,7 @@ // If the paint chunk is a scroll hit test layer, lookup/create the layer. if (scoped_refptr<cc::Layer> scroll_layer = ScrollHitTestLayerForPendingLayer( - paint_artifact, pending_layer, layer_offset)) { + *paint_artifact, pending_layer, layer_offset)) { new_scroll_hit_test_layers.push_back(scroll_layer); if (extra_data_for_testing_enabled_) extra_data_for_testing_->scroll_hit_test_layers.push_back(scroll_layer); @@ -692,7 +693,7 @@ } void PaintArtifactCompositor::Update( - const PaintArtifact& paint_artifact, + scoped_refptr<const PaintArtifact> paint_artifact, CompositorElementIdSet& composited_element_ids, TransformPaintPropertyNode* viewport_scale_node) { DCHECK(root_layer_); @@ -720,7 +721,7 @@ root_layer_.get(), g_s_property_tree_sequence_number); Vector<PendingLayer, 0> pending_layers; - CollectPendingLayers(paint_artifact, pending_layers); + CollectPendingLayers(*paint_artifact, pending_layers); // The page scale layer would create this below but we need to use the // special EnsureCompositorPageScaleTransformNode method since the transform @@ -765,7 +766,7 @@ // The compositor scroll node is not directly stored in the property tree // state but can be created via the scroll offset translation node. const auto& scroll_translation = - ScrollTranslationForPendingLayer(paint_artifact, pending_layer); + ScrollTranslationForPendingLayer(*paint_artifact, pending_layer); int scroll_id = property_tree_manager.EnsureCompositorScrollNode(&scroll_translation);
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h index 514ef8b7..a260446 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h
@@ -60,7 +60,7 @@ // // Populates |composited_element_ids| with the CompositorElementId of all // animations for which we saw a paint chunk and created a layer. - void Update(const PaintArtifact&, + void Update(scoped_refptr<const PaintArtifact>, CompositorElementIdSet& composited_element_ids, TransformPaintPropertyNode* viewport_scale_node); @@ -164,7 +164,7 @@ // paint chunk to align the bounding box to (0, 0) and return the actual // origin of the paint chunk in the |layerOffset| outparam. scoped_refptr<cc::Layer> CompositedLayerForPendingLayer( - const PaintArtifact&, + scoped_refptr<const PaintArtifact>, const PendingLayer&, gfx::Vector2dF& layer_offset, Vector<std::unique_ptr<ContentLayerClientImpl>>&
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc index 5906890..a986ad1 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc
@@ -126,19 +126,19 @@ return property_trees->element_id_to_scroll_node_index[element_id]; } - void Update(const PaintArtifact& artifact) { + void Update(scoped_refptr<const PaintArtifact> artifact) { CompositorElementIdSet element_ids; Update(artifact, element_ids); } - void Update(const PaintArtifact& artifact, + void Update(scoped_refptr<const PaintArtifact> artifact, CompositorElementIdSet& element_ids) { // Pass nullptr for the visual viewport paint property nodes since we're // really just checking the internals of PaintArtifactCompositor. Update(artifact, element_ids, nullptr); } - void Update(const PaintArtifact& artifact, + void Update(scoped_refptr<const PaintArtifact> artifact, CompositorElementIdSet& element_ids, TransformPaintPropertyNode* viewport_scale_transform_node) { paint_artifact_compositor_->Update(artifact, element_ids, @@ -195,17 +195,16 @@ } void AddSimpleRectChunk(TestPaintArtifact& artifact) { - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(100, 100, 200, 100), Color::kBlack); + artifact.Chunk().RectDrawing(FloatRect(100, 100, 200, 100), Color::kBlack); } - void CreateSimpleArtifactWithOpacity(TestPaintArtifact& artifact, - float opacity, - bool include_preceding_chunk, - bool include_subsequent_chunk) { + void UpdateWithArtifactWithOpacity(float opacity, + bool include_preceding_chunk, + bool include_subsequent_chunk) { + TestPaintArtifact artifact; if (include_preceding_chunk) AddSimpleRectChunk(artifact); - auto effect = CreateOpacityEffect(EffectPaintPropertyNode::Root(), opacity); + auto effect = CreateOpacityEffect(e0(), opacity); artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); if (include_subsequent_chunk) @@ -233,15 +232,13 @@ const auto kNotScrollingOnMain = MainThreadScrollingReason::kNotScrollingOnMain; TEST_F(PaintArtifactCompositorTest, EmptyPaintArtifact) { - PaintArtifact empty_artifact; - Update(empty_artifact); + Update(PaintArtifact::Empty()); EXPECT_TRUE(RootLayer()->children().empty()); } TEST_F(PaintArtifactCompositorTest, OneChunkWithAnOffset) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, -50, 100, 100), Color::kWhite); + artifact.Chunk().RectDrawing(FloatRect(50, -50, 100, 100), Color::kWhite); Update(artifact.Build()); ASSERT_EQ(1u, ContentLayerCount()); @@ -262,8 +259,7 @@ TestPaintArtifact artifact; artifact.Chunk(*transform, c0(), e0()) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); artifact.Chunk(*transform, c0(), e0()) .RectDrawing(FloatRect(100, 100, 200, 100), Color::kBlack); Update(artifact.Build()); @@ -662,15 +658,13 @@ layer->SetBounds(gfx::Size(400, 300)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); - test_artifact.Chunk(t0(), c0(), e0()) - .ForeignLayer(FloatPoint(50, 60), IntSize(400, 300), layer); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().ForeignLayer(FloatPoint(50, 60), IntSize(400, 300), + layer); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(3u, ContentLayerCount()); @@ -783,7 +777,7 @@ auto scroll_translation = CreateScrollTranslation(t0(), 7, 9, *scroll); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()).ScrollHitTest(*scroll_translation); + artifact.Chunk().ScrollHitTest(*scroll_translation); artifact.Chunk(*scroll_translation, c0(), e0()) .RectDrawing(FloatRect(-110, 12, 170, 19), Color::kWhite); Update(artifact.Build()); @@ -1039,7 +1033,7 @@ CreateScrollTranslation(*scroll_translation_a, 37, 41, *scroll_b); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()).ScrollHitTest(*scroll_translation_b); + artifact.Chunk().ScrollHitTest(*scroll_translation_b); artifact.Chunk(*scroll_translation_b, c0(), e0()) .ScrollHitTest(*scroll_translation_a); Update(artifact.Build()); @@ -1078,13 +1072,11 @@ TEST_F(PaintArtifactCompositorTest, MergeSimpleChunks) { TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(2u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(2u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); @@ -1105,16 +1097,14 @@ auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(10, 20, 50, 60)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), *clip, e0()) .RectDrawing(FloatRect(0, 0, 200, 300), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 300, 400), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 300, 400), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); + auto artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1139,15 +1129,13 @@ FloatPoint3D(100, 100, 0)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(*transform, c0(), e0()) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); @@ -1182,8 +1170,8 @@ test_artifact.Chunk(*transform2, c0(), e0()) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(2u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(2u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1205,15 +1193,13 @@ FloatPoint3D(100, 100, 0)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(*transform, c0(), e0()) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1237,15 +1223,13 @@ auto effect = CreateOpacityEffect(e0(), opacity); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1277,15 +1261,13 @@ auto effect = CreateOpacityEffect(e0(), transform.get(), clip.get(), opacity); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(*transform, *clip, *effect) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1319,15 +1301,13 @@ CreateClip(c0(), transform2.get(), FloatRoundedRect(10, 20, 50, 60)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), *clip, e0()) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1367,15 +1347,13 @@ auto effect = CreateOpacityEffect(e0(), transform2.get(), &c0(), opacity); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1415,15 +1393,13 @@ CreateOpacityEffect(e0(), transform2.get(), clip.get(), opacity); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), *clip, *effect) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1452,15 +1428,13 @@ auto effect = CreateOpacityEffect(e0(), &t0(), clip.get(), opacity); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), *clip, *effect) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1486,15 +1460,13 @@ auto clip2 = CreateClip(*clip, &t0(), FloatRoundedRect(10, 20, 50, 60)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(t0(), *clip2, e0()) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1522,15 +1494,13 @@ CreateTransform(*transform, TransformationMatrix().Translate(20, 25), FloatPoint3D(100, 100, 0)); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(*transform2, *clip, e0()) .RectDrawing(FloatRect(0, 0, 300, 400), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); ASSERT_EQ(1u, ContentLayerCount()); { @@ -1553,15 +1523,13 @@ CompositingReason::k3DTransform); TestPaintArtifact test_artifact; - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); test_artifact.Chunk(*transform, c0(), e0()) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); - test_artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 200, 300), Color::kGray); - const PaintArtifact& artifact = test_artifact.Build(); - ASSERT_EQ(3u, artifact.PaintChunks().size()); + auto artifact = test_artifact.Build(); + ASSERT_EQ(3u, artifact->PaintChunks().size()); Update(artifact); // The third paint chunk overlaps the second but can't merge due to // incompatible transform. The second paint chunk can't merge into the first @@ -1782,12 +1750,13 @@ auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(100, 100, 300, 200)); auto effect = CreateOpacityEffect(e0(), 0.5); - TestPaintArtifact artifact; - artifact.Chunk(*transform, *clip, *effect) + TestPaintArtifact test_artifact; + test_artifact.Chunk(*transform, *clip, *effect) .RectDrawing(FloatRect(0, 0, 100, 100), Color::kWhite); - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); - Update(artifact.Build()); + test_artifact.Chunk().RectDrawing(FloatRect(0, 0, 100, 100), Color::kGray); + auto artifact = test_artifact.Build(); + + Update(artifact); // Two content layers for the differentiated rect drawings and three dummy // layers for each of the transform, clip and effect nodes. @@ -1798,7 +1767,7 @@ EXPECT_EQ(sequence_number, layer->property_tree_sequence_number()); } - Update(artifact.Build()); + Update(artifact); EXPECT_EQ(2u, RootLayer()->children().size()); sequence_number++; @@ -1807,7 +1776,7 @@ EXPECT_EQ(sequence_number, layer->property_tree_sequence_number()); } - Update(artifact.Build()); + Update(artifact); EXPECT_EQ(2u, RootLayer()->children().size()); sequence_number++; @@ -1823,8 +1792,7 @@ auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(75, 75, 100, 100)); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 50, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 50, 100, 100), Color::kGray); artifact.Chunk(t0(), *clip, e0()) .RectDrawing(FloatRect(100, 100, 100, 100), Color::kGray); Update(artifact.Build()); @@ -1843,12 +1811,10 @@ auto effect = CreateOpacityEffect(e0(), 0.5); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(25, 75, 100, 100), Color::kGray); - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); Update(artifact.Build()); ASSERT_EQ(1u, ContentLayerCount()); @@ -1863,12 +1829,10 @@ auto effect = CreateOpacityEffect(e0(), 0.5f, CompositingReason::kAll); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(25, 75, 100, 100), Color::kGray); - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); Update(artifact.Build()); ASSERT_EQ(3u, ContentLayerCount()); @@ -1900,12 +1864,10 @@ auto effect3 = CreateOpacityEffect(*effect2, 0.3f); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); artifact.Chunk(t0(), c0(), *effect3) .RectDrawing(FloatRect(25, 75, 100, 100), Color::kGray); - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(75, 75, 100, 100), Color::kGray); Update(artifact.Build()); ASSERT_EQ(3u, ContentLayerCount()); @@ -1939,8 +1901,7 @@ CompositingReason::k3DTransform); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 25, 100, 100), Color::kGray); artifact.Chunk(t0(), c0(), *effect) .RectDrawing(FloatRect(25, 75, 100, 100), Color::kGray); artifact.Chunk(*transform, c0(), *effect) @@ -1975,8 +1936,7 @@ auto transform = CreateTransform(t0(), TransformationMatrix(), FloatPoint3D(), CompositingReason::k3DTransform); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(0, 0, 50, 50), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(0, 0, 50, 50), Color::kGray); artifact.Chunk(t0(), c0(), *effect1) .RectDrawing(FloatRect(100, 0, 50, 50), Color::kGray); // This chunk has a transform that must be composited, thus causing effect1 @@ -2038,95 +1998,93 @@ } TEST_F(PaintArtifactCompositorTest, SkipChunkWithOpacityZero) { - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0, false, false); - ASSERT_EQ(0u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0, true, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0, true, true); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0, false, true); - ASSERT_EQ(1u, ContentLayerCount()); - } + UpdateWithArtifactWithOpacity(0, false, false); + ASSERT_EQ(0u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + SkipChunkWithOpacityZeroWithPrecedingChunk) { + UpdateWithArtifactWithOpacity(0, true, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, SkipChunkWithOpacityZeroSubsequentChunk) { + UpdateWithArtifactWithOpacity(0, false, true); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + SkipChunkWithOpacityZeroWithPrecedingAndSubsequentChunk) { + UpdateWithArtifactWithOpacity(0, true, true); + ASSERT_EQ(1u, ContentLayerCount()); } TEST_F(PaintArtifactCompositorTest, SkipChunkWithTinyOpacity) { - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0003f, false, false); - ASSERT_EQ(0u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0003f, true, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0003f, true, true); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0003f, false, true); - ASSERT_EQ(1u, ContentLayerCount()); - } + UpdateWithArtifactWithOpacity(0.0003f, false, false); + ASSERT_EQ(0u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + SkipChunkWithTinyOpacityWithPrecedingChunk) { + UpdateWithArtifactWithOpacity(0.0003f, true, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, SkipChunkWithTinyOpacitySubsequentChunk) { + UpdateWithArtifactWithOpacity(0.0003f, false, true); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + SkipChunkWithTinyOpacityWithPrecedingAndSubsequentChunk) { + UpdateWithArtifactWithOpacity(0.0003f, true, true); + ASSERT_EQ(1u, ContentLayerCount()); } TEST_F(PaintArtifactCompositorTest, DontSkipChunkWithMinimumOpacity) { - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0004f, false, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0004f, true, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0004f, true, true); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.0004f, false, true); - ASSERT_EQ(1u, ContentLayerCount()); - } + UpdateWithArtifactWithOpacity(0.0004f, false, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithMinimumOpacityWithPrecedingChunk) { + UpdateWithArtifactWithOpacity(0.0004f, true, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithMinimumOpacitySubsequentChunk) { + UpdateWithArtifactWithOpacity(0.0004f, false, true); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithMinimumOpacityWithPrecedingAndSubsequentChunk) { + UpdateWithArtifactWithOpacity(0.0004f, true, true); + ASSERT_EQ(1u, ContentLayerCount()); } TEST_F(PaintArtifactCompositorTest, DontSkipChunkWithAboveMinimumOpacity) { - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.3f, false, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.3f, true, false); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.3f, true, true); - ASSERT_EQ(1u, ContentLayerCount()); - } - { - TestPaintArtifact artifact; - CreateSimpleArtifactWithOpacity(artifact, 0.3f, false, true); - ASSERT_EQ(1u, ContentLayerCount()); - } + UpdateWithArtifactWithOpacity(0.3f, false, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithAboveMinimumOpacityWithPrecedingChunk) { + UpdateWithArtifactWithOpacity(0.3f, true, false); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithAboveMinimumOpacitySubsequentChunk) { + UpdateWithArtifactWithOpacity(0.3f, false, true); + ASSERT_EQ(1u, ContentLayerCount()); +} + +TEST_F(PaintArtifactCompositorTest, + DontSkipChunkWithAboveMinimumOpacityWithPrecedingAndSubsequentChunk) { + UpdateWithArtifactWithOpacity(0.3f, true, true); + ASSERT_EQ(1u, ContentLayerCount()); } TEST_F(PaintArtifactCompositorTest, @@ -2765,8 +2723,7 @@ TEST_F(PaintArtifactCompositorTest, ContentsNonOpaque) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(100, 100, 200, 200), Color::kBlack); + artifact.Chunk().RectDrawing(FloatRect(100, 100, 200, 200), Color::kBlack); Update(artifact.Build()); ASSERT_EQ(1u, ContentLayerCount()); EXPECT_FALSE(ContentLayerAt(0)->contents_opaque()); @@ -2774,7 +2731,7 @@ TEST_F(PaintArtifactCompositorTest, ContentsOpaque) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) + artifact.Chunk() .RectDrawing(FloatRect(100, 100, 200, 200), Color::kBlack) .KnownToBeOpaque(); Update(artifact.Build()); @@ -2784,7 +2741,7 @@ TEST_F(PaintArtifactCompositorTest, ContentsOpaqueSubpixel) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) + artifact.Chunk() .RectDrawing(FloatRect(100.5, 100.5, 200, 200), Color::kBlack) .KnownToBeOpaque(); Update(artifact.Build()); @@ -2795,10 +2752,10 @@ TEST_F(PaintArtifactCompositorTest, ContentsOpaqueUnitedNonOpaque) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) + artifact.Chunk() .RectDrawing(FloatRect(100, 100, 200, 200), Color::kBlack) .KnownToBeOpaque() - .Chunk(t0(), c0(), e0()) + .Chunk() .RectDrawing(FloatRect(200, 200, 200, 200), Color::kBlack) .KnownToBeOpaque(); Update(artifact.Build()); @@ -2809,10 +2766,10 @@ TEST_F(PaintArtifactCompositorTest, ContentsOpaqueUnitedOpaque1) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) + artifact.Chunk() .RectDrawing(FloatRect(100, 100, 300, 300), Color::kBlack) .KnownToBeOpaque() - .Chunk(t0(), c0(), e0()) + .Chunk() .RectDrawing(FloatRect(200, 200, 200, 200), Color::kBlack) .KnownToBeOpaque(); Update(artifact.Build()); @@ -2823,10 +2780,10 @@ TEST_F(PaintArtifactCompositorTest, ContentsOpaqueUnitedOpaque2) { TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) + artifact.Chunk() .RectDrawing(FloatRect(100, 100, 200, 200), Color::kBlack) .KnownToBeOpaque() - .Chunk(t0(), c0(), e0()) + .Chunk() .RectDrawing(FloatRect(100, 100, 300, 300), Color::kBlack) .KnownToBeOpaque(); Update(artifact.Build()); @@ -2844,8 +2801,7 @@ auto effect1 = CreateOpacityEffect(e0(), &t0(), nullptr, 0.5); TestPaintArtifact artifact; - artifact.Chunk(t0(), c0(), e0()) - .RectDrawing(FloatRect(50, 50, 100, 100), Color::kGray); + artifact.Chunk().RectDrawing(FloatRect(50, 50, 100, 100), Color::kGray); artifact.Chunk(t0(), *clip1, *effect1) .RectDrawing(FloatRect(100, 100, 100, 100), Color::kGray); Update(artifact.Build()); @@ -2891,6 +2847,8 @@ TestPaintArtifact artifact1; artifact1.Chunk(t0(), *clip, e0()) .RectDrawing(FloatRect(50, 50, 200, 200), Color::kBlack); + artifact1.Client(0).Validate(); + artifact1.Client(1).Validate(); Update(artifact1.Build()); ASSERT_EQ(1u, ContentLayerCount()); @@ -2902,14 +2860,16 @@ Pointee(DrawsRectangle(FloatRect(0, 0, 200, 200), Color::kBlack))); // The layer's painting overflows the left, top, right edges of the clip. - TestPaintArtifact artifact2; - artifact2.Chunk(artifact1.Client(0), t0(), *clip, e0()) - .RectDrawing(artifact1.Client(1), FloatRect(0, 0, 400, 200), - Color::kBlack); + auto artifact2 = TestPaintArtifact() + .Chunk(artifact1.Client(0)) + .Properties(t0(), *clip, e0()) + .RectDrawing(artifact1.Client(1), + FloatRect(0, 0, 400, 200), Color::kBlack) + .Build(); // Simluate commit to the compositor thread. layer->PushPropertiesTo( layer->CreateLayerImpl(host_impl.active_tree()).get()); - Update(artifact2.Build()); + Update(artifact2); ASSERT_EQ(1u, ContentLayerCount()); ASSERT_EQ(layer, ContentLayerAt(0)); @@ -2922,14 +2882,17 @@ Pointee(DrawsRectangle(FloatRect(0, 0, 390, 180), Color::kBlack))); // The layer's painting overflows all edges of the clip. - TestPaintArtifact artifact3; - artifact3.Chunk(artifact1.Client(0), t0(), *clip, e0()) - .RectDrawing(artifact1.Client(1), FloatRect(-100, -200, 500, 800), - Color::kBlack); + auto artifact3 = + TestPaintArtifact() + .Chunk(artifact1.Client(0)) + .Properties(t0(), *clip, e0()) + .RectDrawing(artifact1.Client(1), FloatRect(-100, -200, 500, 800), + Color::kBlack) + .Build(); // Simluate commit to the compositor thread. layer->PushPropertiesTo( layer->CreateLayerImpl(host_impl.active_tree()).get()); - Update(artifact3.Build()); + Update(artifact3); ASSERT_EQ(1u, ContentLayerCount()); ASSERT_EQ(layer, ContentLayerAt(0));
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc index 0121f07..eba6838 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -287,8 +287,13 @@ // Notify the controllers that the artifact has been pushed and some // lifecycle state can be freed (such as raster invalidations). - for (auto* layer : repainted_layers) + for (auto* layer : repainted_layers) { +#if DCHECK_IS_ON() + if (VLOG_IS_ON(2)) + LOG(ERROR) << "FinishCycle for GraphicsLayer: " << layer->DebugName(); +#endif layer->GetPaintController().FinishCycle(); + } #if DCHECK_IS_ON() if (VLOG_IS_ON(2)) { @@ -345,9 +350,9 @@ DCHECK(layer_state_) << "No layer state for GraphicsLayer: " << DebugName(); // Generate raster invalidations for SPv1. IntRect layer_bounds(layer_state_->offset, Size()); - EnsureRasterInvalidator().Generate(GetPaintController().GetPaintArtifact(), - layer_bounds, layer_state_->state, - VisualRectSubpixelOffset(), this); + EnsureRasterInvalidator().Generate( + GetPaintController().GetPaintArtifactShared(), layer_bounds, + layer_state_->state, VisualRectSubpixelOffset(), this); if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && DrawsContent()) { @@ -590,9 +595,6 @@ EnsureRasterInvalidator().SetTracksRasterInvalidations(true); else if (raster_invalidator_) raster_invalidator_->SetTracksRasterInvalidations(false); - - if (paint_controller_) - paint_controller_->SetTracksRasterInvalidations(should_track); } void GraphicsLayer::ResetTrackedRasterInvalidations() { @@ -1147,8 +1149,6 @@ if (!DrawsContent()) return; - // TODO(chrishtr): Stop invalidating the rects once - // FrameView::paintRecursively() does so. layer_->SetNeedsDisplay(); for (size_t i = 0; i < link_highlights_.size(); ++i) link_highlights_[i]->Invalidate(); @@ -1316,11 +1316,8 @@ PaintController& GraphicsLayer::GetPaintController() const { CHECK(DrawsContent()); - if (!paint_controller_) { + if (!paint_controller_) paint_controller_ = PaintController::Create(); - paint_controller_->SetTracksRasterInvalidations( - client_.IsTrackingRasterInvalidations()); - } return *paint_controller_; }
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer_test.cc b/third_party/blink/renderer/platform/graphics/graphics_layer_test.cc index 307d2daa..d2fd8f5 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer_test.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer_test.cc
@@ -99,6 +99,11 @@ return layer.PaintWithoutCommit(interest_rect); } + void CommitAndFinishCycle(GraphicsLayer& layer) { + layer.GetPaintController().CommitNewDisplayItems(); + layer.GetPaintController().FinishCycle(); + } + const RasterInvalidator* GetInternalRasterInvalidator( const GraphicsLayer& layer) { return layer.raster_invalidator_.get(); @@ -213,23 +218,23 @@ TEST_P(GraphicsLayerTest, Paint) { IntRect interest_rect(1, 2, 3, 4); EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); - graphics_layer_->GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(*graphics_layer_); client_.SetNeedsRepaint(true); EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); - graphics_layer_->GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(*graphics_layer_); client_.SetNeedsRepaint(false); EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); interest_rect.Move(IntSize(10, 20)); EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); - graphics_layer_->GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(*graphics_layer_); EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); graphics_layer_->SetNeedsDisplay(); EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); - graphics_layer_->GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(*graphics_layer_); EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect)); }
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc new file mode 100644 index 0000000..fb7e41ea --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc
@@ -0,0 +1,249 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h" + +#include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" + +namespace blink { + +void DisplayItemRasterInvalidator::Generate() { + struct OldAndNewDisplayItems { + const FloatRect* old_visual_rect = nullptr; + const FloatRect* new_visual_rect = nullptr; + PaintInvalidationReason reason = PaintInvalidationReason::kNone; + }; + // If there are multiple display items changed for a client, the map will + // store only one (pair) of them because we only need the visual rect and the + // the multiple items have the same visual rect. + HashMap<const DisplayItemClient*, OldAndNewDisplayItems> + clients_to_invalidate; + + Vector<bool> old_display_items_matched; + old_display_items_matched.resize(old_chunk_.size()); + size_t old_index = old_chunk_.begin_index; + size_t max_cached_old_index = old_index; + + for (const auto& new_item : + new_paint_artifact_.GetDisplayItemList().ItemsInPaintChunk(new_chunk_)) { + size_t matched_old_index = + MatchNewDisplayItemInOldChunk(new_item, old_index); + if (matched_old_index == kNotFound) { + if (new_item.DrawsContent()) { + // Will invalidate for the new display item which doesn't match any old + // display item. + auto& value = clients_to_invalidate + .insert(&new_item.Client(), OldAndNewDisplayItems()) + .stored_value->value; + if (!value.new_visual_rect) { + value.new_visual_rect = &new_item.VisualRect(); + value.reason = new_item.Client().IsCacheable() + ? PaintInvalidationReason::kAppeared + : PaintInvalidationReason::kUncacheable; + } + } + continue; + } + + auto reason = new_item.Client().GetPaintInvalidationReason(); + if (!IsFullPaintInvalidationReason(reason) && + matched_old_index < max_cached_old_index) { + // |new_item| has been moved above other cached items. + reason = PaintInvalidationReason::kReordered; + } + + const auto& old_item = + old_paint_artifact_.GetDisplayItemList()[matched_old_index]; + if (reason != PaintInvalidationReason::kNone && + (old_item.DrawsContent() || new_item.DrawsContent())) { + // The display item reordered, skipped cache or changed. Will invalidate + // for both the old and new display items. + auto& value = clients_to_invalidate + .insert(&new_item.Client(), OldAndNewDisplayItems()) + .stored_value->value; + if (old_item.IsTombstone() || old_item.DrawsContent()) + value.old_visual_rect = &old_item.VisualRect(); + if (new_item.DrawsContent()) + value.new_visual_rect = &new_item.VisualRect(); + value.reason = reason; + } + + size_t offset = matched_old_index - old_chunk_.begin_index; + DCHECK(!old_display_items_matched[offset]); + old_display_items_matched[offset] = true; + + old_index = matched_old_index + 1; + if (old_index == old_chunk_.end_index) + old_index = old_chunk_.begin_index; + + // |old_item.IsTombstone()| is true means that |new_item| was copied from + // cached |old_item|. + if (old_item.IsTombstone()) + max_cached_old_index = std::max(max_cached_old_index, matched_old_index); + } + + // Invalidate remaining unmatched (disappeared or uncacheable) old items. + for (size_t i = old_chunk_.begin_index; i < old_chunk_.end_index; ++i) { + if (old_display_items_matched[i - old_chunk_.begin_index]) + continue; + + const auto& old_item = old_paint_artifact_.GetDisplayItemList()[i]; + if (old_item.DrawsContent() || old_item.IsTombstone()) { + clients_to_invalidate.insert(&old_item.Client(), OldAndNewDisplayItems()) + .stored_value->value.old_visual_rect = &old_item.VisualRect(); + } + } + + for (const auto& item : clients_to_invalidate) { + GenerateRasterInvalidation(*item.key, item.value.old_visual_rect, + item.value.new_visual_rect, item.value.reason); + } +} + +size_t DisplayItemRasterInvalidator::MatchNewDisplayItemInOldChunk( + const DisplayItem& new_item, + size_t old_index) { + if (!new_item.IsCacheable()) + return kNotFound; + + for (size_t i = old_index; i < old_chunk_.end_index; i++) { + const auto& old_item = old_paint_artifact_.GetDisplayItemList()[i]; + if (old_item.IsCacheable() && old_item.GetId() == new_item.GetId()) + return i; + } + for (size_t i = old_chunk_.begin_index; i < old_index; i++) { + const auto& old_item = old_paint_artifact_.GetDisplayItemList()[i]; + if (old_item.IsCacheable() && old_item.GetId() == new_item.GetId()) + return i; + } + return kNotFound; +} + +void DisplayItemRasterInvalidator::AddRasterInvalidation( + const DisplayItemClient& client, + const FloatRect& rect, + PaintInvalidationReason reason, + RasterInvalidator::ClientIsOldOrNew old_or_new) { + auto r = invalidator_.ClipByLayerBounds(mapper_.MapVisualRect(rect)); + if (r.IsEmpty()) + return; + + invalidator_.AddRasterInvalidation(EnclosingIntRect(r), client, reason, + old_or_new); +} + +void DisplayItemRasterInvalidator::GenerateRasterInvalidation( + const DisplayItemClient& client, + const FloatRect* old_visual_rect, + const FloatRect* new_visual_rect, + PaintInvalidationReason reason) { + if (!new_visual_rect || new_visual_rect->IsEmpty()) { + if (old_visual_rect && !old_visual_rect->IsEmpty()) { + AddRasterInvalidation(client, *old_visual_rect, + PaintInvalidationReason::kDisappeared, + kClientIsOld); + } + return; + } + + if (!old_visual_rect || old_visual_rect->IsEmpty()) { + AddRasterInvalidation(client, *new_visual_rect, + PaintInvalidationReason::kAppeared, kClientIsNew); + return; + } + + if (client.IsJustCreated()) { + // The old client has been deleted and the new client happens to be at the + // same address. They have no relationship. + AddRasterInvalidation(client, *old_visual_rect, + PaintInvalidationReason::kDisappeared, kClientIsOld); + AddRasterInvalidation(client, *new_visual_rect, + PaintInvalidationReason::kAppeared, kClientIsNew); + return; + } + + if (IsFullPaintInvalidationReason(reason)) { + GenerateFullRasterInvalidation(client, *old_visual_rect, *new_visual_rect, + reason); + return; + } + + GenerateIncrementalRasterInvalidation(client, *old_visual_rect, + *new_visual_rect); + + auto partial_rect = client.PartialInvalidationVisualRect(); + if (!partial_rect.IsEmpty()) { + AddRasterInvalidation(client, FloatRect(partial_rect), reason, + kClientIsNew); + } +} + +static FloatRect ComputeRightDelta(const FloatPoint& location, + const FloatSize& old_size, + const FloatSize& new_size) { + float delta = new_size.Width() - old_size.Width(); + if (delta > 0) { + return FloatRect(location.X() + old_size.Width(), location.Y(), delta, + new_size.Height()); + } + if (delta < 0) { + return FloatRect(location.X() + new_size.Width(), location.Y(), -delta, + old_size.Height()); + } + return FloatRect(); +} + +static FloatRect ComputeBottomDelta(const FloatPoint& location, + const FloatSize& old_size, + const FloatSize& new_size) { + float delta = new_size.Height() - old_size.Height(); + if (delta > 0) { + return FloatRect(location.X(), location.Y() + old_size.Height(), + new_size.Width(), delta); + } + if (delta < 0) { + return FloatRect(location.X(), location.Y() + new_size.Height(), + old_size.Width(), -delta); + } + return FloatRect(); +} + +void DisplayItemRasterInvalidator::GenerateIncrementalRasterInvalidation( + const DisplayItemClient& client, + const FloatRect& old_visual_rect, + const FloatRect& new_visual_rect) { + DCHECK(old_visual_rect.Location() == new_visual_rect.Location()); + + FloatRect right_delta = + ComputeRightDelta(new_visual_rect.Location(), old_visual_rect.Size(), + new_visual_rect.Size()); + if (!right_delta.IsEmpty()) { + AddRasterInvalidation(client, right_delta, + PaintInvalidationReason::kIncremental, kClientIsNew); + } + + FloatRect bottom_delta = + ComputeBottomDelta(new_visual_rect.Location(), old_visual_rect.Size(), + new_visual_rect.Size()); + if (!bottom_delta.IsEmpty()) { + AddRasterInvalidation(client, bottom_delta, + PaintInvalidationReason::kIncremental, kClientIsNew); + } +} + +void DisplayItemRasterInvalidator::GenerateFullRasterInvalidation( + const DisplayItemClient& client, + const FloatRect& old_visual_rect, + const FloatRect& new_visual_rect, + PaintInvalidationReason reason) { + if (!new_visual_rect.Contains(old_visual_rect)) { + AddRasterInvalidation(client, old_visual_rect, reason, kClientIsNew); + if (old_visual_rect.Contains(new_visual_rect)) + return; + } + + AddRasterInvalidation(client, new_visual_rect, reason, kClientIsNew); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h new file mode 100644 index 0000000..ad02292 --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h
@@ -0,0 +1,67 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DISPLAY_ITEM_RASTER_INVALIDATOR_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DISPLAY_ITEM_RASTER_INVALIDATOR_H_ + +#include "third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h" + +namespace blink { + +// Generates raster invalidation for changed display items in a chunk. +class DisplayItemRasterInvalidator { + public: + DisplayItemRasterInvalidator(RasterInvalidator& invalidator, + const PaintArtifact& old_paint_artifact, + const PaintArtifact& new_paint_artifact, + const PaintChunk& old_chunk, + const PaintChunk& new_chunk, + const ChunkToLayerMapper& mapper) + : invalidator_(invalidator), + old_paint_artifact_(old_paint_artifact), + new_paint_artifact_(new_paint_artifact), + old_chunk_(old_chunk), + new_chunk_(new_chunk), + mapper_(mapper) { + DCHECK(old_chunk_.Matches(new_chunk_)); + } + + void Generate(); + + private: + static const auto kClientIsOld = RasterInvalidator::kClientIsOld; + static const auto kClientIsNew = RasterInvalidator::kClientIsNew; + + ALWAYS_INLINE void AddRasterInvalidation(const DisplayItemClient&, + const FloatRect&, + PaintInvalidationReason, + RasterInvalidator::ClientIsOldOrNew); + ALWAYS_INLINE size_t + MatchNewDisplayItemInOldChunk(const DisplayItem& new_item, size_t old_index); + ALWAYS_INLINE void GenerateRasterInvalidation( + const DisplayItemClient&, + const FloatRect* old_visual_rect, + const FloatRect* new_visual_rect, + PaintInvalidationReason); + ALWAYS_INLINE void GenerateIncrementalRasterInvalidation( + const DisplayItemClient&, + const FloatRect& old_visual_rect, + const FloatRect& new_visual_rect); + ALWAYS_INLINE void GenerateFullRasterInvalidation( + const DisplayItemClient&, + const FloatRect& old_visual_rect, + const FloatRect& new_visual_rect, + PaintInvalidationReason reason); + + RasterInvalidator& invalidator_; + const PaintArtifact& old_paint_artifact_; + const PaintArtifact& new_paint_artifact_; + const PaintChunk& old_chunk_; + const PaintChunk& new_chunk_; + const ChunkToLayerMapper& mapper_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_DISPLAY_ITEM_PAINT_RASTER_INVALIDATOR_H_
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc new file mode 100644 index 0000000..97ffe55 --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc
@@ -0,0 +1,639 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h" + +#include "testing/gmock/include/gmock/gmock.h" +#include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" +#include "third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h" +#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h" +#include "third_party/blink/renderer/platform/testing/test_paint_artifact.h" + +namespace blink { + +using ::testing::UnorderedElementsAre; + +class DisplayItemRasterInvalidatorTest : public PaintControllerTestBase { + protected: + DisplayItemRasterInvalidatorTest() : invalidator_([](const IntRect&) {}) {} + + Vector<RasterInvalidationInfo> GenerateRasterInvalidations() { + GetPaintController().CommitNewDisplayItems(); + invalidator_.Generate( + GetPaintController().GetPaintArtifactShared(), + // The layer rect is big enough not to clip display item raster + // invalidation rects. + IntRect(0, 0, 20000, 20000), PropertyTreeState::Root()); + GetPaintController().FinishCycle(); + + if (invalidator_.GetTracking()) + return invalidator_.GetTracking()->Invalidations(); + return Vector<RasterInvalidationInfo>(); + } + + // In this file, DisplayItemRasterInvalidator is tested through + // RasterInvalidator. + RasterInvalidator invalidator_; +}; + +TEST_F(DisplayItemRasterInvalidatorTest, RemoveItemInMiddle) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 200, 200)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 300, 300)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 300, 300)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &second, "second", IntRect(100, 100, 200, 200), + PaintInvalidationReason::kDisappeared})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrder) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, second, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + DrawRect(context, unaffected, kForegroundType, FloatRect(300, 300, 10, 10)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, second, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + DrawRect(context, unaffected, kForegroundType, FloatRect(300, 300, 10, 10)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &first, "first", IntRect(100, 100, 100, 100), + PaintInvalidationReason::kReordered})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderAndInvalidateFirst) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + first.Invalidate(PaintInvalidationReason::kOutline); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &first, "first", IntRect(100, 100, 100, 100), + PaintInvalidationReason::kOutline})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderAndInvalidateSecond) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + second.Invalidate(PaintInvalidationReason::kOutline); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &second, "second", IntRect(100, 100, 50, 200), + PaintInvalidationReason::kOutline})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderWithIncrementalInvalidation) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + first.SetVisualRect(LayoutRect(100, 100, 200, 100)); + first.Invalidate(PaintInvalidationReason::kIncremental); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, unaffected, kBackgroundType, FloatRect(300, 300, 10, 10)); + + // Incremental invalidation is not applicable when the item is reordered. + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &first, "first", IntRect(100, 100, 200, 100), + PaintInvalidationReason::kReordered})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, NewItemInMiddle) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, third, kBackgroundType, FloatRect(125, 100, 200, 50)); + DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 50, 200)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &third, "third", IntRect(125, 100, 200, 50), + PaintInvalidationReason::kAppeared})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, Incremental) { + LayoutRect initial_rect(100, 100, 100, 100); + std::unique_ptr<FakeDisplayItemClient> clients[6]; + for (size_t i = 0; i < base::size(clients); i++) { + clients[i] = std::make_unique<FakeDisplayItemClient>( + String::Format("%zu", i), initial_rect); + } + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + + for (auto& client : clients) + DrawRect(context, *client, kBackgroundType, FloatRect(initial_rect)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + clients[0]->SetVisualRect(LayoutRect(100, 100, 150, 100)); + clients[1]->SetVisualRect(LayoutRect(100, 100, 100, 150)); + clients[2]->SetVisualRect(LayoutRect(100, 100, 150, 80)); + clients[3]->SetVisualRect(LayoutRect(100, 100, 80, 150)); + clients[4]->SetVisualRect(LayoutRect(100, 100, 150, 150)); + clients[5]->SetVisualRect(LayoutRect(100, 100, 80, 80)); + for (auto& client : clients) { + client->Invalidate(PaintInvalidationReason::kIncremental); + DrawRect(context, *client, kBackgroundType, + FloatRect(client->VisualRect())); + } + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{clients[0].get(), "0", + IntRect(200, 100, 50, 100), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[1].get(), "1", + IntRect(100, 200, 100, 50), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[2].get(), "2", + IntRect(200, 100, 50, 80), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[2].get(), "2", + IntRect(100, 180, 100, 20), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[3].get(), "3", + IntRect(180, 100, 20, 100), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[3].get(), "3", + IntRect(100, 200, 80, 50), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[4].get(), "4", + IntRect(200, 100, 50, 150), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[4].get(), "4", + IntRect(100, 200, 150, 50), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{clients[5].get(), "5", + IntRect(180, 100, 20, 100), + PaintInvalidationReason::kIncremental}, + RasterInvalidationInfo{ + clients[5].get(), "5", IntRect(100, 180, 100, 20), + PaintInvalidationReason::kIncremental})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, AddRemoveFirstAndInvalidateSecond) { + FakeDisplayItemClient chunk("chunk"); + FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); + FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, second, kBackgroundType, FloatRect(200, 200, 50, 50)); + DrawRect(context, second, kForegroundType, FloatRect(200, 200, 50, 50)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + first.Invalidate(); + second.Invalidate(); + second.SetVisualRect(LayoutRect(150, 250, 100, 100)); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 150, 150)); + DrawRect(context, second, kBackgroundType, FloatRect(150, 250, 100, 100)); + DrawRect(context, second, kForegroundType, FloatRect(150, 250, 100, 100)); + EXPECT_EQ(0, NumCachedNewItems()); + + EXPECT_THAT( + GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&first, "first", IntRect(100, 100, 150, 150), + PaintInvalidationReason::kAppeared}, + RasterInvalidationInfo{&second, "second", IntRect(200, 200, 50, 50), + PaintInvalidationReason::kFull}, + RasterInvalidationInfo{&second, "second", IntRect(150, 250, 100, 100), + PaintInvalidationReason::kFull})); + invalidator_.SetTracksRasterInvalidations(false); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + DrawRect(context, second, kBackgroundType, FloatRect(150, 250, 100, 100)); + DrawRect(context, second, kForegroundType, FloatRect(150, 250, 100, 100)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &first, "first", IntRect(100, 100, 150, 150), + PaintInvalidationReason::kDisappeared})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, InvalidateFirstAndAddRemoveSecond) { + FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); + FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 150, 150)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + first.Invalidate(); + first.SetVisualRect(LayoutRect(150, 150, 100, 100)); + second.Invalidate(); + DrawRect(context, first, kBackgroundType, FloatRect(150, 150, 100, 100)); + DrawRect(context, first, kForegroundType, FloatRect(150, 150, 100, 100)); + DrawRect(context, second, kBackgroundType, FloatRect(200, 200, 50, 50)); + DrawRect(context, second, kForegroundType, FloatRect(200, 200, 50, 50)); + + EXPECT_THAT( + GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&first, "first", IntRect(100, 100, 150, 150), + PaintInvalidationReason::kFull}, + RasterInvalidationInfo{&second, "second", IntRect(200, 200, 50, 50), + PaintInvalidationReason::kAppeared})); + invalidator_.SetTracksRasterInvalidations(false); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + first.Invalidate(); + first.SetVisualRect(LayoutRect(100, 100, 150, 150)); + second.Invalidate(); + DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); + DrawRect(context, first, kForegroundType, FloatRect(100, 100, 150, 150)); + + EXPECT_THAT( + GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&first, "first", IntRect(100, 100, 150, 150), + PaintInvalidationReason::kFull}, + RasterInvalidationInfo{&second, "second", IntRect(200, 200, 50, 50), + PaintInvalidationReason::kDisappeared})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderWithChildren) { + FakeDisplayItemClient container1("container1", + LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient container2("container2", + LayoutRect(100, 200, 100, 100)); + FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, content2, kForegroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, container2, kForegroundType, FloatRect(100, 200, 100, 100)); + GenerateRasterInvalidations(); + + // Simulate the situation when |container1| gets a z-index that is greater + // than that of |container2|. + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, content2, kForegroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, container2, kForegroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&container1, "container1", + IntRect(100, 100, 100, 100), + PaintInvalidationReason::kReordered}, + RasterInvalidationInfo{&content1, "content1", + IntRect(100, 100, 50, 200), + PaintInvalidationReason::kReordered})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderWithChildrenAndInvalidation) { + FakeDisplayItemClient container1("container1", + LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient container2("container2", + LayoutRect(100, 200, 100, 100)); + FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, content2, kForegroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, container2, kForegroundType, FloatRect(100, 200, 100, 100)); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + // Simulate the situation when |container1| gets a z-index that is greater + // than that of |container2|, and |container1| is invalidated. + container2.Invalidate(); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, content2, kForegroundType, FloatRect(100, 200, 50, 200)); + DrawRect(context, container2, kForegroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&container1, "container1", + IntRect(100, 100, 100, 100), + PaintInvalidationReason::kReordered}, + RasterInvalidationInfo{&content1, "content1", + IntRect(100, 100, 50, 200), + PaintInvalidationReason::kReordered}, + RasterInvalidationInfo{&container2, "container2", + IntRect(100, 200, 100, 100), + PaintInvalidationReason::kFull})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SwapOrderCrossingChunks) { + FakeDisplayItemClient container1("container1", + LayoutRect(100, 100, 100, 100)); + FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); + FakeDisplayItemClient container2("container2", + LayoutRect(100, 200, 100, 100)); + FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); + GraphicsContext context(GetPaintController()); + + auto container1_effect = CreateOpacityEffect(e0(), 0.5); + auto container1_properties = DefaultPaintChunkProperties(); + container1_properties.SetEffect(container1_effect.get()); + + auto container2_effect = CreateOpacityEffect(e0(), 0.5); + auto container2_properties = DefaultPaintChunkProperties(); + container2_properties.SetEffect(container2_effect.get()); + + GetPaintController().UpdateCurrentPaintChunkProperties( + PaintChunk::Id(container1, kBackgroundType), container1_properties); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + GetPaintController().UpdateCurrentPaintChunkProperties( + PaintChunk::Id(container2, kBackgroundType), container2_properties); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + GenerateRasterInvalidations(); + + // Move content2 into container1, without invalidation. + invalidator_.SetTracksRasterInvalidations(true); + GetPaintController().UpdateCurrentPaintChunkProperties( + PaintChunk::Id(container1, kBackgroundType), container1_properties); + DrawRect(context, container1, kBackgroundType, FloatRect(100, 100, 100, 100)); + DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); + DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); + GetPaintController().UpdateCurrentPaintChunkProperties( + PaintChunk::Id(container2, kBackgroundType), container2_properties); + DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&content2, "content2", + IntRect(100, 200, 50, 200), + PaintInvalidationReason::kDisappeared}, + RasterInvalidationInfo{&content2, "content2", + IntRect(100, 200, 50, 200), + PaintInvalidationReason::kAppeared})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, SkipCache) { + FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200)); + FakeDisplayItemClient content("content", LayoutRect(100, 100, 100, 100)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + FloatRect rect1(100, 100, 50, 50); + FloatRect rect2(150, 100, 50, 50); + FloatRect rect3(200, 100, 50, 50); + + DrawRect(context, multicol, kBackgroundType, FloatRect(100, 200, 100, 100)); + GetPaintController().BeginSkippingCache(); + DrawRect(context, content, kForegroundType, rect1); + DrawRect(context, content, kForegroundType, rect2); + GetPaintController().EndSkippingCache(); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + // Draw again with nothing invalidated. + EXPECT_TRUE(ClientCacheIsValid(multicol)); + DrawRect(context, multicol, kBackgroundType, FloatRect(100, 200, 100, 100)); + + GetPaintController().BeginSkippingCache(); + DrawRect(context, content, kForegroundType, rect1); + DrawRect(context, content, kForegroundType, rect2); + GetPaintController().EndSkippingCache(); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &content, "content", IntRect(100, 100, 100, 100), + PaintInvalidationReason::kUncacheable})); + invalidator_.SetTracksRasterInvalidations(false); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + // Now the multicol becomes 3 columns and repaints. + multicol.Invalidate(); + DrawRect(context, multicol, kBackgroundType, FloatRect(100, 100, 100, 100)); + + GetPaintController().BeginSkippingCache(); + DrawRect(context, content, kForegroundType, rect1); + DrawRect(context, content, kForegroundType, rect2); + DrawRect(context, content, kForegroundType, rect3); + GetPaintController().EndSkippingCache(); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&multicol, "multicol", + IntRect(100, 100, 200, 200), + PaintInvalidationReason::kFull}, + RasterInvalidationInfo{ + &content, "content", IntRect(100, 100, 100, 100), + PaintInvalidationReason::kUncacheable})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, PartialSkipCache) { + FakeDisplayItemClient content("content", LayoutRect(100, 100, 250, 250)); + GraphicsContext context(GetPaintController()); + + FloatRect rect1(100, 100, 50, 50); + FloatRect rect2(150, 100, 50, 50); + FloatRect rect3(200, 100, 50, 50); + + InitRootChunk(); + DrawRect(context, content, kBackgroundType, rect1); + GetPaintController().BeginSkippingCache(); + DrawRect(context, content, kForegroundType, rect2); + GetPaintController().EndSkippingCache(); + DrawRect(context, content, kForegroundType, rect3); + GenerateRasterInvalidations(); + + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + // Draw again with nothing invalidated. + DrawRect(context, content, kBackgroundType, rect1); + GetPaintController().BeginSkippingCache(); + DrawRect(context, content, kForegroundType, rect2); + GetPaintController().EndSkippingCache(); + DrawRect(context, content, kForegroundType, rect3); + + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &content, "content", IntRect(100, 100, 250, 250), + PaintInvalidationReason::kUncacheable})); + invalidator_.SetTracksRasterInvalidations(false); +} + +TEST_F(DisplayItemRasterInvalidatorTest, Partial) { + FakeDisplayItemClient client("client", LayoutRect(100, 100, 300, 300)); + GraphicsContext context(GetPaintController()); + + InitRootChunk(); + DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); + GenerateRasterInvalidations(); + + // Test partial rect invalidation without other invalidations. + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); + DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); + + // Partial invalidation. + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &client, "client", IntRect(150, 160, 170, 180), + PaintInvalidationReason::kRectangle})); + EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); + invalidator_.SetTracksRasterInvalidations(false); + + // Test partial rect invalidation with full invalidation. + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); + client.Invalidate(); + DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); + + // Partial invalidation is shadowed by full invalidation. + EXPECT_THAT(GenerateRasterInvalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + &client, "client", IntRect(100, 100, 300, 300), + PaintInvalidationReason::kFull})); + EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); + invalidator_.SetTracksRasterInvalidations(false); + + // Test partial rect invalidation with incremental invalidation. + invalidator_.SetTracksRasterInvalidations(true); + InitRootChunk(); + client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); + client.SetVisualRect(LayoutRect(100, 100, 300, 400)); + DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 400)); + + // Both partial invalidation and incremental invalidation. + EXPECT_THAT( + GenerateRasterInvalidations(), + UnorderedElementsAre( + RasterInvalidationInfo{&client, "client", IntRect(150, 160, 170, 180), + PaintInvalidationReason::kRectangle}, + RasterInvalidationInfo{&client, "client", IntRect(100, 400, 300, 100), + PaintInvalidationReason::kIncremental})); + invalidator_.SetTracksRasterInvalidations(false); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.cc b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.cc index f5d16e1..d1366a4 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.cc
@@ -19,11 +19,11 @@ void ComputeChunkBoundsAndOpaqueness(const DisplayItemList& display_items, Vector<PaintChunk>& paint_chunks) { - // This happens in tests testing paint chunks without display items. - if (display_items.IsEmpty()) - return; - for (PaintChunk& chunk : paint_chunks) { + // This happens in tests testing paint chunks without display items. + if (!chunk.size()) + continue; + FloatRect bounds; SkRegion known_to_be_opaque_region; for (const DisplayItem& item : display_items.ItemsInPaintChunk(chunk)) { @@ -49,39 +49,29 @@ PaintArtifact::PaintArtifact() : display_item_list_(0) {} PaintArtifact::PaintArtifact(DisplayItemList display_items, - PaintChunksAndRasterInvalidations data) - : display_item_list_(std::move(display_items)), - chunks_and_invalidations_(std::move(data)) { - ComputeChunkBoundsAndOpaqueness(display_item_list_, - chunks_and_invalidations_.chunks); + Vector<PaintChunk> chunks) + : display_item_list_(std::move(display_items)), chunks_(std::move(chunks)) { + ComputeChunkBoundsAndOpaqueness(display_item_list_, chunks_); } -PaintArtifact::PaintArtifact(PaintArtifact&& source) - : display_item_list_(std::move(source.display_item_list_)), - chunks_and_invalidations_(std::move(source.chunks_and_invalidations_)) {} - PaintArtifact::~PaintArtifact() = default; -PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) { - display_item_list_ = std::move(source.display_item_list_); - chunks_and_invalidations_ = std::move(source.chunks_and_invalidations_); - return *this; +scoped_refptr<PaintArtifact> PaintArtifact::Create( + DisplayItemList display_items, + Vector<PaintChunk> chunks) { + return base::AdoptRef( + new PaintArtifact(std::move(display_items), std::move(chunks))); } -void PaintArtifact::Reset() { - display_item_list_.Clear(); - chunks_and_invalidations_.Clear(); +scoped_refptr<PaintArtifact> PaintArtifact::Empty() { + DEFINE_STATIC_REF(PaintArtifact, empty, base::AdoptRef(new PaintArtifact())); + return empty; } size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { - // This function must be called after a full document life cycle update, - // when we have cleared raster invalidation information. - DCHECK(chunks_and_invalidations_.raster_invalidation_rects.IsEmpty()); - DCHECK(chunks_and_invalidations_.raster_invalidation_trackings.IsEmpty()); size_t total_size = sizeof(*this) + display_item_list_.MemoryUsageInBytes() + - chunks_and_invalidations_.chunks.capacity() * - sizeof(chunks_and_invalidations_.chunks[0]); - for (const auto& chunk : chunks_and_invalidations_.chunks) + chunks_.capacity() * sizeof(chunks_[0]); + for (const auto& chunk : chunks_) total_size += chunk.MemoryUsageInBytes(); return total_size; } @@ -113,12 +103,10 @@ } void PaintArtifact::FinishCycle() { - for (auto& chunk : chunks_and_invalidations_.chunks) { + for (auto& chunk : chunks_) { chunk.client_is_just_created = false; chunk.properties.ClearChangedToRoot(); } - chunks_and_invalidations_.raster_invalidation_rects.clear(); - chunks_and_invalidations_.raster_invalidation_trackings.clear(); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h index d3c5dc6..6214baea 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/platform/graphics/paint/display_item_list.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunk.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h" -#include "third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -22,52 +21,27 @@ class GraphicsContext; class PaintChunkSubset; -using ChunkRasterInvalidationRects = Vector<FloatRect, 2>; -using ChunkRasterInvalidationTracking = Vector<RasterInvalidationInfo>; - -struct PaintChunksAndRasterInvalidations { - void Clear() { - chunks.clear(); - raster_invalidation_rects.clear(); - raster_invalidation_trackings.clear(); - } - - Vector<PaintChunk> chunks; - Vector<ChunkRasterInvalidationRects> raster_invalidation_rects; - Vector<ChunkRasterInvalidationTracking> raster_invalidation_trackings; -}; - -// The output of painting, consisting of -// - display item list (in DisplayItemList), -// - paint chunks and their paint invalidations (in -// PaintChunksAndRasterInvalidations). +// The output of painting, consisting of display item list (in DisplayItemList) +// and paint chunks. // // Display item list and paint chunks not only represent the output of the // current painting, but also serve as cache of individual display items and // paint chunks for later paintings as long as the display items and chunks are // valid. // -// Raster invalidations are consumed by CompositedLayerRasterInvalidator and -// will be cleared after a cycle is complete via |FinishCycle()|. -// // It represents a particular state of the world, and should be immutable // (const) to most of its users. // // Unless its dangerous accessors are used, it promises to be in a reasonable // state (e.g. chunk bounding boxes computed). -// -// Reminder: moved-from objects may not be in a known state. They can only -// safely be assigned to or destroyed. -class PLATFORM_EXPORT PaintArtifact final { - DISALLOW_NEW(); - +class PLATFORM_EXPORT PaintArtifact final : public RefCounted<PaintArtifact> { public: - PaintArtifact(); - PaintArtifact(DisplayItemList, PaintChunksAndRasterInvalidations); - PaintArtifact(PaintArtifact&&); - ~PaintArtifact(); + static scoped_refptr<PaintArtifact> Create(DisplayItemList, + Vector<PaintChunk>); - PaintArtifact& operator=(PaintArtifact&&); + static scoped_refptr<PaintArtifact> Empty(); + + ~PaintArtifact(); bool IsEmpty() const { return display_item_list_.IsEmpty(); } @@ -76,10 +50,8 @@ return display_item_list_; } - Vector<PaintChunk>& PaintChunks() { return chunks_and_invalidations_.chunks; } - const Vector<PaintChunk>& PaintChunks() const { - return chunks_and_invalidations_.chunks; - } + Vector<PaintChunk>& PaintChunks() { return chunks_; } + const Vector<PaintChunk>& PaintChunks() const { return chunks_; } PaintChunkSubset GetPaintChunkSubset( const Vector<size_t>& subset_indices) const { @@ -91,9 +63,6 @@ return FindChunkInVectorByDisplayItemIndex(PaintChunks(), index); } - // Resets to an empty paint artifact. - void Reset(); - // Returns the approximate memory usage, excluding memory likely to be // shared with the embedder after copying to cc::DisplayItemList. size_t ApproximateUnsharedMemoryUsage() const; @@ -114,44 +83,17 @@ void AppendToDisplayItemList(const FloatSize& visual_rect_offset, cc::DisplayItemList& display_list) const; - const ChunkRasterInvalidationRects* GetRasterInvalidationRects( - size_t chunk_index) const { - return chunk_index < - chunks_and_invalidations_.raster_invalidation_rects.size() - ? &chunks_and_invalidations_ - .raster_invalidation_rects[chunk_index] - : nullptr; - } - - const ChunkRasterInvalidationRects* GetRasterInvalidationRects( - const PaintChunk& chunk) const { - return GetRasterInvalidationRects( - &chunk - &chunks_and_invalidations_.chunks.front()); - } - - const ChunkRasterInvalidationTracking* GetRasterInvalidationTracking( - size_t chunk_index) const { - return chunk_index < chunks_and_invalidations_.raster_invalidation_trackings - .size() - ? &chunks_and_invalidations_ - .raster_invalidation_trackings[chunk_index] - : nullptr; - } - - const ChunkRasterInvalidationTracking* GetRasterInvalidationTracking( - const PaintChunk& chunk) const { - return GetRasterInvalidationTracking( - &chunk - &chunks_and_invalidations_.chunks.front()); - } - // Called when the caller finishes updating a full document life cycle. // Will cleanup data (e.g. raster invalidations) that will no longer be used // for the next cycle, and update status to be ready for the next cycle. void FinishCycle(); private: + PaintArtifact(); + PaintArtifact(DisplayItemList, Vector<PaintChunk>); + DisplayItemList display_item_list_; - PaintChunksAndRasterInvalidations chunks_and_invalidations_; + Vector<PaintChunk> chunks_; DISALLOW_COPY_AND_ASSIGN(PaintArtifact); };
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h b/third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h index 6004a229..15d9ef59 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h
@@ -26,6 +26,7 @@ class Iterator { public: const PaintChunk& operator*() const { return subset_[offset_]; } + const PaintChunk* operator->() const { return &subset_[offset_]; } bool operator!=(const Iterator& other) const { DCHECK_EQ(&subset_, &other.subset_); return offset_ != other.offset_; @@ -35,6 +36,9 @@ return *this; } + // The index in the whole paint chunks set. + size_t OriginalIndex() const { return subset_.OriginalIndex(offset_); } + private: friend class PaintChunkSubset; Iterator(const PaintChunkSubset& subset, size_t offset) @@ -52,8 +56,15 @@ return subset_indices_ ? subset_indices_->size() : chunks_.size(); } - const PaintChunk& operator[](int i) const { - return chunks_[subset_indices_ ? (*subset_indices_)[i] : i]; + // |i| is an index in the subset. + const PaintChunk& operator[](size_t i) const { + return chunks_[OriginalIndex(i)]; + } + + // |i| is an index in the subset. + // Returns the index in the whole paint chunks set. + size_t OriginalIndex(size_t i) const { + return subset_indices_ ? (*subset_indices_)[i] : i; } private:
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc index 7e8373d..c6db1e55e 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc
@@ -21,7 +21,7 @@ if (current_properties_ != UninitializedProperties()) return false; - DCHECK(data_.chunks.IsEmpty()); + DCHECK(chunks_.IsEmpty()); return true; } @@ -61,7 +61,7 @@ force_new_chunk_ = true; size_t new_chunk_begin_index; - if (data_.chunks.IsEmpty()) { + if (chunks_.IsEmpty()) { new_chunk_begin_index = 0; } else { auto& last_chunk = LastChunk(); @@ -77,9 +77,9 @@ new_chunk_begin_index = last_chunk.end_index; } - data_.chunks.emplace_back(new_chunk_begin_index, new_chunk_begin_index + 1, - next_chunk_id_ ? *next_chunk_id_ : item.GetId(), - current_properties_); + chunks_.emplace_back(new_chunk_begin_index, new_chunk_begin_index + 1, + next_chunk_id_ ? *next_chunk_id_ : item.GetId(), + current_properties_); next_chunk_id_ = base::nullopt; // When forcing a new chunk, we still need to force new chunk for the next @@ -90,27 +90,11 @@ return true; } -void PaintChunker::TrackRasterInvalidation(const PaintChunk& chunk, - const RasterInvalidationInfo& info) { - size_t index = ChunkIndex(chunk); - auto& trackings = data_.raster_invalidation_trackings; - if (trackings.size() <= index) - trackings.resize(index + 1); - trackings[index].push_back(info); -} - -void PaintChunker::Clear() { - data_.Clear(); +Vector<PaintChunk> PaintChunker::ReleasePaintChunks() { next_chunk_id_ = base::nullopt; current_properties_ = UninitializedProperties(); -} - -PaintChunksAndRasterInvalidations PaintChunker::ReleaseData() { - next_chunk_id_ = base::nullopt; - current_properties_ = UninitializedProperties(); - data_.chunks.ShrinkToFit(); - data_.raster_invalidation_rects.ShrinkToFit(); - return std::move(data_); + chunks_.ShrinkToFit(); + return std::move(chunks_); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h index 691072d7..8a0f11ad 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h
@@ -40,45 +40,32 @@ // Returns true if a new chunk is created. bool IncrementDisplayItemIndex(const DisplayItem&); - const Vector<PaintChunk>& PaintChunks() const { return data_.chunks; } + const Vector<PaintChunk>& PaintChunks() const { return chunks_; } - PaintChunk& PaintChunkAt(size_t i) { return data_.chunks[i]; } + PaintChunk& PaintChunkAt(size_t i) { return chunks_[i]; } size_t LastChunkIndex() const { - return data_.chunks.IsEmpty() ? kNotFound : data_.chunks.size() - 1; + return chunks_.IsEmpty() ? kNotFound : chunks_.size() - 1; } - PaintChunk& LastChunk() { return data_.chunks.back(); } + PaintChunk& LastChunk() { return chunks_.back(); } PaintChunk& FindChunkByDisplayItemIndex(size_t index) { - auto* chunk = FindChunkInVectorByDisplayItemIndex(data_.chunks, index); - DCHECK(chunk != data_.chunks.end()); + auto* chunk = FindChunkInVectorByDisplayItemIndex(chunks_, index); + DCHECK(chunk != chunks_.end()); return *chunk; } - void AddRasterInvalidation(const PaintChunk& chunk, const FloatRect& rect) { - size_t index = ChunkIndex(chunk); - auto& rects = data_.raster_invalidation_rects; - if (rects.size() <= index) - rects.resize(index + 1); - rects[index].push_back(rect); - } - - void TrackRasterInvalidation(const PaintChunk&, - const RasterInvalidationInfo&); - - void Clear(); - // Releases the generated paint chunk list and raster invalidations and // resets the state of this object. - PaintChunksAndRasterInvalidations ReleaseData(); + Vector<PaintChunk> ReleasePaintChunks(); private: size_t ChunkIndex(const PaintChunk& chunk) const { - size_t index = &chunk - &data_.chunks.front(); - DCHECK_LT(index, data_.chunks.size()); + size_t index = &chunk - &chunks_.front(); + DCHECK_LT(index, chunks_.size()); return index; } - PaintChunksAndRasterInvalidations data_; + Vector<PaintChunk> chunks_; // The id specified by UpdateCurrentPaintChunkProperties(). If it is not // nullopt, we will use it as the id of the next new chunk. Otherwise we will
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunker_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_chunker_test.cc index 75e37e38..04f41a4c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunker_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunker_test.cc
@@ -50,8 +50,8 @@ PaintChunker chunker; EXPECT_TRUE(chunker.PaintChunks().IsEmpty()); - auto chunks_data = chunker.ReleaseData(); - EXPECT_TRUE(chunks_data.chunks.IsEmpty()); + auto chunks = chunker.ReleasePaintChunks(); + EXPECT_TRUE(chunks.IsEmpty()); } TEST_F(PaintChunkerTest, SingleNonEmptyRange) { @@ -65,11 +65,10 @@ EXPECT_EQ(chunks.size(), 1u); EXPECT_EQ(chunks[0], PaintChunk(0, 2, id, DefaultPaintChunkProperties())); - auto chunks_data = chunker.ReleaseData(); + auto chunks1 = chunker.ReleasePaintChunks(); EXPECT_TRUE(chunker.PaintChunks().IsEmpty()); - EXPECT_EQ(chunks_data.chunks.size(), 1u); - EXPECT_EQ(chunks_data.chunks[0], - PaintChunk(0, 2, id, DefaultPaintChunkProperties())); + EXPECT_EQ(chunks1.size(), 1u); + EXPECT_EQ(chunks1[0], PaintChunk(0, 2, id, DefaultPaintChunkProperties())); } TEST_F(PaintChunkerTest, SamePropertiesTwiceCombineIntoOneChunk) { @@ -85,11 +84,10 @@ EXPECT_EQ(chunks.size(), 1u); EXPECT_EQ(chunks[0], PaintChunk(0, 3, id, DefaultPaintChunkProperties())); - auto chunks_data = chunker.ReleaseData(); + auto chunks1 = chunker.ReleasePaintChunks(); EXPECT_TRUE(chunker.PaintChunks().IsEmpty()); - EXPECT_EQ(chunks_data.chunks.size(), 1u); - EXPECT_EQ(chunks_data.chunks[0], - PaintChunk(0, 3, id, DefaultPaintChunkProperties())); + EXPECT_EQ(chunks1.size(), 1u); + EXPECT_EQ(chunks1[0], PaintChunk(0, 3, id, DefaultPaintChunkProperties())); } TEST_F(PaintChunkerTest, BuildMultipleChunksWithSinglePropertyChanging) {
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc index cd5df08570..1a42f070 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
@@ -6,16 +6,16 @@ #include <memory> #include "base/auto_reset.h" -#include "third_party/blink/renderer/platform/graphics/graphics_layer.h" #include "third_party/blink/renderer/platform/graphics/logging_canvas.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" -#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { PaintController::PaintController(Usage usage) - : usage_(usage), new_display_item_list_(0) { + : usage_(usage), + current_paint_artifact_(PaintArtifact::Empty()), + new_display_item_list_(0) { // frame_first_paints_ should have one null frame since the beginning, so // that PaintController is robust even if it paints outside of BeginFrame // and EndFrame cycles. It will also enable us to combine the first paint @@ -29,36 +29,6 @@ DCHECK(new_display_item_list_.IsEmpty()); } -void PaintController::SetTracksRasterInvalidations(bool value) { - if (value) { - raster_invalidation_tracking_info_ = - std::make_unique<RasterInvalidationTrackingInfo>(); - - // This is called just after a full document cycle update, so all clients in - // current_paint_artifact_ should be still alive. - DCHECK(new_display_item_list_.IsEmpty()); - for (const auto& item : current_paint_artifact_.GetDisplayItemList()) { - raster_invalidation_tracking_info_->old_client_debug_names.Set( - &item.Client(), item.Client().DebugName()); - } - } else if (!RasterInvalidationTracking::ShouldAlwaysTrack()) { - raster_invalidation_tracking_info_ = nullptr; - } -} - -void PaintController::EnsureRasterInvalidationTracking() { - if (!raster_invalidation_tracking_info_) { - raster_invalidation_tracking_info_ = - std::make_unique<RasterInvalidationTrackingInfo>(); - } -} - -const PaintArtifact& PaintController::GetPaintArtifact() const { - DCHECK(new_display_item_list_.IsEmpty()); - DCHECK(new_paint_chunks_.IsInInitialState()); - return current_paint_artifact_; -} - bool PaintController::UseCachedDrawingIfPossible( const DisplayItemClient& client, DisplayItem::Type type) { @@ -91,7 +61,7 @@ EnsureNewDisplayItemListInitialCapacity(); // Visual rect can change without needing invalidation of the client, e.g. // when ancestor clip changes. Update the visual rect to the current value. - current_paint_artifact_.GetDisplayItemList()[cached_item].UpdateVisualRect(); + current_paint_artifact_->GetDisplayItemList()[cached_item].UpdateVisualRect(); if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) ProcessNewItem(MoveItemFromCurrentListToNewList(cached_item)); @@ -140,7 +110,7 @@ return false; } - if (current_paint_artifact_.GetDisplayItemList()[markers->start] + if (current_paint_artifact_->GetDisplayItemList()[markers->start] .IsTombstone()) { // The subsequence has already been copied, indicating that the same client // created multiple subsequences. If DCHECK_IS_ON(), then we should have @@ -230,12 +200,6 @@ << "Multiple subsequences for client: " << client.DebugName(); new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end)); - last_cached_subsequence_end_ = end; -} - -bool PaintController::LastDisplayItemIsSubsequenceEnd() const { - return !new_cached_subsequences_.IsEmpty() && - last_cached_subsequence_end_ == new_display_item_list_.size(); } const DisplayItem* PaintController::LastDisplayItem(unsigned offset) { @@ -252,13 +216,10 @@ display_item.Client().Invalidate(PaintInvalidationReason::kUncacheable); } - if (raster_invalidation_tracking_info_) { - raster_invalidation_tracking_info_->new_client_debug_names.insert( - &display_item.Client(), display_item.Client().DebugName()); - } - - size_t last_chunk_index = new_paint_chunks_.LastChunkIndex(); - bool chunk_added = new_paint_chunks_.IncrementDisplayItemIndex(display_item); +#if DCHECK_IS_ON() + bool chunk_added = +#endif + new_paint_chunks_.IncrementDisplayItemIndex(display_item); auto& last_chunk = new_paint_chunks_.LastChunk(); #if DCHECK_IS_ON() @@ -269,12 +230,6 @@ } #endif - if (chunk_added && last_chunk_index != kNotFound) { - DCHECK(last_chunk_index != new_paint_chunks_.LastChunkIndex()); - GenerateRasterInvalidations( - new_paint_chunks_.PaintChunkAt(last_chunk_index)); - } - last_chunk.outset_for_raster_effects = std::max(last_chunk.outset_for_raster_effects, display_item.OutsetForRasterEffects()); @@ -314,11 +269,8 @@ } DisplayItem& PaintController::MoveItemFromCurrentListToNewList(size_t index) { - items_moved_into_new_list_.resize( - current_paint_artifact_.GetDisplayItemList().size()); - items_moved_into_new_list_[index] = new_display_item_list_.size(); return new_display_item_list_.AppendByMoving( - current_paint_artifact_.GetDisplayItemList()[index]); + current_paint_artifact_->GetDisplayItemList()[index]); } void PaintController::InvalidateAll() { @@ -330,14 +282,14 @@ // TODO(wangxianzhu): Rename this to InvalidateAllForTesting() for SPv2. // Can only be called during layout/paintInvalidation, not during painting. DCHECK(new_display_item_list_.IsEmpty()); - current_paint_artifact_.Reset(); + current_paint_artifact_ = PaintArtifact::Empty(); current_cached_subsequences_.clear(); cache_is_all_invalid_ = true; } bool PaintController::CacheIsAllInvalid() const { DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); - DCHECK(!cache_is_all_invalid_ || current_paint_artifact_.IsEmpty()); + DCHECK(!cache_is_all_invalid_ || current_paint_artifact_->IsEmpty()); return cache_is_all_invalid_; } @@ -388,13 +340,13 @@ DCHECK(ClientCacheIsValid(id.client)); if (next_item_to_match_ < - current_paint_artifact_.GetDisplayItemList().size()) { + current_paint_artifact_->GetDisplayItemList().size()) { // If current_list[next_item_to_match_] matches the new item, we don't need // to update and lookup the index, which is fast. This is the common case // that the current list and the new list are in the same order around the // new item. const DisplayItem& item = - current_paint_artifact_.GetDisplayItemList()[next_item_to_match_]; + current_paint_artifact_->GetDisplayItemList()[next_item_to_match_]; // We encounter an item that has already been copied which indicates we // can't do sequential matching. if (!item.IsTombstone() && id == item.GetId()) { @@ -407,7 +359,7 @@ size_t found_index = FindMatchingItemFromIndex(id, out_of_order_item_indices_, - current_paint_artifact_.GetDisplayItemList()); + current_paint_artifact_->GetDisplayItemList()); if (found_index != kNotFound) { #if DCHECK_IS_ON() ++num_out_of_order_matches_; @@ -422,8 +374,8 @@ size_t PaintController::FindOutOfOrderCachedItemForward( const DisplayItem::Id& id) { for (size_t i = next_item_to_index_; - i < current_paint_artifact_.GetDisplayItemList().size(); ++i) { - const DisplayItem& item = current_paint_artifact_.GetDisplayItemList()[i]; + i < current_paint_artifact_->GetDisplayItemList().size(); ++i) { + const DisplayItem& item = current_paint_artifact_->GetDisplayItemList()[i]; if (item.IsTombstone()) continue; if (id == item.GetId()) { @@ -465,15 +417,12 @@ size_t end_index) { DCHECK(!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); - base::AutoReset<size_t> subsequence_begin_index( - ¤t_cached_subsequence_begin_index_in_new_list_, - new_display_item_list_.size()); - DisplayItem* cached_item = - ¤t_paint_artifact_.GetDisplayItemList()[begin_index]; + const DisplayItem* cached_item = + ¤t_paint_artifact_->GetDisplayItemList()[begin_index]; auto* cached_chunk = - current_paint_artifact_.FindChunkByDisplayItemIndex(begin_index); - DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); + current_paint_artifact_->FindChunkByDisplayItemIndex(begin_index); + DCHECK(cached_chunk != current_paint_artifact_->PaintChunks().end()); auto properties_before_subsequence = new_paint_chunks_.CurrentPaintChunkProperties(); UpdateCurrentPaintChunkPropertiesUsingIdWithFragment( @@ -481,7 +430,7 @@ for (size_t current_index = begin_index; current_index < end_index; ++current_index) { - cached_item = ¤t_paint_artifact_.GetDisplayItemList()[current_index]; + cached_item = ¤t_paint_artifact_->GetDisplayItemList()[current_index]; SECURITY_CHECK(!cached_item->IsTombstone()); #if DCHECK_IS_ON() DCHECK(cached_item->Client().IsAlive()); @@ -489,7 +438,7 @@ if (current_index == cached_chunk->end_index) { ++cached_chunk; - DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); + DCHECK(cached_chunk != current_paint_artifact_->PaintChunks().end()); new_paint_chunks_.ForceNewChunk(); UpdateCurrentPaintChunkPropertiesUsingIdWithFragment( cached_chunk->id, cached_chunk->properties.GetPropertyTreeState()); @@ -529,7 +478,6 @@ void PaintController::ResetCurrentListIndices() { next_item_to_match_ = 0; next_item_to_index_ = 0; - next_chunk_to_match_ = 0; under_invalidation_checking_begin_ = 0; under_invalidation_checking_end_ = 0; } @@ -538,7 +486,7 @@ void PaintController::CommitNewDisplayItems() { TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", "current_display_list_size", - (int)current_paint_artifact_.GetDisplayItemList().size(), + (int)current_paint_artifact_->GetDisplayItemList().size(), "num_non_cached_new_items", (int)new_display_item_list_.size() - num_cached_new_items_); @@ -548,25 +496,20 @@ new_paint_chunk_indices_by_client_.clear(); #endif - if (!new_display_item_list_.IsEmpty()) - GenerateRasterInvalidations(new_paint_chunks_.LastChunk()); - cache_is_all_invalid_ = false; new_cached_subsequences_.swap(current_cached_subsequences_); new_cached_subsequences_.clear(); - last_cached_subsequence_end_ = 0; // The new list will not be appended to again so we can release unused memory. new_display_item_list_.ShrinkToFit(); - current_paint_artifact_ = PaintArtifact(std::move(new_display_item_list_), - new_paint_chunks_.ReleaseData()); + current_paint_artifact_ = + PaintArtifact::Create(std::move(new_display_item_list_), + new_paint_chunks_.ReleasePaintChunks()); ResetCurrentListIndices(); out_of_order_item_indices_.clear(); - out_of_order_chunk_indices_.clear(); - items_moved_into_new_list_.clear(); // We'll allocate the initial buffer when we start the next paint. new_display_item_list_ = DisplayItemList(0); @@ -576,22 +519,6 @@ num_out_of_order_matches_ = 0; num_indexed_items_ = 0; #endif - - if (raster_invalidation_tracking_info_) { - raster_invalidation_tracking_info_->old_client_debug_names.clear(); - std::swap(raster_invalidation_tracking_info_->old_client_debug_names, - raster_invalidation_tracking_info_->new_client_debug_names); - } - -#if DCHECK_IS_ON() - if (VLOG_IS_ON(2)) { - LOG(ERROR) << "PaintController::CommitNewDisplayItems() done"; - if (VLOG_IS_ON(3)) - ShowDebugDataWithRecords(); - else - ShowDebugData(); - } -#endif } void PaintController::FinishCycle() { @@ -607,37 +534,39 @@ if (item.key->IsCacheable()) item.key->Validate(); } - for (const auto& item : current_paint_artifact_.GetDisplayItemList()) { + for (const auto& item : current_paint_artifact_->GetDisplayItemList()) { const auto& client = item.Client(); client.ClearPartialInvalidationVisualRect(); if (client.IsCacheable()) client.Validate(); } - for (const auto& chunk : current_paint_artifact_.PaintChunks()) { + for (const auto& chunk : current_paint_artifact_->PaintChunks()) { if (chunk.id.client.IsCacheable()) chunk.id.client.Validate(); } - current_paint_artifact_.FinishCycle(); + current_paint_artifact_->FinishCycle(); + +#if DCHECK_IS_ON() + if (VLOG_IS_ON(2)) { + LOG(ERROR) << "PaintController::FinishCycle() done"; + if (VLOG_IS_ON(3)) + ShowDebugDataWithRecords(); + else + ShowDebugData(); + } +#endif } size_t PaintController::ApproximateUnsharedMemoryUsage() const { size_t memory_usage = sizeof(*this); // Memory outside this class due to current_paint_artifact_. - memory_usage += current_paint_artifact_.ApproximateUnsharedMemoryUsage() - - sizeof(current_paint_artifact_); + memory_usage += current_paint_artifact_->ApproximateUnsharedMemoryUsage(); - // TODO(jbroman): If display items begin to have significant external memory - // usage that's not shared with the embedder, we should account for it here. - // // External objects, shared with the embedder, such as PaintRecord, should be // excluded to avoid double counting. It is the embedder's responsibility to // count such objects. - // - // At time of writing, the only known case of unshared external memory was - // the rounded clips vector in ClipDisplayItem, which is not expected to - // contribute significantly to memory usage. // Memory outside this class due to new_display_item_list_. DCHECK(new_display_item_list_.IsEmpty()); @@ -674,290 +603,17 @@ DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); DCHECK(new_display_item_list_.IsEmpty()); - auto& display_item_list = current_paint_artifact_.GetDisplayItemList(); + auto& display_item_list = current_paint_artifact_->GetDisplayItemList(); auto& display_item = display_item_list.AllocateAndConstruct<DrawingDisplayItem>( debug_drawing_client, DisplayItem::kDebugDrawing, std::move(record)); // Create a PaintChunk for the debug drawing. - current_paint_artifact_.PaintChunks().emplace_back( + current_paint_artifact_->PaintChunks().emplace_back( display_item_list.size() - 1, display_item_list.size(), display_item.GetId(), property_tree_state); } -void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) { - if (new_chunk.begin_index >= - current_cached_subsequence_begin_index_in_new_list_) - return; - - // Uncacheable chunks will be invalidated in ContentLayerClientImpl. - if (!new_chunk.is_cacheable) - return; - - // Try to match old chunk sequentially first. - const auto& old_chunks = current_paint_artifact_.PaintChunks(); - while (next_chunk_to_match_ < old_chunks.size()) { - const PaintChunk& old_chunk = old_chunks[next_chunk_to_match_]; - if (new_chunk.Matches(old_chunk)) { - GenerateRasterInvalidationsComparingChunks(new_chunk, old_chunk); - ++next_chunk_to_match_; - return; - } - - // Add skipped old chunks into the index. - if (old_chunk.is_cacheable) { - auto it = out_of_order_chunk_indices_.find(&old_chunk.id.client); - Vector<size_t>& indices = - it == out_of_order_chunk_indices_.end() - ? out_of_order_chunk_indices_ - .insert(&old_chunk.id.client, Vector<size_t>()) - .stored_value->value - : it->value; - indices.push_back(next_chunk_to_match_); - } - ++next_chunk_to_match_; - } - - // Sequential matching reaches the end. Find from the out-of-order index. - auto it = out_of_order_chunk_indices_.find(&new_chunk.id.client); - if (it != out_of_order_chunk_indices_.end()) { - for (size_t i : it->value) { - if (new_chunk.Matches(old_chunks[i])) { - GenerateRasterInvalidationsComparingChunks(new_chunk, old_chunks[i]); - return; - } - } - } -} - -void PaintController::AddRasterInvalidation(const DisplayItemClient& client, - PaintChunk& chunk, - const FloatRect& rect, - PaintInvalidationReason reason) { - new_paint_chunks_.AddRasterInvalidation(chunk, rect); - if (RasterInvalidationTracking::ShouldAlwaysTrack()) - EnsureRasterInvalidationTracking(); - if (raster_invalidation_tracking_info_) - TrackRasterInvalidation(client, chunk, reason); -} - -void PaintController::TrackRasterInvalidation(const DisplayItemClient& client, - PaintChunk& chunk, - PaintInvalidationReason reason) { - DCHECK(raster_invalidation_tracking_info_); - - RasterInvalidationInfo info; - info.client = &client; - info.reason = reason; - - if (reason == PaintInvalidationReason::kDisappeared) { - info.client_debug_name = - raster_invalidation_tracking_info_->old_client_debug_names.at(&client); - } else { - info.client_debug_name = client.DebugName(); - } - - new_paint_chunks_.TrackRasterInvalidation(chunk, info); -} - -void PaintController::GenerateRasterInvalidationsComparingChunks( - PaintChunk& new_chunk, - const PaintChunk& old_chunk) { - // TODO(wangxianzhu): Optimize paint offset change. - - struct OldAndNewDisplayItems { - const DisplayItem* old_item = nullptr; - const DisplayItem* new_item = nullptr; - }; - HashMap<const DisplayItemClient*, OldAndNewDisplayItems> - clients_to_invalidate; - - size_t highest_moved_to_index = 0; - // Find clients to invalidate the old visual rects from the old chunk. - for (size_t old_index = old_chunk.begin_index; - old_index < old_chunk.end_index; ++old_index) { - const DisplayItem& old_item = - current_paint_artifact_.GetDisplayItemList()[old_index]; - const DisplayItemClient* client_to_invalidate_old_visual_rect = nullptr; - - if (old_item.IsTombstone()) { - // old_item has been moved into new_display_item_list_ as a cached item. - size_t moved_to_index = items_moved_into_new_list_[old_index]; - if (new_display_item_list_[moved_to_index].DrawsContent()) { - if (moved_to_index < new_chunk.begin_index || - moved_to_index >= new_chunk.end_index) { - // The item has been moved into another chunk, so need to invalidate - // it in the chunk into which the item was moved. - const auto& new_item = new_display_item_list_[moved_to_index]; - PaintChunk& moved_to_chunk = - new_paint_chunks_.FindChunkByDisplayItemIndex(moved_to_index); - AddRasterInvalidation(new_item.Client(), moved_to_chunk, - new_item.VisualRect(), - PaintInvalidationReason::kAppeared); - // And invalidate the old visual rect in this chunk. - client_to_invalidate_old_visual_rect = &new_item.Client(); - } else if (moved_to_index < highest_moved_to_index) { - // The item has been moved behind other cached items, so need to - // invalidate the area that is probably exposed by the item moved - // earlier. - client_to_invalidate_old_visual_rect = - &new_display_item_list_[moved_to_index].Client(); - } else { - highest_moved_to_index = moved_to_index; - } - } - } else if (old_item.DrawsContent()) { - // old_item has either changed or disappeared. - client_to_invalidate_old_visual_rect = &old_item.Client(); - } - - if (client_to_invalidate_old_visual_rect) { - clients_to_invalidate - .insert(client_to_invalidate_old_visual_rect, OldAndNewDisplayItems()) - .stored_value->value.old_item = &old_item; - } - } - - // Find clients to invalidate the new visual rects from the new chunk. - for (size_t new_index = new_chunk.begin_index; - new_index < new_chunk.end_index; ++new_index) { - const DisplayItem& new_item = new_display_item_list_[new_index]; - if (new_item.DrawsContent() && !ClientCacheIsValid(new_item.Client())) { - clients_to_invalidate.insert(&new_item.Client(), OldAndNewDisplayItems()) - .stored_value->value.new_item = &new_item; - } - } - - for (const auto& item : clients_to_invalidate) { - GenerateRasterInvalidation(*item.key, new_chunk, item.value.old_item, - item.value.new_item); - } -} - -void PaintController::GenerateRasterInvalidation( - const DisplayItemClient& client, - PaintChunk& chunk, - const DisplayItem* old_item, - const DisplayItem* new_item) { - if (!new_item || new_item->VisualRect().IsEmpty()) { - if (old_item && !old_item->VisualRect().IsEmpty()) { - AddRasterInvalidation(client, chunk, old_item->VisualRect(), - PaintInvalidationReason::kDisappeared); - } - return; - } - - DCHECK(&client == &new_item->Client()); - if (!old_item || old_item->VisualRect().IsEmpty()) { - AddRasterInvalidation(client, chunk, new_item->VisualRect(), - PaintInvalidationReason::kAppeared); - return; - } - - if (client.IsJustCreated()) { - // The old client has been deleted and the new client happens to be at the - // same address. They have no relationship. - AddRasterInvalidation(client, chunk, old_item->VisualRect(), - PaintInvalidationReason::kDisappeared); - AddRasterInvalidation(client, chunk, new_item->VisualRect(), - PaintInvalidationReason::kAppeared); - return; - } - - auto reason = client.GetPaintInvalidationReason(); - if (reason == PaintInvalidationReason::kNone) { - // The client was validated by another PaintController, but not valid in - // this PaintController. - DCHECK(!ClientCacheIsValid(client)); - reason = PaintInvalidationReason::kFull; - } - - if (IsFullPaintInvalidationReason(reason)) { - GenerateFullRasterInvalidation(chunk, *old_item, *new_item, reason); - return; - } - - GenerateIncrementalRasterInvalidation(chunk, *old_item, *new_item); - - auto partial_rect = client.PartialInvalidationVisualRect(); - if (!partial_rect.IsEmpty()) - AddRasterInvalidation(client, chunk, FloatRect(partial_rect), reason); -} - -static FloatRect ComputeRightDelta(const FloatPoint& location, - const FloatSize& old_size, - const FloatSize& new_size) { - float delta = new_size.Width() - old_size.Width(); - if (delta > 0) { - return FloatRect(location.X() + old_size.Width(), location.Y(), delta, - new_size.Height()); - } - if (delta < 0) { - return FloatRect(location.X() + new_size.Width(), location.Y(), -delta, - old_size.Height()); - } - return FloatRect(); -} - -static FloatRect ComputeBottomDelta(const FloatPoint& location, - const FloatSize& old_size, - const FloatSize& new_size) { - float delta = new_size.Height() - old_size.Height(); - if (delta > 0) { - return FloatRect(location.X(), location.Y() + old_size.Height(), - new_size.Width(), delta); - } - if (delta < 0) { - return FloatRect(location.X(), location.Y() + new_size.Height(), - old_size.Width(), -delta); - } - return FloatRect(); -} - -void PaintController::GenerateIncrementalRasterInvalidation( - PaintChunk& chunk, - const DisplayItem& old_item, - const DisplayItem& new_item) { - DCHECK(&old_item.Client() == &new_item.Client()); - FloatRect old_visual_rect(old_item.VisualRect()); - FloatRect new_visual_rect(new_item.VisualRect()); - DCHECK(old_visual_rect.Location() == new_visual_rect.Location()); - - FloatRect right_delta = - ComputeRightDelta(new_visual_rect.Location(), old_visual_rect.Size(), - new_visual_rect.Size()); - if (!right_delta.IsEmpty()) { - AddRasterInvalidation(new_item.Client(), chunk, right_delta, - PaintInvalidationReason::kIncremental); - } - - FloatRect bottom_delta = - ComputeBottomDelta(new_visual_rect.Location(), old_visual_rect.Size(), - new_visual_rect.Size()); - if (!bottom_delta.IsEmpty()) { - AddRasterInvalidation(new_item.Client(), chunk, bottom_delta, - PaintInvalidationReason::kIncremental); - } -} - -void PaintController::GenerateFullRasterInvalidation( - PaintChunk& chunk, - const DisplayItem& old_item, - const DisplayItem& new_item, - PaintInvalidationReason reason) { - DCHECK(&old_item.Client() == &new_item.Client()); - FloatRect old_visual_rect(old_item.VisualRect()); - FloatRect new_visual_rect(new_item.VisualRect()); - - if (!new_visual_rect.Contains(old_visual_rect)) { - AddRasterInvalidation(new_item.Client(), chunk, old_visual_rect, reason); - if (old_visual_rect.Contains(new_visual_rect)) - return; - } - - AddRasterInvalidation(new_item.Client(), chunk, new_visual_rect, reason); -} - void PaintController::ShowUnderInvalidationError( const char* reason, const DisplayItem& new_item, @@ -1029,8 +685,8 @@ const DisplayItem& new_item = new_display_item_list_.Last(); size_t old_item_index = under_invalidation_checking_begin_; DisplayItem* old_item = - old_item_index < current_paint_artifact_.GetDisplayItemList().size() - ? ¤t_paint_artifact_.GetDisplayItemList()[old_item_index] + old_item_index < current_paint_artifact_->GetDisplayItemList().size() + ? ¤t_paint_artifact_->GetDisplayItemList()[old_item_index] : nullptr; if (!old_item || !new_item.Equals(*old_item)) { @@ -1040,7 +696,7 @@ "under-invalidation: display item changed", new_display_item_list_.Last(), ¤t_paint_artifact_ - .GetDisplayItemList()[under_invalidation_checking_begin_]); + ->GetDisplayItemList()[under_invalidation_checking_begin_]); CHECK(false); }
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller.h b/third_party/blink/renderer/platform/graphics/paint/paint_controller.h index 2b9a19b9..d4ca5b14 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.h
@@ -18,7 +18,6 @@ #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunk.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunker.h" -#include "third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/alignment.h" @@ -160,7 +159,8 @@ } bool IsSkippingCache() const { return skipping_cache_count_; } - // Must be called when a painting is finished. + // Must be called when a painting is finished. Updates the current paint + // artifact with the new paintings. void CommitNewDisplayItems(); // Called when the caller finishes updating a full document life cycle. @@ -177,7 +177,15 @@ size_t ApproximateUnsharedMemoryUsage() const; // Get the artifact generated after the last commit. - const PaintArtifact& GetPaintArtifact() const; + const PaintArtifact& GetPaintArtifact() const { + DCHECK(new_display_item_list_.IsEmpty()); + DCHECK(new_paint_chunks_.IsInInitialState()); + DCHECK(current_paint_artifact_); + return *current_paint_artifact_; + } + scoped_refptr<const PaintArtifact> GetPaintArtifactShared() const { + return base::WrapRefCounted(&GetPaintArtifact()); + } const DisplayItemList& GetDisplayItemList() const { return GetPaintArtifact().GetDisplayItemList(); } @@ -219,10 +227,6 @@ void ShowDebugDataWithRecords() const; #endif - void SetTracksRasterInvalidations(bool); - - bool LastDisplayItemIsSubsequenceEnd() const; - void BeginFrame(const void* frame); FrameFirstPaint EndFrame(const void* frame); @@ -256,11 +260,11 @@ void EnsureNewDisplayItemListInitialCapacity() { if (new_display_item_list_.IsEmpty()) { // TODO(wangxianzhu): Consider revisiting this heuristic. - new_display_item_list_ = - DisplayItemList(current_paint_artifact_.GetDisplayItemList().IsEmpty() - ? kInitialDisplayItemListCapacityBytes - : current_paint_artifact_.GetDisplayItemList() - .UsedCapacityInBytes()); + new_display_item_list_ = DisplayItemList( + current_paint_artifact_->GetDisplayItemList().IsEmpty() + ? kInitialDisplayItemListCapacityBytes + : current_paint_artifact_->GetDisplayItemList() + .UsedCapacityInBytes()); } } @@ -295,30 +299,6 @@ // newly created, or is changed causing the previous indices to be invalid. void ResetCurrentListIndices(); - void GenerateRasterInvalidations(PaintChunk& new_chunk); - void GenerateRasterInvalidationsComparingChunks(PaintChunk& new_chunk, - const PaintChunk& old_chunk); - inline void GenerateRasterInvalidation(const DisplayItemClient&, - PaintChunk&, - const DisplayItem* old_item, - const DisplayItem* new_item); - inline void GenerateIncrementalRasterInvalidation( - PaintChunk&, - const DisplayItem& old_item, - const DisplayItem& new_item); - inline void GenerateFullRasterInvalidation(PaintChunk&, - const DisplayItem& old_item, - const DisplayItem& new_item, - PaintInvalidationReason); - inline void AddRasterInvalidation(const DisplayItemClient&, - PaintChunk&, - const FloatRect&, - PaintInvalidationReason); - void EnsureRasterInvalidationTracking(); - void TrackRasterInvalidation(const DisplayItemClient&, - PaintChunk&, - PaintInvalidationReason); - // The following two methods are for checking under-invalidations // (when RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled). void ShowUnderInvalidationError(const char* reason, @@ -355,20 +335,14 @@ Usage usage_; - // The last complete paint artifact. - // In SPv2, this includes paint chunks as well as display items. - PaintArtifact current_paint_artifact_; + // The last paint artifact after CommitNewDisplayItems(). + // It includes paint chunks as well as display items. + scoped_refptr<PaintArtifact> current_paint_artifact_; // Data being used to build the next paint artifact. DisplayItemList new_display_item_list_; PaintChunker new_paint_chunks_; - // Stores indices into new_display_item_list_ for display items that have been - // moved from current_paint_artifact_.GetDisplayItemList(), indexed by the - // positions of the display items before the move. The values are undefined - // for display items that are not moved. - Vector<size_t> items_moved_into_new_list_; - bool construction_disabled_ = false; bool subsequence_caching_disabled_ = false; @@ -399,15 +373,6 @@ // requests. size_t next_item_to_index_ = 0; - // Similar to out_of_order_item_indices_ but - // - the indices are chunk indices in current_paint_artifacts_.PaintChunks(); - // - chunks are matched not only for requests of cached display items, but - // also non-cached display items. - IndicesByClientMap out_of_order_chunk_indices_; - - size_t current_cached_subsequence_begin_index_in_new_list_ = kNotFound; - size_t next_chunk_to_match_ = 0; - #if DCHECK_IS_ON() int num_sequential_matches_ = 0; int num_out_of_order_matches_ = 0; @@ -430,14 +395,6 @@ String under_invalidation_message_prefix_; - struct RasterInvalidationTrackingInfo { - using ClientDebugNamesMap = HashMap<const DisplayItemClient*, String>; - ClientDebugNamesMap new_client_debug_names; - ClientDebugNamesMap old_client_debug_names; - }; - std::unique_ptr<RasterInvalidationTrackingInfo> - raster_invalidation_tracking_info_; - using CachedSubsequenceMap = HashMap<const DisplayItemClient*, SubsequenceMarkers>; CachedSubsequenceMap current_cached_subsequences_;
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_debug_data.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller_debug_data.cc index ef6bd70..8f70d35b 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_debug_data.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_debug_data.cc
@@ -154,9 +154,9 @@ DisplayItemList::JsonFlags flags) const { LOG(ERROR) << "current display item list: " << DisplayItemListAsJSON( - current_paint_artifact_.GetDisplayItemList(), + current_paint_artifact_->GetDisplayItemList(), current_cached_subsequences_, - current_paint_artifact_.PaintChunks(), flags) + current_paint_artifact_->PaintChunks(), flags) .ToString() .Utf8() .data();
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc index 83e5594..84d3e4f6 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc
@@ -15,9 +15,6 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/testing/paint_test_configurations.h" -using testing::ElementsAre; -using testing::UnorderedElementsAre; - namespace blink { // Tests using this class will be tested with under-invalidation-checking @@ -42,16 +39,12 @@ InitRootChunk(); DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 200, 200)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 1, TestDisplayItem(client, kBackgroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - // Raster invalidation for the whole chunk will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateBasic) { @@ -66,7 +59,7 @@ EXPECT_EQ(0, NumCachedNewItems()); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 3, TestDisplayItem(first, kBackgroundType), @@ -74,10 +67,6 @@ TestDisplayItem(first, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - // Raster invalidation for the whole chunk will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - GetPaintController().FinishCycle(); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); @@ -90,17 +79,13 @@ EXPECT_EQ(1, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(first, kBackgroundType), TestDisplayItem(first, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // |second| disappeared from the chunk. - UnorderedElementsAre(FloatRect(100, 100, 200, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateSwapOrder) { @@ -141,7 +126,7 @@ EXPECT_EQ(2, NumIndexedItems()); // first #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 6, TestDisplayItem(second, kBackgroundType), @@ -152,10 +137,6 @@ TestDisplayItem(unaffected, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Bounds of |second| (old and new are the same). - UnorderedElementsAre(FloatRect(100, 100, 50, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) { @@ -197,7 +178,7 @@ EXPECT_EQ(2, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 6, TestDisplayItem(second, kBackgroundType), @@ -208,12 +189,6 @@ TestDisplayItem(unaffected, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Bounds of |first| (old and new are the same). - UnorderedElementsAre(FloatRect(100, 100, 100, 100))); - // No need to invalidate raster of |second|, because the client (|first|) - // which swapped order with it has been invalidated. - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateNewItemInMiddle) { @@ -244,7 +219,7 @@ EXPECT_EQ(0, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 3, TestDisplayItem(first, kBackgroundType), @@ -252,10 +227,6 @@ TestDisplayItem(second, kBackgroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // |third| newly appeared in the chunk. - UnorderedElementsAre(FloatRect(125, 100, 200, 50))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) { @@ -298,7 +269,7 @@ EXPECT_EQ(2, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 6, TestDisplayItem(first, kBackgroundType), @@ -309,10 +280,6 @@ TestDisplayItem(third, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Bounds of |second| (old and new are the same). - UnorderedElementsAre(FloatRect(100, 100, 50, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, IncrementalRasterInvalidation) { @@ -340,21 +307,9 @@ DrawRect(context, *client, kBackgroundType, FloatRect(client->VisualRect())); } - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre(FloatRect(200, 100, 50, 100), // 0: right - FloatRect(100, 200, 100, 50), // 1: bottom - FloatRect(200, 100, 50, 80), // 2: right - FloatRect(100, 180, 100, 20), // 2: bottom - FloatRect(180, 100, 20, 100), // 3: right - FloatRect(100, 200, 80, 50), // 3: bottom - FloatRect(200, 100, 50, 150), // 4: right - FloatRect(100, 200, 150, 50), // 4: bottom - FloatRect(180, 100, 20, 100), // 5: right - FloatRect(100, 180, 100, 20))); // 5: bottom - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateAddFirstOverlap) { @@ -381,7 +336,7 @@ DrawRect(context, second, kBackgroundType, FloatRect(150, 250, 100, 100)); DrawRect(context, second, kForegroundType, FloatRect(150, 250, 100, 100)); EXPECT_EQ(0, NumCachedNewItems()); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 4, TestDisplayItem(first, kBackgroundType), @@ -390,13 +345,6 @@ TestDisplayItem(second, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre( - // |first| newly appeared in the chunk. - FloatRect(100, 100, 150, 150), - // Old and new bounds of |second|. - FloatRect(200, 200, 50, 50), FloatRect(150, 250, 100, 100))); - GetPaintController().FinishCycle(); InitRootChunk(); DrawRect(context, second, kBackgroundType, FloatRect(150, 250, 100, 100)); @@ -409,17 +357,13 @@ EXPECT_EQ(2, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(second, kBackgroundType), TestDisplayItem(second, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // |first| disappeared from the chunk. - UnorderedElementsAre(FloatRect(100, 100, 150, 150))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateAddLastOverlap) { @@ -446,7 +390,7 @@ DrawRect(context, second, kBackgroundType, FloatRect(200, 200, 50, 50)); DrawRect(context, second, kForegroundType, FloatRect(200, 200, 50, 50)); EXPECT_EQ(0, NumCachedNewItems()); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 4, TestDisplayItem(first, kBackgroundType), @@ -455,13 +399,6 @@ TestDisplayItem(second, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre( - // The bigger of old and new bounds of |first|. - FloatRect(100, 100, 150, 150), - // |second| newly appeared in the chunk. - FloatRect(200, 200, 50, 50))); - GetPaintController().FinishCycle(); InitRootChunk(); first.Invalidate(); @@ -470,88 +407,13 @@ DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); DrawRect(context, first, kForegroundType, FloatRect(100, 100, 150, 150)); EXPECT_EQ(0, NumCachedNewItems()); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(first, kBackgroundType), TestDisplayItem(first, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre( - // The bigger of old and new bounds of |first|. - FloatRect(100, 100, 150, 150), - // |second| disappeared from the chunk. - FloatRect(200, 200, 50, 50))); - GetPaintController().FinishCycle(); -} - -TEST_P(PaintControllerTest, UpdateClip) { - FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); - FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); - GraphicsContext context(GetPaintController()); - - auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(1, 1, 2, 2)); - auto properties = DefaultPaintChunkProperties(); - properties.SetClip(clip.get()); - GetPaintController().UpdateCurrentPaintChunkProperties( - PaintChunk::Id(first, kClipType), properties); - DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); - DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 200, 200)); - CommitAndFinishCycle(); - - EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, - TestDisplayItem(first, kBackgroundType), - TestDisplayItem(second, kBackgroundType)); - - InitRootChunk(); - first.Invalidate(); - DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); - DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 200, 200)); - - EXPECT_EQ(1, NumCachedNewItems()); -#if DCHECK_IS_ON() - EXPECT_EQ(1, NumSequentialMatches()); - EXPECT_EQ(0, NumOutOfOrderMatches()); - EXPECT_EQ(1, NumIndexedItems()); -#endif - - GetPaintController().CommitNewDisplayItems(); - - EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, - TestDisplayItem(first, kBackgroundType), - TestDisplayItem(second, kBackgroundType)); - - EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - // This is a new chunk. Raster invalidation for the whole chunk will be - // issued during PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - GetPaintController().FinishCycle(); - - InitRootChunk(); - second.Invalidate(); - DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); - - auto clip2 = CreateClip(c0(), &t0(), FloatRoundedRect(1, 1, 2, 2)); - auto properties2 = DefaultPaintChunkProperties(); - properties2.SetClip(clip2.get()); - GetPaintController().UpdateCurrentPaintChunkProperties( - PaintChunk::Id(second, kClipType), properties2); - DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 200, 200)); - GetPaintController().CommitNewDisplayItems(); - - EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, - TestDisplayItem(first, kBackgroundType), - TestDisplayItem(second, kBackgroundType)); - - EXPECT_EQ(2u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // |second| disappeared from the first chunk. - UnorderedElementsAre(FloatRect(100, 100, 200, 200))); - // This is a new chunk. Raster invalidation for the whole chunk will be - // issued during PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(1)); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, CachedDisplayItems) { @@ -585,7 +447,7 @@ InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 150, 150)); DrawRect(context, second, kBackgroundType, FloatRect(100, 100, 150, 150)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(first, kBackgroundType), @@ -602,9 +464,12 @@ GetPaintController().GetDisplayItemList()[1]) .GetPaintRecord()); } - GetPaintController().FinishCycle(); EXPECT_TRUE(ClientCacheIsValid(first)); EXPECT_TRUE(ClientCacheIsValid(second)); + + InvalidateAll(); + EXPECT_FALSE(ClientCacheIsValid(first)); + EXPECT_FALSE(ClientCacheIsValid(second)); } TEST_P(PaintControllerTest, UpdateSwapOrderWithChildren) { @@ -649,7 +514,7 @@ DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 8, TestDisplayItem(container2, kBackgroundType), @@ -662,14 +527,6 @@ TestDisplayItem(container1, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT( - *GetRasterInvalidationRects(0), - UnorderedElementsAre( - // Bounds of |container2| which was moved behind |container1|. - FloatRect(100, 200, 100, 100), - // Bounds of |content2| which was moved along with |container2|. - FloatRect(100, 200, 50, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) { @@ -715,7 +572,7 @@ DrawRect(context, content1, kBackgroundType, FloatRect(100, 100, 50, 200)); DrawRect(context, content1, kForegroundType, FloatRect(100, 100, 50, 200)); DrawRect(context, container1, kForegroundType, FloatRect(100, 100, 100, 100)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 8, TestDisplayItem(container2, kBackgroundType), @@ -728,16 +585,6 @@ TestDisplayItem(container1, kForegroundType)); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT( - *GetRasterInvalidationRects(0), - UnorderedElementsAre( - // Bounds of |container1| (old and new are the same). - FloatRect(100, 100, 100, 100), - // Bounds of |container2| which was moved behind |container1|. - FloatRect(100, 200, 100, 100), - // Bounds of |content2| which was moved along with |container2|. - FloatRect(100, 200, 50, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, CachedSubsequenceForcePaintChunk) { @@ -840,7 +687,7 @@ DrawRect(context, container2, kForegroundType, FloatRect(100, 200, 100, 100)); } - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 8, TestDisplayItem(container1, kBackgroundType), @@ -868,11 +715,6 @@ GetPaintController().PaintChunks()[0].id); EXPECT_EQ(PaintChunk::Id(container2, kBackgroundType), GetPaintController().PaintChunks()[1].id); - // Raster invalidation for the whole chunks will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - EXPECT_FALSE(GetRasterInvalidationRects(1)); - GetPaintController().FinishCycle(); // Simulate the situation when |container1| gets a z-index that is greater // than that of |container2|. @@ -928,7 +770,7 @@ EXPECT_EQ(0, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 8, TestDisplayItem(container2, kBackgroundType), @@ -955,10 +797,6 @@ GetPaintController().PaintChunks()[0].id); EXPECT_EQ(PaintChunk::Id(container1, kBackgroundType), GetPaintController().PaintChunks()[1].id); - // Swapping order of chunks should not invalidate anything. - EXPECT_FALSE(GetRasterInvalidationRects(0)); - EXPECT_FALSE(GetRasterInvalidationRects(1)); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, CachedSubsequenceAndDisplayItemsSwapOrder) { @@ -1143,7 +981,7 @@ PaintChunk::Id(container2, kBackgroundType), container2_properties); DrawRect(context, container2, kBackgroundType, FloatRect(100, 200, 100, 100)); DrawRect(context, content2, kBackgroundType, FloatRect(100, 200, 50, 200)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 4, TestDisplayItem(container1, kBackgroundType), @@ -1156,11 +994,6 @@ GetPaintController().PaintChunks()[0].id); EXPECT_EQ(PaintChunk::Id(container2, kBackgroundType), GetPaintController().PaintChunks()[1].id); - // Raster invalidation for the whole chunks will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - EXPECT_FALSE(GetRasterInvalidationRects(1)); - GetPaintController().FinishCycle(); // Move content2 into container1, without invalidation. GetPaintController().UpdateCurrentPaintChunkProperties( @@ -1179,7 +1012,7 @@ EXPECT_EQ(1, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 4, TestDisplayItem(container1, kBackgroundType), @@ -1192,12 +1025,6 @@ GetPaintController().PaintChunks()[0].id); EXPECT_EQ(PaintChunk::Id(container2, kBackgroundType), GetPaintController().PaintChunks()[1].id); - // |content2| is invalidated raster on both the old chunk and the new chunk. - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre(FloatRect(100, 200, 50, 200))); - EXPECT_THAT(*GetRasterInvalidationRects(1), - UnorderedElementsAre(FloatRect(100, 200, 50, 200))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, OutOfOrderNoCrash) { @@ -1294,7 +1121,7 @@ FloatRect(100, 200, 50, 200)); } } - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 6, TestDisplayItem(container1, kBackgroundType), @@ -1335,14 +1162,6 @@ GetPaintController().PaintChunks()[3].id); EXPECT_EQ(PaintChunk::Id(content2, kBackgroundType), GetPaintController().PaintChunks()[4].id); - // Raster invalidation for the whole chunks will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - EXPECT_FALSE(GetRasterInvalidationRects(1)); - EXPECT_FALSE(GetRasterInvalidationRects(2)); - EXPECT_FALSE(GetRasterInvalidationRects(3)); - EXPECT_FALSE(GetRasterInvalidationRects(4)); - GetPaintController().FinishCycle(); // Invalidate container1 but not content1. container1.Invalidate(); @@ -1400,7 +1219,7 @@ EXPECT_EQ(0, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 4, TestDisplayItem(content2, kForegroundType), @@ -1430,15 +1249,6 @@ GetPaintController().PaintChunks()[1].id); EXPECT_EQ(PaintChunk::Id(container1, kForegroundType), GetPaintController().PaintChunks()[2].id); - // This is a new chunk. Raster invalidation of the whole chunk will be - // issued during PaintArtifactCompositor::Update(). - EXPECT_TRUE(GetRasterInvalidationRects(0)->IsEmpty()); - // This chunk didn't change. - EXPECT_TRUE(GetRasterInvalidationRects(1)->IsEmpty()); - // |container1| is invalidated. - EXPECT_THAT(*GetRasterInvalidationRects(2), - UnorderedElementsAre(FloatRect(100, 100, 100, 100))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, SkipCache) { @@ -1458,7 +1268,7 @@ DrawRect(context, content, kForegroundType, rect2); GetPaintController().EndSkippingCache(); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 3, TestDisplayItem(multicol, kBackgroundType), @@ -1475,10 +1285,6 @@ EXPECT_NE(record1, record2); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - // Raster invalidation for the whole chunk will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - GetPaintController().FinishCycle(); InitRootChunk(); // Draw again with nothing invalidated. @@ -1497,7 +1303,7 @@ EXPECT_EQ(0, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 3, TestDisplayItem(multicol, kBackgroundType), @@ -1511,10 +1317,6 @@ .GetPaintRecord()); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Bounds of |content| (old and new are the same); - UnorderedElementsAre(FloatRect(100, 100, 100, 100))); - GetPaintController().FinishCycle(); InitRootChunk(); // Now the multicol becomes 3 columns and repaints. @@ -1540,16 +1342,9 @@ GetPaintController().NewDisplayItemList()[2]) .GetPaintRecord()); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - UnorderedElementsAre( - // Bounds of |multicol| (old and new are the same); - FloatRect(100, 100, 200, 200), - // Bounds of |content| (old and new are the same); - FloatRect(100, 100, 100, 100))); - GetPaintController().FinishCycle(); } TEST_P(PaintControllerTest, PartialSkipCache) { @@ -1607,7 +1402,7 @@ EXPECT_EQ(0, NumIndexedItems()); #endif - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 3, TestDisplayItem(content, kBackgroundType), @@ -1622,7 +1417,6 @@ EXPECT_NE(record2, static_cast<const DrawingDisplayItem&>( GetPaintController().GetDisplayItemList()[2]) .GetPaintRecord()); - GetPaintController().FinishCycle(); } @@ -1704,62 +1498,6 @@ EXPECT_FALSE(result.image_painted); } -TEST_P(PaintControllerTest, PartialInvalidation) { - FakeDisplayItemClient client("client", LayoutRect(100, 100, 300, 300)); - GraphicsContext context(GetPaintController()); - - // Test partial rect invalidation in a new chunk. - InitRootChunk(); - client.SetPartialInvalidationVisualRect(LayoutRect(200, 200, 100, 100)); - DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); - GetPaintController().CommitNewDisplayItems(); - ASSERT_EQ(1u, GetPaintController().PaintChunks().size()); - // Raster invalidation for the whole new chunk will be issued during - // PaintArtifactCompositor::Update(). - EXPECT_FALSE(GetRasterInvalidationRects(0)); - GetPaintController().FinishCycle(); - EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); - - // Test partial rect invalidation without other invalidations. - InitRootChunk(); - client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); - DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); - GetPaintController().CommitNewDisplayItems(); - ASSERT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Partial invalidation. - UnorderedElementsAre(FloatRect(150, 160, 170, 180))); - GetPaintController().FinishCycle(); - EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); - - // Test partial rect invalidation with full invalidation. - InitRootChunk(); - client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); - client.Invalidate(); - DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 300)); - GetPaintController().CommitNewDisplayItems(); - ASSERT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Partial invalidation is shadowed by full invalidation. - UnorderedElementsAre(FloatRect(100, 100, 300, 300))); - GetPaintController().FinishCycle(); - EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); - - // Test partial rect invalidation with incremental invalidation. - InitRootChunk(); - client.SetPartialInvalidationVisualRect(LayoutRect(150, 160, 170, 180)); - client.SetVisualRect(LayoutRect(100, 100, 300, 400)); - DrawRect(context, client, kBackgroundType, FloatRect(100, 100, 300, 400)); - GetPaintController().CommitNewDisplayItems(); - ASSERT_EQ(1u, GetPaintController().PaintChunks().size()); - EXPECT_THAT(*GetRasterInvalidationRects(0), - // Both partial invalidation and incremental invalidation. - UnorderedElementsAre(FloatRect(100, 400, 300, 100), - FloatRect(150, 160, 170, 180))); - GetPaintController().FinishCycle(); - EXPECT_EQ(LayoutRect(), client.PartialInvalidationVisualRect()); -} - TEST_P(PaintControllerTest, InvalidateAll) { if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; @@ -1789,41 +1527,6 @@ EXPECT_TRUE(GetPaintController().CacheIsAllInvalid()); } -TEST_P(PaintControllerTest, TransientPaintController) { - FakeDisplayItemClient client("client", LayoutRect(100, 100, 300, 300)); - GraphicsContext context(GetPaintController()); - InitRootChunk(); - DrawRect(context, client, kBackgroundType, FloatRect(1, 2, 3, 4)); - CommitAndFinishCycle(); - EXPECT_TRUE(client.IsCacheable()); - EXPECT_TRUE(ClientCacheIsValid(GetPaintController(), client)); - - auto transient_controller = - PaintController::Create(PaintController::kTransient); - GraphicsContext transient_context(*transient_controller); - InitRootChunk(*transient_controller); - DrawRect(transient_context, client, kBackgroundType, FloatRect(1, 2, 3, 4)); - transient_controller->CommitNewDisplayItems(); - - // Painting on a transient PaintController doesn't affect cache status in a - // multi-paint PaintController. - EXPECT_TRUE(client.IsCacheable()); - EXPECT_TRUE(ClientCacheIsValid(GetPaintController(), client)); - // EXPECT_FALSE(ClientCacheIsValid(*transient_controller, client)); - - InitRootChunk(*transient_controller); - transient_controller->BeginSkippingCache(); - DrawRect(transient_context, client, kBackgroundType, FloatRect(1, 2, 3, 4)); - transient_controller->EndSkippingCache(); - transient_controller->CommitNewDisplayItems(); - - // Skipping cache on a transient PaintController doesn't affect cache status - // in a multi-paint PaintController. - EXPECT_TRUE(client.IsCacheable()); - EXPECT_TRUE(ClientCacheIsValid(GetPaintController(), client)); - // EXPECT_FALSE(ClientCacheIsValid(*transient_controller, client)); -} - // Death tests don't work properly on Android. #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) @@ -1870,31 +1573,6 @@ CommitAndFinishCycle(); } -TEST_P(PaintControllerTest, DisplayItemIsCacheable) { - GraphicsContext context(GetPaintController()); - - { - auto client = - std::make_unique<FakeDisplayItemClient>("test", LayoutRect(1, 2, 3, 4)); - auto uncacheable_client = - std::make_unique<FakeDisplayItemClient>("test", LayoutRect(1, 2, 3, 4)); - uncacheable_client->Invalidate(PaintInvalidationReason::kUncacheable); - - InitRootChunk(); - DrawRect(context, *client, kForegroundType, FloatRect(1, 2, 3, 4)); - DrawRect(context, *uncacheable_client, kForegroundType, - FloatRect(1, 2, 3, 4)); - CommitAndFinishCycle(); - EXPECT_TRUE(GetPaintController().GetDisplayItemList()[0].IsCacheable()); - EXPECT_FALSE(GetPaintController().GetDisplayItemList()[1].IsCacheable()); - } - - // We can still access DisplayItem::IsCacheable() after the clients are - // destroyed. - EXPECT_TRUE(GetPaintController().GetDisplayItemList()[0].IsCacheable()); - EXPECT_FALSE(GetPaintController().GetDisplayItemList()[1].IsCacheable()); -} - class PaintControllerUnderInvalidationTest : public PaintControllerTestBase, private ScopedPaintUnderInvalidationCheckingForTest {
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h index 253804b..2ec882b5 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
@@ -86,11 +86,6 @@ return ClientCacheIsValid(*paint_controller_, client); } - const ChunkRasterInvalidationRects* GetRasterInvalidationRects(size_t i) { - return GetPaintController().GetPaintArtifact().GetRasterInvalidationRects( - i); - } - private: FakeDisplayItemClient root_paint_property_client_; PaintChunk::Id root_paint_chunk_id_;
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_record_builder_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_record_builder_test.cc index a05c351..baac60e 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_record_builder_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_record_builder_test.cc
@@ -76,7 +76,7 @@ FakeDisplayItemClient client("client", LayoutRect(10, 10, 20, 20)); DrawRect(context, client, kBackgroundType, FloatRect(10, 10, 20, 20)); DrawRect(context, client, kForegroundType, FloatRect(15, 15, 10, 10)); - GetPaintController().CommitNewDisplayItems(); + CommitAndFinishCycle(); EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(client, kBackgroundType), TestDisplayItem(client, kForegroundType));
diff --git a/third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h b/third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h index 00ffa55..04e2760d 100644 --- a/third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h +++ b/third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h
@@ -26,6 +26,7 @@ struct RasterInvalidationInfo { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); + // This is for comparison only. Don't dereference because the client may have // died. const DisplayItemClient* client = nullptr; @@ -36,6 +37,22 @@ PaintInvalidationReason reason = PaintInvalidationReason::kFull; }; +inline bool operator==(const RasterInvalidationInfo& a, + const RasterInvalidationInfo& b) { + return a.client == b.client && a.client_debug_name == b.client_debug_name && + a.rect == b.rect && a.reason == b.reason; +} +inline bool operator!=(const RasterInvalidationInfo& a, + const RasterInvalidationInfo& b) { + return !(a == b); +} + +inline std::ostream& operator<<(std::ostream& os, + const RasterInvalidationInfo& info) { + return os << info.client << ":" << info.client_debug_name + << " rect=" << info.rect << " reason=" << info.reason; +} + struct RasterUnderInvalidation { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); int x;
diff --git a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.cc b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.cc index 897ecf84..e33be29 100644 --- a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.cc +++ b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.cc
@@ -9,19 +9,37 @@ #include <utility> #include "third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.h" +#include "third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.h" #include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" namespace blink { +void RasterInvalidator::UpdateClientDebugNames( + const PaintArtifact& paint_artifact, + const PaintChunkSubset& paint_chunks) { + DCHECK(tracking_info_); + auto& debug_names = tracking_info_->old_client_debug_names; + debug_names.clear(); + for (const auto& chunk : paint_chunks) { + debug_names.insert(&chunk.id.client, chunk.id.client.DebugName()); + for (const auto& item : + paint_artifact.GetDisplayItemList().ItemsInPaintChunk(chunk)) + debug_names.insert(&item.Client(), item.Client().DebugName()); + } +} + void RasterInvalidator::SetTracksRasterInvalidations(bool should_track) { if (should_track) { if (!tracking_info_) tracking_info_ = std::make_unique<RasterInvalidationTrackingInfo>(); tracking_info_->tracking.ClearInvalidations(); - for (const auto& info : paint_chunks_info_) { - tracking_info_->old_client_debug_names.Set(&info.id.client, - info.id.client.DebugName()); + + // This is called just after a full document cycle update, so all clients in + // old_paint_artifact_ should be still alive. + if (old_paint_artifact_) { + UpdateClientDebugNames(*old_paint_artifact_, + old_paint_artifact_->PaintChunks()); } } else if (!RasterInvalidationTracking::ShouldAlwaysTrack()) { tracking_info_ = nullptr; @@ -30,14 +48,26 @@ } } +const PaintChunk& RasterInvalidator::GetOldChunk(size_t index) const { + DCHECK(old_paint_artifact_); + const auto& old_chunk_info = old_paint_chunks_info_[index]; + const auto& old_chunk = + old_paint_artifact_ + ->PaintChunks()[old_chunk_info.index_in_paint_artifact]; +#if DCHECK_IS_ON() + DCHECK(old_chunk.id == old_chunk_info.id); +#endif + return old_chunk; +} + size_t RasterInvalidator::MatchNewChunkToOldChunk(const PaintChunk& new_chunk, - size_t old_index) { - for (size_t i = old_index; i < paint_chunks_info_.size(); i++) { - if (paint_chunks_info_[i].Matches(new_chunk)) + size_t old_index) const { + for (size_t i = old_index; i < old_paint_chunks_info_.size(); i++) { + if (new_chunk.Matches(GetOldChunk(i))) return i; } for (size_t i = 0; i < old_index; i++) { - if (paint_chunks_info_[i].Matches(new_chunk)) + if (new_chunk.Matches(GetOldChunk(i))) return i; } return kNotFound; @@ -60,33 +90,35 @@ PaintInvalidationReason RasterInvalidator::ChunkPropertiesChanged( const RefCountedPropertyTreeState& new_chunk_state, - const PaintChunkInfo& new_chunk, - const PaintChunkInfo& old_chunk, + const RefCountedPropertyTreeState& old_chunk_state, + const PaintChunkInfo& new_chunk_info, + const PaintChunkInfo& old_chunk_info, const PropertyTreeState& layer_state) const { // Special case for transform changes because we may create or delete some // transform nodes when no raster invalidation is needed. For example, when // a composited layer previously not transformed now gets transformed. // Check for real accumulated transform change instead. - if (!ApproximatelyEqual(new_chunk.chunk_to_layer_transform, - old_chunk.chunk_to_layer_transform)) + if (!ApproximatelyEqual(new_chunk_info.chunk_to_layer_transform, + old_chunk_info.chunk_to_layer_transform)) return PaintInvalidationReason::kPaintProperty; // Treat the chunk property as changed if the effect node pointer is // different, or the effect node's value changed between the layer state and // the chunk state. - if (new_chunk_state.Effect() != old_chunk.effect_state || + if (new_chunk_state.Effect() != old_chunk_state.Effect() || new_chunk_state.Effect()->Changed(layer_state, new_chunk_state.Transform())) return PaintInvalidationReason::kPaintProperty; // Check for accumulated clip rect change, if the clip rects are tight. - if (new_chunk.chunk_to_layer_clip.IsTight() && - old_chunk.chunk_to_layer_clip.IsTight()) { - if (new_chunk.chunk_to_layer_clip == old_chunk.chunk_to_layer_clip) + if (new_chunk_info.chunk_to_layer_clip.IsTight() && + old_chunk_info.chunk_to_layer_clip.IsTight()) { + if (new_chunk_info.chunk_to_layer_clip == + old_chunk_info.chunk_to_layer_clip) return PaintInvalidationReason::kNone; // Ignore differences out of the current layer bounds. - if (ClipByLayerBounds(new_chunk.chunk_to_layer_clip.Rect()) == - ClipByLayerBounds(old_chunk.chunk_to_layer_clip.Rect())) + if (ClipByLayerBounds(new_chunk_info.chunk_to_layer_clip.Rect()) == + ClipByLayerBounds(old_chunk_info.chunk_to_layer_clip.Rect())) return PaintInvalidationReason::kNone; return PaintInvalidationReason::kIncremental; } @@ -94,7 +126,7 @@ // Otherwise treat the chunk property as changed if the clip node pointer is // different, or the clip node's value changed between the layer state and the // chunk state. - if (new_chunk_state.Clip() != old_chunk.clip_state || + if (new_chunk_state.Clip() != old_chunk_state.Clip() || new_chunk_state.Clip()->Changed(layer_state, new_chunk_state.Transform())) return PaintInvalidationReason::kPaintProperty; @@ -112,7 +144,7 @@ // common cases that most of the chunks can be matched in-order, the complexity // is slightly larger than O(n). void RasterInvalidator::GenerateRasterInvalidations( - const PaintArtifact& paint_artifact, + const PaintArtifact& new_paint_artifact, const PaintChunkSubset& new_chunks, const PropertyTreeState& layer_state, const FloatSize& visual_rect_subpixel_offset, @@ -120,32 +152,35 @@ ChunkToLayerMapper mapper(layer_state, layer_bounds_.OffsetFromOrigin(), visual_rect_subpixel_offset); Vector<bool> old_chunks_matched; - old_chunks_matched.resize(paint_chunks_info_.size()); + old_chunks_matched.resize(old_paint_chunks_info_.size()); size_t old_index = 0; size_t max_matched_old_index = 0; - for (const auto& new_chunk : new_chunks) { + for (auto it = new_chunks.begin(); it != new_chunks.end(); ++it) { + const auto& new_chunk = *it; mapper.SwitchToChunk(new_chunk); - auto& new_chunk_info = - new_chunks_info.emplace_back(*this, mapper, new_chunk); + auto& new_chunk_info = new_chunks_info.emplace_back(*this, mapper, it); if (!new_chunk.is_cacheable) { - FullyInvalidateNewChunk(new_chunk_info, - PaintInvalidationReason::kChunkUncacheable); + AddRasterInvalidation(new_chunk_info.bounds_in_layer, new_chunk.id.client, + PaintInvalidationReason::kChunkUncacheable, + kClientIsNew); continue; } size_t matched_old_index = MatchNewChunkToOldChunk(new_chunk, old_index); if (matched_old_index == kNotFound) { // The new chunk doesn't match any old chunk. - FullyInvalidateNewChunk(new_chunk_info, - PaintInvalidationReason::kChunkAppeared); + AddRasterInvalidation(new_chunk_info.bounds_in_layer, new_chunk.id.client, + PaintInvalidationReason::kChunkAppeared, + kClientIsNew); continue; } DCHECK(!old_chunks_matched[matched_old_index]); old_chunks_matched[matched_old_index] = true; - auto& old_chunk_info = paint_chunks_info_[matched_old_index]; + auto& old_chunk_info = old_paint_chunks_info_[matched_old_index]; + const auto& old_chunk = GetOldChunk(matched_old_index); // Clip the old chunk bounds by the new layer bounds. old_chunk_info.bounds_in_layer = ClipByLayerBounds(old_chunk_info.bounds_in_layer); @@ -153,14 +188,20 @@ PaintInvalidationReason reason = matched_old_index < max_matched_old_index ? PaintInvalidationReason::kChunkReordered - : ChunkPropertiesChanged(new_chunk.properties, new_chunk_info, - old_chunk_info, layer_state); + : ChunkPropertiesChanged(new_chunk.properties, old_chunk.properties, + new_chunk_info, old_chunk_info, + layer_state); if (IsFullPaintInvalidationReason(reason)) { // Invalidate both old and new bounds of the chunk if the chunk's paint // properties changed, or is moved backward and may expose area that was // previously covered by it. - FullyInvalidateChunk(old_chunk_info, new_chunk_info, reason); + AddRasterInvalidation(old_chunk_info.bounds_in_layer, new_chunk.id.client, + reason, kClientIsNew); + if (old_chunk_info.bounds_in_layer != new_chunk_info.bounds_in_layer) { + AddRasterInvalidation(new_chunk_info.bounds_in_layer, + new_chunk.id.client, reason, kClientIsNew); + } // Ignore the display item raster invalidations because we have fully // invalidated the chunk. } else { @@ -171,101 +212,61 @@ new_chunk_info.chunk_to_layer_transform = old_chunk_info.chunk_to_layer_transform; - if (reason == PaintInvalidationReason::kIncremental) - IncrementallyInvalidateChunk(old_chunk_info, new_chunk_info); + if (reason == PaintInvalidationReason::kIncremental) { + IncrementallyInvalidateChunk(old_chunk_info, new_chunk_info, + new_chunk.id.client); + } - // Add the raster invalidations found by PaintController within the chunk. - AddDisplayItemRasterInvalidations(paint_artifact, new_chunk, mapper); + if (&new_paint_artifact != old_paint_artifact_) { + DisplayItemRasterInvalidator(*this, *old_paint_artifact_, + new_paint_artifact, old_chunk, new_chunk, + mapper) + .Generate(); + } } old_index = matched_old_index + 1; - if (old_index == paint_chunks_info_.size()) + if (old_index == old_paint_chunks_info_.size()) old_index = 0; max_matched_old_index = std::max(max_matched_old_index, matched_old_index); } // Invalidate remaining unmatched (disappeared or uncacheable) old chunks. - for (size_t i = 0; i < paint_chunks_info_.size(); ++i) { + for (size_t i = 0; i < old_paint_chunks_info_.size(); ++i) { if (old_chunks_matched[i]) continue; - FullyInvalidateOldChunk(paint_chunks_info_[i], - paint_chunks_info_[i].is_cacheable - ? PaintInvalidationReason::kChunkDisappeared - : PaintInvalidationReason::kChunkUncacheable); - } -} -void RasterInvalidator::AddDisplayItemRasterInvalidations( - const PaintArtifact& paint_artifact, - const PaintChunk& chunk, - const ChunkToLayerMapper& mapper) { - const auto* rects = paint_artifact.GetRasterInvalidationRects(chunk); - if (!rects || rects->IsEmpty()) - return; - - const auto* tracking = paint_artifact.GetRasterInvalidationTracking(chunk); - DCHECK(!tracking || tracking->IsEmpty() || tracking->size() == rects->size()); - - for (size_t i = 0; i < rects->size(); ++i) { - auto rect = ClipByLayerBounds(mapper.MapVisualRect((*rects)[i])); - if (rect.IsEmpty()) - continue; - raster_invalidation_function_(rect); - - if (tracking && !tracking->IsEmpty()) { - const auto& info = (*tracking)[i]; - tracking_info_->tracking.AddInvalidation( - info.client, info.client_debug_name, rect, info.reason); - } + const auto& old_chunk = GetOldChunk(i); + auto reason = old_chunk.is_cacheable + ? PaintInvalidationReason::kChunkDisappeared + : PaintInvalidationReason::kChunkUncacheable; + AddRasterInvalidation(old_paint_chunks_info_[i].bounds_in_layer, + old_chunk.id.client, reason, kClientIsOld); } } void RasterInvalidator::IncrementallyInvalidateChunk( - const PaintChunkInfo& old_chunk, - const PaintChunkInfo& new_chunk) { - SkRegion diff(old_chunk.bounds_in_layer); - diff.op(new_chunk.bounds_in_layer, SkRegion::kXOR_Op); + const PaintChunkInfo& old_chunk_info, + const PaintChunkInfo& new_chunk_info, + const DisplayItemClient& client) { + SkRegion diff(old_chunk_info.bounds_in_layer); + diff.op(new_chunk_info.bounds_in_layer, SkRegion::kXOR_Op); for (SkRegion::Iterator it(diff); !it.done(); it.next()) { const SkIRect& r = it.rect(); - AddRasterInvalidation(IntRect(r.x(), r.y(), r.width(), r.height()), - &new_chunk.id.client, - PaintInvalidationReason::kIncremental); + AddRasterInvalidation(IntRect(r.x(), r.y(), r.width(), r.height()), client, + PaintInvalidationReason::kIncremental, kClientIsNew); } } -void RasterInvalidator::FullyInvalidateChunk(const PaintChunkInfo& old_chunk, - const PaintChunkInfo& new_chunk, - PaintInvalidationReason reason) { - FullyInvalidateOldChunk(old_chunk, reason); - if (old_chunk.bounds_in_layer != new_chunk.bounds_in_layer) - FullyInvalidateNewChunk(new_chunk, reason); -} - -void RasterInvalidator::FullyInvalidateNewChunk( - const PaintChunkInfo& info, - PaintInvalidationReason reason) { - AddRasterInvalidation(info.bounds_in_layer, &info.id.client, reason); -} - -void RasterInvalidator::FullyInvalidateOldChunk( - const PaintChunkInfo& info, - PaintInvalidationReason reason) { - String debug_name; - if (tracking_info_) - debug_name = tracking_info_->old_client_debug_names.at(&info.id.client); - AddRasterInvalidation(info.bounds_in_layer, &info.id.client, reason, - &debug_name); -} - -void RasterInvalidator::AddRasterInvalidation(const IntRect& rect, - const DisplayItemClient* client, - PaintInvalidationReason reason, - const String* debug_name) { - raster_invalidation_function_(rect); - if (tracking_info_) { - tracking_info_->tracking.AddInvalidation( - client, debug_name ? *debug_name : client->DebugName(), rect, reason); - } +void RasterInvalidator::TrackRasterInvalidation(const IntRect& rect, + const DisplayItemClient& client, + PaintInvalidationReason reason, + ClientIsOldOrNew old_or_new) { + DCHECK(tracking_info_); + String debug_name = old_or_new == kClientIsOld + ? tracking_info_->old_client_debug_names.at(&client) + : client.DebugName(); + tracking_info_->tracking.AddInvalidation(&client, debug_name, rect, reason); } RasterInvalidationTracking& RasterInvalidator::EnsureTracking() { @@ -274,31 +275,26 @@ return tracking_info_->tracking; } -void RasterInvalidator::Generate(const PaintArtifact& paint_artifact, - const gfx::Rect& layer_bounds, - const PropertyTreeState& layer_state, - const FloatSize& visual_rect_subpixel_offset, - const DisplayItemClient* layer_client) { - Generate(paint_artifact, paint_artifact.PaintChunks(), layer_bounds, +void RasterInvalidator::Generate( + scoped_refptr<const PaintArtifact> new_paint_artifact, + const gfx::Rect& layer_bounds, + const PropertyTreeState& layer_state, + const FloatSize& visual_rect_subpixel_offset, + const DisplayItemClient* layer_client) { + Generate(new_paint_artifact, new_paint_artifact->PaintChunks(), layer_bounds, layer_state, visual_rect_subpixel_offset, layer_client); } -void RasterInvalidator::Generate(const PaintArtifact& paint_artifact, - const PaintChunkSubset& paint_chunks, - const gfx::Rect& layer_bounds, - const PropertyTreeState& layer_state, - const FloatSize& visual_rect_subpixel_offset, - const DisplayItemClient* layer_client) { +void RasterInvalidator::Generate( + scoped_refptr<const PaintArtifact> new_paint_artifact, + const PaintChunkSubset& paint_chunks, + const gfx::Rect& layer_bounds, + const PropertyTreeState& layer_state, + const FloatSize& visual_rect_subpixel_offset, + const DisplayItemClient* layer_client) { if (RasterInvalidationTracking::ShouldAlwaysTrack()) EnsureTracking(); - if (tracking_info_) { - for (const auto& chunk : paint_chunks) { - tracking_info_->new_client_debug_names.insert( - &chunk.id.client, chunk.id.client.DebugName()); - } - } - bool layer_bounds_was_empty = layer_bounds_.IsEmpty(); layer_bounds_ = layer_bounds; @@ -311,9 +307,9 @@ // next cycle. ChunkToLayerMapper mapper(layer_state, layer_bounds.OffsetFromOrigin(), visual_rect_subpixel_offset); - for (const auto& chunk : paint_chunks) { - mapper.SwitchToChunk(chunk); - new_chunks_info.emplace_back(*this, mapper, chunk); + for (auto it = paint_chunks.begin(); it != paint_chunks.end(); ++it) { + mapper.SwitchToChunk(*it); + new_chunks_info.emplace_back(*this, mapper, it); } if (tracking_info_ && layer_bounds_was_empty && !layer_bounds.IsEmpty() && @@ -322,16 +318,15 @@ layer_client ? *layer_client : paint_chunks[0].id.client); } } else { - GenerateRasterInvalidations(paint_artifact, paint_chunks, layer_state, + GenerateRasterInvalidations(*new_paint_artifact, paint_chunks, layer_state, visual_rect_subpixel_offset, new_chunks_info); } - paint_chunks_info_ = std::move(new_chunks_info); + if (tracking_info_) + UpdateClientDebugNames(*new_paint_artifact, paint_chunks); - if (tracking_info_) { - tracking_info_->old_client_debug_names = - std::move(tracking_info_->new_client_debug_names); - } + old_paint_chunks_info_ = std::move(new_chunks_info); + old_paint_artifact_ = std::move(new_paint_artifact); } void RasterInvalidator::TrackImplicitFullLayerInvalidation( @@ -351,11 +346,13 @@ } size_t RasterInvalidator::ApproximateUnsharedMemoryUsage() const { - return sizeof(*this) + paint_chunks_info_.capacity() * sizeof(PaintChunkInfo); + return sizeof(*this) + + old_paint_chunks_info_.capacity() * sizeof(PaintChunkInfo); } void RasterInvalidator::ClearOldStates() { - paint_chunks_info_.clear(); + old_paint_artifact_ = nullptr; + old_paint_chunks_info_.clear(); layer_bounds_ = gfx::Rect(); }
diff --git a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h index 71f0530a..9a59ad6 100644 --- a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h +++ b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.h" #include "third_party/blink/renderer/platform/graphics/paint/float_clip_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunk.h" +#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h" #include "third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -15,7 +16,6 @@ namespace blink { class PaintArtifact; -class PaintChunkSubset; class IntRect; class PLATFORM_EXPORT RasterInvalidator { @@ -32,9 +32,9 @@ RasterInvalidationTracking& EnsureTracking(); - // Generate raster invalidations for all of the paint chunks in the paint - // artifact. - void Generate(const PaintArtifact&, + // Generate raster invalidations for all of the changed paint chunks and + // display items in the paint artifact. + void Generate(scoped_refptr<const PaintArtifact>, const gfx::Rect& layer_bounds, const PropertyTreeState& layer_state, const FloatSize& visual_rect_subpixel_offset = FloatSize(), @@ -42,18 +42,13 @@ // Generate raster invalidations for a subset of the paint chunks in the // paint artifact. - void Generate(const PaintArtifact&, + void Generate(scoped_refptr<const PaintArtifact>, const PaintChunkSubset&, const gfx::Rect& layer_bounds, const PropertyTreeState& layer_state, const FloatSize& visual_rect_subpixel_offset = FloatSize(), const DisplayItemClient* layer_client = nullptr); - bool Matches(const PaintChunk& paint_chunk) const { - return paint_chunks_info_.size() && paint_chunks_info_[0].is_cacheable && - paint_chunk.Matches(paint_chunks_info_[0].id); - } - const gfx::Rect& LayerBounds() const { return layer_bounds_; } size_t ApproximateUnsharedMemoryUsage() const; @@ -61,34 +56,35 @@ void ClearOldStates(); private: + friend class DisplayItemRasterInvalidator; friend class RasterInvalidatorTest; + void UpdateClientDebugNames(const PaintArtifact&, const PaintChunkSubset&); + struct PaintChunkInfo { PaintChunkInfo(const RasterInvalidator& invalidator, const ChunkToLayerMapper& mapper, - const PaintChunk& chunk) - : id(chunk.id), - clip_state(chunk.properties.Clip()), - effect_state(chunk.properties.Effect()), - is_cacheable(chunk.is_cacheable), + PaintChunkSubset::Iterator chunk_it) + : index_in_paint_artifact(chunk_it.OriginalIndex()), +#if DCHECK_IS_ON() + id(chunk_it->id), +#endif bounds_in_layer(invalidator.ClipByLayerBounds( - mapper.MapVisualRect(chunk.bounds))), + mapper.MapVisualRect(chunk_it->bounds))), chunk_to_layer_clip(mapper.ClipRect()), chunk_to_layer_transform( - TransformationMatrix::ToSkMatrix44(mapper.Transform())) {} - - bool Matches(const PaintChunk& new_chunk) const { - return is_cacheable && new_chunk.Matches(id); + TransformationMatrix::ToSkMatrix44(mapper.Transform())) { } + // The index of the chunk in the PaintArtifact. It may be different from + // the index of this PaintChunkInfo in paint_chunks_info_ when a subset of + // the paint chunks is handled by the RasterInvalidator. + size_t index_in_paint_artifact; + +#if DCHECK_IS_ON() PaintChunk::Id id; - // These two pointers are for property change detection. The pointed - // property nodes can be freed after this structure is created. As newly - // created property nodes always have Changed() flag set, it's not a problem - // that a new node is created at the address pointed by these pointers. - const void* clip_state; - const void* effect_state; - bool is_cacheable; +#endif + IntRect bounds_in_layer; FloatClipRect chunk_to_layer_clip; SkMatrix chunk_to_layer_transform; @@ -99,28 +95,41 @@ const PropertyTreeState& layer_state, const FloatSize& visual_rect_subpixel_offset, Vector<PaintChunkInfo>& new_chunks_info); - size_t MatchNewChunkToOldChunk(const PaintChunk& new_chunk, size_t old_index); - void AddDisplayItemRasterInvalidations(const PaintArtifact&, - const PaintChunk&, - const ChunkToLayerMapper&); - void IncrementallyInvalidateChunk(const PaintChunkInfo& old_chunk, - const PaintChunkInfo& new_chunk); - void FullyInvalidateChunk(const PaintChunkInfo& old_chunk, - const PaintChunkInfo& new_chunk, - PaintInvalidationReason); - ALWAYS_INLINE void FullyInvalidateNewChunk(const PaintChunkInfo&, - PaintInvalidationReason); - ALWAYS_INLINE void FullyInvalidateOldChunk(const PaintChunkInfo&, - PaintInvalidationReason); - ALWAYS_INLINE void AddRasterInvalidation(const IntRect&, - const DisplayItemClient*, - PaintInvalidationReason, - const String* debug_name = nullptr); - PaintInvalidationReason ChunkPropertiesChanged( - const RefCountedPropertyTreeState& new_chunk_state, - const PaintChunkInfo& new_chunk, - const PaintChunkInfo& old_chunk, - const PropertyTreeState& layer_state) const; + + ALWAYS_INLINE const PaintChunk& GetOldChunk(size_t index) const; + ALWAYS_INLINE size_t MatchNewChunkToOldChunk(const PaintChunk& new_chunk, + size_t old_index) const; + + ALWAYS_INLINE void IncrementallyInvalidateChunk( + const PaintChunkInfo& old_chunk_info, + const PaintChunkInfo& new_chunk_info, + const DisplayItemClient&); + + // |old_or_new| indicates if |client| is known to be new (alive) and we can + // get DebugName() directly or should get from |tracking_info_ + // ->old_client_debug_names|. + enum ClientIsOldOrNew { kClientIsOld, kClientIsNew }; + void AddRasterInvalidation(const IntRect& rect, + const DisplayItemClient& client, + PaintInvalidationReason reason, + ClientIsOldOrNew old_or_new) { + if (rect.IsEmpty()) + return; + raster_invalidation_function_(rect); + if (tracking_info_) + TrackRasterInvalidation(rect, client, reason, old_or_new); + } + void TrackRasterInvalidation(const IntRect&, + const DisplayItemClient&, + PaintInvalidationReason, + ClientIsOldOrNew); + + ALWAYS_INLINE PaintInvalidationReason + ChunkPropertiesChanged(const RefCountedPropertyTreeState& new_chunk_state, + const RefCountedPropertyTreeState& old_chunk_state, + const PaintChunkInfo& new_chunk_info, + const PaintChunkInfo& old_chunk_info, + const PropertyTreeState& layer_state) const; // Clip a rect in the layer space by the layer bounds. template <typename Rect> @@ -133,11 +142,11 @@ RasterInvalidationFunction raster_invalidation_function_; gfx::Rect layer_bounds_; - Vector<PaintChunkInfo> paint_chunks_info_; + Vector<PaintChunkInfo> old_paint_chunks_info_; + scoped_refptr<const PaintArtifact> old_paint_artifact_; struct RasterInvalidationTrackingInfo { using ClientDebugNamesMap = HashMap<const DisplayItemClient*, String>; - ClientDebugNamesMap new_client_debug_names; ClientDebugNamesMap old_client_debug_names; RasterInvalidationTracking tracking; };
diff --git a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator_test.cc b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator_test.cc index f0240c0..e02ca6dd 100644 --- a/third_party/blink/renderer/platform/graphics/paint/raster_invalidator_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/raster_invalidator_test.cc
@@ -5,89 +5,21 @@ #include "third_party/blink/renderer/platform/graphics/paint/raster_invalidator.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" -#include "third_party/blink/renderer/platform/testing/fake_display_item_client.h" #include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h" -#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" -#include "third_party/blink/renderer/platform/wtf/dtoa/utils.h" +#include "third_party/blink/renderer/platform/testing/test_paint_artifact.h" namespace blink { static const IntRect kDefaultLayerBounds(-9999, -7777, 18888, 16666); -class RasterInvalidatorTest : public testing::Test, - private ScopedSlimmingPaintV2ForTest { +class RasterInvalidatorTest : public testing::Test { public: - RasterInvalidatorTest() : ScopedSlimmingPaintV2ForTest(true) {} - static PropertyTreeState DefaultPropertyTreeState() { return PropertyTreeState::Root(); } - RasterInvalidatorTest& Chunk(int type) { - DEFINE_STATIC_LOCAL(FakeDisplayItemClient, fake_client, ()); - fake_client.Validate(); - // The enum arithmetics and magic numbers are to produce different values - // of paint chunk and raster invalidation properties. - PaintChunk::Id id(fake_client, static_cast<DisplayItem::Type>( - DisplayItem::kDrawingFirst + type)); - data_.chunks.emplace_back(0, 0, id, DefaultPropertyTreeState()); - data_.chunks.back().bounds = - FloatRect(type * 110, type * 220, type * 220 + 200, type * 110 + 200); - return *this; - } - - RasterInvalidatorTest& Properties(const PropertyTreeState& state) { - data_.chunks.back().properties = state; - return *this; - } - - RasterInvalidatorTest& Properties(const RefCountedPropertyTreeState& state) { - data_.chunks.back().properties = state.GetPropertyTreeState(); - return *this; - } - - RasterInvalidatorTest& Properties(const TransformPaintPropertyNode& t, - const ClipPaintPropertyNode& c, - const EffectPaintPropertyNode& e) { - Properties(PropertyTreeState(&t, &c, &e)); - return *this; - } - - RasterInvalidatorTest& Uncacheable() { - data_.chunks.back().is_cacheable = false; - return *this; - } - - RasterInvalidatorTest& Bounds(const FloatRect& bounds) { - data_.chunks.back().bounds = bounds; - return *this; - } - - RasterInvalidatorTest& RasterInvalidationCount(int count) { - size_t size = data_.chunks.size(); - DCHECK_GT(size, 0u); - data_.raster_invalidation_rects.resize(size); - data_.raster_invalidation_trackings.resize(size); - int index = static_cast<int>(size - 1); - for (int i = 0; i < count; ++i) { - IntRect rect(index * 11, index * 22, index * 22 + 100 + i, - index * 11 + 100 + i); - data_.raster_invalidation_rects.back().push_back(FloatRect(rect)); - data_.raster_invalidation_trackings.back().push_back( - RasterInvalidationInfo{ - &data_.chunks.back().id.client, "Test", rect, - static_cast<PaintInvalidationReason>( - static_cast<int>(PaintInvalidationReason::kFull) + index + - i)}); - } - return *this; - } - - PaintArtifact Build() { - return PaintArtifact(DisplayItemList(0), std::move(data_)); - } - void ClearGeometryMapperCache() { GeometryMapperTransformCache::ClearCache(); GeometryMapperClipCache::ClearCache(); @@ -96,9 +28,8 @@ void SetUp() override { ClearGeometryMapperCache(); } void TearDown() override { ClearGeometryMapperCache(); } - void CleanUp(PaintArtifact& artifact) { - for (auto& chunk : artifact.PaintChunks()) - chunk.properties.ClearChangedToRoot(); + void FinishCycle(PaintArtifact& artifact) { + artifact.FinishCycle(); ClearGeometryMapperCache(); } @@ -108,50 +39,34 @@ return invalidator.GetTracking()->Invalidations(); } - static IntRect ChunkRectToLayer(const FloatRect& rect, - const IntPoint& chunk_offset_from_layer) { + static IntRect ChunkRectToLayer( + const FloatRect& rect, + const IntPoint& layer_offset, + std::function<void(FloatRect&)> mapper = nullptr) { FloatRect r = rect; - r.MoveBy(chunk_offset_from_layer); + if (mapper) + mapper(r); + r.MoveBy(layer_offset); return EnclosingIntRect(r); } RasterInvalidator::RasterInvalidationFunction kNoopRasterInvalidation = - [this](const IntRect& rect) {}; - - PaintChunksAndRasterInvalidations data_; + [](const IntRect& rect) {}; }; -#define EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, invalidation_index, \ - artifact, chunk_index) \ - do { \ - const auto& chunk = (artifact).PaintChunks()[chunk_index]; \ - const auto* rects = (artifact).GetRasterInvalidationRects(chunk); \ - ASSERT_TRUE(rects); \ - const auto* tracking = (artifact).GetRasterInvalidationTracking(chunk); \ - ASSERT_TRUE(tracking); \ - for (size_t i = 0; i < rects->size(); ++i) { \ - SCOPED_TRACE(invalidation_index + i); \ - const auto& info = (invalidations)[invalidation_index + i]; \ - EXPECT_EQ( \ - ChunkRectToLayer((*rects)[i], -kDefaultLayerBounds.Location()), \ - info.rect); \ - EXPECT_EQ(&chunk.id.client, info.client); \ - EXPECT_EQ((*tracking)[i].reason, info.reason); \ - } \ +#define EXPECT_CHUNK_INVALIDATION_CUSTOM( \ + invalidations, index, chunk, expected_reason, layer_offset, mapper) \ + do { \ + const auto& info = (invalidations)[index]; \ + EXPECT_EQ(ChunkRectToLayer((chunk).bounds, layer_offset, mapper), \ + info.rect); \ + EXPECT_EQ(&(chunk).id.client, info.client); \ + EXPECT_EQ(expected_reason, info.reason); \ } while (false) -#define EXPECT_CHUNK_INVALIDATION_WITH_LAYER_OFFSET( \ - invalidations, index, chunk, expected_reason, layer_offset) \ - do { \ - const auto& info = (invalidations)[index]; \ - EXPECT_EQ(ChunkRectToLayer((chunk).bounds, layer_offset), info.rect); \ - EXPECT_EQ(&(chunk).id.client, info.client); \ - EXPECT_EQ(expected_reason, info.reason); \ - } while (false) - -#define EXPECT_CHUNK_INVALIDATION(invalidations, index, chunk, reason) \ - EXPECT_CHUNK_INVALIDATION_WITH_LAYER_OFFSET( \ - invalidations, index, chunk, reason, -kDefaultLayerBounds.Location()) +#define EXPECT_CHUNK_INVALIDATION(invalidations, index, chunk, reason) \ + EXPECT_CHUNK_INVALIDATION_CUSTOM(invalidations, index, chunk, reason, \ + -kDefaultLayerBounds.Location(), nullptr) #define EXPECT_INCREMENTAL_INVALIDATION(invalidations, index, chunk, \ chunk_rect) \ @@ -165,7 +80,7 @@ TEST_F(RasterInvalidatorTest, ImplicitFullLayerInvalidation) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Build(); + auto artifact = TestPaintArtifact().Chunk(0).Build(); invalidator.SetTracksRasterInvalidations(true); invalidator.Generate(artifact, kDefaultLayerBounds, @@ -175,17 +90,17 @@ EXPECT_EQ(IntRect(IntPoint(), kDefaultLayerBounds.Size()), invalidations[0].rect); EXPECT_EQ(PaintInvalidationReason::kFullLayer, invalidations[0].reason); - CleanUp(artifact); + FinishCycle(*artifact); invalidator.SetTracksRasterInvalidations(false); } TEST_F(RasterInvalidatorTest, LayerBounds) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Build(); + auto artifact = TestPaintArtifact().Chunk(0).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); - CleanUp(artifact); + FinishCycle(*artifact); invalidator.SetTracksRasterInvalidations(true); invalidator.Generate(artifact, kDefaultLayerBounds, @@ -199,184 +114,143 @@ // Change of layer origin causes change of chunk0's transform to layer. const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(2u, invalidations.size()); - EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact.PaintChunks()[0], + EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact->PaintChunks()[0], PaintInvalidationReason::kPaintProperty); - EXPECT_CHUNK_INVALIDATION_WITH_LAYER_OFFSET( - invalidations, 1, artifact.PaintChunks()[0], - PaintInvalidationReason::kPaintProperty, -new_layer_bounds.Location()); - CleanUp(artifact); + EXPECT_CHUNK_INVALIDATION_CUSTOM(invalidations, 1, artifact->PaintChunks()[0], + PaintInvalidationReason::kPaintProperty, + -new_layer_bounds.Location(), nullptr); + FinishCycle(*artifact); } TEST_F(RasterInvalidatorTest, ReorderChunks) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Chunk(1).Chunk(2).Build(); + auto artifact = TestPaintArtifact().Chunk(0).Chunk(1).Chunk(2).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); - CleanUp(artifact); + FinishCycle(*artifact); - // Swap chunk 1 and 2. All chunks have their own local raster invalidations. + // Swap chunk 1 and 2. invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .RasterInvalidationCount(2) + auto new_artifact = TestPaintArtifact() + .Chunk(0) .Chunk(2) - .RasterInvalidationCount(4) .Chunk(1) - .RasterInvalidationCount(3) .Bounds(FloatRect(11, 22, 33, 44)) .Build(); invalidator.Generate(new_artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); const auto& invalidations = TrackedRasterInvalidations(invalidator); - ASSERT_EQ(8u, invalidations.size()); - // The first chunk should always match because otherwise we won't reuse the - // RasterInvalidator (which is according to the first chunk's - // id). For matched chunk, we issue raster invalidations if any found by - // PaintController. - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 0, new_artifact, 0); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 2, new_artifact, 1); - // Invalidated new chunk 2's old (as chunks[1]) and new (as new_artifact[2]) - // bounds. - EXPECT_CHUNK_INVALIDATION(invalidations, 6, artifact.PaintChunks()[1], + ASSERT_EQ(2u, invalidations.size()); + // Invalidated new chunk 2's old (as artifact->PaintChunks()[1]) and new + // (as new_artifact->PaintChunks()[2]) bounds. + EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact->PaintChunks()[1], PaintInvalidationReason::kChunkReordered); - EXPECT_CHUNK_INVALIDATION(invalidations, 7, new_artifact.PaintChunks()[2], + EXPECT_CHUNK_INVALIDATION(invalidations, 1, new_artifact->PaintChunks()[2], PaintInvalidationReason::kChunkReordered); - CleanUp(new_artifact); + FinishCycle(*new_artifact); } TEST_F(RasterInvalidatorTest, ReorderChunkSubsequences) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Chunk(1).Chunk(2).Chunk(3).Chunk(4).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Chunk(1).Chunk(2).Chunk(3).Chunk(4).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); - CleanUp(artifact); + FinishCycle(*artifact); - // Swap chunk (1,2) and (3,4). All chunks have their own local raster - // invalidations. + // Swap chunk (1,2) and (3,4). invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .RasterInvalidationCount(2) + auto new_artifact = TestPaintArtifact() + .Chunk(0) .Chunk(3) - .RasterInvalidationCount(3) .Chunk(4) - .RasterInvalidationCount(4) .Chunk(1) - .RasterInvalidationCount(1) .Bounds(FloatRect(11, 22, 33, 44)) .Chunk(2) - .RasterInvalidationCount(2) .Build(); invalidator.Generate(new_artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); const auto& invalidations = TrackedRasterInvalidations(invalidator); - ASSERT_EQ(12u, invalidations.size()); - // The first chunk should always match because otherwise we won't reuse the - // RasterInvalidator (which is according to the first chunk's - // id). For matched chunk, we issue raster invalidations if any found by - // PaintController. - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 0, new_artifact, 0); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 2, new_artifact, 1); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 5, new_artifact, 2); - // Invalidated new chunk 3's old (as chunks[1]) and new (as new_artifact[3]) - // bounds. - EXPECT_CHUNK_INVALIDATION(invalidations, 9, artifact.PaintChunks()[1], + ASSERT_EQ(3u, invalidations.size()); + // Invalidated new chunk 3's old (as artifact->PaintChunks()[1] and new + // (as new_artifact->PaintChunks()[3]) bounds. + EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact->PaintChunks()[1], PaintInvalidationReason::kChunkReordered); - EXPECT_CHUNK_INVALIDATION(invalidations, 10, new_artifact.PaintChunks()[3], + EXPECT_CHUNK_INVALIDATION(invalidations, 1, new_artifact->PaintChunks()[3], PaintInvalidationReason::kChunkReordered); // Invalidated new chunk 4's new bounds. Didn't invalidate old bounds because // it's the same as the new bounds. - EXPECT_CHUNK_INVALIDATION(invalidations, 11, new_artifact.PaintChunks()[4], + EXPECT_CHUNK_INVALIDATION(invalidations, 2, new_artifact->PaintChunks()[4], PaintInvalidationReason::kChunkReordered); - CleanUp(new_artifact); + FinishCycle(*new_artifact); } -TEST_F(RasterInvalidatorTest, AppearAndDisappear) { +TEST_F(RasterInvalidatorTest, ChunkAppearAndDisappear) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Chunk(1).Chunk(2).Build(); + auto artifact = TestPaintArtifact().Chunk(0).Chunk(1).Chunk(2).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); - CleanUp(artifact); + FinishCycle(*artifact); - // Chunk 1 and 2 disappeared, 3 and 4 appeared. All chunks have their own - // local raster invalidations. + // Chunk 1 and 2 disappeared, 3 and 4 appeared. invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .RasterInvalidationCount(2) - .Chunk(3) - .RasterInvalidationCount(3) - .Chunk(4) - .RasterInvalidationCount(3) - .Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, - DefaultPropertyTreeState()); - const auto& invalidations = TrackedRasterInvalidations(invalidator); - ASSERT_EQ(6u, invalidations.size()); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 0, new_artifact, 0); - EXPECT_CHUNK_INVALIDATION(invalidations, 2, new_artifact.PaintChunks()[1], - PaintInvalidationReason::kChunkAppeared); - EXPECT_CHUNK_INVALIDATION(invalidations, 3, new_artifact.PaintChunks()[2], - PaintInvalidationReason::kChunkAppeared); - EXPECT_CHUNK_INVALIDATION(invalidations, 4, artifact.PaintChunks()[1], - PaintInvalidationReason::kChunkDisappeared); - EXPECT_CHUNK_INVALIDATION(invalidations, 5, artifact.PaintChunks()[2], - PaintInvalidationReason::kChunkDisappeared); - CleanUp(new_artifact); -} - -TEST_F(RasterInvalidatorTest, AppearAtEnd) { - RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Build(); - invalidator.Generate(artifact, kDefaultLayerBounds, - DefaultPropertyTreeState()); - CleanUp(artifact); - - invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .RasterInvalidationCount(2) - .Chunk(1) - .RasterInvalidationCount(3) - .Chunk(2) - .RasterInvalidationCount(3) - .Build(); + auto new_artifact = TestPaintArtifact().Chunk(0).Chunk(3).Chunk(4).Build(); invalidator.Generate(new_artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(4u, invalidations.size()); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 0, new_artifact, 0); - EXPECT_CHUNK_INVALIDATION(invalidations, 2, new_artifact.PaintChunks()[1], + EXPECT_CHUNK_INVALIDATION(invalidations, 0, new_artifact->PaintChunks()[1], PaintInvalidationReason::kChunkAppeared); - EXPECT_CHUNK_INVALIDATION(invalidations, 3, new_artifact.PaintChunks()[2], + EXPECT_CHUNK_INVALIDATION(invalidations, 1, new_artifact->PaintChunks()[2], PaintInvalidationReason::kChunkAppeared); - CleanUp(new_artifact); + EXPECT_CHUNK_INVALIDATION(invalidations, 2, artifact->PaintChunks()[1], + PaintInvalidationReason::kChunkDisappeared); + EXPECT_CHUNK_INVALIDATION(invalidations, 3, artifact->PaintChunks()[2], + PaintInvalidationReason::kChunkDisappeared); + FinishCycle(*new_artifact); +} + +TEST_F(RasterInvalidatorTest, ChunkAppearAtEnd) { + RasterInvalidator invalidator(kNoopRasterInvalidation); + auto artifact = TestPaintArtifact().Chunk(0).Build(); + invalidator.Generate(artifact, kDefaultLayerBounds, + DefaultPropertyTreeState()); + FinishCycle(*artifact); + + invalidator.SetTracksRasterInvalidations(true); + auto new_artifact = TestPaintArtifact().Chunk(0).Chunk(1).Chunk(2).Build(); + invalidator.Generate(new_artifact, kDefaultLayerBounds, + DefaultPropertyTreeState()); + const auto& invalidations = TrackedRasterInvalidations(invalidator); + ASSERT_EQ(2u, invalidations.size()); + EXPECT_CHUNK_INVALIDATION(invalidations, 0, new_artifact->PaintChunks()[1], + PaintInvalidationReason::kChunkAppeared); + EXPECT_CHUNK_INVALIDATION(invalidations, 1, new_artifact->PaintChunks()[2], + PaintInvalidationReason::kChunkAppeared); + FinishCycle(*new_artifact); } TEST_F(RasterInvalidatorTest, UncacheableChunks) { RasterInvalidator invalidator(kNoopRasterInvalidation); - auto artifact = Chunk(0).Chunk(1).Uncacheable().Chunk(2).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Chunk(1).Uncacheable().Chunk(2).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); - CleanUp(artifact); + FinishCycle(*artifact); invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .RasterInvalidationCount(2) - .Chunk(2) - .RasterInvalidationCount(3) - .Chunk(1) - .RasterInvalidationCount(3) - .Uncacheable() - .Build(); + auto new_artifact = + TestPaintArtifact().Chunk(0).Chunk(2).Chunk(1).Uncacheable().Build(); invalidator.Generate(new_artifact, kDefaultLayerBounds, DefaultPropertyTreeState()); const auto& invalidations = TrackedRasterInvalidations(invalidator); - ASSERT_EQ(7u, invalidations.size()); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 0, new_artifact, 0); - EXPECT_DISPLAY_ITEM_INVALIDATIONS(invalidations, 2, new_artifact, 1); - EXPECT_CHUNK_INVALIDATION(invalidations, 5, new_artifact.PaintChunks()[2], + ASSERT_EQ(2u, invalidations.size()); + EXPECT_CHUNK_INVALIDATION(invalidations, 0, new_artifact->PaintChunks()[2], PaintInvalidationReason::kChunkUncacheable); - EXPECT_CHUNK_INVALIDATION(invalidations, 6, artifact.PaintChunks()[1], + EXPECT_CHUNK_INVALIDATION(invalidations, 1, artifact->PaintChunks()[1], PaintInvalidationReason::kChunkUncacheable); - CleanUp(new_artifact); + FinishCycle(*new_artifact); } // Tests the path based on ClipPaintPropertyNode::Changed(). @@ -389,7 +263,8 @@ auto clip2 = CreateClip(*clip0, &t0(), clip_rect); PropertyTreeState layer_state(&t0(), clip0.get(), &e0()); - auto artifact = Chunk(0) + auto artifact = TestPaintArtifact() + .Chunk(0) .Properties(layer_state) .Chunk(1) .Properties(layer_state) @@ -398,17 +273,10 @@ .Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change both clip0 and clip2. invalidator.SetTracksRasterInvalidations(true); - auto new_artifact = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Chunk(2) - .Properties(artifact.PaintChunks()[2].properties) - .Build(); FloatRoundedRect new_clip_rect(FloatRect(-2000, -2000, 4000, 4000), radii); clip0->Update(*clip0->Parent(), ClipPaintPropertyNode::State{clip0->LocalTransformSpace(), @@ -417,33 +285,34 @@ ClipPaintPropertyNode::State{clip2->LocalTransformSpace(), new_clip_rect}); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(1u, invalidations.size()); // Property change in the layer state should not trigger raster invalidation. // |clip2| change should trigger raster invalidation. - EXPECT_CHUNK_INVALIDATION(invalidations, 0, new_artifact.PaintChunks()[2], + EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact->PaintChunks()[2], PaintInvalidationReason::kPaintProperty); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact); + FinishCycle(*artifact); // Change chunk1's properties to use a different property tree state. - auto new_artifact1 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) + auto new_artifact1 = TestPaintArtifact() + .Chunk(0) + .Properties(artifact->PaintChunks()[0].properties) .Chunk(1) - .Properties(artifact.PaintChunks()[2].properties) + .Properties(artifact->PaintChunks()[2].properties) .Chunk(2) - .Properties(artifact.PaintChunks()[2].properties) + .Properties(artifact->PaintChunks()[2].properties) .Build(); invalidator.SetTracksRasterInvalidations(true); invalidator.Generate(new_artifact1, kDefaultLayerBounds, layer_state); const auto& invalidations1 = TrackedRasterInvalidations(invalidator); ASSERT_EQ(1u, invalidations1.size()); - EXPECT_CHUNK_INVALIDATION(invalidations1, 0, new_artifact1.PaintChunks()[1], + EXPECT_CHUNK_INVALIDATION(invalidations1, 0, new_artifact1->PaintChunks()[1], PaintInvalidationReason::kPaintProperty); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact1); + FinishCycle(*new_artifact1); } // Tests the path detecting change of PaintChunkInfo::chunk_to_layer_clip. @@ -454,7 +323,8 @@ auto clip1 = CreateClip(*clip0, &t0(), clip_rect); PropertyTreeState layer_state = PropertyTreeState::Root(); - auto artifact = Chunk(0) + auto artifact = TestPaintArtifact() + .Chunk(0) .Properties(t0(), *clip0, e0()) .Bounds(clip_rect.Rect()) .Chunk(1) @@ -463,7 +333,7 @@ .Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change clip1 to bigger, which is still bound by clip0, resulting no actual // visual change. @@ -472,73 +342,47 @@ clip1->Update(*clip1->Parent(), ClipPaintPropertyNode::State{clip1->LocalTransformSpace(), new_clip_rect1}); - auto new_artifact1 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Bounds(artifact.PaintChunks()[0].bounds) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Bounds(artifact.PaintChunks()[1].bounds) - .Build(); - invalidator.Generate(new_artifact1, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact1); + FinishCycle(*artifact); // Change clip1 to smaller. FloatRoundedRect new_clip_rect2(-500, -500, 1000, 1000); clip1->Update(*clip1->Parent(), ClipPaintPropertyNode::State{clip1->LocalTransformSpace(), new_clip_rect2}); - auto new_artifact2 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Bounds(artifact.PaintChunks()[0].bounds) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Bounds(new_clip_rect2.Rect()) - .Build(); - invalidator.Generate(new_artifact2, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(4u, invalidations.size()); // |clip1| change should trigger incremental raster invalidation. - EXPECT_INCREMENTAL_INVALIDATION(invalidations, 0, - new_artifact2.PaintChunks()[1], + EXPECT_INCREMENTAL_INVALIDATION(invalidations, 0, artifact->PaintChunks()[1], IntRect(-1000, -1000, 2000, 500)); - EXPECT_INCREMENTAL_INVALIDATION(invalidations, 1, - new_artifact2.PaintChunks()[1], + EXPECT_INCREMENTAL_INVALIDATION(invalidations, 1, artifact->PaintChunks()[1], IntRect(-1000, -500, 500, 1000)); - EXPECT_INCREMENTAL_INVALIDATION(invalidations, 2, - new_artifact2.PaintChunks()[1], + EXPECT_INCREMENTAL_INVALIDATION(invalidations, 2, artifact->PaintChunks()[1], IntRect(500, -500, 500, 1000)); - EXPECT_INCREMENTAL_INVALIDATION(invalidations, 3, - new_artifact2.PaintChunks()[1], + EXPECT_INCREMENTAL_INVALIDATION(invalidations, 3, artifact->PaintChunks()[1], IntRect(-1000, 500, 2000, 500)); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact2); + FinishCycle(*artifact); // Change clip1 bigger at one side. FloatRoundedRect new_clip_rect3(-500, -500, 2000, 1000); clip1->Update(*clip1->Parent(), ClipPaintPropertyNode::State{clip1->LocalTransformSpace(), new_clip_rect3}); - auto new_artifact3 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Bounds(artifact.PaintChunks()[0].bounds) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Bounds(new_clip_rect3.Rect()) - .Build(); invalidator.SetTracksRasterInvalidations(true); - invalidator.Generate(new_artifact3, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations1 = TrackedRasterInvalidations(invalidator); ASSERT_EQ(1u, invalidations1.size()); // |clip1| change should trigger incremental raster invalidation. - EXPECT_INCREMENTAL_INVALIDATION(invalidations1, 0, - new_artifact3.PaintChunks()[1], + EXPECT_INCREMENTAL_INVALIDATION(invalidations1, 0, artifact->PaintChunks()[1], IntRect(500, -500, 500, 1000)); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact3); + FinishCycle(*artifact); } TEST_F(RasterInvalidatorTest, ClipLocalTransformSpaceChange) { @@ -553,10 +397,11 @@ auto c1 = CreateClip(c0(), t1.get(), clip_rect); PropertyTreeState layer_state(&t0(), &c0(), &e0()); - auto artifact = Chunk(0).Properties(*t2, *c1, e0()).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Properties(*t2, *c1, e0()).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change both t1 and t2 but keep t1*t2 unchanged, to test change of // LocalTransformSpace of c1. @@ -566,14 +411,12 @@ t2->Update(*t1, TransformPaintPropertyNode::State{ TransformationMatrix().Translate(10, 20)}); - auto new_artifact = Chunk(0).Properties(*t2, *c1, e0()).Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(1u, invalidations.size()); - EXPECT_CHUNK_INVALIDATION(invalidations, 0, new_artifact.PaintChunks()[0], + EXPECT_CHUNK_INVALIDATION(invalidations, 0, artifact->PaintChunks()[0], PaintInvalidationReason::kPaintProperty); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact); } // This is based on ClipLocalTransformSpaceChange, but tests the no-invalidation @@ -592,10 +435,11 @@ auto c1 = CreateClip(c0(), t2.get(), clip_rect); PropertyTreeState layer_state(&t0(), &c0(), &e0()); - auto artifact = Chunk(0).Properties(*t2, *c1, e0()).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Properties(*t2, *c1, e0()).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change both t1 and t2 but keep t1*t2 unchanged. invalidator.SetTracksRasterInvalidations(true); @@ -604,10 +448,9 @@ t2->Update(*t1, TransformPaintPropertyNode::State{ TransformationMatrix().Translate(10, 20)}); - auto new_artifact = Chunk(0).Properties(*t2, *c1, e0()).Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact); + FinishCycle(*artifact); } TEST_F(RasterInvalidatorTest, TransformPropertyChange) { @@ -620,30 +463,25 @@ CreateTransform(*transform0, TransformationMatrix().Translate(-50, -60)); PropertyTreeState layer_state(layer_transform.get(), &c0(), &e0()); - auto artifact = Chunk(0) + auto artifact = TestPaintArtifact() + .Chunk(0) .Properties(*transform0, c0(), e0()) .Chunk(1) .Properties(*transform1, c0(), e0()) .Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change layer_transform should not cause raster invalidation in the layer. invalidator.SetTracksRasterInvalidations(true); layer_transform->Update( *layer_transform->Parent(), TransformPaintPropertyNode::State{TransformationMatrix().Scale(10)}); - auto new_artifact = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Build(); - GeometryMapperTransformCache::ClearCache(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact); + FinishCycle(*artifact); // Inserting another node between layer_transform and transform0 and letting // the new node become the transform of the layer state should not cause @@ -654,30 +492,20 @@ layer_state = PropertyTreeState(new_layer_transform.get(), &c0(), &e0()); transform0->Update(*new_layer_transform, TransformPaintPropertyNode::State{transform0->Matrix()}); - auto new_artifact1 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Build(); - invalidator.Generate(new_artifact1, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact1); + FinishCycle(*artifact); // Removing transform nodes above the layer state should not cause raster // invalidation in the layer. layer_state = DefaultPropertyTreeState(); transform0->Update(*layer_state.Transform(), TransformPaintPropertyNode::State{transform0->Matrix()}); - auto new_artifact2 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Build(); - invalidator.Generate(new_artifact2, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact2); + FinishCycle(*artifact); // Change transform0 and transform1, while keeping the combined transform0 // and transform1 unchanged for chunk 2. We should invalidate only chunk 0 @@ -690,25 +518,20 @@ *transform0, TransformPaintPropertyNode::State{ TransformationMatrix(transform1->Matrix()).Translate(-20, -30)}); - auto new_artifact3 = Chunk(0) - .Properties(artifact.PaintChunks()[0].properties) - .Chunk(1) - .Properties(artifact.PaintChunks()[1].properties) - .Build(); - invalidator.Generate(new_artifact3, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(2u, invalidations.size()); - EXPECT_CHUNK_INVALIDATION_WITH_LAYER_OFFSET( - invalidations, 0, new_artifact3.PaintChunks()[0], - PaintInvalidationReason::kPaintProperty, - -kDefaultLayerBounds.Location() + IntSize(10, 20)); - EXPECT_CHUNK_INVALIDATION_WITH_LAYER_OFFSET( - invalidations, 1, new_artifact3.PaintChunks()[0], - PaintInvalidationReason::kPaintProperty, - -kDefaultLayerBounds.Location() + IntSize(30, 50)); + auto mapper0 = [](FloatRect& r) { r.Move(10, 20); }; + EXPECT_CHUNK_INVALIDATION_CUSTOM(invalidations, 0, artifact->PaintChunks()[0], + PaintInvalidationReason::kPaintProperty, + -kDefaultLayerBounds.Location(), mapper0); + auto mapper1 = [](FloatRect& r) { r.Move(30, 50); }; + EXPECT_CHUNK_INVALIDATION_CUSTOM(invalidations, 1, artifact->PaintChunks()[0], + PaintInvalidationReason::kPaintProperty, + -kDefaultLayerBounds.Location(), mapper1); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact3); + FinishCycle(*artifact); } TEST_F(RasterInvalidatorTest, TransformPropertyTinyChange) { @@ -719,10 +542,13 @@ *layer_transform, TransformationMatrix().Translate(10, 20)); PropertyTreeState layer_state(layer_transform.get(), &c0(), &e0()); - auto artifact = Chunk(0).Properties(*chunk_transform, c0(), e0()).Build(); + auto artifact = TestPaintArtifact() + .Chunk(0) + .Properties(*chunk_transform, c0(), e0()) + .Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change chunk_transform by tiny difference, which should be ignored. invalidator.SetTracksRasterInvalidations(true); @@ -732,11 +558,10 @@ .Translate(0.0000001, -0.0000001) .Scale(1.0000001) .Rotate(0.0000001)}); - auto new_artifact = Chunk(0).Properties(*chunk_transform, c0(), e0()).Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact); + FinishCycle(*artifact); // Tiny differences should accumulate and cause invalidation when the // accumulation is large enough. @@ -748,13 +573,9 @@ .Translate(0.0000001, -0.0000001) .Scale(1.0000001) .Rotate(0.0000001)}); - auto new_artifact = - Chunk(0).Properties(*chunk_transform, c0(), e0()).Build(); - - GeometryMapperTransformCache::ClearCache(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); invalidated = !TrackedRasterInvalidations(invalidator).IsEmpty(); - CleanUp(new_artifact); + FinishCycle(*artifact); } EXPECT_TRUE(invalidated); } @@ -768,43 +589,36 @@ FloatRect chunk_bounds(0, 0, 10000000, 10000000); PropertyTreeState layer_state(layer_transform.get(), &c0(), &e0()); - auto artifact = Chunk(0) - .Bounds(chunk_bounds) + auto artifact = TestPaintArtifact() + .Chunk(0) .Properties(*chunk_transform, c0(), e0()) + .Bounds(chunk_bounds) .Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Scale change from 1e-6 to 2e-6 should be treated as significant. invalidator.SetTracksRasterInvalidations(true); chunk_transform->Update( *layer_state.Transform(), TransformPaintPropertyNode::State{TransformationMatrix().Scale(2e-6)}); - auto new_artifact = Chunk(0) - .Bounds(chunk_bounds) - .Properties(*chunk_transform, c0(), e0()) - .Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_FALSE(TrackedRasterInvalidations(invalidator).IsEmpty()); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact); + FinishCycle(*artifact); // Scale change from 2e-6 to 2e-6 + 1e-15 should be ignored. invalidator.SetTracksRasterInvalidations(true); chunk_transform->Update(*layer_state.Transform(), TransformPaintPropertyNode::State{ TransformationMatrix().Scale(2e-6 + 1e-15)}); - auto new_artifact1 = Chunk(0) - .Bounds(chunk_bounds) - .Properties(*chunk_transform, c0(), e0()) - .Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact1); + FinishCycle(*artifact); } TEST_F(RasterInvalidatorTest, EffectLocalTransformSpaceChange) { @@ -817,10 +631,11 @@ auto e1 = CreateFilterEffect(e0(), t1.get(), &c0(), filter); PropertyTreeState layer_state(&t0(), &c0(), &e0()); - auto artifact = Chunk(0).Properties(*t2, c0(), *e1).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Properties(*t2, c0(), *e1).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change both t1 and t2 but keep t1*t2 unchanged, to test change of // LocalTransformSpace of e1. @@ -830,19 +645,15 @@ t2->Update(*t1, TransformPaintPropertyNode::State{ TransformationMatrix().Translate(10, 20)}); - auto new_artifact = Chunk(0).Properties(*t2, c0(), *e1).Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); const auto& invalidations = TrackedRasterInvalidations(invalidator); ASSERT_EQ(1u, invalidations.size()); - auto expected_invalidation_rect = ChunkRectToLayer( - new_artifact.PaintChunks()[0].bounds, -kDefaultLayerBounds.Location()); - expected_invalidation_rect.Inflate(60); // The filter outset. - EXPECT_EQ(expected_invalidation_rect, invalidations[0].rect); - EXPECT_EQ(&new_artifact.PaintChunks()[0].id.client, invalidations[0].client); - EXPECT_EQ(PaintInvalidationReason::kPaintProperty, invalidations[0].reason); - + auto mapper = [](FloatRect& r) { r.Inflate(60); }; + EXPECT_CHUNK_INVALIDATION_CUSTOM(invalidations, 0, artifact->PaintChunks()[0], + PaintInvalidationReason::kPaintProperty, + -kDefaultLayerBounds.Location(), mapper); invalidator.SetTracksRasterInvalidations(false); - CleanUp(new_artifact); + FinishCycle(*artifact); } // This is based on EffectLocalTransformSpaceChange, but tests the no- @@ -859,10 +670,11 @@ auto e1 = CreateFilterEffect(e0(), t2.get(), &c0(), filter); PropertyTreeState layer_state(&t0(), &c0(), &e0()); - auto artifact = Chunk(0).Properties(*t2, c0(), *e1).Build(); + auto artifact = + TestPaintArtifact().Chunk(0).Properties(*t2, c0(), *e1).Build(); invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); - CleanUp(artifact); + FinishCycle(*artifact); // Change both t1 and t2 but keep t1*t2 unchanged. invalidator.SetTracksRasterInvalidations(true); @@ -871,10 +683,9 @@ t2->Update(*t1, TransformPaintPropertyNode::State{ TransformationMatrix().Translate(10, 20)}); - auto new_artifact = Chunk(0).Properties(*t2, c0(), *e1).Build(); - invalidator.Generate(new_artifact, kDefaultLayerBounds, layer_state); + invalidator.Generate(artifact, kDefaultLayerBounds, layer_state); EXPECT_TRUE(TrackedRasterInvalidations(invalidator).IsEmpty()); - CleanUp(new_artifact); + FinishCycle(*artifact); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.cc b/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.cc index 1d7a300..37861d19 100644 --- a/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.cc +++ b/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.cc
@@ -56,6 +56,8 @@ return "uncacheable"; case PaintInvalidationReason::kJustCreated: return "just created"; + case PaintInvalidationReason::kReordered: + return "reordered"; case PaintInvalidationReason::kChunkAppeared: return "chunk appeared"; case PaintInvalidationReason::kChunkDisappeared:
diff --git a/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.h b/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.h index 9b34db8..8afacba3 100644 --- a/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.h +++ b/third_party/blink/renderer/platform/graphics/paint_invalidation_reason.h
@@ -41,6 +41,7 @@ kUncacheable, // The initial PaintInvalidationReason of a DisplayItemClient. kJustCreated, + kReordered, kChunkAppeared, kChunkDisappeared, kChunkUncacheable,
diff --git a/third_party/blink/renderer/platform/mac/theme_mac.h b/third_party/blink/renderer/platform/mac/theme_mac.h index ac60fc6..4548eee 100644 --- a/third_party/blink/renderer/platform/mac/theme_mac.h +++ b/third_party/blink/renderer/platform/mac/theme_mac.h
@@ -96,7 +96,7 @@ float zoom_factor); static PLATFORM_EXPORT const IntSize* CheckboxSizes(); static PLATFORM_EXPORT const int* CheckboxMargins(NSControlSize); - static PLATFORM_EXPORT NSView* EnsuredView(ScrollableArea*); + static PLATFORM_EXPORT NSView* EnsuredView(const IntSize&); static PLATFORM_EXPORT const IntSize* RadioSizes(); static PLATFORM_EXPORT const int* RadioMargins(NSControlSize);
diff --git a/third_party/blink/renderer/platform/mac/theme_mac.mm b/third_party/blink/renderer/platform/mac/theme_mac.mm index 2fb60f36..b5308fd 100644 --- a/third_party/blink/renderer/platform/mac/theme_mac.mm +++ b/third_party/blink/renderer/platform/mac/theme_mac.mm
@@ -154,11 +154,10 @@ } // Return a fake NSView whose sole purpose is to tell AppKit that it's flipped. -NSView* ThemeMac::EnsuredView(ScrollableArea* scrollable_area) { +NSView* ThemeMac::EnsuredView(const IntSize& size) { // Use a fake flipped view. static NSView* flipped_view = [[BlinkFlippedControl alloc] init]; - [flipped_view - setFrameSize:NSSizeFromCGSize(CGSize(scrollable_area->ContentsSize()))]; + [flipped_view setFrameSize:NSSizeFromCGSize(CGSize(size))]; return flipped_view; }
diff --git a/third_party/blink/renderer/platform/scheduler/BUILD.gn b/third_party/blink/renderer/platform/scheduler/BUILD.gn index 7cecf61..71fd063 100644 --- a/third_party/blink/renderer/platform/scheduler/BUILD.gn +++ b/third_party/blink/renderer/platform/scheduler/BUILD.gn
@@ -157,6 +157,8 @@ testonly = true sources = [ + "base/test/mock_time_domain.cc", + "base/test/mock_time_domain.h", "base/test/task_queue_manager_for_test.cc", "base/test/task_queue_manager_for_test.h", "base/test/test_count_uses_time_source.cc",
diff --git a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc index e5eb7ce..162f0d2 100644 --- a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc
@@ -27,12 +27,12 @@ #include "third_party/blink/renderer/platform/scheduler/base/real_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl_forward.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_selector.h" +#include "third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/test/task_queue_manager_for_test.h" #include "third_party/blink/renderer/platform/scheduler/base/test/test_count_uses_time_source.h" #include "third_party/blink/renderer/platform/scheduler/base/test/test_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/test/test_task_time_observer.h" #include "third_party/blink/renderer/platform/scheduler/base/thread_controller_impl.h" -#include "third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/work_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/work_queue_sets.h" @@ -1609,10 +1609,10 @@ CreateTaskQueues(2u); TimeTicks start_time_ticks = manager_->NowTicks(); - std::unique_ptr<VirtualTimeDomain> domain_a( - new VirtualTimeDomain(start_time_ticks)); - std::unique_ptr<VirtualTimeDomain> domain_b( - new VirtualTimeDomain(start_time_ticks)); + std::unique_ptr<MockTimeDomain> domain_a = + std::make_unique<MockTimeDomain>(start_time_ticks); + std::unique_ptr<MockTimeDomain> domain_b = + std::make_unique<MockTimeDomain>(start_time_ticks); manager_->RegisterTimeDomain(domain_a.get()); manager_->RegisterTimeDomain(domain_b.get()); runners_[0]->SetTimeDomain(domain_a.get()); @@ -1633,13 +1633,13 @@ runners_[1]->PostDelayedTask(FROM_HERE, BindOnce(&TestTask, 6, &run_order), TimeDelta::FromMilliseconds(30)); - domain_b->AdvanceNowTo(start_time_ticks + TimeDelta::FromMilliseconds(50)); + domain_b->SetNowTicks(start_time_ticks + TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(4u, 5u, 6u)); - domain_a->AdvanceNowTo(start_time_ticks + TimeDelta::FromMilliseconds(50)); + domain_a->SetNowTicks(start_time_ticks + TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); RunLoop().RunUntilIdle(); @@ -1656,8 +1656,8 @@ CreateTaskQueues(1u); TimeTicks start_time_ticks = manager_->NowTicks(); - std::unique_ptr<VirtualTimeDomain> domain_a( - new VirtualTimeDomain(start_time_ticks)); + std::unique_ptr<MockTimeDomain> domain_a = + std::make_unique<MockTimeDomain>(start_time_ticks); manager_->RegisterTimeDomain(domain_a.get()); runners_[0]->SetTimeDomain(domain_a.get()); @@ -1671,17 +1671,17 @@ runners_[0]->PostDelayedTask(FROM_HERE, BindOnce(&TestTask, 4, &run_order), TimeDelta::FromMilliseconds(40)); - domain_a->AdvanceNowTo(start_time_ticks + TimeDelta::FromMilliseconds(20)); + domain_a->SetNowTicks(start_time_ticks + TimeDelta::FromMilliseconds(20)); manager_->MaybeScheduleImmediateWork(FROM_HERE); RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1u, 2u)); - std::unique_ptr<VirtualTimeDomain> domain_b( - new VirtualTimeDomain(start_time_ticks)); + std::unique_ptr<MockTimeDomain> domain_b = + std::make_unique<MockTimeDomain>(start_time_ticks); manager_->RegisterTimeDomain(domain_b.get()); runners_[0]->SetTimeDomain(domain_b.get()); - domain_b->AdvanceNowTo(start_time_ticks + TimeDelta::FromMilliseconds(50)); + domain_b->SetNowTicks(start_time_ticks + TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); RunLoop().RunUntilIdle(); @@ -1697,10 +1697,10 @@ CreateTaskQueues(1u); TimeTicks start_time_ticks = manager_->NowTicks(); - std::unique_ptr<VirtualTimeDomain> domain_a( - new VirtualTimeDomain(start_time_ticks)); - std::unique_ptr<VirtualTimeDomain> domain_b( - new VirtualTimeDomain(start_time_ticks)); + std::unique_ptr<MockTimeDomain> domain_a = + std::make_unique<MockTimeDomain>(start_time_ticks); + std::unique_ptr<MockTimeDomain> domain_b = + std::make_unique<MockTimeDomain>(start_time_ticks); manager_->RegisterTimeDomain(domain_a.get()); manager_->RegisterTimeDomain(domain_b.get()); @@ -2837,8 +2837,8 @@ // We should not get a notification for a disabled queue. EXPECT_CALL(observer, OnQueueNextWakeUpChanged(_, _)).Times(0); - std::unique_ptr<VirtualTimeDomain> domain( - new VirtualTimeDomain(manager_->NowTicks())); + std::unique_ptr<MockTimeDomain> domain = + std::make_unique<MockTimeDomain>(manager_->NowTicks()); manager_->RegisterTimeDomain(domain.get()); runners_[0]->SetTimeDomain(domain.get());
diff --git a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_perftest.cc b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_perftest.cc index 2f4d0ba..9e32c64 100644 --- a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_perftest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_perftest.cc
@@ -19,28 +19,29 @@ #include "testing/perf/perf_test.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl_forward.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_selector.h" +#include "third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/test/task_queue_manager_for_test.h" #include "third_party/blink/renderer/platform/scheduler/base/test/test_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/test/test_task_time_observer.h" -#include "third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/work_queue_sets.h" namespace base { namespace sequence_manager { -// To reduce noise related to the OS timer, we use a virtual time domain to +// To reduce noise related to the OS timer, we use a mock time domain to // fast forward the timers. -class PerfTestTimeDomain : public VirtualTimeDomain { +class PerfTestTimeDomain : public MockTimeDomain { public: - PerfTestTimeDomain() : VirtualTimeDomain(TimeTicks::Now()) {} + PerfTestTimeDomain() : MockTimeDomain(TimeTicks::Now()) {} ~PerfTestTimeDomain() override = default; Optional<TimeDelta> DelayTillNextTask(LazyNow* lazy_now) override { Optional<TimeTicks> run_time = NextScheduledRunTime(); if (!run_time) return nullopt; - AdvanceNowTo(*run_time); - return TimeDelta(); // Makes DoWork post an immediate continuation. + SetNowTicks(*run_time); + // Makes SequenceManager to continue immediately. + return TimeDelta(); } void SetNextDelayedDoWork(LazyNow* lazy_now, TimeTicks run_time) override { @@ -49,8 +50,7 @@ RequestDoWork(); } - const char* GetName() const override { return "PerfTestTimeDomain"; } - + private: DISALLOW_COPY_AND_ASSIGN(PerfTestTimeDomain); }; @@ -70,7 +70,7 @@ void TearDown() override { queues_.clear(); - manager_->UnregisterTimeDomain(virtual_time_domain_.get()); + manager_->UnregisterTimeDomain(time_domain_.get()); manager_.reset(); } @@ -82,12 +82,12 @@ DefaultTickClock::GetInstance()); manager_->AddTaskTimeObserver(&test_task_time_observer_); - virtual_time_domain_.reset(new PerfTestTimeDomain()); - manager_->RegisterTimeDomain(virtual_time_domain_.get()); + time_domain_.reset(new PerfTestTimeDomain()); + manager_->RegisterTimeDomain(time_domain_.get()); for (size_t i = 0; i < num_queues; i++) { queues_.push_back(manager_->CreateTaskQueue<TestTaskQueue>( - TaskQueue::Spec("test").SetTimeDomain(virtual_time_domain_.get()))); + TaskQueue::Spec("test").SetTimeDomain(time_domain_.get()))); } delayed_task_closure_ = BindRepeating( @@ -200,7 +200,7 @@ std::unique_ptr<MessageLoop> message_loop_; std::unique_ptr<SequenceManager> manager_; std::unique_ptr<RunLoop> run_loop_; - std::unique_ptr<VirtualTimeDomain> virtual_time_domain_; + std::unique_ptr<TimeDomain> time_domain_; std::vector<scoped_refptr<SingleThreadTaskRunner>> queues_; RepeatingClosure delayed_task_closure_; RepeatingClosure immediate_task_closure_;
diff --git a/third_party/blink/renderer/platform/scheduler/base/task_queue_selector_unittest.cc b/third_party/blink/renderer/platform/scheduler/base/task_queue_selector_unittest.cc index 6eacf1a..4506217 100644 --- a/third_party/blink/renderer/platform/scheduler/base/task_queue_selector_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/task_queue_selector_unittest.cc
@@ -16,7 +16,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl_forward.h" -#include "third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h" +#include "third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/work_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/work_queue_sets.h" @@ -146,11 +146,11 @@ protected: void SetUp() final { - virtual_time_domain_ = std::make_unique<VirtualTimeDomain>( - TimeTicks() + TimeDelta::FromSeconds(1)); + time_domain_ = std::make_unique<MockTimeDomain>(TimeTicks() + + TimeDelta::FromSeconds(1)); for (size_t i = 0; i < kTaskQueueCount; i++) { std::unique_ptr<TaskQueueImpl> task_queue = - std::make_unique<TaskQueueImpl>(nullptr, virtual_time_domain_.get(), + std::make_unique<TaskQueueImpl>(nullptr, time_domain_.get(), TaskQueue::Spec("test")); selector_.AddQueue(task_queue.get()); task_queues_.push_back(std::move(task_queue)); @@ -174,14 +174,14 @@ } std::unique_ptr<TaskQueueImpl> NewTaskQueueWithBlockReporting() { - return std::make_unique<TaskQueueImpl>(nullptr, virtual_time_domain_.get(), + return std::make_unique<TaskQueueImpl>(nullptr, time_domain_.get(), TaskQueue::Spec("test")); } const size_t kTaskQueueCount = 5; RepeatingClosure test_closure_; TaskQueueSelectorForTest selector_; - std::unique_ptr<VirtualTimeDomain> virtual_time_domain_; + std::unique_ptr<TimeDomain> time_domain_; std::vector<std::unique_ptr<TaskQueueImpl>> task_queues_; std::map<TaskQueueImpl*, size_t> queue_to_index_map_; std::unique_ptr<HistogramTester> histogram_tester_;
diff --git a/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.cc b/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.cc new file mode 100644 index 0000000..992bb719 --- /dev/null +++ b/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.cc
@@ -0,0 +1,39 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h" + +namespace base { +namespace sequence_manager { + +MockTimeDomain::MockTimeDomain(TimeTicks initial_now_ticks) + : now_ticks_(initial_now_ticks) {} + +MockTimeDomain::~MockTimeDomain() = default; + +LazyNow MockTimeDomain::CreateLazyNow() const { + return LazyNow(now_ticks_); +} + +TimeTicks MockTimeDomain::Now() const { + return now_ticks_; +} + +void MockTimeDomain::SetNowTicks(TimeTicks now_ticks) { + now_ticks_ = now_ticks; +} + +Optional<TimeDelta> MockTimeDomain::DelayTillNextTask(LazyNow* lazy_now) { + return nullopt; +} + +void MockTimeDomain::SetNextDelayedDoWork(LazyNow* lazy_now, + TimeTicks run_time) {} + +const char* MockTimeDomain::GetName() const { + return "MockTimeDomain"; +} + +} // namespace sequence_manager +} // namespace base
diff --git a/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h b/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h new file mode 100644 index 0000000..c395b6c3a --- /dev/null +++ b/third_party/blink/renderer/platform/scheduler/base/test/mock_time_domain.h
@@ -0,0 +1,38 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_BASE_TEST_MOCK_TIME_DOMAIN_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_BASE_TEST_MOCK_TIME_DOMAIN_H_ + +#include "third_party/blink/renderer/platform/scheduler/base/time_domain_forward.h" + +namespace base { +namespace sequence_manager { + +// TimeDomain with a mock clock and not invoking SequenceManager. +// NOTE: All methods are main thread only. +class MockTimeDomain : public TimeDomain { + public: + explicit MockTimeDomain(TimeTicks initial_now_ticks); + ~MockTimeDomain() override; + + void SetNowTicks(TimeTicks now_ticks); + + // TimeDomain implementation: + LazyNow CreateLazyNow() const override; + TimeTicks Now() const override; + Optional<TimeDelta> DelayTillNextTask(LazyNow* lazy_now) override; + void SetNextDelayedDoWork(LazyNow* lazy_now, TimeTicks run_time) override; + const char* GetName() const override; + + private: + TimeTicks now_ticks_; + + DISALLOW_COPY_AND_ASSIGN(MockTimeDomain); +}; + +} // namespace sequence_manager +} // namespace base + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_BASE_TEST_MOCK_TIME_DOMAIN_H_
diff --git a/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc b/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc index 7076c51..cb4e84f 100644 --- a/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc
@@ -31,11 +31,11 @@ using TaskQueueImpl::SetDelayedWakeUpForTesting; }; -class MockTimeDomain : public TimeDomain { +class TestTimeDomain : public TimeDomain { public: - MockTimeDomain() : now_(TimeTicks() + TimeDelta::FromSeconds(1)) {} + TestTimeDomain() : now_(TimeTicks() + TimeDelta::FromSeconds(1)) {} - ~MockTimeDomain() override = default; + ~TestTimeDomain() override = default; using TimeDomain::NextScheduledRunTime; using TimeDomain::SetNextWakeUpForQueue; @@ -66,13 +66,13 @@ private: TimeTicks now_; - DISALLOW_COPY_AND_ASSIGN(MockTimeDomain); + DISALLOW_COPY_AND_ASSIGN(TestTimeDomain); }; class TimeDomainTest : public testing::Test { public: void SetUp() final { - time_domain_ = WrapUnique(CreateMockTimeDomain()); + time_domain_ = WrapUnique(CreateTestTimeDomain()); task_queue_ = std::make_unique<TaskQueueImplForTest>( nullptr, time_domain_.get(), TaskQueue::Spec("test")); } @@ -82,11 +82,11 @@ task_queue_->UnregisterTaskQueue(); } - virtual MockTimeDomain* CreateMockTimeDomain() { - return new MockTimeDomain(); + virtual TestTimeDomain* CreateTestTimeDomain() { + return new TestTimeDomain(); } - std::unique_ptr<MockTimeDomain> time_domain_; + std::unique_ptr<TestTimeDomain> time_domain_; std::unique_ptr<TaskQueueImplForTest> task_queue_; };
diff --git a/third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h b/third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h index 2e61267..99a61a0 100644 --- a/third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h +++ b/third_party/blink/renderer/platform/scheduler/base/virtual_time_domain.h
@@ -13,7 +13,8 @@ namespace base { namespace sequence_manager { -// TODO(kraynov): Move to platform/scheduler/common. +// TODO(kraynov): Merge into AutoAdvancingVirtualTimeDomain since +// it's not used anywhere else. class PLATFORM_EXPORT VirtualTimeDomain : public TimeDomain { public: explicit VirtualTimeDomain(TimeTicks initial_time_ticks);
diff --git a/third_party/blink/renderer/platform/testing/test_paint_artifact.cc b/third_party/blink/renderer/platform/testing/test_paint_artifact.cc index 1d7d258..ef0e947d 100644 --- a/third_party/blink/renderer/platform/testing/test_paint_artifact.cc +++ b/third_party/blink/renderer/platform/testing/test_paint_artifact.cc
@@ -15,7 +15,6 @@ #include "third_party/blink/renderer/platform/graphics/paint/paint_recorder.h" #include "third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" -#include "third_party/blink/renderer/platform/testing/fake_display_item_client.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" namespace blink { @@ -39,40 +38,38 @@ FloatRect rect_; }; -TestPaintArtifact::TestPaintArtifact() : display_item_list_(0), built_(false) {} +TestPaintArtifact::TestPaintArtifact() : display_item_list_(0) {} TestPaintArtifact::~TestPaintArtifact() = default; -TestPaintArtifact& TestPaintArtifact::Chunk( - const TransformPaintPropertyNode& transform, - const ClipPaintPropertyNode& clip, - const EffectPaintPropertyNode& effect) { - return Chunk(NewClient(), transform, clip, effect); +TestPaintArtifact& TestPaintArtifact::Chunk(int id) { + DEFINE_STATIC_LOCAL(DummyRectClient, client, ()); + Chunk(client, + static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + id)); + // The default bounds with magic numbers make the chunks have different bounds + // from each other, for e.g. RasterInvalidatorTest to check the tracked raster + // invalidation rects of chunks. The actual values don't matter. If the chunk + // has display items, we will recalculate the bounds from the display items + // when constructing the PaintArtifact. + Bounds(FloatRect(id * 110, id * 220, id * 220 + 200, id * 110 + 200)); + return *this; } -TestPaintArtifact& TestPaintArtifact::Chunk( - DisplayItemClient& client, - const TransformPaintPropertyNode& transform, - const ClipPaintPropertyNode& clip, - const EffectPaintPropertyNode& effect) { - return Chunk(client, PropertyTreeState(&transform, &clip, &effect)); -} - -TestPaintArtifact& TestPaintArtifact::Chunk( - const PropertyTreeState& properties) { - return Chunk(NewClient(), properties); -} - -TestPaintArtifact& TestPaintArtifact::Chunk(DisplayItemClient& client, - const PropertyTreeState& state) { - auto& chunks = paint_chunks_data_.chunks; - if (!chunks.IsEmpty()) - chunks.back().end_index = display_item_list_.size(); - chunks.push_back( - PaintChunk(display_item_list_.size(), 0, - PaintChunk::Id(client, DisplayItem::kDrawingFirst), state)); +TestPaintArtifact& TestPaintArtifact::Chunk(FakeDisplayItemClient& client, + DisplayItem::Type type) { + if (!paint_chunks_.IsEmpty()) + paint_chunks_.back().end_index = display_item_list_.size(); + paint_chunks_.push_back(PaintChunk(display_item_list_.size(), 0, + PaintChunk::Id(client, type), + PropertyTreeState::Root())); // Assume PaintController has processed this chunk. - chunks.back().client_is_just_created = false; + paint_chunks_.back().client_is_just_created = false; + return *this; +} + +TestPaintArtifact& TestPaintArtifact::Properties( + const PropertyTreeState& properties) { + paint_chunks_.back().properties = properties; return *this; } @@ -81,7 +78,18 @@ return RectDrawing(NewClient(), bounds, color); } -TestPaintArtifact& TestPaintArtifact::RectDrawing(DisplayItemClient& client, +TestPaintArtifact& TestPaintArtifact::ForeignLayer( + const FloatPoint& location, + const IntSize& size, + scoped_refptr<cc::Layer> layer) { + return ForeignLayer(NewClient(), location, size, std::move(layer)); +} +TestPaintArtifact& TestPaintArtifact::ScrollHitTest( + const TransformPaintPropertyNode& scroll_offset) { + return ScrollHitTest(NewClient(), scroll_offset); +} + +TestPaintArtifact& TestPaintArtifact::RectDrawing(FakeDisplayItemClient& client, const FloatRect& bounds, Color color) { display_item_list_.AllocateAndConstruct<DrawingDisplayItem>( @@ -91,14 +99,7 @@ } TestPaintArtifact& TestPaintArtifact::ForeignLayer( - const FloatPoint& location, - const IntSize& size, - scoped_refptr<cc::Layer> layer) { - return ForeignLayer(NewClient(), location, size, layer); -} - -TestPaintArtifact& TestPaintArtifact::ForeignLayer( - DisplayItemClient& client, + FakeDisplayItemClient& client, const FloatPoint& location, const IntSize& size, scoped_refptr<cc::Layer> layer) { @@ -111,12 +112,7 @@ } TestPaintArtifact& TestPaintArtifact::ScrollHitTest( - const TransformPaintPropertyNode& scroll_offset) { - return ScrollHitTest(NewClient(), scroll_offset); -} - -TestPaintArtifact& TestPaintArtifact::ScrollHitTest( - DisplayItemClient& client, + FakeDisplayItemClient& client, const TransformPaintPropertyNode& scroll_offset) { display_item_list_.AllocateAndConstruct<ScrollHitTestDisplayItem>( client, scroll_offset); @@ -124,28 +120,33 @@ } TestPaintArtifact& TestPaintArtifact::KnownToBeOpaque() { - paint_chunks_data_.chunks.back().known_to_be_opaque = true; + paint_chunks_.back().known_to_be_opaque = true; return *this; } -const PaintArtifact& TestPaintArtifact::Build() { - if (built_) - return paint_artifact_; - - if (!paint_chunks_data_.chunks.IsEmpty()) - paint_chunks_data_.chunks.back().end_index = display_item_list_.size(); - paint_artifact_ = PaintArtifact(std::move(display_item_list_), - std::move(paint_chunks_data_)); - built_ = true; - return paint_artifact_; +TestPaintArtifact& TestPaintArtifact::Bounds(const FloatRect& bounds) { + paint_chunks_.back().bounds = bounds; + return *this; } -DisplayItemClient& TestPaintArtifact::NewClient() { +TestPaintArtifact& TestPaintArtifact::Uncacheable() { + paint_chunks_.back().is_cacheable = false; + return *this; +} + +scoped_refptr<PaintArtifact> TestPaintArtifact::Build() { + if (!paint_chunks_.IsEmpty()) + paint_chunks_.back().end_index = display_item_list_.size(); + return PaintArtifact::Create(std::move(display_item_list_), + std::move(paint_chunks_)); +} + +FakeDisplayItemClient& TestPaintArtifact::NewClient() { dummy_clients_.push_back(std::make_unique<DummyRectClient>()); return *dummy_clients_.back(); } -DisplayItemClient& TestPaintArtifact::Client(size_t i) const { +FakeDisplayItemClient& TestPaintArtifact::Client(size_t i) const { return *dummy_clients_[i]; }
diff --git a/third_party/blink/renderer/platform/testing/test_paint_artifact.h b/third_party/blink/renderer/platform/testing/test_paint_artifact.h index ec1f659..f69602b 100644 --- a/third_party/blink/renderer/platform/testing/test_paint_artifact.h +++ b/third_party/blink/renderer/platform/testing/test_paint_artifact.h
@@ -10,7 +10,7 @@ #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item_list.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" -#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" +#include "third_party/blink/renderer/platform/testing/fake_display_item_client.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -27,17 +27,25 @@ class TransformPaintPropertyNode; // Useful for quickly making a paint artifact in unit tests. -// Must remain in scope while the paint artifact is used, because it owns the -// display item clients. // +// If any method that automatically creates display item client is called, the +// object must remain in scope while the paint artifact is used, because it owns +// the display item clients. // Usage: -// TestPaintArtifact artifact; -// artifact.Chunk(paintProperties) +// TestPaintArtifact test_artifact; +// test_artifact.Chunk().Properties(paint_properties) // .RectDrawing(bounds, color) // .RectDrawing(bounds2, color2); -// artifact.Chunk(otherPaintProperties) +// test_artifact.Chunk().Properties(other_paint_properties) // .RectDrawing(bounds3, color3); +// auto artifact = test_artifact.Build(); // DoSomethingWithArtifact(artifact); +// +// Otherwise the TestPaintArtifact object can be temporary. +// Usage: +// auto artifact = TestPaintArtifact().Chunk(0).Chunk(1).Build(); +// DoSomethingWithArtifact(artifact); +// class TestPaintArtifact { STACK_ALLOCATED(); @@ -45,57 +53,88 @@ TestPaintArtifact(); ~TestPaintArtifact(); - // Add to the artifact. - TestPaintArtifact& Chunk(const TransformPaintPropertyNode&, - const ClipPaintPropertyNode&, - const EffectPaintPropertyNode&); - TestPaintArtifact& Chunk(const PropertyTreeState&); - TestPaintArtifact& RectDrawing(const FloatRect& bounds, Color); - TestPaintArtifact& ForeignLayer(const FloatPoint&, - const IntSize&, - scoped_refptr<cc::Layer>); + // Add a chunk to the artifact. Each chunk will have a different automatically + // created client. + TestPaintArtifact& Chunk() { return Chunk(NewClient()); } + + // Add a chunk with the specified client. + TestPaintArtifact& Chunk(FakeDisplayItemClient&, + DisplayItem::Type = DisplayItem::kDrawingFirst); + + // This is for RasterInvalidatorTest, to create a chunk with specific id and + // bounds calculated with a function from the id. The client is static so + // the caller doesn't need to retain this object when using the paint + // artifact. + TestPaintArtifact& Chunk(int id); + + TestPaintArtifact& Properties(const PropertyTreeState&); + TestPaintArtifact& Properties(const TransformPaintPropertyNode& transform, + const ClipPaintPropertyNode& clip, + const EffectPaintPropertyNode& effect) { + return Properties(PropertyTreeState(&transform, &clip, &effect)); + } + TestPaintArtifact& Properties(const RefCountedPropertyTreeState& properties) { + return Properties(properties.GetPropertyTreeState()); + } + + // Shorthands of Chunk().Properties(...). + TestPaintArtifact& Chunk(const TransformPaintPropertyNode& transform, + const ClipPaintPropertyNode& clip, + const EffectPaintPropertyNode& effect) { + return Chunk().Properties(transform, clip, effect); + } + TestPaintArtifact& Chunk(const PropertyTreeState& properties) { + return Chunk().Properties(properties); + } + TestPaintArtifact& Chunk(const RefCountedPropertyTreeState& properties) { + return Chunk().Properties(properties); + } + + // Add display item in the chunk. Each display item will have a different + // automatically created client. + TestPaintArtifact& RectDrawing(const FloatRect& bounds, Color color); + TestPaintArtifact& ForeignLayer(const FloatPoint& location, + const IntSize& size, + scoped_refptr<cc::Layer> layer); TestPaintArtifact& ScrollHitTest( const TransformPaintPropertyNode& scroll_offset); - TestPaintArtifact& KnownToBeOpaque(); - // Add to the artifact, with specified display item client. These are used - // to test incremental paint artifact updates. - TestPaintArtifact& Chunk(DisplayItemClient&, - const TransformPaintPropertyNode&, - const ClipPaintPropertyNode&, - const EffectPaintPropertyNode&); - TestPaintArtifact& Chunk(DisplayItemClient&, const PropertyTreeState&); - TestPaintArtifact& RectDrawing(DisplayItemClient&, + // Add display item with the specified client in the chunk. + TestPaintArtifact& RectDrawing(FakeDisplayItemClient&, const FloatRect& bounds, Color); - TestPaintArtifact& ForeignLayer(DisplayItemClient&, + TestPaintArtifact& ForeignLayer(FakeDisplayItemClient&, const FloatPoint&, const IntSize&, scoped_refptr<cc::Layer>); TestPaintArtifact& ScrollHitTest( - DisplayItemClient&, + FakeDisplayItemClient&, const TransformPaintPropertyNode& scroll_offset); - // Can't add more things once this is called. - const PaintArtifact& Build(); + // Sets fake bounds for the last paint chunk. Note that the bounds will be + // overwritten when the PaintArtifact is constructed if the chunk has any + // display items. + TestPaintArtifact& Bounds(const FloatRect&); + + TestPaintArtifact& KnownToBeOpaque(); + TestPaintArtifact& Uncacheable(); + + // Build the paint artifact. After that, if this object has automatically + // created any display item client, the caller must retain this object when + // using the returned paint artifact. + scoped_refptr<PaintArtifact> Build(); // Create a new display item client which is owned by this TestPaintArtifact. - DisplayItemClient& NewClient(); + FakeDisplayItemClient& NewClient(); - DisplayItemClient& Client(size_t) const; + FakeDisplayItemClient& Client(size_t) const; private: class DummyRectClient; Vector<std::unique_ptr<DummyRectClient>> dummy_clients_; - // Exists if m_built is false. DisplayItemList display_item_list_; - PaintChunksAndRasterInvalidations paint_chunks_data_; - - // Exists if m_built is true. - PaintArtifact paint_artifact_; - - bool built_; + Vector<PaintChunk> paint_chunks_; }; } // namespace blink
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h index 5e54b53..0e2828b 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h +++ b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h
@@ -45,18 +45,18 @@ /* Forward Declarations */ -#ifndef __IRegisteredCommandElevator_FWD_DEFINED__ -#define __IRegisteredCommandElevator_FWD_DEFINED__ -typedef interface IRegisteredCommandElevator IRegisteredCommandElevator; +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; -#endif /* __IRegisteredCommandElevator_FWD_DEFINED__ */ +#endif /* __IElevator_FWD_DEFINED__ */ -#ifndef __IRegisteredCommandElevator_FWD_DEFINED__ -#define __IRegisteredCommandElevator_FWD_DEFINED__ -typedef interface IRegisteredCommandElevator IRegisteredCommandElevator; +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; -#endif /* __IRegisteredCommandElevator_FWD_DEFINED__ */ +#endif /* __IElevator_FWD_DEFINED__ */ /* header files for imported files */ @@ -68,59 +68,57 @@ #endif -#ifndef __IRegisteredCommandElevator_INTERFACE_DEFINED__ -#define __IRegisteredCommandElevator_INTERFACE_DEFINED__ +#ifndef __IElevator_INTERFACE_DEFINED__ +#define __IElevator_INTERFACE_DEFINED__ -/* interface IRegisteredCommandElevator */ +/* interface IElevator */ /* [unique][helpstring][uuid][oleautomation][object] */ -EXTERN_C const IID IID_IRegisteredCommandElevator; +EXTERN_C const IID IID_IElevator; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("A949CB4E-C4F9-44C4-B213-6BF8AA9AC69C") - IRegisteredCommandElevator : public IUnknown + IElevator : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE LaunchCommand( - /* [string][in] */ const WCHAR *cmd_id, - /* [in] */ DWORD caller_proc_id, - /* [out] */ ULONG_PTR *proc_handle) = 0; + virtual HRESULT STDMETHODCALLTYPE GetElevatorFactory( + /* [string][in] */ const WCHAR *elevator_id, + /* [out] */ IClassFactory **factory) = 0; }; #else /* C style interface */ - typedef struct IRegisteredCommandElevatorVtbl + typedef struct IElevatorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IRegisteredCommandElevator * This, + IElevator * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( - IRegisteredCommandElevator * This); + IElevator * This); ULONG ( STDMETHODCALLTYPE *Release )( - IRegisteredCommandElevator * This); + IElevator * This); - HRESULT ( STDMETHODCALLTYPE *LaunchCommand )( - IRegisteredCommandElevator * This, - /* [string][in] */ const WCHAR *cmd_id, - /* [in] */ DWORD caller_proc_id, - /* [out] */ ULONG_PTR *proc_handle); + HRESULT ( STDMETHODCALLTYPE *GetElevatorFactory )( + IElevator * This, + /* [string][in] */ const WCHAR *elevator_id, + /* [out] */ IClassFactory **factory); END_INTERFACE - } IRegisteredCommandElevatorVtbl; + } IElevatorVtbl; - interface IRegisteredCommandElevator + interface IElevator { - CONST_VTBL struct IRegisteredCommandElevatorVtbl *lpVtbl; + CONST_VTBL struct IElevatorVtbl *lpVtbl; }; @@ -128,18 +126,18 @@ #ifdef COBJMACROS -#define IRegisteredCommandElevator_QueryInterface(This,riid,ppvObject) \ +#define IElevator_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) -#define IRegisteredCommandElevator_AddRef(This) \ +#define IElevator_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) -#define IRegisteredCommandElevator_Release(This) \ +#define IElevator_Release(This) \ ( (This)->lpVtbl -> Release(This) ) -#define IRegisteredCommandElevator_LaunchCommand(This,cmd_id,caller_proc_id,proc_handle) \ - ( (This)->lpVtbl -> LaunchCommand(This,cmd_id,caller_proc_id,proc_handle) ) +#define IElevator_GetElevatorFactory(This,elevator_id,factory) \ + ( (This)->lpVtbl -> GetElevatorFactory(This,elevator_id,factory) ) #endif /* COBJMACROS */ @@ -149,7 +147,7 @@ -#endif /* __IRegisteredCommandElevator_INTERFACE_DEFINED__ */ +#endif /* __IElevator_INTERFACE_DEFINED__ */
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb index 8b6f100..9546c31 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb +++ b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c index b0a5b98..2310ce9 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c +++ b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c
@@ -67,7 +67,7 @@ #endif // !_MIDL_USE_GUIDDEF_ -MIDL_DEFINE_GUID(IID, IID_IRegisteredCommandElevator,0xA949CB4E,0xC4F9,0x44C4,0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C); +MIDL_DEFINE_GUID(IID, IID_IElevator,0xA949CB4E,0xC4F9,0x44C4,0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C); MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0x0014D784,0x7012,0x4A79,0x8A,0xB6,0xAD,0xDB,0x81,0x93,0xA0,0x6E);
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c index b16d775..78735b7c2 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c +++ b/third_party/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c
@@ -46,8 +46,8 @@ #include "elevation_service_idl.h" -#define TYPE_FORMAT_STRING_SIZE 11 -#define PROC_FORMAT_STRING_SIZE 51 +#define TYPE_FORMAT_STRING_SIZE 29 +#define PROC_FORMAT_STRING_SIZE 45 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -83,8 +83,8 @@ extern const MIDL_STUB_DESC Object_StubDesc; -extern const MIDL_SERVER_INFO IRegisteredCommandElevator_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IRegisteredCommandElevator_ProxyInfo; +extern const MIDL_SERVER_INFO IElevator_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo; @@ -97,17 +97,17 @@ 0, { - /* Procedure LaunchCommand */ + /* Procedure GetElevatorFactory */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x3 ), /* 3 */ -/* 8 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ -/* 10 */ NdrFcShort( 0x8 ), /* 8 */ -/* 12 */ NdrFcShort( 0x24 ), /* 36 */ -/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ +/* 8 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 10 */ NdrFcShort( 0x0 ), /* 0 */ +/* 12 */ NdrFcShort( 0x8 ), /* 8 */ +/* 14 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x3, /* 3 */ /* 16 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ /* 18 */ NdrFcShort( 0x0 ), /* 0 */ @@ -115,31 +115,23 @@ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter cmd_id */ + /* Parameter elevator_id */ /* 26 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 28 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ /* 30 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ - /* Parameter caller_proc_id */ + /* Parameter factory */ -/* 32 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 32 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 34 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 36 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter proc_handle */ - -/* 38 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 40 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 42 */ 0xb9, /* FC_UINT3264 */ - 0x0, /* 0 */ +/* 36 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ /* Return value */ -/* 44 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 46 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ -/* 48 */ 0x8, /* FC_LONG */ +/* 38 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 40 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 42 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -157,9 +149,22 @@ 0x25, /* FC_C_WSTRING */ 0x5c, /* FC_PAD */ /* 6 */ - 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 8 */ 0xb9, /* FC_UINT3264 */ - 0x5c, /* FC_PAD */ + 0x11, 0x10, /* FC_RP [pointer_deref] */ +/* 8 */ NdrFcShort( 0x2 ), /* Offset= 2 (10) */ +/* 10 */ + 0x2f, /* FC_IP */ + 0x5a, /* FC_CONSTANT_IID */ +/* 12 */ NdrFcLong( 0x1 ), /* 1 */ +/* 16 */ NdrFcShort( 0x0 ), /* 0 */ +/* 18 */ NdrFcShort( 0x0 ), /* 0 */ +/* 20 */ 0xc0, /* 192 */ + 0x0, /* 0 */ +/* 22 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 24 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 26 */ 0x0, /* 0 */ + 0x46, /* 70 */ 0x0 } @@ -170,50 +175,50 @@ GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ -/* Object interface: IRegisteredCommandElevator, ver. 0.0, +/* Object interface: IElevator, ver. 0.0, GUID={0xA949CB4E,0xC4F9,0x44C4,{0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C}} */ #pragma code_seg(".orpc") -static const unsigned short IRegisteredCommandElevator_FormatStringOffsetTable[] = +static const unsigned short IElevator_FormatStringOffsetTable[] = { 0 }; -static const MIDL_STUBLESS_PROXY_INFO IRegisteredCommandElevator_ProxyInfo = +static const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo = { &Object_StubDesc, elevation_service_idl__MIDL_ProcFormatString.Format, - &IRegisteredCommandElevator_FormatStringOffsetTable[-3], + &IElevator_FormatStringOffsetTable[-3], 0, 0, 0 }; -static const MIDL_SERVER_INFO IRegisteredCommandElevator_ServerInfo = +static const MIDL_SERVER_INFO IElevator_ServerInfo = { &Object_StubDesc, 0, elevation_service_idl__MIDL_ProcFormatString.Format, - &IRegisteredCommandElevator_FormatStringOffsetTable[-3], + &IElevator_FormatStringOffsetTable[-3], 0, 0, 0, 0}; -CINTERFACE_PROXY_VTABLE(4) _IRegisteredCommandElevatorProxyVtbl = +CINTERFACE_PROXY_VTABLE(4) _IElevatorProxyVtbl = { - &IRegisteredCommandElevator_ProxyInfo, - &IID_IRegisteredCommandElevator, + &IElevator_ProxyInfo, + &IID_IElevator, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IRegisteredCommandElevator::LaunchCommand */ + (void *) (INT_PTR) -1 /* IElevator::GetElevatorFactory */ }; -const CInterfaceStubVtbl _IRegisteredCommandElevatorStubVtbl = +const CInterfaceStubVtbl _IElevatorStubVtbl = { - &IID_IRegisteredCommandElevator, - &IRegisteredCommandElevator_ServerInfo, + &IID_IElevator, + &IElevator_ServerInfo, 4, 0, /* pure interpreted */ CStdStubBuffer_METHODS @@ -245,19 +250,19 @@ const CInterfaceProxyVtbl * const _elevation_service_idl_ProxyVtblList[] = { - ( CInterfaceProxyVtbl *) &_IRegisteredCommandElevatorProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorProxyVtbl, 0 }; const CInterfaceStubVtbl * const _elevation_service_idl_StubVtblList[] = { - ( CInterfaceStubVtbl *) &_IRegisteredCommandElevatorStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorStubVtbl, 0 }; PCInterfaceName const _elevation_service_idl_InterfaceNamesList[] = { - "IRegisteredCommandElevator", + "IElevator", 0 };
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h index b59226d..70acdf7 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h +++ b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h
@@ -45,18 +45,18 @@ /* Forward Declarations */ -#ifndef __IRegisteredCommandElevator_FWD_DEFINED__ -#define __IRegisteredCommandElevator_FWD_DEFINED__ -typedef interface IRegisteredCommandElevator IRegisteredCommandElevator; +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; -#endif /* __IRegisteredCommandElevator_FWD_DEFINED__ */ +#endif /* __IElevator_FWD_DEFINED__ */ -#ifndef __IRegisteredCommandElevator_FWD_DEFINED__ -#define __IRegisteredCommandElevator_FWD_DEFINED__ -typedef interface IRegisteredCommandElevator IRegisteredCommandElevator; +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; -#endif /* __IRegisteredCommandElevator_FWD_DEFINED__ */ +#endif /* __IElevator_FWD_DEFINED__ */ /* header files for imported files */ @@ -68,59 +68,57 @@ #endif -#ifndef __IRegisteredCommandElevator_INTERFACE_DEFINED__ -#define __IRegisteredCommandElevator_INTERFACE_DEFINED__ +#ifndef __IElevator_INTERFACE_DEFINED__ +#define __IElevator_INTERFACE_DEFINED__ -/* interface IRegisteredCommandElevator */ +/* interface IElevator */ /* [unique][helpstring][uuid][oleautomation][object] */ -EXTERN_C const IID IID_IRegisteredCommandElevator; +EXTERN_C const IID IID_IElevator; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("A949CB4E-C4F9-44C4-B213-6BF8AA9AC69C") - IRegisteredCommandElevator : public IUnknown + IElevator : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE LaunchCommand( - /* [string][in] */ const WCHAR *cmd_id, - /* [in] */ DWORD caller_proc_id, - /* [out] */ ULONG_PTR *proc_handle) = 0; + virtual HRESULT STDMETHODCALLTYPE GetElevatorFactory( + /* [string][in] */ const WCHAR *elevator_id, + /* [out] */ IClassFactory **factory) = 0; }; #else /* C style interface */ - typedef struct IRegisteredCommandElevatorVtbl + typedef struct IElevatorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IRegisteredCommandElevator * This, + IElevator * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( - IRegisteredCommandElevator * This); + IElevator * This); ULONG ( STDMETHODCALLTYPE *Release )( - IRegisteredCommandElevator * This); + IElevator * This); - HRESULT ( STDMETHODCALLTYPE *LaunchCommand )( - IRegisteredCommandElevator * This, - /* [string][in] */ const WCHAR *cmd_id, - /* [in] */ DWORD caller_proc_id, - /* [out] */ ULONG_PTR *proc_handle); + HRESULT ( STDMETHODCALLTYPE *GetElevatorFactory )( + IElevator * This, + /* [string][in] */ const WCHAR *elevator_id, + /* [out] */ IClassFactory **factory); END_INTERFACE - } IRegisteredCommandElevatorVtbl; + } IElevatorVtbl; - interface IRegisteredCommandElevator + interface IElevator { - CONST_VTBL struct IRegisteredCommandElevatorVtbl *lpVtbl; + CONST_VTBL struct IElevatorVtbl *lpVtbl; }; @@ -128,18 +126,18 @@ #ifdef COBJMACROS -#define IRegisteredCommandElevator_QueryInterface(This,riid,ppvObject) \ +#define IElevator_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) -#define IRegisteredCommandElevator_AddRef(This) \ +#define IElevator_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) -#define IRegisteredCommandElevator_Release(This) \ +#define IElevator_Release(This) \ ( (This)->lpVtbl -> Release(This) ) -#define IRegisteredCommandElevator_LaunchCommand(This,cmd_id,caller_proc_id,proc_handle) \ - ( (This)->lpVtbl -> LaunchCommand(This,cmd_id,caller_proc_id,proc_handle) ) +#define IElevator_GetElevatorFactory(This,elevator_id,factory) \ + ( (This)->lpVtbl -> GetElevatorFactory(This,elevator_id,factory) ) #endif /* COBJMACROS */ @@ -149,7 +147,7 @@ -#endif /* __IRegisteredCommandElevator_INTERFACE_DEFINED__ */ +#endif /* __IElevator_INTERFACE_DEFINED__ */
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb index 133038c..7feb1ab 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb +++ b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_i.c b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_i.c index ca613cac..504905e 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_i.c +++ b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_i.c
@@ -67,7 +67,7 @@ #endif // !_MIDL_USE_GUIDDEF_ -MIDL_DEFINE_GUID(IID, IID_IRegisteredCommandElevator,0xA949CB4E,0xC4F9,0x44C4,0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C); +MIDL_DEFINE_GUID(IID, IID_IElevator,0xA949CB4E,0xC4F9,0x44C4,0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C); MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0x0014D784,0x7012,0x4A79,0x8A,0xB6,0xAD,0xDB,0x81,0x93,0xA0,0x6E);
diff --git a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c index ec23e87..998e7085 100644 --- a/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c +++ b/third_party/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c
@@ -49,8 +49,8 @@ #include "elevation_service_idl.h" -#define TYPE_FORMAT_STRING_SIZE 11 -#define PROC_FORMAT_STRING_SIZE 49 +#define TYPE_FORMAT_STRING_SIZE 29 +#define PROC_FORMAT_STRING_SIZE 43 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -86,8 +86,8 @@ extern const MIDL_STUB_DESC Object_StubDesc; -extern const MIDL_SERVER_INFO IRegisteredCommandElevator_ServerInfo; -extern const MIDL_STUBLESS_PROXY_INFO IRegisteredCommandElevator_ProxyInfo; +extern const MIDL_SERVER_INFO IElevator_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo; @@ -108,48 +108,40 @@ 0, { - /* Procedure LaunchCommand */ + /* Procedure GetElevatorFactory */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x3 ), /* 3 */ -/* 8 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 10 */ NdrFcShort( 0x8 ), /* 8 */ -/* 12 */ NdrFcShort( 0x24 ), /* 36 */ -/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ - 0x4, /* 4 */ +/* 8 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 10 */ NdrFcShort( 0x0 ), /* 0 */ +/* 12 */ NdrFcShort( 0x8 ), /* 8 */ +/* 14 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x3, /* 3 */ /* 16 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ /* 18 */ NdrFcShort( 0x0 ), /* 0 */ /* 20 */ NdrFcShort( 0x0 ), /* 0 */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter cmd_id */ + /* Parameter elevator_id */ /* 24 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ /* 28 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ - /* Parameter caller_proc_id */ + /* Parameter factory */ -/* 30 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 30 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 34 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Parameter proc_handle */ - -/* 36 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 38 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 40 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ /* Return value */ -/* 42 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 44 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ -/* 46 */ 0x8, /* FC_LONG */ +/* 36 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 38 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 40 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -167,9 +159,22 @@ 0x25, /* FC_C_WSTRING */ 0x5c, /* FC_PAD */ /* 6 */ - 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 8 */ 0x8, /* FC_LONG */ - 0x5c, /* FC_PAD */ + 0x11, 0x10, /* FC_RP [pointer_deref] */ +/* 8 */ NdrFcShort( 0x2 ), /* Offset= 2 (10) */ +/* 10 */ + 0x2f, /* FC_IP */ + 0x5a, /* FC_CONSTANT_IID */ +/* 12 */ NdrFcLong( 0x1 ), /* 1 */ +/* 16 */ NdrFcShort( 0x0 ), /* 0 */ +/* 18 */ NdrFcShort( 0x0 ), /* 0 */ +/* 20 */ 0xc0, /* 192 */ + 0x0, /* 0 */ +/* 22 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 24 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 26 */ 0x0, /* 0 */ + 0x46, /* 70 */ 0x0 } @@ -180,50 +185,50 @@ GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ -/* Object interface: IRegisteredCommandElevator, ver. 0.0, +/* Object interface: IElevator, ver. 0.0, GUID={0xA949CB4E,0xC4F9,0x44C4,{0xB2,0x13,0x6B,0xF8,0xAA,0x9A,0xC6,0x9C}} */ #pragma code_seg(".orpc") -static const unsigned short IRegisteredCommandElevator_FormatStringOffsetTable[] = +static const unsigned short IElevator_FormatStringOffsetTable[] = { 0 }; -static const MIDL_STUBLESS_PROXY_INFO IRegisteredCommandElevator_ProxyInfo = +static const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo = { &Object_StubDesc, elevation_service_idl__MIDL_ProcFormatString.Format, - &IRegisteredCommandElevator_FormatStringOffsetTable[-3], + &IElevator_FormatStringOffsetTable[-3], 0, 0, 0 }; -static const MIDL_SERVER_INFO IRegisteredCommandElevator_ServerInfo = +static const MIDL_SERVER_INFO IElevator_ServerInfo = { &Object_StubDesc, 0, elevation_service_idl__MIDL_ProcFormatString.Format, - &IRegisteredCommandElevator_FormatStringOffsetTable[-3], + &IElevator_FormatStringOffsetTable[-3], 0, 0, 0, 0}; -CINTERFACE_PROXY_VTABLE(4) _IRegisteredCommandElevatorProxyVtbl = +CINTERFACE_PROXY_VTABLE(4) _IElevatorProxyVtbl = { - &IRegisteredCommandElevator_ProxyInfo, - &IID_IRegisteredCommandElevator, + &IElevator_ProxyInfo, + &IID_IElevator, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , - (void *) (INT_PTR) -1 /* IRegisteredCommandElevator::LaunchCommand */ + (void *) (INT_PTR) -1 /* IElevator::GetElevatorFactory */ }; -const CInterfaceStubVtbl _IRegisteredCommandElevatorStubVtbl = +const CInterfaceStubVtbl _IElevatorStubVtbl = { - &IID_IRegisteredCommandElevator, - &IRegisteredCommandElevator_ServerInfo, + &IID_IElevator, + &IElevator_ServerInfo, 4, 0, /* pure interpreted */ CStdStubBuffer_METHODS @@ -255,19 +260,19 @@ const CInterfaceProxyVtbl * const _elevation_service_idl_ProxyVtblList[] = { - ( CInterfaceProxyVtbl *) &_IRegisteredCommandElevatorProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorProxyVtbl, 0 }; const CInterfaceStubVtbl * const _elevation_service_idl_StubVtblList[] = { - ( CInterfaceStubVtbl *) &_IRegisteredCommandElevatorStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorStubVtbl, 0 }; PCInterfaceName const _elevation_service_idl_InterfaceNamesList[] = { - "IRegisteredCommandElevator", + "IElevator", 0 };
diff --git a/tools/accessibility/rebase_dump_accessibility_tree_test.py b/tools/accessibility/rebase_dump_accessibility_tree_test.py index bdcfaf3..92c7f3f2 100755 --- a/tools/accessibility/rebase_dump_accessibility_tree_test.py +++ b/tools/accessibility/rebase_dump_accessibility_tree_test.py
@@ -111,18 +111,18 @@ #print(json.dumps(data, indent=4)) for builder in data: - #print builder['result'] + print builder['builder_name'], builder['result'] if builder['result'] == 'FAILURE': - url = builder['url'] - tokens = url.split('/') - if len(tokens) < 9: - continue - bucket = tokens[4] - platform = tokens[6] - build = tokens[8] - logdog_prefix = 'chromium/bb/%s/%s/%s' % (bucket, platform, build) - logdog_steps = '%s/+/recipes/steps/**' % logdog_prefix - logdog_query = 'cit logdog query -results 999 -path "%s"' % logdog_steps + logdog_tokens = [ + 'chromium', + 'buildbucket', + 'cr-buildbucket.appspot.com', + builder['buildbucket_id'], + '+', + 'steps', + '**'] + logdog_path = '/'.join(logdog_tokens) + logdog_query = 'cit logdog query -results 999 -path "%s"' % logdog_path print (BRIGHT_COLOR + '=> %s' + NORMAL_COLOR) % logdog_query steps = os.popen(logdog_query).readlines() a11y_step = None
diff --git a/tools/binary_size/libsupersize/html_report.py b/tools/binary_size/libsupersize/html_report.py index 615a35d..f8d61c7d 100644 --- a/tools/binary_size/libsupersize/html_report.py +++ b/tools/binary_size/libsupersize/html_report.py
@@ -7,6 +7,7 @@ import json import logging import os +import re import shutil import archive @@ -31,7 +32,7 @@ _NODE_MAX_DEPTH_KEY = 'maxDepth' _NODE_LAST_PATH_ELEMENT_KEY = 'lastPathElement' -_COMPACT_FILE_PATH_INDEX_KEY = 'p' +_COMPACT_FILE_PATH_KEY = 'p' _COMPACT_FILE_COMPONENT_INDEX_KEY = 'c' _COMPACT_FILE_SYMBOLS_KEY = 's' _COMPACT_SYMBOL_NAME_KEY = 'n' @@ -52,6 +53,11 @@ 'o': 'Other Entries', } +# Capture one of: "::", "../", "./", "/", "#" +_SPECIAL_CHAR_REGEX = re.compile(r'(::|(?:\.*\/)+|#)') +# Insert zero-width space after capture group +_ZERO_WIDTH_SPACE = r'\1\u200b' + # The display name of the bucket where we put symbols without path. _NAME_SMALL_SYMBOL_BUCKET = '(Other)' _NAME_NO_PATH_BUCKET = '(No Path)' @@ -229,16 +235,14 @@ min_symbol_size: The minimum byte size needed for a symbol to be included. """ file_nodes = {} - source_paths = IndexedSet() components = IndexedSet() # Build a container for symbols smaller than min_symbol_size small_symbols = {} small_file_node = None if min_symbol_size > 0: - path_index = source_paths.GetOrAdd(_NAME_SMALL_SYMBOL_BUCKET) small_file_node = { - _COMPACT_FILE_PATH_INDEX_KEY: path_index, + _COMPACT_FILE_PATH_KEY: _NAME_SMALL_SYMBOL_BUCKET, _COMPACT_FILE_COMPONENT_INDEX_KEY: components.GetOrAdd(''), _COMPACT_FILE_SYMBOLS_KEY: [], } @@ -248,23 +252,28 @@ # and add all the file buckets into file_nodes for symbol in symbols: symbol_type = _GetSymbolType(symbol) - symbol_size = symbol.pss + symbol_size = round(symbol.pss, 2) + if symbol_size.is_integer(): + symbol_size = int(symbol_size) if abs(symbol_size) >= min_symbol_size or symbol_type == 'm': path = symbol.source_path or symbol.object_path file_node = file_nodes.get(path) if file_node is None: - path_index = source_paths.GetOrAdd(path) component_index = components.GetOrAdd(symbol.component) file_node = { - _COMPACT_FILE_PATH_INDEX_KEY: path_index, + _COMPACT_FILE_PATH_KEY: path, _COMPACT_FILE_COMPONENT_INDEX_KEY: component_index, _COMPACT_FILE_SYMBOLS_KEY: [], } file_nodes[path] = file_node + # Insert zero-width spaces after certain characters to indicate to the + # browser it could add a line break there on small screen sizes. + symbol_name = _SPECIAL_CHAR_REGEX.sub(_ZERO_WIDTH_SPACE, + symbol.template_name) file_node[_COMPACT_FILE_SYMBOLS_KEY].append({ - _COMPACT_SYMBOL_NAME_KEY: symbol.template_name, + _COMPACT_SYMBOL_NAME_KEY: symbol_name, _COMPACT_SYMBOL_TYPE_KEY: symbol_type, _COMPACT_SYMBOL_BYTE_SIZE_KEY: symbol_size, }) @@ -286,7 +295,6 @@ return { 'file_nodes': list(file_nodes.values()), - 'source_paths': source_paths.value_list, 'components': components.value_list, }
diff --git a/tools/binary_size/libsupersize/template_tree_view/tree-worker.js b/tools/binary_size/libsupersize/template_tree_view/tree-worker.js index f9272478..9ebe2ce 100644 --- a/tools/binary_size/libsupersize/template_tree_view/tree-worker.js +++ b/tools/binary_size/libsupersize/template_tree_view/tree-worker.js
@@ -26,7 +26,7 @@ /** * @typedef {object} FileEntry JSON object representing a single file and its * symbols. - * @prop {number} p - source_path_index + * @prop {number} p - source_path * @prop {number} c - component_index * @prop {Array<{n:string,b:number,t:string}>} s - Symbols belonging to this * node. Array of objects. @@ -51,7 +51,7 @@ * @enum {string} */ const _KEYS = { - SOURCE_PATH_INDEX: 'p', + SOURCE_PATH: 'p', COMPONENT_INDEX: 'c', FILE_SYMBOLS: 's', SYMBOL_NAME: 'n', @@ -99,7 +99,7 @@ // If there is only 1 child and its the same type, merge it in. if (node.children.length === 1 && node.type === child.type) { // size & type should be the same, so don't bother copying them. - node.shortName += sep + child.shortName; + node.shortName += sep + '\u200b' + child.shortName; node.idPath = child.idPath; node.children = child.children; // Search children of this node. @@ -292,7 +292,7 @@ symbols: tree.file_nodes, sep, methodCountMode, - getPath: s => tree.source_paths[s[_KEYS.SOURCE_PATH_INDEX]], + getPath: s => s[_KEYS.SOURCE_PATH], filterTest: s => typeFilter.has(s.type), });
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 37a3f9fd9..6c6ff22 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -28212,6 +28212,7 @@ <int value="637452937" label="ChromeHomeSurvey:enabled"/> <int value="642037198" label="SoleIntegration:disabled"/> <int value="643725031" label="disable-touch-feedback"/> + <int value="644084236" label="CloseButtonsInactiveTabs:enabled"/> <int value="644189071" label="PermissionsBlacklist:enabled"/> <int value="646252875" label="ReadItLaterInMenu:enabled"/> <int value="646738320" label="disable-gesture-editing"/> @@ -28673,6 +28674,7 @@ <int value="1612446645" label="enable-weak-memorycache"/> <int value="1612871297" label="WebPayments:disabled"/> <int value="1612974229" label="allow-insecure-localhost"/> + <int value="1614596813" label="CloseButtonsInactiveTabs:disabled"/> <int value="1615988672" label="GrantNotificationsToDSE:enabled"/> <int value="1617187093" label="enable-improved-a2hs"/> <int value="1621298798" label="VrBrowserKeyboard:enabled"/> @@ -29446,15 +29448,15 @@ <int value="179" label="webkit-background-composite"/> <int value="180" label="alias-webkit-background-origin"/> <int value="181" label="alias-webkit-background-size"/> - <int value="182" label="webkit-border-after"/> + <int value="182" label="alias-webkit-border-after"/> <int value="183" label="alias-webkit-border-after-color"/> <int value="184" label="alias-webkit-border-after-style"/> <int value="185" label="alias-webkit-border-after-width"/> - <int value="186" label="webkit-border-before"/> + <int value="186" label="alias-webkit-border-before"/> <int value="187" label="alias-webkit-border-before-color"/> <int value="188" label="alias-webkit-border-before-style"/> <int value="189" label="alias-webkit-border-before-width"/> - <int value="190" label="webkit-border-end"/> + <int value="190" label="alias-webkit-border-end"/> <int value="191" label="alias-webkit-border-end-color"/> <int value="192" label="alias-webkit-border-end-style"/> <int value="193" label="alias-webkit-border-end-width"/> @@ -29462,7 +29464,7 @@ <int value="195" label="webkit-border-horizontal-spacing"/> <int value="196" label="webkit-border-image"/> <int value="197" label="alias-webkit-border-radius"/> - <int value="198" label="webkit-border-start"/> + <int value="198" label="alias-webkit-border-start"/> <int value="199" label="alias-webkit-border-start-color"/> <int value="200" label="alias-webkit-border-start-style"/> <int value="201" label="alias-webkit-border-start-width"/> @@ -29878,6 +29880,10 @@ <int value="611" label="border-inline-start-color"/> <int value="612" label="border-inline-start-style"/> <int value="613" label="border-inline-start-width"/> + <int value="614" label="border-block-start"/> + <int value="615" label="border-block-end"/> + <int value="616" label="border-inline-start"/> + <int value="617" label="border-inline-end"/> </enum> <enum name="MappedEditingCommands"> @@ -46307,6 +46313,8 @@ <int value="14" label="Aborted by too often denied rule"/> <int value="15" label="Aborted by matches previous language"/> <int value="16" label="Decision made to create infobar on Android"/> + <int value="17" label="Show omnibar icon to the user"/> + <int value="18" label="Suppress infobar but show omnibar icon"/> </enum> <enum name="TranslateLanguage">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index f9f5f8ba..6834908 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -260,6 +260,17 @@ </summary> </histogram> +<histogram name="Accessibility.iOS.NewLargerTextCategory" enum="BooleanHit"> + <owner>mrsuyi@chromium.org</owner> + <summary> + When a web page reloads or user changes text size category in Settings, + FontSizeTabHelper gets the category and maps it to a scaling number. This is + hit if the category is not listed in the map defined in + /ios/chrome/browser/web/font_size_tab_helper.mm. In that case, we should + update the code by adding an entry for the new category in that map. + </summary> +</histogram> + <histogram name="Accessibility.Mac.DifferentiateWithoutColor" enum="BooleanEnabled"> <owner>ellyjones@chromium.org</owner>
diff --git a/tools/perf/benchmark.csv b/tools/perf/benchmark.csv index aeea374..41a0da8 100644 --- a/tools/perf/benchmark.csv +++ b/tools/perf/benchmark.csv
@@ -45,38 +45,11 @@ rendering.desktop,"sadrul@chromium.org, vmiura@chromium.org", rendering.mobile,"sadrul@chromium.org, vmiura@chromium.org", resource_sizes,"agrieve@chromium.org, rnephew@chromium.org, perezju@chromium.org", -scheduler.tough_scheduling_cases,"skyostil@chromium.org, brianderson@chromium.org", sizes (linux),thestig@chromium.org, sizes (mac),tapted@chromium.org, sizes (win),grt@chromium.org, -smoothness.desktop_tough_pinch_zoom_cases,ericrk@chromium.org, -smoothness.gpu_rasterization.polymer,vmiura@chromium.org, -smoothness.gpu_rasterization.top_25_smooth,vmiura@chromium.org, -smoothness.gpu_rasterization.tough_filters_cases,senorblanco@chromium.org, -smoothness.gpu_rasterization.tough_path_rendering_cases,senorblanco@chromium.org, smoothness.gpu_rasterization.tough_pinch_zoom_cases,ericrk@chromium.org, -smoothness.gpu_rasterization.tough_scrolling_cases,ericrk@chromium.org, -smoothness.gpu_rasterization_and_decoding.image_decoding_cases,cblume@chromium.org, -smoothness.image_decoding_cases,cblume@chromium.org, -smoothness.key_desktop_move_cases,ssid@chromium.org, -smoothness.key_mobile_sites_smooth,"bokan@chromium.org, nzolghadr@chromium.org, vmiura@chromium.org", -smoothness.key_silk_cases,ajuma@chromium.org, -smoothness.maps,"kbr@chromium.org, zmo@chromium.org", -smoothness.pathological_mobile_sites,picksi@chromium.org, -smoothness.simple_mobile_sites,vmiura@chromium.org, -smoothness.sync_scroll.key_mobile_sites_smooth,"bokan@chromium.org, nzolghadr@chromium.org", -smoothness.top_25_smooth,vmiura@chromium.org, -smoothness.tough_ad_cases,skyostil@chromium.org, -smoothness.tough_animation_cases,alancutter@chromium.org, -smoothness.tough_canvas_cases,junov@chromium.org, -smoothness.tough_filters_cases,senorblanco@chromium.org, -smoothness.tough_image_decode_cases,"vmiura@chromium.org, sadrul@chromium.org", -smoothness.tough_path_rendering_cases,senorblanco@chromium.org, smoothness.tough_pinch_zoom_cases,bokan@chromium.org, -smoothness.tough_scrolling_cases,reveman@chromium.org, -smoothness.tough_texture_upload_cases,vmiura@chromium.org, -smoothness.tough_webgl_ad_cases,skyostil@chromium.org, -smoothness.tough_webgl_cases,"kbr@chromium.org, zmo@chromium.org", speedometer,hablich@chromium.org, speedometer-future,hablich@chromium.org, speedometer2,hablich@chromium.org,
diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index 803bb9c..4d0af16f 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py
@@ -20,224 +20,6 @@ return 'smoothness' -@benchmark.Owner(emails=['vmiura@chromium.org']) -class SmoothnessTop25(_Smoothness): - """Measures rendering statistics while scrolling down the top 25 web pages. - - http://www.chromium.org/developers/design-documents/rendering-benchmarks - """ - - @classmethod - def Name(cls): - return 'smoothness.top_25_smooth' - - @classmethod - def AddBenchmarkCommandLineArgs(cls, parser): - parser.add_option('--scroll-forever', action='store_true', - help='If set, continuously scroll up and down forever. ' - 'This is useful for analysing scrolling behaviour ' - 'with tools such as perf.') - - def CreateStorySet(self, options): - return page_sets.Top25SmoothPageSet(scroll_forever=options.scroll_forever) - - -@benchmark.Owner(emails=['senorblanco@chromium.org']) -class SmoothnessToughFiltersCases(_Smoothness): - """Measures frame rate and a variety of other statistics. - - Uses a selection of pages making use of SVG and CSS Filter Effects. - """ - page_set = page_sets.ToughFiltersCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_filters_cases' - - -@benchmark.Owner(emails=['senorblanco@chromium.org']) -class SmoothnessToughPathRenderingCases(_Smoothness): - """Tests a selection of pages with SVG and 2D Canvas paths. - - Measures frame rate and a variety of other statistics. """ - page_set = page_sets.ToughPathRenderingCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_path_rendering_cases' - - -@benchmark.Owner(emails=['junov@chromium.org']) -class SmoothnessToughCanvasCases(_Smoothness): - """Measures frame rate and a variety of other statistics. - - Uses a selection of pages making use of the 2D Canvas API. - """ - page_set = page_sets.ToughCanvasCasesPageSet - - """To add a new smoothness test on an experimental canvas feature, one should - append extra browser arg of - '--enable-blink-features=ComaSeparatedList,OfIndividualFeatures' here""" - - @classmethod - def Name(cls): - return 'smoothness.tough_canvas_cases' - - -@benchmark.Owner(emails=['kbr@chromium.org', 'zmo@chromium.org']) -class SmoothnessToughWebGLCases(_Smoothness): - page_set = page_sets.ToughWebglCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_webgl_cases' - - -@benchmark.Owner(emails=['kbr@chromium.org', 'zmo@chromium.org']) -class SmoothnessMaps(_Smoothness): - page_set = page_sets.MapsPageSet - - @classmethod - def Name(cls): - return 'smoothness.maps' - - -@benchmark.Owner(emails=['ssid@chromium.org']) -class SmoothnessKeyDesktopMoveCases(_Smoothness): - page_set = page_sets.KeyDesktopMoveCasesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_DESKTOP] - - @classmethod - def Name(cls): - return 'smoothness.key_desktop_move_cases' - - -@benchmark.Owner(emails=['bokan@chromium.org', 'nzolghadr@chromium.org', - 'vmiura@chromium.org']) -class SmoothnessKeyMobileSites(_Smoothness): - """Measures rendering statistics while scrolling down the key mobile sites. - - http://www.chromium.org/developers/design-documents/rendering-benchmarks - """ - page_set = page_sets.KeyMobileSitesSmoothPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE] - - @classmethod - def Name(cls): - return 'smoothness.key_mobile_sites_smooth' - - -@benchmark.Owner(emails=['alancutter@chromium.org']) -class SmoothnessToughAnimationCases(_Smoothness): - page_set = page_sets.ToughAnimationCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_animation_cases' - - -@benchmark.Owner(emails=['ajuma@chromium.org']) -class SmoothnessKeySilkCases(_Smoothness): - """Measures rendering statistics for the key silk cases without GPU - rasterization. - """ - page_set = page_sets.KeySilkCasesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE] - - @classmethod - def Name(cls): - return 'smoothness.key_silk_cases' - - -@benchmark.Owner(emails=['vmiura@chromium.org']) -class SmoothnessGpuRasterizationTop25(_Smoothness): - """Measures rendering statistics for the top 25 with GPU rasterization. - """ - tag = 'gpu_rasterization' - page_set = page_sets.Top25SmoothPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE, - story_module.expectations.ALL_CHROMEOS] - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization.top_25_smooth' - - -# Although GPU rasterization is enabled on Mac, it is blacklisted for certain -# path cases, so it is still valuable to run both the GPU and non-GPU versions -# of this benchmark on Mac. -@benchmark.Owner(emails=['senorblanco@chromium.org']) -class SmoothnessGpuRasterizationToughPathRenderingCases(_Smoothness): - """Tests a selection of pages with SVG and 2D canvas paths with GPU - rasterization. - """ - tag = 'gpu_rasterization' - page_set = page_sets.ToughPathRenderingCasesPageSet - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization.tough_path_rendering_cases' - - -@benchmark.Owner(emails=['senorblanco@chromium.org']) -class SmoothnessGpuRasterizationFiltersCases(_Smoothness): - """Tests a selection of pages with SVG and CSS filter effects with GPU - rasterization. - """ - tag = 'gpu_rasterization' - page_set = page_sets.ToughFiltersCasesPageSet - - # With GPU Raster enabled on Mac, there's no reason to run this - # benchmark in addition to SmoothnessFiltersCases. - SUPPORTED_PLATFORMS = [ - story_module.expectations.ALL_LINUX, - story_module.expectations.ALL_MOBILE, - story_module.expectations.ALL_WIN - ] - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization.tough_filters_cases' - - -@benchmark.Owner(emails=['bokan@chromium.org', 'nzolghadr@chromium.org']) -class SmoothnessSyncScrollKeyMobileSites(_Smoothness): - """Measures rendering statistics for the key mobile sites with synchronous - (main thread) scrolling. - """ - tag = 'sync_scroll' - page_set = page_sets.KeyMobileSitesSmoothPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE] - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForSyncScrolling(options) - - @classmethod - def Name(cls): - return 'smoothness.sync_scroll.key_mobile_sites_smooth' - - -@benchmark.Owner(emails=['vmiura@chromium.org']) -class SmoothnessSimpleMobilePages(_Smoothness): - """Measures rendering statistics for simple mobile sites page set. - """ - page_set = page_sets.SimpleMobileSitesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE] - - @classmethod - def Name(cls): - return 'smoothness.simple_mobile_sites' - - @benchmark.Owner(emails=['bokan@chromium.org']) class SmoothnessToughPinchZoomCases(_Smoothness): """Measures rendering statistics for pinch-zooming in the tough pinch zoom @@ -252,19 +34,6 @@ @benchmark.Owner(emails=['ericrk@chromium.org']) -class SmoothnessDesktopToughPinchZoomCases(_Smoothness): - """Measures rendering statistics for pinch-zooming in the tough pinch zoom - cases. Uses lower zoom levels customized for desktop limits. - """ - page_set = page_sets.DesktopToughPinchZoomCasesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MAC] - - @classmethod - def Name(cls): - return 'smoothness.desktop_tough_pinch_zoom_cases' - - -@benchmark.Owner(emails=['ericrk@chromium.org']) class SmoothnessGpuRasterizationToughPinchZoomCases(_Smoothness): """Measures rendering statistics for pinch-zooming in the tough pinch zoom cases with GPU rasterization. @@ -280,154 +49,3 @@ @classmethod def Name(cls): return 'smoothness.gpu_rasterization.tough_pinch_zoom_cases' - - -@benchmark.Owner(emails=['vmiura@chromium.org']) -class SmoothnessGpuRasterizationPolymer(_Smoothness): - """Measures rendering statistics for the Polymer cases with GPU rasterization. - """ - tag = 'gpu_rasterization' - page_set = page_sets.PolymerPageSet - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization.polymer' - - -@benchmark.Owner(emails=['reveman@chromium.org']) -class SmoothnessToughScrollingCases(_Smoothness): - page_set = page_sets.ToughScrollingCasesPageSet - - @classmethod - def ShouldAddValue(cls, name, from_first_story_run): - del from_first_story_run # unused - # Only keep 'mean_pixels_approximated' and 'mean_pixels_checkerboarded' - # metrics. (crbug.com/529331) - return name in ('mean_pixels_approximated', - 'mean_pixels_checkerboarded') - - @classmethod - def Name(cls): - return 'smoothness.tough_scrolling_cases' - - -@benchmark.Owner(emails=['ericrk@chromium.org']) -class SmoothnessGpuRasterizationToughScrollingCases(_Smoothness): - tag = 'gpu_rasterization' - test = smoothness.Smoothness - page_set = page_sets.ToughScrollingCasesPageSet - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization.tough_scrolling_cases' - - -@benchmark.Owner(emails=['vmiura@chromium.org', 'sadrul@chromium.org']) -class SmoothnessToughImageDecodeCases(_Smoothness): - page_set = page_sets.ToughImageDecodeCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_image_decode_cases' - - -@benchmark.Owner(emails=['cblume@chromium.org']) -class SmoothnessImageDecodingCases(_Smoothness): - """Measures decoding statistics for jpeg images. - """ - page_set = page_sets.ImageDecodingCasesPageSet - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - options.AppendExtraBrowserArgs('--disable-accelerated-jpeg-decoding') - - @classmethod - def Name(cls): - return 'smoothness.image_decoding_cases' - - -@benchmark.Owner(emails=['cblume@chromium.org']) -class SmoothnessGpuImageDecodingCases(_Smoothness): - """Measures decoding statistics for jpeg images with GPU rasterization. - """ - tag = 'gpu_rasterization_and_decoding' - page_set = page_sets.ImageDecodingCasesPageSet - - def SetExtraBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - # TODO(sugoi): Remove the following line once M41 goes stable - options.AppendExtraBrowserArgs('--enable-accelerated-jpeg-decoding') - - @classmethod - def Name(cls): - return 'smoothness.gpu_rasterization_and_decoding.image_decoding_cases' - - -@benchmark.Owner(emails=['picksi@chromium.org']) -class SmoothnessPathologicalMobileSites(_Smoothness): - """Measures task execution statistics while scrolling pathological sites. - """ - page_set = page_sets.PathologicalMobileSitesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MOBILE] - - @classmethod - def Name(cls): - return 'smoothness.pathological_mobile_sites' - - -@benchmark.Owner(emails=['vmiura@chromium.org']) -class SmoothnessToughTextureUploadCases(_Smoothness): - page_set = page_sets.ToughTextureUploadCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_texture_upload_cases' - - -@benchmark.Owner(emails=['skyostil@chromium.org']) -class SmoothnessToughAdCases(_Smoothness): - """Measures rendering statistics while displaying advertisements.""" - page_set = page_sets.SyntheticToughAdCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_ad_cases' - - @classmethod - def ShouldAddValue(cls, name, from_first_story_run): - del from_first_story_run # unused - # These pages don't scroll so it's not necessary to measure input latency. - return name != 'first_gesture_scroll_update_latency' - - -@benchmark.Owner(emails=['skyostil@chromium.org']) -class SmoothnessToughWebGLAdCases(_Smoothness): - """Measures rendering statistics while scrolling advertisements.""" - page_set = page_sets.SyntheticToughWebglAdCasesPageSet - - @classmethod - def Name(cls): - return 'smoothness.tough_webgl_ad_cases' - - -@benchmark.Owner(emails=['skyostil@chromium.org', 'brianderson@chromium.org']) -class SmoothnessToughSchedulingCases(_Smoothness): - """Measures rendering statistics while interacting with pages that have - challenging scheduling properties. - - https://docs.google.com/a/chromium.org/document/d/ - 17yhE5Po9By0sCdM1yZT3LiUECaUr_94rQt9j-4tOQIM/view""" - page_set = page_sets.ToughSchedulingCasesPageSet - - @classmethod - def Name(cls): - # This should be smoothness.tough_scheduling_cases but since the benchmark - # has been named this way for long time, we keep the name as-is to avoid - # data migration. - return 'scheduler.tough_scheduling_cases'
diff --git a/tools/perf/core/shard_maps/desktop_26_shard_map.json b/tools/perf/core/shard_maps/desktop_26_shard_map.json index ffefda01..7462c2c 100644 --- a/tools/perf/core/shard_maps/desktop_26_shard_map.json +++ b/tools/perf/core/shard_maps/desktop_26_shard_map.json
@@ -100,72 +100,11 @@ "rendering.desktop": { "begin": 101 }, - "rendering.mobile": {}, - "scheduler.tough_scheduling_cases": {}, - "smoothness.desktop_tough_pinch_zoom_cases": {}, - "smoothness.gpu_rasterization.polymer": {}, - "smoothness.gpu_rasterization.top_25_smooth": {}, - "smoothness.gpu_rasterization.tough_filters_cases": { - "end": 1 - } + "rendering.mobile": {} } }, "9": { "benchmarks": { - "smoothness.gpu_rasterization.tough_filters_cases": { - "begin": 1 - }, - "smoothness.gpu_rasterization.tough_path_rendering_cases": {}, - "smoothness.gpu_rasterization.tough_pinch_zoom_cases": {}, - "smoothness.gpu_rasterization.tough_scrolling_cases": {}, - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases": {}, - "smoothness.image_decoding_cases": {}, - "smoothness.key_desktop_move_cases": {}, - "smoothness.key_mobile_sites_smooth": {}, - "smoothness.key_silk_cases": {}, - "smoothness.maps": {}, - "smoothness.pathological_mobile_sites": {}, - "smoothness.simple_mobile_sites": {}, - "smoothness.sync_scroll.key_mobile_sites_smooth": {}, - "smoothness.top_25_smooth": {}, - "smoothness.tough_ad_cases": { - "end": 6 - } - } - }, - "10": { - "benchmarks": { - "smoothness.tough_ad_cases": { - "begin": 6 - }, - "smoothness.tough_animation_cases": { - "end": 56 - } - } - }, - "11": { - "benchmarks": { - "smoothness.tough_animation_cases": { - "begin": 56 - }, - "smoothness.tough_canvas_cases": {}, - "smoothness.tough_filters_cases": {}, - "smoothness.tough_image_decode_cases": {}, - "smoothness.tough_path_rendering_cases": {}, - "smoothness.tough_pinch_zoom_cases": {}, - "smoothness.tough_scrolling_cases": { - "end": 29 - } - } - }, - "12": { - "benchmarks": { - "smoothness.tough_scrolling_cases": { - "begin": 29 - }, - "smoothness.tough_texture_upload_cases": {}, - "smoothness.tough_webgl_ad_cases": {}, - "smoothness.tough_webgl_cases": {}, "speedometer": {}, "speedometer-future": {}, "speedometer2": {}, @@ -177,7 +116,7 @@ } } }, - "13": { + "10": { "benchmarks": { "system_health.common_desktop": { "begin": 8, @@ -185,14 +124,14 @@ } } }, - "14": { + "11": { "benchmarks": { "system_health.common_desktop": { "begin": 45 } } }, - "15": { + "12": { "benchmarks": { "system_health.common_mobile": {}, "system_health.memory_desktop": { @@ -200,7 +139,7 @@ } } }, - "16": { + "13": { "benchmarks": { "system_health.memory_desktop": { "begin": 12, @@ -208,7 +147,7 @@ } } }, - "17": { + "14": { "benchmarks": { "system_health.memory_desktop": { "begin": 26, @@ -216,7 +155,7 @@ } } }, - "18": { + "15": { "benchmarks": { "system_health.memory_desktop": { "begin": 46, @@ -224,7 +163,7 @@ } } }, - "19": { + "16": { "benchmarks": { "system_health.memory_desktop": { "begin": 54, @@ -232,7 +171,7 @@ } } }, - "20": { + "17": { "benchmarks": { "system_health.memory_desktop": { "begin": 62 @@ -253,7 +192,7 @@ } } }, - "21": { + "18": { "benchmarks": { "tracing.tracing_with_background_memory_infra": { "begin": 1 @@ -263,7 +202,7 @@ } } }, - "22": { + "19": { "benchmarks": { "v8.browsing_desktop": { "begin": 13 @@ -273,7 +212,7 @@ } } }, - "23": { + "20": { "benchmarks": { "v8.browsing_desktop-future": { "begin": 8 @@ -285,17 +224,17 @@ } } }, - "24": { + "21": { "benchmarks": { "v8.runtime_stats.top_25": { "begin": 3 } } }, - "25": { + "22": { "benchmarks": { "wasm": {}, "webrtc": {} } } -} \ No newline at end of file +}
diff --git a/tools/perf/core/shard_maps/mobile_39_shard_map.json b/tools/perf/core/shard_maps/mobile_39_shard_map.json index 5f7814a..c24921d7 100644 --- a/tools/perf/core/shard_maps/mobile_39_shard_map.json +++ b/tools/perf/core/shard_maps/mobile_39_shard_map.json
@@ -155,101 +155,28 @@ "benchmarks": { "rendering.mobile": { "begin": 228 - }, - "scheduler.tough_scheduling_cases": {}, - "smoothness.desktop_tough_pinch_zoom_cases": {}, - "smoothness.gpu_rasterization.polymer": {}, - "smoothness.gpu_rasterization.top_25_smooth": {}, - "smoothness.gpu_rasterization.tough_filters_cases": {}, - "smoothness.gpu_rasterization.tough_path_rendering_cases": {} + } } }, "16": { "benchmarks": { - "smoothness.gpu_rasterization.tough_pinch_zoom_cases": {}, - "smoothness.gpu_rasterization.tough_scrolling_cases": {}, - "smoothness.gpu_rasterization_and_decoding.image_decoding_cases": {}, - "smoothness.image_decoding_cases": {}, - "smoothness.key_desktop_move_cases": {}, - "smoothness.key_mobile_sites_smooth": { - "end": 5 - } + "smoothness.gpu_rasterization.tough_pinch_zoom_cases": {} } }, "17": { "benchmarks": { - "smoothness.key_mobile_sites_smooth": { - "begin": 5 - }, - "smoothness.key_silk_cases": {}, - "smoothness.maps": {}, - "smoothness.pathological_mobile_sites": { - "end": 3 - } + "smoothness.tough_pinch_zoom_cases": {} } }, "18": { "benchmarks": { - "smoothness.pathological_mobile_sites": { - "begin": 3 - }, - "smoothness.simple_mobile_sites": {}, - "smoothness.sync_scroll.key_mobile_sites_smooth": {}, - "smoothness.top_25_smooth": { - "end": 6 - } - } - }, - "19": { - "benchmarks": { - "smoothness.top_25_smooth": { - "begin": 6 - }, - "smoothness.tough_ad_cases": {}, - "smoothness.tough_animation_cases": { - "end": 26 - } - } - }, - "20": { - "benchmarks": { - "smoothness.tough_animation_cases": { - "begin": 26 - }, - "smoothness.tough_canvas_cases": { - "end": 17 - } - } - }, - "21": { - "benchmarks": { - "smoothness.tough_canvas_cases": { - "begin": 17 - }, - "smoothness.tough_filters_cases": {}, - "smoothness.tough_image_decode_cases": {}, - "smoothness.tough_path_rendering_cases": {}, - "smoothness.tough_pinch_zoom_cases": {}, - "smoothness.tough_scrolling_cases": { - "end": 18 - } - } - }, - "22": { - "benchmarks": { - "smoothness.tough_scrolling_cases": { - "begin": 18 - }, - "smoothness.tough_texture_upload_cases": {}, - "smoothness.tough_webgl_ad_cases": {}, - "smoothness.tough_webgl_cases": {}, "speedometer": {}, "speedometer-future": {}, "speedometer2": {}, "speedometer2-future": {} } }, - "23": { + "19": { "benchmarks": { "start_with_url.cold.startup_pages": {}, "start_with_url.warm.startup_pages": {}, @@ -259,7 +186,7 @@ } } }, - "24": { + "20": { "benchmarks": { "system_health.common_mobile": { "begin": 2, @@ -267,7 +194,7 @@ } } }, - "25": { + "21": { "benchmarks": { "system_health.common_mobile": { "begin": 26, @@ -275,7 +202,7 @@ } } }, - "26": { + "22": { "benchmarks": { "system_health.common_mobile": { "begin": 59 @@ -286,7 +213,7 @@ } } }, - "27": { + "23": { "benchmarks": { "system_health.memory_mobile": { "begin": 9, @@ -294,7 +221,7 @@ } } }, - "28": { + "24": { "benchmarks": { "system_health.memory_mobile": { "begin": 18, @@ -302,7 +229,7 @@ } } }, - "29": { + "25": { "benchmarks": { "system_health.memory_mobile": { "begin": 29, @@ -310,7 +237,7 @@ } } }, - "30": { + "26": { "benchmarks": { "system_health.memory_mobile": { "begin": 47, @@ -318,7 +245,7 @@ } } }, - "31": { + "27": { "benchmarks": { "system_health.memory_mobile": { "begin": 53, @@ -326,7 +253,7 @@ } } }, - "32": { + "28": { "benchmarks": { "system_health.memory_mobile": { "begin": 59 @@ -334,7 +261,7 @@ "system_health.webview_startup": {} } }, - "33": { + "29": { "benchmarks": { "tab_switching.typical_25": {}, "thread_times.key_hit_test_cases": {}, @@ -347,7 +274,7 @@ } } }, - "34": { + "30": { "benchmarks": { "thread_times.simple_mobile_sites": { "begin": 2 @@ -362,7 +289,7 @@ } } }, - "35": { + "31": { "benchmarks": { "v8.browsing_mobile": { "begin": 1, @@ -370,7 +297,7 @@ } } }, - "36": { + "32": { "benchmarks": { "v8.browsing_mobile": { "begin": 16 @@ -380,7 +307,7 @@ } } }, - "37": { + "33": { "benchmarks": { "v8.browsing_mobile-future": { "begin": 6, @@ -388,7 +315,7 @@ } } }, - "38": { + "34": { "benchmarks": { "v8.browsing_mobile-future": { "begin": 18 @@ -398,4 +325,4 @@ "webrtc": {} } } -} \ No newline at end of file +}
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index b459f5e..12a013d 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -195,112 +195,18 @@ crbug.com/850295 [ All ] rendering.mobile/aquarium_20k [ Skip ] crbug.com/750876 [ All ] rendering.mobile/paper_calculator_hit_test [ Skip ] -# Benchmark: smoothness.gpu_rasterization.polymer -[ All ] smoothness.gpu_rasterization.polymer/* [ Skip ] # Test needs to be modernized. - # Benchmark: rasterize_and_record_micro.top_25 crbug.com/768010 [ Android_One ] rasterize_and_record_micro.top_25/file://static_top_25/yahoonews.html [ Skip ] crbug.com/764543 [ All ] rasterize_and_record_micro.top_25/file://static_top_25/wikipedia.html [ Skip ] crbug.com/815193 [ Android ] rasterize_and_record_micro.top_25/file://static_top_25/wikipedia.html [ Skip ] crbug.com/842175 [ Android_One ] rasterize_and_record_micro.top_25/file://static_top_25/espn.html [ Skip ] -# Benchmark: smoothness.gpu_rasterization.top_25_smooth -crbug.com/667432 [ All ] smoothness.gpu_rasterization.top_25_smooth/pinterest [ Skip ] -crbug.com/667432 [ All ] smoothness.gpu_rasterization.top_25_smooth/amazon [ Skip ] -crbug.com/528474 [ All ] smoothness.gpu_rasterization.top_25_smooth/cnn [ Skip ] -crbug.com/803869 [ Nexus_5X ] smoothness.gpu_rasterization.top_25_smooth/youtube [ Skip ] -crbug.com/853199 [ Nexus_5X ] smoothness.gpu_rasterization.top_25_smooth/blogspot [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.gpu_rasterization.top_25_smooth/yahoo_games [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.gpu_rasterization.top_25_smooth/yahoo_news [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.gpu_rasterization.top_25_smooth/yahoo_sports [ Skip ] - # Benchmark: smoothness.gpu_rasterization.tough_pinch_zoom_cases crbug.com/822925 [ Android_Webview ] smoothness.gpu_rasterization.tough_pinch_zoom_cases/yahoo_games_pinch [ Skip ] -# Benchmark: smoothness.key_desktop_move_cases -crbug.com/750131 [ Win ] smoothness.key_desktop_move_cases/gmail_move [ Skip ] -crbug.com/770904 [ Mac ] smoothness.key_desktop_move_cases/gmail_move [ Skip ] - -# Benchmark: smoothness.key_mobile_sites_smooth -crbug.com/756119 [ All ] smoothness.key_mobile_sites_smooth/digg [ Skip ] -crbug.com/667432 [ All ] smoothness.key_mobile_sites_smooth/amazon [ Skip ] -crbug.com/169980 [ All ] smoothness.key_mobile_sites_smooth/twitter [ Skip ] -crbug.com/249722 [ All ] smoothness.key_mobile_sites_smooth/espn [ Skip ] -crbug.com/249736 [ All ] smoothness.key_mobile_sites_smooth/forecast.io [ Skip ] - -# Benchmark: smoothness.key_silk_cases -[ All ] smoothness.key_silk_cases/slide_drawer [ Skip ] -crbug.com/780525 [ All ] smoothness.key_silk_cases/polymer_topeka [ Skip ] -crbug.com/461127 [ All ] smoothness.key_silk_cases/famo_us_twitter_demo [ Skip ] - -# Benchmark: smoothness.maps -crbug.com/653993 [ Android_Webview ] smoothness.maps/maps_perf_test [ Skip ] - -# Benchmark: smoothness.pathological_mobile_sites -crbug.com/685342 [ Nexus_7 ] smoothness.pathological_mobile_sites/* [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.pathological_mobile_sites/yahoo_sports_pathological [ Skip ] - -# Benchmark: smoothness.simple_mobile_sites -crbug.com/750833 [ Android_Webview ] smoothness.simple_mobile_sites/flickr_scroll [ Skip ] - -# Benchmark: smoothness.sync_scroll.key_mobile_sites_smooth -crbug.com/756119 [ All ] smoothness.sync_scroll.key_mobile_sites_smooth/digg [ Skip ] -crbug.com/828222 [ Android_Go ] smoothness.sync_scroll.key_mobile_sites_smooth/amazon [ Skip ] - -# Benchmark: smoothness.top_25_smooth -crbug.com/762165 [ Win ] smoothness.top_25_smooth/google_calendar [ Skip ] -crbug.com/815205 [ Mac ] smoothness.top_25_smooth/youtube [ Skip ] -crbug.com/762165 [ Win ] smoothness.top_25_smooth/youtube [ Skip ] -crbug.com/667432 [ All ] smoothness.top_25_smooth/amazon [ Skip ] -crbug.com/528474 [ All ] smoothness.top_25_smooth/cnn [ Skip ] -crbug.com/762165 [ Win ] smoothness.top_25_smooth/google_plus [ Skip ] -crbug.com/762165 [ Win ] smoothness.top_25_smooth/google_image_search [ Skip ] -crbug.com/762165 [ Win ] smoothness.top_25_smooth/google_docs [ Skip ] -crbug.com/812628 [ Nexus_5X ] smoothness.top_25_smooth/youtube [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.top_25_smooth/yahoo_games [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.top_25_smooth/yahoo_news [ Skip ] -crbug.com/822925 [ Android_Webview ] smoothness.top_25_smooth/yahoo_sports [ Skip ] - -# Benchmark: smoothness.tough_ad_cases -crbug.com/555089 [ Android_Svelte ] smoothness.tough_ad_cases/* [ Skip ] - -# Benchmark: smoothness.tough_animation_cases -crbug.com/350692 [ All ] smoothness.tough_animation_cases/microsoft_performance [ Skip ] -crbug.com/755556 [ Android ] smoothness.tough_animation_cases/balls_css_key_frame_animations_composited_transform [ Skip ] -crbug.com/755556 [ Mac ] smoothness.tough_animation_cases/mix_blend_mode_animation_difference [ Skip ] -crbug.com/755556 [ Mac ] smoothness.tough_animation_cases/mix_blend_mode_animation_hue [ Skip ] -crbug.com/829499 [ Android_One ] smoothness.tough_animation_cases/css_animations_many_keyframes [ Skip ] -crbug.com/829499 [ Android_One ] smoothness.tough_animation_cases/web_animations_many_keyframes [ Skip ] - -# Benchmark: smoothness.tough_canvas_cases -crbug.com/785485 [ Android_Webview ] smoothness.tough_canvas_cases/kevs_3d [ Skip ] -crbug.com/755657 [ Android_One ] smoothness.tough_canvas_cases/canvas_to_blob [ Skip ] -crbug.com/785286 [ Android_Webview ] smoothness.tough_canvas_cases/smash_cat [ Skip ] -crbug.com/785286 [ Android_Webview ] smoothness.tough_canvas_cases/effect_games [ Skip ] -crbug.com/364248 [ Nexus_5 ] smoothness.tough_canvas_cases/geo_apis [ Skip ] -crbug.com/825234 [ Android_Webview ] smoothness.tough_canvas_cases/bouncing_balls_shadow [ Skip ] - # Benchmark: smoothness.tough_pinch_zoom_cases crbug.com/822925 [ Android_Webview ] smoothness.tough_pinch_zoom_cases/yahoo_games_pinch [ Skip ] -# Benchmark: smoothness.tough_scrolling_cases -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_15000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_20000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_40000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_50000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_10000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_05000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_30000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_75000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_60000_pixels_per_second [ Skip ] -crbug.com/785473 [ Android_Webview ] smoothness.tough_scrolling_cases/canvas_90000_pixels_per_second [ Skip ] - -# Benchmark: smoothness.tough_texture_upload_cases -crbug.com/795060 [ Android_One ] smoothness.tough_texture_upload_cases/extra_large_texture_uploads [ Skip ] - -# Benchmark: smoothness.tough_webgl_ad_cases -crbug.com/574485 [ Android_Svelte ] smoothness.tough_webgl_ad_cases/* [ Skip ] - # Benchmark: system_health.common_desktop crbug.com/828917 [ Mac ] system_health.common_desktop/multitab:misc:typical24 [ Skip ] crbug.com/728576 [ Mac ] system_health.common_desktop/browse:news:cnn [ Skip ]
diff --git a/tools/perf/fetch_benchmark_deps_unittest.py b/tools/perf/fetch_benchmark_deps_unittest.py index d1565ee..64ea9832 100644 --- a/tools/perf/fetch_benchmark_deps_unittest.py +++ b/tools/perf/fetch_benchmark_deps_unittest.py
@@ -28,7 +28,7 @@ """ def testFetchWPRs(self): - test_name = 'smoothness.top_25_smooth' + test_name = 'system_health.common_desktop' deps_fd, deps_path = tempfile.mkstemp() args = [test_name, '--output-deps=%s' % deps_path] with mock.patch.object(archive_info.WprArchiveInfo, @@ -42,7 +42,7 @@ # pylint: disable=protected-access os.path.normpath(mock_download.call_args[0][0]._file_path), os.path.join(path_util.GetPerfStorySetsDir(), 'data', - 'top_25_smooth.json')) + 'system_health_desktop.json')) # This benchmark doesn't use any static local files. self.assertFalse(mock_get.called)
diff --git a/tools/perf/page_sets/data/key_desktop_move_cases.json b/tools/perf/page_sets/data/key_desktop_move_cases.json deleted file mode 100644 index 997a008..0000000 --- a/tools/perf/page_sets/data/key_desktop_move_cases.json +++ /dev/null
@@ -1,12 +0,0 @@ -{ - "archives": { - "maps_move": { - "DEFAULT": "key_desktop_move_cases_000.wprgo" - }, - "gmail_move": { - "DEFAULT": "key_desktop_move_cases_002.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/pathological_mobile_sites.json b/tools/perf/page_sets/data/pathological_mobile_sites.json deleted file mode 100644 index a00994f..0000000 --- a/tools/perf/page_sets/data/pathological_mobile_sites.json +++ /dev/null
@@ -1,36 +0,0 @@ -{ - "archives": { - "cnn_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "espn_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "recode_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "yahoo_sports_pathological": { - "DEFAULT": "pathological_mobile_sites_001.wprgo" - }, - "latimes_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "pbs_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "guardian_pathological": { - "DEFAULT": "pathological_mobile_sites_010.wprgo" - }, - "wow_wiki_pathological": { - "DEFAULT": "pathological_mobile_sites_008.wprgo" - }, - "zdnet_pathological": { - "DEFAULT": "pathological_mobile_sites_000.wprgo" - }, - "linkedin_pathological": { - "DEFAULT": "pathological_mobile_sites_009.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/tough_ad_cases.json b/tools/perf/page_sets/data/tough_ad_cases.json deleted file mode 100644 index e236e905..0000000 --- a/tools/perf/page_sets/data/tough_ad_cases.json +++ /dev/null
@@ -1,111 +0,0 @@ -{ - "archives": { - "http://androidcentral.com": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://androidpolice.com": { - "DEFAULT": "tough_ad_cases_005.wprgo" - }, - "http://latimes.com": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://localhost:8000/CICAgICQ15a9NxDIARjIASgBMghBC1XuTk8ezw.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CICAgICQ15a9NxDIARjIASgBMghBC1XuTk8ezw.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/CICAgIDQ2Pb-MxCsAhj6ASgBMgi5DLoSO0gPbQ.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CICAgIDQ2Pb-MxCsAhj6ASgBMgi5DLoSO0gPbQ.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/CICAgKCN39CopQEQoAEY2AQoATIID59gK5hjjIg.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CICAgKCN39CopQEQoAEY2AQoATIID59gK5hjjIg.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/CICAgKCNj4HgyAEQeBjYBCgBMgjQpPkOjyWNdw.1.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CICAgKCNj4HgyAEQeBjYBCgBMgjQpPkOjyWNdw.1.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/CICAgMDOrcnRGRB4GNgEKAEyCP_ZBSfwUFsj.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CICAgMDOrcnRGRB4GNgEKAEyCP_ZBSfwUFsj.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/CNP2xe_LmqPEKBCsAhj6ASgBMggnyMqth81h8Q.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/CNP2xe_LmqPEKBCsAhj6ASgBMggnyMqth81h8Q.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/clip-paths-CICAgMDO7Ye9-gEQ2AUYWigBMgjZxDii6aoK9w.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/clip-paths-CICAgMDO7Ye9-gEQ2AUYWigBMgjZxDii6aoK9w.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/clip-paths-CILZhLqO_-27bxB4GNgEKAEyCC46kMLBXnMT.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/clip-paths-CILZhLqO_-27bxB4GNgEKAEyCC46kMLBXnMT.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/filters-CNLa0t2T47qJ_wEQoAEY2AQoATIIFaIdc7VMBr4.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/filters-CNLa0t2T47qJ_wEQoAEY2AQoATIIFaIdc7VMBr4.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/shapes-CICAgMDO7cfIzwEQ1AMYPCgBMghqY8tqyRCArQ.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/shapes-CICAgMDO7cfIzwEQ1AMYPCgBMghqY8tqyRCArQ.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://localhost:8000/shapes-CK7ptO3F8bi2KxDQAhiYAigBMgij6QBQtD2gyA.swf.webglbeta.html": { - "DEFAULT": "tough_ad_cases_009.wprgo" - }, - "http://localhost:8000/shapes-CK7ptO3F8bi2KxDQAhiYAigBMgij6QBQtD2gyA.swiffy72.html": { - "DEFAULT": "tough_ad_cases_000.wprgo" - }, - "http://m.tmz.com": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://mashable.com": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://time.com/3977891/donald-trump-debate-republican/": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://www.androidauthority.com/reduce-data-use-turn-on-data-compression-in-chrome-630064/": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://www.cnn.com/2015/01/09/politics/nebraska-keystone-pipeline/index.html": { - "DEFAULT": "tough_ad_cases_001.wprgo" - }, - "http://www.forbes.com/sites/parmyolson/2015/07/29/jana-mobile-data-facebook-internet-org/": { - "DEFAULT": "tough_ad_cases_003.wprgo" - }, - "http://www.latimes.com": { - "DEFAULT": "tough_ad_cases_006.wprgo" - }, - "http://www.theguardian.com/uk": { - "DEFAULT": "tough_ad_cases_002.wprgo" - }, - "swiffy_collection.html": { - "DEFAULT": "tough_ad_cases_004.wprgo" - }, - "swiffy_webgl_collection.html": { - "DEFAULT": "tough_ad_cases_011.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -} \ No newline at end of file
diff --git a/tools/perf/page_sets/data/tough_canvas_cases.json b/tools/perf/page_sets/data/tough_canvas_cases.json deleted file mode 100644 index 8d59511..0000000 --- a/tools/perf/page_sets/data/tough_canvas_cases.json +++ /dev/null
@@ -1,69 +0,0 @@ -{ - "archives": { - "geo_apis": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "hakim": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_tweet_map": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_video_city": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_worker_fountains": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_asteroid_belt": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_fireflies": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_fish_ie_tank": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_snow": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "microsoft_speed_reading": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "jarro_doverson": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "mix_10k": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "runway": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "spielzeugz": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "man_in_blue": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "chip_tune": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "crafty_mind": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "effect_games": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "kevs_3d": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "megi_dish": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - }, - "smash_cat": { - "DEFAULT": "tough_canvas_cases_001.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/tough_filters_cases.json b/tools/perf/page_sets/data/tough_filters_cases.json deleted file mode 100644 index bb5b6b10..0000000 --- a/tools/perf/page_sets/data/tough_filters_cases.json +++ /dev/null
@@ -1,21 +0,0 @@ -{ - "archives": { - "http://ie.microsoft.com/testdrive/Performance/Pirates/": { - "DEFAULT": "tough_filters_cases_001.wprgo" - }, - "filter_terrain_svg": { - "DEFAULT": "tough_filters_cases_002.wprgo" - }, - "motion_mark_focus": { - "DEFAULT": "tough_filters_cases_002.wprgo" - }, - "analog_clock_svg": { - "DEFAULT": "tough_filters_cases_002.wprgo" - }, - "ie_pirate_mark": { - "DEFAULT": "tough_filters_cases_002.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/tough_image_decode_cases.json b/tools/perf/page_sets/data/tough_image_decode_cases.json deleted file mode 100644 index 63525700..0000000 --- a/tools/perf/page_sets/data/tough_image_decode_cases.json +++ /dev/null
@@ -1,12 +0,0 @@ -{ - "archives": { - "cats_unscaled": { - "DEFAULT": "tough_image_decode_cases_000.wprgo" - }, - "cats_viewport_width": { - "DEFAULT": "tough_image_decode_cases_000.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/tough_path_rendering_cases.json b/tools/perf/page_sets/data/tough_path_rendering_cases.json deleted file mode 100644 index 3f9c4837..0000000 --- a/tools/perf/page_sets/data/tough_path_rendering_cases.json +++ /dev/null
@@ -1,18 +0,0 @@ -{ - "archives": { - "guimark_vector_chart": { - "DEFAULT": "tough_path_rendering_cases_002.wprgo" - }, - "motion_mark_canvas_fill_shapes": { - "DEFAULT": "tough_path_rendering_cases_002.wprgo" - }, - "motion_mark_canvas_stroke_shapes": { - "DEFAULT": "tough_path_rendering_cases_002.wprgo" - }, - "ie_chalkboard": { - "DEFAULT": "tough_path_rendering_cases_002.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/data/tough_webgl_cases.json b/tools/perf/page_sets/data/tough_webgl_cases.json deleted file mode 100644 index f6d04ea..0000000 --- a/tools/perf/page_sets/data/tough_webgl_cases.json +++ /dev/null
@@ -1,36 +0,0 @@ -{ - "archives": { - "aquarium_20k": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "animometer_webgl": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "aquarium": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "blob": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "dynamic_cube_map": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "nvidia_vertex_buffer_object": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "particles": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "san_angeles": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "earth": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - }, - "many_planets_deep": { - "DEFAULT": "tough_webgl_cases_006.wprgo" - } - }, - "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", - "platform_specific": true -}
diff --git a/tools/perf/page_sets/rendering/image_decoding_cases.py b/tools/perf/page_sets/rendering/image_decoding_cases.py index c03a815..06f21900 100644 --- a/tools/perf/page_sets/rendering/image_decoding_cases.py +++ b/tools/perf/page_sets/rendering/image_decoding_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -33,16 +32,3 @@ class YuvDecodingPage(ImageDecodingPage): BASE_NAME = 'yuv_decoding' URL = 'file://../image_decoding_cases/yuv_decoding.html' - - -# TODO(crbug.com/760553):remove this class after -# smoothness.image_decoding_cases benchmark is completely -# replaced by rendering benchmarks -class ImageDecodingCasesPageSet(story.StorySet): - - """ A directed benchmark of accelerated jpeg image decoding performance """ - - def __init__(self): - super(ImageDecodingCasesPageSet, self).__init__() - - self.AddStory(YuvDecodingPage(self))
diff --git a/tools/perf/page_sets/rendering/key_desktop_move_cases.py b/tools/perf/page_sets/rendering/key_desktop_move_cases.py index 142ac13..2c0e994e 100644 --- a/tools/perf/page_sets/rendering/key_desktop_move_cases.py +++ b/tools/perf/page_sets/rendering/key_desktop_move_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.login_helpers import google_login from page_sets.rendering import rendering_story @@ -132,16 +131,3 @@ action_runner.DragPage(left_start_ratio=0.5, top_start_ratio=0.75, left_end_ratio=0.75, top_end_ratio=0.5) # TODO(ssid): Add zoom gestures after fixing bug crbug.com/462214. - - -class KeyDesktopMoveCasesPageSet(story.StorySet): - - """ Special cases for move gesture """ - - def __init__(self): - super(KeyDesktopMoveCasesPageSet, self).__init__( - archive_data_file='../data/key_desktop_move_cases.json', - cloud_storage_bucket=story.PARTNER_BUCKET) - - self.AddStory(GmailMouseScrollPage(self)) - self.AddStory(GoogleMapsPage(self))
diff --git a/tools/perf/page_sets/rendering/maps.py b/tools/perf/page_sets/rendering/maps.py index 761e709..932e538 100644 --- a/tools/perf/page_sets/rendering/maps.py +++ b/tools/perf/page_sets/rendering/maps.py
@@ -4,9 +4,6 @@ import os -from telemetry import story - -from page_sets import webgl_supported_shared_state from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -52,17 +49,3 @@ action_runner.EvaluateJavaScript('startTest()') with action_runner.CreateInteraction('MapAnimation'): action_runner.WaitForJavaScriptCondition('window.testDone', timeout=120) - -# TODO(crbug.com/760553):remove this class after smoothness.maps -# benchmark is completely replaced by rendering benchmarks -class MapsPageSet(story.StorySet): - - """ Google Maps examples """ - - def __init__(self): - super(MapsPageSet,self).__init__(cloud_storage_bucket=story.PUBLIC_BUCKET) - - self.AddStory(MapsPage( - self, - shared_page_state_class=( - webgl_supported_shared_state.WebGLSupportedSharedState)))
diff --git a/tools/perf/page_sets/rendering/pathological_mobile_sites.py b/tools/perf/page_sets/rendering/pathological_mobile_sites.py index f54c2fe..db5e5d7 100644 --- a/tools/perf/page_sets/rendering/pathological_mobile_sites.py +++ b/tools/perf/page_sets/rendering/pathological_mobile_sites.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -80,30 +79,3 @@ class LinkedInPathologicalPage(PathologicalMobileSitesPage): BASE_NAME = 'linkedin_pathological' URL = 'https://www.linkedin.com/in/linustorvalds' - - -# TODO(crbug.com/760553):remove this class after -# smoothness.pathological_mobile_sites benchmark is completely -# replaced by rendering benchmarks -class PathologicalMobileSitesPageSet(story.StorySet): - - """Pathologically bad and janky sites on mobile.""" - - def __init__(self): - super(PathologicalMobileSitesPageSet, self).__init__( - archive_data_file='../data/pathological_mobile_sites.json', - cloud_storage_bucket=story.PARTNER_BUCKET) - - page_classes = [CnnPathologicalPage, - EspnPathologicalPage, - RecodePathologicalPage, - YahooSportsPathologicalPage, - LaTimesPathologicalPage, - PbsPathologicalPage, - GuardianPathologicalPage, - ZDNetPathologicalPage, - WowWikkiPathologicalPage, - LinkedInPathologicalPage] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_canvas_cases.py b/tools/perf/page_sets/rendering/tough_canvas_cases.py index ae4e6ebb..520d4ec 100644 --- a/tools/perf/page_sets/rendering/tough_canvas_cases.py +++ b/tools/perf/page_sets/rendering/tough_canvas_cases.py
@@ -1,7 +1,6 @@ # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from telemetry import story from telemetry.page import shared_page_state from page_sets.rendering import rendering_story @@ -222,62 +221,3 @@ BASE_NAME = 'bouncing_png_images' # pylint: disable=line-too-long URL = 'file://../tough_canvas_cases/rendering_throughput/bouncing_png_images.html' - - -# TODO(crbug.com/760553):remove this class after smoothness.tough_canvas_cases -# benchmark is completely replaced by rendering benchmarks -class ToughCanvasCasesPageSet(story.StorySet): - - """ - Description: Self-driven Canvas2D animation examples - """ - - def __init__(self): - super(ToughCanvasCasesPageSet, self).__init__( - archive_data_file='../data/tough_canvas_cases.json', - cloud_storage_bucket=story.PARTNER_BUCKET) - - # Crashes on Galaxy Nexus. crbug.com/314131 - # TODO(rnephew): Rerecord this story. - # self.AddStory(MicrosofFirefliesPage(self)) - - page_classes = [ - GeoAPIsPage, - RunwayPage, - MicrosoftFishIETankPage, - MicrosoftSpeedReadingPage, - Kevs3DPage, - MegiDishPage, - ManInBluePage, - Mix10KPage, - CraftyMindPage, - ChipTunePage, - JarroDoversonPage, - EffectGamesPage, - SpielzeugzPage, - HakimPage, - MicrosoftSnowPage, - MicrosoftWorkerFountainsPage, - MicrosoftTweetMapPage, - MicrosoftVideoCityPage, - MicrosoftAsteroidBeltPage, - SmashCatPage, - BouncingBallsShadowPage, - BouncingBalls15Page, - CanvasFontCyclerPage, - CanvasAnimationNoClearPage, - CanvasToBlobPage, - ManyImagesPage, - CanvasArcPage, - CanvasLinesPage, - PutGetImageDataPage, - FillShapesPage, - StrokeShapesPage, - BouncingClippedRectanglesPage, - BouncingGradientCirclesPage, - BouncingSVGImagesPage, - BouncingPNGImagesPage - ] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_filters_cases.py b/tools/perf/page_sets/rendering/tough_filters_cases.py index 007c56c9..604932a 100644 --- a/tools/perf/page_sets/rendering/tough_filters_cases.py +++ b/tools/perf/page_sets/rendering/tough_filters_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -67,26 +66,3 @@ action_runner.EvaluateJavaScript( 'document.getElementById("benchmarkButtonText").click()') action_runner.Wait(10) - -# TODO(crbug.com/760553):remove this class after smoothness.tough_filters_cases -# benchmark is completely replaced by rendering benchmarks -class ToughFiltersCasesPageSet(story.StorySet): - - """ - Description: Self-driven filters animation examples - """ - - def __init__(self): - super(ToughFiltersCasesPageSet, self).__init__( - archive_data_file='../data/tough_filters_cases.json', - cloud_storage_bucket=story.PARTNER_BUCKET) - - page_classes = [ - MotionMarkPage, - FilterTerrainSVGPage, - AnalogClockSVGPage, - PirateMarkPage - ] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_image_decode_cases.py b/tools/perf/page_sets/rendering/tough_image_decode_cases.py index 92833f34..c67433a0 100644 --- a/tools/perf/page_sets/rendering/tough_image_decode_cases.py +++ b/tools/perf/page_sets/rendering/tough_image_decode_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -39,26 +38,3 @@ class ViewPortWidthImageDecodePage(ToughImageDecodePage): BASE_NAME = 'cats_viewport_width' URL = 'http://localhost:9000/cats-viewport-width.html' - - -# TODO(crbug.com/760553):remove this class after -# smoothness.tough_image_decode_cases benchmark is completely -# replaced by rendering benchmarks -class ToughImageDecodeCasesPageSet(story.StorySet): - - """ - Description: A collection of difficult image decode tests - """ - - def __init__(self): - super(ToughImageDecodeCasesPageSet, self).__init__( - archive_data_file='../data/tough_image_decode_cases.json', - cloud_storage_bucket=story.PUBLIC_BUCKET) - - page_classes = [ - UnscaledImageDecodePage, - ViewPortWidthImageDecodePage - ] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_path_rendering_cases.py b/tools/perf/page_sets/rendering/tough_path_rendering_cases.py index 07f6dc7..9c0a058 100644 --- a/tools/perf/page_sets/rendering/tough_path_rendering_cases.py +++ b/tools/perf/page_sets/rendering/tough_path_rendering_cases.py
@@ -1,8 +1,6 @@ # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -44,30 +42,3 @@ action_runner.EvaluateJavaScript( 'document.getElementById("StartButton").click()') action_runner.Wait(20) - - -# TODO(crbug.com/760553): remove this class after -# smoothness.tough_path_rendering_cases benchmark is completely replaced -# by rendering benchmarks -class ToughPathRenderingCasesPageSet(story.StorySet): - - """ - Description: Self-driven path rendering examples - """ - - def __init__(self): - super(ToughPathRenderingCasesPageSet, self).__init__( - archive_data_file='../data/tough_path_rendering_cases.json', - cloud_storage_bucket=story.PARTNER_BUCKET) - - page_classes = [ - GUIMarkVectorChartPage, - MotionMarkCanvasFillShapesPage, - MotionMarkCanvasStrokeShapesPage, - ChalkboardPage - ] - - for page_class in page_classes: - self.AddStory(page_class( - page_set=self, - shared_page_state_class=shared_page_state.SharedPageState))
diff --git a/tools/perf/page_sets/rendering/tough_scheduling_cases.py b/tools/perf/page_sets/rendering/tough_scheduling_cases.py index 3025383..37307c3 100644 --- a/tools/perf/page_sets/rendering/tough_scheduling_cases.py +++ b/tools/perf/page_sets/rendering/tough_scheduling_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -143,32 +142,3 @@ class SecondBatchJsHeavyPage(SecondBatchJsPage): BASE_NAME = 'second_batch_js_heavy' URL = 'file://../tough_scheduling_cases/second_batch_js.html?heavy' - - -# TODO(crbug.com/760553):remove this class after -# smoothness.tough_scheduling_cases benchmark is completely -# replaced by rendering benchmarks -class ToughSchedulingCasesPageSet(story.StorySet): - - """Tough scheduler latency test cases.""" - - def __init__(self): - super(ToughSchedulingCasesPageSet, self).__init__( - cloud_storage_bucket=story.INTERNAL_BUCKET) - - page_classes = [ - SimpleTextPage, - TouchHandlerScrollingPage, - RafScrollingPage, - RafCanvasScrollingPage, - RafAnimationScrollingPage, - RafTouchAnimationScrollingPage, - TouchDraggingPage, - SynchronizedScrollOffsetPage, - SecondBatchLightJsPage, - SecondBatchJsMediumPage, - SecondBatchJsHeavyPage - ] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_texture_upload_cases.py b/tools/perf/page_sets/rendering/tough_texture_upload_cases.py index c84094a..2d4bdb00 100644 --- a/tools/perf/page_sets/rendering/tough_texture_upload_cases.py +++ b/tools/perf/page_sets/rendering/tough_texture_upload_cases.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import shared_page_state -from telemetry import story from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -57,28 +56,3 @@ class ExtraLargeTextureUploadsPage(ToughTextureUploadPage): BASE_NAME = 'extra_large_texture_uploads' URL = 'file://../tough_texture_upload_cases/extra_large_texture_uploads.html' - - -# TODO(crbug.com/760553):remove this class once -# smoothness.tough_texture_upload_cases benchmark is completely replaced -# by rendering benchmarks -class ToughTextureUploadCasesPageSet(story.StorySet): - - """ - Description: A collection of texture upload performance tests - """ - - def __init__(self): - super(ToughTextureUploadCasesPageSet, self).__init__() - - page_classes = [ - BackgroundColorAnimationPage, - BackgroundColorAnimationWithGradientPage, - SmallTextureUploadsPage, - MediumTextureUploadsPage, - LargeTextureUploadsPage, - ExtraLargeTextureUploadsPage - ] - - for page_class in page_classes: - self.AddStory(page_class(self))
diff --git a/tools/perf/page_sets/rendering/tough_webgl_cases.py b/tools/perf/page_sets/rendering/tough_webgl_cases.py index 8f0c187..8548b0d 100644 --- a/tools/perf/page_sets/rendering/tough_webgl_cases.py +++ b/tools/perf/page_sets/rendering/tough_webgl_cases.py
@@ -2,9 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from telemetry import story - -from page_sets import webgl_supported_shared_state from page_sets.rendering import rendering_story from page_sets.rendering import story_tags @@ -95,35 +92,3 @@ BASE_NAME = 'animometer_webgl' # pylint: disable=line-too-long URL = 'http://kenrussell.github.io/webgl-animometer/Animometer/tests/3d/webgl.html' - - -# TODO(crbug.com/760553):remove this class after smoothness.tough_webgl_cases -# benchmark is completely replaced by rendering benchmarks -class ToughWebglCasesPageSet(story.StorySet): - - """ - Description: Self-driven WebGL animation examples - """ - - def __init__(self): - super(ToughWebglCasesPageSet, self).__init__( - archive_data_file='../data/tough_webgl_cases.json', - cloud_storage_bucket=story.PUBLIC_BUCKET) - - page_classes = [ - NvidiaVertexBufferObjectPage, - SansAngelesPage, - ParticlesPage, - EarthPage, - ManyPlanetsDeepPage, - AquariumPage, - Aquarium20KFishPage, - BlobPage, - DynamicCubeMapPage, - KenRussellPage - ] - for page_class in page_classes: - self.AddStory(page_class( - self, - shared_page_state_class=( - webgl_supported_shared_state.WebGLSupportedSharedState)))
diff --git a/tools/perf/page_sets/tough_ad_cases.py b/tools/perf/page_sets/tough_ad_cases.py deleted file mode 100644 index 0a4b1bb..0000000 --- a/tools/perf/page_sets/tough_ad_cases.py +++ /dev/null
@@ -1,211 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from page_sets import repeatable_synthesize_scroll_gesture_shared_state - -from telemetry.core import util -from telemetry.page import page as page_module -from telemetry import story - - -class SwiffyPage(page_module.Page): - - def __init__(self, url, page_set): - super(SwiffyPage, self).__init__(url=url, page_set=page_set, - make_javascript_deterministic=False, - name=url) - - def RunNavigateSteps(self, action_runner): - super(SwiffyPage, self).RunNavigateSteps(action_runner) - # Make sure the ad has finished loading. - util.WaitFor(action_runner.tab.HasReachedQuiescence, 60) - # Swiffy overwrites toString() to return a constant string, so "undo" that - # here so that we don't think it has stomped over console.time. - action_runner.EvaluateJavaScript( - 'Function.prototype.toString = function() { return "[native code]"; }') - # Make sure we have a reasonable viewport for mobile. - action_runner.EvaluateJavaScript(""" - var meta = document.createElement("meta"); - meta.name = "viewport"; - meta.content = "width=device-width"; - document.getElementsByTagName("head")[0].appendChild(meta); - """) - - def RunPageInteractions(self, action_runner): - with action_runner.CreateInteraction('ToughAd'): - action_runner.Wait(10) - - -class AdPage(page_module.Page): - - def __init__(self, url, page_set, make_javascript_deterministic=True, - y_scroll_distance_multiplier=0.5, - scroll=False, - wait_for_interactive_or_better=False): - name = url - if not name.startswith('http'): - name = url.split('/')[-1] - super(AdPage, self).__init__( - url=url, - page_set=page_set, - make_javascript_deterministic=make_javascript_deterministic, - shared_page_state_class=( - repeatable_synthesize_scroll_gesture_shared_state.\ - RepeatableSynthesizeScrollGestureSharedState), - name=name) - self._y_scroll_distance_multiplier = y_scroll_distance_multiplier - self._scroll = scroll - self._wait_for_interactive_or_better = wait_for_interactive_or_better - - def RunNavigateSteps(self, action_runner): - # Rewrite file urls to point to the replay server instead. - if self.is_file: - url = self.file_path_url_with_scheme - url = action_runner.tab.browser.platform.http_server.UrlOf( - url[len('file://'):]) - else: - url = self._url - action_runner.tab.Navigate(url) - - # Wait for the page to be scrollable. Simultaneously (to reduce latency due - # to main thread round trips), insert a no-op touch handler on the body. - # Most ads have touch handlers and we want to simulate the worst case of the - # user trying to scroll the page by grabbing an ad. - if self._wait_for_interactive_or_better: - action_runner.WaitForJavaScriptCondition( - '(document.readyState == "interactive" || ' - 'document.readyState == "complete") &&' - 'document.body != null && ' - 'document.body.scrollHeight > window.innerHeight && ' - '!document.body.addEventListener("touchstart", function() {})') - else: - action_runner.WaitForJavaScriptCondition( - 'document.body != null && ' - 'document.body.scrollHeight > window.innerHeight && ' - '!document.body.addEventListener("touchstart", function() {})') - - def RunPageInteractions(self, action_runner): - if not self._scroll: - with action_runner.CreateInteraction('ToughAd'): - action_runner.Wait(30) - else: - action_runner.RepeatableBrowserDrivenScroll( - y_scroll_distance_ratio=self._y_scroll_distance_multiplier, - repeat_count=9) - - -class ForbesAdPage(AdPage): - - def __init__(self, url, page_set, scroll=False): - # forbes.com uses a strange dynamic transform on the body element, - # which occasionally causes us to try scrolling from outside the - # screen. Start at the very top of the viewport to avoid this. - super(ForbesAdPage, self).__init__( - url=url, page_set=page_set, make_javascript_deterministic=False, - scroll=scroll, - wait_for_interactive_or_better=True) - - def RunNavigateSteps(self, action_runner): - super(ForbesAdPage, self).RunNavigateSteps(action_runner) - # Wait until the interstitial banner goes away. - action_runner.WaitForJavaScriptCondition( - 'window.location.pathname.indexOf("welcome") == -1') - - -class SyntheticToughAdCasesPageSet(story.StorySet): - """Pages for measuring rendering performance with advertising content.""" - - def __init__(self): - super(SyntheticToughAdCasesPageSet, self).__init__( - archive_data_file='data/tough_ad_cases.json', - cloud_storage_bucket=story.INTERNAL_BUCKET) - - base_url = 'http://localhost:8000' - - # See go/swiffy-chrome-samples for how to add new pages here or how to - # update the existing ones. - swiffy_pages = [ - 'CICAgICQ15a9NxDIARjIASgBMghBC1XuTk8ezw.swiffy72.html', - 'shapes-CK7ptO3F8bi2KxDQAhiYAigBMgij6QBQtD2gyA.swiffy72.html', - 'CNP2xe_LmqPEKBCsAhj6ASgBMggnyMqth81h8Q.swiffy72.html', - 'clip-paths-CICAgMDO7Ye9-gEQ2AUYWigBMgjZxDii6aoK9w.swiffy72.html', - 'filters-CNLa0t2T47qJ_wEQoAEY2AQoATIIFaIdc7VMBr4.swiffy72.html', - 'shapes-CICAgMDO7cfIzwEQ1AMYPCgBMghqY8tqyRCArQ.swiffy72.html', - 'CICAgIDQ2Pb-MxCsAhj6ASgBMgi5DLoSO0gPbQ.swiffy72.html', - 'CICAgKCN39CopQEQoAEY2AQoATIID59gK5hjjIg.swiffy72.html', - 'CICAgKCNj4HgyAEQeBjYBCgBMgjQpPkOjyWNdw.1.swiffy72.html', - 'clip-paths-CILZhLqO_-27bxB4GNgEKAEyCC46kMLBXnMT.swiffy72.html', - 'CICAgMDOrcnRGRB4GNgEKAEyCP_ZBSfwUFsj.swiffy72.html', - ] - for page_name in swiffy_pages: - url = base_url + '/' + page_name - self.AddStory(SwiffyPage(url, self)) - - -class SyntheticToughWebglAdCasesPageSet(story.StorySet): - """Pages for measuring rendering performance with WebGL ad content.""" - - def __init__(self): - super(SyntheticToughWebglAdCasesPageSet, self).__init__( - archive_data_file='data/tough_ad_cases.json', - cloud_storage_bucket=story.INTERNAL_BUCKET) - - base_url = 'http://localhost:8000' - - # See go/swiffy-chrome-samples for how to add new pages here or how to - # update the existing ones. - swiffy_pages = [ - 'CICAgICQ15a9NxDIARjIASgBMghBC1XuTk8ezw.swf.webglbeta.html', - 'shapes-CK7ptO3F8bi2KxDQAhiYAigBMgij6QBQtD2gyA.swf.webglbeta.html', - 'CNP2xe_LmqPEKBCsAhj6ASgBMggnyMqth81h8Q.swf.webglbeta.html', - 'clip-paths-CICAgMDO7Ye9-gEQ2AUYWigBMgjZxDii6aoK9w.swf.webglbeta.html', - 'filters-CNLa0t2T47qJ_wEQoAEY2AQoATIIFaIdc7VMBr4.swf.webglbeta.html', - 'shapes-CICAgMDO7cfIzwEQ1AMYPCgBMghqY8tqyRCArQ.swf.webglbeta.html', - 'CICAgIDQ2Pb-MxCsAhj6ASgBMgi5DLoSO0gPbQ.swf.webglbeta.html', - 'CICAgKCN39CopQEQoAEY2AQoATIID59gK5hjjIg.swf.webglbeta.html', - 'CICAgKCNj4HgyAEQeBjYBCgBMgjQpPkOjyWNdw.1.swf.webglbeta.html', - 'clip-paths-CILZhLqO_-27bxB4GNgEKAEyCC46kMLBXnMT.swf.webglbeta.html', - 'CICAgMDOrcnRGRB4GNgEKAEyCP_ZBSfwUFsj.swf.webglbeta.html', - ] - for page_name in swiffy_pages: - url = base_url + '/' + page_name - self.AddStory(SwiffyPage(url, self)) - - -class ToughAdCasesPageSet(story.StorySet): - """Pages for measuring performance with advertising content.""" - - def __init__(self, scroll=False): - super(ToughAdCasesPageSet, self).__init__( - archive_data_file='data/tough_ad_cases.json', - cloud_storage_bucket=story.INTERNAL_BUCKET) - - self.AddStory(AdPage('file://tough_ad_cases/' - 'swiffy_collection.html', self, make_javascript_deterministic=False, - y_scroll_distance_multiplier=0.25, scroll=scroll)) - self.AddStory(AdPage('file://tough_ad_cases/' - 'swiffy_webgl_collection.html', - self, make_javascript_deterministic=False, scroll=scroll)) - self.AddStory(AdPage('http://www.latimes.com', self, scroll=scroll, - wait_for_interactive_or_better=True)) - self.AddStory(ForbesAdPage('http://www.forbes.com/sites/parmyolson/' - '2015/07/29/jana-mobile-data-facebook-internet-org/', - self, scroll=scroll)) - self.AddStory(AdPage('http://androidcentral.com', self, scroll=scroll, - wait_for_interactive_or_better=True)) - self.AddStory(AdPage('http://mashable.com', self, scroll=scroll, - y_scroll_distance_multiplier=0.25)) - self.AddStory(AdPage('http://www.androidauthority.com/' - 'reduce-data-use-turn-on-data-compression-in-chrome-630064/', self, - scroll=scroll)) - self.AddStory(AdPage(('http://www.cnn.com/2015/01/09/politics/' - 'nebraska-keystone-pipeline/index.html'), - self, scroll=scroll)) - self.AddStory(AdPage('http://time.com/3977891/' - 'donald-trump-debate-republican/', self, scroll=scroll)) - self.AddStory(AdPage('http://www.theguardian.com/uk', self, scroll=scroll)) - self.AddStory(AdPage('http://m.tmz.com', self, scroll=scroll, - y_scroll_distance_multiplier=0.25)) - self.AddStory(AdPage('http://androidpolice.com', self, scroll=scroll, - wait_for_interactive_or_better=True))
diff --git a/ui/events/blink/blink_event_util.cc b/ui/events/blink/blink_event_util.cc index 5192d460e..93b03bbd 100644 --- a/ui/events/blink/blink_event_util.cc +++ b/ui/events/blink/blink_event_util.cc
@@ -262,8 +262,13 @@ bool CanCoalesce(const WebMouseEvent& event_to_coalesce, const WebMouseEvent& event) { - return event.GetType() == event_to_coalesce.GetType() && - event.GetType() == WebInputEvent::kMouseMove; + // Since we start supporting the stylus input and they are constructed as + // mouse events or touch events, we should check the ID and pointer type when + // coalescing mouse events. + return event.GetType() == WebInputEvent::kMouseMove && + event.GetType() == event_to_coalesce.GetType() && + event.id == event_to_coalesce.id && + event.pointer_type == event_to_coalesce.pointer_type; } void Coalesce(const WebMouseEvent& event_to_coalesce, WebMouseEvent* event) { @@ -383,6 +388,9 @@ return false; if (!unmatched_event_touches[event_touch_index]) return false; + if (event.touches[event_touch_index].pointer_type != + event_to_coalesce.touches[i].pointer_type) + return false; unmatched_event_touches[event_touch_index] = false; } return unmatched_event_touches.none();
diff --git a/ui/events/blink/blink_event_util_unittest.cc b/ui/events/blink/blink_event_util_unittest.cc index 99c87370..7e1af81f 100644 --- a/ui/events/blink/blink_event_util_unittest.cc +++ b/ui/events/blink/blink_event_util_unittest.cc
@@ -135,6 +135,7 @@ blink::WebTouchPoint touch_point; touch_point.id = 1; touch_point.state = blink::WebTouchPoint::kStateMoved; + touch_point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; blink::WebTouchEvent coalesced_event; coalesced_event.SetType(blink::WebInputEvent::kTouchMove); @@ -153,6 +154,10 @@ Coalesce(event_to_be_coalesced, &coalesced_event); EXPECT_EQ(8, coalesced_event.touches[0].movement_x); EXPECT_EQ(6, coalesced_event.touches[0].movement_y); + + coalesced_event.touches[0].pointer_type = + blink::WebPointerProperties::PointerType::kPen; + EXPECT_FALSE(CanCoalesce(event_to_be_coalesced, coalesced_event)); } TEST(BlinkEventUtilTest, WebMouseWheelEventCoalescing) { @@ -221,6 +226,36 @@ EXPECT_FALSE(CanCoalesce(event_to_be_coalesced, coalesced_event)); } +TEST(BlinkEventUtilTest, MouseEventCoalescing) { + blink::WebMouseEvent coalesced_event; + coalesced_event.SetType(blink::WebInputEvent::kMouseMove); + coalesced_event.movement_x = 5; + coalesced_event.movement_y = 10; + coalesced_event.id = 1; + coalesced_event.pointer_type = + blink::WebPointerProperties::PointerType::kMouse; + + blink::WebMouseEvent event_to_be_coalesced; + event_to_be_coalesced.SetType(blink::WebInputEvent::kMouseMove); + event_to_be_coalesced.movement_x = 3; + event_to_be_coalesced.movement_y = -4; + event_to_be_coalesced.id = 1; + event_to_be_coalesced.pointer_type = + blink::WebPointerProperties::PointerType::kMouse; + + EXPECT_TRUE(CanCoalesce(event_to_be_coalesced, coalesced_event)); + Coalesce(event_to_be_coalesced, &coalesced_event); + EXPECT_EQ(8, coalesced_event.movement_x); + EXPECT_EQ(6, coalesced_event.movement_y); + + event_to_be_coalesced.id = 3; + EXPECT_FALSE(CanCoalesce(event_to_be_coalesced, coalesced_event)); + + event_to_be_coalesced.pointer_type = + blink::WebPointerProperties::PointerType::kPen; + EXPECT_FALSE(CanCoalesce(event_to_be_coalesced, coalesced_event)); +} + TEST(BlinkEventUtilTest, WebEventModifersAndEventFlags) { using WebInputEvent = blink::WebInputEvent; constexpr int kWebEventModifiersToTest[] = {WebInputEvent::kShiftKey,
diff --git a/ui/gfx/OWNERS b/ui/gfx/OWNERS index c280f8298..8fb8afb 100644 --- a/ui/gfx/OWNERS +++ b/ui/gfx/OWNERS
@@ -25,9 +25,13 @@ # GPU memory buffer and GpuFence interfaces. per-file gpu_fence*=reveman@chromium.org +per-file gpu_fence*=dcastagna@chromium.org per-file gpu_memory_buffer*=reveman@chromium.org +per-file gpu_memory_buffer*=dcastagna@chromium.org per-file buffer_format*=reveman@chromium.org +per-file buffer_format*=dcastagna@chromium.org per-file *buffer_types.*=reveman@chromium.org +per-file *buffer_types.*=dcastagna@chromium.org # Vector icons. per-file *vector_icon*=estade@chromium.org
diff --git a/ui/gl/OWNERS b/ui/gl/OWNERS index 5d97301e..e3d6ad60e 100644 --- a/ui/gl/OWNERS +++ b/ui/gl/OWNERS
@@ -1,6 +1,7 @@ kbr@chromium.org piman@chromium.org per-file *gl_image*=reveman@chromium.org +per-file *gl_image*=dcastagna@chromium.org per-file *_ozone*=alexst@chromium.org per-file *_ozone*=dnicoara@chromium.org per-file *_ozone*=spang@chromium.org
diff --git a/ui/gl/test/OWNERS b/ui/gl/test/OWNERS index f560efc..aea0bce 100644 --- a/ui/gl/test/OWNERS +++ b/ui/gl/test/OWNERS
@@ -1 +1,2 @@ per-file *gl_image*=reveman@chromium.org +per-file *gl_image*=dcastagna@chromium.org
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc index 785b9a4b..4cd621b 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc
@@ -389,7 +389,7 @@ void MdTab::OnBlur() { // Do not draw focus ring in kHighlight mode. - if (tabbed_pane()->GetStyle() == TabbedPane::TabStripStyle::kHighlight) + if (tabbed_pane()->GetStyle() != TabbedPane::TabStripStyle::kHighlight) SetBorder(CreateEmptyBorder(GetInsets())); SchedulePaint(); }
diff --git a/ui/views/mus/OWNERS b/ui/views/mus/OWNERS index e290675..3a73ee3 100644 --- a/ui/views/mus/OWNERS +++ b/ui/views/mus/OWNERS
@@ -1,3 +1,9 @@ +jamescook@chromium.org +msw@chromium.org +sky@chromium.org + +per-file ax_*=file://ui/accessibility/OWNERS + per-file interactive_ui_tests_manifest.json=set noparent per-file interactive_ui_tests_manifest.json=file://ipc/SECURITY_OWNERS
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 347384b9..acf2d29 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -40,7 +40,6 @@ #include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/null_event_targeter.h" #include "ui/events/platform/platform_event_source.h" -#include "ui/events/platform/x11/x11_event_source.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image_skia.h" @@ -799,11 +798,10 @@ } void DesktopWindowTreeHostX11::Maximize() { - if (ui::HasWMSpecProperty(window_properties_, + if (ui::HasWMSpecProperty(window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"))) { // Unfullscreen the window if it is fullscreen. - ui::SetWMSpecState(xwindow_, false, - gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), x11::None); + SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), x11::None); // Resize the window so that it does not have the same size as a monitor. // (Otherwise, some window managers immediately put the window back in @@ -823,9 +821,8 @@ // heuristics that are in the PropertyNotify and ConfigureNotify handlers. restored_bounds_in_pixels_ = bounds_in_pixels_; - ui::SetWMSpecState(xwindow_, true, - gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), - gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); + SetWMSpecState(true, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), + gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); if (IsMinimized()) ShowWindowWithState(ui::SHOW_STATE_NORMAL); } @@ -837,22 +834,21 @@ void DesktopWindowTreeHostX11::Restore() { should_maximize_after_map_ = false; - ui::SetWMSpecState(xwindow_, false, - gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), - gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); + SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), + gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); if (IsMinimized()) ShowWindowWithState(ui::SHOW_STATE_NORMAL); } bool DesktopWindowTreeHostX11::IsMaximized() const { - return (ui::HasWMSpecProperty(window_properties_, + return (ui::HasWMSpecProperty(window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")) && - ui::HasWMSpecProperty(window_properties_, + ui::HasWMSpecProperty(window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"))); } bool DesktopWindowTreeHostX11::IsMinimized() const { - return ui::HasWMSpecProperty(window_properties_, + return ui::HasWMSpecProperty(window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_HIDDEN")); } @@ -862,8 +858,7 @@ void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) { is_always_on_top_ = always_on_top; - ui::SetWMSpecState(xwindow_, always_on_top, - gfx::GetAtom("_NET_WM_STATE_ABOVE"), x11::None); + SetWMSpecState(always_on_top, gfx::GetAtom("_NET_WM_STATE_ABOVE"), x11::None); } bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { @@ -878,8 +873,8 @@ } void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { - ui::SetWMSpecState(xwindow_, always_visible, - gfx::GetAtom("_NET_WM_STATE_STICKY"), x11::None); + SetWMSpecState(always_visible, gfx::GetAtom("_NET_WM_STATE_STICKY"), + x11::None); int new_desktop = 0; if (always_visible) { @@ -1018,8 +1013,8 @@ if (unmaximize_and_remaximize) Restore(); - ui::SetWMSpecState(xwindow_, fullscreen, - gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), x11::None); + SetWMSpecState(fullscreen, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), + x11::None); if (unmaximize_and_remaximize) Maximize(); @@ -1039,7 +1034,7 @@ OnHostMovedInPixels(bounds_in_pixels_.origin()); OnHostResizedInPixels(bounds_in_pixels_.size()); - if (ui::HasWMSpecProperty(window_properties_, + if (ui::HasWMSpecProperty(window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN")) == fullscreen) { Relayout(); @@ -1651,6 +1646,21 @@ return size_in_pixels; } +void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled, + XAtom state1, + XAtom state2) { + if (IsVisible()) + ui::SetWMSpecState(xwindow_, enabled, state1, state2); + for (XAtom atom : {state1, state2}) { + if (atom != x11::None) { + if (enabled) + window_properties_in_client_.insert(atom); + else + window_properties_in_client_.erase(atom); + } + } +} + void DesktopWindowTreeHostX11::OnWMStateUpdated() { std::vector< ::Atom> atom_list; // Ignore the return value of gfx::GetAtomArrayProperty(). Fluxbox removes the @@ -1660,9 +1670,10 @@ bool was_minimized = IsMinimized(); bool was_maximized = IsMaximized(); - window_properties_.clear(); + window_properties_in_server_.clear(); std::copy(atom_list.begin(), atom_list.end(), - inserter(window_properties_, window_properties_.begin())); + inserter(window_properties_in_server_, + window_properties_in_server_.begin())); bool is_minimized = IsMinimized(); bool is_maximized = IsMaximized(); @@ -1711,7 +1722,7 @@ // do preprocessing before the x window's fullscreen state is toggled. is_always_on_top_ = ui::HasWMSpecProperty( - window_properties_, gfx::GetAtom("_NET_WM_STATE_ABOVE")); + window_properties_in_server_, gfx::GetAtom("_NET_WM_STATE_ABOVE")); if (was_maximized != is_maximized) OnMaximizedStateChanged(); @@ -1967,13 +1978,13 @@ 1); } - ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); - DCHECK(event_source); - UpdateMinAndMaxSize(); XMapWindow(xdisplay_, xwindow_); window_mapped_in_client_ = true; + + for (XAtom atom : window_properties_in_client_) + ui::SetWMSpecState(xwindow_, true, atom, x11::None); } void DesktopWindowTreeHostX11::SetWindowTransparency() {
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h index 5b115b64..492c896 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
@@ -192,6 +192,7 @@ private: friend class DesktopWindowTreeHostX11HighDPITest; + // Initializes our X11 surface to draw on. This method performs all // initialization related to talking to the X11 server. void InitX11Window(const Widget::InitParams& params); @@ -205,6 +206,11 @@ // fullscreen. gfx::Size AdjustSize(const gfx::Size& requested_size); + // If mapped, sends a message to the window manager to enable or disable the + // states |state1| and |state2|. Otherwise, the states will be enabled or + // disabled on the next map. + void SetWMSpecState(bool enabled, XAtom state1, XAtom state2); + // Called when |xwindow_|'s _NET_WM_STATE property is updated. void OnWMStateUpdated(); @@ -337,8 +343,12 @@ // _NET_WM_DESKTOP is unset. base::Optional<int> workspace_; - // The window manager state bits. - base::flat_set<::Atom> window_properties_; + // The window manager state bits as indicated by the server. May be + // out-of-sync. May include bits set by non-Chrome apps. + base::flat_set<::Atom> window_properties_in_server_; + + // The window manager state bits that Chrome has set. + base::flat_set<::Atom> window_properties_in_client_; // Whether |xwindow_| was requested to be fullscreen via SetFullscreen(). bool is_fullscreen_;