diff --git a/AUTHORS b/AUTHORS index 27124a2..fe88fc67 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -184,6 +184,7 @@ Deokjin Kim <deokjin81.kim@samsung.com> Derek Halman <d.halman@gmail.com> Devlin Cronin <rdevlin.cronin@gmail.com> +Diana Suvorova <diana.suvorova@gmail.com> Diego Ferreiro Val <elfogris@gmail.com> Dillon Sellars <dill.sellars@gmail.com> Divya Bansal <divya.bansal@samsung.com>
diff --git a/DEPS b/DEPS index db19d50..9b23b45f7 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,11 @@ # 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': '012893b4aad813254881fd77f31399cf3d9c965d', + 'skia_revision': 'c4176a2fa5aab30e5886f05bbe20de225dbe997b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'e6e187e6877b33bfe4d413beafaeb2644b2c2c5b', + 'v8_revision': 'c9a1f8e834f11acb2bf7c56cd8292cf3c761539c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -56,11 +56,11 @@ # 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. - 'buildtools_revision': '1dcd1bdbe93467531a50b60dbd18860803ca7be1', + 'buildtools_revision': '3d2d34dde457f07ca410d1c06f4f3b9063c28643', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'a781af7d5a1930d82d20c0cbc9d66fc8a42391e0', + 'swiftshader_revision': '4d97f36abd208230b0f3c591af0619f3cc96c533', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -72,7 +72,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. - 'boringssl_revision': '3120950b1e27635ee9b9d167052ce11ce9c96fd4', + 'boringssl_revision': '52586f952ecb624f823eb9ee5ef2eb41e644e7f5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'fc9479ad5e3b6a9863ba6d8517535d9b7a8e95f8', + 'catapult_revision': '08d8c9f0860202115b653dc31a06d366a5978623', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -163,7 +163,7 @@ Var('chromium_git') + '/chromium/deps/hunspell_dictionaries.git' + '@' + 'dc6e7c25bf47cbfb466e0701fd2728b4a12e79d5', 'src/third_party/leveldatabase/src': - Var('chromium_git') + '/external/leveldb.git' + '@' + 'a53934a3ae1244679f812d998a4f16f2c7f309a6', + Var('chromium_git') + '/external/leveldb.git' + '@' + '8415f00eeedd96934d3578572d3802900e61a556', 'src/third_party/snappy/src': Var('chromium_git') + '/external/github.com/google/snappy.git' + '@' + '513df5fb5a2d51146f409141f9eb8736935cc486', @@ -208,7 +208,7 @@ Var('chromium_git') + '/webm/libvpx.git' + '@' + '4e16f7070354fa91c1a617ee18335e580a0b8c8c', 'src/third_party/ffmpeg': - Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'ddb09a0d5aaf6aacf846355b7629953b2496b8ea', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'f82eb1989c0cdd5ed179ee4979ffb18a8030c78a', 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '2f6478eb8d40f1766a96b5b033ed26c0c2244589',
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index 1bdf66c6..6c8f9675 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS
@@ -29,6 +29,7 @@ "+components/url_formatter", "+components/user_prefs", "+components/visitedlink/browser", + "+components/viz/common", "+components/webdata/common", "+content/public/browser",
diff --git a/android_webview/browser/aw_metrics_service_client.cc b/android_webview/browser/aw_metrics_service_client.cc index 5d476f2..b720598 100644 --- a/android_webview/browser/aw_metrics_service_client.cc +++ b/android_webview/browser/aw_metrics_service_client.cc
@@ -16,6 +16,7 @@ #include "base/i18n/rtl.h" #include "base/lazy_instance.h" #include "base/path_service.h" +#include "base/strings/string16.h" #include "base/threading/sequenced_worker_pool.h" #include "components/metrics/call_stack_profile_metrics_provider.h" #include "components/metrics/enabled_state_provider.h" @@ -146,7 +147,7 @@ g_client_id_guid.Get()); metrics_state_manager_ = metrics::MetricsStateManager::Create( - pref_service_, this, base::Bind(&StoreClientInfo), + pref_service_, this, base::string16(), base::Bind(&StoreClientInfo), base::Bind(&LoadClientInfo)); metrics_service_.reset(new ::metrics::MetricsService(
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc index 4e3c633..b82665f 100644 --- a/android_webview/browser/hardware_renderer.cc +++ b/android_webview/browser/hardware_renderer.cc
@@ -17,7 +17,7 @@ #include "cc/output/compositor_frame.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "ui/gfx/transform.h" #include "ui/gl/gl_bindings.h" @@ -29,7 +29,7 @@ surfaces_(SurfacesInstance::GetOrCreateInstance()), frame_sink_id_(surfaces_->AllocateFrameSinkId()), local_surface_id_allocator_( - base::MakeUnique<cc::LocalSurfaceIdAllocator>()), + base::MakeUnique<viz::LocalSurfaceIdAllocator>()), last_committed_layer_tree_frame_sink_id_(0u), last_submitted_layer_tree_frame_sink_id_(0u) { DCHECK(last_egl_context_); @@ -158,21 +158,21 @@ draw_info->clip_right - draw_info->clip_left, draw_info->clip_bottom - draw_info->clip_top); surfaces_->DrawAndSwap(viewport, clip, transform, surface_size_, - cc::SurfaceId(frame_sink_id_, child_id_)); + viz::SurfaceId(frame_sink_id_, child_id_)); } void HardwareRenderer::AllocateSurface() { DCHECK(!child_id_.is_valid()); child_id_ = local_surface_id_allocator_->GenerateId(); - surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); + surfaces_->AddChildId(viz::SurfaceId(frame_sink_id_, child_id_)); } void HardwareRenderer::DestroySurface() { DCHECK(child_id_.is_valid()); - surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); + surfaces_->RemoveChildId(viz::SurfaceId(frame_sink_id_, child_id_)); support_->EvictCurrentSurface(); - child_id_ = cc::LocalSurfaceId(); + child_id_ = viz::LocalSurfaceId(); } void HardwareRenderer::DidReceiveCompositorFrameAck( @@ -192,7 +192,7 @@ } void HardwareRenderer::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} // static
diff --git a/android_webview/browser/hardware_renderer.h b/android_webview/browser/hardware_renderer.h index 64056d89..7099f1b2 100644 --- a/android_webview/browser/hardware_renderer.h +++ b/android_webview/browser/hardware_renderer.h
@@ -12,13 +12,16 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/surface_id.h" struct AwDrawGLInfo; namespace cc { class CompositorFrameSinkSupport; +} + +namespace viz { class LocalSurfaceIdAllocator; } @@ -55,7 +58,7 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; void ReturnChildFrame(std::unique_ptr<ChildFrame> child_frame); @@ -89,11 +92,11 @@ std::unique_ptr<ChildFrame> child_frame_; const scoped_refptr<SurfacesInstance> surfaces_; - cc::FrameSinkId frame_sink_id_; - const std::unique_ptr<cc::LocalSurfaceIdAllocator> + viz::FrameSinkId frame_sink_id_; + const std::unique_ptr<viz::LocalSurfaceIdAllocator> local_surface_id_allocator_; std::unique_ptr<cc::CompositorFrameSinkSupport> support_; - cc::LocalSurfaceId child_id_; + viz::LocalSurfaceId child_id_; CompositorID compositor_id_; // HardwareRenderer guarantees resources are returned in the order of // layer_tree_frame_sink_id, and resources for old output surfaces are
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc index de48534..f8a2ec6 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -254,7 +254,7 @@ cache_params.max_size = 20 * 1024 * 1024; // 20M cache_params.path = cache_path_; builder.EnableHttpCache(cache_params); - builder.SetFileTaskRunner( + builder.SetCacheThreadTaskRunner( BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); net::HttpNetworkSession::Params network_session_params;
diff --git a/android_webview/browser/surfaces_instance.cc b/android_webview/browser/surfaces_instance.cc index eddadbe..3064b23 100644 --- a/android_webview/browser/surfaces_instance.cc +++ b/android_webview/browser/surfaces_instance.cc
@@ -21,7 +21,7 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/transform.h" @@ -55,7 +55,7 @@ settings.should_clear_root_render_pass = false; frame_sink_manager_.reset(new cc::FrameSinkManager); - local_surface_id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); + local_surface_id_allocator_.reset(new viz::LocalSurfaceIdAllocator()); constexpr bool is_root = true; constexpr bool handles_frame_sink_id_invalidation = true; @@ -102,7 +102,7 @@ LOG(FATAL) << "Render thread context loss"; } -cc::FrameSinkId SurfacesInstance::AllocateFrameSinkId() { +viz::FrameSinkId SurfacesInstance::AllocateFrameSinkId() { return frame_sink_id_allocator_.NextFrameSinkId(); } @@ -114,7 +114,7 @@ const gfx::Rect& clip, const gfx::Transform& transform, const gfx::Size& frame_size, - const cc::SurfaceId& child_id) { + const viz::SurfaceId& child_id) { DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) != child_ids_.end()); @@ -159,7 +159,7 @@ display_->DrawAndSwap(); } -void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { +void SurfacesInstance::AddChildId(const viz::SurfaceId& child_id) { DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == child_ids_.end()); child_ids_.push_back(child_id); @@ -167,7 +167,7 @@ SetSolidColorRootFrame(); } -void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { +void SurfacesInstance::RemoveChildId(const viz::SurfaceId& child_id) { auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); DCHECK(itr != child_ids_.end()); child_ids_.erase(itr); @@ -206,7 +206,7 @@ void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} void SurfacesInstance::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} void SurfacesInstance::ReclaimResources(
diff --git a/android_webview/browser/surfaces_instance.h b/android_webview/browser/surfaces_instance.h index cc8c89a..7fd8ce2 100644 --- a/android_webview/browser/surfaces_instance.h +++ b/android_webview/browser/surfaces_instance.h
@@ -11,16 +11,15 @@ #include "base/memory/ref_counted.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/display_client.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/frame_sink_id_allocator.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/frame_sink_id_allocator.h" +#include "components/viz/common/surface_id.h" namespace cc { class BeginFrameSource; class CompositorFrameSinkSupport; class Display; class FrameSinkManager; -class LocalSurfaceIdAllocator; } namespace gfx { @@ -29,6 +28,10 @@ class Transform; } +namespace viz { +class LocalSurfaceIdAllocator; +} + namespace android_webview { class ParentOutputSurface; @@ -39,17 +42,17 @@ public: static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); - cc::FrameSinkId AllocateFrameSinkId(); + viz::FrameSinkId AllocateFrameSinkId(); cc::FrameSinkManager* GetFrameSinkManager(); void DrawAndSwap(const gfx::Size& viewport, const gfx::Rect& clip, const gfx::Transform& transform, const gfx::Size& frame_size, - const cc::SurfaceId& child_id); + const viz::SurfaceId& child_id); - void AddChildId(const cc::SurfaceId& child_id); - void RemoveChildId(const cc::SurfaceId& child_id); + void AddChildId(const viz::SurfaceId& child_id); + void RemoveChildId(const viz::SurfaceId& child_id); private: friend class base::RefCounted<SurfacesInstance>; @@ -68,25 +71,25 @@ void DidReceiveCompositorFrameAck( const std::vector<cc::ReturnedResource>& resources) override; void OnBeginFrame(const cc::BeginFrameArgs& args) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; void SetSolidColorRootFrame(); - cc::FrameSinkIdAllocator frame_sink_id_allocator_; + viz::FrameSinkIdAllocator frame_sink_id_allocator_; - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; std::unique_ptr<cc::FrameSinkManager> frame_sink_manager_; std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; std::unique_ptr<cc::Display> display_; - std::unique_ptr<cc::LocalSurfaceIdAllocator> local_surface_id_allocator_; + std::unique_ptr<viz::LocalSurfaceIdAllocator> local_surface_id_allocator_; std::unique_ptr<cc::CompositorFrameSinkSupport> support_; - cc::LocalSurfaceId root_id_; - std::vector<cc::SurfaceId> child_ids_; + viz::LocalSurfaceId root_id_; + std::vector<viz::SurfaceId> child_ids_; // This is owned by |display_|. ParentOutputSurface* output_surface_;
diff --git a/android_webview/common/crash_reporter/crash_keys.cc b/android_webview/common/crash_reporter/crash_keys.cc index 7453366e..f3549c5 100644 --- a/android_webview/common/crash_reporter/crash_keys.cc +++ b/android_webview/common/crash_reporter/crash_keys.cc
@@ -32,6 +32,11 @@ const char kZeroEncodeDetails[] = "zero-encode-details"; +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +const char kBeginMainFrameHangCompositorState[] = + "begin-main-frame-hang-compositor-state"; + size_t RegisterWebViewCrashKeys() { base::debug::CrashKey fixed_keys[] = { {"AW_WHITELISTED_DEBUG_KEY", kSmallSize}, @@ -129,6 +134,10 @@ // Temporary for https://crbug.com/685996. {"user-cloud-policy-manager-connect-trace", kMediumSize}, + + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + {kBeginMainFrameHangCompositorState, kSmallSize}, }; // This dynamic set of keys is used for sets of key value pairs when gathering
diff --git a/android_webview/java/src/org/chromium/android_webview/AwAutofillClient.java b/android_webview/java/src/org/chromium/android_webview/AwAutofillClient.java index 31482648..2e6346f 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwAutofillClient.java +++ b/android_webview/java/src/org/chromium/android_webview/AwAutofillClient.java
@@ -56,21 +56,28 @@ nativeDismissed(mNativeAwAutofillClient); return; } - mAutofillPopup = new AutofillPopup(context, anchorView, new AutofillDelegate() { - @Override - public void dismissed() { - nativeDismissed(mNativeAwAutofillClient); - } - @Override - public void suggestionSelected(int listIndex) { - nativeSuggestionSelected(mNativeAwAutofillClient, listIndex); - } - @Override - public void deleteSuggestion(int listIndex) {} + try { + mAutofillPopup = new AutofillPopup(context, anchorView, new AutofillDelegate() { + @Override + public void dismissed() { + nativeDismissed(mNativeAwAutofillClient); + } + @Override + public void suggestionSelected(int listIndex) { + nativeSuggestionSelected(mNativeAwAutofillClient, listIndex); + } + @Override + public void deleteSuggestion(int listIndex) {} - @Override - public void accessibilityFocusCleared() {} - }); + @Override + public void accessibilityFocusCleared() {} + }); + } catch (RuntimeException e) { + // Deliberately swallowing exception because bad fraemwork implementation can + // throw exceptions in ListPopupWindow constructor. + nativeDismissed(mNativeAwAutofillClient); + return; + } } mAutofillPopup.filterAndShow(suggestions, isRtl, Color.TRANSPARENT /* backgroundColor */, Color.TRANSPARENT /* dividerColor */, 0 /* dropdownItemHeight */, 0 /* margin */);
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index dabc79b..697d1b0 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -123,8 +123,7 @@ private static class ForceAuxiliaryBitmapRendering { private static final boolean sResult = lazyCheck(); private static boolean lazyCheck() { - return "goldfish".equals(Build.HARDWARE) || "ranchu".equals(Build.HARDWARE) - || !nativeHasRequiredHardwareExtensions(); + return !nativeHasRequiredHardwareExtensions(); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java index 4dd1894a..1da23803 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
@@ -27,12 +27,12 @@ import org.chromium.android_webview.test.util.CommonResources; import org.chromium.android_webview.test.util.JSUtils; import org.chromium.base.annotations.SuppressFBWarnings; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.parameter.ParameterizedTest; import org.chromium.content.browser.BindingManager; -import org.chromium.content.browser.ChildProcessConnection; import org.chromium.content.browser.ChildProcessLauncherHelper; import org.chromium.content_public.common.ContentUrlConstants; import org.chromium.net.test.EmbeddedTestServer;
diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc index 803aa82..b4096c6 100644 --- a/ash/accelerators/accelerator_commands.cc +++ b/ash/accelerators/accelerator_commands.cc
@@ -10,10 +10,34 @@ #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "base/metrics/user_metrics.h" +#include "ui/display/manager/display_manager.h" +#include "ui/display/manager/managed_display_info.h" namespace ash { namespace accelerators { +bool IsInternalDisplayZoomEnabled() { + display::DisplayManager* display_manager = Shell::Get()->display_manager(); + return display_manager->IsDisplayUIScalingEnabled() || + display_manager->IsInUnifiedMode(); +} + +bool ZoomInternalDisplay(bool up) { + if (up) + base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up")); + else + base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down")); + + display::DisplayManager* display_manager = Shell::Get()->display_manager(); + return display_manager->ZoomInternalDisplay(up); +} + +void ResetInternalDisplayZoom() { + base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset")); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); + display_manager->ResetInternalDisplayZoom(); +} + bool ToggleMinimized() { aura::Window* window = wm::GetActiveWindow(); // Attempt to restore the window that would be cycled through next from
diff --git a/ash/accelerators/accelerator_commands.h b/ash/accelerators/accelerator_commands.h index df576ba..255d0c2 100644 --- a/ash/accelerators/accelerator_commands.h +++ b/ash/accelerators/accelerator_commands.h
@@ -12,6 +12,15 @@ namespace ash { namespace accelerators { +// True if the desktop zoom accelerator is enabled. +ASH_EXPORT bool IsInternalDisplayZoomEnabled(); + +// Change internal display zooming up or down. +ASH_EXPORT bool ZoomInternalDisplay(bool up); + +// Reset the display zooming to the default state. +ASH_EXPORT void ResetInternalDisplayZoom(); + // Minimizes the active window, if present. If no windows are active, restores // the first unminimized window. Returns true if a window was minimized or // restored.
diff --git a/ash/accelerators/accelerator_commands_aura.cc b/ash/accelerators/accelerator_commands_aura.cc index ed79a48..11e7b06 100644 --- a/ash/accelerators/accelerator_commands_aura.cc +++ b/ash/accelerators/accelerator_commands_aura.cc
@@ -8,8 +8,6 @@ #include "ash/wm/screen_pinning_controller.h" #include "ash/wm/window_state.h" #include "base/metrics/user_metrics.h" -#include "ui/display/manager/display_manager.h" -#include "ui/display/manager/managed_display_info.h" namespace ash { namespace accelerators { @@ -20,28 +18,6 @@ Shell::Get()->SetTouchHudProjectionEnabled(!enabled); } -bool IsInternalDisplayZoomEnabled() { - display::DisplayManager* display_manager = Shell::Get()->display_manager(); - return display_manager->IsDisplayUIScalingEnabled() || - display_manager->IsInUnifiedMode(); -} - -bool ZoomInternalDisplay(bool up) { - if (up) - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up")); - else - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down")); - - display::DisplayManager* display_manager = Shell::Get()->display_manager(); - return display_manager->ZoomInternalDisplay(up); -} - -void ResetInternalDisplayZoom() { - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset")); - display::DisplayManager* display_manager = Shell::Get()->display_manager(); - display_manager->ResetInternalDisplayZoom(); -} - void Unpin() { aura::Window* pinned_window = Shell::Get()->screen_pinning_controller()->pinned_window();
diff --git a/ash/accelerators/accelerator_commands_aura.h b/ash/accelerators/accelerator_commands_aura.h index 0796c32..5464782c8 100644 --- a/ash/accelerators/accelerator_commands_aura.h +++ b/ash/accelerators/accelerator_commands_aura.h
@@ -15,15 +15,6 @@ // Toggles touch HUD. ASH_EXPORT void ToggleTouchHudProjection(); -// True if the desktop zoom accelerator is enabled. -bool IsInternalDisplayZoomEnabled(); - -// Change internal display zooming up or down. -ASH_EXPORT bool ZoomInternalDisplay(bool up); - -// Reset the display zooming to the default state. -ASH_EXPORT void ResetInternalDisplayZoom(); - // If it is in the pinned mode, exit from it. ASH_EXPORT void Unpin();
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 452df17..9393005e 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc
@@ -11,6 +11,7 @@ #include "ash/accelerators/debug_commands.h" #include "ash/accessibility_delegate.h" #include "ash/accessibility_types.h" +#include "ash/display/display_configuration_controller.h" #include "ash/focus_cycler.h" #include "ash/ime/ime_controller.h" #include "ash/ime/ime_switch_type.h" @@ -62,6 +63,9 @@ #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_sequence.h" #include "ui/compositor/layer_animator.h" +#include "ui/display/display.h" +#include "ui/display/manager/managed_display_info.h" +#include "ui/display/screen.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/message_center/message_center.h" @@ -239,6 +243,12 @@ Shell::Get()->media_controller()->HandleMediaPrevTrack(); } +void HandleToggleMirrorMode() { + base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); + bool mirror = !Shell::Get()->display_manager()->IsInMirrorMode(); + Shell::Get()->display_configuration_controller()->SetMirrorMode(mirror); +} + bool CanHandleNewIncognitoWindow() { return Shell::Get()->shell_delegate()->IsIncognitoAllowed(); } @@ -295,6 +305,37 @@ // Else: consume the Ctrl+Space ET_KEY_RELEASED event but do not do anything. } +display::Display::Rotation GetNextRotation(display::Display::Rotation current) { + switch (current) { + case display::Display::ROTATE_0: + return display::Display::ROTATE_90; + case display::Display::ROTATE_90: + return display::Display::ROTATE_180; + case display::Display::ROTATE_180: + return display::Display::ROTATE_270; + case display::Display::ROTATE_270: + return display::Display::ROTATE_0; + } + NOTREACHED() << "Unknown rotation:" << current; + return display::Display::ROTATE_0; +} + +// Rotates the screen. +void HandleRotateScreen() { + if (Shell::Get()->display_manager()->IsInUnifiedMode()) + return; + + base::RecordAction(UserMetricsAction("Accel_Rotate_Screen")); + gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); + display::Display display = + display::Screen::GetScreen()->GetDisplayNearestPoint(point); + const display::ManagedDisplayInfo& display_info = + Shell::Get()->display_manager()->GetDisplayInfo(display.id()); + Shell::Get()->display_configuration_controller()->SetDisplayRotation( + display.id(), GetNextRotation(display_info.GetActiveRotation()), + display::Display::ROTATION_SOURCE_USER); +} + void HandleRestoreTab() { base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); Shell::Get()->new_window_controller()->RestoreTab(); @@ -359,6 +400,16 @@ Shell::Get()->new_window_controller()->ShowTaskManager(); } +void HandleSwapPrimaryDisplay() { + base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); + + // TODO(rjkroege): This is not correct behaviour on devices with more than + // two screens. Behave the same as mirroring: fail and notify if there are + // three or more screens. + Shell::Get()->display_configuration_controller()->SetPrimaryDisplayId( + Shell::Get()->display_manager()->GetSecondaryDisplay().id()); +} + bool CanHandleSwitchIme(const ui::Accelerator& accelerator) { return Shell::Get()->ime_controller()->CanSwitchImeWithAccelerator( accelerator); @@ -409,6 +460,11 @@ Shell::Get()->window_selector_controller()->ToggleOverview(); } +void HandleToggleUnifiedDesktop() { + Shell::Get()->display_manager()->SetUnifiedDesktopEnabled( + !Shell::Get()->display_manager()->unified_desktop_enabled()); +} + bool CanHandleWindowSnap() { aura::Window* active_window = wm::GetActiveWindow(); if (!active_window) @@ -915,12 +971,15 @@ case DEBUG_PRINT_VIEW_HIERARCHY: case DEBUG_PRINT_WINDOW_HIERARCHY: case DEBUG_SHOW_TOAST: + case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: case DEBUG_TOGGLE_TOUCH_PAD: case DEBUG_TOGGLE_TOUCH_SCREEN: case DEBUG_TOGGLE_TOUCH_VIEW: case DEBUG_TOGGLE_WALLPAPER_MODE: case DEBUG_TRIGGER_CRASH: return debug::DebugAcceleratorsEnabled(); + case DEV_TOGGLE_UNIFIED_DESKTOP: + return debug::DeveloperAcceleratorsEnabled(); case DISABLE_CAPS_LOCK: return CanHandleDisableCapsLock(previous_accelerator); case LOCK_SCREEN: @@ -931,12 +990,20 @@ return CanCycleInputMethod(); case PREVIOUS_IME: return CanCycleInputMethod(); + case ROTATE_SCREEN: + return true; + case SCALE_UI_DOWN: + case SCALE_UI_RESET: + case SCALE_UI_UP: + return accelerators::IsInternalDisplayZoomEnabled(); case SHOW_MESSAGE_CENTER_BUBBLE: return CanHandleShowMessageCenterBubble(); case SHOW_STYLUS_TOOLS: return CanHandleShowStylusTools(); case START_VOICE_INTERACTION: return CanHandleStartVoiceInteraction(); + case SWAP_PRIMARY_DISPLAY: + return display::Screen::GetScreen()->GetNumDisplays() > 1; case SWITCH_IME: return CanHandleSwitchIme(accelerator); case SWITCH_TO_PREVIOUS_USER: @@ -946,6 +1013,8 @@ return CanHandleToggleAppList(accelerator, previous_accelerator); case TOGGLE_CAPS_LOCK: return CanHandleToggleCapsLock(accelerator, previous_accelerator); + case TOGGLE_MIRROR_MODE: + return true; case WINDOW_CYCLE_SNAP_LEFT: case WINDOW_CYCLE_SNAP_RIGHT: return CanHandleWindowSnap(); @@ -1043,6 +1112,7 @@ case DEBUG_PRINT_VIEW_HIERARCHY: case DEBUG_PRINT_WINDOW_HIERARCHY: case DEBUG_SHOW_TOAST: + case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: case DEBUG_TOGGLE_TOUCH_PAD: case DEBUG_TOGGLE_TOUCH_SCREEN: case DEBUG_TOGGLE_TOUCH_VIEW: @@ -1050,6 +1120,9 @@ case DEBUG_TRIGGER_CRASH: debug::PerformDebugActionIfEnabled(action); break; + case DEV_TOGGLE_UNIFIED_DESKTOP: + HandleToggleUnifiedDesktop(); + break; case DISABLE_CAPS_LOCK: HandleDisableCapsLock(); break; @@ -1149,12 +1222,24 @@ case PRINT_UI_HIERARCHIES: debug::PrintUIHierarchies(); break; + case ROTATE_SCREEN: + HandleRotateScreen(); + break; case RESTORE_TAB: HandleRestoreTab(); break; case ROTATE_WINDOW: HandleRotateActiveWindow(); break; + case SCALE_UI_DOWN: + accelerators::ZoomInternalDisplay(false /* down */); + break; + case SCALE_UI_RESET: + accelerators::ResetInternalDisplayZoom(); + break; + case SCALE_UI_UP: + accelerators::ZoomInternalDisplay(true /* up */); + break; case SHOW_IME_MENU_BUBBLE: HandleShowImeMenuBubble(); break; @@ -1179,6 +1264,9 @@ case SUSPEND: HandleSuspend(); break; + case SWAP_PRIMARY_DISPLAY: + HandleSwapPrimaryDisplay(); + break; case SWITCH_IME: HandleSwitchIme(accelerator); break; @@ -1203,6 +1291,9 @@ case TOGGLE_MAXIMIZED: accelerators::ToggleMaximized(); break; + case TOGGLE_MIRROR_MODE: + HandleToggleMirrorMode(); + break; case TOGGLE_OVERVIEW: HandleToggleOverview(); break;
diff --git a/ash/accelerators/accelerator_controller_delegate_aura.cc b/ash/accelerators/accelerator_controller_delegate_aura.cc index 24633933..506ca89 100644 --- a/ash/accelerators/accelerator_controller_delegate_aura.cc +++ b/ash/accelerators/accelerator_controller_delegate_aura.cc
@@ -13,7 +13,6 @@ #include "ash/accelerators/debug_commands.h" #include "ash/accessibility_types.h" #include "ash/debug.h" -#include "ash/display/display_configuration_controller.h" #include "ash/host/ash_window_tree_host.h" #include "ash/magnifier/magnification_controller.h" #include "ash/public/cpp/shell_window_ids.h" @@ -34,7 +33,6 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/base/accelerators/accelerator.h" #include "ui/display/manager/display_manager.h" -#include "ui/display/screen.h" #include "ui/events/event.h" #include "ui/events/keycodes/keyboard_codes.h" @@ -63,37 +61,6 @@ } } -display::Display::Rotation GetNextRotation(display::Display::Rotation current) { - switch (current) { - case display::Display::ROTATE_0: - return display::Display::ROTATE_90; - case display::Display::ROTATE_90: - return display::Display::ROTATE_180; - case display::Display::ROTATE_180: - return display::Display::ROTATE_270; - case display::Display::ROTATE_270: - return display::Display::ROTATE_0; - } - NOTREACHED() << "Unknown rotation:" << current; - return display::Display::ROTATE_0; -} - -// Rotates the screen. -void HandleRotateScreen() { - if (Shell::Get()->display_manager()->IsInUnifiedMode()) - return; - - base::RecordAction(UserMetricsAction("Accel_Rotate_Screen")); - gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); - display::Display display = - display::Screen::GetScreen()->GetDisplayNearestPoint(point); - const display::ManagedDisplayInfo& display_info = - Shell::Get()->display_manager()->GetDisplayInfo(display.id()); - Shell::Get()->display_configuration_controller()->SetDisplayRotation( - display.id(), GetNextRotation(display_info.GetActiveRotation()), - display::Display::ROTATION_SOURCE_USER); -} - void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); DCHECK(screenshot_delegate); @@ -123,22 +90,6 @@ window_state->GetStateType() == wm::WINDOW_STATE_TYPE_PINNED; } -void HandleSwapPrimaryDisplay() { - base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); - - // TODO(rjkroege): This is not correct behaviour on devices with more than - // two screens. Behave the same as mirroring: fail and notify if there are - // three or more screens. - Shell::Get()->display_configuration_controller()->SetPrimaryDisplayId( - Shell::Get()->display_manager()->GetSecondaryDisplay().id()); -} - -void HandleToggleMirrorMode() { - base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); - bool mirror = !Shell::Get()->display_manager()->IsInMirrorMode(); - Shell::Get()->display_configuration_controller()->SetMirrorMode(mirror); -} - bool CanHandleTouchHud() { return RootWindowController::ForTargetRootWindow()->touch_hud_debug(); } @@ -169,29 +120,21 @@ // NOTE: When adding a new accelerator that only depends on //ash/common code, // add it to accelerator_controller.cc instead. See class comment. switch (action) { - case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: case DEBUG_TOGGLE_SHOW_FPS_COUNTER: case DEBUG_TOGGLE_SHOW_PAINT_RECTS: case DEV_ADD_REMOVE_DISPLAY: case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: - case DEV_TOGGLE_UNIFIED_DESKTOP: case LOCK_PRESSED: case LOCK_RELEASED: case MAGNIFY_SCREEN_ZOOM_IN: case MAGNIFY_SCREEN_ZOOM_OUT: case POWER_PRESSED: case POWER_RELEASED: - case ROTATE_SCREEN: - case SCALE_UI_DOWN: - case SCALE_UI_RESET: - case SCALE_UI_UP: case SHOW_MESSAGE_CENTER_BUBBLE: - case SWAP_PRIMARY_DISPLAY: case TAKE_PARTIAL_SCREENSHOT: case TAKE_SCREENSHOT: case TAKE_WINDOW_SCREENSHOT: - case TOGGLE_MIRROR_MODE: case TOUCH_HUD_CLEAR: case TOUCH_HUD_MODE_CHANGE: case TOUCH_HUD_PROJECTION_TOGGLE: @@ -209,22 +152,16 @@ const ui::Accelerator& accelerator, const ui::Accelerator& previous_accelerator) { switch (action) { - case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: case DEBUG_TOGGLE_SHOW_FPS_COUNTER: case DEBUG_TOGGLE_SHOW_PAINT_RECTS: return debug::DebugAcceleratorsEnabled(); case DEV_ADD_REMOVE_DISPLAY: case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: - case DEV_TOGGLE_UNIFIED_DESKTOP: return debug::DeveloperAcceleratorsEnabled(); case MAGNIFY_SCREEN_ZOOM_IN: case MAGNIFY_SCREEN_ZOOM_OUT: return CanHandleMagnifyScreen(); - case SCALE_UI_DOWN: - case SCALE_UI_RESET: - case SCALE_UI_UP: - return accelerators::IsInternalDisplayZoomEnabled(); case UNPIN: return CanHandleUnpin(); @@ -233,16 +170,12 @@ case LOCK_RELEASED: case POWER_PRESSED: case POWER_RELEASED: - case ROTATE_SCREEN: case TAKE_PARTIAL_SCREENSHOT: case TAKE_SCREENSHOT: case TAKE_WINDOW_SCREENSHOT: - case TOGGLE_MIRROR_MODE: case TOUCH_HUD_PROJECTION_TOGGLE: return true; - case SWAP_PRIMARY_DISPLAY: - return display::Screen::GetScreen()->GetNumDisplays() > 1; case TOUCH_HUD_CLEAR: case TOUCH_HUD_MODE_CHANGE: return CanHandleTouchHud(); @@ -258,9 +191,6 @@ AcceleratorAction action, const ui::Accelerator& accelerator) { switch (action) { - case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: - Shell::Get()->display_manager()->ToggleDisplayScaleFactor(); - break; case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: debug::ToggleShowDebugBorders(); break; @@ -276,10 +206,6 @@ case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen(); break; - case DEV_TOGGLE_UNIFIED_DESKTOP: - Shell::Get()->display_manager()->SetUnifiedDesktopEnabled( - !Shell::Get()->display_manager()->unified_desktop_enabled()); - break; case LOCK_PRESSED: case LOCK_RELEASED: Shell::Get()->power_button_controller()->OnLockButtonEvent( @@ -304,21 +230,6 @@ // D-BUS), but we consume them to prevent them from getting // passed to apps -- see http://crbug.com/146609. break; - case ROTATE_SCREEN: - HandleRotateScreen(); - break; - case SCALE_UI_DOWN: - accelerators::ZoomInternalDisplay(false /* down */); - break; - case SCALE_UI_RESET: - accelerators::ResetInternalDisplayZoom(); - break; - case SCALE_UI_UP: - accelerators::ZoomInternalDisplay(true /* up */); - break; - case SWAP_PRIMARY_DISPLAY: - HandleSwapPrimaryDisplay(); - break; case TAKE_PARTIAL_SCREENSHOT: HandleTakePartialScreenshot(screenshot_delegate_.get()); break; @@ -328,9 +239,6 @@ case TAKE_WINDOW_SCREENSHOT: HandleTakeWindowScreenshot(screenshot_delegate_.get()); break; - case TOGGLE_MIRROR_MODE: - HandleToggleMirrorMode(); - break; case TOUCH_HUD_CLEAR: HandleTouchHudClear(); break;
diff --git a/ash/accelerators/debug_commands.cc b/ash/accelerators/debug_commands.cc index 611ac23..49fce5f 100644 --- a/ash/accelerators/debug_commands.cc +++ b/ash/accelerators/debug_commands.cc
@@ -23,6 +23,7 @@ #include "base/strings/utf_string_conversions.h" #include "ui/compositor/debug_utils.h" #include "ui/compositor/layer.h" +#include "ui/display/manager/display_manager.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_rep.h" @@ -195,6 +196,9 @@ ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */, base::ASCIIToUTF16("Dismiss"))); break; + case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: + Shell::Get()->display_manager()->ToggleDisplayScaleFactor(); + break; case DEBUG_TOGGLE_TOUCH_PAD: HandleToggleTouchpad(); break;
diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc index 9812cb8..10c6b451 100644 --- a/ash/app_list/app_list_presenter_delegate_unittest.cc +++ b/ash/app_list/app_list_presenter_delegate_unittest.cc
@@ -23,11 +23,13 @@ #include "ui/app_list/app_list_switches.h" #include "ui/app_list/views/app_list_main_view.h" #include "ui/app_list/views/app_list_view.h" +#include "ui/app_list/views/search_box_view.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/events/test/event_generator.h" +#include "ui/views/controls/textfield/textfield.h" namespace ash { namespace { @@ -61,12 +63,11 @@ void SetUp() override { AshTestBase::SetUp(); - // If the current test is parameterized. - if (testing::UnitTest::GetInstance()->current_test_info()->value_param()) { - test_with_fullscreen_ = GetParam(); - if (test_with_fullscreen_) - EnableFullscreenAppList(); + if (testing::UnitTest::GetInstance()->current_test_info()->value_param() && + GetParam()) { + EnableFullscreenAppList(); } + // Make the display big enough to hold the app list. UpdateDisplay("1024x768"); } @@ -78,16 +79,66 @@ private: test::TestAppListViewPresenterImpl app_list_presenter_impl_; - bool test_with_fullscreen_; base::test::ScopedFeatureList scoped_feature_list_; DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest); }; +// TODO(Newcomer): Remove FullscreenAppListPresenterDelegateTest when the +// fullscreen app list becomes default. +class FullscreenAppListPresenterDelegateTest + : public test::AshTestBase, + public testing::WithParamInterface<bool> { + public: + FullscreenAppListPresenterDelegateTest() {} + ~FullscreenAppListPresenterDelegateTest() override {} + + app_list::AppListPresenterImpl* app_list_presenter_impl() { + return &app_list_presenter_impl_; + } + + // testing::Test: + void SetUp() override { + AshTestBase::SetUp(); + + scoped_feature_list_.InitAndEnableFeature( + app_list::features::kEnableFullscreenAppList); + + // Make the display big enough to hold the app list. + UpdateDisplay("1024x768"); + } + + // Whether to run the test with mouse or gesture events. + bool TestMouseEventParam() { return GetParam(); } + + gfx::Point GetPointOutsideSearchbox() { + return app_list_presenter_impl()->GetView()->GetBoundsInScreen().origin(); + } + + gfx::Point GetPointInsideSearchbox() { + return app_list_presenter_impl_.GetView() + ->search_box_view() + ->GetBoundsInScreen() + .origin(); + } + + private: + test::TestAppListViewPresenterImpl app_list_presenter_impl_; + base::test::ScopedFeatureList scoped_feature_list_; + + DISALLOW_COPY_AND_ASSIGN(FullscreenAppListPresenterDelegateTest); +}; + // Instantiate the Boolean which is used to toggle the Fullscreen app list in // the parameterized tests. INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool()); +// Instantiate the Boolean which is used to toggle mouse and touch events in +// the parameterized tests. +INSTANTIATE_TEST_CASE_P(, + FullscreenAppListPresenterDelegateTest, + testing::Bool()); + // Tests that app list hides when focus moves to a normal window. TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) { app_list_presenter_impl()->Show(GetPrimaryDisplayId()); @@ -136,7 +187,7 @@ EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); } -// Tests that clicking outside the app-list bubble closes it. +// Tests that tapping outside the app-list bubble closes it. TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) { app_list_presenter_impl()->Show(GetPrimaryDisplayId()); @@ -149,7 +200,7 @@ generator.GestureTapAt(app_window_bounds.CenterPoint()); EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); - // Click outside the bubble. This should close it. + // Tap outside the bubble. This should close it. gfx::Point point_outside = gfx::Point(app_window_bounds.right(), app_window_bounds.y()) + gfx::Vector2d(10, 0); @@ -196,7 +247,7 @@ // which is much bigger than the actual app list size). app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); - int app_list_view_top = + const int app_list_view_top = app_list->anchor_rect().y() - app_list->bounds().height() / 2; const int kMinimalAppListMargin = 10; @@ -205,9 +256,9 @@ // Tests that the app list initializes in fullscreen with side shelf alignment // and that the state transitions via text input act properly. -TEST_F(AppListPresenterDelegateTest, SideShelfAlignmentTextStateTransitions) { +TEST_F(FullscreenAppListPresenterDelegateTest, + SideShelfAlignmentTextStateTransitions) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT); // Open the app list with side shelf alignment, then check that it is in @@ -234,9 +285,9 @@ // Tests that the app list initializes in peeking with bottom shelf alignment // and that the state transitions via text input act properly. -TEST_F(AppListPresenterDelegateTest, BottomShelfAlignmentTextStateTransitions) { +TEST_F(FullscreenAppListPresenterDelegateTest, + BottomShelfAlignmentTextStateTransitions) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); EXPECT_FALSE(app_list->is_fullscreen()); @@ -256,9 +307,9 @@ // Tests that the app list initializes in fullscreen with maximize mode active // and that the state transitions via text input act properly. -TEST_F(AppListPresenterDelegateTest, MaximizeModeTextStateTransitions) { +TEST_F(FullscreenAppListPresenterDelegateTest, + MaximizeModeTextStateTransitions) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); EnableMaximizeMode(true); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); @@ -281,10 +332,9 @@ // Tests that the app list state responds correctly to maximize mode being // enabled while the app list is being shown. -TEST_F(AppListPresenterDelegateTest, +TEST_F(FullscreenAppListPresenterDelegateTest, PeekingToFullscreenWhenMaximizeModeIsActive) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); @@ -313,9 +363,9 @@ // Tests that the app list state responds correctly to maximize mode being // enabled while the app list is being shown with half launcher. -TEST_F(AppListPresenterDelegateTest, HalfToFullscreenWhenMaximizeModeIsActive) { +TEST_F(FullscreenAppListPresenterDelegateTest, + HalfToFullscreenWhenMaximizeModeIsActive) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); @@ -336,9 +386,8 @@ } // Tests that the app list view handles drag properly in laptop mode. -TEST_F(AppListPresenterDelegateTest, AppListViewDragHandler) { +TEST_F(FullscreenAppListPresenterDelegateTest, AppListViewDragHandler) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); @@ -399,10 +448,9 @@ } // Tests that the app list view handles drag properly in maximize mode. -TEST_F(AppListPresenterDelegateTest, +TEST_F(FullscreenAppListPresenterDelegateTest, AppListViewDragHandlerMaximizeModeFromAllApps) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); EnableMaximizeMode(true); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); @@ -418,11 +466,9 @@ // Tests that the state of the app list changes properly with drag input from // fullscreen search. -TEST_F(AppListPresenterDelegateTest, +TEST_F(FullscreenAppListPresenterDelegateTest, AppListViewDragHandlerMaximizeModeFromSearch) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - // Reset the app list. - EnableFullscreenAppList(); EnableMaximizeMode(true); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); @@ -441,9 +487,8 @@ // Tests that the bottom shelf background is hidden when the app list is shown // in laptop mode. -TEST_F(AppListPresenterDelegateTest, +TEST_F(FullscreenAppListPresenterDelegateTest, ShelfBackgroundIsHiddenWhenAppListIsShown) { - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); ShelfLayoutManager* shelf_layout_manager = Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId())) @@ -452,45 +497,182 @@ ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT); } -// Tests that the peeking app list closes if the user taps outside its -// bounds. -TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { - // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); +// Tests that the peeking app list closes if the user taps or clicks outside +// its bounds. +TEST_P(FullscreenAppListPresenterDelegateTest, + TapAndClickOutsideClosesPeekingAppList) { + const bool test_mouse_event = TestMouseEventParam(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); - EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); + EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(), + app_list::AppListView::PEEKING); ui::test::EventGenerator& generator = GetEventGenerator(); - // Grab the bounds of the search box, - // which is guaranteed to be inside the app list. - gfx::Point tap_point = app_list_presenter_impl() - ->GetView() - ->search_box_widget() - ->GetContentsView() - ->GetBoundsInScreen() - .CenterPoint(); - - // Tapping inside the bounds doesn't close the app list. - generator.GestureTapAt(tap_point); - EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); - - // Clicking inside the bounds doesn't close the app list. - generator.MoveMouseTo(tap_point); - generator.ClickLeftButton(); - EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); - // Tapping outside the bounds closes the app list. - tap_point.set_x(tap_point.x() + 750); - generator.GestureTapAt(tap_point); - EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); + gfx::Point tap_point = + app_list_presenter_impl()->GetView()->bounds().origin(); + tap_point.Offset(0, -10); + if (test_mouse_event) { + generator.MoveMouseTo(tap_point); + generator.ClickLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapAt(tap_point); + } + EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); +} +// Tests that a keypress activates the searchbox and that clearing the +// searchbox deactivates the searchbox. +TEST_F(FullscreenAppListPresenterDelegateTest, KeyPressEnablesSearchBox) { app_list_presenter_impl()->Show(GetPrimaryDisplayId()); - EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); + ui::test::EventGenerator& generator = GetEventGenerator(); + app_list::SearchBoxView* search_box_view = + app_list_presenter_impl()->GetView()->search_box_view(); + EXPECT_FALSE(search_box_view->is_search_box_active()); - // Clicking outside the bounds closes the app list. - generator.MoveMouseTo(tap_point); - generator.ClickLeftButton(); - EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); + // Press any key, the search box should be active. + generator.PressKey(ui::VKEY_0, 0); + EXPECT_TRUE(search_box_view->is_search_box_active()); + + // Delete the text, the search box should be inactive. + search_box_view->ClearSearch(); + EXPECT_FALSE(search_box_view->is_search_box_active()); +} + +// Tests that a tap/click on the AppListView from half launcher returns the +// AppListView to Peeking, and that a tap/click on the AppListView from +// Peeking closes the app list. +TEST_P(FullscreenAppListPresenterDelegateTest, + StateTransitionsByTapAndClickingAppListBodyFromHalf) { + const bool test_mouse_event = TestMouseEventParam(); + app_list_presenter_impl()->Show(GetPrimaryDisplayId()); + app_list::AppListView* app_list_view = app_list_presenter_impl()->GetView(); + app_list::SearchBoxView* search_box_view = app_list_view->search_box_view(); + ui::test::EventGenerator& generator = GetEventGenerator(); + EXPECT_EQ(app_list_view->app_list_state(), + app_list::AppListView::AppListState::PEEKING); + + // Press a key, the AppListView should transition to half. + generator.PressKey(ui::KeyboardCode::VKEY_0, 0); + EXPECT_EQ(app_list_view->app_list_state(), + app_list::AppListView::AppListState::HALF); + EXPECT_TRUE(search_box_view->is_search_box_active()); + + // Tap outside the search box, the AppListView should transition to Peeking + // and the search box should be inactive. + + if (test_mouse_event) { + generator.MoveMouseTo(GetPointOutsideSearchbox()); + generator.ClickLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapDownAndUp(GetPointOutsideSearchbox()); + } + EXPECT_EQ(app_list_view->app_list_state(), app_list::AppListView::PEEKING); + EXPECT_FALSE(search_box_view->is_search_box_active()); + + // Tap outside the search box again, the AppListView should hide. + if (test_mouse_event) { + generator.MoveMouseTo(GetPointOutsideSearchbox()); + generator.ClickLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapDownAndUp(GetPointOutsideSearchbox()); + } + EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(), + app_list::AppListView::CLOSED); +} + +// Tests that a tap/click on the AppListView from Fullscreen search returns +// the AppListView to fullscreen all apps, and that a tap/click on the +// AppListView from fullscreen all apps closes the app list. +TEST_P(FullscreenAppListPresenterDelegateTest, + StateTransitionsByTappingAppListBodyFromFullscreen) { + const bool test_mouse_event = TestMouseEventParam(); + app_list_presenter_impl()->Show(GetPrimaryDisplayId()); + app_list::AppListView* app_list_view = app_list_presenter_impl()->GetView(); + app_list::SearchBoxView* search_box_view = app_list_view->search_box_view(); + ui::test::EventGenerator& generator = GetEventGenerator(); + + // Execute a long upwards drag, this should transition the app list to + // fullscreen. + const int top_of_app_list = + app_list_view->GetWidget()->GetWindowBoundsInScreen().y(); + generator.GestureScrollSequence(gfx::Point(10, top_of_app_list + 20), + gfx::Point(10, 10), + base::TimeDelta::FromMilliseconds(100), 10); + EXPECT_EQ(app_list_view->app_list_state(), + app_list::AppListView::FULLSCREEN_ALL_APPS); + + // Press a key, this should activate the searchbox and transition to + // fullscreen search. + generator.PressKey(ui::KeyboardCode::VKEY_0, 0); + EXPECT_EQ(app_list_view->app_list_state(), + app_list::AppListView::FULLSCREEN_SEARCH); + EXPECT_TRUE(search_box_view->is_search_box_active()); + + // Tap outside the searchbox, this should deactivate the searchbox and the + // applistview should return to fullscreen all apps. + if (test_mouse_event) { + generator.MoveMouseTo(GetPointOutsideSearchbox()); + generator.ClickLeftButton(); + } else { + generator.GestureTapDownAndUp(GetPointOutsideSearchbox()); + } + EXPECT_EQ(app_list_view->app_list_state(), + app_list::AppListView::FULLSCREEN_ALL_APPS); + EXPECT_FALSE(search_box_view->is_search_box_active()); + + // Tap outside the searchbox again, this should close the applistview. + if (test_mouse_event) { + generator.MoveMouseTo(GetPointOutsideSearchbox()); + generator.ClickLeftButton(); + } else { + generator.GestureTapDownAndUp(GetPointOutsideSearchbox()); + } + EXPECT_EQ(app_list_view->app_list_state(), app_list::AppListView::CLOSED); +} + +// Tests that the searchbox activates when it is tapped and that the widget is +// closed after tapping outside the searchbox. +TEST_P(FullscreenAppListPresenterDelegateTest, TapAndClickEnablesSearchBox) { + const bool test_mouse_event = TestMouseEventParam(); + app_list_presenter_impl()->Show(GetPrimaryDisplayId()); + app_list::SearchBoxView* search_box_view = + app_list_presenter_impl()->GetView()->search_box_view(); + + // Tap/Click the search box, it should activate. + ui::test::EventGenerator& generator = GetEventGenerator(); + if (test_mouse_event) { + generator.MoveMouseTo(GetPointInsideSearchbox()); + generator.PressLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapAt(GetPointInsideSearchbox()); + } + + EXPECT_TRUE(search_box_view->is_search_box_active()); + + // Tap on the body of the app list, the search box should deactivate. + if (test_mouse_event) { + generator.MoveMouseTo(GetPointOutsideSearchbox()); + generator.PressLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapAt(GetPointOutsideSearchbox()); + } + EXPECT_FALSE(search_box_view->is_search_box_active()); + EXPECT_TRUE(app_list_presenter_impl()->IsVisible()); + + // Tap on the body of the app list again, the app list should hide. + if (test_mouse_event) { + generator.PressLeftButton(); + generator.ReleaseLeftButton(); + } else { + generator.GestureTapAt(GetPointOutsideSearchbox()); + } + EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(), + app_list::AppListView::AppListState::CLOSED); } // Tests that the shelf background displays/hides with bottom shelf @@ -498,8 +680,8 @@ TEST_F(AppListPresenterDelegateTest, ShelfBackgroundRespondsToAppListBeingShown) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - if (Shell::GetAshConfig() == Config::MASH) - return; + if (Shell::GetAshConfig() == Config::MASH) + return; EnableFullscreenAppList(); GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM); @@ -511,21 +693,20 @@ SHELF_BACKGROUND_DEFAULT); app_list_presenter_impl()->Dismiss(); - // Set the alignment to the side and show the app list. The background should - // show. + // Set the alignment to the side and show the app list. The background + // should show. GetPrimaryShelf()->SetAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled()); EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment()); - EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()-> - GetShelfBackgroundType(), + EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType(), SHELF_BACKGROUND_DEFAULT); } // Tests that the half app list closes if the user taps outside its bounds. -TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesHalfAppList) { +TEST_F(FullscreenAppListPresenterDelegateTest, + TapAndClickOutsideClosesHalfAppList) { // TODO(newcomer): Investigate mash failures crbug.com/726838 - EnableFullscreenAppList(); app_list_presenter_impl()->Show(GetPrimaryDisplayId()); ui::test::EventGenerator& generator = GetEventGenerator();
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index e37638dc..5c9301b5 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc
@@ -4,7 +4,7 @@ #include "ui/display/manager/display_manager.h" -#include "ash/accelerators/accelerator_commands_aura.h" +#include "ash/accelerators/accelerator_commands.h" #include "ash/ash_switches.h" #include "ash/display/display_configuration_controller.h" #include "ash/display/display_util.h"
diff --git a/ash/laser/laser_pointer_view.cc b/ash/laser/laser_pointer_view.cc index 73401bdd..784f10c 100644 --- a/ash/laser/laser_pointer_view.cc +++ b/ash/laser/laser_pointer_view.cc
@@ -26,9 +26,9 @@ #include "cc/output/layer_tree_frame_sink.h" #include "cc/output/layer_tree_frame_sink_client.h" #include "cc/quads/texture_draw_quad.h" -#include "cc/resources/texture_mailbox.h" #include "cc/resources/transferable_resource.h" #include "components/viz/common/quads/resource_format.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
diff --git a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc index 0dfa273c..cc4b47c 100644 --- a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc +++ b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
@@ -9,9 +9,6 @@ #include "mash/public/interfaces/launchable.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "services/ui/public/interfaces/constants.mojom.h" -#include "services/ui/public/interfaces/display/display_controller.mojom.h" -#include "services/ui/public/interfaces/display/test_display_controller.mojom.h" -#include "ui/display/screen.h" namespace ash { namespace mus { @@ -31,13 +28,6 @@ // http://crbug.com/612331. switch (action) { case DEV_ADD_REMOVE_DISPLAY: - case DEV_TOGGLE_UNIFIED_DESKTOP: - case ROTATE_SCREEN: - case SCALE_UI_DOWN: - case SCALE_UI_RESET: - case SCALE_UI_UP: - case SWAP_PRIMARY_DISPLAY: - case TOGGLE_MIRROR_MODE: case TOUCH_HUD_PROJECTION_TOGGLE: return true; case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: @@ -71,15 +61,6 @@ const ui::Accelerator& previous_accelerator) { switch (action) { case DEV_ADD_REMOVE_DISPLAY: - case DEV_TOGGLE_UNIFIED_DESKTOP: - case ROTATE_SCREEN: - case SCALE_UI_DOWN: - case SCALE_UI_RESET: - case SCALE_UI_UP: - return true; - case SWAP_PRIMARY_DISPLAY: - return display::Screen::GetScreen()->GetNumDisplays() > 1; - case TOGGLE_MIRROR_MODE: case TOUCH_HUD_PROJECTION_TOGGLE: return true; default: @@ -93,43 +74,11 @@ const ui::Accelerator& accelerator) { switch (action) { case DEV_ADD_REMOVE_DISPLAY: { - display::mojom::TestDisplayControllerPtr test_display_controller; - window_manager_->connector()->BindInterface(ui::mojom::kServiceName, - &test_display_controller); - test_display_controller->ToggleAddRemoveDisplay(); - break; - } - case DEV_TOGGLE_UNIFIED_DESKTOP: { - // TODO(crbug.com/657816): This is hack. I'm just stealing the shortcut - // key to toggle display size in mus. This should be removed by launch. - display::mojom::TestDisplayControllerPtr test_display_controller; - window_manager_->connector()->BindInterface(ui::mojom::kServiceName, - &test_display_controller); - test_display_controller->ToggleDisplayResolution(); - break; - } - case ROTATE_SCREEN: { - window_manager_->GetDisplayController()->RotateCurrentDisplayCW(); - break; - } - case SCALE_UI_DOWN: { - window_manager_->GetDisplayController()->DecreaseInternalDisplayZoom(); - break; - } - case SCALE_UI_RESET: { - window_manager_->GetDisplayController()->ResetInternalDisplayZoom(); - break; - } - case SCALE_UI_UP: { - window_manager_->GetDisplayController()->IncreaseInternalDisplayZoom(); - break; - } - case SWAP_PRIMARY_DISPLAY: { - window_manager_->GetDisplayController()->SwapPrimaryDisplay(); - break; - } - case TOGGLE_MIRROR_MODE: { - window_manager_->GetDisplayController()->ToggleMirrorMode(); + if (!test_display_controller_) { + window_manager_->connector()->BindInterface(ui::mojom::kServiceName, + &test_display_controller_); + } + test_display_controller_->ToggleAddRemoveDisplay(); break; } case TOUCH_HUD_PROJECTION_TOGGLE: {
diff --git a/ash/mus/accelerators/accelerator_controller_delegate_mus.h b/ash/mus/accelerators/accelerator_controller_delegate_mus.h index 048f735..a9a95ac 100644 --- a/ash/mus/accelerators/accelerator_controller_delegate_mus.h +++ b/ash/mus/accelerators/accelerator_controller_delegate_mus.h
@@ -7,6 +7,7 @@ #include "ash/accelerators/accelerator_controller_delegate.h" #include "base/macros.h" +#include "services/ui/public/interfaces/display/test_display_controller.mojom.h" namespace ash { namespace mus { @@ -30,6 +31,8 @@ private: WindowManager* window_manager_; + display::mojom::TestDisplayControllerPtr test_display_controller_; + DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerDelegateMus); };
diff --git a/ash/mus/bridge/shell_port_mash.cc b/ash/mus/bridge/shell_port_mash.cc index ade0429..34c6bc08 100644 --- a/ash/mus/bridge/shell_port_mash.cc +++ b/ash/mus/bridge/shell_port_mash.cc
@@ -175,6 +175,9 @@ } bool ShellPortMash::IsMouseEventsEnabled() { + if (GetAshConfig() == Config::MUS) + return Shell::Get()->cursor_manager()->IsMouseEventsEnabled(); + // TODO: http://crbug.com/637853 NOTIMPLEMENTED(); return true;
diff --git a/ash/mus/non_client_frame_controller_unittest.cc b/ash/mus/non_client_frame_controller_unittest.cc index 2aeee663..436e688 100644 --- a/ash/mus/non_client_frame_controller_unittest.cc +++ b/ash/mus/non_client_frame_controller_unittest.cc
@@ -130,7 +130,7 @@ // Give the ui::Compositor a LocalSurfaceId so that it does not defer commit // when a draw is scheduled. - cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); compositor->SetLocalSurfaceId(local_surface_id); // Without the window visible, there should be a tile for the wallpaper at
diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc index 0c82549..cd193d7 100644 --- a/ash/rotator/screen_rotation_animator.cc +++ b/ash/rotator/screen_rotation_animator.cc
@@ -325,7 +325,7 @@ std::unique_ptr<ui::LayerTreeOwner> ScreenRotationAnimator::CopyLayerTree( std::unique_ptr<cc::CopyOutputResult> result) { - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture());
diff --git a/ash/system/ime_menu/ime_menu_tray.cc b/ash/system/ime_menu/ime_menu_tray.cc index df15493..084e9fc 100644 --- a/ash/system/ime_menu/ime_menu_tray.cc +++ b/ash/system/ime_menu/ime_menu_tray.cc
@@ -47,6 +47,10 @@ namespace ash { namespace { + +// Used for testing. +const int kEmojiButtonId = 1; + // Returns the height range of ImeListView. gfx::Range GetImeListViewRange() { const int max_items = 5; @@ -179,7 +183,8 @@ ImeButtonsView(ImeMenuTray* ime_menu_tray, bool show_emoji, bool show_handwriting, - bool show_voice) { + bool show_voice) + : ime_menu_tray_(ime_menu_tray) { DCHECK(ime_menu_tray_); Init(show_emoji, show_handwriting, show_voice); @@ -231,6 +236,7 @@ emoji_button_ = CreateImeMenuButton(this, kImeMenuEmoticonIcon, IDS_ASH_STATUS_TRAY_IME_EMOJI, right_border); + emoji_button_->set_id(kEmojiButtonId); AddChildView(emoji_button_); }
diff --git a/ash/system/ime_menu/ime_menu_tray.h b/ash/system/ime_menu/ime_menu_tray.h index ac4f3761..4717ea04 100644 --- a/ash/system/ime_menu/ime_menu_tray.h +++ b/ash/system/ime_menu/ime_menu_tray.h
@@ -89,7 +89,6 @@ void OnKeyboardSuppressionChanged(bool suppressed) override; private: - // To allow the test class to access |label_|. friend class ImeMenuTrayTest; // Show the IME menu bubble immediately.
diff --git a/ash/system/ime_menu/ime_menu_tray_unittest.cc b/ash/system/ime_menu/ime_menu_tray_unittest.cc index fde99c0..ce8e9a7 100644 --- a/ash/system/ime_menu/ime_menu_tray_unittest.cc +++ b/ash/system/ime_menu/ime_menu_tray_unittest.cc
@@ -30,6 +30,8 @@ namespace ash { namespace { +const int kEmojiButtonId = 1; + ImeMenuTray* GetTray() { return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->ime_menu_tray(); } @@ -51,6 +53,18 @@ ImeMenuTrayTest() {} ~ImeMenuTrayTest() override {} + void SetUp() override { + test::AshTestBase::SetUp(); + // MockInputMethodManager enables emoji, handwriting and voice input by + // default. + InputMethodManager::Initialize(new MockInputMethodManager); + } + + void TearDown() override { + InputMethodManager::Shutdown(); + test::AshTestBase::TearDown(); + } + protected: // Returns true if the IME menu tray is visible. bool IsVisible() { return GetTray()->visible(); } @@ -73,6 +87,11 @@ // Returns true if voice input is enabled for the current keyboard. bool IsVoiceEnabled() { return GetTray()->voice_enabled_; } + views::Button* GetEmojiButton() const { + return static_cast<views::Button*>( + GetTray()->bubble_->bubble_view()->GetViewByID(kEmojiButtonId)); + } + // Verifies the IME menu list has been updated with the right IME list. void ExpectValidImeList(const std::vector<mojom::ImeInfo>& expected_imes, const mojom::ImeInfo& expected_current_ime) { @@ -310,17 +329,26 @@ EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); } -TEST_F(ImeMenuTrayTest, ShouldShowBottomButtons) { - FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT); - EXPECT_FALSE(GetTray()->ShouldShowBottomButtons()); - EXPECT_FALSE(IsEmojiEnabled()); - EXPECT_FALSE(IsHandwritingEnabled()); - EXPECT_FALSE(IsVoiceEnabled()); +// Tests that tapping the emoji button does not crash. http://crbug.com/739630 +TEST_F(ImeMenuTrayTest, TapEmojiButton) { + Shell::Get()->ime_controller()->ShowImeMenuOnShelf(true); + // Open the menu. + ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP)); + GetTray()->PerformAction(tap); + + // Tap the emoji button. + views::Button* emoji_button = GetEmojiButton(); + ASSERT_TRUE(emoji_button); + emoji_button->OnGestureEvent(&tap); + + // The menu should be hidden. + EXPECT_FALSE(IsBubbleShown()); +} + +TEST_F(ImeMenuTrayTest, ShouldShowBottomButtons) { InputMethodManager* input_method_manager = InputMethodManager::Get(); - EXPECT_FALSE(input_method_manager); - InputMethodManager::Initialize(new MockInputMethodManager); - input_method_manager = InputMethodManager::Get(); EXPECT_TRUE(input_method_manager && input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled()); EXPECT_TRUE(input_method_manager->GetImeMenuFeatureEnabled( @@ -329,6 +357,8 @@ InputMethodManager::FEATURE_HANDWRITING)); EXPECT_TRUE(input_method_manager->GetImeMenuFeatureEnabled( InputMethodManager::FEATURE_VOICE)); + + FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT); EXPECT_TRUE(GetTray()->ShouldShowBottomButtons()); EXPECT_TRUE(IsEmojiEnabled()); EXPECT_TRUE(IsHandwritingEnabled()); @@ -344,8 +374,6 @@ TEST_F(ImeMenuTrayTest, ShouldShowBottomButtonsSeperate) { FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT); InputMethodManager* input_method_manager = InputMethodManager::Get(); - InputMethodManager::Initialize(new MockInputMethodManager); - input_method_manager = InputMethodManager::Get(); EXPECT_TRUE(input_method_manager && input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled());
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 51c4c98..59e4992 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc
@@ -144,15 +144,15 @@ } void AshTestBase::UnblockCompositors() { - // In order for frames to be generated, a cc::LocalSurfaceId must be given to - // the ui::Compositor. Normally that cc::LocalSurfaceId comes from the window + // In order for frames to be generated, a viz::LocalSurfaceId must be given to + // the ui::Compositor. Normally that viz::LocalSurfaceId comes from the window // server but in unit tests, there is no window server so we just make up a - // cc::LocalSurfaceId to allow the layer compositor to make forward progress. + // viz::LocalSurfaceId to allow the layer compositor to make forward progress. if (Shell::GetAshConfig() == Config::MUS || Shell::GetAshConfig() == Config::MASH) { aura::Window::Windows root_windows = Shell::GetAllRootWindows(); for (aura::Window* root : root_windows) { - cc::LocalSurfaceId id(1, base::UnguessableToken::Create()); + viz::LocalSurfaceId id(1, base::UnguessableToken::Create()); root->GetHost()->compositor()->SetLocalSurfaceId(id); } }
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index c6f0f42..9ed7c09 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h
@@ -64,7 +64,7 @@ AshTestBase(); ~AshTestBase() override; - // Give all ui::Compositors a valid cc::LocalSurfaceId so that they can + // Give all ui::Compositors a valid viz::LocalSurfaceId so that they can // unblock cc::LayerTreeHost. void UnblockCompositors();
diff --git a/base/BUILD.gn b/base/BUILD.gn index c81242c..ab3a818 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1241,10 +1241,6 @@ } if (is_fuchsia) { - # These are files that are not expected to have equivalent implementations - # on Fuchsia. - sources -= [ "sync_socket_posix.cc" ] - # These files have Fuchsia-specific implementations in the sources += block # below, rather than using the generic POSIX or Linux-y ones. sources -= [ @@ -2345,10 +2341,6 @@ ] } - if (is_fuchsia) { - sources -= [ "sync_socket_unittest.cc" ] - } - if (is_ios) { sources -= [ "files/file_locking_unittest.cc", @@ -2633,8 +2625,11 @@ "android/java/src/org/chromium/base/metrics/RecordUserAction.java", "android/java/src/org/chromium/base/metrics/StatisticsRecorderAndroid.java", "android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java", + "android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java", + "android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java", "android/java/src/org/chromium/base/process_launcher/ChildProcessConstants.java", "android/java/src/org/chromium/base/process_launcher/ChildProcessCreationParams.java", + "android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java", "android/java/src/org/chromium/base/process_launcher/ChildProcessService.java", "android/java/src/org/chromium/base/process_launcher/ChildProcessServiceImpl.java", "android/java/src/org/chromium/base/process_launcher/ChildProcessServiceDelegate.java", @@ -2748,6 +2743,7 @@ "android/junit/src/org/chromium/base/LogTest.java", "android/junit/src/org/chromium/base/NonThreadSafeTest.java", "android/junit/src/org/chromium/base/PromiseTest.java", + "android/junit/src/org/chromium/base/process_launcher/ChildConnectionAllocatorTest.java", "test/android/junit/src/org/chromium/base/test/SetUpStatementTest.java", "test/android/junit/src/org/chromium/base/test/util/DisableIfTest.java", "test/android/junit/src/org/chromium/base/test/util/MinAndroidSdkLevelSkipCheckTest.java",
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildConnectionAllocator.java b/base/android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java similarity index 85% rename from content/public/android/java/src/org/chromium/content/browser/ChildConnectionAllocator.java rename to base/android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java index c9be272..f21c46cf 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ChildConnectionAllocator.java +++ b/base/android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java
@@ -2,18 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.browser; +package org.chromium.base.process_launcher; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import org.chromium.base.Log; import org.chromium.base.ObserverList; import org.chromium.base.VisibleForTesting; -import org.chromium.base.process_launcher.ChildProcessCreationParams; import java.util.ArrayList; import java.util.Arrays; @@ -39,7 +40,7 @@ /** Factory interface. Used by tests to specialize created connections. */ @VisibleForTesting - protected interface ConnectionFactory { + public interface ConnectionFactory { ChildProcessConnection createConnection(Context context, ComponentName serviceName, boolean bindAsExternalService, Bundle serviceBundle, ChildProcessCreationParams creationParams); @@ -59,6 +60,9 @@ // Delay between the call to freeConnection and the connection actually beeing freed. private static final long FREE_CONNECTION_DELAY_MILLIS = 1; + // The handler of the thread on which all interations should happen. + private final Handler mLauncherHandler; + // Connections to services. Indices of the array correspond to the service numbers. private final ChildProcessConnection[] mChildProcessConnections; @@ -79,7 +83,7 @@ * Factory method that retrieves the service name and number of service from the * AndroidManifest.xml. */ - public static ChildConnectionAllocator create(Context context, + public static ChildConnectionAllocator create(Context context, Handler launcherHandler, ChildProcessCreationParams creationParams, String packageName, String serviceClassNameManifestKey, String numChildServicesManifestKey, boolean bindAsExternalService, boolean useStrongBinding) { @@ -110,12 +114,12 @@ throw new RuntimeException("Illegal meta data value: the child service doesn't exist"); } - return new ChildConnectionAllocator(creationParams, packageName, serviceClassName, - bindAsExternalService, useStrongBinding, numServices); + return new ChildConnectionAllocator(launcherHandler, creationParams, packageName, + serviceClassName, bindAsExternalService, useStrongBinding, numServices); } // TODO(jcivelli): remove this method once crbug.com/693484 has been addressed. - static int getNumberOfServices( + public static int getNumberOfServices( Context context, String packageName, String numChildServicesManifestKey) { int numServices = -1; try { @@ -142,13 +146,15 @@ public static ChildConnectionAllocator createForTest(ChildProcessCreationParams creationParams, String packageName, String serviceClassName, int serviceCount, boolean bindAsExternalService, boolean useStrongBinding) { - return new ChildConnectionAllocator(creationParams, packageName, serviceClassName, - bindAsExternalService, useStrongBinding, serviceCount); + return new ChildConnectionAllocator(new Handler(), creationParams, packageName, + serviceClassName, bindAsExternalService, useStrongBinding, serviceCount); } - private ChildConnectionAllocator(ChildProcessCreationParams creationParams, String packageName, - String serviceClassName, boolean bindAsExternalService, boolean useStrongBinding, - int numChildServices) { + private ChildConnectionAllocator(Handler launcherHandler, + ChildProcessCreationParams creationParams, String packageName, String serviceClassName, + boolean bindAsExternalService, boolean useStrongBinding, int numChildServices) { + mLauncherHandler = launcherHandler; + assert isRunningOnLauncherThread(); mCreationParams = creationParams; mPackageName = packageName; mServiceClassName = serviceClassName; @@ -164,7 +170,7 @@ /** @return a bound connection, or null if there are no free slots. */ public ChildProcessConnection allocate(Context context, Bundle serviceBundle, final ChildProcessConnection.ServiceCallback serviceCallback) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (mFreeConnectionIndices.isEmpty()) { Log.d(TAG, "Ran out of services to allocate."); return null; @@ -182,9 +188,9 @@ new ChildProcessConnection.ServiceCallback() { @Override public void onChildStarted() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (serviceCallback != null) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { serviceCallback.onChildStarted(); @@ -195,9 +201,9 @@ @Override public void onChildStartFailed() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (serviceCallback != null) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { serviceCallback.onChildStartFailed(); @@ -208,9 +214,9 @@ @Override public void onChildProcessDied(final ChildProcessConnection connection) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (serviceCallback != null) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { serviceCallback.onChildProcessDied(connection); @@ -224,7 +230,7 @@ // time. If a new connection to the same service is bound at that point, the // process is reused and bad things happen (mostly static variables are set // when we don't expect them to). - LauncherThread.postDelayed(new Runnable() { + mLauncherHandler.postDelayed(new Runnable() { @Override public void run() { free(connection); @@ -249,7 +255,7 @@ /** Frees a connection and notifies listeners. */ private void free(ChildProcessConnection connection) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); // mChildProcessConnections is relatively short (20 items at max at this point). // We are better of iterating than caching in a map. @@ -278,7 +284,7 @@ } public boolean isFreeConnectionAvailable() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return !mFreeConnectionIndices.isEmpty(); } @@ -297,19 +303,23 @@ } @VisibleForTesting - void setConnectionFactoryForTesting(ConnectionFactory connectionFactory) { + public void setConnectionFactoryForTesting(ConnectionFactory connectionFactory) { mConnectionFactory = connectionFactory; } /** @return the count of connections managed by the allocator */ @VisibleForTesting - int allocatedConnectionsCountForTesting() { - assert LauncherThread.runningOnLauncherThread(); + public int allocatedConnectionsCountForTesting() { + assert isRunningOnLauncherThread(); return mChildProcessConnections.length - mFreeConnectionIndices.size(); } @VisibleForTesting - ChildProcessConnection getChildProcessConnectionAtSlotForTesting(int slotNumber) { + public ChildProcessConnection getChildProcessConnectionAtSlotForTesting(int slotNumber) { return mChildProcessConnections[slotNumber]; } + + private boolean isRunningOnLauncherThread() { + return mLauncherHandler.getLooper() == Looper.myLooper(); + } }
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java similarity index 90% rename from content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java rename to base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java index 4ca70ed..b2ae7a3c 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java +++ b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java
@@ -2,22 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.browser; +package org.chromium.base.process_launcher; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; +import android.os.Handler; import android.os.IBinder; +import android.os.Looper; import android.os.RemoteException; import org.chromium.base.Log; import org.chromium.base.TraceEvent; import org.chromium.base.VisibleForTesting; -import org.chromium.base.process_launcher.ChildProcessCreationParams; -import org.chromium.base.process_launcher.ICallbackInt; -import org.chromium.base.process_launcher.IChildProcessService; import javax.annotation.Nullable; @@ -33,7 +32,7 @@ * Used to notify the consumer about the process start. These callbacks will be invoked before * the ConnectionCallbacks. */ - interface ServiceCallback { + public interface ServiceCallback { /** * Called when the child process has successfully started and is ready for connection * setup. @@ -60,7 +59,7 @@ /** * Used to notify the consumer about the connection being established. */ - interface ConnectionCallback { + public interface ConnectionCallback { /** * Called when the connection to the service is established. * @param connection the connection object to the child process @@ -126,7 +125,7 @@ @Override public void onServiceConnected(ComponentName className, final IBinder service) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { ChildProcessConnection.this.onServiceConnectedOnLauncherThread(service); @@ -137,7 +136,7 @@ // Called on the main thread to notify that the child service did not disconnect gracefully. @Override public void onServiceDisconnected(ComponentName className) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { ChildProcessConnection.this.onServiceDisconnectedOnLauncherThread(); @@ -146,6 +145,7 @@ } } + private final Handler mLauncherHandler; private final Context mContext; private final ComponentName mServiceName; @@ -224,7 +224,7 @@ // Set to true once unbind() was called. private boolean mUnbound; - ChildProcessConnection(Context context, ComponentName serviceName, + public ChildProcessConnection(Context context, ComponentName serviceName, boolean bindAsExternalService, Bundle serviceBundle, ChildProcessCreationParams creationParams) { this(context, serviceName, bindAsExternalService, serviceBundle, creationParams, @@ -234,7 +234,7 @@ private ChildProcessConnection(Context context, ComponentName serviceName, boolean bindAsExternalService, Bundle serviceBundle, ChildProcessCreationParams creationParams, boolean doBind) { - assert LauncherThread.runningOnLauncherThread(); + mLauncherHandler = new Handler(); mContext = context; mCreationParams = creationParams; mServiceName = serviceName; @@ -256,22 +256,22 @@ } public final Context getContext() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mContext; } public final String getPackageName() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mServiceName.getPackageName(); } public final IChildProcessService getService() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mService; } public final ComponentName getServiceName() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mServiceName; } @@ -283,7 +283,7 @@ * @return the connection pid, or 0 if not yet connected */ public int getPid() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mPid; } @@ -299,10 +299,9 @@ */ public void start( boolean useStrongBinding, ServiceCallback serviceCallback, boolean retryOnTimeout) { - assert LauncherThread.runningOnLauncherThread(); try { TraceEvent.begin("ChildProcessConnection.start"); - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); assert mConnectionParams == null : "setupConnection() called before start() in ChildProcessConnection."; @@ -332,7 +331,7 @@ */ public void setupConnection(Bundle connectionBundle, @Nullable IBinder callback, ConnectionCallback connectionCallback) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); assert mConnectionParams == null; if (mServiceDisconnected) { Log.w(TAG, "Tried to setup a connection that already disconnected."); @@ -358,7 +357,7 @@ * this multiple times. */ public void stop() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); cancelWatchDog(); unbind(); mService = null; @@ -368,7 +367,7 @@ @VisibleForTesting public void onServiceConnectedOnLauncherThread(IBinder service) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); cancelWatchDog(); // A flag from the parent class ensures we run the post-connection logic only once // (instead of once per each ChildServiceConnection). @@ -416,9 +415,8 @@ } } - @VisibleForTesting - public void onServiceDisconnectedOnLauncherThread() { - assert LauncherThread.runningOnLauncherThread(); + private void onServiceDisconnectedOnLauncherThread() { + assert isRunningOnLauncherThread(); // Ensure that the disconnection logic runs only once (instead of once per each // ChildServiceConnection). if (mServiceDisconnected) { @@ -460,7 +458,7 @@ ICallbackInt pidCallback = new ICallbackInt.Stub() { @Override public void call(final int pid) { - LauncherThread.post(new Runnable() { + mLauncherHandler.post(new Runnable() { @Override public void run() { onSetupConnectionResult(pid); @@ -481,7 +479,7 @@ } private boolean bind(boolean useStrongBinding) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); assert !mUnbound; boolean success = useStrongBinding ? mStrongBinding.bind() : mInitialBinding.bind(); @@ -494,7 +492,7 @@ @VisibleForTesting protected void unbind() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); mUnbound = true; unbindAll(); // Note that we don't update the waived bound only state here as to preserve the state when @@ -509,29 +507,29 @@ } public boolean isInitialBindingBound() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mInitialBinding.isBound(); } public void addInitialBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); mInitialBinding.bind(); updateWaivedBoundOnlyState(); } public boolean isStrongBindingBound() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mStrongBinding.isBound(); } public void removeInitialBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); mInitialBinding.unbind(); updateWaivedBoundOnlyState(); } public void dropOomBindings() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); mInitialBinding.unbind(); mStrongBindingCount = 0; @@ -542,7 +540,7 @@ } public void addStrongBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (!isConnected()) { Log.w(TAG, "The connection is not bound for %d", getPid()); return; @@ -555,7 +553,7 @@ } public void removeStrongBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (!isConnected()) { Log.w(TAG, "The connection is not bound for %d", getPid()); return; @@ -569,12 +567,12 @@ } public boolean isModerateBindingBound() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return mModerateBinding.isBound(); } public void addModerateBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (!isConnected()) { Log.w(TAG, "The connection is not bound for %d", getPid()); return; @@ -584,7 +582,7 @@ } public void removeModerateBinding() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (!isConnected()) { Log.w(TAG, "The connection is not bound for %d", getPid()); return; @@ -623,7 +621,7 @@ private void resetWatchdog(final boolean useStrongBinding, final ServiceCallback serviceCallback, final boolean retryOnTimeout) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); cancelWatchDog(); assert mOnServiceConnectedWatchDog == null; mOnServiceConnectedWatchDog = new Runnable() { @@ -639,19 +637,23 @@ start(useStrongBinding, serviceCallback, retryOnTimeout); } }; - LauncherThread.postDelayed(mOnServiceConnectedWatchDog, BIND_SERVICE_TIMEOUT_IN_MS); + mLauncherHandler.postDelayed(mOnServiceConnectedWatchDog, BIND_SERVICE_TIMEOUT_IN_MS); } private void cancelWatchDog() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (mOnServiceConnectedWatchDog == null) return; - LauncherThread.removeCallbacks(mOnServiceConnectedWatchDog); + mLauncherHandler.removeCallbacks(mOnServiceConnectedWatchDog); mOnServiceConnectedWatchDog = null; } + private boolean isRunningOnLauncherThread() { + return mLauncherHandler.getLooper() == Looper.myLooper(); + } + @VisibleForTesting protected ChildServiceConnection createServiceConnection(int bindFlags) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); return new ChildServiceConnectionImpl(bindFlags); }
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java similarity index 92% rename from content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java rename to base/android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java index 4fc7085..9a52a7d 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java +++ b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.browser; +package org.chromium.base.process_launcher; import android.os.Bundle; import android.os.Handler; @@ -13,8 +13,6 @@ import org.chromium.base.Log; import org.chromium.base.TraceEvent; import org.chromium.base.annotations.SuppressFBWarnings; -import org.chromium.base.process_launcher.ChildProcessConstants; -import org.chromium.base.process_launcher.FileDescriptorInfo; import java.io.IOException; @@ -70,7 +68,7 @@ private static final int NULL_PROCESS_HANDLE = 0; // The handle for the thread we were created on and on which all methods should be called. - private final Handler mLauncherHandler = new Handler(); + private final Handler mLauncherHandler; private final Delegate mDelegate; @@ -94,30 +92,32 @@ * Note that onBeforeConnectionAllocated and onConnectionBound will not be invoked on the * delegate since the connection is already available. */ - public static ChildProcessLauncher createWithBoundConnectionProvider(Delegate delegate, - String[] commandLine, FileDescriptorInfo[] filesToBeMapped, + public static ChildProcessLauncher createWithBoundConnectionProvider(Handler launcherHandler, + Delegate delegate, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, BoundConnectionProvider connectionProvider, IBinder binderCallback) { - return new ChildProcessLauncher(delegate, commandLine, filesToBeMapped, connectionProvider, - null /* connectionAllocator */, binderCallback); + return new ChildProcessLauncher(launcherHandler, delegate, commandLine, filesToBeMapped, + connectionProvider, null /* connectionAllocator */, binderCallback); } /** * Creates a ChildProcessLauncher that will create a connection using the specified * ChildConnectionAllocator. */ - public static ChildProcessLauncher createWithConnectionAllocator(Delegate delegate, - String[] commandLine, FileDescriptorInfo[] filesToBeMapped, + public static ChildProcessLauncher createWithConnectionAllocator(Handler launcherHandler, + Delegate delegate, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, ChildConnectionAllocator connectionAllocator, IBinder binderCallback) { - return new ChildProcessLauncher(delegate, commandLine, filesToBeMapped, + return new ChildProcessLauncher(launcherHandler, delegate, commandLine, filesToBeMapped, null /* connection */, connectionAllocator, binderCallback); } @SuppressFBWarnings("EI_EXPOSE_REP2") - private ChildProcessLauncher(Delegate delegate, String[] commandLine, + private ChildProcessLauncher(Handler launcherHandler, Delegate delegate, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, BoundConnectionProvider connectionProvider, ChildConnectionAllocator connectionAllocator, IBinder binderCallback) { // Either a bound connection provider or a connection allocator should be provided. assert (connectionProvider == null) != (connectionAllocator == null); + mLauncherHandler = launcherHandler; + isRunningOnLauncherThread(); mCommandLine = commandLine; mConnectionProvider = connectionProvider; mConnectionAllocator = connectionAllocator; @@ -164,7 +164,7 @@ @Override public void onChildProcessDied(ChildProcessConnection connection) { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); assert mConnection == connection; ChildProcessLauncher.this.onChildProcessDied(); } @@ -284,7 +284,7 @@ } private void onChildProcessDied() { - assert LauncherThread.runningOnLauncherThread(); + assert isRunningOnLauncherThread(); if (getPid() != 0) { mDelegate.onConnectionLost(mConnection); }
diff --git a/content/public/android/junit/src/org/chromium/content/browser/ChildConnectionAllocatorTest.java b/base/android/junit/src/org/chromium/base/process_launcher/ChildConnectionAllocatorTest.java similarity index 95% rename from content/public/android/junit/src/org/chromium/content/browser/ChildConnectionAllocatorTest.java rename to base/android/junit/src/org/chromium/base/process_launcher/ChildConnectionAllocatorTest.java index 91a09e8..633da541 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/ChildConnectionAllocatorTest.java +++ b/base/android/junit/src/org/chromium/base/process_launcher/ChildConnectionAllocatorTest.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.browser; +package org.chromium.base.process_launcher; import android.content.ComponentName; import android.content.Context; @@ -21,7 +21,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,7 +31,6 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLooper; -import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.test.util.Feature; import org.chromium.testing.local.LocalRobolectricTestRunner; @@ -133,21 +131,12 @@ public void setUp() { MockitoAnnotations.initMocks(this); - // The tests run on only one thread. Pretend that is the launcher thread so LauncherThread - // asserts are not triggered. - LauncherThread.setCurrentThreadAsLauncherThread(); - mAllocator = ChildConnectionAllocator.createForTest(mCreationParams, TEST_PACKAGE_NAME, "AllocatorTest", MAX_CONNECTION_NUMBER, false /* bindAsExternalService */, false /* useStrongBinding */); mAllocator.setConnectionFactoryForTesting(mTestConnectionFactory); } - @After - public void tearDown() { - LauncherThread.setLauncherThreadAsLauncherThread(); - } - @Test @Feature({"ProcessManagement"}) public void testPlainAllocate() {
diff --git a/base/atomic_sequence_num.h b/base/atomic_sequence_num.h index 59b0d25..3e7e95e5 100644 --- a/base/atomic_sequence_num.h +++ b/base/atomic_sequence_num.h
@@ -5,56 +5,33 @@ #ifndef BASE_ATOMIC_SEQUENCE_NUM_H_ #define BASE_ATOMIC_SEQUENCE_NUM_H_ -#include "base/atomicops.h" +#include <atomic> + #include "base/macros.h" namespace base { -class AtomicSequenceNumber; - -// Static (POD) AtomicSequenceNumber that MUST be used in global scope (or -// non-function scope) ONLY. This implementation does not generate any static -// initializer. Note that it does not implement any constructor which means -// that its fields are not initialized except when it is stored in the global -// data section (.data in ELF). If you want to allocate an atomic sequence -// number on the stack (or heap), please use the AtomicSequenceNumber class -// declared below. -class StaticAtomicSequenceNumber { - public: - inline int GetNext() { - return static_cast<int>( - base::subtle::NoBarrier_AtomicIncrement(&seq_, 1) - 1); - } - - private: - friend class AtomicSequenceNumber; - - inline void Reset() { - base::subtle::Release_Store(&seq_, 0); - } - - base::subtle::Atomic32 seq_; -}; - -// AtomicSequenceNumber that can be stored and used safely (i.e. its fields are -// always initialized as opposed to StaticAtomicSequenceNumber declared above). -// Please use StaticAtomicSequenceNumber if you want to declare an atomic -// sequence number in the global scope. +// AtomicSequenceNumber is a thread safe increasing sequence number generator. +// Its constructor doesn't emit a static initializer, so it's safe to use as a +// global variable or static member. class AtomicSequenceNumber { public: - AtomicSequenceNumber() { - seq_.Reset(); - } + constexpr AtomicSequenceNumber() {} - inline int GetNext() { - return seq_.GetNext(); - } + // Returns an increasing sequence number starts from 0 for each call. + // This function can be called from any thread without data race. + inline int GetNext() { return seq_.fetch_add(1, std::memory_order_relaxed); } private: - StaticAtomicSequenceNumber seq_; + std::atomic_int seq_{0}; + DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber); }; +// TODO(tzik): Replace all usage of StaticAtomicSequenceNumber with +// AtomicSequenceNumber, and remove this alias. +using StaticAtomicSequenceNumber = AtomicSequenceNumber; + } // namespace base #endif // BASE_ATOMIC_SEQUENCE_NUM_H_
diff --git a/base/files/file_descriptor_watcher_posix.cc b/base/files/file_descriptor_watcher_posix.cc index ce05081..0579da9 100644 --- a/base/files/file_descriptor_watcher_posix.cc +++ b/base/files/file_descriptor_watcher_posix.cc
@@ -108,8 +108,13 @@ void FileDescriptorWatcher::Controller::Watcher::StartWatching() { DCHECK(thread_checker_.CalledOnValidThread()); - MessageLoopForIO::current()->WatchFileDescriptor( - fd_, false, mode_, &file_descriptor_watcher_, this); + if (!MessageLoopForIO::current()->WatchFileDescriptor( + fd_, false, mode_, &file_descriptor_watcher_, this)) { + // TODO(wez): Ideally we would [D]CHECK here, or propagate the failure back + // to the caller, but there is no guarantee that they haven't already + // closed |fd_| on another thread, so the best we can do is Debug-log. + DLOG(ERROR) << "Failed to watch fd=" << fd_; + } if (!registered_as_destruction_observer_) { MessageLoopForIO::current()->AddDestructionObserver(this);
diff --git a/base/files/file_descriptor_watcher_posix_unittest.cc b/base/files/file_descriptor_watcher_posix_unittest.cc index 7ff40c5f..18d2e86d 100644 --- a/base/files/file_descriptor_watcher_posix_unittest.cc +++ b/base/files/file_descriptor_watcher_posix_unittest.cc
@@ -81,6 +81,9 @@ base::RunLoop().RunUntilIdle(); } + // Ensure that OtherThread is done processing before closing fds. + other_thread_.Stop(); + EXPECT_EQ(0, IGNORE_EINTR(close(pipe_fds_[0]))); EXPECT_EQ(0, IGNORE_EINTR(close(pipe_fds_[1]))); } @@ -116,7 +119,7 @@ std::unique_ptr<FileDescriptorWatcher::Controller> WatchWritable() { std::unique_ptr<FileDescriptorWatcher::Controller> controller = FileDescriptorWatcher::WatchWritable( - read_file_descriptor(), + write_file_descriptor(), Bind(&Mock::WritableCallback, Unretained(&mock_))); EXPECT_TRUE(controller); return controller; @@ -167,14 +170,11 @@ TEST_P(FileDescriptorWatcherTest, WatchWritable) { auto controller = WatchWritable(); -// On Mac and iOS, the write end of a newly created pipe is writable without -// blocking. -#if defined(OS_MACOSX) + // The write end of a newly created pipe is immediately writable. RunLoop run_loop; EXPECT_CALL(mock_, WritableCallback()) .WillOnce(testing::Invoke(&run_loop, &RunLoop::Quit)); run_loop.Run(); -#endif // defined(OS_MACOSX) } TEST_P(FileDescriptorWatcherTest, WatchReadableOneByte) {
diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h index 91327f31..40d23fb 100644 --- a/base/mac/sdk_forward_declarations.h +++ b/base/mac/sdk_forward_declarations.h
@@ -158,10 +158,6 @@ @property(readonly) NSInteger stage; @end -@interface NSView (Yosemite_3_SDK) -- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration; -@end - #endif // MAC_OS_X_VERSION_10_10 // ---------------------------------------------------------------------------- @@ -191,10 +187,16 @@ @end @interface NSView (ElCapitanSDK) -@property(readonly, strong) NSLayoutXAxisAnchor* leftAnchor; -@property(readonly, strong) NSLayoutXAxisAnchor* rightAnchor; -@property(readonly, strong) NSLayoutYAxisAnchor* bottomAnchor; -@property(readonly, strong) NSLayoutDimension* widthAnchor; +- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration + __attribute__((availability(macos, introduced = 10.11))); +@property(readonly, strong) NSLayoutXAxisAnchor* leftAnchor + __attribute__((availability(macos, introduced = 10.11))); +@property(readonly, strong) NSLayoutXAxisAnchor* rightAnchor + __attribute__((availability(macos, introduced = 10.11))); +@property(readonly, strong) NSLayoutYAxisAnchor* bottomAnchor + __attribute__((availability(macos, introduced = 10.11))); +@property(readonly, strong) NSLayoutDimension* widthAnchor + __attribute__((availability(macos, introduced = 10.11))); @end @interface NSWindow (ElCapitanSDK)
diff --git a/base/message_loop/message_pump_fuchsia.cc b/base/message_loop/message_pump_fuchsia.cc index 61a9f9c..56129313 100644 --- a/base/message_loop/message_pump_fuchsia.cc +++ b/base/message_loop/message_pump_fuchsia.cc
@@ -16,7 +16,8 @@ } MessagePumpFuchsia::FileDescriptorWatcher::~FileDescriptorWatcher() { - StopWatchingFileDescriptor(); + if (!StopWatchingFileDescriptor()) + NOTREACHED(); if (io_) __mxio_release(io_); if (was_destroyed_) { @@ -26,13 +27,21 @@ } bool MessagePumpFuchsia::FileDescriptorWatcher::StopWatchingFileDescriptor() { + if (handle_ == MX_HANDLE_INVALID) + return true; uint64_t this_as_key = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this)); - return mx_port_cancel(port_, handle_, this_as_key) == MX_OK; + int result = mx_port_cancel(port_, handle_, this_as_key); + DLOG_IF(ERROR, result != MX_OK) + << "mx_port_cancel(handle=" << handle_ << ") failed: result=" << result; + handle_ = MX_HANDLE_INVALID; + return result == MX_OK; } MessagePumpFuchsia::MessagePumpFuchsia() : keep_running_(true) { - CHECK(mx_port_create(0, &port_) == MX_OK); + // TODO(wez): Remove MX_PORT_OPT_V2 once the SDK is rolled, or migrate + // this implementation use ulib/port helpers. + CHECK(mx_port_create(MX_PORT_OPT_V2, &port_) == MX_OK); } MessagePumpFuchsia::~MessagePumpFuchsia() { @@ -74,8 +83,10 @@ controller->desired_events_ = events; controller->io_ = __mxio_fd_to_io(fd); - if (!controller->io_) + if (!controller->io_) { + DLOG(ERROR) << "Failed to get IO for FD"; return false; + } controller->fd_ = fd; controller->persistent_ = persistent; @@ -86,15 +97,18 @@ bool MessagePumpFuchsia::FileDescriptorWatcher::WaitBegin() { uint32_t signals = 0u; __mxio_wait_begin(io_, desired_events_, &handle_, &signals); - if (handle_ == MX_HANDLE_INVALID) + if (handle_ == MX_HANDLE_INVALID) { + DLOG(ERROR) << "mxio_wait_begin failed"; return false; + } uint64_t this_as_key = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this)); mx_status_t status = mx_object_wait_async(handle_, port_, this_as_key, signals, MX_WAIT_ASYNC_ONCE); if (status != MX_OK) { - DLOG(ERROR) << "mx_object_wait_async failed: " << status; + DLOG(ERROR) << "mx_object_wait_async failed: " << status + << " (port=" << port_ << ")"; return false; } return true; @@ -164,21 +178,14 @@ // pointer is now invalid. bool controller_was_destroyed = false; controller->was_destroyed_ = &controller_was_destroyed; - if ((events & (MXIO_EVT_READABLE | MXIO_EVT_WRITABLE)) == - (MXIO_EVT_READABLE | MXIO_EVT_WRITABLE)) { + if (events & MXIO_EVT_WRITABLE) controller->watcher_->OnFileCanWriteWithoutBlocking(controller->fd_); - if (!controller_was_destroyed) - controller->watcher_->OnFileCanReadWithoutBlocking(controller->fd_); - } else if (events & MXIO_EVT_WRITABLE) { - controller->watcher_->OnFileCanWriteWithoutBlocking(controller->fd_); - } else if (events & MXIO_EVT_READABLE) { + if (!controller_was_destroyed && (events & MXIO_EVT_READABLE)) controller->watcher_->OnFileCanReadWithoutBlocking(controller->fd_); - } if (!controller_was_destroyed) { controller->was_destroyed_ = nullptr; - } - if (!controller_was_destroyed && controller->persistent_) { - controller->WaitBegin(); + if (controller->persistent_) + controller->WaitBegin(); } } else { // Wakeup caused by ScheduleWork(). @@ -199,9 +206,8 @@ mx_port_packet_t packet = {}; packet.type = MX_PKT_TYPE_USER; mx_status_t status = mx_port_queue(port_, &packet, 0); - if (status != MX_OK) { - DLOG(ERROR) << "mx_port_queue failed: " << status; - } + DLOG_IF(ERROR, status != MX_OK) + << "mx_port_queue failed: " << status << " (port=" << port_ << ")"; } void MessagePumpFuchsia::ScheduleDelayedWork(
diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc index 48cb98a3..14bc75c 100644 --- a/base/message_loop/message_pump_libevent.cc +++ b/base/message_loop/message_pump_libevent.cc
@@ -153,13 +153,12 @@ } std::unique_ptr<event> evt(controller->ReleaseEvent()); - if (evt.get() == NULL) { + if (!evt) { // Ownership is transferred to the controller. evt.reset(new event); } else { // Make sure we don't pick up any funky internal libevent masks. - int old_interest_mask = evt.get()->ev_events & - (EV_READ | EV_WRITE | EV_PERSIST); + int old_interest_mask = evt->ev_events & (EV_READ | EV_WRITE | EV_PERSIST); // Combine old/new event masks. event_mask |= old_interest_mask; @@ -180,11 +179,13 @@ // Tell libevent which message pump this socket will belong to when we add it. if (event_base_set(event_base_, evt.get())) { + DPLOG(ERROR) << "event_base_set(fd=" << EVENT_FD(evt.get()) << ")"; return false; } // Add this socket to the list of monitored sockets. if (event_add(evt.get(), NULL)) { + DPLOG(ERROR) << "event_add failed(fd=" << EVENT_FD(evt.get()) << ")"; return false; }
diff --git a/base/message_loop/message_pump_libevent_unittest.cc b/base/message_loop/message_pump_libevent_unittest.cc index 89c4e1f5..75cdca04 100644 --- a/base/message_loop/message_pump_libevent_unittest.cc +++ b/base/message_loop/message_pump_libevent_unittest.cc
@@ -50,6 +50,10 @@ PLOG(ERROR) << "close"; } + void WaitUntilIoThreadStarted() { + ASSERT_TRUE(io_thread_.WaitUntilThreadStarted()); + } + MessageLoopForIO* io_loop() const { return static_cast<MessageLoopForIO*>(io_thread_.message_loop()); } @@ -82,16 +86,14 @@ // Test to make sure that we catch calling WatchFileDescriptor off of the // wrong thread. -#if defined(OS_CHROMEOS) || defined(OS_LINUX) -// Flaky on Chrome OS and Linux: crbug.com/138845. -#define MAYBE_TestWatchingFromBadThread DISABLED_TestWatchingFromBadThread -#else -#define MAYBE_TestWatchingFromBadThread TestWatchingFromBadThread -#endif -TEST_F(MessagePumpLibeventTest, MAYBE_TestWatchingFromBadThread) { +TEST_F(MessagePumpLibeventTest, TestWatchingFromBadThread) { MessagePumpLibevent::FileDescriptorWatcher watcher(FROM_HERE); StupidWatcher delegate; + // Ensure that |io_thread_| has started, otherwise we're racing against + // creation of the thread's MessagePump. + WaitUntilIoThreadStarted(); + ASSERT_DCHECK_DEATH( io_loop()->WatchFileDescriptor(STDOUT_FILENO, false, MessageLoopForIO::WATCH_READ, &watcher, @@ -213,20 +215,18 @@ class QuitWatcher : public BaseWatcher { public: QuitWatcher(MessagePumpLibevent::FileDescriptorWatcher* controller, - RunLoop* run_loop) - : BaseWatcher(controller), run_loop_(run_loop) {} - ~QuitWatcher() override {} + base::Closure quit_closure) + : BaseWatcher(controller), quit_closure_(std::move(quit_closure)) {} void OnFileCanReadWithoutBlocking(int /* fd */) override { // Post a fatal closure to the MessageLoop before we quit it. ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, BindOnce(&FatalClosure)); - // Now quit the MessageLoop. - run_loop_->Quit(); + quit_closure_.Run(); } private: - RunLoop* run_loop_; // weak + base::Closure quit_closure_; }; void WriteFDWrapper(const int fd, @@ -246,7 +246,7 @@ MessageLoop loop(WrapUnique(pump)); RunLoop run_loop; MessagePumpLibevent::FileDescriptorWatcher controller(FROM_HERE); - QuitWatcher delegate(&controller, &run_loop); + QuitWatcher delegate(&controller, run_loop.QuitClosure()); WaitableEvent event(WaitableEvent::ResetPolicy::AUTOMATIC, WaitableEvent::InitialState::NOT_SIGNALED); std::unique_ptr<WaitableEventWatcher> watcher(new WaitableEventWatcher); @@ -277,6 +277,87 @@ BindOnce(&WaitableEventWatcher::StopWatching, Owned(watcher.release()))); } +class CaptureAndQuitWatcher : public BaseWatcher { + public: + CaptureAndQuitWatcher(MessagePumpLibevent::FileDescriptorWatcher* controller, + base::Closure quit_closure) + : BaseWatcher(controller), quit_closure_(std::move(quit_closure)) {} + + void OnFileCanReadWithoutBlocking(int /* fd */) override { + is_readable_ = true; + quit_closure_.Run(); + } + void OnFileCanWriteWithoutBlocking(int /* fd */) override { + is_writable_ = true; + quit_closure_.Run(); + } + + bool is_readable_ = false; + bool is_writable_ = false; + + private: + base::Closure quit_closure_; +}; + +// Verify that basic readable notification works. +TEST_F(MessagePumpLibeventTest, WatchReadable) { + // Tear-down the old MessageLoop before creating the replacement. + ui_loop_.reset(); + + ui_loop_ = base::MakeUnique<MessageLoopForIO>(); + MessagePumpLibevent::FileDescriptorWatcher watcher(FROM_HERE); + RunLoop run_loop; + CaptureAndQuitWatcher delegate(&watcher, run_loop.QuitClosure()); + + // Watch the pipe for readability. + ASSERT_TRUE(MessageLoopForIO::current()->WatchFileDescriptor( + pipefds_[0], /* persistent= */ false, MessageLoopForIO::WATCH_READ, + &watcher, &delegate)); + + // The pipe should not be readable when first created. + base::RunLoop().RunUntilIdle(); + ASSERT_FALSE(delegate.is_readable_); + ASSERT_FALSE(delegate.is_writable_); + + // Write a byte to the other end, making it readable. + const char buf = 0; + ASSERT_TRUE(WriteFileDescriptor(pipefds_[1], &buf, sizeof(buf))); + + // We don't want to assume that the read fd becomes readable the + // instant a bytes is written, so Run until quit by an event. + run_loop.Run(); + + ASSERT_TRUE(delegate.is_readable_); + ASSERT_FALSE(delegate.is_writable_); +} + +// Verify that watching a file descriptor for writability succeeds. +TEST_F(MessagePumpLibeventTest, WatchWritable) { + // Tear-down the old MessageLoop before creating the replacement. + ui_loop_.reset(); + + ui_loop_ = base::MakeUnique<MessageLoopForIO>(); + MessagePumpLibevent::FileDescriptorWatcher watcher(FROM_HERE); + RunLoop run_loop; + CaptureAndQuitWatcher delegate(&watcher, run_loop.QuitClosure()); + + // Watch the pipe for writability. + ASSERT_TRUE(MessageLoopForIO::current()->WatchFileDescriptor( + pipefds_[1], /* persistent= */ false, MessageLoopForIO::WATCH_WRITE, + &watcher, &delegate)); + + // We should not receive a writable notification until we process events. + ASSERT_FALSE(delegate.is_readable_); + ASSERT_FALSE(delegate.is_writable_); + + // The pipe should be writable immediately, so no need to wait for + // the quit closure. + run_loop.RunUntilIdle(); + + ASSERT_FALSE(delegate.is_readable_); + ASSERT_TRUE(delegate.is_writable_); +} + } // namespace } // namespace base
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc index cd64bda..8959e1e0 100644 --- a/base/test/launcher/test_launcher.cc +++ b/base/test/launcher/test_launcher.cc
@@ -900,6 +900,10 @@ results_tracker_.AddGlobalTag("OS_FREEBSD"); #endif +#if defined(OS_FUCHSIA) + results_tracker_.AddGlobalTag("OS_FUCHSIA"); +#endif + #if defined(OS_IOS) results_tracker_.AddGlobalTag("OS_IOS"); #endif
diff --git a/build/android/pylib/local/device/local_device_environment.py b/build/android/pylib/local/device/local_device_environment.py index 1e5056b..09fde59 100644 --- a/build/android/pylib/local/device/local_device_environment.py +++ b/build/android/pylib/local/device/local_device_environment.py
@@ -131,7 +131,7 @@ self._blacklist, enable_device_files_cache=self._enable_device_cache, default_retries=self._max_tries - 1, device_arg=device_arg) if not self._devices: - raise device_errors.NoDevicesError + raise device_errors.NoDevicesError('No devices were available') if self._logcat_output_file: self._logcat_output_dir = tempfile.mkdtemp() @@ -184,8 +184,6 @@ # attached. if self._devices is None: self._InitDevices() - if not self._devices: - raise device_errors.NoDevicesError() return self._devices @property @@ -213,8 +211,9 @@ if self.trace_output: self.DisableTracing() - if self._devices is None: + if not self._devices: return + @handle_shard_failures_with(on_failure=self.BlacklistDevice) def tear_down_device(d): # Write the cache even when not using it so that it will be ready the @@ -263,6 +262,10 @@ self._blacklist.Extend([device_serial], reason=reason) with self._devices_lock: self._devices = [d for d in self._devices if str(d) != device_serial] + logging.error('Device %s blacklisted: %s', device_serial, reason) + if not self._devices: + raise device_errors.NoDevicesError( + 'All devices were blacklisted due to errors') def DisableTracing(self): if not trace_event.trace_is_enabled():
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index c1d63a8..f4f9e44 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1108,9 +1108,8 @@ "-Wno-narrowing", ] - # Don't warn about the "typedef 'foo' locally defined but not used" - # for gcc 4.8. - # TODO: remove this flag once all builds work. See crbug.com/227506 + # -Wunused-local-typedefs is broken in gcc, + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63872 cflags += [ "-Wno-unused-local-typedefs" ] # Don't warn about "maybe" uninitialized. Clang doesn't include this
diff --git a/build/config/jumbo.gni b/build/config/jumbo.gni index 364485cb..06aa8749f 100644 --- a/build/config/jumbo.gni +++ b/build/config/jumbo.gni
@@ -133,6 +133,11 @@ args = [ "--outputs" ] + rebase_path(outputs, root_build_dir) + [ "--file-list={{response_file_name}}" ] } + } else { + # If the list subtraction triggers a gn error, + # jumbo_excluded_sources lists a file that is not in sources. + sources_after_exclusion = invoker.sources - excluded_sources + assert(sources_after_exclusion != [] || true) # Prevent "unused variable". } target_type = invoker.target_type
diff --git a/build/fuchsia/test_runner.py b/build/fuchsia/test_runner.py index e2c832a8..2c0395e8 100755 --- a/build/fuchsia/test_runner.py +++ b/build/fuchsia/test_runner.py
@@ -101,7 +101,9 @@ def BuildBootfs(output_directory, runtime_deps_path, test_name, gtest_filter, - gtest_repeat, test_launcher_filter_file, dry_run): + gtest_repeat, test_launcher_batch_limit, + test_launcher_filter_file, test_launcher_jobs, + single_process_tests, dry_run): with open(runtime_deps_path) as f: lines = f.readlines() @@ -133,11 +135,14 @@ autorun_file.write('#!/bin/sh\n') autorun_file.write('/system/' + os.path.basename(test_name)) autorun_file.write(' --test-launcher-retry-limit=0') + if int(os.environ.get('CHROME_HEADLESS', 0)) != 0: # When running on bots (without KVM) execution is quite slow. The test # launcher times out a subprocess after 45s which can be too short. Make the # timeout twice as long. autorun_file.write(' --test-launcher-timeout=90000') + if single_process_tests: + autorun_file.write(' --single-process-tests') if test_launcher_filter_file: test_launcher_filter_file = os.path.normpath( os.path.join(output_directory, test_launcher_filter_file)) @@ -147,6 +152,12 @@ filter_file_on_device) target_source_pairs.append( [filter_file_on_device, test_launcher_filter_file]) + if test_launcher_batch_limit: + autorun_file.write(' --test-launcher-batch-limit=%d' % + test_launcher_batch_limit) + if test_launcher_jobs: + autorun_file.write(' --test-launcher-jobs=%d' % + test_launcher_jobs) if gtest_filter: autorun_file.write(' --gtest_filter=' + gtest_filter) if gtest_repeat: @@ -210,18 +221,33 @@ type=os.path.realpath, help='Name of the the test') parser.add_argument('--gtest_filter', - help='GTest filter to use in place of any default') + help='GTest filter to use in place of any default.') parser.add_argument('--gtest_repeat', - help='GTest repeat value to use') + help='GTest repeat value to use.') + parser.add_argument('--single-process-tests', action='store_true', + default=False, + help='Runs the tests and the launcher in the same ' + 'process. Useful for debugging.') + parser.add_argument('--test-launcher-batch-limit', + type=int, + help='Sets the limit of test batch to run in a single ' + 'process.') + # --test-launcher-filter-file is specified relative to --output-directory, + # so specifying type=os.path.* will break it. parser.add_argument('--test-launcher-filter-file', - help='Pass filter file through to target process') + help='Pass filter file through to target process.') + parser.add_argument('--test-launcher-jobs', + type=int, + help='Sets the number of parallel test jobs.') parser.add_argument('--test_launcher_summary_output', help='Currently ignored for 2-sided roll.') args = parser.parse_args() bootfs = BuildBootfs(args.output_directory, args.runtime_deps_path, args.test_name, args.gtest_filter, args.gtest_repeat, - args.test_launcher_filter_file, args.dry_run) + args.test_launcher_batch_limit, + args.test_launcher_filter_file, args.test_launcher_jobs, + args.single_process_tests, args.dry_run) qemu_path = os.path.join(SDK_ROOT, 'qemu', 'bin', 'qemu-system-x86_64')
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index eb95eda..d4917244 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -303,8 +303,6 @@ "resources/single_release_callback.h", "resources/single_release_callback_impl.cc", "resources/single_release_callback_impl.h", - "resources/texture_mailbox.cc", - "resources/texture_mailbox.h", "resources/transferable_resource.cc", "resources/transferable_resource.h", "resources/ui_resource_bitmap.cc",
diff --git a/cc/DEPS b/cc/DEPS index bf4ab29b..6b2dad82 100644 --- a/cc/DEPS +++ b/cc/DEPS
@@ -1,6 +1,5 @@ include_rules = [ - "+components/viz/common/quads", - "+components/viz/common/resources", + "+components/viz/common", "+gpu/GLES2", "+gpu/command_buffer/client/context_support.h", "+gpu/command_buffer/client/gles2_interface.h",
diff --git a/cc/base/switches.cc b/cc/base/switches.cc index 0d0e13b1..cb2d0e2 100644 --- a/cc/base/switches.cc +++ b/cc/base/switches.cc
@@ -50,8 +50,8 @@ const char kEnableGpuBenchmarking[] = "enable-gpu-benchmarking"; // Enables multi-client Surface synchronization. In practice, this indicates -// that LayerTreeHost expects to be given a valid LocalSurfaceId provided by -// the parent compositor. +// that LayerTreeHost expects to be given a valid viz::LocalSurfaceId provided +// by the parent compositor. const char kEnableSurfaceSynchronization[] = "enable-surface-synchronization"; // Renders a border around compositor layers to help debug and study
diff --git a/cc/ipc/cc_param_traits.cc b/cc/ipc/cc_param_traits.cc index 9acb2f9a..6f2fbb8 100644 --- a/cc/ipc/cc_param_traits.cc +++ b/cc/ipc/cc_param_traits.cc
@@ -20,7 +20,7 @@ #include "cc/quads/surface_draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/quads/yuv_video_draw_quad.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkFlattenableSerialization.h" #include "third_party/skia/include/core/SkImageFilter.h" @@ -615,20 +615,21 @@ l->append("])"); } -void ParamTraits<cc::FrameSinkId>::GetSize(base::PickleSizer* s, - const param_type& p) { +void ParamTraits<viz::FrameSinkId>::GetSize(base::PickleSizer* s, + const param_type& p) { GetParamSize(s, p.client_id()); GetParamSize(s, p.sink_id()); } -void ParamTraits<cc::FrameSinkId>::Write(base::Pickle* m, const param_type& p) { +void ParamTraits<viz::FrameSinkId>::Write(base::Pickle* m, + const param_type& p) { WriteParam(m, p.client_id()); WriteParam(m, p.sink_id()); } -bool ParamTraits<cc::FrameSinkId>::Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p) { +bool ParamTraits<viz::FrameSinkId>::Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p) { uint32_t client_id; if (!ReadParam(m, iter, &client_id)) return false; @@ -637,33 +638,33 @@ if (!ReadParam(m, iter, &sink_id)) return false; - *p = cc::FrameSinkId(client_id, sink_id); + *p = viz::FrameSinkId(client_id, sink_id); return true; } -void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { - l->append("FrameSinkId("); +void ParamTraits<viz::FrameSinkId>::Log(const param_type& p, std::string* l) { + l->append("viz::FrameSinkId("); LogParam(p.client_id(), l); l->append(", "); LogParam(p.sink_id(), l); l->append(")"); } -void ParamTraits<cc::LocalSurfaceId>::GetSize(base::PickleSizer* s, - const param_type& p) { +void ParamTraits<viz::LocalSurfaceId>::GetSize(base::PickleSizer* s, + const param_type& p) { GetParamSize(s, p.local_id()); GetParamSize(s, p.nonce()); } -void ParamTraits<cc::LocalSurfaceId>::Write(base::Pickle* m, - const param_type& p) { +void ParamTraits<viz::LocalSurfaceId>::Write(base::Pickle* m, + const param_type& p) { WriteParam(m, p.local_id()); WriteParam(m, p.nonce()); } -bool ParamTraits<cc::LocalSurfaceId>::Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p) { +bool ParamTraits<viz::LocalSurfaceId>::Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p) { uint32_t local_id; if (!ReadParam(m, iter, &local_id)) return false; @@ -672,46 +673,47 @@ if (!ReadParam(m, iter, &nonce)) return false; - *p = cc::LocalSurfaceId(local_id, nonce); + *p = viz::LocalSurfaceId(local_id, nonce); return true; } -void ParamTraits<cc::LocalSurfaceId>::Log(const param_type& p, std::string* l) { - l->append("LocalSurfaceId("); +void ParamTraits<viz::LocalSurfaceId>::Log(const param_type& p, + std::string* l) { + l->append("viz::LocalSurfaceId("); LogParam(p.local_id(), l); l->append(", "); LogParam(p.nonce(), l); l->append(")"); } -void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, - const param_type& p) { +void ParamTraits<viz::SurfaceId>::GetSize(base::PickleSizer* s, + const param_type& p) { GetParamSize(s, p.frame_sink_id()); GetParamSize(s, p.local_surface_id()); } -void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { +void ParamTraits<viz::SurfaceId>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.frame_sink_id()); WriteParam(m, p.local_surface_id()); } -bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p) { - cc::FrameSinkId frame_sink_id; +bool ParamTraits<viz::SurfaceId>::Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p) { + viz::FrameSinkId frame_sink_id; if (!ReadParam(m, iter, &frame_sink_id)) return false; - cc::LocalSurfaceId local_surface_id; + viz::LocalSurfaceId local_surface_id; if (!ReadParam(m, iter, &local_surface_id)) return false; - *p = cc::SurfaceId(frame_sink_id, local_surface_id); + *p = viz::SurfaceId(frame_sink_id, local_surface_id); return true; } -void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { - l->append("SurfaceId("); +void ParamTraits<viz::SurfaceId>::Log(const param_type& p, std::string* l) { + l->append("viz::SurfaceId("); LogParam(p.frame_sink_id(), l); l->append(", "); LogParam(p.local_surface_id(), l); @@ -734,7 +736,7 @@ bool ParamTraits<cc::SurfaceInfo>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { - cc::SurfaceId surface_id; + viz::SurfaceId surface_id; if (!ReadParam(m, iter, &surface_id)) return false;
diff --git a/cc/ipc/cc_param_traits.h b/cc/ipc/cc_param_traits.h index d2e8b599..a1fb5f75 100644 --- a/cc/ipc/cc_param_traits.h +++ b/cc/ipc/cc_param_traits.h
@@ -67,8 +67,8 @@ }; template <> -struct CC_IPC_EXPORT ParamTraits<cc::FrameSinkId> { - typedef cc::FrameSinkId param_type; +struct CC_IPC_EXPORT ParamTraits<viz::FrameSinkId> { + typedef viz::FrameSinkId param_type; static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, @@ -78,8 +78,8 @@ }; template <> -struct CC_IPC_EXPORT ParamTraits<cc::LocalSurfaceId> { - typedef cc::LocalSurfaceId param_type; +struct CC_IPC_EXPORT ParamTraits<viz::LocalSurfaceId> { + typedef viz::LocalSurfaceId param_type; static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, @@ -89,8 +89,8 @@ }; template <> -struct CC_IPC_EXPORT ParamTraits<cc::SurfaceId> { - typedef cc::SurfaceId param_type; +struct CC_IPC_EXPORT ParamTraits<viz::SurfaceId> { + typedef viz::SurfaceId param_type; static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m,
diff --git a/cc/ipc/cc_param_traits_macros.h b/cc/ipc/cc_param_traits_macros.h index 7bb91782..934fd4a4 100644 --- a/cc/ipc/cc_param_traits_macros.h +++ b/cc/ipc/cc_param_traits_macros.h
@@ -20,10 +20,10 @@ #include "cc/quads/yuv_video_draw_quad.h" #include "cc/resources/returned_resource.h" #include "cc/resources/transferable_resource.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" #include "cc/surfaces/surface_sequence.h" #include "components/viz/common/quads/resource_format.h" +#include "components/viz/common/surface_id.h" #include "ui/gfx/ipc/color/gfx_param_traits.h" #include "ui/gfx/ipc/gfx_param_traits.h" #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
diff --git a/cc/ipc/cc_param_traits_unittest.cc b/cc/ipc/cc_param_traits_unittest.cc index 5da53a13..8d003a9 100644 --- a/cc/ipc/cc_param_traits_unittest.cc +++ b/cc/ipc/cc_param_traits_unittest.cc
@@ -44,7 +44,7 @@ namespace content { namespace { -static constexpr cc::FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); class CCParamTraitsTest : public testing::Test { protected: @@ -383,9 +383,9 @@ pass_cmp->CopyFromAndAppendDrawQuad(streamvideo_in, streamvideo_in->shared_quad_state); - cc::SurfaceId arbitrary_surface_id( + viz::SurfaceId arbitrary_surface_id( kArbitraryFrameSinkId, - cc::LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); SurfaceDrawQuad* surface_in = pass_in->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); surface_in->SetAll(shared_state3_in, arbitrary_rect2, @@ -641,9 +641,9 @@ TEST_F(CCParamTraitsTest, SurfaceInfo) { IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - const cc::SurfaceId kArbitrarySurfaceId( + const viz::SurfaceId kArbitrarySurfaceId( kArbitraryFrameSinkId, - cc::LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); constexpr float kArbitraryDeviceScaleFactor = 0.9f; const gfx::Size kArbitrarySize(65, 321); const cc::SurfaceInfo surface_info_in(
diff --git a/cc/ipc/compositor_frame_metadata.typemap b/cc/ipc/compositor_frame_metadata.typemap index e9d96d9..c2818d1 100644 --- a/cc/ipc/compositor_frame_metadata.typemap +++ b/cc/ipc/compositor_frame_metadata.typemap
@@ -5,6 +5,9 @@ mojom = "//cc/ipc/compositor_frame_metadata.mojom" public_headers = [ "//cc/output/compositor_frame_metadata.h" ] traits_headers = [ "//cc/ipc/compositor_frame_metadata_struct_traits.h" ] +deps = [ + "//components/viz/common", +] sources = [ "compositor_frame_metadata_struct_traits.cc", ]
diff --git a/cc/ipc/compositor_frame_metadata_struct_traits.h b/cc/ipc/compositor_frame_metadata_struct_traits.h index 2959aba..caab25b 100644 --- a/cc/ipc/compositor_frame_metadata_struct_traits.h +++ b/cc/ipc/compositor_frame_metadata_struct_traits.h
@@ -101,12 +101,12 @@ return metadata.latency_info; } - static const std::vector<cc::SurfaceId>& referenced_surfaces( + static const std::vector<viz::SurfaceId>& referenced_surfaces( const cc::CompositorFrameMetadata& metadata) { return metadata.referenced_surfaces; } - static const std::vector<cc::SurfaceId>& activation_dependencies( + static const std::vector<viz::SurfaceId>& activation_dependencies( const cc::CompositorFrameMetadata& metadata) { return metadata.activation_dependencies; }
diff --git a/cc/ipc/copy_output_request_struct_traits.h b/cc/ipc/copy_output_request_struct_traits.h index 7bc31687..4e96b7e 100644 --- a/cc/ipc/copy_output_request_struct_traits.h +++ b/cc/ipc/copy_output_request_struct_traits.h
@@ -31,7 +31,7 @@ return request->area_; } - static const base::Optional<cc::TextureMailbox>& texture_mailbox( + static const base::Optional<viz::TextureMailbox>& texture_mailbox( const std::unique_ptr<cc::CopyOutputRequest>& request) { return request->texture_mailbox_; }
diff --git a/cc/ipc/copy_output_result_struct_traits.cc b/cc/ipc/copy_output_result_struct_traits.cc index abdbb25..e4ae70d 100644 --- a/cc/ipc/copy_output_result_struct_traits.cc +++ b/cc/ipc/copy_output_result_struct_traits.cc
@@ -84,7 +84,7 @@ // constructor of cc::CopyOutputResult. gfx::Size size; auto bitmap = base::MakeUnique<SkBitmap>(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; if (!data.ReadSize(&size))
diff --git a/cc/ipc/copy_output_result_struct_traits.h b/cc/ipc/copy_output_result_struct_traits.h index e18d7ab..edfa604 100644 --- a/cc/ipc/copy_output_result_struct_traits.h +++ b/cc/ipc/copy_output_result_struct_traits.h
@@ -25,7 +25,7 @@ static const SkBitmap& bitmap( const std::unique_ptr<cc::CopyOutputResult>& result); - static const cc::TextureMailbox& texture_mailbox( + static const viz::TextureMailbox& texture_mailbox( const std::unique_ptr<cc::CopyOutputResult>& result) { return result->texture_mailbox_; }
diff --git a/cc/ipc/frame_sink_id.typemap b/cc/ipc/frame_sink_id.typemap index d63c299..654c5b2f 100644 --- a/cc/ipc/frame_sink_id.typemap +++ b/cc/ipc/frame_sink_id.typemap
@@ -3,6 +3,9 @@ # found in the LICENSE file. mojom = "//cc/ipc/frame_sink_id.mojom" -public_headers = [ "//cc/surfaces/frame_sink_id.h" ] +public_headers = [ "//components/viz/common/frame_sink_id.h" ] +deps = [ + "//components/viz/common", +] traits_headers = [ "//cc/ipc/frame_sink_id_struct_traits.h" ] -type_mappings = [ "cc.mojom.FrameSinkId=cc::FrameSinkId" ] +type_mappings = [ "cc.mojom.FrameSinkId=viz::FrameSinkId" ]
diff --git a/cc/ipc/frame_sink_id_struct_traits.h b/cc/ipc/frame_sink_id_struct_traits.h index 3a879a3..8d91a2d 100644 --- a/cc/ipc/frame_sink_id_struct_traits.h +++ b/cc/ipc/frame_sink_id_struct_traits.h
@@ -6,22 +6,22 @@ #define CC_IPC_FRAME_SINK_ID_STRUCT_TRAITS_H_ #include "cc/ipc/frame_sink_id.mojom-shared.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" namespace mojo { template <> -struct StructTraits<cc::mojom::FrameSinkIdDataView, cc::FrameSinkId> { - static uint32_t client_id(const cc::FrameSinkId& frame_sink_id) { +struct StructTraits<cc::mojom::FrameSinkIdDataView, viz::FrameSinkId> { + static uint32_t client_id(const viz::FrameSinkId& frame_sink_id) { return frame_sink_id.client_id(); } - static uint32_t sink_id(const cc::FrameSinkId& frame_sink_id) { + static uint32_t sink_id(const viz::FrameSinkId& frame_sink_id) { return frame_sink_id.sink_id(); } - static bool Read(cc::mojom::FrameSinkIdDataView data, cc::FrameSinkId* out) { - *out = cc::FrameSinkId(data.client_id(), data.sink_id()); + static bool Read(cc::mojom::FrameSinkIdDataView data, viz::FrameSinkId* out) { + *out = viz::FrameSinkId(data.client_id(), data.sink_id()); return true; } };
diff --git a/cc/ipc/local_surface_id.typemap b/cc/ipc/local_surface_id.typemap index 832477a..ac81237a 100644 --- a/cc/ipc/local_surface_id.typemap +++ b/cc/ipc/local_surface_id.typemap
@@ -3,6 +3,9 @@ # found in the LICENSE file. mojom = "//cc/ipc/local_surface_id.mojom" -public_headers = [ "//cc/surfaces/local_surface_id.h" ] +public_headers = [ "//components/viz/common/local_surface_id.h" ] +deps = [ + "//components/viz/common", +] traits_headers = [ "//cc/ipc/local_surface_id_struct_traits.h" ] -type_mappings = [ "cc.mojom.LocalSurfaceId=cc::LocalSurfaceId" ] +type_mappings = [ "cc.mojom.LocalSurfaceId=viz::LocalSurfaceId" ]
diff --git a/cc/ipc/local_surface_id_struct_traits.h b/cc/ipc/local_surface_id_struct_traits.h index ee53990..e0ad34f0 100644 --- a/cc/ipc/local_surface_id_struct_traits.h +++ b/cc/ipc/local_surface_id_struct_traits.h
@@ -6,24 +6,24 @@ #define CC_IPC_LOCAL_SURFACE_ID_STRUCT_TRAITS_H_ #include "cc/ipc/local_surface_id.mojom-shared.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "mojo/common/common_custom_types_struct_traits.h" namespace mojo { template <> -struct StructTraits<cc::mojom::LocalSurfaceIdDataView, cc::LocalSurfaceId> { - static uint32_t local_id(const cc::LocalSurfaceId& local_surface_id) { +struct StructTraits<cc::mojom::LocalSurfaceIdDataView, viz::LocalSurfaceId> { + static uint32_t local_id(const viz::LocalSurfaceId& local_surface_id) { return local_surface_id.local_id(); } static const base::UnguessableToken& nonce( - const cc::LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { return local_surface_id.nonce(); } static bool Read(cc::mojom::LocalSurfaceIdDataView data, - cc::LocalSurfaceId* out) { + viz::LocalSurfaceId* out) { out->local_id_ = data.local_id(); return data.ReadNonce(&out->nonce_); }
diff --git a/cc/ipc/quads_struct_traits.h b/cc/ipc/quads_struct_traits.h index 1a2892f..d0ec09d 100644 --- a/cc/ipc/quads_struct_traits.h +++ b/cc/ipc/quads_struct_traits.h
@@ -234,7 +234,7 @@ }; template <> struct StructTraits<cc::mojom::SurfaceQuadStateDataView, cc::DrawQuad> { - static const cc::SurfaceId& surface(const cc::DrawQuad& input) { + static const viz::SurfaceId& surface(const cc::DrawQuad& input) { const cc::SurfaceDrawQuad* quad = cc::SurfaceDrawQuad::MaterialCast(&input); return quad->surface_id; }
diff --git a/cc/ipc/struct_traits_unittest.cc b/cc/ipc/struct_traits_unittest.cc index 48f7269..6c69c7f0 100644 --- a/cc/ipc/struct_traits_unittest.cc +++ b/cc/ipc/struct_traits_unittest.cc
@@ -102,7 +102,7 @@ std::move(callback).Run(s); } - void EchoSurfaceId(const SurfaceId& s, + void EchoSurfaceId(const viz::SurfaceId& s, EchoSurfaceIdCallback callback) override { std::move(callback).Run(s); } @@ -117,7 +117,7 @@ std::move(callback).Run(s); } - void EchoTextureMailbox(const TextureMailbox& t, + void EchoTextureMailbox(const viz::TextureMailbox& t, EchoTextureMailboxCallback callback) override { std::move(callback).Run(t); } @@ -366,13 +366,15 @@ latency_info.AddLatencyNumber( ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 1337, 7331); std::vector<ui::LatencyInfo> latency_infos = {latency_info}; - std::vector<SurfaceId> referenced_surfaces; - SurfaceId id(FrameSinkId(1234, 4321), - LocalSurfaceId(5678, base::UnguessableToken::Create())); + std::vector<viz::SurfaceId> referenced_surfaces; + viz::SurfaceId id( + viz::FrameSinkId(1234, 4321), + viz::LocalSurfaceId(5678, base::UnguessableToken::Create())); referenced_surfaces.push_back(id); - std::vector<SurfaceId> activation_dependencies; - SurfaceId id2(FrameSinkId(4321, 1234), - LocalSurfaceId(8765, base::UnguessableToken::Create())); + std::vector<viz::SurfaceId> activation_dependencies; + viz::SurfaceId id2( + viz::FrameSinkId(4321, 1234), + viz::LocalSurfaceId(8765, base::UnguessableToken::Create())); activation_dependencies.push_back(id2); uint32_t frame_token = 0xdeadbeef; uint64_t begin_frame_ack_sequence_number = 0xdeadbeef; @@ -477,7 +479,7 @@ const uint32_t target = 3; gpu::Mailbox mailbox; mailbox.SetName(mailbox_name); - TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(), target); + viz::TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(), target); base::RunLoop run_loop; auto callback = base::Bind(CopyOutputRequestCallback, run_loop.QuitClosure(), gfx::Size()); @@ -565,7 +567,7 @@ CopyOutputResultCallback, run_loop.QuitClosure(), sync_token, is_lost)); gpu::Mailbox mailbox; mailbox.SetName(mailbox_name); - TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(), target); + viz::TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(), target); auto input = CopyOutputResult::CreateTextureResult(size, texture_mailbox, std::move(callback)); @@ -578,7 +580,7 @@ EXPECT_TRUE(output->HasTexture()); EXPECT_EQ(size, output->size()); - TextureMailbox out_mailbox; + viz::TextureMailbox out_mailbox; std::unique_ptr<SingleReleaseCallback> out_callback; output->TakeTexture(&out_mailbox, &out_callback); EXPECT_EQ(mailbox, out_mailbox.mailbox()); @@ -680,12 +682,12 @@ solid_quad->SetNew(sqs, rect2, rect2, color2, force_anti_aliasing_off); const gfx::Rect rect3(1029, 3847, 5610, 2938); - const SurfaceId primary_surface_id( - FrameSinkId(1234, 4321), - LocalSurfaceId(5678, base::UnguessableToken::Create())); - const SurfaceId fallback_surface_id( - FrameSinkId(2468, 1357), - LocalSurfaceId(1234, base::UnguessableToken::Create())); + const viz::SurfaceId primary_surface_id( + viz::FrameSinkId(1234, 4321), + viz::LocalSurfaceId(5678, base::UnguessableToken::Create())); + const viz::SurfaceId fallback_surface_id( + viz::FrameSinkId(2468, 1357), + viz::LocalSurfaceId(1234, base::UnguessableToken::Create())); SurfaceDrawQuad* primary_surface_quad = render_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); SurfaceDrawQuad* fallback_surface_quad = @@ -876,8 +878,9 @@ const gfx::Rect surface_quad_rect(1337, 2448, 1234, 5678); surface_quad->SetNew( shared_state_2, surface_quad_rect, surface_quad_rect, - SurfaceId(FrameSinkId(1337, 1234), - LocalSurfaceId(1234, base::UnguessableToken::Create())), + viz::SurfaceId( + viz::FrameSinkId(1337, 1234), + viz::LocalSurfaceId(1234, base::UnguessableToken::Create())), SurfaceDrawQuadType::PRIMARY, nullptr); std::unique_ptr<RenderPass> output; @@ -1023,26 +1026,26 @@ } TEST_F(StructTraitsTest, SurfaceId) { - static constexpr FrameSinkId frame_sink_id(1337, 1234); - static LocalSurfaceId local_surface_id(0xfbadbeef, - base::UnguessableToken::Create()); - SurfaceId input(frame_sink_id, local_surface_id); + static constexpr viz::FrameSinkId frame_sink_id(1337, 1234); + static viz::LocalSurfaceId local_surface_id(0xfbadbeef, + base::UnguessableToken::Create()); + viz::SurfaceId input(frame_sink_id, local_surface_id); mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); - SurfaceId output; + viz::SurfaceId output; proxy->EchoSurfaceId(input, &output); EXPECT_EQ(frame_sink_id, output.frame_sink_id()); EXPECT_EQ(local_surface_id, output.local_surface_id()); } TEST_F(StructTraitsTest, SurfaceReference) { - const SurfaceId parent_id( - FrameSinkId(2016, 1234), - LocalSurfaceId(0xfbadbeef, - base::UnguessableToken::Deserialize(123, 456))); - const SurfaceId child_id( - FrameSinkId(1111, 9999), - LocalSurfaceId(0xabcdabcd, - base::UnguessableToken::Deserialize(333, 333))); + const viz::SurfaceId parent_id( + viz::FrameSinkId(2016, 1234), + viz::LocalSurfaceId(0xfbadbeef, + base::UnguessableToken::Deserialize(123, 456))); + const viz::SurfaceId child_id( + viz::FrameSinkId(1111, 9999), + viz::LocalSurfaceId(0xabcdabcd, + base::UnguessableToken::Deserialize(333, 333))); const SurfaceReference input(parent_id, child_id); mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); @@ -1053,7 +1056,7 @@ } TEST_F(StructTraitsTest, SurfaceSequence) { - const FrameSinkId frame_sink_id(2016, 1234); + const viz::FrameSinkId frame_sink_id(2016, 1234); const uint32_t sequence = 0xfbadbeef; SurfaceSequence input(frame_sink_id, sequence); mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); @@ -1116,8 +1119,8 @@ gpu::Mailbox mailbox; mailbox.SetName(mailbox_name); - TextureMailbox input(mailbox, sync_token, texture_target, size_in_pixels, - is_overlay_candidate, secure_output_only); + viz::TextureMailbox input(mailbox, sync_token, texture_target, size_in_pixels, + is_overlay_candidate, secure_output_only); input.set_nearest_neighbor(nearest_neighbor); input.set_color_space(color_space); #if defined(OS_ANDROID) @@ -1126,7 +1129,7 @@ #endif mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); - TextureMailbox output; + viz::TextureMailbox output; proxy->EchoTextureMailbox(input, &output); EXPECT_EQ(mailbox, output.mailbox());
diff --git a/cc/ipc/surface_id.typemap b/cc/ipc/surface_id.typemap index f272a820..9a9ef20a 100644 --- a/cc/ipc/surface_id.typemap +++ b/cc/ipc/surface_id.typemap
@@ -3,6 +3,9 @@ # found in the LICENSE file. mojom = "//cc/ipc/surface_id.mojom" -public_headers = [ "//cc/surfaces/surface_id.h" ] +public_headers = [ "//components/viz/common/surface_id.h" ] +deps = [ + "//components/viz/common", +] traits_headers = [ "//cc/ipc/surface_id_struct_traits.h" ] -type_mappings = [ "cc.mojom.SurfaceId=cc::SurfaceId" ] +type_mappings = [ "cc.mojom.SurfaceId=viz::SurfaceId" ]
diff --git a/cc/ipc/surface_id_struct_traits.h b/cc/ipc/surface_id_struct_traits.h index 3f3b7cd6..dc12c80e 100644 --- a/cc/ipc/surface_id_struct_traits.h +++ b/cc/ipc/surface_id_struct_traits.h
@@ -8,23 +8,23 @@ #include "cc/ipc/frame_sink_id_struct_traits.h" #include "cc/ipc/local_surface_id_struct_traits.h" #include "cc/ipc/surface_id.mojom-shared.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/local_surface_id.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id.h" +#include "components/viz/common/surface_id.h" namespace mojo { template <> -struct StructTraits<cc::mojom::SurfaceIdDataView, cc::SurfaceId> { - static const cc::FrameSinkId& frame_sink_id(const cc::SurfaceId& id) { +struct StructTraits<cc::mojom::SurfaceIdDataView, viz::SurfaceId> { + static const viz::FrameSinkId& frame_sink_id(const viz::SurfaceId& id) { return id.frame_sink_id(); } - static const cc::LocalSurfaceId& local_surface_id(const cc::SurfaceId& id) { + static const viz::LocalSurfaceId& local_surface_id(const viz::SurfaceId& id) { return id.local_surface_id(); } - static bool Read(cc::mojom::SurfaceIdDataView data, cc::SurfaceId* out) { + static bool Read(cc::mojom::SurfaceIdDataView data, viz::SurfaceId* out) { return data.ReadFrameSinkId(&out->frame_sink_id_) && data.ReadLocalSurfaceId(&out->local_surface_id_); }
diff --git a/cc/ipc/surface_info_struct_traits.h b/cc/ipc/surface_info_struct_traits.h index 8b032e31..13a2ae6 100644 --- a/cc/ipc/surface_info_struct_traits.h +++ b/cc/ipc/surface_info_struct_traits.h
@@ -12,7 +12,7 @@ template <> struct StructTraits<cc::mojom::SurfaceInfoDataView, cc::SurfaceInfo> { - static const cc::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) { + static const viz::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) { return surface_info.id(); }
diff --git a/cc/ipc/surface_reference_struct_traits.h b/cc/ipc/surface_reference_struct_traits.h index 209f1b3..9b89e39 100644 --- a/cc/ipc/surface_reference_struct_traits.h +++ b/cc/ipc/surface_reference_struct_traits.h
@@ -7,18 +7,18 @@ #include "cc/ipc/surface_id_struct_traits.h" #include "cc/ipc/surface_reference.mojom-shared.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference.h" +#include "components/viz/common/surface_id.h" namespace mojo { template <> struct StructTraits<cc::mojom::SurfaceReferenceDataView, cc::SurfaceReference> { - static const cc::SurfaceId& parent_id(const cc::SurfaceReference& ref) { + static const viz::SurfaceId& parent_id(const cc::SurfaceReference& ref) { return ref.parent_id(); } - static const cc::SurfaceId& child_id(const cc::SurfaceReference& ref) { + static const viz::SurfaceId& child_id(const cc::SurfaceReference& ref) { return ref.child_id(); }
diff --git a/cc/ipc/surface_sequence_struct_traits.h b/cc/ipc/surface_sequence_struct_traits.h index 0ad45878..1b30ee0 100644 --- a/cc/ipc/surface_sequence_struct_traits.h +++ b/cc/ipc/surface_sequence_struct_traits.h
@@ -12,7 +12,7 @@ template <> struct StructTraits<cc::mojom::SurfaceSequenceDataView, cc::SurfaceSequence> { - static const cc::FrameSinkId& frame_sink_id(const cc::SurfaceSequence& id) { + static const viz::FrameSinkId& frame_sink_id(const cc::SurfaceSequence& id) { return id.frame_sink_id; } @@ -22,7 +22,7 @@ static bool Read(cc::mojom::SurfaceSequenceDataView data, cc::SurfaceSequence* out) { - cc::FrameSinkId frame_sink_id; + viz::FrameSinkId frame_sink_id; if (!data.ReadFrameSinkId(&frame_sink_id)) return false; *out = cc::SurfaceSequence(frame_sink_id, data.sequence());
diff --git a/cc/ipc/texture_mailbox.typemap b/cc/ipc/texture_mailbox.typemap index 71d9947..be37c00b 100644 --- a/cc/ipc/texture_mailbox.typemap +++ b/cc/ipc/texture_mailbox.typemap
@@ -3,6 +3,9 @@ # found in the LICENSE file. mojom = "//cc/ipc/texture_mailbox.mojom" -public_headers = [ "//cc/resources/texture_mailbox.h" ] +public_headers = [ "//components/viz/common/quads/texture_mailbox.h" ] traits_headers = [ "//cc/ipc/texture_mailbox_struct_traits.h" ] -type_mappings = [ "cc.mojom.TextureMailbox=cc::TextureMailbox" ] +deps = [ + "//components/viz/common", +] +type_mappings = [ "cc.mojom.TextureMailbox=viz::TextureMailbox" ]
diff --git a/cc/ipc/texture_mailbox_struct_traits.h b/cc/ipc/texture_mailbox_struct_traits.h index dc4d88f..9f10322 100644 --- a/cc/ipc/texture_mailbox_struct_traits.h +++ b/cc/ipc/texture_mailbox_struct_traits.h
@@ -6,7 +6,7 @@ #define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ #include "cc/ipc/texture_mailbox.mojom-shared.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/ipc/common/mailbox_holder_struct_traits.h" #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" #include "ui/gfx/ipc/color/gfx_param_traits.h" @@ -14,21 +14,21 @@ namespace mojo { template <> -struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { +struct StructTraits<cc::mojom::TextureMailboxDataView, viz::TextureMailbox> { static const gpu::MailboxHolder& mailbox_holder( - const cc::TextureMailbox& input) { + const viz::TextureMailbox& input) { return input.mailbox_holder_; } - static const gfx::Size& size_in_pixels(const cc::TextureMailbox& input) { + static const gfx::Size& size_in_pixels(const viz::TextureMailbox& input) { return input.size_in_pixels_; } - static bool is_overlay_candidate(const cc::TextureMailbox& input) { + static bool is_overlay_candidate(const viz::TextureMailbox& input) { return input.is_overlay_candidate_; } - static bool is_backed_by_surface_texture(const cc::TextureMailbox& input) { + static bool is_backed_by_surface_texture(const viz::TextureMailbox& input) { #if defined(OS_ANDROID) return input.is_backed_by_surface_texture_; #else @@ -36,7 +36,7 @@ #endif } - static bool wants_promotion_hint(const cc::TextureMailbox& input) { + static bool wants_promotion_hint(const viz::TextureMailbox& input) { #if defined(OS_ANDROID) return input.wants_promotion_hint_; #else @@ -44,20 +44,20 @@ #endif } - static bool secure_output_only(const cc::TextureMailbox& input) { + static bool secure_output_only(const viz::TextureMailbox& input) { return input.secure_output_only_; } - static bool nearest_neighbor(const cc::TextureMailbox& input) { + static bool nearest_neighbor(const viz::TextureMailbox& input) { return input.nearest_neighbor_; } - static const gfx::ColorSpace& color_space(const cc::TextureMailbox& input) { + static const gfx::ColorSpace& color_space(const viz::TextureMailbox& input) { return input.color_space_; } static bool Read(cc::mojom::TextureMailboxDataView data, - cc::TextureMailbox* out) { + viz::TextureMailbox* out) { #if defined(OS_ANDROID) out->is_backed_by_surface_texture_ = data.is_backed_by_surface_texture(); out->wants_promotion_hint_ = data.wants_promotion_hint();
diff --git a/cc/layers/append_quads_data.h b/cc/layers/append_quads_data.h index 5fec36e..89930a5 100644 --- a/cc/layers/append_quads_data.h +++ b/cc/layers/append_quads_data.h
@@ -9,7 +9,7 @@ #include <vector> #include "cc/cc_export.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -33,7 +33,7 @@ // This is the set of surface IDs that must have corresponding // active CompositorFrames so that this CompositorFrame can // activate. - std::vector<SurfaceId> activation_dependencies; + std::vector<viz::SurfaceId> activation_dependencies; }; } // namespace cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 6e45fd3..245b929 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -455,10 +455,7 @@ return GetEffectTree().Node(effect_tree_index())->subtree_has_copy_request; } -void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() { - if (scrollable()) - UpdatePropertyTreeScrollOffset(); - +void LayerImpl::UpdatePropertyTreeForAnimationIfNeeded() { if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { if (TransformNode* node = GetTransformTree().FindNodeFromElementId(element_id())) { @@ -711,24 +708,6 @@ return GetScrollTree().current_scroll_offset(element_id()); } -void LayerImpl::UpdatePropertyTreeScrollOffset() { - // TODO(enne): in the future, scrolling should update the scroll tree - // directly instead of going through layers. - TransformTree& transform_tree = GetTransformTree(); - TransformNode* node = transform_tree.Node(transform_tree_index_); - DCHECK(node); - // TODO(pdr): This is a workaround for https://crbug.com/712298 to avoid - // crashing when there's no transform node. This workaround should be removed. - if (!node) - return; - gfx::ScrollOffset current_offset = CurrentScrollOffset(); - if (node->scroll_offset != current_offset) { - node->scroll_offset = current_offset; - node->needs_local_transform_update = true; - transform_tree.set_needs_update(true); - } -} - SimpleEnclosedRegion LayerImpl::VisibleOpaqueRegion() const { if (contents_opaque()) return SimpleEnclosedRegion(visible_layer_rect());
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 87891ce..57c5c6d 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h
@@ -410,7 +410,7 @@ bool has_copy_requests_in_target_subtree(); - void UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); + void UpdatePropertyTreeForAnimationIfNeeded(); float GetIdealContentsScale() const;
diff --git a/cc/layers/surface_layer_impl.h b/cc/layers/surface_layer_impl.h index 3c51882..a073966 100644 --- a/cc/layers/surface_layer_impl.h +++ b/cc/layers/surface_layer_impl.h
@@ -12,8 +12,8 @@ #include "cc/cc_export.h" #include "cc/layers/layer_impl.h" #include "cc/quads/surface_draw_quad.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" +#include "components/viz/common/surface_id.h" namespace cc {
diff --git a/cc/layers/surface_layer_impl_unittest.cc b/cc/layers/surface_layer_impl_unittest.cc index f39326d..58c4661 100644 --- a/cc/layers/surface_layer_impl_unittest.cc +++ b/cc/layers/surface_layer_impl_unittest.cc
@@ -17,7 +17,7 @@ namespace cc { namespace { -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); TEST(SurfaceLayerImplTest, OcclusionWithDeviceScaleFactor) { float device_scale_factor = 1.33f; @@ -27,7 +27,7 @@ gfx::ScaleToCeiledSize(layer_size, device_scale_factor)); gfx::Size viewport_size(681, 750); - const LocalSurfaceId kArbitraryLocalSurfaceId( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId( 9, base::UnguessableToken::Create()); LayerTestCommon::LayerImplTest impl; @@ -36,7 +36,7 @@ impl.AddChildToRoot<SurfaceLayerImpl>(); surface_layer_impl->SetBounds(layer_size); surface_layer_impl->SetDrawsContent(true); - SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); + viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); surface_layer_impl->SetPrimarySurfaceInfo( SurfaceInfo(surface_id, device_scale_factor, scaled_surface_size)); @@ -93,7 +93,7 @@ TEST(SurfaceLayerImplTest, Occlusion) { gfx::Size layer_size(1000, 1000); gfx::Size viewport_size(1000, 1000); - const LocalSurfaceId kArbitraryLocalSurfaceId( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId( 9, base::UnguessableToken::Create()); LayerTestCommon::LayerImplTest impl; @@ -102,7 +102,7 @@ impl.AddChildToRoot<SurfaceLayerImpl>(); surface_layer_impl->SetBounds(layer_size); surface_layer_impl->SetDrawsContent(true); - SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); + viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); surface_layer_impl->SetPrimarySurfaceInfo( SurfaceInfo(surface_id, 1.f, layer_size)); @@ -145,9 +145,9 @@ LayerTestCommon::LayerImplTest impl; SurfaceLayerImpl* surface_layer_impl = impl.AddChildToRoot<SurfaceLayerImpl>(); - const LocalSurfaceId kArbitraryLocalSurfaceId( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId( 9, base::UnguessableToken::Create()); - const LocalSurfaceId kArbitraryLocalSurfaceId2( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId2( 10, base::UnguessableToken::Create()); // Given condition: layer and surface have different size and different @@ -163,8 +163,8 @@ // active tree. surface_layer_impl->SetBounds(layer_size); surface_layer_impl->SetDrawsContent(true); - SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); - SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2); + viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId); + viz::SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2); surface_layer_impl->SetPrimarySurfaceInfo( SurfaceInfo(surface_id, surface_scale, surface_size)); surface_layer_impl->SetFallbackSurfaceInfo( @@ -215,17 +215,17 @@ impl.AddChildToRoot<SurfaceLayerImpl>(); // Populate the primary SurfaceInfo. - const LocalSurfaceId kArbitraryLocalSurfaceId1( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId1( 9, base::UnguessableToken::Create()); - SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1); + viz::SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1); float surface_scale1 = 1.f; gfx::Size surface_size1(300, 300); SurfaceInfo primary_surface_info(surface_id1, surface_scale1, surface_size1); // Populate the fallback SurfaceInfo. - const LocalSurfaceId kArbitraryLocalSurfaceId2( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId2( 7, base::UnguessableToken::Create()); - SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2); + viz::SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2); float surface_scale2 = 2.f; gfx::Size surface_size2(400, 400); SurfaceInfo fallback_surface_info(surface_id2, surface_scale2, surface_size2); @@ -332,9 +332,9 @@ impl.AddChildToRoot<SurfaceLayerImpl>(); // Populate the primary SurfaceInfo. - const LocalSurfaceId kArbitraryLocalSurfaceId1( + const viz::LocalSurfaceId kArbitraryLocalSurfaceId1( 9, base::UnguessableToken::Create()); - SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1); + viz::SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1); float surface_scale1 = 1.f; gfx::Size surface_size1(300, 300); SurfaceInfo primary_surface_info(surface_id1, surface_scale1, surface_size1);
diff --git a/cc/layers/surface_layer_unittest.cc b/cc/layers/surface_layer_unittest.cc index be2299d..9422c9f 100644 --- a/cc/layers/surface_layer_unittest.cc +++ b/cc/layers/surface_layer_unittest.cc
@@ -37,7 +37,7 @@ using testing::ElementsAre; using testing::SizeIs; -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); class SurfaceLayerTest : public testing::Test { public: @@ -82,7 +82,7 @@ // SequenceSurfaceReferenceFactory implementation. MOCK_CONST_METHOD1(SatisfySequence, void(const SurfaceSequence&)); MOCK_CONST_METHOD2(RequireSequence, - void(const SurfaceId&, const SurfaceSequence&)); + void(const viz::SurfaceId&, const SurfaceSequence&)); protected: ~MockSurfaceReferenceFactory() override = default; @@ -97,12 +97,13 @@ const base::UnguessableToken kArbitraryToken = base::UnguessableToken::Create(); const SurfaceInfo info( - SurfaceId(kArbitraryFrameSinkId, LocalSurfaceId(1, kArbitraryToken)), 1.f, - gfx::Size(1, 1)); - const SurfaceSequence expected_seq1(FrameSinkId(1, 1), 1u); - const SurfaceSequence expected_seq2(FrameSinkId(2, 2), 1u); - const SurfaceId expected_id(kArbitraryFrameSinkId, - LocalSurfaceId(1, kArbitraryToken)); + viz::SurfaceId(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, kArbitraryToken)), + 1.f, gfx::Size(1, 1)); + const SurfaceSequence expected_seq1(viz::FrameSinkId(1, 1), 1u); + const SurfaceSequence expected_seq2(viz::FrameSinkId(2, 2), 1u); + const viz::SurfaceId expected_id(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, kArbitraryToken)); scoped_refptr<MockSurfaceReferenceFactory> ref_factory = new testing::StrictMock<MockSurfaceReferenceFactory>(); @@ -119,7 +120,7 @@ layer->SetPrimarySurfaceInfo(info); layer->SetFallbackSurfaceInfo(info); layer_tree_host_->GetSurfaceSequenceGenerator()->set_frame_sink_id( - FrameSinkId(1, 1)); + viz::FrameSinkId(1, 1)); layer_tree_host_->SetRootLayer(layer); auto animation_host2 = AnimationHost::CreateForTesting(ThreadInstance::MAIN); @@ -130,7 +131,7 @@ layer2->SetPrimarySurfaceInfo(info); layer2->SetFallbackSurfaceInfo(info); layer_tree_host2->GetSurfaceSequenceGenerator()->set_frame_sink_id( - FrameSinkId(2, 2)); + viz::FrameSinkId(2, 2)); layer_tree_host2->SetRootLayer(layer2); testing::Mock::VerifyAndClearExpectations(ref_factory.get()); @@ -165,8 +166,8 @@ scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory); layer_tree_host_->SetRootLayer(layer); SurfaceInfo primary_info( - SurfaceId(kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())), + viz::SurfaceId(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, base::UnguessableToken::Create())), 1.f, gfx::Size(1, 1)); layer->SetPrimarySurfaceInfo(primary_info); layer->SetFallbackSurfaceInfo(primary_info); @@ -195,8 +196,8 @@ EXPECT_EQ(primary_info, layer_impl->fallback_surface_info()); SurfaceInfo fallback_info( - SurfaceId(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())), + viz::SurfaceId(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())), 2.f, gfx::Size(10, 10)); layer->SetFallbackSurfaceInfo(fallback_info); @@ -224,9 +225,9 @@ scoped_refptr<SurfaceReferenceFactory> ref_factory = new testing::NiceMock<MockSurfaceReferenceFactory>(); - const SurfaceId old_surface_id( + const viz::SurfaceId old_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); const SurfaceInfo old_surface_info(old_surface_id, 1.f, gfx::Size(1, 1)); // This layer will always contain the old surface id and will be deleted when @@ -255,9 +256,9 @@ EXPECT_THAT(host_impl_.pending_tree()->SurfaceLayerIds(), ElementsAre(old_surface_id)); - const SurfaceId new_surface_id( + const viz::SurfaceId new_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); const SurfaceInfo new_surface_info(new_surface_id, 1.f, gfx::Size(2, 2)); // Switch the new layer to use |new_surface_id|. @@ -295,8 +296,8 @@ new testing::NiceMock<MockSurfaceReferenceFactory>(); const SurfaceInfo surface_info( - SurfaceId(kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())), + viz::SurfaceId(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, base::UnguessableToken::Create())), 1.f, gfx::Size(1, 1)); scoped_refptr<SurfaceLayer> layer1 = SurfaceLayer::Create(ref_factory); @@ -356,7 +357,7 @@ void BeginTest() override { layer_tree_host()->GetSurfaceSequenceGenerator()->set_frame_sink_id( - FrameSinkId(1, 1)); + viz::FrameSinkId(1, 1)); ref_factory_ = new testing::StrictMock<MockSurfaceReferenceFactory>(); // Create a SurfaceLayer but don't add it to the tree yet. No sequence @@ -364,17 +365,17 @@ EXPECT_CALL(*ref_factory_, SatisfySequence(_)).Times(0); EXPECT_CALL(*ref_factory_, RequireSequence(_, _)).Times(0); layer_ = SurfaceLayer::Create(ref_factory_); - SurfaceInfo info( - SurfaceId(kArbitraryFrameSinkId, LocalSurfaceId(1, kArbitraryToken)), - 1.f, gfx::Size(1, 1)); + SurfaceInfo info(viz::SurfaceId(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, kArbitraryToken)), + 1.f, gfx::Size(1, 1)); layer_->SetPrimarySurfaceInfo(info); layer_->SetFallbackSurfaceInfo(info); testing::Mock::VerifyAndClearExpectations(ref_factory_.get()); // Add the layer to the tree. A sequence must be required. SurfaceSequence expected_seq(kArbitraryFrameSinkId, 1u); - SurfaceId expected_id(kArbitraryFrameSinkId, - LocalSurfaceId(1, kArbitraryToken)); + viz::SurfaceId expected_id(kArbitraryFrameSinkId, + viz::LocalSurfaceId(1, kArbitraryToken)); EXPECT_CALL(*ref_factory_, SatisfySequence(_)).Times(0); EXPECT_CALL(*ref_factory_, RequireSequence(Eq(expected_id), Eq(expected_seq)))
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index 802fb8d6..71f0553a 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc
@@ -50,7 +50,7 @@ } void TextureLayer::ClearTexture() { - SetTextureMailbox(TextureMailbox(), nullptr); + SetTextureMailbox(viz::TextureMailbox(), nullptr); } std::unique_ptr<LayerImpl> TextureLayer::CreateLayerImpl( @@ -116,7 +116,7 @@ } void TextureLayer::SetTextureMailboxInternal( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback, bool requires_commit, bool allow_mailbox_reuse) { @@ -146,7 +146,7 @@ } void TextureLayer::SetTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) { bool requires_commit = true; bool allow_mailbox_reuse = false; @@ -183,7 +183,7 @@ bool TextureLayer::Update() { bool updated = Layer::Update(); if (client_) { - TextureMailbox mailbox; + viz::TextureMailbox mailbox; std::unique_ptr<SingleReleaseCallback> release_callback; if (client_->PrepareTextureMailbox(&mailbox, &release_callback)) { // Already within a commit, no need to do another one immediately. @@ -218,7 +218,7 @@ texture_layer->SetPremultipliedAlpha(premultiplied_alpha_); texture_layer->SetBlendBackgroundColor(blend_background_color_); if (needs_set_mailbox_) { - TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl; if (holder_ref_) { TextureMailboxHolder* holder = holder_ref_->holder(); @@ -243,7 +243,7 @@ } TextureLayer::TextureMailboxHolder::TextureMailboxHolder( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) : internal_references_(0), mailbox_(mailbox), @@ -257,7 +257,7 @@ std::unique_ptr<TextureLayer::TextureMailboxHolder::MainThreadReference> TextureLayer::TextureMailboxHolder::Create( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) { return base::MakeUnique<MainThreadReference>( new TextureMailboxHolder(mailbox, std::move(release_callback))); @@ -289,7 +289,7 @@ DCHECK(main_thread_checker_.CalledOnValidThread()); if (!--internal_references_) { release_callback_->Run(sync_token_, is_lost_); - mailbox_ = TextureMailbox(); + mailbox_ = viz::TextureMailbox(); release_callback_ = nullptr; } }
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index 05f7367f..04c1e1b2 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h
@@ -13,7 +13,7 @@ #include "base/threading/thread_checker.h" #include "cc/cc_export.h" #include "cc/layers/layer.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" namespace gpu { struct SyncToken; @@ -42,7 +42,7 @@ DISALLOW_COPY_AND_ASSIGN(MainThreadReference); }; - const TextureMailbox& mailbox() const { return mailbox_; } + const viz::TextureMailbox& mailbox() const { return mailbox_; } void Return(const gpu::SyncToken& sync_token, bool is_lost); // Gets a ReleaseCallback that can be called from another thread. Note: the @@ -54,7 +54,7 @@ // Protected visiblity so only TextureLayer and unit tests can create these. static std::unique_ptr<MainThreadReference> Create( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback); virtual ~TextureMailboxHolder(); @@ -62,7 +62,7 @@ friend class base::RefCountedThreadSafe<TextureMailboxHolder>; friend class MainThreadReference; explicit TextureMailboxHolder( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback); void InternalAddRef(); @@ -75,7 +75,7 @@ // These members are only accessed on the main thread, or on the impl thread // during commit where the main thread is blocked. unsigned internal_references_; - TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; std::unique_ptr<SingleReleaseCallback> release_callback_; // This lock guards the sync_token_ and is_lost_ fields because they can be @@ -130,7 +130,7 @@ // Code path for plugins which supply their own mailbox. void SetTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback); void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override; @@ -147,7 +147,7 @@ private: void SetTextureMailboxInternal( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback, bool requires_commit, bool allow_mailbox_reuse);
diff --git a/cc/layers/texture_layer_client.h b/cc/layers/texture_layer_client.h index 24794642..be96234 100644 --- a/cc/layers/texture_layer_client.h +++ b/cc/layers/texture_layer_client.h
@@ -7,8 +7,11 @@ #include "cc/resources/single_release_callback.h" -namespace cc { +namespace viz { class TextureMailbox; +} + +namespace cc { class TextureLayerClient { public: @@ -16,7 +19,7 @@ // Returns false if no new data is available // and the old mailbox is to be reused. virtual bool PrepareTextureMailbox( - TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) = 0; protected:
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index a64b5e9..93c0f95 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc
@@ -41,7 +41,7 @@ TextureLayerImpl::~TextureLayerImpl() { FreeTextureMailbox(); } void TextureLayerImpl::SetTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback) { DCHECK_EQ(mailbox.IsValid(), !!release_callback); FreeTextureMailbox(); @@ -256,7 +256,7 @@ ->task_runner_provider() ->blocking_main_thread_task_runner()); } - texture_mailbox_ = TextureMailbox(); + texture_mailbox_ = viz::TextureMailbox(); release_callback_ = nullptr; } else if (external_texture_resource_) { DCHECK(!own_mailbox_);
diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h index 035463bc..8bf72a95 100644 --- a/cc/layers/texture_layer_impl.h +++ b/cc/layers/texture_layer_impl.h
@@ -54,7 +54,7 @@ void SetVertexOpacity(const float vertex_opacity[4]); void SetTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback); private: @@ -74,7 +74,7 @@ // This is a resource that's a GL copy of a software texture mailbox. std::unique_ptr<ScopedResource> texture_copy_; - TextureMailbox texture_mailbox_; + viz::TextureMailbox texture_mailbox_; std::unique_ptr<SingleReleaseCallbackImpl> release_callback_; bool own_mailbox_; bool valid_texture_copy_;
diff --git a/cc/layers/texture_layer_impl_unittest.cc b/cc/layers/texture_layer_impl_unittest.cc index 5dd7dc90..57689da 100644 --- a/cc/layers/texture_layer_impl_unittest.cc +++ b/cc/layers/texture_layer_impl_unittest.cc
@@ -59,7 +59,7 @@ ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name); - TextureMailbox texture_mailbox( + viz::TextureMailbox texture_mailbox( mailbox, gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), @@ -119,7 +119,7 @@ ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name); - TextureMailbox texture_mailbox( + viz::TextureMailbox texture_mailbox( mailbox, gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), @@ -162,7 +162,7 @@ ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name); - TextureMailbox texture_mailbox( + viz::TextureMailbox texture_mailbox( mailbox, gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456),
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 3e137fe..216ba35 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc
@@ -100,7 +100,7 @@ FakeTextureLayerClient() : mailbox_changed_(true) {} bool PrepareTextureMailbox( - TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) override { if (!mailbox_changed_) return false; @@ -111,7 +111,7 @@ return true; } - void set_mailbox(const TextureMailbox& mailbox, + void set_mailbox(const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) { mailbox_ = mailbox; release_callback_ = std::move(release_callback); @@ -119,7 +119,7 @@ } private: - TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; std::unique_ptr<SingleReleaseCallback> release_callback_; bool mailbox_changed_; DISALLOW_COPY_AND_ASSIGN(FakeTextureLayerClient); @@ -173,8 +173,10 @@ mailbox_name2_); const uint32_t arbitrary_target1 = GL_TEXTURE_2D; const uint32_t arbitrary_target2 = GL_TEXTURE_EXTERNAL_OES; - mailbox1_ = TextureMailbox(mailbox_name1_, sync_token1_, arbitrary_target1); - mailbox2_ = TextureMailbox(mailbox_name2_, sync_token2_, arbitrary_target2); + mailbox1_ = + viz::TextureMailbox(mailbox_name1_, sync_token1_, arbitrary_target1); + mailbox2_ = + viz::TextureMailbox(mailbox_name2_, sync_token2_, arbitrary_target2); gfx::Size size(128, 128); shared_bitmap_ = manager->AllocateSharedBitmap(size); DCHECK(shared_bitmap_); @@ -184,7 +186,7 @@ release_mailbox3_impl_ = base::Bind(&MockMailboxCallback::ReleaseImpl2, base::Unretained(&mock_callback_), shared_bitmap_.get()); - mailbox3_ = TextureMailbox(shared_bitmap_.get(), size); + mailbox3_ = viz::TextureMailbox(shared_bitmap_.get(), size); } gpu::Mailbox mailbox_name1_; @@ -196,9 +198,9 @@ ReleaseCallbackImpl release_mailbox1_impl_; ReleaseCallbackImpl release_mailbox2_impl_; ReleaseCallbackImpl release_mailbox3_impl_; - TextureMailbox mailbox1_; - TextureMailbox mailbox2_; - TextureMailbox mailbox3_; + viz::TextureMailbox mailbox1_; + viz::TextureMailbox mailbox2_; + viz::TextureMailbox mailbox3_; gpu::SyncToken sync_token1_; gpu::SyncToken sync_token2_; std::unique_ptr<viz::SharedBitmap> shared_bitmap_; @@ -310,7 +312,7 @@ test_data_.mock_callback_, Release(test_data_.mailbox_name2_, test_data_.sync_token2_, false)) .Times(1); - test_layer->SetTextureMailbox(TextureMailbox(), nullptr); + test_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); Mock::VerifyAndClearExpectations(layer_tree_host_.get()); Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); @@ -325,7 +327,7 @@ EXPECT_CALL(test_data_.mock_callback_, Release2(test_data_.shared_bitmap_.get(), _, false)) .Times(1); - test_layer->SetTextureMailbox(TextureMailbox(), nullptr); + test_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); Mock::VerifyAndClearExpectations(layer_tree_host_.get()); Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); @@ -684,7 +686,7 @@ EXPECT_EQ(3, callback_count_); // Case #4: release mailbox that was committed but never drawn. The // old mailbox should be released during the next commit. - layer_->SetTextureMailbox(TextureMailbox(), nullptr); + layer_->SetTextureMailbox(viz::TextureMailbox(), nullptr); break; case 5: EXPECT_EQ(4, callback_count_); @@ -703,7 +705,7 @@ case 7: EXPECT_EQ(4, callback_count_); // Resetting the mailbox will call the callback now. - layer_->SetTextureMailbox(TextureMailbox(), nullptr); + layer_->SetTextureMailbox(viz::TextureMailbox(), nullptr); EXPECT_EQ(5, callback_count_); EndTest(); break; @@ -733,9 +735,10 @@ &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, base::Unretained(this), mailbox_char)); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), - SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), - GL_TEXTURE_2D), + viz::TextureMailbox( + MailboxFromChar(mailbox_char), + SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), + GL_TEXTURE_2D), std::move(callback)); // Damage the layer so we send a new frame with the new mailbox to the // Display compositor. @@ -808,8 +811,8 @@ SingleReleaseCallback::Create(base::Bind( &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback, base::Unretained(this), sync_token)); - layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char), - sync_token, GL_TEXTURE_2D), + layer_->SetTextureMailbox(viz::TextureMailbox(MailboxFromChar(mailbox_char), + sync_token, GL_TEXTURE_2D), std::move(callback)); } @@ -928,7 +931,7 @@ { std::unique_ptr<TextureLayerImpl> impl_layer = TextureLayerImpl::Create(host_impl_.active_tree(), 1); - impl_layer->SetTextureMailbox(TextureMailbox(), nullptr); + impl_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); EXPECT_FALSE(WillDraw(impl_layer.get(), DRAW_MODE_HARDWARE)); } @@ -955,7 +958,7 @@ { std::unique_ptr<TextureLayerImpl> impl_layer = TextureLayerImpl::Create(host_impl_.active_tree(), 1); - impl_layer->SetTextureMailbox(TextureMailbox(), nullptr); + impl_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); EXPECT_FALSE(WillDraw(impl_layer.get(), DRAW_MODE_SOFTWARE)); } @@ -1023,7 +1026,7 @@ // Test resetting the mailbox. EXPECT_CALL(test_data_.mock_callback_, ReleaseImpl(test_data_.mailbox_name1_, _, false, _)).Times(1); - pending_layer->SetTextureMailbox(TextureMailbox(), nullptr); + pending_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); pending_layer->PushPropertiesTo(active_layer.get()); active_layer->DidBecomeActive(); Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); @@ -1053,7 +1056,7 @@ EXPECT_TRUE(impl_layer->WillDraw( DRAW_MODE_HARDWARE, host_impl_.active_tree()->resource_provider())); impl_layer->DidDraw(host_impl_.active_tree()->resource_provider()); - impl_layer->SetTextureMailbox(TextureMailbox(), nullptr); + impl_layer->SetTextureMailbox(viz::TextureMailbox(), nullptr); } TEST_F(TextureLayerImplWithMailboxTest, TestCallbackOnInUseResource) { @@ -1087,16 +1090,16 @@ public: // TextureLayerClient implementation. bool PrepareTextureMailbox( - TextureMailbox* texture_mailbox, + viz::TextureMailbox* texture_mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) override { if (layer_tree_host()->SourceFrameNumber() == 1) { // Once this has been committed, the mailbox will be released. - *texture_mailbox = TextureMailbox(); + *texture_mailbox = viz::TextureMailbox(); return true; } - *texture_mailbox = TextureMailbox(MailboxFromChar('1'), - SyncTokenFromUInt(0x123), GL_TEXTURE_2D); + *texture_mailbox = viz::TextureMailbox( + MailboxFromChar('1'), SyncTokenFromUInt(0x123), GL_TEXTURE_2D); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, base::Unretained(this))); @@ -1165,7 +1168,7 @@ // TextureLayerClient implementation. bool PrepareTextureMailbox( - TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) override { ++prepare_called_; if (!mailbox_changed_) @@ -1177,10 +1180,10 @@ return true; } - TextureMailbox MakeMailbox(char name) { - return TextureMailbox(MailboxFromChar(name), - SyncTokenFromUInt(static_cast<uint32_t>(name)), - GL_TEXTURE_2D); + viz::TextureMailbox MakeMailbox(char name) { + return viz::TextureMailbox(MailboxFromChar(name), + SyncTokenFromUInt(static_cast<uint32_t>(name)), + GL_TEXTURE_2D); } void MailboxReleased(const gpu::SyncToken& sync_token, bool lost_resource) { @@ -1268,7 +1271,7 @@ // Used on the main thread. bool mailbox_changed_; - TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; int mailbox_returned_; int prepare_called_; int commit_count_; @@ -1284,10 +1287,10 @@ public: // TextureLayerClient implementation. bool PrepareTextureMailbox( - TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) override { - *mailbox = TextureMailbox(MailboxFromChar('1'), SyncTokenFromUInt(1), - GL_TEXTURE_2D); + *mailbox = viz::TextureMailbox(MailboxFromChar('1'), SyncTokenFromUInt(1), + GL_TEXTURE_2D); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerReleaseResourcesBase::MailboxReleased, base::Unretained(this))); @@ -1364,9 +1367,10 @@ &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), - SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), - GL_TEXTURE_2D), + viz::TextureMailbox( + MailboxFromChar(mailbox_char), + SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), + GL_TEXTURE_2D), std::move(callback)); } @@ -1434,9 +1438,10 @@ &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, base::Unretained(this))); layer_->SetTextureMailbox( - TextureMailbox(MailboxFromChar(mailbox_char), - SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), - GL_TEXTURE_2D), + viz::TextureMailbox( + MailboxFromChar(mailbox_char), + SyncTokenFromUInt(static_cast<uint32_t>(mailbox_char)), + GL_TEXTURE_2D), std::move(callback)); }
diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h index 9e73fc5..d86941f 100644 --- a/cc/output/compositor_frame_metadata.h +++ b/cc/output/compositor_frame_metadata.h
@@ -12,7 +12,7 @@ #include "cc/cc_export.h" #include "cc/input/selection.h" #include "cc/output/begin_frame_args.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/geometry/size_f.h" #include "ui/gfx/geometry/vector2d_f.h" @@ -83,7 +83,7 @@ // determine which surfaces to retain and which to evict. It will likely // be unnecessary for the embedder to explicitly specify which surfaces to // retain. Thus, this field will likely go away. - std::vector<SurfaceId> referenced_surfaces; + std::vector<viz::SurfaceId> referenced_surfaces; // This is the set of dependent SurfaceIds that should be active in the // display compositor before this CompositorFrame can be activated. Note @@ -96,7 +96,7 @@ // |referenced_surfaces|. |activation_dependencies| is the set of // surface IDs that this frame would like to block on until they // become available or a deadline hits. - std::vector<SurfaceId> activation_dependencies; + std::vector<viz::SurfaceId> activation_dependencies; // This indicates whether this CompositorFrame can be activated before // dependencies have been resolved.
diff --git a/cc/output/copy_output_request.cc b/cc/output/copy_output_request.cc index 4f1f4263..b748c5f 100644 --- a/cc/output/copy_output_request.cc +++ b/cc/output/copy_output_request.cc
@@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "cc/output/copy_output_result.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "third_party/skia/include/core/SkBitmap.h" namespace cc { @@ -57,7 +57,7 @@ void CopyOutputRequest::SendTextureResult( const gfx::Size& size, - const TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) { DCHECK(texture_mailbox.IsTexture()); SendResult(CopyOutputResult::CreateTextureResult( @@ -65,7 +65,7 @@ } void CopyOutputRequest::SetTextureMailbox( - const TextureMailbox& texture_mailbox) { + const viz::TextureMailbox& texture_mailbox) { DCHECK(!force_bitmap_result_); DCHECK(texture_mailbox.IsTexture()); texture_mailbox_ = texture_mailbox;
diff --git a/cc/output/copy_output_request.h b/cc/output/copy_output_request.h index 437ebdf..8147ab2 100644 --- a/cc/output/copy_output_request.h +++ b/cc/output/copy_output_request.h
@@ -13,7 +13,7 @@ #include "base/unguessable_token.h" #include "cc/cc_export.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "ui/gfx/geometry/rect.h" @@ -69,16 +69,18 @@ // By default copy requests create a new TextureMailbox to return contents // in. This allows a client to provide a TextureMailbox, and the compositor - // will place the result inside the TextureMailbox. - void SetTextureMailbox(const TextureMailbox& texture_mailbox); + // will place the result inside the viz::TextureMailbox. + void SetTextureMailbox(const viz::TextureMailbox& texture_mailbox); bool has_texture_mailbox() const { return texture_mailbox_.has_value(); } - const TextureMailbox& texture_mailbox() const { return *texture_mailbox_; } + const viz::TextureMailbox& texture_mailbox() const { + return *texture_mailbox_; + } void SendEmptyResult(); void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap); void SendTextureResult( const gfx::Size& size, - const TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, std::unique_ptr<SingleReleaseCallback> release_callback); void SendResult(std::unique_ptr<CopyOutputResult> result); @@ -94,7 +96,7 @@ base::Optional<base::UnguessableToken> source_; bool force_bitmap_result_; base::Optional<gfx::Rect> area_; - base::Optional<TextureMailbox> texture_mailbox_; + base::Optional<viz::TextureMailbox> texture_mailbox_; CopyOutputRequestCallback result_callback_; DISALLOW_COPY_AND_ASSIGN(CopyOutputRequest);
diff --git a/cc/output/copy_output_result.cc b/cc/output/copy_output_result.cc index b623442..7df94db 100644 --- a/cc/output/copy_output_result.cc +++ b/cc/output/copy_output_result.cc
@@ -5,7 +5,7 @@ #include "cc/output/copy_output_result.h" #include "base/logging.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" namespace cc { @@ -18,7 +18,7 @@ CopyOutputResult::CopyOutputResult( const gfx::Size& size, - const TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) : size_(size), texture_mailbox_(texture_mailbox), @@ -36,12 +36,12 @@ } void CopyOutputResult::TakeTexture( - TextureMailbox* texture_mailbox, + viz::TextureMailbox* texture_mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback) { *texture_mailbox = texture_mailbox_; *release_callback = std::move(release_callback_); - texture_mailbox_ = TextureMailbox(); + texture_mailbox_ = viz::TextureMailbox(); } } // namespace cc
diff --git a/cc/output/copy_output_result.h b/cc/output/copy_output_result.h index c4d2fee..38a177c 100644 --- a/cc/output/copy_output_result.h +++ b/cc/output/copy_output_result.h
@@ -10,21 +10,23 @@ #include "base/memory/ptr_util.h" #include "cc/cc_export.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/geometry/size.h" class SkBitmap; +namespace viz { +class TextureMailbox; +} + namespace cc { namespace mojom { class CopyOutputResultDataView; } -class TextureMailbox; - class CC_EXPORT CopyOutputResult { public: static std::unique_ptr<CopyOutputResult> CreateEmptyResult() { @@ -36,7 +38,7 @@ } static std::unique_ptr<CopyOutputResult> CreateTextureResult( const gfx::Size& size, - const TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, std::unique_ptr<SingleReleaseCallback> release_callback) { return base::WrapUnique(new CopyOutputResult(size, texture_mailbox, std::move(release_callback))); @@ -50,7 +52,7 @@ gfx::Size size() const { return size_; } std::unique_ptr<SkBitmap> TakeBitmap(); - void TakeTexture(TextureMailbox* texture_mailbox, + void TakeTexture(viz::TextureMailbox* texture_mailbox, std::unique_ptr<SingleReleaseCallback>* release_callback); private: @@ -61,12 +63,12 @@ explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); explicit CopyOutputResult( const gfx::Size& size, - const TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, std::unique_ptr<SingleReleaseCallback> release_callback); gfx::Size size_; std::unique_ptr<SkBitmap> bitmap_; - TextureMailbox texture_mailbox_; + viz::TextureMailbox texture_mailbox_; std::unique_ptr<SingleReleaseCallback> release_callback_; DISALLOW_COPY_AND_ASSIGN(CopyOutputResult);
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 29b67dc..541c439 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc
@@ -2778,7 +2778,7 @@ gpu::SyncToken sync_token; gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); - TextureMailbox texture_mailbox(mailbox, sync_token, GL_TEXTURE_2D); + viz::TextureMailbox texture_mailbox(mailbox, sync_token, GL_TEXTURE_2D); std::unique_ptr<SingleReleaseCallback> release_callback; if (own_mailbox) {
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 3e35f72..88c506a4 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc
@@ -1797,9 +1797,9 @@ root_pass->copy_requests.push_back( CopyOutputRequest::CreateRequest(base::Bind(&IgnoreCopyResult))); - TextureMailbox mailbox = - TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_2D, - gfx::Size(256, 256), true, false); + viz::TextureMailbox mailbox = + viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D, gfx::Size(256, 256), true, false); std::unique_ptr<SingleReleaseCallbackImpl> release_callback = SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( @@ -1959,9 +1959,9 @@ gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, gpu::CommandBufferId::FromUnsafeValue(0x123), 29); - TextureMailbox mailbox = - TextureMailbox(gpu::Mailbox::Generate(), sync_token, GL_TEXTURE_2D, - gfx::Size(256, 256), true, false); + viz::TextureMailbox mailbox = + viz::TextureMailbox(gpu::Mailbox::Generate(), sync_token, GL_TEXTURE_2D, + gfx::Size(256, 256), true, false); std::unique_ptr<SingleReleaseCallbackImpl> release_callback = SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( @@ -2160,9 +2160,9 @@ gfx::Size viewport_size(100, 100); - TextureMailbox mailbox = - TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_2D, - gfx::Size(256, 256), true, false); + viz::TextureMailbox mailbox = + viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D, gfx::Size(256, 256), true, false); std::unique_ptr<SingleReleaseCallbackImpl> release_callback = SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox(
diff --git a/cc/output/layer_tree_frame_sink.h b/cc/output/layer_tree_frame_sink.h index e953ce31..514f35ee 100644 --- a/cc/output/layer_tree_frame_sink.h +++ b/cc/output/layer_tree_frame_sink.h
@@ -24,6 +24,7 @@ } namespace viz { +class LocalSurfaceId; class SharedBitmapManager; } @@ -32,7 +33,6 @@ struct BeginFrameAck; class CompositorFrame; class LayerTreeFrameSinkClient; -class LocalSurfaceId; // An interface for submitting CompositorFrames to a display compositor // which will compose frames from multiple clients to show on screen to the @@ -110,9 +110,9 @@ return shared_bitmap_manager_; } - // If supported, this sets the LocalSurfaceId the LayerTreeFrameSink will use - // to submit a CompositorFrame. - virtual void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) {} + // If supported, this sets the viz::LocalSurfaceId the LayerTreeFrameSink will + // use to submit a CompositorFrame. + virtual void SetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id) {} // Support for a pull-model where draws are requested by the implementation of // LayerTreeFrameSink. This is called by the compositor to notify that there's
diff --git a/cc/output/overlay_processor.cc b/cc/output/overlay_processor.cc index 13217aa..28a7a2a8 100644 --- a/cc/output/overlay_processor.cc +++ b/cc/output/overlay_processor.cc
@@ -177,15 +177,18 @@ gfx::Rect output_surface_overlay_damage_rect; gfx::Rect this_frame_underlay_rect; for (const OverlayCandidate& overlay : *candidates) { - if (overlay.plane_z_order > 0 && overlay.is_opaque) { + if (overlay.plane_z_order >= 0) { const gfx::Rect overlay_display_rect = ToEnclosedRect(overlay.display_rect); - overlay_damage_rect_.Union(overlay_display_rect); - damage_rect->Subtract(overlay_display_rect); - if (overlay.use_output_surface_for_resource) - output_surface_overlay_damage_rect.Union(overlay_display_rect); - } else if (overlay.plane_z_order < 0 && overlay.is_unoccluded && - this_frame_underlay_rect.IsEmpty()) { + if (overlay.use_output_surface_for_resource) { + if (overlay.plane_z_order > 0) + output_surface_overlay_damage_rect.Union(overlay_display_rect); + } else { + overlay_damage_rect_.Union(overlay_display_rect); + if (overlay.is_opaque) + damage_rect->Subtract(overlay_display_rect); + } + } else if (overlay.is_unoccluded && this_frame_underlay_rect.IsEmpty()) { this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect); } }
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index 35f3addf..77ec844 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc
@@ -29,13 +29,13 @@ #include "cc/quads/stream_video_draw_quad.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/resource_provider.h" -#include "cc/resources/texture_mailbox.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/rect_conversions.h" @@ -263,9 +263,9 @@ ResourceId CreateResource(ResourceProvider* resource_provider, const gfx::Size& size, bool is_overlay_candidate) { - TextureMailbox mailbox = - TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_2D, - size, is_overlay_candidate, false); + viz::TextureMailbox mailbox = + viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D, size, is_overlay_candidate, false); std::unique_ptr<SingleReleaseCallbackImpl> release_callback = SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); @@ -492,6 +492,7 @@ TEST_F(FullscreenOverlayTest, SuccessfulOverlay) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); + gfx::Rect output_rect = pass->output_rect; TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); @@ -518,6 +519,9 @@ EXPECT_EQ(1U, candidate_list.size()); // Check that the right resource id got extracted. EXPECT_EQ(original_resource_id, candidate_list.front().resource_id); + gfx::Rect overlay_damage_rect = + overlay_processor_->GetAndResetOverlayDamage(); + EXPECT_EQ(output_rect, overlay_damage_rect); } TEST_F(FullscreenOverlayTest, AlphaFail) { @@ -857,6 +861,9 @@ &damage_rect_, &content_bounds_); EXPECT_EQ(1U, candidate_list.size()); EXPECT_FALSE(damage_rect_.IsEmpty()); + gfx::Rect overlay_damage_rect = + overlay_processor_->GetAndResetOverlayDamage(); + EXPECT_FALSE(overlay_damage_rect.IsEmpty()); } TEST_F(SingleOverlayOnTopTest, RejectBackgroundColor) {
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc index fafc1b2..17454756 100644 --- a/cc/quads/draw_quad_unittest.cc +++ b/cc/quads/draw_quad_unittest.cc
@@ -32,7 +32,7 @@ namespace cc { namespace { -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); TEST(DrawQuadTest, CopySharedQuadState) { gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); @@ -262,8 +262,9 @@ TEST(DrawQuadTest, CopySurfaceDrawQuad) { gfx::Rect visible_rect(40, 50, 30, 20); - SurfaceId surface_id(kArbitraryFrameSinkId, - LocalSurfaceId(1234, base::UnguessableToken::Create())); + viz::SurfaceId surface_id( + kArbitraryFrameSinkId, + viz::LocalSurfaceId(1234, base::UnguessableToken::Create())); CREATE_SHARED_STATE(); CREATE_QUAD_NEW(SurfaceDrawQuad, visible_rect, surface_id, @@ -544,8 +545,9 @@ TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { gfx::Rect visible_rect(40, 50, 30, 20); - SurfaceId surface_id(kArbitraryFrameSinkId, - LocalSurfaceId(4321, base::UnguessableToken::Create())); + viz::SurfaceId surface_id( + kArbitraryFrameSinkId, + viz::LocalSurfaceId(4321, base::UnguessableToken::Create())); CREATE_SHARED_STATE(); CREATE_QUAD_NEW(SurfaceDrawQuad, visible_rect, surface_id,
diff --git a/cc/quads/surface_draw_quad.cc b/cc/quads/surface_draw_quad.cc index a4b556e..a3ccd0e9 100644 --- a/cc/quads/surface_draw_quad.cc +++ b/cc/quads/surface_draw_quad.cc
@@ -16,7 +16,7 @@ void SurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, SurfaceDrawQuadType surface_draw_quad_type, SurfaceDrawQuad* fallback_quad) { gfx::Rect opaque_rect; @@ -33,7 +33,7 @@ const gfx::Rect& opaque_rect, const gfx::Rect& visible_rect, bool needs_blending, - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, SurfaceDrawQuadType surface_draw_quad_type, SurfaceDrawQuad* fallback_quad) { DrawQuad::SetAll(shared_quad_state, DrawQuad::SURFACE_CONTENT, rect,
diff --git a/cc/quads/surface_draw_quad.h b/cc/quads/surface_draw_quad.h index 1c1f19d..9ce3a2a 100644 --- a/cc/quads/surface_draw_quad.h +++ b/cc/quads/surface_draw_quad.h
@@ -9,7 +9,7 @@ #include "cc/cc_export.h" #include "cc/quads/draw_quad.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -22,7 +22,7 @@ void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, SurfaceDrawQuadType surface_draw_quad_type, SurfaceDrawQuad* fallback_quad); @@ -31,11 +31,11 @@ const gfx::Rect& opaque_rect, const gfx::Rect& visible_rect, bool needs_blending, - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, SurfaceDrawQuadType surface_draw_quad_type, SurfaceDrawQuad* fallback_quad); - SurfaceId surface_id; + viz::SurfaceId surface_id; SurfaceDrawQuadType surface_draw_quad_type; const SurfaceDrawQuad* fallback_quad = nullptr;
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 15e23df..4a96f6b4 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc
@@ -312,7 +312,8 @@ ResourceProvider::Resource::Resource(Resource&& other) = default; -void ResourceProvider::Resource::SetMailbox(const TextureMailbox& mailbox) { +void ResourceProvider::Resource::SetMailbox( + const viz::TextureMailbox& mailbox) { mailbox_ = mailbox; if (IsGpuResourceType(type)) { synchronization_state_ = @@ -664,7 +665,7 @@ } ResourceId ResourceProvider::CreateResourceFromTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, bool read_lock_fences_enabled) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -709,7 +710,7 @@ } ResourceId ResourceProvider::CreateResourceFromTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl) { return CreateResourceFromTextureMailbox( mailbox, std::move(release_callback_impl), false); @@ -1539,9 +1540,9 @@ TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, it->format)); resource->buffer_format = it->buffer_format; - resource->SetMailbox(TextureMailbox(it->mailbox_holder.mailbox, - it->mailbox_holder.sync_token, - it->mailbox_holder.texture_target)); + resource->SetMailbox(viz::TextureMailbox( + it->mailbox_holder.mailbox, it->mailbox_holder.sync_token, + it->mailbox_holder.texture_target)); resource->read_lock_fences_enabled = it->read_lock_fences_enabled; resource->is_overlay_candidate = it->is_overlay_candidate; #if defined(OS_ANDROID) @@ -1698,7 +1699,7 @@ gl->ProduceTextureDirectCHROMIUM(resource->gl_id, mailbox_holder.texture_target, mailbox_holder.mailbox.name); - resource->SetMailbox(TextureMailbox(mailbox_holder)); + resource->SetMailbox(viz::TextureMailbox(mailbox_holder)); resource->SetLocallyUsed(); }
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h index c4202e9..e9e6147 100644 --- a/cc/resources/resource_provider.h +++ b/cc/resources/resource_provider.h
@@ -32,10 +32,10 @@ #include "cc/resources/release_callback_impl.h" #include "cc/resources/return_callback.h" #include "cc/resources/single_release_callback_impl.h" -#include "cc/resources/texture_mailbox.h" #include "cc/resources/transferable_resource.h" #include "components/viz/common/quads/resource_format.h" #include "components/viz/common/quads/shared_bitmap.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "components/viz/common/resources/resource_settings.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2ext.h" @@ -151,11 +151,11 @@ // Wraps an external texture mailbox into a GL resource. ResourceId CreateResourceFromTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); ResourceId CreateResourceFromTextureMailbox( - const TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, bool read_lock_fences_enabled); @@ -298,7 +298,7 @@ return color_space_; } - const TextureMailbox& mailbox() const { return mailbox_; } + const viz::TextureMailbox& mailbox() const { return mailbox_; } void set_sync_token(const gpu::SyncToken& sync_token) { sync_token_ = sync_token; @@ -314,7 +314,7 @@ GLenum target_; viz::ResourceFormat format_; gfx::Size size_; - TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; gpu::SyncToken sync_token_; bool has_sync_token_; bool synchronized_; @@ -612,8 +612,8 @@ return synchronization_state_; } - const TextureMailbox& mailbox() const { return mailbox_; } - void SetMailbox(const TextureMailbox& mailbox); + const viz::TextureMailbox& mailbox() const { return mailbox_; } + void SetMailbox(const viz::TextureMailbox& mailbox); void SetLocallyUsed(); void SetSynchronized(); @@ -687,7 +687,7 @@ private: SynchronizationState synchronization_state_ = SYNCHRONIZED; - TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; DISALLOW_COPY_AND_ASSIGN(Resource); };
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index 0e8ddc5af..754fe2da 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc
@@ -517,7 +517,7 @@ ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), release_called, release_sync_token, lost_resource)); return child_resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(gpu_mailbox, *sync_token, GL_TEXTURE_2D), + viz::TextureMailbox(gpu_mailbox, *sync_token, GL_TEXTURE_2D), std::move(callback)); } else { gfx::Size size(64, 64); @@ -530,7 +530,7 @@ ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), release_called, release_sync_token, lost_resource)); return child_resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(shared_bitmap_ptr, size), std::move(callback)); + viz::TextureMailbox(shared_bitmap_ptr, size), std::move(callback)); } } @@ -658,8 +658,8 @@ EXPECT_TRUE(external_sync_token.HasData()); gfx::ColorSpace color_space4 = gfx::ColorSpace::CreateXYZD50(); - TextureMailbox id4_mailbox(external_mailbox, external_sync_token, - GL_TEXTURE_EXTERNAL_OES); + viz::TextureMailbox id4_mailbox(external_mailbox, external_sync_token, + GL_TEXTURE_EXTERNAL_OES); id4_mailbox.set_color_space(color_space4); ResourceId id4 = child_resource_provider_->CreateResourceFromTextureMailbox( id4_mailbox, @@ -908,8 +908,8 @@ external_sync_token.GetData()); EXPECT_TRUE(external_sync_token.HasData()); - TextureMailbox id1_mailbox(external_mailbox, external_sync_token, - GL_TEXTURE_EXTERNAL_OES); + viz::TextureMailbox id1_mailbox(external_mailbox, external_sync_token, + GL_TEXTURE_EXTERNAL_OES); id1_mailbox.set_wants_promotion_hint(true); id1_mailbox.set_is_overlay_candidate(true); id1_mailbox.set_is_backed_by_surface_texture(true); @@ -917,8 +917,8 @@ id1_mailbox, SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); - TextureMailbox id2_mailbox(external_mailbox, external_sync_token, - GL_TEXTURE_EXTERNAL_OES); + viz::TextureMailbox id2_mailbox(external_mailbox, external_sync_token, + GL_TEXTURE_EXTERNAL_OES); id2_mailbox.set_wants_promotion_hint(false); id2_mailbox.set_is_overlay_candidate(true); id2_mailbox.set_is_backed_by_surface_texture(false); @@ -1029,8 +1029,8 @@ external_sync_token.GetData()); EXPECT_TRUE(external_sync_token.HasData()); ResourceId id3 = child_resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(external_mailbox, external_sync_token, - GL_TEXTURE_EXTERNAL_OES), + viz::TextureMailbox(external_mailbox, external_sync_token, + GL_TEXTURE_EXTERNAL_OES), SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); std::vector<ReturnedResource> returned_to_child; @@ -1425,7 +1425,7 @@ shared_bitmap_manager_.get(), gfx::Size(1, 1), 0)); viz::SharedBitmap* shared_bitmap_ptr = shared_bitmap.get(); ResourceId id3 = child_resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(shared_bitmap_ptr, gfx::Size(1, 1)), + viz::TextureMailbox(shared_bitmap_ptr, gfx::Size(1, 1)), SingleReleaseCallbackImpl::Create(base::Bind( &SharedBitmapReleaseCallback, base::Passed(&shared_bitmap)))); @@ -2295,7 +2295,7 @@ base::Bind(ReleaseCallback, &release_sync_token, &lost_resource, &main_thread_task_runner); ResourceId resource = resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), + viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), SingleReleaseCallbackImpl::Create(callback)); EXPECT_EQ(1u, context()->NumTextures()); EXPECT_FALSE(release_sync_token.HasData()); @@ -2349,7 +2349,7 @@ EXPECT_LT(0u, sync_token.release_count()); release_sync_token.Clear(); resource = resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), + viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), SingleReleaseCallbackImpl::Create(callback)); EXPECT_EQ(1u, context()->NumTextures()); EXPECT_FALSE(release_sync_token.HasData()); @@ -2706,7 +2706,7 @@ } TEST_P(ResourceProviderTest, LostContext) { - // TextureMailbox callbacks only exist for GL textures for now. + // viz::TextureMailbox callbacks only exist for GL textures for now. if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) return; unsigned texture = context()->createTexture(); @@ -2727,7 +2727,8 @@ base::Bind(ReleaseCallback, &release_sync_token, &lost_resource, &main_thread_task_runner)); resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), std::move(callback)); + viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), + std::move(callback)); EXPECT_FALSE(release_sync_token.HasData()); EXPECT_FALSE(lost_resource); @@ -2987,7 +2988,7 @@ SingleReleaseCallbackImpl::Create( base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, &main_thread_task_runner)); - TextureMailbox mailbox(shared_bitmap.get(), size); + viz::TextureMailbox mailbox(shared_bitmap.get(), size); ResourceId id = resource_provider->CreateResourceFromTextureMailbox( mailbox, std::move(callback)); @@ -3051,7 +3052,7 @@ base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, &mailbox_task_runner)); - TextureMailbox mailbox(gpu_mailbox, sync_token, target); + viz::TextureMailbox mailbox(gpu_mailbox, sync_token, target); mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); ResourceId id = resource_provider->CreateResourceFromTextureMailbox( @@ -3188,7 +3189,7 @@ std::unique_ptr<SingleReleaseCallbackImpl> callback = SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, sync_token, target); + viz::TextureMailbox mailbox(gpu_mailbox, sync_token, target); ResourceId id = resource_provider->CreateResourceFromTextureMailbox( mailbox, std::move(callback)); @@ -3257,7 +3258,7 @@ std::unique_ptr<SingleReleaseCallbackImpl> callback = SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, sync_token, target); + viz::TextureMailbox mailbox(gpu_mailbox, sync_token, target); ResourceId id = resource_provider->CreateResourceFromTextureMailbox( mailbox, std::move(callback)); @@ -3311,7 +3312,7 @@ std::unique_ptr<SingleReleaseCallbackImpl> callback = SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, sync_token, target); + viz::TextureMailbox mailbox(gpu_mailbox, sync_token, target); ResourceId id = resource_provider->CreateResourceFromTextureMailbox( mailbox, std::move(callback)); @@ -3351,8 +3352,8 @@ EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); - TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), - GL_TEXTURE_2D); + viz::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D); std::unique_ptr<SingleReleaseCallbackImpl> callback = SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback));
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc index d167201..7ec8510 100644 --- a/cc/resources/video_resource_updater.cc +++ b/cc/resources/video_resource_updater.cc
@@ -438,9 +438,9 @@ gpu::SyncToken sync_token = GenerateCompositorSyncToken(context_provider_->ContextGL()); - TextureMailbox mailbox(plane_resource.mailbox(), sync_token, - resource_provider_->GetResourceTextureTarget( - plane_resource.resource_id())); + viz::TextureMailbox mailbox(plane_resource.mailbox(), sync_token, + resource_provider_->GetResourceTextureTarget( + plane_resource.resource_id())); mailbox.set_color_space(output_color_space); external_resources.mailboxes.push_back(mailbox); @@ -551,9 +551,9 @@ PlaneResource& plane_resource = *plane_resources[i]; // VideoResourceUpdater shares a context with the compositor so a // sync token is not required. - TextureMailbox mailbox(plane_resource.mailbox(), sync_token, - resource_provider_->GetResourceTextureTarget( - plane_resource.resource_id())); + viz::TextureMailbox mailbox(plane_resource.mailbox(), sync_token, + resource_provider_->GetResourceTextureTarget( + plane_resource.resource_id())); mailbox.set_color_space(output_color_space); external_resources.mailboxes.push_back(mailbox); external_resources.release_callbacks.push_back( @@ -627,8 +627,8 @@ gpu::SyncToken sync_token = video_frame->UpdateReleaseSyncToken(&client); // Set sync token otherwise resource is assumed to be synchronized. - TextureMailbox mailbox(resource->mailbox(), sync_token, GL_TEXTURE_2D, - video_frame->coded_size(), false, false); + viz::TextureMailbox mailbox(resource->mailbox(), sync_token, GL_TEXTURE_2D, + video_frame->coded_size(), false, false); mailbox.set_color_space(resource_color_space); external_resources->mailboxes.push_back(mailbox); @@ -672,12 +672,12 @@ CopyPlaneTexture(video_frame.get(), resource_color_space, mailbox_holder, &external_resources); } else { - TextureMailbox mailbox(mailbox_holder.mailbox, mailbox_holder.sync_token, - mailbox_holder.texture_target, - video_frame->coded_size(), - video_frame->metadata()->IsTrue( - media::VideoFrameMetadata::ALLOW_OVERLAY), - false); + viz::TextureMailbox mailbox( + mailbox_holder.mailbox, mailbox_holder.sync_token, + mailbox_holder.texture_target, video_frame->coded_size(), + video_frame->metadata()->IsTrue( + media::VideoFrameMetadata::ALLOW_OVERLAY), + false); mailbox.set_color_space(resource_color_space); #if defined(OS_ANDROID) mailbox.set_is_backed_by_surface_texture(video_frame->metadata()->IsTrue(
diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h index eab4122..958d016 100644 --- a/cc/resources/video_resource_updater.h +++ b/cc/resources/video_resource_updater.h
@@ -18,8 +18,8 @@ #include "base/time/time.h" #include "cc/cc_export.h" #include "cc/resources/release_callback_impl.h" -#include "cc/resources/texture_mailbox.h" #include "components/viz/common/quads/resource_format.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "ui/gfx/geometry/size.h" namespace media { @@ -49,7 +49,7 @@ }; ResourceType type; - std::vector<TextureMailbox> mailboxes; + std::vector<viz::TextureMailbox> mailboxes; std::vector<ReleaseCallbackImpl> release_callbacks; bool read_lock_fences_enabled;
diff --git a/cc/scheduler/begin_frame_source.h b/cc/scheduler/begin_frame_source.h index e21878dd..4c399b95 100644 --- a/cc/scheduler/begin_frame_source.h +++ b/cc/scheduler/begin_frame_source.h
@@ -11,8 +11,6 @@ #include <set> #include <string> -#include "base/containers/flat_set.h" -#include "base/containers/small_map.h" #include "base/logging.h" #include "base/macros.h" #include "base/trace_event/trace_event.h"
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index f9f55d0..318916d 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include "base/auto_reset.h" +#include "base/debug/crash_logging.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/profiler/scoped_tracker.h" @@ -25,7 +26,12 @@ // for message latency and kernel scheduling variability. const base::TimeDelta kDeadlineFudgeFactor = base::TimeDelta::FromMicroseconds(1000); -} + +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +const char kBeginMainFrameHangCompositorState[] = + "begin-main-frame-hang-compositor-state"; +} // namespace Scheduler::Scheduler( SchedulerClient* client, @@ -701,6 +707,12 @@ ScheduleBeginImplFrameDeadlineIfNeeded(); SetupNextBeginFrameIfNeeded(); + + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + base::debug::SetCrashKeyValue( + kBeginMainFrameHangCompositorState, + state_machine_.CrashKeyValueForBeginMainFrameHang()); } std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index f8602b2..39ee1ef 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc
@@ -249,6 +249,17 @@ state->EndDictionary(); } +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +std::string SchedulerStateMachine::CrashKeyValueForBeginMainFrameHang() const { + return base::StringPrintf( + "%d,%d,%d,%d,%d,%d,%d,%d,%d", begin_impl_frame_state_, + begin_main_frame_state_, layer_tree_frame_sink_state_, + pending_submit_frames_, visible_, has_pending_tree_, + pending_tree_is_ready_for_activation_, active_tree_needs_first_draw_, + begin_frame_source_paused_); +} + bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { // Normally when |visible_| is false or |begin_frame_source_paused_| is true, // pending activations will be forced and draws will be aborted. However,
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h index 45bd7f9..ef998dc5 100644 --- a/cc/scheduler/scheduler_state_machine.h +++ b/cc/scheduler/scheduler_state_machine.h
@@ -132,6 +132,10 @@ std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; void AsValueInto(base::trace_event::TracedValue* dict) const; + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + std::string CrashKeyValueForBeginMainFrameHang() const; + Action NextAction() const; void WillSendBeginMainFrame(); void WillNotifyBeginMainFrameNotSent();
diff --git a/cc/surfaces/BUILD.gn b/cc/surfaces/BUILD.gn index a01581ea..b91156bb 100644 --- a/cc/surfaces/BUILD.gn +++ b/cc/surfaces/BUILD.gn
@@ -6,13 +6,6 @@ cc_source_set("surface_id") { sources = [ - "frame_sink_id.cc", - "frame_sink_id.h", - "frame_sink_id_allocator.h", - "local_surface_id.cc", - "local_surface_id.h", - "surface_id.cc", - "surface_id.h", "surface_info.h", "surface_reference.cc", "surface_reference.h", @@ -25,6 +18,7 @@ deps = [ "//base", + "//components/viz/common", "//mojo/public/cpp/bindings:struct_traits", "//ui/gfx/geometry:geometry", ] @@ -48,8 +42,6 @@ "frame_sink_manager.cc", "frame_sink_manager.h", "frame_sink_manager_client.h", - "local_surface_id_allocator.cc", - "local_surface_id_allocator.h", "primary_begin_frame_source.cc", "primary_begin_frame_source.h", "referenced_surface_tracker.cc", @@ -89,6 +81,7 @@ "//base", "//base/third_party/dynamic_annotations", "//cc", + "//components/viz/common", "//gpu/command_buffer/client:gles2_interface", "//gpu/command_buffer/common", "//gpu/vulkan:features",
diff --git a/cc/surfaces/DEPS b/cc/surfaces/DEPS index 7502d902..07703df 100644 --- a/cc/surfaces/DEPS +++ b/cc/surfaces/DEPS
@@ -1,3 +1,4 @@ include_rules = [ + "+components/viz/common", "+mojo/public/cpp/bindings/struct_traits.h", ]
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc index 7d6dfe1..666d0a12 100644 --- a/cc/surfaces/compositor_frame_sink_support.cc +++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -22,7 +22,7 @@ std::unique_ptr<CompositorFrameSinkSupport> CompositorFrameSinkSupport::Create( CompositorFrameSinkSupportClient* client, FrameSinkManager* frame_sink_manager, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, bool is_root, bool handles_frame_sink_id_invalidation, bool needs_sync_tokens) { @@ -43,7 +43,7 @@ // Make it unreachable from the top-level root. if (referenced_local_surface_id_.has_value()) { auto reference = MakeTopLevelRootReference( - SurfaceId(frame_sink_id_, referenced_local_surface_id_.value())); + viz::SurfaceId(frame_sink_id_, referenced_local_surface_id_.value())); surface_manager_->RemoveSurfaceReferences({reference}); } @@ -118,8 +118,8 @@ void CompositorFrameSinkSupport::EvictCurrentSurface() { if (!current_surface_id_.is_valid()) return; - SurfaceId to_destroy_surface_id = current_surface_id_; - current_surface_id_ = SurfaceId(); + viz::SurfaceId to_destroy_surface_id = current_surface_id_; + current_surface_id_ = viz::SurfaceId(); surface_manager_->DestroySurface(to_destroy_surface_id); } @@ -145,7 +145,7 @@ } bool CompositorFrameSinkSupport::SubmitCompositorFrame( - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, CompositorFrame frame) { TRACE_EVENT0("cc", "CompositorFrameSinkSupport::SubmitCompositorFrame"); DCHECK(local_surface_id.is_valid()); @@ -176,7 +176,7 @@ local_surface_id == current_surface_id_.local_surface_id()) { current_surface = prev_surface; } else { - SurfaceId surface_id(frame_sink_id_, local_surface_id); + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id); gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); float device_scale_factor = frame.metadata.device_scale_factor; SurfaceInfo surface_info(surface_id, device_scale_factor, frame_size); @@ -193,7 +193,7 @@ } current_surface = CreateSurface(surface_info); - current_surface_id_ = SurfaceId(frame_sink_id_, local_surface_id); + current_surface_id_ = viz::SurfaceId(frame_sink_id_, local_surface_id); surface_manager_->SurfaceDamageExpected(current_surface->surface_id(), last_begin_frame_args_); } @@ -222,14 +222,14 @@ } void CompositorFrameSinkSupport::UpdateSurfaceReferences( - const LocalSurfaceId& local_surface_id, - const std::vector<SurfaceId>& active_referenced_surfaces) { - SurfaceId surface_id(frame_sink_id_, local_surface_id); + const viz::LocalSurfaceId& local_surface_id, + const std::vector<viz::SurfaceId>& active_referenced_surfaces) { + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id); - const base::flat_set<SurfaceId>& existing_referenced_surfaces = + const base::flat_set<viz::SurfaceId>& existing_referenced_surfaces = surface_manager_->GetSurfacesReferencedByParent(surface_id); - base::flat_set<SurfaceId> new_referenced_surfaces( + base::flat_set<viz::SurfaceId> new_referenced_surfaces( active_referenced_surfaces.begin(), active_referenced_surfaces.end(), base::KEEP_FIRST_OF_DUPES); @@ -242,16 +242,17 @@ new_referenced_surfaces, &references_to_add, &references_to_remove); - // Check if this is a display root surface and the SurfaceId is changing. + // Check if this is a display root surface and the viz::SurfaceId is changing. if (is_root_ && (!referenced_local_surface_id_.has_value() || referenced_local_surface_id_.value() != local_surface_id)) { - // Make the new SurfaceId reachable from the top-level root. + // Make the new viz::SurfaceId reachable from the top-level root. references_to_add.push_back(MakeTopLevelRootReference(surface_id)); - // Make the old SurfaceId unreachable from the top-level root if applicable. + // Make the old viz::SurfaceId unreachable from the top-level root if + // applicable. if (referenced_local_surface_id_.has_value()) { - references_to_remove.push_back(MakeTopLevelRootReference( - SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()))); + references_to_remove.push_back(MakeTopLevelRootReference(viz::SurfaceId( + frame_sink_id_, referenced_local_surface_id_.value()))); } referenced_local_surface_id_ = local_surface_id; @@ -265,7 +266,7 @@ } SurfaceReference CompositorFrameSinkSupport::MakeTopLevelRootReference( - const SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { return SurfaceReference(surface_manager_->GetRootSurfaceId(), surface_id); } @@ -280,20 +281,20 @@ } void CompositorFrameSinkSupport::WillDrawSurface( - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) { if (client_) client_->WillDrawSurface(local_surface_id, damage_rect); } void CompositorFrameSinkSupport::ClaimTemporaryReference( - const SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { surface_manager_->AssignTemporaryReference(surface_id, frame_sink_id_); } CompositorFrameSinkSupport::CompositorFrameSinkSupport( CompositorFrameSinkSupportClient* client, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, bool is_root, bool handles_frame_sink_id_invalidation, bool needs_sync_tokens)
diff --git a/cc/surfaces/compositor_frame_sink_support.h b/cc/surfaces/compositor_frame_sink_support.h index 8dffc5b..15ee062 100644 --- a/cc/surfaces/compositor_frame_sink_support.h +++ b/cc/surfaces/compositor_frame_sink_support.h
@@ -37,14 +37,14 @@ static std::unique_ptr<CompositorFrameSinkSupport> Create( CompositorFrameSinkSupportClient* client, FrameSinkManager* frame_sink_manager, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, bool is_root, bool handles_frame_sink_id_invalidation, bool needs_sync_tokens); ~CompositorFrameSinkSupport() override; - const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } + const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } FrameSinkManager* frame_sink_manager() { return frame_sink_manager_; } SurfaceManager* surface_manager() { return surface_manager_; } @@ -64,17 +64,16 @@ void EvictCurrentSurface(); void SetNeedsBeginFrame(bool needs_begin_frame); void DidNotProduceFrame(const BeginFrameAck& ack); - bool SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, + bool SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, CompositorFrame frame); void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); - void ClaimTemporaryReference(const SurfaceId& surface_id); - + void ClaimTemporaryReference(const viz::SurfaceId& surface_id); Surface* GetCurrentSurfaceForTesting(); protected: CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, bool is_root, bool handles_frame_sink_id_invalidation, bool needs_sync_tokens); @@ -87,14 +86,14 @@ // if |is_root_| is true and |local_surface_id| has changed. Modifies surface // references stored in SurfaceManager. void UpdateSurfaceReferences( - const LocalSurfaceId& local_surface_id, - const std::vector<SurfaceId>& active_referenced_surfaces); + const viz::LocalSurfaceId& local_surface_id, + const std::vector<viz::SurfaceId>& active_referenced_surfaces); // Creates a surface reference from the top-level root to |surface_id|. - SurfaceReference MakeTopLevelRootReference(const SurfaceId& surface_id); + SurfaceReference MakeTopLevelRootReference(const viz::SurfaceId& surface_id); void DidReceiveCompositorFrameAck(); - void WillDrawSurface(const LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect); // BeginFrameObserver implementation. @@ -110,13 +109,13 @@ FrameSinkManager* frame_sink_manager_ = nullptr; SurfaceManager* surface_manager_ = nullptr; - const FrameSinkId frame_sink_id_; - SurfaceId current_surface_id_; + const viz::FrameSinkId frame_sink_id_; + viz::SurfaceId current_surface_id_; // If this contains a value then a surface reference from the top-level root - // to SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was + // to viz::SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was // added. This will not contain a value if |is_root_| is false. - base::Optional<LocalSurfaceId> referenced_local_surface_id_; + base::Optional<viz::LocalSurfaceId> referenced_local_surface_id_; SurfaceResourceHolder surface_resource_holder_;
diff --git a/cc/surfaces/compositor_frame_sink_support_client.h b/cc/surfaces/compositor_frame_sink_support_client.h index 242d46e9..f0f4fb2 100644 --- a/cc/surfaces/compositor_frame_sink_support_client.h +++ b/cc/surfaces/compositor_frame_sink_support_client.h
@@ -11,9 +11,11 @@ class Rect; } -namespace cc { - +namespace viz { class LocalSurfaceId; +} + +namespace cc { struct BeginFrameArgs; @@ -37,7 +39,7 @@ const std::vector<ReturnedResource>& resources) = 0; // Called when surface is being scheduled for a draw. - virtual void WillDrawSurface(const LocalSurfaceId& local_surface_id, + virtual void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) = 0; protected:
diff --git a/cc/surfaces/compositor_frame_sink_support_unittest.cc b/cc/surfaces/compositor_frame_sink_support_unittest.cc index 38f1681..f1227f6 100644 --- a/cc/surfaces/compositor_frame_sink_support_unittest.cc +++ b/cc/surfaces/compositor_frame_sink_support_unittest.cc
@@ -10,15 +10,15 @@ #include "cc/output/copy_output_result.h" #include "cc/resources/resource_provider.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_external_begin_frame_source.h" #include "cc/test/fake_surface_observer.h" #include "cc/test/mock_compositor_frame_sink_support_client.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/surface_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -38,9 +38,9 @@ constexpr bool kHandlesFrameSinkIdInvalidation = true; constexpr bool kNeedsSyncPoints = true; -constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); -constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2); -constexpr FrameSinkId kYetAnotherArbitraryFrameSinkId(3, 3); +constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); +constexpr viz::FrameSinkId kAnotherArbitraryFrameSinkId(2, 2); +constexpr viz::FrameSinkId kYetAnotherArbitraryFrameSinkId(3, 3); const base::UnguessableToken kArbitraryToken = base::UnguessableToken::Create(); const base::UnguessableToken kArbitrarySourceId1 = @@ -73,7 +73,7 @@ InsertResources(resources); } - void WillDrawSurface(const LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override {} void clear_returned_resources() { returned_resources_.clear(); } @@ -159,13 +159,13 @@ fake_support_client_.clear_returned_resources(); } - Surface* GetSurfaceForId(const SurfaceId& id) { + Surface* GetSurfaceForId(const viz::SurfaceId& id) { return manager_.surface_manager()->GetSurfaceForId(id); } void RefCurrentFrameResources() { Surface* surface = GetSurfaceForId( - SurfaceId(support_->frame_sink_id(), local_surface_id_)); + viz::SurfaceId(support_->frame_sink_id(), local_surface_id_)); support_->RefResources(surface->GetActiveFrame().resource_list); } @@ -174,7 +174,7 @@ FakeCompositorFrameSinkSupportClient fake_support_client_; std::unique_ptr<CompositorFrameSinkSupport> support_; FakeExternalBeginFrameSource begin_frame_source_; - LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; FakeSurfaceObserver surface_observer_; // This is the sync token submitted with the frame. It should never be @@ -492,12 +492,12 @@ CompositorFrameSinkSupport::Create( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(6, kArbitraryToken); + viz::LocalSurfaceId local_surface_id(6, kArbitraryToken); support->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(_)) .WillOnce(testing::InvokeWithoutArgs([&support, &mock_client]() { - LocalSurfaceId new_id(7, base::UnguessableToken::Create()); + viz::LocalSurfaceId new_id(7, base::UnguessableToken::Create()); support->SubmitCompositorFrame(new_id, MakeCompositorFrame()); })) .WillRepeatedly(testing::Return()); @@ -511,8 +511,8 @@ CompositorFrameSinkSupport::Create( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(7, kArbitraryToken); - SurfaceId id(kAnotherArbitraryFrameSinkId, local_surface_id); + viz::LocalSurfaceId local_surface_id(7, kArbitraryToken); + viz::SurfaceId id(kAnotherArbitraryFrameSinkId, local_surface_id); TransferableResource resource; resource.id = 1; @@ -522,7 +522,7 @@ support->SubmitCompositorFrame(local_surface_id, std::move(frame)); EXPECT_EQ(surface_observer_.last_created_surface_id().local_surface_id(), local_surface_id); - local_surface_id_ = LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); std::vector<ReturnedResource> returned_resources = { resource.ToReturnedResource()}; @@ -541,7 +541,7 @@ CompositorFrameSinkSupport::Create( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(7, kArbitraryToken); + viz::LocalSurfaceId local_surface_id(7, kArbitraryToken); TransferableResource resource; resource.id = 1; @@ -551,9 +551,9 @@ support->SubmitCompositorFrame(local_surface_id, std::move(frame)); EXPECT_EQ(surface_observer_.last_created_surface_id().local_surface_id(), local_surface_id); - local_surface_id_ = LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); - SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); + viz::SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); Surface* surface = GetSurfaceForId(surface_id); surface->AddDestructionDependency( SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); @@ -576,7 +576,7 @@ CompositorFrameSinkSupport::Create( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(7, kArbitraryToken); + viz::LocalSurfaceId local_surface_id(7, kArbitraryToken); TransferableResource resource; resource.id = 1; @@ -587,11 +587,11 @@ support->SubmitCompositorFrame(local_surface_id, std::move(frame)); EXPECT_EQ(surface_observer_.last_created_surface_id().local_surface_id(), local_surface_id); - local_surface_id_ = LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); manager_.RegisterFrameSinkId(kYetAnotherArbitraryFrameSinkId); - SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); + viz::SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); Surface* surface = GetSurfaceForId(surface_id); surface->AddDestructionDependency( SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); @@ -611,12 +611,12 @@ } TEST_F(CompositorFrameSinkSupportTest, DestroySequence) { - LocalSurfaceId local_surface_id2(5, kArbitraryToken); + viz::LocalSurfaceId local_surface_id2(5, kArbitraryToken); std::unique_ptr<CompositorFrameSinkSupport> support2 = CompositorFrameSinkSupport::Create( &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId, kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); + viz::SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); support2->SubmitCompositorFrame(local_surface_id2, MakeCompositorFrame()); // Check that waiting before the sequence is satisfied works. @@ -643,10 +643,10 @@ // Tests that Surface ID namespace invalidation correctly allows // Sequences to be ignored. TEST_F(CompositorFrameSinkSupportTest, InvalidFrameSinkId) { - FrameSinkId frame_sink_id(1234, 5678); + viz::FrameSinkId frame_sink_id(1234, 5678); - LocalSurfaceId local_surface_id(5, kArbitraryToken); - SurfaceId id(support_->frame_sink_id(), local_surface_id); + viz::LocalSurfaceId local_surface_id(5, kArbitraryToken); + viz::SurfaceId id(support_->frame_sink_id(), local_surface_id); support_->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); manager_.RegisterFrameSinkId(frame_sink_id); @@ -666,8 +666,8 @@ } TEST_F(CompositorFrameSinkSupportTest, DestroyCycle) { - LocalSurfaceId local_surface_id2(5, kArbitraryToken); - SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); + viz::LocalSurfaceId local_surface_id2(5, kArbitraryToken); + viz::SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); std::unique_ptr<CompositorFrameSinkSupport> support2 = CompositorFrameSinkSupport::Create( &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId, @@ -683,7 +683,7 @@ { CompositorFrame frame = MakeCompositorFrame(); frame.metadata.referenced_surfaces.push_back( - SurfaceId(support_->frame_sink_id(), local_surface_id_)); + viz::SurfaceId(support_->frame_sink_id(), local_surface_id_)); support2->SubmitCompositorFrame(local_surface_id2, std::move(frame)); EXPECT_EQ(surface_observer_.last_created_surface_id().local_surface_id(), local_surface_id2); @@ -700,8 +700,8 @@ support_->EvictCurrentSurface(); EXPECT_TRUE(GetSurfaceForId(id2)); // local_surface_id_ should be retained by reference from id2. - EXPECT_TRUE( - GetSurfaceForId(SurfaceId(support_->frame_sink_id(), local_surface_id_))); + EXPECT_TRUE(GetSurfaceForId( + viz::SurfaceId(support_->frame_sink_id(), local_surface_id_))); // Satisfy last destruction dependency for id2. manager_.surface_manager()->SatisfySequence( @@ -711,9 +711,9 @@ // sequences holding on to it, so they should be destroyed. EXPECT_TRUE(!GetSurfaceForId(id2)); EXPECT_TRUE(!GetSurfaceForId( - SurfaceId(support_->frame_sink_id(), local_surface_id_))); + viz::SurfaceId(support_->frame_sink_id(), local_surface_id_))); - local_surface_id_ = LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); } void CopyRequestTestCallback(bool* called, @@ -725,7 +725,7 @@ { CompositorFrame frame = MakeCompositorFrame(); frame.metadata.referenced_surfaces.push_back( - SurfaceId(support_->frame_sink_id(), local_surface_id_)); + viz::SurfaceId(support_->frame_sink_id(), local_surface_id_)); support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); EXPECT_EQ(surface_observer_.last_created_surface_id().local_surface_id(), local_surface_id_); @@ -762,7 +762,7 @@ EXPECT_FALSE(called3); support_->EvictCurrentSurface(); - local_surface_id_ = LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); EXPECT_TRUE(called1); EXPECT_TRUE(called2); EXPECT_TRUE(called3); @@ -784,7 +784,8 @@ frame.metadata.device_scale_factor = 2.5f; support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); - SurfaceId expected_surface_id(support_->frame_sink_id(), local_surface_id_); + viz::SurfaceId expected_surface_id(support_->frame_sink_id(), + local_surface_id_); EXPECT_EQ(expected_surface_id, surface_observer_.last_surface_info().id()); EXPECT_EQ(2.5f, surface_observer_.last_surface_info().device_scale_factor()); EXPECT_EQ(gfx::Size(7, 8), @@ -794,7 +795,7 @@ // Check that if a CompositorFrame is received with size zero, we don't create // a Surface for it. TEST_F(CompositorFrameSinkSupportTest, ZeroFrameSize) { - SurfaceId id(support_->frame_sink_id(), local_surface_id_); + viz::SurfaceId id(support_->frame_sink_id(), local_surface_id_); CompositorFrame frame = MakeEmptyCompositorFrame(); frame.render_pass_list.push_back(RenderPass::Create()); EXPECT_TRUE( @@ -805,7 +806,7 @@ // Check that if a CompositorFrame is received with device scale factor of 0, we // don't create a Surface for it. TEST_F(CompositorFrameSinkSupportTest, ZeroDeviceScaleFactor) { - SurfaceId id(support_->frame_sink_id(), local_surface_id_); + viz::SurfaceId id(support_->frame_sink_id(), local_surface_id_); CompositorFrame frame = MakeCompositorFrame(); frame.metadata.device_scale_factor = 0.f; EXPECT_TRUE( @@ -816,7 +817,7 @@ // Check that if the size of a CompositorFrame doesn't match the size of the // Surface it's being submitted to, we skip the frame. TEST_F(CompositorFrameSinkSupportTest, FrameSizeMismatch) { - SurfaceId id(support_->frame_sink_id(), local_surface_id_); + viz::SurfaceId id(support_->frame_sink_id(), local_surface_id_); // Submit a frame with size (5,5). CompositorFrame frame = MakeEmptyCompositorFrame(); @@ -842,7 +843,7 @@ // device scale factor of the Surface it's being submitted to, the frame is // rejected and the surface is destroyed. TEST_F(CompositorFrameSinkSupportTest, DeviceScaleFactorMismatch) { - SurfaceId id(support_->frame_sink_id(), local_surface_id_); + viz::SurfaceId id(support_->frame_sink_id(), local_surface_id_); // Submit a frame with device scale factor of 0.5. CompositorFrame frame = MakeCompositorFrame();
diff --git a/cc/surfaces/direct_layer_tree_frame_sink.cc b/cc/surfaces/direct_layer_tree_frame_sink.cc index f81c5a6..b617cdd 100644 --- a/cc/surfaces/direct_layer_tree_frame_sink.cc +++ b/cc/surfaces/direct_layer_tree_frame_sink.cc
@@ -8,15 +8,15 @@ #include "cc/output/compositor_frame.h" #include "cc/output/layer_tree_frame_sink_client.h" #include "cc/surfaces/display.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id_allocator.h" namespace cc { DirectLayerTreeFrameSink::DirectLayerTreeFrameSink( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, FrameSinkManager* frame_sink_manager, Display* display, scoped_refptr<ContextProvider> context_provider, @@ -38,7 +38,7 @@ } DirectLayerTreeFrameSink::DirectLayerTreeFrameSink( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, FrameSinkManager* frame_sink_manager, Display* display, scoped_refptr<VulkanContextProvider> vulkan_context_provider) @@ -150,7 +150,7 @@ } void DirectLayerTreeFrameSink::WillDrawSurface( - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) { // TODO(staraz): Implement this. }
diff --git a/cc/surfaces/direct_layer_tree_frame_sink.h b/cc/surfaces/direct_layer_tree_frame_sink.h index c9dd7b10..614b2b1 100644 --- a/cc/surfaces/direct_layer_tree_frame_sink.h +++ b/cc/surfaces/direct_layer_tree_frame_sink.h
@@ -12,12 +12,15 @@ #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/display_client.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/local_surface_id_allocator.h" + +namespace viz { +class LocalSurfaceIdAllocator; +} namespace cc { class Display; -class LocalSurfaceIdAllocator; class FrameSinkManager; // This class submits compositor frames to an in-process Display, with the @@ -28,10 +31,10 @@ public ExternalBeginFrameSourceClient, public NON_EXPORTED_BASE(DisplayClient) { public: - // The underlying Display, FrameSinkManager, and LocalSurfaceIdAllocator must - // outlive this class. + // The underlying Display, FrameSinkManager, and viz::LocalSurfaceIdAllocator + // must outlive this class. DirectLayerTreeFrameSink( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, FrameSinkManager* frame_sink_manager, Display* display, scoped_refptr<ContextProvider> context_provider, @@ -39,7 +42,7 @@ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, viz::SharedBitmapManager* shared_bitmap_manager); DirectLayerTreeFrameSink( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, FrameSinkManager* frame_sink_manager, Display* display, scoped_refptr<VulkanContextProvider> vulkan_context_provider); @@ -67,7 +70,7 @@ void OnBeginFrame(const BeginFrameArgs& args) override; void ReclaimResources( const std::vector<ReturnedResource>& resources) override; - void WillDrawSurface(const LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; // ExternalBeginFrameSourceClient implementation: @@ -76,10 +79,10 @@ // This class is only meant to be used on a single thread. base::ThreadChecker thread_checker_; - const FrameSinkId frame_sink_id_; - LocalSurfaceId local_surface_id_; + const viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId local_surface_id_; FrameSinkManager* frame_sink_manager_; - LocalSurfaceIdAllocator local_surface_id_allocator_; + viz::LocalSurfaceIdAllocator local_surface_id_allocator_; Display* display_; gfx::Size last_swap_frame_size_; float device_scale_factor_ = 1.f;
diff --git a/cc/surfaces/direct_layer_tree_frame_sink_unittest.cc b/cc/surfaces/direct_layer_tree_frame_sink_unittest.cc index d1acb3da..a43443f 100644 --- a/cc/surfaces/direct_layer_tree_frame_sink_unittest.cc +++ b/cc/surfaces/direct_layer_tree_frame_sink_unittest.cc
@@ -13,9 +13,7 @@ #include "cc/scheduler/delay_based_time_source.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_layer_tree_frame_sink_client.h" @@ -24,12 +22,14 @@ #include "cc/test/test_context_provider.h" #include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { namespace { -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); class TestDirectLayerTreeFrameSink : public DirectLayerTreeFrameSink { public:
diff --git a/cc/surfaces/direct_surface_reference_factory.cc b/cc/surfaces/direct_surface_reference_factory.cc index 47d0d4b22..d107925 100644 --- a/cc/surfaces/direct_surface_reference_factory.cc +++ b/cc/surfaces/direct_surface_reference_factory.cc
@@ -23,7 +23,7 @@ } void DirectSurfaceReferenceFactory::RequireSequence( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, const SurfaceSequence& sequence) const { manager_->RequireSequence(surface_id, sequence); }
diff --git a/cc/surfaces/direct_surface_reference_factory.h b/cc/surfaces/direct_surface_reference_factory.h index 8a4de59..597ae14 100644 --- a/cc/surfaces/direct_surface_reference_factory.h +++ b/cc/surfaces/direct_surface_reference_factory.h
@@ -6,9 +6,9 @@ #define CC_SURFACES_DIRECT_SURFACE_REFERENCE_FACTORY_H_ #include "cc/surfaces/sequence_surface_reference_factory.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_manager.h" #include "cc/surfaces/surface_sequence.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -27,7 +27,7 @@ // SequenceSurfaceReferenceFactory implementation: void SatisfySequence(const SurfaceSequence& sequence) const override; - void RequireSequence(const SurfaceId& surface_id, + void RequireSequence(const viz::SurfaceId& surface_id, const SurfaceSequence& sequence) const override; base::WeakPtr<SurfaceManager> manager_;
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc index 831aa9a..bd5782d85 100644 --- a/cc/surfaces/display.cc +++ b/cc/surfaces/display.cc
@@ -36,7 +36,7 @@ Display::Display(viz::SharedBitmapManager* bitmap_manager, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, const RendererSettings& settings, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, std::unique_ptr<OutputSurface> output_surface, std::unique_ptr<DisplayScheduler> scheduler, std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter) @@ -94,7 +94,7 @@ } } -void Display::SetLocalSurfaceId(const LocalSurfaceId& id, +void Display::SetLocalSurfaceId(const viz::LocalSurfaceId& id, float device_scale_factor) { if (current_surface_id_.local_surface_id() == id && device_scale_factor_ == device_scale_factor) { @@ -102,7 +102,7 @@ } TRACE_EVENT0("cc", "Display::SetSurfaceId"); - current_surface_id_ = SurfaceId(frame_sink_id_, id); + current_surface_id_ = viz::SurfaceId(frame_sink_id_, id); device_scale_factor_ = device_scale_factor; UpdateRootSurfaceResourcesLocked(); @@ -381,7 +381,7 @@ } } -bool Display::SurfaceDamaged(const SurfaceId& surface_id, +bool Display::SurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) { bool display_damaged = false; if (ack.has_damage) { @@ -405,12 +405,12 @@ return display_damaged; } -void Display::SurfaceDiscarded(const SurfaceId& surface_id) { +void Display::SurfaceDiscarded(const viz::SurfaceId& surface_id) { if (aggregator_) aggregator_->ReleaseResources(surface_id); } -bool Display::SurfaceHasUndrawnFrame(const SurfaceId& surface_id) const { +bool Display::SurfaceHasUndrawnFrame(const viz::SurfaceId& surface_id) const { if (!surface_manager_) return false; @@ -421,7 +421,7 @@ return surface->HasUndrawnActiveFrame(); } -const SurfaceId& Display::CurrentSurfaceId() { +const viz::SurfaceId& Display::CurrentSurfaceId() { return current_surface_id_; }
diff --git a/cc/surfaces/display.h b/cc/surfaces/display.h index 0a39ef5..b40050c 100644 --- a/cc/surfaces/display.h +++ b/cc/surfaces/display.h
@@ -13,11 +13,11 @@ #include "cc/resources/returned_resource.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/display_scheduler.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/surface_aggregator.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_manager.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/surface_id.h" #include "gpu/command_buffer/common/texture_in_use_response.h" #include "ui/gfx/color_space.h" #include "ui/latency/latency_info.h" @@ -55,7 +55,7 @@ Display(viz::SharedBitmapManager* bitmap_manager, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, const RendererSettings& settings, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, std::unique_ptr<OutputSurface> output_surface, std::unique_ptr<DisplayScheduler> scheduler, std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter); @@ -66,21 +66,22 @@ // device_scale_factor is used to communicate to the external window system // what scale this was rendered at. - void SetLocalSurfaceId(const LocalSurfaceId& id, float device_scale_factor); + void SetLocalSurfaceId(const viz::LocalSurfaceId& id, + float device_scale_factor); void SetVisible(bool visible); void Resize(const gfx::Size& new_size); void SetColorSpace(const gfx::ColorSpace& blending_color_space, const gfx::ColorSpace& device_color_space); void SetOutputIsSecure(bool secure); - const SurfaceId& CurrentSurfaceId(); + const viz::SurfaceId& CurrentSurfaceId(); // DisplaySchedulerClient implementation. bool DrawAndSwap() override; - bool SurfaceHasUndrawnFrame(const SurfaceId& surface_id) const override; - bool SurfaceDamaged(const SurfaceId& surface_id, + bool SurfaceHasUndrawnFrame(const viz::SurfaceId& surface_id) const override; + bool SurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) override; - void SurfaceDiscarded(const SurfaceId& surface_id) override; + void SurfaceDiscarded(const viz::SurfaceId& surface_id) override; // OutputSurfaceClient implementation. void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; @@ -107,8 +108,8 @@ DisplayClient* client_ = nullptr; SurfaceManager* surface_manager_ = nullptr; - const FrameSinkId frame_sink_id_; - SurfaceId current_surface_id_; + const viz::FrameSinkId frame_sink_id_; + viz::SurfaceId current_surface_id_; gfx::Size current_surface_size_; float device_scale_factor_ = 1.f; gfx::ColorSpace blending_color_space_ = gfx::ColorSpace::CreateSRGB();
diff --git a/cc/surfaces/display_scheduler.cc b/cc/surfaces/display_scheduler.cc index 28e329f8..c1450ce 100644 --- a/cc/surfaces/display_scheduler.cc +++ b/cc/surfaces/display_scheduler.cc
@@ -84,7 +84,8 @@ // Notification that there was a resize or the root surface changed and // that we should just draw immediately. -void DisplayScheduler::SetNewRootSurface(const SurfaceId& root_surface_id) { +void DisplayScheduler::SetNewRootSurface( + const viz::SurfaceId& root_surface_id) { TRACE_EVENT0("cc", "DisplayScheduler::SetNewRootSurface"); root_surface_id_ = root_surface_id; BeginFrameAck ack; @@ -95,7 +96,7 @@ // Indicates that there was damage to one of the surfaces. // Has some logic to wait for multiple active surfaces before // triggering the deadline. -void DisplayScheduler::ProcessSurfaceDamage(const SurfaceId& surface_id, +void DisplayScheduler::ProcessSurfaceDamage(const viz::SurfaceId& surface_id, const BeginFrameAck& ack, bool display_damaged) { TRACE_EVENT1("cc", "DisplayScheduler::SurfaceDamaged", "surface_id", @@ -141,9 +142,9 @@ bool old_value = has_pending_surfaces_; - for (const std::pair<SurfaceId, SurfaceBeginFrameState>& entry : + for (const std::pair<viz::SurfaceId, SurfaceBeginFrameState>& entry : surface_states_) { - const SurfaceId& surface_id = entry.first; + const viz::SurfaceId& surface_id = entry.first; const SurfaceBeginFrameState& state = entry.second; // Surface is ready if it hasn't received the current BeginFrame or receives @@ -279,7 +280,7 @@ void DisplayScheduler::OnSurfaceCreated(const SurfaceInfo& surface_info) {} -void DisplayScheduler::OnSurfaceDestroyed(const SurfaceId& surface_id) { +void DisplayScheduler::OnSurfaceDestroyed(const viz::SurfaceId& surface_id) { auto it = surface_states_.find(surface_id); if (it == surface_states_.end()) return; @@ -288,7 +289,7 @@ ScheduleBeginFrameDeadline(); } -bool DisplayScheduler::OnSurfaceDamaged(const SurfaceId& surface_id, +bool DisplayScheduler::OnSurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) { bool damaged = client_->SurfaceDamaged(surface_id, ack); ProcessSurfaceDamage(surface_id, ack, damaged); @@ -296,11 +297,11 @@ return damaged; } -void DisplayScheduler::OnSurfaceDiscarded(const SurfaceId& surface_id) { +void DisplayScheduler::OnSurfaceDiscarded(const viz::SurfaceId& surface_id) { client_->SurfaceDiscarded(surface_id); } -void DisplayScheduler::OnSurfaceDamageExpected(const SurfaceId& surface_id, +void DisplayScheduler::OnSurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args) { TRACE_EVENT1("cc", "DisplayScheduler::SurfaceDamageExpected", "surface_id", surface_id.ToString()); @@ -314,7 +315,7 @@ ScheduleBeginFrameDeadline(); } -void DisplayScheduler::OnSurfaceWillDraw(const SurfaceId& surface_id) {} +void DisplayScheduler::OnSurfaceWillDraw(const viz::SurfaceId& surface_id) {} base::TimeTicks DisplayScheduler::DesiredBeginFrameDeadlineTime() const { switch (AdjustedBeginFrameDeadlineMode()) {
diff --git a/cc/surfaces/display_scheduler.h b/cc/surfaces/display_scheduler.h index c98fbab6..0979580 100644 --- a/cc/surfaces/display_scheduler.h +++ b/cc/surfaces/display_scheduler.h
@@ -14,9 +14,9 @@ #include "base/single_thread_task_runner.h" #include "cc/output/renderer_settings.h" #include "cc/scheduler/begin_frame_source.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_observer.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -28,10 +28,11 @@ virtual ~DisplaySchedulerClient() {} virtual bool DrawAndSwap() = 0; - virtual bool SurfaceHasUndrawnFrame(const SurfaceId& surface_id) const = 0; - virtual bool SurfaceDamaged(const SurfaceId& surface_id, + virtual bool SurfaceHasUndrawnFrame( + const viz::SurfaceId& surface_id) const = 0; + virtual bool SurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) = 0; - virtual void SurfaceDiscarded(const SurfaceId& surface_id) = 0; + virtual void SurfaceDiscarded(const viz::SurfaceId& surface_id) = 0; }; class CC_SURFACES_EXPORT DisplayScheduler : public BeginFrameObserverBase, @@ -49,8 +50,8 @@ void SetRootSurfaceResourcesLocked(bool locked); void ForceImmediateSwapIfPossible(); virtual void DisplayResized(); - virtual void SetNewRootSurface(const SurfaceId& root_surface_id); - virtual void ProcessSurfaceDamage(const SurfaceId& surface_id, + virtual void SetNewRootSurface(const viz::SurfaceId& root_surface_id); + virtual void ProcessSurfaceDamage(const viz::SurfaceId& surface_id, const BeginFrameAck& ack, bool display_damaged); @@ -65,13 +66,13 @@ // SurfaceObserver implementation. void OnSurfaceCreated(const SurfaceInfo& surface_info) override; - void OnSurfaceDestroyed(const SurfaceId& surface_id) override; - bool OnSurfaceDamaged(const SurfaceId& surface_id, + void OnSurfaceDestroyed(const viz::SurfaceId& surface_id) override; + bool OnSurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) override; - void OnSurfaceDiscarded(const SurfaceId& surface_id) override; - void OnSurfaceDamageExpected(const SurfaceId& surface_id, + void OnSurfaceDiscarded(const viz::SurfaceId& surface_id) override; + void OnSurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args) override; - void OnSurfaceWillDraw(const SurfaceId& surface_id) override; + void OnSurfaceWillDraw(const viz::SurfaceId& surface_id) override; protected: enum class BeginFrameDeadlineMode { kImmediate, kRegular, kLate, kNone }; @@ -114,7 +115,7 @@ BeginFrameArgs last_args; BeginFrameAck last_ack; }; - base::flat_map<SurfaceId, SurfaceBeginFrameState> surface_states_; + base::flat_map<viz::SurfaceId, SurfaceBeginFrameState> surface_states_; int next_swap_id_; int pending_swaps_; @@ -123,7 +124,7 @@ bool observing_begin_frame_source_; - SurfaceId root_surface_id_; + viz::SurfaceId root_surface_id_; base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_;
diff --git a/cc/surfaces/display_scheduler_unittest.cc b/cc/surfaces/display_scheduler_unittest.cc index 2bc7f07..473ee26 100644 --- a/cc/surfaces/display_scheduler_unittest.cc +++ b/cc/surfaces/display_scheduler_unittest.cc
@@ -21,7 +21,7 @@ const int kMaxPendingSwaps = 1; -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); class FakeDisplaySchedulerClient : public DisplaySchedulerClient { public: @@ -41,29 +41,29 @@ return success; } - bool SurfaceHasUndrawnFrame(const SurfaceId& surface_id) const override { + bool SurfaceHasUndrawnFrame(const viz::SurfaceId& surface_id) const override { return base::ContainsKey(undrawn_surfaces_, surface_id); } - bool SurfaceDamaged(const SurfaceId& surface_id, + bool SurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) override { return false; } - void SurfaceDiscarded(const SurfaceId& surface_id) override {} + void SurfaceDiscarded(const viz::SurfaceId& surface_id) override {} int draw_and_swap_count() const { return draw_and_swap_count_; } void SetNextDrawAndSwapFails() { next_draw_and_swap_fails_ = true; } - void SurfaceDamaged(const SurfaceId& surface_id) { + void SurfaceDamaged(const viz::SurfaceId& surface_id) { undrawn_surfaces_.insert(surface_id); } protected: int draw_and_swap_count_; bool next_draw_and_swap_fails_; - std::set<SurfaceId> undrawn_surfaces_; + std::set<viz::SurfaceId> undrawn_surfaces_; }; class TestDisplayScheduler : public DisplayScheduler { @@ -132,17 +132,17 @@ void SetUp() override { scheduler_.SetRootSurfaceResourcesLocked(false); } void AdvanceTimeAndBeginFrameForTest( - const std::vector<SurfaceId>& observing_surfaces) { + const std::vector<viz::SurfaceId>& observing_surfaces) { now_src_.Advance(base::TimeDelta::FromMicroseconds(10000)); // FakeBeginFrameSource deals with |source_id| and |sequence_number|. last_begin_frame_args_ = fake_begin_frame_source_.CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, &now_src_); fake_begin_frame_source_.TestOnBeginFrame(last_begin_frame_args_); - for (const SurfaceId& surface : observing_surfaces) + for (const viz::SurfaceId& surface : observing_surfaces) scheduler_.OnSurfaceDamageExpected(surface, last_begin_frame_args_); } - void SurfaceDamaged(const SurfaceId& surface_id) { + void SurfaceDamaged(const viz::SurfaceId& surface_id) { client_.SurfaceDamaged(surface_id); scheduler_.ProcessSurfaceDamage(surface_id, AckForCurrentBeginFrame(), true); @@ -170,20 +170,20 @@ }; TEST_F(DisplaySchedulerTest, ResizeHasLateDeadlineUntilNewRootSurface) { - SurfaceId root_surface_id1( + viz::SurfaceId root_surface_id1( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId root_surface_id2( + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId root_surface_id2( kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); base::TimeTicks late_deadline; scheduler_.SetVisible(true); // Go trough an initial BeginFrame cycle with the root surface. - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); scheduler_.SetNewRootSurface(root_surface_id1); scheduler_.BeginFrameDeadlineForTest(); @@ -213,17 +213,17 @@ } TEST_F(DisplaySchedulerTest, ResizeHasLateDeadlineUntilDamagedSurface) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); base::TimeTicks late_deadline; scheduler_.SetVisible(true); // Go trough an initial BeginFrame cycle with the root surface. - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); scheduler_.SetNewRootSurface(root_surface_id); scheduler_.BeginFrameDeadlineForTest(); @@ -252,13 +252,13 @@ } TEST_F(DisplaySchedulerTest, SurfaceDamaged) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); - SurfaceId sid2(kArbitraryFrameSinkId, - LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId sid2(kArbitraryFrameSinkId, + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); scheduler_.SetVisible(true); scheduler_.SetNewRootSurface(root_surface_id); @@ -321,7 +321,7 @@ scheduler_.BeginFrameDeadlineForTest(); // System should be idle now. - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); EXPECT_FALSE(scheduler_.inside_begin_frame_deadline_interval()); // Surface damage with |!display_damaged| does not affect needs_draw and @@ -346,13 +346,13 @@ }; TEST_F(DisplaySchedulerWaitForAllSurfacesTest, WaitForAllSurfacesBeforeDraw) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); - SurfaceId sid2(kArbitraryFrameSinkId, - LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId sid2(kArbitraryFrameSinkId, + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); scheduler_.SetVisible(true); scheduler_.SetNewRootSurface(root_surface_id); @@ -406,13 +406,13 @@ // System should be idle now because we had a frame without damage. Restore it // to active state (DisplayScheduler observing BeginFrames) for the next test. - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); EXPECT_FALSE(scheduler_.inside_begin_frame_deadline_interval()); SurfaceDamaged(sid1); scheduler_.BeginFrameDeadlineForTest(); // BeginFrame without expected surface damage triggers immediate deadline. - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); EXPECT_TRUE(scheduler_.inside_begin_frame_deadline_interval()); EXPECT_GE(now_src().NowTicks(), scheduler_.DesiredBeginFrameDeadlineTimeForTest()); @@ -420,11 +420,11 @@ } TEST_F(DisplaySchedulerTest, OutputSurfaceLost) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); scheduler_.SetVisible(true); scheduler_.SetNewRootSurface(root_surface_id); @@ -454,9 +454,9 @@ } TEST_F(DisplaySchedulerTest, VisibleWithoutDamageNoTicks) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); EXPECT_EQ(0u, fake_begin_frame_source_.num_observers()); scheduler_.SetVisible(true); @@ -470,11 +470,11 @@ } TEST_F(DisplaySchedulerTest, VisibleWithDamageTicks) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); scheduler_.SetNewRootSurface(root_surface_id); @@ -487,11 +487,11 @@ } TEST_F(DisplaySchedulerTest, Visibility) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); // Set the root surface. scheduler_.SetNewRootSurface(root_surface_id); @@ -540,11 +540,11 @@ } TEST_F(DisplaySchedulerTest, ResizeCausesSwap) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); scheduler_.SetVisible(true); scheduler_.SetNewRootSurface(root_surface_id); @@ -559,18 +559,18 @@ EXPECT_EQ(1, client_.draw_and_swap_count()); scheduler_.DisplayResized(); - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); // DisplayResized should trigger a swap to happen. scheduler_.BeginFrameDeadlineForTest(); EXPECT_EQ(2, client_.draw_and_swap_count()); } TEST_F(DisplaySchedulerTest, RootSurfaceResourcesLocked) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); base::TimeTicks late_deadline; scheduler_.SetVisible(true); @@ -615,13 +615,13 @@ } TEST_F(DisplaySchedulerTest, DidSwapBuffers) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); - SurfaceId sid2(kArbitraryFrameSinkId, - LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId sid2(kArbitraryFrameSinkId, + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); scheduler_.SetVisible(true); scheduler_.SetNewRootSurface(root_surface_id); @@ -676,11 +676,11 @@ // This test verfies that we try to reschedule the deadline // after any event that may change what deadline we want. TEST_F(DisplaySchedulerTest, ScheduleBeginFrameDeadline) { - SurfaceId root_surface_id( + viz::SurfaceId root_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(1, base::UnguessableToken::Create())); - SurfaceId sid1(kArbitraryFrameSinkId, - LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); + viz::SurfaceId sid1(kArbitraryFrameSinkId, + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); int count = 1; EXPECT_EQ(count, scheduler_.scheduler_begin_frame_deadline_count()); @@ -704,12 +704,12 @@ scheduler_.SetNewRootSurface(root_surface_id); EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); scheduler_.BeginFrameDeadlineForTest(); scheduler_.DidSwapBuffers(); - AdvanceTimeAndBeginFrameForTest(std::vector<SurfaceId>()); + AdvanceTimeAndBeginFrameForTest(std::vector<viz::SurfaceId>()); EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); scheduler_.DidReceiveSwapBuffersAck();
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc index 62958f6..620cd39d 100644 --- a/cc/surfaces/display_unittest.cc +++ b/cc/surfaces/display_unittest.cc
@@ -16,15 +16,15 @@ #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/display_client.h" #include "cc/surfaces/display_scheduler.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_output_surface.h" #include "cc/test/scheduler_test_common.h" #include "cc/test/test_shared_bitmap_manager.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/common/resources/shared_bitmap_manager.h" #include "gpu/GLES2/gl2extchromium.h" #include "testing/gmock/include/gmock/gmock.h" @@ -35,8 +35,8 @@ namespace cc { namespace { -static constexpr FrameSinkId kArbitraryFrameSinkId(3, 3); -static constexpr FrameSinkId kAnotherFrameSinkId(4, 4); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(3, 3); +static constexpr viz::FrameSinkId kAnotherFrameSinkId(4, 4); class TestSoftwareOutputDevice : public SoftwareOutputDevice { public: @@ -60,11 +60,11 @@ void DisplayResized() override { display_resized_ = true; } - void SetNewRootSurface(const SurfaceId& root_surface_id) override { + void SetNewRootSurface(const viz::SurfaceId& root_surface_id) override { has_new_root_surface = true; } - void ProcessSurfaceDamage(const SurfaceId& surface_id, + void ProcessSurfaceDamage(const viz::SurfaceId& surface_id, const BeginFrameAck& ack, bool display_damaged) override { if (display_damaged) { @@ -127,7 +127,7 @@ std::unique_ptr<Display> CreateDisplay( const RendererSettings& settings, - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, std::unique_ptr<DisplayScheduler> scheduler, std::unique_ptr<OutputSurface> output_surface) { auto display = base::MakeUnique<Display>( @@ -147,7 +147,7 @@ protected: void SubmitCompositorFrame(RenderPassList* pass_list, - const LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { CompositorFrame frame = test::MakeCompositorFrame(); pass_list->swap(frame.render_pass_list); @@ -156,7 +156,7 @@ FrameSinkManager manager_; std::unique_ptr<CompositorFrameSinkSupport> support_; - LocalSurfaceIdAllocator id_allocator_; + viz::LocalSurfaceIdAllocator id_allocator_; scoped_refptr<base::NullTaskRunner> task_runner_; TestSharedBitmapManager shared_bitmap_manager_; std::unique_ptr<BeginFrameSource> begin_frame_source_; @@ -191,7 +191,7 @@ display_->Initialize(&client, manager_.surface_manager()); display_->SetColorSpace(color_space_1, color_space_1); - LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); + viz::LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); EXPECT_FALSE(scheduler_->damaged); EXPECT_FALSE(scheduler_->has_new_root_surface); display_->SetLocalSurfaceId(local_surface_id, 1.f); @@ -449,7 +449,7 @@ display_->Initialize(&client, manager_.surface_manager()); display_->SetColorSpace(color_space_1, color_space_1); - LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); + viz::LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); display_->SetLocalSurfaceId(local_surface_id, 1.f); scheduler_->ResetDamageForTest(); @@ -501,8 +501,8 @@ }; TEST_F(DisplayTest, Finish) { - LocalSurfaceId local_surface_id1(id_allocator_.GenerateId()); - LocalSurfaceId local_surface_id2(id_allocator_.GenerateId()); + viz::LocalSurfaceId local_surface_id1(id_allocator_.GenerateId()); + viz::LocalSurfaceId local_surface_id2(id_allocator_.GenerateId()); RendererSettings settings; settings.partial_swap_enabled = true; @@ -601,7 +601,7 @@ // There should not be a side-effect on other Displays. TEST_F(DisplayTest, CompositorFrameDamagesCorrectDisplay) { RendererSettings settings; - LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); + viz::LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); // Set up first display. SetUpDisplay(settings, nullptr);
diff --git a/cc/surfaces/frame_sink_manager.cc b/cc/surfaces/frame_sink_manager.cc index 079135c..dea0fdf 100644 --- a/cc/surfaces/frame_sink_manager.cc +++ b/cc/surfaces/frame_sink_manager.cc
@@ -34,16 +34,18 @@ DCHECK_EQ(registered_sources_.size(), 0u); } -void FrameSinkManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { +void FrameSinkManager::RegisterFrameSinkId( + const viz::FrameSinkId& frame_sink_id) { surface_manager_.RegisterFrameSinkId(frame_sink_id); } -void FrameSinkManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { +void FrameSinkManager::InvalidateFrameSinkId( + const viz::FrameSinkId& frame_sink_id) { surface_manager_.InvalidateFrameSinkId(frame_sink_id); } void FrameSinkManager::RegisterFrameSinkManagerClient( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, FrameSinkManagerClient* client) { DCHECK(client); DCHECK_EQ(surface_manager_.GetValidFrameSinkIds().count(frame_sink_id), 1u); @@ -58,7 +60,7 @@ } void FrameSinkManager::UnregisterFrameSinkManagerClient( - const FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { DCHECK_EQ(surface_manager_.GetValidFrameSinkIds().count(frame_sink_id), 1u); auto client_iter = clients_.find(frame_sink_id); DCHECK(client_iter != clients_.end()); @@ -73,7 +75,7 @@ void FrameSinkManager::RegisterBeginFrameSource( BeginFrameSource* source, - const FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { DCHECK(source); DCHECK_EQ(registered_sources_.count(source), 0u); DCHECK_EQ(surface_manager_.GetValidFrameSinkIds().count(frame_sink_id), 1u); @@ -88,7 +90,7 @@ DCHECK(source); DCHECK_EQ(registered_sources_.count(source), 1u); - FrameSinkId frame_sink_id = registered_sources_[source]; + viz::FrameSinkId frame_sink_id = registered_sources_[source]; registered_sources_.erase(source); primary_source_.OnBeginFrameSourceRemoved(source); @@ -110,7 +112,7 @@ } void FrameSinkManager::RecursivelyAttachBeginFrameSource( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, BeginFrameSource* source) { FrameSinkSourceMapping& mapping = frame_sink_source_map_[frame_sink_id]; if (!mapping.source) { @@ -121,16 +123,16 @@ } for (size_t i = 0; i < mapping.children.size(); ++i) { // |frame_sink_source_map_| is a container that can allocate new memory and - // move data between buffers. Copy child's FrameSinkId before passing it to - // RecursivelyAttachBeginFrameSource so that we don't reference data inside - // |frame_sink_source_map_|. - FrameSinkId child_copy = mapping.children[i]; + // move data between buffers. Copy child's viz::FrameSinkId before passing + // it to RecursivelyAttachBeginFrameSource so that we don't reference data + // inside |frame_sink_source_map_|. + viz::FrameSinkId child_copy = mapping.children[i]; RecursivelyAttachBeginFrameSource(child_copy, source); } } void FrameSinkManager::RecursivelyDetachBeginFrameSource( - const FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, BeginFrameSource* source) { auto iter = frame_sink_source_map_.find(frame_sink_id); if (iter == frame_sink_source_map_.end()) @@ -147,20 +149,20 @@ return; } - std::vector<FrameSinkId>& children = iter->second.children; + std::vector<viz::FrameSinkId>& children = iter->second.children; for (size_t i = 0; i < children.size(); ++i) { RecursivelyDetachBeginFrameSource(children[i], source); } } bool FrameSinkManager::ChildContains( - const FrameSinkId& child_frame_sink_id, - const FrameSinkId& search_frame_sink_id) const { + const viz::FrameSinkId& child_frame_sink_id, + const viz::FrameSinkId& search_frame_sink_id) const { auto iter = frame_sink_source_map_.find(child_frame_sink_id); if (iter == frame_sink_source_map_.end()) return false; - const std::vector<FrameSinkId>& children = iter->second.children; + const std::vector<viz::FrameSinkId>& children = iter->second.children; for (size_t i = 0; i < children.size(); ++i) { if (children[i] == search_frame_sink_id) return true; @@ -171,13 +173,13 @@ } void FrameSinkManager::RegisterFrameSinkHierarchy( - const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id) { + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) { // If it's possible to reach the parent through the child's descendant chain, // then this will create an infinite loop. Might as well just crash here. CHECK(!ChildContains(child_frame_sink_id, parent_frame_sink_id)); - std::vector<FrameSinkId>& children = + std::vector<viz::FrameSinkId>& children = frame_sink_source_map_[parent_frame_sink_id].children; for (size_t i = 0; i < children.size(); ++i) DCHECK(children[i] != child_frame_sink_id); @@ -195,18 +197,18 @@ } void FrameSinkManager::UnregisterFrameSinkHierarchy( - const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id) { - // Deliberately do not check validity of either parent or child FrameSinkId - // here. They were valid during the registration, so were valid at some - // point in time. This makes it possible to invalidate parent and child - // FrameSinkIds independently of each other and not have an ordering + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) { + // Deliberately do not check validity of either parent or child + // viz::FrameSinkId here. They were valid during the registration, so were + // valid at some point in time. This makes it possible to invalidate parent + // and child FrameSinkIds independently of each other and not have an ordering // dependency of unregistering the hierarchy first before either of them. DCHECK_EQ(frame_sink_source_map_.count(parent_frame_sink_id), 1u); auto iter = frame_sink_source_map_.find(parent_frame_sink_id); - std::vector<FrameSinkId>& children = iter->second.children; + std::vector<viz::FrameSinkId>& children = iter->second.children; bool found_child = false; for (size_t i = 0; i < children.size(); ++i) { if (children[i] == child_frame_sink_id) { @@ -239,7 +241,8 @@ RecursivelyAttachBeginFrameSource(source_iter.second, source_iter.first); } -void FrameSinkManager::DropTemporaryReference(const SurfaceId& surface_id) { +void FrameSinkManager::DropTemporaryReference( + const viz::SurfaceId& surface_id) { surface_manager_.DropTemporaryReference(surface_id); }
diff --git a/cc/surfaces/frame_sink_manager.h b/cc/surfaces/frame_sink_manager.h index 2833389..dd3e77b 100644 --- a/cc/surfaces/frame_sink_manager.h +++ b/cc/surfaces/frame_sink_manager.h
@@ -13,10 +13,10 @@ #include "base/containers/flat_map.h" #include "base/logging.h" #include "base/macros.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/primary_begin_frame_source.h" #include "cc/surfaces/surface_manager.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/frame_sink_id.h" namespace cc { class BeginFrameSource; @@ -36,11 +36,11 @@ SurfaceManager::LifetimeType::SEQUENCES); ~FrameSinkManager(); - void RegisterFrameSinkId(const FrameSinkId& frame_sink_id); + void RegisterFrameSinkId(const viz::FrameSinkId& frame_sink_id); // Invalidate a frame_sink_id that might still have associated sequences, // possibly because a renderer process has crashed. - void InvalidateFrameSinkId(const FrameSinkId& frame_sink_id); + void InvalidateFrameSinkId(const viz::FrameSinkId& frame_sink_id); // CompositorFrameSinkSupport, hierarchy, and BeginFrameSource can be // registered and unregistered in any order with respect to each other. @@ -53,15 +53,15 @@ // Associates a FrameSinkManagerClient with the frame_sink_id it uses. // FrameSinkManagerClient and framesink allocators have a 1:1 mapping. // Caller guarantees the client is alive between register/unregister. - void RegisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id, + void RegisterFrameSinkManagerClient(const viz::FrameSinkId& frame_sink_id, FrameSinkManagerClient* client); - void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id); + void UnregisterFrameSinkManagerClient(const viz::FrameSinkId& frame_sink_id); // Associates a |source| with a particular framesink. That framesink and // any children of that framesink with valid clients can potentially use // that |source|. void RegisterBeginFrameSource(BeginFrameSource* source, - const FrameSinkId& frame_sink_id); + const viz::FrameSinkId& frame_sink_id); void UnregisterBeginFrameSource(BeginFrameSource* source); // Returns a stable BeginFrameSource that forwards BeginFrames from the first @@ -72,15 +72,16 @@ // that surfaces from the child framesik will be displayed in the parent. // Children are allowed to use any begin frame source that their parent can // use. - void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id); - void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id); + void RegisterFrameSinkHierarchy(const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id); + void UnregisterFrameSinkHierarchy( + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id); // Drops the temporary reference for |surface_id|. If a surface reference has // already been added from the parent to |surface_id| then this will do // nothing. - void DropTemporaryReference(const SurfaceId& surface_id); + void DropTemporaryReference(const viz::SurfaceId& surface_id); SurfaceManager* surface_manager() { return &surface_manager_; } @@ -88,15 +89,15 @@ friend class test::CompositorFrameSinkSupportTest; friend class test::SurfaceSynchronizationTest; - void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, + void RecursivelyAttachBeginFrameSource(const viz::FrameSinkId& frame_sink_id, BeginFrameSource* source); - void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, + void RecursivelyDetachBeginFrameSource(const viz::FrameSinkId& frame_sink_id, BeginFrameSource* source); // Returns true if |child framesink| is or has |search_frame_sink_id| as a // child. - bool ChildContains(const FrameSinkId& child_frame_sink_id, - const FrameSinkId& search_frame_sink_id) const; + bool ChildContains(const viz::FrameSinkId& child_frame_sink_id, + const viz::FrameSinkId& search_frame_sink_id) const; // Begin frame source routing. Both BeginFrameSource and // CompositorFrameSinkSupport pointers guaranteed alive by callers until @@ -109,17 +110,19 @@ // The currently assigned begin frame source for this client. BeginFrameSource* source = nullptr; // This represents a dag of parent -> children mapping. - std::vector<FrameSinkId> children; + std::vector<viz::FrameSinkId> children; }; - base::flat_map<FrameSinkId, FrameSinkManagerClient*> clients_; - std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash> + base::flat_map<viz::FrameSinkId, FrameSinkManagerClient*> clients_; + std::unordered_map<viz::FrameSinkId, + FrameSinkSourceMapping, + viz::FrameSinkIdHash> frame_sink_source_map_; // Set of BeginFrameSource along with associated FrameSinkIds. Any child // that is implicitly using this framesink must be reachable by the // parent in the dag. - std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; + std::unordered_map<BeginFrameSource*, viz::FrameSinkId> registered_sources_; PrimaryBeginFrameSource primary_source_;
diff --git a/cc/surfaces/frame_sink_manager_unittest.cc b/cc/surfaces/frame_sink_manager_unittest.cc index ea5c852..3b1d945b 100644 --- a/cc/surfaces/frame_sink_manager_unittest.cc +++ b/cc/surfaces/frame_sink_manager_unittest.cc
@@ -15,15 +15,15 @@ namespace { -constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); } class FakeFrameSinkManagerClient : public FrameSinkManagerClient { public: - explicit FakeFrameSinkManagerClient(const FrameSinkId& frame_sink_id) + explicit FakeFrameSinkManagerClient(const viz::FrameSinkId& frame_sink_id) : source_(nullptr), manager_(nullptr), frame_sink_id_(frame_sink_id) {} - FakeFrameSinkManagerClient(const FrameSinkId& frame_sink_id, + FakeFrameSinkManagerClient(const viz::FrameSinkId& frame_sink_id, FrameSinkManager* manager) : source_(nullptr), manager_(nullptr), frame_sink_id_(frame_sink_id) { DCHECK(manager); @@ -38,7 +38,7 @@ } BeginFrameSource* source() { return source_; } - const FrameSinkId& frame_sink_id() { return frame_sink_id_; } + const viz::FrameSinkId& frame_sink_id() { return frame_sink_id_; } void Register(FrameSinkManager* manager) { EXPECT_EQ(nullptr, manager_); @@ -61,7 +61,7 @@ private: BeginFrameSource* source_; FrameSinkManager* manager_; - FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; }; class FrameSinkManagerTest : public testing::Test { @@ -73,12 +73,12 @@ FrameSinkManagerTest() { for (size_t i = 0; i < MAX_FRAME_SINK; ++i) - manager_.RegisterFrameSinkId(FrameSinkId(i, i)); + manager_.RegisterFrameSinkId(viz::FrameSinkId(i, i)); } ~FrameSinkManagerTest() override { for (size_t i = 0; i < MAX_FRAME_SINK; ++i) - manager_.InvalidateFrameSinkId(FrameSinkId(i, i)); + manager_.InvalidateFrameSinkId(viz::FrameSinkId(i, i)); } protected: @@ -86,8 +86,8 @@ }; TEST_F(FrameSinkManagerTest, SingleClients) { - FakeFrameSinkManagerClient client(FrameSinkId(1, 1)); - FakeFrameSinkManagerClient other_client(FrameSinkId(2, 2)); + FakeFrameSinkManagerClient client(viz::FrameSinkId(1, 1)); + FakeFrameSinkManagerClient other_client(viz::FrameSinkId(2, 2)); StubBeginFrameSource source; EXPECT_EQ(nullptr, client.source()); @@ -152,13 +152,13 @@ BeginFrameSource* begin_frame_source = manager_.GetPrimaryBeginFrameSource(); begin_frame_source->AddObserver(&obs); - FakeFrameSinkManagerClient root1(FrameSinkId(1, 1), &manager_); + FakeFrameSinkManagerClient root1(viz::FrameSinkId(1, 1), &manager_); std::unique_ptr<FakeExternalBeginFrameSource> external_source1 = base::MakeUnique<FakeExternalBeginFrameSource>(60.f, false); manager_.RegisterBeginFrameSource(external_source1.get(), root1.frame_sink_id()); - FakeFrameSinkManagerClient root2(FrameSinkId(2, 2), &manager_); + FakeFrameSinkManagerClient root2(viz::FrameSinkId(2, 2), &manager_); std::unique_ptr<FakeExternalBeginFrameSource> external_source2 = base::MakeUnique<FakeExternalBeginFrameSource>(60.f, false); manager_.RegisterBeginFrameSource(external_source2.get(), @@ -207,11 +207,11 @@ // root1 -> A -> B // root2 -> C - FakeFrameSinkManagerClient root1(FrameSinkId(1, 1), &manager_); - FakeFrameSinkManagerClient root2(FrameSinkId(2, 2), &manager_); - FakeFrameSinkManagerClient client_a(FrameSinkId(3, 3), &manager_); - FakeFrameSinkManagerClient client_b(FrameSinkId(4, 4), &manager_); - FakeFrameSinkManagerClient client_c(FrameSinkId(5, 5), &manager_); + FakeFrameSinkManagerClient root1(viz::FrameSinkId(1, 1), &manager_); + FakeFrameSinkManagerClient root2(viz::FrameSinkId(2, 2), &manager_); + FakeFrameSinkManagerClient client_a(viz::FrameSinkId(3, 3), &manager_); + FakeFrameSinkManagerClient client_b(viz::FrameSinkId(4, 4), &manager_); + FakeFrameSinkManagerClient client_c(viz::FrameSinkId(5, 5), &manager_); manager_.RegisterBeginFrameSource(&root1_source, root1.frame_sink_id()); manager_.RegisterBeginFrameSource(&root2_source, root2.frame_sink_id()); @@ -269,15 +269,15 @@ } // This test verifies that a BeginFrameSource path to the root from a -// FrameSinkId is preserved even if that FrameSinkId has no children +// viz::FrameSinkId is preserved even if that viz::FrameSinkId has no children // and does not have a corresponding FrameSinkManagerClient. TEST_F(FrameSinkManagerTest, ParentWithoutClientRetained) { StubBeginFrameSource root_source; - constexpr FrameSinkId kFrameSinkIdRoot(1, 1); - constexpr FrameSinkId kFrameSinkIdA(2, 2); - constexpr FrameSinkId kFrameSinkIdB(3, 3); - constexpr FrameSinkId kFrameSinkIdC(4, 4); + constexpr viz::FrameSinkId kFrameSinkIdRoot(1, 1); + constexpr viz::FrameSinkId kFrameSinkIdA(2, 2); + constexpr viz::FrameSinkId kFrameSinkIdB(3, 3); + constexpr viz::FrameSinkId kFrameSinkIdC(4, 4); FakeFrameSinkManagerClient root(kFrameSinkIdRoot, &manager_); FakeFrameSinkManagerClient client_b(kFrameSinkIdB, &manager_); @@ -313,10 +313,10 @@ ParentWithoutClientRetained_LateBeginFrameRegistration) { StubBeginFrameSource root_source; - constexpr FrameSinkId kFrameSinkIdRoot(1, 1); - constexpr FrameSinkId kFrameSinkIdA(2, 2); - constexpr FrameSinkId kFrameSinkIdB(3, 3); - constexpr FrameSinkId kFrameSinkIdC(4, 4); + constexpr viz::FrameSinkId kFrameSinkIdRoot(1, 1); + constexpr viz::FrameSinkId kFrameSinkIdA(2, 2); + constexpr viz::FrameSinkId kFrameSinkIdB(3, 3); + constexpr viz::FrameSinkId kFrameSinkIdC(4, 4); FakeFrameSinkManagerClient root(kFrameSinkIdRoot, &manager_); FakeFrameSinkManagerClient client_b(kFrameSinkIdB, &manager_); @@ -354,9 +354,9 @@ class SurfaceManagerOrderingTest : public FrameSinkManagerTest { public: SurfaceManagerOrderingTest() - : client_a_(FrameSinkId(1, 1)), - client_b_(FrameSinkId(2, 2)), - client_c_(FrameSinkId(3, 3)), + : client_a_(viz::FrameSinkId(1, 1)), + client_b_(viz::FrameSinkId(2, 2)), + client_c_(viz::FrameSinkId(3, 3)), hierarchy_registered_(false), clients_registered_(false), bfs_registered_(false) {
diff --git a/cc/surfaces/primary_begin_frame_source.h b/cc/surfaces/primary_begin_frame_source.h index cf424aa..a49aed04 100644 --- a/cc/surfaces/primary_begin_frame_source.h +++ b/cc/surfaces/primary_begin_frame_source.h
@@ -5,6 +5,7 @@ #ifndef CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_ #define CC_SURFACES_PRIMARY_BEGIN_FRAME_SOURCE_H_ +#include "base/containers/flat_set.h" #include "cc/scheduler/begin_frame_source.h" namespace cc {
diff --git a/cc/surfaces/referenced_surface_tracker.cc b/cc/surfaces/referenced_surface_tracker.cc index cf4e6e2..4f4167ba 100644 --- a/cc/surfaces/referenced_surface_tracker.cc +++ b/cc/surfaces/referenced_surface_tracker.cc
@@ -9,16 +9,16 @@ namespace cc { void GetSurfaceReferenceDifference( - const SurfaceId& parent_surface_id, - const base::flat_set<SurfaceId>& old_referenced_surfaces, - const base::flat_set<SurfaceId>& new_referenced_surfaces, + const viz::SurfaceId& parent_surface_id, + const base::flat_set<viz::SurfaceId>& old_referenced_surfaces, + const base::flat_set<viz::SurfaceId>& new_referenced_surfaces, std::vector<SurfaceReference>* references_to_add, std::vector<SurfaceReference>* references_to_remove) { DCHECK(parent_surface_id.is_valid()); // Find SurfaceIds in |old_referenced_surfaces| that aren't referenced // anymore. - for (const SurfaceId& surface_id : old_referenced_surfaces) { + for (const viz::SurfaceId& surface_id : old_referenced_surfaces) { if (new_referenced_surfaces.count(surface_id) == 0) { references_to_remove->push_back( SurfaceReference(parent_surface_id, surface_id)); @@ -27,7 +27,7 @@ // Find SurfaceIds in |new_referenced_surfaces| that aren't already // referenced. - for (const SurfaceId& surface_id : new_referenced_surfaces) { + for (const viz::SurfaceId& surface_id : new_referenced_surfaces) { if (old_referenced_surfaces.count(surface_id) == 0) { references_to_add->push_back( SurfaceReference(parent_surface_id, surface_id));
diff --git a/cc/surfaces/referenced_surface_tracker.h b/cc/surfaces/referenced_surface_tracker.h index 61fcd0b1..cac5a41 100644 --- a/cc/surfaces/referenced_surface_tracker.h +++ b/cc/surfaces/referenced_surface_tracker.h
@@ -8,9 +8,9 @@ #include <vector> #include "base/containers/flat_set.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -19,9 +19,9 @@ // |references_to_remove| based on the difference using |parent_surface_id| as // the parent for references. CC_SURFACES_EXPORT void GetSurfaceReferenceDifference( - const SurfaceId& parent_surface_id, - const base::flat_set<SurfaceId>& old_referenced_surfaces, - const base::flat_set<SurfaceId>& new_referenced_surfaces, + const viz::SurfaceId& parent_surface_id, + const base::flat_set<viz::SurfaceId>& old_referenced_surfaces, + const base::flat_set<viz::SurfaceId>& new_referenced_surfaces, std::vector<SurfaceReference>* references_to_add, std::vector<SurfaceReference>* references_to_remove);
diff --git a/cc/surfaces/referenced_surface_tracker_unittest.cc b/cc/surfaces/referenced_surface_tracker_unittest.cc index 624248e..562ffe7 100644 --- a/cc/surfaces/referenced_surface_tracker_unittest.cc +++ b/cc/surfaces/referenced_surface_tracker_unittest.cc
@@ -10,9 +10,9 @@ #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/surface_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,19 +23,20 @@ namespace test { namespace { -constexpr FrameSinkId kParentFrameSink(2, 1); -constexpr FrameSinkId kChildFrameSink1(65563, 1); -constexpr FrameSinkId kChildFrameSink2(65564, 1); +constexpr viz::FrameSinkId kParentFrameSink(2, 1); +constexpr viz::FrameSinkId kChildFrameSink1(65563, 1); +constexpr viz::FrameSinkId kChildFrameSink2(65564, 1); -base::flat_set<SurfaceId> MakeReferenceSet( - std::initializer_list<SurfaceId> surface_ids) { - return base::flat_set<SurfaceId>(surface_ids, base::KEEP_FIRST_OF_DUPES); +base::flat_set<viz::SurfaceId> MakeReferenceSet( + std::initializer_list<viz::SurfaceId> surface_ids) { + return base::flat_set<viz::SurfaceId>(surface_ids, base::KEEP_FIRST_OF_DUPES); } -SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { - return SurfaceId( - frame_sink_id, - LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); +viz::SurfaceId MakeSurfaceId(const viz::FrameSinkId& frame_sink_id, + uint32_t local_id) { + return viz::SurfaceId( + frame_sink_id, viz::LocalSurfaceId( + local_id, base::UnguessableToken::Deserialize(0, 1u))); } } // namespace @@ -54,9 +55,9 @@ } void UpdateReferences( - const SurfaceId& surface_id, - const base::flat_set<SurfaceId>& old_referenced_surfaces, - const base::flat_set<SurfaceId>& new_referenced_surfaces) { + const viz::SurfaceId& surface_id, + const base::flat_set<viz::SurfaceId>& old_referenced_surfaces, + const base::flat_set<viz::SurfaceId>& new_referenced_surfaces) { references_to_add_.clear(); references_to_remove_.clear(); GetSurfaceReferenceDifference(surface_id, old_referenced_surfaces, @@ -72,8 +73,8 @@ }; TEST_F(ReferencedSurfaceTrackerTest, AddSurfaceReference) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); const SurfaceReference reference(parent_id, child_id1); // Check that reference to |child_id1| is added. @@ -84,8 +85,8 @@ } TEST_F(ReferencedSurfaceTrackerTest, NoChangeToReferences) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); const SurfaceReference reference(parent_id, child_id1); // Check that no references are added or removed. @@ -96,8 +97,8 @@ } TEST_F(ReferencedSurfaceTrackerTest, RemoveSurfaceReference) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); const SurfaceReference reference(parent_id, child_id1); // Check that reference to |child_id1| is removed. @@ -108,9 +109,9 @@ } TEST_F(ReferencedSurfaceTrackerTest, RemoveOneOfTwoSurfaceReferences) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1_first = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id1_second = MakeSurfaceId(kChildFrameSink1, 2); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1_first = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id1_second = MakeSurfaceId(kChildFrameSink1, 2); const SurfaceReference reference_first(parent_id, child_id1_first); const SurfaceReference reference_second(parent_id, child_id1_second); @@ -123,9 +124,9 @@ } TEST_F(ReferencedSurfaceTrackerTest, AddTwoThenRemoveOneSurfaceReferences) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 2); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 2); const SurfaceReference reference1(parent_id, child_id1); const SurfaceReference reference2(parent_id, child_id2);
diff --git a/cc/surfaces/sequence_surface_reference_factory.cc b/cc/surfaces/sequence_surface_reference_factory.cc index c06f17c9..c24abf6 100644 --- a/cc/surfaces/sequence_surface_reference_factory.cc +++ b/cc/surfaces/sequence_surface_reference_factory.cc
@@ -13,7 +13,7 @@ base::Closure SequenceSurfaceReferenceFactory::CreateReference( SurfaceReferenceOwner* owner, - const SurfaceId& surface_id) const { + const viz::SurfaceId& surface_id) const { auto seq = owner->GetSurfaceSequenceGenerator()->CreateSurfaceSequence(); RequireSequence(surface_id, seq); return base::Bind(&SequenceSurfaceReferenceFactory::SatisfySequence, this,
diff --git a/cc/surfaces/sequence_surface_reference_factory.h b/cc/surfaces/sequence_surface_reference_factory.h index 7e397dac..1ad6f8fc1 100644 --- a/cc/surfaces/sequence_surface_reference_factory.h +++ b/cc/surfaces/sequence_surface_reference_factory.h
@@ -18,14 +18,15 @@ SequenceSurfaceReferenceFactory() = default; // SurfaceReferenceFactory implementation: - base::Closure CreateReference(SurfaceReferenceOwner* owner, - const SurfaceId& surface_id) const override; + base::Closure CreateReference( + SurfaceReferenceOwner* owner, + const viz::SurfaceId& surface_id) const override; protected: ~SequenceSurfaceReferenceFactory() override = default; private: - virtual void RequireSequence(const SurfaceId& surface_id, + virtual void RequireSequence(const viz::SurfaceId& surface_id, const SurfaceSequence& sequence) const = 0; virtual void SatisfySequence(const SurfaceSequence& sequence) const = 0;
diff --git a/cc/surfaces/stub_surface_reference_factory.cc b/cc/surfaces/stub_surface_reference_factory.cc index cc674fdf..29b6313 100644 --- a/cc/surfaces/stub_surface_reference_factory.cc +++ b/cc/surfaces/stub_surface_reference_factory.cc
@@ -10,7 +10,7 @@ base::Closure StubSurfaceReferenceFactory::CreateReference( SurfaceReferenceOwner* owner, - const SurfaceId& surface_id) const { + const viz::SurfaceId& surface_id) const { return base::Closure(); }
diff --git a/cc/surfaces/stub_surface_reference_factory.h b/cc/surfaces/stub_surface_reference_factory.h index 7fdb4c62..62ff788 100644 --- a/cc/surfaces/stub_surface_reference_factory.h +++ b/cc/surfaces/stub_surface_reference_factory.h
@@ -20,8 +20,9 @@ StubSurfaceReferenceFactory() = default; // SurfaceReferenceFactory: - base::Closure CreateReference(SurfaceReferenceOwner* owner, - const SurfaceId& surface_id) const override; + base::Closure CreateReference( + SurfaceReferenceOwner* owner, + const viz::SurfaceId& surface_id) const override; protected: ~StubSurfaceReferenceFactory() override = default;
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc index c578ef2..fc89d3d 100644 --- a/cc/surfaces/surface.cc +++ b/cc/surfaces/surface.cc
@@ -11,10 +11,10 @@ #include "base/stl_util.h" #include "cc/output/copy_output_request.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface_client.h" #include "cc/surfaces/surface_manager.h" #include "cc/surfaces/surface_resource_holder_client.h" +#include "components/viz/common/local_surface_id_allocator.h" namespace cc { @@ -71,13 +71,13 @@ } void Surface::RejectCompositorFramesToFallbackSurfaces() { - std::vector<FrameSinkId> frame_sink_ids_for_dependencies; - for (const SurfaceId& surface_id : + std::vector<viz::FrameSinkId> frame_sink_ids_for_dependencies; + for (const viz::SurfaceId& surface_id : GetPendingFrame().metadata.activation_dependencies) { frame_sink_ids_for_dependencies.push_back(surface_id.frame_sink_id()); } - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : GetPendingFrame().metadata.referenced_surfaces) { // A surface ID in |referenced_surfaces| that has a corresponding surface // ID in |activation_dependencies| with the same frame sink ID is said to @@ -180,7 +180,7 @@ copy_requests.push_back(std::move(copy_request)); } -void Surface::NotifySurfaceIdAvailable(const SurfaceId& surface_id) { +void Surface::NotifySurfaceIdAvailable(const viz::SurfaceId& surface_id) { auto it = activation_dependencies_.find(surface_id); // This surface may no longer have blockers if the deadline has passed. if (it == activation_dependencies_.end()) @@ -264,9 +264,9 @@ void Surface::UpdateActivationDependencies( const CompositorFrame& current_frame) { - base::flat_set<SurfaceId> new_activation_dependencies; + base::flat_set<viz::SurfaceId> new_activation_dependencies; - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : current_frame.metadata.activation_dependencies) { Surface* dependency = surface_manager_->GetSurfaceForId(surface_id); // If a activation dependency does not have a corresponding active frame in @@ -278,8 +278,8 @@ // If this Surface has a previous pending frame, then we must determine the // changes in dependencies so that we can update the SurfaceDependencyTracker // map. - base::flat_set<SurfaceId> added_dependencies; - base::flat_set<SurfaceId> removed_dependencies; + base::flat_set<viz::SurfaceId> added_dependencies; + base::flat_set<viz::SurfaceId> removed_dependencies; ComputeChangeInDependencies(activation_dependencies_, new_activation_dependencies, &added_dependencies, &removed_dependencies); @@ -294,16 +294,16 @@ } void Surface::ComputeChangeInDependencies( - const base::flat_set<SurfaceId>& existing_dependencies, - const base::flat_set<SurfaceId>& new_dependencies, - base::flat_set<SurfaceId>* added_dependencies, - base::flat_set<SurfaceId>* removed_dependencies) { - for (const SurfaceId& surface_id : existing_dependencies) { + const base::flat_set<viz::SurfaceId>& existing_dependencies, + const base::flat_set<viz::SurfaceId>& new_dependencies, + base::flat_set<viz::SurfaceId>* added_dependencies, + base::flat_set<viz::SurfaceId>* removed_dependencies) { + for (const viz::SurfaceId& surface_id : existing_dependencies) { if (!new_dependencies.count(surface_id)) removed_dependencies->insert(surface_id); } - for (const SurfaceId& surface_id : new_dependencies) { + for (const viz::SurfaceId& surface_id : new_dependencies) { if (!existing_dependencies.count(surface_id)) added_dependencies->insert(surface_id); } @@ -361,7 +361,7 @@ void Surface::SatisfyDestructionDependencies( base::flat_set<SurfaceSequence>* sequences, - base::flat_set<FrameSinkId>* valid_frame_sink_ids) { + base::flat_set<viz::FrameSinkId>* valid_frame_sink_ids) { base::EraseIf(destruction_dependencies_, [sequences, valid_frame_sink_ids](SurfaceSequence seq) { return (!!sequences->erase(seq) ||
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h index d4c8a7d7..ad079c4 100644 --- a/cc/surfaces/surface.h +++ b/cc/surfaces/surface.h
@@ -20,11 +20,11 @@ #include "base/optional.h" #include "cc/output/compositor_frame.h" #include "cc/output/copy_output_request.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/surface_dependency_deadline.h" #include "cc/surfaces/surface_info.h" #include "cc/surfaces/surface_sequence.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/frame_sink_id.h" #include "ui/gfx/geometry/size.h" namespace ui { @@ -40,7 +40,8 @@ class CC_SURFACES_EXPORT Surface : public SurfaceDeadlineObserver { public: using WillDrawCallback = - base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>; + base::RepeatingCallback<void(const viz::LocalSurfaceId&, + const gfx::Rect&)>; Surface(const SurfaceInfo& surface_info, SurfaceManager* surface_manager, @@ -49,8 +50,8 @@ bool needs_sync_tokens); ~Surface(); - const SurfaceId& surface_id() const { return surface_info_.id(); } - const SurfaceId& previous_frame_surface_id() const { + const viz::SurfaceId& surface_id() const { return surface_info_.id(); } + const viz::SurfaceId& previous_frame_surface_id() const { return previous_frame_surface_id_; } @@ -89,8 +90,9 @@ const WillDrawCallback& will_draw_callback); void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); - // Notifies the Surface that a blocking SurfaceId now has an active frame. - void NotifySurfaceIdAvailable(const SurfaceId& surface_id); + // Notifies the Surface that a blocking viz::SurfaceId now has an active + // frame. + void NotifySurfaceIdAvailable(const viz::SurfaceId& surface_id); // Called if a deadline has been hit and this surface is not yet active but // it's marked as respecting deadlines. @@ -127,12 +129,12 @@ // remove them from sequences. void SatisfyDestructionDependencies( base::flat_set<SurfaceSequence>* sequences, - base::flat_set<FrameSinkId>* valid_id_namespaces); + base::flat_set<viz::FrameSinkId>* valid_id_namespaces); size_t GetDestructionDependencyCount() const { return destruction_dependencies_.size(); } - const std::vector<SurfaceId>* active_referenced_surfaces() const { + const std::vector<viz::SurfaceId>* active_referenced_surfaces() const { return active_frame_data_ ? &active_frame_data_->frame.metadata.referenced_surfaces : nullptr; @@ -140,14 +142,14 @@ // Returns the set of dependencies blocking this surface's pending frame // that themselves have not yet activated. - const base::flat_set<SurfaceId>& activation_dependencies() const { + const base::flat_set<viz::SurfaceId>& activation_dependencies() const { return activation_dependencies_; } // Returns the set of activation dependencies that have been ignored because // the last CompositorFrame was activated due to a deadline. Late dependencies // activate immediately when they arrive. - const base::flat_set<SurfaceId>& late_activation_dependencies() const { + const base::flat_set<viz::SurfaceId>& late_activation_dependencies() const { return late_activation_dependencies_; } @@ -187,10 +189,10 @@ void ActivateFrame(FrameData frame_data); void UpdateActivationDependencies(const CompositorFrame& current_frame); void ComputeChangeInDependencies( - const base::flat_set<SurfaceId>& existing_dependencies, - const base::flat_set<SurfaceId>& new_dependencies, - base::flat_set<SurfaceId>* added_dependencies, - base::flat_set<SurfaceId>* removed_dependencies); + const base::flat_set<viz::SurfaceId>& existing_dependencies, + const base::flat_set<viz::SurfaceId>& new_dependencies, + base::flat_set<viz::SurfaceId>* added_dependencies, + base::flat_set<viz::SurfaceId>* removed_dependencies); void UnrefFrameResourcesAndRunDrawCallback( base::Optional<FrameData> frame_data); @@ -203,7 +205,7 @@ std::vector<ui::LatencyInfo>* latency_info); SurfaceInfo surface_info_; - SurfaceId previous_frame_surface_id_; + viz::SurfaceId previous_frame_surface_id_; SurfaceManager* const surface_manager_; base::WeakPtr<SurfaceClient> surface_client_; SurfaceDependencyDeadline deadline_; @@ -215,8 +217,8 @@ const bool needs_sync_tokens_; std::vector<SurfaceSequence> destruction_dependencies_; - base::flat_set<SurfaceId> activation_dependencies_; - base::flat_set<SurfaceId> late_activation_dependencies_; + base::flat_set<viz::SurfaceId> activation_dependencies_; + base::flat_set<viz::SurfaceId> late_activation_dependencies_; DISALLOW_COPY_AND_ASSIGN(Surface); };
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc index d044150..0b551f96 100644 --- a/cc/surfaces/surface_aggregator.cc +++ b/cc/surfaces/surface_aggregator.cc
@@ -123,7 +123,7 @@ } RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id, - const SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { auto key = std::make_pair(surface_id, surface_local_pass_id); auto it = render_pass_allocator_map_.find(key); if (it != render_pass_allocator_map_.end()) { @@ -160,7 +160,8 @@ if (previous_index == surface->frame_index()) return gfx::Rect(); } - const SurfaceId& previous_surface_id = surface->previous_frame_surface_id(); + const viz::SurfaceId& previous_surface_id = + surface->previous_frame_surface_id(); if (surface->surface_id() != previous_surface_id) { it = previous_contained_surfaces_.find(previous_surface_id); @@ -191,7 +192,7 @@ bool ignore_undamaged, gfx::Rect* damage_rect_in_quad_space, bool* damage_rect_in_quad_space_valid) { - SurfaceId surface_id = surface_quad->surface_id; + viz::SurfaceId surface_id = surface_quad->surface_id; // If this surface's id is already in our referenced set then it creates // a cycle in the graph and should be dropped. if (referenced_surfaces_.count(surface_id)) @@ -406,7 +407,7 @@ const gfx::Transform& target_transform, const ClipData& clip_rect, RenderPass* dest_pass, - const SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { const SharedQuadState* last_copied_source_shared_quad_state = nullptr; const SharedQuadState* dest_shared_quad_state = nullptr; // If the current frame has copy requests then aggregate the entire @@ -587,7 +588,7 @@ // Walk the Surface tree from surface_id. Validate the resources of the current // surface and its descendants, check if there are any copy requests, and // return the combined damage rect. -gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, +gfx::Rect SurfaceAggregator::PrewalkTree(const viz::SurfaceId& surface_id, bool in_moved_pixel_surface, int parent_pass_id, PrewalkResult* result) { @@ -634,7 +635,7 @@ render_pass_dependencies_[parent_pass_id].insert(remapped_pass_id); struct SurfaceInfo { - SurfaceInfo(const SurfaceId& id, + SurfaceInfo(const viz::SurfaceId& id, bool has_moved_pixels, RenderPassId parent_pass_id, const gfx::Transform& target_to_surface_transform) @@ -643,7 +644,7 @@ parent_pass_id(parent_pass_id), target_to_surface_transform(target_to_surface_transform) {} - SurfaceId id; + viz::SurfaceId id; bool has_moved_pixels; RenderPassId parent_pass_id; gfx::Transform target_to_surface_transform; @@ -781,13 +782,13 @@ // referenced by a drawn Surface, but aren't contained in a SurfaceDrawQuad. // They need to be iterated over to ensure that any copy requests on them // (or on Surfaces they reference) are executed. - std::vector<SurfaceId> surfaces_to_copy( + std::vector<viz::SurfaceId> surfaces_to_copy( prewalk_result->undrawn_surfaces.begin(), prewalk_result->undrawn_surfaces.end()); DCHECK(referenced_surfaces_.empty()); for (size_t i = 0; i < surfaces_to_copy.size(); i++) { - SurfaceId surface_id = surfaces_to_copy[i]; + viz::SurfaceId surface_id = surfaces_to_copy[i]; Surface* surface = manager_->GetSurfaceForId(surface_id); if (!surface) continue; @@ -837,7 +838,7 @@ } } -CompositorFrame SurfaceAggregator::Aggregate(const SurfaceId& surface_id) { +CompositorFrame SurfaceAggregator::Aggregate(const viz::SurfaceId& surface_id) { uma_stats_.Reset(); Surface* surface = manager_->GetSurfaceForId(surface_id); @@ -914,7 +915,7 @@ return frame; } -void SurfaceAggregator::ReleaseResources(const SurfaceId& surface_id) { +void SurfaceAggregator::ReleaseResources(const viz::SurfaceId& surface_id) { auto it = surface_id_to_resource_child_id_.find(surface_id); if (it != surface_id_to_resource_child_id_.end()) { provider_->DestroyChild(it->second); @@ -922,7 +923,8 @@ } } -void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) { +void SurfaceAggregator::SetFullDamageForSurface( + const viz::SurfaceId& surface_id) { auto it = previous_contained_surfaces_.find(surface_id); if (it == previous_contained_surfaces_.end()) return;
diff --git a/cc/surfaces/surface_aggregator.h b/cc/surfaces/surface_aggregator.h index 364f649..773fbdc 100644 --- a/cc/surfaces/surface_aggregator.h +++ b/cc/surfaces/surface_aggregator.h
@@ -15,8 +15,8 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/render_pass.h" #include "cc/resources/transferable_resource.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/surface_id.h" #include "ui/gfx/color_space.h" namespace cc { @@ -31,19 +31,19 @@ class CC_SURFACES_EXPORT SurfaceAggregator { public: - using SurfaceIndexMap = base::flat_map<SurfaceId, int>; + using SurfaceIndexMap = base::flat_map<viz::SurfaceId, int>; SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider, bool aggregate_only_damaged); ~SurfaceAggregator(); - CompositorFrame Aggregate(const SurfaceId& surface_id); - void ReleaseResources(const SurfaceId& surface_id); + CompositorFrame Aggregate(const viz::SurfaceId& surface_id); + void ReleaseResources(const viz::SurfaceId& surface_id); SurfaceIndexMap& previous_contained_surfaces() { return previous_contained_surfaces_; } - void SetFullDamageForSurface(const SurfaceId& surface_id); + void SetFullDamageForSurface(const viz::SurfaceId& surface_id); void set_output_is_secure(bool secure) { output_is_secure_ = secure; } // Set the color spaces for the created RenderPasses, which is propagated @@ -66,7 +66,7 @@ ~PrewalkResult(); // This is the set of Surfaces that were referenced by another Surface, but // not included in a SurfaceDrawQuad. - base::flat_set<SurfaceId> undrawn_surfaces; + base::flat_set<viz::SurfaceId> undrawn_surfaces; bool may_contain_video = false; }; @@ -97,7 +97,7 @@ const gfx::Transform& target_transform); RenderPassId RemapPassId(RenderPassId surface_local_pass_id, - const SurfaceId& surface_id); + const viz::SurfaceId& surface_id); void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, const gfx::Transform& target_transform, @@ -118,8 +118,8 @@ const gfx::Transform& target_transform, const ClipData& clip_rect, RenderPass* dest_pass, - const SurfaceId& surface_id); - gfx::Rect PrewalkTree(const SurfaceId& surface_id, + const viz::SurfaceId& surface_id); + gfx::Rect PrewalkTree(const viz::SurfaceId& surface_id, bool in_moved_pixel_surface, int parent_pass, PrewalkResult* result); @@ -148,10 +148,10 @@ ResourceProvider* provider_; // Every Surface has its own RenderPass ID namespace. This structure maps - // each source (SurfaceId, RenderPass id) to a unified ID namespace that's - // used in the aggregated frame. An entry is removed from the map if it's not - // used for one output frame. - base::flat_map<std::pair<SurfaceId, RenderPassId>, RenderPassInfo> + // each source (viz::SurfaceId, RenderPass id) to a unified ID namespace + // that's used in the aggregated frame. An entry is removed from the map if + // it's not used for one output frame. + base::flat_map<std::pair<viz::SurfaceId, RenderPassId>, RenderPassInfo> render_pass_allocator_map_; RenderPassId next_render_pass_id_; const bool aggregate_only_damaged_; @@ -167,7 +167,7 @@ // The id for the final color conversion render pass. RenderPassId color_conversion_render_pass_id_ = 0; - base::flat_map<SurfaceId, int> surface_id_to_resource_child_id_; + base::flat_map<viz::SurfaceId, int> surface_id_to_resource_child_id_; // The following state is only valid for the duration of one Aggregate call // and is only stored on the class to avoid having to pass through every @@ -175,7 +175,7 @@ // This is the set of surfaces referenced in the aggregation so far, used to // detect cycles. - base::flat_set<SurfaceId> referenced_surfaces_; + base::flat_set<viz::SurfaceId> referenced_surfaces_; // For each Surface used in the last aggregation, gives the frame_index at // that time. @@ -183,7 +183,7 @@ SurfaceIndexMap contained_surfaces_; // After surface validation, every Surface in this set is valid. - base::flat_set<SurfaceId> valid_surfaces_; + base::flat_set<viz::SurfaceId> valid_surfaces_; // This is the pass list for the aggregated frame. RenderPassList* dest_pass_list_;
diff --git a/cc/surfaces/surface_aggregator_perftest.cc b/cc/surfaces/surface_aggregator_perftest.cc index a9c8a35..0da1d6f6 100644 --- a/cc/surfaces/surface_aggregator_perftest.cc +++ b/cc/surfaces/surface_aggregator_perftest.cc
@@ -50,13 +50,13 @@ num_surfaces); for (int i = 0; i < num_surfaces; i++) { child_supports[i] = CompositorFrameSinkSupport::Create( - nullptr, &manager_, FrameSinkId(1, i + 1), kIsChildRoot, + nullptr, &manager_, viz::FrameSinkId(1, i + 1), kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); } aggregator_.reset(new SurfaceAggregator( manager_.surface_manager(), resource_provider_.get(), optimize_damage)); for (int i = 0; i < num_surfaces; i++) { - LocalSurfaceId local_surface_id(i + 1, kArbitraryToken); + viz::LocalSurfaceId local_surface_id(i + 1, kArbitraryToken); std::unique_ptr<RenderPass> pass(RenderPass::Create()); pass->output_rect = gfx::Rect(0, 0, 1, 2); @@ -97,7 +97,8 @@ pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); surface_quad->SetNew( sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), - SurfaceId(FrameSinkId(1, i), LocalSurfaceId(i, kArbitraryToken)), + viz::SurfaceId(viz::FrameSinkId(1, i), + viz::LocalSurfaceId(i, kArbitraryToken)), SurfaceDrawQuadType::PRIMARY, nullptr); } @@ -108,7 +109,7 @@ std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( - nullptr, &manager_, FrameSinkId(1, num_surfaces + 1), kIsRoot, + nullptr, &manager_, viz::FrameSinkId(1, num_surfaces + 1), kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); timer_.Reset(); do { @@ -120,8 +121,8 @@ pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); surface_quad->SetNew( sqs, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), - SurfaceId(FrameSinkId(1, num_surfaces), - LocalSurfaceId(num_surfaces, kArbitraryToken)), + viz::SurfaceId(viz::FrameSinkId(1, num_surfaces), + viz::LocalSurfaceId(num_surfaces, kArbitraryToken)), SurfaceDrawQuadType::PRIMARY, nullptr); pass->output_rect = gfx::Rect(0, 0, 100, 100); @@ -134,11 +135,12 @@ frame.render_pass_list.push_back(std::move(pass)); root_support->SubmitCompositorFrame( - LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame)); + viz::LocalSurfaceId(num_surfaces + 1, kArbitraryToken), + std::move(frame)); - CompositorFrame aggregated = aggregator_->Aggregate( - SurfaceId(FrameSinkId(1, num_surfaces + 1), - LocalSurfaceId(num_surfaces + 1, kArbitraryToken))); + CompositorFrame aggregated = aggregator_->Aggregate(viz::SurfaceId( + viz::FrameSinkId(1, num_surfaces + 1), + viz::LocalSurfaceId(num_surfaces + 1, kArbitraryToken))); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired());
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc index e2361417c..36c5744 100644 --- a/cc/surfaces/surface_aggregator_unittest.cc +++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -19,7 +19,6 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/compositor_frame_helpers.h" @@ -29,6 +28,7 @@ #include "cc/test/render_pass_test_utils.h" #include "cc/test/surface_aggregator_test_helpers.h" #include "cc/test/test_shared_bitmap_manager.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/common/resources/shared_bitmap_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,21 +37,21 @@ namespace cc { namespace { -constexpr FrameSinkId kArbitraryRootFrameSinkId(1, 1); -constexpr FrameSinkId kArbitraryFrameSinkId1(2, 2); -constexpr FrameSinkId kArbitraryFrameSinkId2(3, 3); -constexpr FrameSinkId kArbitraryMiddleFrameSinkId(4, 4); -constexpr FrameSinkId kArbitraryReservedFrameSinkId(5, 5); -constexpr FrameSinkId kArbitraryFrameSinkId3(6, 6); +constexpr viz::FrameSinkId kArbitraryRootFrameSinkId(1, 1); +constexpr viz::FrameSinkId kArbitraryFrameSinkId1(2, 2); +constexpr viz::FrameSinkId kArbitraryFrameSinkId2(3, 3); +constexpr viz::FrameSinkId kArbitraryMiddleFrameSinkId(4, 4); +constexpr viz::FrameSinkId kArbitraryReservedFrameSinkId(5, 5); +constexpr viz::FrameSinkId kArbitraryFrameSinkId3(6, 6); const base::UnguessableToken kArbitraryToken = base::UnguessableToken::Create(); constexpr bool kRootIsRoot = true; constexpr bool kChildIsRoot = false; constexpr bool kHandlesFrameSinkIdInvalidation = true; constexpr bool kNeedsSyncPoints = false; -SurfaceId InvalidSurfaceId() { - static SurfaceId invalid(FrameSinkId(), - LocalSurfaceId(0xdeadbeef, kArbitraryToken)); +viz::SurfaceId InvalidSurfaceId() { + static viz::SurfaceId invalid( + viz::FrameSinkId(), viz::LocalSurfaceId(0xdeadbeef, kArbitraryToken)); return invalid; } @@ -109,7 +109,7 @@ SurfaceAggregatorTest::SetUp(); root_local_surface_id_ = allocator_.GenerateId(); root_surface_ = manager_.surface_manager()->GetSurfaceForId( - SurfaceId(support_->frame_sink_id(), root_local_surface_id_)); + viz::SurfaceId(support_->frame_sink_id(), root_local_surface_id_)); } void TearDown() override { @@ -119,10 +119,10 @@ void AggregateAndVerify(test::Pass* expected_passes, size_t expected_pass_count, - SurfaceId* surface_ids, + viz::SurfaceId* surface_ids, size_t expected_surface_count) { CompositorFrame aggregated_frame = aggregator_.Aggregate( - SurfaceId(support_->frame_sink_id(), root_local_surface_id_)); + viz::SurfaceId(support_->frame_sink_id(), root_local_surface_id_)); TestPassesMatchExpectations(expected_passes, expected_pass_count, &aggregated_frame.render_pass_list); @@ -143,7 +143,7 @@ } void SubmitPassListAsFrame(CompositorFrameSinkSupport* support, - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, RenderPassList* pass_list) { CompositorFrame frame = test::MakeEmptyCompositorFrame(); pass_list->swap(frame.render_pass_list); @@ -154,14 +154,14 @@ void SubmitCompositorFrame(CompositorFrameSinkSupport* support, test::Pass* passes, size_t pass_count, - const LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { RenderPassList pass_list; AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); SubmitPassListAsFrame(support, local_surface_id, &pass_list); } void QueuePassAsFrame(std::unique_ptr<RenderPass> pass, - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, CompositorFrameSinkSupport* support) { CompositorFrame child_frame = test::MakeEmptyCompositorFrame(); child_frame.render_pass_list.push_back(std::move(pass)); @@ -170,11 +170,11 @@ } protected: - LocalSurfaceId root_local_surface_id_; + viz::LocalSurfaceId root_local_surface_id_; Surface* root_surface_; - LocalSurfaceIdAllocator allocator_; + viz::LocalSurfaceIdAllocator allocator_; std::unique_ptr<CompositorFrameSinkSupport> child_support_; - LocalSurfaceIdAllocator child_allocator_; + viz::LocalSurfaceIdAllocator child_allocator_; }; // Tests that a very simple frame containing only two solid color quads makes it @@ -187,8 +187,9 @@ SubmitCompositorFrame(support_.get(), passes, arraysize(passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id}; AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); @@ -205,9 +206,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints)); - LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); - SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), - embedded_local_surface_id); + viz::LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), + embedded_local_surface_id); test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), test::Quad::SolidColorQuad(SK_ColorBLUE)}; @@ -224,7 +225,8 @@ SubmitCompositorFrame(support_.get(), passes, arraysize(passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); RenderPassList& render_pass_list(aggregated_frame.render_pass_list); @@ -254,8 +256,9 @@ SubmitCompositorFrame(support_.get(), passes, arraysize(passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id}; AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); } @@ -272,7 +275,7 @@ SubmitCompositorFrame(support_.get(), passes, arraysize(passes), root_local_surface_id_); - SurfaceId surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId surface_id(support_->frame_sink_id(), root_local_surface_id_); CompositorFrame aggregated_frame; aggregated_frame = aggregator_.Aggregate(surface_id); @@ -320,9 +323,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints)); - LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); - SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), - embedded_local_surface_id); + viz::LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), + embedded_local_surface_id); test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; test::Pass embedded_passes[] = { @@ -345,8 +348,9 @@ test::Quad::SolidColorQuad(SK_ColorBLACK)}; test::Pass expected_passes[] = { test::Pass(expected_quads, arraysize(expected_quads))}; - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id, embedded_surface_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id, embedded_surface_id}; AggregateAndVerify( expected_passes, arraysize(expected_passes), ids, arraysize(ids)); @@ -361,17 +365,17 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); - SurfaceId primary_child_surface_id(primary_child_support->frame_sink_id(), - primary_child_local_surface_id); + viz::LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId primary_child_surface_id( + primary_child_support->frame_sink_id(), primary_child_local_surface_id); std::unique_ptr<CompositorFrameSinkSupport> fallback_child_support = CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); - SurfaceId fallback_child_surface_id(fallback_child_support->frame_sink_id(), - fallback_child_local_surface_id); + viz::LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId fallback_child_surface_id( + fallback_child_support->frame_sink_id(), fallback_child_local_surface_id); test::Quad fallback_child_quads[] = {test::Quad::SolidColorQuad(SK_ColorRED)}; test::Pass fallback_child_passes[] = { @@ -399,9 +403,10 @@ test::Pass expected_passes1[] = { test::Pass(expected_quads1, arraysize(expected_quads1))}; - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id, primary_child_surface_id, - fallback_child_surface_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id, primary_child_surface_id, + fallback_child_surface_id}; AggregateAndVerify(expected_passes1, arraysize(expected_passes1), ids, arraysize(ids)); @@ -448,9 +453,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); - SurfaceId primary_child_surface_id(primary_child_support->frame_sink_id(), - primary_child_local_surface_id); + viz::LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId primary_child_surface_id( + primary_child_support->frame_sink_id(), primary_child_local_surface_id); test::Quad primary_child_quads[] = { test::Quad::SolidColorQuad(SK_ColorGREEN)}; test::Pass primary_child_passes[] = { @@ -466,9 +471,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); - SurfaceId fallback_child_surface_id(fallback_child_support->frame_sink_id(), - fallback_child_local_surface_id); + viz::LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId fallback_child_surface_id( + fallback_child_support->frame_sink_id(), fallback_child_local_surface_id); test::Quad fallback_child_quads[] = {test::Quad::SolidColorQuad(SK_ColorRED)}; test::Pass fallback_child_passes[] = { @@ -496,9 +501,10 @@ test::Pass expected_passes1[] = { test::Pass(expected_quads1, arraysize(expected_quads1))}; - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id, primary_child_surface_id, - fallback_child_surface_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id, primary_child_surface_id, + fallback_child_surface_id}; AggregateAndVerify(expected_passes1, arraysize(expected_passes1), ids, arraysize(ids)); @@ -511,9 +517,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); - SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), - embedded_local_surface_id); + viz::LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), + embedded_local_surface_id); test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; test::Pass embedded_passes[] = { @@ -535,7 +541,8 @@ SubmitCompositorFrame(support_.get(), root_passes, arraysize(root_passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); test::Quad expected_quads[] = { @@ -552,7 +559,7 @@ DCHECK_EQ(copy_request_ptr, aggregated_frame.render_pass_list[0]->copy_requests[0].get()); - SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id}; + viz::SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id}; EXPECT_EQ(arraysize(surface_ids), aggregator_.previous_contained_surfaces().size()); for (size_t i = 0; i < arraysize(surface_ids); i++) { @@ -570,9 +577,9 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); - SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), - embedded_local_surface_id); + viz::LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), + embedded_local_surface_id); test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; test::Pass embedded_passes[] = { @@ -606,7 +613,8 @@ support_->SubmitCompositorFrame(root_local_surface_id_, std::move(frame)); } - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), @@ -625,7 +633,7 @@ DCHECK_EQ(copy_request2_ptr, aggregated_frame.render_pass_list[1]->copy_requests[0].get()); - SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id}; + viz::SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id}; EXPECT_EQ(arraysize(surface_ids), aggregator_.previous_contained_surfaces().size()); for (size_t i = 0; i < arraysize(surface_ids); i++) { @@ -655,11 +663,11 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId2, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); - SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), - embedded_local_surface_id); - SurfaceId nonexistent_surface_id(support_->frame_sink_id(), - allocator_.GenerateId()); + viz::LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(embedded_support->frame_sink_id(), + embedded_local_surface_id); + viz::SurfaceId nonexistent_surface_id(support_->frame_sink_id(), + allocator_.GenerateId()); test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; test::Pass embedded_passes[] = { @@ -672,9 +680,9 @@ CopyOutputRequest* copy_request_ptr = copy_request.get(); embedded_support->RequestCopyOfSurface(std::move(copy_request)); - LocalSurfaceId parent_local_surface_id = allocator_.GenerateId(); - SurfaceId parent_surface_id(parent_support->frame_sink_id(), - parent_local_surface_id); + viz::LocalSurfaceId parent_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId parent_surface_id(parent_support->frame_sink_id(), + parent_local_surface_id); test::Quad parent_quads[] = { test::Quad::SolidColorQuad(SK_ColorGRAY), @@ -712,7 +720,8 @@ support_->SubmitCompositorFrame(root_local_surface_id_, std::move(frame)); } - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); // First pass should come from surface that had a copy request but was not @@ -729,8 +738,8 @@ DCHECK_EQ(copy_request_ptr, aggregated_frame.render_pass_list[0]->copy_requests[0].get()); - SurfaceId surface_ids[] = { - SurfaceId(support_->frame_sink_id(), root_local_surface_id_), + viz::SurfaceId surface_ids[] = { + viz::SurfaceId(support_->frame_sink_id(), root_local_surface_id_), parent_surface_id, embedded_surface_id, nonexistent_surface_id}; EXPECT_EQ(arraysize(surface_ids), aggregator_.previous_contained_surfaces().size()); @@ -746,9 +755,9 @@ // This tests referencing a surface that has multiple render passes. TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) { - LocalSurfaceId embedded_local_surface_id = child_allocator_.GenerateId(); - SurfaceId embedded_surface_id(child_support_->frame_sink_id(), - embedded_local_surface_id); + viz::LocalSurfaceId embedded_local_surface_id = child_allocator_.GenerateId(); + viz::SurfaceId embedded_surface_id(child_support_->frame_sink_id(), + embedded_local_surface_id); int pass_ids[] = {1, 2, 3}; @@ -777,7 +786,8 @@ SubmitCompositorFrame(support_.get(), root_passes, arraysize(root_passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -896,8 +906,9 @@ test::Quad::SolidColorQuad(SK_ColorBLUE)}; test::Pass expected_passes[] = { test::Pass(expected_quads, arraysize(expected_quads))}; - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id, InvalidSurfaceId()}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id, InvalidSurfaceId()}; AggregateAndVerify( expected_passes, arraysize(expected_passes), ids, arraysize(ids)); @@ -906,9 +917,9 @@ // Tests a reference to a valid surface with no submitted frame. This quad // should also just be dropped. TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) { - LocalSurfaceId empty_local_surface_id = allocator_.GenerateId(); - SurfaceId surface_with_no_frame_id(support_->frame_sink_id(), - empty_local_surface_id); + viz::LocalSurfaceId empty_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId surface_with_no_frame_id(support_->frame_sink_id(), + empty_local_surface_id); test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), test::Quad::SurfaceQuad(surface_with_no_frame_id, @@ -923,8 +934,9 @@ test::Quad::SolidColorQuad(SK_ColorBLUE)}; test::Pass expected_passes[] = { test::Pass(expected_quads, arraysize(expected_quads))}; - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); - SurfaceId ids[] = {root_surface_id, surface_with_no_frame_id}; + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); + viz::SurfaceId ids[] = {root_surface_id, surface_with_no_frame_id}; AggregateAndVerify( expected_passes, arraysize(expected_passes), ids, arraysize(ids)); } @@ -932,7 +944,8 @@ // Tests a surface quad referencing itself, generating a trivial cycle. // The quad creating the cycle should be dropped from the final frame. TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleCyclicalReference) { - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); test::Quad quads[] = { test::Quad::SurfaceQuad(root_surface_id, InvalidSurfaceId(), 1.f), test::Quad::SolidColorQuad(SK_ColorYELLOW)}; @@ -944,16 +957,16 @@ test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorYELLOW)}; test::Pass expected_passes[] = { test::Pass(expected_quads, arraysize(expected_quads))}; - SurfaceId ids[] = {root_surface_id}; + viz::SurfaceId ids[] = {root_surface_id}; AggregateAndVerify( expected_passes, arraysize(expected_passes), ids, arraysize(ids)); } // Tests a more complex cycle with one intermediate surface. TEST_F(SurfaceAggregatorValidSurfaceTest, TwoSurfaceCyclicalReference) { - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support_->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support_->frame_sink_id(), + child_local_surface_id); test::Quad parent_quads[] = { test::Quad::SolidColorQuad(SK_ColorBLUE), @@ -965,7 +978,8 @@ SubmitCompositorFrame(support_.get(), parent_passes, arraysize(parent_passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); test::Quad child_quads[] = { test::Quad::SolidColorQuad(SK_ColorGREEN), test::Quad::SurfaceQuad(root_surface_id, InvalidSurfaceId(), 1.f), @@ -987,7 +1001,7 @@ test::Quad::SolidColorQuad(SK_ColorCYAN)}; test::Pass expected_passes[] = { test::Pass(expected_quads, arraysize(expected_quads))}; - SurfaceId ids[] = {root_surface_id, child_surface_id}; + viz::SurfaceId ids[] = {root_surface_id, child_surface_id}; AggregateAndVerify( expected_passes, arraysize(expected_passes), ids, arraysize(ids)); } @@ -995,9 +1009,9 @@ // Tests that we map render pass IDs from different surfaces into a unified // namespace and update RenderPassDrawQuad's id references to match. TEST_F(SurfaceAggregatorValidSurfaceTest, RenderPassIdMapping) { - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support_->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support_->frame_sink_id(), + child_local_surface_id); RenderPassId child_pass_id[] = {1u, 2u}; test::Quad child_quad[][1] = {{test::Quad::SolidColorQuad(SK_ColorGREEN)}, @@ -1021,7 +1035,8 @@ SubmitCompositorFrame(support_.get(), parent_passes, arraysize(parent_passes), root_local_surface_id_); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1126,9 +1141,9 @@ nullptr, &manager_, kArbitraryFrameSinkId3, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); int pass_id = 1; - LocalSurfaceId grandchild_local_surface_id = allocator_.GenerateId(); - SurfaceId grandchild_surface_id(grandchild_support->frame_sink_id(), - grandchild_local_surface_id); + viz::LocalSurfaceId grandchild_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId grandchild_surface_id(grandchild_support->frame_sink_id(), + grandchild_local_surface_id); std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); gfx::Rect output_rect(SurfaceSize()); @@ -1141,9 +1156,9 @@ QueuePassAsFrame(std::move(grandchild_pass), grandchild_local_surface_id, grandchild_support.get()); - LocalSurfaceId child_one_local_surface_id = allocator_.GenerateId(); - SurfaceId child_one_surface_id(child_one_support->frame_sink_id(), - child_one_local_surface_id); + viz::LocalSurfaceId child_one_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_one_surface_id(child_one_support->frame_sink_id(), + child_one_local_surface_id); std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create(); child_one_pass->SetNew(pass_id, output_rect, damage_rect, @@ -1161,9 +1176,9 @@ QueuePassAsFrame(std::move(child_one_pass), child_one_local_surface_id, child_one_support.get()); - LocalSurfaceId child_two_local_surface_id = allocator_.GenerateId(); - SurfaceId child_two_surface_id(child_two_support->frame_sink_id(), - child_two_local_surface_id); + viz::LocalSurfaceId child_two_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_two_surface_id(child_two_support->frame_sink_id(), + child_two_local_surface_id); std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create(); child_two_pass->SetNew(pass_id, output_rect, damage_rect, @@ -1199,7 +1214,8 @@ QueuePassAsFrame(std::move(root_pass), root_local_surface_id_, support_.get()); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1247,9 +1263,9 @@ nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); // Innermost child surface. - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support_->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support_->frame_sink_id(), + child_local_surface_id); { int child_pass_id[] = {1, 2}; test::Quad child_quads[][1] = { @@ -1283,9 +1299,9 @@ } // Middle child surface. - LocalSurfaceId middle_local_surface_id = allocator_.GenerateId(); - SurfaceId middle_surface_id(middle_support->frame_sink_id(), - middle_local_surface_id); + viz::LocalSurfaceId middle_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId middle_surface_id(middle_support->frame_sink_id(), + middle_local_surface_id); { test::Quad middle_quads[] = { test::Quad::SurfaceQuad(child_surface_id, InvalidSurfaceId(), 1.f)}; @@ -1335,7 +1351,8 @@ support_->SubmitCompositorFrame(root_local_surface_id_, std::move(root_frame)); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1430,9 +1447,9 @@ child_root_pass->shared_quad_state_list.front(); child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support_->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support_->frame_sink_id(), + child_local_surface_id); child_support_->SubmitCompositorFrame(child_local_surface_id, std::move(child_frame)); @@ -1447,9 +1464,9 @@ AddPasses(&parent_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), parent_surface_passes, arraysize(parent_surface_passes)); - LocalSurfaceId parent_local_surface_id = allocator_.GenerateId(); - SurfaceId parent_surface_id(parent_support->frame_sink_id(), - parent_local_surface_id); + viz::LocalSurfaceId parent_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId parent_surface_id(parent_support->frame_sink_id(), + parent_local_surface_id); parent_support->SubmitCompositorFrame(parent_local_surface_id, std::move(parent_surface_frame)); @@ -1474,7 +1491,8 @@ support_->SubmitCompositorFrame(root_local_surface_id_, std::move(root_frame)); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1500,8 +1518,8 @@ child_support_->SubmitCompositorFrame(child_local_surface_id, std::move(child_frame)); - SurfaceId root_surface_id(support_->frame_sink_id(), - root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1542,8 +1560,8 @@ support_->SubmitCompositorFrame(root_local_surface_id_, std::move(root_frame)); - SurfaceId root_surface_id(support_->frame_sink_id(), - root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1559,8 +1577,8 @@ // No Surface changed, so no damage should be given. { - SurfaceId root_surface_id(support_->frame_sink_id(), - root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1606,8 +1624,8 @@ std::move(root_frame)); { - SurfaceId root_surface_id(support_->frame_sink_id(), - root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1620,9 +1638,9 @@ gfx::Rect(SurfaceSize()))); } - LocalSurfaceId second_root_local_surface_id = allocator_.GenerateId(); - SurfaceId second_root_surface_id(support_->frame_sink_id(), - second_root_local_surface_id); + viz::LocalSurfaceId second_root_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId second_root_surface_id(support_->frame_sink_id(), + second_root_local_surface_id); { test::Quad root_render_pass_quads[] = {test::Quad::SolidColorQuad(1)}; @@ -1672,9 +1690,9 @@ // Tests that quads outside the damage rect are ignored. TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) { - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support_->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support_->frame_sink_id(), + child_local_surface_id); // The child surface has three quads, one with a visible rect of 13,13 4x4 and // the other other with a visible rect of 10,10 2x2 (relative to root target // space), and one with a non-invertible transform. @@ -1734,7 +1752,8 @@ &root_pass_list); } - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id_); CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); const RenderPassList& aggregated_pass_list = @@ -1971,9 +1990,9 @@ void SubmitCompositorFrameWithResources(ResourceId* resource_ids, size_t num_resource_ids, bool valid, - SurfaceId child_id, + viz::SurfaceId child_id, CompositorFrameSinkSupport* support, - SurfaceId surface_id) { + viz::SurfaceId surface_id) { CompositorFrame frame = test::MakeEmptyCompositorFrame(); std::unique_ptr<RenderPass> pass = RenderPass::Create(); pass->SetNew(1, gfx::Rect(0, 0, 20, 20), gfx::Rect(), gfx::Transform()); @@ -2021,20 +2040,20 @@ CompositorFrameSinkSupport::Create( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); - SurfaceId surface_id(support->frame_sink_id(), local_surface_id); + viz::LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); + viz::SurfaceId surface_id(support->frame_sink_id(), local_surface_id); ResourceId ids[] = {11, 12, 13}; - SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), - support.get(), surface_id); + SubmitCompositorFrameWithResources( + ids, arraysize(ids), true, viz::SurfaceId(), support.get(), surface_id); CompositorFrame frame = aggregator_->Aggregate(surface_id); // Nothing should be available to be returned yet. EXPECT_TRUE(client.returned_resources().empty()); - SubmitCompositorFrameWithResources(NULL, 0u, true, SurfaceId(), support.get(), - surface_id); + SubmitCompositorFrameWithResources(NULL, 0u, true, viz::SurfaceId(), + support.get(), surface_id); frame = aggregator_->Aggregate(surface_id); @@ -2058,14 +2077,14 @@ CompositorFrameSinkSupport::Create( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id1(7u, base::UnguessableToken::Create()); - LocalSurfaceId local_surface_id2(8u, base::UnguessableToken::Create()); - SurfaceId surface_id1(support->frame_sink_id(), local_surface_id1); - SurfaceId surface_id2(support->frame_sink_id(), local_surface_id2); + viz::LocalSurfaceId local_surface_id1(7u, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id2(8u, base::UnguessableToken::Create()); + viz::SurfaceId surface_id1(support->frame_sink_id(), local_surface_id1); + viz::SurfaceId surface_id2(support->frame_sink_id(), local_surface_id2); ResourceId ids[] = {11, 12, 13}; - SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), - support.get(), surface_id1); + SubmitCompositorFrameWithResources( + ids, arraysize(ids), true, viz::SurfaceId(), support.get(), surface_id1); CompositorFrame frame = aggregator_->Aggregate(surface_id1); @@ -2074,8 +2093,8 @@ // Submitting a CompositorFrame to |surface_id2| should cause the surface // associated with |surface_id1| to get garbage collected. - SubmitCompositorFrameWithResources(NULL, 0u, true, SurfaceId(), support.get(), - surface_id2); + SubmitCompositorFrameWithResources(NULL, 0u, true, viz::SurfaceId(), + support.get(), surface_id2); frame = aggregator_->Aggregate(surface_id2); @@ -2096,8 +2115,8 @@ CompositorFrameSinkSupport::Create( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); - SurfaceId surface_id(support->frame_sink_id(), local_surface_id); + viz::LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); + viz::SurfaceId surface_id(support->frame_sink_id(), local_surface_id); CompositorFrame frame = test::MakeCompositorFrame(); TransferableResource resource; @@ -2113,8 +2132,8 @@ // Nothing should be available to be returned yet. EXPECT_TRUE(client.returned_resources().empty()); - SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), support.get(), - surface_id); + SubmitCompositorFrameWithResources(NULL, 0, true, viz::SurfaceId(), + support.get(), surface_id); ASSERT_EQ(1u, client.returned_resources().size()); EXPECT_EQ(11u, client.returned_resources()[0].id); @@ -2125,29 +2144,30 @@ FakeCompositorFrameSinkSupportClient client; std::unique_ptr<CompositorFrameSinkSupport> support1 = CompositorFrameSinkSupport::Create( - &client, &manager_, FrameSinkId(1, 1), kChildIsRoot, + &client, &manager_, viz::FrameSinkId(1, 1), kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); std::unique_ptr<CompositorFrameSinkSupport> support2 = CompositorFrameSinkSupport::Create( - &client, &manager_, FrameSinkId(2, 2), kChildIsRoot, + &client, &manager_, viz::FrameSinkId(2, 2), kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); - SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); + viz::LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); + viz::SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); - LocalSurfaceId local_frame2_id(8u, base::UnguessableToken::Create()); - SurfaceId surface2_id(support2->frame_sink_id(), local_frame2_id); + viz::LocalSurfaceId local_frame2_id(8u, base::UnguessableToken::Create()); + viz::SurfaceId surface2_id(support2->frame_sink_id(), local_frame2_id); ResourceId ids[] = {11, 12, 13}; - SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), - support1.get(), surface1_id); + SubmitCompositorFrameWithResources( + ids, arraysize(ids), true, viz::SurfaceId(), support1.get(), surface1_id); ResourceId ids2[] = {14, 15, 16}; - SubmitCompositorFrameWithResources(ids2, arraysize(ids2), true, SurfaceId(), - support2.get(), surface2_id); + SubmitCompositorFrameWithResources(ids2, arraysize(ids2), true, + viz::SurfaceId(), support2.get(), + surface2_id); CompositorFrame frame = aggregator_->Aggregate(surface1_id); - SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), support1.get(), - surface1_id); + SubmitCompositorFrameWithResources(NULL, 0, true, viz::SurfaceId(), + support1.get(), surface1_id); // Nothing should be available to be returned yet. EXPECT_TRUE(client.returned_resources().empty()); @@ -2183,19 +2203,20 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId root_local_surface_id(7u, kArbitraryToken); - SurfaceId root_surface_id(root_support->frame_sink_id(), - root_local_surface_id); - LocalSurfaceId middle_local_surface_id(8u, kArbitraryToken); - SurfaceId middle_surface_id(middle_support->frame_sink_id(), - middle_local_surface_id); - LocalSurfaceId child_local_surface_id(9u, kArbitraryToken); - SurfaceId child_surface_id(child_support->frame_sink_id(), - child_local_surface_id); + viz::LocalSurfaceId root_local_surface_id(7u, kArbitraryToken); + viz::SurfaceId root_surface_id(root_support->frame_sink_id(), + root_local_surface_id); + viz::LocalSurfaceId middle_local_surface_id(8u, kArbitraryToken); + viz::SurfaceId middle_surface_id(middle_support->frame_sink_id(), + middle_local_surface_id); + viz::LocalSurfaceId child_local_surface_id(9u, kArbitraryToken); + viz::SurfaceId child_surface_id(child_support->frame_sink_id(), + child_local_surface_id); ResourceId ids[] = {14, 15, 16}; - SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), - child_support.get(), child_surface_id); + SubmitCompositorFrameWithResources(ids, arraysize(ids), true, + viz::SurfaceId(), child_support.get(), + child_surface_id); ResourceId ids2[] = {17, 18, 19}; SubmitCompositorFrameWithResources(ids2, arraysize(ids2), false, @@ -2233,21 +2254,21 @@ TEST_F(SurfaceAggregatorWithResourcesTest, SecureOutputTexture) { std::unique_ptr<CompositorFrameSinkSupport> support1 = CompositorFrameSinkSupport::Create( - nullptr, &manager_, FrameSinkId(1, 1), kChildIsRoot, + nullptr, &manager_, viz::FrameSinkId(1, 1), kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); std::unique_ptr<CompositorFrameSinkSupport> support2 = CompositorFrameSinkSupport::Create( - nullptr, &manager_, FrameSinkId(2, 2), kChildIsRoot, + nullptr, &manager_, viz::FrameSinkId(2, 2), kChildIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); - SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); + viz::LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); + viz::SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); - LocalSurfaceId local_frame2_id(8u, base::UnguessableToken::Create()); - SurfaceId surface2_id(support2->frame_sink_id(), local_frame2_id); + viz::LocalSurfaceId local_frame2_id(8u, base::UnguessableToken::Create()); + viz::SurfaceId surface2_id(support2->frame_sink_id(), local_frame2_id); ResourceId ids[] = {11, 12, 13}; - SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), - support1.get(), surface1_id); + SubmitCompositorFrameWithResources( + ids, arraysize(ids), true, viz::SurfaceId(), support1.get(), surface1_id); CompositorFrame frame = aggregator_->Aggregate(surface1_id); @@ -2315,7 +2336,7 @@ SubmitCompositorFrame(support_.get(), passes, arraysize(passes), root_local_surface_id_); - SurfaceId surface_id(support_->frame_sink_id(), root_local_surface_id_); + viz::SurfaceId surface_id(support_->frame_sink_id(), root_local_surface_id_); CompositorFrame aggregated_frame; aggregator_.SetOutputColorSpace(color_space1, color_space1);
diff --git a/cc/surfaces/surface_dependency_tracker.cc b/cc/surfaces/surface_dependency_tracker.cc index bf7c41c..12545ce6 100644 --- a/cc/surfaces/surface_dependency_tracker.cc +++ b/cc/surfaces/surface_dependency_tracker.cc
@@ -34,7 +34,7 @@ // Activation dependencies that aren't currently known to the surface manager // or do not have an active CompositorFrame block this frame. - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : pending_frame.metadata.activation_dependencies) { Surface* dependency = surface_manager_->GetSurfaceForId(surface_id); if (!dependency || !dependency->HasActiveFrame()) { @@ -59,14 +59,14 @@ void SurfaceDependencyTracker::OnSurfaceDependenciesChanged( Surface* surface, - const base::flat_set<SurfaceId>& added_dependencies, - const base::flat_set<SurfaceId>& removed_dependencies) { + const base::flat_set<viz::SurfaceId>& added_dependencies, + const base::flat_set<viz::SurfaceId>& removed_dependencies) { // Update the |blocked_surfaces_from_dependency_| map with the changes in // dependencies. - for (const SurfaceId& surface_id : added_dependencies) + for (const viz::SurfaceId& surface_id : added_dependencies) blocked_surfaces_from_dependency_[surface_id].insert(surface->surface_id()); - for (const SurfaceId& surface_id : removed_dependencies) { + for (const viz::SurfaceId& surface_id : removed_dependencies) { auto it = blocked_surfaces_from_dependency_.find(surface_id); it->second.erase(surface->surface_id()); if (it->second.empty()) @@ -86,7 +86,7 @@ DCHECK(!pending_frame.metadata.activation_dependencies.empty()); - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : pending_frame.metadata.activation_dependencies) { auto it = blocked_surfaces_from_dependency_.find(surface_id); if (it == blocked_surfaces_from_dependency_.end()) @@ -104,8 +104,8 @@ blocked_surfaces_by_id_.erase(surface->surface_id()); - // Pretend that the discarded surface's SurfaceId is now available to unblock - // dependencies because we now know the surface will never activate. + // Pretend that the discarded surface's viz::SurfaceId is now available to + // unblock dependencies because we now know the surface will never activate. NotifySurfaceIdAvailable(surface->surface_id()); } @@ -114,7 +114,7 @@ const CompositorFrame& pending_frame = surface->GetPendingFrame(); - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : pending_frame.metadata.activation_dependencies) { Surface* dependency = surface_manager_->GetSurfaceForId(surface_id); if (dependency && dependency->HasPendingFrame()) @@ -139,8 +139,8 @@ // Inherit the deadline from the first parent blocked on this surface. auto it = blocked_surfaces_from_dependency_.find(surface->surface_id()); if (it != blocked_surfaces_from_dependency_.end()) { - const base::flat_set<SurfaceId>& dependent_parent_ids = it->second; - for (const SurfaceId& parent_id : dependent_parent_ids) { + const base::flat_set<viz::SurfaceId>& dependent_parent_ids = it->second; + for (const viz::SurfaceId& parent_id : dependent_parent_ids) { Surface* parent = surface_manager_->GetSurfaceForId(parent_id); if (parent && parent->has_deadline()) { deadline_changed = @@ -160,7 +160,7 @@ return; // Recursively propagate the newly set deadline to children. - for (const SurfaceId& surface_id : + for (const viz::SurfaceId& surface_id : pending_frame.metadata.activation_dependencies) { Surface* dependency = surface_manager_->GetSurfaceForId(surface_id); if (dependency && dependency->HasPendingFrame()) @@ -169,7 +169,7 @@ } bool SurfaceDependencyTracker::IsSurfaceLate(Surface* surface) { - for (const SurfaceId& surface_id : surfaces_with_missing_dependencies_) { + for (const viz::SurfaceId& surface_id : surfaces_with_missing_dependencies_) { Surface* activated_surface = surface_manager_->GetSurfaceForId(surface_id); DCHECK(activated_surface->HasActiveFrame()); if (activated_surface->late_activation_dependencies().count( @@ -181,17 +181,17 @@ } void SurfaceDependencyTracker::NotifySurfaceIdAvailable( - const SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { auto it = blocked_surfaces_from_dependency_.find(surface_id); if (it == blocked_surfaces_from_dependency_.end()) return; // Unblock surfaces that depend on this |surface_id|. - base::flat_set<SurfaceId> blocked_surfaces_by_id(it->second); + base::flat_set<viz::SurfaceId> blocked_surfaces_by_id(it->second); blocked_surfaces_from_dependency_.erase(it); // Tell each surface about the availability of its blocker. - for (const SurfaceId& blocked_surface_by_id : blocked_surfaces_by_id) { + for (const viz::SurfaceId& blocked_surface_by_id : blocked_surfaces_by_id) { Surface* blocked_surface = surface_manager_->GetSurfaceForId(blocked_surface_by_id); if (!blocked_surface) {
diff --git a/cc/surfaces/surface_dependency_tracker.h b/cc/surfaces/surface_dependency_tracker.h index ffa95d2..77aa9a6 100644 --- a/cc/surfaces/surface_dependency_tracker.h +++ b/cc/surfaces/surface_dependency_tracker.h
@@ -37,8 +37,8 @@ void OnSurfaceActivated(Surface* surface); void OnSurfaceDependenciesChanged( Surface* surface, - const base::flat_set<SurfaceId>& added_dependencies, - const base::flat_set<SurfaceId>& removed_dependencies); + const base::flat_set<viz::SurfaceId>& added_dependencies, + const base::flat_set<viz::SurfaceId>& removed_dependencies); void OnSurfaceDiscarded(Surface* surface); private: @@ -58,20 +58,22 @@ // Informs all Surfaces with pending frames blocked on the provided // |surface_id| that there is now an active frame available in Surface // corresponding to |surface_id|. - void NotifySurfaceIdAvailable(const SurfaceId& surface_id); + void NotifySurfaceIdAvailable(const viz::SurfaceId& surface_id); SurfaceManager* const surface_manager_; // A map from a SurfaceId to the set of Surfaces blocked on that SurfaceId. - std::unordered_map<SurfaceId, base::flat_set<SurfaceId>, SurfaceIdHash> + std::unordered_map<viz::SurfaceId, + base::flat_set<viz::SurfaceId>, + viz::SurfaceIdHash> blocked_surfaces_from_dependency_; // The set of SurfaceIds corresponding that are known to have blockers. - base::flat_set<SurfaceId> blocked_surfaces_by_id_; + base::flat_set<viz::SurfaceId> blocked_surfaces_by_id_; // The set of SurfaceIds corresponding to Surfaces that have active // CompositorFrames with missing dependencies. - base::flat_set<SurfaceId> surfaces_with_missing_dependencies_; + base::flat_set<viz::SurfaceId> surfaces_with_missing_dependencies_; DISALLOW_COPY_AND_ASSIGN(SurfaceDependencyTracker); };
diff --git a/cc/surfaces/surface_hittest.cc b/cc/surfaces/surface_hittest.cc index df69c7a..5e16db0 100644 --- a/cc/surfaces/surface_hittest.cc +++ b/cc/surfaces/surface_hittest.cc
@@ -22,11 +22,11 @@ SurfaceHittest::~SurfaceHittest() {} -SurfaceId SurfaceHittest::GetTargetSurfaceAtPoint( - const SurfaceId& root_surface_id, +viz::SurfaceId SurfaceHittest::GetTargetSurfaceAtPoint( + const viz::SurfaceId& root_surface_id, const gfx::Point& point, gfx::Transform* transform) { - SurfaceId out_surface_id = root_surface_id; + viz::SurfaceId out_surface_id = root_surface_id; // Reset the output transform to identity. if (transform) @@ -40,8 +40,8 @@ } bool SurfaceHittest::GetTransformToTargetSurface( - const SurfaceId& root_surface_id, - const SurfaceId& target_surface_id, + const viz::SurfaceId& root_surface_id, + const viz::SurfaceId& target_surface_id, gfx::Transform* transform) { // Reset the output transform to identity. if (transform) @@ -53,8 +53,8 @@ } bool SurfaceHittest::TransformPointToTargetSurface( - const SurfaceId& original_surface_id, - const SurfaceId& target_surface_id, + const viz::SurfaceId& original_surface_id, + const viz::SurfaceId& target_surface_id, gfx::Point* point) { gfx::Transform transform; // Two possibilities need to be considered: original_surface_id can be @@ -77,11 +77,11 @@ } bool SurfaceHittest::GetTargetSurfaceAtPointInternal( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, RenderPassId render_pass_id, const gfx::Point& point_in_root_target, std::set<const RenderPass*>* referenced_passes, - SurfaceId* out_surface_id, + viz::SurfaceId* out_surface_id, gfx::Transform* out_transform) { const RenderPass* render_pass = GetRenderPassForSurfaceById(surface_id, render_pass_id); @@ -171,8 +171,8 @@ } bool SurfaceHittest::GetTransformToTargetSurfaceInternal( - const SurfaceId& root_surface_id, - const SurfaceId& target_surface_id, + const viz::SurfaceId& root_surface_id, + const viz::SurfaceId& target_surface_id, RenderPassId render_pass_id, std::set<const RenderPass*>* referenced_passes, gfx::Transform* out_transform) { @@ -251,7 +251,7 @@ } const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, RenderPassId render_pass_id) { Surface* surface = manager_->GetSurfaceForId(surface_id); if (!surface)
diff --git a/cc/surfaces/surface_hittest.h b/cc/surfaces/surface_hittest.h index 6d2a3746..fd70978 100644 --- a/cc/surfaces/surface_hittest.h +++ b/cc/surfaces/surface_hittest.h
@@ -8,8 +8,8 @@ #include <set> #include "cc/quads/render_pass.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/surface_id.h" namespace gfx { class Point; @@ -32,43 +32,44 @@ // Returns the target surface that falls underneath the provided |point|. // Also returns the |transform| to convert the |point| to the target surface's // space. - SurfaceId GetTargetSurfaceAtPoint(const SurfaceId& root_surface_id, - const gfx::Point& point, - gfx::Transform* transform); + viz::SurfaceId GetTargetSurfaceAtPoint(const viz::SurfaceId& root_surface_id, + const gfx::Point& point, + gfx::Transform* transform); // Returns whether the target surface falls inside the provide root surface. // Returns the |transform| to convert points from the root surface coordinate // space to the target surface coordinate space. - bool GetTransformToTargetSurface(const SurfaceId& root_surface_id, - const SurfaceId& target_surface_id, + bool GetTransformToTargetSurface(const viz::SurfaceId& root_surface_id, + const viz::SurfaceId& target_surface_id, gfx::Transform* transform); // Attempts to transform a point from the coordinate space of one surface to // that of another, where one is surface is embedded within the other. // Returns true if the transform is successfully applied, and false if // neither surface is contained with the other. - bool TransformPointToTargetSurface(const SurfaceId& original_surface_id, - const SurfaceId& target_surface_id, + bool TransformPointToTargetSurface(const viz::SurfaceId& original_surface_id, + const viz::SurfaceId& target_surface_id, gfx::Point* point); private: bool GetTargetSurfaceAtPointInternal( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, RenderPassId render_pass_id, const gfx::Point& point_in_root_target, std::set<const RenderPass*>* referenced_passes, - SurfaceId* out_surface_id, + viz::SurfaceId* out_surface_id, gfx::Transform* out_transform); bool GetTransformToTargetSurfaceInternal( - const SurfaceId& root_surface_id, - const SurfaceId& target_surface_id, + const viz::SurfaceId& root_surface_id, + const viz::SurfaceId& target_surface_id, RenderPassId render_pass_id, std::set<const RenderPass*>* referenced_passes, gfx::Transform* out_transform); - const RenderPass* GetRenderPassForSurfaceById(const SurfaceId& surface_id, - RenderPassId render_pass_id); + const RenderPass* GetRenderPassForSurfaceById( + const viz::SurfaceId& surface_id, + RenderPassId render_pass_id); bool PointInQuad(const DrawQuad* quad, const gfx::Point& point_in_render_pass_space,
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc index 386e069..4f3ddfe 100644 --- a/cc/surfaces/surface_hittest_unittest.cc +++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -7,12 +7,12 @@ #include "cc/output/compositor_frame.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_hittest.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/surface_hittest_test_helpers.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/geometry/size.h" @@ -21,16 +21,16 @@ namespace { -constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); constexpr bool kIsRoot = true; constexpr bool kIsChildRoot = false; constexpr bool kHandlesFrameSinkIdInvalidation = true; constexpr bool kNeedsSyncPoints = true; struct TestCase { - SurfaceId input_surface_id; + viz::SurfaceId input_surface_id; gfx::Point input_point; - SurfaceId expected_layer_tree_frame_sink_id; + viz::SurfaceId expected_layer_tree_frame_sink_id; gfx::Point expected_output_point; }; @@ -67,7 +67,7 @@ // not crash. TEST(SurfaceHittestTest, Hittest_BadCompositorFrameDoesNotCrash) { FrameSinkManager manager; - FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); + viz::FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( nullptr, &manager, kArbitraryFrameSinkId, kIsRoot, @@ -79,9 +79,9 @@ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); // Add a reference to a non-existant child surface on the root surface. - SurfaceId child_surface_id( + viz::SurfaceId child_surface_id( kArbitraryFrameSinkId, - LocalSurfaceId(0xdeadbeef, base::UnguessableToken::Create())); + viz::LocalSurfaceId(0xdeadbeef, base::UnguessableToken::Create())); gfx::Rect child_rect(200, 200); CreateSurfaceDrawQuad(root_pass, gfx::Transform(), @@ -90,9 +90,9 @@ child_surface_id); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); root_support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); @@ -112,7 +112,7 @@ FrameSinkManager manager; // Set up root FrameSink. - FrameSinkId root_frame_sink_id(1, 1); + viz::FrameSinkId root_frame_sink_id(1, 1); std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( nullptr, &manager, root_frame_sink_id, kIsRoot, @@ -124,9 +124,9 @@ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); root_support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); TestCase tests[] = { @@ -147,14 +147,14 @@ FrameSinkManager manager; // Set up root FrameSink. - FrameSinkId root_frame_sink_id(1, 1); + viz::FrameSinkId root_frame_sink_id(1, 1); std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( nullptr, &manager, root_frame_sink_id, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); // Set up child FrameSink. - FrameSinkId child_frame_sink_id(2, 2); + viz::FrameSinkId child_frame_sink_id(2, 2); std::unique_ptr<CompositorFrameSinkSupport> child_support = CompositorFrameSinkSupport::Create( nullptr, &manager, child_frame_sink_id, kIsChildRoot, @@ -166,9 +166,9 @@ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); // Add a reference to the child surface on the root surface. - LocalSurfaceIdAllocator child_allocator; - LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); - SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); + viz::LocalSurfaceIdAllocator child_allocator; + viz::LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); + viz::SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); gfx::Rect child_rect(200, 200); CreateSurfaceDrawQuad(root_pass, gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, @@ -180,9 +180,9 @@ child_surface_id); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); root_support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); @@ -290,14 +290,14 @@ FrameSinkManager manager; // Set up root FrameSink. - FrameSinkId root_frame_sink_id(1, 1); + viz::FrameSinkId root_frame_sink_id(1, 1); std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( nullptr, &manager, root_frame_sink_id, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); // Set up child FrameSink. - FrameSinkId child_frame_sink_id(2, 2); + viz::FrameSinkId child_frame_sink_id(2, 2); std::unique_ptr<CompositorFrameSinkSupport> child_support = CompositorFrameSinkSupport::Create( nullptr, &manager, child_frame_sink_id, kIsChildRoot, @@ -314,9 +314,9 @@ invalid_render_pass_id); // Add a reference to the child surface on the root surface. - LocalSurfaceIdAllocator child_allocator; - LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); - SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); + viz::LocalSurfaceIdAllocator child_allocator; + viz::LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); + viz::SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); gfx::Rect child_rect(200, 200); CreateSurfaceDrawQuad(root_pass, gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, @@ -328,9 +328,9 @@ child_surface_id); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); root_support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); @@ -399,7 +399,7 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) { FrameSinkManager manager; - FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); + viz::FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); std::unique_ptr<CompositorFrameSinkSupport> support = CompositorFrameSinkSupport::Create( nullptr, &manager, root_frame_sink_id, kIsRoot, @@ -446,9 +446,9 @@ child_solid_quad_rect); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); TestCase tests[] = { @@ -504,14 +504,14 @@ FrameSinkManager manager; // Set up root FrameSink. - FrameSinkId root_frame_sink_id(1, 1); + viz::FrameSinkId root_frame_sink_id(1, 1); std::unique_ptr<CompositorFrameSinkSupport> root_support = CompositorFrameSinkSupport::Create( nullptr, &manager, root_frame_sink_id, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); // Set up child FrameSink. - FrameSinkId child_frame_sink_id(2, 2); + viz::FrameSinkId child_frame_sink_id(2, 2); std::unique_ptr<CompositorFrameSinkSupport> child_support = CompositorFrameSinkSupport::Create( nullptr, &manager, child_frame_sink_id, kIsRoot, @@ -523,9 +523,9 @@ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); // Add a reference to the child surface on the root surface. - LocalSurfaceIdAllocator child_allocator; - LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); - SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); + viz::LocalSurfaceIdAllocator child_allocator; + viz::LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); + viz::SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); gfx::Rect child_rect(200, 200); CreateSurfaceDrawQuad( root_pass, @@ -536,9 +536,9 @@ root_rect, child_rect, child_surface_id); // Submit the root frame. - LocalSurfaceIdAllocator root_allocator; - LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); - SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); + viz::LocalSurfaceIdAllocator root_allocator; + viz::LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); + viz::SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); root_support->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame));
diff --git a/cc/surfaces/surface_info.h b/cc/surfaces/surface_info.h index 14cfab5..70efd5ec 100644 --- a/cc/surfaces/surface_info.h +++ b/cc/surfaces/surface_info.h
@@ -5,7 +5,7 @@ #ifndef CC_SURFACES_SURFACE_INFO_H_ #define CC_SURFACES_SURFACE_INFO_H_ -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "ui/gfx/geometry/size.h" namespace IPC { @@ -22,7 +22,7 @@ class SurfaceInfo { public: SurfaceInfo() = default; - SurfaceInfo(const SurfaceId& id, + SurfaceInfo(const viz::SurfaceId& id, float device_scale_factor, const gfx::Size& size_in_pixels) : id_(id), @@ -42,7 +42,7 @@ bool operator!=(const SurfaceInfo& info) const { return !(*this == info); } - const SurfaceId& id() const { return id_; } + const viz::SurfaceId& id() const { return id_; } float device_scale_factor() const { return device_scale_factor_; } const gfx::Size& size_in_pixels() const { return size_in_pixels_; } @@ -50,7 +50,7 @@ friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>; friend struct IPC::ParamTraits<SurfaceInfo>; - SurfaceId id_; + viz::SurfaceId id_; float device_scale_factor_ = 1.f; gfx::Size size_in_pixels_; };
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc index 341fccd..1a75047d 100644 --- a/cc/surfaces/surface_manager.cc +++ b/cc/surfaces/surface_manager.cc
@@ -13,11 +13,11 @@ #include "base/logging.h" #include "cc/surfaces/direct_surface_reference_factory.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/stub_surface_reference_factory.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_client.h" #include "cc/surfaces/surface_info.h" +#include "components/viz/common/local_surface_id_allocator.h" #if DCHECK_IS_ON() #include <sstream> @@ -32,8 +32,9 @@ SurfaceManager::SurfaceManager(LifetimeType lifetime_type) : lifetime_type_(lifetime_type), dependency_tracker_(this), - root_surface_id_(FrameSinkId(0u, 0u), - LocalSurfaceId(1u, base::UnguessableToken::Create())), + root_surface_id_( + viz::FrameSinkId(0u, 0u), + viz::LocalSurfaceId(1u, base::UnguessableToken::Create())), weak_factory_(this) { thread_checker_.DetachFromThread(); if (using_surface_references()) { @@ -77,8 +78,8 @@ DCHECK(surface_info.is_valid()); DCHECK(surface_client); - // If no surface with this SurfaceId exists, simply create the surface and - // return. + // If no surface with this viz::SurfaceId exists, simply create the surface + // and return. auto it = surface_map_.find(surface_info.id()); if (it == surface_map_.end()) { surface_map_[surface_info.id()] = @@ -87,16 +88,17 @@ return surface_map_[surface_info.id()].get(); } - // If a surface with this SurfaceId exists, it must be marked as destroyed. - // Otherwise, we wouldn't receive a request to reuse the same SurfaceId. - // Remove the surface out of the garbage collector's queue and reuse it. + // If a surface with this viz::SurfaceId exists, it must be marked as + // destroyed. Otherwise, we wouldn't receive a request to reuse the same + // viz::SurfaceId. Remove the surface out of the garbage collector's queue and + // reuse it. Surface* surface = it->second.get(); DCHECK(IsMarkedForDestruction(surface_info.id())); surfaces_to_destroy_.erase(surface_info.id()); return surface; } -void SurfaceManager::DestroySurface(const SurfaceId& surface_id) { +void SurfaceManager::DestroySurface(const viz::SurfaceId& surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(surface_map_.count(surface_id)); for (auto& observer : observer_list_) @@ -105,13 +107,13 @@ GarbageCollectSurfaces(); } -void SurfaceManager::SurfaceWillDraw(const SurfaceId& surface_id) { +void SurfaceManager::SurfaceWillDraw(const viz::SurfaceId& surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); for (auto& observer : observer_list_) observer.OnSurfaceWillDraw(surface_id); } -void SurfaceManager::RequireSequence(const SurfaceId& surface_id, +void SurfaceManager::RequireSequence(const viz::SurfaceId& surface_id, const SurfaceSequence& sequence) { auto* surface = GetSurfaceForId(surface_id); if (!surface) { @@ -128,18 +130,20 @@ GarbageCollectSurfaces(); } -void SurfaceManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { +void SurfaceManager::RegisterFrameSinkId( + const viz::FrameSinkId& frame_sink_id) { bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second; DCHECK(inserted); } -void SurfaceManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { +void SurfaceManager::InvalidateFrameSinkId( + const viz::FrameSinkId& frame_sink_id) { valid_frame_sink_ids_.erase(frame_sink_id); // Remove any temporary references owned by |frame_sink_id|. - std::vector<SurfaceId> temp_refs_to_clear; + std::vector<viz::SurfaceId> temp_refs_to_clear; for (auto& map_entry : temporary_references_) { - base::Optional<FrameSinkId>& owner = map_entry.second; + base::Optional<viz::FrameSinkId>& owner = map_entry.second; if (owner.has_value() && owner.value() == frame_sink_id) temp_refs_to_clear.push_back(map_entry.first); } @@ -150,7 +154,7 @@ GarbageCollectSurfaces(); } -const SurfaceId& SurfaceManager::GetRootSurfaceId() const { +const viz::SurfaceId& SurfaceManager::GetRootSurfaceId() const { return root_surface_id_; } @@ -172,8 +176,8 @@ GarbageCollectSurfaces(); } -void SurfaceManager::AssignTemporaryReference(const SurfaceId& surface_id, - const FrameSinkId& owner) { +void SurfaceManager::AssignTemporaryReference(const viz::SurfaceId& surface_id, + const viz::FrameSinkId& owner) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(lifetime_type_, LifetimeType::REFERENCES); @@ -183,7 +187,7 @@ temporary_references_[surface_id] = owner; } -void SurfaceManager::DropTemporaryReference(const SurfaceId& surface_id) { +void SurfaceManager::DropTemporaryReference(const viz::SurfaceId& surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(lifetime_type_, LifetimeType::REFERENCES); @@ -193,16 +197,18 @@ RemoveTemporaryReference(surface_id, false); } -const base::flat_set<SurfaceId>& SurfaceManager::GetSurfacesReferencedByParent( - const SurfaceId& surface_id) const { +const base::flat_set<viz::SurfaceId>& +SurfaceManager::GetSurfacesReferencedByParent( + const viz::SurfaceId& surface_id) const { auto iter = references_.find(surface_id); if (iter == references_.end()) return empty_surface_id_set_; return iter->second.children; } -const base::flat_set<SurfaceId>& SurfaceManager::GetSurfacesThatReferenceChild( - const SurfaceId& surface_id) const { +const base::flat_set<viz::SurfaceId>& +SurfaceManager::GetSurfacesThatReferenceChild( + const viz::SurfaceId& surface_id) const { auto iter = references_.find(surface_id); if (iter == references_.end()) return empty_surface_id_set_; @@ -217,7 +223,7 @@ ? GetLiveSurfacesForReferences() : GetLiveSurfacesForSequences(); - std::vector<SurfaceId> surfaces_to_delete; + std::vector<viz::SurfaceId> surfaces_to_delete; // Delete all destroyed and unreachable surfaces. for (auto iter = surfaces_to_destroy_.begin(); @@ -231,7 +237,7 @@ } // ~Surface() draw callback could modify |surfaces_to_destroy_|. - for (const SurfaceId& surface_id : surfaces_to_delete) + for (const viz::SurfaceId& surface_id : surfaces_to_delete) DestroySurfaceInternal(surface_id); } @@ -240,8 +246,9 @@ SurfaceIdSet reachable_surfaces; - // Walk down from the root and mark each SurfaceId we encounter as reachable. - std::queue<SurfaceId> surface_queue; + // Walk down from the root and mark each viz::SurfaceId we encounter as + // reachable. + std::queue<viz::SurfaceId> surface_queue; surface_queue.push(root_surface_id_); // All temporary references are also reachable. @@ -252,7 +259,7 @@ while (!surface_queue.empty()) { const auto& children = GetSurfacesReferencedByParent(surface_queue.front()); - for (const SurfaceId& child_id : children) { + for (const viz::SurfaceId& child_id : children) { // Check for cycles when inserting into |reachable_surfaces|. if (reachable_surfaces.insert(child_id).second) surface_queue.push(child_id); @@ -269,13 +276,13 @@ // Simple mark and sweep GC. // TODO(jbauman): Reduce the amount of work when nothing needs to be // destroyed. - std::vector<SurfaceId> live_surfaces; - std::unordered_set<SurfaceId, SurfaceIdHash> live_surfaces_set; + std::vector<viz::SurfaceId> live_surfaces; + std::unordered_set<viz::SurfaceId, viz::SurfaceIdHash> live_surfaces_set; // GC roots are surfaces that have not been destroyed, or have not had all // their destruction dependencies satisfied. for (auto& map_entry : surface_map_) { - const SurfaceId& surface_id = map_entry.first; + const viz::SurfaceId& surface_id = map_entry.first; Surface* surface = map_entry.second.get(); surface->SatisfyDestructionDependencies(&satisfied_sequences_, &valid_frame_sink_ids_); @@ -294,7 +301,7 @@ DCHECK(surf); const auto& children = GetSurfacesReferencedByParent(surf->surface_id()); - for (const SurfaceId& id : children) { + for (const viz::SurfaceId& id : children) { if (live_surfaces_set.count(id)) continue; @@ -309,8 +316,8 @@ return live_surfaces_set; } -void SurfaceManager::AddSurfaceReferenceImpl(const SurfaceId& parent_id, - const SurfaceId& child_id) { +void SurfaceManager::AddSurfaceReferenceImpl(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id) { if (parent_id.frame_sink_id() == child_id.frame_sink_id()) { DLOG(ERROR) << "Cannot add self reference from " << parent_id << " to " << child_id; @@ -331,8 +338,9 @@ RemoveTemporaryReference(child_id, true); } -void SurfaceManager::RemoveSurfaceReferenceImpl(const SurfaceId& parent_id, - const SurfaceId& child_id) { +void SurfaceManager::RemoveSurfaceReferenceImpl( + const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id) { auto iter_parent = references_.find(parent_id); auto iter_child = references_.find(child_id); if (iter_parent == references_.end() || iter_child == references_.end()) @@ -342,44 +350,46 @@ iter_child->second.parents.erase(parent_id); } -void SurfaceManager::RemoveAllSurfaceReferences(const SurfaceId& surface_id) { +void SurfaceManager::RemoveAllSurfaceReferences( + const viz::SurfaceId& surface_id) { DCHECK(!HasTemporaryReference(surface_id)); auto iter = references_.find(surface_id); if (iter != references_.end()) { // Remove all references from |surface_id| to a child surface. - for (const SurfaceId& child_id : iter->second.children) + for (const viz::SurfaceId& child_id : iter->second.children) references_[child_id].parents.erase(surface_id); // Remove all reference from parent surface to |surface_id|. - for (const SurfaceId& parent_id : iter->second.parents) + for (const viz::SurfaceId& parent_id : iter->second.parents) references_[parent_id].children.erase(surface_id); references_.erase(iter); } } -bool SurfaceManager::HasTemporaryReference(const SurfaceId& surface_id) const { +bool SurfaceManager::HasTemporaryReference( + const viz::SurfaceId& surface_id) const { return temporary_references_.count(surface_id) != 0; } -void SurfaceManager::AddTemporaryReference(const SurfaceId& surface_id) { +void SurfaceManager::AddTemporaryReference(const viz::SurfaceId& surface_id) { DCHECK(!HasTemporaryReference(surface_id)); // Add an entry to |temporary_references_| with no owner for the temporary // reference. Also add a range tracking entry so we know the order that - // surfaces were created for the FrameSinkId. - temporary_references_[surface_id] = base::Optional<FrameSinkId>(); + // surfaces were created for the viz::FrameSinkId. + temporary_references_[surface_id] = base::Optional<viz::FrameSinkId>(); temporary_reference_ranges_[surface_id.frame_sink_id()].push_back( surface_id.local_surface_id()); } -void SurfaceManager::RemoveTemporaryReference(const SurfaceId& surface_id, +void SurfaceManager::RemoveTemporaryReference(const viz::SurfaceId& surface_id, bool remove_range) { DCHECK(HasTemporaryReference(surface_id)); - const FrameSinkId& frame_sink_id = surface_id.frame_sink_id(); - std::vector<LocalSurfaceId>& frame_sink_temp_refs = + const viz::FrameSinkId& frame_sink_id = surface_id.frame_sink_id(); + std::vector<viz::LocalSurfaceId>& frame_sink_temp_refs = temporary_reference_ranges_[frame_sink_id]; // Find the iterator to the range tracking entry for |surface_id|. Use that @@ -394,7 +404,7 @@ // Remove temporary references and range tracking information. for (auto iter = begin_iter; iter != end_iter; ++iter) - temporary_references_.erase(SurfaceId(frame_sink_id, *iter)); + temporary_references_.erase(viz::SurfaceId(frame_sink_id, *iter)); frame_sink_temp_refs.erase(begin_iter, end_iter); // If last temporary reference is removed for |frame_sink_id| then cleanup @@ -403,7 +413,7 @@ temporary_reference_ranges_.erase(frame_sink_id); } -Surface* SurfaceManager::GetSurfaceForId(const SurfaceId& surface_id) { +Surface* SurfaceManager::GetSurfaceForId(const viz::SurfaceId& surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); auto it = surface_map_.find(surface_id); if (it == surface_map_.end()) @@ -411,7 +421,7 @@ return it->second.get(); } -bool SurfaceManager::SurfaceModified(const SurfaceId& surface_id, +bool SurfaceManager::SurfaceModified(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) { CHECK(thread_checker_.CalledOnValidThread()); bool changed = false; @@ -443,8 +453,8 @@ void SurfaceManager::SurfaceDependenciesChanged( Surface* surface, - const base::flat_set<SurfaceId>& added_dependencies, - const base::flat_set<SurfaceId>& removed_dependencies) { + const base::flat_set<viz::SurfaceId>& added_dependencies, + const base::flat_set<viz::SurfaceId>& removed_dependencies) { dependency_tracker_.OnSurfaceDependenciesChanged(surface, added_dependencies, removed_dependencies); } @@ -455,14 +465,14 @@ dependency_tracker_.OnSurfaceDiscarded(surface); } -void SurfaceManager::SurfaceDamageExpected(const SurfaceId& surface_id, +void SurfaceManager::SurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args) { DCHECK(thread_checker_.CalledOnValidThread()); for (auto& observer : observer_list_) observer.OnSurfaceDamageExpected(surface_id, args); } -void SurfaceManager::DestroySurfaceInternal(const SurfaceId& surface_id) { +void SurfaceManager::DestroySurfaceInternal(const viz::SurfaceId& surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); auto it = surface_map_.find(surface_id); DCHECK(it != surface_map_.end()); @@ -476,9 +486,10 @@ } #if DCHECK_IS_ON() -void SurfaceManager::SurfaceReferencesToStringImpl(const SurfaceId& surface_id, - std::string indent, - std::stringstream* str) { +void SurfaceManager::SurfaceReferencesToStringImpl( + const viz::SurfaceId& surface_id, + std::string indent, + std::stringstream* str) { *str << indent; // Print the current line for |surface_id|. @@ -507,12 +518,13 @@ // If the current surface has references to children, sort children and print // references for each child. - for (const SurfaceId& child_id : GetSurfacesReferencedByParent(surface_id)) + for (const viz::SurfaceId& child_id : + GetSurfacesReferencedByParent(surface_id)) SurfaceReferencesToStringImpl(child_id, indent + " ", str); } #endif // DCHECK_IS_ON() -bool SurfaceManager::IsMarkedForDestruction(const SurfaceId& surface_id) { +bool SurfaceManager::IsMarkedForDestruction(const viz::SurfaceId& surface_id) { return surfaces_to_destroy_.count(surface_id) != 0; }
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h index b194c0e5..fbb587b 100644 --- a/cc/surfaces/surface_manager.h +++ b/cc/surfaces/surface_manager.h
@@ -19,14 +19,14 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/surface_dependency_tracker.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_observer.h" #include "cc/surfaces/surface_reference.h" #include "cc/surfaces/surface_reference_factory.h" #include "cc/surfaces/surface_sequence.h" #include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/surface_id.h" #if DCHECK_IS_ON() #include <iosfwd> @@ -71,13 +71,13 @@ bool needs_sync_tokens); // Destroy the Surface once a set of sequence numbers has been satisfied. - void DestroySurface(const SurfaceId& surface_id); + void DestroySurface(const viz::SurfaceId& surface_id); // Called when a surface has been added to the aggregated CompositorFrame // and will notify observers with SurfaceObserver::OnSurfaceWillDraw. - void SurfaceWillDraw(const SurfaceId& surface_id); + void SurfaceWillDraw(const viz::SurfaceId& surface_id); - Surface* GetSurfaceForId(const SurfaceId& surface_id); + Surface* GetSurfaceForId(const viz::SurfaceId& surface_id); void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } @@ -90,7 +90,8 @@ // in response to a BeginFrame, or a CopyOutputRequest is issued. // // |ack.sequence_number| is only valid if called in response to a BeginFrame. - bool SurfaceModified(const SurfaceId& surface_id, const BeginFrameAck& ack); + bool SurfaceModified(const viz::SurfaceId& surface_id, + const BeginFrameAck& ack); // Called when a CompositorFrame is submitted to a SurfaceClient // for a given |surface_id| for the first time. @@ -103,45 +104,46 @@ // has changed. void SurfaceDependenciesChanged( Surface* surface, - const base::flat_set<SurfaceId>& added_dependencies, - const base::flat_set<SurfaceId>& removed_dependencies); + const base::flat_set<viz::SurfaceId>& added_dependencies, + const base::flat_set<viz::SurfaceId>& removed_dependencies); // Called when |surface| is being destroyed. void SurfaceDiscarded(Surface* surface); // Called when a Surface's CompositorFrame producer has received a BeginFrame // and, thus, is expected to produce damage soon. - void SurfaceDamageExpected(const SurfaceId& surface_id, + void SurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args); // Require that the given sequence number must be satisfied (using // SatisfySequence) before the given surface can be destroyed. - void RequireSequence(const SurfaceId& surface_id, + void RequireSequence(const viz::SurfaceId& surface_id, const SurfaceSequence& sequence); // Satisfies the given sequence number. Once all sequence numbers that // a surface depends on are satisfied, the surface can be destroyed. void SatisfySequence(const SurfaceSequence& sequence); - void RegisterFrameSinkId(const FrameSinkId& frame_sink_id); + void RegisterFrameSinkId(const viz::FrameSinkId& frame_sink_id); // Invalidate a frame_sink_id that might still have associated sequences, // possibly because a renderer process has crashed. - void InvalidateFrameSinkId(const FrameSinkId& frame_sink_id); + void InvalidateFrameSinkId(const viz::FrameSinkId& frame_sink_id); // Register a relationship between two namespaces. This relationship means // that surfaces from the child namespace will be displayed in the parent. // Children are allowed to use any begin frame source that their parent can // use. - void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id); - void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, - const FrameSinkId& child_frame_sink_id); + void RegisterFrameSinkHierarchy(const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id); + void UnregisterFrameSinkHierarchy( + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id); - // Returns the top level root SurfaceId. Surfaces that are not reachable + // Returns the top level root viz::SurfaceId. Surfaces that are not reachable // from the top level root may be garbage collected. It will not be a valid - // SurfaceId and will never correspond to a surface. - const SurfaceId& GetRootSurfaceId() const; + // viz::SurfaceId and will never correspond to a surface. + const viz::SurfaceId& GetRootSurfaceId() const; // Adds all surface references in |references|. This will remove any temporary // references for child surface in a surface reference. @@ -155,23 +157,23 @@ // |surface_id|. If |owner| is invalidated the temporary reference // will be removed. If a surface reference has already been added from the // parent to |surface_id| then this will do nothing. - void AssignTemporaryReference(const SurfaceId& surface_id, - const FrameSinkId& owner); + void AssignTemporaryReference(const viz::SurfaceId& surface_id, + const viz::FrameSinkId& owner); // Drops the temporary reference for |surface_id|. If a surface reference has // already been added from the parent to |surface_id| then this will do // nothing. - void DropTemporaryReference(const SurfaceId& surface_id); + void DropTemporaryReference(const viz::SurfaceId& surface_id); // Returns all surfaces referenced by parent |surface_id|. Will return an // empty set if |surface_id| is unknown or has no references. - const base::flat_set<SurfaceId>& GetSurfacesReferencedByParent( - const SurfaceId& surface_id) const; + const base::flat_set<viz::SurfaceId>& GetSurfacesReferencedByParent( + const viz::SurfaceId& surface_id) const; // Returns all surfaces that have a reference to child |surface_id|. Will // return an empty set if |surface_id| is unknown or has no references to it. - const base::flat_set<SurfaceId>& GetSurfacesThatReferenceChild( - const SurfaceId& surface_id) const; + const base::flat_set<viz::SurfaceId>& GetSurfacesThatReferenceChild( + const viz::SurfaceId& surface_id) const; const scoped_refptr<SurfaceReferenceFactory>& reference_factory() { return reference_factory_; @@ -181,7 +183,7 @@ return lifetime_type_ == LifetimeType::REFERENCES; } - const base::flat_set<FrameSinkId>& GetValidFrameSinkIds() { + const base::flat_set<viz::FrameSinkId>& GetValidFrameSinkIds() { return valid_frame_sink_ids_; } @@ -189,17 +191,17 @@ friend class test::SurfaceSynchronizationTest; friend class SurfaceManagerRefTest; - using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>; + using SurfaceIdSet = std::unordered_set<viz::SurfaceId, viz::SurfaceIdHash>; struct SurfaceReferenceInfo { SurfaceReferenceInfo(); ~SurfaceReferenceInfo(); // Surfaces that have references to this surface. - base::flat_set<SurfaceId> parents; + base::flat_set<viz::SurfaceId> parents; // Surfaces that are referenced from this surface. - base::flat_set<SurfaceId> children; + base::flat_set<viz::SurfaceId> children; }; // Garbage collects all destroyed surfaces that aren't live. @@ -213,40 +215,41 @@ // Adds a reference from |parent_id| to |child_id| without dealing with // temporary references. - void AddSurfaceReferenceImpl(const SurfaceId& parent_id, - const SurfaceId& child_id); + void AddSurfaceReferenceImpl(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id); // Removes a reference from a |parent_id| to |child_id|. - void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id, - const SurfaceId& child_id); + void RemoveSurfaceReferenceImpl(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id); // Removes all surface references to or from |surface_id|. Used when the // surface is about to be deleted. - void RemoveAllSurfaceReferences(const SurfaceId& surface_id); + void RemoveAllSurfaceReferences(const viz::SurfaceId& surface_id); - bool HasTemporaryReference(const SurfaceId& surface_id) const; + bool HasTemporaryReference(const viz::SurfaceId& surface_id) const; // Adds a temporary reference to |surface_id|. The reference will not have an // owner initially. - void AddTemporaryReference(const SurfaceId& surface_id); + void AddTemporaryReference(const viz::SurfaceId& surface_id); // Removes temporary reference to |surface_id|. If |remove_range| is true then - // all temporary references to surfaces with the same FrameSinkId as + // all temporary references to surfaces with the same viz::FrameSinkId as // |surface_id| that were added before |surface_id| will also be removed. - void RemoveTemporaryReference(const SurfaceId& surface_id, bool remove_range); + void RemoveTemporaryReference(const viz::SurfaceId& surface_id, + bool remove_range); // Removes the surface from the surface map and destroys it. - void DestroySurfaceInternal(const SurfaceId& surface_id); + void DestroySurfaceInternal(const viz::SurfaceId& surface_id); #if DCHECK_IS_ON() // Recursively prints surface references starting at |surface_id| to |str|. - void SurfaceReferencesToStringImpl(const SurfaceId& surface_id, + void SurfaceReferencesToStringImpl(const viz::SurfaceId& surface_id, std::string indent, std::stringstream* str); #endif // Returns true if |surface_id| is in the garbage collector's queue. - bool IsMarkedForDestruction(const SurfaceId& surface_id); + bool IsMarkedForDestruction(const viz::SurfaceId& surface_id); // Use reference or sequence based lifetime management. LifetimeType lifetime_type_; @@ -255,28 +258,28 @@ // because they will call back into the dependency tracker. SurfaceDependencyTracker dependency_tracker_; - base::flat_map<SurfaceId, std::unique_ptr<Surface>> surface_map_; + base::flat_map<viz::SurfaceId, std::unique_ptr<Surface>> surface_map_; base::ObserverList<SurfaceObserver> observer_list_; base::ThreadChecker thread_checker_; - base::flat_set<SurfaceId> surfaces_to_destroy_; + base::flat_set<viz::SurfaceId> surfaces_to_destroy_; // Set of SurfaceSequences that have been satisfied by a frame but not yet // waited on. base::flat_set<SurfaceSequence> satisfied_sequences_; - // Set of valid FrameSinkIds. When a FrameSinkId is removed from - // this set, any remaining (surface) sequences with that FrameSinkId are + // Set of valid FrameSinkIds. When a viz::FrameSinkId is removed from + // this set, any remaining (surface) sequences with that viz::FrameSinkId are // considered satisfied. - base::flat_set<FrameSinkId> valid_frame_sink_ids_; + base::flat_set<viz::FrameSinkId> valid_frame_sink_ids_; // Root SurfaceId that references display root surfaces. There is no Surface // with this id, it's for bookkeeping purposes only. - const SurfaceId root_surface_id_; + const viz::SurfaceId root_surface_id_; // Always empty set that is returned when there is no entry in |references_| - // for a SurfaceId. - const base::flat_set<SurfaceId> empty_surface_id_set_; + // for a viz::SurfaceId. + const base::flat_set<viz::SurfaceId> empty_surface_id_set_; // The DirectSurfaceReferenceFactory that uses this manager to create surface // references. @@ -285,25 +288,29 @@ // Keeps track of surface references for a surface. The graph of references is // stored in both directions, so we know the parents and children for each // surface. - std::unordered_map<SurfaceId, SurfaceReferenceInfo, SurfaceIdHash> + std::unordered_map<viz::SurfaceId, SurfaceReferenceInfo, viz::SurfaceIdHash> references_; // A map of surfaces that have temporary references to them. The key is the // SurfaceId and the value is the owner. The owner will initially be empty and // set later by AssignTemporaryReference(). - std::unordered_map<SurfaceId, base::Optional<FrameSinkId>, SurfaceIdHash> + std::unordered_map<viz::SurfaceId, + base::Optional<viz::FrameSinkId>, + viz::SurfaceIdHash> temporary_references_; // Range tracking information for temporary references. Each map entry is an // is an ordered list of SurfaceIds that have temporary references with the - // same FrameSinkId. A SurfaceId can be reconstructed with: + // same viz::FrameSinkId. A SurfaceId can be reconstructed with: // SurfaceId surface_id(key, value[index]); // The LocalSurfaceIds are stored in the order the surfaces are created in. If // a reference is added to a later SurfaceId then all temporary references up // to that point will be removed. This is to handle clients getting out of // sync, for example the embedded client producing new SurfaceIds faster than // the embedding client can use them. - std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> + std::unordered_map<viz::FrameSinkId, + std::vector<viz::LocalSurfaceId>, + viz::FrameSinkIdHash> temporary_reference_ranges_; base::WeakPtrFactory<SurfaceManager> weak_factory_;
diff --git a/cc/surfaces/surface_manager_ref_unittest.cc b/cc/surfaces/surface_manager_ref_unittest.cc index 9385a95..88977da 100644 --- a/cc/surfaces/surface_manager_ref_unittest.cc +++ b/cc/surfaces/surface_manager_ref_unittest.cc
@@ -12,9 +12,9 @@ #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" #include "cc/surfaces/surface.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/compositor_frame_helpers.h" +#include "components/viz/common/surface_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,9 +26,9 @@ namespace cc { namespace { -constexpr FrameSinkId kFrameSink1(1, 0); -constexpr FrameSinkId kFrameSink2(2, 0); -constexpr FrameSinkId kFrameSink3(3, 0); +constexpr viz::FrameSinkId kFrameSink1(1, 0); +constexpr viz::FrameSinkId kFrameSink2(2, 0); +constexpr viz::FrameSinkId kFrameSink3(3, 0); } // namespace @@ -39,22 +39,23 @@ // Creates a new Surface with the provided |frame_sink_id| and |local_id|. // Will first create a Surfacesupport for |frame_sink_id| if necessary. - SurfaceId CreateSurface(const FrameSinkId& frame_sink_id, uint32_t local_id) { - LocalSurfaceId local_surface_id(local_id, - base::UnguessableToken::Deserialize(0, 1u)); + viz::SurfaceId CreateSurface(const viz::FrameSinkId& frame_sink_id, + uint32_t local_id) { + viz::LocalSurfaceId local_surface_id( + local_id, base::UnguessableToken::Deserialize(0, 1u)); GetCompositorFrameSinkSupport(frame_sink_id) .SubmitCompositorFrame(local_surface_id, test::MakeCompositorFrame()); - return SurfaceId(frame_sink_id, local_surface_id); + return viz::SurfaceId(frame_sink_id, local_surface_id); } // Destroy Surface with |surface_id|. - void DestroySurface(const SurfaceId& surface_id) { + void DestroySurface(const viz::SurfaceId& surface_id) { GetCompositorFrameSinkSupport(surface_id.frame_sink_id()) .EvictCurrentSurface(); } CompositorFrameSinkSupport& GetCompositorFrameSinkSupport( - const FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { auto& support_ptr = supports_[frame_sink_id]; if (!support_ptr) { constexpr bool is_root = false; @@ -67,40 +68,41 @@ return *support_ptr; } - void DestroyCompositorFrameSinkSupport(const FrameSinkId& frame_sink_id) { + void DestroyCompositorFrameSinkSupport( + const viz::FrameSinkId& frame_sink_id) { auto support_ptr = supports_.find(frame_sink_id); ASSERT_NE(support_ptr, supports_.end()); supports_.erase(support_ptr); } - void RemoveSurfaceReference(const SurfaceId& parent_id, - const SurfaceId& child_id) { + void RemoveSurfaceReference(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id) { manager_->surface_manager()->RemoveSurfaceReferences( {SurfaceReference(parent_id, child_id)}); } - void AddSurfaceReference(const SurfaceId& parent_id, - const SurfaceId& child_id) { + void AddSurfaceReference(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id) { manager_->surface_manager()->AddSurfaceReferences( {SurfaceReference(parent_id, child_id)}); } // Returns all the references where |surface_id| is the parent. - const base::flat_set<SurfaceId>& GetReferencesFrom( - const SurfaceId& surface_id) { + const base::flat_set<viz::SurfaceId>& GetReferencesFrom( + const viz::SurfaceId& surface_id) { return GetSurfaceManager().GetSurfacesReferencedByParent(surface_id); } // Returns all the references where |surface_id| is the child. - const base::flat_set<SurfaceId>& GetReferencesFor( - const SurfaceId& surface_id) { + const base::flat_set<viz::SurfaceId>& GetReferencesFor( + const viz::SurfaceId& surface_id) { return GetSurfaceManager().GetSurfacesThatReferenceChild(surface_id); } // Temporary references are stored as a map in SurfaceManager. This method // converts the map to a vector. - std::vector<SurfaceId> GetAllTempReferences() { - std::vector<SurfaceId> temp_references; + std::vector<viz::SurfaceId> GetAllTempReferences() { + std::vector<viz::SurfaceId> temp_references; for (auto& map_entry : GetSurfaceManager().temporary_references_) temp_references.push_back(map_entry.first); return temp_references; @@ -120,15 +122,15 @@ manager_.reset(); } - std::unordered_map<FrameSinkId, + std::unordered_map<viz::FrameSinkId, std::unique_ptr<CompositorFrameSinkSupport>, - FrameSinkIdHash> + viz::FrameSinkIdHash> supports_; std::unique_ptr<FrameSinkManager> manager_; }; TEST_F(SurfaceManagerRefTest, AddReference) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); EXPECT_THAT(GetReferencesFor(id1), @@ -137,8 +139,8 @@ } TEST_F(SurfaceManagerRefTest, AddRemoveReference) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -156,9 +158,9 @@ } TEST_F(SurfaceManagerRefTest, NewSurfaceFromFrameSink) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); - SurfaceId id3 = CreateSurface(kFrameSink3, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id3 = CreateSurface(kFrameSink3, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -166,7 +168,7 @@ // |kFramesink2| received a CompositorFrame with a new size, so it destroys // |id2| and creates |id2_next|. No reference have been removed yet. - SurfaceId id2_next = CreateSurface(kFrameSink2, 2); + viz::SurfaceId id2_next = CreateSurface(kFrameSink2, 2); EXPECT_NE(nullptr, GetSurfaceManager().GetSurfaceForId(id2)); EXPECT_NE(nullptr, GetSurfaceManager().GetSurfaceForId(id2_next)); @@ -189,9 +191,9 @@ } TEST_F(SurfaceManagerRefTest, ReferenceCycleGetsDeleted) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); - SurfaceId id3 = CreateSurface(kFrameSink3, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id3 = CreateSurface(kFrameSink3, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -214,8 +216,8 @@ } TEST_F(SurfaceManagerRefTest, SurfacesAreDeletedDuringGarbageCollection) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -240,9 +242,9 @@ } TEST_F(SurfaceManagerRefTest, GarbageCollectionWorksRecusively) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); - SurfaceId id3 = CreateSurface(kFrameSink3, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id3 = CreateSurface(kFrameSink3, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -268,8 +270,8 @@ } TEST_F(SurfaceManagerRefTest, TryAddReferenceSameReferenceTwice) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); AddSurfaceReference(id1, id2); @@ -283,7 +285,7 @@ } TEST_F(SurfaceManagerRefTest, AddingSelfReferenceFails) { - SurfaceId id1 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink2, 1); // A temporary reference must exist to |id1|. EXPECT_THAT(GetAllTempReferences(), ElementsAre(id1)); @@ -301,8 +303,8 @@ } TEST_F(SurfaceManagerRefTest, RemovingNonexistantReferenceFails) { - SurfaceId id1 = CreateSurface(kFrameSink1, 1); - SurfaceId id2 = CreateSurface(kFrameSink2, 1); + viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); + viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); // Removing non-existent reference should be ignored. AddSurfaceReference(id1, id2); @@ -313,13 +315,13 @@ TEST_F(SurfaceManagerRefTest, AddSurfaceThenReference) { // Create a new surface. - const SurfaceId surface_id = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId surface_id = CreateSurface(kFrameSink2, 1); // A temporary reference must be added to |surface_id|. EXPECT_THAT(GetAllTempReferences(), ElementsAre(surface_id)); // Create |parent_id| and add a real reference from it to |surface_id|. - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(parent_id, surface_id); // The temporary reference to |surface_id| should be gone. @@ -331,7 +333,7 @@ TEST_F(SurfaceManagerRefTest, AddSurfaceThenRootReference) { // Create a new surface. - const SurfaceId surface_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId surface_id = CreateSurface(kFrameSink1, 1); // Temporary reference should be added to |surface_id|. EXPECT_THAT(GetAllTempReferences(), ElementsAre(surface_id)); @@ -348,15 +350,15 @@ TEST_F(SurfaceManagerRefTest, AddTwoSurfacesThenOneReference) { // Create two surfaces with different FrameSinkIds. - const SurfaceId surface_id1 = CreateSurface(kFrameSink2, 1); - const SurfaceId surface_id2 = CreateSurface(kFrameSink3, 1); + const viz::SurfaceId surface_id1 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId surface_id2 = CreateSurface(kFrameSink3, 1); // Temporary reference should be added for both surfaces. EXPECT_THAT(GetAllTempReferences(), UnorderedElementsAre(surface_id1, surface_id2)); // Create |parent_id| and add a real reference from it to |surface_id1|. - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(parent_id, surface_id1); // Real reference must be added to |surface_id1| and the temporary reference @@ -369,11 +371,11 @@ } TEST_F(SurfaceManagerRefTest, AddSurfacesSkipReference) { - // Add two surfaces that have the same FrameSinkId. This would happen when a - // client submits two CompositorFrames before parent submits a new + // Add two surfaces that have the same viz::FrameSinkId. This would happen + // when a client submits two CompositorFrames before parent submits a new // CompositorFrame. - const SurfaceId surface_id1 = CreateSurface(kFrameSink2, 2); - const SurfaceId surface_id2 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId surface_id1 = CreateSurface(kFrameSink2, 2); + const viz::SurfaceId surface_id2 = CreateSurface(kFrameSink2, 1); // Temporary references should be added for both surfaces and they should be // stored in the order of creation. @@ -382,7 +384,7 @@ // Create |parent_id| and add a reference from it to |surface_id2| which was // created later. - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(parent_id, surface_id2); // The real reference should be added for |surface_id2| and the temporary @@ -393,10 +395,10 @@ } TEST_F(SurfaceManagerRefTest, RemoveFirstTempReferenceOnly) { - // Add two surfaces that have the same FrameSinkId. This would happen when a - // client submits two CFs before parent submits a new CF. - const SurfaceId surface_id1 = CreateSurface(kFrameSink2, 1); - const SurfaceId surface_id2 = CreateSurface(kFrameSink2, 2); + // Add two surfaces that have the same viz::FrameSinkId. This would happen + // when a client submits two CFs before parent submits a new CF. + const viz::SurfaceId surface_id1 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId surface_id2 = CreateSurface(kFrameSink2, 2); // Temporary references should be added for both surfaces and they should be // stored in the order of creation. @@ -405,7 +407,7 @@ // Create |parent_id| and add a reference from it to |surface_id1| which was // created earlier. - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(parent_id, surface_id1); // The real reference should be added for |surface_id1| and its temporary @@ -417,12 +419,12 @@ } TEST_F(SurfaceManagerRefTest, SurfaceWithTemporaryReferenceIsNotDeleted) { - const SurfaceId id1 = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), id1); // We create |id2| and never add a real reference to it. This leaves the // temporary reference. - const SurfaceId id2 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId id2 = CreateSurface(kFrameSink2, 1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id2)); EXPECT_NE(nullptr, GetSurfaceManager().GetSurfaceForId(id2)); @@ -443,7 +445,7 @@ // invalidated then the temporary reference is also removed. TEST_F(SurfaceManagerRefTest, InvalidateTempReferenceOwnerRemovesReference) { // Surface |id1| should have a temporary reference on creation. - const SurfaceId id1 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId id1 = CreateSurface(kFrameSink2, 1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1)); // |id1| should have a temporary reference after an owner is assigned. @@ -458,10 +460,10 @@ // Checks that adding a surface reference clears the temporary reference and // ownership. Invalidating the old owner shouldn't do anything. TEST_F(SurfaceManagerRefTest, InvalidateHasNoEffectOnSurfaceReferences) { - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), parent_id); - const SurfaceId id1 = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId id1 = CreateSurface(kFrameSink2, 1); GetSurfaceManager().AssignTemporaryReference(id1, kFrameSink1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1)); @@ -477,7 +479,7 @@ } TEST_F(SurfaceManagerRefTest, CheckDropTemporaryReferenceWorks) { - const SurfaceId id1 = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId id1 = CreateSurface(kFrameSink1, 1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1)); // An example of why this could happen is the window server doesn't know the @@ -491,11 +493,11 @@ // are multiple temporary references. This tests something like the parent // client crashing, so it's TEST_F(SurfaceManagerRefTest, TempReferencesWithClientCrash) { - const SurfaceId parent_id = CreateSurface(kFrameSink1, 1); + const viz::SurfaceId parent_id = CreateSurface(kFrameSink1, 1); AddSurfaceReference(GetSurfaceManager().GetRootSurfaceId(), parent_id); - const SurfaceId id1a = CreateSurface(kFrameSink2, 1); - const SurfaceId id1b = CreateSurface(kFrameSink2, 2); + const viz::SurfaceId id1a = CreateSurface(kFrameSink2, 1); + const viz::SurfaceId id1b = CreateSurface(kFrameSink2, 2); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1a, id1b)); @@ -505,8 +507,8 @@ ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1a, id1b)); // If the parent client crashes then the FrameSink connection will be closed - // and the FrameSinkId invalidated. The temporary reference |kFrameSink1| owns - // to |id2a| will be removed. + // and the viz::FrameSinkId invalidated. The temporary reference |kFrameSink1| + // owns to |id2a| will be removed. DestroyCompositorFrameSinkSupport(kFrameSink1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1b));
diff --git a/cc/surfaces/surface_observer.h b/cc/surfaces/surface_observer.h index a8166a0..388e2b0 100644 --- a/cc/surfaces/surface_observer.h +++ b/cc/surfaces/surface_observer.h
@@ -5,11 +5,14 @@ #ifndef CC_SURFACES_SURFACE_OBSERVER_H_ #define CC_SURFACES_SURFACE_OBSERVER_H_ +namespace viz { +class SurfaceId; +} + namespace cc { struct BeginFrameAck; struct BeginFrameArgs; -class SurfaceId; class SurfaceInfo; class SurfaceObserver { @@ -19,7 +22,7 @@ virtual void OnSurfaceCreated(const SurfaceInfo& surface_info) = 0; // Runs when a Surface was marked to be destroyed. - virtual void OnSurfaceDestroyed(const SurfaceId& surface_id) = 0; + virtual void OnSurfaceDestroyed(const viz::SurfaceId& surface_id) = 0; // Runs when a Surface is modified, e.g. when a CompositorFrame is // activated, its producer confirms that no CompositorFrame will be submitted @@ -27,19 +30,19 @@ // // |ack.sequence_number| is only valid if called in response to a BeginFrame. // Should return true if this causes a Display to be damaged. - virtual bool OnSurfaceDamaged(const SurfaceId& surface_id, + virtual bool OnSurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) = 0; // Called when a surface is garbage-collected. - virtual void OnSurfaceDiscarded(const SurfaceId& surface_id) = 0; + virtual void OnSurfaceDiscarded(const viz::SurfaceId& surface_id) = 0; // Runs when a Surface's CompositorFrame producer has received a BeginFrame // and, thus, is expected to produce damage soon. - virtual void OnSurfaceDamageExpected(const SurfaceId& surface_id, + virtual void OnSurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args) = 0; // Runs when a surface has been added to the aggregated CompositorFrame. - virtual void OnSurfaceWillDraw(const SurfaceId& surface_id) = 0; + virtual void OnSurfaceWillDraw(const viz::SurfaceId& surface_id) = 0; }; } // namespace cc
diff --git a/cc/surfaces/surface_reference.cc b/cc/surfaces/surface_reference.cc index 5570fbfd..dd7ab2e 100644 --- a/cc/surfaces/surface_reference.cc +++ b/cc/surfaces/surface_reference.cc
@@ -10,8 +10,8 @@ SurfaceReference::SurfaceReference() = default; -SurfaceReference::SurfaceReference(const SurfaceId& parent_id, - const SurfaceId& child_id) +SurfaceReference::SurfaceReference(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id) : parent_id_(parent_id), child_id_(child_id) {} SurfaceReference::SurfaceReference(const SurfaceReference& other) = default;
diff --git a/cc/surfaces/surface_reference.h b/cc/surfaces/surface_reference.h index ac3bb77..cc483575 100644 --- a/cc/surfaces/surface_reference.h +++ b/cc/surfaces/surface_reference.h
@@ -8,7 +8,7 @@ #include <string> #include "base/hash.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "mojo/public/cpp/bindings/struct_traits.h" namespace cc { @@ -20,13 +20,14 @@ class SurfaceReference { public: SurfaceReference(); - SurfaceReference(const SurfaceId& parent_id, const SurfaceId& child_id); + SurfaceReference(const viz::SurfaceId& parent_id, + const viz::SurfaceId& child_id); SurfaceReference(const SurfaceReference& other); ~SurfaceReference(); - const SurfaceId& parent_id() const { return parent_id_; } - const SurfaceId& child_id() const { return child_id_; } + const viz::SurfaceId& parent_id() const { return parent_id_; } + const viz::SurfaceId& child_id() const { return child_id_; } size_t hash() const { return base::HashInts(static_cast<uint64_t>(parent_id_.hash()), @@ -52,8 +53,8 @@ friend struct mojo::StructTraits<mojom::SurfaceReferenceDataView, SurfaceReference>; - SurfaceId parent_id_; - SurfaceId child_id_; + viz::SurfaceId parent_id_; + viz::SurfaceId child_id_; }; struct SurfaceReferenceHash {
diff --git a/cc/surfaces/surface_reference_factory.h b/cc/surfaces/surface_reference_factory.h index c41b670f..966dc50 100644 --- a/cc/surfaces/surface_reference_factory.h +++ b/cc/surfaces/surface_reference_factory.h
@@ -7,8 +7,8 @@ #include "base/callback_forward.h" #include "base/memory/ref_counted.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference_owner.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -20,8 +20,9 @@ public: // Creates a reference to the surface with the given surface id and returns // a closure that must be called exactly once to remove the reference. - virtual base::Closure CreateReference(SurfaceReferenceOwner* owner, - const SurfaceId& surface_id) const = 0; + virtual base::Closure CreateReference( + SurfaceReferenceOwner* owner, + const viz::SurfaceId& surface_id) const = 0; SurfaceReferenceFactory() = default;
diff --git a/cc/surfaces/surface_sequence.h b/cc/surfaces/surface_sequence.h index 3437394..68ee2f8 100644 --- a/cc/surfaces/surface_sequence.h +++ b/cc/surfaces/surface_sequence.h
@@ -11,7 +11,7 @@ #include <tuple> #include "base/hash.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" namespace cc { @@ -20,11 +20,11 @@ // may be depended on once. struct SurfaceSequence { SurfaceSequence() : sequence(0u) {} - SurfaceSequence(const FrameSinkId& frame_sink_id, uint32_t sequence) + SurfaceSequence(const viz::FrameSinkId& frame_sink_id, uint32_t sequence) : frame_sink_id(frame_sink_id), sequence(sequence) {} bool is_valid() const { return frame_sink_id.is_valid() && sequence > 0u; } - FrameSinkId frame_sink_id; + viz::FrameSinkId frame_sink_id; uint32_t sequence; };
diff --git a/cc/surfaces/surface_sequence_generator.h b/cc/surfaces/surface_sequence_generator.h index c9d1e4a1..4426edc 100644 --- a/cc/surfaces/surface_sequence_generator.h +++ b/cc/surfaces/surface_sequence_generator.h
@@ -11,7 +11,7 @@ #include "base/macros.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" namespace cc { @@ -23,14 +23,14 @@ SurfaceSequenceGenerator(); ~SurfaceSequenceGenerator(); - void set_frame_sink_id(const FrameSinkId& frame_sink_id) { + void set_frame_sink_id(const viz::FrameSinkId& frame_sink_id) { frame_sink_id_ = frame_sink_id; } SurfaceSequence CreateSurfaceSequence(); private: - FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; uint32_t next_surface_sequence_; DISALLOW_COPY_AND_ASSIGN(SurfaceSequenceGenerator);
diff --git a/cc/surfaces/surface_sequence_generator_unittest.cc b/cc/surfaces/surface_sequence_generator_unittest.cc index b7946c61..18cbbca 100644 --- a/cc/surfaces/surface_sequence_generator_unittest.cc +++ b/cc/surfaces/surface_sequence_generator_unittest.cc
@@ -10,7 +10,7 @@ namespace cc { namespace { -static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); TEST(SurfaceSequenceGeneratorTest, Basic) { SurfaceSequenceGenerator generator;
diff --git a/cc/surfaces/surface_synchronization_unittest.cc b/cc/surfaces/surface_synchronization_unittest.cc index 12414a1..f9aad93 100644 --- a/cc/surfaces/surface_synchronization_unittest.cc +++ b/cc/surfaces/surface_synchronization_unittest.cc
@@ -5,12 +5,12 @@ #include "base/containers/flat_set.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/surface_id.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_external_begin_frame_source.h" #include "cc/test/fake_surface_observer.h" #include "cc/test/mock_compositor_frame_sink_support_client.h" +#include "components/viz/common/surface_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,20 +27,21 @@ constexpr bool kIsChildRoot = false; constexpr bool kHandlesFrameSinkIdInvalidation = true; constexpr bool kNeedsSyncPoints = true; -constexpr FrameSinkId kDisplayFrameSink(2, 0); -constexpr FrameSinkId kParentFrameSink(3, 0); -constexpr FrameSinkId kChildFrameSink1(65563, 0); -constexpr FrameSinkId kChildFrameSink2(65564, 0); -constexpr FrameSinkId kArbitraryFrameSink(1337, 7331); +constexpr viz::FrameSinkId kDisplayFrameSink(2, 0); +constexpr viz::FrameSinkId kParentFrameSink(3, 0); +constexpr viz::FrameSinkId kChildFrameSink1(65563, 0); +constexpr viz::FrameSinkId kChildFrameSink2(65564, 0); +constexpr viz::FrameSinkId kArbitraryFrameSink(1337, 7331); -std::vector<SurfaceId> empty_surface_ids() { - return std::vector<SurfaceId>(); +std::vector<viz::SurfaceId> empty_surface_ids() { + return std::vector<viz::SurfaceId>(); } -SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { - return SurfaceId( - frame_sink_id, - LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); +viz::SurfaceId MakeSurfaceId(const viz::FrameSinkId& frame_sink_id, + uint32_t local_id) { + return viz::SurfaceId( + frame_sink_id, viz::LocalSurfaceId( + local_id, base::UnguessableToken::Deserialize(0, 1u))); } } // namespace @@ -102,15 +103,15 @@ FrameSinkManager& frame_sink_manager() { return frame_sink_manager_; } // Returns all the references where |surface_id| is the parent. - const base::flat_set<SurfaceId>& GetChildReferences( - const SurfaceId& surface_id) { + const base::flat_set<viz::SurfaceId>& GetChildReferences( + const viz::SurfaceId& surface_id) { return frame_sink_manager() .surface_manager() ->GetSurfacesReferencedByParent(surface_id); } // Returns true if there is a temporary reference for |surface_id|. - bool HasTemporaryReference(const SurfaceId& surface_id) { + bool HasTemporaryReference(const viz::SurfaceId& surface_id) { return frame_sink_manager().surface_manager()->HasTemporaryReference( surface_id); } @@ -172,12 +173,12 @@ surface_observer_.Reset(); } - bool IsMarkedForDestruction(const SurfaceId& surface_id) { + bool IsMarkedForDestruction(const viz::SurfaceId& surface_id) { return frame_sink_manager_.surface_manager()->IsMarkedForDestruction( surface_id); } - Surface* GetSurfaceForId(const SurfaceId& surface_id) { + Surface* GetSurfaceForId(const viz::SurfaceId& surface_id) { return frame_sink_manager_.surface_manager()->GetSurfaceForId(surface_id); } @@ -196,10 +197,11 @@ }; // The display root surface should have a surface reference from the top-level -// root added/removed when a CompositorFrame is submitted with a new SurfaceId. +// root added/removed when a CompositorFrame is submitted with a new +// viz::SurfaceId. TEST_F(SurfaceSynchronizationTest, RootSurfaceReceivesReferences) { - const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2); + const viz::SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2); // Submit a CompositorFrame for the first display root surface. display_support().SubmitCompositorFrame(display_id_first.local_surface_id(), @@ -229,9 +231,9 @@ // The parent Surface is blocked on |child_id1| and |child_id2|. TEST_F(SurfaceSynchronizationTest, BlockedOnTwo) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); parent_support().SubmitCompositorFrame( parent_id.local_surface_id(), @@ -269,9 +271,9 @@ // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. TEST_F(SurfaceSynchronizationTest, BlockedChain) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); parent_support().SubmitCompositorFrame( parent_id.local_surface_id(), @@ -334,9 +336,9 @@ // parent_surface and child_surface1 are blocked on |child_id2|. TEST_F(SurfaceSynchronizationTest, TwoBlockedOnOne) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); parent_support().SubmitCompositorFrame( parent_id.local_surface_id(), @@ -387,9 +389,9 @@ // parent_surface is blocked on |child_id1|, and child_surface2 is blocked on // |child_id2| until the deadline hits. TEST_F(SurfaceSynchronizationTest, DeadlineHits) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); parent_support().SubmitCompositorFrame( parent_id.local_surface_id(), @@ -456,8 +458,8 @@ // This test verifies at the Surface activates once a CompositorFrame is // submitted that has no unresolved dependencies. TEST_F(SurfaceSynchronizationTest, NewFrameOverridesOldDependencies) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); // Submit a CompositorFrame that depends on |arbitrary_id|. parent_support().SubmitCompositorFrame( @@ -485,9 +487,9 @@ // references. A new surface from a child will continue to exist as a temporary // reference until the parent's frame activates. TEST_F(SurfaceSynchronizationTest, OnlyActiveFramesAffectSurfaceReferences) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); // child_support1 submits a CompositorFrame without any dependencies. // DidReceiveCompositorFrameAck should call on immediate activation. @@ -551,8 +553,8 @@ // CompositorFrame starts out as pending, then becomes active, and then is // replaced with another active CompositorFrame. TEST_F(SurfaceSynchronizationTest, ResourcesOnlyReturnedOnce) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); // The parent submits a CompositorFrame that depends on |child_id| before the // child submits a CompositorFrame. The CompositorFrame also has resources in @@ -609,9 +611,9 @@ // child_support1 evicts its blocked Surface. The parent surface should // activate. TEST_F(SurfaceSynchronizationTest, EvictSurfaceWithPendingFrame) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); // Submit a CompositorFrame that depends on |child_id1|. parent_support().SubmitCompositorFrame( @@ -654,9 +656,9 @@ // updated allowing garbage collection of surfaces that are no longer // referenced. TEST_F(SurfaceSynchronizationTest, DropStaleReferencesAfterActivation) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); // The parent submits a CompositorFrame that depends on |child_id1| before the // child submits a CompositorFrame. @@ -742,11 +744,11 @@ } // Checks whether the latency info are moved to the new surface from the old -// one when LocalSurfaceId changes. No frame has unresolved dependencies. +// one when viz::LocalSurfaceId changes. No frame has unresolved dependencies. TEST_F(SurfaceSynchronizationTest, LatencyInfoCarriedOverOnResize_NoUnresolvedDependencies) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); const ui::LatencyComponentType latency_type1 = ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; const int64_t latency_id1 = 234; @@ -772,7 +774,7 @@ EXPECT_FALSE(old_surface->HasPendingFrame()); // Submit another frame with some other latency info and a different - // LocalSurfaceId. + // viz::LocalSurfaceId. ui::LatencyInfo info2; info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2); @@ -812,12 +814,13 @@ } // Checks whether the latency info are moved to the new surface from the old -// one when LocalSurfaceId changes. Old surface has unresolved dependencies. +// one when viz::LocalSurfaceId changes. Old surface has unresolved +// dependencies. TEST_F(SurfaceSynchronizationTest, LatencyInfoCarriedOverOnResize_OldSurfaceHasPendingAndActiveFrame) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); const ui::LatencyComponentType latency_type1 = ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; @@ -889,12 +892,13 @@ } // Checks whether the latency info are moved to the new surface from the old -// one when LocalSurfaceId changes. The new surface has unresolved dependencies. +// one when viz::LocalSurfaceId changes. The new surface has unresolved +// dependencies. TEST_F(SurfaceSynchronizationTest, LatencyInfoCarriedOverOnResize_NewSurfaceHasPendingFrame) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); const ui::LatencyComponentType latency_type1 = ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; @@ -970,7 +974,7 @@ // Checks that resources and ack are sent together if possible. TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); TransferableResource resource; resource.id = 1234; parent_support().SubmitCompositorFrame( @@ -989,8 +993,8 @@ // Verifies that if a surface is marked destroyed and a new frame arrives for // it, it will be recovered. TEST_F(SurfaceSynchronizationTest, SurfaceResurrection) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); // Create the child surface by submitting a frame to it. EXPECT_EQ(nullptr, GetSurfaceForId(child_id)); @@ -1026,11 +1030,11 @@ EXPECT_FALSE(IsMarkedForDestruction(child_id)); } -// Verifies that if a LocalSurfaceId belonged to a surface that doesn't exist -// anymore, it can still be reused for new surfaces. +// Verifies that if a viz::LocalSurfaceId belonged to a surface that doesn't +// exist anymore, it can still be reused for new surfaces. TEST_F(SurfaceSynchronizationTest, LocalSurfaceIdIsReusable) { - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); // Submit the first frame. Creates the surface. child_support1().SubmitCompositorFrame(child_id.local_surface_id(), @@ -1066,10 +1070,10 @@ // by deadline, and the new subtree was activated by a dependency finally // resolving. TEST_F(SurfaceSynchronizationTest, DependencyTrackingGarbageCollection) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); parent_support().SubmitCompositorFrame( parent_id1.local_surface_id(), @@ -1125,10 +1129,10 @@ // from that subtree due to an unresolved dependency. This test verifies that // this dependency resolution does not crash. TEST_F(SurfaceSynchronizationTest, GarbageCollectionOnDeadline) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); // |parent_id1| is blocked on |child_id|. parent_support().SubmitCompositorFrame( @@ -1192,9 +1196,9 @@ // This test verifies that a CompositorFrame will only blocked on embedded // surfaces but not on other retained surface IDs in the CompositorFrame. TEST_F(SurfaceSynchronizationTest, OnlyBlockOnEmbeddedSurfaces) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); // Submitting a CompositorFrame with |parent_id2| so that the display // CompositorFrame can hold a reference to it. @@ -1232,9 +1236,9 @@ // This test verifies that a late arriving CompositorFrame activates immediately // and does not trigger a new deadline. TEST_F(SurfaceSynchronizationTest, LateArrivingDependency) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); display_support().SubmitCompositorFrame( display_id.local_surface_id(), @@ -1270,10 +1274,10 @@ // This test verifies that a late arriving CompositorFrame activates immediately // along with its subtree and does not trigger a new deadline. TEST_F(SurfaceSynchronizationTest, MultiLevelLateArrivingDependency) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); display_support().SubmitCompositorFrame( display_id.local_surface_id(), @@ -1325,11 +1329,11 @@ // by a parent CompositorFrame as a fallback will be rejected and ACK'ed // immediately. TEST_F(SurfaceSynchronizationTest, FallbackSurfacesClosed) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); // This is the fallback child surface that the parent holds a reference to. - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); // This is the primary child surface that the parent wants to block on. - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2); // child_support1 submits a CompositorFrame without any dependencies. // DidReceiveCompositorFrameAck should call on immediate activation. @@ -1404,10 +1408,10 @@ // This test verifies that two surface subtrees have independent deadlines. TEST_F(SurfaceSynchronizationTest, IndependentDeadlines) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); - const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); + const viz::SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); child_support1().SubmitCompositorFrame(child_id1.local_surface_id(), MakeCompositorFrame()); @@ -1483,9 +1487,9 @@ // This test verifies that a child inherits its deadline from its dependent // parent (embedder) surface. TEST_F(SurfaceSynchronizationTest, DeadlineInheritance) { - const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); + const viz::SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); parent_support().SubmitCompositorFrame( parent_id1.local_surface_id(), @@ -1531,10 +1535,10 @@ // ultimately inherit the same deadline even if the grandchild is available // before the child. TEST_F(SurfaceSynchronizationTest, MultiLevelDeadlineInheritance) { - const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); - const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); - const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); - const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); + const viz::SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); + const viz::SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); + const viz::SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); + const viz::SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); display_support().SubmitCompositorFrame( display_id.local_surface_id(),
diff --git a/cc/surfaces/surface_unittest.cc b/cc/surfaces/surface_unittest.cc index ff6316595..42439b9 100644 --- a/cc/surfaces/surface_unittest.cc +++ b/cc/surfaces/surface_unittest.cc
@@ -7,19 +7,19 @@ #include "cc/output/copy_output_result.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface_dependency_tracker.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/fake_external_begin_frame_source.h" #include "cc/test/scheduler_test_common.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/size.h" namespace cc { namespace { -constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); +constexpr viz::FrameSinkId kArbitraryFrameSinkId(1, 1); constexpr bool kIsRoot = true; constexpr bool kHandlesFrameSinkIdInvalidation = true; constexpr bool kNeedsSyncPoints = true; @@ -32,8 +32,8 @@ nullptr, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); - SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); + viz::LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); + viz::SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); support->SubmitCompositorFrame(local_surface_id, test::MakeCompositorFrame()); EXPECT_TRUE(surface_manager->GetSurfaceForId(surface_id)); support->EvictCurrentSurface(); @@ -43,9 +43,9 @@ TEST(SurfaceTest, SurfaceIds) { for (size_t i = 0; i < 3; ++i) { - LocalSurfaceIdAllocator allocator; - LocalSurfaceId id1 = allocator.GenerateId(); - LocalSurfaceId id2 = allocator.GenerateId(); + viz::LocalSurfaceIdAllocator allocator; + viz::LocalSurfaceId id1 = allocator.GenerateId(); + viz::LocalSurfaceId id2 = allocator.GenerateId(); EXPECT_NE(id1, id2); } } @@ -65,8 +65,8 @@ nullptr, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); - SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); + viz::LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); + viz::SurfaceId surface_id(kArbitraryFrameSinkId, local_surface_id); CompositorFrame frame = test::MakeCompositorFrame(); support->SubmitCompositorFrame(local_surface_id, std::move(frame)); Surface* surface = surface_manager->GetSurfaceForId(surface_id);
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc index aabb74a..f002c9c6 100644 --- a/cc/surfaces/surfaces_pixeltest.cc +++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -8,13 +8,13 @@ #include "cc/quads/surface_draw_quad.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_aggregator.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/compositor_frame_helpers.h" #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "testing/gtest/include/gtest/gtest.h" #if !defined(OS_ANDROID) @@ -22,10 +22,10 @@ namespace cc { namespace { -constexpr FrameSinkId kArbitraryRootFrameSinkId(1, 1); -constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2); -constexpr FrameSinkId kArbitraryLeftFrameSinkId(3, 3); -constexpr FrameSinkId kArbitraryRightFrameSinkId(4, 4); +constexpr viz::FrameSinkId kArbitraryRootFrameSinkId(1, 1); +constexpr viz::FrameSinkId kArbitraryChildFrameSinkId(2, 2); +constexpr viz::FrameSinkId kArbitraryLeftFrameSinkId(3, 3); +constexpr viz::FrameSinkId kArbitraryRightFrameSinkId(4, 4); constexpr bool kIsRoot = true; constexpr bool kIsChildRoot = false; constexpr bool kHandlesFrameSinkIdInvalidation = true; @@ -45,7 +45,7 @@ protected: FrameSinkManager manager_; - LocalSurfaceIdAllocator allocator_; + viz::LocalSurfaceIdAllocator allocator_; std::unique_ptr<CompositorFrameSinkSupport> support_; }; @@ -87,8 +87,9 @@ CompositorFrame root_frame = test::MakeCompositorFrame(); root_frame.render_pass_list.push_back(std::move(pass)); - LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id); + viz::LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id); support_->SubmitCompositorFrame(root_local_surface_id, std::move(root_frame)); SurfaceAggregator aggregator(manager_.surface_manager(), @@ -111,11 +112,12 @@ nullptr, &manager_, kArbitraryChildFrameSinkId, kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); - SurfaceId child_surface_id(child_support->frame_sink_id(), - child_local_surface_id); - LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id); + viz::LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId child_surface_id(child_support->frame_sink_id(), + child_local_surface_id); + viz::LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id); { gfx::Rect rect(device_viewport_size_); @@ -207,13 +209,15 @@ CompositorFrameSinkSupport::Create( nullptr, &manager_, kArbitraryRightFrameSinkId, kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); - LocalSurfaceId left_child_local_id = allocator_.GenerateId(); - SurfaceId left_child_id(left_support->frame_sink_id(), left_child_local_id); - LocalSurfaceId right_child_local_id = allocator_.GenerateId(); - SurfaceId right_child_id(right_support->frame_sink_id(), - right_child_local_id); - LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); - SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id); + viz::LocalSurfaceId left_child_local_id = allocator_.GenerateId(); + viz::SurfaceId left_child_id(left_support->frame_sink_id(), + left_child_local_id); + viz::LocalSurfaceId right_child_local_id = allocator_.GenerateId(); + viz::SurfaceId right_child_id(right_support->frame_sink_id(), + right_child_local_id); + viz::LocalSurfaceId root_local_surface_id = allocator_.GenerateId(); + viz::SurfaceId root_surface_id(support_->frame_sink_id(), + root_local_surface_id); { gfx::Rect rect(device_viewport_size_);
diff --git a/cc/test/DEPS b/cc/test/DEPS index e32f5a41..13ff54e 100644 --- a/cc/test/DEPS +++ b/cc/test/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+components/viz/common", "+gpu/command_buffer/client/gl_in_process_context.h", "+gpu/command_buffer/client/gles2_implementation.h", "+gpu/command_buffer/client/gles2_interface_stub.h",
diff --git a/cc/test/compositor_frame_helpers.cc b/cc/test/compositor_frame_helpers.cc index 7db4647..646ffb8 100644 --- a/cc/test/compositor_frame_helpers.cc +++ b/cc/test/compositor_frame_helpers.cc
@@ -28,8 +28,8 @@ } CompositorFrame MakeCompositorFrame( - std::vector<SurfaceId> activation_dependencies, - std::vector<SurfaceId> referenced_surfaces, + std::vector<viz::SurfaceId> activation_dependencies, + std::vector<viz::SurfaceId> referenced_surfaces, std::vector<TransferableResource> resource_list) { CompositorFrame compositor_frame = test::MakeCompositorFrame(); compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
diff --git a/cc/test/compositor_frame_helpers.h b/cc/test/compositor_frame_helpers.h index 9894910b..f7001261 100644 --- a/cc/test/compositor_frame_helpers.h +++ b/cc/test/compositor_frame_helpers.h
@@ -8,7 +8,7 @@ #include <vector> #include "cc/resources/transferable_resource.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -24,8 +24,8 @@ CompositorFrame MakeEmptyCompositorFrame(); CompositorFrame MakeCompositorFrame( - std::vector<SurfaceId> activation_dependencies, - std::vector<SurfaceId> referenced_surfaces, + std::vector<viz::SurfaceId> activation_dependencies, + std::vector<viz::SurfaceId> referenced_surfaces, std::vector<TransferableResource> resource_list); } // namespace test
diff --git a/cc/test/fake_compositor_frame_sink_support_client.cc b/cc/test/fake_compositor_frame_sink_support_client.cc index ff3568d..e6b7452f 100644 --- a/cc/test/fake_compositor_frame_sink_support_client.cc +++ b/cc/test/fake_compositor_frame_sink_support_client.cc
@@ -27,7 +27,7 @@ } void FakeCompositorFrameSinkSupportClient::WillDrawSurface( - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) { last_local_surface_id_ = local_surface_id; last_damage_rect_ = damage_rect;
diff --git a/cc/test/fake_compositor_frame_sink_support_client.h b/cc/test/fake_compositor_frame_sink_support_client.h index 31d9804..462b988 100644 --- a/cc/test/fake_compositor_frame_sink_support_client.h +++ b/cc/test/fake_compositor_frame_sink_support_client.h
@@ -6,7 +6,7 @@ #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_SUPPORT_CLIENT_H_ #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "ui/gfx/geometry/rect.h" namespace cc { @@ -23,11 +23,11 @@ void OnBeginFrame(const BeginFrameArgs& args) override; void ReclaimResources( const std::vector<ReturnedResource>& resources) override; - void WillDrawSurface(const LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; const gfx::Rect& last_damage_rect() const { return last_damage_rect_; } - const LocalSurfaceId& last_local_surface_id() const { + const viz::LocalSurfaceId& last_local_surface_id() const { return last_local_surface_id_; } const std::vector<ReturnedResource>& returned_resources() const { @@ -36,7 +36,7 @@ private: gfx::Rect last_damage_rect_; - LocalSurfaceId last_local_surface_id_; + viz::LocalSurfaceId last_local_surface_id_; std::vector<ReturnedResource> returned_resources_; DISALLOW_COPY_AND_ASSIGN(FakeCompositorFrameSinkSupportClient);
diff --git a/cc/test/fake_surface_observer.cc b/cc/test/fake_surface_observer.cc index d5bb3ed7..6408037 100644 --- a/cc/test/fake_surface_observer.cc +++ b/cc/test/fake_surface_observer.cc
@@ -16,19 +16,20 @@ damaged_surfaces_.clear(); will_draw_surfaces_.clear(); last_surface_info_ = SurfaceInfo(); - last_created_surface_id_ = SurfaceId(); + last_created_surface_id_ = viz::SurfaceId(); } -bool FakeSurfaceObserver::IsSurfaceDamaged(const SurfaceId& surface_id) const { +bool FakeSurfaceObserver::IsSurfaceDamaged( + const viz::SurfaceId& surface_id) const { return damaged_surfaces_.count(surface_id) > 0; } bool FakeSurfaceObserver::SurfaceWillDrawCalled( - const SurfaceId& surface_id) const { + const viz::SurfaceId& surface_id) const { return will_draw_surfaces_.count(surface_id) > 0; } -bool FakeSurfaceObserver::OnSurfaceDamaged(const SurfaceId& surface_id, +bool FakeSurfaceObserver::OnSurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) { if (ack.has_damage) damaged_surfaces_.insert(surface_id); @@ -36,7 +37,7 @@ return ack.has_damage && damage_display_; } -void FakeSurfaceObserver::OnSurfaceWillDraw(const SurfaceId& surface_id) { +void FakeSurfaceObserver::OnSurfaceWillDraw(const viz::SurfaceId& surface_id) { will_draw_surfaces_.insert(surface_id); }
diff --git a/cc/test/fake_surface_observer.h b/cc/test/fake_surface_observer.h index 0ce2c23d..1472b94 100644 --- a/cc/test/fake_surface_observer.h +++ b/cc/test/fake_surface_observer.h
@@ -7,9 +7,9 @@ #include "base/containers/flat_set.h" #include "cc/output/begin_frame_args.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" #include "cc/surfaces/surface_observer.h" +#include "components/viz/common/surface_id.h" namespace cc { @@ -22,11 +22,11 @@ const BeginFrameAck& last_ack() const { return last_ack_; } - bool IsSurfaceDamaged(const SurfaceId& surface_id) const; + bool IsSurfaceDamaged(const viz::SurfaceId& surface_id) const; - bool SurfaceWillDrawCalled(const SurfaceId& surface_id) const; + bool SurfaceWillDrawCalled(const viz::SurfaceId& surface_id) const; - const SurfaceId& last_created_surface_id() const { + const viz::SurfaceId& last_created_surface_id() const { return last_created_surface_id_; } @@ -36,20 +36,20 @@ private: // SurfaceObserver implementation: - bool OnSurfaceDamaged(const SurfaceId& surface_id, + bool OnSurfaceDamaged(const viz::SurfaceId& surface_id, const BeginFrameAck& ack) override; void OnSurfaceCreated(const SurfaceInfo& surface_info) override; - void OnSurfaceDiscarded(const SurfaceId& surface_id) override {} - void OnSurfaceDestroyed(const SurfaceId& surface_id) override {} - void OnSurfaceDamageExpected(const SurfaceId& surface_id, + void OnSurfaceDiscarded(const viz::SurfaceId& surface_id) override {} + void OnSurfaceDestroyed(const viz::SurfaceId& surface_id) override {} + void OnSurfaceDamageExpected(const viz::SurfaceId& surface_id, const BeginFrameArgs& args) override {} - void OnSurfaceWillDraw(const SurfaceId& surface_id) override; + void OnSurfaceWillDraw(const viz::SurfaceId& surface_id) override; bool damage_display_; BeginFrameAck last_ack_; - base::flat_set<SurfaceId> damaged_surfaces_; - base::flat_set<SurfaceId> will_draw_surfaces_; - SurfaceId last_created_surface_id_; + base::flat_set<viz::SurfaceId> damaged_surfaces_; + base::flat_set<viz::SurfaceId> will_draw_surfaces_; + viz::SurfaceId last_created_surface_id_; SurfaceInfo last_surface_info_; };
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 915a95d..029a2bcb 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -16,7 +16,6 @@ #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" #include "cc/output/software_output_device.h" -#include "cc/resources/texture_mailbox.h" #include "cc/test/paths.h" #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test_output_surface.h" @@ -24,6 +23,7 @@ #include "cc/test/test_in_process_context_provider.h" #include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/ipc/gl_in_process_context.h" @@ -134,7 +134,7 @@ // Drop TextureMailboxes on the main thread so that they can be cleaned up and // the pending callbacks will fire. for (size_t i = 0; i < texture_layers_.size(); ++i) { - texture_layers_[i]->SetTextureMailbox(TextureMailbox(), nullptr); + texture_layers_[i]->SetTextureMailbox(viz::TextureMailbox(), nullptr); } TryEndTest(); @@ -225,7 +225,7 @@ std::unique_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( const gfx::Size& size, - const TextureMailbox& texture_mailbox) { + const viz::TextureMailbox& texture_mailbox) { DCHECK(texture_mailbox.IsTexture()); if (!texture_mailbox.IsTexture()) return nullptr;
diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index 5b2c7bb..b1a6b0216 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h
@@ -16,13 +16,16 @@ class SkBitmap; +namespace viz { +class TextureMailbox; +} + namespace cc { class CopyOutputRequest; class CopyOutputResult; class PixelComparator; class SolidColorLayer; class TextureLayer; -class TextureMailbox; class LayerTreePixelTest : public LayerTreeTest { public: @@ -79,7 +82,7 @@ std::unique_ptr<SkBitmap> CopyTextureMailboxToBitmap( const gfx::Size& size, - const TextureMailbox& texture_mailbox); + const viz::TextureMailbox& texture_mailbox); void Finish();
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index af95a2e..415aa14b 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc
@@ -479,7 +479,7 @@ std::move(compositor_context_provider)); } void DisplayReceivedLocalSurfaceId( - const LocalSurfaceId& local_surface_id) override { + const viz::LocalSurfaceId& local_surface_id) override { hooks_->DisplayReceivedLocalSurfaceIdOnThread(local_surface_id); } void DisplayReceivedCompositorFrame(const CompositorFrame& frame) override { @@ -575,7 +575,7 @@ } void LayerTreeTest::PostSetLocalSurfaceIdToMainThread( - const LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { main_task_runner_->PostTask( FROM_HERE, base::BindOnce(&LayerTreeTest::DispatchSetLocalSurfaceId, main_thread_weak_ptr_, local_surface_id)); @@ -752,7 +752,7 @@ } void LayerTreeTest::DispatchSetLocalSurfaceId( - const LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { DCHECK(main_task_runner_->BelongsToCurrentThread()); if (layer_tree_host_) layer_tree_host_->SetLocalSurfaceId(local_surface_id);
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 6695daab..8b521b7 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h
@@ -75,7 +75,7 @@ void PostAddLongAnimationToMainThreadPlayer( AnimationPlayer* player_to_receive_animation); void PostSetLocalSurfaceIdToMainThread( - const LocalSurfaceId& local_surface_id); + const viz::LocalSurfaceId& local_surface_id); void PostSetDeferCommitsToMainThread(bool defer_commits); void PostSetNeedsCommitToMainThread(); void PostSetNeedsUpdateLayersToMainThread(); @@ -161,7 +161,7 @@ virtual void DispatchAddAnimationToPlayer( AnimationPlayer* player_to_receive_animation, double animation_duration); - void DispatchSetLocalSurfaceId(const LocalSurfaceId& local_surface_id); + void DispatchSetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id); void DispatchSetDeferCommits(bool defer_commits); void DispatchSetNeedsCommit(); void DispatchSetNeedsUpdateLayers();
diff --git a/cc/test/mock_compositor_frame_sink_support_client.cc b/cc/test/mock_compositor_frame_sink_support_client.cc index 758c87d8..7d6fa17 100644 --- a/cc/test/mock_compositor_frame_sink_support_client.cc +++ b/cc/test/mock_compositor_frame_sink_support_client.cc
@@ -5,7 +5,7 @@ #include "cc/test/mock_compositor_frame_sink_support_client.h" #include "cc/output/begin_frame_args.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "ui/gfx/geometry/rect.h" namespace cc {
diff --git a/cc/test/mock_compositor_frame_sink_support_client.h b/cc/test/mock_compositor_frame_sink_support_client.h index 6230223..6f59c4a 100644 --- a/cc/test/mock_compositor_frame_sink_support_client.h +++ b/cc/test/mock_compositor_frame_sink_support_client.h
@@ -22,7 +22,8 @@ void(const std::vector<ReturnedResource>&)); MOCK_METHOD1(OnBeginFrame, void(const BeginFrameArgs&)); MOCK_METHOD1(ReclaimResources, void(const std::vector<ReturnedResource>&)); - MOCK_METHOD2(WillDrawSurface, void(const LocalSurfaceId&, const gfx::Rect&)); + MOCK_METHOD2(WillDrawSurface, + void(const viz::LocalSurfaceId&, const gfx::Rect&)); }; } // namespace test
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 1f6639cb..6d60a3b 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc
@@ -155,7 +155,8 @@ memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); std::unique_ptr<SingleReleaseCallbackImpl> callback = SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, kSyncTokenForMailboxTextureQuad, target); + viz::TextureMailbox mailbox(gpu_mailbox, kSyncTokenForMailboxTextureQuad, + target); ResourceId resource8 = resource_provider->CreateResourceFromTextureMailbox( mailbox, std::move(callback)); resource_provider->AllocateForTesting(resource8);
diff --git a/cc/test/surface_aggregator_test_helpers.cc b/cc/test/surface_aggregator_test_helpers.cc index 0abd28d..4c17955 100644 --- a/cc/test/surface_aggregator_test_helpers.cc +++ b/cc/test/surface_aggregator_test_helpers.cc
@@ -25,8 +25,8 @@ void AddSurfaceQuad(RenderPass* pass, const gfx::Size& surface_size, float opacity, - const SurfaceId& primary_surface_id, - const SurfaceId& fallback_surface_id) { + const viz::SurfaceId& primary_surface_id, + const viz::SurfaceId& fallback_surface_id) { gfx::Transform layer_to_target_transform; gfx::Size layer_bounds = surface_size; gfx::Rect visible_layer_rect = gfx::Rect(surface_size);
diff --git a/cc/test/surface_aggregator_test_helpers.h b/cc/test/surface_aggregator_test_helpers.h index 22af9a6..cae3f03d 100644 --- a/cc/test/surface_aggregator_test_helpers.h +++ b/cc/test/surface_aggregator_test_helpers.h
@@ -11,7 +11,7 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/render_pass.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/geometry/size.h" @@ -32,8 +32,8 @@ return quad; } - static Quad SurfaceQuad(const SurfaceId& primary_surface_id, - const SurfaceId& fallback_surface_id, + static Quad SurfaceQuad(const viz::SurfaceId& primary_surface_id, + const viz::SurfaceId& fallback_surface_id, float opacity) { Quad quad; quad.material = DrawQuad::SURFACE_CONTENT; @@ -52,8 +52,8 @@ DrawQuad::Material material; // Set when material==DrawQuad::SURFACE_CONTENT. - SurfaceId primary_surface_id; - SurfaceId fallback_surface_id; + viz::SurfaceId primary_surface_id; + viz::SurfaceId fallback_surface_id; float opacity; // Set when material==DrawQuad::SOLID_COLOR. SkColor color;
diff --git a/cc/test/surface_hittest_test_helpers.cc b/cc/test/surface_hittest_test_helpers.cc index ed737fd..a2a48fa 100644 --- a/cc/test/surface_hittest_test_helpers.cc +++ b/cc/test/surface_hittest_test_helpers.cc
@@ -51,7 +51,7 @@ const gfx::Transform& transform, const gfx::Rect& root_rect, const gfx::Rect& quad_rect, - SurfaceId surface_id) { + viz::SurfaceId surface_id) { CreateSharedQuadState(pass, transform, root_rect); SurfaceDrawQuad* surface_quad = pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); @@ -85,13 +85,13 @@ TestSurfaceHittestDelegate::~TestSurfaceHittestDelegate() {} void TestSurfaceHittestDelegate::AddInsetsForRejectSurface( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, const gfx::Insets& inset) { insets_for_reject_.insert(std::make_pair(surface_id, inset)); } void TestSurfaceHittestDelegate::AddInsetsForAcceptSurface( - const SurfaceId& surface_id, + const viz::SurfaceId& surface_id, const gfx::Insets& inset) { insets_for_accept_.insert(std::make_pair(surface_id, inset)); }
diff --git a/cc/test/surface_hittest_test_helpers.h b/cc/test/surface_hittest_test_helpers.h index 6ec3c36c3..8197fe5 100644 --- a/cc/test/surface_hittest_test_helpers.h +++ b/cc/test/surface_hittest_test_helpers.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "cc/quads/render_pass.h" #include "cc/surfaces/surface_hittest_delegate.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "ui/gfx/geometry/insets.h" namespace gfx { @@ -43,7 +43,7 @@ const gfx::Transform& transform, const gfx::Rect& root_rect, const gfx::Rect& quad_rect, - SurfaceId surface_id); + viz::SurfaceId surface_id); void CreateRenderPass(int render_pass_id, const gfx::Rect& rect, @@ -64,9 +64,9 @@ int reject_target_overrides() const { return reject_target_overrides_; } int accept_target_overrides() const { return accept_target_overrides_; } - void AddInsetsForRejectSurface(const SurfaceId& surface_id, + void AddInsetsForRejectSurface(const viz::SurfaceId& surface_id, const gfx::Insets& inset); - void AddInsetsForAcceptSurface(const SurfaceId& surface_id, + void AddInsetsForAcceptSurface(const viz::SurfaceId& surface_id, const gfx::Insets& inset); // SurfaceHittestDelegate implementation. @@ -78,8 +78,8 @@ private: int reject_target_overrides_; int accept_target_overrides_; - std::map<SurfaceId, gfx::Insets> insets_for_reject_; - std::map<SurfaceId, gfx::Insets> insets_for_accept_; + std::map<viz::SurfaceId, gfx::Insets> insets_for_reject_; + std::map<viz::SurfaceId, gfx::Insets> insets_for_accept_; DISALLOW_COPY_AND_ASSIGN(TestSurfaceHittestDelegate); };
diff --git a/cc/test/test_hooks.h b/cc/test/test_hooks.h index a143805..c2cc40fb 100644 --- a/cc/test/test_hooks.h +++ b/cc/test/test_hooks.h
@@ -76,7 +76,7 @@ // DrawLayersOnThread() instead. For that reason these methods do not receive // a LayerTreeHostImpl pointer. virtual void DisplayReceivedLocalSurfaceIdOnThread( - const LocalSurfaceId& local_surface_id) {} + const viz::LocalSurfaceId& local_surface_id) {} virtual void DisplayReceivedCompositorFrameOnThread( const CompositorFrame& frame) {} virtual void DisplayWillDrawAndSwapOnThread(
diff --git a/cc/test/test_layer_tree_frame_sink.cc b/cc/test/test_layer_tree_frame_sink.cc index f671f4c..246e84d 100644 --- a/cc/test/test_layer_tree_frame_sink.cc +++ b/cc/test/test_layer_tree_frame_sink.cc
@@ -19,7 +19,7 @@ namespace cc { -static constexpr FrameSinkId kLayerTreeFrameSinkId(1, 1); +static constexpr viz::FrameSinkId kLayerTreeFrameSinkId(1, 1); TestLayerTreeFrameSink::TestLayerTreeFrameSink( scoped_refptr<ContextProvider> compositor_context_provider, @@ -42,7 +42,7 @@ task_runner_(std::move(task_runner)), frame_sink_id_(kLayerTreeFrameSinkId), frame_sink_manager_(new FrameSinkManager), - local_surface_id_allocator_(new LocalSurfaceIdAllocator), + local_surface_id_allocator_(new viz::LocalSurfaceIdAllocator), external_begin_frame_source_(this), weak_ptr_factory_(this) { // Always use sync tokens so that code paths in resource provider that deal @@ -127,7 +127,7 @@ } void TestLayerTreeFrameSink::SetLocalSurfaceId( - const LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { test_client_->DisplayReceivedLocalSurfaceId(local_surface_id); } @@ -194,7 +194,7 @@ } void TestLayerTreeFrameSink::WillDrawSurface( - const LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} void TestLayerTreeFrameSink::DisplayOutputSurfaceLost() {
diff --git a/cc/test/test_layer_tree_frame_sink.h b/cc/test/test_layer_tree_frame_sink.h index c877674..2f0f5dde 100644 --- a/cc/test/test_layer_tree_frame_sink.h +++ b/cc/test/test_layer_tree_frame_sink.h
@@ -14,7 +14,7 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/display_client.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" namespace base { class SingleThreadTaskRunner; @@ -35,7 +35,7 @@ scoped_refptr<ContextProvider> compositor_context_provider) = 0; virtual void DisplayReceivedLocalSurfaceId( - const LocalSurfaceId& local_surface_id) = 0; + const viz::LocalSurfaceId& local_surface_id) = 0; virtual void DisplayReceivedCompositorFrame(const CompositorFrame& frame) = 0; virtual void DisplayWillDrawAndSwap(bool will_draw_and_swap, const RenderPassList& render_passes) = 0; @@ -78,7 +78,7 @@ // LayerTreeFrameSink implementation. bool BindToClient(LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; - void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) override; + void SetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id) override; void SubmitCompositorFrame(CompositorFrame frame) override; void DidNotProduceFrame(const BeginFrameAck& ack) override; @@ -88,7 +88,7 @@ void OnBeginFrame(const BeginFrameArgs& args) override; void ReclaimResources( const std::vector<ReturnedResource>& resources) override; - void WillDrawSurface(const LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; // DisplayClient implementation. @@ -110,12 +110,12 @@ scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; // TODO(danakj): These don't need to be stored in unique_ptrs when // LayerTreeFrameSink is owned/destroyed on the compositor thread. std::unique_ptr<FrameSinkManager> frame_sink_manager_; - std::unique_ptr<LocalSurfaceIdAllocator> local_surface_id_allocator_; - LocalSurfaceId local_surface_id_; + std::unique_ptr<viz::LocalSurfaceIdAllocator> local_surface_id_allocator_; + viz::LocalSurfaceId local_surface_id_; gfx::Size display_size_; float device_scale_factor_ = 0;
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 3ab29fa..39c74932 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -241,7 +241,7 @@ return settings_; } -void LayerTreeHost::SetFrameSinkId(const FrameSinkId& frame_sink_id) { +void LayerTreeHost::SetFrameSinkId(const viz::FrameSinkId& frame_sink_id) { surface_sequence_generator_.set_frame_sink_id(frame_sink_id); } @@ -373,9 +373,7 @@ // Animation::InEffect and we want the old InEffect value for updating // property tree scrolling and animation. // TODO(pdr): Enforce this comment with DCHECKS and a lifecycle state. - bool is_impl_side_update = false; - sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread( - is_impl_side_update); + sync_tree->UpdatePropertyTreeAnimationFromMainThread(); TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); DCHECK(host_impl->mutator_host()); @@ -1110,7 +1108,8 @@ SetNeedsCommit(); } -void LayerTreeHost::SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) { +void LayerTreeHost::SetLocalSurfaceId( + const viz::LocalSurfaceId& local_surface_id) { if (local_surface_id_ == local_surface_id) return; local_surface_id_ = local_surface_id; @@ -1161,12 +1160,12 @@ return did_paint_content; } -void LayerTreeHost::AddSurfaceLayerId(const SurfaceId& surface_id) { +void LayerTreeHost::AddSurfaceLayerId(const viz::SurfaceId& surface_id) { if (++surface_layer_ids_[surface_id] == 1) needs_surface_ids_sync_ = true; } -void LayerTreeHost::RemoveSurfaceLayerId(const SurfaceId& surface_id) { +void LayerTreeHost::RemoveSurfaceLayerId(const viz::SurfaceId& surface_id) { auto iter = surface_layer_ids_.find(surface_id); if (iter == surface_layer_ids_.end()) return; @@ -1177,8 +1176,8 @@ } } -base::flat_set<SurfaceId> LayerTreeHost::SurfaceLayerIds() const { - base::flat_set<SurfaceId> ids; +base::flat_set<viz::SurfaceId> LayerTreeHost::SurfaceLayerIds() const { + base::flat_set<viz::SurfaceId> ids; for (auto& map_entry : surface_layer_ids_) ids.insert(map_entry.first); return ids;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 1ef7a20..a253e3e 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -112,9 +112,9 @@ // Returns the settings used by this host. const LayerTreeSettings& GetSettings() const; - // Sets the client id used to generate the SurfaceId that uniquely identifies - // the Surfaces produced by this compositor. - void SetFrameSinkId(const FrameSinkId& frame_sink_id); + // Sets the client id used to generate the viz::SurfaceId that uniquely + // identifies the Surfaces produced by this compositor. + void SetFrameSinkId(const viz::FrameSinkId& frame_sink_id); // Sets the LayerTreeMutator interface used to directly mutate the compositor // state on the compositor thread. (Compositor-Worker) @@ -325,10 +325,12 @@ void SetContentSourceId(uint32_t); uint32_t content_source_id() const { return content_source_id_; } - // If this LayerTreeHost needs a valid LocalSurfaceId then commits will be - // deferred until a valid LocalSurfaceId is provided. - void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id); - const LocalSurfaceId& local_surface_id() const { return local_surface_id_; } + // If this LayerTreeHost needs a valid viz::LocalSurfaceId then commits will + // be deferred until a valid viz::LocalSurfaceId is provided. + void SetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id); + const viz::LocalSurfaceId& local_surface_id() const { + return local_surface_id_; + } void SetRasterColorSpace(const gfx::ColorSpace& raster_color_space); const gfx::ColorSpace& raster_color_space() const { @@ -356,9 +358,9 @@ void SetHasCopyRequest(bool has_copy_request); bool has_copy_request() const { return has_copy_request_; } - void AddSurfaceLayerId(const SurfaceId& surface_id); - void RemoveSurfaceLayerId(const SurfaceId& surface_id); - base::flat_set<SurfaceId> SurfaceLayerIds() const; + void AddSurfaceLayerId(const viz::SurfaceId& surface_id); + void RemoveSurfaceLayerId(const viz::SurfaceId& surface_id); + base::flat_set<viz::SurfaceId> SurfaceLayerIds() const; void AddLayerShouldPushProperties(Layer* layer); void RemoveLayerShouldPushProperties(Layer* layer); @@ -604,7 +606,7 @@ gfx::ColorSpace raster_color_space_; uint32_t content_source_id_; - LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; bool defer_commits_ = false; SkColor background_color_ = SK_ColorWHITE; @@ -630,8 +632,8 @@ scoped_refptr<HeadsUpDisplayLayer> hud_layer_; - // The number of SurfaceLayers that have fallback set to SurfaceId. - base::flat_map<SurfaceId, int> surface_layer_ids_; + // The number of SurfaceLayers that have fallback set to viz::SurfaceId. + base::flat_map<viz::SurfaceId, int> surface_layer_ids_; // Set of layers that need to push properties. std::unordered_set<Layer*> layers_that_should_push_properties_;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 63d133c..5180d53e 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -1089,18 +1089,6 @@ if (!CommitToActiveTree()) CreatePendingTree(); - // The state of PropertyTrees on the recycle tree can be stale if scrolling - // and animation updates were made on the active tree, since these are not - // replicated on the recycle tree. We use the function below to handle the - // similar case for updates from the main thread not being in sync with - // changes made on the active tree. - // Note that while in practice only the scroll state should need to be - // updated, since the animation state is updated both on the recycle and - // active tree. We use the same function as for main thread commits for - // consistency. - bool is_impl_side_update = true; - sync_tree()->UpdatePropertyTreeScrollingAndAnimationFromMainThread( - is_impl_side_update); UpdateSyncTreeAfterCommitOrImplSideInvalidation(); } @@ -1767,8 +1755,8 @@ resource_provider_->PrepareSendToParent(resources, &compositor_frame.resource_list); compositor_frame.render_pass_list = std::move(frame->render_passes); - // TODO(fsamuel): Once all clients get their LocalSurfaceId from their parent, - // the LocalSurfaceId should hang off CompositorFrameMetadata. + // TODO(fsamuel): Once all clients get their viz::LocalSurfaceId from their + // parent, the viz::LocalSurfaceId should hang off CompositorFrameMetadata. if (settings_.enable_surface_synchronization && active_tree()->local_surface_id().is_valid()) { layer_tree_frame_sink_->SetLocalSurfaceId(
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index a4c481a..a05cde9 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -36,8 +36,6 @@ #include "cc/scheduler/commit_earlyout_reason.h" #include "cc/scheduler/draw_result.h" #include "cc/scheduler/video_frame_controller.h" -#include "cc/surfaces/local_surface_id.h" -#include "cc/surfaces/surface_id.h" #include "cc/tiles/decoded_image_tracker.h" #include "cc/tiles/image_decode_cache.h" #include "cc/tiles/tile_manager.h" @@ -45,6 +43,8 @@ #include "cc/trees/layer_tree_settings.h" #include "cc/trees/mutator_host_client.h" #include "cc/trees/task_runner_provider.h" +#include "components/viz/common/local_surface_id.h" +#include "components/viz/common/surface_id.h" #include "ui/gfx/geometry/rect.h" namespace gfx { @@ -234,7 +234,7 @@ ~FrameData(); void AsValueInto(base::trace_event::TracedValue* value) const; - std::vector<SurfaceId> activation_dependencies; + std::vector<viz::SurfaceId> activation_dependencies; std::vector<gfx::Rect> occluding_screen_space_rects; std::vector<gfx::Rect> non_occluding_screen_space_rects; RenderPassList render_passes; @@ -746,7 +746,7 @@ LayerTreeFrameSink* layer_tree_frame_sink_; - LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; // The following scoped variables must not outlive the // |layer_tree_frame_sink_|.
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 1753e6d..431f74a 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -95,10 +95,11 @@ namespace cc { namespace { -SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { - return SurfaceId( - frame_sink_id, - LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); +viz::SurfaceId MakeSurfaceId(const viz::FrameSinkId& frame_sink_id, + uint32_t local_id) { + return viz::SurfaceId( + frame_sink_id, viz::LocalSurfaceId( + local_id, base::UnguessableToken::Deserialize(0, 1u))); } struct TestFrameData : public LayerTreeHostImpl::FrameData { @@ -3535,13 +3536,15 @@ host_impl_->SetViewportSize(gfx::Size(50, 50)); LayerImpl* root = host_impl_->active_tree()->root_layer_for_testing(); - std::vector<SurfaceId> primary_surfaces = { - MakeSurfaceId(FrameSinkId(1, 1), 1), MakeSurfaceId(FrameSinkId(2, 2), 2), - MakeSurfaceId(FrameSinkId(3, 3), 3)}; + std::vector<viz::SurfaceId> primary_surfaces = { + MakeSurfaceId(viz::FrameSinkId(1, 1), 1), + MakeSurfaceId(viz::FrameSinkId(2, 2), 2), + MakeSurfaceId(viz::FrameSinkId(3, 3), 3)}; - std::vector<SurfaceId> fallback_surfaces = { - MakeSurfaceId(FrameSinkId(4, 4), 1), MakeSurfaceId(FrameSinkId(4, 4), 2), - MakeSurfaceId(FrameSinkId(4, 4), 3)}; + std::vector<viz::SurfaceId> fallback_surfaces = { + MakeSurfaceId(viz::FrameSinkId(4, 4), 1), + MakeSurfaceId(viz::FrameSinkId(4, 4), 2), + MakeSurfaceId(viz::FrameSinkId(4, 4), 3)}; for (size_t i = 0; i < primary_surfaces.size(); ++i) { std::unique_ptr<SurfaceLayerImpl> child = @@ -3558,7 +3561,7 @@ root->test_properties()->AddChild(std::move(child)); } - base::flat_set<SurfaceId> fallback_surfaces_set; + base::flat_set<viz::SurfaceId> fallback_surfaces_set; for (size_t i = 0; i < fallback_surfaces.size(); ++i) { fallback_surfaces_set.insert(fallback_surfaces[i]); } @@ -8792,7 +8795,7 @@ } void DisplayReceivedLocalSurfaceId( - const LocalSurfaceId& local_surface_id) override {} + const viz::LocalSurfaceId& local_surface_id) override {} void DisplayReceivedCompositorFrame(const CompositorFrame& frame) override {} void DisplayWillDrawAndSwap(bool will_draw_and_swap, const RenderPassList& render_passes) override {}
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index df03b17..30553919 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc
@@ -18,13 +18,13 @@ #include "cc/layers/solid_color_layer.h" #include "cc/layers/texture_layer.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/layer_tree_json_parser.h" #include "cc/test/layer_tree_test.h" #include "cc/test/paths.h" #include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "testing/perf/perf_test.h" namespace cc { @@ -324,7 +324,7 @@ gpu::CommandBufferId::FromUnsafeValue(1), next_fence_sync_); next_sync_token.SetVerifyFlush(); - TextureMailbox mailbox(gpu_mailbox, next_sync_token, GL_TEXTURE_2D); + viz::TextureMailbox mailbox(gpu_mailbox, next_sync_token, GL_TEXTURE_2D); next_fence_sync_++; tab_contents_->SetTextureMailbox(mailbox, std::move(callback)); @@ -348,7 +348,7 @@ } void CleanUpAndEndTestOnMainThread() { - tab_contents_->SetTextureMailbox(TextureMailbox(), nullptr); + tab_contents_->SetTextureMailbox(viz::TextureMailbox(), nullptr); // ReleaseMailbox will end the test when we get the last mailbox back. }
diff --git a/cc/trees/layer_tree_host_pixeltest_readback.cc b/cc/trees/layer_tree_host_pixeltest_readback.cc index d920a3e..85bcf51 100644 --- a/cc/trees/layer_tree_host_pixeltest_readback.cc +++ b/cc/trees/layer_tree_host_pixeltest_readback.cc
@@ -115,7 +115,7 @@ EXPECT_TRUE(task_runner_provider()->IsMainThread()); EXPECT_TRUE(result->HasTexture()); - TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); EXPECT_TRUE(texture_mailbox.IsValid());
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index b64406d3..5afe760 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -7542,7 +7542,7 @@ }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); -// Makes sure that LocalSurfaceId is propagated to the LayerTreeFrameSink. +// Makes sure that viz::LocalSurfaceId is propagated to the LayerTreeFrameSink. class LayerTreeHostTestLocalSurfaceId : public LayerTreeHostTest { protected: void InitializeSettings(LayerTreeSettings* settings) override { @@ -7564,15 +7564,15 @@ } void DisplayReceivedLocalSurfaceIdOnThread( - const LocalSurfaceId& local_surface_id) override { + const viz::LocalSurfaceId& local_surface_id) override { EXPECT_EQ(expected_local_surface_id_, local_surface_id); EndTest(); } void AfterTest() override {} - LocalSurfaceId expected_local_surface_id_; - LocalSurfaceIdAllocator allocator_; + viz::LocalSurfaceId expected_local_surface_id_; + viz::LocalSurfaceIdAllocator allocator_; }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLocalSurfaceId);
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 250cb10..1673a974 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -915,7 +915,7 @@ texture->SetBounds(gfx::Size(10, 10)); texture->SetIsDrawable(true); texture->SetTextureMailbox( - TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), + viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), SingleReleaseCallback::Create( base::Bind(&LayerTreeHostContextTestDontUseLostResources:: EmptyReleaseCallback)));
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index 02ab684..3eda715 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -974,7 +974,7 @@ EXPECT_FALSE(result->IsEmpty()); EXPECT_TRUE(result->HasTexture()); - TextureMailbox mailbox; + viz::TextureMailbox mailbox; result->TakeTexture(&mailbox, &release_); EXPECT_TRUE(release_); } @@ -1006,7 +1006,7 @@ EXPECT_FALSE(result->IsEmpty()); EXPECT_TRUE(result->HasTexture()); - TextureMailbox mailbox; + viz::TextureMailbox mailbox; std::unique_ptr<SingleReleaseCallback> release; result->TakeTexture(&mailbox, &release); EXPECT_FALSE(release); @@ -1029,7 +1029,7 @@ gl->GenSyncTokenCHROMIUM(fence_sync, sync_token_.GetData()); request->SetTextureMailbox( - TextureMailbox(mailbox, sync_token_, GL_TEXTURE_2D)); + viz::TextureMailbox(mailbox, sync_token_, GL_TEXTURE_2D)); EXPECT_TRUE(request->has_texture_mailbox()); copy_layer_->RequestCopyOfOutput(std::move(request)); @@ -1037,7 +1037,7 @@ void AfterTest() override { // Expect the compositor to have waited for the sync point in the provided - // TextureMailbox. + // viz::TextureMailbox. EXPECT_EQ(sync_token_, waited_sync_token_after_readback_); // Except the copy to have *not* made another texture. EXPECT_EQ(num_textures_without_readback_, num_textures_with_readback_);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index e90083b..1f78845 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -182,8 +182,13 @@ property_trees()->changed = true; set_needs_update_draw_properties(); - if (IsActiveTree() && layer_tree_host_impl_->pending_tree()) - layer_tree_host_impl_->pending_tree()->DidUpdateScrollOffset(id); + if (IsActiveTree()) { + // Ensure the other trees are kept in sync. + if (layer_tree_host_impl_->pending_tree()) + layer_tree_host_impl_->pending_tree()->DidUpdateScrollOffset(id); + if (layer_tree_host_impl_->recycle_tree()) + layer_tree_host_impl_->recycle_tree()->DidUpdateScrollOffset(id); + } } void LayerTreeImpl::UpdateScrollbarGeometries() { @@ -667,29 +672,21 @@ return page_scale_factor; } -void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread( - bool is_impl_side_update) { - // TODO(enne): This should get replaced by pulling out scrolling and - // animations into their own trees. Then scrolls and animations would have - // their own ways of synchronizing across commits. This occurs to push - // updates from scrolling deltas on the compositor thread that have occurred - // after begin frame and updates from animations that have ticked since begin - // frame to a newly-committed property tree. +void LayerTreeImpl::UpdatePropertyTreeAnimationFromMainThread() { + // TODO(enne): This should get replaced by pulling out animations into their + // own trees. Then animations would have their own ways of synchronizing + // across commits. This occurs to push updates from animations that have + // ticked since begin frame to a newly-committed property tree. if (layer_list_.empty()) return; - // Entries from |element_id_to_*_animations_| should be deleted only after - // they have been synchronized with the main thread, which will not be the - // case if this is an impl-side invalidation. - const bool can_delete_animations = !is_impl_side_update; auto element_id_to_opacity = element_id_to_opacity_animations_.begin(); while (element_id_to_opacity != element_id_to_opacity_animations_.end()) { const ElementId id = element_id_to_opacity->first; if (EffectNode* node = property_trees_.effect_tree.FindNodeFromElementId(id)) { - if ((!node->is_currently_animating_opacity || - node->opacity == element_id_to_opacity->second) && - can_delete_animations) { + if (!node->is_currently_animating_opacity || + node->opacity == element_id_to_opacity->second) { element_id_to_opacity_animations_.erase(element_id_to_opacity++); continue; } @@ -704,9 +701,8 @@ const ElementId id = element_id_to_filter->first; if (EffectNode* node = property_trees_.effect_tree.FindNodeFromElementId(id)) { - if ((!node->is_currently_animating_filter || - node->filters == element_id_to_filter->second) && - can_delete_animations) { + if (!node->is_currently_animating_filter || + node->filters == element_id_to_filter->second) { element_id_to_filter_animations_.erase(element_id_to_filter++); continue; } @@ -721,9 +717,8 @@ const ElementId id = element_id_to_transform->first; if (TransformNode* node = property_trees_.transform_tree.FindNodeFromElementId(id)) { - if ((!node->is_currently_animating || - node->local == element_id_to_transform->second) && - can_delete_animations) { + if (!node->is_currently_animating || + node->local == element_id_to_transform->second) { element_id_to_transform_animations_.erase(element_id_to_transform++); continue; } @@ -735,7 +730,7 @@ } LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) { - layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); + layer->UpdatePropertyTreeForAnimationIfNeeded(); }); } @@ -1202,13 +1197,13 @@ } void LayerTreeImpl::SetSurfaceLayerIds( - const base::flat_set<SurfaceId>& surface_layer_ids) { + const base::flat_set<viz::SurfaceId>& surface_layer_ids) { DCHECK(surface_layer_ids_.empty()); surface_layer_ids_ = surface_layer_ids; needs_surface_ids_sync_ = true; } -const base::flat_set<SurfaceId>& LayerTreeImpl::SurfaceLayerIds() const { +const base::flat_set<viz::SurfaceId>& LayerTreeImpl::SurfaceLayerIds() const { return surface_layer_ids_; }
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index dc40268..356a2d1 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -262,8 +262,7 @@ has_transparent_background_ = transparent; } - void UpdatePropertyTreeScrollingAndAnimationFromMainThread( - bool is_impl_side_update); + void UpdatePropertyTreeAnimationFromMainThread(); void SetPageScaleOnActiveTree(float active_page_scale); void PushPageScaleFromMainThread(float page_scale_factor, float min_page_scale_factor, @@ -292,10 +291,12 @@ void set_content_source_id(uint32_t id) { content_source_id_ = id; } uint32_t content_source_id() { return content_source_id_; } - void set_local_surface_id(const LocalSurfaceId& id) { + void set_local_surface_id(const viz::LocalSurfaceId& id) { local_surface_id_ = id; } - const LocalSurfaceId& local_surface_id() const { return local_surface_id_; } + const viz::LocalSurfaceId& local_surface_id() const { + return local_surface_id_; + } void SetRasterColorSpace(const gfx::ColorSpace& raster_color_space); const gfx::ColorSpace& raster_color_space() const { @@ -374,8 +375,9 @@ void AddToElementMap(LayerImpl* layer); void RemoveFromElementMap(LayerImpl* layer); - void SetSurfaceLayerIds(const base::flat_set<SurfaceId>& surface_layer_ids); - const base::flat_set<SurfaceId>& SurfaceLayerIds() const; + void SetSurfaceLayerIds( + const base::flat_set<viz::SurfaceId>& surface_layer_ids); + const base::flat_set<viz::SurfaceId>& SurfaceLayerIds() const; void ClearSurfaceLayerIds(); void AddLayerShouldPushProperties(LayerImpl* layer); @@ -580,7 +582,7 @@ gfx::ColorSpace raster_color_space_; uint32_t content_source_id_; - LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; @@ -610,7 +612,7 @@ std::vector<PictureLayerImpl*> picture_layers_; - base::flat_set<SurfaceId> surface_layer_ids_; + base::flat_set<viz::SurfaceId> surface_layer_ids_; // List of render surfaces for the most recently prepared frame. RenderSurfaceList render_surface_list_;
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 56743c60..05df2e5b 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h
@@ -104,7 +104,7 @@ LayerTreeDebugState initial_debug_state; // Indicates that the LayerTreeHost should defer commits unless it has a valid - // LocalSurfaceId set. + // viz::LocalSurfaceId set. bool enable_surface_synchronization = false; // Indicates the case when a sub-frame gets its own LayerTree because it's
diff --git a/chrome/VERSION b/chrome/VERSION index 4d1936a..ec88460d 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=61 MINOR=0 -BUILD=3155 +BUILD=3156 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java index 53004273..18510d3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
@@ -120,7 +120,7 @@ * outside of {@link CustomTabsConnection#getInstance()}. */ public CustomTabsConnection createCustomTabsConnection() { - return new CustomTabsConnection(((ChromeApplication) ContextUtils.getApplicationContext())); + return new CustomTabsConnection(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemsAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemsAdapter.java index f25443b..830e573 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemsAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemsAdapter.java
@@ -356,6 +356,16 @@ if (mDelegate.getModel().isFolderVisible(othersNodeId)) { mTopLevelFolders.add(othersNodeId); } + + // Add any top-level managed and partner bookmark folders that are children of the root + // folder. + List<BookmarkId> managedAndPartnerFolderIds = + mDelegate.getModel().getTopLevelFolderIDs(true, false); + BookmarkId rootFolder = mDelegate.getModel().getRootFolderId(); + for (BookmarkId bookmarkId : managedAndPartnerFolderIds) { + BookmarkId parent = mDelegate.getModel().getBookmarkById(bookmarkId).getParentId(); + if (parent.equals(rootFolder)) mTopLevelFolders.add(bookmarkId); + } } @VisibleForTesting
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index 23e12bf..60d3de9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -5,7 +5,6 @@ package org.chromium.chrome.browser.customtabs; import android.app.Activity; -import android.app.Application; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -136,6 +135,8 @@ // prerender and hidden tab loads with unmatching fragments. private boolean mIsFirstLoad; + private final CustomTabsConnection mConnection = CustomTabsConnection.getInstance(); + private static class PageLoadMetricsObserver implements PageLoadMetrics.Observer { private final CustomTabsConnection mConnection; private final CustomTabsSessionToken mSession; @@ -238,9 +239,7 @@ String url = IntentHandler.getUrlFromIntent(intent); if (TextUtils.isEmpty(url)) return false; - CustomTabsConnection connection = CustomTabsConnection.getInstance( - (Application) ContextUtils.getApplicationContext()); - connection.onHandledIntent(session, url, intent); + CustomTabsConnection.getInstance().onHandledIntent(session, url, intent); sActiveContentHandler.loadUrlAndTrackFromTimestamp(new LoadUrlParams(url), IntentHandler.getTimestampFromIntent(intent)); return true; @@ -316,16 +315,14 @@ public void onStart() { super.onStart(); mIsClosing = false; - CustomTabsConnection.getInstance(getApplication()) - .keepAliveForSession(mIntentDataProvider.getSession(), - mIntentDataProvider.getKeepAliveServiceIntent()); + mConnection.keepAliveForSession( + mIntentDataProvider.getSession(), mIntentDataProvider.getKeepAliveServiceIntent()); } @Override public void onStop() { super.onStop(); - CustomTabsConnection.getInstance(getApplication()) - .dontKeepAliveForSession(mIntentDataProvider.getSession()); + mConnection.dontKeepAliveForSession(mIntentDataProvider.getSession()); } @Override @@ -337,13 +334,11 @@ super.preInflationStartup(); mSession = mIntentDataProvider.getSession(); supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); - CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication()); - mSpeculatedUrl = connection.getSpeculatedUrl(mSession); + mSpeculatedUrl = mConnection.getSpeculatedUrl(mSession); mHasSpeculated = !TextUtils.isEmpty(mSpeculatedUrl); - if (getSavedInstanceState() == null - && CustomTabsConnection.hasWarmUpBeenFinished(getApplication())) { + if (getSavedInstanceState() == null && CustomTabsConnection.hasWarmUpBeenFinished()) { initializeTabModels(); - mMainTab = getHiddenTab(connection); + mMainTab = getHiddenTab(); if (mMainTab == null) mMainTab = createMainTab(); mIsFirstLoad = true; loadUrlInTab(mMainTab, new LoadUrlParams(getUrlToLoad()), @@ -365,8 +360,7 @@ getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseButtonDrawable()); getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityState() == CustomTabsIntent.SHOW_PAGE_TITLE); - if (CustomTabsConnection.getInstance(getApplication()) - .shouldHideDomainForSession(mSession)) { + if (mConnection.shouldHideDomainForSession(mSession)) { getToolbarManager().setUrlBarHidden(true); } int toolbarColor = mIntentDataProvider.getToolbarColor(); @@ -419,11 +413,10 @@ public void finishNativeInitialization() { if (!mIntentDataProvider.isInfoPage()) FirstRunSignInProcessor.start(this); - final CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication()); // If extra headers have been passed, cancel any current prerender, as // prerendering doesn't support extra headers. if (IntentHandler.getExtraHeadersFromIntent(getIntent()) != null) { - connection.cancelSpeculation(mSession); + mConnection.cancelSpeculation(mSession); } getTabModelSelector().getModel(false).addObserver(mTabModelObserver); @@ -533,11 +526,11 @@ } }; recordClientPackageName(); - connection.showSignInToastIfNecessary(mSession, getIntent()); + mConnection.showSignInToastIfNecessary(mSession, getIntent()); String url = getUrlToLoad(); - String packageName = connection.getClientPackageNameForSession(mSession); + String packageName = mConnection.getClientPackageNameForSession(mSession); if (TextUtils.isEmpty(packageName)) { - packageName = connection.extractCreatorPackage(getIntent()); + packageName = mConnection.extractCreatorPackage(getIntent()); } DataUseTabUIManager.onCustomTabInitialNavigation(mMainTab, packageName, url); @@ -562,15 +555,15 @@ * Encapsulates CustomTabsConnection#takeHiddenTab() * with additional initialization logic. */ - private Tab getHiddenTab(CustomTabsConnection connection) { + private Tab getHiddenTab() { String url = getUrlToLoad(); - String referrerUrl = connection.getReferrer(mSession, getIntent()); - Tab tab = connection.takeHiddenTab(mSession, url, referrerUrl); + String referrerUrl = mConnection.getReferrer(mSession, getIntent()); + Tab tab = mConnection.takeHiddenTab(mSession, url, referrerUrl); mUsingHiddenTab = tab != null; if (!mUsingHiddenTab) return null; RecordHistogram.recordEnumeratedHistogram("CustomTabs.WebContentsStateOnLaunch", WEBCONTENTS_STATE_PRERENDERED_WEBCONTENTS, WEBCONTENTS_STATE_MAX); - tab.setAppAssociatedWith(connection.getClientPackageNameForSession(mSession)); + tab.setAppAssociatedWith(mConnection.getClientPackageNameForSession(mSession)); if (mIntentDataProvider.shouldEnableEmbeddedMediaExperience()) { tab.enableEmbeddedMediaExperience(true); } @@ -579,8 +572,7 @@ } private Tab createMainTab() { - CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication()); - WebContents webContents = takeWebContents(connection); + WebContents webContents = takeWebContents(); int assignedTabId = IntentUtils.safeGetIntExtra( getIntent(), IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); @@ -588,7 +580,7 @@ getIntent(), IntentHandler.EXTRA_PARENT_TAB_ID, Tab.INVALID_TAB_ID); Tab tab = new Tab(assignedTabId, parentTabId, false, this, getWindowAndroid(), TabLaunchType.FROM_EXTERNAL_APP, null, null); - tab.setAppAssociatedWith(connection.getClientPackageNameForSession(mSession)); + tab.setAppAssociatedWith(mConnection.getClientPackageNameForSession(mSession)); tab.initialize( webContents, getTabContentManager(), new CustomTabDelegateFactory( @@ -605,10 +597,10 @@ return tab; } - private WebContents takeWebContents(CustomTabsConnection connection) { + private WebContents takeWebContents() { mUsingPrerender = true; int webContentsStateOnLaunch = WEBCONTENTS_STATE_PRERENDERED_WEBCONTENTS; - WebContents webContents = takePrerenderedWebContents(connection); + WebContents webContents = takePrerenderedWebContents(); if (webContents == null) { mUsingPrerender = false; @@ -631,17 +623,15 @@ RecordHistogram.recordEnumeratedHistogram("CustomTabs.WebContentsStateOnLaunch", webContentsStateOnLaunch, WEBCONTENTS_STATE_MAX); - if (!mUsingPrerender) { - connection.resetPostMessageHandlerForSession(mSession, webContents); - } + if (!mUsingPrerender) mConnection.resetPostMessageHandlerForSession(mSession, webContents); return webContents; } - private WebContents takePrerenderedWebContents(CustomTabsConnection connection) { + private WebContents takePrerenderedWebContents() { String url = getUrlToLoad(); - String referrerUrl = connection.getReferrer(mSession, getIntent()); - return connection.takePrerenderedUrl(mSession, url, referrerUrl); + String referrerUrl = mConnection.getReferrer(mSession, getIntent()); + return mConnection.takePrerenderedUrl(mSession, url, referrerUrl); } private WebContents takeAsyncWebContents() { @@ -658,8 +648,7 @@ mTabObserver = new CustomTabObserver( getApplication(), mSession, mIntentDataProvider.isOpenedByChrome()); - mMetricsObserver = new PageLoadMetricsObserver( - CustomTabsConnection.getInstance(getApplication()), mSession, tab); + mMetricsObserver = new PageLoadMetricsObserver(mConnection, mSession, tab); tab.addObserver(mTabObserver); prepareTabBackground(tab); @@ -672,8 +661,7 @@ } private void recordClientPackageName() { - String clientName = CustomTabsConnection.getInstance(getApplication()) - .getClientPackageNameForSession(mSession); + String clientName = mConnection.getClientPackageNameForSession(mSession); if (TextUtils.isEmpty(clientName)) clientName = mIntentDataProvider.getClientPackageName(); final String packageName = clientName; if (TextUtils.isEmpty(packageName) || packageName.contains(getPackageName())) return; @@ -732,8 +720,7 @@ @Override public void onPauseWithNative() { super.onPauseWithNative(); - CustomTabsConnection.getInstance(getApplication()).notifyNavigationEvent( - mSession, CustomTabsCallback.TAB_HIDDEN); + mConnection.notifyNavigationEvent(mSession, CustomTabsCallback.TAB_HIDDEN); } @Override @@ -787,8 +774,7 @@ IntentHandler.addReferrerAndHeaders(params, intent); if (params.getReferrer() == null) { - params.setReferrer(CustomTabsConnection.getInstance(getApplication()) - .getReferrerForSession(mSession)); + params.setReferrer(mConnection.getReferrerForSession(mSession)); } // See ChromeTabCreator#getTransitionType(). This marks the navigation chain as starting // from an external intent (unless otherwise specified by an extra in the intent). @@ -1098,8 +1084,7 @@ mMainTab = null; // mHasCreatedTabEarly == true => mMainTab != null in the rest of the code. mHasCreatedTabEarly = false; - CustomTabsConnection.getInstance(getApplication()).resetPostMessageHandlerForSession( - mSession, null); + mConnection.resetPostMessageHandlerForSession(mSession, null); tab.detachAndStartReparenting(intent, startActivityOptions, finalizeCallback); } else { // Temporarily allowing disk access while fixing. TODO: http://crbug.com/581860
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java index 4588d84..ed058dc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabObserver.java
@@ -51,7 +51,7 @@ if (openedByChrome) { mCustomTabsConnection = null; } else { - mCustomTabsConnection = CustomTabsConnection.getInstance(application); + mCustomTabsConnection = CustomTabsConnection.getInstance(); } mSession = session; if (!openedByChrome && mCustomTabsConnection.shouldSendNavigationInfoForSession(mSession)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java index e79e1d6..4ef154ee 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -5,7 +5,6 @@ package org.chromium.chrome.browser.customtabs; import android.app.ActivityManager; -import android.app.Application; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -27,6 +26,7 @@ import android.util.Pair; import android.widget.RemoteViews; +import org.chromium.base.BaseChromiumApplication; import org.chromium.base.CommandLine; import org.chromium.base.ContextUtils; import org.chromium.base.Log; @@ -180,7 +180,7 @@ @VisibleForTesting SpeculationParams mSpeculation; - protected final Application mApplication; + protected final Context mContext; protected final ClientManager mClientManager; private final boolean mLogRequests; private final AtomicBoolean mWarmupHasBeenCalled = new AtomicBoolean(); @@ -197,21 +197,20 @@ * Public to be instanciable from {@link ChromeApplication}. This is however * intended to be private. */ - public CustomTabsConnection(Application application) { + public CustomTabsConnection() { super(); - mApplication = application; - mClientManager = new ClientManager(mApplication); + mContext = ContextUtils.getApplicationContext(); + // Command line switch values are used below. + BaseChromiumApplication.initCommandLine(mContext); + mClientManager = new ClientManager(mContext); mLogRequests = CommandLine.getInstance().hasSwitch(LOG_SERVICE_REQUESTS); } /** * @return The unique instance of ChromeCustomTabsConnection. - * TODO(estevenson): Remove Application param. */ - @SuppressFBWarnings("BC_UNCONFIRMED_CAST") - public static CustomTabsConnection getInstance(Application application) { + public static CustomTabsConnection getInstance() { if (sInstance.get() == null) { - ((ChromeApplication) application).initCommandLine(); sInstance.compareAndSet(null, AppHooks.get().createCustomTabsConnection()); } return sInstance.get(); @@ -264,17 +263,16 @@ /** Warmup activities that should only happen once. */ @SuppressFBWarnings("DM_EXIT") - private static void initializeBrowser(final Application app) { + private static void initializeBrowser(final Context context) { ThreadUtils.assertOnUiThread(); try { - ChromeBrowserInitializer.getInstance(app).handleSynchronousStartupWithGpuWarmUp(); + ChromeBrowserInitializer.getInstance(context).handleSynchronousStartupWithGpuWarmUp(); } catch (ProcessInitException e) { Log.e(TAG, "ProcessInitException while starting the browser process."); // Cannot do anything without the native library, and cannot show a // dialog to the user. System.exit(-1); } - final Context context = app.getApplicationContext(); ChildProcessLauncherHelper.warmUp(context); ChromeBrowserInitializer.initNetworkChangeNotifier(context); WarmupManager.getInstance().initializeViewHierarchy( @@ -295,8 +293,8 @@ /** * @return Whether {@link CustomTabsConnection#warmup(long)} has been called. */ - public static boolean hasWarmUpBeenFinished(Application application) { - return getInstance(application).mWarmupHasBeenFinished.get(); + public static boolean hasWarmUpBeenFinished() { + return getInstance().mWarmupHasBeenFinished.get(); } /** @@ -325,7 +323,7 @@ // 4. RequestThrottler first access has to be done only once. // (1) - if (!initialized) initializeBrowser(mApplication); + if (!initialized) initializeBrowser(mContext); // (2) if (mayCreateSpareWebContents && mSpeculation == null) { @@ -341,7 +339,7 @@ // The throttling database uses shared preferences, that can cause a // StrictMode violation on the first access. Make sure that this access is // not in mayLauchUrl. - RequestThrottler.loadInBackground(mApplication); + RequestThrottler.loadInBackground(mContext); } } finally { TraceEvent.end("CustomTabsConnection.warmupInternal"); @@ -1009,7 +1007,7 @@ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) { do { ActivityManager am = - (ActivityManager) mApplication.getSystemService(Context.ACTIVITY_SERVICE); + (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); // Extra paranoia here and below, some L 5.0.x devices seem to throw NPE somewhere // in this code. // See https://crbug.com/654705. @@ -1068,8 +1066,7 @@ return SPECULATION_STATUS_ON_START_NOT_ALLOWED_DATA_REDUCTION_ENABLED; } ConnectivityManager cm = - (ConnectivityManager) mApplication.getApplicationContext().getSystemService( - Context.CONNECTIVITY_SERVICE); + (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.isActiveNetworkMetered() && !shouldPrerenderOnCellularForSession(session)) { return SPECULATION_STATUS_ON_START_NOT_ALLOWED_NETWORK_METERED; } @@ -1165,7 +1162,7 @@ if (mExternalPrerenderHandler == null) { mExternalPrerenderHandler = new ExternalPrerenderHandler(); } - Rect contentBounds = ExternalPrerenderHandler.estimateContentSize(mApplication, true); + Rect contentBounds = ExternalPrerenderHandler.estimateContentSize(mContext, true); String referrer = getReferrer(session, extrasIntent); boolean forced = shouldPrerenderOnCellularForSession(session); @@ -1220,12 +1217,12 @@ } @VisibleForTesting - void resetThrottling(Context context, int uid) { + void resetThrottling(int uid) { mClientManager.resetThrottling(uid); } @VisibleForTesting - void ban(Context context, int uid) { + void ban(int uid) { mClientManager.ban(uid); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java index 96cdeb9..73650b5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java
@@ -36,7 +36,7 @@ @Override public IBinder onBind(Intent intent) { mBindIntent = intent; - mConnection = CustomTabsConnection.getInstance(getApplication()); + mConnection = CustomTabsConnection.getInstance(); mConnection.logCall("Service#onBind()", true); return super.onBind(intent); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java index 72cff49..c63de9fb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -183,7 +183,8 @@ // http://crbug.com/169549 : If you type in a URL that then redirects in server side to an // link that cannot be rendered by the browser, we want to show the intent picker. - boolean isTyped = pageTransitionCore == PageTransition.TYPED; + boolean isTyped = (pageTransitionCore == PageTransition.TYPED) + || ((params.getPageTransition() & PageTransition.FROM_ADDRESS_BAR) != 0); boolean typedRedirectToExternalProtocol = isTyped && params.isRedirect() && isExternalProtocol;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java index 0473d6e..18dc12f0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -585,8 +585,8 @@ public void onSendFinished(PendingIntent pendingIntent, Intent intent, int resultCode, String resultData, Bundle resultExtras) { if (ChromeLauncherActivity.isCustomTabIntent(intent)) { - CustomTabsConnection.getInstance( - getApplication()).sendFirstRunCallbackIfNecessary(intent, complete); + CustomTabsConnection.getInstance().sendFirstRunCallbackIfNecessary( + intent, complete); } } };
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SpannableAutocompleteEditTextModel.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SpannableAutocompleteEditTextModel.java index 2c0ee6f..50148e73 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SpannableAutocompleteEditTextModel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SpannableAutocompleteEditTextModel.java
@@ -128,11 +128,12 @@ private void clearAutocompleteText() { if (DEBUG) Log.i(TAG, "clearAutocomplete"); mPreviouslySetState.clearAutocompleteText(); - if (!mCurrentState.hasAutocompleteText()) { - notifyAutocompleteTextStateChanged(); - return; - } mCurrentState.clearAutocompleteText(); + } + + private void clearAutocompleteTextAndUpdateSpan() { + if (DEBUG) Log.i(TAG, "clearAutocompleteAndUpdateSpan"); + clearAutocompleteText(); // Take effect and notify if not already in a batch edit. if (mInputConnection != null) { mInputConnection.beginBatchEdit(); @@ -176,7 +177,7 @@ if (mInputConnection != null) mInputConnection.commitAutocomplete(); } else { if (DEBUG) Log.i(TAG, "Touching before the cursor removes autocomplete."); - clearAutocompleteText(); + clearAutocompleteTextAndUpdateSpan(); } } notifyAutocompleteTextStateChanged(); @@ -195,7 +196,7 @@ if (mBatchEditNestCount > 0) return; // let endBatchEdit() handles changes from IME. // An external change such as text paste occurred. mLastEditWasTyping = false; - clearAutocompleteText(); + clearAutocompleteTextAndUpdateSpan(); } @Override @@ -436,6 +437,7 @@ } mLastEditWasTyping = false; clearAutocompleteText(); + notifyAutocompleteTextStateChanged(); return retVal; } if (!setAutocompleteSpan()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java index bdbec52..42786498 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser.prerender; -import android.app.Application; import android.content.Context; import android.content.res.Resources; import android.graphics.Point; @@ -121,20 +120,20 @@ * The estimate is likely to be incorrect. This is not a problem, as the aim * is to avoid getting a different layout and resources than needed at * render time. - * @param application The application to use for getting resources. + * @param context The application context. * @param convertToDp Whether the value should be converted to dp from pixels. * @return The estimated prerender size in pixels or dp. */ - public static Rect estimateContentSize(Application application, boolean convertToDp) { + public static Rect estimateContentSize(Context context, boolean convertToDp) { // The size is estimated as: // X = screenSizeX // Y = screenSizeY - top bar - bottom bar - custom tabs bar // The bounds rectangle includes the bottom bar and the custom tabs bar as well. Rect screenBounds = new Rect(); Point screenSize = new Point(); - WindowManager wm = (WindowManager) application.getSystemService(Context.WINDOW_SERVICE); + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getSize(screenSize); - Resources resources = application.getResources(); + Resources resources = context.getResources(); int statusBarId = resources.getIdentifier("status_bar_height", "dimen", "android"); try { screenSize.y -= resources.getDimensionPixelSize(statusBarId);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java index 1f89665..aefe281 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
@@ -189,7 +189,7 @@ if (mQueuedUrl != null) loadUrl(mQueuedUrl); AutocompleteController.nativePrefetchZeroSuggestResults(); - CustomTabsConnection.getInstance(getApplication()).warmup(0); + CustomTabsConnection.getInstance().warmup(0); mSearchBox.onDeferredStartup(isVoiceSearchIntent()); RecordUserAction.record("SearchWidget.WidgetSelected");
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java index a13e2f50..3a6cc75 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java
@@ -102,20 +102,9 @@ public void onSheetClosed() { if (mSelectedItemId != 0 && mSelectedItemId != R.id.action_home) { showBottomSheetContent(R.id.action_home); + } else { + clearBottomSheetContents(); } - - Iterator<Entry<Integer, BottomSheetContent>> contentIterator = - mBottomSheetContents.entrySet().iterator(); - while (contentIterator.hasNext()) { - Entry<Integer, BottomSheetContent> entry = contentIterator.next(); - if (entry.getKey() == R.id.action_home || entry.getKey() == INCOGNITO_HOME_ID) { - continue; - } - - entry.getValue().destroy(); - contentIterator.remove(); - } - // TODO(twellington): determine a policy for destroying the // SuggestionsBottomSheetContent. } @@ -124,11 +113,16 @@ public void onSheetContentChanged(BottomSheetContent newContent) { if (mBottomSheet.isSheetOpen()) announceBottomSheetContentSelected(); - if (!mShouldOpenSheetOnNextContentChange) return; + if (mShouldOpenSheetOnNextContentChange) { + mShouldOpenSheetOnNextContentChange = false; + if (!mBottomSheet.isSheetOpen()) { + mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_FULL, true); + } + return; + } - mShouldOpenSheetOnNextContentChange = false; - if (!mBottomSheet.isSheetOpen()) { - mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_FULL, true); + if (mBottomSheet.getSheetState() == BottomSheet.SHEET_STATE_PEEK) { + clearBottomSheetContents(); } } @@ -354,4 +348,18 @@ // the support library is rolled. return mSelectedItemId; } + + public void clearBottomSheetContents() { + Iterator<Entry<Integer, BottomSheetContent>> contentIterator = + mBottomSheetContents.entrySet().iterator(); + while (contentIterator.hasNext()) { + Entry<Integer, BottomSheetContent> entry = contentIterator.next(); + if (entry.getKey() == R.id.action_home || entry.getKey() == INCOGNITO_HOME_ID) { + continue; + } + + entry.getValue().destroy(); + contentIterator.remove(); + } + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java index 3a313877..2be5386 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java
@@ -18,6 +18,7 @@ import org.junit.runner.RunWith; import org.chromium.base.ThreadUtils; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; @@ -34,7 +35,6 @@ import org.chromium.chrome.test.util.ChromeRestriction; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content.browser.BindingManager; -import org.chromium.content.browser.ChildProcessConnection; import org.chromium.content.browser.ChildProcessLauncherHelper; import org.chromium.content.browser.test.ChildProcessAllocatorSettings; import org.chromium.content.browser.test.util.Criteria;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java index 42253ca0..d5ef912 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser; +import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; + import android.support.test.InstrumentationRegistry; import android.support.test.filters.LargeTest; @@ -18,7 +20,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.blink.mojom.document_metadata.Entity; @@ -33,6 +34,7 @@ import org.chromium.net.test.EmbeddedTestServer; import org.chromium.url.mojom.Url; +import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** @@ -43,11 +45,13 @@ ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, "enable-features=CopylessPaste"}) @Restriction(Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE) public class CopylessPasteTest { - // NODATA_PAGE doesn't contain desired metadata. - @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); + // The default timeout (in seconds) for a callback to wait. + public static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(10); + + // NODATA_PAGE doesn't contain desired metadata. private static final String NODATA_PAGE = "/chrome/test/data/android/about.html"; // DATA_PAGE contains desired metadata. @@ -140,10 +144,9 @@ @Test @LargeTest @Feature({"CopylessPaste"}) - @DisabledTest(message = "crbug.com/713895") public void testNoMeta() throws InterruptedException, TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); - mCallbackHelper.waitForCallback(0); + mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); Assert.assertNull(mCallbackHelper.getWebPage()); } @@ -153,10 +156,9 @@ @Test @LargeTest @Feature({"CopylessPaste"}) - @DisabledTest(message = "Flaky: crbug.com/713172") public void testValid() throws InterruptedException, TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE)); - mCallbackHelper.waitForCallback(0); + mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); WebPage extracted = mCallbackHelper.getWebPage(); WebPage expected = new WebPage(); @@ -185,21 +187,16 @@ @Test @LargeTest @Feature({"CopylessPaste"}) - @DisabledTest(message = "Flaky: crbug.com/713172") public void testCache() throws InterruptedException, TimeoutException { - // The URLs used here should be unique in CopylessPasteTest. - String uniqueTag = "#123"; - // NODATA_PAGE doesn't contain desired metadata. - mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE + uniqueTag)); - mCallbackHelper.waitForCallback(0); - // DATA_PAGE contains desired metadata. - mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE + uniqueTag)); - mCallbackHelper.waitForCallback(1); + mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); + mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); + mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE)); + mCallbackHelper.waitForCallback(1, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); // Cache hit without entities. Shouldn't parse again. - mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE + uniqueTag)); + mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); // Cache hit with entities. Shouldn't parse again. - mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE + uniqueTag)); + mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE)); Assert.assertEquals(2, mCallbackHelper.getCallCount()); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index 92d4c3b..367700506 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -8,7 +8,6 @@ import static org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule.LONG_TIMEOUT_MS; import android.app.Activity; -import android.app.Application; import android.app.Instrumentation; import android.app.Instrumentation.ActivityMonitor; import android.app.Instrumentation.ActivityResult; @@ -205,18 +204,13 @@ LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); mWebServer = TestWebServer.start(); - CustomTabsConnection connection = - CustomTabsConnection.getInstance((Application) appContext); + CustomTabsConnection connection = CustomTabsConnection.getInstance(); connection.setForcePrerender(true); } @After public void tearDown() throws Exception { - Context appContext = InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext(); - CustomTabsConnection connection = - CustomTabsConnection.getInstance((Application) appContext); + CustomTabsConnection connection = CustomTabsConnection.getInstance(); connection.setForcePrerender(false); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @@ -1012,7 +1006,7 @@ final Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage2); final CustomTabsSessionToken session = warmUpAndLaunchUrlWithSession(intent); Assert.assertEquals(getActivity().getIntentDataProvider().getSession(), session); - CustomTabsConnection connection = CustomTabsConnection.getInstance((Application) context); + CustomTabsConnection connection = CustomTabsConnection.getInstance(); String packageName = context.getPackageName(); final String referrer = IntentHandler.constructValidReferrerForAuthority(packageName).getUrl(); @@ -2191,8 +2185,7 @@ Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); - final CustomTabsConnection connection = - CustomTabsConnection.getInstance((Application) context); + final CustomTabsConnection connection = CustomTabsConnection.getInstance(); CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting(); connection.newSession(token); @@ -2681,8 +2674,7 @@ Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); - CustomTabsConnection connection = - CustomTabsTestUtils.setUpConnection((Application) context); + CustomTabsConnection connection = CustomTabsTestUtils.setUpConnection(); CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting(); connection.newSession(token); Bundle extras = null; @@ -2704,11 +2696,7 @@ } private CustomTabsConnection warmUpAndWait() { - final Context context = InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext(); - CustomTabsConnection connection = - CustomTabsTestUtils.setUpConnection((Application) context); + CustomTabsConnection connection = CustomTabsTestUtils.setUpConnection(); final CallbackHelper startupCallbackHelper = new CallbackHelper(); Assert.assertTrue(connection.warmup(0)); ThreadUtils.runOnUiThread(new Runnable() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java index ed83977..d99ab10 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java
@@ -66,6 +66,9 @@ @Before public void setUp() throws Exception { + // CustomTabsConnection needs a true context, not the mock context set below. + CustomTabsConnection.getInstance(); + mAppContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java index 2a1179e0..dab6580 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
@@ -6,8 +6,6 @@ import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; -import android.app.Application; -import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; @@ -15,7 +13,6 @@ import android.os.Process; import android.support.customtabs.CustomTabsService; import android.support.customtabs.CustomTabsSessionToken; -import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import org.junit.After; @@ -49,17 +46,12 @@ private static final String INVALID_SCHEME_URL = "intent://www.google.com"; private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; - private Context mAppContext; - @Before public void setUp() throws Exception { - mAppContext = InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext(); PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); - mCustomTabsConnection = CustomTabsTestUtils.setUpConnection((Application) mAppContext); - mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid()); + mCustomTabsConnection = CustomTabsTestUtils.setUpConnection(); + mCustomTabsConnection.resetThrottling(Process.myUid()); } @After @@ -155,7 +147,7 @@ @SmallTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testPrerenderDestroysSpareRenderer() { - CustomTabsConnection.getInstance((Application) mAppContext).setForcePrerender(true); + CustomTabsConnection.getInstance().setForcePrerender(true); final CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override @@ -305,7 +297,7 @@ @SmallTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testStillHighConfidenceMayLaunchUrlWithSeveralUrls() { - CustomTabsConnection.getInstance((Application) mAppContext).setForcePrerender(true); + CustomTabsConnection.getInstance().setForcePrerender(true); final CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting(); Assert.assertTrue(mCustomTabsConnection.newSession(token)); @@ -352,7 +344,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @RetryOnFailure public void testCanCancelPrerender() { - CustomTabsConnection.getInstance((Application) mAppContext).setForcePrerender(true); + CustomTabsConnection.getInstance().setForcePrerender(true); final CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override @@ -439,9 +431,9 @@ @SmallTest public void testMultipleMayLaunchUrl() { CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true); - mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid()); + mCustomTabsConnection.resetThrottling(Process.myUid()); assertWarmupAndMayLaunchUrl(token, URL, true); - mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid()); + mCustomTabsConnection.resetThrottling(Process.myUid()); assertWarmupAndMayLaunchUrl(token, URL2, true); } @@ -545,9 +537,9 @@ @SmallTest public void testThrottlingAcrossSessions() { CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true); - mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid()); + mCustomTabsConnection.resetThrottling(Process.myUid()); CustomTabsSessionToken token2 = assertWarmupAndMayLaunchUrl(null, URL, true); - mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid()); + mCustomTabsConnection.resetThrottling(Process.myUid()); for (int i = 0; i < 10; i++) { mCustomTabsConnection.mayLaunchUrl(token, Uri.parse(URL), null, null); } @@ -558,7 +550,7 @@ @SmallTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testBanningWorks() { - mCustomTabsConnection.ban(mAppContext, Process.myUid()); + mCustomTabsConnection.ban(Process.myUid()); final CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting(); Assert.assertTrue(mCustomTabsConnection.newSession(token)); @@ -578,7 +570,7 @@ @SmallTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testBanningDisabledForCellular() { - mCustomTabsConnection.ban(mAppContext, Process.myUid()); + mCustomTabsConnection.ban(Process.myUid()); final CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting(); Assert.assertTrue(mCustomTabsConnection.newSession(token));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java index 5553294..2ef94b17 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser.customtabs; -import android.app.Application; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -38,9 +37,9 @@ return intent; } - public static CustomTabsConnection setUpConnection(Application application) { - CustomTabsConnection connection = CustomTabsConnection.getInstance(application); - connection.resetThrottling(application, Process.myUid()); + public static CustomTabsConnection setUpConnection() { + CustomTabsConnection connection = CustomTabsConnection.getInstance(); + connection.resetThrottling(Process.myUid()); return connection; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java index b6e6a37..75a6439 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
@@ -340,6 +340,13 @@ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, START_OTHER_ACTIVITY); + // http://crbug.com/709217 + checkUrl("market://1234") + .withPageTransition(PageTransition.FROM_ADDRESS_BAR) + .withIsRedirect(true) + .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, + START_OTHER_ACTIVITY); + // http://crbug.com/143118 checkUrl("market://1234") .withPageTransition(PageTransition.TYPED)
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java index 12474f38..a98f5d6 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java
@@ -70,23 +70,12 @@ @Override public void onAutocompleteTextStateChanged(boolean updateDisplay) { - // This function is called in super(), so mVerifier may be null. - if (mVerifier != null) { - mVerifier.onAutocompleteTextStateChanged(updateDisplay); - } + mVerifier.onAutocompleteTextStateChanged(updateDisplay); } @Override public void onUpdateSelectionForTesting(int selStart, int selEnd) { - // This function is called in super(), so mVerifier may be null. - if (mVerifier != null) { - mVerifier.onUpdateSelection(selStart, selEnd); - } - } - - @Override - public boolean hasFocus() { - return true; + mVerifier.onUpdateSelection(selStart, selEnd); } }
diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc index 6cc0c91..b685bb3 100644 --- a/chrome/app/chrome_crash_reporter_client_win.cc +++ b/chrome/app/chrome_crash_reporter_client_win.cc
@@ -74,6 +74,11 @@ constexpr size_t kPrinterInfoCount = 4; constexpr char kPrinterInfo[] = "prn-info-%" PRIuS; +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +constexpr char kBeginMainFrameHangCompositorState[] = + "begin-main-frame-hang-compositor-state"; + using namespace crash_keys; int snprintf(char* buffer, @@ -183,6 +188,10 @@ // Temporary for https://crbug.com/685996. {"user-cloud-policy-manager-connect-trace", kMediumSize}, + + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + {kBeginMainFrameHangCompositorState, kSmallSize}, }; // This dynamic set of keys is used for sets of key value pairs when gathering
diff --git a/chrome/app/chrome_exe_main_mac.cc b/chrome/app/chrome_exe_main_mac.cc index d27593f..a43b28e0 100644 --- a/chrome/app/chrome_exe_main_mac.cc +++ b/chrome/app/chrome_exe_main_mac.cc
@@ -56,8 +56,11 @@ // The name of the parameter containing the executable path. const std::string exec_param = "EXECUTABLE_PATH"; + // The name of the parameter containg the pid of this process. + const std::string pid_param = "CURRENT_PID"; - if (!server.SetParameter(exec_param, rp)) { + if (!server.SetParameter(exec_param, rp) || + !server.SetParameter(pid_param, std::to_string(getpid()))) { fprintf(stderr, "Failed to set up parameters for sandbox.\n"); abort(); }
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 88edcb1..102e80f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -266,6 +266,8 @@ "component_updater/supervised_user_whitelist_installer.h", "component_updater/sw_reporter_installer_win.cc", "component_updater/sw_reporter_installer_win.h", + "conflicts/enumerate_input_method_editors_win.cc", + "conflicts/enumerate_input_method_editors_win.h", "conflicts/installed_programs_win.cc", "conflicts/installed_programs_win.h", "conflicts/module_database_observer_win.h", @@ -3389,6 +3391,8 @@ "renderer_context_menu/spelling_menu_observer.h", "repost_form_warning_controller.cc", "repost_form_warning_controller.h", + "resource_coordinator/background_tab_navigation_throttle.cc", + "resource_coordinator/background_tab_navigation_throttle.h", "resource_coordinator/tab_manager.cc", "resource_coordinator/tab_manager.h", "resource_coordinator/tab_manager_delegate_chromeos.cc", @@ -4558,7 +4562,7 @@ "media/pepper_cdm_test_helper.cc", "media/pepper_cdm_test_helper.h", ] - deps += [ "//media:cdm_paths" ] + deps += [ "//media/cdm:cdm_paths" ] } }
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ff0b081..fa986845 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2020,6 +2020,10 @@ flag_descriptions::kBypassAppBannerEngagementChecksName, flag_descriptions::kBypassAppBannerEngagementChecksDescription, kOsAll, SINGLE_VALUE_TYPE(switches::kBypassAppBannerEngagementChecks)}, + {"enable-desktop-pwa-windowing", + flag_descriptions::kEnableDesktopPWAWindowingName, + flag_descriptions::kEnableDesktopPWAWindowingDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kDesktopPWAWindowing)}, {"use-sync-sandbox", flag_descriptions::kSyncSandboxName, flag_descriptions::kSyncSandboxDescription, kOsAll, SINGLE_VALUE_TYPE_AND_VALUE( @@ -3155,6 +3159,14 @@ flag_descriptions::kResourceLoadSchedulerDescription, kOsAll, FEATURE_VALUE_TYPE(features::kResourceLoadScheduler)}, +#if defined(TOOLKIT_VIEWS) + {"delay-reload-stop-button-change", + flag_descriptions::kDelayReloadStopButtonChangeName, + flag_descriptions::kDelayReloadStopButtonChangeDescription, + kOsCrOS | kOsWin | kOsLinux, + SINGLE_DISABLE_VALUE_TYPE(switches::kDelayReloadStopButtonChange)}, +#endif // TOOLKIT_VIEWS + // NOTE: Adding new command-line switches requires adding corresponding // entries to enum "LoginCustomFlags" in histograms/enums.xml. See note in // enums.xml and don't forget to run AboutFlagsHistogramTest unit test.
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc index 26a67227..fc06a47 100644 --- a/chrome/browser/android/tab_web_contents_delegate_android.cc +++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -45,6 +45,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/file_chooser_params.h" +#include "content/public/common/media_stream_request.h" #include "jni/TabWebContentsDelegateAndroid_jni.h" #include "ppapi/features/features.h" #include "ui/gfx/geometry/rect.h" @@ -283,8 +284,11 @@ const content::MediaStreamRequest& request, const content::MediaResponseCallback& callback) { #if BUILDFLAG(ENABLE_VR) - if (vr_shell::VrTabHelper::IsInVr(web_contents)) + if (vr_shell::VrTabHelper::IsInVr(web_contents)) { + callback.Run(content::MediaStreamDevices(), + content::MEDIA_DEVICE_NOT_SUPPORTED, nullptr); return; + } #endif MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( web_contents, request, callback, nullptr);
diff --git a/chrome/browser/background_sync/OWNERS b/chrome/browser/background_sync/OWNERS index a97cadfa..f6372cb 100644 --- a/chrome/browser/background_sync/OWNERS +++ b/chrome/browser/background_sync/OWNERS
@@ -1,4 +1,7 @@ iclelland@chromium.org jkarlin@chromium.org +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # COMPONENT: Blink>BackgroundSync
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc index 59e0a228f..a893424 100644 --- a/chrome/browser/banners/app_banner_manager.cc +++ b/chrome/browser/banners/app_banner_manager.cc
@@ -434,7 +434,7 @@ AppBannerSettingsHelper::HasSufficientEngagement(score)) { has_sufficient_engagement_ = true; - if (is_pending_engagement()) { + if (state_ == State::PENDING_ENGAGEMENT) { // We have already finished the installability eligibility checks. Proceed // directly to sending the banner prompt request. UpdateState(State::ACTIVE);
diff --git a/chrome/browser/banners/app_banner_manager.h b/chrome/browser/banners/app_banner_manager.h index 1131063..e0c9877 100644 --- a/chrome/browser/banners/app_banner_manager.h +++ b/chrome/browser/banners/app_banner_manager.h
@@ -50,6 +50,43 @@ public blink::mojom::AppBannerService, public SiteEngagementObserver { public: + enum class State { + // The banner pipeline has not yet been triggered for this page load. + INACTIVE, + + // The banner pipeline is currently running for this page load. + ACTIVE, + + // The banner pipeline is currently waiting for the page manifest to be + // fetched. + FETCHING_MANIFEST, + + // The banner pipeline is currently waiting for the installability criteria + // to be checked. In this state the pipeline could be paused while waiting + // for the site to register a service worker. + PENDING_INSTALLABLE_CHECK, + + // The banner pipeline has finished running, but is waiting for sufficient + // engagement to trigger the banner. + PENDING_ENGAGEMENT, + + // The banner has sent the beforeinstallprompt event and is waiting for the + // response to the event. + SENDING_EVENT, + + // The banner has sent the beforeinstallprompt, and the web page called + // prompt on the event while the event was being handled. + SENDING_EVENT_GOT_EARLY_PROMPT, + + // The banner pipeline has finished running, but is waiting for the web page + // to call prompt on the event. + PENDING_PROMPT, + + // The banner pipeline has finished running for this page load and no more + // processing is to be done. + COMPLETE, + }; + // Returns the current time. static base::Time GetCurrentTime(); @@ -92,43 +129,6 @@ virtual void OnAppIconFetched(const SkBitmap& bitmap) {} protected: - enum class State { - // The banner pipeline has not yet been triggered for this page load. - INACTIVE, - - // The banner pipeline is currently running for this page load. - ACTIVE, - - // The banner pipeline is currently waiting for the page manifest to be - // fetched. - FETCHING_MANIFEST, - - // The banner pipeline is currently waiting for the installability criteria - // to be checked. In this state the pipeline could be paused while waiting - // for the site to register a service worker. - PENDING_INSTALLABLE_CHECK, - - // The banner pipeline has finished running, but is waiting for sufficient - // engagement to trigger the banner. - PENDING_ENGAGEMENT, - - // The banner has sent the beforeinstallprompt event and is waiting for the - // response to the event. - SENDING_EVENT, - - // The banner has sent the beforeinstallprompt, and the web page called - // prompt on the event while the event was being handled. - SENDING_EVENT_GOT_EARLY_PROMPT, - - // The banner pipeline has finished running, but is waiting for the web page - // to call prompt on the event. - PENDING_PROMPT, - - // The banner pipeline has finished running for this page load and no more - // processing is to be done. - COMPLETE, - }; - explicit AppBannerManager(content::WebContents* web_contents); ~AppBannerManager() override; @@ -224,11 +224,7 @@ // Subclass accessors for private fields which should not be changed outside // this class. InstallableManager* manager() const { return manager_; } - bool is_inactive() const { return state_ == State::INACTIVE; } - bool is_complete() const { return state_ == State::COMPLETE; } - bool is_pending_engagement() const { - return state_ == State::PENDING_ENGAGEMENT; - } + State state() const { return state_; } bool IsRunning() const; bool IsWaitingForData() const;
diff --git a/chrome/browser/banners/app_banner_manager_browsertest.cc b/chrome/browser/banners/app_banner_manager_browsertest.cc index 3328089..b190237 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest.cc +++ b/chrome/browser/banners/app_banner_manager_browsertest.cc
@@ -4,6 +4,8 @@ #include <vector> +#include "base/bind.h" +#include "base/callback.h" #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -30,6 +32,8 @@ namespace banners { +using State = AppBannerManager::State; + // Browser tests for web app banners. // NOTE: this test relies on service workers; failures and flakiness may be due // to changes in SW code. @@ -54,13 +58,7 @@ void clear_will_show() { will_show_.reset(); } - bool is_inactive() { return AppBannerManager::is_inactive(); } - - bool is_complete() { return AppBannerManager::is_complete(); } - - bool is_pending_engagement() { - return AppBannerManager::is_pending_engagement(); - } + State state() { return AppBannerManager::state(); } bool need_to_log_status() { return need_to_log_status_; } @@ -178,7 +176,7 @@ ui_test_utils::NavigateToURL(browser, test_url); EXPECT_FALSE(manager->will_show()); - EXPECT_TRUE(manager->is_inactive()); + EXPECT_EQ(State::INACTIVE, manager->state()); histograms.ExpectTotalCount(banners::kMinutesHistogram, 0); histograms.ExpectTotalCount(banners::kInstallableStatusCodeHistogram, @@ -202,7 +200,8 @@ // Generally the manager will be in the complete state, however some test // cases navigate the page, causing the state to go back to INACTIVE. - EXPECT_TRUE(manager->is_complete() || manager->is_inactive()); + EXPECT_TRUE(manager->state() == State::COMPLETE || + manager->state() == State::INACTIVE); // Check the tab title; this allows the test page to send data back out to // be inspected by the test case. @@ -226,6 +225,39 @@ } } + void TriggerBannerFlowWithNavigation(Browser* browser, + AppBannerManagerTest* manager, + const GURL& url, + bool expected_will_show, + bool expected_need_to_log_status, + State expected_state) { + // Use NavigateToURLWithDisposition as it isn't overloaded, so can be used + // with Bind. + TriggerBannerFlow( + browser, manager, + base::BindOnce(&ui_test_utils::NavigateToURLWithDisposition, browser, + url, WindowOpenDisposition::CURRENT_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION), + expected_will_show, expected_need_to_log_status, expected_state); + } + + void TriggerBannerFlow(Browser* browser, + AppBannerManagerTest* manager, + base::OnceClosure trigger_task, + bool expected_will_show, + bool expected_need_to_log_status, + State expected_state) { + base::RunLoop run_loop; + manager->clear_will_show(); + manager->Prepare(run_loop.QuitClosure()); + std::move(trigger_task).Run(); + run_loop.Run(); + + EXPECT_EQ(expected_will_show, manager->will_show()); + EXPECT_EQ(expected_need_to_log_status, manager->need_to_log_status()); + EXPECT_EQ(expected_state, manager->state()); + } + base::test::ScopedFeatureList feature_list_; }; @@ -458,33 +490,20 @@ // First run through: expect the manager to end up stopped in the pending // state, without showing a banner. - { - base::RunLoop run_loop; - manager->clear_will_show(); - manager->Prepare(run_loop.QuitClosure()); - ui_test_utils::NavigateToURL(browser(), test_url); - run_loop.Run(); - } - - EXPECT_FALSE(manager->will_show()); - EXPECT_TRUE(manager->is_pending_engagement()); - EXPECT_TRUE(manager->need_to_log_status()); + TriggerBannerFlowWithNavigation( + browser(), manager.get(), test_url, false /* expected_will_show */, + true /* expected_need_to_log_status */, State::PENDING_ENGAGEMENT); // Trigger an engagement increase that signals observers and expect the banner // to be shown. - { - base::RunLoop run_loop; - manager->clear_will_show(); - manager->Prepare(run_loop.QuitClosure()); - service->HandleNavigation( - browser()->tab_strip_model()->GetActiveWebContents(), - ui::PageTransition::PAGE_TRANSITION_TYPED); - run_loop.Run(); - } - - EXPECT_TRUE(manager->will_show()); - EXPECT_FALSE(manager->need_to_log_status()); - EXPECT_TRUE(manager->is_complete()); + TriggerBannerFlow( + browser(), manager.get(), + base::BindOnce(&SiteEngagementService::HandleNavigation, + base::Unretained(service), + browser()->tab_strip_model()->GetActiveWebContents(), + ui::PageTransition::PAGE_TRANSITION_TYPED), + true /* expected_will_show */, false /* expected_need_to_log_status */, + State::COMPLETE); histograms.ExpectTotalCount(banners::kMinutesHistogram, 1); histograms.ExpectUniqueSample(banners::kInstallableStatusCodeHistogram, @@ -504,30 +523,15 @@ // First run through: expect the manager to end up stopped in the pending // state, without showing a banner. - { - base::RunLoop run_loop; - manager->clear_will_show(); - manager->Prepare(run_loop.QuitClosure()); - ui_test_utils::NavigateToURL(browser(), test_url); - run_loop.Run(); - } - - EXPECT_FALSE(manager->will_show()); - EXPECT_TRUE(manager->is_pending_engagement()); - EXPECT_TRUE(manager->need_to_log_status()); + TriggerBannerFlowWithNavigation( + browser(), manager.get(), test_url, false /* expected_will_show */, + true /* expected_need_to_log_status */, State::PENDING_ENGAGEMENT); // Navigate and expect Stop() to be called. - { - base::RunLoop run_loop; - manager->clear_will_show(); - manager->Prepare(run_loop.QuitClosure()); - ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); - run_loop.Run(); - } - - EXPECT_FALSE(manager->will_show()); - EXPECT_TRUE(manager->is_inactive()); - EXPECT_FALSE(manager->need_to_log_status()); + TriggerBannerFlowWithNavigation(browser(), manager.get(), GURL("about:blank"), + false /* expected_will_show */, + false /* expected_need_to_log_status */, + State::INACTIVE); histograms.ExpectTotalCount(banners::kMinutesHistogram, 0); histograms.ExpectUniqueSample(banners::kInstallableStatusCodeHistogram,
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 7932191..18abb5a 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -802,8 +802,7 @@ void ChromeBrowserMainParts::StartMetricsRecording() { TRACE_EVENT0("startup", "ChromeBrowserMainParts::StartMetricsRecording"); - g_browser_process->metrics_service()->CheckForClonedInstall( - BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); + g_browser_process->metrics_service()->CheckForClonedInstall(); // Register a synthetic field trial for the sampling profiler configuration // that was already chosen.
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 50373fe..96d3b40 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -35,6 +35,7 @@ #include "base/win/windows_version.h" #include "base/win/wrapped_window_proc.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/conflicts/enumerate_input_method_editors_win.h" #include "chrome/browser/conflicts/module_database_win.h" #include "chrome/browser/conflicts/module_event_sink_impl_win.h" #include "chrome/browser/conflicts/shell_extension_enumerator_win.h" @@ -208,7 +209,7 @@ // the provided |module_watcher| and |shell_extension_enumerator|. void SetupModuleDatabase( std::unique_ptr<ModuleWatcher>* module_watcher, - std::unique_ptr<ShellExtensionEnumerator>* shell_extension_enumerator_) { + std::unique_ptr<ShellExtensionEnumerator>* shell_extension_enumerator) { uint64_t creation_time = 0; ModuleEventSinkImpl::GetProcessCreationTime(::GetCurrentProcess(), &creation_time); @@ -225,10 +226,27 @@ module_database->OnProcessStarted(process_id, creation_time, content::PROCESS_TYPE_BROWSER); *module_watcher = ModuleWatcher::Create( - base::Bind(&OnModuleEvent, process_id, creation_time)); - *shell_extension_enumerator_ = base::MakeUnique<ShellExtensionEnumerator>( - base::Bind(&ModuleDatabase::OnShellExtensionEnumerated, - base::Unretained(module_database))); + base::BindRepeating(&OnModuleEvent, process_id, creation_time)); + + // Enumerate shell extensions and input method editors. It is safe to use + // base::Unretained() here because the ModuleDatabase is never freed. + *shell_extension_enumerator = base::MakeUnique<ShellExtensionEnumerator>( + base::BindRepeating(&ModuleDatabase::OnShellExtensionEnumerated, + base::Unretained(module_database))); + EnumerateInputMethodEditors(base::BindRepeating( + &ModuleDatabase::OnImeEnumerated, base::Unretained(module_database))); +} + +void ShowCloseBrowserFirstMessageBox() { + int message_id = IDS_UNINSTALL_CLOSE_APP; + if (base::win::GetVersion() >= base::win::VERSION_WIN8 && + (shell_integration::GetDefaultBrowser() == + shell_integration::IS_DEFAULT)) { + message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE; + } + chrome::ShowWarningMessageBox(NULL, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), + l10n_util::GetStringUTF16(message_id)); } void MaybePostSettingsResetPrompt() { @@ -243,18 +261,6 @@ } // namespace -void ShowCloseBrowserFirstMessageBox() { - int message_id = IDS_UNINSTALL_CLOSE_APP; - if (base::win::GetVersion() >= base::win::VERSION_WIN8 && - (shell_integration::GetDefaultBrowser() == - shell_integration::IS_DEFAULT)) { - message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE; - } - chrome::ShowWarningMessageBox(NULL, - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), - l10n_util::GetStringUTF16(message_id)); -} - int DoUninstallTasks(bool chrome_still_running) { // We want to show a warning to user (and exit) if Chrome is already running // *before* we show the uninstall confirmation dialog box. But while the
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 17f899b..824183f 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -73,6 +73,7 @@ #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" +#include "chrome/browser/resource_coordinator/background_tab_navigation_throttle.h" #include "chrome/browser/safe_browsing/browser_url_loader_throttle.h" #include "chrome/browser/safe_browsing/certificate_reporting_service.h" #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" @@ -880,6 +881,13 @@ APIPermission::kBackground) && process_map->Contains(extension->id(), opener_render_process_id); } + +void InvokeCallbackOnThread( + scoped_refptr<base::SequencedTaskRunner> task_runner, + base::Callback<void(bool)> callback, + bool result) { + task_runner->PostTask(FROM_HERE, base::Bind(std::move(callback), result)); +} #endif } // namespace @@ -2070,9 +2078,11 @@ base::BindOnce( &ChromeContentBrowserClient::RequestFileSystemPermissionOnUIThread, it->first, it->second, url, allow, - base::Bind(&ChromeContentBrowserClient::FileSystemAccessed, - weak_factory_.GetWeakPtr(), url, render_frames, - callback))); + base::Bind( + &ChromeContentBrowserClient::FileSystemAccessed, + weak_factory_.GetWeakPtr(), url, render_frames, + base::Bind(&InvokeCallbackOnThread, + base::SequencedTaskRunnerHandle::Get(), callback)))); } void ChromeContentBrowserClient::RequestFileSystemPermissionOnUIThread( @@ -3275,6 +3285,16 @@ &throttles); } +#if !defined(OS_ANDROID) + // BackgroundTabNavigationThrottle is used by TabManager, which is only + // enabled on non-Android platforms. + std::unique_ptr<content::NavigationThrottle> + background_tab_navigation_throttle = resource_coordinator:: + BackgroundTabNavigationThrottle::MaybeCreateThrottleFor(handle); + if (background_tab_navigation_throttle) + throttles.push_back(std::move(background_tab_navigation_throttle)); +#endif + return throttles; }
diff --git a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc index 382f660..1b152e0 100644 --- a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc +++ b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc
@@ -128,14 +128,14 @@ // Log a warning message because, for now, this should not basically happen // except for some exceptional situation or due to some bug. - LOG(WARNING) << "Migration has happend for an ARC-disallowed user."; + LOG(WARNING) << "Migration has happened for an ARC-disallowed user."; } else { message_center::NotifierId notifier_id( message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); notifier_id.profile_id = account_id.GetUserEmail(); // Delay the notification to make sure that it is not hidden behind windows - // which are shown at the beginnig of user session (e.g. Chrome). + // which are shown at the beginning of user session (e.g. Chrome). base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&DoShowArcMigrationSuccessNotification, notifier_id),
diff --git a/chrome/browser/chromeos/arc/arc_migration_guide_notification.h b/chrome/browser/chromeos/arc/arc_migration_guide_notification.h index 61760d9a..29de908 100644 --- a/chrome/browser/chromeos/arc/arc_migration_guide_notification.h +++ b/chrome/browser/chromeos/arc/arc_migration_guide_notification.h
@@ -10,12 +10,12 @@ namespace arc { // Shows a notification for guiding the user for file system migration. -// This is used when an ARC app is launched while ARC is temporaliry disabled +// This is used when an ARC app is launched while ARC is temporarily disabled // due to the file system incompatibility. void ShowArcMigrationGuideNotification(Profile* profile); // Shows a one-time notification when this is the first sign-in after the -// migration has happend successfully. It records the fact to the pref that no +// migration has happened successfully. It records the fact to the pref that no // more notification is necessary, either when it showed the notification or // when the profile is newly created on the compatible filesystem. void ShowArcMigrationSuccessNotificationIfNeeded(Profile* profile);
diff --git a/chrome/browser/chromeos/arc/arc_service_launcher.cc b/chrome/browser/chromeos/arc/arc_service_launcher.cc index 2c72c4d..fab7b60 100644 --- a/chrome/browser/chromeos/arc/arc_service_launcher.cc +++ b/chrome/browser/chromeos/arc/arc_service_launcher.cc
@@ -112,8 +112,8 @@ base::MakeUnique<ArcFileSystemMounter>(arc_bridge_service)); arc_service_manager_->AddService( base::MakeUnique<ArcImeService>(arc_bridge_service)); - arc_service_manager_->AddService(base::MakeUnique<ArcIntentHelperBridge>( - arc_bridge_service, arc_service_manager_->activity_resolver())); + arc_service_manager_->AddService( + base::MakeUnique<ArcIntentHelperBridge>(arc_bridge_service)); arc_service_manager_->AddService( base::MakeUnique<ArcMetricsService>(arc_bridge_service)); arc_service_manager_->AddService(
diff --git a/chrome/browser/chromeos/arc/arc_util.h b/chrome/browser/chromeos/arc/arc_util.h index 7555419..c28d5c4 100644 --- a/chrome/browser/chromeos/arc/arc_util.h +++ b/chrome/browser/chromeos/arc/arc_util.h
@@ -27,11 +27,11 @@ // Values to be stored in the local state preference to keep track of the // filesystem encryption migration status. enum FileSystemCompatibilityState : int32_t { - // No migiration has happend, user keeps using the old file system. + // No migration has happened, user keeps using the old file system. kFileSystemIncompatible = 0, - // Migration has happend. New filesystem is in use. + // Migration has happened. New filesystem is in use. kFileSystemCompatible = 1, - // Migration has happend, and a notification about the fact was already shown. + // Migration has happened, and a notification about it was already shown. kFileSystemCompatibleAndNotified = 2, // Existing code assumes that kFileSystemIncompatible is the only state @@ -47,7 +47,7 @@ bool IsArcAllowedForProfile(const Profile* profile); // Returns true if the profile is temporarily blocked to run ARC in the current -// session, because the filesystem storing the profile is incomaptible with the +// session, because the filesystem storing the profile is incompatible with the // currently installed ARC version. // // The actual filesystem check is performed only when it is running on the
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc index 500b9b0..abc7ba4 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
@@ -13,7 +13,6 @@ #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_service_manager.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/intent_helper/local_activity_resolver.h" #include "components/arc/intent_helper/page_transition_util.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" @@ -179,9 +178,12 @@ if (!arc_service_manager) return content::NavigationThrottle::PROCEED; - scoped_refptr<LocalActivityResolver> local_resolver = - arc_service_manager->activity_resolver(); - if (local_resolver->ShouldChromeHandleUrl(url)) { + auto* intent_helper_bridge = + arc_service_manager->GetService<ArcIntentHelperBridge>(); + if (!intent_helper_bridge) + return content::NavigationThrottle::PROCEED; + + if (intent_helper_bridge->ShouldChromeHandleUrl(url)) { // Allow navigation to proceed if there isn't an android app that handles // the given URL. return content::NavigationThrottle::PROCEED;
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 770fca1e..42f3a31 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -1009,7 +1009,8 @@ BootTimesRecorder::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); - lock_screen_apps_state_controller_.reset(); + if (lock_screen_apps_state_controller_) + lock_screen_apps_state_controller_->Shutdown(); // This must be shut down before |arc_service_launcher_|. NoteTakingHelper::Shutdown();
diff --git a/chrome/browser/chromeos/lock_screen_apps/state_controller.cc b/chrome/browser/chromeos/lock_screen_apps/state_controller.cc index fbdd0b8..9de3541 100644 --- a/chrome/browser/chromeos/lock_screen_apps/state_controller.cc +++ b/chrome/browser/chromeos/lock_screen_apps/state_controller.cc
@@ -112,6 +112,19 @@ "" /* supervised_user_id */); } +void StateController::Shutdown() { + session_observer_.RemoveAll(); + if (app_manager_) { + app_manager_->Stop(); + ResetNoteTakingWindowAndMoveToNextState(true /*close_window*/); + app_manager_.reset(); + } + power_manager_client_observer_.RemoveAll(); + input_devices_observer_.RemoveAll(); + binding_.Close(); + weak_ptr_factory_.InvalidateWeakPtrs(); +} + void StateController::OnProfilesReady(Profile* primary_profile, Profile* lock_screen_profile, Profile::CreateStatus status) {
diff --git a/chrome/browser/chromeos/lock_screen_apps/state_controller.h b/chrome/browser/chromeos/lock_screen_apps/state_controller.h index ee98d89..016e220 100644 --- a/chrome/browser/chromeos/lock_screen_apps/state_controller.h +++ b/chrome/browser/chromeos/lock_screen_apps/state_controller.h
@@ -83,6 +83,17 @@ void Initialize(); void SetPrimaryProfile(Profile* profile); + // Shuts down the state controller, reseting all dependencies on profiles. + // Should be called on global instance before profile destruction starts. + // TODO(tbarzic): Consider removing this after lock screen implementation + // moves to ash - the main reason the method is needed is to enable + // SigninScreenHandler to safely remove itself as an observer on its + // destruction (which might happen after state controller has to be + // shutdown). When this is not the case anymore StateController::Shutdown + // usage can be replaced with destructing the StateController instance. + // https://crbug.com/741145 + void Shutdown(); + void AddObserver(StateObserver* observer); void RemoveObserver(StateObserver* observer);
diff --git a/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc b/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc index 97d46203..2df6fd7 100644 --- a/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc +++ b/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc
@@ -52,6 +52,9 @@ const char kTestAppId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; const char kSecondaryTestAppId[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; +// The primary tesing profile. +const char kPrimaryProfileName[] = "primary_profile"; + scoped_refptr<extensions::Extension> CreateTestNoteTakingApp( const std::string& app_id) { ListBuilder action_handlers; @@ -369,10 +372,28 @@ extensions::ExtensionSystem::Get(lock_screen_profile())->Shutdown(); state_controller_->RemoveObserver(&observer_); - state_controller_.reset(); + state_controller_->Shutdown(); session_manager_.reset(); app_manager_ = nullptr; + app_window_.reset(); BrowserWithTestWindowTest::TearDown(); + DestroyProfile(lock_screen_profile()); + } + + TestingProfile* CreateProfile() override { + return profile_manager_.CreateTestingProfile(kPrimaryProfileName); + } + + void DestroyProfile(TestingProfile* test_profile) override { + if (test_profile == profile()) { + profile_manager_.DeleteTestingProfile(kPrimaryProfileName); + } else if (test_profile == lock_screen_profile()) { + lock_screen_profile_ = nullptr; + profile_manager_.DeleteTestingProfile( + chromeos::ProfileHelper::GetLockScreenAppProfileName()); + } else { + ADD_FAILURE() << "Request to destroy unknown profile."; + } } void InitExtensionSystem(Profile* profile) { @@ -478,7 +499,6 @@ TrayActionState::kActive; } - TestingProfile* profile() { return &profile_; } TestingProfile* lock_screen_profile() { return lock_screen_profile_; } chromeos::FakePowerManagerClient* power_manager_client() { @@ -505,7 +525,6 @@ private: std::unique_ptr<base::test::ScopedCommandLine> command_line_; TestingProfileManager profile_manager_; - TestingProfile profile_; TestingProfile* lock_screen_profile_ = nullptr; // Run loop used to throttle test until async state controller initialization
diff --git a/chrome/browser/chromeos/login/enterprise_enrollment_browsertest.cc b/chrome/browser/chromeos/login/enterprise_enrollment_browsertest.cc index f45abfa..0e46ddf8 100644 --- a/chrome/browser/chromeos/login/enterprise_enrollment_browsertest.cc +++ b/chrome/browser/chromeos/login/enterprise_enrollment_browsertest.cc
@@ -166,7 +166,6 @@ "login.OAuthEnrollmentScreen.showStep = function(step) {" " testShowStep(step);" " if (step == 'working') {" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('ShowSpinnerScreen');" " }" "}"); @@ -175,7 +174,6 @@ "login.OAuthEnrollmentScreen.invalidateAd = function(machineName, " "user, errorState) {" " testInvalidateAd(machineName, user, errorState);" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('ShowJoinDomainError');" "}"); }
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index 4813f64..4d2446d7 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -843,7 +843,6 @@ int original_width; EXPECT_TRUE(content::ExecuteScriptAndExtractInt( window->web_contents(), - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(window.innerWidth);", &original_width)); @@ -859,7 +858,6 @@ int width_zoomed_in; EXPECT_TRUE(content::ExecuteScriptAndExtractInt( window->web_contents(), - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(window.innerWidth);", &width_zoomed_in)); DCHECK_LT(width_zoomed_in, original_width); @@ -870,7 +868,6 @@ int width_zoom_normal; EXPECT_TRUE(content::ExecuteScriptAndExtractInt( window->web_contents(), - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(window.innerWidth);", &width_zoom_normal)); DCHECK_EQ(width_zoom_normal, original_width); @@ -881,7 +878,6 @@ int width_zoomed_out; EXPECT_TRUE(content::ExecuteScriptAndExtractInt( window->web_contents(), - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(window.innerWidth);", &width_zoomed_out)); DCHECK_GT(width_zoomed_out, original_width); @@ -2229,7 +2225,6 @@ EXPECT_TRUE(content::ExecuteScriptAndExtractString( window->web_contents(), "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send(token);" "});", &result));
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index 44929f5..cd0a8b7 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -112,7 +112,6 @@ "authenticator.addEventListener('ready'," "function f() {" "authenticator.removeEventListener('ready', f);" - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send('offlineLoaded');" "});" "$('error-offline-login-link').onclick();" @@ -149,7 +148,6 @@ animated_pages + ".addEventListener('neon-animation-finish'," "function() {" - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send('switchToPassword');" "})"; ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); @@ -289,7 +287,6 @@ "var testInvalidateAd = login.GaiaSigninScreen.invalidateAd;" "login.GaiaSigninScreen.invalidateAd = function(user, errorState) {" " testInvalidateAd(user, errorState);" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('ShowAuthError');" "}"); }
diff --git a/chrome/browser/chromeos/login/oobe_screen.cc b/chrome/browser/chromeos/login/oobe_screen.cc index 0add6c67..60a8b6f 100644 --- a/chrome/browser/chromeos/login/oobe_screen.cc +++ b/chrome/browser/chromeos/login/oobe_screen.cc
@@ -4,8 +4,11 @@ #include "chrome/browser/chromeos/login/oobe_screen.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/macros.h" +#include "base/strings/string_split.h" +#include "chromeos/chromeos_switches.h" namespace chromeos { namespace { @@ -73,4 +76,16 @@ return OobeScreen::SCREEN_UNKNOWN; } +bool ForceShowOobeScreen(OobeScreen screen) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kOobeForceShowScreen)) + return false; + std::string option_str = + command_line->GetSwitchValueASCII(switches::kOobeForceShowScreen); + std::vector<std::string> screens = base::SplitString( + option_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + std::string name = GetOobeScreenName(screen); + return std::find(screens.begin(), screens.end(), name) != screens.end(); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/oobe_screen.h b/chrome/browser/chromeos/login/oobe_screen.h index e1877f48..b305d3e 100644 --- a/chrome/browser/chromeos/login/oobe_screen.h +++ b/chrome/browser/chromeos/login/oobe_screen.h
@@ -65,6 +65,9 @@ // Converts the JS name for the given sreen into a Screen instance. OobeScreen GetOobeScreenFromName(const std::string& name); +// Returns true if a command line argument requests |screen| to always be shown. +bool ForceShowOobeScreen(OobeScreen screen); + } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OOBE_SCREEN_H_
diff --git a/chrome/browser/chromeos/login/saml/saml_browsertest.cc b/chrome/browser/chromeos/login/saml/saml_browsertest.cc index a63586f..d63219f 100644 --- a/chrome/browser/chromeos/login/saml/saml_browsertest.cc +++ b/chrome/browser/chromeos/login/saml/saml_browsertest.cc
@@ -364,7 +364,6 @@ " function f() {" " $('gaia-signin').gaiaAuthHost_.removeEventListener(" " 'authFlowChange', f);" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send(" " $('gaia-signin').isSAML() ? 'SamlLoaded' : 'GaiaLoaded');" " });"); @@ -523,7 +522,6 @@ "$('gaia-signin').gaiaAuthHost_.addEventListener('authCompleted'," " function(e) {" " var password = e.detail.password;" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send(password);" " });")); @@ -1121,7 +1119,6 @@ ASSERT_TRUE(content::ExecuteScript( GetLoginUI()->GetWebContents(), "$('gaia-signin').gaiaAuthHost_.addEventListener('ready', function() {" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('ready');" "});" "$('add-user-button').click();")); @@ -1138,7 +1135,6 @@ "$('saml-interstitial').addEventListener(" " 'samlInterstitialPageReady'," " function() {" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send(" " 'samlInterstitialPageReady');" " });" @@ -1171,7 +1167,6 @@ ASSERT_TRUE(content::ExecuteScript( GetLoginUI()->GetWebContents(), "$('gaia-signin').gaiaAuthHost_.addEventListener('ready', function() {" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('ready');" "});" "$('saml-interstitial').changeAccountLink.click();"));
diff --git a/chrome/browser/chromeos/login/screens/user_image_screen.cc b/chrome/browser/chromeos/login/screens/user_image_screen.cc index fa74856..495fee8 100644 --- a/chrome/browser/chromeos/login/screens/user_image_screen.cc +++ b/chrome/browser/chromeos/login/screens/user_image_screen.cc
@@ -189,7 +189,10 @@ NOTREACHED(); } - if (GetUser()->CanSyncImage()) { + // If we have a synced image then we will exit this screen, so do not check + // for a synced image if we are force showing the screen for testing. + if (!ForceShowOobeScreen(OobeScreen::SCREEN_USER_IMAGE_PICKER) && + GetUser()->CanSyncImage()) { if (UserImageSyncObserver* sync_observer = GetSyncObserver()) { sync_waiting_start_time_ = base::Time::Now(); // We have synced image already.
diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.cc b/chrome/browser/chromeos/login/test/oobe_base_test.cc index 8139b03..df875259 100644 --- a/chrome/browser/chromeos/login/test/oobe_base_test.cc +++ b/chrome/browser/chromeos/login/test/oobe_base_test.cc
@@ -237,7 +237,6 @@ " var authenticator = $('gaia-signin').gaiaAuthHost_;" " var f = function() {" " authenticator.removeEventListener('ready', f);" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('GaiaReady');" " };" " authenticator.addEventListener('ready', f);"
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index ce2aca3..04bd2d56 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -1027,6 +1027,8 @@ void WizardController::SetCurrentScreenSmooth(BaseScreen* new_current, bool use_smoothing) { + VLOG(1) << "SetCurrentScreenrSmooth: " + << GetOobeScreenName(new_current->screen_id()); if (current_screen_ == new_current || new_current == nullptr || oobe_ui_ == nullptr) { return;
diff --git a/chrome/browser/conflicts/enumerate_input_method_editors_win.cc b/chrome/browser/conflicts/enumerate_input_method_editors_win.cc new file mode 100644 index 0000000..e4952f8 --- /dev/null +++ b/chrome/browser/conflicts/enumerate_input_method_editors_win.cc
@@ -0,0 +1,121 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/conflicts/enumerate_input_method_editors_win.h" + +#include <algorithm> +#include <iterator> +#include <utility> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/files/file_path.h" +#include "base/metrics/histogram_functions.h" +#include "base/strings/string16.h" +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "base/task_scheduler/post_task.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "base/win/registry.h" +#include "chrome/browser/conflicts/module_info_util_win.h" + +namespace { + +// Returns true if |ime_guid| is the GUID of a built-in Microsoft IME. +bool IsMicrosoftIme(const wchar_t* ime_guid) { + // This list was provided by Microsoft. + static constexpr const wchar_t* kMicrosoftImeGuids[] = { + L"{0000897b-83df-4b96-be07-0fb58b01c4a4}", + L"{03b5835f-f03c-411b-9ce2-aa23e1171e36}", + L"{07eb03d6-b001-41df-9192-bf9b841ee71f}", + L"{3697c5fa-60dd-4b56-92d4-74a569205c16}", + L"{531fdebf-9b4c-4a43-a2aa-960e8fcdc732}", + L"{6a498709-e00b-4c45-a018-8f9e4081ae40}", + L"{78cb5b0e-26ed-4fcc-854c-77e8f3d1aa80}", + L"{81d4e9c9-1d3b-41bc-9e6c-4b40bf79e35e}", + L"{8613e14c-d0c0-4161-ac0f-1dd2563286bc}", + L"{a028ae76-01b1-46c2-99c4-acd9858ae02f}", + L"{a1e2b86b-924a-4d43-80f6-8a820df7190f}", + L"{ae6be008-07fb-400d-8beb-337a64f7051f}", + L"{b115690a-ea02-48d5-a231-e3578d2fdf80}", + L"{c1ee01f2-b3b6-4a6a-9ddd-e988c088ec82}", + L"{dcbd6fa8-032f-11d3-b5b1-00c04fc324a1}", + L"{e429b25a-e5d3-4d1f-9be3-0c608477e3a1}", + L"{f25e9f57-2fc8-4eb3-a41a-cce5f08541e6}", + L"{f89e9e58-bd2f-4008-9ac2-0f816c09f4ee}", + L"{fa445657-9379-11d6-b41a-00065b83ee53}", + }; + + DCHECK(std::is_sorted(std::begin(kMicrosoftImeGuids), + std::end(kMicrosoftImeGuids))); + + return std::binary_search( + std::begin(kMicrosoftImeGuids), std::end(kMicrosoftImeGuids), ime_guid, + [](const wchar_t* lhs, const wchar_t* rhs) { + return base::CompareCaseInsensitiveASCII(lhs, rhs) == -1; + }); +} + +// Returns the path to the in-proc server DLL for |guid|, or an empty path if +// none is found. +base::FilePath GetInprocServerDllPath(const wchar_t* guid) { + base::string16 key_name = base::StringPrintf(kClassIdRegistryKeyFormat, guid); + base::win::RegKey registry_key; + base::string16 value; + if (registry_key.Open(HKEY_CLASSES_ROOT, key_name.c_str(), KEY_QUERY_VALUE) == + ERROR_SUCCESS && + registry_key.ReadValue(L"", &value) == ERROR_SUCCESS) { + return base::FilePath(value); + } + + return base::FilePath(); +} + +void EnumerateImesOnBlockingSequence( + scoped_refptr<base::SequencedTaskRunner> task_runner, + OnImeEnumeratedCallback callback) { + int nb_imes = 0; + for (base::win::RegistryKeyIterator iter(HKEY_LOCAL_MACHINE, kImeRegistryKey); + iter.Valid(); ++iter) { + const wchar_t* guid = iter.Name(); + + // Skip Microsoft IMEs since Chrome won't do anything about those. + if (IsMicrosoftIme(guid)) + continue; + + base::FilePath dll_path = GetInprocServerDllPath(guid); + if (dll_path.empty()) + continue; + + uint32_t size_of_image = 0; + uint32_t time_date_stamp = 0; + if (!GetModuleImageSizeAndTimeDateStamp(dll_path, &size_of_image, + &time_date_stamp)) { + continue; + } + + nb_imes++; + task_runner->PostTask(FROM_HERE, + base::BindRepeating(callback, dll_path, size_of_image, + time_date_stamp)); + } + + base::UmaHistogramCounts100("ThirdPartyModules.InputMethodEditorsCount", + nb_imes); +} + +} // namespace + +const wchar_t kImeRegistryKey[] = L"SOFTWARE\\Microsoft\\CTF\\TIP"; +const wchar_t kClassIdRegistryKeyFormat[] = L"CLSID\\%ls\\InProcServer32"; + +void EnumerateInputMethodEditors(OnImeEnumeratedCallback callback) { + base::PostTaskWithTraits( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + base::BindOnce(&EnumerateImesOnBlockingSequence, + base::SequencedTaskRunnerHandle::Get(), + std::move(callback))); +}
diff --git a/chrome/browser/conflicts/enumerate_input_method_editors_win.h b/chrome/browser/conflicts/enumerate_input_method_editors_win.h new file mode 100644 index 0000000..b1426dc --- /dev/null +++ b/chrome/browser/conflicts/enumerate_input_method_editors_win.h
@@ -0,0 +1,30 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CONFLICTS_ENUMERATE_INPUT_METHOD_EDITORS_WIN_H_ +#define CHROME_BROWSER_CONFLICTS_ENUMERATE_INPUT_METHOD_EDITORS_WIN_H_ + +#include <stdint.h> + +#include "base/callback_forward.h" + +namespace base { +class FilePath; +} + +// The path to the registry key where IMEs are registered. +extern const wchar_t kImeRegistryKey[]; + +// A format string for generating paths to COM class in-proc server keys under +// HKEY_CLASSES_ROOT. +extern const wchar_t kClassIdRegistryKeyFormat[]; + +// Finds third-party IMEs (Input Method Editor) installed on the computer by +// enumerating the registry. In addition to the file path, the SizeOfImage and +// TimeDateStamp of the module is returned via the callback. +using OnImeEnumeratedCallback = + base::RepeatingCallback<void(const base::FilePath&, uint32_t, uint32_t)>; +void EnumerateInputMethodEditors(OnImeEnumeratedCallback callback); + +#endif // CHROME_BROWSER_CONFLICTS_ENUMERATE_INPUT_METHOD_EDITORS_WIN_H_
diff --git a/chrome/browser/conflicts/enumerate_input_method_editors_win_unittest.cc b/chrome/browser/conflicts/enumerate_input_method_editors_win_unittest.cc new file mode 100644 index 0000000..69030dc --- /dev/null +++ b/chrome/browser/conflicts/enumerate_input_method_editors_win_unittest.cc
@@ -0,0 +1,105 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/conflicts/enumerate_input_method_editors_win.h" + +#include <vector> + +#include "base/bind.h" +#include "base/files/file_path.h" +#include "base/macros.h" +#include "base/path_service.h" +#include "base/strings/stringprintf.h" +#include "base/test/scoped_task_environment.h" +#include "base/test/test_reg_util_win.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +class EnumerateInputMethodEditorsTest : public testing::Test { + protected: + EnumerateInputMethodEditorsTest() = default; + ~EnumerateInputMethodEditorsTest() override = default; + + void SetUp() override { + // Override all registry hives so that real IMEs don't mess up the unit + // tests. + ASSERT_NO_FATAL_FAILURE( + registry_override_manager_.OverrideRegistry(HKEY_CLASSES_ROOT)); + ASSERT_NO_FATAL_FAILURE( + registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); + ASSERT_NO_FATAL_FAILURE( + registry_override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE)); + } + + void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + + private: + base::test::ScopedTaskEnvironment scoped_task_environment_; + + registry_util::RegistryOverrideManager registry_override_manager_; + + DISALLOW_COPY_AND_ASSIGN(EnumerateInputMethodEditorsTest); +}; + +// Adds a fake IME entry to the registry that should be found by the +// enumeration. The call must be wrapped inside an ASSERT_NO_FATAL_FAILURE. +void RegisterFakeIme(const wchar_t* guid, const wchar_t* path) { + base::win::RegKey class_id( + HKEY_CLASSES_ROOT, + base::StringPrintf(kClassIdRegistryKeyFormat, guid).c_str(), KEY_WRITE); + ASSERT_TRUE(class_id.Valid()); + + ASSERT_EQ(ERROR_SUCCESS, class_id.WriteValue(nullptr, path)); + + base::win::RegKey registration(HKEY_LOCAL_MACHINE, kImeRegistryKey, + KEY_WRITE); + ASSERT_EQ(ERROR_SUCCESS, registration.CreateKey(guid, KEY_WRITE)); +} + +void OnImeEnumerated(std::vector<base::FilePath>* imes, + const base::FilePath& ime_path, + uint32_t size_of_image, + uint32_t time_date_stamp) { + imes->push_back(ime_path); +} + +} // namespace + +// Registers a few fake IMEs then see if the enumeration finds them. +TEST_F(EnumerateInputMethodEditorsTest, EnumerateImes2) { + // Use the current exe file as an arbitrary module that exists. + base::FilePath file_exe; + ASSERT_TRUE(base::PathService::Get(base::FILE_EXE, &file_exe)); + ASSERT_NO_FATAL_FAILURE( + RegisterFakeIme(L"{FAKE_GUID}", file_exe.value().c_str())); + + // Do the asynchronous enumeration. + std::vector<base::FilePath> imes; + EnumerateInputMethodEditors( + base::Bind(&OnImeEnumerated, base::Unretained(&imes))); + + RunUntilIdle(); + + EXPECT_EQ(1u, imes.size()); + EXPECT_EQ(file_exe, imes[0]); +} + +TEST_F(EnumerateInputMethodEditorsTest, SkipMicrosoftImes) { + static constexpr wchar_t kMicrosoftImeExample[] = + L"{6a498709-e00b-4c45-a018-8f9e4081ae40}"; + + // Register a fake IME using the Microsoft IME guid. + ASSERT_NO_FATAL_FAILURE( + RegisterFakeIme(kMicrosoftImeExample, L"c:\\path\\to\\ime.dll")); + + // Do the asynchronous enumeration. + std::vector<base::FilePath> imes; + EnumerateInputMethodEditors( + base::Bind(&OnImeEnumerated, base::Unretained(&imes))); + + RunUntilIdle(); + + EXPECT_TRUE(imes.empty()); +}
diff --git a/chrome/browser/conflicts/module_database_win.cc b/chrome/browser/conflicts/module_database_win.cc index 46f1e7f1..65417ec 100644 --- a/chrome/browser/conflicts/module_database_win.cc +++ b/chrome/browser/conflicts/module_database_win.cc
@@ -77,14 +77,27 @@ void ModuleDatabase::OnShellExtensionEnumerated(const base::FilePath& path, uint32_t size_of_image, uint32_t time_date_stamp) { + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + idle_timer_.Reset(); - DCHECK(task_runner_->RunsTasksInCurrentSequence()); auto* module_info = FindOrCreateModuleInfo(path, size_of_image, time_date_stamp); module_info->second.module_types |= ModuleInfoData::kTypeShellExtension; } +void ModuleDatabase::OnImeEnumerated(const base::FilePath& path, + uint32_t size_of_image, + uint32_t time_date_stamp) { + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + + idle_timer_.Reset(); + + auto* module_info = + FindOrCreateModuleInfo(path, size_of_image, time_date_stamp); + module_info->second.module_types |= ModuleInfoData::kTypeIme; +} + void ModuleDatabase::OnModuleLoad(uint32_t process_id, uint64_t creation_time, const base::FilePath& module_path,
diff --git a/chrome/browser/conflicts/module_database_win.h b/chrome/browser/conflicts/module_database_win.h index d239bf2..ba1d1c2 100644 --- a/chrome/browser/conflicts/module_database_win.h +++ b/chrome/browser/conflicts/module_database_win.h
@@ -84,6 +84,12 @@ uint32_t size_of_image, uint32_t time_date_stamp); + // Indicates that a new registered input method editor was found. Must be + // called in the same sequence as |task_runner_|. + void OnImeEnumerated(const base::FilePath& path, + uint32_t size_of_image, + uint32_t time_date_stamp); + // Indicates that a module has been loaded. The data passed to this function // is taken as gospel, so if it originates from a remote process it should be // independently validated first. (In practice, see ModuleEventSinkImpl for
diff --git a/chrome/browser/conflicts/module_info_util_win.cc b/chrome/browser/conflicts/module_info_util_win.cc index 4da8bb6..9059453b 100644 --- a/chrome/browser/conflicts/module_info_util_win.cc +++ b/chrome/browser/conflicts/module_info_util_win.cc
@@ -24,6 +24,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/win/scoped_handle.h" +#include "chrome/common/safe_browsing/pe_image_reader_win.h" namespace { @@ -218,21 +219,6 @@ certificate_info->subject = subject; } -// Helper function to get a value at a specific offset in a buffer. Also does -// bounds checking. -template <typename T> -bool GetValueAtOffset(const char* buffer, - uint64_t offset, - const size_t buffer_size, - T* result) { - // Bounds checking. - if (offset + sizeof(T) >= buffer_size) - return false; - - memcpy(result, &buffer[offset], sizeof(T)); - return true; -} - } // namespace // ModuleDatabase::CertificateInfo --------------------------------------------- @@ -317,41 +303,20 @@ // the file in a well-formed dll. constexpr size_t kPageSize = 4096; - char buffer[kPageSize]; - int bytes_read = file.Read(0, buffer, kPageSize); + // Note: base::MakeUnique() is explicitly avoided because it does value- + // initialization on arrays, which is not needed in this case. + auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[kPageSize]); + int bytes_read = + file.Read(0, reinterpret_cast<char*>(buffer.get()), kPageSize); if (bytes_read == -1) return false; - // Get NT header offset. - uint64_t nt_header_offset = offsetof(IMAGE_DOS_HEADER, e_lfanew); - - LONG e_lfanew = 0; - if (!GetValueAtOffset(buffer, nt_header_offset, bytes_read, &e_lfanew)) + safe_browsing::PeImageReader pe_image_reader; + if (!pe_image_reader.Initialize(buffer.get(), bytes_read)) return false; - // Check magic signature. - uint64_t nt_signature_offset = - e_lfanew + offsetof(IMAGE_NT_HEADERS, Signature); + *size_of_image = pe_image_reader.GetSizeOfImage(); + *time_date_stamp = pe_image_reader.GetCoffFileHeader()->TimeDateStamp; - DWORD nt_signature = 0; - if (!GetValueAtOffset(buffer, nt_signature_offset, bytes_read, &nt_signature)) - return false; - - if (nt_signature != IMAGE_NT_SIGNATURE) - return false; - - // Get SizeOfImage. - uint64_t size_of_image_offset = e_lfanew + - offsetof(IMAGE_NT_HEADERS, OptionalHeader) + - offsetof(IMAGE_OPTIONAL_HEADER, SizeOfImage); - if (!GetValueAtOffset(buffer, size_of_image_offset, bytes_read, - size_of_image)) - return false; - - // Get TimeDateStamp. - uint64_t time_date_stamp_offset = e_lfanew + - offsetof(IMAGE_NT_HEADERS, FileHeader) + - offsetof(IMAGE_FILE_HEADER, TimeDateStamp); - return GetValueAtOffset(buffer, time_date_stamp_offset, bytes_read, - time_date_stamp); + return true; }
diff --git a/chrome/browser/conflicts/module_info_win.h b/chrome/browser/conflicts/module_info_win.h index cb870da5..779c0a5 100644 --- a/chrome/browser/conflicts/module_info_win.h +++ b/chrome/browser/conflicts/module_info_win.h
@@ -78,12 +78,15 @@ // useful to the ModuleDatabase. struct ModuleInfoData { // The possible types of module we are dealing with. Used as bit set values. - - // These modules are or were loaded into one of chrome's process at some - // point. - static constexpr uint32_t kTypeLoadedModule = 1 << 0; - // These modules are registered as a shell extension. - static constexpr uint32_t kTypeShellExtension = 1 << 1; + enum ModuleType : uint32_t { + // These modules are or were loaded into one of chrome's process at some + // point. + kTypeLoadedModule = 1 << 0, + // These modules are registered as a shell extension. + kTypeShellExtension = 1 << 1, + // These modules are registered as an Input Method Editor. + kTypeIme = 1 << 2, + }; ModuleInfoData(); ~ModuleInfoData();
diff --git a/chrome/browser/extensions/api/feedback_private/single_log_source_factory.cc b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.cc index f4b2e24..e372ab08 100644 --- a/chrome/browser/extensions/api/feedback_private/single_log_source_factory.cc +++ b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/extensions/api/feedback_private/single_log_source_factory.h" #include "base/memory/ptr_util.h" +#include "chrome/browser/chromeos/system_logs/single_debug_daemon_log_source.h" #include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h" namespace extensions { @@ -13,6 +14,7 @@ namespace feedback_private = api::feedback_private; +using system_logs::SingleDebugDaemonLogSource; using system_logs::SingleLogFileLogSource; using system_logs::SystemLogsSource; @@ -33,6 +35,12 @@ case feedback_private::LOG_SOURCE_UILATEST: return base::MakeUnique<system_logs::SingleLogFileLogSource>( SingleLogFileLogSource::SupportedSource::kUiLatest); + case feedback_private::LOG_SOURCE_DRMMODETEST: + return base::MakeUnique<system_logs::SingleDebugDaemonLogSource>( + SingleDebugDaemonLogSource::SupportedSource::kModetest); + case feedback_private::LOG_SOURCE_LSUSB: + return base::MakeUnique<system_logs::SingleDebugDaemonLogSource>( + SingleDebugDaemonLogSource::SupportedSource::kLsusb); case feedback_private::LOG_SOURCE_NONE: default: NOTREACHED() << "Unknown log source type.";
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc index d7e6a373..68842631 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -197,10 +197,6 @@ return task_runner_; } -void NativeMessageProcessHost::ReadNowForTesting() { - DoRead(); -} - void NativeMessageProcessHost::WaitRead() { if (closed_) return;
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h index 1f9a2f13..2ddef67 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host.h +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -55,10 +55,6 @@ void Start(Client* client) override; scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; - // Try and read a single message from |read_file_|. This should only be called - // in unittests when you know there is data in the file. - void ReadNowForTesting(); - private: NativeMessageProcessHost(const std::string& source_extension_id, const std::string& native_host_name,
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc index 4d8cf88d..a0cf87625 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
@@ -18,6 +18,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/json/json_reader.h" #include "base/message_loop/message_loop.h" +#include "base/process/process_metrics.h" #include "base/rand_util.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" @@ -114,7 +115,7 @@ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } void TearDown() override { - if (native_message_host_.get()) { + if (native_message_host_) { BrowserThread::DeleteSoon( BrowserThread::IO, FROM_HERE, native_message_host_.release()); } @@ -184,26 +185,33 @@ // Read a single message from a local file. TEST_F(NativeMessagingTest, SingleSendMessageRead) { base::FilePath temp_output_file = temp_dir_.GetPath().AppendASCII("output"); +#if defined(OS_WIN) base::FilePath temp_input_file = CreateTempFileWithMessage(kTestMessage); ASSERT_FALSE(temp_input_file.empty()); - std::unique_ptr<NativeProcessLauncher> launcher = FakeLauncher::Create(temp_input_file, temp_output_file); +#else // defined(OS_WIN) + base::PlatformFile pipe_handles[2]; + ASSERT_EQ(0, pipe(pipe_handles)); + base::File read_file(pipe_handles[0]); + std::string formatted_message = FormatMessage(kTestMessage); + ASSERT_GT(base::GetPageSize(), formatted_message.size()); + ASSERT_TRUE(base::WriteFileDescriptor( + pipe_handles[1], formatted_message.data(), formatted_message.size())); + base::File write_file(pipe_handles[1]); + std::unique_ptr<NativeProcessLauncher> launcher = + FakeLauncher::CreateWithPipeInput(std::move(read_file), temp_output_file); +#endif // defined(OS_WIN) native_message_host_ = NativeMessageProcessHost::CreateWithLauncher( ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py", std::move(launcher)); + ASSERT_TRUE(last_message_.empty()); native_message_host_->Start(this); - ASSERT_TRUE(native_message_host_.get()); - run_loop_.reset(new base::RunLoop()); - run_loop_->RunUntilIdle(); - if (last_message_.empty()) { - run_loop_.reset(new base::RunLoop()); - std::unique_ptr<NativeMessageProcessHost> native_message_process_host_( - static_cast<NativeMessageProcessHost*>(native_message_host_.release())); - native_message_process_host_->ReadNowForTesting(); - run_loop_->Run(); - } + ASSERT_TRUE(native_message_host_); + run_loop_.reset(new base::RunLoop()); + run_loop_->Run(); + EXPECT_EQ(kTestMessage, last_message_); } @@ -241,7 +249,7 @@ ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py", std::move(launcher)); native_message_host_->Start(this); - ASSERT_TRUE(native_message_host_.get()); + ASSERT_TRUE(native_message_host_); base::RunLoop().RunUntilIdle(); native_message_host_->OnMessage(kTestMessage); @@ -272,7 +280,7 @@ false, &error_message); native_message_host_->Start(this); - ASSERT_TRUE(native_message_host_.get()); + ASSERT_TRUE(native_message_host_); native_message_host_->OnMessage("{\"text\": \"Hello.\"}"); run_loop_.reset(new base::RunLoop()); @@ -315,7 +323,7 @@ true, &error_message); native_message_host_->Start(this); - ASSERT_TRUE(native_message_host_.get()); + ASSERT_TRUE(native_message_host_); native_message_host_->OnMessage("{\"text\": \"Hello.\"}"); run_loop_.reset(new base::RunLoop()); @@ -336,7 +344,7 @@ false, &error_message); native_message_host_->Start(this); - ASSERT_TRUE(native_message_host_.get()); + ASSERT_TRUE(native_message_host_); run_loop_.reset(new base::RunLoop()); run_loop_->Run();
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc index 9126f73..437f5d82 100644 --- a/chrome/browser/extensions/extension_util.cc +++ b/chrome/browser/extensions/extension_util.cc
@@ -309,7 +309,8 @@ bool CanHostedAppsOpenInWindows() { #if defined(OS_MACOSX) return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableHostedAppsInWindows); + switches::kEnableHostedAppsInWindows) || + base::FeatureList::IsEnabled(features::kDesktopPWAWindowing); #else return true; #endif
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 525a739d..3d506eb 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -287,6 +287,11 @@ "saved 1 MB of data, then the promo will not be shown. Data Saver must be " "enabled for the promo to be shown."; +const char kEnableDesktopPWAWindowingName[] = + "Windowing related features for desktop PWAs."; +const char kEnableDesktopPWAWindowingDescription[] = + "Enable experimental windowing features for desktop PWAs."; + const char kEnableEnumeratingAudioDevicesName[] = "Experimentally enable enumerating audio devices."; const char kEnableEnumeratingAudioDevicesDescription[] = @@ -745,6 +750,13 @@ const char kUiPartialSwapDescription[] = "Sets partial swap behavior."; +const char kDelayReloadStopButtonChangeName[] = + "Reduce stop/reload button flicker"; + +const char kDelayReloadStopButtonChangeDescription[] = + "Delays display of stop button when page is loading such that short " + "loads won't show the stop button at all."; + const char kIgnoreGpuBlacklistName[] = "Override software rendering list"; const char kIgnoreGpuBlacklistDescription[] = @@ -2006,7 +2018,9 @@ const char kChromeHomeName[] = "Chrome Home"; -const char kChromeHomeDescription[] = "Enables Chrome Home on Android."; +const char kChromeHomeDescription[] = + "Enables Chrome Home on Android. You must restart the browser" + " twice for changes to take effect."; const char kChromeHomeExpandButtonName[] = "Chrome Home Expand Button";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 515b506..d1bc22a 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -124,6 +124,9 @@ extern const char kDebugShortcutsName[]; extern const char kDebugShortcutsDescription[]; +extern const char kDelayReloadStopButtonChangeName[]; +extern const char kDelayReloadStopButtonChangeDescription[]; + extern const char kDeviceDiscoveryNotificationsName[]; extern const char kDeviceDiscoveryNotificationsDescription[]; @@ -194,6 +197,9 @@ extern const char kEnableDataReductionProxySavingsPromoName[]; extern const char kEnableDataReductionProxySavingsPromoDescription[]; +extern const char kEnableDesktopPWAWindowingName[]; +extern const char kEnableDesktopPWAWindowingDescription[]; + extern const char kEnableEnumeratingAudioDevicesName[]; extern const char kEnableEnumeratingAudioDevicesDescription[];
diff --git a/chrome/browser/geolocation/OWNERS b/chrome/browser/geolocation/OWNERS index 7534177..3ba48c1d 100644 --- a/chrome/browser/geolocation/OWNERS +++ b/chrome/browser/geolocation/OWNERS
@@ -2,4 +2,7 @@ raymes@chromium.org timvolodine@chromium.org +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # COMPONENT: Internals>Permissions
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 5c40e9e4..d50cdbbd 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -96,7 +96,6 @@ registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, content::NotificationService::AllSources()); std::string script(base::StringPrintf( - "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(addIFrame(%d, \"%s\"));", iframe_id, url.spec().c_str())); web_contents->GetMainFrame()->ExecuteJavaScriptForTests(
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index e5eeba76..41cfd40 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc
@@ -76,7 +76,6 @@ #include "net/cert/cert_verify_proc.h" #include "net/cert/ct_known_logs.h" #include "net/cert/ct_log_verifier.h" -#include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/cert/multi_threaded_cert_verifier.h"
diff --git a/chrome/browser/media/OWNERS b/chrome/browser/media/OWNERS index c614779..c5eec594 100644 --- a/chrome/browser/media/OWNERS +++ b/chrome/browser/media/OWNERS
@@ -13,4 +13,7 @@ per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # COMPONENT: Blink>Media
diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc index 4ef874c..ec8fc7c 100644 --- a/chrome/browser/media/cast_transport_host_filter.cc +++ b/chrome/browser/media/cast_transport_host_filter.cc
@@ -399,29 +399,33 @@ device::mojom::WakeLock* CastTransportHostFilter::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. - if (!wake_lock_) { - device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); + if (wake_lock_) + return wake_lock_.get(); - // Service manager connection might be not initialized in some testing - // contexts. - if (content::ServiceManagerConnection::GetForProcess()) { - service_manager::mojom::ConnectorRequest connector_request; - auto connector = service_manager::Connector::Create(&connector_request); + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::BindOnce(&BindConnectorRequest, std::move(connector_request))); + DCHECK(content::ServiceManagerConnection::GetForProcess()); - device::mojom::WakeLockProviderPtr wake_lock_provider; - connector->BindInterface(device::mojom::kServiceName, - mojo::MakeRequest(&wake_lock_provider)); - wake_lock_provider->GetWakeLockWithoutContext( - device::mojom::WakeLockType::PreventAppSuspension, - device::mojom::WakeLockReason::ReasonOther, - "Cast is streaming content to a remote receiver", std::move(request)); - } - } + service_manager::mojom::ConnectorRequest connector_request; + auto connector = service_manager::Connector::Create(&connector_request); + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, + base::BindOnce(&BindConnectorRequest, std::move(connector_request))); + + device::mojom::WakeLockProviderPtr wake_lock_provider; + connector->BindInterface(device::mojom::kServiceName, + mojo::MakeRequest(&wake_lock_provider)); + wake_lock_provider->GetWakeLockWithoutContext( + device::mojom::WakeLockType::PreventAppSuspension, + device::mojom::WakeLockReason::ReasonOther, + "Cast is streaming content to a remote receiver", std::move(request)); return wake_lock_.get(); } +void CastTransportHostFilter::InitializeNoOpWakeLockForTesting() { + // Initializes |wake_lock_| to make GetWakeLock() short-circuit out of its + // own lazy initialization process. + mojo::MakeRequest(&wake_lock_); +} + } // namespace cast
diff --git a/chrome/browser/media/cast_transport_host_filter.h b/chrome/browser/media/cast_transport_host_filter.h index 4ce0b4f5..994bbc0 100644 --- a/chrome/browser/media/cast_transport_host_filter.h +++ b/chrome/browser/media/cast_transport_host_filter.h
@@ -27,6 +27,9 @@ public: CastTransportHostFilter(); + // Used by unit test only. + void InitializeNoOpWakeLockForTesting(); + private: ~CastTransportHostFilter() override;
diff --git a/chrome/browser/media/cast_transport_host_filter_unittest.cc b/chrome/browser/media/cast_transport_host_filter_unittest.cc index 2a6cb35..bc166bd 100644 --- a/chrome/browser/media/cast_transport_host_filter_unittest.cc +++ b/chrome/browser/media/cast_transport_host_filter_unittest.cc
@@ -22,6 +22,8 @@ : browser_thread_bundle_( content::TestBrowserThreadBundle::IO_MAINLOOP) { filter_ = new cast::CastTransportHostFilter(); + static_cast<cast::CastTransportHostFilter*>(filter_.get()) + ->InitializeNoOpWakeLockForTesting(); // 127.0.0.1:7 is the local echo service port, which // is probably not going to respond, but that's ok. // TODO(hubbe): Open up an UDP port and make sure
diff --git a/chrome/browser/media/router/browser_presentation_connection_proxy.cc b/chrome/browser/media/router/browser_presentation_connection_proxy.cc index e5a8354..fce1b7f 100644 --- a/chrome/browser/media/router/browser_presentation_connection_proxy.cc +++ b/chrome/browser/media/router/browser_presentation_connection_proxy.cc
@@ -62,8 +62,8 @@ // TODO(imcheng): It would be slightly more efficient to send messages in // a single batch. for (const auto& message : messages) { - target_connection_ptr_->OnMessage(message, - base::Bind(&OnMessageReceivedByRenderer)); + target_connection_ptr_->OnMessage( + message, base::BindOnce(&OnMessageReceivedByRenderer)); } } } // namespace media_router
diff --git a/chrome/browser/media/router/create_presentation_connection_request_unittest.cc b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc index 4392ff6..d195509 100644 --- a/chrome/browser/media/router/create_presentation_connection_request_unittest.cc +++ b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
@@ -70,10 +70,10 @@ "Unknown error."); CreatePresentationConnectionRequest request( render_frame_host_id_, presentation_urls_, url::Origin(GURL(kFrameUrl)), - base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, - base::Unretained(this)), - base::Bind(&CreatePresentationConnectionRequestTest::OnError, - base::Unretained(this), error)); + base::BindOnce(&CreatePresentationConnectionRequestTest::FailOnSuccess, + base::Unretained(this)), + base::BindOnce(&CreatePresentationConnectionRequestTest::OnError, + base::Unretained(this), error)); PresentationRequest presentation_request( render_frame_host_id_, presentation_urls_, url::Origin(GURL(kFrameUrl))); @@ -87,10 +87,10 @@ kPresentationId); CreatePresentationConnectionRequest request( render_frame_host_id_, {presentation_url_}, url::Origin(GURL(kFrameUrl)), - base::Bind(&CreatePresentationConnectionRequestTest::OnSuccess, - base::Unretained(this), presentation_info), - base::Bind(&CreatePresentationConnectionRequestTest::FailOnError, - base::Unretained(this))); + base::BindOnce(&CreatePresentationConnectionRequestTest::OnSuccess, + base::Unretained(this), presentation_info), + base::BindOnce(&CreatePresentationConnectionRequestTest::FailOnError, + base::Unretained(this))); MediaRoute route(kRouteId, MediaSourceForTab(1), "sinkId", "Description", false, "", false); request.InvokeSuccessCallback(kPresentationId, presentation_url_, route); @@ -103,10 +103,10 @@ "This is an error message"); CreatePresentationConnectionRequest request( render_frame_host_id_, presentation_urls_, url::Origin(GURL(kFrameUrl)), - base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, - base::Unretained(this)), - base::Bind(&CreatePresentationConnectionRequestTest::OnError, - base::Unretained(this), error)); + base::BindOnce(&CreatePresentationConnectionRequestTest::FailOnSuccess, + base::Unretained(this)), + base::BindOnce(&CreatePresentationConnectionRequestTest::OnError, + base::Unretained(this), error)); request.InvokeErrorCallback(error); EXPECT_TRUE(cb_invoked_); }
diff --git a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_proxy.cc b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_proxy.cc index 10801e62..a3362d0 100644 --- a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_proxy.cc +++ b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_proxy.cc
@@ -28,7 +28,7 @@ content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(&DialMediaSinkServiceProxy::StartOnIOThread, this)); + base::BindOnce(&DialMediaSinkServiceProxy::StartOnIOThread, this)); } void DialMediaSinkServiceProxy::Stop() { @@ -36,7 +36,7 @@ content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(&DialMediaSinkServiceProxy::StopOnIOThread, this)); + base::BindOnce(&DialMediaSinkServiceProxy::StopOnIOThread, this)); } void DialMediaSinkServiceProxy::SetDialMediaSinkServiceForTest( @@ -72,7 +72,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, - base::Bind(sink_discovery_callback_, std::move(sinks))); + base::BindOnce(sink_discovery_callback_, std::move(sinks))); } } // namespace media_router
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor.cc b/chrome/browser/media/router/discovery/discovery_network_monitor.cc index 2b2b760..7ad23149 100644 --- a/chrome/browser/media/router/discovery/discovery_network_monitor.cc +++ b/chrome/browser/media/router/discovery/discovery_network_monitor.cc
@@ -107,8 +107,8 @@ net::NetworkChangeNotifier::ConnectionType) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&DiscoveryNetworkMonitor::UpdateNetworkInfo, - base::Unretained(this))); + base::BindOnce(&DiscoveryNetworkMonitor::UpdateNetworkInfo, + base::Unretained(this))); } void DiscoveryNetworkMonitor::UpdateNetworkInfo() {
diff --git a/chrome/browser/media/router/media_router_dialog_controller_unittest.cc b/chrome/browser/media/router/media_router_dialog_controller_unittest.cc index 802cf790..5684780 100644 --- a/chrome/browser/media/router/media_router_dialog_controller_unittest.cc +++ b/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
@@ -70,10 +70,10 @@ RenderFrameHostId(1, 2), {GURL("http://example.com"), GURL("http://example2.com")}, url::Origin(GURL("http://google.com")), - base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, - base::Unretained(this)), - base::Bind(&MediaRouterDialogControllerTest::RequestError, - base::Unretained(this)))); + base::BindOnce(&MediaRouterDialogControllerTest::RequestSuccess, + base::Unretained(this)), + base::BindOnce(&MediaRouterDialogControllerTest::RequestError, + base::Unretained(this)))); } std::unique_ptr<TestMediaRouterDialogController> dialog_controller_;
diff --git a/chrome/browser/media/router/mojo/media_route_controller.cc b/chrome/browser/media/router/mojo/media_route_controller.cc index 6904a95..f1acacb 100644 --- a/chrome/browser/media/router/mojo/media_route_controller.cc +++ b/chrome/browser/media/router/mojo/media_route_controller.cc
@@ -38,7 +38,7 @@ binding_(this) { DCHECK(mojo_media_controller_.is_bound()); DCHECK(media_router); - mojo_media_controller_.set_connection_error_handler(base::Bind( + mojo_media_controller_.set_connection_error_handler(base::BindOnce( &MediaRouteController::OnMojoConnectionError, base::Unretained(this))); } @@ -88,7 +88,7 @@ DCHECK(!binding_.is_bound()); mojom::MediaStatusObserverPtr observer; binding_.Bind(mojo::MakeRequest(&observer)); - binding_.set_connection_error_handler(base::Bind( + binding_.set_connection_error_handler(base::BindOnce( &MediaRouteController::OnMojoConnectionError, base::Unretained(this))); return observer; }
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 779ee9391..3bf02eb4 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -108,7 +108,7 @@ binding_ = base::MakeUnique<mojo::Binding<mojom::MediaRouter>>( this, std::move(request)); - binding_->set_connection_error_handler(base::Bind( + binding_->set_connection_error_handler(base::BindOnce( &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); event_page_request_manager_->SetExtensionId(extension.id()); @@ -140,7 +140,7 @@ #endif media_route_provider_ = std::move(media_route_provider_ptr); - media_route_provider_.set_connection_error_handler(base::Bind( + media_route_provider_.set_connection_error_handler(base::BindOnce( &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); auto config = mojom::MediaRouteProviderConfig::New(); @@ -429,8 +429,9 @@ << sinks.size() << " devices..."; event_page_request_manager_->RunOrDefer( - base::Bind(&MediaRouterMojoImpl::DoProvideSinks, - weak_factory_.GetWeakPtr(), provider_name, std::move(sinks)), + base::BindOnce(&MediaRouterMojoImpl::DoProvideSinks, + weak_factory_.GetWeakPtr(), provider_name, + std::move(sinks)), MediaRouteProviderWakeReason::PROVIDE_SINKS); } @@ -604,8 +605,8 @@ observer_list->AddObserver(observer); if (should_listen) { event_page_request_manager_->RunOrDefer( - base::Bind(&MediaRouterMojoImpl::DoStartListeningForRouteMessages, - weak_factory_.GetWeakPtr(), route_id), + base::BindOnce(&MediaRouterMojoImpl::DoStartListeningForRouteMessages, + weak_factory_.GetWeakPtr(), route_id), MediaRouteProviderWakeReason::START_LISTENING_FOR_ROUTE_MESSAGES); } } @@ -651,9 +652,9 @@ << ", presentation ID: " << presentation_id; media_route_provider_->CreateRoute( source_id, sink_id, presentation_id, origin, tab_id, timeout, incognito, - base::Bind(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), false)); + base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + base::Unretained(this), presentation_id, incognito, + base::Passed(&callbacks), false)); } void MediaRouterMojoImpl::DoJoinRoute( @@ -669,9 +670,9 @@ media_route_provider_->JoinRoute( source_id, presentation_id, origin, tab_id, timeout, incognito, - base::Bind(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), true)); + base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + base::Unretained(this), presentation_id, incognito, + base::Passed(&callbacks), true)); } void MediaRouterMojoImpl::DoConnectRouteByRouteId( @@ -689,17 +690,16 @@ media_route_provider_->ConnectRouteByRouteId( source_id, route_id, presentation_id, origin, tab_id, timeout, incognito, - base::Bind(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), true)); + base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + base::Unretained(this), presentation_id, incognito, + base::Passed(&callbacks), true)); } void MediaRouterMojoImpl::DoTerminateRoute(const MediaRoute::Id& route_id) { DVLOG_WITH_INSTANCE(1) << "DoTerminateRoute " << route_id; media_route_provider_->TerminateRoute( - route_id, - base::Bind(&MediaRouterMojoImpl::OnTerminateRouteResult, - base::Unretained(this), route_id)); + route_id, base::BindOnce(&MediaRouterMojoImpl::OnTerminateRouteResult, + base::Unretained(this), route_id)); } void MediaRouterMojoImpl::DoDetachRoute(const MediaRoute::Id& route_id) { @@ -769,8 +769,8 @@ media_route_provider_->CreateMediaRouteController( route_id, std::move(mojo_media_controller_request), std::move(mojo_observer), - base::Bind(&MediaRouterMojoImpl::OnMediaControllerCreated, - base::Unretained(this), route_id)); + base::BindOnce(&MediaRouterMojoImpl::OnMediaControllerCreated, + base::Unretained(this), route_id)); } void MediaRouterMojoImpl::OnRouteMessagesReceived(
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc index 0e902ae..cc79326 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -230,7 +230,7 @@ RouteRequestResult::OK)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->CreateRoute(kSource, kSinkId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -269,7 +269,7 @@ RouteRequestResult::OK)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->CreateRoute(kSource, kSinkId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -300,7 +300,7 @@ DoInvoke(nullptr, "", kError, RouteRequestResult::TIMED_OUT)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->CreateRoute(kSource, kSinkId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -332,7 +332,7 @@ RouteRequestResult::INCOGNITO_MISMATCH)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->CreateRoute(kSource, kSinkId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -421,7 +421,7 @@ RouteRequestResult::OK)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->JoinRoute(kSource, kPresentationId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -437,7 +437,7 @@ RouteRequestResult::ROUTE_NOT_FOUND)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->JoinRoute(kSource, kPresentationId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -473,7 +473,7 @@ DoInvoke(nullptr, "", kError, RouteRequestResult::TIMED_OUT)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->JoinRoute(kSource, kPresentationId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -516,7 +516,7 @@ RouteRequestResult::INCOGNITO_MISMATCH)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->JoinRoute(kSource, kPresentationId, url::Origin(GURL(kOrigin)), nullptr, std::move(route_response_callbacks), @@ -556,7 +556,7 @@ RouteRequestResult::OK)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->ConnectRouteByRouteId( kSource, kRouteId, url::Origin(GURL(kOrigin)), nullptr, @@ -587,7 +587,7 @@ DoInvoke(nullptr, "", kError, RouteRequestResult::TIMED_OUT)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->ConnectRouteByRouteId( kSource, kRouteId, url::Origin(GURL(kOrigin)), nullptr, @@ -624,7 +624,7 @@ RouteRequestResult::INCOGNITO_MISMATCH)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); std::vector<MediaRouteResponseCallback> route_response_callbacks; - route_response_callbacks.push_back(base::Bind( + route_response_callbacks.push_back(base::BindOnce( &RouteResponseCallbackHandler::Invoke, base::Unretained(&handler))); router()->ConnectRouteByRouteId( kSource, kRouteId, url::Origin(GURL(kOrigin)), nullptr, @@ -978,8 +978,8 @@ EXPECT_CALL(handler, Invoke(true)) .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); router()->SendRouteMessage(kRouteId, kMessage, - base::Bind(&SendMessageCallbackHandler::Invoke, - base::Unretained(&handler))); + base::BindOnce(&SendMessageCallbackHandler::Invoke, + base::Unretained(&handler))); run_loop.Run(); } @@ -1002,8 +1002,8 @@ .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); router()->SendRouteBinaryMessage( kRouteId, std::move(expected_binary_data), - base::Bind(&SendMessageCallbackHandler::Invoke, - base::Unretained(&handler))); + base::BindOnce(&SendMessageCallbackHandler::Invoke, + base::Unretained(&handler))); run_loop.Run(); } @@ -1211,7 +1211,7 @@ SinkResponseCallbackHandler sink_handler; EXPECT_CALL(sink_handler, Invoke(kSinkId2)).Times(1); - MediaSinkSearchResponseCallback sink_callback = base::Bind( + MediaSinkSearchResponseCallback sink_callback = base::BindOnce( &SinkResponseCallbackHandler::Invoke, base::Unretained(&sink_handler)); router()->SearchSinks(kSinkId, kSource, search_input, domain, @@ -1449,8 +1449,8 @@ void RegisterMediaRouteProvider() { media_router_proxy_->RegisterMediaRouteProvider( std::move(media_route_provider_proxy_), - base::Bind(&RegisterMediaRouteProviderHandler::Invoke, - base::Unretained(&provider_handler_))); + base::BindOnce(&RegisterMediaRouteProviderHandler::Invoke, + base::Unretained(&provider_handler_))); } void ProcessEventLoop() { base::RunLoop().RunUntilIdle(); }
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_test.cc b/chrome/browser/media/router/mojo/media_router_mojo_test.cc index 357e7ed..0ca16a9 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_test.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_test.cc
@@ -77,8 +77,8 @@ EXPECT_CALL(provide_handler_, InvokeInternal(kInstanceId, testing::_)); media_router_proxy_->RegisterMediaRouteProvider( std::move(mojo_media_router), - base::Bind(&RegisterMediaRouteProviderHandler::Invoke, - base::Unretained(&provide_handler_))); + base::BindOnce(&RegisterMediaRouteProviderHandler::Invoke, + base::Unretained(&provide_handler_))); } void MediaRouterMojoTest::SetUp() {
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc index 8827de8..4f62975a 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -51,13 +51,6 @@ using DelegateObserver = content::PresentationServiceDelegate::Observer; -// Returns the unique identifier for the supplied RenderFrameHost. -RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) { - int render_process_id = render_frame_host->GetProcess()->GetID(); - int render_frame_id = render_frame_host->GetRoutingID(); - return RenderFrameHostId(render_process_id, render_frame_id); -} - // Gets the last committed URL for the render frame specified by // |render_frame_host_id|. url::Origin GetLastCommittedURLForFrame( @@ -383,9 +376,6 @@ const std::vector<GURL>& default_presentation_urls, content::DefaultPresentationConnectionCallback callback) { RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); - if (!IsMainFrame(render_frame_host_id)) - return; - if (default_presentation_urls.empty()) { ClearDefaultPresentationRequest(); return; @@ -742,13 +732,6 @@ observer.OnDefaultPresentationRemoved(); } -// TODO(imcheng): Move this check to PresentationServiceImpl. -bool PresentationServiceDelegateImpl::IsMainFrame( - const RenderFrameHostId& render_frame_host_id) const { - RenderFrameHost* main_frame = web_contents_->GetMainFrame(); - return main_frame && GetRenderFrameHostId(main_frame) == render_frame_host_id; -} - MediaRoute::Id PresentationServiceDelegateImpl::GetRouteId( const RenderFrameHostId& render_frame_host_id, const std::string& presentation_id) const {
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.h b/chrome/browser/media/router/presentation_service_delegate_impl.h index f98a8eb..27e1e5b7 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl.h +++ b/chrome/browser/media/router/presentation_service_delegate_impl.h
@@ -228,11 +228,6 @@ // |default_presentation_started_callback_|. void ClearDefaultPresentationRequest(); - // Returns |true| if the given frame is the main frame of the associated - // WebContents. - // NOTE: This method will be removed in an upcoming patch. - bool IsMainFrame(const RenderFrameHostId& render_frame_host_id) const; - // Returns the ID of the route corresponding to |presentation_id| in the given // frame, or empty if no such route exist. MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id,
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc index c18a5cec..d510a62 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -334,8 +334,6 @@ EXPECT_CALL(router_, RegisterMediaSinksObserver(_)).Times(0); } -// TODO(imcheng): Add a test to set default presentation URL in a different -// RenderFrameHost and verify that it is ignored. TEST_F(PresentationServiceDelegateImplTest, SetDefaultPresentationUrl) { EXPECT_FALSE(delegate_impl_->HasDefaultPresentationRequest()); @@ -461,10 +459,10 @@ delegate_impl_->ReconnectPresentation( main_frame_process_id_, main_frame_routing_id_, presentation_urls_, kPresentationId, - base::Bind(&MockCreatePresentationConnnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), - base::Bind( + base::BindOnce(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -704,10 +702,10 @@ delegate_impl_->ReconnectPresentation( main_frame_process_id_, main_frame_routing_id_, presentation_urls_, kPresentationId, - base::Bind(&MockCreatePresentationConnnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), - base::Bind( + base::BindOnce(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -724,10 +722,10 @@ delegate_impl_->ReconnectPresentation( main_frame_process_id_, main_frame_routing_id_, presentation_urls_, kPresentationId, - base::Bind(&MockCreatePresentationConnnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), - base::Bind( + base::BindOnce(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); } @@ -767,10 +765,10 @@ delegate_impl_->ReconnectPresentation( main_frame_process_id_, main_frame_routing_id_, presentation_urls_, kPresentationId, - base::Bind(&MockCreatePresentationConnnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), - base::Bind( + base::BindOnce(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -787,10 +785,10 @@ delegate_impl_->ReconnectPresentation( main_frame_process_id_, main_frame_routing_id_, presentation_urls_, kPresentationId, - base::Bind(&MockCreatePresentationConnnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), - base::Bind( + base::BindOnce(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); }
diff --git a/chrome/browser/media/webrtc/OWNERS b/chrome/browser/media/webrtc/OWNERS index 3a863ba..fe79b0b 100644 --- a/chrome/browser/media/webrtc/OWNERS +++ b/chrome/browser/media/webrtc/OWNERS
@@ -12,4 +12,7 @@ per-file media_stream_device*=raymes@chromium.org per-file media_permission*=raymes@chromium.org +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # COMPONENT: Blink>WebRTC \ No newline at end of file
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc index 28882ee..c142faad 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
@@ -83,6 +83,14 @@ UMA_LINUX_DISTRO_FEDORA_OTHER = 10, UMA_LINUX_DISTRO_FEDORA_24 = 11, UMA_LINUX_DISTRO_FEDORA_25 = 12, + UMA_LINUX_DISTRO_FEDORA_26 = 13, + UMA_LINUX_DISTRO_DEBIAN_9 = 14, + UMA_LINUX_DISTRO_ARCH = 15, + UMA_LINUX_DISTRO_CENTOS = 16, + UMA_LINUX_DISTRO_ELEMENTARY = 17, + UMA_LINUX_DISTRO_MINT = 18, + UMA_LINUX_DISTRO_RHEL = 19, + UMA_LINUX_DISTRO_SUSE_ENTERPRISE = 20, // Note: Add new distros to the list above this line, and update LinuxDistro // in tools/metrics/histograms/enums.xml accordingly. UMA_LINUX_DISTRO_MAX @@ -212,7 +220,7 @@ // Format: Ubuntu YY.MM.P [LTS] // We are only concerned with release (YY.MM) not the patch (P). distro_result = UMA_LINUX_DISTRO_UBUNTU_OTHER; - if (distro_tokens.size() >= 3) { + if (distro_tokens.size() >= 2) { base::Version version(distro_tokens[1]); if (version.IsValid()) { if (version.CompareToWildcardString("14.04.*") == 0) { @@ -229,7 +237,7 @@ } else if (distro_tokens[0] == "openSUSE") { // Format: openSUSE Leap RR.R distro_result = UMA_LINUX_DISTRO_OPENSUSE_OTHER; - if (distro_tokens.size() >= 4 && distro_tokens[1] == "Leap" && + if (distro_tokens.size() >= 3 && distro_tokens[1] == "Leap" && distro_tokens[2] == "42.2") { distro_result = UMA_LINUX_DISTRO_OPENSUSE_LEAP_42_2; } @@ -239,8 +247,12 @@ distro_result = UMA_LINUX_DISTRO_DEBIAN_OTHER; if (distro_tokens.size() >= 3) { base::Version version(distro_tokens[2]); - if (version.IsValid() && version.CompareToWildcardString("8.*")) { - distro_result = UMA_LINUX_DISTRO_DEBIAN_8; + if (version.IsValid()) { + if (version.CompareToWildcardString("8.*")) { + distro_result = UMA_LINUX_DISTRO_DEBIAN_8; + } else if (version.CompareToWildcardString("9.*")) { + distro_result = UMA_LINUX_DISTRO_DEBIAN_9; + } } } } else if (distro_tokens[0] == "Fedora") { @@ -251,8 +263,32 @@ distro_result = UMA_LINUX_DISTRO_FEDORA_24; } else if (distro_tokens[2] == "25") { distro_result = UMA_LINUX_DISTRO_FEDORA_25; + } else if (distro_tokens[2] == "26") { + distro_result = UMA_LINUX_DISTRO_FEDORA_26; } } + } else if (distro_tokens[0] == "Arch") { + // Format: Arch Linux + distro_result = UMA_LINUX_DISTRO_ARCH; + } else if (distro_tokens[0] == "CentOS") { + // Format: CentOS [Linux] release <version> (<codename>) + distro_result = UMA_LINUX_DISTRO_CENTOS; + } else if (distro_tokens[0] == "elementary") { + // Format: elementary OS <release name> + distro_result = UMA_LINUX_DISTRO_ELEMENTARY; + } else if (distro_tokens.size() >= 2 && distro_tokens[1] == "Mint") { + // Format: Linux Mint RR <codename> + distro_result = UMA_LINUX_DISTRO_MINT; + } else if (distro_tokens.size() >= 4 && distro_tokens[0] == "Red" && + distro_tokens[1] == "Hat" && distro_tokens[2] == "Enterprise" && + distro_tokens[3] == "Linux") { + // Format: Red Hat Enterprise Linux <variant> [release] R.P (<codename>) + distro_result = UMA_LINUX_DISTRO_RHEL; + } else if (distro_tokens.size() >= 3 && distro_tokens[0] == "SUSE" && + distro_tokens[1] == "Linux" && + distro_tokens[2] == "Enterprise") { + // Format: SUSE Linux Enterprise <variant> RR (<platform>) + distro_result = UMA_LINUX_DISTRO_SUSE_ENTERPRISE; } }
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc index 631690d7..9781219 100644 --- a/chrome/browser/metrics/chrome_metrics_service_client.cc +++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -548,14 +548,6 @@ return metrics::GetUploadInterval(); } -base::string16 ChromeMetricsServiceClient::GetRegistryBackupKey() { -#if defined(OS_WIN) - return install_static::GetRegistryPath().append(L"\\StabilityMetrics"); -#else - return base::string16(); -#endif -} - void ChromeMetricsServiceClient::OnPluginLoadingError( const base::FilePath& plugin_path) { #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h index 293b6ee..7c2abdd 100644 --- a/chrome/browser/metrics/chrome_metrics_service_client.h +++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -88,7 +88,6 @@ const metrics::MetricsLogUploader::UploadCallback& on_upload_complete) override; base::TimeDelta GetStandardUploadInterval() override; - base::string16 GetRegistryBackupKey() override; void OnPluginLoadingError(const base::FilePath& plugin_path) override; bool IsReportingPolicyManaged() override; metrics::EnableMetricsDefault GetMetricsReportingDefaultState() override;
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc index d451a34..2cb48eb 100644 --- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc +++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -101,6 +101,16 @@ } #endif +// Returns the name of a key under HKEY_CURRENT_USER that can be used to store +// backups of metrics data. Unused except on Windows. +base::string16 GetRegistryBackupKey() { +#if defined(OS_WIN) + return install_static::GetRegistryPath().append(L"\\StabilityMetrics"); +#else + return base::string16(); +#endif +} + } // namespace @@ -278,7 +288,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); if (!metrics_state_manager_) { metrics_state_manager_ = metrics::MetricsStateManager::Create( - local_state_, enabled_state_provider_.get(), + local_state_, enabled_state_provider_.get(), GetRegistryBackupKey(), base::Bind(&PostStoreMetricsClientInfo), base::Bind(&GoogleUpdateSettings::LoadMetricsClientInfo)); }
diff --git a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc index 16ec748..632fefd5 100644 --- a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc
@@ -9,6 +9,7 @@ #include <memory> #include <string> +#include "base/strings/string16.h" #include "components/metrics/client_info.h" #include "components/metrics/metrics_service.h" #include "components/metrics/metrics_state_manager.h" @@ -109,7 +110,7 @@ metrics::MetricsService::RegisterPrefs(local_state.registry()); std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager( metrics::MetricsStateManager::Create( - &local_state, &enabled_state_provider, + &local_state, &enabled_state_provider, base::string16(), base::Bind(&StoreNoClientInfoBackup), base::Bind(&ReturnNoBackup))); TestExtensionsMetricsProvider extension_metrics(metrics_state_manager.get()); extension_metrics.ProvideSystemProfileMetrics(&system_profile);
diff --git a/chrome/browser/metrics/perf/OWNERS b/chrome/browser/metrics/perf/OWNERS index b2e025d..ec4643a7 100644 --- a/chrome/browser/metrics/perf/OWNERS +++ b/chrome/browser/metrics/perf/OWNERS
@@ -1 +1,4 @@ +chongjiang@chromium.org +gmx@chromium.org +lakshmana@chromium.org sque@chromium.org
diff --git a/chrome/browser/notifications/OWNERS b/chrome/browser/notifications/OWNERS index f7954230..0d30063 100644 --- a/chrome/browser/notifications/OWNERS +++ b/chrome/browser/notifications/OWNERS
@@ -8,5 +8,8 @@ # Mac files per-file *_mac*=rsesek@chromium.org +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications
diff --git a/chrome/browser/notifications/notification.cc b/chrome/browser/notifications/notification.cc index cec64b2..1f0ae13 100644 --- a/chrome/browser/notifications/notification.cc +++ b/chrome/browser/notifications/notification.cc
@@ -14,7 +14,7 @@ const GURL& origin_url, const std::string& tag, const message_center::RichNotificationData& rich_notification_data, - NotificationDelegate* delegate) + scoped_refptr<NotificationDelegate> delegate) : message_center::Notification(type, delegate->id(), title,
diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h index c5c44ca..45fe6948 100644 --- a/chrome/browser/notifications/notification.h +++ b/chrome/browser/notifications/notification.h
@@ -8,6 +8,7 @@ #include <memory> #include <string> +#include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "base/values.h" #include "chrome/browser/notifications/notification_delegate.h" @@ -32,7 +33,7 @@ const GURL& origin_url, const std::string& tag, const message_center::RichNotificationData& rich_notification_data, - NotificationDelegate* delegate); + scoped_refptr<NotificationDelegate> delegate); Notification(const std::string& id, const Notification& notification);
diff --git a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc index 9021acc..2fe5df9 100644 --- a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc
@@ -230,8 +230,8 @@ abort_info.time_to_abort); return; case PageAbortReason::ABORT_OTHER: - NOTREACHED() - << "Received PageAbortReason::ABORT_OTHER for committed load."; + // This is technically possible, though rare. See ~PageLoadTracker for an + // explanation. return; case PageAbortReason::ABORT_NONE: NOTREACHED(); @@ -268,8 +268,8 @@ abort_info.time_to_abort); return; case PageAbortReason::ABORT_OTHER: - NOTREACHED() - << "Received PageAbortReason::ABORT_OTHER for committed load."; + // This is technically possible, though rare. See ~PageLoadTracker for an + // explanation. return; case PageAbortReason::ABORT_NONE: NOTREACHED();
diff --git a/chrome/browser/permissions/PERMISSIONS_OWNERS b/chrome/browser/permissions/PERMISSIONS_OWNERS new file mode 100644 index 0000000..778a059 --- /dev/null +++ b/chrome/browser/permissions/PERMISSIONS_OWNERS
@@ -0,0 +1,7 @@ +# PermissionContext subclasses require a Security UX review by one of the +# following: + +benwells@chromium.org +dominickn@chromium.org +raymes@chromium.org +timloh@chromium.org
diff --git a/chrome/browser/plugins/OWNERS b/chrome/browser/plugins/OWNERS index 0c02f69d..7724296 100644 --- a/chrome/browser/plugins/OWNERS +++ b/chrome/browser/plugins/OWNERS
@@ -2,3 +2,6 @@ per-file flash*=tommycli@chromium.org per-file plugin_power_saver*=tommycli@chromium.org + +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS
diff --git a/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc b/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc index 58c1104..3a47bb1 100644 --- a/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc +++ b/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
@@ -209,8 +209,7 @@ } ASSERT_FALSE(script_argument.empty()); - GetUI()->web_ui()->CallJavascriptFunctionUnsafe( - "onManipulateSettingsForTest", script_argument); + GetUI()->SendManipulateSettingsForTest(script_argument); } // Saves the print preview settings to be sent to the print preview dialog. @@ -283,8 +282,7 @@ ui->web_ui()->AddMessageHandler( base::MakeUnique<UIDoneLoadingMessageHandler>(this)); - ui->web_ui()->CallJavascriptFunctionUnsafe( - "onEnableManipulateSettingsForTest"); + ui->SendEnableManipulateSettingsForTest(); } void DidCloneToNewWebContents(WebContents* old_web_contents,
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index e9fa0c5..95cc04a9 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc
@@ -83,6 +83,7 @@ #include "extensions/features/features.h" #include "net/cert/cert_verifier.h" #include "net/cert/ct_log_verifier.h" +#include "net/cert/ct_policy_enforcer.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/cookies/canonical_cookie.h" #include "net/http/http_network_session.h" @@ -1148,8 +1149,8 @@ base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), ct_tree_tracker_.get()); - main_request_context_->set_ct_policy_enforcer( - io_thread_globals->system_request_context->ct_policy_enforcer()); + main_request_context_storage_->set_ct_policy_enforcer( + base::MakeUnique<net::CTPolicyEnforcer>()); InitializeInternal(profile_params_.get(), protocol_handlers, std::move(request_interceptors));
diff --git a/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.cc index 7bab569..95a482c 100644 --- a/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.cc
@@ -45,6 +45,8 @@ PPAPI_DISPATCH_HOST_RESOURCE_CALL( PpapiHostMsg_PlatformVerification_ChallengePlatform, OnChallengePlatform) + PPAPI_DISPATCH_HOST_RESOURCE_CALL( + PpapiHostMsg_PlatformVerification_GetStorageId, OnGetStorageId) PPAPI_END_MESSAGE_MAP() return PP_ERROR_FAILED; @@ -111,4 +113,16 @@ } #endif +int32_t PepperPlatformVerificationMessageFilter::OnGetStorageId( + ppapi::host::HostMessageContext* context) { + // TODO(jrummell): Implement Storage ID. For now simply returns empty string. + // http://crbug.com/478960. + ppapi::host::ReplyMessageContext reply_context = + context->MakeReplyMessageContext(); + reply_context.params.set_result(PP_OK); + SendReply(reply_context, + PpapiHostMsg_PlatformVerification_GetStorageIdReply(std::string())); + return PP_OK_COMPLETIONPENDING; +} + } // namespace chrome
diff --git a/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h index 3833f38..0b54a380 100644 --- a/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h +++ b/chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h
@@ -57,6 +57,8 @@ const std::string& platform_key_certificate); #endif + int32_t OnGetStorageId(ppapi::host::HostMessageContext* context); + // Used to lookup the WebContents associated with this PP_Instance. int render_process_id_; int render_frame_id_;
diff --git a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc index 0d3bbb0..736216a 100644 --- a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc +++ b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc
@@ -1126,7 +1126,6 @@ std::string result; std::string script = "function onInput(e) {" - " domAutomationController.setAutomationId(0);" " domAutomationController.send(getInputFieldText());" "}" "inputField = document.getElementById('text-field');"
diff --git a/chrome/browser/resource_coordinator/background_tab_navigation_throttle.cc b/chrome/browser/resource_coordinator/background_tab_navigation_throttle.cc new file mode 100644 index 0000000..88a87ca --- /dev/null +++ b/chrome/browser/resource_coordinator/background_tab_navigation_throttle.cc
@@ -0,0 +1,65 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/resource_coordinator/background_tab_navigation_throttle.h" + +#include "base/feature_list.h" +#include "base/memory/ptr_util.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/resource_coordinator/tab_manager.h" +#include "chrome/browser/search/search.h" +#include "chrome/common/chrome_features.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/web_contents.h" + +namespace resource_coordinator { + +// static +std::unique_ptr<BackgroundTabNavigationThrottle> +BackgroundTabNavigationThrottle::MaybeCreateThrottleFor( + content::NavigationHandle* navigation_handle) { + if (!base::FeatureList::IsEnabled(features::kStaggeredBackgroundTabOpen)) + return nullptr; + + // Only consider main frames because this is to delay tabs. + if (!navigation_handle->IsInMainFrame()) + return nullptr; + + // Never delay foreground tabs. + if (navigation_handle->GetWebContents()->IsVisible()) + return nullptr; + + // Never delay the tab when there is opener, so the created window can talk + // to the creator immediately. + if (navigation_handle->GetWebContents()->HasOpener()) + return nullptr; + + // Only delay the first navigation in a newly created tab. + if (!navigation_handle->GetWebContents() + ->GetController() + .IsInitialNavigation()) { + return nullptr; + } + + return base::MakeUnique<BackgroundTabNavigationThrottle>(navigation_handle); +} + +const char* BackgroundTabNavigationThrottle::GetNameForLogging() { + return "BackgroundTabNavigationThrottle"; +} + +BackgroundTabNavigationThrottle::BackgroundTabNavigationThrottle( + content::NavigationHandle* navigation_handle) + : content::NavigationThrottle(navigation_handle) {} + +BackgroundTabNavigationThrottle::~BackgroundTabNavigationThrottle() {} + +content::NavigationThrottle::ThrottleCheckResult +BackgroundTabNavigationThrottle::WillStartRequest() { + return g_browser_process->GetTabManager()->MaybeThrottleNavigation( + navigation_handle()); +} + +} // namespace resource_coordinator
diff --git a/chrome/browser/resource_coordinator/background_tab_navigation_throttle.h b/chrome/browser/resource_coordinator/background_tab_navigation_throttle.h new file mode 100644 index 0000000..abcb1fb --- /dev/null +++ b/chrome/browser/resource_coordinator/background_tab_navigation_throttle.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_BACKGROUND_TAB_NAVIGATION_THROTTLE_H_ +#define CHROME_BROWSER_RESOURCE_COORDINATOR_BACKGROUND_TAB_NAVIGATION_THROTTLE_H_ + +#include <memory> + +#include "base/macros.h" +#include "content/public/browser/navigation_throttle.h" + +namespace resource_coordinator { + +// BackgroundTabNavigationThrottle plumbs navigation information to TabManager +// and enables TabManager to delay navigation for background tabs. This is only +// used on non-Android platforms, same as TabManager. +class BackgroundTabNavigationThrottle : public content::NavigationThrottle { + public: + static std::unique_ptr<BackgroundTabNavigationThrottle> + MaybeCreateThrottleFor(content::NavigationHandle* navigation_handle); + + explicit BackgroundTabNavigationThrottle( + content::NavigationHandle* navigation_handle); + ~BackgroundTabNavigationThrottle() override; + + // content::NavigationThrottle implementation + const char* GetNameForLogging() override; + content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; + + private: + DISALLOW_COPY_AND_ASSIGN(BackgroundTabNavigationThrottle); +}; + +} // namespace resource_coordinator + +#endif // CHROME_BROWSER_RESOURCE_COORDINATOR_BACKGROUND_TAB_NAVIGATION_THROTTLE_H_
diff --git a/chrome/browser/resource_coordinator/background_tab_navigation_throttle_unittest.cc b/chrome/browser/resource_coordinator/background_tab_navigation_throttle_unittest.cc new file mode 100644 index 0000000..dba97a5c --- /dev/null +++ b/chrome/browser/resource_coordinator/background_tab_navigation_throttle_unittest.cc
@@ -0,0 +1,161 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/resource_coordinator/background_tab_navigation_throttle.h" + +#include <tuple> + +#include "base/macros.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/common/chrome_features.h" +#include "chrome/test/base/chrome_render_view_host_test_harness.h" +#include "components/variations/variations_associated_data.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/navigation_throttle.h" +#include "content/public/browser/web_contents.h" +#include "content/test/test_web_contents.h" +#include "url/gurl.h" + +namespace resource_coordinator { + +namespace { + +enum ExpectInstantiationResult { + EXPECT_INSTANTIATION, + EXPECT_NO_INSTANTIATION +}; + +const char kTestUrl[] = "http://www.example.com"; + +} // namespace + +class BackgroundTabNavigationThrottleTest + : public ChromeRenderViewHostTestHarness, + public testing::WithParamInterface< + std::tuple<ExpectInstantiationResult, + bool, // enable_feature + bool, // is_in_main_frame + bool, // is_background_tab + bool, // no_opener + bool, // is_initial_navigation + GURL>> { + public: + BackgroundTabNavigationThrottleTest() {} + + void SetUp() override { + std::tie(expected_instantiation_result_, enable_feature_, is_in_main_frame_, + is_background_tab_, no_opener_, is_initial_navigation_, url_) = + GetParam(); + + if (enable_feature_) { + scoped_feature_list_.InitAndEnableFeature( + features::kStaggeredBackgroundTabOpen); + } + + ChromeRenderViewHostTestHarness::SetUp(); + content::RenderFrameHostTester::For(main_rfh()) + ->InitializeRenderFrameIfNeeded(); + } + + void TearDown() override { + ChromeRenderViewHostTestHarness::TearDown(); + variations::testing::ClearAllVariationParams(); + } + + protected: + ExpectInstantiationResult expected_instantiation_result_; + bool enable_feature_; + bool is_in_main_frame_; + bool is_background_tab_; + bool no_opener_; + bool is_initial_navigation_; + GURL url_; + + private: + base::test::ScopedFeatureList scoped_feature_list_; + + DISALLOW_COPY_AND_ASSIGN(BackgroundTabNavigationThrottleTest); +}; + +TEST_P(BackgroundTabNavigationThrottleTest, Instantiate) { + if (!is_initial_navigation_) + NavigateAndCommit(GURL(kTestUrl)); + + if (is_background_tab_) + web_contents()->WasHidden(); + else + web_contents()->WasShown(); + + std::unique_ptr<content::TestWebContents> opener( + content::TestWebContents::Create(browser_context(), + main_rfh()->GetSiteInstance())); + if (!no_opener_) { + static_cast<content::TestWebContents*>(web_contents()) + ->SetOpener(opener.get()); + } + + content::RenderFrameHost* rfh; + if (is_in_main_frame_) + rfh = main_rfh(); + else + rfh = content::RenderFrameHostTester::For(main_rfh())->AppendChild("child"); + + DCHECK(rfh); + std::unique_ptr<content::NavigationHandle> handle = + content::NavigationHandle::CreateNavigationHandleForTesting(url_, rfh); + std::unique_ptr<BackgroundTabNavigationThrottle> throttle = + BackgroundTabNavigationThrottle::MaybeCreateThrottleFor(handle.get()); + + const bool expect_instantiation = + expected_instantiation_result_ == EXPECT_INSTANTIATION; + EXPECT_EQ(expect_instantiation, throttle != nullptr); +} + +INSTANTIATE_TEST_CASE_P( + InstantiateThrottle, + BackgroundTabNavigationThrottleTest, + ::testing::Values(std::make_tuple(EXPECT_INSTANTIATION, + true, // Enable feature + true, // Is in main frame + true, // Is background tab + true, // No opener + true, // Is initial navigation + GURL(kTestUrl)), + std::make_tuple(EXPECT_NO_INSTANTIATION, + false, // Disable feature + true, + true, + true, + true, + GURL(kTestUrl)), + std::make_tuple(EXPECT_NO_INSTANTIATION, + true, + false, // Is in child frame + true, + true, + true, + GURL(kTestUrl)), + std::make_tuple(EXPECT_NO_INSTANTIATION, + true, + true, + false, // Is foreground tab + true, + true, + GURL(kTestUrl)), + std::make_tuple(EXPECT_NO_INSTANTIATION, + true, + true, + true, + false, // Has opener + true, + GURL(kTestUrl)), + std::make_tuple(EXPECT_NO_INSTANTIATION, + true, + true, + true, + true, + false, // Is not initial navigation + GURL(kTestUrl)))); + +} // namespace resource_coordinator
diff --git a/chrome/browser/resource_coordinator/tab_manager.cc b/chrome/browser/resource_coordinator/tab_manager.cc index 9db21d6..7e3f0c7 100644 --- a/chrome/browser/resource_coordinator/tab_manager.cc +++ b/chrome/browser/resource_coordinator/tab_manager.cc
@@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/command_line.h" #include "base/feature_list.h" #include "base/memory/memory_pressure_monitor.h" #include "base/metrics/field_trial.h" @@ -42,12 +41,12 @@ #include "chrome/browser/ui/tabs/tab_utils.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_features.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "components/metrics/system_memory_stats_recorder.h" #include "components/variations/variations_associated_data.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" +#include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" @@ -841,6 +840,8 @@ ReloadWebContentsIfDiscarded(new_contents, GetWebContentsData(new_contents)); } + + ResumeTabNavigationIfNeeded(new_contents); } void TabManager::TabInsertedAt(TabStripModel* tab_strip_model, @@ -976,4 +977,121 @@ } } +content::NavigationThrottle::ThrottleCheckResult +TabManager::MaybeThrottleNavigation( + content::NavigationHandle* navigation_handle) { + if (!ShouldDelayNavigation(navigation_handle)) { + loading_contents_.insert(navigation_handle->GetWebContents()); + return content::NavigationThrottle::PROCEED; + } + + // TODO(zhenw): Try to set the favicon and title from history service if this + // navigation will be delayed. + GetWebContentsData(navigation_handle->GetWebContents()) + ->SetTabLoadingState(TAB_IS_NOT_LOADING); + pending_navigations_.push_back(navigation_handle); + + return content::NavigationThrottle::DEFER; +} + +bool TabManager::ShouldDelayNavigation( + content::NavigationHandle* navigation_handle) const { + // Do not delay the navigation if no tab is currently loading. + if (loading_contents_.empty()) + return false; + + return true; +} + +void TabManager::OnDidFinishNavigation( + content::NavigationHandle* navigation_handle) { + auto it = pending_navigations_.begin(); + while (it != pending_navigations_.end()) { + content::NavigationHandle* pending_handle = *it; + if (pending_handle == navigation_handle) { + pending_navigations_.erase(it); + break; + } + it++; + } +} + +void TabManager::OnDidStopLoading(content::WebContents* contents) { + DCHECK_EQ(TAB_IS_LOADED, GetWebContentsData(contents)->tab_loading_state()); + loading_contents_.erase(contents); + LoadNextBackgroundTabIfNeeded(); +} + +void TabManager::OnWebContentsDestroyed(content::WebContents* contents) { + RemovePendingNavigationIfNeeded(contents); + loading_contents_.erase(contents); + LoadNextBackgroundTabIfNeeded(); +} + +void TabManager::LoadNextBackgroundTabIfNeeded() { + // Do not load more background tabs until all currently loading tabs have + // finished. + if (!loading_contents_.empty()) + return; + + if (pending_navigations_.empty()) + return; + + content::NavigationHandle* navigation_handle = pending_navigations_.front(); + pending_navigations_.erase(pending_navigations_.begin()); + ResumeNavigation(navigation_handle); +} + +void TabManager::ResumeTabNavigationIfNeeded(content::WebContents* contents) { + content::NavigationHandle* navigation_handle = + RemovePendingNavigationIfNeeded(contents); + if (navigation_handle) + ResumeNavigation(navigation_handle); +} + +void TabManager::ResumeNavigation( + content::NavigationHandle* navigation_handle) { + GetWebContentsData(navigation_handle->GetWebContents()) + ->SetTabLoadingState(TAB_IS_LOADING); + loading_contents_.insert(navigation_handle->GetWebContents()); + + navigation_handle->Resume(); +} + +content::NavigationHandle* TabManager::RemovePendingNavigationIfNeeded( + content::WebContents* contents) { + content::NavigationHandle* navigation_handle = nullptr; + auto it = pending_navigations_.begin(); + while (it != pending_navigations_.end()) { + navigation_handle = *it; + if ((*it)->GetWebContents() == contents) { + navigation_handle = *it; + pending_navigations_.erase(it); + break; + } + it++; + } + return navigation_handle; +} + +bool TabManager::IsTabLoadingForTest(content::WebContents* contents) const { + if (loading_contents_.count(contents) == 1) { + DCHECK_EQ(TAB_IS_LOADING, + GetWebContentsData(contents)->tab_loading_state()); + return true; + } + + DCHECK_NE(TAB_IS_LOADING, GetWebContentsData(contents)->tab_loading_state()); + return false; +} + +bool TabManager::IsNavigationDelayedForTest( + const content::NavigationHandle* navigation_handle) const { + for (const auto* nav : pending_navigations_) { + if (nav == navigation_handle) + return true; + } + return false; +} + } // namespace resource_coordinator
diff --git a/chrome/browser/resource_coordinator/tab_manager.h b/chrome/browser/resource_coordinator/tab_manager.h index 83f6a1b..6600088 100644 --- a/chrome/browser/resource_coordinator/tab_manager.h +++ b/chrome/browser/resource_coordinator/tab_manager.h
@@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/browser_tab_strip_tracker.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" +#include "content/public/browser/navigation_throttle.h" class BrowserList; class GURL; @@ -37,6 +38,7 @@ } namespace content { +class NavigationHandle; class WebContents; } @@ -61,6 +63,9 @@ // kernel is forced to kill processes, it will be able to do so using the same // algorithm as the one used here. // +// The TabManager also delays background tabs' navigation when needed in order +// to improve users' experience with the foreground tab. +// // Note that the browser tests are only active for platforms that use // TabManager (CrOS only for now) and need to be adjusted accordingly if // support for new platforms is added. @@ -150,6 +155,23 @@ // TODO(tasak): rename this to CanPurgeBackgroundedRenderer. bool CanSuspendBackgroundedRenderer(int render_process_id) const; + // Maybe throttle a tab's navigation based on current system status. + content::NavigationThrottle::ThrottleCheckResult MaybeThrottleNavigation( + content::NavigationHandle* navigation_handle); + + // Notifies TabManager that one navigation has finished (committed, aborted or + // replaced). TabManager should clean up the NavigationHandle objects bookkept + // before. + void OnDidFinishNavigation(content::NavigationHandle* navigation_handle); + + // Notifies TabManager that one tab has finished loading. TabManager can + // decide which tab to load next. + void OnDidStopLoading(content::WebContents* contents); + + // Notifies TabManager that one tab WebContents has been destroyed. TabManager + // needs to clean up data related to that tab. + void OnWebContentsDestroyed(content::WebContents* contents); + // Returns true if |first| is considered less desirable to be killed than // |second|. static bool CompareTabStats(const TabStats& first, const TabStats& second); @@ -187,6 +209,11 @@ GetUnsortedTabStatsIsInVisibleWindow); FRIEND_TEST_ALL_PREFIXES(TabManagerTest, HistogramsSessionRestoreSwitchToTab); FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardTabWithNonVisibleTabs); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, MaybeThrottleNavigation); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OnDidFinishNavigation); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OnDidStopLoading); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OnWebContentsDestroyed); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OnDelayedTabSelected); // Information about a Browser. struct BrowserInfo { @@ -339,6 +366,31 @@ // during session restore. void RecordSwitchToTab(content::WebContents* contents) const; + // Returns true if the navigation should be delayed. + bool ShouldDelayNavigation( + content::NavigationHandle* navigation_handle) const; + + // Start loading the next background tab if needed. + void LoadNextBackgroundTabIfNeeded(); + + // Resume the tab's navigation if it is pending right now. + void ResumeTabNavigationIfNeeded(content::WebContents* contents); + + // Resume navigation. + void ResumeNavigation(content::NavigationHandle* navigation_handle); + + // Remove the pending navigation for the provided WebContents. Return the + // removed navigation handle. Return nullptr if it doesn't exists. + content::NavigationHandle* RemovePendingNavigationIfNeeded( + content::WebContents* contents); + + // Check if the tab is loading. Use only in tests. + bool IsTabLoadingForTest(content::WebContents* contents) const; + + // Check if the navigation is delayed. Use only in tests. + bool IsNavigationDelayedForTest( + const content::NavigationHandle* navigation_handle) const; + // Timer to periodically update the stats of the renderers. base::RepeatingTimer update_timer_; @@ -408,6 +460,14 @@ class TabManagerSessionRestoreObserver; std::unique_ptr<TabManagerSessionRestoreObserver> session_restore_observer_; + // The list of navigation handles that are delayed. + std::vector<content::NavigationHandle*> pending_navigations_; + + // The tabs that are currently loading. We will consider loading the next + // background tab when these tabs have finished loading or a background tab + // is brought to foreground. + std::set<content::WebContents*> loading_contents_; + // Weak pointer factory used for posting delayed tasks. base::WeakPtrFactory<TabManager> weak_ptr_factory_;
diff --git a/chrome/browser/resource_coordinator/tab_manager_unittest.cc b/chrome/browser/resource_coordinator/tab_manager_unittest.cc index 63a8ed33..49537e1 100644 --- a/chrome/browser/resource_coordinator/tab_manager_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_unittest.cc
@@ -39,12 +39,16 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using content::NavigationHandle; +using content::NavigationThrottle; using content::WebContents; using content::WebContentsTester; namespace resource_coordinator { namespace { +const char kTestUrl[] = "http://www.example.com"; + class TabStripDummyDelegate : public TestTabStripModelDelegate { public: TabStripDummyDelegate() {} @@ -114,6 +118,45 @@ web_contents->NavigateAndCommit(GURL("https://www.example.com")); return web_contents; } + + std::unique_ptr<NavigationHandle> CreateTabAndNavigation() { + content::TestWebContents* web_contents = + content::TestWebContents::Create(profile(), nullptr); + return content::NavigationHandle::CreateNavigationHandleForTesting( + GURL(kTestUrl), web_contents->GetMainFrame()); + } + + // Simulate creating 3 tabs and their navigations. + void MaybeThrottleNavigations(TabManager* tab_manager) { + nav_handle1_ = CreateTabAndNavigation(); + nav_handle2_ = CreateTabAndNavigation(); + nav_handle3_ = CreateTabAndNavigation(); + contents1_ = nav_handle1_->GetWebContents(); + contents2_ = nav_handle2_->GetWebContents(); + contents3_ = nav_handle3_->GetWebContents(); + + NavigationThrottle::ThrottleCheckResult result1 = + tab_manager->MaybeThrottleNavigation(nav_handle1_.get()); + NavigationThrottle::ThrottleCheckResult result2 = + tab_manager->MaybeThrottleNavigation(nav_handle2_.get()); + NavigationThrottle::ThrottleCheckResult result3 = + tab_manager->MaybeThrottleNavigation(nav_handle3_.get()); + + // First tab starts navigation right away because there is no tab loading. + EXPECT_EQ(content::NavigationThrottle::PROCEED, result1); + + // The other 2 tabs's navigations are delayed. + EXPECT_EQ(content::NavigationThrottle::DEFER, result2); + EXPECT_EQ(content::NavigationThrottle::DEFER, result3); + } + + protected: + std::unique_ptr<NavigationHandle> nav_handle1_; + std::unique_ptr<NavigationHandle> nav_handle2_; + std::unique_ptr<NavigationHandle> nav_handle3_; + WebContents* contents1_; + WebContents* contents2_; + WebContents* contents3_; }; // TODO(georgesak): Add tests for protection to tabs with form input and @@ -692,4 +735,112 @@ tab_strip.CloseAllTabs(); } +TEST_F(TabManagerTest, MaybeThrottleNavigation) { + TabManager* tab_manager = g_browser_process->GetTabManager(); + MaybeThrottleNavigations(tab_manager); + tab_manager->GetWebContentsData(contents1_) + ->DidStartNavigation(nav_handle1_.get()); + + // Tab 1 is loading. The other 2 tabs's navigations are delayed. + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_)); + + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); +} + +TEST_F(TabManagerTest, OnDidFinishNavigation) { + TabManager* tab_manager = g_browser_process->GetTabManager(); + MaybeThrottleNavigations(tab_manager); + tab_manager->GetWebContentsData(contents1_) + ->DidStartNavigation(nav_handle1_.get()); + + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager->GetWebContentsData(contents2_) + ->DidFinishNavigation(nav_handle2_.get()); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); +} + +TEST_F(TabManagerTest, OnDidStopLoading) { + TabManager* tab_manager = g_browser_process->GetTabManager(); + MaybeThrottleNavigations(tab_manager); + tab_manager->GetWebContentsData(contents1_) + ->DidStartNavigation(nav_handle1_.get()); + + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + + // Simulate tab 1 has finished loading. + tab_manager->GetWebContentsData(contents1_)->DidStopLoading(); + + // After tab 1 has finished loading, TabManager starts loading the next tab. + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); +} + +TEST_F(TabManagerTest, OnWebContentsDestroyed) { + TabManager* tab_manager = g_browser_process->GetTabManager(); + MaybeThrottleNavigations(tab_manager); + tab_manager->GetWebContentsData(contents1_) + ->DidStartNavigation(nav_handle1_.get()); + + // Tab 2 is destroyed when its navigation is still delayed. Its states are + // cleaned up. + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager->OnWebContentsDestroyed(contents2_); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + + // Tab 1 is destroyed when it is still loading. Its states are cleaned up and + // Tabmanager starts to load the next tab (tab 3). + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + tab_manager->GetWebContentsData(contents1_)->WebContentsDestroyed(); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_)); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); +} + +TEST_F(TabManagerTest, OnDelayedTabSelected) { + TabManager* tab_manager = g_browser_process->GetTabManager(); + MaybeThrottleNavigations(tab_manager); + tab_manager->GetWebContentsData(contents1_) + ->DidStartNavigation(nav_handle1_.get()); + + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + + // Simulate selecting tab 3, which should start loading immediately. + tab_manager->ActiveTabChanged( + contents1_, contents3_, 2, + TabStripModelObserver::CHANGE_REASON_USER_GESTURE); + + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_)); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + + // Simulate tab 1 has finished loading. TabManager will NOT load the next tab + // (tab 2) because tab 3 is still loading. + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager->GetWebContentsData(contents1_)->DidStopLoading(); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_)); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + + // Simulate tab 3 has finished loading. TabManager starts loading the next tab + // (tab 2). + tab_manager->GetWebContentsData(contents3_)->DidStopLoading(); + EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_)); + EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_)); + EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); +} + } // namespace resource_coordinator
diff --git a/chrome/browser/resource_coordinator/tab_manager_web_contents_data.cc b/chrome/browser/resource_coordinator/tab_manager_web_contents_data.cc index 715d09c..bd6f3d4 100644 --- a/chrome/browser/resource_coordinator/tab_manager_web_contents_data.cc +++ b/chrome/browser/resource_coordinator/tab_manager_web_contents_data.cc
@@ -9,7 +9,9 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/engagement/site_engagement_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/resource_coordinator/tab_manager.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" using base::TimeTicks; @@ -42,6 +44,7 @@ // when available. if (tab_data_.tab_loading_state != TAB_IS_LOADED) { SetTabLoadingState(TAB_IS_LOADED); + g_browser_process->GetTabManager()->OnDidStopLoading(web_contents()); } } @@ -58,6 +61,11 @@ SetTabLoadingState(TAB_IS_LOADING); } +void TabManager::WebContentsData::DidFinishNavigation( + content::NavigationHandle* navigation_handle) { + g_browser_process->GetTabManager()->OnDidFinishNavigation(navigation_handle); +} + void TabManager::WebContentsData::WebContentsDestroyed() { // If Chrome is shutting down, ignore this event. if (g_browser_process->IsShuttingDown()) @@ -73,6 +81,9 @@ base::TimeDelta::FromSeconds(1), base::TimeDelta::FromDays(1), 100); } + + SetTabLoadingState(TAB_IS_NOT_LOADING); + g_browser_process->GetTabManager()->OnWebContentsDestroyed(web_contents()); } bool TabManager::WebContentsData::IsDiscarded() {
diff --git a/chrome/browser/resource_coordinator/tab_manager_web_contents_data.h b/chrome/browser/resource_coordinator/tab_manager_web_contents_data.h index 3ccce43..8cbe85ba 100644 --- a/chrome/browser/resource_coordinator/tab_manager_web_contents_data.h +++ b/chrome/browser/resource_coordinator/tab_manager_web_contents_data.h
@@ -57,6 +57,8 @@ void DidStopLoading() override; void DidStartNavigation( content::NavigationHandle* navigation_handle) override; + void DidFinishNavigation( + content::NavigationHandle* navigation_handle) override; void WebContentsDestroyed() override; // Returns true if the tab has been discarded to save memory. @@ -122,6 +124,11 @@ // Returns the time to first purge after the tab is backgrounded. base::TimeDelta time_to_purge() const { return time_to_purge_; } + // Sets the tab loading state. + void SetTabLoadingState(TabLoadingState state) { + tab_data_.tab_loading_state = state; + } + // Returns the TabLoadingState of the tab. TabLoadingState tab_loading_state() const { return tab_data_.tab_loading_state; @@ -165,11 +172,6 @@ // for more details. base::TimeTicks NowTicks() const; - // Sets the tab loading state. - void SetTabLoadingState(TabLoadingState state) { - tab_data_.tab_loading_state = state; - } - // Contains all the needed data for the tab. Data tab_data_;
diff --git a/chrome/browser/resources/chromeos/zip_archiver/OWNERS b/chrome/browser/resources/chromeos/zip_archiver/OWNERS new file mode 100644 index 0000000..77f7614 --- /dev/null +++ b/chrome/browser/resources/chromeos/zip_archiver/OWNERS
@@ -0,0 +1,2 @@ +yawano@chromium.org +mtomasz@chromium.org
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h index 621898d..dde1579c 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h
@@ -24,13 +24,16 @@ const char kArchiveReadDataError[] = "Failed to read archive data."; const char kArchiveReadFreeError[] = "Failed to close archive."; -// The size of the buffer used to skip unnecessary data. -// Should be positive and less than size_t maximum. -const int64_t kDummyBufferSize = 512 * 1024; // 512 KB +// The size of the buffer used to skip unnecessary data. Should be positive and +// UINT16_MAX or less. unzReadCurrentFile in third_party/minizip/src/unzip.c +// supports to read a data up to UINT16_MAX at a time. +const int64_t kDummyBufferSize = UINT16_MAX; // ~64 KB -// The size of the buffer used by ReadInProgress to decompress data. -// Should be positive and less than size_t maximum. -const int64_t kDecompressBufferSize = 512 * 1024; // 512 KB. +// The size of the buffer used by ReadInProgress to decompress data. Should be +// positive and UINT16_MAX or less. unzReadCurrentFile in +// third_party/minizip/src/unzip.c supports to read a data up to UINT16_MAX at a +// time. +const int64_t kDecompressBufferSize = UINT16_MAX; // ~64 KB. // The maximum data chunk size for VolumeReader::Read requests. // Should be positive.
diff --git a/chrome/browser/resources/md_bookmarks/folder_node.html b/chrome/browser/resources/md_bookmarks/folder_node.html index e72f981d..2664930 100644 --- a/chrome/browser/resources/md_bookmarks/folder_node.html +++ b/chrome/browser/resources/md_bookmarks/folder_node.html
@@ -102,14 +102,16 @@ <div class="menu-label">[[item_.title]]</div> </div> </div> - <div id="descendants" hidden$="[[isClosed_]]" role="group"> - <template is="dom-repeat" - items="[[item_.children]]" - as="child" - filter="isFolder_"> - <bookmarks-folder-node item-id="[[child]]" - depth="[[getChildDepth_(depth)]]"> - </bookmarks-folder-node> + <div id="descendants" role="group"> + <template is="dom-if" if="[[!isClosed_]]"> + <template is="dom-repeat" + items="[[item_.children]]" + as="child" + filter="isFolder_"> + <bookmarks-folder-node item-id="[[child]]" + depth="[[getChildDepth_(depth)]]"> + </bookmarks-folder-node> + </template> </template> </div> </template>
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js index ecf8ad6..ff056a51 100644 --- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js +++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -790,7 +790,8 @@ */ computeIssueBannerShown_: function(view, issue) { return !!issue && - (view == media_router.MediaRouterView.SINK_LIST || + (view == media_router.MediaRouterView.CAST_MODE_LIST || + view == media_router.MediaRouterView.SINK_LIST || view == media_router.MediaRouterView.FILTER || view == media_router.MediaRouterView.ISSUE); }, @@ -1332,11 +1333,11 @@ // Make space for the non-blocking issue in the sink list. this.updateElementPositioning_(); } - } else { - // Switch back to the sink list if the issue was cleared. If the previous - // issue was non-blocking, this would be a no-op. It is expected that - // the only way to clear an issue is by user action; the IssueManager - // (C++ side) does not clear issues in the UI. + } else if (this.currentView_ == media_router.MediaRouterView.ISSUE) { + // Switch back to the sink list if the issue was cleared and it was + // showing an issue. It is expected that the only way to clear an issue is + // by user action; the IssueManager (C++ side) does not clear issues in + // the UI. this.showSinkList_(); }
diff --git a/chrome/browser/resources/print_preview/print_preview.html b/chrome/browser/resources/print_preview/print_preview.html index 244f99bf..df7bc9f 100644 --- a/chrome/browser/resources/print_preview/print_preview.html +++ b/chrome/browser/resources/print_preview/print_preview.html
@@ -75,15 +75,14 @@ <include src="settings/advanced_options_settings.html"> <include src="settings/more_settings.html"> </div> - <div id="link-container"> <if expr="not chromeos"> + <div id="link-container"> <div> <a is="action-link" id="system-dialog-link" class="navbar-link"> $i18n{systemDialogOption} </a> <div id="system-dialog-throbber" hidden class="throbber"></div> </div> -</if> <if expr="is_macosx"> <div> <a is="action-link" id="open-pdf-in-preview-link" class="navbar-link"> @@ -93,6 +92,7 @@ </div> </if> </div> +</if> </div> </div> <include src="search/destination_search.html">
diff --git a/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js b/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js index 25637213..6b966fe59 100644 --- a/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js +++ b/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js
@@ -166,9 +166,11 @@ this.enableActionButton_( this.i18n('chromeCleanupDoneButtonLabel'), this.dismiss_.bind(this)); this.setIconDone_(); + } else if (idleReason == settings.ChromeCleanupIdleReason.INITIAL) { + this.dismiss_(); } else { // Scanning-related idle reasons are unexpected. Show an error message for - // all reasons other than |CLEANING_SUCCEEDED|. + // all reasons other than |CLEANING_SUCCEEDED| and |INITIAL|. this.title_ = this.i18n('chromeCleanupTitleErrorCantRemove'); this.enableActionButton_( this.i18n('chromeCleanupDoneButtonLabel'), this.dismiss_.bind(this));
diff --git a/chrome/browser/resources/settings/settings_menu/settings_menu.html b/chrome/browser/resources/settings/settings_menu/settings_menu.html index 1ca810c..718fe7e 100644 --- a/chrome/browser/resources/settings/settings_menu/settings_menu.html +++ b/chrome/browser/resources/settings/settings_menu/settings_menu.html
@@ -26,6 +26,7 @@ -webkit-margin-end: 2px; /* Margin so selected outline is visible. */ -webkit-margin-start: 1px; -webkit-padding-start: 23px; /* 24px - 1px from margin for outline. */ + align-items: center; color: var(--settings-nav-grey); display: flex; font-weight: 500;
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html index e5561de..6fd3fcf 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.html +++ b/chrome/browser/resources/settings/site_settings/site_details.html
@@ -63,10 +63,6 @@ <h2>$i18n{siteSettingsPermissions}</h2> </div> <div class="list-frame"> - <site-details-permission category="{{ContentSettingsTypes.COOKIES}}" - icon="settings:cookie" id="cookies" - label="$i18n{siteSettingsCookies}"> - </site-details-permission> <site-details-permission category="{{ContentSettingsTypes.GEOLOCATION}}" icon="settings:location-on" id="geolocation" label="$i18n{siteSettingsLocation}">
diff --git a/chrome/browser/resources/settings/site_settings/site_details_permission.html b/chrome/browser/resources/settings/site_settings/site_details_permission.html index 2d90097..22bf311 100644 --- a/chrome/browser/resources/settings/site_settings/site_details_permission.html +++ b/chrome/browser/resources/settings/site_settings/site_details_permission.html
@@ -29,10 +29,6 @@ <option id="block" value$="[[ContentSetting.BLOCK]]"> $i18n{siteSettingsActionBlock} </option> - <option id="sessionOnly" value$="[[ContentSetting.SESSION_ONLY]]" - hidden$="[[!isCookiesCategory_(category)]]"> - $i18n{siteSettingsActionSessionOnly} - </option> </select> <span class="md-select-underline"></span> </div>
diff --git a/chrome/browser/resources/settings/site_settings/site_details_permission.js b/chrome/browser/resources/settings/site_settings/site_details_permission.js index 2d799f5..1eb49eeb 100644 --- a/chrome/browser/resources/settings/site_settings/site_details_permission.js +++ b/chrome/browser/resources/settings/site_settings/site_details_permission.js
@@ -42,11 +42,6 @@ this.removePatternWildcard(right); }, - /** @private */ - isCookiesCategory_: function(category) { - return category == settings.ContentSettingsTypes.COOKIES; - }, - /** * Updates the drop-down value after |site| has changed. * @param {!SiteException} site The site to display.
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc index 0ea7937..cb9d883 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc
@@ -15,6 +15,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/metrics/histogram_macros.h" #include "base/task_scheduler/post_task.h" #include "base/task_scheduler/task_traits.h" #include "base/threading/thread_restrictions.h" @@ -27,6 +28,7 @@ #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h" #include "chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.h" #include "chrome/browser/safe_browsing/chrome_cleaner/srt_client_info_win.h" +#include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" #include "chrome/installer/util/scoped_token_privilege.h" #include "components/chrome_cleaner/public/constants/constants.h" #include "components/safe_browsing/common/safe_browsing_prefs.h" @@ -50,6 +52,26 @@ constexpr int kRebootRequiredExitCode = 15; constexpr int kRebootNotRequiredExitCode = 0; +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum CleanupResultHistogramValue { + CLEANUP_RESULT_SUCCEEDED = 0, + CLEANUP_RESULT_REBOOT_REQUIRED = 1, + CLEANUP_RESULT_FAILED = 2, + + CLEANUP_RESULT_MAX, +}; + +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum IPCDisconnectedHistogramValue { + IPC_DISCONNECTED_SUCCESS = 0, + IPC_DISCONNECTED_LOST_WHILE_SCANNING = 1, + IPC_DISCONNECTED_LOST_USER_PROMPTED = 2, + + IPC_DISCONNECTED_MAX, +}; + // Attempts to change the Chrome Cleaner binary's suffix to ".exe". Will return // an empty FilePath on failure. Should be called on a sequence with traits // appropriate for IO operations. @@ -100,8 +122,28 @@ : ChromeCleanerController::IdleReason::kConnectionLost; } +void RecordCleanerLogsAcceptanceHistogram(bool logs_accepted) { + UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.CleanerLogsAcceptance", + logs_accepted); +} + +void RecordCleanupResultHistogram(CleanupResultHistogramValue result) { + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.Cleaner.CleanupResult", result, + CLEANUP_RESULT_MAX); +} + +void RecordIPCDisconnectedHistogram(IPCDisconnectedHistogramValue error) { + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.IPCDisconnected", error, + IPC_DISCONNECTED_MAX); +} + } // namespace +void RecordCleanupStartedHistogram(CleanupStartedHistogramValue value) { + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.CleanupStarted", value, + CLEANUP_STARTED_MAX); +} + ChromeCleanerControllerDelegate::ChromeCleanerControllerDelegate() = default; ChromeCleanerControllerDelegate::~ChromeCleanerControllerDelegate() = default; @@ -154,8 +196,11 @@ return false; State state = GetInstance()->state(); + IdleReason reason = GetInstance()->idle_reason(); return state == State::kInfected || state == State::kCleaning || - state == State::kRebootRequired; + state == State::kRebootRequired || + (state == State::kIdle && (reason == IdleReason::kCleaningFailed || + reason == IdleReason::kConnectionLost)); } void ChromeCleanerController::SetLogsEnabled(bool logs_enabled) { @@ -167,6 +212,18 @@ observer.OnLogsEnabledChanged(logs_enabled_); } +void ChromeCleanerController::ResetIdleState() { + if (state() != State::kIdle || idle_reason() == IdleReason::kInitial) + return; + + idle_reason_ = IdleReason::kInitial; + + // SetStateAndNotifyObservers doesn't allow transitions to the same state. + // Notify observers directly instead. + for (auto& observer : observer_list_) + NotifyObserver(&observer); +} + void ChromeCleanerController::SetDelegateForTesting( ChromeCleanerControllerDelegate* delegate) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); @@ -231,12 +288,14 @@ case UserResponse::kAcceptedWithLogs: acceptance = PromptAcceptance::ACCEPTED_WITH_LOGS; SetLogsEnabled(true); + RecordCleanerLogsAcceptanceHistogram(true); new_state = State::kCleaning; delegate_->TagForResetting(profile); break; case UserResponse::kAcceptedWithoutLogs: acceptance = PromptAcceptance::ACCEPTED_WITHOUT_LOGS; SetLogsEnabled(false); + RecordCleanerLogsAcceptanceHistogram(false); new_state = State::kCleaning; delegate_->TagForResetting(profile); break; @@ -264,6 +323,7 @@ if (state() != State::kRebootRequired) return; + UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.Cleaner.RebootResponse", true); InitiateReboot(); } @@ -329,6 +389,8 @@ if (executable_path.empty()) { idle_reason_ = IdleReason::kScanningFailed; SetStateAndNotifyObservers(State::kIdle); + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_CLEANER_DOWNLOAD_FAILED); return; } @@ -391,9 +453,12 @@ PromptAcceptance::DENIED)); idle_reason_ = IdleReason::kScanningFoundNothing; SetStateAndNotifyObservers(State::kIdle); + RecordPromptNotShownWithReasonHistogram(NO_PROMPT_REASON_NOTHING_FOUND); return; } + UMA_HISTOGRAM_COUNTS_1000("SoftwareReporter.NumberOfFilesToDelete", + files_to_delete->size()); files_to_delete_ = std::move(files_to_delete); prompt_user_callback_ = std::move(prompt_user_callback); SetStateAndNotifyObservers(State::kInfected); @@ -405,6 +470,14 @@ DCHECK_NE(State::kRebootRequired, state()); if (state() == State::kScanning || state() == State::kInfected) { + if (state() == State::kScanning) { + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_IPC_CONNECTION_BROKEN); + RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_LOST_WHILE_SCANNING); + } else { + RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_LOST_USER_PROMPTED); + } + idle_reason_ = IdleReasonWhenConnectionClosedTooSoon(state()); SetStateAndNotifyObservers(State::kIdle); return; @@ -416,6 +489,7 @@ // Cleaner process since communication via Mojo is complete and only the // exit code of the process is of any use to us (for deciding whether we // need to reboot). + RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_SUCCESS); } void ChromeCleanerController::OnCleanerProcessDone( @@ -432,27 +506,26 @@ DCHECK_NE(ChromeCleanerRunner::LaunchStatus::kLaunchFailed, process_status.launch_status); - if (process_status.launch_status != + if (process_status.launch_status == ChromeCleanerRunner::LaunchStatus::kSuccess) { - idle_reason_ = IdleReason::kCleaningFailed; - SetStateAndNotifyObservers(State::kIdle); - return; + if (process_status.exit_code == kRebootRequiredExitCode) { + RecordCleanupResultHistogram(CLEANUP_RESULT_REBOOT_REQUIRED); + SetStateAndNotifyObservers(State::kRebootRequired); + return; + } + + if (process_status.exit_code == kRebootNotRequiredExitCode) { + RecordCleanupResultHistogram(CLEANUP_RESULT_SUCCEEDED); + delegate_->ResetTaggedProfiles( + g_browser_process->profile_manager()->GetLoadedProfiles(), + base::BindOnce(&ChromeCleanerController::OnSettingsResetCompleted, + base::Unretained(this))); + ResetCleanerDataAndInvalidateWeakPtrs(); + return; + } } - if (process_status.exit_code == kRebootRequiredExitCode) { - SetStateAndNotifyObservers(State::kRebootRequired); - return; - } - - if (process_status.exit_code == kRebootNotRequiredExitCode) { - delegate_->ResetTaggedProfiles( - g_browser_process->profile_manager()->GetLoadedProfiles(), - base::BindOnce(&ChromeCleanerController::OnSettingsResetCompleted, - base::Unretained(this))); - ResetCleanerDataAndInvalidateWeakPtrs(); - return; - } - + RecordCleanupResultHistogram(CLEANUP_RESULT_FAILED); idle_reason_ = IdleReason::kCleaningFailed; SetStateAndNotifyObservers(State::kIdle); }
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h index 0547e74..8ed8f3b 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h
@@ -23,6 +23,18 @@ namespace safe_browsing { +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum CleanupStartedHistogramValue { + CLEANUP_STARTED_FROM_PROMPT_DIALOG = 0, + CLEANUP_STARTED_FROM_PROMPT_IN_SETTINGS = 1, + + CLEANUP_STARTED_MAX, +}; + +// Records a SoftwareReporter.CleanupStarted histogram. +void RecordCleanupStartedHistogram(CleanupStartedHistogramValue value); + // Delegate class that provides services to the ChromeCleanerController class // and can be overridden by tests via // SetChromeCleanerControllerDelegateForTesting(). @@ -125,6 +137,7 @@ static bool ShouldShowCleanupInSettingsUI(); State state() const { return state_; } + IdleReason idle_reason() const { return idle_reason_; } // Called by Chrome Cleaner's UI when the user changes Cleaner logs upload // permissions. Observers are notified if |logs_enabled| is different from the @@ -132,6 +145,10 @@ void SetLogsEnabled(bool logs_enabled); bool logs_enabled() const { return logs_enabled_; } + // Called by the Chrome Cleaner's UI when the user dismisses the card while + // in the kIdle state. Does nothing if the current state is not |kIdle|. + void ResetIdleState(); + // |AddObserver()| immediately notifies |observer| of the controller's state // by calling the corresponding |On*()| function. void AddObserver(Observer* observer);
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc index 7624e64..72b58371 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.h" +#include "base/metrics/histogram_macros.h" +#include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_finder.h" @@ -40,6 +42,23 @@ return nullptr; } +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum PromptDialogResponseHistogramValue { + PROMPT_DIALOG_RESPONSE_ACCEPTED = 0, + PROMPT_DIALOG_RESPONSE_DETAILS = 1, + PROMPT_DIALOG_RESPONSE_CANCELLED = 2, + PROMPT_DIALOG_RESPONSE_DISMISSED = 3, + + PROMPT_DIALOG_RESPONSE_MAX, +}; + +void RecordPromptDialogResponseHistogram( + PromptDialogResponseHistogramValue value) { + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.PromptDialogResponse", value, + PROMPT_DIALOG_RESPONSE_MAX); +} + } // namespace ChromeCleanerDialogControllerImpl::ChromeCleanerDialogControllerImpl( @@ -60,6 +79,9 @@ void ChromeCleanerDialogControllerImpl::Accept(bool logs_enabled) { DCHECK(browser_); + RecordPromptDialogResponseHistogram(PROMPT_DIALOG_RESPONSE_ACCEPTED); + RecordCleanupStartedHistogram(CLEANUP_STARTED_FROM_PROMPT_DIALOG); + cleaner_controller_->ReplyWithUserResponse( browser_->profile(), logs_enabled @@ -72,6 +94,8 @@ void ChromeCleanerDialogControllerImpl::Cancel() { DCHECK(browser_); + RecordPromptDialogResponseHistogram(PROMPT_DIALOG_RESPONSE_CANCELLED); + cleaner_controller_->ReplyWithUserResponse( browser_->profile(), ChromeCleanerController::UserResponse::kDenied); OnInteractionDone(); @@ -80,6 +104,8 @@ void ChromeCleanerDialogControllerImpl::Close() { DCHECK(browser_); + RecordPromptDialogResponseHistogram(PROMPT_DIALOG_RESPONSE_DISMISSED); + cleaner_controller_->ReplyWithUserResponse( browser_->profile(), ChromeCleanerController::UserResponse::kDismissed); OnInteractionDone(); @@ -87,6 +113,8 @@ void ChromeCleanerDialogControllerImpl::DetailsButtonClicked( bool logs_enabled) { + RecordPromptDialogResponseHistogram(PROMPT_DIALOG_RESPONSE_DETAILS); + cleaner_controller_->SetLogsEnabled(logs_enabled); OpenSettingsPage(browser_); OnInteractionDone(); @@ -124,11 +152,14 @@ // TODO(alito): Register with chrome::BrowserListObserver to get notified // later if a suitable browser window becomes available to show the // prompt. http://crbug.com/734677 + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_BROWSER_NOT_AVAILABLE); OnInteractionDone(); return; } chrome::ShowChromeCleanerPrompt(browser_, this); + RecordPromptShownHistogram(); dialog_shown_ = true; }
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc index 34605c3..2d3b8df 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc
@@ -18,6 +18,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" +#include "base/metrics/histogram_macros.h" #include "base/sequenced_task_runner.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -52,6 +53,23 @@ install_mode); } +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum CleanerDownloadStatusHistogramValue { + CLEANER_DOWNLOAD_STATUS_SUCCEEDED = 0, + CLEANER_DOWNLOAD_STATUS_OTHER_FAILURE = 1, + CLEANER_DOWNLOAD_STATUS_NOT_FOUND_ON_SERVER = 2, + CLEANER_DOWNLOAD_STATUS_FAILED_TO_CREATE_TEMP_DIR = 3, + + CLEANER_DOWNLOAD_STATUS_MAX, +}; + +void RecordCleanerDownloadStatusHistogram( + CleanerDownloadStatusHistogramValue value) { + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.Cleaner.DownloadStatus", value, + CLEANER_DOWNLOAD_STATUS_MAX); +} + // Class that will attempt to download the Chrome Cleaner executable and call a // given callback when done. Instances of ChromeCleanerFetcher own themselves // and will self-delete if they encounter an error or when the network request @@ -123,6 +141,8 @@ void ChromeCleanerFetcher::OnTemporaryDirectoryCreated(bool success) { if (!success) { + RecordCleanerDownloadStatusHistogram( + CLEANER_DOWNLOAD_STATUS_FAILED_TO_CREATE_TEMP_DIR); PostCallbackAndDeleteSelf( base::FilePath(), ChromeCleanerFetchStatus::kFailedToCreateTemporaryDirectory); @@ -166,6 +186,8 @@ DCHECK(fetched_callback_); if (source->GetResponseCode() == net::HTTP_NOT_FOUND) { + RecordCleanerDownloadStatusHistogram( + CLEANER_DOWNLOAD_STATUS_NOT_FOUND_ON_SERVER); PostCallbackAndDeleteSelf(base::FilePath(), ChromeCleanerFetchStatus::kNotFoundOnServer); return; @@ -175,6 +197,7 @@ if (!source->GetStatus().is_success() || source->GetResponseCode() != net::HTTP_OK || !source->GetResponseAsFilePath(/*take_ownership=*/true, &download_path)) { + RecordCleanerDownloadStatusHistogram(CLEANER_DOWNLOAD_STATUS_OTHER_FAILURE); PostCallbackAndDeleteSelf(base::FilePath(), ChromeCleanerFetchStatus::kOtherFailure); return; @@ -186,6 +209,7 @@ // Take ownership of the scoped temp directory so it is not deleted. scoped_temp_dir_->Take(); + RecordCleanerDownloadStatusHistogram(CLEANER_DOWNLOAD_STATUS_SUCCEEDED); PostCallbackAndDeleteSelf(std::move(download_path), ChromeCleanerFetchStatus::kSuccess); }
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc index 5791a03a..28f1385 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc
@@ -496,6 +496,8 @@ // re-display it. Improve this. http://crbug.com/460295 if (fetch_status == ChromeCleanerFetchStatus::kNotFoundOnServer) { RecordSRTPromptHistogram(SRT_PROMPT_DOWNLOAD_UNAVAILABLE); + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_CLEANER_DOWNLOAD_FAILED); return; } @@ -504,8 +506,11 @@ // reporter. We can't use other ways of finding a browser because we don't // have a profile. Browser* browser = chrome::FindLastActive(); - if (!browser) + if (!browser) { + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_BROWSER_NOT_AVAILABLE); return; + } Profile* profile = browser->profile(); DCHECK(profile); @@ -588,8 +593,10 @@ ChromeCleanerController* cleaner_controller = ChromeCleanerController::GetInstance(); - if (cleaner_controller->state() != ChromeCleanerController::State::kIdle) + if (cleaner_controller->state() != ChromeCleanerController::State::kIdle) { + RecordPromptNotShownWithReasonHistogram(NO_PROMPT_REASON_NOT_ON_IDLE_STATE); return; + } cleaner_controller->Scan(reporter_invocation); DCHECK_EQ(ChromeCleanerController::State::kScanning, @@ -624,6 +631,7 @@ local_state && local_state->GetBoolean(prefs::kSwReporterPendingPrompt); if (!incoming_seed.empty() && incoming_seed == old_seed && !pending_prompt) { RecordReporterStepHistogram(SW_REPORTER_ALREADY_PROMPTED); + RecordPromptNotShownWithReasonHistogram(NO_PROMPT_REASON_ALREADY_PROMPTED); return; } @@ -771,6 +779,8 @@ if (!finished_invocation.BehaviourIsSupported( SwReporterInvocation::BEHAVIOUR_TRIGGER_PROMPT)) { + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_BEHAVIOUR_NOT_SUPPORTED); return; } @@ -779,12 +789,15 @@ // Knowing about disabled field trial is more important than reporter not // finding anything to remove, so check this case first. RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_FIELD_TRIAL); + RecordPromptNotShownWithReasonHistogram( + NO_PROMPT_REASON_FEATURE_NOT_ENABLED); return; } if (exit_code != chrome_cleaner::kSwReporterPostRebootCleanupNeeded && exit_code != chrome_cleaner::kSwReporterCleanupNeeded) { RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_NEEDED); + RecordPromptNotShownWithReasonHistogram(NO_PROMPT_REASON_NOTHING_FOUND); return; }
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.cc index 3c63d8b..062dc62 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.cc
@@ -15,6 +15,7 @@ #include "base/callback_helpers.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/metrics/histogram_macros.h" #include "base/sequence_checker.h" #include "base/synchronization/lock.h" #include "base/win/registry.h" @@ -220,6 +221,7 @@ DCHECK(profile); RecordResetPending(true, profile); + UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.TaggedProfileForResetting", true); } void PostCleanupSettingsResetter::ResetTaggedProfiles( @@ -237,6 +239,9 @@ return; } + UMA_HISTOGRAM_EXACT_LINEAR("SoftwareReporter.PostCleanupSettingsReset", + profiles_to_reset.size(), 10); + // The SettingsResetter object will self-delete once |done_callback| is // invoked. make_scoped_refptr(new SettingsResetter(std::move(profiles_to_reset),
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc index 356e6f6..4bcd0ae 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc
@@ -37,6 +37,9 @@ "https://dl.google.com/dl" "/softwareremovaltool/win/c/chrome_cleanup_tool.exe?chrome-prompt=1"; +constexpr char kSoftwareReporterPromptShownMetricName[] = + "SoftwareReporter.PromptShown"; + } // namespace namespace safe_browsing { @@ -111,4 +114,15 @@ SRT_PROMPT_MAX); } +void RecordPromptShownHistogram() { + UMA_HISTOGRAM_BOOLEAN(kSoftwareReporterPromptShownMetricName, true); +} + +void RecordPromptNotShownWithReasonHistogram( + NoPromptReasonHistogramValue value) { + UMA_HISTOGRAM_BOOLEAN(kSoftwareReporterPromptShownMetricName, false); + UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.NoPromptReason", value, + NO_PROMPT_REASON_MAX); +} + } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h index 6809423..ff3c316 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h
@@ -26,6 +26,21 @@ SRT_PROMPT_MAX, }; +// These values are used to send UMA information and are replicated in the +// histograms.xml file, so the order MUST NOT CHANGE. +enum NoPromptReasonHistogramValue { + NO_PROMPT_REASON_BEHAVIOUR_NOT_SUPPORTED = 0, + NO_PROMPT_REASON_FEATURE_NOT_ENABLED = 1, + NO_PROMPT_REASON_NOTHING_FOUND = 2, + NO_PROMPT_REASON_ALREADY_PROMPTED = 3, + NO_PROMPT_REASON_CLEANER_DOWNLOAD_FAILED = 4, + NO_PROMPT_REASON_BROWSER_NOT_AVAILABLE = 5, + NO_PROMPT_REASON_NOT_ON_IDLE_STATE = 6, + NO_PROMPT_REASON_IPC_CONNECTION_BROKEN = 7, + + NO_PROMPT_REASON_MAX, +}; + // When enabled, all user interaction with the Chrome Cleaner will happen from // within Chrome. extern const base::Feature kInBrowserCleanerUIFeature; @@ -51,6 +66,15 @@ // Records a value for the SRT Prompt Histogram. void RecordSRTPromptHistogram(SRTPromptHistogramValue value); +// Records a SoftwareReporter.PromptShown histogram with value true. +void RecordPromptShownHistogram(); + +// Records a SoftwareReporter.PromptShown histogram with value false and +// a SoftwareReporter.NoPromptReason histogram with the reason corresponding +// to |value|. +void RecordPromptNotShownWithReasonHistogram( + NoPromptReasonHistogramValue value); + } // namespace safe_browsing #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_FIELD_TRIAL_WIN_H_
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_global_error_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_global_error_win.cc index 29a9e10b2..afc8a40 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_global_error_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_global_error_win.cc
@@ -137,6 +137,7 @@ void SRTGlobalError::ShowBubbleView(Browser* browser) { RecordSRTPromptHistogram(SRT_PROMPT_SHOWN); + RecordPromptShownHistogram(); GlobalErrorWithStandardBubble::ShowBubbleView(browser); }
diff --git a/chrome/browser/storage/OWNERS b/chrome/browser/storage/OWNERS index 721ef45..558b9a17a 100644 --- a/chrome/browser/storage/OWNERS +++ b/chrome/browser/storage/OWNERS
@@ -4,5 +4,8 @@ per-file storage_info_fetcher.*=finnur@chromium.org +per-file *permission_context*=set noparent +per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS + # TEAM: storage-dev@chromium.org # COMPONENT: Blink>Storage>DOMStorage
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index 40607a3..c3cee5d5 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
@@ -124,12 +124,6 @@ ProfileSyncServiceHarness::~ProfileSyncServiceHarness() { } -void ProfileSyncServiceHarness::SetCredentials(const std::string& username, - const std::string& password) { - username_ = username; - password_ = password; -} - bool ProfileSyncServiceHarness::SetupSync() { bool result = SetupSync(syncer::UserSelectableTypes(), false); if (!result) { @@ -181,8 +175,7 @@ std::string gaia_id = GetGaiaIdForUsername(username_); service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); std::string account_id = service()->signin()->GetAuthenticatedAccountId(); - service()->GoogleSigninSucceededWithPassword(account_id, username_, - password_); + service()->GoogleSigninSucceeded(account_id, username_); ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString()); } else {
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.h b/chrome/browser/sync/test/integration/profile_sync_service_harness.h index 958f173..f808851 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.h +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.h
@@ -46,9 +46,6 @@ SigninType signin_type); virtual ~ProfileSyncServiceHarness(); - // Sets the GAIA credentials with which to sign in to sync. - void SetCredentials(const std::string& username, const std::string& password); - // Creates a ProfileSyncService for the profile passed at construction and // enables sync for all available datatypes. Returns true only after sync has // been fully initialized and authenticated, and we are ready to process
diff --git a/chrome/browser/ui/app_list/search/answer_card/answer_card_search_provider.cc b/chrome/browser/ui/app_list/search/answer_card/answer_card_search_provider.cc index 3a04719a..38572e5 100644 --- a/chrome/browser/ui/app_list/search/answer_card/answer_card_search_provider.cc +++ b/chrome/browser/ui/app_list/search/answer_card/answer_card_search_provider.cc
@@ -85,7 +85,9 @@ // Lifetime of |prefixed_query| should be longer than the one of // |replacements|. - base::string16 prefixed_query(base::UTF8ToUTF16("q=") + query); + base::string16 prefixed_query( + base::UTF8ToUTF16("q=") + query + + base::UTF8ToUTF16(features::AnswerServerQuerySuffix())); GURL::ReplacementsW replacements; replacements.SetQueryStr(prefixed_query); current_request_url_ = answer_server_url_.ReplaceComponents(replacements);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 8e8bb57..a474346 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -2542,6 +2542,34 @@ EXPECT_TRUE(manager->IsWindowOnDesktopOfUser(window, current_user)); } +// Ensure multi-profile panels are properly added / removed from the shelf. +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, + PanelUpdateOnUserSwitch) { + InitLauncherController(); + + // Check the shelf model used by ShelfWindowWatcher. + ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model(); + ASSERT_EQ(1, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[0].type); + + // Add an app panel window; ShelfWindowWatcher will add a shelf item. + V2App panel(profile(), extension_platform_app_.get(), + extensions::AppWindow::WINDOW_TYPE_PANEL); + ASSERT_EQ(2, model_.item_count()); + EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[1].type); + + // After switching users the item should go away. + TestingProfile* profile2 = CreateMultiUserProfile("user2"); + SwitchActiveUser(multi_user_util::GetAccountIdFromProfile(profile2)); + ASSERT_EQ(1, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[0].type); + + // And it should come back when switching back. + SwitchActiveUser(multi_user_util::GetAccountIdFromProfile(profile())); + ASSERT_EQ(2, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[1].type); +} + // Check that a running windowed V1 application will be properly pinned and // unpinned when the order gets changed through a profile / policy change. TEST_F(ChromeLauncherControllerTest,
diff --git a/chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.cc index 3899041e..fea64653 100644 --- a/chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.h" +#include "ash/public/cpp/shelf_types.h" +#include "ash/public/cpp/window_properties.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" @@ -46,9 +48,15 @@ extensions::AppWindow* app_window = *it; Profile* profile = Profile::FromBrowserContext(app_window->browser_context()); - if (!multi_user_util::IsProfileFromActiveUser(profile) && - IsRegisteredApp(app_window->GetNativeWindow())) - UnregisterApp(app_window->GetNativeWindow()); + if (!multi_user_util::IsProfileFromActiveUser(profile)) { + if (IsRegisteredApp(app_window->GetNativeWindow())) { + UnregisterApp(app_window->GetNativeWindow()); + } else if (app_window->window_type_is_panel()) { + // Panels are not registered; hide by clearing the shelf item type. + app_window->GetNativeWindow()->SetProperty<int>(ash::kShelfItemTypeKey, + ash::TYPE_UNDEFINED); + } + } } for (AppWindowList::iterator it = app_window_list_.begin(); it != app_window_list_.end();
diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc index b17017d..a4de34d 100644 --- a/chrome/browser/ui/certificate_dialogs.cc +++ b/chrome/browser/ui/certificate_dialogs.cc
@@ -14,18 +14,15 @@ #include "base/bind.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/task_scheduler/post_task.h" #include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/common/net/x509_certificate_model.h" #include "chrome/grit/generated_resources.h" -#include "content/public/browser/browser_thread.h" #include "net/base/filename_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "url/gurl.h" -using content::BrowserThread; -using content::WebContents; - namespace { void WriterCallback(const base::FilePath& path, const std::string& data) { @@ -36,12 +33,6 @@ } } -void WriteFileOnFileThread(const base::FilePath& path, - const std::string& data) { - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::BindOnce(&WriterCallback, path, data)); -} - std::string WrapAt64(const std::string &str) { std::string result; for (size_t i = 0; i < str.size(); i += 64) { @@ -67,7 +58,7 @@ class Exporter : public ui::SelectFileDialog::Listener { public: - Exporter(WebContents* web_contents, + Exporter(content::WebContents* web_contents, gfx::NativeWindow parent, net::X509Certificate::OSCertHandles::iterator certs_begin, net::X509Certificate::OSCertHandles::iterator certs_end); @@ -86,7 +77,7 @@ net::X509Certificate::OSCertHandles cert_chain_list_; }; -Exporter::Exporter(WebContents* web_contents, +Exporter::Exporter(content::WebContents* web_contents, gfx::NativeWindow parent, net::X509Certificate::OSCertHandles::iterator certs_begin, net::X509Certificate::OSCertHandles::iterator certs_end) @@ -153,8 +144,10 @@ break; } - if (!data.empty()) - WriteFileOnFileThread(path, data); + if (!data.empty()) { + base::PostTaskWithTraits(FROM_HERE, {base::MayBlock()}, + base::BindOnce(&WriterCallback, path, data)); + } delete this; } @@ -198,7 +191,7 @@ parent, params); } -void ShowCertExportDialog(WebContents* web_contents, +void ShowCertExportDialog(content::WebContents* web_contents, gfx::NativeWindow parent, const scoped_refptr<net::X509Certificate>& cert) { net::X509Certificate::OSCertHandles cert_chain;
diff --git a/chrome/browser/ui/cocoa/animated_icon.h b/chrome/browser/ui/cocoa/animated_icon.h index b932785e..68c277b 100644 --- a/chrome/browser/ui/cocoa/animated_icon.h +++ b/chrome/browser/ui/cocoa/animated_icon.h
@@ -29,7 +29,7 @@ void set_color(SkColor color) { color_ = color; } - // Animates the icon. + // Animates the icon. Restart from the beginning if it's already running. void Animate(); // Paints the icon on the current drawing context, centered in |frame|.
diff --git a/chrome/browser/ui/cocoa/animated_icon.mm b/chrome/browser/ui/cocoa/animated_icon.mm index af45966..65ae036 100644 --- a/chrome/browser/ui/cocoa/animated_icon.mm +++ b/chrome/browser/ui/cocoa/animated_icon.mm
@@ -20,6 +20,7 @@ AnimatedIcon::~AnimatedIcon() {} void AnimatedIcon::Animate() { + animation_->End(); animation_->Start(); }
diff --git a/chrome/browser/ui/cocoa/browser_window_layout.mm b/chrome/browser/ui/cocoa/browser_window_layout.mm index 6df8307..041f0f8f 100644 --- a/chrome/browser/ui/cocoa/browser_window_layout.mm +++ b/chrome/browser/ui/cocoa/browser_window_layout.mm
@@ -11,6 +11,7 @@ #include "base/mac/mac_util.h" #include "chrome/browser/ui/cocoa/l10n_util.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" +#include "chrome/common/chrome_features.h" namespace chrome { @@ -24,7 +25,8 @@ // may break in a future macOS release. NSFullSizeContentViewWindowMask is a // new (10.10+), supported way to make the content view the full size of the // window without covering the controls. - return base::mac::IsAtLeastOS10_11(); + return base::FeatureList::IsEnabled(features::kMacFullSizeContentView) && + base::mac::IsAtLeastOS10_11(); } } // namespace chrome
diff --git a/chrome/browser/ui/cocoa/browser_window_touch_bar.mm b/chrome/browser/ui/cocoa/browser_window_touch_bar.mm index ca3b4aa..daa014a6 100644 --- a/chrome/browser/ui/cocoa/browser_window_touch_bar.mm +++ b/chrome/browser/ui/cocoa/browser_window_touch_bar.mm
@@ -183,7 +183,8 @@ - (NSView*)backOrForwardTouchBarView; // Creates and returns the search button. -- (NSView*)searchTouchBarView; +- (NSView*)searchTouchBarView + __attribute__((availability(macos, introduced = 10.12))); @end @implementation BrowserWindowTouchBar @@ -298,9 +299,13 @@ setCustomizationLabel:l10n_util::GetNSString( IDS_TOUCH_BAR_BOOKMARK_CUSTOMIZATION_LABEL)]; } else if ([identifier hasSuffix:kSearchTouchId]) { - [touchBarItem setView:[self searchTouchBarView]]; - [touchBarItem setCustomizationLabel:l10n_util::GetNSString( - IDS_TOUCH_BAR_GOOGLE_SEARCH)]; + if (@available(macOS 10.12, *)) { + [touchBarItem setView:[self searchTouchBarView]]; + [touchBarItem setCustomizationLabel:l10n_util::GetNSString( + IDS_TOUCH_BAR_GOOGLE_SEARCH)]; + } else { + NOTREACHED(); + } } else if ([identifier hasSuffix:kFullscreenOriginLabelTouchId]) { content::WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); @@ -391,7 +396,8 @@ trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(backOrForward:)]; - control.segmentStyle = NSSegmentStyleSeparated; + if (@available(macOS 10.10, *)) + control.segmentStyle = NSSegmentStyleSeparated; [control setEnabled:commandUpdater_->IsCommandEnabled(IDC_BACK) forSegment:kBackSegmentIndex]; [control setEnabled:commandUpdater_->IsCommandEnabled(IDC_FORWARD)
diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm index 8818003..c74d0f8 100644 --- a/chrome/browser/ui/cocoa/framed_browser_window.mm +++ b/chrome/browser/ui/cocoa/framed_browser_window.mm
@@ -110,7 +110,9 @@ bool shouldUseFullSizeContentView = chrome::ShouldUseFullSizeContentView() && hasTabStrip; if (shouldUseFullSizeContentView) { - styleMask |= NSFullSizeContentViewWindowMask; + if (@available(macOS 10.10, *)) { + styleMask |= NSFullSizeContentViewWindowMask; + } } if ((self = [super initWithContentRect:contentRect @@ -273,29 +275,33 @@ NSButton* button = [self standardWindowButton:buttonType]; [button setTranslatesAutoresizingMaskIntoConstraints:NO]; - // Do not use leadingAnchor because |ShouldFlipWindowControlsInRTL| - // should determine if current locale is RTL. - NSLayoutXAxisAnchor* leadingSourceAnchor = [button leftAnchor]; - NSLayoutXAxisAnchor* leadingTargetAnchor = [[button superview] leftAnchor]; - if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) { - leadingSourceAnchor = [button rightAnchor]; - leadingTargetAnchor = [[button superview] rightAnchor]; - leadingOffset = -leadingOffset; - } + if (@available(macOS 10.11, *)) { + // Do not use leadingAnchor because |ShouldFlipWindowControlsInRTL| + // should determine if current locale is RTL. + NSLayoutXAxisAnchor* leadingSourceAnchor = [button leftAnchor]; + NSLayoutXAxisAnchor* leadingTargetAnchor = [[button superview] leftAnchor]; + if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) { + leadingSourceAnchor = [button rightAnchor]; + leadingTargetAnchor = [[button superview] rightAnchor]; + leadingOffset = -leadingOffset; + } #if !defined(MAC_OS_X_VERSION_10_11) || \ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 - id leadingSourceAnchorDuck = leadingSourceAnchor; + id leadingSourceAnchorDuck = leadingSourceAnchor; #else - NSLayoutXAxisAnchor* leadingSourceAnchorDuck = leadingSourceAnchor; + NSLayoutXAxisAnchor* leadingSourceAnchorDuck = leadingSourceAnchor; #endif - [[leadingSourceAnchorDuck constraintEqualToAnchor:leadingTargetAnchor - constant:leadingOffset] - setActive:YES]; + [[leadingSourceAnchorDuck constraintEqualToAnchor:leadingTargetAnchor + constant:leadingOffset] + setActive:YES]; - [[[button bottomAnchor] - constraintEqualToAnchor:[[button superview] bottomAnchor]] - setActive:YES]; + [[[button bottomAnchor] + constraintEqualToAnchor:[[button superview] bottomAnchor]] + setActive:YES]; + } else { + NOTREACHED(); + } } - (void)adjustCloseButton:(NSNotification*)notification {
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm index 9e9dc9b..da0b9d2e 100644 --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
@@ -51,18 +51,23 @@ ? NSRightTextAlignment : NSLeftTextAlignment]; - // Disable Force Touch in the Omnibox. Note that this API is defined in - // 10.10.3 and higher so have to check more than just isYosmiteOrLater(). - // Also, because NSPressureConfiguration is not in the original 10.10 SDK, - // use NSClassFromString() to instantiate it (otherwise there's a - // linker error). + // Disable Force Touch in the Omnibox. Note that this API is documented as + // being available in 10.11 or higher, but if the API is available in an older + // version we still want to use it. That prevents us from guarding the call + // with @available, so instead we use respondsToSelector and silence the + // availability warning. Also, because NSPressureConfiguration is not in the + // original 10.10 SDK, use NSClassFromString() to instantiate it (otherwise + // there's a linker error). if (base::mac::IsAtLeastOS10_10() && [self respondsToSelector:@selector(setPressureConfiguration:)]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" NSPressureConfiguration* pressureConfiguration = [[[NSClassFromString(@"NSPressureConfiguration") alloc] initWithPressureBehavior:NSPressureBehaviorPrimaryClick] autorelease]; [self setPressureConfiguration:pressureConfiguration]; +#pragma clang diagnostic pop } }
diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.cc b/chrome/browser/ui/views/toolbar/app_menu_button.cc index b36e966..66a567ec 100644 --- a/chrome/browser/ui/views/toolbar/app_menu_button.cc +++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -183,7 +183,7 @@ // Only show a special color for severity when using the classic Chrome // theme. Otherwise, we can't be sure that it contrasts with the toolbar // background. - new_icon_->set_color( + new_icon_->SetColor( ThemeServiceFactory::GetForProfile(toolbar_view_->browser()->profile()) ->UsingDefaultTheme() ? severity_color
diff --git a/chrome/browser/ui/views/toolbar/reload_button.cc b/chrome/browser/ui/views/toolbar/reload_button.cc index ee50d12..91f8156 100644 --- a/chrome/browser/ui/views/toolbar/reload_button.cc +++ b/chrome/browser/ui/views/toolbar/reload_button.cc
@@ -6,12 +6,14 @@ #include <stddef.h> +#include "base/command_line.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/themes/theme_properties.h" +#include "chrome/common/chrome_switches.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/simple_menu_model.h" @@ -21,7 +23,6 @@ #include "ui/views/metrics.h" #include "ui/views/widget/widget.h" - namespace { // Contents of the Reload drop-down menu. @@ -31,8 +32,14 @@ IDS_RELOAD_MENU_EMPTY_AND_HARD_RELOAD_ITEM, }; -} // namespace +// True if we should delay the switch from reload to stop (i.e. only show Stop +// for long loads). +bool ShouldDelayChangeToReloadState() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDelayReloadStopButtonChange); +} +} // namespace // ReloadButton --------------------------------------------------------------- @@ -46,42 +53,65 @@ visible_mode_(MODE_RELOAD), double_click_timer_delay_( base::TimeDelta::FromMilliseconds(views::GetDoubleClickInterval())), - stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)), + mode_switch_timer_delay_(base::TimeDelta::FromMilliseconds(1350)), menu_enabled_(false), testing_mouse_hovered_(false), testing_reload_count_(0) {} -ReloadButton::~ReloadButton() { -} +ReloadButton::~ReloadButton() {} void ReloadButton::ChangeMode(Mode mode, bool force) { intended_mode_ = mode; - // If the change is forced, or the user isn't hovering the icon, or it's safe - // to change it to the other image type, make the change immediately; - // otherwise we'll let it happen later. - if (force || (!IsMouseHovered() && !testing_mouse_hovered_) || - ((mode == MODE_STOP) ? - !double_click_timer_.IsRunning() : (visible_mode_ != MODE_STOP))) { - double_click_timer_.Stop(); - stop_to_reload_timer_.Stop(); - if (mode != visible_mode_) - ChangeModeInternal(mode); - SetEnabled(true); + if (ShouldDelayChangeToReloadState()) { + const bool from_reload_to_stop = + visible_mode_ == MODE_RELOAD && mode == MODE_STOP; + if (force || (!from_reload_to_stop && + !(IsMouseHovered() || testing_mouse_hovered_))) { + mode_switch_timer_.Stop(); + if (mode != visible_mode_) + ChangeModeInternal(mode); + SetEnabled(true); + } else { + // We want to disable the button if we're preventing a change from stop to + // reload due to hovering, but not if we're preventing a change from + // reload to stop. (Disabled reload state is only applicable when instant + // extended API is enabled and mode is NTP, which is handled just above.) + if (visible_mode_ != MODE_RELOAD) + SetEnabled(false); - // We want to disable the button if we're preventing a change from stop to - // reload due to hovering, but not if we're preventing a change from reload to - // stop due to the double-click timer running. (Disabled reload state is only - // applicable when instant extended API is enabled and mode is NTP, which is - // handled just above.) - } else if (visible_mode_ != MODE_RELOAD) { - SetEnabled(false); + if (!mode_switch_timer_.IsRunning()) { + mode_switch_timer_.Start(FROM_HERE, mode_switch_timer_delay_, this, + &ReloadButton::OnStopToReloadTimer); + } + } + } else { + // If the change is forced, or the user isn't hovering the icon, or it's + // safe to change it to the other image type, make the change immediately; + // otherwise we'll let it happen later. + if (force || (!IsMouseHovered() && !testing_mouse_hovered_) || + ((mode == MODE_STOP) ? !double_click_timer_.IsRunning() + : (visible_mode_ != MODE_STOP))) { + double_click_timer_.Stop(); + mode_switch_timer_.Stop(); + if (mode != visible_mode_) + ChangeModeInternal(mode); + SetEnabled(true); - // Go ahead and change to reload after a bit, which allows repeated reloads - // without moving the mouse. - if (!stop_to_reload_timer_.IsRunning()) { - stop_to_reload_timer_.Start(FROM_HERE, stop_to_reload_timer_delay_, this, - &ReloadButton::OnStopToReloadTimer); + // We want to disable the button if we're preventing a change from stop to + // reload due to hovering, but not if we're preventing a change from + // reload to stop due to the double-click timer running. (Disabled reload + // state is only applicable when instant extended API is enabled and mode + // is NTP, which is handled just above.) + } else if (visible_mode_ != MODE_RELOAD) { + SetEnabled(false); + + // Go ahead and change to reload after a bit, which allows repeated + // reloads without moving the mouse. + if (!mode_switch_timer_.IsRunning()) { + mode_switch_timer_.Start(FROM_HERE, mode_switch_timer_delay_, this, + &ReloadButton::OnStopToReloadTimer); + } } } } @@ -140,7 +170,17 @@ // The user has clicked, so we can feel free to update the button, // even if the mouse is still hovering. ChangeMode(MODE_RELOAD, true); - } else if (!double_click_timer_.IsRunning()) { + return; + } + + // Ignore double clicks. With the ShouldDelayChangeToReloadState flag we have + // no use for the double click timer and can just check the event's click + // count. + const bool is_double_click = ShouldDelayChangeToReloadState() + ? event.AsMouseEvent()->GetClickCount() > 1 + : double_click_timer_.IsRunning(); + + if (!is_double_click) { // Shift-clicking or ctrl-clicking the reload button means we should ignore // any cached content. int command; @@ -153,13 +193,15 @@ command = IDC_RELOAD; } - // Start a timer - while this timer is running, the reload button cannot be - // changed to a stop button. We do not set |intended_mode_| to MODE_STOP - // here as the browser will do that when it actually starts loading (which - // may happen synchronously, thus the need to do this before telling the - // browser to execute the reload command). - double_click_timer_.Start(FROM_HERE, double_click_timer_delay_, this, - &ReloadButton::OnDoubleClickTimer); + if (!ShouldDelayChangeToReloadState()) { + // Start a timer - while this timer is running, the reload button cannot + // be changed to a stop button. We do not set |intended_mode_| to + // MODE_STOP here as the browser will do that when it actually starts + // loading (which may happen synchronously, thus the need to do this + // before telling the browser to execute the reload command). + double_click_timer_.Start(FROM_HERE, double_click_timer_delay_, this, + &ReloadButton::OnDoubleClickTimer); + } ExecuteBrowserCommand(command, flags); ++testing_reload_count_;
diff --git a/chrome/browser/ui/views/toolbar/reload_button.h b/chrome/browser/ui/views/toolbar/reload_button.h index 6a8cfc7..d976262e 100644 --- a/chrome/browser/ui/views/toolbar/reload_button.h +++ b/chrome/browser/ui/views/toolbar/reload_button.h
@@ -18,9 +18,10 @@ // ReloadButton // // The reload button in the toolbar, which changes to a stop button when a page -// load is in progress. Trickiness comes from the desire to have the 'stop' -// button not change back to 'reload' if the user's mouse is hovering over it -// (to prevent mis-clicks). +// load is in progress. The initial change from reload to stop is internally +// delayed to avoid flicker for rapid page loads (as can happen when a page +// fetches additional resources). The change from stop back to reload may be +// delayed if the user is hovering the button, to prevent mis-clicks. // //////////////////////////////////////////////////////////////////////////////// @@ -76,9 +77,12 @@ void OnDoubleClickTimer(); void OnStopToReloadTimer(); + void OnLongLoadTimer(); base::OneShotTimer double_click_timer_; - base::OneShotTimer stop_to_reload_timer_; + + // Timer to delay switching between reload and stop states. + base::OneShotTimer mode_switch_timer_; // This may be NULL when testing. CommandUpdater* command_updater_; @@ -92,7 +96,7 @@ // The delay times for the timers. These are members so that tests can modify // them. base::TimeDelta double_click_timer_delay_; - base::TimeDelta stop_to_reload_timer_delay_; + base::TimeDelta mode_switch_timer_delay_; // Indicates if reload menu is enabled. bool menu_enabled_;
diff --git a/chrome/browser/ui/views/toolbar/reload_button_unittest.cc b/chrome/browser/ui/views/toolbar/reload_button_unittest.cc index 00195421..f5fa0a4 100644 --- a/chrome/browser/ui/views/toolbar/reload_button_unittest.cc +++ b/chrome/browser/ui/views/toolbar/reload_button_unittest.cc
@@ -19,7 +19,7 @@ ReloadButton::Mode intended_mode, ReloadButton::Mode visible_mode, bool double_click_timer_running, - bool stop_to_reload_timer_running); + bool mode_switch_timer_running); // These accessors eliminate the need to declare each testcase as a friend. void set_mouse_hovered(bool hovered) { @@ -41,21 +41,20 @@ // Set the timer delays to 0 so that timers will fire as soon as we tell the // message loop to run pending tasks. reload_.double_click_timer_delay_ = base::TimeDelta(); - reload_.stop_to_reload_timer_delay_ = base::TimeDelta(); + reload_.mode_switch_timer_delay_ = base::TimeDelta(); } void ReloadButtonTest::CheckState(bool enabled, ReloadButton::Mode intended_mode, ReloadButton::Mode visible_mode, bool double_click_timer_running, - bool stop_to_reload_timer_running) { + bool mode_switch_timer_running) { EXPECT_EQ(enabled, reload_.enabled()); EXPECT_EQ(intended_mode, reload_.intended_mode_); EXPECT_EQ(visible_mode, reload_.visible_mode_); EXPECT_EQ(double_click_timer_running, reload_.double_click_timer_.IsRunning()); - EXPECT_EQ(stop_to_reload_timer_running, - reload_.stop_to_reload_timer_.IsRunning()); + EXPECT_EQ(mode_switch_timer_running, reload_.mode_switch_timer_.IsRunning()); } TEST_F(ReloadButtonTest, Basic) {
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index df3e48b..79d3f8f66 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -45,7 +45,6 @@ #include "chrome/browser/ui/views/translate/translate_bubble_view.h" #include "chrome/browser/ui/views/translate/translate_icon_view.h" #include "chrome/browser/upgrade_detector.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 2e1dd19..9e9a644b 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -370,7 +370,7 @@ if (url.host() == chrome::kChromeUIQuotaInternalsHost) return &NewWebUI<QuotaInternalsUI>; if (url.host() == safe_browsing::kChromeUISafeBrowsingHost) - return &NewWebUI<SafeBrowsingUI>; + return &NewWebUI<safe_browsing::SafeBrowsingUI>; if (url.host() == chrome::kChromeUISignInInternalsHost) return &NewWebUI<SignInInternalsUI>; if (url.host_piece() == chrome::kChromeUISuggestionsHost)
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index f385536..27f6272d 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -686,6 +686,7 @@ if (!PrivetPrintingEnabled()) { RejectJavascriptCallback(base::Value(callback_id), base::Value()); + return; } #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) using local_discovery::ServiceDiscoverySharedClient; @@ -884,13 +885,14 @@ CHECK(args->GetString(0, &callback_id)); CHECK(!callback_id.empty()); std::string json_str; - if (!args->GetString(1, &json_str)) - RejectJavascriptCallback(base::Value(callback_id), base::Value(-1)); + CHECK(args->GetString(1, &json_str)); std::unique_ptr<base::DictionaryValue> settings = GetSettingsDictionary(json_str); - if (!settings) + if (!settings) { RejectJavascriptCallback(base::Value(callback_id), base::Value(-1)); + return; + } ReportPrintSettingsStats(*settings); @@ -1957,3 +1959,12 @@ const base::Closure& closure) { pdf_file_saved_closure_ = closure; } + +void PrintPreviewHandler::SendEnableManipulateSettingsForTest() { + FireWebUIListener("enable-manipulate-settings-for-test", base::Value()); +} + +void PrintPreviewHandler::SendManipulateSettingsForTest( + const base::DictionaryValue& settings) { + FireWebUIListener("manipulate-settings-for-test", settings); +}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h index 5b55691f..6561892 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -133,6 +133,12 @@ // Sets |pdf_file_saved_closure_| to |closure|. void SetPdfSavedClosureForTesting(const base::Closure& closure); + // Fires the 'enable-manipulate-settings-for-test' WebUI event. + void SendEnableManipulateSettingsForTest(); + + // Fires the 'manipulate-settings-for-test' WebUI event with |settings|. + void SendManipulateSettingsForTest(const base::DictionaryValue& settings); + protected: // If |prompt_user| is true, starts a task to create the default Save As PDF // directory if needed. OnDirectoryCreated() will be called when it
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 8493e8c..5233b57b 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -676,3 +676,12 @@ const base::Closure& closure) { handler_->SetPdfSavedClosureForTesting(closure); } + +void PrintPreviewUI::SendEnableManipulateSettingsForTest() { + handler_->SendEnableManipulateSettingsForTest(); +} + +void PrintPreviewUI::SendManipulateSettingsForTest( + const base::DictionaryValue& settings) { + handler_->SendManipulateSettingsForTest(settings); +}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.h b/chrome/browser/ui/webui/print_preview/print_preview_ui.h index 856d80d..1a7a40a 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.h
@@ -23,6 +23,7 @@ struct PrintHostMsg_SetOptionsFromDocument_Params; namespace base { +class DictionaryValue; class FilePath; class RefCountedBytes; } @@ -155,6 +156,14 @@ // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). void SetPdfSavedClosureForTesting(const base::Closure& closure); + // Tell the handler to send the enable-manipulate-settings-for-test WebUI + // event. + void SendEnableManipulateSettingsForTest(); + + // Tell the handler to send the manipulate-settings-for-test WebUI event + // to set the print preview settings contained in |settings|. + void SendManipulateSettingsForTest(const base::DictionaryValue& settings); + private: FRIEND_TEST_ALL_PREFIXES(PrintPreviewDialogControllerUnitTest, TitleAfterReload);
diff --git a/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc b/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc index e786d4c..25352bd 100644 --- a/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc +++ b/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/feature_list.h" +#include "base/metrics/histogram_macros.h" #include "base/synchronization/lock.h" #include "base/values.h" #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" @@ -130,6 +131,7 @@ DCHECK_EQ(0U, args->GetSize()); controller_->RemoveObserver(this); + controller_->ResetIdleState(); CallJavascriptFunction("cr.webUIListenerCallback", base::Value("chrome-cleanup-on-dismiss")); @@ -143,6 +145,7 @@ DCHECK( base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)); + UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.CleanupCard", true); AllowJavascript(); // Send the current logs upload state. @@ -175,6 +178,8 @@ // The state is propagated to all open tabs and should be consistent. DCHECK_EQ(controller_->logs_enabled(), allow_logs_upload); + safe_browsing::RecordCleanupStartedHistogram( + safe_browsing::CLEANUP_STARTED_FROM_PROMPT_IN_SETTINGS); controller_->ReplyWithUserResponse( profile_, allow_logs_upload
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc index 810bca60..44e4c60 100644 --- a/chrome/browser/win/jumplist.cc +++ b/chrome/browser/win/jumplist.cc
@@ -316,10 +316,14 @@ if (timer_.IsRunning()) { // TODO(chengx): Remove the UMA histogram below after fixing crbug/733034. UMA_HISTOGRAM_COUNTS_10000( - "WinJumplist.NotificationTimeInterval", + "WinJumplist.NotificationTimeInterval2", (timer_.desired_run_time() - base::TimeTicks::Now()).InMilliseconds()); timer_.Reset(); } else { + // TODO(chengx): Remove the UMA histogram below after fixing crbug/733034. + // If the notification interval is larger than 3500 ms, add a "0" to the + // histogram so that we know how many notifications get coalesced. + UMA_HISTOGRAM_COUNTS_10000("WinJumplist.NotificationTimeInterval2", 0); // base::Unretained is safe since |this| is guaranteed to outlive timer_. timer_.Start( FROM_HERE, kDelayForJumplistUpdate,
diff --git a/chrome/browser/win/jumplist_updater.cc b/chrome/browser/win/jumplist_updater.cc index 529fd623..0f26768 100644 --- a/chrome/browser/win/jumplist_updater.cc +++ b/chrome/browser/win/jumplist_updater.cc
@@ -164,9 +164,6 @@ } bool JumpListUpdater::AddTasks(const ShellLinkItemList& link_items) { - // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. - SCOPED_UMA_HISTOGRAM_TIMER("WinJumplistUpdater.AddTasksDuration"); - if (!destination_list_.Get()) return false;
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index aae37029..a719b68 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -559,8 +559,8 @@ "//components/bookmarks/common", "//components/nacl/common:switches", "//components/offline_pages/features", - "//media:cdm_paths", # Needed by chrome_paths.cc. "//media:media_features", + "//media/cdm:cdm_paths", # Needed by chrome_paths.cc. "//ppapi/features", "//third_party/widevine/cdm:headers", ]
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 5c046f4..cd8f5638 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -144,6 +144,10 @@ base::FEATURE_DISABLED_BY_DEFAULT}; #endif +// Enables or disables windowing related features for desktop PWAs. +const base::Feature kDesktopPWAWindowing{"DesktopPWAWindowing", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Experiment to display a toggle allowing users to opt-out of persisting a // Grant or Deny decision in a permission prompt. const base::Feature kDisplayPersistenceToggleInPermissionPrompts{ @@ -202,6 +206,12 @@ #if defined(OS_MACOSX) // Enables RTL layout in macOS top chrome. const base::Feature kMacRTL{"MacRTL", base::FEATURE_DISABLED_BY_DEFAULT}; + +// Uses NSFullSizeContentViewWindowMask where available instead of adding our +// own views to the window frame. This is a temporary kill switch, it can be +// removed once we feel okay about leaving it on. +const base::Feature kMacFullSizeContentView{"MacFullSizeContentView", + base::FEATURE_ENABLED_BY_DEFAULT}; #endif // Enables or disables the Material Design version of chrome://bookmarks. @@ -357,6 +367,13 @@ const base::Feature kSiteDetails{"SiteDetails", base::FEATURE_DISABLED_BY_DEFAULT}; +#if !defined(OS_ANDROID) +// Enables delaying the navigation of background tabs in order to improve +// foreground tab's user experience. +const base::Feature kStaggeredBackgroundTabOpen{ + "StaggeredBackgroundTabOpen", base::FEATURE_DISABLED_BY_DEFAULT}; +#endif + // Enables or disables the creation of (legacy) supervised users. Does not // affect existing supervised users. const base::Feature kSupervisedUserCreation{"SupervisedUserCreation",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 2c1caeea..0f38c2f0f 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -9,6 +9,7 @@ #define CHROME_COMMON_CHROME_FEATURES_H_ #include "base/feature_list.h" +#include "build/build_config.h" #include "chrome/common/features.h" #include "extensions/features/features.h" #include "ppapi/features/features.h" @@ -80,6 +81,8 @@ extern const base::Feature kDesktopIOSPromotion; #endif // defined(OS_WIN) +extern const base::Feature kDesktopPWAWindowing; + extern const base::Feature kDisplayPersistenceToggleInPermissionPrompts; extern const base::Feature kExpectCTReporting; @@ -107,6 +110,7 @@ #if defined(OS_MACOSX) extern const base::Feature kMacRTL; +extern const base::Feature kMacFullSizeContentView; #endif extern const base::Feature kMaterialDesignBookmarks; @@ -185,6 +189,10 @@ extern const base::Feature kSiteNotificationChannels; #endif +#if !defined(OS_ANDROID) +extern const base::Feature kStaggeredBackgroundTabOpen; +#endif + extern const base::Feature kSupervisedUserCreation; #if defined(SYZYASAN)
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index e47a10f..e833c10a 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc
@@ -158,6 +158,10 @@ // apps. const char kDebugPackedApps[] = "debug-packed-apps"; +// Delay the toolbar icon switching between reload and stop when page load state +// changes. +const char kDelayReloadStopButtonChange[] = "delay-reload-stop-button-change"; + // Passes command line parameters to the DevTools front-end. const char kDevToolsFlags[] = "devtools-flags";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index fd32c06..25d3512 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h
@@ -63,6 +63,7 @@ extern const char kCustomDevtoolsFrontend[]; extern const char kDebugEnableFrameToggle[]; extern const char kDebugPackedApps[]; +extern const char kDelayReloadStopButtonChange[]; extern const char kDevToolsFlags[]; extern const char kDiagnostics[]; extern const char kDiagnosticsFormat[];
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc index 2f1efe6f2..c3c57bf 100644 --- a/chrome/common/crash_keys.cc +++ b/chrome/common/crash_keys.cc
@@ -89,6 +89,11 @@ const char kUserCloudPolicyManagerConnectTrace[] = "user-cloud-policy-manager-connect-trace"; +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +const char kBeginMainFrameHangCompositorState[] = + "begin-main-frame-hang-compositor-state"; + size_t RegisterChromeCrashKeys() { // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. @@ -222,6 +227,10 @@ // Temporary for https://crbug.com/685996. {kUserCloudPolicyManagerConnectTrace, kMediumSize}, + + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + {kBeginMainFrameHangCompositorState, crash_keys::kSmallSize}, }; // This dynamic set of keys is used for sets of key value pairs when gathering
diff --git a/chrome/common/crash_keys.h b/chrome/common/crash_keys.h index 687146e..52b9b69 100644 --- a/chrome/common/crash_keys.h +++ b/chrome/common/crash_keys.h
@@ -150,6 +150,10 @@ // browser crash due to an attempt to connect twice. https://crbug.com/685996. extern const char kUserCloudPolicyManagerConnectTrace[]; +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +extern const char kBeginMainFrameHangCompositorState[]; + } // namespace crash_keys #endif // CHROME_COMMON_CRASH_KEYS_H_
diff --git a/chrome/common/extensions/api/feedback_private.idl b/chrome/common/extensions/api/feedback_private.idl index 017b14b..6ef853b 100644 --- a/chrome/common/extensions/api/feedback_private.idl +++ b/chrome/common/extensions/api/feedback_private.idl
@@ -101,7 +101,13 @@ messages, // Latest Chrome OS UI logs. - uiLatest + uiLatest, + + // Info about display connectors and connected displays from DRM subsystem. + drmModetest, + + // USB device list and connectivity graph. + lsusb }; // Input parameters for a readLogSource() call.
diff --git a/chrome/common/safe_browsing/pe_image_reader_win.cc b/chrome/common/safe_browsing/pe_image_reader_win.cc index c53ab16..7d46303b 100644 --- a/chrome/common/safe_browsing/pe_image_reader_win.cc +++ b/chrome/common/safe_browsing/pe_image_reader_win.cc
@@ -56,6 +56,8 @@ return &optional_header_->DataDirectory[0]; } + DWORD GetSizeOfImage() override { return optional_header_->SizeOfImage; } + private: const OPTIONAL_HEADER_TYPE* optional_header_; DISALLOW_COPY_AND_ASSIGN(OptionalHeaderImpl); @@ -191,6 +193,10 @@ return true; } +DWORD PeImageReader::GetSizeOfImage() { + return optional_header_->GetSizeOfImage(); +} + void PeImageReader::Clear() { image_data_ = NULL; image_size_ = 0;
diff --git a/chrome/common/safe_browsing/pe_image_reader_win.h b/chrome/common/safe_browsing/pe_image_reader_win.h index 51bb238..30c2d255 100644 --- a/chrome/common/safe_browsing/pe_image_reader_win.h +++ b/chrome/common/safe_browsing/pe_image_reader_win.h
@@ -70,6 +70,9 @@ bool EnumCertificates(EnumCertificatesCallback callback, void* context); + // Returns the size of the image file. + DWORD GetSizeOfImage(); + private: // Bits indicating what portions of the image have been validated. enum ValidationStages { @@ -96,6 +99,9 @@ // Returns a pointer to the first data directory entry. virtual const IMAGE_DATA_DIRECTORY* GetDataDirectoryEntries() = 0; + + // Returns the size of the image file. + virtual DWORD GetSizeOfImage() = 0; }; template<class OPTIONAL_HEADER_TYPE>
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 56aad7b3..46c07aa 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -633,9 +633,8 @@ const char kNotificationsHelpURL[] = "https://support.google.com/chrome/?p=ui_notifications"; -// TODO(proberge): Change this URL to a p-link. const char kChromeCleanerLearnMoreURL[] = - "https://support.google.com/chrome/answer/6086368"; + "https://support.google.com/chrome/?p=chrome_cleanup_tool"; #endif const char kNotificationWelcomeLearnMoreURL[] =
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn index 315f8b6..e3a1a13 100644 --- a/chrome/installer/linux/BUILD.gn +++ b/chrome/installer/linux/BUILD.gn
@@ -194,7 +194,7 @@ # TODO(thomasanderson): Move this variable into a .gni file # somewhere. It is currently copied from # buildtools/third_party/libc++/BUILD.gn. - libcpp_is_static = !is_component_build && !using_sanitizer + libcpp_is_static = !is_component_build && !is_asan && !is_msan && !is_tsan if (!libcpp_is_static && use_custom_libcxx) { public_deps += [ "//buildtools/third_party/libc++:libc++" ] } @@ -247,7 +247,7 @@ # TODO(thomasanderson): Move this variable into a .gni file # somewhere. It is currently copied from # buildtools/third_party/libc++/BUILD.gn. - libcpp_is_static = !is_component_build && !using_sanitizer + libcpp_is_static = !is_component_build && !is_asan && !is_msan && !is_tsan if (!libcpp_is_static && use_custom_libcxx) { packaging_files_binaries += [ "$root_out_dir/libc++.so" ] }
diff --git a/chrome/installer/zucchini/BUILD.gn b/chrome/installer/zucchini/BUILD.gn index ba3b0b5..323b011 100644 --- a/chrome/installer/zucchini/BUILD.gn +++ b/chrome/installer/zucchini/BUILD.gn
@@ -13,6 +13,7 @@ "disassembler.cc", "disassembler.h", "image_utils.h", + "suffix_array.h", "typed_value.h", ] @@ -44,6 +45,7 @@ sources = [ "buffer_view_unittest.cc", "crc32_unittest.cc", + "suffix_array_unittest.cc", "typed_value_unittest.cc", ]
diff --git a/chrome/installer/zucchini/suffix_array.h b/chrome/installer/zucchini/suffix_array.h new file mode 100644 index 0000000..1df25df3 --- /dev/null +++ b/chrome/installer/zucchini/suffix_array.h
@@ -0,0 +1,472 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_INSTALLER_ZUCCHINI_SUFFIX_ARRAY_H_ +#define CHROME_INSTALLER_ZUCCHINI_SUFFIX_ARRAY_H_ + +#include <algorithm> +#include <cassert> +#include <iterator> +#include <numeric> +#include <vector> + +#include "base/logging.h" + +namespace zucchini { + +// A functor class that implements the naive suffix sorting algorithm that uses +// std::sort with lexicographical compare. This is only meant as reference of +// the interface. +class NaiveSuffixSort { + public: + // Type requirements: + // |InputRng| is an input random access range. + // |KeyType| is an unsigned integer type. + // |SAIt| is a random access iterator with mutable references. + template <class InputRng, class KeyType, class SAIt> + // |str| is the input string on which suffix sort is applied. + // Characters found in |str| must be in the range [0, |key_bound|) + // |suffix_array| is the beginning of the destination range, which is at least + // as large as |str|. + void operator()(const InputRng& str, + KeyType key_bound, + SAIt suffix_array) const { + using size_type = typename SAIt::value_type; + + size_type n = static_cast<size_type>(std::end(str) - std::begin(str)); + + // |suffix_array| is first filled with ordered indices of |str|. + // Those indices are then sorted with lexicographical comparisons in |str|. + std::iota(suffix_array, suffix_array + n, 0); + std::sort(suffix_array, suffix_array + n, [&str](size_type i, size_type j) { + return std::lexicographical_compare(std::begin(str) + i, std::end(str), + std::begin(str) + j, std::end(str)); + }); + } +}; + +// A functor class that implements suffix array induced sorting (SA-IS) +// algorithm with linear time and memory complexity, +// see http://ieeexplore.ieee.org/abstract/document/5582081/ +class Sais { + public: + // Type requirements: + // |InputRng| is an input random access range. + // |KeyType| is an unsigned integer type. + // |SAIt| is a random access iterator with mutable values. + template <class InputRng, class KeyType, class SAIt> + // |str| is the input string on which suffix sort is applied. + // Characters found in |str| must be in the range [0, |key_bound|) + // |suffix_array| is the beginning of the destination range, which is at least + // as large as |str|. + void operator()(const InputRng& str, + KeyType key_bound, + SAIt suffix_array) const { + using value_type = typename InputRng::value_type; + using size_type = typename SAIt::value_type; + + static_assert(std::is_unsigned<value_type>::value, + "Sais only supports input string with unsigned values"); + static_assert(std::is_unsigned<KeyType>::value, "KeyType must be unsigned"); + + size_type n = static_cast<size_type>(std::end(str) - std::begin(str)); + + Implementation<size_type, KeyType>::SuffixSort(std::begin(str), n, + key_bound, suffix_array); + } + + // Given string S of length n. We assume S is terminated by a unique sentinel + // $, which is considered as the smallest character. This sentinel does not + // exist in memory and is only treated implicitly, hence |n| does not count + // the sentinel in this implementation. We denote suf(S,i) the suffix formed + // by S[i..n). + + // A suffix suf(S,i) is said to be S-type or L-type, if suf(S,i) < suf(S,i+1) + // or suf(S,i) > suf(S,i+1), respectively. + enum SLType : bool { SType, LType }; + + // A character S[i] is said to be S-type or L-type if the suffix suf(S,i) is + // S-type or L-type, respectively. + + // A character S[i] is called LMS (leftmost S-type), if S[i] is S-type and + // S[i-1] is L-type. A suffix suf(S,i) is called LMS, if S[i] is an LMS + // character. + + // A substring S[i..j) is an LMS-substring if + // (1) S[i] is LMS, S[j] is LMS or the sentinel $, and S[i..j) has no other + // LMS characters, or + // (2) S[i..j) is the sentinel $. + + template <class SizeType, class KeyType> + struct Implementation { + static_assert(std::is_unsigned<SizeType>::value, + "SizeType must be unsigned"); + static_assert(std::is_unsigned<KeyType>::value, "KeyType must be unsigned"); + using size_type = SizeType; + using key_type = KeyType; + + using iterator = typename std::vector<size_type>::iterator; + using const_iterator = typename std::vector<size_type>::const_iterator; + + // Partition every suffix based on SL-type. Returns the number of LMS + // suffixes. + template <class StrIt> + static size_type BuildSLPartition( + StrIt str, + size_type length, + key_type key_bound, + std::vector<SLType>::reverse_iterator sl_partition_it) { + // We will count LMS suffixes (S to L-type or last S-type). + size_type lms_count = 0; + + // |previous_type| is initialized to L-type to avoid counting an extra + // LMS suffix at the end + SLType previous_type = LType; + + // Initialized to dummy, impossible key. + key_type previous_key = key_bound; + + // We're travelling backward to determine the partition, + // as if we prepend one character at a time to the string, ex: + // b$ is L-type because b > $. + // ab$ is S-type because a < b, implying ab$ < b$. + // bab$ is L-type because b > a, implying bab$ > ab$. + // bbab$ is L-type, because bab$ was also L-type, implying bbab$ > bab$. + for (auto str_it = std::reverse_iterator<StrIt>(str + length); + str_it != std::reverse_iterator<StrIt>(str); + ++str_it, ++sl_partition_it) { + key_type current_key = *str_it; + + if (current_key > previous_key || previous_key == key_bound) { + // S[i] > S[i + 1] or S[i] is last character. + if (previous_type == SType) + // suf(S,i) is L-type and suf(S,i + 1) is S-type, therefore, + // suf(S,i+1) was a LMS suffix. + ++lms_count; + + previous_type = LType; // For next round. + } else if (current_key < previous_key) { + // S[i] < S[i + 1] + previous_type = SType; // For next round. + } + // Else, S[i] == S[i + 1]: + // The next character that differs determines the SL-type, + // so we reuse the last seen type. + + *sl_partition_it = previous_type; + previous_key = current_key; // For next round. + } + + return lms_count; + } + + // Find indices of LMS suffixes and write result to |lms_indices|. + static void FindLmsSuffixes(const std::vector<SLType>& sl_partition, + iterator lms_indices) { + // |previous_type| is initialized to S-type to avoid counting an extra + // LMS suffix at the beginning + SLType previous_type = SType; + for (size_type i = 0; i < sl_partition.size(); ++i) { + if (sl_partition[i] == SType && previous_type == LType) + *lms_indices++ = i; + previous_type = sl_partition[i]; + } + } + + template <class StrIt> + static std::vector<size_type> MakeBucketCount(StrIt str, + size_type length, + key_type key_bound) { + // Occurrence of every unique character is counted in |buckets| + std::vector<size_type> buckets(static_cast<size_type>(key_bound)); + + for (auto it = str; it != str + length; ++it) + ++buckets[*it]; + return buckets; + } + + // Apply induced sort from |lms_indices| to |suffix_array| associated with + // the string |str|. + template <class StrIt, class SAIt> + static void InducedSort(StrIt str, + size_type length, + const std::vector<SLType>& sl_partition, + const std::vector<size_type>& lms_indices, + const std::vector<size_type>& buckets, + SAIt suffix_array) { + // All indices are first marked as unset with the illegal value |length|. + std::fill(suffix_array, suffix_array + length, length); + + // Used to mark bucket boundaries (head or end) as indices in str. + DCHECK(!buckets.empty()); + std::vector<size_type> bucket_bounds(buckets.size()); + + // Step 1: Assign indices for LMS suffixes, populating the end of + // respective buckets but keeping relative order. + + // Find the end of each bucket and write it to |bucket_bounds|. + std::partial_sum(buckets.begin(), buckets.end(), bucket_bounds.begin()); + + // Process each |lms_indices| backward, and assign them to the end of + // their respective buckets, so relative order is preserved. + for (auto it = lms_indices.crbegin(); it != lms_indices.crend(); ++it) { + key_type key = str[*it]; + suffix_array[--bucket_bounds[key]] = *it; + } + + // Step 2 + // Scan forward |suffix_array|; for each modified suf(S,i) for which + // suf(S,SA(i) - 1) is L-type, place suf(S,SA(i) - 1) to the current + // head of the corresponding bucket and forward the bucket head to the + // right. + + // Find the head of each bucket and write it to |bucket_bounds|. Since + // only LMS suffixes where inserted in |suffix_array| during Step 1, + // |bucket_bounds| does not contains the head of each bucket and needs to + // be updated. + bucket_bounds[0] = 0; + std::partial_sum(buckets.begin(), buckets.end() - 1, + bucket_bounds.begin() + 1); + + // From Step 1, the sentinel $, which we treat implicitly, would have + // been placed at the beginning of |suffix_array|, since $ is always + // considered as the smallest character. We then have to deal with the + // previous (last) suffix. + if (sl_partition[length - 1] == LType) { + key_type key = str[length - 1]; + suffix_array[bucket_bounds[key]++] = length - 1; + } + for (auto it = suffix_array; it != suffix_array + length; ++it) { + size_type suffix_index = *it; + + // While the original algorithm marks unset suffixes with -1, + // we found that marking them with |length| is also possible and more + // convenient because we are working with unsigned integers. + if (suffix_index != length && suffix_index > 0 && + sl_partition[--suffix_index] == LType) { + key_type key = str[suffix_index]; + suffix_array[bucket_bounds[key]++] = suffix_index; + } + } + + // Step 3 + // Scan backward |suffix_array|; for each modified suf(S, i) for which + // suf(S,SA(i) - 1) is S-type, place suf(S,SA(i) - 1) to the current + // end of the corresponding bucket and forward the bucket head to the + // left. + + // Find the end of each bucket and write it to |bucket_bounds|. Since + // only L-type suffixes where inserted in |suffix_array| during Step 2, + // |bucket_bounds| does not contain the end of each bucket and needs to + // be updated. + std::partial_sum(buckets.begin(), buckets.end(), bucket_bounds.begin()); + + for (auto it = std::reverse_iterator<SAIt>(suffix_array + length); + it != std::reverse_iterator<SAIt>(suffix_array); ++it) { + size_type suffix_index = *it; + if (suffix_index != length && suffix_index > 0 && + sl_partition[--suffix_index] == SType) { + key_type key = str[suffix_index]; + suffix_array[--bucket_bounds[key]] = suffix_index; + } + } + // Deals with the last suffix, because of the sentinel. + if (sl_partition[length - 1] == SType) { + key_type key = str[length - 1]; + suffix_array[--bucket_bounds[key]] = length - 1; + } + } + + // Given a string S starting at |str| with length |length|, an array + // starting at |substring_array| containing lexicographically ordered LMS + // terminated substring indices of S and an SL-Type partition |sl_partition| + // of S, assigns a unique label to every unique LMS substring. The sorted + // labels for all LMS substrings are written to |lms_str|, while the indices + // of LMS suffixes are written to |lms_indices|. In addition, returns the + // total number of unique labels. + template <class StrIt, class SAIt> + static size_type LabelLmsSubstrings(StrIt str, + size_type length, + const std::vector<SLType>& sl_partition, + SAIt suffix_array, + iterator lms_indices, + iterator lms_str) { + // Labelling starts at 0. + size_type label = 0; + + // |previous_lms| is initialized to 0 to indicate it is unset. + // Note that suf(S,0) is never a LMS suffix. Substrings will be visited in + // lexicographical order. + size_type previous_lms = 0; + for (auto it = suffix_array; it != suffix_array + length; ++it) { + if (*it > 0 && sl_partition[*it] == SType && + sl_partition[*it - 1] == LType) { + // suf(S, *it) is a LMS suffix. + + size_type current_lms = *it; + if (previous_lms != 0) { + // There was a previous LMS suffix. Check if the current LMS + // substring is equal to the previous one. + SLType current_lms_type = SType; + SLType previous_lms_type = SType; + for (size_type k = 0;; ++k) { + // |current_lms_end| and |previous_lms_end| denote whether we have + // reached the end of the current and previous LMS substring, + // respectively + bool current_lms_end = false; + bool previous_lms_end = false; + + // Check for both previous and current substring ends. + // Note that it is more convenient to check if + // suf(S,current_lms + k) is an LMS suffix than to retrieve it + // from lms_indices. + if (current_lms + k >= length || + (current_lms_type == LType && + sl_partition[current_lms + k] == SType)) { + current_lms_end = true; + } + if (previous_lms + k >= length || + (previous_lms_type == LType && + sl_partition[previous_lms + k] == SType)) { + previous_lms_end = true; + } + + if (current_lms_end && previous_lms_end) { + break; // Previous and current substrings are identical. + } else if (current_lms_end != previous_lms_end || + str[current_lms + k] != str[previous_lms + k]) { + // Previous and current substrings differ, a new label is used. + ++label; + break; + } + + current_lms_type = sl_partition[current_lms + k]; + previous_lms_type = sl_partition[previous_lms + k]; + } + } + *lms_indices++ = *it; + *lms_str++ = label; + previous_lms = current_lms; + } + } + + return label + 1; + } + + // Implementation of the SA-IS algorithm. |str| must be a random access + // iterator pointing at the beginning of S with length |length|. The result + // is writtend in |suffix_array|, a random access iterator. + template <class StrIt, class SAIt> + static void SuffixSort(StrIt str, + size_type length, + key_type key_bound, + SAIt suffix_array) { + if (length == 1) + *suffix_array = 0; + if (length < 2) + return; + + std::vector<SLType> sl_partition(length); + size_type lms_count = + BuildSLPartition(str, length, key_bound, sl_partition.rbegin()); + std::vector<size_type> lms_indices(lms_count); + FindLmsSuffixes(sl_partition, lms_indices.begin()); + std::vector<size_type> buckets = MakeBucketCount(str, length, key_bound); + + if (lms_indices.size() > 1) { + // Given |lms_indices| in the same order they appear in |str|, induce + // LMS substrings relative order and write result to |suffix_array|. + InducedSort(str, length, sl_partition, lms_indices, buckets, + suffix_array); + std::vector<size_type> lms_str(lms_indices.size()); + + // Given LMS substrings in relative order found in |suffix_array|, + // map LMS substrings to unique labels to form a new string, |lms_str|. + size_type label_count = + LabelLmsSubstrings(str, length, sl_partition, suffix_array, + lms_indices.begin(), lms_str.begin()); + + if (label_count < lms_str.size()) { + // Reorder |lms_str| to have LMS suffixes in the same order they + // appear in |str|. + for (size_type i = 0; i < lms_indices.size(); ++i) + suffix_array[lms_indices[i]] = lms_str[i]; + + SLType previous_type = SType; + for (size_type i = 0, j = 0; i < sl_partition.size(); ++i) { + if (sl_partition[i] == SType && previous_type == LType) { + lms_str[j] = suffix_array[i]; + lms_indices[j++] = i; + } + previous_type = sl_partition[i]; + } + + // Recursively apply SuffixSort on |lms_str|, which is formed from + // labeled LMS suffixes in the same order they appear in |str|. + // Note that |KeyType| will be size_type because |lms_str| contains + // indices. |lms_str| is at most half the length of |str|. + Implementation<size_type, size_type>::SuffixSort( + lms_str.begin(), static_cast<size_type>(lms_str.size()), + label_count, suffix_array); + + // Map LMS labels back to indices in |str| and write result to + // |lms_indices|. We're using |suffix_array| as a temporary buffer. + for (size_type i = 0; i < lms_indices.size(); ++i) + suffix_array[i] = lms_indices[suffix_array[i]]; + std::copy_n(suffix_array, lms_indices.size(), lms_indices.begin()); + + // At this point, |lms_indices| contains sorted LMS suffixes of |str|. + } + } + // Given |lms_indices| where LMS suffixes are sorted, induce the full + // order of suffixes in |str|. + InducedSort(str, length, sl_partition, lms_indices, buckets, + suffix_array); + } + }; +}; + +// Generates a sorted suffix array for the input string |str| using the functor +// |Algorithm| which provides an interface equivalent to NaiveSuffixSort. +/// Characters found in |str| are assumed to be in range [0, |key_bound|). +// Returns the suffix array as a vector. +// |StrRng| is an input random access range. +// |KeyType| is an unsigned integer type. +template <class Algorithm, class StrRng, class KeyType> +std::vector<typename StrRng::size_type> MakeSuffixArray(const StrRng& str, + KeyType key_bound) { + Algorithm sort; + std::vector<typename StrRng::size_type> suffix_array(str.end() - str.begin()); + sort(str, key_bound, suffix_array.begin()); + return suffix_array; +} + +// Type requirements: +// |SARng| is an input random access range. +// |StrIt1| is a random access iterator. +// |StrIt2| is a forward iterator. +template <class SARng, class StrIt1, class StrIt2> +// Lexicographical lower bound using binary search for +// [|str2_first|, |str2_last|) in the suffix array |suffix_array| of a string +// starting at |str1_first|. This does not necessarily return the index of +// the longest matching substring. +auto SuffixLowerBound(const SARng& suffix_array, + StrIt1 str1_first, + StrIt2 str2_first, + StrIt2 str2_last) -> decltype(std::begin(suffix_array)) { + using size_type = typename SARng::value_type; + + size_t n = std::end(suffix_array) - std::begin(suffix_array); + auto it = std::lower_bound( + std::begin(suffix_array), std::end(suffix_array), str2_first, + [str1_first, str2_last, n](size_type a, StrIt2 b) { + return std::lexicographical_compare(str1_first + a, str1_first + n, b, + str2_last); + }); + return it; +} + +} // namespace zucchini + +#endif // CHROME_INSTALLER_ZUCCHINI_SUFFIX_ARRAY_H_
diff --git a/chrome/installer/zucchini/suffix_array_unittest.cc b/chrome/installer/zucchini/suffix_array_unittest.cc new file mode 100644 index 0000000..fff4df8 --- /dev/null +++ b/chrome/installer/zucchini/suffix_array_unittest.cc
@@ -0,0 +1,323 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/installer/zucchini/suffix_array.h" + +#include <algorithm> +#include <cstddef> +#include <initializer_list> +#include <string> +#include <vector> + +#include "testing/gtest/include/gtest/gtest.h" + +namespace zucchini { + +using ustring = std::basic_string<unsigned char>; + +constexpr uint16_t kNumChar = 256; + +ustring MakeUnsignedString(const std::string& str) { + return {str.begin(), str.end()}; +} + +template <class T> +std::vector<T> MakeVector(const std::initializer_list<T>& ilist) { + return {ilist.begin(), ilist.end()}; +} + +void TestSlPartition(std::initializer_list<Sais::SLType> expected_sl_partition, + std::initializer_list<size_t> expected_lms_indices, + std::string str) { + using SaisImpl = Sais::Implementation<size_t, uint16_t>; + + std::vector<Sais::SLType> sl_partition(str.size()); + EXPECT_EQ(expected_lms_indices.size(), + SaisImpl::BuildSLPartition(str.begin(), str.size(), kNumChar, + sl_partition.rbegin())); + EXPECT_EQ(MakeVector(expected_sl_partition), sl_partition); + + std::vector<size_t> lms_indices(expected_lms_indices.size()); + SaisImpl::FindLmsSuffixes(expected_sl_partition, lms_indices.begin()); + EXPECT_EQ(MakeVector(expected_lms_indices), lms_indices); +} + +TEST(SaisTest, BuildSLPartition) { + TestSlPartition({}, {}, ""); + TestSlPartition( + { + Sais::LType, + }, + {}, "a"); + TestSlPartition( + { + Sais::LType, Sais::LType, + }, + {}, "ba"); + TestSlPartition( + { + Sais::SType, Sais::LType, + }, + {}, "ab"); + TestSlPartition( + { + Sais::SType, Sais::SType, Sais::LType, + }, + {}, "aab"); + TestSlPartition( + { + Sais::LType, Sais::LType, Sais::LType, + }, + {}, "bba"); + TestSlPartition( + { + Sais::LType, Sais::SType, Sais::LType, + }, + {1}, "bab"); + TestSlPartition( + { + Sais::LType, Sais::SType, Sais::SType, Sais::LType, + }, + {1}, "baab"); + + TestSlPartition( + { + Sais::LType, // zucchini + Sais::LType, // ucchini + Sais::SType, // cchini + Sais::SType, // chini + Sais::SType, // hini + Sais::SType, // ini + Sais::LType, // ni + Sais::LType, // i + }, + {2}, "zucchini"); +} + +std::vector<size_t> BucketCount(const std::initializer_list<unsigned char> str, + uint16_t max_key) { + using SaisImpl = Sais::Implementation<size_t, uint16_t>; + return SaisImpl::MakeBucketCount(str.begin(), str.size(), max_key); +} + +TEST(SaisTest, BucketCount) { + using vec = std::vector<size_t>; + + EXPECT_EQ(vec({0, 0, 0, 0}), BucketCount({}, 4)); + EXPECT_EQ(vec({1, 0, 0, 0}), BucketCount({0}, 4)); + EXPECT_EQ(vec({0, 2, 0, 1}), BucketCount({1, 1, 3}, 4)); +} + +std::vector<size_t> InducedSortSubstring(ustring str) { + using SaisImpl = Sais::Implementation<size_t, uint16_t>; + std::vector<Sais::SLType> sl_partition(str.size()); + size_t lms_count = SaisImpl::BuildSLPartition( + str.begin(), str.size(), kNumChar, sl_partition.rbegin()); + std::vector<size_t> lms_indices(lms_count); + SaisImpl::FindLmsSuffixes(sl_partition, lms_indices.begin()); + auto buckets = SaisImpl::MakeBucketCount(str.begin(), str.size(), kNumChar); + + std::vector<size_t> suffix_array(str.size()); + SaisImpl::InducedSort(str, str.size(), sl_partition, lms_indices, buckets, + suffix_array.begin()); + + return suffix_array; +} + +TEST(SaisTest, InducedSortSubstring) { + using vec = std::vector<size_t>; + + auto us = MakeUnsignedString; + + // L; a$ + EXPECT_EQ(vec({0}), InducedSortSubstring(us("a"))); + + // SL; ab$, b$ + EXPECT_EQ(vec({0, 1}), InducedSortSubstring(us("ab"))); + + // LL; a$, ba$ + EXPECT_EQ(vec({1, 0}), InducedSortSubstring(us("ba"))); + + // SLL; a$, aba$, ba$ + EXPECT_EQ(vec({2, 0, 1}), InducedSortSubstring(us("aba"))); + + // LSL; ab$, b$, ba + EXPECT_EQ(vec({1, 2, 0}), InducedSortSubstring(us("bab"))); + + // SSL; aab$, ab$, b$ + EXPECT_EQ(vec({0, 1, 2}), InducedSortSubstring(us("aab"))); + + // LSSL; aab$, ab$, b$, ba + EXPECT_EQ(vec({1, 2, 3, 0}), InducedSortSubstring(us("baab"))); +} + +template <class Algorithm> +void TestSuffixSort(ustring test_str) { + std::vector<size_t> suffix_array = + MakeSuffixArray<Algorithm>(test_str, kNumChar); + EXPECT_EQ(test_str.size(), suffix_array.size()); + + // Expect that I[] is a permutation of [0, len]. + std::vector<size_t> sorted_suffix(suffix_array.begin(), suffix_array.end()); + std::sort(sorted_suffix.begin(), sorted_suffix.end()); + for (size_t i = 0; i < test_str.size(); ++i) + EXPECT_EQ(i, sorted_suffix[i]); + + // Expect that all suffixes are strictly ordered. + auto end = test_str.end(); + for (size_t i = 1; i < test_str.size(); ++i) { + auto suf1 = test_str.begin() + suffix_array[i - 1]; + auto suf2 = test_str.begin() + suffix_array[i]; + bool is_less = std::lexicographical_compare(suf1, end, suf2, end); + EXPECT_TRUE(is_less); + } +} + +constexpr const char* test_strs[] = { + "", + "a", + "aa", + "za", + "CACAO", + "aaaaa", + "banana", + "tobeornottobe", + "The quick brown fox jumps over the lazy dog.", + "elephantelephantelephantelephantelephant", + "walawalawashington", + "-------------------------", + "011010011001011010010110011010010", + "3141592653589793238462643383279502884197169399375105", + "\xFF\xFE\xFF\xFE\xFD\x80\x30\x31\x32\x80\x30\xFF\x01\xAB\xCD", + "abccbaabccbaabccbaabccbaabccbaabccbaabccbaabccba", + "0123456789876543210", + "9876543210123456789", + "aababcabcdabcdeabcdefabcdefg", + "asdhklgalksdjghalksdjghalksdjgh", +}; + +TEST(SuffixSortTest, NaiveSuffixSort) { + for (const std::string& test_str : test_strs) { + TestSuffixSort<NaiveSuffixSort>(MakeUnsignedString(test_str)); + } +} + +TEST(SuffixSortTest, SaisSort) { + for (const std::string& test_str : test_strs) { + TestSuffixSort<Sais>(MakeUnsignedString(test_str)); + } +} + +// Test with sequence that has every character. +TEST(SuffixSortTest, AllChar) { + std::vector<unsigned char> all_char(kNumChar); + std::iota(all_char.begin(), all_char.end(), 0); + + { + std::vector<size_t> suffix_array = + MakeSuffixArray<Sais>(all_char, kNumChar); + for (size_t i = 0; i < kNumChar; ++i) + EXPECT_EQ(i, suffix_array[i]); + } + + std::vector<unsigned char> all_char_reverse(all_char.rbegin(), + all_char.rend()); + { + std::vector<size_t> suffix_array = + MakeSuffixArray<Sais>(all_char_reverse, kNumChar); + for (size_t i = 0; i < kNumChar; ++i) + EXPECT_EQ(kNumChar - i - 1, suffix_array[i]); + } +} + +void TestSuffixLowerBound(ustring base_str, ustring search_str) { + std::vector<size_t> suffix_array = + MakeSuffixArray<NaiveSuffixSort>(base_str, kNumChar); + + auto pos = SuffixLowerBound(suffix_array, base_str.begin(), + search_str.begin(), search_str.end()); + + auto end = base_str.end(); + if (pos != suffix_array.begin()) { + // Previous suffix is less than |search_str|. + auto suf = base_str.begin() + pos[-1]; + bool is_less = std::lexicographical_compare(suf, end, search_str.begin(), + search_str.end()); + EXPECT_TRUE(is_less); + } + if (pos != suffix_array.end()) { + // Current suffix is greater of equal to |search_str|. + auto suf = base_str.begin() + *pos; + bool is_less = std::lexicographical_compare(suf, end, search_str.begin(), + search_str.end()); + EXPECT_FALSE(is_less); + } +} + +TEST(SuffixArrayTest, LowerBound) { + auto us = MakeUnsignedString; + + TestSuffixLowerBound(us(""), us("")); + TestSuffixLowerBound(us(""), us("a")); + TestSuffixLowerBound(us("b"), us("")); + TestSuffixLowerBound(us("b"), us("a")); + TestSuffixLowerBound(us("b"), us("c")); + TestSuffixLowerBound(us("b"), us("bc")); + TestSuffixLowerBound(us("aa"), us("a")); + TestSuffixLowerBound(us("aa"), us("aa")); + + ustring sentence = us("the quick brown fox jumps over the lazy dog."); + // Entire string: exact and unique. + TestSuffixLowerBound(sentence, sentence); + // Empty string: exact and non-unique. + TestSuffixLowerBound(sentence, us("")); + // Exact and unique suffix matches. + TestSuffixLowerBound(sentence, us(".")); + TestSuffixLowerBound(sentence, us("the lazy dog.")); + // Exact and unique non-suffix matches. + TestSuffixLowerBound(sentence, us("quick")); + TestSuffixLowerBound(sentence, us("the quick")); + // Partial and unique matches. + TestSuffixLowerBound(sentence, us("fox jumps with the hosps")); + TestSuffixLowerBound(sentence, us("xyz")); + // Exact and non-unique match: take lexicographical first. + TestSuffixLowerBound(sentence, us("the")); + TestSuffixLowerBound(sentence, us(" ")); + // Partial and non-unique match. + // query < "the l"... < "the q"... + TestSuffixLowerBound(sentence, us("the apple")); + // "the l"... < query < "the q"... + TestSuffixLowerBound(sentence, us("the opera")); + // "the l"... < "the q"... < query + TestSuffixLowerBound(sentence, us("the zebra")); + // Prefix match dominates suffix match (unique). + TestSuffixLowerBound(sentence, us("over quick brown fox")); + // Empty matchs. + TestSuffixLowerBound(sentence, us(",")); + TestSuffixLowerBound(sentence, us("1234")); + TestSuffixLowerBound(sentence, us("THE QUICK BROWN FOX")); + TestSuffixLowerBound(sentence, us("(the")); +} + +TEST(SuffixArrayTest, LowerBoundExact) { + for (const std::string& test_str : test_strs) { + ustring test_ustr = MakeUnsignedString(test_str); + + std::vector<size_t> suffix_array = + MakeSuffixArray<Sais>(test_ustr, kNumChar); + + for (size_t lo = 0; lo < test_str.size(); ++lo) { + for (size_t hi = lo + 1; hi <= test_str.size(); ++hi) { + ustring query(test_ustr.begin() + lo, test_ustr.begin() + hi); + ASSERT_EQ(query.size(), hi - lo); + auto pos = SuffixLowerBound(suffix_array, test_ustr.begin(), + query.begin(), query.end()); + EXPECT_TRUE( + std::equal(query.begin(), query.end(), test_ustr.begin() + *pos)); + } + } + } +} + +} // namespace zucchini
diff --git a/chrome/renderer/safe_browsing/DEPS b/chrome/renderer/safe_browsing/DEPS index e581dd3..4db2367 100644 --- a/chrome/renderer/safe_browsing/DEPS +++ b/chrome/renderer/safe_browsing/DEPS
@@ -2,6 +2,7 @@ "+components/safe_browsing/common", "+components/safe_browsing/csd.pb.h", "+components/safe_browsing/renderer", + "+components/safe_browsing/features.h", "+third_party/smhasher", ]
diff --git a/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc b/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc index b537f33..53f6814 100644 --- a/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc +++ b/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc
@@ -5,12 +5,12 @@ #include "components/safe_browsing/renderer/threat_dom_details.h" #include <memory> - #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" #include "base/test/scoped_feature_list.h" #include "chrome/test/base/chrome_render_view_test.h" #include "components/safe_browsing/common/safebrowsing_messages.h" +#include "components/safe_browsing/features.h" #include "components/variations/variations_associated_data.h" #include "content/public/renderer/render_view.h" #include "net/base/escape.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9e57343..4c185565 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2890,7 +2890,7 @@ ] if (enable_pepper_cdms) { - deps += [ "//media:cdm_paths" ] + deps += [ "//media/cdm:cdm_paths" ] data_deps = [ "//media/cdm/ppapi:clearkeycdmadapter", "//third_party/widevine/cdm:widevinecdmadapter", @@ -3057,6 +3057,7 @@ "../browser/component_updater/subresource_filter_component_installer_unittest.cc", "../browser/component_updater/supervised_user_whitelist_installer_unittest.cc", "../browser/component_updater/sw_reporter_installer_win_unittest.cc", + "../browser/conflicts/enumerate_input_method_editors_win_unittest.cc", "../browser/conflicts/installed_programs_win_unittest.cc", "../browser/conflicts/module_database_win_unittest.cc", "../browser/conflicts/module_event_sink_impl_win_unittest.cc", @@ -3469,6 +3470,7 @@ "//components/ntp_snippets:test_support", "//components/os_crypt:test_support", "//components/resources", + "//components/safe_browsing:features", "//components/safe_browsing_db", "//components/safe_browsing_db:test_database_manager", "//components/safe_json:test_support", @@ -3603,6 +3605,7 @@ "../browser/media_galleries/media_galleries_preferences_unittest.cc", "../browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc", "../browser/media_galleries/win/mtp_device_object_enumerator_unittest.cc", + "../browser/resource_coordinator/background_tab_navigation_throttle_unittest.cc", "../browser/resource_coordinator/tab_manager_delegate_chromeos_unittest.cc", "../browser/resource_coordinator/tab_manager_unittest.cc", "../browser/resource_coordinator/tab_manager_web_contents_data_unittest.cc",
diff --git a/chrome/test/data/webui/media_router/media_router_container_cast_mode_list_tests.js b/chrome/test/data/webui/media_router/media_router_container_cast_mode_list_tests.js index f563218..dfe283b 100644 --- a/chrome/test/data/webui/media_router/media_router_container_cast_mode_list_tests.js +++ b/chrome/test/data/webui/media_router/media_router_container_cast_mode_list_tests.js
@@ -271,14 +271,15 @@ 'container-header', 'device-missing']); - // Set a non-blocking issue. The issue should stay hidden. + // Set a non-blocking issue. The issue should be visible. container.issue = fakeNonBlockingIssue; setTimeout(function() { - checkElementsVisibleWithId(['cast-mode-list', - 'container-header', - 'device-missing']); + checkElementsVisibleWithId([ + 'cast-mode-list', 'container-header', 'device-missing', + 'issue-banner' + ]); - // Set a blocking issue. The issue should stay hidden. + // Set a blocking issue. The cast mode list should not be displayed. container.issue = fakeBlockingIssue; setTimeout(function() { checkElementsVisibleWithId(['container-header',
diff --git a/chrome/test/data/webui/settings/site_details_permission_tests.js b/chrome/test/data/webui/settings/site_details_permission_tests.js index f8d73ef..997a11e 100644 --- a/chrome/test/data/webui/settings/site_details_permission_tests.js +++ b/chrome/test/data/webui/settings/site_details_permission_tests.js
@@ -26,22 +26,6 @@ } }; - /** - * An example pref with only one entry allowed. - */ - var prefsCookies = { - exceptions: { - cookies: [ - { - embeddingOrigin: '', - origin: 'https://www.example.com', - setting: 'allow', - source: 'preference', - }, - ] - } - }; - // Initialize a site-details-permission before each test. setup(function() { browserProxy = new TestSiteSettingsPrefsBrowserProxy(); @@ -110,34 +94,4 @@ origin, settings.ContentSetting.ALLOW); }); }); - - test('cookies category', function() { - var origin = 'https://www.example.com'; - browserProxy.setPrefs(prefsCookies); - testElement.category = settings.ContentSettingsTypes.COOKIES; - testElement.label = 'Cookies'; - testElement.site = { - origin: origin, - embeddingOrigin: '', - }; - - assertFalse(testElement.$.details.hidden); - - var header = testElement.$.details.querySelector('#permissionHeader'); - assertEquals( - 'Cookies', header.innerText.trim(), - 'Widget should be labelled correctly'); - - // Flip the permission and validate that prefs stay in sync. - return validatePermissionFlipWorks( - origin, settings.ContentSetting.SESSION_ONLY) - .then(function() { - return validatePermissionFlipWorks( - origin, settings.ContentSetting.ALLOW); - }) - .then(function() { - return validatePermissionFlipWorks( - origin, settings.ContentSetting.BLOCK); - }); - }); });
diff --git a/chrome/test/data/webui/settings/site_details_tests.js b/chrome/test/data/webui/settings/site_details_tests.js index b195082..37eb131 100644 --- a/chrome/test/data/webui/settings/site_details_tests.js +++ b/chrome/test/data/webui/settings/site_details_tests.js
@@ -39,14 +39,6 @@ source: 'extension', }, ], - cookies: [ - { - embeddingOrigin: 'https://foo-allow.com:443', - origin: 'https://foo-allow.com:443', - setting: 'allow', - source: 'preference', - }, - ], geolocation: [ { embeddingOrigin: 'https://foo-allow.com:443',
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index fd9368a..8322ec81 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -1238,11 +1238,15 @@ TEST_PPAPI_OUT_OF_PROCESS(PDF) -// TODO(dalecurtis): Renable once the platform verification infobar has been -// implemented; see http://crbug.com/270908 -// #if defined(OS_CHROMEOS) -// TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate) -// #endif +IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, PlatformVerificationPrivate) { + RunTest( +#if defined(OS_CHROMEOS) +// TODO(dalecurtis): Renable once the platform verification infobar has +// been implemented; see http://crbug.com/270908 +// LIST_TEST(PlatformVerificationPrivate_ChallengePlatform) +#endif + LIST_TEST(PlatformVerificationPrivate_StorageId)); +} IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) { RunTest(
diff --git a/chrome/utility/safe_browsing/mac/BUILD.gn b/chrome/utility/safe_browsing/mac/BUILD.gn index 2f3ee334d..60d6979 100644 --- a/chrome/utility/safe_browsing/mac/BUILD.gn +++ b/chrome/utility/safe_browsing/mac/BUILD.gn
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/sysroot.gni") import("//testing/libfuzzer/fuzzer_test.gni") source_set("mac") { @@ -49,19 +48,6 @@ public_configs = [ ":dmg_public_config" ] } -config("10_10_config") { - cflags = [ - "-isysroot", - sysroot, - "-mmacosx-version-min=10.10", - ] - ldflags = [ - "-isysroot", - sysroot, - "-mmacosx-version-min=10.10", - ] -} - executable("crdmg") { sources = [ "crdmg.cc", @@ -72,9 +58,6 @@ "//base", "//sandbox/mac:seatbelt", ] - - configs -= [ "//build/config/compiler:runtime_library" ] - configs += [ ":10_10_config" ] } fuzzer_test("safe_browsing_dmg_fuzzer") {
diff --git a/chrome/utility/safe_browsing/mac/crdmg.cc b/chrome/utility/safe_browsing/mac/crdmg.cc index d73333e..edae4f4 100644 --- a/chrome/utility/safe_browsing/mac/crdmg.cc +++ b/chrome/utility/safe_browsing/mac/crdmg.cc
@@ -53,7 +53,7 @@ bool EnableSandbox(); // Performs the actual DMG operation. - bool ParseDMG(); + __attribute__((availability(macos, introduced = 10.10))) bool ParseDMG(); base::File dmg_file_; @@ -91,8 +91,13 @@ if (!EnableSandbox()) return EXIT_FAILURE; - if (!ParseDMG()) + if (__builtin_available(macOS 10.10, *)) { + if (!ParseDMG()) + return EXIT_FAILURE; + } else { + LOG(ERROR) << "Requires 10.10 or higher"; return EXIT_FAILURE; + } return EXIT_SUCCESS; }
diff --git a/chromecast/browser/metrics/cast_metrics_service_client.cc b/chromecast/browser/metrics/cast_metrics_service_client.cc index 8cb0a48..9066f4bb 100644 --- a/chromecast/browser/metrics/cast_metrics_service_client.cc +++ b/chromecast/browser/metrics/cast_metrics_service_client.cc
@@ -9,6 +9,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/strings/string16.h" #include "base/strings/string_number_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -322,7 +323,7 @@ cast_service_ = cast_service; metrics_state_manager_ = ::metrics::MetricsStateManager::Create( - pref_service_, this, + pref_service_, this, base::string16(), base::Bind(&CastMetricsServiceClient::StoreClientInfo, base::Unretained(this)), base::Bind(&CastMetricsServiceClient::LoadClientInfo,
diff --git a/chromecast/chromecast.gni b/chromecast/chromecast.gni index 6cc70ad..491d71a 100644 --- a/chromecast/chromecast.gni +++ b/chromecast/chromecast.gni
@@ -42,6 +42,9 @@ # still be used to enable multizone. supports_multizone = is_cast_audio_only && !is_cast_desktop_build + # Set to true for builds targeting ARC. + is_android_arc = false + # Set true for builds targeting Android Things. is_android_things = false }
diff --git a/chromecast/crash/cast_crash_keys.cc b/chromecast/crash/cast_crash_keys.cc index 48dab21..f9ad50b7 100644 --- a/chromecast/crash/cast_crash_keys.cc +++ b/chromecast/crash/cast_crash_keys.cc
@@ -14,6 +14,11 @@ const char kCurrentApp[] = "current_app"; const char kPreviousApp[] = "previous_app"; +// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. +// TODO(sunnyps): Remove after fixing https://crbug.com/622080 +const char kBeginMainFrameHangCompositorState[] = + "begin-main-frame-hang-compositor-state"; + size_t RegisterCastCrashKeys() { const base::debug::CrashKey fixed_keys[] = { {kLastApp, ::crash_keys::kSmallSize}, @@ -91,6 +96,10 @@ // Temporary for https://crbug.com/685996. {"user-cloud-policy-manager-connect-trace", ::crash_keys::kMediumSize}, + + // TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang. + // TODO(sunnyps): Remove after fixing https://crbug.com/622080 + {kBeginMainFrameHangCompositorState, ::crash_keys::kSmallSize}, }; return base::debug::InitCrashKeys(fixed_keys, arraysize(fixed_keys),
diff --git a/chromecast/public/media/media_pipeline_backend.h b/chromecast/public/media/media_pipeline_backend.h index 978faea..a5fa8a6 100644 --- a/chromecast/public/media/media_pipeline_backend.h +++ b/chromecast/public/media/media_pipeline_backend.h
@@ -159,8 +159,12 @@ uint64_t dropped_frames; // Reported as webkitDroppedFrames. }; - // Provides the video configuration. Called once before the backend is - // initialized, and again any time the configuration changes (in any state). + // Provides the video configuration. Called once with the configuration for + // the primary stream before the backend is initialized, and the + // configuration may contain a pointer to additional configuration for a + // secondary stream. Called again with the configuration for either the + // primary or secondary stream when either changes after the backend is + // initialized. // Note that SetConfig() may be called before SetDelegate() is called. // Returns true if the configuration is a supported configuration. virtual bool SetConfig(const VideoConfig& config) = 0;
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index d45179c7..f7e18dc 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc
@@ -426,6 +426,11 @@ // Indicates that if we should start bootstrapping Master OOBE. const char kOobeBootstrappingMaster[] = "oobe-bootstrapping-master"; +// Forces OOBE/login to force show a comma-separated list of screens from +// chromeos::kScreenNames in oobe_screen.cc. Supported screens are: +// user-image +const char kOobeForceShowScreen[] = "oobe-force-show-screen"; + // Indicates that a guest session has been started before OOBE completion. const char kOobeGuestSession[] = "oobe-guest-session";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 1e13360..be722daf 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h
@@ -126,6 +126,7 @@ CHROMEOS_EXPORT extern const char kNetworkSettingsConfig[]; CHROMEOS_EXPORT extern const char kNoteTakingAppIds[]; CHROMEOS_EXPORT extern const char kOobeBootstrappingMaster[]; +CHROMEOS_EXPORT extern const char kOobeForceShowScreen[]; CHROMEOS_EXPORT extern const char kOobeGuestSession[]; CHROMEOS_EXPORT extern const char kOobeSkipPostLogin[]; CHROMEOS_EXPORT extern const char kOobeTimerInterval[];
diff --git a/chromeos/components/tether/host_connection_metrics_logger.cc b/chromeos/components/tether/host_connection_metrics_logger.cc index 4159020..4daeefbd 100644 --- a/chromeos/components/tether/host_connection_metrics_logger.cc +++ b/chromeos/components/tether/host_connection_metrics_logger.cc
@@ -36,10 +36,16 @@ ConnectionToHostResult_FailureClientConnectionEventType::TIMEOUT); break; case ConnectionToHostResult:: - CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_NEW_ATTEMPT: + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_USER: RecordConnectionResultFailureClientConnection( ConnectionToHostResult_FailureClientConnectionEventType:: - CANCELED_BY_NEW_ATTEMPT); + CANCELED_BY_USER); + break; + case ConnectionToHostResult:: + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_INTERNAL_ERROR: + RecordConnectionResultFailureClientConnection( + ConnectionToHostResult_FailureClientConnectionEventType:: + INTERNAL_ERROR); break; case ConnectionToHostResult:: CONNECTION_RESULT_FAILURE_TETHERING_TIMED_OUT_FIRST_TIME_SETUP_WAS_REQUIRED:
diff --git a/chromeos/components/tether/host_connection_metrics_logger.h b/chromeos/components/tether/host_connection_metrics_logger.h index f5a22ef1..dfa0b72 100644 --- a/chromeos/components/tether/host_connection_metrics_logger.h +++ b/chromeos/components/tether/host_connection_metrics_logger.h
@@ -22,7 +22,8 @@ CONNECTION_RESULT_SUCCESS, CONNECTION_RESULT_FAILURE_UNKNOWN_ERROR, CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_TIMEOUT, - CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_NEW_ATTEMPT, + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_USER, + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_INTERNAL_ERROR, CONNECTION_RESULT_FAILURE_TETHERING_TIMED_OUT_FIRST_TIME_SETUP_WAS_REQUIRED, CONNECTION_RESULT_FAILURE_TETHERING_TIMED_OUT_FIRST_TIME_SETUP_WAS_NOT_REQUIRED }; @@ -46,7 +47,10 @@ RecordConnectionResultFailureClientConnection_Timeout); FRIEND_TEST_ALL_PREFIXES( HostConnectionMetricsLoggerTest, - RecordConnectionResultFailureClientConnection_CanceledByNewAttempt); + RecordConnectionResultFailureClientConnection_CanceledByUser); + FRIEND_TEST_ALL_PREFIXES( + HostConnectionMetricsLoggerTest, + RecordConnectionResultFailureClientConnection_InternalError); FRIEND_TEST_ALL_PREFIXES( HostConnectionMetricsLoggerTest, RecordConnectionResultFailureTetheringTimeout_SetupRequired); @@ -89,7 +93,8 @@ enum ConnectionToHostResult_FailureClientConnectionEventType { TIMEOUT = 0, - CANCELED_BY_NEW_ATTEMPT = 1, + CANCELED_BY_USER = 1, + INTERNAL_ERROR = 2, FAILURE_CLIENT_CONNECTION_MAX }; @@ -100,24 +105,18 @@ }; // Record if a host connection attempt never went through due to provisioning - // failure, or otherwise continued. Should only be publicly called with - // an argument of ConnectionToHostResult_ProvisioningFailureEventType::OTHER. + // failure, or otherwise continued. void RecordConnectionResultProvisioningFailure( ConnectionToHostResult_ProvisioningFailureEventType event_type); - // Record if a host connection attempt succeeded or failed. Should only be - // publicly called with - // an argument of ConnectionToHostResult_SuccessEventType::SUCCESS. Failure is + // Record if a host connection attempt succeeded or failed. Failure is // covered by the RecordConnectionResultFailure() method. void RecordConnectionResultSuccess( ConnectionToHostResult_SuccessEventType event_type); - // Record how a host connection attempt failed. Should only be - // publicly called with an argument of - // ConnectionToHostResult_FailureEventType::UNKNOWN_ERROR. Failure due to - // client error or tethering - // timeout is covered - // by theRecordConnectionResultFailureClientConnection() or + // Record how a host connection attempt failed. Failure due to client error or + // tethering timeout is covered by the + // RecordConnectionResultFailureClientConnection() or // RecordConnectionResultFailureTetheringTimeout() methods, respectively. void RecordConnectionResultFailure( ConnectionToHostResult_FailureEventType event_type);
diff --git a/chromeos/components/tether/host_connection_metrics_logger_unittest.cc b/chromeos/components/tether/host_connection_metrics_logger_unittest.cc index 296ecc8..37d658a3 100644 --- a/chromeos/components/tether/host_connection_metrics_logger_unittest.cc +++ b/chromeos/components/tether/host_connection_metrics_logger_unittest.cc
@@ -125,15 +125,35 @@ } TEST_F(HostConnectionMetricsLoggerTest, - RecordConnectionResultFailureClientConnection_CanceledByNewAttempt) { + RecordConnectionResultFailureClientConnection_CanceledByUser) { metrics_logger_->RecordConnectionToHostResult( HostConnectionMetricsLogger::ConnectionToHostResult:: - CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_NEW_ATTEMPT); + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_CANCELED_BY_USER); VerifyFailure_ClientConnection( HostConnectionMetricsLogger:: ConnectionToHostResult_FailureClientConnectionEventType:: - CANCELED_BY_NEW_ATTEMPT); + CANCELED_BY_USER); + VerifyFailure( + HostConnectionMetricsLogger::ConnectionToHostResult_FailureEventType:: + CLIENT_CONNECTION_ERROR); + VerifySuccess(HostConnectionMetricsLogger:: + ConnectionToHostResult_SuccessEventType::FAILURE); + VerifyProvisioningFailure( + HostConnectionMetricsLogger:: + ConnectionToHostResult_ProvisioningFailureEventType::OTHER); +} + +TEST_F(HostConnectionMetricsLoggerTest, + RecordConnectionResultFailureClientConnection_InternalError) { + metrics_logger_->RecordConnectionToHostResult( + HostConnectionMetricsLogger::ConnectionToHostResult:: + CONNECTION_RESULT_FAILURE_CLIENT_CONNECTION_INTERNAL_ERROR); + + VerifyFailure_ClientConnection( + HostConnectionMetricsLogger:: + ConnectionToHostResult_FailureClientConnectionEventType:: + INTERNAL_ERROR); VerifyFailure( HostConnectionMetricsLogger::ConnectionToHostResult_FailureEventType:: CLIENT_CONNECTION_ERROR);
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 0f35769..f78810a8 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -43,8 +43,6 @@ "intent_helper/intent_filter.h", "intent_helper/link_handler_model_impl.cc", "intent_helper/link_handler_model_impl.h", - "intent_helper/local_activity_resolver.cc", - "intent_helper/local_activity_resolver.h", "intent_helper/page_transition_util.cc", "intent_helper/page_transition_util.h", "kiosk/arc_kiosk_bridge.cc", @@ -225,7 +223,6 @@ "intent_helper/font_size_util_unittest.cc", "intent_helper/intent_filter_unittest.cc", "intent_helper/link_handler_model_impl_unittest.cc", - "intent_helper/local_activity_resolver_unittest.cc", "intent_helper/page_transition_util_unittest.cc", "kiosk/arc_kiosk_bridge_unittest.cc", ]
diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc index a0b2b96..3eb7e88 100644 --- a/components/arc/arc_service_manager.cc +++ b/components/arc/arc_service_manager.cc
@@ -20,8 +20,7 @@ } // namespace ArcServiceManager::ArcServiceManager() - : arc_bridge_service_(base::MakeUnique<ArcBridgeService>()), - activity_resolver_(new LocalActivityResolver()) { + : arc_bridge_service_(base::MakeUnique<ArcBridgeService>()) { DCHECK(!g_arc_service_manager); g_arc_service_manager = this; } @@ -75,7 +74,6 @@ void ArcServiceManager::Shutdown() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - activity_resolver_ = nullptr; services_.clear(); }
diff --git a/components/arc/arc_service_manager.h b/components/arc/arc_service_manager.h index 26540b0a..c015b16 100644 --- a/components/arc/arc_service_manager.h +++ b/components/arc/arc_service_manager.h
@@ -16,7 +16,6 @@ #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" #include "components/arc/arc_service.h" -#include "components/arc/intent_helper/local_activity_resolver.h" namespace content { class BrowserContext; @@ -116,14 +115,7 @@ // Called to shut down all ARC services. void Shutdown(); - // Returns the activity resolver owned by ArcServiceManager. - scoped_refptr<LocalActivityResolver> activity_resolver() { - return activity_resolver_; - } - private: - class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. - // Helper methods for AddService and GetService. bool AddServiceInternal(const std::string& name, std::unique_ptr<ArcService> service); @@ -133,7 +125,6 @@ std::unique_ptr<ArcBridgeService> arc_bridge_service_; std::unordered_multimap<std::string, std::unique_ptr<ArcService>> services_; - scoped_refptr<LocalActivityResolver> activity_resolver_; // This holds the pointer to the BrowserContext (practically Profile) // which is allowed to use ARC.
diff --git a/components/arc/arc_session_runner.cc b/components/arc/arc_session_runner.cc index e08cfa6..c9af993 100644 --- a/components/arc/arc_session_runner.cc +++ b/components/arc/arc_session_runner.cc
@@ -228,10 +228,12 @@ // safe place to start the container for login screen. DCHECK(!arc_session_); DCHECK_EQ(state_, State::STOPPED); - arc_session_ = factory_.Run(); - arc_session_->AddObserver(this); - state_ = State::STARTING_FOR_LOGIN_SCREEN; - arc_session_->StartForLoginScreen(); + + // TODO(yusukes): Once Chrome OS side is ready, uncomment the following: + // arc_session_ = factory_.Run(); + // arc_session_->AddObserver(this); + // state_ = State::STARTING_FOR_LOGIN_SCREEN; + // arc_session_->StartForLoginScreen(); } } // namespace arc
diff --git a/components/arc/arc_session_runner_unittest.cc b/components/arc/arc_session_runner_unittest.cc index f8f9cc4..144d0b0b 100644 --- a/components/arc/arc_session_runner_unittest.cc +++ b/components/arc/arc_session_runner_unittest.cc
@@ -189,7 +189,7 @@ // Does the same with the mini instance for login screen. // TODO(yusukes): Enable the test once EmitLoginPromptVisibleCalled() is fully // enabled. -TEST_F(ArcSessionRunnerTest, BootFailureForLoginScreen) { +TEST_F(ArcSessionRunnerTest, DISABLED_BootFailureForLoginScreen) { ResetArcSessionFactory( base::Bind(&ArcSessionRunnerTest::CreateBootFailureArcSession, ArcStopReason::CRASH)); @@ -214,7 +214,7 @@ // is called. // TODO(yusukes): Enable the test once EmitLoginPromptVisibleCalled() is fully // enabled. -TEST_F(ArcSessionRunnerTest, StartWithLoginScreenInstance) { +TEST_F(ArcSessionRunnerTest, DISABLED_StartWithLoginScreenInstance) { EXPECT_TRUE(arc_session_runner()->IsStopped()); chromeos::DBusThreadManager::Get()
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc index 7fb2c3b..2975e46 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc
@@ -15,7 +15,6 @@ #include "components/arc/arc_service_manager.h" #include "components/arc/audio/arc_audio_bridge.h" #include "components/arc/intent_helper/link_handler_model_impl.h" -#include "components/arc/intent_helper/local_activity_resolver.h" #include "ui/base/layout.h" #include "url/gurl.h" @@ -29,12 +28,8 @@ const char ArcIntentHelperBridge::kArcIntentHelperPackageName[] = "org.chromium.arc.intent_helper"; -ArcIntentHelperBridge::ArcIntentHelperBridge( - ArcBridgeService* bridge_service, - const scoped_refptr<LocalActivityResolver>& activity_resolver) - : ArcService(bridge_service), - binding_(this), - activity_resolver_(activity_resolver) { +ArcIntentHelperBridge::ArcIntentHelperBridge(ArcBridgeService* bridge_service) + : ArcService(bridge_service), binding_(this) { arc_bridge_service()->intent_helper()->AddObserver(this); } @@ -100,6 +95,21 @@ return icon_loader_.GetActivityIcons(activities, callback); } +bool ArcIntentHelperBridge::ShouldChromeHandleUrl(const GURL& url) { + if (!url.SchemeIsHTTPOrHTTPS()) { + // Chrome will handle everything that is not http and https. + return true; + } + + for (const IntentFilter& filter : intent_filters_) { + if (filter.Match(url)) + return false; + } + + // Didn't find any matches for Android so let Chrome handle it. + return true; +} + void ArcIntentHelperBridge::AddObserver(ArcIntentHelperObserver* observer) { observer_list_.AddObserver(observer); } @@ -139,7 +149,7 @@ void ArcIntentHelperBridge::OnIntentFiltersUpdated( std::vector<IntentFilter> filters) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - activity_resolver_->UpdateIntentFilters(std::move(filters)); + intent_filters_ = std::move(filters); for (auto& observer : observer_list_) observer.OnIntentFiltersUpdated();
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.h b/components/arc/intent_helper/arc_intent_helper_bridge.h index 16449d3b9..4f90f4a 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.h +++ b/components/arc/intent_helper/arc_intent_helper_bridge.h
@@ -11,7 +11,6 @@ #include "ash/link_handler_model_factory.h" #include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" #include "components/arc/arc_service.h" @@ -31,7 +30,6 @@ class ArcBridgeService; class IntentFilter; -class LocalActivityResolver; // Receives intents from ARC. class ArcIntentHelperBridge @@ -40,9 +38,7 @@ public mojom::IntentHelperHost, public ash::LinkHandlerModelFactory { public: - ArcIntentHelperBridge( - ArcBridgeService* bridge_service, - const scoped_refptr<LocalActivityResolver>& activity_resolver); + explicit ArcIntentHelperBridge(ArcBridgeService* bridge_service); ~ArcIntentHelperBridge() override; void AddObserver(ArcIntentHelperObserver* observer); @@ -73,6 +69,14 @@ GetResult GetActivityIcons(const std::vector<ActivityName>& activities, const OnIconsReadyCallback& callback); + // Returns true when |url| can only be handled by Chrome. Otherwise, which is + // when there might be one or more ARC apps that can handle |url|, returns + // false. This function synchronously checks the |url| without making any IPC + // to ARC side. Note that this function only supports http and https. If url's + // scheme is neither http nor https, the function immediately returns true + // without checking the filters. + bool ShouldChromeHandleUrl(const GURL& url); + // ash::LinkHandlerModelFactory std::unique_ptr<ash::LinkHandlerModel> CreateModel(const GURL& url) override; @@ -90,11 +94,14 @@ static const char kArcIntentHelperPackageName[]; private: + THREAD_CHECKER(thread_checker_); + mojo::Binding<mojom::IntentHelperHost> binding_; internal::ActivityIconLoader icon_loader_; - scoped_refptr<LocalActivityResolver> activity_resolver_; - THREAD_CHECKER(thread_checker_); + // List of intent filters from Android. Used to determine if Chrome should + // handle a URL without handing off to Android. + std::vector<IntentFilter> intent_filters_; base::ObserverList<ArcIntentHelperObserver> observer_list_;
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc b/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc index fd704229..bb04cd01 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc
@@ -9,33 +9,38 @@ #include "base/memory/ptr_util.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/common/intent_helper.mojom.h" -#include "components/arc/intent_helper/local_activity_resolver.h" #include "testing/gtest/include/gtest/gtest.h" namespace arc { namespace { +IntentFilter GetIntentFilter(const std::string& host) { + std::vector<IntentFilter::AuthorityEntry> authorities; + authorities.emplace_back(host, -1); + + // TODO + return IntentFilter(std::move(authorities), + std::vector<IntentFilter::PatternMatcher>()); +} + class ArcIntentHelperTest : public testing::Test { public: ArcIntentHelperTest() = default; protected: std::unique_ptr<ArcBridgeService> arc_bridge_service_; - scoped_refptr<LocalActivityResolver> activity_resolver_; std::unique_ptr<ArcIntentHelperBridge> instance_; private: void SetUp() override { arc_bridge_service_ = base::MakeUnique<ArcBridgeService>(); - activity_resolver_ = new LocalActivityResolver(); - instance_ = base::MakeUnique<ArcIntentHelperBridge>( - arc_bridge_service_.get(), activity_resolver_); + instance_ = + base::MakeUnique<ArcIntentHelperBridge>(arc_bridge_service_.get()); } void TearDown() override { instance_.reset(); - activity_resolver_ = nullptr; arc_bridge_service_.reset(); } @@ -161,4 +166,92 @@ EXPECT_FALSE(observer->IsUpdated()); } +// Tests that ShouldChromeHandleUrl returns true by default. +TEST_F(ArcIntentHelperTest, TestDefault) { + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("http://www.google.com"))); + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("https://www.google.com"))); + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("file:///etc/password"))); + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("chrome://help"))); + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("about://chrome"))); +} + +// Tests that ShouldChromeHandleUrl returns false when there's a match. +TEST_F(ArcIntentHelperTest, TestSingleFilter) { + std::vector<IntentFilter> array; + array.emplace_back(GetIntentFilter("www.google.com")); + instance_->OnIntentFiltersUpdated(std::move(array)); + + EXPECT_FALSE(instance_->ShouldChromeHandleUrl(GURL("http://www.google.com"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://www.google.com"))); + + EXPECT_TRUE( + instance_->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); +} + +// Tests the same with multiple filters. +TEST_F(ArcIntentHelperTest, TestMultipleFilters) { + std::vector<IntentFilter> array; + array.emplace_back(GetIntentFilter("www.google.com")); + array.emplace_back(GetIntentFilter("www.google.co.uk")); + array.emplace_back(GetIntentFilter("dev.chromium.org")); + instance_->OnIntentFiltersUpdated(std::move(array)); + + EXPECT_FALSE(instance_->ShouldChromeHandleUrl(GURL("http://www.google.com"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://www.google.com"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("http://www.google.co.uk"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("http://dev.chromium.org"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://dev.chromium.org"))); + + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("http://www.android.com"))); +} + +// Tests that ShouldChromeHandleUrl returns true for non http(s) URLs. +TEST_F(ArcIntentHelperTest, TestNonHttp) { + std::vector<IntentFilter> array; + array.emplace_back(GetIntentFilter("www.google.com")); + instance_->OnIntentFiltersUpdated(std::move(array)); + + EXPECT_TRUE( + instance_->ShouldChromeHandleUrl(GURL("chrome://www.google.com"))); + EXPECT_TRUE( + instance_->ShouldChromeHandleUrl(GURL("custom://www.google.com"))); +} + +// Tests that ShouldChromeHandleUrl discards the previous filters when +// UpdateIntentFilters is called with new ones. +TEST_F(ArcIntentHelperTest, TestMultipleUpdate) { + std::vector<IntentFilter> array; + array.emplace_back(GetIntentFilter("www.google.com")); + array.emplace_back(GetIntentFilter("dev.chromium.org")); + instance_->OnIntentFiltersUpdated(std::move(array)); + + std::vector<IntentFilter> array2; + array2.emplace_back(GetIntentFilter("www.google.co.uk")); + array2.emplace_back(GetIntentFilter("dev.chromium.org")); + array2.emplace_back(GetIntentFilter("www.android.com")); + instance_->OnIntentFiltersUpdated(std::move(array2)); + + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("http://www.google.com"))); + EXPECT_TRUE(instance_->ShouldChromeHandleUrl(GURL("https://www.google.com"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("http://www.google.co.uk"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("http://dev.chromium.org"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://dev.chromium.org"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("http://www.android.com"))); + EXPECT_FALSE( + instance_->ShouldChromeHandleUrl(GURL("https://www.android.com"))); +} + } // namespace arc
diff --git a/components/arc/intent_helper/local_activity_resolver.cc b/components/arc/intent_helper/local_activity_resolver.cc deleted file mode 100644 index d667bff..0000000 --- a/components/arc/intent_helper/local_activity_resolver.cc +++ /dev/null
@@ -1,37 +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/arc/intent_helper/local_activity_resolver.h" - -#include <utility> - -#include "url/gurl.h" - -namespace arc { - -LocalActivityResolver::LocalActivityResolver() = default; - -LocalActivityResolver::~LocalActivityResolver() = default; - -bool LocalActivityResolver::ShouldChromeHandleUrl(const GURL& url) { - if (!url.SchemeIsHTTPOrHTTPS()) { - // Chrome will handle everything that is not http and https. - return true; - } - - for (const IntentFilter& filter : intent_filters_) { - if (filter.Match(url)) - return false; - } - - // Didn't find any matches for Android so let Chrome handle it. - return true; -} - -void LocalActivityResolver::UpdateIntentFilters( - std::vector<IntentFilter> intent_filters) { - intent_filters_ = std::move(intent_filters); -} - -} // namespace arc
diff --git a/components/arc/intent_helper/local_activity_resolver.h b/components/arc/intent_helper/local_activity_resolver.h deleted file mode 100644 index 353d31c..0000000 --- a/components/arc/intent_helper/local_activity_resolver.h +++ /dev/null
@@ -1,47 +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_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ -#define COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_ - -#include <vector> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "components/arc/common/intent_helper.mojom.h" -#include "components/arc/intent_helper/intent_filter.h" - -class GURL; - -namespace arc { - -class LocalActivityResolver : public base::RefCounted<LocalActivityResolver> { - public: - LocalActivityResolver(); - - // Returns true when |url| can only be handled by Chrome. Otherwise, which is - // when there might be one or more ARC apps that can handle |url|, returns - // false. This function synchronously checks the |url| without making any IPC - // to ARC side. Note that this function only supports http and https. If url's - // scheme is neither http nor https, the function immediately returns true - // without checking the filters. - bool ShouldChromeHandleUrl(const GURL& url); - - // Called when the list of intent filters on ARC side is updated. - void UpdateIntentFilters(std::vector<IntentFilter> intent_filters); - - private: - friend class base::RefCounted<LocalActivityResolver>; - ~LocalActivityResolver(); - - // List of intent filters from Android. Used to determine if Chrome should - // handle a URL without handing off to Android. - std::vector<IntentFilter> intent_filters_; - - DISALLOW_COPY_AND_ASSIGN(LocalActivityResolver); -}; - -} // namespace arc - -#endif // COMPONENTS_ARC_INTENT_HELPER_LOCAL_ACTIVITY_RESOLVER_H_
diff --git a/components/arc/intent_helper/local_activity_resolver_unittest.cc b/components/arc/intent_helper/local_activity_resolver_unittest.cc deleted file mode 100644 index 09bf445..0000000 --- a/components/arc/intent_helper/local_activity_resolver_unittest.cc +++ /dev/null
@@ -1,120 +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/arc/intent_helper/local_activity_resolver.h" - -#include <string> -#include <utility> - -#include "components/arc/intent_helper/intent_filter.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "url/gurl.h" - -namespace arc { - -namespace { - -IntentFilter GetIntentFilter(const std::string& host) { - std::vector<IntentFilter::AuthorityEntry> authorities; - authorities.emplace_back(host, -1); - - return IntentFilter(std::move(authorities), - std::vector<IntentFilter::PatternMatcher>()); -} - -} // namespace - -// Tests that ShouldChromeHandleUrl returns true by default. -TEST(LocalActivityResolverTest, TestDefault) { - scoped_refptr<LocalActivityResolver> resolver(new LocalActivityResolver()); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("http://www.google.com"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("https://www.google.com"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("file:///etc/password"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("chrome://help"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("about://chrome"))); -} - -// Tests that ShouldChromeHandleUrl returns false when there's a match. -TEST(LocalActivityResolverTest, TestSingleFilter) { - scoped_refptr<LocalActivityResolver> resolver(new LocalActivityResolver()); - - std::vector<IntentFilter> array; - array.emplace_back(GetIntentFilter("www.google.com")); - resolver->UpdateIntentFilters(std::move(array)); - - EXPECT_FALSE(resolver->ShouldChromeHandleUrl(GURL("http://www.google.com"))); - EXPECT_FALSE(resolver->ShouldChromeHandleUrl(GURL("https://www.google.com"))); - - EXPECT_TRUE( - resolver->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); -} - -// Tests the same with multiple filters. -TEST(LocalActivityResolverTest, TestMultipleFilters) { - scoped_refptr<LocalActivityResolver> resolver(new LocalActivityResolver()); - - std::vector<IntentFilter> array; - array.emplace_back(GetIntentFilter("www.google.com")); - array.emplace_back(GetIntentFilter("www.google.co.uk")); - array.emplace_back(GetIntentFilter("dev.chromium.org")); - resolver->UpdateIntentFilters(std::move(array)); - - EXPECT_FALSE(resolver->ShouldChromeHandleUrl(GURL("http://www.google.com"))); - EXPECT_FALSE(resolver->ShouldChromeHandleUrl(GURL("https://www.google.com"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("http://www.google.co.uk"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("http://dev.chromium.org"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("https://dev.chromium.org"))); - - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("http://www.android.com"))); -} - -// Tests that ShouldChromeHandleUrl returns true for non http(s) URLs. -TEST(LocalActivityResolverTest, TestNonHttp) { - scoped_refptr<LocalActivityResolver> resolver(new LocalActivityResolver()); - - std::vector<IntentFilter> array; - array.emplace_back(GetIntentFilter("www.google.com")); - resolver->UpdateIntentFilters(std::move(array)); - - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("chrome://www.google.com"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("custom://www.google.com"))); -} - -// Tests that ShouldChromeHandleUrl discards the previous filters when -// UpdateIntentFilters is called with new ones. -TEST(LocalActivityResolverTest, TestMultipleUpdate) { - scoped_refptr<LocalActivityResolver> resolver(new LocalActivityResolver()); - - std::vector<IntentFilter> array; - array.emplace_back(GetIntentFilter("www.google.com")); - array.emplace_back(GetIntentFilter("dev.chromium.org")); - resolver->UpdateIntentFilters(std::move(array)); - - std::vector<IntentFilter> array2; - array2.emplace_back(GetIntentFilter("www.google.co.uk")); - array2.emplace_back(GetIntentFilter("dev.chromium.org")); - array2.emplace_back(GetIntentFilter("www.android.com")); - resolver->UpdateIntentFilters(std::move(array2)); - - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("http://www.google.com"))); - EXPECT_TRUE(resolver->ShouldChromeHandleUrl(GURL("https://www.google.com"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("http://www.google.co.uk"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("https://www.google.co.uk"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("http://dev.chromium.org"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("https://dev.chromium.org"))); - EXPECT_FALSE(resolver->ShouldChromeHandleUrl(GURL("http://www.android.com"))); - EXPECT_FALSE( - resolver->ShouldChromeHandleUrl(GURL("https://www.android.com"))); -} - -} // namespace arc
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index 3cf073b6ce..513e2752 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -956,11 +956,6 @@ crypto_->SetSyncEngine(engine_.get()); crypto_->SetDataTypeManager(data_type_manager_.get()); - // If we have a cached passphrase use it to decrypt/encrypt data now that the - // backend is initialized. We want to call this before notifying observers in - // case this operation affects the "passphrase required" status. - crypto_->ConsumeCachedPassphraseIfPossible(); - // Auto-start means IsFirstSetupComplete gets set automatically. if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { // This will trigger a configure if it completes setup. @@ -1213,10 +1208,6 @@ configure_status_ = result.status; data_type_status_table_ = result.data_type_status_table; - // We should have cleared our cached passphrase before we get here (in - // OnEngineInitialized()). - DCHECK(crypto_->cached_passphrase().empty()); - if (!sync_configure_start_time_.is_null()) { if (configure_status_ == DataTypeManager::OK) { base::Time sync_configure_stop_time = base::Time::Now(); @@ -1555,23 +1546,6 @@ } } -#if defined(OS_CHROMEOS) -void ProfileSyncService::RefreshSpareBootstrapToken( - const std::string& passphrase) { - syncer::SystemEncryptor encryptor; - syncer::Cryptographer temp_cryptographer(&encryptor); - // The first 2 params (hostname and username) doesn't have any effect here. - syncer::KeyParams key_params = {"localhost", "dummy", passphrase}; - - std::string bootstrap_token; - if (!temp_cryptographer.AddKey(key_params)) { - NOTREACHED() << "Failed to add key to cryptographer."; - } - temp_cryptographer.GetBootstrapToken(&bootstrap_token); - sync_prefs_.SetSpareBootstrapToken(bootstrap_token); -} -#endif - void ProfileSyncService::OnUserChoseDatatypes( bool sync_everything, syncer::ModelTypeSet chosen_types) { @@ -1944,21 +1918,9 @@ } } -void ProfileSyncService::GoogleSigninSucceededWithPassword( - const std::string& account_id, - const std::string& username, - const std::string& password) { +void ProfileSyncService::GoogleSigninSucceeded(const std::string& account_id, + const std::string& username) { DCHECK(thread_checker_.CalledOnValidThread()); - if (IsSyncRequested() && !password.empty()) { - crypto_->CachePassphrase(password); - // Try to consume the passphrase we just cached. If the sync engine - // is not running yet, the passphrase will remain cached until the - // engine starts up. - crypto_->ConsumeCachedPassphraseIfPossible(); - } -#if defined(OS_CHROMEOS) - RefreshSpareBootstrapToken(password); -#endif if (!IsEngineInitialized() || GetAuthError().state() != AuthError::NONE) { // Track the fact that we're still waiting for auth to complete. is_auth_in_progress_ = true;
diff --git a/components/browser_sync/profile_sync_service.h b/components/browser_sync/profile_sync_service.h index 963748d..d9c8da9 100644 --- a/components/browser_sync/profile_sync_service.h +++ b/components/browser_sync/profile_sync_service.h
@@ -381,9 +381,8 @@ syncer::ModelTypeSet GetEncryptedDataTypes() const override; // SigninManagerBase::Observer implementation. - void GoogleSigninSucceededWithPassword(const std::string& account_id, - const std::string& username, - const std::string& password) override; + void GoogleSigninSucceeded(const std::string& account_id, + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override; @@ -683,12 +682,6 @@ bool sync_everything, const syncer::ModelTypeSet chosen_types) const; -#if defined(OS_CHROMEOS) - // Refresh spare sync bootstrap token for re-enabling the sync service. - // Called on successful sign-in notifications. - void RefreshSpareBootstrapToken(const std::string& passphrase); -#endif - // Internal unrecoverable error handler. Used to track error reason via // Sync.UnrecoverableErrors histogram. void OnInternalUnrecoverableError(const tracked_objects::Location& from_here,
diff --git a/components/browser_sync/profile_sync_service_startup_unittest.cc b/components/browser_sync/profile_sync_service_startup_unittest.cc index 83c2123..2b603cc3 100644 --- a/components/browser_sync/profile_sync_service_startup_unittest.cc +++ b/components/browser_sync/profile_sync_service_startup_unittest.cc
@@ -44,7 +44,6 @@ const char kGaiaId[] = "12345"; const char kEmail[] = "test_user@gmail.com"; -const char kDummyPassword[] = "foobar"; class SyncServiceObserverMock : public syncer::SyncServiceObserver { public: @@ -119,14 +118,14 @@ kEmail); pref_service()->SetString(prefs::kGoogleServicesAccountId, account_id); #if !defined(OS_CHROMEOS) + const char kDummyPassword[] = "foobar"; profile_sync_service_bundle_.signin_manager()->SignIn(kGaiaId, kEmail, kDummyPassword); #else profile_sync_service_bundle_.signin_manager()->SetAuthenticatedAccountInfo( kGaiaId, kEmail); if (sync_service) - sync_service->GoogleSigninSucceededWithPassword(account_id, kEmail, - kDummyPassword); + sync_service->GoogleSigninSucceeded(account_id, kEmail); #endif return account_id; }
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index d9342555..7fb93c9 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -659,7 +659,7 @@ json_pref_store_ = new JsonPrefStore(filepath, GetFileThread()->task_runner(), std::unique_ptr<PrefFilter>()); - context_builder.SetFileTaskRunner(GetFileThread()->task_runner()); + context_builder.SetCacheThreadTaskRunner(GetFileThread()->task_runner()); // Register prefs and set up the PrefService. PrefServiceFactory factory;
diff --git a/components/cronet/ios/cronet_environment.h b/components/cronet/ios/cronet_environment.h index 31cec890..bed027b 100644 --- a/components/cronet/ios/cronet_environment.h +++ b/components/cronet/ios/cronet_environment.h
@@ -29,7 +29,7 @@ namespace net { class CookieStore; class NetLog; -class FileNetLogObserver; +class WriteToFileNetLogObserver; } // namespace net namespace cronet { @@ -131,7 +131,7 @@ const base::Closure& task); // Helper methods that start/stop net logging on the network thread. - void StartNetLogOnNetworkThread(const base::FilePath&, bool log_bytes); + void StartNetLogOnNetworkThread(base::ScopedFILE file, bool log_bytes); void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); // Returns the HttpNetworkSession object from the passed in @@ -169,7 +169,7 @@ std::string user_agent_; bool user_agent_partial_; std::unique_ptr<net::NetLog> net_log_; - std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_; + std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; bool enable_pkp_bypass_for_local_trust_anchors_; DISALLOW_COPY_AND_ASSIGN(CronetEnvironment);
diff --git a/components/cronet/ios/cronet_environment.mm b/components/cronet/ios/cronet_environment.mm index 609c180..dd3c96f 100644 --- a/components/cronet/ios/cronet_environment.mm +++ b/components/cronet/ios/cronet_environment.mm
@@ -8,11 +8,11 @@ #include "base/at_exit.h" #include "base/atomicops.h" -#include "base/bind.h" #include "base/command_line.h" #include "base/feature_list.h" #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/files/scoped_file.h" #include "base/json/json_writer.h" #include "base/mac/bind_objc_block.h" #include "base/mac/foundation_util.h" @@ -37,9 +37,9 @@ #include "net/http/http_stream_factory.h" #include "net/http/http_transaction_factory.h" #include "net/http/http_util.h" -#include "net/log/file_net_log_observer.h" #include "net/log/net_log.h" #include "net/log/net_log_capture_mode.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/proxy/proxy_service.h" #include "net/quic/core/quic_versions.h" #include "net/socket/ssl_client_socket.h" @@ -86,10 +86,6 @@ DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextGetter); }; -void SignalEvent(base::WaitableEvent* event) { - event->Signal(); -} - } // namespace namespace cronet { @@ -144,34 +140,42 @@ bool CronetEnvironment::StartNetLog(base::FilePath::StringType file_name, bool log_bytes) { - if (file_name.empty()) + if (!file_name.length()) return false; base::FilePath path(file_name); + base::ScopedFILE file(base::OpenFile(path, "w")); + if (!file) { + LOG(ERROR) << "Can not start NetLog to " << path.value() << ": " + << strerror(errno); + return false; + } + LOG(WARNING) << "Starting NetLog to " << path.value(); - PostToNetworkThread(FROM_HERE, - base::Bind(&CronetEnvironment::StartNetLogOnNetworkThread, - base::Unretained(this), path, log_bytes)); + PostToNetworkThread( + FROM_HERE, + base::Bind(&CronetEnvironment::StartNetLogOnNetworkThread, + base::Unretained(this), base::Passed(&file), log_bytes)); return true; } -void CronetEnvironment::StartNetLogOnNetworkThread(const base::FilePath& path, +void CronetEnvironment::StartNetLogOnNetworkThread(base::ScopedFILE file, bool log_bytes) { DCHECK(net_log_); - if (file_net_log_observer_) + if (net_log_observer_) return; net::NetLogCaptureMode capture_mode = log_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() : net::NetLogCaptureMode::Default(); - file_net_log_observer_ = - net::FileNetLogObserver::CreateUnbounded(path, nullptr); - file_net_log_observer_->StartObserving(main_context_->net_log(), - capture_mode); + net_log_observer_.reset(new net::WriteToFileNetLogObserver()); + net_log_observer_->set_capture_mode(capture_mode); + net_log_observer_->StartObserving(main_context_->net_log(), std::move(file), + nullptr, main_context_.get()); LOG(WARNING) << "Started NetLog"; } @@ -187,12 +191,12 @@ void CronetEnvironment::StopNetLogOnNetworkThread( base::WaitableEvent* log_stopped_event) { - if (file_net_log_observer_) { + if (net_log_observer_) { DLOG(WARNING) << "Stopped NetLog."; - file_net_log_observer_->StopObserving( - nullptr, base::BindOnce(&SignalEvent, log_stopped_event)); - file_net_log_observer_.reset(); + net_log_observer_->StopObserving(main_context_.get()); + net_log_observer_.reset(); } + log_stopped_event->Signal(); } net::HttpNetworkSession* CronetEnvironment::GetHttpNetworkSession(
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 0c9daaf..9dbf06e 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -19,6 +19,9 @@ #include "net/cert/caching_cert_verifier.h" #include "net/cert/cert_verifier.h" #include "net/cert/cert_verify_proc.h" +#include "net/cert/ct_policy_enforcer.h" +#include "net/cert/ct_policy_status.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/multi_threaded_cert_verifier.h" #include "net/dns/host_resolver.h" #include "net/dns/mapped_host_resolver.h" @@ -100,6 +103,20 @@ const char kSSLKeyLogFile[] = "ssl_key_log_file"; +// A CTPolicyEnforcer that accepts all certificates. +class DoNothingCTPolicyEnforcer : public net::CTPolicyEnforcer { + public: + DoNothingCTPolicyEnforcer() = default; + ~DoNothingCTPolicyEnforcer() override = default; + + net::ct::CertPolicyCompliance DoesConformToCertPolicy( + net::X509Certificate* cert, + const net::SCTList& verified_scts, + const net::NetLogWithSource& net_log) override { + return net::ct::CertPolicyCompliance::CERT_POLICY_COMPLIES_VIA_SCTS; + } +}; + } // namespace URLRequestContextConfig::QuicHint::QuicHint(const std::string& host, @@ -459,6 +476,12 @@ cert_verifier = net::CertVerifier::CreateDefault(); } context_builder->SetCertVerifier(std::move(cert_verifier)); + // Certificate Transparency is intentionally ignored in Cronet. + // See //net/docs/certificate-transparency.md for more details. + context_builder->set_ct_verifier( + base::MakeUnique<net::DoNothingCTVerifier>()); + context_builder->set_ct_policy_enforcer( + base::MakeUnique<DoNothingCTPolicyEnforcer>()); // TODO(mef): Use |config| to set cookies. }
diff --git a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc index aaec299..8b4522f 100644 --- a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc +++ b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc
@@ -145,10 +145,13 @@ net::ProxyRetryInfoMap proxy_retry_info; if (use_data_reduction_proxy) { - std::string data_reduction_proxy; - base::TrimString(test_context_->config()->test_params()->DefaultOrigin(), - "/", &data_reduction_proxy); - data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); + test_context_->config()->test_params()->UseNonSecureProxiesForHttp(); + data_reduction_proxy_info.UseProxyServer(test_context_->config() + ->test_params() + ->proxies_for_http() + .front() + .proxy_server()); + } else { data_reduction_proxy_info.UseNamedProxy("proxy.com"); }
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc index ef62c61..7280184 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -743,9 +743,21 @@ BYPASS_EVENT_TYPE_SHORT }, }; - std::string primary = test_context_->config()->test_params()->DefaultOrigin(); - std::string fallback = - test_context_->config()->test_params()->DefaultFallbackOrigin(); + test_context_->config()->test_params()->UseNonSecureProxiesForHttp(); + std::string primary = test_context_->config() + ->test_params() + ->proxies_for_http() + .front() + .proxy_server() + .host_port_pair() + .ToString(); + std::string fallback = test_context_->config() + ->test_params() + ->proxies_for_http() + .at(1) + .proxy_server() + .host_port_pair() + .ToString(); for (size_t i = 0; i < arraysize(tests); ++i) { ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult( net::ProxyServer::FromURI( @@ -930,6 +942,7 @@ AttachToContextAndInit(); if (test.enable_data_reduction_proxy) drp_test_context()->EnableDataReductionProxyWithSecureProxyCheckSuccess(); + drp_test_context()->config()->test_params()->UseNonSecureProxiesForHttp(); MockRead reads[] = {MockRead(test.response_headers), MockRead(""),
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc index e153937..531bcaa 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
@@ -272,9 +272,9 @@ // fully bypassed. std::vector<DataReductionProxyServer> data_reduction_proxy_servers; data_reduction_proxy_servers.push_back(DataReductionProxyServer( - net::ProxyServer::FromURI(config()->test_params()->DefaultOrigin(), - net::ProxyServer::SCHEME_HTTP), + config()->test_params()->proxies_for_http().front().proxy_server(), ProxyServer::CORE)); + config()->test_params()->UseNonSecureProxiesForHttp(); config()->test_params()->SetProxiesForHttp(data_reduction_proxy_servers); } @@ -796,11 +796,14 @@ TEST_F(DataReductionProxyBypassStatsEndToEndTest, BypassedBytesNetErrorOther) { // Make the data reduction proxy host fail to resolve. - net::ProxyServer origin = - config()->test_params()->proxies_for_http().front().proxy_server(); std::unique_ptr<net::MockHostResolver> host_resolver( new net::MockHostResolver()); - host_resolver->rules()->AddSimulatedFailure(origin.host_port_pair().host()); + + for (const auto& proxy_server : config()->test_params()->proxies_for_http()) { + host_resolver->rules()->AddSimulatedFailure( + proxy_server.proxy_server().host_port_pair().host()); + } + set_host_resolver(host_resolver.get()); InitializeContext(); @@ -1061,25 +1064,4 @@ 1 /*PROXY_SCHEME_HTTP */, 1); } -// Verifies that the scheme of the HTTPS data reduction proxy used is recorded -// correctly. -TEST_F(DataReductionProxyBypassStatsEndToEndTest, HttpsProxyScheme) { - net::ProxyServer origin = - net::ProxyServer::FromURI("test.com:443", net::ProxyServer::SCHEME_HTTPS); - std::vector<DataReductionProxyServer> data_reduction_proxy_servers; - data_reduction_proxy_servers.push_back( - DataReductionProxyServer(origin, ProxyServer::UNSPECIFIED_TYPE)); - config()->test_params()->SetProxiesForHttp(data_reduction_proxy_servers); - - InitializeContext(); - - base::HistogramTester histogram_tester; - CreateAndExecuteRequest(GURL("http://bar.com"), net::LOAD_NORMAL, net::OK, - "HTTP/1.1 200 OK\r\n" - "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", - kNextBody.c_str(), nullptr, nullptr); - histogram_tester.ExpectUniqueSample("DataReductionProxy.ProxySchemeUsed", - 2 /*PROXY_SCHEME_HTTPS */, 1); -} - } // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc index 6789bb4..27a8a7e 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
@@ -568,10 +568,19 @@ }; // The retry map has the scheme prefix for https but not for http. - std::string origin = GetRetryMapKeyFromOrigin( - TestDataReductionProxyParams::DefaultOrigin()); - std::string fallback_origin = GetRetryMapKeyFromOrigin( - TestDataReductionProxyParams::DefaultFallbackOrigin()); + std::string origin = GetRetryMapKeyFromOrigin(params() + ->proxies_for_http() + .front() + .proxy_server() + .host_port_pair() + .ToString()); + std::string fallback_origin = + GetRetryMapKeyFromOrigin(params() + ->proxies_for_http() + .at(1) + .proxy_server() + .host_port_pair() + .ToString()); for (size_t i = 0; i < arraysize(tests); ++i) { net::ProxyConfig::ProxyRules rules; @@ -611,10 +620,19 @@ } TEST_F(DataReductionProxyConfigTest, AreProxiesBypassedRetryDelay) { - std::string origin = GetRetryMapKeyFromOrigin( - TestDataReductionProxyParams::DefaultOrigin()); - std::string fallback_origin = GetRetryMapKeyFromOrigin( - TestDataReductionProxyParams::DefaultFallbackOrigin()); + std::string origin = GetRetryMapKeyFromOrigin(params() + ->proxies_for_http() + .front() + .proxy_server() + .host_port_pair() + .ToString()); + std::string fallback_origin = + GetRetryMapKeyFromOrigin(params() + ->proxies_for_http() + .at(1) + .proxy_server() + .host_port_pair() + .ToString()); net::ProxyConfig::ProxyRules rules; std::vector<std::string> proxies; @@ -675,22 +693,12 @@ net::ProxyServer expected_second; bool expected_is_fallback; } tests[] = { - {net::ProxyServer::FromURI(TestDataReductionProxyParams::DefaultOrigin(), - net::ProxyServer::SCHEME_HTTP), - true, - net::ProxyServer::FromURI(TestDataReductionProxyParams::DefaultOrigin(), - net::ProxyServer::SCHEME_HTTP), - net::ProxyServer::FromURI( - TestDataReductionProxyParams::DefaultFallbackOrigin(), - net::ProxyServer::SCHEME_HTTP), - false}, - {net::ProxyServer::FromURI( - TestDataReductionProxyParams::DefaultFallbackOrigin(), - net::ProxyServer::SCHEME_HTTP), - true, net::ProxyServer::FromURI( - TestDataReductionProxyParams::DefaultFallbackOrigin(), - net::ProxyServer::SCHEME_HTTP), - net::ProxyServer(), true}, + {params()->proxies_for_http().front().proxy_server(), true, + params()->proxies_for_http().front().proxy_server(), + params()->proxies_for_http().at(1).proxy_server(), false}, + {params()->proxies_for_http().at(1).proxy_server(), true, + params()->proxies_for_http().at(1).proxy_server(), net::ProxyServer(), + true}, }; for (size_t i = 0; i < arraysize(tests); ++i) { std::unique_ptr<TestDataReductionProxyParams> params(
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc index 8576bc777..a39600bd 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
@@ -588,24 +588,26 @@ TEST_F(DataReductionProxyDelegateTest, OnResolveProxyHandler) { GURL url("http://www.google.com/"); - - // Data reduction proxy info + params()->UseNonSecureProxiesForHttp(); + net::ProxyList proxy_list; + proxy_list.AddProxyServer( + params()->proxies_for_http().front().proxy_server()); + proxy_list.AddProxyServer(net::ProxyServer::Direct()); net::ProxyInfo data_reduction_proxy_info; - std::string data_reduction_proxy; - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - data_reduction_proxy_info.UsePacString( - "PROXY " + - net::ProxyServer::FromURI(params()->DefaultOrigin(), - net::ProxyServer::SCHEME_HTTP) - .host_port_pair() - .ToString() + - "; DIRECT"); + data_reduction_proxy_info.UseProxyList(proxy_list); EXPECT_FALSE(data_reduction_proxy_info.is_empty()); // Data reduction proxy config net::ProxyConfig data_reduction_proxy_config; data_reduction_proxy_config.proxy_rules().ParseFromString( - "http=" + data_reduction_proxy + ",direct://;"); + "http=" + + params() + ->proxies_for_http() + .front() + .proxy_server() + .host_port_pair() + .ToString() + + ",direct://;"); data_reduction_proxy_config.set_id(1); // Other proxy info @@ -733,17 +735,12 @@ GURL url(test.url); net::ProxyInfo data_reduction_proxy_info; - - std::string data_reduction_proxy; if (!test.use_direct_proxy) { - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - data_reduction_proxy_info.UsePacString( - "PROXY " + - net::ProxyServer::FromURI(params()->DefaultOrigin(), - net::ProxyServer::SCHEME_HTTP) - .host_port_pair() - .ToString() + - "; DIRECT"); + net::ProxyList proxy_list; + proxy_list.AddProxyServer( + params()->proxies_for_http().front().proxy_server()); + proxy_list.AddProxyServer(net::ProxyServer::Direct()); + data_reduction_proxy_info.UseProxyList(proxy_list); } EXPECT_EQ(test.use_direct_proxy, data_reduction_proxy_info.is_empty()); @@ -753,7 +750,14 @@ } else { data_reduction_proxy_config.proxy_rules().ParseFromString( - "http=" + data_reduction_proxy + ",direct://;"); + "http=" + + params() + ->proxies_for_http() + .front() + .proxy_server() + .host_port_pair() + .ToString() + + ",direct://;"); data_reduction_proxy_config.set_id(1); } EXPECT_NE(test.use_direct_proxy, data_reduction_proxy_config.is_valid()); @@ -798,6 +802,7 @@ "Chrome-Proxy: q=low\r\n" "Content-Length: 1000\r\n\r\n"; + params()->UseNonSecureProxiesForHttp(); std::unique_ptr<net::URLRequest> request = FetchURLRequest( GURL("http://example.com/path/"), nullptr, kDrpResponseHeaders, 1000); @@ -825,6 +830,7 @@ "Via: 1.1 Chrome-Compression-Proxy-Suffix\r\n" "Content-Length: 10\r\n\r\n"; + params()->UseNonSecureProxiesForHttp(); { base::HistogramTester histogram_tester; base::TimeDelta advance_time(base::TimeDelta::FromSeconds(1)); @@ -882,6 +888,9 @@ }, }; for (const auto& test : tests) { + if (!test.holdback) + params()->UseNonSecureProxiesForHttp(); + base::FieldTrialList field_trial_list(nullptr); ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( "DataCompressionProxyHoldback", test.holdback ? "Enabled" : "Control")); @@ -904,6 +913,7 @@ "Via: 1.1 Chrome-Compression-Proxy\r\n" "X-Original-Content-Length: 10000\r\n\r\n"; + params()->UseNonSecureProxiesForHttp(); std::unique_ptr<net::URLRequest> request = FetchURLRequest( GURL("http://example.com/path/"), nullptr, kDrpResponseHeaders, 0); @@ -921,6 +931,7 @@ int64_t baseline_received_bytes = total_received_bytes(); int64_t baseline_original_received_bytes = total_original_received_bytes(); + params()->UseNonSecureProxiesForHttp(); net::MockWrite writes[] = { net::MockWrite("GET http://example.com/path/ HTTP/1.1\r\n" "Host: example.com\r\n"), @@ -945,6 +956,7 @@ int64_t baseline_received_bytes = total_received_bytes(); int64_t baseline_original_received_bytes = total_original_received_bytes(); + params()->UseNonSecureProxiesForHttp(); net::MockRead reads[] = {net::MockRead("HTTP/1.1 "), net::MockRead(net::ASYNC, net::ERR_ABORTED)}; net::StaticSocketDataProvider socket(reads, arraysize(reads), nullptr, 0); @@ -1028,6 +1040,7 @@ 100, 300}, }; + params()->UseNonSecureProxiesForHttp(); for (const auto& test : test_cases) { base::HistogramTester histogram_tester; int64_t baseline_received_bytes = total_received_bytes();
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc index 12b12a2..75fdb3b 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
@@ -126,6 +126,7 @@ &default_network_delegate_)); default_context_->set_network_delegate(&default_network_delegate_); default_context_->set_net_log(test_context_->net_log()); + test_context_->config()->test_params()->UseNonSecureProxiesForHttp(); } ~DataReductionProxyInterceptorTest() override { @@ -298,6 +299,7 @@ .WithURLRequestContext(&context_) .WithMockClientSocketFactory(&mock_socket_factory_) .Build(); + drp_test_context_->config()->test_params()->UseNonSecureProxiesForHttp(); drp_test_context_->AttachToURLRequestContext(&context_storage_); context_.set_client_socket_factory(&mock_socket_factory_); proxy_delegate_ = drp_test_context_->io_data()->CreateProxyDelegate();
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc index 0d580297..9f6df6c 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
@@ -37,6 +37,7 @@ DataReductionProxyTestContext::Builder() .Build(); TestDataReductionProxyConfig* config = test_context->config(); + config->test_params()->UseNonSecureProxiesForHttp(); net::ProxyServer origin = config->test_params()->proxies_for_http().front().proxy_server();
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index dba17a0..30ce6c4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -884,8 +884,8 @@ net::ProxyInfo data_reduction_proxy_info; net::ProxyRetryInfoMap proxy_retry_info; std::string data_reduction_proxy; - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); + data_reduction_proxy_info.UseProxyServer( + params()->proxies_for_http().front().proxy_server()); net::HttpRequestHeaders headers; // Call network delegate methods to ensure that appropriate chrome proxy @@ -949,11 +949,13 @@ net::ProxyInfo data_reduction_proxy_info; std::string proxy; - if (tests[i].is_data_reduction_proxy) - base::TrimString(params()->DefaultOrigin(), "/", &proxy); - else + if (tests[i].is_data_reduction_proxy) { + data_reduction_proxy_info.UseProxyServer( + params()->proxies_for_http().front().proxy_server()); + } else { base::TrimString(kOtherProxy, "/", &proxy); - data_reduction_proxy_info.UseNamedProxy(proxy); + data_reduction_proxy_info.UseNamedProxy(proxy); + } // Needed as a parameter, but functionality is not tested. TestPreviewsDecider test_previews_decider; @@ -1091,12 +1093,12 @@ for (const auto& test : tests) { net::ProxyInfo data_reduction_proxy_info; - std::string data_reduction_proxy; - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - if (test.used_data_reduction_proxy) - data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); - else + if (test.used_data_reduction_proxy) { + data_reduction_proxy_info.UseProxyServer( + params()->proxies_for_http().front().proxy_server()); + } else { data_reduction_proxy_info.UseNamedProxy("port.of.other.proxy"); + } // Main frame loaded. Lo-Fi should be used. net::HttpRequestHeaders headers; net::ProxyRetryInfoMap proxy_retry_info; @@ -1199,9 +1201,8 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RedirectRequestDataCleared) { Init(USE_INSECURE_PROXY, false); net::ProxyInfo data_reduction_proxy_info; - std::string data_reduction_proxy; - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); + data_reduction_proxy_info.UseProxyServer( + params()->proxies_for_http().front().proxy_server()); // Main frame loaded. Lo-Fi should be used. net::HttpRequestHeaders headers_original; @@ -1840,9 +1841,8 @@ // This is unaffacted by brotil and insecure proxy. Init(USE_INSECURE_PROXY, false /* enable_brotli_globally */); net::ProxyInfo data_reduction_proxy_info; - std::string data_reduction_proxy; - base::TrimString(params()->DefaultOrigin(), "/", &data_reduction_proxy); - data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); + data_reduction_proxy_info.UseProxyServer( + params()->proxies_for_http().front().proxy_server()); std::unique_ptr<net::URLRequest> request = context()->CreateRequest(GURL(kTestURL), net::RequestPriority::IDLE,
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc index 7b6e0c7..66c9a2d0 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
@@ -31,8 +31,6 @@ const char kControl[] = "Control"; const char kDisabled[] = "Disabled"; const char kLitePage[] = "Enabled_Preview"; -const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443"; -const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80"; const char kDefaultSecureProxyCheckUrl[] = "http://check.googlezip.net/connect"; const char kDefaultWarmupUrl[] = "http://check.googlezip.net/generate_204"; @@ -470,41 +468,9 @@ DataReductionProxyTypeInfo::~DataReductionProxyTypeInfo() {} DataReductionProxyParams::DataReductionProxyParams() - : DataReductionProxyParams(true) {} - -DataReductionProxyParams::~DataReductionProxyParams() {} - -DataReductionProxyParams::DataReductionProxyParams(bool should_call_init) : use_override_proxies_for_http_(false) { - if (should_call_init) { - bool result = Init(); - DCHECK(result); - } -} - -void DataReductionProxyParams::SetProxiesForHttpForTesting( - const std::vector<DataReductionProxyServer>& proxies_for_http) { - proxies_for_http_ = proxies_for_http; -} - -bool DataReductionProxyParams::Init() { - InitWithoutChecks(); - // Verify that all necessary params are set. - if (!origin_.is_valid()) { - DVLOG(1) << "Invalid data reduction proxy origin: " << origin_.ToURI(); - return false; - } - - if (!fallback_origin_.is_valid()) { - DVLOG(1) << "Invalid data reduction proxy fallback origin: " - << fallback_origin_.ToURI(); - return false; - } - return true; -} - -void DataReductionProxyParams::InitWithoutChecks() { - DCHECK(proxies_for_http_.empty()); + static const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443"; + static const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80"; use_override_proxies_for_http_ = params::GetOverrideProxiesForHttpFromCommandLine( @@ -512,33 +478,39 @@ const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - std::string origin; - origin = command_line.GetSwitchValueASCII(switches::kDataReductionProxy); + std::string origin = + command_line.GetSwitchValueASCII(switches::kDataReductionProxy); std::string fallback_origin = command_line.GetSwitchValueASCII(switches::kDataReductionProxyFallback); // Set from preprocessor constants those params that are not specified on the // command line. if (origin.empty()) - origin = GetDefaultOrigin(); + origin = kDefaultSpdyOrigin; if (fallback_origin.empty()) - fallback_origin = GetDefaultFallbackOrigin(); + fallback_origin = kDefaultFallbackOrigin; - origin_ = net::ProxyServer::FromURI(origin, net::ProxyServer::SCHEME_HTTP); - fallback_origin_ = + net::ProxyServer origin_proxy_server = + net::ProxyServer::FromURI(origin, net::ProxyServer::SCHEME_HTTP); + net::ProxyServer fallback_proxy_server = net::ProxyServer::FromURI(fallback_origin, net::ProxyServer::SCHEME_HTTP); - if (origin_.is_valid()) { - // |origin_| is the core proxy server. + if (origin_proxy_server.is_valid()) { proxies_for_http_.push_back( - DataReductionProxyServer(origin_, ProxyServer::CORE)); + DataReductionProxyServer(origin_proxy_server, ProxyServer::CORE)); } - if (fallback_origin_.is_valid()) { - // |fallback| is also a core proxy server. + if (fallback_proxy_server.is_valid()) { proxies_for_http_.push_back( - DataReductionProxyServer(fallback_origin_, ProxyServer::CORE)); + DataReductionProxyServer(fallback_proxy_server, ProxyServer::CORE)); } } +DataReductionProxyParams::~DataReductionProxyParams() {} + +void DataReductionProxyParams::SetProxiesForHttpForTesting( + const std::vector<DataReductionProxyServer>& proxies_for_http) { + proxies_for_http_ = proxies_for_http; +} + const std::vector<DataReductionProxyServer>& DataReductionProxyParams::proxies_for_http() const { if (use_override_proxies_for_http_) @@ -546,13 +518,4 @@ return proxies_for_http_; } -// TODO(kundaji): Remove tests for macro definitions. -std::string DataReductionProxyParams::GetDefaultOrigin() const { - return kDefaultSpdyOrigin; -} - -std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const { - return kDefaultFallbackOrigin; -} - } // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h index f65969a..96f7ba6 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h
@@ -11,7 +11,6 @@ #include "base/macros.h" #include "base/strings/string_piece.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_config_values.h" -#include "net/proxy/proxy_server.h" #include "url/gurl.h" namespace net { @@ -213,30 +212,9 @@ const std::vector<DataReductionProxyServer>& proxies_for_http() const override; - protected: - // Test constructor that optionally won't call Init(); - explicit DataReductionProxyParams(bool should_call_init); - - // Initialize the values of the proxies, and secure proxy check URL, from - // command line flags and preprocessor constants, and check that there are - // corresponding definitions for the allowed configurations. - bool Init(); - - // Initialize the values of the proxies, and secure proxy check URL from - // command line flags and preprocessor constants. - void InitWithoutChecks(); - - // Returns the corresponding string from preprocessor constants if defined, - // and an empty string otherwise. - virtual std::string GetDefaultOrigin() const; - virtual std::string GetDefaultFallbackOrigin() const; - private: std::vector<DataReductionProxyServer> proxies_for_http_; - net::ProxyServer origin_; - net::ProxyServer fallback_origin_; - bool use_override_proxies_for_http_; std::vector<DataReductionProxyServer> override_data_reduction_proxy_servers_;
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc index e639988..e79393a 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
@@ -4,52 +4,52 @@ #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" -namespace { -// Test values to replace the values specified in preprocessor defines. -static const char kDefaultOrigin[] = "origin.net:80"; -static const char kDefaultFallbackOrigin[] = "fallback.net:80"; - -static const char kFlagOrigin[] = "https://origin.org:443"; -static const char kFlagFallbackOrigin[] = "fallback.org:80"; -} +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_server.h" namespace data_reduction_proxy { + TestDataReductionProxyParams::TestDataReductionProxyParams() - : DataReductionProxyParams(false) { - init_result_ = Init(); + : DataReductionProxyParams(), override_non_secure_proxies_(false) { + proxies_for_http_.push_back(DataReductionProxyServer( + net::ProxyServer::FromURI("origin.net:80", net::ProxyServer::SCHEME_HTTP), + ProxyServer::CORE)); + proxies_for_http_.push_back(DataReductionProxyServer( + net::ProxyServer::FromURI("fallback.net:80", + net::ProxyServer::SCHEME_HTTP), + ProxyServer::CORE)); } -bool TestDataReductionProxyParams::init_result() const { - return init_result_; -} + TestDataReductionProxyParams::~TestDataReductionProxyParams() {} -void TestDataReductionProxyParams::SetProxiesForHttp( - const std::vector<DataReductionProxyServer>& proxies) { - SetProxiesForHttpForTesting(proxies); -} -// Test values to replace the values specified in preprocessor defines. -std::string TestDataReductionProxyParams::DefaultOrigin() { - return kDefaultOrigin; -} + void TestDataReductionProxyParams::SetProxiesForHttp( + const std::vector<DataReductionProxyServer>& proxies) { + DCHECK_GE(2u, proxies_for_http_.size()); -std::string TestDataReductionProxyParams::DefaultFallbackOrigin() { - return kDefaultFallbackOrigin; -} + size_t secure_proxies = 0; + for (const auto& ps : proxies) + if (ps.proxy_server().is_https()) + secure_proxies++; + DCHECK_GE(1u, secure_proxies); -std::string TestDataReductionProxyParams::FlagOrigin() { - return kFlagOrigin; -} + SetProxiesForHttpForTesting(proxies); + proxies_for_http_.clear(); + for (const auto& ps : proxies) { + if (override_non_secure_proxies_ && ps.proxy_server().is_https()) { + proxies_for_http_.push_back(DataReductionProxyServer( + net::ProxyServer::FromURI("origin.net:80", + net::ProxyServer::SCHEME_HTTP), + ProxyServer::CORE)); + } else { + proxies_for_http_.push_back(ps); + } + } + } -std::string TestDataReductionProxyParams::FlagFallbackOrigin() { - return kFlagFallbackOrigin; -} - -std::string TestDataReductionProxyParams::GetDefaultOrigin() const { - return kDefaultOrigin; -} - -std::string TestDataReductionProxyParams::GetDefaultFallbackOrigin() const { - return kDefaultFallbackOrigin; + const std::vector<DataReductionProxyServer>& + TestDataReductionProxyParams::proxies_for_http() const { + if (override_non_secure_proxies_) + return proxies_for_http_; + return DataReductionProxyParams::proxies_for_http(); } } // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h index 04e5d6e..81906331 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h
@@ -16,24 +16,23 @@ class TestDataReductionProxyParams : public DataReductionProxyParams { public: TestDataReductionProxyParams(); - bool init_result() const; + + ~TestDataReductionProxyParams() override; void SetProxiesForHttp(const std::vector<DataReductionProxyServer>& proxies); - // Test values to replace the values specified in preprocessor defines. - static std::string DefaultOrigin(); - static std::string DefaultFallbackOrigin(); + // Use non-secure data saver proxies. Useful when a URL request is fetched + // from non-SSL mock sockets. + void UseNonSecureProxiesForHttp() { override_non_secure_proxies_ = true; } - static std::string FlagOrigin(); - static std::string FlagFallbackOrigin(); - - protected: - std::string GetDefaultOrigin() const override; - - std::string GetDefaultFallbackOrigin() const override; + const std::vector<DataReductionProxyServer>& proxies_for_http() + const override; private: - bool init_result_; + bool override_non_secure_proxies_; + + std::vector<DataReductionProxyServer> proxies_for_http_; }; + } // namespace data_reduction_proxy #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS_TEST_UTILS_H_
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc index 2da780a..63e8cda5 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
@@ -31,10 +31,6 @@ namespace data_reduction_proxy { class DataReductionProxyParamsTest : public testing::Test { public: - void CheckParams(const TestDataReductionProxyParams& params, - bool expected_init_result) { - EXPECT_EQ(expected_init_result, params.init_result()); - } void CheckValues(const TestDataReductionProxyParams& params, const std::string& expected_origin, const std::string& expected_fallback_origin) { @@ -57,18 +53,16 @@ TEST_F(DataReductionProxyParamsTest, EverythingDefined) { TestDataReductionProxyParams params; - CheckParams(params, true); std::vector<DataReductionProxyServer> expected_proxies; // Both the origin and fallback proxy must have type CORE. expected_proxies.push_back(DataReductionProxyServer( - net::ProxyServer::FromURI(TestDataReductionProxyParams::DefaultOrigin(), + net::ProxyServer::FromURI("https://proxy.googlezip.net:443", net::ProxyServer::SCHEME_HTTP), ProxyServer::CORE)); expected_proxies.push_back(DataReductionProxyServer( - net::ProxyServer::FromURI( - TestDataReductionProxyParams::DefaultFallbackOrigin(), - net::ProxyServer::SCHEME_HTTP), + net::ProxyServer::FromURI("compress.googlezip.net:80", + net::ProxyServer::SCHEME_HTTP), ProxyServer::CORE)); EXPECT_EQ(expected_proxies, params.proxies_for_http()); @@ -76,15 +70,11 @@ TEST_F(DataReductionProxyParamsTest, Flags) { base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kDataReductionProxy, - TestDataReductionProxyParams::FlagOrigin()); + switches::kDataReductionProxy, "http://ovveride-1.com/"); base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kDataReductionProxyFallback, - TestDataReductionProxyParams::FlagFallbackOrigin()); + switches::kDataReductionProxyFallback, "http://ovveride-2.com/"); TestDataReductionProxyParams params; - CheckParams(params, true); - CheckValues(params, TestDataReductionProxyParams::FlagOrigin(), - TestDataReductionProxyParams::FlagFallbackOrigin()); + CheckValues(params, "http://ovveride-1.com/", "http://ovveride-2.com/"); } TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
diff --git a/components/download/internal/controller_impl.cc b/components/download/internal/controller_impl.cc index e97ff0a8..cd69bdda 100644 --- a/components/download/internal/controller_impl.cc +++ b/components/download/internal/controller_impl.cc
@@ -57,6 +57,18 @@ return Client::FailureReason::UNKNOWN; } +// Helper function to determine if more downloads can be activated based on +// configuration. +bool CanActivateMoreDownloads(Configuration* config, + uint32_t active_count, + uint32_t paused_count) { + if (config->max_concurrent_downloads <= paused_count + active_count || + config->max_running_downloads <= active_count) { + return false; + } + return true; +} + } // namespace ControllerImpl::ControllerImpl( @@ -802,28 +814,35 @@ if (initializing_internals_) return; - // Check the configuration to throttle number of downloads. + // Check all the entries and the configuration to throttle number of + // downloads. std::map<Entry::State, uint32_t> entries_states; - for (const auto* const entry : model_->PeekEntries()) + Model::EntryList scheduling_candidates; + for (auto* const entry : model_->PeekEntries()) { entries_states[entry->state]++; + // Only schedule background tasks based on available and active entries. + if (entry->state == Entry::State::AVAILABLE || + entry->state == Entry::State::ACTIVE) { + scheduling_candidates.emplace_back(entry); + } + } + uint32_t paused_count = entries_states[Entry::State::PAUSED]; uint32_t active_count = entries_states[Entry::State::ACTIVE]; - if (config_->max_concurrent_downloads <= paused_count + active_count || - config_->max_running_downloads <= active_count) { - return; - } - Entry* next = scheduler_->Next( - model_->PeekEntries(), device_status_listener_->CurrentDeviceStatus()); + while (CanActivateMoreDownloads(config_, active_count, paused_count)) { + Entry* next = scheduler_->Next( + model_->PeekEntries(), device_status_listener_->CurrentDeviceStatus()); + if (!next) + break; - while (next) { DCHECK_EQ(Entry::State::AVAILABLE, next->state); TransitTo(next, Entry::State::ACTIVE, model_.get()); + active_count++; UpdateDriverState(next); - next = scheduler_->Next(model_->PeekEntries(), - device_status_listener_->CurrentDeviceStatus()); } - scheduler_->Reschedule(model_->PeekEntries()); + + scheduler_->Reschedule(scheduling_candidates); } void ControllerImpl::HandleExternalDownload(const std::string& guid,
diff --git a/components/download/internal/controller_impl_unittest.cc b/components/download/internal/controller_impl_unittest.cc index 992eaaf..561a482 100644 --- a/components/download/internal/controller_impl_unittest.cc +++ b/components/download/internal/controller_impl_unittest.cc
@@ -30,6 +30,7 @@ #include "testing/gtest/include/gtest/gtest.h" using testing::_; +using testing::NiceMock; using testing::Return; namespace download { @@ -136,7 +137,7 @@ auto model = base::MakeUnique<ModelImpl>(std::move(store)); auto device_status_listener = base::MakeUnique<test::TestDeviceStatusListener>(); - auto scheduler = base::MakeUnique<MockScheduler>(); + auto scheduler = base::MakeUnique<NiceMock<MockScheduler>>(); auto task_scheduler = base::MakeUnique<MockTaskScheduler>(); auto download_file_dir = base::FilePath(kDownloadDirPath); @@ -1179,7 +1180,7 @@ // Hit the max running configuration threshold, nothing should be called. EXPECT_CALL(*scheduler_, Next(_, _)).Times(0); - EXPECT_CALL(*scheduler_, Reschedule(_)).Times(0); + EXPECT_CALL(*scheduler_, Reschedule(_)).Times(1); driver_->MakeReady(); task_runner_->RunUntilIdle(); @@ -1190,8 +1191,9 @@ // paused downloads. TEST_F(DownloadServiceControllerImplTest, ThrottlingConfigMaxConcurrent) { Entry entry1 = test::BuildBasicEntry(Entry::State::AVAILABLE); - Entry entry2 = test::BuildBasicEntry(Entry::State::PAUSED); - std::vector<Entry> entries = {entry1, entry2}; + Entry entry2 = test::BuildBasicEntry(Entry::State::AVAILABLE); + Entry entry3 = test::BuildBasicEntry(Entry::State::PAUSED); + std::vector<Entry> entries = {entry1, entry2, entry3}; EXPECT_CALL(*client_, OnServiceInitialized(_)).Times(1); @@ -1206,16 +1208,23 @@ // Can have one more download due to max concurrent configuration. testing::InSequence seq; + EXPECT_EQ(Entry::State::AVAILABLE, model_->Get(entry1.guid)->state); EXPECT_CALL(*scheduler_, Next(_, _)) .Times(1) .WillOnce(Return(model_->Get(entry1.guid))) .RetiresOnSaturation(); - EXPECT_CALL(*scheduler_, Next(_, _)).Times(1).RetiresOnSaturation(); + // |scheduler_| will poll entry2 on next time, but it should not change the + // state of entry2 due to max running download configuration. + ON_CALL(*scheduler_, Next(_, _)) + .WillByDefault(Return(model_->Get(entry2.guid))); + EXPECT_CALL(*scheduler_, Reschedule(_)).Times(1); driver_->MakeReady(); task_runner_->RunUntilIdle(); EXPECT_EQ(Entry::State::ACTIVE, model_->Get(entry1.guid)->state); + EXPECT_EQ(Entry::State::AVAILABLE, model_->Get(entry2.guid)->state); + EXPECT_EQ(Entry::State::PAUSED, model_->Get(entry3.guid)->state); } } // namespace download
diff --git a/components/download/internal/scheduler/scheduler.h b/components/download/internal/scheduler/scheduler.h index cbad6a1d47..58d835a 100644 --- a/components/download/internal/scheduler/scheduler.h +++ b/components/download/internal/scheduler/scheduler.h
@@ -17,8 +17,9 @@ // download tasks. class Scheduler { public: - // Reschedule another background platform task. Called when downloads are - // added or removed or the criteria has changed. + // Reschedule another background platform task based on the scheduling + // parameters of |entries|. Should only pass in entries in active or available + // state. virtual void Reschedule(const Model::EntryList& entries) = 0; // Returns the next download that should be processed based on scheduling
diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc index dc0977c..f9cd7b56 100644 --- a/components/exo/buffer.cc +++ b/components/exo/buffer.cc
@@ -23,9 +23,9 @@ #include "base/trace_event/trace_event_argument.h" #include "cc/output/context_provider.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" #include "components/exo/layer_tree_frame_sink_holder.h" #include "components/viz/common/quads/resource_format.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "ui/aura/env.h"
diff --git a/components/exo/buffer_unittest.cc b/components/exo/buffer_unittest.cc index 02423ea..32c78ea 100644 --- a/components/exo/buffer_unittest.cc +++ b/components/exo/buffer_unittest.cc
@@ -32,7 +32,7 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - const cc::FrameSinkId arbitrary_frame_sink_id(1, 1); + const viz::FrameSinkId arbitrary_frame_sink_id(1, 1); LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder = surface->layer_tree_frame_sink_holder(); @@ -69,7 +69,7 @@ gfx::Size buffer_size(256, 256); std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); - const cc::FrameSinkId arbitrary_frame_sink_id(1, 1); + const viz::FrameSinkId arbitrary_frame_sink_id(1, 1); std::unique_ptr<Surface> surface(new Surface); LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder = surface->layer_tree_frame_sink_holder();
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index 4f6ab06..0080c51 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -233,7 +233,7 @@ return window->GetProperty(kSurfaceKey); } -cc::SurfaceId Surface::GetSurfaceId() const { +viz::SurfaceId Surface::GetSurfaceId() const { return window_->GetSurfaceId(); }
diff --git a/components/exo/surface.h b/components/exo/surface.h index c6037f0..ae168733 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -68,7 +68,7 @@ aura::Window* window() { return window_.get(); } - cc::SurfaceId GetSurfaceId() const; + viz::SurfaceId GetSurfaceId() const; LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder() { return layer_tree_frame_sink_holder_.get();
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc index d7301cc..7109ace8 100644 --- a/components/exo/surface_unittest.cc +++ b/components/exo/surface_unittest.cc
@@ -100,7 +100,7 @@ } const cc::CompositorFrame& GetFrameFromSurface(Surface* surface) { - cc::SurfaceId surface_id = surface->GetSurfaceId(); + viz::SurfaceId surface_id = surface->GetSurfaceId(); cc::SurfaceManager* surface_manager = aura::Env::GetInstance() ->context_factory_private() ->GetFrameSinkManager()
diff --git a/components/feature_engagement_tracker/README.md b/components/feature_engagement_tracker/README.md index c79afd9bb..9c560d92 100644 --- a/components/feature_engagement_tracker/README.md +++ b/components/feature_engagement_tracker/README.md
@@ -256,6 +256,7 @@ "event_used": "{EventConfig}", "event_trigger": "{EventConfig}", "event_???": "{EventConfig}", + "x_???": "..." } ``` @@ -286,6 +287,20 @@ that must have been met. * Name must match `/^event_[a-zA-Z0-9-_]+$/` and not be `event_used` or `event_trigger`. +* `x_???` + * Any parameter starting with `x_` is ignored by the feature engagement + tracker. + * A typical use case for this would be if there are multiple experiments + for the same in-product help, and you want to specify different strings + to use in each of them, such as: + + ``` + "x_promo_string": "IDS_MYFUN_PROMO_2" + ``` + + * Failing to use an `x_`-prefix for parameters unrelated to the + `FeatureConfig` will end up being recorded as `FAILURE_UNKNOWN_KEY` in + the `InProductHelp.Config.ParsingEvent` histogram. **Examples**
diff --git a/components/feature_engagement_tracker/internal/chrome_variations_configuration.cc b/components/feature_engagement_tracker/internal/chrome_variations_configuration.cc index fe99eca..bb1f35f 100644 --- a/components/feature_engagement_tracker/internal/chrome_variations_configuration.cc +++ b/components/feature_engagement_tracker/internal/chrome_variations_configuration.cc
@@ -36,6 +36,7 @@ const char kEventConfigKeyPrefix[] = "event_"; const char kSessionRateKey[] = "session_rate"; const char kAvailabilityKey[] = "availability"; +const char kIgnoredKeyPrefix[] = "x_"; const char kEventConfigDataNameKey[] = "name"; const char kEventConfigDataComparatorKey[] = "comparator"; @@ -271,8 +272,13 @@ continue; } config.event_configs.insert(event_config); + } else if (base::StartsWith(key, kIgnoredKeyPrefix, + base::CompareCase::INSENSITIVE_ASCII)) { + // Intentionally ignoring parameter using registered ignored prefix. + DVLOG(2) << "Ignoring unknown key when parsing config for feature " + << feature->name << ": " << key; } else { - DVLOG(1) << "Ignoring unknown key when parsing config for feature " + DVLOG(1) << "Unknown key found when parsing config for feature " << feature->name << ": " << key; stats::RecordConfigParsingEvent( stats::ConfigParsingEvent::FAILURE_UNKNOWN_KEY);
diff --git a/components/feature_engagement_tracker/internal/chrome_variations_configuration_unittest.cc b/components/feature_engagement_tracker/internal/chrome_variations_configuration_unittest.cc index 63f4e922..d8027dd 100644 --- a/components/feature_engagement_tracker/internal/chrome_variations_configuration_unittest.cc +++ b/components/feature_engagement_tracker/internal/chrome_variations_configuration_unittest.cc
@@ -281,10 +281,13 @@ } TEST_F(ChromeVariationsConfigurationTest, IgnoresInvalidConfigKeys) { + base::HistogramTester histogram_tester; std::map<std::string, std::string> foo_params; foo_params["event_used"] = "name:eu;comparator:any;window:0;storage:360"; foo_params["event_trigger"] = "name:et;comparator:any;window:0;storage:360"; - foo_params["not_there_yet"] = "bogus value"; + foo_params["not_there_yet"] = "bogus value"; // Unrecognized. + foo_params["still_not_there"] = "another bogus value"; // Unrecognized. + foo_params["x_this_is_ignored"] = "this value is ignored"; // Ignored. SetFeatureParams(kTestFeatureFoo, foo_params); std::vector<const base::Feature*> features = {&kTestFeatureFoo}; @@ -298,6 +301,11 @@ expected_foo.used = EventConfig("eu", Comparator(ANY, 0), 0, 360); expected_foo.trigger = EventConfig("et", Comparator(ANY, 0), 0, 360); EXPECT_EQ(expected_foo, foo); + + // Exactly 2 keys should be unrecognized and not ignored. + histogram_tester.ExpectBucketCount( + kConfigParseEventName, + static_cast<int>(stats::ConfigParsingEvent::FAILURE_UNKNOWN_KEY), 2); } TEST_F(ChromeVariationsConfigurationTest, IgnoresInvalidEventConfigTokens) {
diff --git a/components/feature_engagement_tracker/public/feature_list.cc b/components/feature_engagement_tracker/public/feature_list.cc index a045c43..92e2fd3 100644 --- a/components/feature_engagement_tracker/public/feature_list.cc +++ b/components/feature_engagement_tracker/public/feature_list.cc
@@ -25,6 +25,11 @@ &kIPHIncognitoWindowFeature, &kIPHNewTabFeature, #endif // defined(OS_WIN) || defined(OS_LINUX) +#if defined(OS_IOS) + &kIPHNewTabTipFeature, + &kIPHNewIncognitoTabTipFeature, + &kIPHBadgedReadingListFeature, +#endif // defined(OS_IOS) }; } // namespace
diff --git a/components/feature_engagement_tracker/public/feature_list.h b/components/feature_engagement_tracker/public/feature_list.h index 87858066..a815e40 100644 --- a/components/feature_engagement_tracker/public/feature_list.h +++ b/components/feature_engagement_tracker/public/feature_list.h
@@ -56,6 +56,11 @@ DEFINE_VARIATION_PARAM(kIPHIncognitoWindowFeature, "IPH_IncognitoWindow"); DEFINE_VARIATION_PARAM(kIPHNewTabFeature, "IPH_NewTab"); #endif // defined(OS_WIN) || defined(OS_LINUX) +#if defined(OS_IOS) +DEFINE_VARIATION_PARAM(kIPHNewTabTipFeature, "IPH_NewTabTip"); +DEFINE_VARIATION_PARAM(kIPHNewIncognitoTabTipFeature, "IPH_NewIncognitoTabTip"); +DEFINE_VARIATION_PARAM(kIPHBadgedReadingListFeature, "IPH_BadgedReadingList"); +#endif // defined(OS_IOS) } // namespace @@ -73,6 +78,10 @@ #elif defined(OS_WIN) || defined(OS_LINUX) VARIATION_ENTRY(kIPHIncognitoWindowFeature), VARIATION_ENTRY(kIPHNewTabFeature), +#elif defined(OS_IOS) + VARIATION_ENTRY(kIPHNewTabTipFeature), + VARIATION_ENTRY(kIPHNewIncognitoTabTipFeature), + VARIATION_ENTRY(kIPHBadgedReadingListFeature), #else VARIATION_ENTRY(kIPHDummyFeature), // Ensures non-empty array. #endif
diff --git a/components/leveldb/env_mojo.cc b/components/leveldb/env_mojo.cc index 862431cd..00bc573 100644 --- a/components/leveldb/env_mojo.cc +++ b/components/leveldb/env_mojo.cc
@@ -45,7 +45,12 @@ char buf[512]; snprintf(buf, sizeof(buf), "%s (MojoFSError: %d::%s)", err_str.c_str(), method, MethodIDToString(method)); - return Status::IOError(filename, buf); + + if (error == FileError::NOT_FOUND) { + return Status::NotFound(filename, buf); + } else { + return Status::IOError(filename, buf); + } } class MojoFileLock : public FileLock {
diff --git a/components/metrics/cloned_install_detector.cc b/components/metrics/cloned_install_detector.cc index 7e9be8c..d9e752d 100644 --- a/components/metrics/cloned_install_detector.cc +++ b/components/metrics/cloned_install_detector.cc
@@ -14,6 +14,7 @@ #include "base/metrics/metrics_hashes.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" +#include "base/task_scheduler/post_task.h" #include "components/metrics/machine_id_provider.h" #include "components/metrics/metrics_pref_names.h" #include "components/prefs/pref_registry_simple.h" @@ -47,23 +48,19 @@ } // namespace -ClonedInstallDetector::ClonedInstallDetector(MachineIdProvider* raw_id_provider) - : raw_id_provider_(raw_id_provider), weak_ptr_factory_(this) { -} +ClonedInstallDetector::ClonedInstallDetector() : weak_ptr_factory_(this) {} ClonedInstallDetector::~ClonedInstallDetector() { } -void ClonedInstallDetector::CheckForClonedInstall( - PrefService* local_state, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - base::PostTaskAndReplyWithResult( - task_runner.get(), +void ClonedInstallDetector::CheckForClonedInstall(PrefService* local_state) { + base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, - base::Bind(&MachineIdProvider::GetMachineId, raw_id_provider_), + {base::MayBlock(), base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + base::Bind(&MachineIdProvider::GetMachineId), base::Bind(&ClonedInstallDetector::SaveMachineId, - weak_ptr_factory_.GetWeakPtr(), - local_state)); + weak_ptr_factory_.GetWeakPtr(), local_state)); } void ClonedInstallDetector::SaveMachineId(PrefService* local_state,
diff --git a/components/metrics/cloned_install_detector.h b/components/metrics/cloned_install_detector.h index 0609122..6a728ae 100644 --- a/components/metrics/cloned_install_detector.h +++ b/components/metrics/cloned_install_detector.h
@@ -7,25 +7,18 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" class PrefRegistrySimple; class PrefService; -namespace base { -class SingleThreadTaskRunner; -} - namespace metrics { -class MachineIdProvider; - // A class for detecting if an install is cloned. It does this by detecting // when the hardware running Chrome changes. class ClonedInstallDetector { public: - explicit ClonedInstallDetector(MachineIdProvider* raw_id_provider); + ClonedInstallDetector(); virtual ~ClonedInstallDetector(); // Posts a task to |task_runner| to generate a machine ID and store it to a @@ -34,9 +27,7 @@ // 24-bit value based off of machine characteristics. This value should never // be sent over the network. // TODO(jwd): Implement change detection. - void CheckForClonedInstall( - PrefService* local_state, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); + void CheckForClonedInstall(PrefService* local_state); static void RegisterPrefs(PrefRegistrySimple* registry); @@ -49,7 +40,6 @@ // task. void SaveMachineId(PrefService* local_state, const std::string& raw_id); - scoped_refptr<MachineIdProvider> raw_id_provider_; base::WeakPtrFactory<ClonedInstallDetector> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ClonedInstallDetector);
diff --git a/components/metrics/cloned_install_detector_unittest.cc b/components/metrics/cloned_install_detector_unittest.cc index 92625996..2e2ebd7 100644 --- a/components/metrics/cloned_install_detector_unittest.cc +++ b/components/metrics/cloned_install_detector_unittest.cc
@@ -27,10 +27,8 @@ TestingPrefServiceSimple prefs; ClonedInstallDetector::RegisterPrefs(prefs.registry()); - std::unique_ptr<ClonedInstallDetector> detector( - new ClonedInstallDetector(MachineIdProvider::CreateInstance())); - - detector->SaveMachineId(&prefs, kTestRawId); + ClonedInstallDetector detector; + detector.SaveMachineId(&prefs, kTestRawId); EXPECT_EQ(kTestHashedId, prefs.GetInteger(prefs::kMetricsMachineId)); } @@ -42,10 +40,8 @@ // Save a machine id that will cause a clone to be detected. prefs.SetInteger(prefs::kMetricsMachineId, kTestHashedId + 1); - std::unique_ptr<ClonedInstallDetector> detector( - new ClonedInstallDetector(MachineIdProvider::CreateInstance())); - - detector->SaveMachineId(&prefs, kTestRawId); + ClonedInstallDetector detector; + detector.SaveMachineId(&prefs, kTestRawId); EXPECT_TRUE(prefs.GetBoolean(prefs::kMetricsResetIds)); }
diff --git a/components/metrics/machine_id_provider.h b/components/metrics/machine_id_provider.h index d7fcc447..b7a2704 100644 --- a/components/metrics/machine_id_provider.h +++ b/components/metrics/machine_id_provider.h
@@ -8,37 +8,28 @@ #include <string> #include "base/macros.h" -#include "base/memory/ref_counted.h" namespace metrics { // Provides machine characteristics used as a machine id. The implementation is -// platform specific with a default implementation that gives an empty id. The -// class is ref-counted thread safe so it can be used to post to the FILE thread -// and communicate back to the UI thread. -// This raw machine id should not be stored or transmitted over the network. -// TODO(jwd): Simplify implementation to get rid of the need for -// RefCountedThreadSafe (crbug.com/354882). -class MachineIdProvider : public base::RefCountedThreadSafe<MachineIdProvider> { +// platform specific. GetMachineId() must be called on a thread which allows +// I/O. GetMachineId() must not be called if HasId() returns false on this +// platform. +class MachineIdProvider { public: + // Returns true if this platform provides a non-empty GetMachineId(). This is + // useful to avoid an async call to GetMachineId() on platforms with no + // implementation. + static bool HasId(); + // Get a string containing machine characteristics, to be used as a machine // id. The implementation is platform specific, with a default implementation // returning an empty string. // The return value should not be stored to disk or transmitted. - std::string GetMachineId(); - - // Returns a pointer to a new MachineIdProvider or NULL if there is no - // provider implemented on a given platform. This is done to avoid posting a - // task to the FILE thread on platforms with no implementation. - static MachineIdProvider* CreateInstance(); + static std::string GetMachineId(); private: - friend class base::RefCountedThreadSafe<MachineIdProvider>; - - MachineIdProvider(); - virtual ~MachineIdProvider(); - - DISALLOW_COPY_AND_ASSIGN(MachineIdProvider); + DISALLOW_IMPLICIT_CONSTRUCTORS(MachineIdProvider); }; } // namespace metrics
diff --git a/components/metrics/machine_id_provider_stub.cc b/components/metrics/machine_id_provider_stub.cc index 626f2b7..d7472098 100644 --- a/components/metrics/machine_id_provider_stub.cc +++ b/components/metrics/machine_id_provider_stub.cc
@@ -4,20 +4,18 @@ #include "components/metrics/machine_id_provider.h" +#include "base/logging.h" + namespace metrics { -MachineIdProvider::MachineIdProvider() { -} - -MachineIdProvider::~MachineIdProvider() { +// static +bool MachineIdProvider::HasId() { + return false; } // static -MachineIdProvider* MachineIdProvider::CreateInstance() { - return NULL; -} - std::string MachineIdProvider::GetMachineId() { + NOTREACHED(); return std::string(); }
diff --git a/components/metrics/machine_id_provider_win.cc b/components/metrics/machine_id_provider_win.cc index 41079a7..15dbb5f 100644 --- a/components/metrics/machine_id_provider_win.cc +++ b/components/metrics/machine_id_provider_win.cc
@@ -16,14 +16,14 @@ namespace metrics { -MachineIdProvider::MachineIdProvider() { -} - -MachineIdProvider::~MachineIdProvider() { +// static +bool MachineIdProvider::HasId() { + return true; } // On windows, the machine id is based on the serial number of the drive Chrome // is running from. +// static std::string MachineIdProvider::GetMachineId() { base::ThreadRestrictions::AssertIOAllowed(); @@ -109,10 +109,4 @@ return std::string(serial_number); } - -// static -MachineIdProvider* MachineIdProvider::CreateInstance() { - return new MachineIdProvider(); -} - } // namespace metrics
diff --git a/components/metrics/machine_id_provider_win_unittest.cc b/components/metrics/machine_id_provider_win_unittest.cc index 11ffd8f..6bcd0c4 100644 --- a/components/metrics/machine_id_provider_win_unittest.cc +++ b/components/metrics/machine_id_provider_win_unittest.cc
@@ -4,24 +4,17 @@ #include "components/metrics/machine_id_provider.h" -#include "base/memory/ref_counted.h" -#include "base/win/windows_version.h" #include "testing/gtest/include/gtest/gtest.h" namespace metrics { TEST(MachineIdProviderTest, GetId) { - scoped_refptr<MachineIdProvider> provider( - MachineIdProvider::CreateInstance()); - std::string id1 = provider->GetMachineId(); + EXPECT_TRUE(MachineIdProvider::HasId()); - // TODO(rpaquay): See crbug/458230 - if (base::win::GetVersion() <= base::win::VERSION_XP) - return; - + const std::string id1 = MachineIdProvider::GetMachineId(); EXPECT_NE(std::string(), id1); - std::string id2 = provider->GetMachineId(); + const std::string id2 = MachineIdProvider::GetMachineId(); EXPECT_EQ(id1, id2); }
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index 6a44e35..f29f176 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc
@@ -215,7 +215,6 @@ state_manager_(state_manager), client_(client), local_state_(local_state), - clean_exit_beacon_(client->GetRegistryBackupKey(), local_state), recording_state_(UNSET), test_mode_active_(false), state_(INITIALIZED), @@ -301,7 +300,7 @@ } bool MetricsService::WasLastShutdownClean() const { - return clean_exit_beacon_.exited_cleanly(); + return state_manager_->clean_exit_beacon()->exited_cleanly(); } void MetricsService::EnableRecording() { @@ -404,7 +403,8 @@ rotation_scheduler_->Stop(); reporting_service_.Stop(); - MarkAppCleanShutdownAndCommit(&clean_exit_beacon_, local_state_); + MarkAppCleanShutdownAndCommit(state_manager_->clean_exit_beacon(), + local_state_); // Give providers a chance to persist histograms as part of being // backgrounded. @@ -425,13 +425,13 @@ } void MetricsService::OnAppEnterForeground() { - clean_exit_beacon_.WriteBeaconValue(false); + state_manager_->clean_exit_beacon()->WriteBeaconValue(false); ExecutionPhaseManager(local_state_).OnAppEnterForeground(); StartSchedulerIfNecessary(); } #else void MetricsService::LogNeedForCleanShutdown() { - clean_exit_beacon_.WriteBeaconValue(false); + state_manager_->clean_exit_beacon()->WriteBeaconValue(false); // Redundant setting to be sure we call for a clean shutdown. clean_shutdown_status_ = NEED_TO_SHUTDOWN; } @@ -493,11 +493,11 @@ session_id_ = local_state_->GetInteger(prefs::kMetricsSessionID); StabilityMetricsProvider provider(local_state_); - if (!clean_exit_beacon_.exited_cleanly()) { + if (!state_manager_->clean_exit_beacon()->exited_cleanly()) { provider.LogCrash(); // Reset flag, and wait until we call LogNeedForCleanShutdown() before // monitoring. - clean_exit_beacon_.WriteBeaconValue(true); + state_manager_->clean_exit_beacon()->WriteBeaconValue(true); ExecutionPhaseManager manager(local_state_); UMA_HISTOGRAM_SPARSE_SLOWLY("Chrome.Browser.CrashedExecutionPhase", static_cast<int>(manager.GetExecutionPhase())); @@ -508,7 +508,7 @@ // bypassed. const bool is_initial_stability_log_required = ProvidersHaveInitialStabilityMetrics() || - !clean_exit_beacon_.exited_cleanly(); + !state_manager_->clean_exit_beacon()->exited_cleanly(); bool has_initial_stability_log = false; if (is_initial_stability_log_required) { // If the previous session didn't exit cleanly, or if any provider @@ -914,9 +914,8 @@ metrics_providers_.push_back(std::move(provider)); } -void MetricsService::CheckForClonedInstall( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - state_manager_->CheckForClonedInstall(task_runner); +void MetricsService::CheckForClonedInstall() { + state_manager_->CheckForClonedInstall(); } void MetricsService::NotifySyntheticTrialObservers() { @@ -1014,7 +1013,7 @@ // (and that we don't use some alternate path, and not call LogCleanShutdown). clean_shutdown_status_ = CLEANLY_SHUTDOWN; client_->OnLogCleanShutdown(); - clean_exit_beacon_.WriteBeaconValue(true); + state_manager_->clean_exit_beacon()->WriteBeaconValue(true); SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_); StabilityMetricsProvider(local_state_).MarkSessionEndCompleted(end_completed); }
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h index 102ab72..08ac80eb 100644 --- a/components/metrics/metrics_service.h +++ b/components/metrics/metrics_service.h
@@ -23,7 +23,6 @@ #include "base/metrics/histogram_snapshot_manager.h" #include "base/metrics/user_metrics.h" #include "base/observer_list.h" -#include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "build/build_config.h" @@ -182,8 +181,7 @@ // Check if this install was cloned or imaged from another machine. If a // clone is detected, reset the client id and low entropy source. This // should not be called more than once. - void CheckForClonedInstall( - scoped_refptr<base::SingleThreadTaskRunner> task_runner); + void CheckForClonedInstall(); // Clears the stability metrics that are saved in local state. void ClearSavedStabilityMetrics(); @@ -384,8 +382,6 @@ PrefService* local_state_; - CleanExitBeacon clean_exit_beacon_; - base::ActionCallback action_callback_; // Indicate whether recording and reporting are currently happening.
diff --git a/components/metrics/metrics_service_client.cc b/components/metrics/metrics_service_client.cc index 4339ad0..701b15d 100644 --- a/components/metrics/metrics_service_client.cc +++ b/components/metrics/metrics_service_client.cc
@@ -16,10 +16,6 @@ return nullptr; } -base::string16 MetricsServiceClient::GetRegistryBackupKey() { - return base::string16(); -} - bool MetricsServiceClient::IsReportingPolicyManaged() { return false; }
diff --git a/components/metrics/metrics_service_client.h b/components/metrics/metrics_service_client.h index 569e121..bf42e51 100644 --- a/components/metrics/metrics_service_client.h +++ b/components/metrics/metrics_service_client.h
@@ -102,10 +102,6 @@ // Returns the standard interval between upload attempts. virtual base::TimeDelta GetStandardUploadInterval() = 0; - // Returns the name of a key under HKEY_CURRENT_USER that can be used to store - // backups of metrics data. Unused except on Windows. - virtual base::string16 GetRegistryBackupKey(); - // Called on plugin loading errors. virtual void OnPluginLoadingError(const base::FilePath& plugin_path) {}
diff --git a/components/metrics/metrics_service_unittest.cc b/components/metrics/metrics_service_unittest.cc index e426789..3be79ac 100644 --- a/components/metrics/metrics_service_unittest.cc +++ b/components/metrics/metrics_service_unittest.cc
@@ -17,6 +17,7 @@ #include "base/metrics/statistics_recorder.h" #include "base/metrics/user_metrics.h" #include "base/stl_util.h" +#include "base/strings/string16.h" #include "base/strings/stringprintf.h" #include "base/test/scoped_feature_list.h" #include "base/test/test_simple_task_runner.h" @@ -90,9 +91,6 @@ enabled_state_provider_(new TestEnabledStateProvider(false, false)) { base::SetRecordActionTaskRunner(task_runner_); MetricsService::RegisterPrefs(testing_local_state_.registry()); - metrics_state_manager_ = MetricsStateManager::Create( - GetLocalState(), enabled_state_provider_.get(), - base::Bind(&StoreNoClientInfoBackup), base::Bind(&ReturnNoBackup)); } ~MetricsServiceTest() override { @@ -101,6 +99,13 @@ } MetricsStateManager* GetMetricsStateManager() { + // Lazy-initialize the metrics_state_manager so that it correctly reads the + // stability state from prefs after tests have a chance to initialize it. + if (!metrics_state_manager_) { + metrics_state_manager_ = MetricsStateManager::Create( + GetLocalState(), enabled_state_provider_.get(), base::string16(), + base::Bind(&StoreNoClientInfoBackup), base::Bind(&ReturnNoBackup)); + } return metrics_state_manager_.get(); }
diff --git a/components/metrics/metrics_state_manager.cc b/components/metrics/metrics_state_manager.cc index 83d62b5f..45c2c48 100644 --- a/components/metrics/metrics_state_manager.cc +++ b/components/metrics/metrics_state_manager.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/guid.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/sparse_histogram.h" #include "base/rand_util.h" @@ -57,12 +58,14 @@ MetricsStateManager::MetricsStateManager( PrefService* local_state, EnabledStateProvider* enabled_state_provider, + const base::string16& backup_registry_key, const StoreClientInfoCallback& store_client_info, const LoadClientInfoCallback& retrieve_client_info) : local_state_(local_state), enabled_state_provider_(enabled_state_provider), store_client_info_(store_client_info), load_client_info_(retrieve_client_info), + clean_exit_beacon_(backup_registry_key, local_state), low_entropy_source_(kLowEntropySourceNotSet), entropy_source_returned_(ENTROPY_SOURCE_NONE) { ResetMetricsIDsIfNecessary(); @@ -140,16 +143,14 @@ BackUpCurrentClientInfo(); } -void MetricsStateManager::CheckForClonedInstall( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { +void MetricsStateManager::CheckForClonedInstall() { DCHECK(!cloned_install_detector_); - MachineIdProvider* provider = MachineIdProvider::CreateInstance(); - if (!provider) + if (!MachineIdProvider::HasId()) return; - cloned_install_detector_.reset(new ClonedInstallDetector(provider)); - cloned_install_detector_->CheckForClonedInstall(local_state_, task_runner); + cloned_install_detector_ = base::MakeUnique<ClonedInstallDetector>(); + cloned_install_detector_->CheckForClonedInstall(local_state_); } std::unique_ptr<const base::FieldTrial::EntropyProvider> @@ -194,13 +195,14 @@ std::unique_ptr<MetricsStateManager> MetricsStateManager::Create( PrefService* local_state, EnabledStateProvider* enabled_state_provider, + const base::string16& backup_registry_key, const StoreClientInfoCallback& store_client_info, const LoadClientInfoCallback& retrieve_client_info) { std::unique_ptr<MetricsStateManager> result; // Note: |instance_exists_| is updated in the constructor and destructor. if (!instance_exists_) { result.reset(new MetricsStateManager(local_state, enabled_state_provider, - store_client_info, + backup_registry_key, store_client_info, retrieve_client_info)); } return result;
diff --git a/components/metrics/metrics_state_manager.h b/components/metrics/metrics_state_manager.h index 99c0f62..fbb0f595 100644 --- a/components/metrics/metrics_state_manager.h +++ b/components/metrics/metrics_state_manager.h
@@ -12,7 +12,8 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/metrics/field_trial.h" -#include "base/single_thread_task_runner.h" +#include "base/strings/string16.h" +#include "components/metrics/clean_exit_beacon.h" #include "components/metrics/client_info.h" class PrefService; @@ -49,6 +50,13 @@ // not opted in to metrics reporting. const std::string& client_id() const { return client_id_; } + // The CleanExitBeacon, used to determine whether the previous Chrome browser + // session terminated gracefully. + CleanExitBeacon* clean_exit_beacon() { return &clean_exit_beacon_; } + const CleanExitBeacon* clean_exit_beacon() const { + return &clean_exit_beacon_; + } + // Forces the client ID to be generated. This is useful in case it's needed // before recording. void ForceClientIdCreation(); @@ -56,8 +64,7 @@ // Checks if this install was cloned or imaged from another machine. If a // clone is detected, resets the client id and low entropy source. This // should not be called more than once. - void CheckForClonedInstall( - scoped_refptr<base::SingleThreadTaskRunner> task_runner); + void CheckForClonedInstall(); // Returns the preferred entropy provider used to seed persistent activities // based on whether or not metrics reporting is permitted on this client. @@ -78,9 +85,12 @@ // Creates the MetricsStateManager, enforcing that only a single instance // of the class exists at a time. Returns NULL if an instance exists already. + // On Windows, |backup_registry_key| is used to store a backup of the clean + // exit beacon. It is ignored on other platforms. static std::unique_ptr<MetricsStateManager> Create( PrefService* local_state, EnabledStateProvider* enabled_state_provider, + const base::string16& backup_registry_key, const StoreClientInfoCallback& store_client_info, const LoadClientInfoCallback& load_client_info); @@ -113,6 +123,7 @@ // that it is later retrievable by |load_client_info|. MetricsStateManager(PrefService* local_state, EnabledStateProvider* enabled_state_provider, + const base::string16& backup_registry_key, const StoreClientInfoCallback& store_client_info, const LoadClientInfoCallback& load_client_info); @@ -165,6 +176,10 @@ // its typical location and wants to attempt loading it from this backup. const LoadClientInfoCallback load_client_info_; + // A beacon used to determine whether the previous Chrome browser session + // terminated gracefully. + CleanExitBeacon clean_exit_beacon_; + // The identifier that's sent to the server with the log reports. std::string client_id_;
diff --git a/components/metrics/metrics_state_manager_unittest.cc b/components/metrics/metrics_state_manager_unittest.cc index a55c2fa9f..801f74a2 100644 --- a/components/metrics/metrics_state_manager_unittest.cc +++ b/components/metrics/metrics_state_manager_unittest.cc
@@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/strings/string16.h" #include "components/metrics/client_info.h" #include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_service.h" @@ -35,7 +36,7 @@ std::unique_ptr<MetricsStateManager> CreateStateManager() { return MetricsStateManager::Create( - &prefs_, enabled_state_provider_.get(), + &prefs_, enabled_state_provider_.get(), base::string16(), base::Bind(&MetricsStateManagerTest::MockStoreClientInfoBackup, base::Unretained(this)), base::Bind(&MetricsStateManagerTest::LoadFakeClientInfoBackup,
diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc index 023a2af..df3d137 100644 --- a/components/omnibox/browser/history_url_provider.cc +++ b/components/omnibox/browser/history_url_provider.cc
@@ -568,9 +568,9 @@ if (destination_url.is_valid()) { match.destination_url = destination_url; - // Trim off "http://" if the user didn't type it. - DCHECK(!trim_http || - !AutocompleteInput::HasHTTPScheme(input.text())); + // If the input explicitly contains "http://", callers must set |trim_http| + // to false. Otherwise, |trim_http| may be either true or false. + DCHECK(!(trim_http && AutocompleteInput::HasHTTPScheme(input.text()))); base::string16 display_string(url_formatter::FormatUrl( destination_url, url_formatter::kFormatUrlOmitAll & ~url_formatter::kFormatUrlOmitHTTP,
diff --git a/components/omnibox/bug-triage.md b/components/omnibox/bug-triage.md index 5fc61ce..daff8d4 100644 --- a/components/omnibox/bug-triage.md +++ b/components/omnibox/bug-triage.md
@@ -1,6 +1,6 @@ # Omnibox Bug Triage Process -*last update: 2017/06/05* +*last update: 2017/07/11* *The current triage process owner is `mpearson@`.* @@ -173,6 +173,14 @@ ## Example request for chrome://omnibox data +NOTE: If you ask someone for chrome://omnibox data on a public bug, label the +bug with Restrict-View-Google so that any personal data from the reporter's +chrome://omnibox output is not made public. Do this *before* they respond. +As the original reporter, they should still have access to the bug even with the +restrict applied. + +Example request: + > Please submit chrome://omnibox output for “\_\_\_”. Check both the "show > all details" and "show results per provider" boxes. This will help us > figure out what's going on. @@ -186,9 +194,9 @@ [crbug/91378](https://bugs.chromium.org/p/chromium/issues/detail?id=91378). * Try to understand the motivation of the user making the request. Please - ask the user for examples, with chrome://omnibox detail, of times where the - omnibox doesn’t do what they want. Ideally we should be able make to make the - omnibox smart enough that such a feature isn’t necessary. + ask the user for examples, with chrome://omnibox detail (see above), of times + where the omnibox doesn’t do what they want. Ideally we should be able make + to make the omnibox smart enough that such a feature isn’t necessary. * “I typed in something like go/foo and got redirected to a search results page instead.” See @@ -211,7 +219,7 @@ [Omnibox bugs that we intend/hope to tackle this year](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20NextAction%3C2018/1/1%20OR%20component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20-has:NextAction%20&sort=pri&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified), broken down: -* [User-facing](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20-Hotlist=CodeHealth%20-Hotlist=Refactoring%20-component:Test%20NextAction%3C2018/1/1%20OR%20component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20-Hotlist=CodeHealth%20-Hotlist=Refactoring%20-component:Test%20-has:NextAction&sort=pri&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified +* [User-facing](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20-Hotlist=CodeHealth%20-Hotlist=Refactoring%20-component:Test%20NextAction%3C2018/1/1%20OR%20component:UI%3EBrowser%3EOmnibox%20-component:UI%3EBrowser%3EOmnibox%3ESecurityIndicators%20status:Available,Assigned,Started%20-Hotlist=CodeHealth%20-Hotlist=Refactoring%20-component:Test%20-has:NextAction&sort=pri&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified) (everything not tagged as one of the non-user-facing categories below). Some of these can be further categorized: Performance, Polish, Enterprise, Answers in Suggest, Tab To Search, Zero Suggest.
diff --git a/components/password_manager/core/browser/hash_password_manager.cc b/components/password_manager/core/browser/hash_password_manager.cc index 8d6bb63c..57b08c1 100644 --- a/components/password_manager/core/browser/hash_password_manager.cc +++ b/components/password_manager/core/browser/hash_password_manager.cc
@@ -8,6 +8,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "components/os_crypt/os_crypt.h" +#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_util.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_service.h" @@ -56,6 +57,16 @@ return result; } +void HashPasswordManager::ReportIsSyncPasswordHashSavedMetric() { + if (!prefs_) + return; + auto hash_password_state = + prefs_->HasPrefPath(prefs::kSyncPasswordHash) + ? metrics_util::IsSyncPasswordHashSaved::SAVED + : metrics_util::IsSyncPasswordHashSaved::NOT_SAVED; + metrics_util::LogIsSyncPasswordHashSaved(hash_password_state); +} + std::string HashPasswordManager::CreateRandomSalt() { char buffer[kSyncPasswordSaltLength]; crypto::RandBytes(buffer, kSyncPasswordSaltLength);
diff --git a/components/password_manager/core/browser/hash_password_manager.h b/components/password_manager/core/browser/hash_password_manager.h index 03b17211..217f4d4 100644 --- a/components/password_manager/core/browser/hash_password_manager.h +++ b/components/password_manager/core/browser/hash_password_manager.h
@@ -33,6 +33,8 @@ // Returns empty if no hash is available. base::Optional<SyncPasswordData> RetrievePasswordHash(); + void ReportIsSyncPasswordHashSavedMetric(); + void set_prefs(PrefService* prefs) { prefs_ = prefs; } private:
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.cc b/components/password_manager/core/browser/password_manager_metrics_util.cc index 503a9f9..3dc8207 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.cc +++ b/components/password_manager/core/browser/password_manager_metrics_util.cc
@@ -199,12 +199,21 @@ SubmittedFormFrame::SUBMITTED_FORM_FRAME_COUNT); } +#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || \ + (defined(OS_LINUX) && !defined(OS_CHROMEOS)) void LogSyncPasswordHashChange(SyncPasswordHashChange event) { UMA_HISTOGRAM_ENUMERATION( "PasswordManager.SyncPasswordHashChange", event, SyncPasswordHashChange::SAVED_SYNC_PASSWORD_CHANGE_COUNT); } +void LogIsSyncPasswordHashSaved(IsSyncPasswordHashSaved state) { + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.IsSyncPasswordHashSaved", state, + IsSyncPasswordHashSaved::IS_SYNC_PASSWORD_HASH_SAVED_COUNT); +} +#endif + } // namespace metrics_util } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.h b/components/password_manager/core/browser/password_manager_metrics_util.h index a23a9db..909a914 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.h +++ b/components/password_manager/core/browser/password_manager_metrics_util.h
@@ -193,13 +193,6 @@ SUBMITTED_FORM_FRAME_COUNT }; -enum class SyncPasswordHashChange { - SAVED_ON_CHROME_SIGNIN, - SAVED_IN_CONTENT_AREA, - CLEARED_ON_CHROME_SIGNOUT, - SAVED_SYNC_PASSWORD_CHANGE_COUNT -}; - // Metrics: "PasswordManager.AccessPasswordInSettings" enum AccessPasswordInSettingsEvent { ACCESS_PASSWORD_VIEWED = 0, @@ -215,6 +208,22 @@ REAUTH_COUNT }; +#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || \ + (defined(OS_LINUX) && !defined(OS_CHROMEOS)) +enum class SyncPasswordHashChange { + SAVED_ON_CHROME_SIGNIN, + SAVED_IN_CONTENT_AREA, + CLEARED_ON_CHROME_SIGNOUT, + SAVED_SYNC_PASSWORD_CHANGE_COUNT +}; + +enum class IsSyncPasswordHashSaved { + NOT_SAVED, + SAVED, + IS_SYNC_PASSWORD_HASH_SAVED_COUNT +}; +#endif + // A version of the UMA_HISTOGRAM_BOOLEAN macro that allows the |name| // to vary over the program's runtime. void LogUMAHistogramBoolean(const std::string& name, bool sample); @@ -304,9 +313,15 @@ // Log a frame of a submitted password form. void LogSubmittedFormFrame(SubmittedFormFrame frame); +#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || \ + (defined(OS_LINUX) && !defined(OS_CHROMEOS)) // Log a save sync password change event. void LogSyncPasswordHashChange(SyncPasswordHashChange event); +// Log whether a sync password hash saved. +void LogIsSyncPasswordHashSaved(IsSyncPasswordHashSaved state); +#endif + } // namespace metrics_util } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 44cfc53..5adf79f 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc
@@ -270,6 +270,12 @@ task_runner->PostDelayedTask(FROM_HERE, task, base::TimeDelta::FromSeconds(30)); } + +#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || \ + (defined(OS_LINUX) && !defined(OS_CHROMEOS)) + if (!sync_username.empty()) + hash_password_manager_.ReportIsSyncPasswordHashSavedMetric(); +#endif } void PasswordStore::AddSiteStats(const InteractionsStats& stats) {
diff --git a/components/payments/core/address_normalization_manager.cc b/components/payments/core/address_normalization_manager.cc index 136146c8..240846b 100644 --- a/components/payments/core/address_normalization_manager.cc +++ b/components/payments/core/address_normalization_manager.cc
@@ -31,9 +31,10 @@ AddressNormalizationManager::~AddressNormalizationManager() {} -void AddressNormalizationManager::FinalizeWithCompletionCallback( +void AddressNormalizationManager::FinalizePendingRequestsWithCompletionCallback( base::OnceClosure completion_callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK(!completion_callback_); completion_callback_ = std::move(completion_callback); accepting_requests_ = false; MaybeRunCompletionCallback(); @@ -61,6 +62,10 @@ // We're no longer accepting requests, and all the delegates have completed. // Now's the time to run the completion callback. std::move(completion_callback_).Run(); + + // Start accepting requests after the completion callback has run. + delegates_.clear(); + accepting_requests_ = true; } AddressNormalizationManager::NormalizerDelegate::NormalizerDelegate(
diff --git a/components/payments/core/address_normalization_manager.h b/components/payments/core/address_normalization_manager.h index 5205f30..63ff0f1 100644 --- a/components/payments/core/address_normalization_manager.h +++ b/components/payments/core/address_normalization_manager.h
@@ -33,11 +33,12 @@ ~AddressNormalizationManager(); - // Stops accepting normalization requests. If all the address normalization - // requests have already completed, |completion_callback| will be called - // before this method returns. Otherwise, it will be called as soon as the - // last pending request completes. - void FinalizeWithCompletionCallback(base::OnceClosure completion_callback); + // Stops accepting normalization requests until all pending requests complete. + // If all the address normalization requests have already completed, + // |completion_callback| will be called before this method returns. Otherwise, + // it will be called as soon as the last pending request completes. + void FinalizePendingRequestsWithCompletionCallback( + base::OnceClosure completion_callback); // Normalizes the address in |profile|. This may or may not happen // asynchronously. On completion, the address in |profile| will be updated
diff --git a/components/payments/core/address_normalization_manager_unittest.cc b/components/payments/core/address_normalization_manager_unittest.cc index 76b4656..4e58c24 100644 --- a/components/payments/core/address_normalization_manager_unittest.cc +++ b/components/payments/core/address_normalization_manager_unittest.cc
@@ -23,7 +23,7 @@ } void Finalize() { - manager_->FinalizeWithCompletionCallback( + manager_->FinalizePendingRequestsWithCompletionCallback( base::BindOnce(&AddressNormalizationManagerTest::CompletionCallback, base::Unretained(this))); }
diff --git a/components/payments/core/subkey_requester.cc b/components/payments/core/subkey_requester.cc index f4dfbc87..17b21d40 100644 --- a/components/payments/core/subkey_requester.cc +++ b/components/payments/core/subkey_requester.cc
@@ -45,7 +45,7 @@ base::TimeDelta::FromSeconds(timeout_seconds)); } - ~SubKeyRequest() override {} + ~SubKeyRequest() override { on_timeout_.Cancel(); } void OnRulesLoaded() override { on_timeout_.Cancel();
diff --git a/components/resources/safe_browsing_resources.grdp b/components/resources/safe_browsing_resources.grdp index ae40ba6..1b2d2115 100644 --- a/components/resources/safe_browsing_resources.grdp +++ b/components/resources/safe_browsing_resources.grdp
@@ -2,4 +2,5 @@ <grit-part> <include name="IDR_SAFE_BROWSING_HTML" file="..\..\components\safe_browsing\web_ui\resources\safe_browsing.html" type="BINDATA" /> <include name="IDR_SAFE_BROWSING_CSS" file="..\..\components\safe_browsing\web_ui\resources\safe_browsing.css" type="BINDATA" /> + <include name="IDR_SAFE_BROWSING_JS" file="..\..\components\safe_browsing\web_ui\resources\safe_browsing.js" type="BINDATA" /> </grit-part>
diff --git a/components/safe_browsing/BUILD.gn b/components/safe_browsing/BUILD.gn index 0f05c746..7b090bc 100644 --- a/components/safe_browsing/BUILD.gn +++ b/components/safe_browsing/BUILD.gn
@@ -24,6 +24,7 @@ ] deps = [ ":base_ping_manager", + ":features", "//base:base", "//base:i18n", "//components/safe_browsing/common:safe_browsing_prefs", @@ -69,3 +70,14 @@ "//testing/gtest", ] } + +static_library("features") { + sources = [ + "features.cc", + "features.h", + ] + + deps = [ + "//base:base", + ] +}
diff --git a/components/safe_browsing/features.cc b/components/safe_browsing/features.cc new file mode 100644 index 0000000..9412e7b --- /dev/null +++ b/components/safe_browsing/features.cc
@@ -0,0 +1,78 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/safe_browsing/features.h" + +#include <stddef.h> +#include <algorithm> +#include <utility> +#include <vector> +#include "base/feature_list.h" + +#include "base/macros.h" +#include "base/values.h" +namespace safe_browsing { +// Please define any new SafeBrowsing related features in this file, and add +// them to the ExperimentalFeaturesList below to start displaying their status +// on the chrome://safe-browsing page. +const base::Feature kLocalDatabaseManagerEnabled{ + "SafeBrowsingV4LocalDatabaseManagerEnabled", + base::FEATURE_DISABLED_BY_DEFAULT}; + +const base::Feature kV4OnlyEnabled{"SafeBrowsingV4OnlyEnabled", + base::FEATURE_DISABLED_BY_DEFAULT}; +// This Feature specifies which non-resource HTML Elements to collect based on +// their tag and attributes. It's a single param containing a comma-separated +// list of pairs. For example: "tag1,id,tag1,height,tag2,foo" - this will +// collect elements with tag "tag1" that have attribute "id" or "height" set, +// and elements of tag "tag2" if they have attribute "foo" set. All tag names +// and attributes should be lower case. +const base::Feature kThreatDomDetailsTagAndAttributeFeature{ + "ThreatDomDetailsTagAttributes", base::FEATURE_DISABLED_BY_DEFAULT}; + +namespace { +// List of experimental features. Boolean value for each list member should be +// set to True if the experiment is currently running at a probability other +// than 1 or 0, or to False otherwise. +std::vector<std::pair<const base::Feature*, bool>> + +GetExperimentalFeaturesList() { + std::vector<std::pair<const base::Feature*, bool>> experimental_features_list{ + std::make_pair(&kLocalDatabaseManagerEnabled, true), + std::make_pair(&kV4OnlyEnabled, true), + std::make_pair(&kThreatDomDetailsTagAndAttributeFeature, false)}; + + return experimental_features_list; +} + +// Adds the name and the enabled/disabled status of a given feature. +void AddFeatureAndAvailability(const base::Feature* exp_feature, + base::ListValue* param_list) { + param_list->GetList().push_back(base::Value(exp_feature->name)); + if (base::FeatureList::IsEnabled(*exp_feature)) { + param_list->GetList().push_back(base::Value("Enabled")); + } else { + param_list->GetList().push_back(base::Value("Disabled")); + } +} +} // namespace + +// Returns the list of the experimental features that are enabled or disabled, +// as part of currently running Safe Browsing experiments. +base::ListValue GetFeatureStatusList() { + std::vector<std::pair<const base::Feature*, bool>> features_list = + GetExperimentalFeaturesList(); + + base::ListValue param_list; + for (std::vector<std::pair<const base::Feature*, bool>>::iterator it = + features_list.begin(); + it != features_list.end(); ++it) { + if ((*it).second) { + AddFeatureAndAvailability((*it).first, ¶m_list); + } + } + return param_list; +} + +} // namespace safe_browsing
diff --git a/components/safe_browsing/features.h b/components/safe_browsing/features.h new file mode 100644 index 0000000..c4a0a12 --- /dev/null +++ b/components/safe_browsing/features.h
@@ -0,0 +1,29 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_SAFE_BROWSING_FEATURES_H_ +#define COMPONENTS_SAFE_BROWSING_FEATURES_H_ + +#include <stddef.h> +#include <algorithm> +#include <utility> +#include <vector> + +#include "base/feature_list.h" +#include "base/macros.h" +#include "base/values.h" +namespace base { +class ListValue; +} // namespace base + +namespace safe_browsing { +// Features list +extern const base::Feature kLocalDatabaseManagerEnabled; +extern const base::Feature kV4OnlyEnabled; +extern const base::Feature kThreatDomDetailsTagAndAttributeFeature; + +base::ListValue GetFeatureStatusList(); + +#endif // COMPONENTS_SAFE_BROWSING_FEATURES_H_ +} // namespace safe_browsing
diff --git a/components/safe_browsing/renderer/BUILD.gn b/components/safe_browsing/renderer/BUILD.gn index da1a4886..02239b4 100644 --- a/components/safe_browsing/renderer/BUILD.gn +++ b/components/safe_browsing/renderer/BUILD.gn
@@ -12,6 +12,7 @@ ] deps = [ "//base", + "//components/safe_browsing:features", "//components/safe_browsing/common:common", "//content/public/renderer", "//ipc",
diff --git a/components/safe_browsing/renderer/DEPS b/components/safe_browsing/renderer/DEPS index b7cc985c..15dc39e 100644 --- a/components/safe_browsing/renderer/DEPS +++ b/components/safe_browsing/renderer/DEPS
@@ -1,7 +1,8 @@ include_rules = [ "+content/public/renderer", + "+components/safe_browsing", "+third_party/WebKit/public/platform", "+third_party/WebKit/public/web", "+ipc", "+mojo/public/cpp", -] \ No newline at end of file +]
diff --git a/components/safe_browsing/renderer/threat_dom_details.cc b/components/safe_browsing/renderer/threat_dom_details.cc index c3d712b3..9fd9af5 100644 --- a/components/safe_browsing/renderer/threat_dom_details.cc +++ b/components/safe_browsing/renderer/threat_dom_details.cc
@@ -16,6 +16,7 @@ #include "base/strings/stringprintf.h" #include "components/safe_browsing/common/safebrowsing_messages.h" #include "components/safe_browsing/common/safebrowsing_types.h" +#include "components/safe_browsing/features.h" #include "content/public/renderer/render_frame.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/web/WebDocument.h" @@ -35,15 +36,6 @@ // messages generated by ThreatDOMDetails. using ElementToNodeMap = std::map<blink::WebNode, size_t>; -// This Feature specifies which non-resource HTML Elements to collect based on -// their tag and attributes. It's a single param containing a comma-separated -// list of pairs. For example: "tag1,id,tag1,height,tag2,foo" - this will -// collect elements with tag "tag1" that have attribute "id" or "height" set, -// and elements of tag "tag2" if they have attribute "foo" set. All tag names -// and attributes should be lower case. -const base::Feature kThreatDomDetailsTagAndAttributeFeature{ - "ThreatDomDetailsTagAttributes", base::FEATURE_DISABLED_BY_DEFAULT}; - // The name of the param containing the tags and attributes list. const char kTagAndAttributeParamName[] = "tag_attribute_csv";
diff --git a/components/safe_browsing/renderer/threat_dom_details.h b/components/safe_browsing/renderer/threat_dom_details.h index 0f48d0b..76c32a3d 100644 --- a/components/safe_browsing/renderer/threat_dom_details.h +++ b/components/safe_browsing/renderer/threat_dom_details.h
@@ -19,7 +19,6 @@ namespace safe_browsing { -extern const base::Feature kThreatDomDetailsTagAndAttributeFeature; extern const char kTagAndAttributeParamName[]; // Represents the tag name of an HTML Element and its associated attributes.
diff --git a/components/safe_browsing/web_ui/BUILD.gn b/components/safe_browsing/web_ui/BUILD.gn index 0c24b46..f1234f9 100644 --- a/components/safe_browsing/web_ui/BUILD.gn +++ b/components/safe_browsing/web_ui/BUILD.gn
@@ -13,6 +13,7 @@ "//base", "//components/resources:components_resources_grit", "//components/resources:components_scaled_resources_grit", + "//components/safe_browsing:features", "//components/strings:components_strings_grit", "//content/public/browser", "//net",
diff --git a/components/safe_browsing/web_ui/resources/safe_browsing.css b/components/safe_browsing/web_ui/resources/safe_browsing.css index 0bacdd7f..93c0cfb 100644 --- a/components/safe_browsing/web_ui/resources/safe_browsing.css +++ b/components/safe_browsing/web_ui/resources/safe_browsing.css
@@ -2,7 +2,28 @@ /* 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. */ - +body { + color: rgb(48, 57, 66); + margin:15px; +} p { white-space: pre-wrap; } + +.experiments { + background-color: #fbfbfb; + border: 1px solid #cecece; + border-radius: 3px; + padding: 19px; + line-height: 1.5; +} + +#sbTitle { + font-size: 2em; + margin-bottom: 0.8em; +} + +h1, h2, h3, p { + font-weight: normal; + line-height: 1; + }
diff --git a/components/safe_browsing/web_ui/resources/safe_browsing.html b/components/safe_browsing/web_ui/resources/safe_browsing.html index 31ae761..2578e08 100644 --- a/components/safe_browsing/web_ui/resources/safe_browsing.html +++ b/components/safe_browsing/web_ui/resources/safe_browsing.html
@@ -8,10 +8,17 @@ <script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/load_time_data.js"></script> <script src="chrome://resources/js/util.js"></script> + <script src="safe_browsing.js"></script> </head> <body> - <h1>Safe Browsing</h1> +<div id="header"> + <h1 id="sbTitle">Safe Browsing</h1> + </div> <p>$i18n{sbUnderConstruction}</p> + <h2>Experiments</h2> + <div class="experiments"> + <p id="experimentsList"></p> + </div> <script src="chrome://resources/js/i18n_template.js"></script> </body> </html>
diff --git a/components/safe_browsing/web_ui/resources/safe_browsing.js b/components/safe_browsing/web_ui/resources/safe_browsing.js new file mode 100644 index 0000000..d47e9a2 --- /dev/null +++ b/components/safe_browsing/web_ui/resources/safe_browsing.js
@@ -0,0 +1,29 @@ +/* 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. */ + + cr.define('safe_browsing', function() { + 'use strict'; + + function initialize() { + chrome.send('expParamList',[]); + } + + function addExperiment(result) { + var resLength = result.length; + var experimentsListFormatted=""; + +for (var i = 0; i < resLength; i+=2) { + experimentsListFormatted += "<div>" + result[i+1] + " --- " + result [i] + + "</div>";} + $('experimentsList').innerHTML = experimentsListFormatted; + } + + return { + addExperiment: addExperiment, + initialize: initialize, + }; + +}); + +document.addEventListener('DOMContentLoaded', safe_browsing.initialize);
diff --git a/components/safe_browsing/web_ui/safe_browsing_ui.cc b/components/safe_browsing/web_ui/safe_browsing_ui.cc index 761b7cb..fe19f300 100644 --- a/components/safe_browsing/web_ui/safe_browsing_ui.cc +++ b/components/safe_browsing/web_ui/safe_browsing_ui.cc
@@ -1,28 +1,41 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// 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 "components/safe_browsing/web_ui/safe_browsing_ui.h" + +#include <algorithm> +#include <utility> +#include "base/macros.h" +#include "base/values.h" #include "components/grit/components_resources.h" #include "components/grit/components_scaled_resources.h" +#include "components/safe_browsing/features.h" #include "components/safe_browsing/web_ui/constants.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -#include "content/public/browser/web_ui_data_source.h" - +#include "content/public/browser/web_ui_message_handler.h" +namespace safe_browsing { SafeBrowsingUI::SafeBrowsingUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { // Set up the chrome://safe-browsing source. + content::WebUIDataSource* html_source = content::WebUIDataSource::Create( safe_browsing::kChromeUISafeBrowsingHost); + // Register callback handler. + // Handles messages from JavaScript to C++ via chrome.send(). + web_ui->AddMessageHandler(base::MakeUnique<SafeBrowsingUIHandler>()); + // Add localized string resources. html_source->AddLocalizedString("sbUnderConstruction", IDS_SB_UNDER_CONSTRUCTION); // Add required resources. html_source->AddResourcePath("safe_browsing.css", IDR_SAFE_BROWSING_CSS); + html_source->AddResourcePath("safe_browsing.js", IDR_SAFE_BROWSING_JS); html_source->SetDefaultResource(IDR_SAFE_BROWSING_HTML); content::BrowserContext* browser_context = @@ -31,3 +44,19 @@ } SafeBrowsingUI::~SafeBrowsingUI() {} + +SafeBrowsingUIHandler::SafeBrowsingUIHandler(){}; + +void SafeBrowsingUIHandler::ExpParamList(const base::ListValue* unused) { + AllowJavascript(); + CallJavascriptFunction("safe_browsing.addExperiment", GetFeatureStatusList()); +} + +void SafeBrowsingUIHandler::RegisterMessages() { + web_ui()->RegisterMessageCallback( + "expParamList", + base::Bind(&SafeBrowsingUIHandler::ExpParamList, base::Unretained(this))); +} + +SafeBrowsingUIHandler::~SafeBrowsingUIHandler() {} +} // namespace safe_browsing
diff --git a/components/safe_browsing/web_ui/safe_browsing_ui.h b/components/safe_browsing/web_ui/safe_browsing_ui.h index 440fae2..816c234 100644 --- a/components/safe_browsing/web_ui/safe_browsing_ui.h +++ b/components/safe_browsing/web_ui/safe_browsing_ui.h
@@ -1,13 +1,32 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SAFE_BROWSING_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_SAFE_BROWSING_UI_H_ +#ifndef COMPONENTS_SAFE_BROWSING_WEBUI_SAFE_BROWSING_UI_H_ +#define COMPONENTS_SAFE_BROWSING_WEBUI_SAFE_BROWSING_UI_H_ +#include "base/bind.h" +#include "base/callback.h" #include "base/macros.h" +#include "base/values.h" #include "content/public/browser/url_data_source.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller.h" +#include "content/public/browser/web_ui_data_source.h" +#include "content/public/browser/web_ui_message_handler.h" + +namespace safe_browsing { +class SafeBrowsingUIHandler : public content::WebUIMessageHandler { + public: + SafeBrowsingUIHandler(); + ~SafeBrowsingUIHandler() override; + void ExpParamList(const base::ListValue* args); + void RegisterMessages() override; + + private: + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIHandler); +}; // The WebUI for chrome://safe-browsing class SafeBrowsingUI : public content::WebUIController { @@ -18,5 +37,6 @@ private: DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUI); }; +} // namespace safe_browsing -#endif // CHROME_BROWSER_UI_WEBUI_SAFE_BROWSING_UI_H_ +#endif // COMPONENTS_SAFE_BROWSING_WEBUI_SAFE_BROWSING_UI_H_
diff --git a/components/safe_browsing_db/BUILD.gn b/components/safe_browsing_db/BUILD.gn index 031ccc7..a0869605 100644 --- a/components/safe_browsing_db/BUILD.gn +++ b/components/safe_browsing_db/BUILD.gn
@@ -217,6 +217,7 @@ ] deps = [ "//base", + "//components/safe_browsing:features", ] }
diff --git a/components/safe_browsing_db/DEPS b/components/safe_browsing_db/DEPS index 55dc17a..341bbf0 100644 --- a/components/safe_browsing_db/DEPS +++ b/components/safe_browsing_db/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+components/data_use_measurement/core", "+components/safe_browsing/common/safe_browsing_prefs.h", + "+components/safe_browsing/features.h", "+components/variations", "+components/version_info", "+content/public/browser",
diff --git a/components/safe_browsing_db/v4_feature_list.cc b/components/safe_browsing_db/v4_feature_list.cc index 9d166e9..8185e6fc 100644 --- a/components/safe_browsing_db/v4_feature_list.cc +++ b/components/safe_browsing_db/v4_feature_list.cc
@@ -2,22 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/feature_list.h" #include "components/safe_browsing_db/v4_feature_list.h" +#include "base/feature_list.h" +#include "components/safe_browsing/features.h" + namespace safe_browsing { namespace V4FeatureList { -namespace { - -const base::Feature kLocalDatabaseManagerEnabled{ - "SafeBrowsingV4LocalDatabaseManagerEnabled", - base::FEATURE_DISABLED_BY_DEFAULT}; - -const base::Feature kV4OnlyEnabled{"SafeBrowsingV4OnlyEnabled", - base::FEATURE_DISABLED_BY_DEFAULT}; - bool IsV4OnlyEnabled() { return base::FeatureList::IsEnabled(kV4OnlyEnabled); } @@ -27,8 +20,6 @@ IsV4OnlyEnabled(); } -} // namespace - V4UsageStatus GetV4UsageStatus() { V4UsageStatus v4_usage_status; if (safe_browsing::V4FeatureList::IsV4OnlyEnabled()) {
diff --git a/components/security_state/content/content_utils.cc b/components/security_state/content/content_utils.cc index 9d4b4a1..2832bf0 100644 --- a/components/security_state/content/content_utils.cc +++ b/components/security_state/content/content_utils.cc
@@ -53,7 +53,117 @@ return blink::kWebSecurityStyleUnknown; } -void AddConnectionExplanation( +void ExplainHTTPSecurity( + const security_state::SecurityInfo& security_info, + content::SecurityStyleExplanations* security_style_explanations) { + if (security_info.security_level == security_state::HTTP_SHOW_WARNING) { + if (security_info.displayed_password_field_on_http || + security_info.displayed_credit_card_field_on_http) { + security_style_explanations->neutral_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_PRIVATE_USER_DATA_INPUT), + l10n_util::GetStringUTF8( + IDS_PRIVATE_USER_DATA_INPUT_DESCRIPTION))); + } + if (security_info.incognito_downgraded_security_level) { + security_style_explanations->neutral_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_INCOGNITO_NONSECURE), + l10n_util::GetStringUTF8(IDS_INCOGNITO_NONSECURE_DESCRIPTION))); + } + } +} + +void ExplainSafeBrowsingSecurity( + const security_state::SecurityInfo& security_info, + content::SecurityStyleExplanations* security_style_explanations) { + if (security_info.malicious_content_status != + security_state::MALICIOUS_CONTENT_STATUS_NONE) { + security_style_explanations->summary = + l10n_util::GetStringUTF8(IDS_SAFEBROWSING_WARNING); + } +} + +void ExplainCertificateSecurity( + const security_state::SecurityInfo& security_info, + content::SecurityStyleExplanations* security_style_explanations) { + if (security_info.sha1_in_chain) { + security_style_explanations->neutral_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_SHA1), + l10n_util::GetStringUTF8(IDS_SHA1_DESCRIPTION), + !!security_info.certificate, + blink::WebMixedContentContextType::kNotMixedContent)); + } + + if (security_info.cert_missing_subject_alt_name) { + security_style_explanations->insecure_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING), + l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING_DESCRIPTION), + !!security_info.certificate, + blink::WebMixedContentContextType::kNotMixedContent)); + } + + bool is_cert_status_error = net::IsCertStatusError(security_info.cert_status); + bool is_cert_status_minor_error = + net::IsCertStatusMinorError(security_info.cert_status); + + if (is_cert_status_error) { + base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString( + net::MapCertStatusToNetError(security_info.cert_status))); + + content::SecurityStyleExplanation explanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), + l10n_util::GetStringFUTF8( + IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), + !!security_info.certificate, + blink::WebMixedContentContextType::kNotMixedContent); + + if (is_cert_status_minor_error) { + security_style_explanations->neutral_explanations.push_back(explanation); + } else { + security_style_explanations->insecure_explanations.push_back(explanation); + } + } else { + // If the certificate does not have errors and is not using SHA1, then add + // an explanation that the certificate is valid. + + base::string16 issuer_name; + if (security_info.certificate) { + // This results in the empty string if there is no relevant display name. + issuer_name = base::UTF8ToUTF16( + security_info.certificate->issuer().GetDisplayName()); + } else { + issuer_name = base::string16(); + } + if (issuer_name.empty()) { + issuer_name.assign( + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); + } + + if (!security_info.sha1_in_chain) { + security_style_explanations->secure_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), + l10n_util::GetStringFUTF8( + IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, issuer_name), + !!security_info.certificate, + blink::WebMixedContentContextType::kNotMixedContent)); + } + } + + security_style_explanations->pkp_bypassed = security_info.pkp_bypassed; + if (security_info.pkp_bypassed) { + security_style_explanations->info_explanations.push_back( + content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_PRIVATE_KEY_PINNING_BYPASSED), + l10n_util::GetStringUTF8( + IDS_PRIVATE_KEY_PINNING_BYPASSED_DESCRIPTION))); + } +} + +void ExplainConnectionSecurity( const security_state::SecurityInfo& security_info, content::SecurityStyleExplanations* security_style_explanations) { // Avoid showing TLS details when we couldn't even establish a TLS connection @@ -135,6 +245,54 @@ description_replacements, nullptr)))); } +void ExplainContentSecurity( + const security_state::SecurityInfo& security_info, + content::SecurityStyleExplanations* security_style_explanations) { + security_style_explanations->ran_insecure_content_style = + SecurityLevelToSecurityStyle(security_state::kRanInsecureContentLevel); + security_style_explanations->displayed_insecure_content_style = + SecurityLevelToSecurityStyle( + security_state::kDisplayedInsecureContentLevel); + + // Record the presence of mixed content (HTTP subresources on an HTTPS + // page). + security_style_explanations->ran_mixed_content = + security_info.mixed_content_status == + security_state::CONTENT_STATUS_RAN || + security_info.mixed_content_status == + security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; + security_style_explanations->displayed_mixed_content = + security_info.mixed_content_status == + security_state::CONTENT_STATUS_DISPLAYED || + security_info.mixed_content_status == + security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; + + security_style_explanations->contained_mixed_form = + security_info.contained_mixed_form; + + // If the main resource was loaded with no certificate errors or only minor + // certificate errors, then record the presence of subresources with + // certificate errors. Subresource certificate errors aren't recorded when the + // main resource was loaded with major certificate errors because, in the + // common case, these subresource certificate errors would be duplicative with + // the main resource's error. + bool is_cert_status_error = net::IsCertStatusError(security_info.cert_status); + bool is_cert_status_minor_error = + net::IsCertStatusMinorError(security_info.cert_status); + if (!is_cert_status_error || is_cert_status_minor_error) { + security_style_explanations->ran_content_with_cert_errors = + security_info.content_with_cert_errors_status == + security_state::CONTENT_STATUS_RAN || + security_info.content_with_cert_errors_status == + security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; + security_style_explanations->displayed_content_with_cert_errors = + security_info.content_with_cert_errors_status == + security_state::CONTENT_STATUS_DISPLAYED || + security_info.content_with_cert_errors_status == + security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; + } +} + } // namespace std::unique_ptr<security_state::VisibleSecurityState> GetVisibleSecurityState( @@ -183,34 +341,8 @@ const blink::WebSecurityStyle security_style = SecurityLevelToSecurityStyle(security_info.security_level); - if (security_info.security_level == security_state::HTTP_SHOW_WARNING) { - if (security_info.displayed_password_field_on_http || - security_info.displayed_credit_card_field_on_http) { - security_style_explanations->neutral_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_PRIVATE_USER_DATA_INPUT), - l10n_util::GetStringUTF8( - IDS_PRIVATE_USER_DATA_INPUT_DESCRIPTION))); - } - if (security_info.incognito_downgraded_security_level) { - security_style_explanations->neutral_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_INCOGNITO_NONSECURE), - l10n_util::GetStringUTF8(IDS_INCOGNITO_NONSECURE_DESCRIPTION))); - } - } - - security_style_explanations->ran_insecure_content_style = - SecurityLevelToSecurityStyle(security_state::kRanInsecureContentLevel); - security_style_explanations->displayed_insecure_content_style = - SecurityLevelToSecurityStyle( - security_state::kDisplayedInsecureContentLevel); - - if (security_info.malicious_content_status != - security_state::MALICIOUS_CONTENT_STATUS_NONE) { - security_style_explanations->summary = - l10n_util::GetStringUTF8(IDS_SAFEBROWSING_WARNING); - } + ExplainHTTPSecurity(security_info, security_style_explanations); + ExplainSafeBrowsingSecurity(security_info, security_style_explanations); // Check if the page is HTTP; if so, no more explanations are needed. Note // that SecurityStyleUnauthenticated does not necessarily mean that @@ -225,117 +357,9 @@ return security_style; } - if (security_info.sha1_in_chain) { - security_style_explanations->neutral_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_SHA1), - l10n_util::GetStringUTF8(IDS_SHA1_DESCRIPTION), - !!security_info.certificate, - blink::WebMixedContentContextType::kNotMixedContent)); - } - - if (security_info.cert_missing_subject_alt_name) { - security_style_explanations->insecure_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING), - l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING_DESCRIPTION), - !!security_info.certificate, - blink::WebMixedContentContextType::kNotMixedContent)); - } - - // Record the presence of mixed content (HTTP subresources on an HTTPS - // page). - security_style_explanations->ran_mixed_content = - security_info.mixed_content_status == - security_state::CONTENT_STATUS_RAN || - security_info.mixed_content_status == - security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; - security_style_explanations->displayed_mixed_content = - security_info.mixed_content_status == - security_state::CONTENT_STATUS_DISPLAYED || - security_info.mixed_content_status == - security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; - - security_style_explanations->contained_mixed_form = - security_info.contained_mixed_form; - - bool is_cert_status_error = net::IsCertStatusError(security_info.cert_status); - bool is_cert_status_minor_error = - net::IsCertStatusMinorError(security_info.cert_status); - - // If the main resource was loaded no certificate errors or only minor - // certificate errors, then record the presence of subresources with - // certificate errors. Subresource certificate errors aren't recorded - // when the main resource was loaded with major certificate errors - // because, in the common case, these subresource certificate errors - // would be duplicative with the main resource's error. - if (!is_cert_status_error || is_cert_status_minor_error) { - security_style_explanations->ran_content_with_cert_errors = - security_info.content_with_cert_errors_status == - security_state::CONTENT_STATUS_RAN || - security_info.content_with_cert_errors_status == - security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; - security_style_explanations->displayed_content_with_cert_errors = - security_info.content_with_cert_errors_status == - security_state::CONTENT_STATUS_DISPLAYED || - security_info.content_with_cert_errors_status == - security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; - } - - if (is_cert_status_error) { - base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString( - net::MapCertStatusToNetError(security_info.cert_status))); - - content::SecurityStyleExplanation explanation( - l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), - l10n_util::GetStringFUTF8( - IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), - !!security_info.certificate, - blink::WebMixedContentContextType::kNotMixedContent); - - if (is_cert_status_minor_error) { - security_style_explanations->neutral_explanations.push_back(explanation); - } else { - security_style_explanations->insecure_explanations.push_back(explanation); - } - } else { - // If the certificate does not have errors and is not using SHA1, then add - // an explanation that the certificate is valid. - - base::string16 issuer_name; - if (security_info.certificate) { - // This results in the empty string if there is no relevant display name. - issuer_name = base::UTF8ToUTF16( - security_info.certificate->issuer().GetDisplayName()); - } else { - issuer_name = base::string16(); - } - if (issuer_name.empty()) { - issuer_name.assign( - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); - } - - if (!security_info.sha1_in_chain) { - security_style_explanations->secure_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), - l10n_util::GetStringFUTF8( - IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, issuer_name), - !!security_info.certificate, - blink::WebMixedContentContextType::kNotMixedContent)); - } - } - - AddConnectionExplanation(security_info, security_style_explanations); - - security_style_explanations->pkp_bypassed = security_info.pkp_bypassed; - if (security_info.pkp_bypassed) { - security_style_explanations->info_explanations.push_back( - content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_PRIVATE_KEY_PINNING_BYPASSED), - l10n_util::GetStringUTF8( - IDS_PRIVATE_KEY_PINNING_BYPASSED_DESCRIPTION))); - } + ExplainCertificateSecurity(security_info, security_style_explanations); + ExplainConnectionSecurity(security_info, security_style_explanations); + ExplainContentSecurity(security_info, security_style_explanations); return security_style; }
diff --git a/components/signin/core/browser/signin_manager_base.h b/components/signin/core/browser/signin_manager_base.h index 06c08c3..a7c0867 100644 --- a/components/signin/core/browser/signin_manager_base.h +++ b/components/signin/core/browser/signin_manager_base.h
@@ -43,10 +43,6 @@ class PrefService; class SigninClient; -namespace browser_sync { -class ProfileSyncService; -} - namespace password_manager { class PasswordStoreSigninNotifierImpl; } @@ -77,7 +73,6 @@ // Observers that can observer the password of the Google account after a // successful sign-in. friend class PasswordStoreSigninNotifierImpl; - friend class browser_sync::ProfileSyncService; // SigninManagers that fire |GoogleSigninSucceededWithPassword| // notifications.
diff --git a/components/sync/driver/sync_service_crypto.cc b/components/sync/driver/sync_service_crypto.cc index a3c5536..3c338f9 100644 --- a/components/sync/driver/sync_service_crypto.cc +++ b/components/sync/driver/sync_service_crypto.cc
@@ -277,11 +277,6 @@ // Clear our cache of the cryptographer's pending keys. cached_pending_keys_.clear_blob(); - // If the pending keys were resolved via keystore, it's possible we never - // consumed our cached passphrase. Clear it now. - if (!cached_passphrase_.empty()) - cached_passphrase_.clear(); - // Reset passphrase_required_reason_ since we know we no longer require the // passphrase. passphrase_required_reason_ = REASON_PASSPHRASE_NOT_REQUIRED; @@ -391,34 +386,6 @@ return std::move(saved_nigori_state_); } -void SyncServiceCrypto::ConsumeCachedPassphraseIfPossible() { - DCHECK(thread_checker_.CalledOnValidThread()); - - // If no cached passphrase, or sync engine hasn't started up yet, just exit. - // If the engine isn't running yet, OnEngineInitialized() will call this - // method again after the engine starts up. - if (cached_passphrase_.empty() || !engine_) - return; - - // Engine is up and running, so we can consume the cached passphrase. - std::string passphrase = cached_passphrase_; - cached_passphrase_.clear(); - - // If we need a passphrase to decrypt data, try the cached passphrase. - if (passphrase_required_reason() == REASON_DECRYPTION) { - if (SetDecryptionPassphrase(passphrase)) { - DVLOG(1) << "Cached passphrase successfully decrypted pending keys"; - return; - } - } - - // If we get here, we don't have pending keys (or at least, the passphrase - // doesn't decrypt them) - just try to re-encrypt using the encryption - // passphrase. - if (!IsUsingSecondaryPassphrase()) - SetEncryptionPassphrase(passphrase, false); -} - bool SyncServiceCrypto::CheckPassphraseAgainstCachedPendingKeys( const std::string& passphrase) const { DCHECK(cached_pending_keys_.has_blob());
diff --git a/components/sync/driver/sync_service_crypto.h b/components/sync/driver/sync_service_crypto.h index d081a22..f28632f 100644 --- a/components/sync/driver/sync_service_crypto.h +++ b/components/sync/driver/sync_service_crypto.h
@@ -79,21 +79,9 @@ // Takes the previously saved nigori state; null if there isn't any. std::unique_ptr<SyncEncryptionHandler::NigoriState> TakeSavedNigoriState(); - // Sets the cached passphrase. - void CachePassphrase(const std::string& passphrase) { - cached_passphrase_ = passphrase; - } - - // During initial signin, ProfileSyncService caches the user's signin - // passphrase so it can be used to encrypt/decrypt data after sync starts up. - // This routine is invoked once the engine has started up to use the - // cached passphrase and clear it out when it is done. - void ConsumeCachedPassphraseIfPossible(); - PassphraseRequiredReason passphrase_required_reason() const { return passphrase_required_reason_; } - const std::string& cached_passphrase() { return cached_passphrase_; } bool encryption_pending() { return encryption_pending_; } private: @@ -123,12 +111,6 @@ PassphraseRequiredReason passphrase_required_reason_ = REASON_PASSPHRASE_NOT_REQUIRED; - // Sometimes we need to temporarily hold on to a passphrase because we don't - // yet have a engine to send it to. This happens during initialization as - // we don't StartUp until we have a valid token, which happens after valid - // credentials were provided. - std::string cached_passphrase_; - // The current set of encrypted types. Always a superset of // Cryptographer::SensitiveTypes(). ModelTypeSet encrypted_types_ = SyncEncryptionHandler::SensitiveTypes();
diff --git a/components/sync/engine_impl/net/server_connection_manager.cc b/components/sync/engine_impl/net/server_connection_manager.cc index 5bc867b..990502c 100644 --- a/components/sync/engine_impl/net/server_connection_manager.cc +++ b/components/sync/engine_impl/net/server_connection_manager.cc
@@ -97,22 +97,6 @@ return true; } -ServerConnectionManager::ScopedConnectionHelper::ScopedConnectionHelper( - ServerConnectionManager* manager, - Connection* connection) - : manager_(manager), connection_(connection) {} - -ServerConnectionManager::ScopedConnectionHelper::~ScopedConnectionHelper() { - if (connection_) - manager_->OnConnectionDestroyed(connection_.get()); - connection_.reset(); -} - -ServerConnectionManager::Connection* -ServerConnectionManager::ScopedConnectionHelper::get() { - return connection_.get(); -} - namespace { string StripTrailingSlash(const string& s) { @@ -157,46 +141,16 @@ use_ssl_(use_ssl), proto_sync_path_(kSyncServerSyncPath), server_status_(HttpResponse::NONE), - terminated_(false), - active_connection_(nullptr), - cancelation_signal_(cancelation_signal), - signal_handler_registered_(false) { - signal_handler_registered_ = cancelation_signal_->TryRegisterHandler(this); - if (!signal_handler_registered_) { - // Calling a virtual function from a constructor. We can get away with it - // here because ServerConnectionManager::OnSignalReceived() is the function - // we want to call. - OnSignalReceived(); - } -} + cancelation_signal_(cancelation_signal) {} -ServerConnectionManager::~ServerConnectionManager() { - if (signal_handler_registered_) { - cancelation_signal_->UnregisterHandler(this); - } -} +ServerConnectionManager::~ServerConnectionManager() = default; -ServerConnectionManager::Connection* +std::unique_ptr<ServerConnectionManager::Connection> ServerConnectionManager::MakeActiveConnection() { - base::AutoLock lock(terminate_connection_lock_); - DCHECK(!active_connection_); - if (terminated_) + if (cancelation_signal_->IsSignalled()) return nullptr; - active_connection_ = MakeConnection(); - return active_connection_; -} - -void ServerConnectionManager::OnConnectionDestroyed(Connection* connection) { - DCHECK(connection); - base::AutoLock lock(terminate_connection_lock_); - // |active_connection_| can be null already if it was aborted. Also, - // it can legitimately be a different Connection object if a new Connection - // was created after a previous one was Aborted and destroyed. - if (active_connection_ != connection) - return; - - active_connection_ = nullptr; + return MakeConnection(); } bool ServerConnectionManager::SetAuthToken(const std::string& auth_token) { @@ -271,17 +225,15 @@ return false; } - // When our connection object falls out of scope, it clears itself from - // active_connection_. - ScopedConnectionHelper post(this, MakeActiveConnection()); - if (!post.get()) { + std::unique_ptr<Connection> connection = MakeActiveConnection(); + if (!connection.get()) { params->response.server_status = HttpResponse::CONNECTION_UNAVAILABLE; return false; } // Note that |post| may be aborted by now, which will just cause Init to fail // with CONNECTION_UNAVAILABLE. - bool ok = post.get()->Init(path.c_str(), auth_token, params->buffer_in, + bool ok = connection->Init(path.c_str(), auth_token, params->buffer_in, ¶ms->response); if (params->response.server_status == HttpResponse::SYNC_AUTH_ERROR) { @@ -291,7 +243,7 @@ if (!ok || net::HTTP_OK != params->response.response_code) return false; - if (post.get()->ReadBufferResponse(¶ms->buffer_out, ¶ms->response, + if (connection->ReadBufferResponse(¶ms->buffer_out, ¶ms->response, true)) { params->response.server_status = HttpResponse::SERVER_CONNECTION_OK; return true; @@ -311,21 +263,11 @@ listeners_.RemoveObserver(listener); } -ServerConnectionManager::Connection* ServerConnectionManager::MakeConnection() { +std::unique_ptr<ServerConnectionManager::Connection> +ServerConnectionManager::MakeConnection() { return nullptr; // For testing. } -void ServerConnectionManager::OnSignalReceived() { - base::AutoLock lock(terminate_connection_lock_); - terminated_ = true; - if (active_connection_) - active_connection_->Abort(); - - // Sever our ties to this connection object. Note that it still may exist, - // since we don't own it, but it has been neutered. - active_connection_ = nullptr; -} - std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) { s << " Response Code (bogus on error): " << hr.response_code; s << " Content-Length (bogus on error): " << hr.content_length;
diff --git a/components/sync/engine_impl/net/server_connection_manager.h b/components/sync/engine_impl/net/server_connection_manager.h index d61451d..a9fef51 100644 --- a/components/sync/engine_impl/net/server_connection_manager.h +++ b/components/sync/engine_impl/net/server_connection_manager.h
@@ -99,7 +99,7 @@ // Use this class to interact with the sync server. // The ServerConnectionManager currently supports POSTing protocol buffers. // -class ServerConnectionManager : public CancelationObserver { +class ServerConnectionManager { public: // buffer_in - will be POSTed // buffer_out - string will be overwritten with response @@ -146,10 +146,11 @@ } std::string buffer_; - ServerConnectionManager* scm_; private: int ReadResponse(std::string* buffer, int length); + + ServerConnectionManager* scm_; }; ServerConnectionManager(const std::string& server, @@ -157,7 +158,7 @@ bool use_ssl, CancelationSignal* cancelation_signal); - ~ServerConnectionManager() override; + virtual ~ServerConnectionManager(); // POSTS buffer_in and reads a response into buffer_out. Uses our currently // set auth token in our headers. @@ -177,13 +178,7 @@ // Factory method to create an Connection object we can use for // communication with the server. - virtual Connection* MakeConnection(); - - // Closes any active network connections to the sync server. - // We expect this to get called on a different thread than the valid - // ThreadChecker thread, as we want to kill any pending http traffic without - // having to wait for the request to complete. - void OnSignalReceived() final; + virtual std::unique_ptr<Connection> MakeConnection(); void set_client_id(const std::string& client_id) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -219,34 +214,11 @@ // known bad token. void InvalidateAndClearAuthToken(); - // Helper to check terminated flags and build a Connection object, installing - // it as the |active_connection_|. If this ServerConnectionManager has been - // terminated, this will return null. - Connection* MakeActiveConnection(); - - // Called by Connection objects as they are destroyed to allow the - // ServerConnectionManager to cleanup active connections. - void OnConnectionDestroyed(Connection* connection); + // Helper to check terminated flags and build a Connection object. If this + // ServerConnectionManager has been terminated, this will return null. + std::unique_ptr<Connection> MakeActiveConnection(); private: - // A class to help deal with cleaning up active Connection objects when (for - // ex) multiple early-exits are present in some scope. ScopedConnectionHelper - // informs the ServerConnectionManager before the Connection object it takes - // ownership of is destroyed. - class ScopedConnectionHelper { - public: - // |manager| must outlive this. Takes ownership of |connection|. - ScopedConnectionHelper(ServerConnectionManager* manager, - Connection* connection); - ~ScopedConnectionHelper(); - Connection* get(); - - private: - ServerConnectionManager* manager_; - std::unique_ptr<Connection> connection_; - DISALLOW_COPY_AND_ASSIGN(ScopedConnectionHelper); - }; - void NotifyStatusChanged(); // The sync_server_ is the server that requests will be made to. @@ -276,19 +248,7 @@ base::ThreadChecker thread_checker_; - // Protects all variables below to allow bailing out of active connections. - base::Lock terminate_connection_lock_; - - // If true, we've been told to terminate IO and expect to be destroyed - // shortly. No future network requests will be made. - bool terminated_; - - // A non-owning pointer to any active http connection, so that we can abort - // it if necessary. - Connection* active_connection_; - CancelationSignal* const cancelation_signal_; - bool signal_handler_registered_; DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); };
diff --git a/components/sync/engine_impl/net/sync_server_connection_manager.cc b/components/sync/engine_impl/net/sync_server_connection_manager.cc index 55b5803..dd47f593 100644 --- a/components/sync/engine_impl/net/sync_server_connection_manager.cc +++ b/components/sync/engine_impl/net/sync_server_connection_manager.cc
@@ -6,6 +6,8 @@ #include <stdint.h> +#include "base/callback_helpers.h" +#include "components/sync/base/cancelation_signal.h" #include "components/sync/engine/net/http_post_provider_factory.h" #include "components/sync/engine/net/http_post_provider_interface.h" #include "net/base/net_errors.h" @@ -13,9 +15,13 @@ namespace syncer { -SyncBridgedConnection::SyncBridgedConnection(ServerConnectionManager* scm, - HttpPostProviderFactory* factory) - : Connection(scm), factory_(factory) { +SyncBridgedConnection::SyncBridgedConnection( + ServerConnectionManager* scm, + HttpPostProviderFactory* factory, + CancelationSignal* cancelation_signal) + : Connection(scm), + factory_(factory), + cancelation_signal_(cancelation_signal) { post_provider_ = factory_->Create(); } @@ -51,6 +57,15 @@ // Issue the POST, blocking until it finishes. int error_code = 0; int response_code = 0; + if (!cancelation_signal_->TryRegisterHandler(this)) { + // Return early because cancelation signal was signaled. + response->server_status = HttpResponse::CONNECTION_UNAVAILABLE; + return false; + } + base::ScopedClosureRunner auto_unregister(base::Bind( + &CancelationSignal::UnregisterHandler, + base::Unretained(cancelation_signal_), base::Unretained(this))); + if (!http->MakeSynchronousPost(&error_code, &response_code)) { DCHECK_NE(error_code, net::OK); DVLOG(1) << "Http POST failed, error returns: " << error_code; @@ -81,6 +96,11 @@ post_provider_->Abort(); } +void SyncBridgedConnection::OnSignalReceived() { + DCHECK(post_provider_); + post_provider_->Abort(); +} + SyncServerConnectionManager::SyncServerConnectionManager( const std::string& server, int port, @@ -88,15 +108,17 @@ HttpPostProviderFactory* factory, CancelationSignal* cancelation_signal) : ServerConnectionManager(server, port, use_ssl, cancelation_signal), - post_provider_factory_(factory) { + post_provider_factory_(factory), + cancelation_signal_(cancelation_signal) { DCHECK(post_provider_factory_.get()); } -SyncServerConnectionManager::~SyncServerConnectionManager() {} +SyncServerConnectionManager::~SyncServerConnectionManager() = default; -ServerConnectionManager::Connection* +std::unique_ptr<ServerConnectionManager::Connection> SyncServerConnectionManager::MakeConnection() { - return new SyncBridgedConnection(this, post_provider_factory_.get()); + return base::MakeUnique<SyncBridgedConnection>( + this, post_provider_factory_.get(), cancelation_signal_); } } // namespace syncer
diff --git a/components/sync/engine_impl/net/sync_server_connection_manager.h b/components/sync/engine_impl/net/sync_server_connection_manager.h index f9b03c0..76190e11 100644 --- a/components/sync/engine_impl/net/sync_server_connection_manager.h +++ b/components/sync/engine_impl/net/sync_server_connection_manager.h
@@ -20,10 +20,12 @@ // This provides HTTP Post functionality through the interface provided // by the application hosting the syncer backend. -class SyncBridgedConnection : public ServerConnectionManager::Connection { +class SyncBridgedConnection : public ServerConnectionManager::Connection, + public CancelationObserver { public: SyncBridgedConnection(ServerConnectionManager* scm, - HttpPostProviderFactory* factory); + HttpPostProviderFactory* factory, + CancelationSignal* cancelation_signal); ~SyncBridgedConnection() override; @@ -34,11 +36,17 @@ void Abort() override; + void OnSignalReceived() override; + private: // Pointer to the factory we use for creating HttpPostProviders. We do not // own |factory_|. HttpPostProviderFactory* factory_; + // Cancelation signal is signalled when engine shuts down. Current blocking + // operation should be aborted. + CancelationSignal* cancelation_signal_; + HttpPostProviderInterface* post_provider_; DISALLOW_COPY_AND_ASSIGN(SyncBridgedConnection); @@ -57,7 +65,7 @@ ~SyncServerConnectionManager() override; // ServerConnectionManager overrides. - Connection* MakeConnection() override; + std::unique_ptr<Connection> MakeConnection() override; private: FRIEND_TEST_ALL_PREFIXES(SyncServerConnectionManagerTest, VeryEarlyAbortPost); @@ -70,6 +78,10 @@ // issue a POST to sync servers. std::unique_ptr<HttpPostProviderFactory> post_provider_factory_; + // Cancelation signal is signalled when engine shuts down. Current blocking + // operation should be aborted. + CancelationSignal* cancelation_signal_; + DISALLOW_COPY_AND_ASSIGN(SyncServerConnectionManager); };
diff --git a/components/sync/engine_impl/syncer_proto_util_unittest.cc b/components/sync/engine_impl/syncer_proto_util_unittest.cc index 4efb8ed..4230246 100644 --- a/components/sync/engine_impl/syncer_proto_util_unittest.cc +++ b/components/sync/engine_impl/syncer_proto_util_unittest.cc
@@ -219,7 +219,6 @@ : ServerConnectionManager("unused", 0, false, signal), send_error_(false) {} - ~DummyConnectionManager() override {} bool PostBufferWithCachedAuth(PostBufferParams* params) override { if (send_error_) { return false;
diff --git a/components/ui_devtools/views/ui_devtools_unittest.cc b/components/ui_devtools/views/ui_devtools_unittest.cc index fbd45920..9ebf91f5 100644 --- a/components/ui_devtools/views/ui_devtools_unittest.cc +++ b/components/ui_devtools/views/ui_devtools_unittest.cc
@@ -139,8 +139,8 @@ return -1; } -ui::Layer* GetHighlightingLayer(aura::Window* highlight_window) { - for (auto* layer : highlight_window->layer()->children()) { +ui::Layer* GetHighlightingLayer(aura::Window* root_window) { + for (auto* layer : root_window->layer()->children()) { if (layer->name() == "HighlightingLayer") return layer; } @@ -166,9 +166,8 @@ .build(); } -void ExpectHighlighted(const gfx::Rect& bounds, - aura::Window* highlight_window) { - ui::Layer* highlighting_layer = GetHighlightingLayer(highlight_window); +void ExpectHighlighted(const gfx::Rect& bounds, aura::Window* root_window) { + ui::Layer* highlighting_layer = GetHighlightingLayer(root_window); EXPECT_TRUE(highlighting_layer->visible()); EXPECT_EQ(bounds, highlighting_layer->bounds()); EXPECT_EQ(kBackgroundColor, highlighting_layer->GetTargetColor());
diff --git a/components/variations/client_filterable_state.h b/components/variations/client_filterable_state.h index c2671f37..20ebaa9 100644 --- a/components/variations/client_filterable_state.h +++ b/components/variations/client_filterable_state.h
@@ -41,6 +41,10 @@ // identify models of devices. std::string hardware_class; + // Whether this is a low-end device. Currently only supported on Android. + // Based on base::SysInfo::IsLowEndDevice(). + bool is_low_end_device = false; + // The country code to use for studies configured with session consistency. std::string session_consistency_country;
diff --git a/components/variations/proto/study.proto b/components/variations/proto/study.proto index 42f11b35..b7a0bb69b 100644 --- a/components/variations/proto/study.proto +++ b/components/variations/proto/study.proto
@@ -206,7 +206,7 @@ // Filtering criteria specifying whether this study is applicable to a given // Chrome instance. // - // Next tag: 15 + // Next tag: 16 message Filter { // The start date of the study in Unix time format. (Seconds since midnight // January 1, 1970 UTC). See: http://en.wikipedia.org/wiki/Unix_time @@ -300,6 +300,10 @@ // |country| is specified. Mutually exclusive with |country|. // Ex: ["in", "us"] repeated string exclude_country = 11; + + // Specifies whether the config should apply to low-end devices only. This + // is currently only supported on Android. + optional bool is_low_end_device = 15; } // Filtering criteria for this study. A study that is filtered out for a given
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index ab3b89e..e6c32d9 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc
@@ -632,6 +632,13 @@ state->form_factor = GetCurrentFormFactor(); state->platform = ClientFilterableState::GetCurrentPlatform(); state->hardware_class = GetHardwareClass(); +#if defined(OS_ANDROID) + // This is set on Android only currently, because the IsLowEndDevice() API + // on other platforms has no intrinsic meaning outside of a field trial that + // controls its value. Since this is before server-side field trials are + // evaluated, that field trial would not be able to apply for this case. + state->is_low_end_device = base::SysInfo::IsLowEndDevice(); +#endif state->session_consistency_country = GetLatestCountry(); state->permanent_consistency_country = LoadPermanentConsistencyCountry( version, state->session_consistency_country);
diff --git a/components/variations/study_filtering.cc b/components/variations/study_filtering.cc index e7ccd25..97d4390 100644 --- a/components/variations/study_filtering.cc +++ b/components/variations/study_filtering.cc
@@ -116,6 +116,12 @@ return false; } +bool CheckStudyLowEndDevice(const Study::Filter& filter, + bool is_low_end_device) { + return !filter.has_is_low_end_device() || + filter.is_low_end_device() == is_low_end_device; +} + bool CheckStudyStartDate(const Study::Filter& filter, const base::Time& date_time) { if (filter.has_start_date()) { @@ -245,6 +251,13 @@ return false; } + if (!CheckStudyLowEndDevice(study.filter(), + client_state.is_low_end_device)) { + DVLOG(1) << "Filtered out study " << study.name() + << " due to is_low_end_device."; + return false; + } + const std::string& country = GetClientCountryForStudy(study, client_state); if (!CheckStudyCountry(study.filter(), country)) { DVLOG(1) << "Filtered out study " << study.name() << " due to country.";
diff --git a/components/variations/study_filtering.h b/components/variations/study_filtering.h index a5667cd..87b4fae 100644 --- a/components/variations/study_filtering.h +++ b/components/variations/study_filtering.h
@@ -41,6 +41,10 @@ // Checks whether a study is applicable for the given |platform| per |filter|. bool CheckStudyPlatform(const Study::Filter& filter, Study::Platform platform); +// Checks whether a study is applicable given |is_low_end_device| per |filter|. +bool CheckStudyLowEndDevice(const Study::Filter& filter, + bool is_low_end_device); + // Checks whether a study is applicable for the given date/time per |filter|. bool CheckStudyStartDate(const Study::Filter& filter, const base::Time& date_time);
diff --git a/components/variations/study_filtering_unittest.cc b/components/variations/study_filtering_unittest.cc index 1d70c48..c9728e4 100644 --- a/components/variations/study_filtering_unittest.cc +++ b/components/variations/study_filtering_unittest.cc
@@ -255,6 +255,22 @@ } } +TEST(VariationsStudyFilteringTest, CheckStudyLowEndDevice) { + Study::Filter filter; + + // Check that if the filter is not set, study applies to either low end value. + EXPECT_TRUE(internal::CheckStudyLowEndDevice(filter, true)); + EXPECT_TRUE(internal::CheckStudyLowEndDevice(filter, false)); + + filter.set_is_low_end_device(true); + EXPECT_TRUE(internal::CheckStudyLowEndDevice(filter, true)); + EXPECT_FALSE(internal::CheckStudyLowEndDevice(filter, false)); + + filter.set_is_low_end_device(false); + EXPECT_FALSE(internal::CheckStudyLowEndDevice(filter, true)); + EXPECT_TRUE(internal::CheckStudyLowEndDevice(filter, false)); +} + TEST(VariationsStudyFilteringTest, CheckStudyStartDate) { const base::Time now = base::Time::Now(); const base::TimeDelta delta = base::TimeDelta::FromHours(1);
diff --git a/components/viz/client/client_layer_tree_frame_sink.cc b/components/viz/client/client_layer_tree_frame_sink.cc index 2a5dc333..ca6af71 100644 --- a/components/viz/client/client_layer_tree_frame_sink.cc +++ b/components/viz/client/client_layer_tree_frame_sink.cc
@@ -96,7 +96,7 @@ } void ClientLayerTreeFrameSink::SetLocalSurfaceId( - const cc::LocalSurfaceId& local_surface_id) { + const LocalSurfaceId& local_surface_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(local_surface_id.is_valid()); DCHECK(enable_surface_synchronization_);
diff --git a/components/viz/client/client_layer_tree_frame_sink.h b/components/viz/client/client_layer_tree_frame_sink.h index 4946db4..537cdf0 100644 --- a/components/viz/client/client_layer_tree_frame_sink.h +++ b/components/viz/client/client_layer_tree_frame_sink.h
@@ -11,8 +11,8 @@ #include "cc/output/context_provider.h" #include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" -#include "cc/surfaces/local_surface_id_allocator.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/local_surface_id_allocator.h" +#include "components/viz/common/surface_id.h" #include "mojo/public/cpp/bindings/binding.h" namespace viz { @@ -52,7 +52,7 @@ // cc::LayerTreeFrameSink implementation. bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; - void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; + void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) override; void SubmitCompositorFrame(cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; @@ -70,7 +70,7 @@ static void OnMojoConnectionError(uint32_t custom_reason, const std::string& description); - cc::LocalSurfaceId local_surface_id_; + LocalSurfaceId local_surface_id_; std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_; std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_;
diff --git a/components/viz/client/local_surface_id_provider.cc b/components/viz/client/local_surface_id_provider.cc index caf3ca9..90773f3 100644 --- a/components/viz/client/local_surface_id_provider.cc +++ b/components/viz/client/local_surface_id_provider.cc
@@ -13,8 +13,7 @@ DefaultLocalSurfaceIdProvider::DefaultLocalSurfaceIdProvider() = default; -const cc::LocalSurfaceId& -DefaultLocalSurfaceIdProvider::GetLocalSurfaceIdForFrame( +const LocalSurfaceId& DefaultLocalSurfaceIdProvider::GetLocalSurfaceIdForFrame( const cc::CompositorFrame& frame) { gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); if (!local_surface_id_.is_valid() || surface_size_ != frame_size ||
diff --git a/components/viz/client/local_surface_id_provider.h b/components/viz/client/local_surface_id_provider.h index 50f4dd2e..49ec5242 100644 --- a/components/viz/client/local_surface_id_provider.h +++ b/components/viz/client/local_surface_id_provider.h
@@ -5,8 +5,8 @@ #ifndef COMPONENTS_VIZ_CLIENT_LOCAL_SURFACE_ID_PROVIDER_H_ #define COMPONENTS_VIZ_CLIENT_LOCAL_SURFACE_ID_PROVIDER_H_ -#include "cc/surfaces/local_surface_id.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "ui/gfx/geometry/size.h" namespace cc { @@ -20,7 +20,7 @@ LocalSurfaceIdProvider(); virtual ~LocalSurfaceIdProvider(); - virtual const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame( + virtual const LocalSurfaceId& GetLocalSurfaceIdForFrame( const cc::CompositorFrame& frame) = 0; private: @@ -31,14 +31,14 @@ public: DefaultLocalSurfaceIdProvider(); - const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame( + const LocalSurfaceId& GetLocalSurfaceIdForFrame( const cc::CompositorFrame& frame) override; private: - cc::LocalSurfaceId local_surface_id_; + LocalSurfaceId local_surface_id_; gfx::Size surface_size_; float device_scale_factor_ = 0; - cc::LocalSurfaceIdAllocator local_surface_id_allocator_; + LocalSurfaceIdAllocator local_surface_id_allocator_; DISALLOW_COPY_AND_ASSIGN(DefaultLocalSurfaceIdProvider); };
diff --git a/components/viz/common/BUILD.gn b/components/viz/common/BUILD.gn index 1737f83f..c9051b6 100644 --- a/components/viz/common/BUILD.gn +++ b/components/viz/common/BUILD.gn
@@ -6,15 +6,24 @@ source_set("common") { sources = [ + "frame_sink_id.cc", + "frame_sink_id.h", + "frame_sink_id_allocator.h", "gl_helper.cc", "gl_helper.h", "gl_helper_readback_support.cc", "gl_helper_readback_support.h", "gl_helper_scaling.cc", "gl_helper_scaling.h", + "local_surface_id.cc", + "local_surface_id.h", + "local_surface_id_allocator.cc", + "local_surface_id_allocator.h", "quads/resource_format.h", "quads/shared_bitmap.cc", "quads/shared_bitmap.h", + "quads/texture_mailbox.cc", + "quads/texture_mailbox.h", "resources/buffer_to_texture_target_map.cc", "resources/buffer_to_texture_target_map.h", "resources/platform_color.h", @@ -23,18 +32,23 @@ "resources/resource_settings.cc", "resources/resource_settings.h", "resources/shared_bitmap_manager.h", + "surface_id.cc", + "surface_id.h", ] deps = [ "//base", "//gpu/command_buffer/client:gles2_interface", + "//mojo/public/cpp/bindings", "//skia", + "//ui/gfx:color_space", "//ui/gfx/geometry", ] public_deps = [ "//gpu/command_buffer/client", "//gpu/command_buffer/common", + "//mojo/public/cpp/bindings", ] }
diff --git a/components/viz/common/DEPS b/components/viz/common/DEPS index 2455aca..b4322a2 100644 --- a/components/viz/common/DEPS +++ b/components/viz/common/DEPS
@@ -5,6 +5,7 @@ "+gpu/command_buffer/client", "+gpu/command_buffer/common", "+gpu/ipc/common", + "+mojo/public/cpp/bindings", "+ui/gfx/geometry", "+services/ui/gpu/interfaces", "+third_party/skia",
diff --git a/cc/surfaces/frame_sink_id.cc b/components/viz/common/frame_sink_id.cc similarity index 83% rename from cc/surfaces/frame_sink_id.cc rename to components/viz/common/frame_sink_id.cc index 129c740..1e5653e0 100644 --- a/cc/surfaces/frame_sink_id.cc +++ b/components/viz/common/frame_sink_id.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "base/strings/stringprintf.h" -namespace cc { +namespace viz { std::string FrameSinkId::ToString() const { return base::StringPrintf("FrameSinkId(%d, %d)", client_id_, sink_id_); @@ -16,4 +16,4 @@ return out << frame_sink_id.ToString(); } -} // namespace cc +} // namespace viz
diff --git a/cc/surfaces/frame_sink_id.h b/components/viz/common/frame_sink_id.h similarity index 88% rename from cc/surfaces/frame_sink_id.h rename to components/viz/common/frame_sink_id.h index 4bf95b1..8b2c6853 100644 --- a/cc/surfaces/frame_sink_id.h +++ b/components/viz/common/frame_sink_id.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_FRAME_SINK_ID_H_ -#define CC_SURFACES_FRAME_SINK_ID_H_ +#ifndef COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_H_ +#define COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_H_ #include <stdint.h> @@ -13,7 +13,7 @@ #include "base/hash.h" -namespace cc { +namespace viz { class FrameSinkId { public: @@ -57,6 +57,6 @@ size_t operator()(const FrameSinkId& key) const { return key.hash(); } }; -} // namespace cc +} // namespace viz -#endif // CC_SURFACES_FRAME_SINK_ID_H_ +#endif // COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_H_
diff --git a/cc/surfaces/frame_sink_id_allocator.h b/components/viz/common/frame_sink_id_allocator.h similarity index 70% rename from cc/surfaces/frame_sink_id_allocator.h rename to components/viz/common/frame_sink_id_allocator.h index 48bf1aa..c92bf9e7 100644 --- a/cc/surfaces/frame_sink_id_allocator.h +++ b/components/viz/common/frame_sink_id_allocator.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ -#define CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ +#ifndef COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_ALLOCATOR_H_ +#define COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_ALLOCATOR_H_ -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" -namespace cc { +namespace viz { // This class generates FrameSinkId with a fixed client_id and an // incrementally-increasing sink_id. @@ -27,6 +27,6 @@ DISALLOW_COPY_AND_ASSIGN(FrameSinkIdAllocator); }; -} // namespace cc +} // namespace viz -#endif // CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ +#endif // COMPONENTS_VIZ_COMMON_FRAME_SINK_ID_ALLOCATOR_H_
diff --git a/cc/surfaces/local_surface_id.cc b/components/viz/common/local_surface_id.cc similarity index 85% rename from cc/surfaces/local_surface_id.cc rename to components/viz/common/local_surface_id.cc index cf934f0d..c1ea944 100644 --- a/cc/surfaces/local_surface_id.cc +++ b/components/viz/common/local_surface_id.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "base/strings/stringprintf.h" -namespace cc { +namespace viz { std::string LocalSurfaceId::ToString() const { return base::StringPrintf("LocalSurfaceId(%d, %s" PRIu64 ")", local_id_, @@ -18,4 +18,4 @@ return out << local_surface_id.ToString(); } -} // namespace cc +} // namespace viz
diff --git a/cc/surfaces/local_surface_id.h b/components/viz/common/local_surface_id.h similarity index 87% rename from cc/surfaces/local_surface_id.h rename to components/viz/common/local_surface_id.h index 138bfa64..6790c94 100644 --- a/cc/surfaces/local_surface_id.h +++ b/components/viz/common/local_surface_id.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_LOCAL_SURFACE_ID_H_ -#define CC_SURFACES_LOCAL_SURFACE_ID_H_ +#ifndef COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_H_ +#define COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_H_ #include <inttypes.h> @@ -19,6 +19,9 @@ namespace mojom { class LocalSurfaceIdDataView; } +} // namespace cc + +namespace viz { class LocalSurfaceId { public: @@ -61,7 +64,7 @@ std::string ToString() const; private: - friend struct mojo::StructTraits<mojom::LocalSurfaceIdDataView, + friend struct mojo::StructTraits<cc::mojom::LocalSurfaceIdDataView, LocalSurfaceId>; uint32_t local_id_; @@ -75,6 +78,6 @@ size_t operator()(const LocalSurfaceId& key) const { return key.hash(); } }; -} // namespace cc +} // namespace viz -#endif // CC_SURFACES_LOCAL_SURFACE_ID_H_ +#endif // COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_H_
diff --git a/cc/surfaces/local_surface_id_allocator.cc b/components/viz/common/local_surface_id_allocator.cc similarity index 84% rename from cc/surfaces/local_surface_id_allocator.cc rename to components/viz/common/local_surface_id_allocator.cc index d1603b3..5922160d 100644 --- a/cc/surfaces/local_surface_id_allocator.cc +++ b/components/viz/common/local_surface_id_allocator.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include <stdint.h> #include "base/rand_util.h" #include "base/unguessable_token.h" -namespace cc { +namespace viz { LocalSurfaceIdAllocator::LocalSurfaceIdAllocator() : next_id_(1u) {} @@ -21,4 +21,4 @@ return id; } -} // namespace cc +} // namespace viz
diff --git a/cc/surfaces/local_surface_id_allocator.h b/components/viz/common/local_surface_id_allocator.h similarity index 64% rename from cc/surfaces/local_surface_id_allocator.h rename to components/viz/common/local_surface_id_allocator.h index 1e4b1b9..bba8f297 100644 --- a/cc/surfaces/local_surface_id_allocator.h +++ b/components/viz/common/local_surface_id_allocator.h
@@ -2,21 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_LOCAL_SURFACE_ID_ALLOCATOR_H_ -#define CC_SURFACES_LOCAL_SURFACE_ID_ALLOCATOR_H_ +#ifndef COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_ALLOCATOR_H_ +#define COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_ALLOCATOR_H_ #include <stdint.h> #include "base/macros.h" -#include "cc/surfaces/surface_id.h" -#include "cc/surfaces/surfaces_export.h" +#include "components/viz/common/surface_id.h" -namespace cc { +namespace viz { // This is a helper class for generating local surface IDs for a single // FrameSink. This is not threadsafe, to use from multiple threads wrap this // class in a mutex. -class CC_SURFACES_EXPORT LocalSurfaceIdAllocator { +class LocalSurfaceIdAllocator { public: LocalSurfaceIdAllocator(); ~LocalSurfaceIdAllocator(); @@ -29,6 +28,6 @@ DISALLOW_COPY_AND_ASSIGN(LocalSurfaceIdAllocator); }; -} // namespace cc +} // namespace viz -#endif // CC_SURFACES_LOCAL_SURFACE_ID_ALLOCATOR_H_ +#endif // COMPONENTS_VIZ_COMMON_LOCAL_SURFACE_ID_ALLOCATOR_H_
diff --git a/components/viz/common/quads/DEPS b/components/viz/common/quads/DEPS index b273ae3..1b76160 100644 --- a/components/viz/common/quads/DEPS +++ b/components/viz/common/quads/DEPS
@@ -1,3 +1,4 @@ include_rules = [ + "+mojo/public/cpp/bindings", "+ui/gfx", ]
diff --git a/cc/resources/texture_mailbox.cc b/components/viz/common/quads/texture_mailbox.cc similarity index 89% rename from cc/resources/texture_mailbox.cc rename to components/viz/common/quads/texture_mailbox.cc index 468624d..6b04c114 100644 --- a/cc/resources/texture_mailbox.cc +++ b/components/viz/common/quads/texture_mailbox.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include <stddef.h> #include <stdint.h> @@ -10,10 +10,9 @@ #include "base/logging.h" #include "components/viz/common/quads/shared_bitmap.h" -namespace cc { +namespace viz { -TextureMailbox::TextureMailbox() : shared_bitmap_(NULL) { -} +TextureMailbox::TextureMailbox() : shared_bitmap_(NULL) {} TextureMailbox::TextureMailbox(const TextureMailbox& other) = default; @@ -62,7 +61,7 @@ DCHECK(!is_overlay_candidate || !size_in_pixels.IsEmpty()); } -TextureMailbox::TextureMailbox(viz::SharedBitmap* shared_bitmap, +TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels) : shared_bitmap_(shared_bitmap), size_in_pixels_(size_in_pixels), @@ -75,7 +74,7 @@ nearest_neighbor_(false) { // If an embedder of cc gives an invalid TextureMailbox, we should crash // here to identify the offender. - CHECK(viz::SharedBitmap::VerifySizeInBytes(size_in_pixels_)); + CHECK(SharedBitmap::VerifySizeInBytes(size_in_pixels_)); } TextureMailbox::~TextureMailbox() {} @@ -96,7 +95,7 @@ size_t TextureMailbox::SharedMemorySizeInBytes() const { // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the // constructor and the field is immutable. - return viz::SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); + return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); } -} // namespace cc +} // namespace viz
diff --git a/cc/resources/texture_mailbox.h b/components/viz/common/quads/texture_mailbox.h similarity index 87% rename from cc/resources/texture_mailbox.h rename to components/viz/common/quads/texture_mailbox.h index 4380135..7136d7e 100644 --- a/cc/resources/texture_mailbox.h +++ b/components/viz/common/quads/texture_mailbox.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_RESOURCES_TEXTURE_MAILBOX_H_ -#define CC_RESOURCES_TEXTURE_MAILBOX_H_ +#ifndef COMPONENTS_VIZ_COMMON_QUADS_TEXTURE_MAILBOX_H_ +#define COMPONENTS_VIZ_COMMON_QUADS_TEXTURE_MAILBOX_H_ #include <stddef.h> #include <stdint.h> @@ -11,25 +11,25 @@ #include <string> #include "base/memory/shared_memory.h" -#include "cc/cc_export.h" +#include "build/build_config.h" #include "gpu/command_buffer/common/mailbox_holder.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "ui/gfx/color_space.h" #include "ui/gfx/geometry/size.h" -namespace viz { -class SharedBitmap; -} - namespace cc { - namespace mojom { class TextureMailboxDataView; } +} // namespace cc + +namespace viz { + +class SharedBitmap; // TODO(skaslev, danakj) Rename this class more apropriately since now it // can hold a shared memory resource as well as a texture mailbox. -class CC_EXPORT TextureMailbox { +class TextureMailbox { public: TextureMailbox(); TextureMailbox(const TextureMailbox& other); @@ -43,8 +43,7 @@ const gfx::Size& size_in_pixels, bool is_overlay_candidate, bool secure_output_only); - TextureMailbox(viz::SharedBitmap* shared_bitmap, - const gfx::Size& size_in_pixels); + TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels); ~TextureMailbox(); @@ -84,7 +83,7 @@ // This is valid if allow_overlau() or IsSharedMemory() is true. gfx::Size size_in_pixels() const { return size_in_pixels_; } - viz::SharedBitmap* shared_bitmap() const { return shared_bitmap_; } + SharedBitmap* shared_bitmap() const { return shared_bitmap_; } size_t SharedMemorySizeInBytes() const; #if defined(OS_ANDROID) @@ -102,11 +101,11 @@ #endif private: - friend struct mojo::StructTraits<mojom::TextureMailboxDataView, + friend struct mojo::StructTraits<cc::mojom::TextureMailboxDataView, TextureMailbox>; gpu::MailboxHolder mailbox_holder_; - viz::SharedBitmap* shared_bitmap_; + SharedBitmap* shared_bitmap_; gfx::Size size_in_pixels_; bool is_overlay_candidate_; #if defined(OS_ANDROID) @@ -118,6 +117,6 @@ gfx::ColorSpace color_space_; }; -} // namespace cc +} // namespace viz -#endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ +#endif // COMPONENTS_VIZ_COMMON_QUADS_TEXTURE_MAILBOX_H_
diff --git a/cc/surfaces/surface_id.cc b/components/viz/common/surface_id.cc similarity index 86% rename from cc/surfaces/surface_id.cc rename to components/viz/common/surface_id.cc index 079a377..62384cd6 100644 --- a/cc/surfaces/surface_id.cc +++ b/components/viz/common/surface_id.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "base/strings/stringprintf.h" -namespace cc { +namespace viz { std::string SurfaceId::ToString() const { return base::StringPrintf("SurfaceId(%s, %s)", @@ -18,4 +18,4 @@ return out << surface_id.ToString(); } -} // namespace cc +} // namespace viz
diff --git a/cc/surfaces/surface_id.h b/components/viz/common/surface_id.h similarity index 86% rename from cc/surfaces/surface_id.h rename to components/viz/common/surface_id.h index 1dc32ce..81cfd6bf 100644 --- a/cc/surfaces/surface_id.h +++ b/components/viz/common/surface_id.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_SURFACE_ID_H_ -#define CC_SURFACES_SURFACE_ID_H_ +#ifndef COMPONENTS_VIZ_COMMON_SURFACE_ID_H_ +#define COMPONENTS_VIZ_COMMON_SURFACE_ID_H_ #include <stdint.h> @@ -12,14 +12,17 @@ #include "base/format_macros.h" #include "base/hash.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id.h" #include "mojo/public/cpp/bindings/struct_traits.h" namespace cc { namespace mojom { class SurfaceIdDataView; } +} // namespace cc + +namespace viz { class SurfaceId { public: @@ -66,7 +69,7 @@ } private: - friend struct mojo::StructTraits<mojom::SurfaceIdDataView, SurfaceId>; + friend struct mojo::StructTraits<cc::mojom::SurfaceIdDataView, SurfaceId>; FrameSinkId frame_sink_id_; LocalSurfaceId local_surface_id_; @@ -78,6 +81,6 @@ size_t operator()(const SurfaceId& key) const { return key.hash(); } }; -} // namespace cc +} // namespace viz -#endif // CC_SURFACES_SURFACE_ID_H_ +#endif // COMPONENTS_VIZ_COMMON_SURFACE_ID_H_
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc index 0f9ce146..6b73e34 100644 --- a/components/viz/host/host_frame_sink_manager.cc +++ b/components/viz/host/host_frame_sink_manager.cc
@@ -32,7 +32,7 @@ } void HostFrameSinkManager::CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkClientPtr client) { DCHECK_EQ(frame_sink_data_map_.count(frame_sink_id), 0u); @@ -45,7 +45,7 @@ } void HostFrameSinkManager::DestroyCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id) { + const FrameSinkId& frame_sink_id) { auto iter = frame_sink_data_map_.find(frame_sink_id); DCHECK(iter != frame_sink_data_map_.end()); @@ -58,8 +58,8 @@ } void HostFrameSinkManager::RegisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) { // Register and store the parent. frame_sink_manager_ptr_->RegisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); @@ -67,8 +67,8 @@ } void HostFrameSinkManager::UnregisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) { auto iter = frame_sink_data_map_.find(child_frame_sink_id); DCHECK(iter != frame_sink_data_map_.end()); @@ -93,7 +93,7 @@ } void HostFrameSinkManager::OnClientConnectionClosed( - const cc::FrameSinkId& frame_sink_id) { + const FrameSinkId& frame_sink_id) { // TODO(kylechar): Notify observers. }
diff --git a/components/viz/host/host_frame_sink_manager.h b/components/viz/host/host_frame_sink_manager.h index b1c7758b..7c82b782 100644 --- a/components/viz/host/host_frame_sink_manager.h +++ b/components/viz/host/host_frame_sink_manager.h
@@ -11,7 +11,7 @@ #include "base/observer_list.h" #include "base/optional.h" #include "cc/ipc/frame_sink_manager.mojom.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/host/frame_sink_observer.h" #include "components/viz/host/viz_host_export.h" #include "mojo/public/cpp/bindings/binding.h" @@ -44,25 +44,25 @@ // that allows the client to submit CompositorFrames. When no longer needed, // call DestroyCompositorFrameSink(). void CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkClientPtr client); // Destroys a client connection. Will call UnregisterFrameSinkHierarchy() with // the registered parent if there is one. - void DestroyCompositorFrameSink(const cc::FrameSinkId& frame_sink_id); + void DestroyCompositorFrameSink(const FrameSinkId& frame_sink_id); // Registers FrameSink hierarchy. Clients can call this multiple times to // reparent without calling UnregisterFrameSinkHierarchy(). If a client uses // CompositorFrameSink, then CreateCompositorFrameSink() should be called // before this. - void RegisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id); + void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id); // Unregisters FrameSink hierarchy. Client must have registered FrameSink // hierarchy before unregistering. - void UnregisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id); + void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id); private: struct FrameSinkData { @@ -73,7 +73,7 @@ // The FrameSinkId registered as the parent in the BeginFrame hierarchy. // This mirrors state in viz. - base::Optional<cc::FrameSinkId> parent; + base::Optional<FrameSinkId> parent; // The private interface that gives the host control over the // CompositorFrameSink connection between the client and viz. @@ -85,7 +85,7 @@ // cc::mojom::FrameSinkManagerClient: void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; - void OnClientConnectionClosed(const cc::FrameSinkId& frame_sink_id) override; + void OnClientConnectionClosed(const FrameSinkId& frame_sink_id) override; // Mojo connection to the FrameSinkManager. cc::mojom::FrameSinkManagerPtr frame_sink_manager_ptr_; @@ -94,7 +94,7 @@ mojo::Binding<cc::mojom::FrameSinkManagerClient> binding_; // Per CompositorFrameSink data. - base::flat_map<cc::FrameSinkId, FrameSinkData> frame_sink_data_map_; + base::flat_map<FrameSinkId, FrameSinkData> frame_sink_data_map_; // Local observers to that receive OnSurfaceCreated() messages from IPC. base::ObserverList<FrameSinkObserver> observers_;
diff --git a/components/viz/host/host_frame_sink_manager_unittests.cc b/components/viz/host/host_frame_sink_manager_unittests.cc index 9c24966..7e1bdad 100644 --- a/components/viz/host/host_frame_sink_manager_unittests.cc +++ b/components/viz/host/host_frame_sink_manager_unittests.cc
@@ -11,7 +11,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "cc/ipc/frame_sink_manager.mojom.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,8 +19,8 @@ namespace test { namespace { -constexpr cc::FrameSinkId kFrameSinkId1(1, 1); -constexpr cc::FrameSinkId kFrameSinkId2(1, 1); +constexpr FrameSinkId kFrameSinkId1(1, 1); +constexpr FrameSinkId kFrameSinkId2(1, 1); ACTION_P(InvokeClosure, closure) { closure.Run(); @@ -67,7 +67,7 @@ // cc::mojom::FrameSinkManager: // TODO(kylechar): See if we can mock functions with InterfacePtrs parameters. void CreateRootCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -75,17 +75,15 @@ cc::mojom::DisplayPrivateAssociatedRequest display_private_request) override {} void CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client) override {} MOCK_METHOD2(RegisterFrameSinkHierarchy, - void(const cc::FrameSinkId& parent, - const cc::FrameSinkId& child)); + void(const FrameSinkId& parent, const FrameSinkId& child)); MOCK_METHOD2(UnregisterFrameSinkHierarchy, - void(const cc::FrameSinkId& parent, - const cc::FrameSinkId& child)); - MOCK_METHOD1(DropTemporaryReference, void(const cc::SurfaceId& surface_id)); + void(const FrameSinkId& parent, const FrameSinkId& child)); + MOCK_METHOD1(DropTemporaryReference, void(const SurfaceId& surface_id)); private: mojo::Binding<cc::mojom::FrameSinkManager> binding_;
diff --git a/components/viz/service/display_embedder/display_provider.h b/components/viz/service/display_embedder/display_provider.h index 4b997c8..37ba0a26 100644 --- a/components/viz/service/display_embedder/display_provider.h +++ b/components/viz/service/display_embedder/display_provider.h
@@ -26,7 +26,7 @@ // Creates a new cc::Display for |surface_handle| with |frame_sink_id|. Will // also create cc::BeginFrameSource and return it in |begin_frame_source|. virtual std::unique_ptr<cc::Display> CreateDisplay( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, std::unique_ptr<cc::BeginFrameSource>* begin_frame_source) = 0; };
diff --git a/components/viz/service/display_embedder/gpu_display_provider.cc b/components/viz/service/display_embedder/gpu_display_provider.cc index aab7a8f..d1fd741 100644 --- a/components/viz/service/display_embedder/gpu_display_provider.cc +++ b/components/viz/service/display_embedder/gpu_display_provider.cc
@@ -52,7 +52,7 @@ GpuDisplayProvider::~GpuDisplayProvider() = default; std::unique_ptr<cc::Display> GpuDisplayProvider::CreateDisplay( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, std::unique_ptr<cc::BeginFrameSource>* begin_frame_source) { auto synthetic_begin_frame_source =
diff --git a/components/viz/service/display_embedder/gpu_display_provider.h b/components/viz/service/display_embedder/gpu_display_provider.h index 3c21ebd..fb37618d 100644 --- a/components/viz/service/display_embedder/gpu_display_provider.h +++ b/components/viz/service/display_embedder/gpu_display_provider.h
@@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/service/display_embedder/display_provider.h" #include "components/viz/service/viz_service_export.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" @@ -35,7 +35,7 @@ // DisplayProvider: std::unique_ptr<cc::Display> CreateDisplay( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, std::unique_ptr<cc::BeginFrameSource>* begin_frame_source) override;
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc index 0f82baf..a2b23eb 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -41,7 +41,7 @@ } void FrameSinkManagerImpl::CreateRootCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -65,7 +65,7 @@ } void FrameSinkManagerImpl::CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client) { @@ -79,25 +79,24 @@ } void FrameSinkManagerImpl::RegisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) { manager_.RegisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } void FrameSinkManagerImpl::UnregisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) { manager_.UnregisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } -void FrameSinkManagerImpl::DropTemporaryReference( - const cc::SurfaceId& surface_id) { +void FrameSinkManagerImpl::DropTemporaryReference(const SurfaceId& surface_id) { manager_.DropTemporaryReference(surface_id); } -void FrameSinkManagerImpl::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) { +void FrameSinkManagerImpl::DestroyCompositorFrameSink(FrameSinkId sink_id) { compositor_frame_sinks_.erase(sink_id); } @@ -115,32 +114,30 @@ client_->OnSurfaceCreated(surface_info); } -bool FrameSinkManagerImpl::OnSurfaceDamaged(const cc::SurfaceId& surface_id, +bool FrameSinkManagerImpl::OnSurfaceDamaged(const SurfaceId& surface_id, const cc::BeginFrameAck& ack) { return false; } -void FrameSinkManagerImpl::OnSurfaceDiscarded(const cc::SurfaceId& surface_id) { -} +void FrameSinkManagerImpl::OnSurfaceDiscarded(const SurfaceId& surface_id) {} -void FrameSinkManagerImpl::OnSurfaceDestroyed(const cc::SurfaceId& surface_id) { -} +void FrameSinkManagerImpl::OnSurfaceDestroyed(const SurfaceId& surface_id) {} void FrameSinkManagerImpl::OnSurfaceDamageExpected( - const cc::SurfaceId& surface_id, + const SurfaceId& surface_id, const cc::BeginFrameArgs& args) {} -void FrameSinkManagerImpl::OnSurfaceWillDraw(const cc::SurfaceId& surface_id) {} +void FrameSinkManagerImpl::OnSurfaceWillDraw(const SurfaceId& surface_id) {} void FrameSinkManagerImpl::OnClientConnectionLost( - const cc::FrameSinkId& frame_sink_id) { + const FrameSinkId& frame_sink_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (client_) client_->OnClientConnectionClosed(frame_sink_id); } void FrameSinkManagerImpl::OnPrivateConnectionLost( - const cc::FrameSinkId& frame_sink_id) { + const FrameSinkId& frame_sink_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DestroyCompositorFrameSink(frame_sink_id); }
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h index 597b22c..b3d3677 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.h +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
@@ -13,9 +13,9 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" #include "cc/ipc/frame_sink_manager.mojom.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/frame_sink_manager.h" #include "cc/surfaces/surface_observer.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h" #include "components/viz/service/viz_service_export.h" #include "gpu/ipc/common/surface_handle.h" @@ -51,7 +51,7 @@ // cc::mojom::FrameSinkManager implementation: void CreateRootCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -59,17 +59,17 @@ cc::mojom::DisplayPrivateAssociatedRequest display_private_request) override; void CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client) override; void RegisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) override; + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) override; void UnregisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) override; - void DropTemporaryReference(const cc::SurfaceId& surface_id) override; + const FrameSinkId& parent_frame_sink_id, + const FrameSinkId& child_frame_sink_id) override; + void DropTemporaryReference(const SurfaceId& surface_id) override; private: // It is necessary to pass |frame_sink_id| by value because the id @@ -77,21 +77,21 @@ // removed from the map, |frame_sink_id| would also be destroyed if it were a // reference. But the map can continue to iterate and try to use it. Passing // by value avoids this. - void DestroyCompositorFrameSink(cc::FrameSinkId frame_sink_id); + void DestroyCompositorFrameSink(FrameSinkId frame_sink_id); // cc::SurfaceObserver implementation. void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; - bool OnSurfaceDamaged(const cc::SurfaceId& surface_id, + bool OnSurfaceDamaged(const SurfaceId& surface_id, const cc::BeginFrameAck& ack) override; - void OnSurfaceDiscarded(const cc::SurfaceId& surface_id) override; - void OnSurfaceDestroyed(const cc::SurfaceId& surface_id) override; - void OnSurfaceDamageExpected(const cc::SurfaceId& surface_id, + void OnSurfaceDiscarded(const SurfaceId& surface_id) override; + void OnSurfaceDestroyed(const SurfaceId& surface_id) override; + void OnSurfaceDamageExpected(const SurfaceId& surface_id, const cc::BeginFrameArgs& args) override; - void OnSurfaceWillDraw(const cc::SurfaceId& surface_id) override; + void OnSurfaceWillDraw(const SurfaceId& surface_id) override; // GpuCompositorFrameSinkDelegate implementation. - void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id) override; - void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id) override; + void OnClientConnectionLost(const FrameSinkId& frame_sink_id) override; + void OnPrivateConnectionLost(const FrameSinkId& frame_sink_id) override; // FrameSinkManager should be the first object constructed and the last object // destroyed in order to ensure that all other objects that depend on it have @@ -101,9 +101,9 @@ // Provides a cc::Display for CreateRootCompositorFrameSink(). DisplayProvider* const display_provider_; - std::unordered_map<cc::FrameSinkId, + std::unordered_map<FrameSinkId, std::unique_ptr<cc::mojom::CompositorFrameSink>, - cc::FrameSinkIdHash> + FrameSinkIdHash> compositor_frame_sinks_; THREAD_CHECKER(thread_checker_);
diff --git a/components/viz/service/frame_sinks/gpu_compositor_frame_sink.cc b/components/viz/service/frame_sinks/gpu_compositor_frame_sink.cc index 6a75a191..02caf452 100644 --- a/components/viz/service/frame_sinks/gpu_compositor_frame_sink.cc +++ b/components/viz/service/frame_sinks/gpu_compositor_frame_sink.cc
@@ -11,7 +11,7 @@ GpuCompositorFrameSink::GpuCompositorFrameSink( GpuCompositorFrameSinkDelegate* delegate, cc::FrameSinkManager* frame_sink_manager, - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest compositor_frame_sink_private_request, @@ -43,7 +43,7 @@ } void GpuCompositorFrameSink::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { if (!support_->SubmitCompositorFrame(local_surface_id, std::move(frame))) { compositor_frame_sink_binding_.CloseWithReason( @@ -64,7 +64,7 @@ } void GpuCompositorFrameSink::ClaimTemporaryReference( - const cc::SurfaceId& surface_id) { + const SurfaceId& surface_id) { support_->ClaimTemporaryReference(surface_id); } @@ -85,7 +85,7 @@ } void GpuCompositorFrameSink::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} void GpuCompositorFrameSink::OnClientConnectionLost() {
diff --git a/components/viz/service/frame_sinks/gpu_compositor_frame_sink.h b/components/viz/service/frame_sinks/gpu_compositor_frame_sink.h index 24a6ad2..fd22cad 100644 --- a/components/viz/service/frame_sinks/gpu_compositor_frame_sink.h +++ b/components/viz/service/frame_sinks/gpu_compositor_frame_sink.h
@@ -13,8 +13,8 @@ #include "cc/ipc/compositor_frame_sink.mojom.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/local_surface_id.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/local_surface_id.h" +#include "components/viz/common/surface_id.h" #include "components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h" #include "mojo/public/cpp/bindings/binding.h" @@ -29,7 +29,7 @@ GpuCompositorFrameSink( GpuCompositorFrameSinkDelegate* delegate, cc::FrameSinkManager* frame_sink_manager, - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client); @@ -38,12 +38,12 @@ // cc::mojom::CompositorFrameSink: void SetNeedsBeginFrame(bool needs_begin_frame) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& begin_frame_ack) override; // cc::mojom::CompositorFrameSinkPrivate: - void ClaimTemporaryReference(const cc::SurfaceId& surface_id) override; + void ClaimTemporaryReference(const SurfaceId& surface_id) override; void RequestCopyOfSurface( std::unique_ptr<cc::CopyOutputRequest> request) override; @@ -54,7 +54,7 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; void OnClientConnectionLost();
diff --git a/components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h b/components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h index a5baa3e2..b463feb 100644 --- a/components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h +++ b/components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h
@@ -14,11 +14,10 @@ class GpuCompositorFrameSinkDelegate { public: // When the client pipe is closed the host process will be notified. - virtual void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id) = 0; + virtual void OnClientConnectionLost(const FrameSinkId& frame_sink_id) = 0; // When the private pipe is closed the CompositorFrameSink will be destroyed. - virtual void OnPrivateConnectionLost( - const cc::FrameSinkId& frame_sink_id) = 0; + virtual void OnPrivateConnectionLost(const FrameSinkId& frame_sink_id) = 0; protected: virtual ~GpuCompositorFrameSinkDelegate() {}
diff --git a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc index 26ad063..7aa83fc3 100644 --- a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc +++ b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc
@@ -15,7 +15,7 @@ GpuRootCompositorFrameSink::GpuRootCompositorFrameSink( GpuCompositorFrameSinkDelegate* delegate, cc::FrameSinkManager* frame_sink_manager, - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, std::unique_ptr<cc::Display> display, std::unique_ptr<cc::BeginFrameSource> begin_frame_source, cc::mojom::CompositorFrameSinkAssociatedRequest request, @@ -78,7 +78,7 @@ } void GpuRootCompositorFrameSink::SetLocalSurfaceId( - const cc::LocalSurfaceId& local_surface_id, + const LocalSurfaceId& local_surface_id, float scale_factor) { display_->SetLocalSurfaceId(local_surface_id, scale_factor); } @@ -88,7 +88,7 @@ } void GpuRootCompositorFrameSink::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { if (!support_->SubmitCompositorFrame(local_surface_id, std::move(frame))) { compositor_frame_sink_binding_.Close(); @@ -102,7 +102,7 @@ } void GpuRootCompositorFrameSink::ClaimTemporaryReference( - const cc::SurfaceId& surface_id) { + const SurfaceId& surface_id) { support_->ClaimTemporaryReference(surface_id); } @@ -140,7 +140,7 @@ } void GpuRootCompositorFrameSink::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} void GpuRootCompositorFrameSink::OnClientConnectionLost() {
diff --git a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h index 6d28a2f..584d785 100644 --- a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h +++ b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h
@@ -11,8 +11,8 @@ #include "cc/ipc/frame_sink_manager.mojom.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/display_client.h" -#include "cc/surfaces/local_surface_id.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/local_surface_id.h" +#include "components/viz/common/surface_id.h" #include "components/viz/service/frame_sinks/gpu_compositor_frame_sink_delegate.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/binding.h" @@ -38,7 +38,7 @@ GpuRootCompositorFrameSink( GpuCompositorFrameSinkDelegate* delegate, cc::FrameSinkManager* frame_sink_manager, - const cc::FrameSinkId& frame_sink_id, + const FrameSinkId& frame_sink_id, std::unique_ptr<cc::Display> display, std::unique_ptr<cc::BeginFrameSource> begin_frame_source, cc::mojom::CompositorFrameSinkAssociatedRequest request, @@ -53,17 +53,17 @@ void ResizeDisplay(const gfx::Size& size) override; void SetDisplayColorSpace(const gfx::ColorSpace& color_space) override; void SetOutputIsSecure(bool secure) override; - void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id, + void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id, float scale_factor) override; // cc::mojom::CompositorFrameSink: void SetNeedsBeginFrame(bool needs_begin_frame) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& begin_frame_ack) override; // cc::mojom::CompositorFrameSinkPrivate: - void ClaimTemporaryReference(const cc::SurfaceId& surface_id) override; + void ClaimTemporaryReference(const SurfaceId& surface_id) override; void RequestCopyOfSurface( std::unique_ptr<cc::CopyOutputRequest> request) override; @@ -80,7 +80,7 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; void OnClientConnectionLost();
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 000b35e..e069154 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1389,6 +1389,8 @@ "service_worker/service_worker_handle.h", "service_worker/service_worker_info.cc", "service_worker/service_worker_info.h", + "service_worker/service_worker_installed_scripts_sender.cc", + "service_worker/service_worker_installed_scripts_sender.h", "service_worker/service_worker_internals_ui.cc", "service_worker/service_worker_internals_ui.h", "service_worker/service_worker_job_coordinator.cc",
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc index a6736aa..3824914 100644 --- a/content/browser/accessibility/browser_accessibility.cc +++ b/content/browser/accessibility/browser_accessibility.cc
@@ -746,116 +746,6 @@ return GetData().GetHtmlAttribute(html_attr, value); } -BrowserAccessibility* BrowserAccessibility::GetTable() const { - BrowserAccessibility* table = const_cast<BrowserAccessibility*>(this); - while (table && !ui::IsTableLikeRole(table->GetRole())) - table = table->PlatformGetParent(); - return table; -} - -BrowserAccessibility* BrowserAccessibility::GetTableCell(int index) const { - if (!ui::IsTableLikeRole(GetRole()) && - !ui::IsCellOrTableHeaderRole(GetRole())) - return nullptr; - - BrowserAccessibility* table = GetTable(); - if (!table) - return nullptr; - const std::vector<int32_t>& unique_cell_ids = - table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); - if (index < 0 || index >= static_cast<int>(unique_cell_ids.size())) - return nullptr; - return table->manager_->GetFromID(unique_cell_ids[index]); -} - -BrowserAccessibility* BrowserAccessibility::GetTableCell(int row, - int column) const { - if (!ui::IsTableLikeRole(GetRole()) && - !ui::IsCellOrTableHeaderRole(GetRole())) - return nullptr; - if (row < 0 || row >= GetTableRowCount() || column < 0 || - column >= GetTableColumnCount()) { - return nullptr; - } - - BrowserAccessibility* table = GetTable(); - if (!table) - return nullptr; - - // In contrast to unique cell IDs, these are duplicated whenever a cell spans - // multiple columns or rows. - const std::vector<int32_t>& cell_ids = - table->GetIntListAttribute(ui::AX_ATTR_CELL_IDS); - DCHECK_EQ(GetTableRowCount() * GetTableColumnCount(), - static_cast<int>(cell_ids.size())); - int position = row * GetTableColumnCount() + column; - if (position < 0 || position >= static_cast<int>(cell_ids.size())) - return nullptr; - return table->manager_->GetFromID(cell_ids[position]); -} - -int BrowserAccessibility::GetTableCellIndex() const { - if (!ui::IsCellOrTableHeaderRole(GetRole())) - return -1; - - BrowserAccessibility* table = GetTable(); - if (!table) - return -1; - - const std::vector<int32_t>& unique_cell_ids = - table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); - auto iter = - std::find(unique_cell_ids.begin(), unique_cell_ids.end(), GetId()); - if (iter == unique_cell_ids.end()) - return -1; - - return std::distance(unique_cell_ids.begin(), iter); -} - -int BrowserAccessibility::GetTableColumn() const { - return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX); -} - -int BrowserAccessibility::GetTableColumnCount() const { - BrowserAccessibility* table = GetTable(); - if (!table) - return 0; - - return table->GetIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT); -} - -int BrowserAccessibility::GetTableColumnSpan() const { - if (!ui::IsCellOrTableHeaderRole(GetRole())) - return 0; - - int column_span; - if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &column_span)) - return column_span; - return 1; -} - -int BrowserAccessibility::GetTableRow() const { - return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX); -} - -int BrowserAccessibility::GetTableRowCount() const { - BrowserAccessibility* table = GetTable(); - if (!table) - return 0; - - return table->GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT); -} - -int BrowserAccessibility::GetTableRowSpan() const { - if (!ui::IsCellOrTableHeaderRole(GetRole())) - return 0; - - int row_span; - if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &row_span)) - return row_span; - return 1; -} - base::string16 BrowserAccessibility::GetText() const { return GetInnerText(); } @@ -914,7 +804,7 @@ return html_tag == "textarea"; } -// In general we should use IsEditField() instead if we want to check for +// In general we should use ui::IsEditField() instead if we want to check for // something that has a caret and the user can edit. // TODO(aleventhal) this name is confusing because it returns true for combobox, // and we should take a look at why a combobox is considered a text control. The @@ -936,11 +826,6 @@ } } -bool BrowserAccessibility::IsEditField() const { - return GetRole() == ui::AX_ROLE_TEXT_FIELD || - GetRole() == ui::AX_ROLE_SEARCH_BOX; -} - // Indicates if this object is at the root of a rich edit text control. bool BrowserAccessibility::IsRichTextControl() const { return HasState(ui::AX_STATE_RICHLY_EDITABLE) && @@ -1105,6 +990,12 @@ return focused->GetNativeViewAccessible(); } +ui::AXPlatformNode* BrowserAccessibility::GetFromNodeID(int32_t id) { + // Not all BrowserAccessibility subclasses can return an AXPlatformNode yet. + // So, here we just return nullptr. + return nullptr; +} + gfx::AcceleratedWidget BrowserAccessibility::GetTargetForNativeAccessibilityEvent() { BrowserAccessibilityDelegate* root_delegate =
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h index 94630d7..e790989 100644 --- a/content/browser/accessibility/browser_accessibility.h +++ b/content/browser/accessibility/browser_accessibility.h
@@ -296,52 +296,6 @@ base::string16 GetFontFamily() const; base::string16 GetLanguage() const; - // Returns the table or ARIA grid if inside one. - BrowserAccessibility* GetTable() const; - - // If inside a table or ARIA grid, returns the cell found at the given index. - // Indices are in row major order and each cell is counted once regardless of - // its span. - BrowserAccessibility* GetTableCell(int index) const; - - // If inside a table or ARIA grid, returns the cell at the given row and - // column (0-based). Works correctly with cells that span multiple rows or - // columns. - BrowserAccessibility* GetTableCell(int row, int column) const; - - // If inside a table or ARIA grid, returns the zero-based index of the cell. - // Indices are in row major order and each cell is counted once regardless of - // its span. Returns -1 if the cell is not found or if not inside a table. - int GetTableCellIndex() const; - - // If inside a table or ARIA grid, returns the physical column number for the - // current cell. In contrast to logical columns, physical columns always start - // from 0 and have no gaps in their numbering. Logical columns can be set - // using aria-colindex. - int GetTableColumn() const; - - // If inside a table or ARIA grid, returns the number of physical columns, - // otherwise returns 0. - int GetTableColumnCount() const; - - // If inside a table or ARIA grid, returns the number of physical columns that - // this cell spans. If not a cell, returns 0. - int GetTableColumnSpan() const; - - // If inside a table or ARIA grid, returns the physical row number for the - // current cell. In contrast to logical rows, physical rows always start from - // 0 and have no gaps in their numbering. Logical rows can be set using - // aria-rowindex. - int GetTableRow() const; - - // If inside a table or ARIA grid, returns the number of physical rows, - // otherwise returns 0. - int GetTableRowCount() const; - - // If inside a table or ARIA grid, returns the number of physical rows that - // this cell spans. If not a cell, returns 0. - int GetTableRowSpan() const; - virtual base::string16 GetText() const; // Returns true if the bit corresponding to the given enum is 1. @@ -387,6 +341,7 @@ gfx::Rect GetScreenBoundsRect() const override; gfx::NativeViewAccessible HitTestSync(int x, int y) override; gfx::NativeViewAccessible GetFocus() override; + ui::AXPlatformNode* GetFromNodeID(int32_t id) override; gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; bool AccessibilityPerformAction(const ui::AXActionData& data) override; bool ShouldIgnoreHoveredStateForTesting() override;
diff --git a/content/browser/accessibility/browser_accessibility_com_win.cc b/content/browser/accessibility/browser_accessibility_com_win.cc index 57ff9025..932d213 100644 --- a/content/browser/accessibility/browser_accessibility_com_win.cc +++ b/content/browser/accessibility/browser_accessibility_com_win.cc
@@ -464,52 +464,7 @@ if (!owner()) return E_FAIL; - // Forward all non-spatial directions (e.g. NAVDIR_NEXT) to the platform node - // implementation. - if (nav_dir != NAVDIR_DOWN && nav_dir != NAVDIR_UP && - nav_dir != NAVDIR_LEFT && nav_dir != NAVDIR_RIGHT) { - return AXPlatformNodeWin::accNavigate(nav_dir, start, end); - } - - if (end) { - end->vt = VT_EMPTY; - } else { - return E_INVALIDARG; - } - - BrowserAccessibilityComWin* target = GetTargetFromChildID(start); - if (!target) - return E_INVALIDARG; - - BrowserAccessibility* result = nullptr; - // Only handle spatial directions for tables here. - switch (nav_dir) { - case NAVDIR_DOWN: - result = target->owner()->GetTableCell( - owner()->GetTableRow() + owner()->GetTableRowSpan(), - owner()->GetTableColumn()); - break; - case NAVDIR_UP: - result = target->owner()->GetTableCell(owner()->GetTableRow() - 1, - owner()->GetTableColumn()); - break; - case NAVDIR_LEFT: - result = target->owner()->GetTableCell(owner()->GetTableRow(), - owner()->GetTableColumn() - 1); - break; - case NAVDIR_RIGHT: - result = target->owner()->GetTableCell( - owner()->GetTableRow(), - owner()->GetTableColumn() + owner()->GetTableColumnSpan()); - break; - } - - if (!result) - return S_FALSE; - - end->vt = VT_DISPATCH; - end->pdispVal = ToBrowserAccessibilityComWin(result)->NewReference(); - return S_OK; + return AXPlatformNodeWin::accNavigate(nav_dir, start, end); } STDMETHODIMP BrowserAccessibilityComWin::get_accChild(VARIANT var_child, @@ -613,7 +568,7 @@ } bool BrowserAccessibilityComWin::IsRangeValueSupported() { - switch (ia_role()) { + switch (MSAARole()) { case ROLE_SYSTEM_PROGRESSBAR: case ROLE_SYSTEM_SLIDER: case ROLE_SYSTEM_SPINBUTTON: @@ -683,11 +638,7 @@ if (!owner()) return E_FAIL; - if (!role) - return E_INVALIDARG; - - *role = ia2_role(); - return S_OK; + return AXPlatformNodeWin::role(role); } STDMETHODIMP BrowserAccessibilityComWin::get_attributes(BSTR* attributes) { @@ -720,12 +671,7 @@ return E_FAIL; AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); - if (!states) - return E_INVALIDARG; - - *states = ia2_state(); - - return S_OK; + return AXPlatformNodeWin::get_states(states); } STDMETHODIMP BrowserAccessibilityComWin::get_uniqueID(LONG* unique_id) { @@ -1125,11 +1071,13 @@ if (!accessible) return E_INVALIDARG; - BrowserAccessibility* cell = - owner()->GetTableCell(static_cast<int>(row), static_cast<int>(column)); - if (cell && ToBrowserAccessibilityComWin(cell)) { - *accessible = static_cast<IAccessible*>( - ToBrowserAccessibilityComWin(cell)->NewReference()); + AXPlatformNodeBase* cell = + GetTableCell(static_cast<int>(row), static_cast<int>(column)); + if (cell) { + auto* node_win = static_cast<AXPlatformNodeWin*>(cell); + node_win->AddRef(); + + *accessible = static_cast<IAccessible*>(node_win); return S_OK; } @@ -1162,8 +1110,7 @@ if (!cell_index) return E_INVALIDARG; - BrowserAccessibility* cell = - owner()->GetTableCell(static_cast<int>(row), static_cast<int>(column)); + auto* cell = GetTableCell(static_cast<int>(row), static_cast<int>(column)); if (cell) { *cell_index = static_cast<LONG>(cell->GetTableCellIndex()); return S_OK; @@ -1184,29 +1131,28 @@ if (!description) return E_INVALIDARG; - int columns = owner()->GetTableColumnCount(); + int columns = GetTableColumnCount(); if (column < 0 || column >= columns) return E_INVALIDARG; - int rows = owner()->GetTableRowCount(); + int rows = GetTableRowCount(); if (rows <= 0) { *description = nullptr; return S_FALSE; } for (int i = 0; i < rows; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(i, column); - if (ToBrowserAccessibilityComWin(cell) && - cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) { + auto* cell = GetTableCell(i, column); + if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) { base::string16 cell_name = cell->GetString16Attribute(ui::AX_ATTR_NAME); if (cell_name.size() > 0) { *description = SysAllocString(cell_name.c_str()); return S_OK; } - if (ToBrowserAccessibilityComWin(cell)->description().size() > 0) { - *description = SysAllocString( - ToBrowserAccessibilityComWin(cell)->description().c_str()); + cell_name = cell->GetString16Attribute(ui::AX_ATTR_DESCRIPTION); + if (cell_name.size() > 0) { + *description = SysAllocString(cell_name.c_str()); return S_OK; } } @@ -1228,8 +1174,7 @@ if (!n_columns_spanned) return E_INVALIDARG; - BrowserAccessibility* cell = - owner()->GetTableCell(static_cast<int>(row), static_cast<int>(column)); + auto* cell = GetTableCell(static_cast<int>(row), static_cast<int>(column)); if (!cell) return E_INVALIDARG; @@ -1256,7 +1201,7 @@ if (!column_index) return E_INVALIDARG; - BrowserAccessibility* cell = owner()->GetTableCell(cell_index); + auto* cell = GetTableCell(cell_index); if (!cell) return E_INVALIDARG; *column_index = cell->GetTableColumn(); @@ -1272,7 +1217,7 @@ if (!column_count) return E_INVALIDARG; - *column_count = owner()->GetTableColumnCount(); + *column_count = GetTableColumnCount(); return S_OK; } @@ -1285,7 +1230,7 @@ if (!row_count) return E_INVALIDARG; - *row_count = owner()->GetTableRowCount(); + *row_count = GetTableRowCount(); return S_OK; } @@ -1341,28 +1286,26 @@ if (!description) return E_INVALIDARG; - if (row < 0 || row >= owner()->GetTableRowCount()) + if (row < 0 || row >= GetTableRowCount()) return E_INVALIDARG; - int columns = owner()->GetTableColumnCount(); + int columns = GetTableColumnCount(); if (columns <= 0) { *description = nullptr; return S_FALSE; } for (int i = 0; i < columns; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(row, i); - if (ToBrowserAccessibilityComWin(cell) && - cell->GetRole() == ui::AX_ROLE_ROW_HEADER) { + auto* cell = GetTableCell(row, i); + if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) { base::string16 cell_name = cell->GetString16Attribute(ui::AX_ATTR_NAME); if (cell_name.size() > 0) { *description = SysAllocString(cell_name.c_str()); return S_OK; } - - if (ToBrowserAccessibilityComWin(cell)->description().size() > 0) { - *description = SysAllocString( - ToBrowserAccessibilityComWin(cell)->description().c_str()); + cell_name = cell->GetString16Attribute(ui::AX_ATTR_DESCRIPTION); + if (cell_name.size() > 0) { + *description = SysAllocString(cell_name.c_str()); return S_OK; } } @@ -1383,11 +1326,11 @@ if (!n_rows_spanned) return E_INVALIDARG; - BrowserAccessibility* cell = owner()->GetTableCell(row, column); + auto* cell = GetTableCell(row, column); if (!cell) return E_INVALIDARG; - *n_rows_spanned = owner()->GetTableRowSpan(); + *n_rows_spanned = GetTableRowSpan(); return S_OK; } @@ -1410,7 +1353,7 @@ if (!row_index) return E_INVALIDARG; - BrowserAccessibility* cell = owner()->GetTableCell(cell_index); + auto* cell = GetTableCell(cell_index); if (!cell) return E_INVALIDARG; @@ -1544,14 +1487,14 @@ if (!row || !column || !row_extents || !column_extents || !is_selected) return E_INVALIDARG; - BrowserAccessibility* cell = owner()->GetTableCell(index); + auto* cell = GetTableCell(index); if (!cell) return E_INVALIDARG; *row = cell->GetTableRow(); *column = cell->GetTableColumn(); - *row_extents = owner()->GetTableRowSpan(); - *column_extents = owner()->GetTableColumnSpan(); + *row_extents = GetTableRowSpan(); + *column_extents = GetTableColumnSpan(); *is_selected = false; // Not supported. return S_OK; @@ -1601,11 +1544,13 @@ if (!cell) return E_INVALIDARG; - BrowserAccessibility* table_cell = - owner()->GetTableCell(static_cast<int>(row), static_cast<int>(column)); - if (ToBrowserAccessibilityComWin(table_cell)) { - return ToBrowserAccessibilityComWin(table_cell) - ->QueryInterface(IID_IUnknown, reinterpret_cast<void**>(cell)); + AXPlatformNodeBase* table_cell = + GetTableCell(static_cast<int>(row), static_cast<int>(column)); + if (table_cell) { + auto* node_win = static_cast<AXPlatformNodeWin*>(table_cell); + node_win->AddRef(); + *cell = static_cast<IAccessible*>(node_win); + return S_OK; } *cell = nullptr; @@ -1678,7 +1623,7 @@ if (!n_columns_spanned) return E_INVALIDARG; - *n_columns_spanned = owner()->GetTableColumnSpan(); + *n_columns_spanned = GetTableColumnSpan(); return S_OK; } @@ -1694,21 +1639,21 @@ return E_INVALIDARG; *n_column_header_cells = 0; - BrowserAccessibility* table = owner()->GetTable(); + auto* table = GetTable(); if (!table) { NOTREACHED(); return S_FALSE; } - int column = owner()->GetTableColumn(); - int columns = owner()->GetTableColumnCount(); - int rows = owner()->GetTableRowCount(); + int column = GetTableColumn(); + int columns = GetTableColumnCount(); + int rows = GetTableRowCount(); if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) return S_FALSE; for (int i = 0; i < rows; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(i, column); - if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) + auto* cell = GetTableCell(i, column); + if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) (*n_column_header_cells)++; } @@ -1716,10 +1661,12 @@ CoTaskMemAlloc((*n_column_header_cells) * sizeof(cell_accessibles[0]))); int index = 0; for (int i = 0; i < rows; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(i, column); - if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) { - (*cell_accessibles)[index] = static_cast<IAccessible*>( - ToBrowserAccessibilityComWin(cell)->NewReference()); + AXPlatformNodeBase* cell = GetTableCell(i, column); + if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) { + auto* node_win = static_cast<AXPlatformNodeWin*>(cell); + node_win->AddRef(); + + (*cell_accessibles)[index] = static_cast<IAccessible*>(node_win); ++index; } } @@ -1736,7 +1683,7 @@ if (!column_index) return E_INVALIDARG; - *column_index = owner()->GetTableColumn(); + *column_index = GetTableColumn(); return S_OK; } @@ -1749,7 +1696,7 @@ if (!n_rows_spanned) return E_INVALIDARG; - *n_rows_spanned = owner()->GetTableRowSpan(); + *n_rows_spanned = GetTableRowSpan(); return S_OK; } @@ -1765,21 +1712,21 @@ return E_INVALIDARG; *n_row_header_cells = 0; - BrowserAccessibility* table = owner()->GetTable(); + auto* table = GetTable(); if (!table) { NOTREACHED(); return S_FALSE; } - int row = owner()->GetTableRow(); - int columns = owner()->GetTableColumnCount(); - int rows = owner()->GetTableRowCount(); + int row = GetTableRow(); + int columns = GetTableColumnCount(); + int rows = GetTableRowCount(); if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) return S_FALSE; for (int i = 0; i < columns; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(row, i); - if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) + auto* cell = GetTableCell(row, i); + if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) (*n_row_header_cells)++; } @@ -1787,10 +1734,12 @@ CoTaskMemAlloc((*n_row_header_cells) * sizeof(cell_accessibles[0]))); int index = 0; for (int i = 0; i < columns; ++i) { - BrowserAccessibility* cell = owner()->GetTableCell(row, i); - if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) { - (*cell_accessibles)[index] = static_cast<IAccessible*>( - ToBrowserAccessibilityComWin(cell)->NewReference()); + AXPlatformNodeBase* cell = GetTableCell(row, i); + if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) { + auto* node_win = static_cast<AXPlatformNodeWin*>(cell); + node_win->AddRef(); + + (*cell_accessibles)[index] = static_cast<IAccessible*>(node_win); ++index; } } @@ -1807,7 +1756,7 @@ if (!row_index) return E_INVALIDARG; - *row_index = owner()->GetTableRow(); + *row_index = GetTableRow(); return S_OK; } @@ -1840,10 +1789,10 @@ return E_INVALIDARG; } - *row_index = owner()->GetTableRow(); - *column_index = owner()->GetTableColumn(); - *row_extents = owner()->GetTableRowSpan(); - *column_extents = owner()->GetTableColumnSpan(); + *row_index = GetTableRow(); + *column_index = GetTableColumn(); + *row_extents = GetTableRowSpan(); + *column_extents = GetTableColumnSpan(); *is_selected = false; // Not supported. return S_OK; @@ -1858,14 +1807,18 @@ if (!table) return E_INVALIDARG; - BrowserAccessibility* find_table = owner()->GetTable(); - if (!find_table || !ToBrowserAccessibilityComWin(find_table)) { + auto* find_table = GetTable(); + if (!find_table) { *table = nullptr; return S_FALSE; } - *table = static_cast<IAccessibleTable*>( - ToBrowserAccessibilityComWin(find_table)->NewReference()); + // The IAccessibleTable interface is still on the BrowserAccessibilityComWin + // class. + auto* node_win = static_cast<BrowserAccessibilityComWin*>(find_table); + node_win->AddRef(); + + *table = static_cast<IAccessibleTable*>(node_win); return S_OK; } @@ -3401,7 +3354,7 @@ void** object) { BrowserAccessibilityComWin* accessibility = reinterpret_cast<BrowserAccessibilityComWin*>(this_ptr); - int32_t ia_role = accessibility->ia_role(); + int32_t ia_role = accessibility->MSAARole(); if (iid == IID_IAccessibleImage) { if (ia_role != ROLE_SYSTEM_GRAPHIC) { *object = NULL; @@ -3552,7 +3505,17 @@ old_win_attributes_.swap(win_attributes_); win_attributes_.reset(new WinAttributes()); - InitRoleAndState(); + win_attributes_->ia_role = MSAARole(); + win_attributes_->ia_state = MSAAState(); + win_attributes_->role_name = base::UTF8ToUTF16(StringOverrideForMSAARole()); + + win_attributes_->ia2_role = IA2Role(); + // If we didn't explicitly set the IAccessible2 role, make it the same + // as the MSAA role. + if (!win_attributes_->ia2_role) + win_attributes_->ia2_role = win_attributes_->ia_role; + + win_attributes_->ia2_state = IA2State(); win_attributes_->ia2_attributes.clear(); @@ -3629,9 +3592,13 @@ // Expose table cell index. if (ui::IsCellOrTableHeaderRole(owner()->GetRole())) { - BrowserAccessibility* table = owner()->PlatformGetParent(); - while (table && !ui::IsTableLikeRole(table->GetRole())) - table = table->PlatformGetParent(); + BrowserAccessibilityWin* win_parent = + static_cast<BrowserAccessibilityWin*>(owner()->PlatformGetParent()); + AXPlatformNodeBase* table = win_parent->GetCOM(); + + while (table && !ui::IsTableLikeRole(table->GetData().role)) + table = FromNativeViewAccessible(table->GetParent()); + if (table) { const std::vector<int32_t>& unique_cell_ids = table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); @@ -3660,8 +3627,8 @@ // Expose row or column header sort direction. int32_t sort_direction; - if ((ia_role() == ROLE_SYSTEM_COLUMNHEADER || - ia_role() == ROLE_SYSTEM_ROWHEADER) && + if ((MSAARole() == ROLE_SYSTEM_COLUMNHEADER || + MSAARole() == ROLE_SYSTEM_ROWHEADER) && owner()->GetIntAttribute(ui::AX_ATTR_SORT_DIRECTION, &sort_direction)) { switch (static_cast<ui::AXSortDirection>(sort_direction)) { case ui::AX_SORT_DIRECTION_NONE: @@ -3736,13 +3703,6 @@ AddRelation(IA2_RELATION_ERROR_MESSAGE, error_message_id); UpdateRequiredAttributes(); - // If this is a web area for a presentational iframe, give it a role of - // something other than DOCUMENT so that the fact that it's a separate doc - // is not exposed to AT. - if (owner()->IsWebAreaForPresentationalIframe()) { - win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; - win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; - } } void BrowserAccessibilityComWin::UpdateStep2ComputeHypertext() { @@ -4919,495 +4879,6 @@ ->Fire(); } -void BrowserAccessibilityComWin::InitRoleAndState() { - int32_t ia_role = 0; - base::string16 role_name; - int32_t ia2_role = 0; - int32_t ia2_state = IA2_STATE_OPAQUE; - - const auto checked_state = static_cast<ui::AXCheckedState>( - owner()->GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); - if (checked_state) { - ia2_state |= IA2_STATE_CHECKABLE; - } - - if (owner()->HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && - owner()->GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != - ui::AX_INVALID_STATE_FALSE) - ia2_state |= IA2_STATE_INVALID_ENTRY; - if (owner()->HasState(ui::AX_STATE_REQUIRED)) - ia2_state |= IA2_STATE_REQUIRED; - if (owner()->HasState(ui::AX_STATE_VERTICAL)) - ia2_state |= IA2_STATE_VERTICAL; - if (owner()->HasState(ui::AX_STATE_HORIZONTAL)) - ia2_state |= IA2_STATE_HORIZONTAL; - - const bool is_editable = owner()->HasState(ui::AX_STATE_EDITABLE); - if (is_editable) - ia2_state |= IA2_STATE_EDITABLE; - - if (owner()->IsRichTextControl() || owner()->IsEditField()) { - // Support multi/single line states if root editable or appropriate role. - // We support the edit box roles even if the area is not actually editable, - // because it is technically feasible for JS to implement the edit box - // by controlling selection. - if (owner()->HasState(ui::AX_STATE_MULTILINE)) { - ia2_state |= IA2_STATE_MULTI_LINE; - } else { - ia2_state |= IA2_STATE_SINGLE_LINE; - } - } - - if (!owner()->GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) - ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; - - if (owner()->GetBoolAttribute(ui::AX_ATTR_MODAL)) - ia2_state |= IA2_STATE_MODAL; - - base::string16 html_tag = owner()->GetString16Attribute(ui::AX_ATTR_HTML_TAG); - switch (owner()->GetRole()) { - case ui::AX_ROLE_ALERT: - ia_role = ROLE_SYSTEM_ALERT; - break; - case ui::AX_ROLE_ALERT_DIALOG: - ia_role = ROLE_SYSTEM_DIALOG; - break; - case ui::AX_ROLE_ANCHOR: - ia_role = ROLE_SYSTEM_LINK; - break; - case ui::AX_ROLE_APPLICATION: - ia_role = ROLE_SYSTEM_APPLICATION; - break; - case ui::AX_ROLE_ARTICLE: - ia_role = ROLE_SYSTEM_DOCUMENT; - break; - case ui::AX_ROLE_AUDIO: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_BANNER: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_HEADER; - break; - case ui::AX_ROLE_BLOCKQUOTE: - role_name = html_tag; - ia2_role = IA2_ROLE_SECTION; - break; - case ui::AX_ROLE_BUSY_INDICATOR: - ia_role = ROLE_SYSTEM_ANIMATION; - break; - case ui::AX_ROLE_BUTTON: - ia_role = ROLE_SYSTEM_PUSHBUTTON; - break; - case ui::AX_ROLE_CANVAS: - if (owner()->GetBoolAttribute(ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { - role_name = L"canvas"; - ia2_role = IA2_ROLE_CANVAS; - } else { - ia_role = ROLE_SYSTEM_GRAPHIC; - } - break; - case ui::AX_ROLE_CAPTION: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_CAPTION; - break; - case ui::AX_ROLE_CELL: - ia_role = ROLE_SYSTEM_CELL; - break; - case ui::AX_ROLE_CHECK_BOX: - ia_role = ROLE_SYSTEM_CHECKBUTTON; - break; - case ui::AX_ROLE_COLOR_WELL: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_COLOR_CHOOSER; - break; - case ui::AX_ROLE_COLUMN: - ia_role = ROLE_SYSTEM_COLUMN; - break; - case ui::AX_ROLE_COLUMN_HEADER: - ia_role = ROLE_SYSTEM_COLUMNHEADER; - break; - case ui::AX_ROLE_COMBO_BOX: - ia_role = ROLE_SYSTEM_COMBOBOX; - break; - case ui::AX_ROLE_COMPLEMENTARY: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_NOTE; - break; - case ui::AX_ROLE_CONTENT_INFO: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_DATE: - case ui::AX_ROLE_DATE_TIME: - ia_role = ROLE_SYSTEM_DROPLIST; - ia2_role = IA2_ROLE_DATE_EDITOR; - break; - case ui::AX_ROLE_DEFINITION: - role_name = html_tag; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_DESCRIPTION_LIST_DETAIL: - role_name = html_tag; - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_DESCRIPTION_LIST: - role_name = html_tag; - ia_role = ROLE_SYSTEM_LIST; - break; - case ui::AX_ROLE_DESCRIPTION_LIST_TERM: - ia_role = ROLE_SYSTEM_LISTITEM; - break; - case ui::AX_ROLE_DETAILS: - role_name = html_tag; - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_DIALOG: - ia_role = ROLE_SYSTEM_DIALOG; - break; - case ui::AX_ROLE_DISCLOSURE_TRIANGLE: - ia_role = ROLE_SYSTEM_PUSHBUTTON; - break; - case ui::AX_ROLE_DOCUMENT: - case ui::AX_ROLE_ROOT_WEB_AREA: - case ui::AX_ROLE_WEB_AREA: - ia_role = ROLE_SYSTEM_DOCUMENT; - break; - case ui::AX_ROLE_EMBEDDED_OBJECT: - if (owner()->PlatformChildCount()) { - // Windows screen readers assume that IA2_ROLE_EMBEDDED_OBJECT - // doesn't have any children, but it may be something like a - // browser plugin that has a document inside. - ia_role = ROLE_SYSTEM_GROUPING; - } else { - ia_role = ROLE_SYSTEM_CLIENT; - ia2_role = IA2_ROLE_EMBEDDED_OBJECT; - } - break; - case ui::AX_ROLE_FIGCAPTION: - role_name = html_tag; - ia2_role = IA2_ROLE_CAPTION; - break; - case ui::AX_ROLE_FIGURE: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_FEED: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_FORM: - role_name = L"form"; - ia2_role = IA2_ROLE_FORM; - break; - case ui::AX_ROLE_FOOTER: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_FOOTER; - break; - case ui::AX_ROLE_GENERIC_CONTAINER: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_SECTION; - role_name = html_tag.empty() ? L"div" : html_tag; - break; - case ui::AX_ROLE_GRID: - ia_role = ROLE_SYSTEM_TABLE; - break; - case ui::AX_ROLE_GROUP: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_HEADING: - role_name = html_tag; - if (html_tag.empty()) - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_HEADING; - break; - case ui::AX_ROLE_IFRAME: - ia_role = ROLE_SYSTEM_DOCUMENT; - ia2_role = IA2_ROLE_INTERNAL_FRAME; - break; - case ui::AX_ROLE_IFRAME_PRESENTATIONAL: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_IMAGE: - ia_role = ROLE_SYSTEM_GRAPHIC; - break; - case ui::AX_ROLE_IMAGE_MAP: - role_name = html_tag; - ia2_role = IA2_ROLE_IMAGE_MAP; - break; - case ui::AX_ROLE_IMAGE_MAP_LINK: - ia_role = ROLE_SYSTEM_LINK; - break; - case ui::AX_ROLE_INPUT_TIME: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_LABEL_TEXT: - case ui::AX_ROLE_LEGEND: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_LABEL; - break; - case ui::AX_ROLE_LINK: - ia_role = ROLE_SYSTEM_LINK; - break; - case ui::AX_ROLE_LIST: - ia_role = ROLE_SYSTEM_LIST; - break; - case ui::AX_ROLE_LIST_BOX: - ia_role = ROLE_SYSTEM_LIST; - break; - case ui::AX_ROLE_LIST_BOX_OPTION: - ia_role = ROLE_SYSTEM_LISTITEM; - break; - case ui::AX_ROLE_LIST_ITEM: - ia_role = ROLE_SYSTEM_LISTITEM; - break; - case ui::AX_ROLE_MAIN: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_MARK: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_TEXT_FRAME; - break; - case ui::AX_ROLE_MARQUEE: - ia_role = ROLE_SYSTEM_ANIMATION; - break; - case ui::AX_ROLE_MATH: - ia_role = ROLE_SYSTEM_EQUATION; - break; - case ui::AX_ROLE_MENU: - case ui::AX_ROLE_MENU_BUTTON: - ia_role = ROLE_SYSTEM_MENUPOPUP; - break; - case ui::AX_ROLE_MENU_BAR: - ia_role = ROLE_SYSTEM_MENUBAR; - break; - case ui::AX_ROLE_MENU_ITEM: - ia_role = ROLE_SYSTEM_MENUITEM; - break; - case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: - ia_role = ROLE_SYSTEM_MENUITEM; - ia2_role = IA2_ROLE_CHECK_MENU_ITEM; - break; - case ui::AX_ROLE_MENU_ITEM_RADIO: - ia_role = ROLE_SYSTEM_MENUITEM; - ia2_role = IA2_ROLE_RADIO_MENU_ITEM; - break; - case ui::AX_ROLE_MENU_LIST_POPUP: - ia_role = ROLE_SYSTEM_LIST; - ia2_state &= ~(IA2_STATE_EDITABLE); - break; - case ui::AX_ROLE_MENU_LIST_OPTION: - ia_role = ROLE_SYSTEM_LISTITEM; - ia2_state &= ~(IA2_STATE_EDITABLE); - break; - case ui::AX_ROLE_METER: - role_name = html_tag; - ia_role = ROLE_SYSTEM_PROGRESSBAR; - break; - case ui::AX_ROLE_NAVIGATION: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_SECTION; - break; - case ui::AX_ROLE_NOTE: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_NOTE; - break; - case ui::AX_ROLE_OUTLINE: - ia_role = ROLE_SYSTEM_OUTLINE; - break; - case ui::AX_ROLE_PARAGRAPH: - role_name = L"P"; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_POP_UP_BUTTON: - if (html_tag == L"select") { - ia_role = ROLE_SYSTEM_COMBOBOX; - } else { - ia_role = ROLE_SYSTEM_BUTTONMENU; - } - break; - case ui::AX_ROLE_PRE: - role_name = html_tag; - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_PARAGRAPH; - break; - case ui::AX_ROLE_PROGRESS_INDICATOR: - ia_role = ROLE_SYSTEM_PROGRESSBAR; - break; - case ui::AX_ROLE_RADIO_BUTTON: - ia_role = ROLE_SYSTEM_RADIOBUTTON; - break; - case ui::AX_ROLE_RADIO_GROUP: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_REGION: - if (html_tag == L"section") { - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_SECTION; - } else { - ia_role = ROLE_SYSTEM_PANE; - } - break; - case ui::AX_ROLE_ROW: { - // Role changes depending on whether row is inside a treegrid - // https://www.w3.org/TR/core-aam-1.1/#role-map-row - ia_role = - IsInTreeGrid(owner()) ? ROLE_SYSTEM_OUTLINEITEM : ROLE_SYSTEM_ROW; - break; - } - case ui::AX_ROLE_ROW_HEADER: - ia_role = ROLE_SYSTEM_ROWHEADER; - break; - case ui::AX_ROLE_RUBY: - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_TEXT_FRAME; - break; - case ui::AX_ROLE_RULER: - ia_role = ROLE_SYSTEM_CLIENT; - ia2_role = IA2_ROLE_RULER; - break; - case ui::AX_ROLE_SCROLL_AREA: - ia_role = ROLE_SYSTEM_CLIENT; - ia2_role = IA2_ROLE_SCROLL_PANE; - ia2_state &= ~(IA2_STATE_EDITABLE); - break; - case ui::AX_ROLE_SCROLL_BAR: - ia_role = ROLE_SYSTEM_SCROLLBAR; - break; - case ui::AX_ROLE_SEARCH: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_SECTION; - break; - case ui::AX_ROLE_SLIDER: - ia_role = ROLE_SYSTEM_SLIDER; - break; - case ui::AX_ROLE_SPIN_BUTTON: - ia_role = ROLE_SYSTEM_SPINBUTTON; - break; - case ui::AX_ROLE_SPIN_BUTTON_PART: - ia_role = ROLE_SYSTEM_PUSHBUTTON; - break; - case ui::AX_ROLE_ANNOTATION: - case ui::AX_ROLE_LIST_MARKER: - case ui::AX_ROLE_STATIC_TEXT: - ia_role = ROLE_SYSTEM_STATICTEXT; - break; - case ui::AX_ROLE_STATUS: - ia_role = ROLE_SYSTEM_STATUSBAR; - break; - case ui::AX_ROLE_SPLITTER: - ia_role = ROLE_SYSTEM_SEPARATOR; - break; - case ui::AX_ROLE_SVG_ROOT: - ia_role = ROLE_SYSTEM_GRAPHIC; - break; - case ui::AX_ROLE_SWITCH: - role_name = L"switch"; - ia2_role = IA2_ROLE_TOGGLE_BUTTON; - break; - case ui::AX_ROLE_TAB: - ia_role = ROLE_SYSTEM_PAGETAB; - break; - case ui::AX_ROLE_TABLE: - ia_role = ROLE_SYSTEM_TABLE; - break; - case ui::AX_ROLE_TABLE_HEADER_CONTAINER: - ia_role = ROLE_SYSTEM_GROUPING; - ia2_role = IA2_ROLE_SECTION; - break; - case ui::AX_ROLE_TAB_LIST: - ia_role = ROLE_SYSTEM_PAGETABLIST; - break; - case ui::AX_ROLE_TAB_PANEL: - ia_role = ROLE_SYSTEM_PROPERTYPAGE; - break; - case ui::AX_ROLE_TERM: - ia_role = ROLE_SYSTEM_LISTITEM; - break; - case ui::AX_ROLE_TOGGLE_BUTTON: - ia_role = ROLE_SYSTEM_PUSHBUTTON; - ia2_role = IA2_ROLE_TOGGLE_BUTTON; - break; - case ui::AX_ROLE_TEXT_FIELD: - case ui::AX_ROLE_SEARCH_BOX: - ia_role = ROLE_SYSTEM_TEXT; - ia2_state |= IA2_STATE_SELECTABLE_TEXT; - break; - case ui::AX_ROLE_ABBR: - case ui::AX_ROLE_TIME: - role_name = html_tag; - ia_role = ROLE_SYSTEM_TEXT; - ia2_role = IA2_ROLE_TEXT_FRAME; - break; - case ui::AX_ROLE_TIMER: - ia_role = ROLE_SYSTEM_CLOCK; - break; - case ui::AX_ROLE_TOOLBAR: - ia_role = ROLE_SYSTEM_TOOLBAR; - break; - case ui::AX_ROLE_TOOLTIP: - ia_role = ROLE_SYSTEM_TOOLTIP; - break; - case ui::AX_ROLE_TREE: - ia_role = ROLE_SYSTEM_OUTLINE; - break; - case ui::AX_ROLE_TREE_GRID: - ia_role = ROLE_SYSTEM_OUTLINE; - break; - case ui::AX_ROLE_TREE_ITEM: - ia_role = ROLE_SYSTEM_OUTLINEITEM; - break; - case ui::AX_ROLE_LINE_BREAK: - ia_role = ROLE_SYSTEM_WHITESPACE; - break; - case ui::AX_ROLE_VIDEO: - ia_role = ROLE_SYSTEM_GROUPING; - break; - case ui::AX_ROLE_WINDOW: - ia_role = ROLE_SYSTEM_WINDOW; - break; - - // TODO(dmazzoni): figure out the proper MSAA role for all of these. - case ui::AX_ROLE_DIRECTORY: - case ui::AX_ROLE_IGNORED: - case ui::AX_ROLE_LOG: - case ui::AX_ROLE_NONE: - case ui::AX_ROLE_PRESENTATIONAL: - case ui::AX_ROLE_SLIDER_THUMB: - default: - ia_role = ROLE_SYSTEM_CLIENT; - break; - } - - // The role should always be set. - DCHECK(!role_name.empty() || ia_role); - - // If we didn't explicitly set the IAccessible2 role, make it the same - // as the MSAA role. - if (!ia2_role) - ia2_role = ia_role; - - win_attributes_->ia_role = ia_role; - win_attributes_->ia_state = MSAAState(); - win_attributes_->role_name = role_name; - win_attributes_->ia2_role = ia2_role; - win_attributes_->ia2_state = ia2_state; -} - -bool BrowserAccessibilityComWin::IsInTreeGrid( - const BrowserAccessibility* item) { - BrowserAccessibility* container = item->PlatformGetParent(); - if (container && container->GetRole() == ui::AX_ROLE_GROUP) { - // If parent was a rowgroup, we need to look at the grandparent - container = container->PlatformGetParent(); - } - - if (!container) { - return false; - } - - return container->GetRole() == ui::AX_ROLE_TREE_GRID; -} - BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( BrowserAccessibility* obj) { if (!obj || !obj->IsNative())
diff --git a/content/browser/accessibility/browser_accessibility_com_win.h b/content/browser/accessibility/browser_accessibility_com_win.h index f385050..082580b 100644 --- a/content/browser/accessibility/browser_accessibility_com_win.h +++ b/content/browser/accessibility/browser_accessibility_com_win.h
@@ -727,9 +727,6 @@ private: // Private accessors. - int32_t ia_role() const { return win_attributes_->ia_role; } - int32_t ia2_role() const { return win_attributes_->ia2_role; } - int32_t ia2_state() const { return win_attributes_->ia2_state; } const std::vector<base::string16>& ia2_attributes() const { return win_attributes_->ia2_attributes; } @@ -777,10 +774,6 @@ // Does not return a new reference. BrowserAccessibilityComWin* GetTargetFromChildID(const VARIANT& var_id); - // Initialize the role and state metadata from the role enum and state - // bitmasks defined in ui::AXNodeData. - void InitRoleAndState(); - // Retrieve the value of an attribute from the string attribute map and // if found and nonempty, allocate a new BSTR (with SysAllocString) // and return S_OK. If not found or empty, return S_FALSE. @@ -926,9 +919,6 @@ // Fire a Windows-specific accessibility event notification on this node. void FireNativeEvent(LONG win_event_type) const; - - static bool IsInTreeGrid(const BrowserAccessibility* item); - struct WinAttributes { WinAttributes(); ~WinAttributes();
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc index 5ee4d2e6..7e9341c5 100644 --- a/content/browser/accessibility/browser_accessibility_win.cc +++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "content/browser/accessibility/browser_accessibility_win.h" +#include "content/browser/accessibility/browser_accessibility_manager.h" #include "ui/base/win/atl_module.h" @@ -60,6 +61,18 @@ return GetCOM(); } +ui::AXPlatformNode* BrowserAccessibilityWin::GetFromNodeID(int32_t id) { + if (!instance_active()) + return nullptr; + + BrowserAccessibility* accessibility = manager_->GetFromID(id); + if (!accessibility) + return nullptr; + + auto* accessibility_win = ToBrowserAccessibilityWin(accessibility); + return accessibility_win->GetCOM(); +} + BrowserAccessibilityComWin* BrowserAccessibilityWin::GetCOM() const { DCHECK(browser_accessibility_com_); return browser_accessibility_com_;
diff --git a/content/browser/accessibility/browser_accessibility_win.h b/content/browser/accessibility/browser_accessibility_win.h index abfce60..ec38830e 100644 --- a/content/browser/accessibility/browser_accessibility_win.h +++ b/content/browser/accessibility/browser_accessibility_win.h
@@ -33,6 +33,7 @@ base::string16 GetText() const override; gfx::NativeViewAccessible GetNativeViewAccessible() override; + ui::AXPlatformNode* GetFromNodeID(int32_t id) override; class BrowserAccessibilityComWin* GetCOM() const;
diff --git a/content/browser/appcache/appcache_host.cc b/content/browser/appcache/appcache_host.cc index 3af81c5..ecfa39c 100644 --- a/content/browser/appcache/appcache_host.cc +++ b/content/browser/appcache/appcache_host.cc
@@ -44,21 +44,26 @@ } // Anonymous namespace -AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend, +AppCacheHost::AppCacheHost(int host_id, + AppCacheFrontend* frontend, AppCacheServiceImpl* service) : host_id_(host_id), - spawning_host_id_(kAppCacheNoHostId), spawning_process_id_(0), - parent_host_id_(kAppCacheNoHostId), parent_process_id_(0), + spawning_host_id_(kAppCacheNoHostId), + spawning_process_id_(0), + parent_host_id_(kAppCacheNoHostId), + parent_process_id_(0), pending_main_resource_cache_id_(kAppCacheNoCacheId), pending_selected_cache_id_(kAppCacheNoCacheId), was_select_cache_called_(false), is_cache_selection_enabled_(true), - frontend_(frontend), service_(service), + frontend_(frontend), + service_(service), storage_(service->storage()), pending_callback_param_(NULL), main_resource_was_namespace_entry_(false), main_resource_blocked_(false), - associated_cache_info_pending_(false) { + associated_cache_info_pending_(false), + weak_factory_(this) { service_->AddObserver(this); } @@ -543,6 +548,10 @@ frontend_ = frontend; } +base::WeakPtr<AppCacheHost> AppCacheHost::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); +} + void AppCacheHost::AssociateNoCache(const GURL& manifest_url) { // manifest url can be empty. AssociateCacheHelper(NULL, manifest_url);
diff --git a/content/browser/appcache/appcache_host.h b/content/browser/appcache/appcache_host.h index 31c714b..2cbf435 100644 --- a/content/browser/appcache/appcache_host.h +++ b/content/browser/appcache/appcache_host.h
@@ -13,6 +13,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "content/browser/appcache/appcache_group.h" #include "content/browser/appcache/appcache_service_impl.h" @@ -194,6 +195,9 @@ void PrepareForTransfer(); void CompleteTransfer(int host_id, AppCacheFrontend* frontend); + // Returns a weak pointer reference to the host. + base::WeakPtr<AppCacheHost> GetWeakPtr(); + private: friend class content::AppCacheHostTest; friend class content::AppCacheStorageImplTest; @@ -353,6 +357,8 @@ FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheTwice); FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); + base::WeakPtrFactory<AppCacheHost> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(AppCacheHost); };
diff --git a/content/browser/appcache/appcache_request_handler.cc b/content/browser/appcache/appcache_request_handler.cc index dc0070c..652eff24 100644 --- a/content/browser/appcache/appcache_request_handler.cc +++ b/content/browser/appcache/appcache_request_handler.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/bind.h" +#include "base/command_line.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_backend_impl.h" #include "content/browser/appcache/appcache_host.h" @@ -18,6 +19,7 @@ #include "content/browser/appcache/appcache_url_loader_request.h" #include "content/browser/appcache/appcache_url_request_job.h" #include "content/browser/service_worker/service_worker_request_handler.h" +#include "content/public/common/content_features.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" @@ -101,7 +103,7 @@ // If its been setup to deliver a network response, we can just delete // it now and return NULL instead to achieve that since it couldn't // have been started yet. - if (job && job->IsDeliveringNetworkResponse()) { + if (job && job->IsDeliveringNetworkResponse() && !job->AsURLLoaderJob()) { DCHECK(!job->IsStarted()); job.reset(); } @@ -238,10 +240,16 @@ appcache_handle_core->host()->CreateRequestHandler( AppCacheURLLoaderRequest::Create(request), request.resource_type, request.should_reset_appcache); - handler->set_network_url_loader_factory_getter(url_loader_factory_getter); + handler->network_url_loader_factory_getter_ = url_loader_factory_getter; + handler->appcache_host_ = appcache_handle_core->host()->GetWeakPtr(); return handler; } +void AppCacheRequestHandler::SetSubresourceRequestLoadInfo( + std::unique_ptr<SubresourceLoadInfo> subresource_load_info) { + subresource_load_info_ = std::move(subresource_load_info); +} + void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { storage()->CancelDelegateCallbacks(this); host_ = NULL; // no need to RemoveObserver, the host is being deleted @@ -322,6 +330,15 @@ base::Bind(&AppCacheRequestHandler::OnPrepareToRestart, base::Unretained(this))); job_ = job->GetWeakPtr(); + if (!is_main_resource() && + base::FeatureList::IsEnabled(features::kNetworkService)) { + AppCacheURLLoaderJob* loader_job = job_->AsURLLoaderJob(); + + loader_job->SetSubresourceLoadInfo( + std::move(subresource_load_info_), + network_url_loader_factory_getter_.get()); + } + return job; } @@ -543,14 +560,19 @@ std::move(callback).Run(StartLoaderCallback()); return; } - navigation_request_job_->AsURLLoaderJob()->set_loader_callback( + navigation_request_job_->AsURLLoaderJob()->set_main_resource_loader_callback( std::move(callback)); } mojom::URLLoaderFactoryPtr AppCacheRequestHandler::MaybeCreateSubresourceFactory() { - return AppCacheSubresourceURLFactory::CreateURLLoaderFactory( - network_url_loader_factory_getter_.get()); + mojom::URLLoaderFactoryPtr factory_ptr = nullptr; + + // The factory is destroyed when the renderer drops the connection. + AppCacheSubresourceURLFactory::CreateURLLoaderFactory( + network_url_loader_factory_getter_.get(), appcache_host_, &factory_ptr); + + return factory_ptr; } } // namespace content
diff --git a/content/browser/appcache/appcache_request_handler.h b/content/browser/appcache/appcache_request_handler.h index 9fa3939..da797b92 100644 --- a/content/browser/appcache/appcache_request_handler.h +++ b/content/browser/appcache/appcache_request_handler.h
@@ -32,7 +32,8 @@ class AppCacheRequest; class AppCacheRequestHandlerTest; class AppCacheURLRequestJob; -struct ResourceRequest; +class AppCacheHost; +struct SubresourceLoadInfo; // An instance is created for each net::URLRequest. The instance survives all // http transactions involved in the processing of its net::URLRequest, and is @@ -80,6 +81,15 @@ AppCacheNavigationHandleCore* appcache_handle_core, URLLoaderFactoryGetter* url_loader_factory_getter); + // The following setters only apply for the network service code. + void set_network_url_loader_factory_getter( + URLLoaderFactoryGetter* url_loader_factory_getter) { + network_url_loader_factory_getter_ = url_loader_factory_getter; + } + + void SetSubresourceRequestLoadInfo( + std::unique_ptr<SubresourceLoadInfo> subresource_load_info); + private: friend class AppCacheHost; @@ -152,11 +162,6 @@ LoaderCallback callback) override; mojom::URLLoaderFactoryPtr MaybeCreateSubresourceFactory() override; - void set_network_url_loader_factory_getter( - URLLoaderFactoryGetter* url_loader_factory_getter) { - network_url_loader_factory_getter_ = url_loader_factory_getter; - } - // Data members ----------------------------------------------- // What host we're servicing a request for. @@ -217,6 +222,8 @@ std::unique_ptr<AppCacheRequest> request_; + // Network service related members. + // In the network service world we are queried via the URLLoaderRequestHandler // interface to see if the navigation request can be handled via the // AppCache. We hold onto the AppCache job created here until the client @@ -230,6 +237,13 @@ friend class content::AppCacheRequestHandlerTest; + // Subresource load information. + std::unique_ptr<SubresourceLoadInfo> subresource_load_info_; + + // The AppCache host instance. We pass this to the + // AppCacheSubresourceURLFactory instance on creation. + base::WeakPtr<AppCacheHost> appcache_host_; + DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); };
diff --git a/content/browser/appcache/appcache_subresource_url_factory.cc b/content/browser/appcache/appcache_subresource_url_factory.cc index e971ba6..4b6f9fd 100644 --- a/content/browser/appcache/appcache_subresource_url_factory.cc +++ b/content/browser/appcache/appcache_subresource_url_factory.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "content/browser/appcache/appcache_host.h" #include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_url_loader_job.h" #include "content/browser/appcache/appcache_url_loader_request.h" @@ -23,9 +24,11 @@ // Implements the URLLoaderFactory mojom for AppCache requests. AppCacheSubresourceURLFactory::AppCacheSubresourceURLFactory( mojom::URLLoaderFactoryRequest request, - URLLoaderFactoryGetter* default_url_loader_factory_getter) + URLLoaderFactoryGetter* default_url_loader_factory_getter, + base::WeakPtr<AppCacheHost> host) : binding_(this, std::move(request)), - default_url_loader_factory_getter_(default_url_loader_factory_getter) { + default_url_loader_factory_getter_(default_url_loader_factory_getter), + appcache_host_(host) { binding_.set_connection_error_handler( base::Bind(&AppCacheSubresourceURLFactory::OnConnectionError, base::Unretained(this))); @@ -34,17 +37,17 @@ AppCacheSubresourceURLFactory::~AppCacheSubresourceURLFactory() {} // static -mojom::URLLoaderFactoryPtr +AppCacheSubresourceURLFactory* AppCacheSubresourceURLFactory::CreateURLLoaderFactory( - URLLoaderFactoryGetter* default_url_loader_factory_getter) { - mojom::URLLoaderFactoryPtr loader_factory; - mojom::URLLoaderFactoryRequest request = mojo::MakeRequest(&loader_factory); + URLLoaderFactoryGetter* default_url_loader_factory_getter, + base::WeakPtr<AppCacheHost> host, + mojom::URLLoaderFactoryPtr* loader_factory) { + mojom::URLLoaderFactoryRequest request = mojo::MakeRequest(loader_factory); // This instance will get deleted when the client drops the connection. // Please see OnConnectionError() for details. - new AppCacheSubresourceURLFactory(std::move(request), - default_url_loader_factory_getter); - return loader_factory; + return new AppCacheSubresourceURLFactory( + std::move(request), default_url_loader_factory_getter, host); } void AppCacheSubresourceURLFactory::CreateLoaderAndStart( @@ -57,11 +60,42 @@ const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DLOG(WARNING) << "Received request for loading : " << request.url.spec(); - default_url_loader_factory_getter_->GetNetworkFactory() - ->get() - ->CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest(), routing_id, - request_id, options, request, std::move(client), - traffic_annotation); + + // If the host is invalid, it means that the renderer has probably died. + // (Frame has navigated elsewhere?) + if (!appcache_host_.get()) + return; + + std::unique_ptr<AppCacheRequestHandler> handler = + appcache_host_->CreateRequestHandler( + AppCacheURLLoaderRequest::Create(request), request.resource_type, + request.should_reset_appcache); + if (!handler) { + ResourceRequestCompletionStatus request_result; + request_result.error_code = net::ERR_FAILED; + client->OnComplete(request_result); + return; + } + + handler->set_network_url_loader_factory_getter( + default_url_loader_factory_getter_.get()); + + std::unique_ptr<SubresourceLoadInfo> load_info(new SubresourceLoadInfo()); + load_info->url_loader_request = std::move(url_loader_request); + load_info->routing_id = routing_id; + load_info->request_id = request_id; + load_info->options = options; + load_info->request = request; + load_info->client = std::move(client); + load_info->traffic_annotation = traffic_annotation; + + handler->SetSubresourceRequestLoadInfo(std::move(load_info)); + + AppCacheJob* job = handler->MaybeLoadResource(nullptr); + if (job) { + // The handler is owned by the job. + job->AsURLLoaderJob()->set_request_handler(std::move(handler)); + } } void AppCacheSubresourceURLFactory::SyncLoad(int32_t routing_id,
diff --git a/content/browser/appcache/appcache_subresource_url_factory.h b/content/browser/appcache/appcache_subresource_url_factory.h index a5620cf..ef4458e 100644 --- a/content/browser/appcache/appcache_subresource_url_factory.h +++ b/content/browser/appcache/appcache_subresource_url_factory.h
@@ -6,6 +6,7 @@ #define CONTENT_BROWSER_APPCACHE_APPCACHE_SUBRESOURCE_URL_FACTORY_H_ #include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" #include "content/public/common/url_loader_factory.mojom.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -13,6 +14,7 @@ namespace content { +class AppCacheHost; class AppCacheJob; class AppCacheServiceImpl; class URLLoaderFactoryGetter; @@ -25,10 +27,15 @@ // Factory function to create an instance of the factory. // 1. The |factory_getter| parameter is used to query the network service // to pass network requests to. - // Returns a URLLoaderFactoryPtr instance which controls the lifetime of the - // factory. - static mojom::URLLoaderFactoryPtr CreateURLLoaderFactory( - URLLoaderFactoryGetter* factory_getter); + // 2. The |host| parameter contains the appcache host instance. This is used + // to create the AppCacheRequestHandler instances for handling subresource + // requests. + // Returns the AppCacheSubresourceURLFactory instance. The URLLoaderFactoryPtr + // is returned in the |loader_factory| parameter. + static AppCacheSubresourceURLFactory* CreateURLLoaderFactory( + URLLoaderFactoryGetter* factory_getter, + base::WeakPtr<AppCacheHost> host, + mojom::URLLoaderFactoryPtr* loader_factory); // mojom::URLLoaderFactory implementation. void CreateLoaderAndStart( @@ -47,7 +54,8 @@ private: AppCacheSubresourceURLFactory(mojom::URLLoaderFactoryRequest request, - URLLoaderFactoryGetter* factory_getter); + URLLoaderFactoryGetter* factory_getter, + base::WeakPtr<AppCacheHost> host); void OnConnectionError(); @@ -58,6 +66,8 @@ // the network service. scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_; + base::WeakPtr<AppCacheHost> appcache_host_; + DISALLOW_COPY_AND_ASSIGN(AppCacheSubresourceURLFactory); };
diff --git a/content/browser/appcache/appcache_url_loader_job.cc b/content/browser/appcache/appcache_url_loader_job.cc index 55c5f2e..1d1932f 100644 --- a/content/browser/appcache/appcache_url_loader_job.cc +++ b/content/browser/appcache/appcache_url_loader_job.cc
@@ -6,12 +6,19 @@ #include "base/strings/string_number_conversions.h" #include "content/browser/appcache/appcache_histograms.h" +#include "content/browser/appcache/appcache_subresource_url_factory.h" +#include "content/browser/url_loader_factory_getter.h" #include "content/common/net_adapters.h" #include "content/public/common/resource_type.h" #include "net/http/http_status_code.h" namespace content { +SubresourceLoadInfo::SubresourceLoadInfo() + : routing_id(-1), request_id(-1), options(0) {} + +SubresourceLoadInfo::~SubresourceLoadInfo() {} + AppCacheURLLoaderJob::~AppCacheURLLoaderJob() { if (storage_.get()) storage_->CancelDelegateCallbacks(this); @@ -34,6 +41,9 @@ delivery_type_ = APPCACHED_DELIVERY; + load_timing_info_.request_start_time = base::Time::Now(); + load_timing_info_.request_start = base::TimeTicks::Now(); + AppCacheHistograms::AddAppCacheJobStartDelaySample(base::TimeTicks::Now() - start_time_tick_); @@ -59,11 +69,22 @@ AppCacheHistograms::AddNetworkJobStartDelaySample(base::TimeTicks::Now() - start_time_tick_); - DCHECK(!loader_callback_.is_null()); - // In network service land, if we are processing a navigation request, we - // need to inform the loader callback that we are not going to handle this - // request. The loader callback is valid only for navigation requests. - std::move(loader_callback_).Run(StartLoaderCallback()); + if (IsResourceTypeFrame(request_.resource_type)) { + DCHECK(!main_resource_loader_callback_.is_null()); + // In network service land, if we are processing a navigation request, we + // need to inform the loader callback that we are not going to handle this + // request. The loader callback is valid only for navigation requests. + std::move(main_resource_loader_callback_).Run(StartLoaderCallback()); + } else { + default_url_loader_factory_getter_->GetNetworkFactory() + ->get() + ->CreateLoaderAndStart( + mojo::MakeRequest(&network_loader_request_), + subresource_load_info_->routing_id, + subresource_load_info_->request_id, subresource_load_info_->options, + subresource_load_info_->request, std::move(client_info_), + subresource_load_info_->traffic_annotation); + } } void AppCacheURLLoaderJob::DeliverErrorResponse() { @@ -99,12 +120,28 @@ } void AppCacheURLLoaderJob::FollowRedirect() { - DCHECK(false); + if (network_loader_request_) + network_loader_request_->FollowRedirect(); } void AppCacheURLLoaderJob::SetPriority(net::RequestPriority priority, int32_t intra_priority_value) { - NOTREACHED() << "We don't support SetPriority()"; + if (network_loader_request_) + network_loader_request_->SetPriority(priority, intra_priority_value); +} + +void AppCacheURLLoaderJob::SetSubresourceLoadInfo( + std::unique_ptr<SubresourceLoadInfo> subresource_load_info, + URLLoaderFactoryGetter* default_url_loader) { + subresource_load_info_ = std::move(subresource_load_info); + + associated_binding_.reset(new mojo::AssociatedBinding<mojom::URLLoader>( + this, std::move(subresource_load_info_->url_loader_request))); + associated_binding_->set_connection_error_handler(base::Bind( + &AppCacheURLLoaderJob::OnConnectionError, StaticAsWeakPtr(this))); + + client_info_ = std::move(subresource_load_info_->client); + default_url_loader_factory_getter_ = default_url_loader; } void AppCacheURLLoaderJob::Start(mojom::URLLoaderRequest request, @@ -151,9 +188,11 @@ if (is_range_request()) SetupRangeResponse(); - DCHECK(!loader_callback_.is_null()); - std::move(loader_callback_) - .Run(base::Bind(&AppCacheURLLoaderJob::Start, StaticAsWeakPtr(this))); + if (IsResourceTypeFrame(request_.resource_type)) { + DCHECK(!main_resource_loader_callback_.is_null()); + std::move(main_resource_loader_callback_) + .Run(base::Bind(&AppCacheURLLoaderJob::Start, StaticAsWeakPtr(this))); + } response_body_stream_ = std::move(data_pipe_.producer_handle); @@ -185,6 +224,12 @@ void AppCacheURLLoaderJob::OnReadComplete(int result) { DLOG(WARNING) << "AppCache read completed with result: " << result; + if (result <= 0) { + writable_handle_watcher_.Cancel(); + pending_write_->Complete(0); + pending_write_ = nullptr; + } + bool is_main_resource = IsResourceTypeFrame(request_.resource_type); if (result == 0) { @@ -216,7 +261,6 @@ void AppCacheURLLoaderJob::SendResponseInfo() { DCHECK(client_info_); - // If this is null it means the response information was sent to the client. if (!data_pipe_.consumer_handle.is_valid()) return; @@ -227,18 +271,28 @@ ResourceResponseHead response_head; response_head.headers = http_info->headers; + response_head.appcache_id = cache_id_; + response_head.appcache_manifest_url = manifest_url_; - // TODO(ananta) - // Copy more fields. http_info->headers->GetMimeType(&response_head.mime_type); http_info->headers->GetCharset(&response_head.charset); + // TODO(ananta) + // Verify if the times sent here are correct. response_head.request_time = http_info->request_time; response_head.response_time = http_info->response_time; response_head.content_length = is_range_request() ? range_response_info_->headers->GetContentLength() : info_->response_data_size(); + response_head.connection_info = http_info->connection_info; + response_head.socket_address = http_info->socket_address; + response_head.was_fetched_via_spdy = http_info->was_fetched_via_spdy; + response_head.was_alpn_negotiated = http_info->was_alpn_negotiated; + response_head.alpn_negotiated_protocol = http_info->alpn_negotiated_protocol; + + response_head.load_timing = load_timing_info_; + client_info_->OnReceiveResponse(response_head, http_info->ssl_info, mojom::DownloadedTempFilePtr()); @@ -289,10 +343,26 @@ void AppCacheURLLoaderJob::NotifyCompleted(int error_code) { if (storage_.get()) storage_->CancelDelegateCallbacks(this); - // TODO(ananta) - // Fill other details in the ResourceRequestCompletionStatus structure. + + const net::HttpResponseInfo* http_info = is_range_request() + ? range_response_info_.get() + : info_->http_response_info(); + ResourceRequestCompletionStatus request_complete_data; request_complete_data.error_code = error_code; + + // TODO(ananta) + // Fill other details in the ResourceRequestCompletionStatus structure in + // case of an error. + if (!request_complete_data.error_code) { + request_complete_data.exists_in_cache = http_info->was_cached; + request_complete_data.completion_time = base::TimeTicks::Now(); + request_complete_data.encoded_body_length = + is_range_request() ? range_response_info_->headers->GetContentLength() + : info_->response_data_size(); + request_complete_data.decoded_body_length = + request_complete_data.encoded_body_length; + } client_info_->OnComplete(request_complete_data); }
diff --git a/content/browser/appcache/appcache_url_loader_job.h b/content/browser/appcache/appcache_url_loader_job.h index 42615a68..59f62035 100644 --- a/content/browser/appcache/appcache_url_loader_job.h +++ b/content/browser/appcache/appcache_url_loader_job.h
@@ -12,12 +12,14 @@ #include "base/time/time.h" #include "content/browser/appcache/appcache_entry.h" #include "content/browser/appcache/appcache_job.h" +#include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_response.h" #include "content/browser/appcache/appcache_storage.h" #include "content/browser/loader/url_loader_request_handler.h" #include "content/common/content_export.h" #include "content/public/common/resource_request.h" #include "content/public/common/url_loader.mojom.h" +#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/system/data_pipe.h" @@ -25,6 +27,23 @@ class AppCacheRequest; class NetToMojoPendingBuffer; +class URLLoaderFactoryGetter; +struct SubresourceLoadInfo; + +// Holds information about the subresource load request like the routing id, +// request id, the client pointer, etc. +struct SubresourceLoadInfo { + SubresourceLoadInfo(); + ~SubresourceLoadInfo(); + + mojom::URLLoaderAssociatedRequest url_loader_request; + int32_t routing_id; + int32_t request_id; + uint32_t options; + ResourceRequest request; + mojom::URLLoaderClientPtr client; + net::MutableNetworkTrafficAnnotationTag traffic_annotation; +}; // AppCacheJob wrapper for a mojom::URLLoader implementation which returns // responses stored in the AppCache. @@ -54,8 +73,23 @@ void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override; - void set_loader_callback(LoaderCallback callback) { - loader_callback_ = std::move(callback); + void set_main_resource_loader_callback(LoaderCallback callback) { + main_resource_loader_callback_ = std::move(callback); + } + + // Subresource request load information is passed in the + // |subresource_load_info| parameter. This includes the request id, the + // client pointer, etc. + // |default_url_loader| is used to retrieve the network loader for requests + // intended to be sent to the network. + void SetSubresourceLoadInfo( + std::unique_ptr<SubresourceLoadInfo> subresource_load_info, + URLLoaderFactoryGetter* default_url_loader); + + // Ownership of the |handler| is transferred to us via this call. This is + // only for subresource requests. + void set_request_handler(std::unique_ptr<AppCacheRequestHandler> handler) { + sub_resource_handler_ = std::move(handler); } protected: @@ -123,8 +157,29 @@ mojo::SimpleWatcher writable_handle_watcher_; // The Callback to be invoked in the network service land to indicate if - // the request can be serviced via the AppCache. - LoaderCallback loader_callback_; + // the main resource request can be serviced via the AppCache. + LoaderCallback main_resource_loader_callback_; + + // We own the AppCacheRequestHandler instance for subresource requests. + std::unique_ptr<AppCacheRequestHandler> sub_resource_handler_; + + scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_; + + // Holds subresource url loader information. + std::unique_ptr<SubresourceLoadInfo> subresource_load_info_; + + // Timing information for the most recent request. Its start times are + // populated in DeliverAppCachedResponse(). + net::LoadTimingInfo load_timing_info_; + + // Used for subresource requests which go to the network. + mojom::URLLoaderAssociatedPtr network_loader_request_; + + // Binds the subresource URLLoaderClient with us. We can use the regular + // binding_ member above when we remove the need for the associated requests + // issue with URLLoaderFactory. + std::unique_ptr<mojo::AssociatedBinding<mojom::URLLoader>> + associated_binding_; DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderJob); };
diff --git a/content/browser/blob_storage/blob_registry_wrapper.cc b/content/browser/blob_storage/blob_registry_wrapper.cc index 71077fb..aaa5c0f 100644 --- a/content/browser/blob_storage/blob_registry_wrapper.cc +++ b/content/browser/blob_storage/blob_registry_wrapper.cc
@@ -36,16 +36,21 @@ } // namespace -BlobRegistryWrapper::BlobRegistryWrapper( +// static +scoped_refptr<BlobRegistryWrapper> BlobRegistryWrapper::Create( scoped_refptr<ChromeBlobStorageContext> blob_storage_context, scoped_refptr<storage::FileSystemContext> file_system_context) { - DCHECK(base::FeatureList::IsEnabled(features::kMojoBlobs)); - + scoped_refptr<BlobRegistryWrapper> result(new BlobRegistryWrapper()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::BindOnce(&BlobRegistryWrapper::InitializeOnIOThread, this, + base::BindOnce(&BlobRegistryWrapper::InitializeOnIOThread, result, std::move(blob_storage_context), std::move(file_system_context))); + return result; +} + +BlobRegistryWrapper::BlobRegistryWrapper() { + DCHECK(base::FeatureList::IsEnabled(features::kMojoBlobs)); } void BlobRegistryWrapper::Bind(
diff --git a/content/browser/blob_storage/blob_registry_wrapper.h b/content/browser/blob_storage/blob_registry_wrapper.h index 1befb59..7f28bc1 100644 --- a/content/browser/blob_storage/blob_registry_wrapper.h +++ b/content/browser/blob_storage/blob_registry_wrapper.h
@@ -28,7 +28,7 @@ : public base::RefCountedThreadSafe<BlobRegistryWrapper, BrowserThread::DeleteOnIOThread> { public: - BlobRegistryWrapper( + static scoped_refptr<BlobRegistryWrapper> Create( scoped_refptr<ChromeBlobStorageContext> blob_storage_context, scoped_refptr<storage::FileSystemContext> file_system_context); @@ -37,6 +37,7 @@ storage::mojom::BlobRegistryRequest request); private: + BlobRegistryWrapper(); friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; friend class base::DeleteHelper<BlobRegistryWrapper>; ~BlobRegistryWrapper();
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 30cc0ed..1441c9e9 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -445,7 +445,7 @@ void BrowserPluginGuest::OnRequireSequence( int instance_id, - const cc::SurfaceId& id, + const viz::SurfaceId& id, const cc::SurfaceSequence& sequence) { GetFrameSinkManager()->surface_manager()->RequireSequence(id, sequence); }
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 896752df..7fe0134 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -52,7 +52,6 @@ #endif namespace cc { -class SurfaceId; class SurfaceInfo; struct SurfaceSequence; } // namespace cc @@ -61,6 +60,10 @@ class Range; } // namespace gfx +namespace viz { +class SurfaceId; +} // namespace viz + namespace content { class BrowserPluginGuestManager; @@ -280,7 +283,7 @@ void OnSatisfySequence(int instance_id, const cc::SurfaceSequence& sequence); void OnRequireSequence(int instance_id, - const cc::SurfaceId& id, + const viz::SurfaceId& id, const cc::SurfaceSequence& sequence); // Message handlers for messages from embedder. void OnDetach(int instance_id);
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 2224f98..eee583b 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -722,7 +722,7 @@ return this; } -cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { +viz::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { return frame_sink_id_allocator_.NextFrameSinkId(); }
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h index 29f69eeb..828e786 100644 --- a/content/browser/compositor/gpu_process_transport_factory.h +++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -17,7 +17,7 @@ #include "base/observer_list.h" #include "build/build_config.h" #include "cc/output/renderer_settings.h" -#include "cc/surfaces/frame_sink_id_allocator.h" +#include "components/viz/common/frame_sink_id_allocator.h" #include "components/viz/host/host_frame_sink_manager.h" #include "content/browser/compositor/image_transport_factory.h" #include "gpu/ipc/client/gpu_channel_host.h" @@ -62,7 +62,7 @@ ui::Layer* target) override; void RemoveReflector(ui::Reflector* reflector) override; void RemoveCompositor(ui::Compositor* compositor) override; - cc::FrameSinkId AllocateFrameSinkId() override; + viz::FrameSinkId AllocateFrameSinkId() override; viz::HostFrameSinkManager* GetHostFrameSinkManager() override; void SetDisplayVisible(ui::Compositor* compositor, bool visible) override; void ResizeDisplay(ui::Compositor* compositor, @@ -107,7 +107,7 @@ scoped_refptr<cc::VulkanInProcessContextProvider> SharedVulkanContextProvider(); - cc::FrameSinkIdAllocator frame_sink_id_allocator_; + viz::FrameSinkIdAllocator frame_sink_id_allocator_; #if defined(OS_WIN) // Used by output surface, stored in PerCompositorData.
diff --git a/content/browser/compositor/reflector_impl.cc b/content/browser/compositor/reflector_impl.cc index c5214b6..08292d6 100644 --- a/content/browser/compositor/reflector_impl.cc +++ b/content/browser/compositor/reflector_impl.cc
@@ -158,7 +158,7 @@ const gfx::Rect& redraw_rect) { if (layer_data->needs_set_mailbox) { layer_data->layer->SetTextureMailbox( - cc::TextureMailbox(mailbox_->holder()), + viz::TextureMailbox(mailbox_->holder()), cc::SingleReleaseCallback::Create(base::Bind(ReleaseMailbox, mailbox_)), source_size); layer_data->needs_set_mailbox = false;
diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc index e268774..f1879dd8 100644 --- a/content/browser/compositor/reflector_impl_unittest.cc +++ b/content/browser/compositor/reflector_impl_unittest.cc
@@ -169,7 +169,7 @@ void TearDown() override { if (reflector_) reflector_->RemoveMirroringLayer(mirroring_layer_.get()); - cc::TextureMailbox mailbox; + viz::TextureMailbox mailbox; std::unique_ptr<cc::SingleReleaseCallback> release; if (mirroring_layer_->PrepareTextureMailbox(&mailbox, &release)) { release->Run(gpu::SyncToken(), false);
diff --git a/content/browser/compositor/software_output_device_ozone_unittest.cc b/content/browser/compositor/software_output_device_ozone_unittest.cc index 1645976..af3e1574 100644 --- a/content/browser/compositor/software_output_device_ozone_unittest.cc +++ b/content/browser/compositor/software_output_device_ozone_unittest.cc
@@ -94,7 +94,7 @@ window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( &window_delegate_, gfx::Rect(size)); compositor_.reset( - new ui::Compositor(cc::FrameSinkId(1, 1), context_factory, nullptr, + new ui::Compositor(viz::FrameSinkId(1, 1), context_factory, nullptr, base::ThreadTaskRunnerHandle::Get(), false /* enable_surface_synchronization */)); compositor_->SetAcceleratedWidget(window_delegate_.GetAcceleratedWidget());
diff --git a/content/browser/compositor/surface_utils.cc b/content/browser/compositor/surface_utils.cc index 185d48d..0ced495a 100644 --- a/content/browser/compositor/surface_utils.cc +++ b/content/browser/compositor/surface_utils.cc
@@ -89,7 +89,7 @@ uint8_t* pixels = static_cast<uint8_t*>(bitmap->getPixels()); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture()); @@ -155,7 +155,7 @@ namespace content { -cc::FrameSinkId AllocateFrameSinkId() { +viz::FrameSinkId AllocateFrameSinkId() { #if defined(OS_ANDROID) return CompositorImpl::AllocateFrameSinkId(); #else
diff --git a/content/browser/compositor/surface_utils.h b/content/browser/compositor/surface_utils.h index 3a4c680a2..07ff173d 100644 --- a/content/browser/compositor/surface_utils.h +++ b/content/browser/compositor/surface_utils.h
@@ -7,7 +7,7 @@ #include <memory> -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "content/common/content_export.h" #include "content/public/browser/readback_types.h" #include "third_party/skia/include/core/SkImageInfo.h" @@ -25,7 +25,7 @@ namespace content { -CONTENT_EXPORT cc::FrameSinkId AllocateFrameSinkId(); +CONTENT_EXPORT viz::FrameSinkId AllocateFrameSinkId(); CONTENT_EXPORT cc::FrameSinkManager* GetFrameSinkManager();
diff --git a/content/browser/devtools/protocol/emulation_handler.cc b/content/browser/devtools/protocol/emulation_handler.cc index 736e855..34b728f 100644 --- a/content/browser/devtools/protocol/emulation_handler.cc +++ b/content/browser/devtools/protocol/emulation_handler.cc
@@ -226,17 +226,28 @@ device_emulation_enabled_ = true; device_emulation_params_ = params; - // if (width > 0 && height > 0) - // widget_host->GetView()->SetSize(gfx::Size(width, height)); + if (width > 0 && height > 0) { + original_view_size_ = widget_host->GetView()->GetViewBounds().size(); + widget_host->GetView()->SetSize(gfx::Size(width, height)); + } else { + original_view_size_ = gfx::Size(); + } UpdateDeviceEmulationState(); return Response::OK(); } Response EmulationHandler::ClearDeviceMetricsOverride() { + RenderWidgetHostImpl* widget_host = + host_ ? host_->GetRenderWidgetHost() : nullptr; + if (!widget_host) + return Response::Error("Target does not support metrics override"); if (!device_emulation_enabled_) return Response::OK(); device_emulation_enabled_ = false; + if (original_view_size_.width()) + widget_host->GetView()->SetSize(original_view_size_); + original_view_size_ = gfx::Size(); UpdateDeviceEmulationState(); return Response::OK(); }
diff --git a/content/browser/devtools/protocol/emulation_handler.h b/content/browser/devtools/protocol/emulation_handler.h index 12a2abd..06f99fea 100644 --- a/content/browser/devtools/protocol/emulation_handler.h +++ b/content/browser/devtools/protocol/emulation_handler.h
@@ -68,6 +68,7 @@ std::string touch_emulation_configuration_; bool device_emulation_enabled_; + gfx::Size original_view_size_; blink::WebDeviceEmulationParams device_emulation_params_; RenderFrameHostImpl* host_;
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc index 0751813d..d8b0b164 100644 --- a/content/browser/devtools/protocol/page_handler.cc +++ b/content/browser/devtools/protocol/page_handler.cc
@@ -355,6 +355,7 @@ void PageHandler::CaptureScreenshot( Maybe<std::string> format, Maybe<int> quality, + Maybe<Page::Viewport> clip, Maybe<bool> from_surface, std::unique_ptr<CaptureScreenshotCallback> callback) { if (!host_ || !host_->GetRenderWidgetHost()) { @@ -381,9 +382,25 @@ modified_params.scale = dpfactor; modified_params.view_size.width = emulated_view_size.width(); modified_params.view_size.height = emulated_view_size.height(); + if (clip.isJust()) { + // TODO(pfeldman): Modifying here to save on the extra + // RenderWidgetScreenMetricsEmulator / DevToolsEmulator delegate back + // and forth. + modified_params.viewport_offset.x = clip.fromJust()->GetX() * dpfactor; + modified_params.viewport_offset.y = clip.fromJust()->GetY() * dpfactor; + modified_params.viewport_scale = clip.fromJust()->GetScale(); + } + emulation_handler_->SetDeviceEmulationParams(modified_params); - widget_host->GetView()->SetSize( - gfx::ScaleToFlooredSize(emulated_view_size, dpfactor)); + + if (clip.isJust()) { + widget_host->GetView()->SetSize(gfx::ScaleToCeiledSize( + gfx::Size(clip.fromJust()->GetWidth(), clip.fromJust()->GetHeight()), + dpfactor * clip.fromJust()->GetScale())); + } else { + widget_host->GetView()->SetSize( + gfx::ScaleToFlooredSize(emulated_view_size, dpfactor)); + } } std::string screenshot_format = format.fromMaybe(kPng);
diff --git a/content/browser/devtools/protocol/page_handler.h b/content/browser/devtools/protocol/page_handler.h index 733bab4..45ac79d 100644 --- a/content/browser/devtools/protocol/page_handler.h +++ b/content/browser/devtools/protocol/page_handler.h
@@ -82,6 +82,7 @@ void CaptureScreenshot( Maybe<std::string> format, Maybe<int> quality, + Maybe<Page::Viewport> clip, Maybe<bool> from_surface, std::unique_ptr<CaptureScreenshotCallback> callback) override; void PrintToPDF(Maybe<bool> landscape,
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index aeb9c9ba..19580422 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc
@@ -1347,7 +1347,6 @@ ? new_create_info.save_info->hash_state->Clone() : nullptr; - destination_info_.current_path = new_create_info.save_info->file_path; destination_info_.received_bytes = offset; hash_state_ = std::move(hash_state); destination_info_.hash.clear();
diff --git a/content/browser/frame_host/cross_process_frame_connector.cc b/content/browser/frame_host/cross_process_frame_connector.cc index fe36990..21f5dc4 100644 --- a/content/browser/frame_host/cross_process_frame_connector.cc +++ b/content/browser/frame_host/cross_process_frame_connector.cc
@@ -101,7 +101,7 @@ } void CrossProcessFrameConnector::OnRequireSequence( - const cc::SurfaceId& id, + const viz::SurfaceId& id, const cc::SurfaceSequence& sequence) { GetFrameSinkManager()->surface_manager()->RequireSequence(id, sequence); } @@ -118,7 +118,7 @@ gfx::Point CrossProcessFrameConnector::TransformPointToRootCoordSpace( const gfx::Point& point, - const cc::SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { gfx::Point transformed_point; TransformPointToCoordSpaceForView(point, GetRootRenderWidgetHostView(), surface_id, &transformed_point); @@ -127,8 +127,8 @@ bool CrossProcessFrameConnector::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, - const cc::SurfaceId& local_surface_id, + const viz::SurfaceId& original_surface, + const viz::SurfaceId& local_surface_id, gfx::Point* transformed_point) { if (original_surface == local_surface_id) { *transformed_point = point; @@ -152,7 +152,7 @@ bool CrossProcessFrameConnector::TransformPointToCoordSpaceForView( const gfx::Point& point, RenderWidgetHostViewBase* target_view, - const cc::SurfaceId& local_surface_id, + const viz::SurfaceId& local_surface_id, gfx::Point* transformed_point) { RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); if (!root_view)
diff --git a/content/browser/frame_host/cross_process_frame_connector.h b/content/browser/frame_host/cross_process_frame_connector.h index 27b7066..a55c098 100644 --- a/content/browser/frame_host/cross_process_frame_connector.h +++ b/content/browser/frame_host/cross_process_frame_connector.h
@@ -91,21 +91,21 @@ gfx::Rect ChildFrameRect(); void UpdateCursor(const WebCursor& cursor); gfx::Point TransformPointToRootCoordSpace(const gfx::Point& point, - const cc::SurfaceId& surface_id); + const viz::SurfaceId& surface_id); // TransformPointToLocalCoordSpace() can only transform points between // surfaces where one is embedded (not necessarily directly) within the // other, and will return false if this is not the case. For points that can // be in sibling surfaces, they must first be converted to the root // surface's coordinate space. bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, - const cc::SurfaceId& local_surface_id, + const viz::SurfaceId& original_surface, + const viz::SurfaceId& local_surface_id, gfx::Point* transformed_point); // Returns false if |target_view| and |view_| do not have the same root // RenderWidgetHostView. bool TransformPointToCoordSpaceForView(const gfx::Point& point, RenderWidgetHostViewBase* target_view, - const cc::SurfaceId& local_surface_id, + const viz::SurfaceId& local_surface_id, gfx::Point* transformed_point); // Pass acked touch events to the root view for gesture processing. @@ -153,7 +153,7 @@ void OnVisibilityChanged(bool visible); void OnSetIsInert(bool); void OnSatisfySequence(const cc::SurfaceSequence& sequence); - void OnRequireSequence(const cc::SurfaceId& id, + void OnRequireSequence(const viz::SurfaceId& id, const cc::SurfaceSequence& sequence); void SetRect(const gfx::Rect& frame_rect);
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc index b25a6afd..4f1e52aa 100644 --- a/content/browser/frame_host/interstitial_page_impl.cc +++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -284,27 +284,17 @@ old_view->Show(); } - // If the focus was on the interstitial, let's keep it to the page. - // (Note that in unit-tests the RVH may not have a view). - if (render_view_host_->GetWidget()->GetView() && - render_view_host_->GetWidget()->GetView()->HasFocus() && - controller_->delegate()->GetRenderViewHost()->GetWidget()->GetView()) { - controller_->delegate() - ->GetRenderViewHost() - ->GetWidget() - ->GetView() - ->Focus(); - } - // Delete this and call Shutdown on the RVH asynchronously, as we may have // been called from a RVH delegate method, and we can't delete the RVH out // from under itself. base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( FROM_HERE, base::Bind(&InterstitialPageImpl::Shutdown, weak_ptr_factory_.GetWeakPtr())); + bool has_focus = render_view_host_->GetWidget()->GetView() && + render_view_host_->GetWidget()->GetView()->HasFocus(); render_view_host_ = NULL; frame_tree_->root()->ResetForNewProcess(); - controller_->delegate()->DetachInterstitialPage(); + controller_->delegate()->DetachInterstitialPage(has_focus); // Let's revert to the original title if necessary. NavigationEntry* entry = controller_->GetVisibleEntry(); if (entry && !new_navigation_ && should_revert_web_contents_title_)
diff --git a/content/browser/frame_host/interstitial_page_impl_browsertest.cc b/content/browser/frame_host/interstitial_page_impl_browsertest.cc index c8e9148..6439a0d 100644 --- a/content/browser/frame_host/interstitial_page_impl_browsertest.cc +++ b/content/browser/frame_host/interstitial_page_impl_browsertest.cc
@@ -169,6 +169,8 @@ interstitial_.reset(); } + InterstitialPageImpl* interstitial() { return interstitial_.get(); } + bool FocusInputAndSelectText() { return ExecuteScript(interstitial_->GetMainFrame(), "focus_select_input()"); } @@ -315,6 +317,34 @@ TearDownInterstitialPage(); } +IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, FocusAfterDetaching) { + WebContentsImpl* web_contents = + static_cast<WebContentsImpl*>(shell()->web_contents()); + + // Load something into the WebContents. + EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank"))); + + // Blur the main frame. + web_contents->GetMainFrame()->GetRenderWidgetHost()->Blur(); + EXPECT_FALSE( + web_contents->GetMainFrame()->GetRenderWidgetHost()->is_focused()); + + // Setup the interstitial and focus it. + SetUpInterstitialPage(); + interstitial()->GetView()->GetRenderWidgetHost()->Focus(); + EXPECT_TRUE(web_contents->ShowingInterstitialPage()); + EXPECT_TRUE(static_cast<RenderWidgetHostImpl*>( + interstitial()->GetView()->GetRenderWidgetHost()) + ->is_focused()); + + // Tear down interstitial. + TearDownInterstitialPage(); + + // Since the interstitial was focused, the main frame should be now focused + // after the interstitial teardown. + EXPECT_TRUE(web_contents->GetRenderViewHost()->GetWidget()->is_focused()); +} + // Ensure that we don't show the underlying RenderWidgetHostView if a subframe // commits in the original page while an interstitial is showing. // See https://crbug.com/729105.
diff --git a/content/browser/frame_host/navigation_controller_delegate.h b/content/browser/frame_host/navigation_controller_delegate.h index 60df123f..c57ac461 100644 --- a/content/browser/frame_host/navigation_controller_delegate.h +++ b/content/browser/frame_host/navigation_controller_delegate.h
@@ -61,7 +61,7 @@ virtual void AttachInterstitialPage( InterstitialPageImpl* interstitial_page) = 0; virtual void DidProceedOnInterstitial() = 0; - virtual void DetachInterstitialPage() = 0; + virtual void DetachInterstitialPage(bool has_focus) = 0; virtual void UpdateOverridingUserAgent() = 0; };
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index 20437dd..26c9828 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -1136,50 +1136,43 @@ } void NavigationHandleImpl::RegisterNavigationThrottles() { - // Register the navigation throttles. The vector returned by - // CreateThrottlesForNavigation is not assigned to throttles_ directly because - // it would overwrite any throttles previously added with - // RegisterThrottleForTesting. - // TODO(carlosk, arthursonzogni): should simplify this to either use - // |throttles_| directly (except for the case described above) or - // |throttles_to_register| for registering all throttles. - std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = - GetDelegate()->CreateThrottlesForNavigation(this); + // Note: |throttle_| might not be empty. Some NavigationThrottles might have + // been registered with RegisterThrottleForTesting. These must reside at the + // end of |throttles_|. TestNavigationManagerThrottle expects that the + // NavigationThrottles added for test are the last NavigationThrottles to + // execute. Take them out while appending the rest of the + // NavigationThrottles. + std::vector<std::unique_ptr<NavigationThrottle>> testing_throttles = + std::move(throttles_); + + throttles_ = GetDelegate()->CreateThrottlesForNavigation(this); // Check for renderer-inititated main frame navigations to data URLs. This is // done first as it may block the main frame navigation altogether. - std::unique_ptr<NavigationThrottle> data_url_navigation_throttle = - DataUrlNavigationThrottle::CreateThrottleForNavigation(this); - if (data_url_navigation_throttle) - throttles_to_register.push_back(std::move(data_url_navigation_throttle)); + AddThrottle(DataUrlNavigationThrottle::CreateThrottleForNavigation(this)); - std::unique_ptr<content::NavigationThrottle> ancestor_throttle = - content::AncestorThrottle::MaybeCreateThrottleFor(this); - if (ancestor_throttle) - throttles_.push_back(std::move(ancestor_throttle)); - - std::unique_ptr<content::NavigationThrottle> form_submission_throttle = - content::FormSubmissionThrottle::MaybeCreateThrottleFor(this); - if (form_submission_throttle) - throttles_.push_back(std::move(form_submission_throttle)); + AddThrottle(AncestorThrottle::MaybeCreateThrottleFor(this)); + AddThrottle(FormSubmissionThrottle::MaybeCreateThrottleFor(this)); // Check for mixed content. This is done after the AncestorThrottle and the // FormSubmissionThrottle so that when folks block mixed content with a CSP // policy, they don't get a warning. They'll still get a warning in the // console about CSP blocking the load. - std::unique_ptr<NavigationThrottle> mixed_content_throttle = - MixedContentNavigationThrottle::CreateThrottleForNavigation(this); - if (mixed_content_throttle) - throttles_to_register.push_back(std::move(mixed_content_throttle)); + AddThrottle( + MixedContentNavigationThrottle::CreateThrottleForNavigation(this)); - std::unique_ptr<NavigationThrottle> devtools_throttle = - RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); - if (devtools_throttle) - throttles_to_register.push_back(std::move(devtools_throttle)); + AddThrottle(RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this)); - throttles_.insert(throttles_.begin(), - std::make_move_iterator(throttles_to_register.begin()), - std::make_move_iterator(throttles_to_register.end())); + // Insert all testing NavigationThrottles last. + throttles_.insert(throttles_.end(), + std::make_move_iterator(testing_throttles.begin()), + std::make_move_iterator(testing_throttles.end())); +} + +void NavigationHandleImpl::AddThrottle( + std::unique_ptr<NavigationThrottle> throttle) { + if (throttle) + throttles_.push_back(std::move(throttle)); } bool NavigationHandleImpl::IsSelfReferentialURL() {
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h index 05fd51b5..cb680ebe1 100644 --- a/content/browser/frame_host/navigation_handle_impl.h +++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -429,6 +429,9 @@ // Populates |throttles_| with the throttles for this navigation. void RegisterNavigationThrottles(); + // Takes ownership of |throttle| (if any) and appends it to |throttles_|. + void AddThrottle(std::unique_ptr<NavigationThrottle> throttle); + // Checks for attempts to navigate to a page that is already referenced more // than once in the frame's ancestors. This is a helper function used by // WillStartRequest and WillRedirectRequest to prevent the navigation.
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc index 83d5c86a..df454073 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -111,8 +111,8 @@ GetFrameSinkManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, frame_sink_id_); } - parent_frame_sink_id_ = cc::FrameSinkId(); - local_surface_id_ = cc::LocalSurfaceId(); + parent_frame_sink_id_ = viz::FrameSinkId(); + local_surface_id_ = viz::LocalSurfaceId(); // Unlocks the mouse if this RenderWidgetHostView holds the lock. UnlockMouse(); @@ -451,7 +451,7 @@ } void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); current_surface_scale_factor_ = frame.metadata.device_scale_factor; @@ -480,7 +480,7 @@ cc::SurfaceSequence sequence = cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); cc::SurfaceManager* manager = GetFrameSinkManager()->surface_manager(); - cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id_); // The renderer process will satisfy this dependency when it creates a // SurfaceLayer. manager->RequireSequence(surface_id, sequence); @@ -496,7 +496,7 @@ } void RenderWidgetHostViewChildFrame::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0("content", "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame"); @@ -567,7 +567,7 @@ return host_->delegate()->HasMouseLock(host_); } -cc::FrameSinkId RenderWidgetHostViewChildFrame::GetFrameSinkId() { +viz::FrameSinkId RenderWidgetHostViewChildFrame::GetFrameSinkId() { return frame_sink_id_; } @@ -617,20 +617,20 @@ return point; return frame_connector_->TransformPointToRootCoordSpace( - point, cc::SurfaceId(frame_sink_id_, local_surface_id_)); + point, viz::SurfaceId(frame_sink_id_, local_surface_id_)); } bool RenderWidgetHostViewChildFrame::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { *transformed_point = point; if (!frame_connector_ || !local_surface_id_.is_valid()) return false; return frame_connector_->TransformPointToLocalCoordSpace( - point, original_surface, cc::SurfaceId(frame_sink_id_, local_surface_id_), - transformed_point); + point, original_surface, + viz::SurfaceId(frame_sink_id_, local_surface_id_), transformed_point); } bool RenderWidgetHostViewChildFrame::TransformPointToCoordSpaceForView( @@ -646,7 +646,7 @@ } return frame_connector_->TransformPointToCoordSpaceForView( - point, target_view, cc::SurfaceId(frame_sink_id_, local_surface_id_), + point, target_view, viz::SurfaceId(frame_sink_id_, local_surface_id_), transformed_point); } @@ -821,8 +821,8 @@ return true; } -cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { - return cc::SurfaceId(frame_sink_id_, local_surface_id_); +viz::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { + return viz::SurfaceId(frame_sink_id_, local_surface_id_); }; void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() {
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h index 0d382b7..633b6c4 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.h +++ b/content/browser/frame_host/render_widget_host_view_child_frame.h
@@ -117,7 +117,7 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) override; void OnSurfaceChanged(const cc::SurfaceInfo& surface_info) override; @@ -129,7 +129,7 @@ InputEventAckState ack_result) override; bool LockMouse() override; void UnlockMouse() override; - cc::FrameSinkId GetFrameSinkId() override; + viz::FrameSinkId GetFrameSinkId() override; void ProcessKeyboardEvent(const NativeWebKeyboardEvent& event, const ui::LatencyInfo& latency) override; void ProcessMouseEvent(const blink::WebMouseEvent& event, @@ -142,7 +142,7 @@ const ui::LatencyInfo& latency) override; gfx::Point TransformPointToRootCoordSpace(const gfx::Point& point) override; bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) override; bool TransformPointToCoordSpaceForView( const gfx::Point& point, @@ -177,12 +177,12 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& id, + void WillDrawSurface(const viz::LocalSurfaceId& id, const gfx::Rect& damage_rect) override {} // Exposed for tests. bool IsChildFrameForTesting() const override; - cc::SurfaceId SurfaceIdForTesting() const override; + viz::SurfaceId SurfaceIdForTesting() const override; CrossProcessFrameConnector* FrameConnectorForTesting() const { return frame_connector_; } @@ -220,7 +220,7 @@ explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); void Init(); - void ProcessCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void ProcessCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame); void SendSurfaceInfoToEmbedder(); @@ -238,11 +238,11 @@ RenderWidgetHostImpl* host_; // The ID for FrameSink associated with this view. - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; // Surface-related state. std::unique_ptr<cc::CompositorFrameSinkSupport> support_; - cc::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; uint32_t next_surface_sequence_; gfx::Size current_surface_size_; float current_surface_scale_factor_; @@ -278,7 +278,7 @@ FrameSwappedCallbackList frame_swapped_callbacks_; // The surface client ID of the parent RenderWidgetHostView. 0 if none. - cc::FrameSinkId parent_frame_sink_id_; + viz::FrameSinkId parent_frame_sink_id_; bool has_frame_ = false; cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame_browsertest.cc b/content/browser/frame_host/render_widget_host_view_child_frame_browsertest.cc index b572962..aaab0f4 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame_browsertest.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame_browsertest.cc
@@ -3,8 +3,8 @@ // found in the LICENSE file. #include "base/macros.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_sequence.h" +#include "components/viz/common/surface_id.h" #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" @@ -147,7 +147,7 @@ return false; } - void OnRequire(const cc::SurfaceId& id, const cc::SurfaceSequence sequence) { + void OnRequire(const viz::SurfaceId& id, const cc::SurfaceSequence sequence) { content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind(&SurfaceRefMessageFilter::OnRequireOnUI, this));
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc index 3c53aef..ce5e699 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
@@ -38,7 +38,7 @@ namespace content { namespace { -const cc::LocalSurfaceId kArbitraryLocalSurfaceId( +const viz::LocalSurfaceId kArbitraryLocalSurfaceId( 1, base::UnguessableToken::Deserialize(2, 3)); @@ -133,11 +133,11 @@ #endif } - cc::SurfaceId GetSurfaceId() const { - return cc::SurfaceId(view_->frame_sink_id_, view_->local_surface_id_); + viz::SurfaceId GetSurfaceId() const { + return viz::SurfaceId(view_->frame_sink_id_, view_->local_surface_id_); } - cc::LocalSurfaceId GetLocalSurfaceId() const { + viz::LocalSurfaceId GetLocalSurfaceId() const { return view_->local_surface_id_; } @@ -192,7 +192,7 @@ gfx::Size view_size(100, 100); gfx::Rect view_rect(view_size); float scale_factor = 1.f; - cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); view_->SetSize(view_size); view_->Show(); @@ -201,7 +201,7 @@ local_surface_id, CreateDelegatedFrame(scale_factor, view_size, view_rect)); - cc::SurfaceId id = GetSurfaceId(); + viz::SurfaceId id = GetSurfaceId(); if (id.is_valid()) { #if !defined(OS_ANDROID) ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index 736645b..df4a82f1 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -289,7 +289,7 @@ } void RenderWidgetHostViewGuest::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0("content", "RenderWidgetHostViewGuest::OnSwapCompositorFrame");
diff --git a/content/browser/frame_host/render_widget_host_view_guest.h b/content/browser/frame_host/render_widget_host_view_guest.h index 1720632..8d59b040 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.h +++ b/content/browser/frame_host/render_widget_host_view_guest.h
@@ -94,7 +94,7 @@ const gfx::Range& range) override; void SelectionBoundsChanged( const ViewHostMsg_SelectionBounds_Params& params) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; #if defined(USE_AURA) void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
diff --git a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc index 4f21dc2..1e0baae 100644 --- a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
@@ -198,13 +198,13 @@ #endif } - cc::SurfaceId GetSurfaceId() const { + viz::SurfaceId GetSurfaceId() const { DCHECK(view_); RenderWidgetHostViewChildFrame* rwhvcf = static_cast<RenderWidgetHostViewChildFrame*>(view_); if (!rwhvcf->local_surface_id_.is_valid()) - return cc::SurfaceId(); - return cc::SurfaceId(rwhvcf->frame_sink_id_, rwhvcf->local_surface_id_); + return viz::SurfaceId(); + return viz::SurfaceId(rwhvcf->frame_sink_id_, rwhvcf->local_surface_id_); } protected: @@ -246,7 +246,7 @@ gfx::Size view_size(100, 100); gfx::Rect view_rect(view_size); float scale_factor = 1.f; - cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); ASSERT_TRUE(browser_plugin_guest_); @@ -258,7 +258,7 @@ local_surface_id, CreateDelegatedFrame(scale_factor, view_size, view_rect)); - cc::SurfaceId id = GetSurfaceId(); + viz::SurfaceId id = GetSurfaceId(); EXPECT_TRUE(id.is_valid());
diff --git a/content/browser/image_capture/image_capture_impl.cc b/content/browser/image_capture/image_capture_impl.cc index 3471fca..cf174a9d 100644 --- a/content/browser/image_capture/image_capture_impl.cc +++ b/content/browser/image_capture/image_capture_impl.cc
@@ -22,14 +22,6 @@ namespace { -void RunGetPhotoStateCallbackOnUIThread( - const ImageCaptureImpl::GetPhotoStateCallback& callback, - media::mojom::PhotoStatePtr capabilities) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(callback, base::Passed(&capabilities))); -} - void RunFailedGetPhotoStateCallback( ImageCaptureImpl::GetPhotoStateCallback cb) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -48,26 +40,11 @@ cb.Run(std::move(empty_capabilities)); } -void RunSetOptionsCallbackOnUIThread( - const ImageCaptureImpl::SetOptionsCallback& callback, - bool success) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(callback, success)); -} - void RunFailedSetOptionsCallback(ImageCaptureImpl::SetOptionsCallback cb) { DCHECK_CURRENTLY_ON(BrowserThread::UI); cb.Run(false); } -void RunTakePhotoCallbackOnUIThread( - const ImageCaptureImpl::TakePhotoCallback& callback, - media::mojom::BlobPtr blob) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(callback, base::Passed(std::move(blob)))); -} - void RunFailedTakePhotoCallback(ImageCaptureImpl::TakePhotoCallback cb) { DCHECK_CURRENTLY_ON(BrowserThread::UI); cb.Run(media::mojom::Blob::New()); @@ -147,7 +124,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); media::ScopedResultCallback<GetPhotoStateCallback> scoped_callback( - base::Bind(&RunGetPhotoStateCallbackOnUIThread, callback), + media::BindToCurrentLoop(callback), media::BindToCurrentLoop(base::Bind(&RunFailedGetPhotoStateCallback))); BrowserThread::PostTask( @@ -163,7 +140,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); media::ScopedResultCallback<SetOptionsCallback> scoped_callback( - base::Bind(&RunSetOptionsCallbackOnUIThread, callback), + media::BindToCurrentLoop(callback), media::BindToCurrentLoop(base::Bind(&RunFailedSetOptionsCallback))); BrowserThread::PostTask( @@ -178,7 +155,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); media::ScopedResultCallback<TakePhotoCallback> scoped_callback( - base::Bind(&RunTakePhotoCallbackOnUIThread, callback), + media::BindToCurrentLoop(callback), media::BindToCurrentLoop(base::Bind(&RunFailedTakePhotoCallback))); BrowserThread::PostTask(
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc index 6c09172..85df1d00 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -35,26 +35,53 @@ return !origin.unique(); } -void DoCallStatusCallback( +::indexed_db::mojom::Status GetIndexedDBStatus(leveldb::Status status) { + if (status.ok()) + return ::indexed_db::mojom::Status::OK; + else if (status.IsNotFound()) + return ::indexed_db::mojom::Status::NotFound; + else if (status.IsCorruption()) + return ::indexed_db::mojom::Status::Corruption; + else if (status.IsNotSupportedError()) + return ::indexed_db::mojom::Status::NotSupported; + else if (status.IsInvalidArgument()) + return ::indexed_db::mojom::Status::InvalidArgument; + else + return ::indexed_db::mojom::Status::IOError; +} + +void DoCallCompactionStatusCallback( IndexedDBDispatcherHost::AbortTransactionsAndCompactDatabaseCallback callback, leveldb::Status status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - - if (status.ok()) - std::move(callback).Run(::indexed_db::mojom::CompactionStatus::OK); - else - std::move(callback).Run(::indexed_db::mojom::CompactionStatus::Error); + std::move(callback).Run(GetIndexedDBStatus(status)); } -void CallStatusCallbackOnIOThread( +void CallCompactionStatusCallbackOnIOThread( scoped_refptr<base::SequencedTaskRunner> io_runner, IndexedDBDispatcherHost::AbortTransactionsAndCompactDatabaseCallback mojo_callback, leveldb::Status status) { - io_runner->PostTask( - FROM_HERE, - base::BindOnce(&DoCallStatusCallback, std::move(mojo_callback), status)); + io_runner->PostTask(FROM_HERE, + base::BindOnce(&DoCallCompactionStatusCallback, + std::move(mojo_callback), status)); +} + +void DoCallAbortStatusCallback( + IndexedDBDispatcherHost::AbortTransactionsForDatabaseCallback callback, + leveldb::Status status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + std::move(callback).Run(GetIndexedDBStatus(status)); +} + +void CallAbortStatusCallbackOnIOThread( + scoped_refptr<base::SequencedTaskRunner> io_runner, + IndexedDBDispatcherHost::AbortTransactionsForDatabaseCallback mojo_callback, + leveldb::Status status) { + io_runner->PostTask(FROM_HERE, + base::BindOnce(&DoCallAbortStatusCallback, + std::move(mojo_callback), status)); } } // namespace @@ -86,6 +113,9 @@ void AbortTransactionsAndCompactDatabaseOnIDBThread( base::OnceCallback<void(leveldb::Status)> callback, const url::Origin& origin); + void AbortTransactionsForDatabaseOnIDBThread( + base::OnceCallback<void(leveldb::Status)> callback, + const url::Origin& origin); private: const int ipc_process_id_; @@ -267,8 +297,8 @@ } base::OnceCallback<void(leveldb::Status)> callback_on_io = base::BindOnce( - &CallStatusCallbackOnIOThread, base::ThreadTaskRunnerHandle::Get(), - std::move(mojo_callback)); + &CallCompactionStatusCallbackOnIOThread, + base::ThreadTaskRunnerHandle::Get(), std::move(mojo_callback)); idb_runner_->PostTask( FROM_HERE, base::BindOnce( @@ -277,6 +307,27 @@ origin)); } +void IndexedDBDispatcherHost::AbortTransactionsForDatabase( + const url::Origin& origin, + AbortTransactionsForDatabaseCallback mojo_callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + if (!IsValidOrigin(origin)) { + mojo::ReportBadMessage(kInvalidOrigin); + return; + } + + base::OnceCallback<void(leveldb::Status)> callback_on_io = base::BindOnce( + &CallAbortStatusCallbackOnIOThread, base::ThreadTaskRunnerHandle::Get(), + std::move(mojo_callback)); + idb_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &IDBSequenceHelper::AbortTransactionsForDatabaseOnIDBThread, + base::Unretained(idb_helper_), base::Passed(&callback_on_io), + origin)); +} + void IndexedDBDispatcherHost::InvalidateWeakPtrsAndClearBindings() { weak_factory_.InvalidateWeakPtrs(); cursor_bindings_.CloseAllBindings(); @@ -342,4 +393,14 @@ std::move(callback), origin); } +void IndexedDBDispatcherHost::IDBSequenceHelper:: + AbortTransactionsForDatabaseOnIDBThread( + base::OnceCallback<void(leveldb::Status)> callback, + const url::Origin& origin) { + DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); + + indexed_db_context_->GetIDBFactory()->AbortTransactionsForDatabase( + std::move(callback), origin); +} + } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.h b/content/browser/indexed_db/indexed_db_dispatcher_host.h index 67f24ab4..582fe63 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host.h +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.h
@@ -109,6 +109,9 @@ void AbortTransactionsAndCompactDatabase( const url::Origin& origin, AbortTransactionsAndCompactDatabaseCallback callback) override; + void AbortTransactionsForDatabase( + const url::Origin& origin, + AbortTransactionsForDatabaseCallback callback) override; void InvalidateWeakPtrsAndClearBindings();
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc index b2d98b3..736e8dc 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc +++ b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc
@@ -125,9 +125,9 @@ DISALLOW_COPY_AND_ASSIGN(TestDatabaseConnection); }; -void CompactionStatusCallback(const base::Closure& callback, - ::indexed_db::mojom::CompactionStatus* status_out, - ::indexed_db::mojom::CompactionStatus status) { +void StatusCallback(const base::Closure& callback, + ::indexed_db::mojom::Status* status_out, + ::indexed_db::mojom::Status status) { *status_out = status; callback.Run(); } @@ -481,8 +481,8 @@ connection.database.Bind(std::move(database_info)); - ::indexed_db::mojom::CompactionStatus callback_result = - ::indexed_db::mojom::CompactionStatus::Error; + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; { ::testing::InSequence dummy; base::RunLoop loop; @@ -500,12 +500,12 @@ connection.database->Commit(kTransactionId); idb_mojo_factory_->AbortTransactionsAndCompactDatabase( - origin, base::BindOnce(&CompactionStatusCallback, - std::move(quit_closure), &callback_result)); + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); loop.Run(); } - EXPECT_EQ(::indexed_db::mojom::CompactionStatus::OK, callback_result); + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); } TEST_F(IndexedDBDispatcherHostTest, CompactDatabaseWhileDoingTransaction) { @@ -542,8 +542,8 @@ connection.database.Bind(std::move(database_info)); - ::indexed_db::mojom::CompactionStatus callback_result = - ::indexed_db::mojom::CompactionStatus::Error; + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; { ::testing::InSequence dummy; base::RunLoop loop; @@ -565,12 +565,12 @@ base::UTF8ToUTF16(kObjectStoreName), content::IndexedDBKeyPath(), false); idb_mojo_factory_->AbortTransactionsAndCompactDatabase( - origin, base::BindOnce(&CompactionStatusCallback, - std::move(quit_closure), &callback_result)); + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); loop.Run(); } - EXPECT_EQ(::indexed_db::mojom::CompactionStatus::OK, callback_result); + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); } TEST_F(IndexedDBDispatcherHostTest, CompactDatabaseWhileUpgrading) { @@ -605,8 +605,8 @@ connection.database.Bind(std::move(database_info)); - ::indexed_db::mojom::CompactionStatus callback_result = - ::indexed_db::mojom::CompactionStatus::Error; + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; { ::testing::InSequence dummy; base::RunLoop loop; @@ -625,12 +625,197 @@ ASSERT_TRUE(connection.database.is_bound()); idb_mojo_factory_->AbortTransactionsAndCompactDatabase( - origin, base::BindOnce(&CompactionStatusCallback, - std::move(quit_closure), &callback_result)); + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); loop.Run(); } - EXPECT_EQ(::indexed_db::mojom::CompactionStatus::OK, callback_result); + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); +} + +TEST_F(IndexedDBDispatcherHostTest, + AbortTransactionsAfterCompletingTransaction) { + const int64_t kDBVersion = 1; + const int64_t kTransactionId = 1; + + // Open connection. + TestDatabaseConnection connection(url::Origin(GURL(kOrigin)), + base::UTF8ToUTF16(kDatabaseName), + kDBVersion, kTransactionId); + IndexedDBDatabaseMetadata metadata; + DatabaseAssociatedPtrInfo database_info; + { + base::RunLoop loop; + EXPECT_CALL( + *connection.open_callbacks, + MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), + IndexedDBDatabaseMetadata::NO_VERSION, + blink::kWebIDBDataLossNone, std::string(), _)) + .WillOnce(testing::DoAll(MoveArg<0>(&database_info), + testing::SaveArg<4>(&metadata), + RunClosure(loop.QuitClosure()))); + + // Queue open request message. + connection.Open(idb_mojo_factory_.get()); + loop.Run(); + } + + EXPECT_TRUE(database_info.is_valid()); + EXPECT_EQ(connection.version, metadata.version); + EXPECT_EQ(connection.db_name, metadata.name); + + connection.database.Bind(std::move(database_info)); + + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; + { + ::testing::InSequence dummy; + base::RunLoop loop; + base::Closure quit_closure = base::BarrierClosure(3, loop.QuitClosure()); + const url::Origin origin = url::Origin(GURL(kOrigin)); + + EXPECT_CALL(*connection.connection_callbacks, Complete(kTransactionId)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + EXPECT_CALL( + *connection.open_callbacks, + MockedSuccessDatabase(IsAssociatedInterfacePtrInfoValid(false), _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + + connection.database->Commit(kTransactionId); + idb_mojo_factory_->AbortTransactionsForDatabase( + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); + + loop.Run(); + } + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); +} + +TEST_F(IndexedDBDispatcherHostTest, AbortTransactionsWhileDoingTransaction) { + const int64_t kDBVersion = 1; + const int64_t kTransactionId = 1; + const int64_t kObjectStoreId = 10; + const char kObjectStoreName[] = "os"; + + // Open connection. + TestDatabaseConnection connection(url::Origin(GURL(kOrigin)), + base::UTF8ToUTF16(kDatabaseName), + kDBVersion, kTransactionId); + IndexedDBDatabaseMetadata metadata; + DatabaseAssociatedPtrInfo database_info; + { + base::RunLoop loop; + EXPECT_CALL( + *connection.open_callbacks, + MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), + IndexedDBDatabaseMetadata::NO_VERSION, + blink::kWebIDBDataLossNone, std::string(), _)) + .WillOnce(testing::DoAll(MoveArg<0>(&database_info), + testing::SaveArg<4>(&metadata), + RunClosure(loop.QuitClosure()))); + + // Queue open request message. + connection.Open(idb_mojo_factory_.get()); + loop.Run(); + } + + EXPECT_TRUE(database_info.is_valid()); + EXPECT_EQ(connection.version, metadata.version); + EXPECT_EQ(connection.db_name, metadata.name); + + connection.database.Bind(std::move(database_info)); + + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; + { + ::testing::InSequence dummy; + base::RunLoop loop; + base::Closure quit_closure = base::BarrierClosure(3, loop.QuitClosure()); + const url::Origin origin = url::Origin(GURL(kOrigin)); + + EXPECT_CALL( + *connection.connection_callbacks, + Abort(kTransactionId, blink::kWebIDBDatabaseExceptionUnknownError, _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + EXPECT_CALL(*connection.open_callbacks, + Error(blink::kWebIDBDatabaseExceptionAbortError, _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + + ASSERT_TRUE(connection.database.is_bound()); + connection.database->CreateObjectStore(kTransactionId, kObjectStoreId, + base::UTF8ToUTF16(kObjectStoreName), + content::IndexedDBKeyPath(), false); + idb_mojo_factory_->AbortTransactionsForDatabase( + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); + + loop.Run(); + } + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); +} + +TEST_F(IndexedDBDispatcherHostTest, AbortTransactionsWhileUpgrading) { + const int64_t kDBVersion = 1; + const int64_t kTransactionId = 1; + + // Open connection. + TestDatabaseConnection connection(url::Origin(GURL(kOrigin)), + base::UTF8ToUTF16(kDatabaseName), + kDBVersion, kTransactionId); + IndexedDBDatabaseMetadata metadata; + DatabaseAssociatedPtrInfo database_info; + { + base::RunLoop loop; + EXPECT_CALL( + *connection.open_callbacks, + MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), + IndexedDBDatabaseMetadata::NO_VERSION, + blink::kWebIDBDataLossNone, std::string(), _)) + .WillOnce(testing::DoAll(MoveArg<0>(&database_info), + testing::SaveArg<4>(&metadata), + RunClosure(loop.QuitClosure()))); + + // Queue open request message. + connection.Open(idb_mojo_factory_.get()); + loop.Run(); + } + + EXPECT_TRUE(database_info.is_valid()); + EXPECT_EQ(connection.version, metadata.version); + EXPECT_EQ(connection.db_name, metadata.name); + + connection.database.Bind(std::move(database_info)); + + ::indexed_db::mojom::Status callback_result = + ::indexed_db::mojom::Status::IOError; + { + ::testing::InSequence dummy; + base::RunLoop loop; + base::Closure quit_closure = base::BarrierClosure(3, loop.QuitClosure()); + const url::Origin origin = url::Origin(GURL(kOrigin)); + + EXPECT_CALL( + *connection.connection_callbacks, + Abort(kTransactionId, blink::kWebIDBDatabaseExceptionUnknownError, _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + EXPECT_CALL(*connection.open_callbacks, + Error(blink::kWebIDBDatabaseExceptionAbortError, _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + + ASSERT_TRUE(connection.database.is_bound()); + idb_mojo_factory_->AbortTransactionsForDatabase( + origin, base::BindOnce(&StatusCallback, std::move(quit_closure), + &callback_result)); + + loop.Run(); + } + EXPECT_EQ(::indexed_db::mojom::Status::OK, callback_result); } } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_factory.h b/content/browser/indexed_db/indexed_db_factory.h index 00c6a72..388b0cc6 100644 --- a/content/browser/indexed_db/indexed_db_factory.h +++ b/content/browser/indexed_db/indexed_db_factory.h
@@ -67,6 +67,9 @@ virtual void AbortTransactionsAndCompactDatabase( base::OnceCallback<void(leveldb::Status)> callback, const url::Origin& origin) = 0; + virtual void AbortTransactionsForDatabase( + base::OnceCallback<void(leveldb::Status)> callback, + const url::Origin& origin) = 0; virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0; virtual void HandleBackingStoreCorruption(
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.cc b/content/browser/indexed_db/indexed_db_factory_impl.cc index c06e8dc9..35d68e9 100644 --- a/content/browser/indexed_db/indexed_db_factory_impl.cc +++ b/content/browser/indexed_db/indexed_db_factory_impl.cc
@@ -124,6 +124,33 @@ return ptr->HasOneRef(); } +leveldb::Status IndexedDBFactoryImpl::AbortTransactions(const Origin& origin) { + const scoped_refptr<IndexedDBBackingStore>& backing_store = + backing_store_map_[origin]; + if (!backing_store) { + return leveldb::Status::IOError( + "Internal error opening backing store for " + "indexedDB.abortTransactions."); + } + + leveldb::Status get_names_status; + std::vector<base::string16> db_names = + backing_store->GetDatabaseNames(&get_names_status); + if (!get_names_status.ok()) { + return leveldb::Status::IOError( + "Internal error getting origin database names for " + "indexedDB.abortTransactions."); + } + + for (base::string16& name : db_names) { + const scoped_refptr<IndexedDBDatabase>& db = + database_map_[std::make_pair(origin, name)]; + db->AbortAllTransactionsForConnections(); + } + + return leveldb::Status::OK(); +} + void IndexedDBFactoryImpl::ForceClose(const Origin& origin) { OriginDBs range = GetOpenDatabasesForOrigin(origin); @@ -299,7 +326,7 @@ void IndexedDBFactoryImpl::AbortTransactionsAndCompactDatabase( base::OnceCallback<void(leveldb::Status)> callback, - const url::Origin& origin) { + const Origin& origin) { IDB_TRACE("IndexedDBFactoryImpl::AbortTransactionsAndCompactDatabase"); const scoped_refptr<IndexedDBBackingStore>& backing_store = backing_store_map_[origin]; @@ -309,24 +336,22 @@ "indexedDB.abortTransactionsAndCompactDatabase.")); return; } + leveldb::Status status = AbortTransactions(origin); + backing_store->Compact(); + std::move(callback).Run(status); +} - leveldb::Status get_names_status; - std::vector<base::string16> db_names = - backing_store->GetDatabaseNames(&get_names_status); - if (!get_names_status.ok()) { - std::move(callback).Run(leveldb::Status::IOError( - "Internal error getting origin database names for " - "indexedDB.abortTransactionsAndCompactDatabase.")); +void IndexedDBFactoryImpl::AbortTransactionsForDatabase( + base::OnceCallback<void(leveldb::Status)> callback, + const Origin& origin) { + IDB_TRACE("IndexedDBFactoryImpl::AbortTransactionsForDatabase"); + if (!backing_store_map_[origin]) { + std::move(callback).Run( + leveldb::Status::IOError("Internal error opening backing store for " + "indexedDB.abortTransactionsForDatabase.")); return; } - for (base::string16& name : db_names) { - const scoped_refptr<IndexedDBDatabase>& db = - database_map_[std::make_pair(origin, name)]; - db->AbortAllTransactionsForConnections(); - } - - backing_store->Compact(); - std::move(callback).Run(leveldb::Status::OK()); + std::move(callback).Run(AbortTransactions(origin)); } void IndexedDBFactoryImpl::HandleBackingStoreFailure(const Origin& origin) {
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.h b/content/browser/indexed_db/indexed_db_factory_impl.h index ecb2a54..6182e43 100644 --- a/content/browser/indexed_db/indexed_db_factory_impl.h +++ b/content/browser/indexed_db/indexed_db_factory_impl.h
@@ -54,6 +54,9 @@ void AbortTransactionsAndCompactDatabase( base::OnceCallback<void(leveldb::Status)> callback, const url::Origin& origin) override; + void AbortTransactionsForDatabase( + base::OnceCallback<void(leveldb::Status)> callback, + const url::Origin& origin) override; void HandleBackingStoreFailure(const url::Origin& origin) override; void HandleBackingStoreCorruption( @@ -116,6 +119,8 @@ FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure); + leveldb::Status AbortTransactions(const url::Origin& origin); + // Called internally after a database is closed, with some delay. If this // factory has the last reference, it will be released. void MaybeCloseBackingStore(const url::Origin& origin);
diff --git a/content/browser/indexed_db/mock_indexed_db_factory.h b/content/browser/indexed_db/mock_indexed_db_factory.h index 54ec4fd..e0c7670 100644 --- a/content/browser/indexed_db/mock_indexed_db_factory.h +++ b/content/browser/indexed_db/mock_indexed_db_factory.h
@@ -62,6 +62,15 @@ base::OnceCallback<void(leveldb::Status)>* callback_ref = &callback; AbortTransactionsAndCompactDatabaseProxy(callback_ref, origin); } + MOCK_METHOD2(AbortTransactionsForDatabaseProxy, + void(base::OnceCallback<void(leveldb::Status)>* callback, + const url::Origin& origin)); + virtual void AbortTransactionsForDatabase( + base::OnceCallback<void(leveldb::Status)> callback, + const url::Origin& origin) { + base::OnceCallback<void(leveldb::Status)>* callback_ref = &callback; + AbortTransactionsForDatabaseProxy(callback_ref, origin); + } MOCK_METHOD1(HandleBackingStoreFailure, void(const url::Origin& origin)); MOCK_METHOD2(HandleBackingStoreCorruption,
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc index ef1a471..45a04b9 100644 --- a/content/browser/media/capture/aura_window_capture_machine.cc +++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -325,7 +325,7 @@ return false; } - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture());
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc index 4411641..0d458df8 100644 --- a/content/browser/presentation/presentation_service_impl.cc +++ b/content/browser/presentation/presentation_service_impl.cc
@@ -298,7 +298,7 @@ void PresentationServiceImpl::SetDefaultPresentationUrls( const std::vector<GURL>& presentation_urls) { DVLOG(2) << "SetDefaultPresentationUrls"; - if (!controller_delegate_) + if (!controller_delegate_ || !is_main_frame_) return; if (default_presentation_urls_ == presentation_urls)
diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h index 4c6393d..231b3ee3 100644 --- a/content/browser/presentation/presentation_service_impl.h +++ b/content/browser/presentation/presentation_service_impl.h
@@ -94,6 +94,8 @@ OtherRenderFrameDeleted); FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DelegateFails); FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, + SetDefaultPresentationUrlsNoopsOnNonMainFrame); + FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ListenForConnectionStateChange); FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ListenForConnectionClose);
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc index beb33bb4..536817a4 100644 --- a/content/browser/presentation/presentation_service_impl_unittest.cc +++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -459,6 +459,23 @@ base::RunLoop().RunUntilIdle(); } +TEST_F(PresentationServiceImplTest, + SetDefaultPresentationUrlsNoopsOnNonMainFrame) { + RenderFrameHost* rfh = main_rfh(); + RenderFrameHostTester* rfh_tester = RenderFrameHostTester::For(rfh); + rfh = rfh_tester->AppendChild("subframe"); + + EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1); + EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1); + service_impl_.reset( + new PresentationServiceImpl(rfh, contents(), &mock_delegate_, nullptr)); + + EXPECT_CALL(mock_delegate_, + SetDefaultPresentationUrls(_, _, presentation_urls_, _)) + .Times(0); + service_impl_->SetDefaultPresentationUrls(presentation_urls_); +} + TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) { PresentationInfo connection(presentation_url1_, kPresentationId); PresentationConnectionStateChangedCallback state_changed_cb;
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h index 37bd5b9..da3c2c7 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.h +++ b/content/browser/renderer_host/browser_compositor_view_mac.h
@@ -45,7 +45,7 @@ BrowserCompositorMacClient* client, bool render_widget_host_is_hidden, bool ns_view_attached_to_window, - const cc::FrameSinkId& frame_sink_id); + const viz::FrameSinkId& frame_sink_id); ~BrowserCompositorMac() override; // These will not return nullptr until Destroy is called. @@ -57,7 +57,7 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame); void OnDidNotProduceFrame(const cc::BeginFrameAck& ack); void SetHasTransparentBackground(bool transparent);
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm index 90851fe7..278c7021 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -173,7 +173,7 @@ BrowserCompositorMacClient* client, bool render_widget_host_is_hidden, bool ns_view_attached_to_window, - const cc::FrameSinkId& frame_sink_id) + const viz::FrameSinkId& frame_sink_id) : client_(client), accelerated_widget_mac_ns_view_(accelerated_widget_mac_ns_view), weak_factory_(this) { @@ -279,7 +279,7 @@ } void BrowserCompositorMac::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { // Compute the frame size based on the root render pass rect size. cc::RenderPass* root_pass = frame.render_pass_list.back().get();
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index afbf62a..5a8eb8ed 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -43,9 +43,9 @@ #include "cc/surfaces/direct_layer_tree_frame_sink.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" -#include "cc/surfaces/frame_sink_id_allocator.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_settings.h" +#include "components/viz/common/frame_sink_id_allocator.h" #include "components/viz/common/gl_helper.h" #include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/service/display_embedder/compositor_overlay_candidate_validator_android.h" @@ -110,7 +110,7 @@ SingleThreadTaskGraphRunner task_graph_runner; viz::HostFrameSinkManager host_frame_sink_manager; - cc::FrameSinkIdAllocator frame_sink_id_allocator; + viz::FrameSinkIdAllocator frame_sink_id_allocator; // This is owned here so that SurfaceManager will be accessible in process // when display is in the same process. Other than using SurfaceManager, // access to |in_process_frame_sink_manager_| should happen via @@ -169,6 +169,7 @@ } gpu::gles2::ContextCreationAttribHelper GetCompositorContextAttributes( + const gfx::ColorSpace& display_color_space, bool has_transparent_background) { // This is used for the browser compositor (offscreen) and for the display // compositor (onscreen), so ask for capabilities needed by either one. @@ -184,6 +185,18 @@ attributes.sample_buffers = 0; attributes.bind_generates_resource = false; + if (base::FeatureList::IsEnabled(features::kColorCorrectRendering)) { + if (display_color_space == gfx::ColorSpace::CreateSRGB()) { + attributes.color_space = gpu::gles2::COLOR_SPACE_SRGB; + } else if (display_color_space == gfx::ColorSpace::CreateDisplayP3D65()) { + attributes.color_space = gpu::gles2::COLOR_SPACE_DISPLAY_P3; + } else { + attributes.color_space = gpu::gles2::COLOR_SPACE_UNSPECIFIED; + DLOG(ERROR) << "Android color space is neither sRGB nor P3, output color " + "will be incorrect."; + } + } + if (has_transparent_background) { attributes.alpha_size = 8; } else if (base::SysInfo::AmountOfPhysicalMemoryMB() <= 512) { @@ -429,7 +442,7 @@ } // static -cc::FrameSinkId CompositorImpl::AllocateFrameSinkId() { +viz::FrameSinkId CompositorImpl::AllocateFrameSinkId() { return g_compositor_dependencies.Get() .frame_sink_id_allocator.NextFrameSinkId(); } @@ -750,6 +763,11 @@ constexpr bool support_locking = false; constexpr bool automatic_flushes = false; + // TODO(ccameron): Update the display color space based on isWideColorGamut. + // https://crbug.com/735658 + display_color_space_ = display::Screen::GetScreen() + ->GetDisplayNearestWindow(root_window_) + .color_space(); ui::ContextProviderCommandBuffer* shared_context = nullptr; scoped_refptr<ui::ContextProviderCommandBuffer> context_provider = @@ -760,7 +778,8 @@ std::string("CompositorContextProvider")), automatic_flushes, support_locking, GetCompositorContextSharedMemoryLimits(root_window_), - GetCompositorContextAttributes(has_transparent_background_), + GetCompositorContextAttributes(display_color_space_, + has_transparent_background_), shared_context, ui::command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); if (!context_provider->BindToCurrentThread()) { @@ -827,11 +846,7 @@ display_->SetVisible(true); display_->Resize(size_); - const gfx::ColorSpace& display_color_space = - display::Screen::GetScreen() - ->GetDisplayNearestWindow(root_window_) - .color_space(); - display_->SetColorSpace(display_color_space, display_color_space); + display_->SetColorSpace(display_color_space_, display_color_space_); GetFrameSinkManager()->RegisterBeginFrameSource( root_window_->GetBeginFrameSource(), frame_sink_id_); host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); @@ -896,11 +911,11 @@ host_->SetNeedsAnimate(); } -cc::FrameSinkId CompositorImpl::GetFrameSinkId() { +viz::FrameSinkId CompositorImpl::GetFrameSinkId() { return frame_sink_id_; } -void CompositorImpl::AddChildFrameSink(const cc::FrameSinkId& frame_sink_id) { +void CompositorImpl::AddChildFrameSink(const viz::FrameSinkId& frame_sink_id) { if (has_layer_tree_frame_sink_) { GetFrameSinkManager()->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); @@ -910,7 +925,7 @@ } void CompositorImpl::RemoveChildFrameSink( - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { auto it = pending_child_frame_sink_ids_.find(frame_sink_id); if (it != pending_child_frame_sink_ids_.end()) { pending_child_frame_sink_ids_.erase(it);
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index 3279a62..5f01a53 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -15,9 +15,9 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/timer/timer.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" +#include "components/viz/common/frame_sink_id.h" #include "content/common/content_export.h" #include "content/public/browser/android/compositor.h" #include "gpu/command_buffer/common/capabilities.h" @@ -66,7 +66,7 @@ static cc::FrameSinkManager* GetFrameSinkManager(); static viz::HostFrameSinkManager* GetHostFrameSinkManager(); - static cc::FrameSinkId AllocateFrameSinkId(); + static viz::FrameSinkId AllocateFrameSinkId(); // ui::ResourceProvider implementation. cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; @@ -116,9 +116,9 @@ void RequestCopyOfOutputOnRootLayer( std::unique_ptr<cc::CopyOutputRequest> request) override; void SetNeedsAnimate() override; - cc::FrameSinkId GetFrameSinkId() override; - void AddChildFrameSink(const cc::FrameSinkId& frame_sink_id) override; - void RemoveChildFrameSink(const cc::FrameSinkId& frame_sink_id) override; + viz::FrameSinkId GetFrameSinkId() override; + void AddChildFrameSink(const viz::FrameSinkId& frame_sink_id) override; + void RemoveChildFrameSink(const viz::FrameSinkId& frame_sink_id) override; void SetVisible(bool visible); void CreateLayerTreeHost(); @@ -140,7 +140,7 @@ bool HavePendingReadbacks(); void SetBackgroundColor(int color); - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; // root_layer_ is the persistent internal root layer, while subroot_layer_ // is the one attached by the compositor client. @@ -156,6 +156,7 @@ std::unique_ptr<cc::Display> display_; + gfx::ColorSpace display_color_space_; gfx::Size size_; bool has_transparent_background_; @@ -185,7 +186,7 @@ gpu::Capabilities gpu_capabilities_; bool has_layer_tree_frame_sink_ = false; - std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> + std::unordered_set<viz::FrameSinkId, viz::FrameSinkIdHash> pending_child_frame_sink_ids_; base::WeakPtrFactory<CompositorImpl> weak_factory_;
diff --git a/content/browser/renderer_host/delegated_frame_host.cc b/content/browser/renderer_host/delegated_frame_host.cc index 95e7c87..ce7e0dda 100644 --- a/content/browser/renderer_host/delegated_frame_host.cc +++ b/content/browser/renderer_host/delegated_frame_host.cc
@@ -17,12 +17,12 @@ #include "cc/output/compositor_frame.h" #include "cc/output/copy_output_request.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/frame_sink_manager.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_hittest.h" #include "components/viz/common/gl_helper.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "content/browser/compositor/surface_utils.h" #include "content/browser/gpu/compositor_util.h" #include "content/browser/renderer_host/compositor_resize_lock.h" @@ -41,7 +41,7 @@ //////////////////////////////////////////////////////////////////////////////// // DelegatedFrameHost -DelegatedFrameHost::DelegatedFrameHost(const cc::FrameSinkId& frame_sink_id, +DelegatedFrameHost::DelegatedFrameHost(const viz::FrameSinkId& frame_sink_id, DelegatedFrameHostClient* client) : frame_sink_id_(frame_sink_id), client_(client), @@ -166,21 +166,21 @@ frame_subscriber_.reset(); } -cc::FrameSinkId DelegatedFrameHost::GetFrameSinkId() { +viz::FrameSinkId DelegatedFrameHost::GetFrameSinkId() { return frame_sink_id_; } -cc::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint( +viz::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point) { - cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id_); if (!surface_id.is_valid()) return surface_id; cc::SurfaceHittest hittest(delegate, GetFrameSinkManager()->surface_manager()); gfx::Transform target_transform; - cc::SurfaceId target_local_surface_id = + viz::SurfaceId target_local_surface_id = hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform); *transformed_point = point; if (target_local_surface_id.is_valid()) @@ -190,9 +190,9 @@ bool DelegatedFrameHost::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { - cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id_); if (!surface_id.is_valid()) return false; *transformed_point = point; @@ -212,7 +212,7 @@ return false; return target_view->TransformPointToLocalCoordSpace( - point, cc::SurfaceId(frame_sink_id_, local_surface_id_), + point, viz::SurfaceId(frame_sink_id_, local_surface_id_), transformed_point); } @@ -368,7 +368,7 @@ // as a source. request->set_source(frame_subscriber()->GetSourceIdForCopyRequest()); if (subscriber_texture.get()) { - request->SetTextureMailbox(cc::TextureMailbox( + request->SetTextureMailbox(viz::TextureMailbox( subscriber_texture->mailbox(), subscriber_texture->sync_token(), subscriber_texture->target())); } @@ -391,7 +391,7 @@ } void DelegatedFrameHost::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { #if defined(OS_CHROMEOS) DCHECK(!resize_lock_ || !client_->IsAutoResizeEnabled()); @@ -464,7 +464,7 @@ if (local_surface_id != local_surface_id_ || !has_frame_) { // manager must outlive compositors using it. - cc::SurfaceId surface_id(frame_sink_id_, local_surface_id); + viz::SurfaceId surface_id(frame_sink_id_, local_surface_id); cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, frame_size); client_->DelegatedFrameHostGetLayer()->SetShowPrimarySurface( @@ -511,7 +511,7 @@ renderer_compositor_frame_sink_->ReclaimResources(resources); } -void DelegatedFrameHost::WillDrawSurface(const cc::LocalSurfaceId& id, +void DelegatedFrameHost::WillDrawSurface(const viz::LocalSurfaceId& id, const gfx::Rect& damage_rect) { if (id != local_surface_id_) return; @@ -641,7 +641,7 @@ if (subscriber_texture.get() && !subscriber_texture->texture_id()) return; - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture());
diff --git a/content/browser/renderer_host/delegated_frame_host.h b/content/browser/renderer_host/delegated_frame_host.h index 1a3e82e..c819b09 100644 --- a/content/browser/renderer_host/delegated_frame_host.h +++ b/content/browser/renderer_host/delegated_frame_host.h
@@ -86,7 +86,7 @@ public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient), public base::SupportsWeakPtr<DelegatedFrameHost> { public: - DelegatedFrameHost(const cc::FrameSinkId& frame_sink_id, + DelegatedFrameHost(const viz::FrameSinkId& frame_sink_id, DelegatedFrameHostClient* client); ~DelegatedFrameHost() override; @@ -114,14 +114,14 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& id, + void WillDrawSurface(const viz::LocalSurfaceId& id, const gfx::Rect& damage_rect) override; // Public interface exposed to RenderWidgetHostView. void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame); void ClearDelegatedFrame(); void WasHidden(); @@ -147,19 +147,19 @@ std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber); void EndFrameSubscription(); bool HasFrameSubscriber() const { return !!frame_subscriber_; } - cc::FrameSinkId GetFrameSinkId(); + viz::FrameSinkId GetFrameSinkId(); // Returns a null SurfaceId if this DelegatedFrameHost has not yet created // a compositor Surface. - cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceHittestDelegate* delegate, - const gfx::Point& point, - gfx::Point* transformed_point); + viz::SurfaceId SurfaceIdAtPoint(cc::SurfaceHittestDelegate* delegate, + const gfx::Point& point, + gfx::Point* transformed_point); // Given the SurfaceID of a Surface that is contained within this class' // Surface, find the relative transform between the Surfaces and apply it // to a point. Returns false if a Surface has not yet been created or if // |original_surface| is not embedded within our current Surface. bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point); // Given a RenderWidgetHostViewBase that renders to a Surface that is @@ -175,8 +175,8 @@ void DidNotProduceFrame(const cc::BeginFrameAck& ack); // Exposed for tests. - cc::SurfaceId SurfaceIdForTesting() const { - return cc::SurfaceId(frame_sink_id_, local_surface_id_); + viz::SurfaceId SurfaceIdForTesting() const { + return viz::SurfaceId(frame_sink_id_, local_surface_id_); } bool HasFrameForTesting() const { return has_frame_; } @@ -252,8 +252,8 @@ void DidFinishFrame(const cc::BeginFrameAck& ack); - const cc::FrameSinkId frame_sink_id_; - cc::LocalSurfaceId local_surface_id_; + const viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId local_surface_id_; DelegatedFrameHostClient* const client_; ui::Compositor* compositor_;
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_mac.mm b/content/browser/renderer_host/input/synthetic_gesture_target_mac.mm index e162dd0..e9513715 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_mac.mm +++ b/content/browser/renderer_host/input/synthetic_gesture_target_mac.mm
@@ -91,7 +91,7 @@ eventWithMagnification:0.0f locationInWindow:NSMakePoint(gesture_event->x, gesture_event->y)]; - [cocoa_view_ beginGestureWithEvent:event]; + [cocoa_view_ handleBeginGestureWithEvent:event]; return; } case WebInputEvent::kGesturePinchEnd: { @@ -99,7 +99,7 @@ eventWithMagnification:0.0f locationInWindow:NSMakePoint(gesture_event->x, gesture_event->y)]; - [cocoa_view_ endGestureWithEvent:event]; + [cocoa_view_ handleEndGestureWithEvent:event]; return; } case WebInputEvent::kGesturePinchUpdate: {
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl.cc b/content/browser/renderer_host/offscreen_canvas_provider_impl.cc index 0dd63956..c2cb711 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl.cc
@@ -23,8 +23,8 @@ } void OffscreenCanvasProviderImpl::CreateOffscreenCanvasSurface( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request) { // TODO(kylechar): Kill the renderer too. @@ -47,7 +47,7 @@ } void OffscreenCanvasProviderImpl::CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkClientPtr client, cc::mojom::CompositorFrameSinkRequest request) { // TODO(kylechar): Kill the renderer too. @@ -67,7 +67,7 @@ } void OffscreenCanvasProviderImpl::DestroyOffscreenCanvasSurface( - cc::FrameSinkId frame_sink_id) { + viz::FrameSinkId frame_sink_id) { canvas_map_.erase(frame_sink_id); }
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl.h b/content/browser/renderer_host/offscreen_canvas_provider_impl.h index 69ed7978..668cd60 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl.h
@@ -8,7 +8,7 @@ #include <memory> #include "base/containers/flat_map.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom.h" @@ -34,12 +34,12 @@ // blink::mojom::OffscreenCanvasProvider implementation. void CreateOffscreenCanvasSurface( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request) override; void CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkClientPtr client, cc::mojom::CompositorFrameSinkRequest request) override; @@ -48,7 +48,7 @@ // Destroys the |canvas_map_| entry for |frame_sink_id|. Provided as a // callback to each OffscreenCanvasSurfaceImpl so they can destroy themselves. - void DestroyOffscreenCanvasSurface(cc::FrameSinkId frame_sink_id); + void DestroyOffscreenCanvasSurface(viz::FrameSinkId frame_sink_id); viz::HostFrameSinkManager* const host_frame_sink_manager_; @@ -57,7 +57,7 @@ mojo::BindingSet<blink::mojom::OffscreenCanvasProvider> bindings_; - base::flat_map<cc::FrameSinkId, std::unique_ptr<OffscreenCanvasSurfaceImpl>> + base::flat_map<viz::FrameSinkId, std::unique_ptr<OffscreenCanvasSurfaceImpl>> canvas_map_; DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasProviderImpl);
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc index 18c4afd4..048c75e 100644 --- a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc
@@ -32,9 +32,9 @@ namespace { constexpr uint32_t kRendererClientId = 3; -constexpr cc::FrameSinkId kFrameSinkParent(kRendererClientId, 1); -constexpr cc::FrameSinkId kFrameSinkA(kRendererClientId, 3); -constexpr cc::FrameSinkId kFrameSinkB(kRendererClientId, 4); +constexpr viz::FrameSinkId kFrameSinkParent(kRendererClientId, 1); +constexpr viz::FrameSinkId kFrameSinkA(kRendererClientId, 3); +constexpr viz::FrameSinkId kFrameSinkB(kRendererClientId, 4); // Stub OffscreenCanvasSurfaceClient that stores the latest SurfaceInfo. class StubOffscreenCanvasSurfaceClient @@ -123,7 +123,7 @@ // Gets the OffscreenCanvasSurfaceImpl for |frame_sink_id| or null if it // it doesn't exist. OffscreenCanvasSurfaceImpl* GetOffscreenCanvasSurface( - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { auto iter = provider_->canvas_map_.find(frame_sink_id); if (iter == provider_->canvas_map_.end()) return nullptr; @@ -131,8 +131,8 @@ } // Gets list of FrameSinkId for all offscreen canvases. - std::vector<cc::FrameSinkId> GetAllCanvases() { - std::vector<cc::FrameSinkId> frame_sink_ids; + std::vector<viz::FrameSinkId> GetAllCanvases() { + std::vector<viz::FrameSinkId> frame_sink_ids; for (auto& map_entry : provider_->canvas_map_) frame_sink_ids.push_back(map_entry.second->frame_sink_id()); std::sort(frame_sink_ids.begin(), frame_sink_ids.end()); @@ -205,7 +205,7 @@ mojo::MakeRequest(&compositor_frame_sink)); // Renderer submits a CompositorFrame with |local_id|. - const cc::LocalSurfaceId local_id(1, base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_id(1, base::UnguessableToken::Create()); compositor_frame_sink->SubmitCompositorFrame(local_id, MakeCompositorFrame()); RunUntilIdle(); @@ -302,7 +302,7 @@ // Check that trying to create an OffscreenCanvasSurfaceImpl with a client id // that doesn't match the renderer fails. TEST_F(OffscreenCanvasProviderImplTest, InvalidClientId) { - const cc::FrameSinkId invalid_frame_sink_id(4, 3); + const viz::FrameSinkId invalid_frame_sink_id(4, 3); EXPECT_NE(kRendererClientId, invalid_frame_sink_id.client_id()); StubOffscreenCanvasSurfaceClient surface_client;
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc index 7cb16fd1..b54cdd92 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
@@ -16,8 +16,8 @@ OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( viz::HostFrameSinkManager* host_frame_sink_manager, - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request, DestroyCallback destroy_callback) @@ -68,7 +68,7 @@ client_->OnSurfaceCreated(surface_info); } -void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, +void OffscreenCanvasSurfaceImpl::Require(const viz::SurfaceId& surface_id, const cc::SurfaceSequence& sequence) { GetFrameSinkManager()->surface_manager()->RequireSequence(surface_id, sequence);
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_impl.h index c060e56d..a0ab9d8 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
@@ -7,8 +7,8 @@ #include "base/callback.h" #include "base/compiler_specific.h" -#include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/surface_info.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/host/frame_sink_observer.h" #include "components/viz/host/host_frame_sink_manager.h" #include "content/common/content_export.h" @@ -27,20 +27,20 @@ OffscreenCanvasSurfaceImpl( viz::HostFrameSinkManager* host_frame_sink_manager, - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& frame_sink_id, blink::mojom::OffscreenCanvasSurfaceClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request, DestroyCallback destroy_callback); ~OffscreenCanvasSurfaceImpl() override; - const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } + const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } - const cc::FrameSinkId& parent_frame_sink_id() const { + const viz::FrameSinkId& parent_frame_sink_id() const { return parent_frame_sink_id_; } - const cc::LocalSurfaceId& local_surface_id() const { + const viz::LocalSurfaceId& local_surface_id() const { return local_surface_id_; } @@ -55,7 +55,7 @@ void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; // blink::mojom::OffscreenCanvasSurface implementation. - void Require(const cc::SurfaceId& surface_id, + void Require(const viz::SurfaceId& surface_id, const cc::SurfaceSequence& sequence) override; void Satisfy(const cc::SurfaceSequence& sequence) override; @@ -73,9 +73,9 @@ DestroyCallback destroy_callback_; // Surface-related state - const cc::FrameSinkId frame_sink_id_; - cc::LocalSurfaceId local_surface_id_; - const cc::FrameSinkId parent_frame_sink_id_; + const viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId local_surface_id_; + const viz::FrameSinkId parent_frame_sink_id_; bool has_created_compositor_frame_sink_ = false;
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 43b7512a120..e0fc0f46 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc
@@ -18,6 +18,7 @@ #include "base/numerics/safe_math.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/thread.h" #include "build/build_config.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" @@ -68,10 +69,6 @@ #include "url/gurl.h" #include "url/origin.h" -#if defined(OS_MACOSX) -#include "content/common/mac/font_descriptor.h" -#endif - #if defined(OS_WIN) #include "content/common/font_cache_dispatcher_win.h" #endif @@ -81,6 +78,7 @@ #endif #if defined(OS_MACOSX) +#include "content/common/mac/font_loader.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" #endif @@ -227,29 +225,18 @@ #if defined(OS_MACOSX) void RenderMessageFilter::OnLoadFont(const FontDescriptor& font, - IPC::Message* reply_msg) { - FontLoader::Result* result = new FontLoader::Result; - - BrowserThread::PostTaskAndReply( - BrowserThread::FILE, FROM_HERE, - base::Bind(&FontLoader::LoadFont, font, result), - base::Bind(&RenderMessageFilter::SendLoadFontReply, this, reply_msg, - base::Owned(result))); + IPC::Message* reply_msg) { + FontLoader::LoadFont( + font, + base::BindOnce(&RenderMessageFilter::SendLoadFontReply, this, reply_msg)); } void RenderMessageFilter::SendLoadFontReply(IPC::Message* reply, - FontLoader::Result* result) { - base::SharedMemoryHandle handle; - if (result->font_data_size == 0 || result->font_id == 0) { - result->font_data_size = 0; - result->font_id = 0; - } else { - handle = result->font_data.handle().Duplicate(); - result->font_data.Unmap(); - result->font_data.Close(); - } - RenderProcessHostMsg_LoadFont::WriteReplyParams( - reply, result->font_data_size, handle, result->font_id); + uint32_t data_size, + base::SharedMemoryHandle handle, + uint32_t font_id) { + RenderProcessHostMsg_LoadFont::WriteReplyParams(reply, data_size, handle, + font_id); Send(reply); } @@ -277,10 +264,13 @@ void RenderMessageFilter::OnSetThreadPriority(base::PlatformThreadId ns_tid, base::ThreadPriority priority) { - BrowserThread::PostTask( - BrowserThread::FILE_USER_BLOCKING, FROM_HERE, - base::Bind(&RenderMessageFilter::SetThreadPriorityOnFileThread, this, - ns_tid, priority)); + constexpr base::TaskTraits kTraits = { + base::MayBlock(), base::TaskPriority::USER_BLOCKING, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}; + base::PostTaskWithTraits( + FROM_HERE, kTraits, + base::BindOnce(&RenderMessageFilter::SetThreadPriorityOnFileThread, this, + ns_tid, priority)); } #endif
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index acaf9fd..b6202cb3 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h
@@ -37,13 +37,6 @@ #include <windows.h> #endif -#if defined(OS_MACOSX) -#include "content/common/mac/font_loader.h" -#endif - -#if defined(OS_ANDROID) -#endif - class GURL; struct FontDescriptor; @@ -106,7 +99,10 @@ #if defined(OS_MACOSX) // Messages for OOP font loading. void OnLoadFont(const FontDescriptor& font, IPC::Message* reply_msg); - void SendLoadFontReply(IPC::Message* reply, FontLoader::Result* result); + void SendLoadFontReply(IPC::Message* reply, + uint32_t data_size, + base::SharedMemoryHandle handle, + uint32_t font_id); #endif // mojom::RenderMessageFilter:
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 2aebb480..08e1987 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -204,7 +204,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/ui_base_switches.h" #include "ui/display/display_switches.h" -#include "ui/gfx/color_space_switches.h" #include "ui/gl/gl_switches.h" #include "ui/gl/gpu_switching_manager.h" #include "ui/native_theme/native_theme_features.h"
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 6ff30ba..f6b12ff8 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -338,7 +338,12 @@ gfx::ColorSpace::CreateSRGB().GetICCProfile( ¶ms->image_decode_color_space); } else { - params->image_decode_color_space = gfx::ICCProfile::FromBestMonitor(); + if (display::Display::HasForceColorProfile()) { + display::Display::GetForcedColorProfile().GetICCProfile( + ¶ms->image_decode_color_space); + } else { + params->image_decode_color_space = gfx::ICCProfile::FromBestMonitor(); + } } GetWidget()->GetResizeParams(¶ms->initial_size);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 2db6b5e..e8ffb78 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -446,19 +446,19 @@ return view_.get(); } -cc::FrameSinkId RenderWidgetHostImpl::AllocateFrameSinkId( +viz::FrameSinkId RenderWidgetHostImpl::AllocateFrameSinkId( bool is_guest_view_hack) { // GuestViews have two RenderWidgetHostViews and so we need to make sure // we don't have FrameSinkId collisions. // The FrameSinkId generated here must not conflict with FrameSinkId allocated -// in cc::FrameSinkIdAllocator. +// in viz::FrameSinkIdAllocator. #if !defined(OS_ANDROID) if (is_guest_view_hack) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); return factory->GetContextFactoryPrivate()->AllocateFrameSinkId(); } #endif - return cc::FrameSinkId( + return viz::FrameSinkId( base::checked_cast<uint32_t>(this->GetProcess()->GetID()), base::checked_cast<uint32_t>(this->GetRoutingID())); } @@ -703,7 +703,7 @@ view_->DoBrowserControlsShrinkBlinkSize(); resize_params->bottom_controls_height = view_->GetBottomControlsHeight(); resize_params->visible_viewport_size = view_->GetVisibleViewportSize(); - cc::LocalSurfaceId local_surface_id = view_->GetLocalSurfaceId(); + viz::LocalSurfaceId local_surface_id = view_->GetLocalSurfaceId(); if (local_surface_id.is_valid()) resize_params->local_surface_id = local_surface_id; } @@ -2583,7 +2583,7 @@ } void RenderWidgetHostImpl::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { auto new_surface_properties = RenderWidgetSurfaceProperties::FromCompositorFrame(frame);
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 8ef5f936..9e658e97 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -26,7 +26,7 @@ #include "base/timer/elapsed_timer.h" #include "build/build_config.h" #include "cc/ipc/compositor_frame_sink.mojom.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/common/quads/shared_bitmap.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/browser/renderer_host/input/input_ack_handler.h" @@ -149,7 +149,7 @@ RenderWidgetHostOwnerDelegate* owner_delegate() { return owner_delegate_; } - cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack); + viz::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack); // RenderWidgetHost implementation. void UpdateTextDirection(blink::WebTextDirection direction) override; @@ -578,7 +578,7 @@ // cc::mojom::CompositorFrameSink implementation. void SetNeedsBeginFrame(bool needs_begin_frame) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; @@ -965,7 +965,7 @@ // These information are used to verify that the renderer does not misbehave // when it comes to allocating LocalSurfaceIds. If surface properties change, // a new LocalSurfaceId must be created. - cc::LocalSurfaceId last_local_surface_id_; + viz::LocalSurfaceId last_local_surface_id_; RenderWidgetSurfaceProperties last_surface_properties_; mojo::Binding<cc::mojom::CompositorFrameSink> compositor_frame_sink_binding_;
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc index 048665f6..bb6b5ec 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.cc +++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -102,7 +102,7 @@ } RenderWidgetHostInputEventRouter::HittestDelegate::HittestDelegate( - const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& + const std::unordered_map<viz::SurfaceId, HittestData, viz::SurfaceIdHash>& hittest_data) : hittest_data_(hittest_data) {} @@ -156,7 +156,7 @@ // hit testing, and reflect transformations that would normally be applied in // the renderer process if the event was being routed between frames within a // single process with only one RenderWidgetHost. - cc::FrameSinkId frame_sink_id = + viz::FrameSinkId frame_sink_id = root_view->FrameSinkIdAtPoint(&delegate, point, transformed_point); const FrameSinkIdOwnerMap::iterator iter = owner_map_.find(frame_sink_id); // If the point hit a Surface whose namspace is no longer in the map, then @@ -740,7 +740,7 @@ } void RenderWidgetHostInputEventRouter::AddFrameSinkIdOwner( - const cc::FrameSinkId& id, + const viz::FrameSinkId& id, RenderWidgetHostViewBase* owner) { DCHECK(owner_map_.find(id) == owner_map_.end()); // We want to be notified if the owner is destroyed so we can remove it from @@ -750,7 +750,7 @@ } void RenderWidgetHostInputEventRouter::RemoveFrameSinkIdOwner( - const cc::FrameSinkId& id) { + const viz::FrameSinkId& id) { auto it_to_remove = owner_map_.find(id); if (it_to_remove != owner_map_.end()) { it_to_remove->second->RemoveObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.h b/content/browser/renderer_host/render_widget_host_input_event_router.h index 08bb689..9d1666b 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.h +++ b/content/browser/renderer_host/render_widget_host_input_event_router.h
@@ -15,7 +15,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "cc/surfaces/surface_hittest_delegate.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" #include "content/common/content_export.h" #include "ui/gfx/geometry/vector2d.h" @@ -75,11 +75,11 @@ const blink::WebGestureEvent& event); void CancelScrollBubbling(RenderWidgetHostViewBase* target_view); - void AddFrameSinkIdOwner(const cc::FrameSinkId& id, + void AddFrameSinkIdOwner(const viz::FrameSinkId& id, RenderWidgetHostViewBase* owner); - void RemoveFrameSinkIdOwner(const cc::FrameSinkId& id); + void RemoveFrameSinkIdOwner(const viz::FrameSinkId& id); - bool is_registered(const cc::FrameSinkId& id) { + bool is_registered(const viz::FrameSinkId& id) { return owner_map_.find(id) != owner_map_.end(); } @@ -104,21 +104,21 @@ class HittestDelegate : public cc::SurfaceHittestDelegate { public: - HittestDelegate( - const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& - hittest_data); + HittestDelegate(const std::unordered_map<viz::SurfaceId, + HittestData, + viz::SurfaceIdHash>& hittest_data); bool RejectHitTarget(const cc::SurfaceDrawQuad* surface_quad, const gfx::Point& point_in_quad_space) override; bool AcceptHitTarget(const cc::SurfaceDrawQuad* surface_quad, const gfx::Point& point_in_quad_space) override; - const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& + const std::unordered_map<viz::SurfaceId, HittestData, viz::SurfaceIdHash>& hittest_data_; }; - using FrameSinkIdOwnerMap = std::unordered_map<cc::FrameSinkId, + using FrameSinkIdOwnerMap = std::unordered_map<viz::FrameSinkId, RenderWidgetHostViewBase*, - cc::FrameSinkIdHash>; + viz::FrameSinkIdHash>; struct TargetData { RenderWidgetHostViewBase* target; gfx::Vector2d delta; @@ -180,7 +180,7 @@ // the main frame. bool in_touchscreen_gesture_pinch_; bool gesture_pinch_did_send_scroll_begin_; - std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash> + std::unordered_map<viz::SurfaceId, HittestData, viz::SurfaceIdHash> hittest_data_; DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter);
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 17777f0..4811819 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -1428,8 +1428,8 @@ // when enough time passes without receiving a new compositor frame. TEST_F(RenderWidgetHostTest, NewContentRenderingTimeout) { const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); host_->set_new_content_rendering_delay_for_testing( base::TimeDelta::FromMicroseconds(10)); @@ -1490,8 +1490,8 @@ // in its metadata is properly discarded. TEST_F(RenderWidgetHostTest, SwapCompositorFrameWithBadSourceId) { const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); host_->StartNewContentRenderingTimeout(100); host_->set_new_content_rendering_delay_for_testing( @@ -2023,8 +2023,8 @@ TEST_F(RenderWidgetHostTest, FrameToken_MessageThenFrame) { const uint32_t frame_token = 99; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages; messages.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5)); @@ -2048,8 +2048,8 @@ TEST_F(RenderWidgetHostTest, FrameToken_FrameThenMessage) { const uint32_t frame_token = 99; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages; messages.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5)); @@ -2074,8 +2074,8 @@ const uint32_t frame_token1 = 99; const uint32_t frame_token2 = 100; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages1; std::vector<IPC::Message> messages2; messages1.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5)); @@ -2113,8 +2113,8 @@ const uint32_t frame_token1 = 99; const uint32_t frame_token2 = 100; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages1; std::vector<IPC::Message> messages2; messages1.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5)); @@ -2152,8 +2152,8 @@ const uint32_t frame_token1 = 99; const uint32_t frame_token2 = 100; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages1; std::vector<IPC::Message> messages2; messages1.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5)); @@ -2186,8 +2186,8 @@ const uint32_t frame_token2 = 50; const uint32_t frame_token3 = 30; const gfx::Size frame_size(50, 50); - const cc::LocalSurfaceId local_surface_id(1, - base::UnguessableToken::Create()); + const viz::LocalSurfaceId local_surface_id(1, + base::UnguessableToken::Create()); std::vector<IPC::Message> messages1; std::vector<IPC::Message> messages3; messages1.push_back(ViewHostMsg_DidFirstVisuallyNonEmptyPaint(5));
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index c7406682..3d2a044 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -363,7 +363,7 @@ "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) return; - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture()); @@ -478,7 +478,7 @@ view_.SetLayout(ui::ViewAndroid::LayoutParams::MatchParent()); if (using_browser_compositor_) { - cc::FrameSinkId frame_sink_id = + viz::FrameSinkId frame_sink_id = host_->AllocateFrameSinkId(false /* is_guest_view_hack */); delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( &view_, CompositorImpl::GetFrameSinkManager(), this, frame_sink_id)); @@ -825,17 +825,17 @@ ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); } -cc::SurfaceId RenderWidgetHostViewAndroid::SurfaceIdForTesting() const { +viz::SurfaceId RenderWidgetHostViewAndroid::SurfaceIdForTesting() const { return delegated_frame_host_ ? delegated_frame_host_->SurfaceId() - : cc::SurfaceId(); + : viz::SurfaceId(); } -cc::FrameSinkId RenderWidgetHostViewAndroid::FrameSinkIdAtPoint( +viz::FrameSinkId RenderWidgetHostViewAndroid::FrameSinkIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point) { if (!delegated_frame_host_) - return cc::FrameSinkId(); + return viz::FrameSinkId(); float scale_factor = view_.GetDipScale(); DCHECK_GT(scale_factor, 0); @@ -843,7 +843,7 @@ // |point| from DIPs to pixels before hittesting. gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); - cc::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); + viz::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); if (surface_id.is_valid()) { cc::SurfaceHittest hittest(delegate, GetFrameSinkManager()->surface_manager()); @@ -890,7 +890,7 @@ bool RenderWidgetHostViewAndroid::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { if (!delegated_frame_host_) return false; @@ -901,7 +901,7 @@ // is necessary. gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); - cc::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); + viz::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); if (!surface_id.is_valid()) return false; @@ -930,7 +930,7 @@ // In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion, // but it is not necessary here because the final target view is responsible // for converting before computing the final transform. - cc::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); + viz::SurfaceId surface_id = delegated_frame_host_->SurfaceId(); if (!surface_id.is_valid()) return false; @@ -1201,7 +1201,7 @@ } void RenderWidgetHostViewAndroid::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { if (!delegated_frame_host_) { DCHECK(!using_browser_compositor_); @@ -2028,9 +2028,9 @@ content_view_core_->DidStopFlinging(); } -cc::FrameSinkId RenderWidgetHostViewAndroid::GetFrameSinkId() { +viz::FrameSinkId RenderWidgetHostViewAndroid::GetFrameSinkId() { if (!delegated_frame_host_) - return cc::FrameSinkId(); + return viz::FrameSinkId(); return delegated_frame_host_->GetFrameSinkId(); }
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index c7c18a97..e6db3f7 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -153,7 +153,7 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) override; void ClearCompositorFrame() override; @@ -167,10 +167,10 @@ override; void OnDidNavigateMainFrameToNewPage() override; void SetNeedsBeginFrames(bool needs_begin_frames) override; - cc::FrameSinkId GetFrameSinkId() override; - cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, - const gfx::Point& point, - gfx::Point* transformed_point) override; + viz::FrameSinkId GetFrameSinkId() override; + viz::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, + const gfx::Point& point, + gfx::Point* transformed_point) override; void ProcessMouseEvent(const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) override; void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, @@ -180,7 +180,7 @@ void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency) override; bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) override; bool TransformPointToCoordSpaceForView( const gfx::Point& point, @@ -310,7 +310,7 @@ ImeAdapterAndroid* ime_adapter_for_testing() { return ime_adapter_android_; } // Exposed for tests. - cc::SurfaceId SurfaceIdForTesting() const override; + viz::SurfaceId SurfaceIdForTesting() const override; ui::TouchSelectionControllerClient* GetSelectionControllerClientManagerForTesting();
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index a6c969f..f59f310 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -21,9 +21,9 @@ #include "cc/layers/layer.h" #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" -#include "cc/resources/texture_mailbox.h" #include "cc/trees/layer_tree_settings.h" #include "components/viz/common/gl_helper.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h" #include "content/browser/bad_message.h" @@ -896,7 +896,7 @@ } void RenderWidgetHostViewAura::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); @@ -1603,7 +1603,7 @@ event_handler_->OnMouseEvent(event); } -cc::FrameSinkId RenderWidgetHostViewAura::FrameSinkIdAtPoint( +viz::FrameSinkId RenderWidgetHostViewAura::FrameSinkIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point) { @@ -1615,10 +1615,10 @@ gfx::ConvertPointToPixel(device_scale_factor_, point); // TODO: this shouldn't be used with aura-mus, so that the null check so // go away and become a DCHECK. - cc::SurfaceId id = delegated_frame_host_ - ? delegated_frame_host_->SurfaceIdAtPoint( - delegate, point_in_pixels, transformed_point) - : cc::SurfaceId(); + viz::SurfaceId id = delegated_frame_host_ + ? delegated_frame_host_->SurfaceIdAtPoint( + delegate, point_in_pixels, transformed_point) + : viz::SurfaceId(); *transformed_point = gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); @@ -1655,7 +1655,7 @@ bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { // Transformations use physical pixels rather than DIP, so conversion // is necessary. @@ -2287,17 +2287,17 @@ ui::GestureRecognizer::Get()->CancelActiveTouches(window_); } -cc::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() { +viz::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() { return frame_sink_id_; } -cc::LocalSurfaceId RenderWidgetHostViewAura::GetLocalSurfaceId() const { +viz::LocalSurfaceId RenderWidgetHostViewAura::GetLocalSurfaceId() const { return local_surface_id_; } -cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { +viz::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { return delegated_frame_host_ ? delegated_frame_host_->SurfaceIdForTesting() - : cc::SurfaceId(); + : viz::SurfaceId(); } void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 9c4f3d4..bff417de 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -168,17 +168,17 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) override; void ClearCompositorFrame() override; void DidStopFlinging() override; void OnDidNavigateMainFrameToNewPage() override; - cc::FrameSinkId GetFrameSinkId() override; - cc::LocalSurfaceId GetLocalSurfaceId() const override; - cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, - const gfx::Point& point, - gfx::Point* transformed_point) override; + viz::FrameSinkId GetFrameSinkId() override; + viz::LocalSurfaceId GetLocalSurfaceId() const override; + viz::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, + const gfx::Point& point, + gfx::Point* transformed_point) override; void ProcessMouseEvent(const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) override; void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, @@ -188,7 +188,7 @@ void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency) override; bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) override; bool TransformPointToCoordSpaceForView( const gfx::Point& point, @@ -315,7 +315,7 @@ std::unique_ptr<TouchSelectionControllerClientAura> client); // Exposed for tests. - cc::SurfaceId SurfaceIdForTesting() const override; + viz::SurfaceId SurfaceIdForTesting() const override; // RenderWidgetHostViewEventHandler::Delegate: gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; @@ -604,8 +604,8 @@ // provides an implementation, and directs events to |host_|. std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; - cc::FrameSinkId frame_sink_id_; - cc::LocalSurfaceId local_surface_id_; + viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId local_surface_id_; base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 6e22dd4..fc8a7d5 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -28,12 +28,12 @@ #include "cc/output/compositor_frame_metadata.h" #include "cc/output/copy_output_request.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/fake_external_begin_frame_source.h" #include "cc/test/fake_surface_observer.h" #include "components/viz/common/gl_helper.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" #include "components/viz/service/display_embedder/shared_bitmap_allocation_notifier_impl.h" #include "content/browser/browser_thread_impl.h" @@ -131,7 +131,7 @@ namespace { -const cc::LocalSurfaceId kArbitraryLocalSurfaceId( +const viz::LocalSurfaceId kArbitraryLocalSurfaceId( 1, base::UnguessableToken::Deserialize(2, 3)); @@ -478,7 +478,7 @@ } } - cc::SurfaceId surface_id() const { + viz::SurfaceId surface_id() const { return GetDelegatedFrameHost()->SurfaceIdForTesting(); } @@ -869,7 +869,7 @@ IPC::TestSink* sink_; base::test::ScopedFeatureList feature_list_; - cc::LocalSurfaceIdAllocator local_surface_id_allocator_; + viz::LocalSurfaceIdAllocator local_surface_id_allocator_; private: DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraTest); @@ -2598,7 +2598,7 @@ std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers( view_->GetNativeView(), false /* sync_bounds */)); - cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); + viz::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); if (id.is_valid()) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); cc::SurfaceManager* manager = factory->GetContextFactoryPrivate() @@ -2623,8 +2623,8 @@ gfx::Size large_size(100, 100); gfx::Size small_size(40, 45); gfx::Size medium_size(40, 95); - cc::LocalSurfaceId small_id = local_surface_id_allocator_.GenerateId(); - cc::LocalSurfaceId medium_id = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId small_id = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId medium_id = local_surface_id_allocator_.GenerateId(); // Prevent the DelegatedFrameHost from skipping frames. // XXX @@ -2676,9 +2676,9 @@ gfx::Size size1(100, 100); gfx::Size size2(200, 200); gfx::Size size3(300, 300); - cc::LocalSurfaceId id1 = local_surface_id_allocator_.GenerateId(); - cc::LocalSurfaceId id2 = local_surface_id_allocator_.GenerateId(); - cc::LocalSurfaceId id3 = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId id1 = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId id2 = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId id3 = local_surface_id_allocator_.GenerateId(); aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow(); view_->InitAsChild(nullptr); @@ -2738,7 +2738,7 @@ view_->SubmitCompositorFrame( id2, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2))); view_->renderer_compositor_frame_sink_->Flush(); - cc::SurfaceId surface_id = view_->surface_id(); + viz::SurfaceId surface_id = view_->surface_id(); if (!surface_id.is_valid()) { // No frame ack yet. EXPECT_FALSE(view_->renderer_compositor_frame_sink_->did_receive_ack()); @@ -2793,7 +2793,7 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { gfx::Rect view_rect(100, 100); gfx::Size frame_size = view_rect.size(); - cc::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; + viz::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; view_->InitAsChild(nullptr); aura::client::ParentWindowWithContext( @@ -2911,7 +2911,7 @@ TEST_F(RenderWidgetHostViewAuraTest, ResizeAfterReceivingFrame) { gfx::Rect view_rect(100, 100); gfx::Size frame_size = view_rect.size(); - cc::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; + viz::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; view_->InitAsChild(nullptr); aura::client::ParentWindowWithContext( @@ -3222,7 +3222,7 @@ views[1]->Hide(); EXPECT_TRUE(views[1]->HasFrameData()); gfx::Size size2(200, 200); - cc::LocalSurfaceId id2 = local_surface_id_allocator_.GenerateId(); + viz::LocalSurfaceId id2 = local_surface_id_allocator_.GenerateId(); views[1]->SetSize(size2); EXPECT_FALSE(views[1]->HasFrameData()); // Show it, it should block until we give it a frame. @@ -3438,7 +3438,7 @@ TEST_F(RenderWidgetHostViewAuraTest, ForwardsBeginFrameAcks) { gfx::Rect view_rect(100, 100); gfx::Size frame_size = view_rect.size(); - cc::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; + viz::LocalSurfaceId local_surface_id = kArbitraryLocalSurfaceId; view_->InitAsChild(nullptr); aura::client::ParentWindowWithContext( @@ -3603,7 +3603,7 @@ view_->SubmitCompositorFrame( kArbitraryLocalSurfaceId, MakeDelegatedFrame(1.f, view_rect_.size(), view_rect_)); - cc::SurfaceId surface_id = + viz::SurfaceId surface_id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); if (surface_id.is_valid()) view_->GetDelegatedFrameHost()->WillDrawSurface(
diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index c2cdfa4d..8bdc035 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc
@@ -382,20 +382,20 @@ void RenderWidgetHostViewBase::OnDidNavigateMainFrameToNewPage() { } -cc::FrameSinkId RenderWidgetHostViewBase::GetFrameSinkId() { - return cc::FrameSinkId(); +viz::FrameSinkId RenderWidgetHostViewBase::GetFrameSinkId() { + return viz::FrameSinkId(); } -cc::LocalSurfaceId RenderWidgetHostViewBase::GetLocalSurfaceId() const { - return cc::LocalSurfaceId(); +viz::LocalSurfaceId RenderWidgetHostViewBase::GetLocalSurfaceId() const { + return viz::LocalSurfaceId(); } -cc::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( +viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point) { NOTREACHED(); - return cc::FrameSinkId(); + return viz::FrameSinkId(); } gfx::Point RenderWidgetHostViewBase::TransformPointToRootCoordSpace( @@ -411,7 +411,7 @@ bool RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { *transformed_point = point; return true; @@ -490,8 +490,8 @@ return false; } -cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { - return cc::SurfaceId(); +viz::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { + return viz::SurfaceId(); } } // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h index 4f35147..bde6cf95 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -20,7 +20,7 @@ #include "build/build_config.h" #include "cc/ipc/compositor_frame_sink.mojom.h" #include "cc/output/compositor_frame.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/common/content_export.h" #include "content/common/input/input_event_ack_state.h" @@ -228,8 +228,9 @@ virtual void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) = 0; - virtual void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, - cc::CompositorFrame frame) = 0; + virtual void SubmitCompositorFrame( + const viz::LocalSurfaceId& local_surface_id, + cc::CompositorFrame frame) = 0; virtual void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) {} virtual void OnSurfaceChanged(const cc::SurfaceInfo& surface_info) {} @@ -252,16 +253,16 @@ virtual void DidStopFlinging() {} // Returns the ID associated with the CompositorFrameSink of this view. - virtual cc::FrameSinkId GetFrameSinkId(); + virtual viz::FrameSinkId GetFrameSinkId(); - virtual cc::LocalSurfaceId GetLocalSurfaceId() const; + virtual viz::LocalSurfaceId GetLocalSurfaceId() const; // When there are multiple RenderWidgetHostViews for a single page, input // events need to be targeted to the correct one for handling. The following // methods are invoked on the RenderWidgetHostView that should be able to // properly handle the event (i.e. it has focus for keyboard events, or has // been identified by hit testing mouse, touch or gesture events). - virtual cc::FrameSinkId FrameSinkIdAtPoint( + virtual viz::FrameSinkId FrameSinkIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point); @@ -289,7 +290,7 @@ // coordinate space as an intermediate step. virtual bool TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point); // Transform a point that is in the coordinate space for the current @@ -437,7 +438,7 @@ // Exposed for testing. virtual bool IsChildFrameForTesting() const; - virtual cc::SurfaceId SurfaceIdForTesting() const; + virtual viz::SurfaceId SurfaceIdForTesting() const; protected: // Interface class only, do not construct.
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index b346290f..4214b88 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -619,7 +619,6 @@ "}" "</style>" "<script>" - " domAutomationController.setAutomationId(0);" " domAutomationController.send(\"DONE\");" "</script>", box_size.width(),
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 031508c..8890cc9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -22,7 +22,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "content/browser/renderer_host/browser_compositor_view_mac.h" #include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h" #include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h" @@ -189,6 +189,22 @@ @property(nonatomic, readonly) NSRange selectedRange; @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp; +// Common code path for handling begin gesture events. This helper method is +// called via different codepaths based on OS version and SDK: +// - On 10.11 and later, when linking with the 10.11 SDK, it is called from +// |magnifyWithEvent:| when the given event's phase is NSEventPhaseBegin. +// - On 10.10 and earlier, or when linking with an earlier SDK, it is called +// by |beginGestureWithEvent:| when a gesture begins. +- (void)handleBeginGestureWithEvent:(NSEvent*)event; + +// Common code path for handling end gesture events. This helper method is +// called via different codepaths based on OS version and SDK: +// - On 10.11 and later, when linking with the 10.11 SDK, it is called from +// |magnifyWithEvent:| when the given event's phase is NSEventPhaseEnded. +// - On 10.10 and earlier, or when linking with an earlier SDK, it is called +// by |endGestureWithEvent:| when a gesture ends. +- (void)handleEndGestureWithEvent:(NSEvent*)event; + - (void)setCanBeKeyView:(BOOL)can; - (void)setCloseOnDeactivate:(BOOL)b; - (void)setOpaque:(BOOL)opaque; @@ -309,7 +325,7 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) override; void ClearCompositorFrame() override; @@ -329,10 +345,10 @@ std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() override; - cc::FrameSinkId GetFrameSinkId() override; - cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, - const gfx::Point& point, - gfx::Point* transformed_point) override; + viz::FrameSinkId GetFrameSinkId() override; + viz::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, + const gfx::Point& point, + gfx::Point* transformed_point) override; // Returns true when we can do SurfaceHitTesting for the event type. bool ShouldRouteEvent(const blink::WebInputEvent& event) const; void ProcessMouseEvent(const blink::WebMouseEvent& event, @@ -344,7 +360,7 @@ void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency) override; bool TransformPointToLocalCoordSpace(const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) override; bool TransformPointToCoordSpaceForView( const gfx::Point& point, @@ -467,7 +483,7 @@ void AcceleratedWidgetSwapCompleted() override; // Exposed for testing. - cc::SurfaceId SurfaceIdForTesting() const override; + viz::SurfaceId SurfaceIdForTesting() const override; void SetShowingContextMenu(bool showing) override;
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 1c48e6b..345343e 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -18,6 +18,7 @@ #include "base/command_line.h" #include "base/debug/crash_logging.h" #include "base/logging.h" +#include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #import "base/mac/scoped_nsobject.h" #include "base/mac/sdk_forward_declarations.h" @@ -156,7 +157,6 @@ consumed:(BOOL)consumed; - (void)processedGestureScrollEvent:(const blink::WebGestureEvent&)event consumed:(BOOL)consumed; - - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; - (void)windowDidChangeBackingProperties:(NSNotification*)notification; - (void)windowChangedGlobalFrame:(NSNotification*)notification; @@ -450,7 +450,7 @@ [cocoa_view_ setLayer:background_layer_]; [cocoa_view_ setWantsLayer:YES]; - cc::FrameSinkId frame_sink_id = + viz::FrameSinkId frame_sink_id = render_widget_host_->AllocateFrameSinkId(is_guest_view_hack_); browser_compositor_.reset( new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(), @@ -532,7 +532,7 @@ allow_pause_for_resize_or_repaint_ = allow; } -cc::SurfaceId RenderWidgetHostViewMac::SurfaceIdForTesting() const { +viz::SurfaceId RenderWidgetHostViewMac::SurfaceIdForTesting() const { return browser_compositor_->GetDelegatedFrameHost()->SurfaceIdForTesting(); } @@ -1417,7 +1417,7 @@ } void RenderWidgetHostViewMac::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); @@ -1504,11 +1504,11 @@ new SyntheticGestureTargetMac(host, cocoa_view_)); } -cc::FrameSinkId RenderWidgetHostViewMac::GetFrameSinkId() { +viz::FrameSinkId RenderWidgetHostViewMac::GetFrameSinkId() { return browser_compositor_->GetDelegatedFrameHost()->GetFrameSinkId(); } -cc::FrameSinkId RenderWidgetHostViewMac::FrameSinkIdAtPoint( +viz::FrameSinkId RenderWidgetHostViewMac::FrameSinkIdAtPoint( cc::SurfaceHittestDelegate* delegate, const gfx::Point& point, gfx::Point* transformed_point) { @@ -1516,7 +1516,7 @@ // |point| from DIPs to pixels before hittesting. float scale_factor = ui::GetScaleFactorForNativeView(cocoa_view_); gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); - cc::SurfaceId id = + viz::SurfaceId id = browser_compositor_->GetDelegatedFrameHost()->SurfaceIdAtPoint( delegate, point_in_pixels, transformed_point); *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); @@ -1565,7 +1565,7 @@ bool RenderWidgetHostViewMac::TransformPointToLocalCoordSpace( const gfx::Point& point, - const cc::SurfaceId& original_surface, + const viz::SurfaceId& original_surface, gfx::Point* transformed_point) { // Transformations use physical pixels rather than DIP, so conversion // is necessary. @@ -2358,7 +2358,7 @@ } } -- (void)beginGestureWithEvent:(NSEvent*)event { +- (void)handleBeginGestureWithEvent:(NSEvent*)event { [responderDelegate_ beginGestureWithEvent:event]; gestureBeginEvent_.reset( new WebGestureEvent(WebGestureEventBuilder::Build(event, self))); @@ -2371,7 +2371,7 @@ } } -- (void)endGestureWithEvent:(NSEvent*)event { +- (void)handleEndGestureWithEvent:(NSEvent*)event { [responderDelegate_ endGestureWithEvent:event]; gestureBeginEvent_.reset(); @@ -2386,6 +2386,38 @@ } } +- (void)beginGestureWithEvent:(NSEvent*)event { + // This method must be handled when linking with the 10.10 SDK or earlier, or + // when the app is running on 10.10 or earlier. In other circumstances, the + // event will be handled by |magnifyWithEvent:|, so this method should do + // nothing. + bool shouldHandle = true; +#if defined(MAC_OS_X_VERSION_10_11) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 + shouldHandle = base::mac::IsAtMostOS10_10(); +#endif + + if (shouldHandle) { + [self handleBeginGestureWithEvent:event]; + } +} + +- (void)endGestureWithEvent:(NSEvent*)event { + // This method must be handled when linking with the 10.10 SDK or earlier, or + // when the app is running on 10.10 or earlier. In other circumstances, the + // event will be handled by |magnifyWithEvent:|, so this method should do + // nothing. + bool shouldHandle = true; +#if defined(MAC_OS_X_VERSION_10_11) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 + shouldHandle = base::mac::IsAtMostOS10_10(); +#endif + + if (shouldHandle) { + [self handleEndGestureWithEvent:event]; + } +} + - (void)touchesMovedWithEvent:(NSEvent*)event { [responderDelegate_ touchesMovedWithEvent:event]; } @@ -2601,6 +2633,33 @@ if (!renderWidgetHostView_->render_widget_host_) return; +#if defined(MAC_OS_X_VERSION_10_11) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 + // When linking against the 10.11 (or later) SDK and running on 10.11 or + // later, check the phase of the event and specially handle the "begin" and + // "end" phases. + if (base::mac::IsAtLeastOS10_11()) { + if (event.phase == NSEventPhaseBegan) { + [self handleBeginGestureWithEvent:event]; + return; + } + + if (event.phase == NSEventPhaseEnded || + event.phase == NSEventPhaseCancelled) { + [self handleEndGestureWithEvent:event]; + return; + } + } +#endif + + // If this conditional evalutes to true, and the function has not + // short-circuited from the previous block, then this event is a duplicate of + // a gesture event, and should be ignored. + if (event.phase == NSEventPhaseBegan || event.phase == NSEventPhaseEnded || + event.phase == NSEventPhaseCancelled) { + return; + } + // If, due to nesting of multiple gestures (e.g, from multiple touch // devices), the beginning of the gesture has been lost, skip the remainder // of the gesture.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index 87946bc29..ef72d17 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -10,6 +10,7 @@ #include <tuple> #include "base/command_line.h" +#include "base/mac/mac_util.h" #include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/sdk_forward_declarations.h" #include "base/macros.h" @@ -178,8 +179,17 @@ return event; } +NSEventPhase PhaseForEventType(NSEventType type) { + if (type == NSEventTypeBeginGesture) + return NSEventPhaseBegan; + if (type == NSEventTypeEndGesture) + return NSEventPhaseEnded; + return NSEventPhaseChanged; +} + id MockGestureEvent(NSEventType type, double magnification) { id event = [OCMockObject mockForClass:[NSEvent class]]; + NSEventPhase phase = PhaseForEventType(type); NSPoint locationInWindow = NSMakePoint(0, 0); CGFloat deltaX = 0; CGFloat deltaY = 0; @@ -187,6 +197,7 @@ NSUInteger modifierFlags = 0; [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(type)] type]; + [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(phase)] phase]; [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(locationInWindow)] locationInWindow]; [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(deltaX)] deltaX]; @@ -1514,7 +1525,34 @@ class RenderWidgetHostViewMacPinchTest : public RenderWidgetHostViewMacTest { public: - RenderWidgetHostViewMacPinchTest() : process_host_(nullptr) {} + RenderWidgetHostViewMacPinchTest() = default; + + void SetUp() override { + RenderWidgetHostViewMacTest::SetUp(); + // Initialize the view associated with a MockRenderWidgetHostImpl, rather + // than the MockRenderProcessHost that is set up by the test harness which + // mocks out |OnMessageReceived()|. + browser_context_.reset(new TestBrowserContext); + process_host_.reset(new MockRenderProcessHost(browser_context_.get())); + process_host_->Init(); + delegate_.reset(new MockRenderWidgetHostDelegate); + int32_t routing_id = process_host_->GetNextRoutingID(); + host_.reset(new MockRenderWidgetHostImpl(delegate_.get(), + process_host_.get(), routing_id)); + view_ = new RenderWidgetHostViewMac(host_.get(), false); + cocoa_view_.reset([view_->cocoa_view() retain]); + process_host_->sink().ClearMessages(); + } + + void TearDown() override { + cocoa_view_.reset(); + host_->ShutdownAndDestroyWidget(false); + host_.reset(); + delegate_.reset(); + process_host_.reset(); + browser_context_.reset(); + RenderWidgetHostViewMacTest::TearDown(); + } bool ZoomDisabledForPinchUpdateMessage() { const IPC::Message* message = nullptr; @@ -1543,26 +1581,42 @@ return gesture_event->data.pinch_update.zoom_disabled; } - MockRenderProcessHost* process_host_; + bool ShouldSendGestureEvents() { +#if defined(MAC_OS_X_VERSION_10_11) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 + return base::mac::IsAtMostOS10_10(); +#endif + return true; + } + + void SendBeginEvent() { + NSEvent* pinchBeginEvent = MockGestureEvent(NSEventTypeBeginGesture, 0); + if (ShouldSendGestureEvents()) + [cocoa_view_ beginGestureWithEvent:pinchBeginEvent]; + [cocoa_view_ magnifyWithEvent:pinchBeginEvent]; + } + + void SendEndEvent() { + NSEvent* pinchEndEvent = MockGestureEvent(NSEventTypeEndGesture, 0); + [cocoa_view_ magnifyWithEvent:pinchEndEvent]; + if (ShouldSendGestureEvents()) + [cocoa_view_ endGestureWithEvent:pinchEndEvent]; + } + + std::unique_ptr<TestBrowserContext> browser_context_; + std::unique_ptr<MockRenderProcessHost> process_host_; + std::unique_ptr<MockRenderWidgetHostImpl> host_; + std::unique_ptr<MockRenderWidgetHostDelegate> delegate_; + + // Owned by view_->cocoa_view(), which is stored in cocoa_view_. + RenderWidgetHostViewMac* view_; + base::scoped_nsobject<RenderWidgetHostViewCocoa> cocoa_view_; private: DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacPinchTest); }; TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) { - // Initialize the view associated with a MockRenderWidgetHostImpl, rather than - // the MockRenderProcessHost that is set up by the test harness which mocks - // out |OnMessageReceived()|. - TestBrowserContext browser_context; - process_host_ = new MockRenderProcessHost(&browser_context); - process_host_->Init(); - MockRenderWidgetHostDelegate delegate; - int32_t routing_id = process_host_->GetNextRoutingID(); - MockRenderWidgetHostImpl* host = - new MockRenderWidgetHostImpl(&delegate, process_host_, routing_id); - RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); - process_host_->sink().ClearMessages(); - // We'll use this IPC message to ack events. InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD, blink::WebInputEvent::kGesturePinchUpdate, @@ -1572,42 +1626,38 @@ // Do a gesture that crosses the threshold. { - NSEvent* pinchBeginEvent = - MockGestureEvent(NSEventTypeBeginGesture, 0); NSEvent* pinchUpdateEvents[3] = { MockGestureEvent(NSEventTypeMagnify, 0.25), MockGestureEvent(NSEventTypeMagnify, 0.25), MockGestureEvent(NSEventTypeMagnify, 0.25), }; - NSEvent* pinchEndEvent = - MockGestureEvent(NSEventTypeEndGesture, 0); - [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent]; + SendBeginEvent(); EXPECT_EQ(0U, process_host_->sink().message_count()); // No zoom is sent for the first update event. - [view->cocoa_view() magnifyWithEvent:pinchUpdateEvents[0]]; - host->OnMessageReceived(*response); + [cocoa_view_ magnifyWithEvent:pinchUpdateEvents[0]]; + host_->OnMessageReceived(*response); EXPECT_EQ(2U, process_host_->sink().message_count()); EXPECT_TRUE(ZoomDisabledForPinchUpdateMessage()); process_host_->sink().ClearMessages(); // The second update event crosses the threshold of 0.4, and so zoom is no // longer disabled. - [view->cocoa_view() magnifyWithEvent:pinchUpdateEvents[1]]; + [cocoa_view_ magnifyWithEvent:pinchUpdateEvents[1]]; EXPECT_FALSE(ZoomDisabledForPinchUpdateMessage()); - host->OnMessageReceived(*response); + host_->OnMessageReceived(*response); EXPECT_EQ(1U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); // The third update still has zoom enabled. - [view->cocoa_view() magnifyWithEvent:pinchUpdateEvents[2]]; + [cocoa_view_ magnifyWithEvent:pinchUpdateEvents[2]]; EXPECT_FALSE(ZoomDisabledForPinchUpdateMessage()); - host->OnMessageReceived(*response); + host_->OnMessageReceived(*response); EXPECT_EQ(1U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); - [view->cocoa_view() endGestureWithEvent:pinchEndEvent]; + SendEndEvent(); EXPECT_EQ(1U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); } @@ -1615,23 +1665,21 @@ // Do a gesture that doesn't cross the threshold, but happens when we're not // at page scale factor one, so it should be sent to the renderer. { - NSEvent* pinchBeginEvent = MockGestureEvent(NSEventTypeBeginGesture, 0); NSEvent* pinchUpdateEvent = MockGestureEvent(NSEventTypeMagnify, 0.25); - NSEvent* pinchEndEvent = MockGestureEvent(NSEventTypeEndGesture, 0); - view->page_at_minimum_scale_ = false; + view_->page_at_minimum_scale_ = false; - [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent]; + SendBeginEvent(); EXPECT_EQ(0U, process_host_->sink().message_count()); // Expect that a zoom happen because the time threshold has not passed. - [view->cocoa_view() magnifyWithEvent:pinchUpdateEvent]; + [cocoa_view_ magnifyWithEvent:pinchUpdateEvent]; EXPECT_FALSE(ZoomDisabledForPinchUpdateMessage()); - host->OnMessageReceived(*response); + host_->OnMessageReceived(*response); EXPECT_EQ(2U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); - [view->cocoa_view() endGestureWithEvent:pinchEndEvent]; + SendEndEvent(); EXPECT_EQ(1U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); } @@ -1639,33 +1687,28 @@ // Do a gesture again, after the page scale is no longer at one, and ensure // that it is thresholded again. { - NSEvent* pinchBeginEvent = MockGestureEvent(NSEventTypeBeginGesture, 0); NSEvent* pinchUpdateEvent = MockGestureEvent(NSEventTypeMagnify, 0.25); - NSEvent* pinchEndEvent = MockGestureEvent(NSEventTypeEndGesture, 0); - view->page_at_minimum_scale_ = true; + view_->page_at_minimum_scale_ = true; - [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent]; + SendBeginEvent(); EXPECT_EQ(0U, process_host_->sink().message_count()); // Get back to zoom one right after the begin event. This should still keep // the thresholding in place (it is latched at the begin event). - view->page_at_minimum_scale_ = false; + view_->page_at_minimum_scale_ = false; // Expect that zoom be disabled because the time threshold has passed. - [view->cocoa_view() magnifyWithEvent:pinchUpdateEvent]; + [cocoa_view_ magnifyWithEvent:pinchUpdateEvent]; EXPECT_EQ(2U, process_host_->sink().message_count()); EXPECT_TRUE(ZoomDisabledForPinchUpdateMessage()); - host->OnMessageReceived(*response); + host_->OnMessageReceived(*response); process_host_->sink().ClearMessages(); - [view->cocoa_view() endGestureWithEvent:pinchEndEvent]; + SendEndEvent(); EXPECT_EQ(1U, process_host_->sink().message_count()); process_host_->sink().ClearMessages(); } - - // Clean up. - host->ShutdownAndDestroyWidget(true); } TEST_F(RenderWidgetHostViewMacTest, EventLatencyOSMouseWheelHistogram) {
diff --git a/content/browser/sandbox_parameters_mac.mm b/content/browser/sandbox_parameters_mac.mm index d7b18aa..4658c8a 100644 --- a/content/browser/sandbox_parameters_mac.mm +++ b/content/browser/sandbox_parameters_mac.mm
@@ -66,7 +66,7 @@ std::string bundle_id = base::SysNSStringToUTF8([bundle bundleIdentifier]); CHECK(client->SetParameter(Sandbox::kSandboxChromeBundleId, bundle_id)); - CHECK(client->SetParameter(Sandbox::kSandboxChromePID, + CHECK(client->SetParameter(Sandbox::kSandboxBrowserPID, std::to_string(getpid()))); std::string logging_path =
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc index 57cefad..6f0ec5a 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc
@@ -350,7 +350,6 @@ std::string GetHTMLContents() override { return "<html><head><script>" - "window.domAutomationController.setAutomationId(1);" "window.domAutomationController.send(\"okay\");" "</script></head>" "<body>this page is an interstitial</body></html>";
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc index d64ee26..d2b92c5 100644 --- a/content/browser/service_worker/embedded_worker_instance.cc +++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -244,12 +244,10 @@ public: WorkerProcessHandle(const base::WeakPtr<ServiceWorkerContextCore>& context, int embedded_worker_id, - int process_id, - bool is_new_process) + int process_id) : context_(context), embedded_worker_id_(embedded_worker_id), - process_id_(process_id), - is_new_process_(is_new_process) { + process_id_(process_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_NE(ChildProcessHost::kInvalidUniqueID, process_id_); } @@ -266,14 +264,12 @@ } int process_id() const { return process_id_; } - bool is_new_process() const { return is_new_process_; } private: base::WeakPtr<ServiceWorkerContextCore> context_; const int embedded_worker_id_; const int process_id_; - const bool is_new_process_; DISALLOW_COPY_AND_ASSIGN(WorkerProcessHandle); }; @@ -406,33 +402,30 @@ return; } - const bool is_new_process = process_info->is_new_process; - TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "ALLOCATING_PROCESS", - instance_, "Is New Process", - is_new_process); - if (is_installed_) - ServiceWorkerMetrics::RecordProcessCreated(is_new_process); - ServiceWorkerMetrics::StartSituation start_situation = - ServiceWorkerMetrics::StartSituation::UNKNOWN; + process_info->start_situation; + TRACE_EVENT_NESTABLE_ASYNC_END1( + "ServiceWorker", "ALLOCATING_PROCESS", instance_, "StartSituation", + ServiceWorkerMetrics::StartSituationToString(start_situation)); + if (is_installed_) { + ServiceWorkerMetrics::RecordProcessCreated( + start_situation == ServiceWorkerMetrics::StartSituation::NEW_PROCESS); + } + if (started_during_browser_startup_) start_situation = ServiceWorkerMetrics::StartSituation::DURING_STARTUP; - else if (is_new_process) - start_situation = ServiceWorkerMetrics::StartSituation::NEW_PROCESS; - else - start_situation = ServiceWorkerMetrics::StartSituation::EXISTING_PROCESS; // Notify the instance that a process is allocated. state_ = ProcessAllocationState::ALLOCATED; instance_->OnProcessAllocated( - base::MakeUnique<WorkerProcessHandle>( - instance_->context_, instance_->embedded_worker_id(), - process_info->process_id, is_new_process), + base::MakeUnique<WorkerProcessHandle>(instance_->context_, + instance_->embedded_worker_id(), + process_info->process_id), start_situation); // Notify the instance that it is registered to the DevTools manager. - instance_->OnRegisteredToDevToolsManager( - is_new_process, std::move(devtools_proxy), params->wait_for_debugger); + instance_->OnRegisteredToDevToolsManager(std::move(devtools_proxy), + params->wait_for_debugger); status = instance_->SendStartWorker(std::move(params)); if (status != SERVICE_WORKER_OK) { @@ -485,6 +478,7 @@ void EmbeddedWorkerInstance::Start( std::unique_ptr<EmbeddedWorkerStartParams> params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, const StatusCallback& callback) { restart_count_++; if (!context_) { @@ -515,6 +509,7 @@ base::Bind(&CallDetach, base::Unretained(this))); pending_dispatcher_request_ = std::move(dispatcher_request); + pending_installed_scripts_info_ = std::move(installed_scripts_info); inflight_start_task_.reset( new StartTask(this, params->script_url, std::move(request))); @@ -613,7 +608,6 @@ } void EmbeddedWorkerInstance::OnRegisteredToDevToolsManager( - bool is_new_process, std::unique_ptr<DevToolsProxy> devtools_proxy, bool wait_for_debugger) { if (devtools_proxy) { @@ -651,12 +645,13 @@ mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo host_ptr_info; instance_host_binding_.Bind(mojo::MakeRequest(&host_ptr_info)); + const bool is_script_streaming = !pending_installed_scripts_info_.is_null(); inflight_start_task_->set_start_worker_sent_time(base::TimeTicks::Now()); client_->StartWorker(*params, std::move(pending_dispatcher_request_), + std::move(pending_installed_scripts_info_), std::move(host_ptr_info)); registry_->BindWorkerToProcess(process_id(), embedded_worker_id()); - // TODO(shimazu): Check if script streaming is used for the starting worker. - OnStartWorkerMessageSent(false /* is_script_streaming */); + OnStartWorkerMessageSent(is_script_streaming); if (starting_phase() == SCRIPT_STREAMING) { TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("ServiceWorker", "SENT_START_WITH_SCRIPT_STREAMING", this); @@ -931,11 +926,6 @@ return ChildProcessHost::kInvalidUniqueID; } -bool EmbeddedWorkerInstance::is_new_process() const { - DCHECK(process_handle_); - return process_handle_->is_new_process(); -} - int EmbeddedWorkerInstance::worker_devtools_agent_route_id() const { if (devtools_proxy_) return devtools_proxy_->agent_route_id();
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h index f70c3fc4..5f9fa24 100644 --- a/content/browser/service_worker/embedded_worker_instance.h +++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -112,9 +112,12 @@ // STOPPED status. |callback| is invoked after the worker script has been // started and evaluated, or when an error occurs. // |params| should be populated with service worker version info needed - // to start the worker. + // to start the worker. If the worker is already installed, + // |installed_scripts_info| holds information about its scripts; otherwise, + // it is null. void Start(std::unique_ptr<EmbeddedWorkerStartParams> params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, const StatusCallback& callback); // Stops the worker. It is invalid to call this when the worker is @@ -144,9 +147,6 @@ int restart_count() const { return restart_count_; } int process_id() const; int thread_id() const { return thread_id_; } - // This should be called only when the worker instance has a valid process, - // that is, when |process_id()| returns a valid process id. - bool is_new_process() const; int worker_devtools_agent_route_id() const; void AddListener(Listener* listener); @@ -216,7 +216,6 @@ // Called back from StartTask after the worker is registered to // WorkerDevToolsManager. void OnRegisteredToDevToolsManager( - bool is_new_process, std::unique_ptr<DevToolsProxy> devtools_proxy, bool wait_for_debugger); @@ -294,9 +293,15 @@ // Binding for EmbeddedWorkerInstanceHost, runs on IO thread. mojo::AssociatedBinding<EmbeddedWorkerInstanceHost> instance_host_binding_; - // TODO(shimazu): Remove this after EmbeddedWorkerStartParams is changed to - // a mojo struct. + // |pending_dispatcher_request_| and |pending_installed_scripts_info_| are + // parameters of the StartWorker message. These are called "pending" because + // they are not used directly by this class and are just transferred to the + // renderer in SendStartWorker(). + // TODO(shimazu): Remove |pending_dispatcher_request_| and + // |pending_installed_scripts_info_| when EmbeddedWorkerStartParams is + // changed to a mojo struct and we put them in EmbeddedWorkerStartParams. mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; + mojom::ServiceWorkerInstalledScriptsInfoPtr pending_installed_scripts_info_; // Whether devtools is attached or not. bool devtools_attached_;
diff --git a/content/browser/service_worker/embedded_worker_instance_unittest.cc b/content/browser/service_worker/embedded_worker_instance_unittest.cc index 363eb05..fe7a3bcc 100644 --- a/content/browser/service_worker/embedded_worker_instance_unittest.cc +++ b/content/browser/service_worker/embedded_worker_instance_unittest.cc
@@ -99,6 +99,7 @@ CreateStartParams(id, pattern, url); worker->Start( std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); run_loop.Run(); return status; @@ -132,6 +133,14 @@ return worker->SendStartWorker(std::move(params)); } + mojom::ServiceWorkerInstalledScriptsInfoPtr GetInstalledScriptsInfoPtr() { + installed_scripts_managers_.emplace_back(); + auto info = mojom::ServiceWorkerInstalledScriptsInfo::New(); + info->manager_request = + mojo::MakeRequest(&installed_scripts_managers_.back()); + return info; + } + ServiceWorkerContextCore* context() { return helper_->context(); } EmbeddedWorkerRegistry* embedded_worker_registry() { @@ -147,7 +156,10 @@ return helper_->mock_instance_clients(); } + // Mojo endpoints. std::vector<mojom::ServiceWorkerEventDispatcherPtr> dispatchers_; + std::vector<mojom::ServiceWorkerInstalledScriptsManagerPtr> + installed_scripts_managers_; TestBrowserThreadBundle thread_bundle_; std::unique_ptr<EmbeddedWorkerTestHelper> helper_; @@ -225,7 +237,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(service_worker_version_id, pattern, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); EXPECT_EQ(EmbeddedWorkerStatus::STARTING, worker->status()); run_loop.Run(); @@ -283,6 +295,7 @@ CreateStartParams(service_worker_version_id, pattern, url); worker->Start( std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(SERVICE_WORKER_OK, status); @@ -308,6 +321,7 @@ CreateStartParams(service_worker_version_id, pattern, url); worker->Start( std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); EXPECT_EQ(EmbeddedWorkerStatus::STARTING, worker->status()); run_loop.Run(); @@ -389,6 +403,7 @@ CreateStartParams(version_id1, pattern, url); worker1->Start( std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(SERVICE_WORKER_OK, status); @@ -402,6 +417,7 @@ CreateStartParams(version_id2, pattern, url); worker2->Start( std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(SERVICE_WORKER_OK, status); @@ -439,7 +455,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, base::Bind(&base::DoNothing))); worker->Detach(); base::RunLoop().RunUntilIdle(); @@ -472,7 +488,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, base::Bind(&base::DoNothing))); base::RunLoop().RunUntilIdle(); @@ -512,7 +528,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, base::Bind(&base::DoNothing))); worker->Stop(); base::RunLoop().RunUntilIdle(); @@ -535,7 +551,7 @@ std::unique_ptr<base::RunLoop> run_loop(new base::RunLoop); params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop->QuitClosure())); run_loop->Run(); @@ -587,7 +603,7 @@ CreateStartParams(version_id, scope, url); params->pause_after_download = true; worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, base::Bind(&base::DoNothing))); base::RunLoop().RunUntilIdle(); @@ -617,7 +633,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, base::Bind(&base::DoNothing))); base::RunLoop().RunUntilIdle(); @@ -650,7 +666,7 @@ params = CreateStartParams(version_id, scope, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop->QuitClosure())); run_loop->Run(); @@ -681,7 +697,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, pattern, url); worker->Start( - std::move(params), CreateEventDispatcher(), + std::move(params), CreateEventDispatcher(), GetInstalledScriptsInfoPtr(), base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); run_loop.Run(); @@ -716,6 +732,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, pattern, url); worker->Start(std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); base::RunLoop().RunUntilIdle(); @@ -736,6 +753,7 @@ void StartWorker( const EmbeddedWorkerStartParams& /* unused */, mojom::ServiceWorkerEventDispatcherRequest /* unused */, + mojom::ServiceWorkerInstalledScriptsInfoPtr /* unused */, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo /* unused */) override { helper_->mock_instance_clients()->clear(); @@ -763,6 +781,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, pattern, url); worker->Start(std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); base::RunLoop().RunUntilIdle(); @@ -819,6 +838,7 @@ std::unique_ptr<EmbeddedWorkerStartParams> params = CreateStartParams(version_id, pattern, url); worker->Start(std::move(params), CreateEventDispatcher(), + GetInstalledScriptsInfoPtr(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); worker->AddMessageToConsole(test_message.first, test_message.second); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index a92a970..4a3a539 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -73,6 +73,7 @@ void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { if (!helper_) return;
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h index b94ffebb..1dc7b84 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.h +++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -79,10 +79,11 @@ mojo::ScopedMessagePipeHandle request); protected: - // Implementation of mojo interfaces. + // mojom::EmbeddedWorkerInstanceClient implementation. void StartWorker( const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) override; void StopWorker() override;
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc index e14f09e..e11bbdc4 100644 --- a/content/browser/service_worker/service_worker_context_unittest.cc +++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -180,11 +180,13 @@ protected: void StartWorker(const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest request, + mojom::ServiceWorkerInstalledScriptsInfoPtr scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) override { events_.push_back(Message::StartWorker); EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( - params, std::move(request), std::move(instance_host)); + params, std::move(request), std::move(scripts_info), + std::move(instance_host)); } void StopWorker() override {
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc index b4742ea..07e8736 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -1027,12 +1027,6 @@ base::debug::ScopedCrashKey scope_provider_host_pid( "swdh_set_hosted_version_host_pid", base::IntToString(provider_host->process_id())); - if (version->embedded_worker()->process_id() != - ChildProcessHost::kInvalidUniqueID) { - base::debug::ScopedCrashKey scope_is_new_process( - "swdh_set_hosted_version_is_new_process", - version->embedded_worker()->is_new_process() ? "true" : "false"); - } base::debug::ScopedCrashKey scope_worker_restart_count( "swdh_set_hosted_version_restart_count", base::IntToString(version->embedded_worker()->restart_count()));
diff --git a/content/browser/service_worker/service_worker_installed_scripts_sender.cc b/content/browser/service_worker/service_worker_installed_scripts_sender.cc new file mode 100644 index 0000000..3a2c1af --- /dev/null +++ b/content/browser/service_worker/service_worker_installed_scripts_sender.cc
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/service_worker/service_worker_installed_scripts_sender.h" + +namespace content { + +ServiceWorkerInstalledScriptsSender::ServiceWorkerInstalledScriptsSender() = + default; +ServiceWorkerInstalledScriptsSender::~ServiceWorkerInstalledScriptsSender() = + default; + +mojom::ServiceWorkerInstalledScriptsInfoPtr +ServiceWorkerInstalledScriptsSender::CreateInfoAndBind() { + auto info = mojom::ServiceWorkerInstalledScriptsInfo::New(); + info->manager_request = mojo::MakeRequest(&manager_); + + // TODO(shimazu): Read all installed urls and start pushing scripts. + return info; +} + +} // namespace content
diff --git a/content/browser/service_worker/service_worker_installed_scripts_sender.h b/content/browser/service_worker/service_worker_installed_scripts_sender.h new file mode 100644 index 0000000..97dd25fa --- /dev/null +++ b/content/browser/service_worker/service_worker_installed_scripts_sender.h
@@ -0,0 +1,32 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INSTALLED_SCRIPTS_SENDER_H_ +#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INSTALLED_SCRIPTS_SENDER_H_ + +#include "content/common/service_worker/service_worker_installed_scripts_manager.mojom.h" + +namespace content { + +// ServiceWorkerInstalledScriptsSender serves the service worker's installed +// scripts from ServiceWorkerStorage to the renderer through Mojo data pipes. +// ServiceWorkerInstalledScriptsSender is owned by ServiceWorkerVersion. It is +// created for worker startup and lives as long as the worker is running. +class ServiceWorkerInstalledScriptsSender { + public: + ServiceWorkerInstalledScriptsSender(); + ~ServiceWorkerInstalledScriptsSender(); + + // Creates a Mojo struct (mojom::ServiceWorkerInstalledScriptsInfo) and sets + // it with the information to create WebServiceWorkerInstalledScriptsManager + // on the renderer. + mojom::ServiceWorkerInstalledScriptsInfoPtr CreateInfoAndBind(); + + private: + mojom::ServiceWorkerInstalledScriptsManagerPtr manager_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INSTALLED_SCRIPTS_SENDER_H_
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc index 38a73cf..26f29c9d 100644 --- a/content/browser/service_worker/service_worker_job_unittest.cc +++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -1694,13 +1694,15 @@ protected: void StartWorker(const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest request, + mojom::ServiceWorkerInstalledScriptsInfoPtr scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) override { ASSERT_TRUE(next_pause_after_download_.has_value()); EXPECT_EQ(next_pause_after_download_.value(), params.pause_after_download); num_of_startworker_++; EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( - params, std::move(request), std::move(instance_host)); + params, std::move(request), std::move(scripts_info), + std::move(instance_host)); } private:
diff --git a/content/browser/service_worker/service_worker_metrics.cc b/content/browser/service_worker/service_worker_metrics.cc index 9706daa2..7b276eb 100644 --- a/content/browser/service_worker/service_worker_metrics.cc +++ b/content/browser/service_worker/service_worker_metrics.cc
@@ -25,15 +25,19 @@ // Don't change these returned strings. They are written (in hashed form) into // logs. switch (situation) { + case ServiceWorkerMetrics::StartSituation::UNKNOWN: + NOTREACHED(); + return "_Unknown"; case ServiceWorkerMetrics::StartSituation::DURING_STARTUP: return "_DuringStartup"; case ServiceWorkerMetrics::StartSituation::NEW_PROCESS: return "_NewProcess"; - case ServiceWorkerMetrics::StartSituation::EXISTING_PROCESS: - return "_ExistingProcess"; - default: - NOTREACHED() << static_cast<int>(situation); + case ServiceWorkerMetrics::StartSituation::EXISTING_UNREADY_PROCESS: + return "_ExistingUnreadyProcess"; + case ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS: + return "_ExistingReadyProcess"; } + NOTREACHED() << static_cast<int>(situation); return "_Unknown"; } @@ -103,8 +107,10 @@ return Preparation::START_DURING_STARTUP; case Situation::NEW_PROCESS: return Preparation::START_IN_NEW_PROCESS; - case Situation::EXISTING_PROCESS: - return Preparation::START_IN_EXISTING_PROCESS; + case Situation::EXISTING_UNREADY_PROCESS: + return Preparation::START_IN_EXISTING_UNREADY_PROCESS; + case Situation::EXISTING_READY_PROCESS: + return Preparation::START_IN_EXISTING_READY_PROCESS; case Situation::UNKNOWN: break; } @@ -132,8 +138,10 @@ return "_StartWorkerDuringStartup"; case Preparation::START_IN_NEW_PROCESS: return "_StartWorkerNewProcess"; - case Preparation::START_IN_EXISTING_PROCESS: - return "_StartWorkerExistingProcess"; + case Preparation::START_IN_EXISTING_UNREADY_PROCESS: + return "_StartWorkerExistingUnreadyProcess"; + case Preparation::START_IN_EXISTING_READY_PROCESS: + return "_StartWorkerExistingReadyProcess"; case Preparation::STARTING: return "_StartingWorker"; case Preparation::RUNNING: @@ -224,13 +232,22 @@ using ScopedEventRecorder = ServiceWorkerMetrics::ScopedEventRecorder; -ScopedEventRecorder::ScopedEventRecorder() {} +ScopedEventRecorder::ScopedEventRecorder( + ServiceWorkerMetrics::EventType start_worker_purpose) + : start_worker_purpose_(start_worker_purpose) {} ScopedEventRecorder::~ScopedEventRecorder() { for (const auto& ev : event_stats_) { RecordEventHandledRatio(ev.first, ev.second.handled_events, ev.second.fired_events); } + if (start_worker_purpose_ == EventType::NAVIGATION_HINT) { + bool frame_fetch_event_fired = + event_stats_[EventType::FETCH_MAIN_FRAME].fired_events || + event_stats_[EventType::FETCH_SUB_FRAME].fired_events; + UMA_HISTOGRAM_BOOLEAN("ServiceWorker.StartHintPrecision", + frame_fetch_event_fired); + } } void ScopedEventRecorder::RecordEventHandledStatus( @@ -326,6 +343,26 @@ return "error"; } +const char* ServiceWorkerMetrics::StartSituationToString( + StartSituation start_situation) { + switch (start_situation) { + case StartSituation::UNKNOWN: + return "Unknown"; + case StartSituation::DURING_STARTUP: + return "During startup"; + case StartSituation::NEW_PROCESS: + return "New process"; + case StartSituation::EXISTING_UNREADY_PROCESS: + return "Existing unready process"; + case StartSituation::EXISTING_READY_PROCESS: + return "Existing ready process"; + break; + } + NOTREACHED() << "Got unexpected start situation: " + << static_cast<int>(start_situation); + return "error"; +} + ServiceWorkerMetrics::Site ServiceWorkerMetrics::SiteFromURL(const GURL& url) { // UIThreadSearchTermsData::GoogleBaseURLValue() returns the google base // URL, but not available in content layer. @@ -848,16 +885,6 @@ return nullptr; } -ServiceWorkerMetrics::StartSituation ServiceWorkerMetrics::GetStartSituation( - bool is_browser_startup_complete, - bool is_new_process) { - if (!is_browser_startup_complete) - return StartSituation::DURING_STARTUP; - if (is_new_process) - return StartSituation::NEW_PROCESS; - return StartSituation::EXISTING_PROCESS; -} - void ServiceWorkerMetrics::RecordStartStatusAfterFailure( int failure_count, ServiceWorkerStatusCode status) {
diff --git a/content/browser/service_worker/service_worker_metrics.h b/content/browser/service_worker/service_worker_metrics.h index 7a3d96c..431ef53 100644 --- a/content/browser/service_worker/service_worker_metrics.h +++ b/content/browser/service_worker/service_worker_metrics.h
@@ -144,33 +144,47 @@ // Not used for UMA. enum class StartSituation { + // Failed to allocate a process. UNKNOWN, + // The service worker started up during browser startup. DURING_STARTUP, - EXISTING_PROCESS, - NEW_PROCESS + // The service worker started up in a new process. + NEW_PROCESS, + // The service worker started up in an existing unready process. (Ex: The + // process was created for the navigation by PlzNavigate but the IPC + // connection is not established yet.) + EXISTING_UNREADY_PROCESS, + // The service worker started up in an existing ready process. + EXISTING_READY_PROCESS }; // Used for UMA. Append only. // This enum describes how an activated worker was found and prepared (i.e., // reached the RUNNING status) in order to dispatch a fetch event to. enum class WorkerPreparationType { - UNKNOWN, + UNKNOWN = 0, // The worker was already starting up. We waited for it to finish. - STARTING, + STARTING = 1, // The worker was already running. - RUNNING, + RUNNING = 2, // The worker was stopping. We waited for it to stop, and then started it // up. - STOPPING, + STOPPING = 3, // The worker was in the stopped state. We started it up, and startup // required a new process to be created. - START_IN_NEW_PROCESS, - // The worker was in the stopped state. We started it up, and it used an - // existing process. - START_IN_EXISTING_PROCESS, + START_IN_NEW_PROCESS = 4, + // Deprecated 07/2017; replaced by START_IN_EXISTING_UNREADY_PROCESS and + // START_IN_EXISTING_READY_PROCESS. + // START_IN_EXISTING_PROCESS = 5, // The worker was in the stopped state. We started it up, and this occurred // during browser startup. - START_DURING_STARTUP, + START_DURING_STARTUP = 6, + // The worker was in the stopped state. We started it up, and it used an + // existing unready process. + START_IN_EXISTING_UNREADY_PROCESS = 7, + // The worker was in the stopped state. We started it up, and it used an + // existing ready process. + START_IN_EXISTING_READY_PROCESS = 8, // Add new types here. NUM_TYPES }; @@ -190,7 +204,7 @@ class ScopedEventRecorder { public: - explicit ScopedEventRecorder(); + explicit ScopedEventRecorder(EventType start_worker_purpose); ~ScopedEventRecorder(); void RecordEventHandledStatus(EventType event, bool handled); @@ -207,6 +221,7 @@ size_t fired_events); std::map<EventType, EventStat> event_stats_; + const EventType start_worker_purpose_; DISALLOW_COPY_AND_ASSIGN(ScopedEventRecorder); }; @@ -214,6 +229,9 @@ // Converts an event type to a string. Used for tracing. static const char* EventTypeToString(EventType event_type); + // Converts a start situation to a string. Used for tracing. + static const char* StartSituationToString(StartSituation start_situation); + // If the |url| is not a special site, returns Site::OTHER. static Site SiteFromURL(const GURL& url); @@ -337,8 +355,6 @@ StartSituation start_situation); static const char* LoadSourceToString(LoadSource source); - static StartSituation GetStartSituation(bool is_browser_startup_complete, - bool is_new_process); // Records the result of a start attempt that occurred after the worker had // failed |failure_count| consecutive times.
diff --git a/content/browser/service_worker/service_worker_metrics_unittest.cc b/content/browser/service_worker/service_worker_metrics_unittest.cc index fa63add..810cc72 100644 --- a/content/browser/service_worker/service_worker_metrics_unittest.cc +++ b/content/browser/service_worker/service_worker_metrics_unittest.cc
@@ -14,8 +14,8 @@ const std::string kNavigationPreloadSuffix = "_NavigationPreloadEnabled"; const std::string kStartWorkerDuringStartupSuffix = "_StartWorkerDuringStartup"; const std::string kWorkerStartOccurred = "_WorkerStartOccurred"; -const std::string kStartWorkerExistingProcessSuffix = - "_StartWorkerExistingProcess"; +const std::string kStartWorkerExistingReadyProcessSuffix = + "_StartWorkerExistingReadyProcess"; const std::string kPreparationTime = "ServiceWorker.ActivatedWorkerPreparationForMainFrame.Time"; const std::string kPreparationType = @@ -111,14 +111,19 @@ // Test preparation when the worker started up in an existing process. base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordActivatedWorkerPreparationForMainFrame( - time, EmbeddedWorkerStatus::STOPPED, StartSituation::EXISTING_PROCESS, + time, EmbeddedWorkerStatus::STOPPED, + StartSituation::EXISTING_READY_PROCESS, true /* did_navigation_preload */); histogram_tester.ExpectUniqueSample( kPreparationType, - static_cast<int>(WorkerPreparationType::START_IN_EXISTING_PROCESS), 1); + static_cast<int>( + WorkerPreparationType::START_IN_EXISTING_READY_PROCESS), + 1); histogram_tester.ExpectUniqueSample( kPreparationType + kNavigationPreloadSuffix, - static_cast<int>(WorkerPreparationType::START_IN_EXISTING_PROCESS), 1); + static_cast<int>( + WorkerPreparationType::START_IN_EXISTING_READY_PROCESS), + 1); histogram_tester.ExpectTimeBucketCount(kPreparationTime, time, 1); histogram_tester.ExpectTimeBucketCount( kPreparationTime + kNavigationPreloadSuffix, time, 1); @@ -137,7 +142,7 @@ base::TimeDelta worker_start = base::TimeDelta::FromMilliseconds(123); base::TimeDelta response_start = base::TimeDelta::FromMilliseconds(789); EmbeddedWorkerStatus initial_worker_status = EmbeddedWorkerStatus::RUNNING; - StartSituation start_situation = StartSituation::EXISTING_PROCESS; + StartSituation start_situation = StartSituation::EXISTING_READY_PROCESS; base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordNavigationPreloadResponse( worker_start, response_start, initial_worker_status, start_situation, @@ -164,7 +169,7 @@ base::TimeDelta worker_start = base::TimeDelta::FromMilliseconds(123); base::TimeDelta response_start = base::TimeDelta::FromMilliseconds(789); EmbeddedWorkerStatus initial_worker_status = EmbeddedWorkerStatus::RUNNING; - StartSituation start_situation = StartSituation::EXISTING_PROCESS; + StartSituation start_situation = StartSituation::EXISTING_READY_PROCESS; base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordNavigationPreloadResponse( worker_start, response_start, initial_worker_status, start_situation, @@ -216,7 +221,7 @@ base::TimeDelta worker_start = base::TimeDelta::FromMilliseconds(234); base::TimeDelta response_start = base::TimeDelta::FromMilliseconds(789); EmbeddedWorkerStatus initial_worker_status = EmbeddedWorkerStatus::STOPPED; - StartSituation start_situation = StartSituation::EXISTING_PROCESS; + StartSituation start_situation = StartSituation::EXISTING_READY_PROCESS; base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordNavigationPreloadResponse( worker_start, response_start, initial_worker_status, start_situation, @@ -342,7 +347,7 @@ auto start_timing = mojom::EmbeddedWorkerStartTiming::New(); start_timing->blink_initialized_time = start_worker_sent_time; start_timing->start_worker_received_time = start_worker_sent_time + latency; - StartSituation start_situation = StartSituation::EXISTING_PROCESS; + StartSituation start_situation = StartSituation::EXISTING_READY_PROCESS; base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordEmbeddedWorkerStartTiming( @@ -353,7 +358,7 @@ histogram_tester.ExpectTimeBucketCount( "EmbeddedWorkerInstance.Start.StartMessageLatency", latency, 1); histogram_tester.ExpectTimeBucketCount( - "EmbeddedWorkerInstance.Start.StartMessageLatency_ExistingProcess", + "EmbeddedWorkerInstance.Start.StartMessageLatency_ExistingReadyProcess", latency, 1); histogram_tester.ExpectUniqueSample( "EmbeddedWorkerInstance.Start.WaitedForRendererSetup", false, 1); @@ -420,7 +425,7 @@ auto start_timing = mojom::EmbeddedWorkerStartTiming::New(); start_timing->blink_initialized_time = start_worker_sent_time; start_timing->start_worker_received_time = start_worker_sent_time - latency; - StartSituation start_situation = StartSituation::EXISTING_PROCESS; + StartSituation start_situation = StartSituation::EXISTING_READY_PROCESS; base::HistogramTester histogram_tester; ServiceWorkerMetrics::RecordEmbeddedWorkerStartTiming( @@ -431,7 +436,8 @@ histogram_tester.ExpectTotalCount( "EmbeddedWorkerInstance.Start.StartMessageLatency", 0); histogram_tester.ExpectTotalCount( - "EmbeddedWorkerInstance.Start.StartMessageLatency_ExistingProcess", 0); + "EmbeddedWorkerInstance.Start.StartMessageLatency_ExistingReadyProcess", + 0); histogram_tester.ExpectTotalCount( "EmbeddedWorkerInstance.Start.WaitedForRendererSetup", 0); histogram_tester.ExpectTotalCount(
diff --git a/content/browser/service_worker/service_worker_process_manager.cc b/content/browser/service_worker/service_worker_process_manager.cc index 48d2547..8e193da3 100644 --- a/content/browser/service_worker/service_worker_process_manager.cc +++ b/content/browser/service_worker/service_worker_process_manager.cc
@@ -167,7 +167,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); out_info->process_id = ChildProcessHost::kInvalidUniqueID; - out_info->is_new_process = false; + out_info->start_situation = ServiceWorkerMetrics::StartSituation::UNKNOWN; if (process_id_for_test_ != ChildProcessHost::kInvalidUniqueID) { // Let tests specify the returned process ID. Note: We may need to be able @@ -175,7 +175,8 @@ int result = can_use_existing_process ? process_id_for_test_ : new_process_id_for_test_; out_info->process_id = result; - out_info->is_new_process = false; + out_info->start_situation = + ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS; return SERVICE_WORKER_OK; } @@ -193,7 +194,8 @@ instance_info_.insert( std::make_pair(embedded_worker_id, ProcessInfo(process_id))); out_info->process_id = process_id; - out_info->is_new_process = false; + out_info->start_situation = + ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS; return SERVICE_WORKER_OK; } } @@ -215,7 +217,20 @@ site_instance->set_process_reuse_policy( SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE); } + RenderProcessHost* rph = site_instance->GetProcess(); + ServiceWorkerMetrics::StartSituation start_situation; + if (!rph->HasConnection()) { + // HasConnection() is false means that Init() has not been called or the + // process has been killed. + start_situation = ServiceWorkerMetrics::StartSituation::NEW_PROCESS; + } else if (!rph->IsReady()) { + start_situation = + ServiceWorkerMetrics::StartSituation::EXISTING_UNREADY_PROCESS; + } else { + start_situation = + ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS; + } // This Init() call posts a task to the IO thread that adds the RPH's // ServiceWorkerDispatcherHost to the @@ -230,9 +245,7 @@ rph->IncrementServiceWorkerRefCount(); out_info->process_id = rph->GetID(); - // TODO(falken): This is not accurate. SiteInstance could have returned an - // existing process. - out_info->is_new_process = true; + out_info->start_situation = start_situation; return SERVICE_WORKER_OK; }
diff --git a/content/browser/service_worker/service_worker_process_manager.h b/content/browser/service_worker/service_worker_process_manager.h index 6c86d491..10ba8a5 100644 --- a/content/browser/service_worker/service_worker_process_manager.h +++ b/content/browser/service_worker/service_worker_process_manager.h
@@ -13,6 +13,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/synchronization/lock.h" +#include "content/browser/service_worker/service_worker_metrics.h" #include "content/common/service_worker/service_worker_status_code.h" class GURL; @@ -32,12 +33,10 @@ struct AllocatedProcessInfo { // Same as RenderProcessHost::GetID(). int process_id; - // True if SiteInstance was used to retrieve the process. Even if true, this - // might not actually be a brand new process, since SiteInstance can return - // an existing process. If false, the process already existed in - // ServiceWorkerProcessManager's list of known processes. - // TODO(falken): Fix this. - bool is_new_process; + + // This must be one of NEW_PROCESS, EXISTING_UNREADY_PROCESS or + // EXISTING_READY_PROCESS. + ServiceWorkerMetrics::StartSituation start_situation; }; // |*this| must be owned by a ServiceWorkerContextWrapper in a
diff --git a/content/browser/service_worker/service_worker_process_manager_unittest.cc b/content/browser/service_worker/service_worker_process_manager_unittest.cc index 95d6c8a..90d65da5 100644 --- a/content/browser/service_worker/service_worker_process_manager_unittest.cc +++ b/content/browser/service_worker/service_worker_process_manager_unittest.cc
@@ -136,7 +136,8 @@ // An existing process should be allocated to the worker. EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(host1->GetID(), process_info.process_id); - EXPECT_FALSE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS, + process_info.start_situation); EXPECT_EQ(1u, host1->GetWorkerRefCount()); EXPECT_EQ(0u, host2->GetWorkerRefCount()); EXPECT_EQ(1u, instance_info.size()); @@ -154,7 +155,8 @@ // The same process should be allocated to the second worker. EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(host1->GetID(), process_info.process_id); - EXPECT_FALSE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS, + process_info.start_situation); EXPECT_EQ(2u, host1->GetWorkerRefCount()); EXPECT_EQ(0u, host2->GetWorkerRefCount()); EXPECT_EQ(2u, instance_info.size()); @@ -171,7 +173,8 @@ // A different existing process should be allocated to the third worker. EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(host2->GetID(), process_info.process_id); - EXPECT_FALSE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS, + process_info.start_situation); EXPECT_EQ(2u, host1->GetWorkerRefCount()); EXPECT_EQ(1u, host2->GetWorkerRefCount()); EXPECT_EQ(3u, instance_info.size()); @@ -206,6 +209,7 @@ // Create a process that is hosting a frame with URL |pattern_|. std::unique_ptr<MockRenderProcessHost> host(CreateRenderProcessHost()); + host->Init(); RenderProcessHostImpl::AddFrameWithSite(browser_context_.get(), host.get(), kSiteUrl); @@ -222,7 +226,8 @@ // An existing process should be allocated to the worker. EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(host->GetID(), process_info.process_id); - EXPECT_TRUE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_UNREADY_PROCESS, + process_info.start_situation); EXPECT_EQ(1u, host->GetWorkerRefCount()); EXPECT_EQ(1u, instance_info.size()); std::map<int, ServiceWorkerProcessManager::ProcessInfo>::iterator found = @@ -262,7 +267,8 @@ // A new process should be allocated to the worker. EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_NE(host->GetID(), process_info.process_id); - EXPECT_TRUE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::NEW_PROCESS, + process_info.start_situation); EXPECT_EQ(0u, host->GetWorkerRefCount()); EXPECT_EQ(1u, instance_info.size()); std::map<int, ServiceWorkerProcessManager::ProcessInfo>::iterator found = @@ -290,7 +296,8 @@ // Allocating a process in shutdown should abort. EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); EXPECT_EQ(ChildProcessHost::kInvalidUniqueID, process_info.process_id); - EXPECT_FALSE(process_info.is_new_process); + EXPECT_EQ(ServiceWorkerMetrics::StartSituation::UNKNOWN, + process_info.start_situation); EXPECT_TRUE(process_manager_->instance_info_.empty()); }
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index 0cf8b851..93722add 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -560,7 +560,7 @@ "ServiceWorker.ActivatedWorkerPreparationForMainFrame.Type_" "NavigationPreloadEnabled", static_cast<int>(ServiceWorkerMetrics::WorkerPreparationType:: - START_IN_EXISTING_PROCESS), + START_IN_EXISTING_READY_PROCESS), 1); histogram_tester.ExpectUniqueSample( "ServiceWorker.NavPreload.FinishedFirst_MainFrame", false, 1); @@ -587,7 +587,7 @@ "ServiceWorker.ActivatedWorkerPreparationForMainFrame.Type_" "NavigationPreloadEnabled", static_cast<int>(ServiceWorkerMetrics::WorkerPreparationType:: - START_IN_EXISTING_PROCESS), + START_IN_EXISTING_READY_PROCESS), 1); histogram_tester.ExpectUniqueSample( "ServiceWorker.NavPreload.FinishedFirst_MainFrame", true, 1);
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 6faa3fd..d387881 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -27,6 +27,7 @@ #include "content/browser/service_worker/service_worker_client_utils.h" #include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" +#include "content/browser/service_worker/service_worker_installed_scripts_sender.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/common/origin_trials/trial_token_validator.h" #include "content/common/service_worker/embedded_worker_messages.h" @@ -1432,6 +1433,8 @@ "ServiceWorker", "ServiceWorkerVersion::StartWorker", trace_id, "Script", script_url_.spec(), "Purpose", ServiceWorkerMetrics::EventTypeToString(purpose)); + DCHECK(!start_worker_first_purpose_); + start_worker_first_purpose_ = purpose; start_callbacks_.push_back( base::Bind(&ServiceWorkerVersion::RecordStartWorkerResult, weak_factory_.GetWeakPtr(), purpose, prestart_status, @@ -1451,12 +1454,17 @@ void ServiceWorkerVersion::StartWorkerInternal() { DCHECK_EQ(EmbeddedWorkerStatus::STOPPED, running_status()); + DCHECK(start_worker_first_purpose_); if (!ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram(site_for_uma_)) { DCHECK(!event_recorder_); event_recorder_ = - base::MakeUnique<ServiceWorkerMetrics::ScopedEventRecorder>(); + base::MakeUnique<ServiceWorkerMetrics::ScopedEventRecorder>( + start_worker_first_purpose_.value()); } + // We don't clear |start_worker_first_purpose_| here but clear in + // FinishStartWorker. This is because StartWorkerInternal may be called + // again from OnStoppedInternal if StopWorker is called before OnStarted. StartTimeoutTimer(); @@ -1467,8 +1475,17 @@ params->is_installed = IsInstalled(status_); params->pause_after_download = pause_after_download_; + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info; + if (ServiceWorkerUtils::IsScriptStreamingEnabled()) { + DCHECK(!installed_scripts_sender_); + installed_scripts_sender_ = + base::MakeUnique<ServiceWorkerInstalledScriptsSender>(); + installed_scripts_info = installed_scripts_sender_->CreateInfoAndBind(); + } + embedded_worker_->Start( std::move(params), mojo::MakeRequest(&event_dispatcher_), + std::move(installed_scripts_info), base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, weak_factory_.GetWeakPtr())); event_dispatcher_.set_connection_error_handler(base::Bind( @@ -1663,9 +1680,7 @@ !skip_recording_startup_time_) { ServiceWorkerMetrics::RecordStartWorkerTime( GetTickDuration(start_time), IsInstalled(prestart_status), - ServiceWorkerMetrics::GetStartSituation( - is_browser_startup_complete, embedded_worker_->is_new_process()), - purpose); + embedded_worker_->start_situation(), purpose); } if (status != SERVICE_WORKER_ERROR_TIMEOUT) @@ -1828,6 +1843,7 @@ pending_requests_.Clear(); external_request_uuid_to_request_id_.clear(); event_dispatcher_.reset(); + installed_scripts_sender_.reset(); // TODO(falken): Call SWURLRequestJob::ClearStream here? streaming_url_request_jobs_.clear(); @@ -1843,6 +1859,7 @@ } void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) { + start_worker_first_purpose_ = base::nullopt; RunCallbacks(this, &start_callbacks_, status); }
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h index 27e52065..cd9c7ec3 100644 --- a/content/browser/service_worker/service_worker_version.h +++ b/content/browser/service_worker/service_worker_version.h
@@ -23,6 +23,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" +#include "base/optional.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/tick_clock.h" #include "base/time/time.h" @@ -52,6 +53,7 @@ class MessagePort; class ServiceWorkerContextCore; +class ServiceWorkerInstalledScriptsSender; class ServiceWorkerProviderHost; class ServiceWorkerRegistration; class ServiceWorkerURLRequestJob; @@ -676,7 +678,8 @@ void OnStoppedInternal(EmbeddedWorkerStatus old_status); - // Fires and clears all start callbacks. + // Resets |start_worker_first_purpose_| and fires and clears all start + // callbacks. void FinishStartWorker(ServiceWorkerStatusCode status); // Removes any pending external request that has GUID of |request_uuid|. @@ -715,6 +718,9 @@ // Connected to ServiceWorkerContextClient while the worker is running. mojom::ServiceWorkerEventDispatcherPtr event_dispatcher_; + std::unique_ptr<ServiceWorkerInstalledScriptsSender> + installed_scripts_sender_; + std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; std::map<std::string, ServiceWorkerProviderHost*> controllee_map_; @@ -781,6 +787,10 @@ bool stop_when_devtools_detached_ = false; + // Keeps the first purpose of starting the worker for UMA. Cleared in + // FinishStartWorker(). + base::Optional<ServiceWorkerMetrics::EventType> start_worker_first_purpose_; + // This is the set of features that were used up until installation of this // version completed, or used during the lifetime of |this|. The values must // be from blink::UseCounter::Feature enum.
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc index 8de95659e..a80c58b 100644 --- a/content/browser/service_worker/service_worker_version_unittest.cc +++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -1447,4 +1447,107 @@ EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); } +class ServiceWorkerNavigationHintUMATest : public ServiceWorkerVersionTest { + protected: + ServiceWorkerNavigationHintUMATest() : ServiceWorkerVersionTest() {} + + void StartWorker(ServiceWorkerMetrics::EventType purpose) { + ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; + version_->StartWorker(purpose, CreateReceiverOnCurrentThread(&status)); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(SERVICE_WORKER_OK, status); + } + + void StopWorker() { + ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; + version_->StopWorker(CreateReceiverOnCurrentThread(&status)); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(SERVICE_WORKER_OK, status); + } + + static const char kStartHintPrecision[]; + + base::HistogramTester histogram_tester_; + + private: + DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNavigationHintUMATest); +}; + +const char ServiceWorkerNavigationHintUMATest::kStartHintPrecision[] = + "ServiceWorker.StartHintPrecision"; + +TEST_F(ServiceWorkerNavigationHintUMATest, Precision) { + version_->SetStatus(ServiceWorkerVersion::ACTIVATED); + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + StopWorker(); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, true, 0); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, false, 1); + + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + SimulateDispatchEvent(ServiceWorkerMetrics::EventType::MESSAGE); + StopWorker(); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, true, 0); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, false, 2); + + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + SimulateDispatchEvent(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME); + StopWorker(); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, true, 1); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, false, 2); + + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + SimulateDispatchEvent(ServiceWorkerMetrics::EventType::FETCH_SUB_FRAME); + StopWorker(); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, true, 2); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, false, 2); +} + +TEST_F(ServiceWorkerNavigationHintUMATest, ConcurrentStart) { + version_->SetStatus(ServiceWorkerVersion::ACTIVATED); + ServiceWorkerStatusCode status1 = SERVICE_WORKER_ERROR_MAX_VALUE; + ServiceWorkerStatusCode status2 = SERVICE_WORKER_ERROR_MAX_VALUE; + version_->StartWorker(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME, + CreateReceiverOnCurrentThread(&status1)); + version_->StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT, + CreateReceiverOnCurrentThread(&status2)); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(SERVICE_WORKER_OK, status1); + EXPECT_EQ(SERVICE_WORKER_OK, status2); + StopWorker(); + // The first purpose of starting worker was not a navigation hint. + histogram_tester_.ExpectTotalCount(kStartHintPrecision, 0); + + status1 = SERVICE_WORKER_ERROR_MAX_VALUE; + status2 = SERVICE_WORKER_ERROR_MAX_VALUE; + version_->StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT, + CreateReceiverOnCurrentThread(&status2)); + version_->StartWorker(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME, + CreateReceiverOnCurrentThread(&status1)); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(SERVICE_WORKER_OK, status1); + EXPECT_EQ(SERVICE_WORKER_OK, status2); + SimulateDispatchEvent(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME); + StopWorker(); + // The first purpose of starting worker was a navigation hint. + histogram_tester_.ExpectTotalCount(kStartHintPrecision, 1); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, true, 1); + histogram_tester_.ExpectBucketCount(kStartHintPrecision, false, 0); +} + +TEST_F(ServiceWorkerNavigationHintUMATest, StartWhileStopping) { + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; + version_->StopWorker(CreateReceiverOnCurrentThread(&status)); + EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, version_->running_status()); + histogram_tester_.ExpectTotalCount(kStartHintPrecision, 0); + + StartWorker(ServiceWorkerMetrics::EventType::NAVIGATION_HINT); + // The UMA must be recorded while restarting. + histogram_tester_.ExpectTotalCount(kStartHintPrecision, 1); + EXPECT_EQ(SERVICE_WORKER_OK, status); + StopWorker(); + // The UMA must be recorded when the worker stopped. + histogram_tester_.ExpectTotalCount(kStartHintPrecision, 2); +} + } // namespace content
diff --git a/content/browser/shared_worker/shared_worker_host.cc b/content/browser/shared_worker/shared_worker_host.cc index 43e63ded..c2b97610 100644 --- a/content/browser/shared_worker/shared_worker_host.cc +++ b/content/browser/shared_worker/shared_worker_host.cc
@@ -202,6 +202,8 @@ void SharedWorkerHost::AllowFileSystemResponse( std::unique_ptr<IPC::Message> reply_msg, bool allowed) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + WorkerProcessHostMsg_RequestFileSystemAccessSync::WriteReplyParams( reply_msg.get(), allowed);
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 1c8cab6..ac68083 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -5445,11 +5445,9 @@ // window gets or loses focus. const char kSetupFocusEvents[] = "window.addEventListener('focus', function() {" - " domAutomationController.setAutomationId(0);" " domAutomationController.send('%s-got-focus');" "});" "window.addEventListener('blur', function() {" - " domAutomationController.setAutomationId(0);" " domAutomationController.send('%s-lost-focus');" "});"; std::string script = base::StringPrintf(kSetupFocusEvents, "main", "main"); @@ -5634,11 +5632,9 @@ " wheel_count++;" " if (wheel_count % 2 == 0)" " e.preventDefault();\n" - " domAutomationController.setAutomationId(0);" " domAutomationController.send('wheel: ' + wheel_count);" "}" "function scroll_handler(e) {" - " domAutomationController.setAutomationId(0);" " domAutomationController.send('scroll: ' + wheel_count);" "}" "scroll_div = document.getElementById('scrollable_div');"
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index ad5f32c..2ad03f4 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -561,7 +561,7 @@ blob_context.get(), partition->url_loader_factory_getter_.get()); if (base::FeatureList::IsEnabled(features::kMojoBlobs)) { - partition->blob_registry_ = base::MakeRefCounted<BlobRegistryWrapper>( + partition->blob_registry_ = BlobRegistryWrapper::Create( blob_context, partition->filesystem_context_); }
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index e5c923a..b85d291 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1506,6 +1506,10 @@ should_normally_be_visible_ = false; } +bool WebContentsImpl::IsVisible() const { + return should_normally_be_visible_; +} + void WebContentsImpl::WasOccluded() { if (capturer_count_ > 0) return; @@ -2919,11 +2923,17 @@ LoadingStateChanged(true, true, nullptr); } -void WebContentsImpl::DetachInterstitialPage() { +void WebContentsImpl::DetachInterstitialPage(bool has_focus) { bool interstitial_pausing_throbber = ShowingInterstitialPage() && interstitial_page_->pause_throbber(); if (ShowingInterstitialPage()) interstitial_page_ = nullptr; + + // If the focus was on the interstitial, let's keep it to the page. + // (Note that in unit-tests the RVH may not have a view). + if (has_focus && GetRenderViewHost()->GetWidget()->GetView()) + GetRenderViewHost()->GetWidget()->GetView()->Focus(); + for (auto& observer : observers_) observer.DidDetachInterstitialPage();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index e16ba9d..9c837588 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -365,6 +365,7 @@ base::TimeTicks GetLastHiddenTime() const override; void WasShown() override; void WasHidden() override; + bool IsVisible() const override; bool NeedToFireBeforeUnload() override; void DispatchBeforeUnload() override; void AttachToOuterWebContentsFrame( @@ -814,7 +815,7 @@ bool muted); // Unsets the currently showing interstitial. - void DetachInterstitialPage() override; + void DetachInterstitialPage(bool has_focus) override; void UpdateOverridingUserAgent() override;
diff --git a/content/browser/zoom_browsertest.cc b/content/browser/zoom_browsertest.cc index 3a6721f0..6c653819 100644 --- a/content/browser/zoom_browsertest.cc +++ b/content/browser/zoom_browsertest.cc
@@ -134,7 +134,6 @@ const std::string& label) { const char kOnResizeCallbackSetup[] = "document.body.onresize = function(){" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('%s ' + window.innerWidth);" "};"; EXPECT_TRUE(ExecuteScript( @@ -168,7 +167,6 @@ void SetupOnResizeCallback(const ToRenderFrameHost& adapter) { const char kOnResizeCallbackSetup[] = "document.body.onresize = function(){" - " window.domAutomationController.setAutomationId(0);" " window.domAutomationController.send('Resized');" "};"; EXPECT_TRUE(ExecuteScript(
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 90e1e69..8dafe6c 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -619,7 +619,10 @@ void ChildThreadImpl::OnChannelError() { on_channel_error_called_ = true; - base::MessageLoop::current()->QuitWhenIdle(); + // If this thread runs in the browser process, only Thread::Stop should + // stop its message loop. Otherwise, QuitWhenIdle could race Thread::Stop. + if (!IsInBrowserProcess()) + base::MessageLoop::current()->QuitWhenIdle(); } bool ChildThreadImpl::Send(IPC::Message* msg) {
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index 0cc4552..4029bbb 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -562,7 +562,7 @@ "media/cdm_host_files.h", ] deps += [ - "//media:cdm_paths", + "//media/cdm:cdm_paths", # Needed for finding CDM path from CDM adapter path. # TODO(xhwang): Remove this dependency when CDM adapter is deprecated. @@ -615,6 +615,7 @@ "service_worker/embedded_worker.mojom", "service_worker/service_worker.mojom", "service_worker/service_worker_event_dispatcher.mojom", + "service_worker/service_worker_installed_scripts_manager.mojom", "service_worker/service_worker_provider.mojom", "service_worker/service_worker_provider_interfaces.mojom", "service_worker/service_worker_types.mojom",
diff --git a/content/common/DEPS b/content/common/DEPS index b11a706..a7b3f43 100644 --- a/content/common/DEPS +++ b/content/common/DEPS
@@ -2,8 +2,7 @@ "-storage/browser", "+components/discardable_memory/common", - "+components/viz/common/quads", - "+components/viz/common/resources", + "+components/viz/common", "+components/payments", "+device/base/synchronization", "+services/resource_coordinator/public/interfaces",
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h index 515d748..64e0cd4 100644 --- a/content/common/browser_plugin/browser_plugin_messages.h +++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -163,7 +163,7 @@ IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_RequireSequence, int /* browser_plugin_instance_id */, - cc::SurfaceId /* surface_id */, + viz::SurfaceId /* surface_id */, cc::SurfaceSequence /* sequence */) // -----------------------------------------------------------------------------
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 7367ff14..fee04ff 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -14,9 +14,9 @@ #include <vector> #include "build/build_config.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" #include "cc/surfaces/surface_sequence.h" +#include "components/viz/common/surface_id.h" #include "content/common/content_export.h" #include "content/common/content_param_traits.h" #include "content/common/content_security_policy/csp_context.h" @@ -549,7 +549,7 @@ // to perform hittesting on the browser process. IPC_STRUCT_BEGIN(FrameHostMsg_HittestData_Params) // |surface_id| represents the surface used by this remote frame. - IPC_STRUCT_MEMBER(cc::SurfaceId, surface_id) + IPC_STRUCT_MEMBER(viz::SurfaceId, surface_id) // If |ignored_for_hittest| then this surface should be ignored during // hittesting. @@ -1427,7 +1427,7 @@ // Creates a destruction dependency for the Surface specified by the given // |surface_id|. IPC_MESSAGE_ROUTED2(FrameHostMsg_RequireSequence, - cc::SurfaceId /* surface_id */, + viz::SurfaceId /* surface_id */, cc::SurfaceSequence /* sequence */) // Provides the result from handling BeforeUnload. |proceed| matches the return
diff --git a/content/common/indexed_db/indexed_db.mojom b/content/common/indexed_db/indexed_db.mojom index 786b6e5..8835113 100644 --- a/content/common/indexed_db/indexed_db.mojom +++ b/content/common/indexed_db/indexed_db.mojom
@@ -90,9 +90,13 @@ VersionChange, }; -enum CompactionStatus { +enum Status { OK, - Error, + NotFound, + Corruption, + NotSupported, + InvalidArgument, + IOError, }; struct IndexMetadata { @@ -335,5 +339,6 @@ mojo.common.mojom.String16 name, int64 version, int64 transaction_id); DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin, mojo.common.mojom.String16 name, bool force_close); - AbortTransactionsAndCompactDatabase(url.mojom.Origin origin) => (CompactionStatus status); + AbortTransactionsAndCompactDatabase(url.mojom.Origin origin) => (Status status); + AbortTransactionsForDatabase(url.mojom.Origin origin) => (Status status); };
diff --git a/content/common/mac/font_loader.h b/content/common/mac/font_loader.h index b4bbd470..4976a240 100644 --- a/content/common/mac/font_loader.h +++ b/content/common/mac/font_loader.h
@@ -5,49 +5,47 @@ #ifndef CONTENT_COMMON_MAC_FONT_LOADER_H_ #define CONTENT_COMMON_MAC_FONT_LOADER_H_ -#include <ApplicationServices/ApplicationServices.h> +#include <memory> + +#include <CoreGraphics/CoreGraphics.h> #include <stdint.h> +#include "base/callback_forward.h" #include "base/memory/shared_memory.h" #include "content/common/content_export.h" -#ifdef __OBJC__ -@class NSFont; -#else -class NSFont; -#endif - struct FontDescriptor; +namespace content { + // Provides functionality to transmit fonts over IPC. // // Note about font formats: .dfont (datafork suitcase) fonts are currently not // supported by this code since CGFontCreateWithDataProvider() can't handle them // directly. - class FontLoader { public: - // This structure holds the result of LoadFont(). This structure is passed to - // LoadFont(), which should run on the file thread, then it is passed to a - // task which sends the result to the originating renderer. - struct Result { - uint32_t font_data_size; + // Internal font load result data. Exposed here for testing. + struct ResultInternal { + uint32_t font_data_size = 0; base::SharedMemory font_data; - uint32_t font_id; + uint32_t font_id = 0; }; + + // Callback for the reporting result of LoadFont(). + // - The first argument is the data size. + // - The SharedMemoryHandle points to a shared memory buffer containing the + // raw data for the font file. + // - The last argument is the font_id: a unique identifier for the on-disk + // file we load for the font. + using LoadedCallback = + base::OnceCallback<void(uint32_t, base::SharedMemoryHandle, uint32_t)>; + // Load a font specified by |font| into a shared memory buffer suitable for - // sending over IPC. - // - // On return: - // |result->font_data| - shared memory buffer containing the raw data for - // the font file. The buffer is only valid when both |result->font_data_size| - // and |result->font_id| are not zero. - // |result->font_data_size| - size of data contained in |result->font_data|. - // This value is zero on failure. - // |result->font_id| - unique identifier for the on-disk file we load for - // the font. This value is zero on failure. + // sending over IPC. On failure, zeroes and an invalid handle are reported + // to the callback. CONTENT_EXPORT - static void LoadFont(const FontDescriptor& font, FontLoader::Result* result); + static void LoadFont(const FontDescriptor& font, LoadedCallback callback); // Given a shared memory buffer containing the raw data for a font file, load // the font and return a CGFontRef. @@ -64,6 +62,12 @@ static bool CGFontRefFromBuffer(base::SharedMemoryHandle font_data, uint32_t font_data_size, CGFontRef* out); + + CONTENT_EXPORT + static std::unique_ptr<ResultInternal> LoadFontForTesting( + const FontDescriptor& font); }; +} // namespace content + #endif // CONTENT_COMMON_MAC_FONT_LOADER_H_
diff --git a/content/common/mac/font_loader.mm b/content/common/mac/font_loader.mm index ae036075..1435aa62 100644 --- a/content/common/mac/font_loader.mm +++ b/content/common/mac/font_loader.mm
@@ -5,64 +5,37 @@ #include "content/common/mac/font_loader.h" #import <Cocoa/Cocoa.h> +#include <CoreText/CoreText.h> #include <limits> +#include "base/bind.h" +#include "base/callback.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" -#include "base/mac/foundation_util.h" +#import "base/mac/foundation_util.h" #include "base/mac/scoped_cftyperef.h" -#include "base/mac/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" +#include "base/memory/ptr_util.h" #include "base/strings/sys_string_conversions.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" #include "content/common/mac/font_descriptor.h" -#include <map> - +namespace content { namespace { -uint32_t GetFontIDForFont(const base::FilePath& font_path) { - // content/common can't depend on content/browser, so this cannot call - // BrowserThread::CurrentlyOn(). Check this is always called on the same - // thread. - static pthread_t thread_id = pthread_self(); - DCHECK_EQ(pthread_self(), thread_id); - - // Font loading used to call ATSFontGetContainer() - // and used that as font id. - // ATS is deprecated and CTFont doesn't seem to have a obvious fixed id for a - // font. Since this function is only called from a single thread, use a static - // map to store ids. - typedef std::map<base::FilePath, uint32_t> FontIdMap; - CR_DEFINE_STATIC_LOCAL(FontIdMap, font_ids, ()); - - auto it = font_ids.find(font_path); - if (it != font_ids.end()) - return it->second; - - uint32_t font_id = font_ids.size() + 1; - font_ids[font_path] = font_id; - return font_id; -} - -} // namespace - -// static -void FontLoader::LoadFont(const FontDescriptor& font, - FontLoader::Result* result) { +std::unique_ptr<FontLoader::ResultInternal> LoadFontOnFileThread( + const FontDescriptor& font) { base::ThreadRestrictions::AssertIOAllowed(); - DCHECK(result); - result->font_data_size = 0; - result->font_id = 0; - NSFont* font_to_encode = font.ToNSFont(); // Load appropriate NSFont. if (!font_to_encode) { DLOG(ERROR) << "Failed to load font " << font.font_name; - return; + return nullptr; } // NSFont -> File path. @@ -73,13 +46,13 @@ // If said unit test were to load a system font and activate it from memory // it becomes impossible for the system to the find the original file ref // since the font now lives in memory as far as it's concerned. - CTFontRef ct_font_to_encode = (CTFontRef)font_to_encode; + CTFontRef ct_font = base::mac::NSToCFCast(font_to_encode); base::scoped_nsobject<NSURL> font_url( base::mac::CFToNSCast(base::mac::CFCastStrict<CFURLRef>( - CTFontCopyAttribute(ct_font_to_encode, kCTFontURLAttribute)))); + CTFontCopyAttribute(ct_font, kCTFontURLAttribute)))); if (![font_url isFileURL]) { DLOG(ERROR) << "Failed to find font file for " << font.font_name; - return; + return nullptr; } base::FilePath font_path = base::mac::NSStringToFilePath([font_url path]); @@ -88,19 +61,21 @@ int64_t font_file_size_64 = -1; if (!base::GetFileSize(font_path, &font_file_size_64)) { DLOG(ERROR) << "Couldn't get font file size for " << font_path.value(); - return; + return nullptr; } if (font_file_size_64 <= 0 || font_file_size_64 >= std::numeric_limits<int32_t>::max()) { DLOG(ERROR) << "Bad size for font file " << font_path.value(); - return; + return nullptr; } + auto result = base::MakeUnique<FontLoader::ResultInternal>(); + int32_t font_file_size_32 = static_cast<int32_t>(font_file_size_64); if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) { DLOG(ERROR) << "Failed to create shmem area for " << font.font_name; - return; + return nullptr; } int32_t amt_read = base::ReadFile( @@ -108,11 +83,52 @@ font_file_size_32); if (amt_read != font_file_size_32) { DLOG(ERROR) << "Failed to read font data for " << font_path.value(); - return; + return nullptr; } result->font_data_size = font_file_size_32; - result->font_id = GetFontIDForFont(font_path); + + // Font loading used to call ATSFontGetContainer() and used that as font id. + // ATS is deprecated. CoreText offers up the ATSFontRef typeface ID via + // CTFontGetPlatformFont. + result->font_id = CTFontGetPlatformFont(ct_font, nil); + DCHECK_NE(0u, result->font_id); + + if (result->font_data_size == 0 || result->font_id == 0) + return nullptr; + + return result; +} + +void ReplyOnUIThread(FontLoader::LoadedCallback callback, + std::unique_ptr<FontLoader::ResultInternal> result) { + if (!result) { + std::move(callback).Run(0, base::SharedMemoryHandle(), 0); + return; + } + + DCHECK_NE(0u, result->font_data_size); + DCHECK_NE(0u, result->font_id); + + base::SharedMemoryHandle handle = result->font_data.handle().Duplicate(); + result->font_data.Unmap(); + result->font_data.Close(); + std::move(callback).Run(result->font_data_size, handle, result->font_id); +} + +} // namespace + +// static +void FontLoader::LoadFont(const FontDescriptor& font, LoadedCallback callback) { + // Tasks are triggered when font loading in the sandbox fails. Usually due to + // a user installing a third-party font manager. See crbug.com/72727. Web page + // rendering can't continue until a font is returned. + constexpr base::TaskTraits kTraits = { + base::MayBlock(), base::TaskPriority::USER_VISIBLE, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}; + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, kTraits, base::BindOnce(&LoadFontOnFileThread, font), + base::BindOnce(&ReplyOnUIThread, std::move(callback))); } // static @@ -143,3 +159,11 @@ return true; } + +// static +std::unique_ptr<FontLoader::ResultInternal> FontLoader::LoadFontForTesting( + const FontDescriptor& font) { + return LoadFontOnFileThread(font); +} + +} // namespace content
diff --git a/content/common/resize_params.h b/content/common/resize_params.h index ac0810dc..59620ba 100644 --- a/content/common/resize_params.h +++ b/content/common/resize_params.h
@@ -6,7 +6,7 @@ #define CONTENT_COMMON_RESIZE_PARAMS_H_ #include "base/optional.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "content/common/content_export.h" #include "content/public/common/screen_info.h" #include "third_party/WebKit/public/platform/WebDisplayMode.h" @@ -40,7 +40,7 @@ float bottom_controls_height; // The local surface ID to use (if valid). - base::Optional<cc::LocalSurfaceId> local_surface_id; + base::Optional<viz::LocalSurfaceId> local_surface_id; // The size of the visible viewport, which may be smaller than the view if the // view is partially occluded (e.g. by a virtual keyboard). The size is in
diff --git a/content/common/sandbox_mac.h b/content/common/sandbox_mac.h index 7d5f9f7..8496104 100644 --- a/content/common/sandbox_mac.h +++ b/content/common/sandbox_mac.h
@@ -48,16 +48,16 @@ // This path is not necessarily unique e.g. in the face of hardlinks. static base::FilePath GetCanonicalSandboxPath(const base::FilePath& path); - static const char* kSandboxEnableLogging; - static const char* kSandboxDisableDenialLogging; - static const char* kSandboxHomedirAsLiteral; - static const char* kSandboxOSVersion; - static const char* kSandboxPermittedDir; + static const char* kSandboxBrowserPID; static const char* kSandboxBundlePath; - static const char* kSandboxLoggingPathAsLiteral; static const char* kSandboxChromeBundleId; static const char* kSandboxComponentPath; - static const char* kSandboxChromePID; + static const char* kSandboxDisableDenialLogging; + static const char* kSandboxEnableLogging; + static const char* kSandboxHomedirAsLiteral; + static const char* kSandboxLoggingPathAsLiteral; + static const char* kSandboxOSVersion; + static const char* kSandboxPermittedDir; // TODO(kerrnel): this is only for the legacy sandbox. static const char* kSandboxElCapOrLater;
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm index 570edc5..0eb7e2f 100644 --- a/content/common/sandbox_mac.mm +++ b/content/common/sandbox_mac.mm
@@ -68,17 +68,18 @@ } // namespace // Static variable declarations. -const char* Sandbox::kSandboxEnableLogging = "ENABLE_LOGGING"; -const char* Sandbox::kSandboxDisableDenialLogging = - "DISABLE_SANDBOX_DENIAL_LOGGING"; -const char* Sandbox::kSandboxHomedirAsLiteral = "USER_HOMEDIR_AS_LITERAL"; -const char* Sandbox::kSandboxOSVersion = "OS_VERSION"; -const char* Sandbox::kSandboxPermittedDir = "PERMITTED_DIR"; +const char* Sandbox::kSandboxBrowserPID = "BROWSER_PID"; const char* Sandbox::kSandboxBundlePath = "BUNDLE_PATH"; -const char* Sandbox::kSandboxLoggingPathAsLiteral = "LOG_FILE_PATH"; const char* Sandbox::kSandboxChromeBundleId = "BUNDLE_ID"; const char* Sandbox::kSandboxComponentPath = "COMPONENT_PATH"; -const char* Sandbox::kSandboxChromePID = "CHROMIUM_PID"; +const char* Sandbox::kSandboxDisableDenialLogging = + "DISABLE_SANDBOX_DENIAL_LOGGING"; +const char* Sandbox::kSandboxEnableLogging = "ENABLE_LOGGING"; +const char* Sandbox::kSandboxHomedirAsLiteral = "USER_HOMEDIR_AS_LITERAL"; +const char* Sandbox::kSandboxLoggingPathAsLiteral = "LOG_FILE_PATH"; +const char* Sandbox::kSandboxOSVersion = "OS_VERSION"; +const char* Sandbox::kSandboxPermittedDir = "PERMITTED_DIR"; + const char* Sandbox::kSandboxElCapOrLater = "ELCAP_OR_LATER"; // Warm up System APIs that empirically need to be accessed before the Sandbox
diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index e7e3d20..4b0ef85 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm
@@ -113,14 +113,14 @@ NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0]; FontDescriptor descriptor(srcFont); - FontLoader::Result result; - FontLoader::LoadFont(descriptor, &result); - EXPECT_GT(result.font_data_size, 0U); - EXPECT_GT(result.font_id, 0U); + std::unique_ptr<FontLoader::ResultInternal> result = + FontLoader::LoadFontForTesting(descriptor); + EXPECT_GT(result->font_data_size, 0U); + EXPECT_GT(result->font_id, 0U); - base::WriteFileDescriptor(fileno(temp_file), - static_cast<const char *>(result.font_data.memory()), - result.font_data_size); + base::WriteFileDescriptor( + fileno(temp_file), static_cast<const char*>(result->font_data.memory()), + result->font_data_size); ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, "FontLoadingTestCase", temp_file_path.value().c_str()));
diff --git a/content/common/service_worker/embedded_worker.mojom b/content/common/service_worker/embedded_worker.mojom index 33508fe..15047db 100644 --- a/content/common/service_worker/embedded_worker.mojom +++ b/content/common/service_worker/embedded_worker.mojom
@@ -5,6 +5,7 @@ module content.mojom; import "content/common/service_worker/service_worker_event_dispatcher.mojom"; +import "content/common/service_worker/service_worker_installed_scripts_manager.mojom"; import "mojo/common/string16.mojom"; import "mojo/common/time.mojom"; import "services/service_manager/public/interfaces/interface_provider.mojom"; @@ -31,6 +32,7 @@ // as OnThreadStarted(), OnStarted(). StartWorker(EmbeddedWorkerStartParams params, ServiceWorkerEventDispatcher& dispatcher_request, + ServiceWorkerInstalledScriptsInfo? installed_scripts_info, associated EmbeddedWorkerInstanceHost instance_host); // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped(). StopWorker();
diff --git a/content/common/service_worker/service_worker_installed_scripts_manager.mojom b/content/common/service_worker/service_worker_installed_scripts_manager.mojom new file mode 100644 index 0000000..32e022b5 --- /dev/null +++ b/content/common/service_worker/service_worker_installed_scripts_manager.mojom
@@ -0,0 +1,34 @@ +// 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. + +module content.mojom; + +import "url/mojo/url.mojom"; + +// This is sent from the browser to the renderer on starting worker. +// Contains information about the scripts of an installed service worker. +struct ServiceWorkerInstalledScriptsInfo { + ServiceWorkerInstalledScriptsManager& manager_request; + array<url.mojom.Url> installed_urls; +}; + +// This is sent from the browser to the renderer. +// Contains information about a service worker script. +struct ServiceWorkerScriptInfo { + url.mojom.Url script_url; + string encoding; + // HTTP headers of the script. + map<string, string> headers; + // A handle for receiving the script body. + handle<data_pipe_consumer> body; + // A handle for receiving the V8 code cached metadata. + handle<data_pipe_consumer> meta_data; +}; + +// Renderer-side interface. The browser uses this interface to send +// information about installed scripts to the renderer. +interface ServiceWorkerInstalledScriptsManager { + // Starts streaming the script to the renderer. + TransferInstalledScript(ServiceWorkerScriptInfo script_info); +}; \ No newline at end of file
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index c2e1d073..ced400b5 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h
@@ -155,6 +155,8 @@ IPC_STRUCT_TRAITS_MEMBER(fit_to_view) IPC_STRUCT_TRAITS_MEMBER(offset) IPC_STRUCT_TRAITS_MEMBER(scale) + IPC_STRUCT_TRAITS_MEMBER(viewport_offset) + IPC_STRUCT_TRAITS_MEMBER(viewport_scale) IPC_STRUCT_TRAITS_MEMBER(screen_orientation_angle) IPC_STRUCT_TRAITS_MEMBER(screen_orientation_type) IPC_STRUCT_TRAITS_END()
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn index 434fc73..cf73d63 100644 --- a/content/public/android/BUILD.gn +++ b/content/public/android/BUILD.gn
@@ -112,9 +112,6 @@ "java/src/org/chromium/content/browser/BindingManager.java", "java/src/org/chromium/content/browser/BindingManagerImpl.java", "java/src/org/chromium/content/browser/BrowserStartupController.java", - "java/src/org/chromium/content/browser/ChildConnectionAllocator.java", - "java/src/org/chromium/content/browser/ChildProcessConnection.java", - "java/src/org/chromium/content/browser/ChildProcessLauncher.java", "java/src/org/chromium/content/browser/ChildProcessLauncherHelper.java", "java/src/org/chromium/content/browser/ContentChildProcessConstants.java", "java/src/org/chromium/content/browser/ContentClassFactory.java", @@ -473,7 +470,6 @@ junit_binary("content_junit_tests") { java_files = [ "junit/src/org/chromium/content/browser/BindingManagerImplTest.java", - "junit/src/org/chromium/content/browser/ChildConnectionAllocatorTest.java", "junit/src/org/chromium/content/browser/ChildProcessConnectionTest.java", "junit/src/org/chromium/content/browser/MenuDescriptorTest.java", "junit/src/org/chromium/content/browser/SpareChildConnectionTest.java",
diff --git a/content/public/android/java/src/org/chromium/content/browser/BindingManager.java b/content/public/android/java/src/org/chromium/content/browser/BindingManager.java index ffa1bb0..febf5f7 100644 --- a/content/public/android/java/src/org/chromium/content/browser/BindingManager.java +++ b/content/public/android/java/src/org/chromium/content/browser/BindingManager.java
@@ -6,6 +6,8 @@ import android.content.Context; +import org.chromium.base.process_launcher.ChildProcessConnection; + /** * Manages oom bindings used to bound child services. "Oom binding" is a binding that raises the * process oom priority so that it shouldn't be killed by the OS out-of-memory killer under
diff --git a/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java b/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java index 05944c8..a0564bc 100644 --- a/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java
@@ -14,6 +14,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.VisibleForTesting; import org.chromium.base.metrics.RecordHistogram; +import org.chromium.base.process_launcher.ChildProcessConnection; import java.util.LinkedList;
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncherHelper.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncherHelper.java index 11b4896d..b4a64b7 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncherHelper.java +++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncherHelper.java
@@ -20,8 +20,11 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.base.library_loader.Linker; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessConstants; import org.chromium.base.process_launcher.ChildProcessCreationParams; +import org.chromium.base.process_launcher.ChildProcessLauncher; import org.chromium.base.process_launcher.FileDescriptorInfo; import org.chromium.content.app.ChromiumLinkerParams; import org.chromium.content.app.SandboxedProcessService; @@ -313,10 +316,10 @@ if (!sandboxed) { if (sPrivilegedChildConnectionAllocator == null) { - sPrivilegedChildConnectionAllocator = - ChildConnectionAllocator.create(context, creationParams, packageName, - PRIVILEGED_SERVICES_NAME_KEY, NUM_PRIVILEGED_SERVICES_KEY, - bindAsExternalService, true /* useStrongBinding */); + sPrivilegedChildConnectionAllocator = ChildConnectionAllocator.create(context, + LauncherThread.getHandler(), creationParams, packageName, + PRIVILEGED_SERVICES_NAME_KEY, NUM_PRIVILEGED_SERVICES_KEY, + bindAsExternalService, true /* useStrongBinding */); } return sPrivilegedChildConnectionAllocator; } @@ -336,8 +339,9 @@ packageName, serviceName, sSandboxedServicesCountForTesting, bindAsExternalService, false /* useStrongBinding */); } else { - connectionAllocator = ChildConnectionAllocator.create(context, creationParams, - packageName, SANDBOXED_SERVICES_NAME_KEY, NUM_SANDBOXED_SERVICES_KEY, + connectionAllocator = ChildConnectionAllocator.create(context, + LauncherThread.getHandler(), creationParams, packageName, + SANDBOXED_SERVICES_NAME_KEY, NUM_SANDBOXED_SERVICES_KEY, bindAsExternalService, false /* useStrongBinding */); } if (sSandboxedServiceFactoryForTesting != null) { @@ -404,11 +408,13 @@ connectionAllocator, serviceCallback); } }; - mLauncher = ChildProcessLauncher.createWithBoundConnectionProvider(mLauncherDelegate, - commandLine, filesToBeMapped, connectionProvider, binderCallback); + mLauncher = ChildProcessLauncher.createWithBoundConnectionProvider( + LauncherThread.getHandler(), mLauncherDelegate, commandLine, filesToBeMapped, + connectionProvider, binderCallback); } else { - mLauncher = ChildProcessLauncher.createWithConnectionAllocator(mLauncherDelegate, - commandLine, filesToBeMapped, connectionAllocator, binderCallback); + mLauncher = ChildProcessLauncher.createWithConnectionAllocator( + LauncherThread.getHandler(), mLauncherDelegate, commandLine, filesToBeMapped, + connectionAllocator, binderCallback); } }
diff --git a/content/public/android/java/src/org/chromium/content/browser/LauncherThread.java b/content/public/android/java/src/org/chromium/content/browser/LauncherThread.java index 6069269..e3e6ffd91 100644 --- a/content/public/android/java/src/org/chromium/content/browser/LauncherThread.java +++ b/content/public/android/java/src/org/chromium/content/browser/LauncherThread.java
@@ -42,6 +42,10 @@ return sHandler.getLooper() == Looper.myLooper(); } + public static Handler getHandler() { + return sHandler; + } + @VisibleForTesting public static void setCurrentThreadAsLauncherThread() { sHandler = new Handler();
diff --git a/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java b/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java index 6538cc7..b973a81 100644 --- a/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java +++ b/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java
@@ -10,6 +10,8 @@ import org.chromium.base.Log; import org.chromium.base.VisibleForTesting; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; /** * This class is used to create a single spare ChildProcessConnection (usually early on during
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java index 3e87a5f..d868525 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java
@@ -26,6 +26,8 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.process_launcher.FileDescriptorInfo; import org.chromium.base.test.util.Feature;
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherIntegrationTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherIntegrationTest.java index 7c735dc..d1d5dcb 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherIntegrationTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherIntegrationTest.java
@@ -15,6 +15,8 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.UrlUtils;
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java index 66110fd..35b6fd14 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
@@ -18,6 +18,9 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; +import org.chromium.base.process_launcher.ChildProcessLauncher; import org.chromium.base.process_launcher.FileDescriptorInfo; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.Feature; @@ -101,10 +104,10 @@ public ChildConnectionAllocator call() { Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); - return ChildConnectionAllocator.create(context, null /* creationParams */, - SERVICE_PACKAGE_NAME, SERVICE_NAME_META_DATA_KEY, - SERVICE_COUNT_META_DATA_KEY, false /* bindAsExternalService */, - false /* useStrongBinding */); + return ChildConnectionAllocator.create(context, LauncherThread.getHandler(), + null /* creationParams */, SERVICE_PACKAGE_NAME, + SERVICE_NAME_META_DATA_KEY, SERVICE_COUNT_META_DATA_KEY, + false /* bindAsExternalService */, false /* useStrongBinding */); } }); } @@ -304,8 +307,9 @@ public ChildProcessLauncher createChildProcessLauncher( ChildProcessLauncher.Delegate delegate, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, IBinder binderCallback) { - return ChildProcessLauncher.createWithConnectionAllocator(delegate, - commandLine, filesToBeMapped, mConnectionAllocator, binderCallback); + return ChildProcessLauncher.createWithConnectionAllocator( + LauncherThread.getHandler(), delegate, commandLine, filesToBeMapped, + mConnectionAllocator, binderCallback); } }; @@ -388,8 +392,9 @@ public ChildProcessLauncher createChildProcessLauncher( ChildProcessLauncher.Delegate delegate, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, IBinder binderCallback) { - return ChildProcessLauncher.createWithBoundConnectionProvider(delegate, - commandLine, filesToBeMapped, connectionProvider, binderCallback); + return ChildProcessLauncher.createWithBoundConnectionProvider( + LauncherThread.getHandler(), delegate, commandLine, filesToBeMapped, + connectionProvider, binderCallback); } }; @@ -534,9 +539,9 @@ public ChildProcessLauncher call() { ChildProcessLauncher processLauncher = ChildProcessLauncher.createWithConnectionAllocator( - EMPTY_LAUNCHER_DELEGATE, new String[0], - new FileDescriptorInfo[0], connectionAllocator, - null /* binderCallback */); + LauncherThread.getHandler(), EMPTY_LAUNCHER_DELEGATE, + new String[0], new FileDescriptorInfo[0], + connectionAllocator, null /* binderCallback */); if (!processLauncher.start(setupConnection, queueIfNoFreeConnection)) { return null; }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java index 64a9c359..c37f98c 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
@@ -96,7 +96,6 @@ + "<head>" + " <script>" + " function sendCommand(command) {" - + " window.domAutomationController.setAutomationId(1);" + " window.domAutomationController.send(command);" + " }" + " </script>"
diff --git a/content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java b/content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java index 7963b33..969b12c 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java
@@ -22,6 +22,7 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLooper; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.test.util.Feature; import org.chromium.testing.local.LocalRobolectricTestRunner;
diff --git a/content/public/android/junit/src/org/chromium/content/browser/SpareChildConnectionTest.java b/content/public/android/junit/src/org/chromium/content/browser/SpareChildConnectionTest.java index 106905d..01eca4f8 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/SpareChildConnectionTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/SpareChildConnectionTest.java
@@ -25,6 +25,8 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLooper; +import org.chromium.base.process_launcher.ChildConnectionAllocator; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.test.util.Feature; import org.chromium.testing.local.LocalRobolectricTestRunner;
diff --git a/content/public/android/junit/src/org/chromium/content/browser/TestChildProcessConnection.java b/content/public/android/junit/src/org/chromium/content/browser/TestChildProcessConnection.java index 0b150f2..2f7baa8c 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/TestChildProcessConnection.java +++ b/content/public/android/junit/src/org/chromium/content/browser/TestChildProcessConnection.java
@@ -8,6 +8,7 @@ import android.os.Bundle; import android.os.IBinder; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.process_launcher.ICallbackInt; import org.chromium.base.process_launcher.IChildProcessService;
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 5881c95..993bf7a 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h
@@ -442,6 +442,11 @@ virtual void WasShown() = 0; virtual void WasHidden() = 0; + // Whether the WebContents is visible. This can return true even if the page + // is still loading, as opposed to RenderWidgetHostView::IsShowing(), which + // always returns false when the page is still loading. + virtual bool IsVisible() const = 0; + // Returns true if the before unload and unload listeners need to be // fired. The value of this changes over time. For example, if true and the // before unload listener is executed and allows the user to exit, then this
diff --git a/content/public/renderer/BUILD.gn b/content/public/renderer/BUILD.gn index f3f14f9..ddadd8925 100644 --- a/content/public/renderer/BUILD.gn +++ b/content/public/renderer/BUILD.gn
@@ -101,6 +101,11 @@ "//content/renderer", ] + if (is_android) { + # For seccomp_sandbox_status_android.h. + deps += [ "//sandbox" ] + } + if (enable_webrtc) { sources += [ "media_stream_audio_renderer.h",
diff --git a/content/public/renderer/seccomp_sandbox_status_android.h b/content/public/renderer/seccomp_sandbox_status_android.h index 8a4d823..fed9a4f4 100644 --- a/content/public/renderer/seccomp_sandbox_status_android.h +++ b/content/public/renderer/seccomp_sandbox_status_android.h
@@ -7,20 +7,12 @@ #include "content/common/content_export.h" +#include "sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h" + namespace content { -enum class SeccompSandboxStatus { - NOT_SUPPORTED = 0, // Seccomp is not supported. - DETECTION_FAILED, // Run-time detection of Seccomp+TSYNC failed. - FEATURE_DISABLED, // Sandbox was disabled by FeatureList. - FEATURE_ENABLED, // Sandbox was enabled by FeatureList. - ENGAGED, // Sandbox was enabled and successfully turned on. - STATUS_MAX - // This enum is used by an UMA histogram, so only append values. -}; - // Gets the SeccompSandboxStatus of the current process. -CONTENT_EXPORT SeccompSandboxStatus GetSeccompSandboxStatus(); +CONTENT_EXPORT sandbox::SeccompSandboxStatus GetSeccompSandboxStatus(); } // namespace content
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index b007eab1..568cb7e1 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc
@@ -42,7 +42,7 @@ #include "ui/base/platform_window_defaults.h" #include "ui/base/test/material_design_controller_test_api.h" #include "ui/compositor/compositor_switches.h" -#include "ui/gfx/color_space_switches.h" +#include "ui/display/display_switches.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_switches.h"
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 725456c3..6c9200e 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -1341,7 +1341,7 @@ void WaitForSurfaceReady(RenderWidgetHostViewBase* root_container); private: - bool ContainsSurfaceId(const cc::SurfaceId& container_surface_id); + bool ContainsSurfaceId(const viz::SurfaceId& container_surface_id); cc::SurfaceManager* surface_manager_; RenderWidgetHostViewBase* target_view_; @@ -1357,7 +1357,7 @@ void SurfaceHitTestReadyNotifier::WaitForSurfaceReady( RenderWidgetHostViewBase* root_view) { - cc::SurfaceId root_surface_id = root_view->SurfaceIdForTesting(); + viz::SurfaceId root_surface_id = root_view->SurfaceIdForTesting(); while (!ContainsSurfaceId(root_surface_id)) { // TODO(kenrb): Need a better way to do this. Needs investigation on // whether we can add a callback through RenderWidgetHostViewBaseObserver @@ -1372,7 +1372,7 @@ } bool SurfaceHitTestReadyNotifier::ContainsSurfaceId( - const cc::SurfaceId& container_surface_id) { + const viz::SurfaceId& container_surface_id) { if (!container_surface_id.is_valid()) return false; @@ -1381,7 +1381,7 @@ if (!container_surface || !container_surface->active_referenced_surfaces()) return false; - for (const cc::SurfaceId& id : + for (const viz::SurfaceId& id : *container_surface->active_referenced_surfaces()) { if (id == target_view_->SurfaceIdForTesting() || ContainsSurfaceId(id)) return true;
diff --git a/content/renderer/DEPS b/content/renderer/DEPS index c3ef7730..b803a5a 100644 --- a/content/renderer/DEPS +++ b/content/renderer/DEPS
@@ -9,8 +9,7 @@ "+components/url_formatter", "+components/variations", "+components/viz/client", - "+components/viz/common/quads", - "+components/viz/common/resources", + "+components/viz/common", "+cc/blink", "+content/public/child",
diff --git a/content/renderer/android/synchronous_layer_tree_frame_sink.cc b/content/renderer/android/synchronous_layer_tree_frame_sink.cc index 6fe3d64eb..7998397 100644 --- a/content/renderer/android/synchronous_layer_tree_frame_sink.cc +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.cc
@@ -26,7 +26,7 @@ #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/display.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "content/common/android/sync_compositor_messages.h" #include "content/common/view_messages.h" #include "content/renderer/android/synchronous_compositor_filter.h" @@ -49,8 +49,8 @@ namespace { const int64_t kFallbackTickTimeoutInMilliseconds = 100; -const cc::FrameSinkId kRootFrameSinkId(1, 1); -const cc::FrameSinkId kChildFrameSinkId(1, 2); +const viz::FrameSinkId kRootFrameSinkId(1, 1); +const viz::FrameSinkId kChildFrameSinkId(1, 2); // Do not limit number of resources, so use an unrealistically high value. const size_t kNumResourcesLimit = 10 * 1000 * 1000; @@ -127,7 +127,7 @@ memory_policy_(0u), frame_swap_message_queue_(frame_swap_message_queue), frame_sink_manager_(new cc::FrameSinkManager), - local_surface_id_allocator_(new cc::LocalSurfaceIdAllocator), + local_surface_id_allocator_(new viz::LocalSurfaceIdAllocator), begin_frame_source_(std::move(begin_frame_source)) { DCHECK(registry_); DCHECK(sender_); @@ -305,7 +305,7 @@ SkBlendMode::kSrcOver, 0 /* sorting_context_id */); surface_quad->SetNew( shared_quad_state, gfx::Rect(child_size), gfx::Rect(child_size), - cc::SurfaceId(kChildFrameSinkId, child_local_surface_id_), + viz::SurfaceId(kChildFrameSinkId, child_local_surface_id_), cc::SurfaceDrawQuadType::PRIMARY, nullptr); bool result = child_support_->SubmitCompositorFrame(child_local_surface_id_, @@ -499,7 +499,7 @@ } void SynchronousLayerTreeFrameSink::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} } // namespace content
diff --git a/content/renderer/android/synchronous_layer_tree_frame_sink.h b/content/renderer/android/synchronous_layer_tree_frame_sink.h index de4632d..e10a164 100644 --- a/content/renderer/android/synchronous_layer_tree_frame_sink.h +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.h
@@ -31,7 +31,6 @@ class ContextProvider; class Display; class FrameSinkManager; -class LocalSurfaceIdAllocator; } // namespace cc namespace IPC { @@ -39,6 +38,10 @@ class Sender; } // namespace IPC +namespace viz { +class LocalSurfaceIdAllocator; +} + namespace content { class FrameSwapMessageQueue; @@ -101,7 +104,7 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; private: @@ -154,9 +157,9 @@ // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface // is owned/destroyed on the compositor thread. std::unique_ptr<cc::FrameSinkManager> frame_sink_manager_; - std::unique_ptr<cc::LocalSurfaceIdAllocator> local_surface_id_allocator_; - cc::LocalSurfaceId child_local_surface_id_; - cc::LocalSurfaceId root_local_surface_id_; + std::unique_ptr<viz::LocalSurfaceIdAllocator> local_surface_id_allocator_; + viz::LocalSurfaceId child_local_surface_id_; + viz::LocalSurfaceId root_local_surface_id_; gfx::Size child_size_; gfx::Size display_size_; float device_scale_factor_ = 0;
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index 8d715a2..d488bd4 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc
@@ -68,7 +68,7 @@ } // cc::SequenceSurfaceReferenceFactory implementation: - void RequireSequence(const cc::SurfaceId& surface_id, + void RequireSequence(const viz::SurfaceId& surface_id, const cc::SurfaceSequence& sequence) const override { sender_->Send( new FrameHostMsg_RequireSequence(routing_id_, surface_id, sequence)); @@ -122,7 +122,7 @@ routing_id_, browser_plugin_instance_id_, seq)); } - void RequireSequence(const cc::SurfaceId& surface_id, + void RequireSequence(const viz::SurfaceId& surface_id, const cc::SurfaceSequence& sequence) const override { sender_->Send(new BrowserPluginHostMsg_RequireSequence( routing_id_, browser_plugin_instance_id_, surface_id, sequence));
diff --git a/content/renderer/child_frame_compositing_helper.h b/content/renderer/child_frame_compositing_helper.h index aa90625..789a31b 100644 --- a/content/renderer/child_frame_compositing_helper.h +++ b/content/renderer/child_frame_compositing_helper.h
@@ -15,8 +15,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/shared_memory.h" #include "base/memory/weak_ptr.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference_factory.h" +#include "components/viz/common/surface_id.h" #include "content/common/content_export.h" #include "ui/gfx/geometry/size.h" @@ -56,7 +56,7 @@ void UpdateVisibility(bool); void ChildFrameGone(); - cc::SurfaceId surface_id() const { return surface_id_; } + viz::SurfaceId surface_id() const { return surface_id_; } protected: // Friend RefCounted so that the dtor can be non-public. @@ -89,7 +89,7 @@ RenderFrameProxy* const render_frame_proxy_; std::unique_ptr<blink::WebLayer> web_layer_; - cc::SurfaceId surface_id_; + viz::SurfaceId surface_id_; blink::WebRemoteFrame* frame_; scoped_refptr<cc::SurfaceReferenceFactory> surface_reference_factory_;
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 29447582..e5522c4 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -691,7 +691,7 @@ return layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(value)); } -cc::FrameSinkId RenderWidgetCompositor::GetFrameSinkId() { +viz::FrameSinkId RenderWidgetCompositor::GetFrameSinkId() { return frame_sink_id_; } @@ -1218,7 +1218,7 @@ void RenderWidgetCompositor::DidLoseLayerTreeFrameSink() {} void RenderWidgetCompositor::SetFrameSinkId( - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { frame_sink_id_ = frame_sink_id; layer_tree_host_->SetFrameSinkId(frame_sink_id); } @@ -1241,7 +1241,7 @@ } void RenderWidgetCompositor::SetLocalSurfaceId( - const cc::LocalSurfaceId& local_surface_id) { + const viz::LocalSurfaceId& local_surface_id) { layer_tree_host_->SetLocalSurfaceId(local_surface_id); }
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index 372ef4b8..1743a5a40 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h
@@ -111,15 +111,15 @@ std::unique_ptr<base::Value> value, const base::Callback<void(std::unique_ptr<base::Value>)>& callback); bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value); - void SetFrameSinkId(const cc::FrameSinkId& frame_sink_id); + void SetFrameSinkId(const viz::FrameSinkId& frame_sink_id); void SetPaintedDeviceScaleFactor(float device_scale); void SetRasterColorSpace(const gfx::ColorSpace& color_space); void SetIsForOopif(bool is_for_oopif); void SetContentSourceId(uint32_t source_id); - void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id); + void SetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id); // WebLayerTreeView implementation. - cc::FrameSinkId GetFrameSinkId() override; + viz::FrameSinkId GetFrameSinkId() override; void SetRootLayer(const blink::WebLayer& layer) override; void ClearRootLayer() override; cc::AnimationHost* CompositorAnimationHost() override; @@ -242,7 +242,7 @@ blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_;
diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc index 4bf1c74..8dc45694 100644 --- a/content/renderer/mus/renderer_window_tree_client.cc +++ b/content/renderer/mus/renderer_window_tree_client.cc
@@ -107,7 +107,7 @@ int64_t display_id, ui::Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { root_window_id_ = root->window_id; tree_ = std::move(tree); if (!pending_layer_tree_frame_sink_callback_.is_null()) { @@ -134,7 +134,7 @@ void RendererWindowTreeClient::OnFrameSinkIdAllocated( ui::Id window_id, - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { // TODO(fsamuel): OOPIF's |frame_sink_id| is ready. The OOPIF can now be // embedded by the parent. } @@ -144,7 +144,7 @@ ui::mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { NOTREACHED(); } @@ -152,8 +152,7 @@ ui::Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { -} + const base::Optional<viz::LocalSurfaceId>& local_surface_id) {} void RendererWindowTreeClient::OnWindowTransformChanged( ui::Id window_id,
diff --git a/content/renderer/mus/renderer_window_tree_client.h b/content/renderer/mus/renderer_window_tree_client.h index f2c56fba..83ef310 100644 --- a/content/renderer/mus/renderer_window_tree_client.h +++ b/content/renderer/mus/renderer_window_tree_client.h
@@ -70,24 +70,24 @@ int64_t display_id, ui::Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnEmbeddedAppDisconnected(ui::Id window_id) override; void OnUnembed(ui::Id window_id) override; void OnCaptureChanged(ui::Id new_capture_window_id, ui::Id old_capture_window_id) override; void OnFrameSinkIdAllocated(ui::Id window_id, - const cc::FrameSinkId& frame_sink_id) override; + const viz::FrameSinkId& frame_sink_id) override; void OnTopLevelCreated( uint32_t change_id, ui::mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnWindowBoundsChanged( ui::Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_frame_id) override; + const base::Optional<viz::LocalSurfaceId>& local_frame_id) override; void OnWindowTransformChanged(ui::Id window_id, const gfx::Transform& old_transform, const gfx::Transform& new_transform) override;
diff --git a/content/renderer/pepper/pepper_compositor_host.cc b/content/renderer/pepper/pepper_compositor_host.cc index a9cdcec..cc58631 100644 --- a/content/renderer/pepper/pepper_compositor_host.cc +++ b/content/renderer/pepper/pepper_compositor_host.cc
@@ -14,9 +14,9 @@ #include "cc/layers/layer.h" #include "cc/layers/solid_color_layer.h" #include "cc/layers/texture_layer.h" -#include "cc/resources/texture_mailbox.h" #include "cc/trees/layer_tree_host.h" #include "components/viz/client/client_shared_bitmap_manager.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "content/renderer/pepper/gfx_conversion.h" #include "content/renderer/pepper/host_globals.h" @@ -281,9 +281,9 @@ static_cast<cc::TextureLayer*>(layer.get())); if (!old_layer || new_layer->common.resource_id != old_layer->common.resource_id) { - cc::TextureMailbox mailbox(new_layer->texture->mailbox, - new_layer->texture->sync_token, - new_layer->texture->target); + viz::TextureMailbox mailbox(new_layer->texture->mailbox, + new_layer->texture->sync_token, + new_layer->texture->target); texture_layer->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( base::Bind(&PepperCompositorHost::ResourceReleased, @@ -319,7 +319,7 @@ ->shared_bitmap_manager() ->GetBitmapForSharedMemory(image_shm.get()); - cc::TextureMailbox mailbox(bitmap.get(), PP_ToGfxSize(desc.size)); + viz::TextureMailbox mailbox(bitmap.get(), PP_ToGfxSize(desc.size)); image_layer->SetTextureMailbox( mailbox, cc::SingleReleaseCallback::Create(base::Bind(
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc index 435c55d0..ed8115a 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host.cc +++ b/content/renderer/pepper/pepper_graphics_2d_host.cc
@@ -15,9 +15,9 @@ #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "cc/paint/paint_flags.h" -#include "cc/resources/texture_mailbox.h" #include "components/viz/client/client_shared_bitmap_manager.h" #include "components/viz/common/quads/shared_bitmap.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "content/renderer/pepper/gfx_conversion.h" @@ -559,7 +559,7 @@ } bool PepperGraphics2DHost::PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) { if (!texture_mailbox_modified_) return false; @@ -584,7 +584,7 @@ viz::SharedBitmap::CheckedSizeInBytes(pixel_image_size)); image_data_->Unmap(); - *mailbox = cc::TextureMailbox(shared_bitmap.get(), pixel_image_size); + *mailbox = viz::TextureMailbox(shared_bitmap.get(), pixel_image_size); *release_callback = cc::SingleReleaseCallback::Create( base::Bind(&PepperGraphics2DHost::ReleaseCallback, this->AsWeakPtr(),
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.h b/content/renderer/pepper/pepper_graphics_2d_host.h index ce8355d7..c314770 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host.h +++ b/content/renderer/pepper/pepper_graphics_2d_host.h
@@ -23,7 +23,6 @@ namespace cc { class SingleReleaseCallback; -class TextureMailbox; } namespace gfx { @@ -36,6 +35,7 @@ namespace viz { class SharedBitmap; +class TextureMailbox; } namespace content { @@ -76,7 +76,7 @@ const gfx::Rect& paint_rect); bool PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback); void AttachedToNewLayer();
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index c2372e0..f123f53 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -756,7 +756,7 @@ } void PepperPluginInstanceImpl::CommitTextureMailbox( - const cc::TextureMailbox& texture_mailbox) { + const viz::TextureMailbox& texture_mailbox) { if (committed_texture_.IsValid() && !IsTextureInUse(committed_texture_)) { committed_texture_graphics_3d_->ReturnFrontBuffer( committed_texture_.mailbox(), committed_texture_consumed_sync_token_, @@ -793,7 +793,7 @@ } void PepperPluginInstanceImpl::FinishedConsumingCommittedTexture( - const cc::TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, scoped_refptr<PPB_Graphics3D_Impl> graphics_3d, const gpu::SyncToken& sync_token, bool is_lost) { @@ -2169,7 +2169,7 @@ } bool PepperPluginInstanceImpl::PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) { if (!bound_graphics_2d_platform_) return false; @@ -3461,7 +3461,7 @@ } void PepperPluginInstanceImpl::IncrementTextureReferenceCount( - const cc::TextureMailbox& mailbox) { + const viz::TextureMailbox& mailbox) { auto it = std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), [&mailbox](const TextureMailboxRefCount& ref_count) { @@ -3476,7 +3476,7 @@ } bool PepperPluginInstanceImpl::DecrementTextureReferenceCount( - const cc::TextureMailbox& mailbox) { + const viz::TextureMailbox& mailbox) { auto it = std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), [&mailbox](const TextureMailboxRefCount& ref_count) { @@ -3494,7 +3494,7 @@ } bool PepperPluginInstanceImpl::IsTextureInUse( - const cc::TextureMailbox& mailbox) const { + const viz::TextureMailbox& mailbox) const { auto it = std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), [&mailbox](const TextureMailboxRefCount& ref_count) {
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index 660f3a37..c94b7612 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -25,7 +25,7 @@ #include "cc/layers/content_layer_client.h" #include "cc/layers/layer.h" #include "cc/layers/texture_layer_client.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "content/common/content_export.h" #include "content/public/renderer/pepper_plugin_instance.h" #include "content/public/renderer/plugin_instance_throttler.h" @@ -202,14 +202,14 @@ void ScrollRect(int dx, int dy, const gfx::Rect& rect); // Commit the texture mailbox to the screen. - void CommitTextureMailbox(const cc::TextureMailbox& texture_mailbox); + void CommitTextureMailbox(const viz::TextureMailbox& texture_mailbox); // Passes the committed texture to |texture_layer_| and marks it as in use. void PassCommittedTextureToTextureLayer(); // Callback when the compositor is finished consuming the committed texture. void FinishedConsumingCommittedTexture( - const cc::TextureMailbox& texture_mailbox, + const viz::TextureMailbox& texture_mailbox, scoped_refptr<PPB_Graphics3D_Impl> graphics_3d, const gpu::SyncToken& sync_token, bool is_lost); @@ -551,7 +551,7 @@ // cc::TextureLayerClient implementation. bool PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) override; // RenderFrameObserver @@ -722,25 +722,25 @@ // Each time CommitTextureMailbox() is called, this instance is given // ownership - // of a cc::TextureMailbox. This instance always needs to hold on to the most - // recently committed cc::TextureMailbox, since UpdateLayer() might require + // of a viz::TextureMailbox. This instance always needs to hold on to the most + // recently committed viz::TextureMailbox, since UpdateLayer() might require // it. - // Since it is possible for a cc::TextureMailbox to be passed to + // Since it is possible for a viz::TextureMailbox to be passed to // texture_layer_ more than once, a reference counting mechanism is necessary - // to ensure that a cc::TextureMailbox isn't returned until all copies of it + // to ensure that a viz::TextureMailbox isn't returned until all copies of it // have been released by texture_layer_. // - // This method should be called each time a cc::TextureMailbox is passed to + // This method should be called each time a viz::TextureMailbox is passed to // |texture_layer_|. It increments an internal reference count. - void IncrementTextureReferenceCount(const cc::TextureMailbox& mailbox); + void IncrementTextureReferenceCount(const viz::TextureMailbox& mailbox); // This method should be called each time |texture_layer_| finishes consuming - // a cc::TextureMailbox. It decrements an internal reference count. Returns + // a viz::TextureMailbox. It decrements an internal reference count. Returns // whether the last reference was removed. - bool DecrementTextureReferenceCount(const cc::TextureMailbox& mailbox); + bool DecrementTextureReferenceCount(const viz::TextureMailbox& mailbox); - // Whether a given cc::TextureMailbox is in use by |texture_layer_|. - bool IsTextureInUse(const cc::TextureMailbox& mailbox) const; + // Whether a given viz::TextureMailbox is in use by |texture_layer_|. + bool IsTextureInUse(const viz::TextureMailbox& mailbox) const; RenderFrameImpl* render_frame_; scoped_refptr<PluginModule> module_; @@ -967,7 +967,7 @@ // The most recently committed texture. This is kept around in case the layer // needs to be regenerated. - cc::TextureMailbox committed_texture_; + viz::TextureMailbox committed_texture_; // The Graphics3D that produced the most recently committed texture. scoped_refptr<PPB_Graphics3D_Impl> committed_texture_graphics_3d_; @@ -975,10 +975,10 @@ gpu::SyncToken committed_texture_consumed_sync_token_; // Holds the number of references |texture_layer_| has to any given - // cc::TextureMailbox. + // viz::TextureMailbox. // We expect there to be no more than 10 textures in use at a time. A // std::vector will have better performance than a std::map. - using TextureMailboxRefCount = std::pair<cc::TextureMailbox, int>; + using TextureMailboxRefCount = std::pair<viz::TextureMailbox, int>; std::vector<TextureMailboxRefCount> texture_ref_counts_; bool initialized_;
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc index d8b0967..048ffea 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -184,7 +184,7 @@ // Don't need to check for NULL from GetPluginInstance since when we're // bound, we know our instance is valid. bool is_overlay_candidate = use_image_chromium_; - cc::TextureMailbox texture_mailbox( + viz::TextureMailbox texture_mailbox( taken_front_buffer_, sync_token, // TODO(reveman): Get texture target from browser process. #if defined(OS_MACOSX)
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 6ca8796..388367820 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -425,7 +425,7 @@ class RendererLocalSurfaceIdProvider : public viz::LocalSurfaceIdProvider { public: - const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame( + const viz::LocalSurfaceId& GetLocalSurfaceIdForFrame( const cc::CompositorFrame& frame) override { auto new_surface_properties = RenderWidgetSurfaceProperties::FromCompositorFrame(frame); @@ -438,8 +438,8 @@ } private: - cc::LocalSurfaceIdAllocator local_surface_id_allocator_; - cc::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceIdAllocator local_surface_id_allocator_; + viz::LocalSurfaceId local_surface_id_; RenderWidgetSurfaceProperties surface_properties_; }; @@ -763,7 +763,7 @@ registry->AddInterface(base::Bind(&CreateFrameFactory), base::ThreadTaskRunnerHandle::Get()); registry->AddInterface(base::Bind(&EmbeddedWorkerInstanceClientImpl::Create, - base::TimeTicks::Now()), + base::TimeTicks::Now(), GetIOTaskRunner()), base::ThreadTaskRunnerHandle::Get()); GetServiceManagerConnection()->AddConnectionFilter( base::MakeUnique<SimpleConnectionFilter>(std::move(registry)));
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 7c43924..8cc8e86 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -1336,7 +1336,7 @@ StartCompositor(); DCHECK_NE(MSG_ROUTING_NONE, routing_id_); compositor_->SetFrameSinkId( - cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); + viz::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); RenderThreadImpl* render_thread = RenderThreadImpl::current(); // render_thread may be NULL in tests.
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index c9c67df4..fe42f62 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -24,7 +24,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "cc/input/touch_action.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "content/common/content_export.h" #include "content/common/cursors/webcursor.h" #include "content/common/drag_event_source_info.h" @@ -898,7 +898,7 @@ // to replace it. See https://crbug.com/695579. uint32_t current_content_source_id_; - cc::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceId local_surface_id_; scoped_refptr<MainThreadEventQueue> input_event_queue_;
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 5bce20b..f4cf148 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -647,9 +647,9 @@ storage::GetIdentifierFromOrigin(WebSecurityOriginToGURL(origin))); } -cc::FrameSinkId RendererBlinkPlatformImpl::GenerateFrameSinkId() { - return cc::FrameSinkId(RenderThread::Get()->GetClientId(), - RenderThread::Get()->GenerateRoutingID()); +viz::FrameSinkId RendererBlinkPlatformImpl::GenerateFrameSinkId() { + return viz::FrameSinkId(RenderThread::Get()->GetClientId(), + RenderThread::Get()->GenerateRoutingID()); } bool RendererBlinkPlatformImpl::IsThreadedCompositingEnabled() {
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h index 33f26240..0ca8faf4 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h
@@ -122,7 +122,7 @@ long long size) override; blink::WebString DatabaseCreateOriginIdentifier( const blink::WebSecurityOrigin& origin) override; - cc::FrameSinkId GenerateFrameSinkId() override; + viz::FrameSinkId GenerateFrameSinkId() override; void GetPluginList(bool refresh, const blink::WebSecurityOrigin& mainFrameOrigin,
diff --git a/content/renderer/renderer_main_platform_delegate_android.cc b/content/renderer/renderer_main_platform_delegate_android.cc index ffcb0a7d..dc0ff56e 100644 --- a/content/renderer/renderer_main_platform_delegate_android.cc +++ b/content/renderer/renderer_main_platform_delegate_android.cc
@@ -4,75 +4,19 @@ #include "content/renderer/renderer_main_platform_delegate.h" -#include <signal.h> - #include "base/android/build_info.h" -#include "base/logging.h" -#include "base/macros.h" #include "base/metrics/histogram_macros.h" -#include "content/public/renderer/seccomp_sandbox_status_android.h" +#include "content/renderer/seccomp_sandbox_status_android.h" +#include "sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h" #include "sandbox/sandbox_features.h" #if BUILDFLAG(USE_SECCOMP_BPF) -#include "content/renderer/seccomp_sandbox_status_android.h" +#include "base/memory/ptr_util.h" #include "sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.h" -#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" #endif namespace content { -namespace { - -// Scoper class to record a SeccompSandboxStatus UMA value. -class RecordSeccompStatus { - public: - RecordSeccompStatus() { - SetSeccompSandboxStatus(SeccompSandboxStatus::NOT_SUPPORTED); - } - - ~RecordSeccompStatus() { - UMA_HISTOGRAM_ENUMERATION("Android.SeccompStatus.RendererSandbox", - GetSeccompSandboxStatus(), - SeccompSandboxStatus::STATUS_MAX); - } - - void set_status(SeccompSandboxStatus status) { - SetSeccompSandboxStatus(status); - } - - private: - DISALLOW_COPY_AND_ASSIGN(RecordSeccompStatus); -}; - -#if BUILDFLAG(USE_SECCOMP_BPF) -// Determines if the running device should support Seccomp, based on the Android -// SDK version. -bool IsSeccompBPFSupportedBySDK(const base::android::BuildInfo* info) { - if (info->sdk_int() < 22) { - // Seccomp was never available pre-Lollipop. - return false; - } else if (info->sdk_int() == 22) { - // On Lollipop-MR1, only select Nexus devices have Seccomp available. - const char* const kDevices[] = { - "deb", "flo", "hammerhead", "mako", - "manta", "shamu", "sprout", "volantis", - }; - - for (auto* device : kDevices) { - if (strcmp(device, info->device()) == 0) { - return true; - } - } - } else { - // On Marshmallow and higher, Seccomp is required by CTS. - return true; - } - return false; -} -#endif // USE_SECCOMP_BPF - -} // namespace - RendererMainPlatformDelegate::RendererMainPlatformDelegate( const MainFunctionParams& parameters) {} @@ -86,41 +30,19 @@ } bool RendererMainPlatformDelegate::EnableSandbox() { - RecordSeccompStatus status_uma; - -#if BUILDFLAG(USE_SECCOMP_BPF) auto* info = base::android::BuildInfo::GetInstance(); - - // Determine if Seccomp is available via the Android SDK version. - if (!IsSeccompBPFSupportedBySDK(info)) - return true; - - // Do run-time detection to ensure that support is present. - if (!sandbox::SandboxBPF::SupportsSeccompSandbox( - sandbox::SandboxBPF::SeccompLevel::MULTI_THREADED)) { - status_uma.set_status(SeccompSandboxStatus::DETECTION_FAILED); - LOG(WARNING) << "Seccomp support should be present, but detection " - << "failed. Continuing without Seccomp-BPF."; - return true; - } - - sig_t old_handler = signal(SIGSYS, SIG_DFL); - if (old_handler != SIG_DFL) { - // On Android O and later, the zygote applies a seccomp filter to all - // apps. It has its own SIGSYS handler that must be un-hooked so that - // the Chromium one can be used instead. If pre-O devices have a SIGSYS - // handler, then warn about that. - DLOG_IF(WARNING, info->sdk_int() < 26) - << "Un-hooking existing SIGSYS handler before starting " - << "Seccomp sandbox"; - } - - sandbox::SandboxBPF sandbox(new sandbox::BaselinePolicyAndroid()); - CHECK( - sandbox.StartSandbox(sandbox::SandboxBPF::SeccompLevel::MULTI_THREADED)); - - status_uma.set_status(SeccompSandboxStatus::ENGAGED); + sandbox::SeccompStarterAndroid starter(info->sdk_int(), info->device()); + // The policy compiler is only available if USE_SECCOMP_BPF is enabled. +#if BUILDFLAG(USE_SECCOMP_BPF) + starter.set_policy(base::MakeUnique<sandbox::BaselinePolicyAndroid>()); #endif + starter.StartSandbox(); + + SetSeccompSandboxStatus(starter.status()); + UMA_HISTOGRAM_ENUMERATION("Android.SeccompStatus.RendererSandbox", + starter.status(), + sandbox::SeccompSandboxStatus::STATUS_MAX); + return true; }
diff --git a/content/renderer/renderer_v2.sb b/content/renderer/renderer_v2.sb index 94745d8..c760822 100644 --- a/content/renderer/renderer_v2.sb +++ b/content/renderer/renderer_v2.sb
@@ -12,20 +12,18 @@ (define (param-defined? str) (string? (param str))) ; Define constants for all of the parameter strings passed in. +(define browser-pid "BROWSER_PID") +(define bundle-id "BUNDLE_ID") +(define bundle-path "BUNDLE_PATH") +(define component-path "COMPONENT_PATH") +(define current-pid "CURRENT_PID") (define disable-sandbox-denial-logging "DISABLE_SANDBOX_DENIAL_LOGGING") (define enable-logging "ENABLE_LOGGING") -(define homedir-as-literal "USER_HOMEDIR_AS_LITERAL") -(define bundle-path "BUNDLE_PATH") (define executable-path "EXECUTABLE_PATH") -(define chromium-pid "CHROMIUM_PID") +(define homedir-as-literal "USER_HOMEDIR_AS_LITERAL") (define log-file-path "LOG_FILE_PATH") -(define bundle-id "BUNDLE_ID") -(define component-path "COMPONENT_PATH") (define os-version (string->number (param "OS_VERSION"))) -; OS Version numbers -(define mavericks 1009) - ; Backwards compatibility for 10.9 (if (not (defined? 'path)) (define path literal)) @@ -58,7 +56,7 @@ (allow mach-lookup (global-name (string-append (param bundle-id) ".rohitfork." - (param chromium-pid)))) + (param browser-pid)))) ; Allow realpath() to work. (allow file-read-metadata (subpath "/")) @@ -76,7 +74,7 @@ (allow file-read-data (path (user-homedir-path "/.CFUserTextEncoding"))) ; Reads of /dev devices. -(allow file-read-data +(allow file-read-data (path "/dev/autofs_nowait") (path "/dev/fd") (path "/dev/null") @@ -130,11 +128,11 @@ (global-name "com.apple.windowserver.active")) ; MacOS dropped FontServer to replace it with the (XPC based) com.apple.fonts. -(if (= os-version mavericks) +(if (< os-version 1010) (allow mach-lookup (global-name "com.apple.FontServer"))) ; sysctl -(if (= os-version mavericks) +(if (= os-version 1009) (allow sysctl-read) ; else (allow sysctl-read @@ -155,4 +153,6 @@ (sysctl-name "kern.osrelease") (sysctl-name "kern.ostype") (sysctl-name "kern.osversion") + (sysctl-name (string-append "kern.proc.pid." (param current-pid))) + (sysctl-name "kern.usrstack64") (sysctl-name "kern.version")))
diff --git a/content/renderer/seccomp_sandbox_status_android.cc b/content/renderer/seccomp_sandbox_status_android.cc index 34cb7bb92f..c0a25b9f 100644 --- a/content/renderer/seccomp_sandbox_status_android.cc +++ b/content/renderer/seccomp_sandbox_status_android.cc
@@ -4,15 +4,18 @@ #include "content/renderer/seccomp_sandbox_status_android.h" +#include "content/public/renderer/seccomp_sandbox_status_android.h" + namespace content { -static SeccompSandboxStatus g_status = SeccompSandboxStatus::NOT_SUPPORTED; +static sandbox::SeccompSandboxStatus g_status = + sandbox::SeccompSandboxStatus::NOT_SUPPORTED; -void SetSeccompSandboxStatus(SeccompSandboxStatus status) { +void SetSeccompSandboxStatus(sandbox::SeccompSandboxStatus status) { g_status = status; } -SeccompSandboxStatus GetSeccompSandboxStatus() { +sandbox::SeccompSandboxStatus GetSeccompSandboxStatus() { return g_status; }
diff --git a/content/renderer/seccomp_sandbox_status_android.h b/content/renderer/seccomp_sandbox_status_android.h index 044f2c4..66408f6 100644 --- a/content/renderer/seccomp_sandbox_status_android.h +++ b/content/renderer/seccomp_sandbox_status_android.h
@@ -5,11 +5,11 @@ #ifndef CONTENT_RENDERER_SECCOMP_SANDBOX_STATUS_ANDROID_H_ #define CONTENT_RENDERER_SECCOMP_SANDBOX_STATUS_ANDROID_H_ -#include "content/public/renderer/seccomp_sandbox_status_android.h" +#include "sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h" namespace content { -void SetSeccompSandboxStatus(SeccompSandboxStatus status); +void SetSeccompSandboxStatus(sandbox::SeccompSandboxStatus status); } // namespace content
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc index d513426..7ab4e30 100644 --- a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc +++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
@@ -35,11 +35,13 @@ // static void EmbeddedWorkerInstanceClientImpl::Create( base::TimeTicks blink_initialized_time, + scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner, const service_manager::BindSourceInfo& source_info, mojom::EmbeddedWorkerInstanceClientRequest request) { // This won't be leaked because the lifetime will be managed internally. EmbeddedWorkerInstanceClientImpl* client = - new EmbeddedWorkerInstanceClientImpl(std::move(request)); + new EmbeddedWorkerInstanceClientImpl(std::move(io_thread_runner), + std::move(request)); client->blink_initialized_time_ = blink_initialized_time; } @@ -54,6 +56,7 @@ void EmbeddedWorkerInstanceClientImpl::StartWorker( const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { DCHECK(ChildThreadImpl::current()); DCHECK(!wrapper_); @@ -66,7 +69,8 @@ std::move(instance_host), std::move(temporal_self_)); client->set_blink_initialized_time(blink_initialized_time_); client->set_start_worker_received_time(base::TimeTicks::Now()); - wrapper_ = StartWorkerContext(params, std::move(client)); + wrapper_ = StartWorkerContext(params, std::move(installed_scripts_info), + std::move(client)); } void EmbeddedWorkerInstanceClientImpl::StopWorker() { @@ -94,8 +98,11 @@ } EmbeddedWorkerInstanceClientImpl::EmbeddedWorkerInstanceClientImpl( + scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner, mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request) - : binding_(this, std::move(request)), temporal_self_(this) { + : binding_(this, std::move(request)), + temporal_self_(this), + io_thread_runner_(std::move(io_thread_runner)) { binding_.set_connection_error_handler(base::Bind( &EmbeddedWorkerInstanceClientImpl::OnError, base::Unretained(this))); } @@ -110,10 +117,14 @@ std::unique_ptr<EmbeddedWorkerInstanceClientImpl::WorkerWrapper> EmbeddedWorkerInstanceClientImpl::StartWorkerContext( const EmbeddedWorkerStartParams& params, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, std::unique_ptr<ServiceWorkerContextClient> context_client) { std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> manager; - if (ServiceWorkerUtils::IsScriptStreamingEnabled()) - manager = WebServiceWorkerInstalledScriptsManagerImpl::Create(); + if (ServiceWorkerUtils::IsScriptStreamingEnabled()) { + DCHECK(installed_scripts_info); + manager = WebServiceWorkerInstalledScriptsManagerImpl::Create( + std::move(installed_scripts_info), io_thread_runner_); + } auto wrapper = base::MakeUnique<WorkerWrapper>( blink::WebEmbeddedWorker::Create(std::move(context_client),
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.h b/content/renderer/service_worker/embedded_worker_instance_client_impl.h index 2b09cdbd..14d932a6c 100644 --- a/content/renderer/service_worker/embedded_worker_instance_client_impl.h +++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
@@ -33,9 +33,11 @@ class EmbeddedWorkerInstanceClientImpl : public mojom::EmbeddedWorkerInstanceClient { public: - static void Create(base::TimeTicks blink_initialized_time, - const service_manager::BindSourceInfo& source_info, - mojom::EmbeddedWorkerInstanceClientRequest request); + static void Create( + base::TimeTicks blink_initialized_time, + scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner, + const service_manager::BindSourceInfo& source_info, + mojom::EmbeddedWorkerInstanceClientRequest request); ~EmbeddedWorkerInstanceClientImpl() override; @@ -66,12 +68,14 @@ }; EmbeddedWorkerInstanceClientImpl( + scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner, mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request); // mojom::EmbeddedWorkerInstanceClient implementation void StartWorker( const EmbeddedWorkerStartParams& params, mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) override; void StopWorker() override; @@ -84,6 +88,7 @@ std::unique_ptr<WorkerWrapper> StartWorkerContext( const EmbeddedWorkerStartParams& params, + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, std::unique_ptr<ServiceWorkerContextClient> context_client); mojo::Binding<mojom::EmbeddedWorkerInstanceClient> binding_; @@ -98,6 +103,8 @@ // For UMA. base::TimeTicks blink_initialized_time_; + scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner_; + DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstanceClientImpl); };
diff --git a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc index d69666d..3c81f07 100644 --- a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc +++ b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc
@@ -6,18 +6,50 @@ #include "base/memory/ptr_util.h" #include "base/stl_util.h" +#include "mojo/public/cpp/bindings/strong_binding.h" namespace content { +namespace { + +// Internal lives on the IO thread. This receives mojom::ServiceWorkerScriptInfo +// for all installed scripts and then starts reading the body and meta data from +// the browser. This instance will be kept alive as long as the Mojo's +// connection is established. +class Internal : public mojom::ServiceWorkerInstalledScriptsManager { + public: + // Called on the IO thread. + // Creates and binds a new Internal instance to |request|. + static void Create( + mojom::ServiceWorkerInstalledScriptsManagerRequest request) { + mojo::MakeStrongBinding(base::MakeUnique<Internal>(), std::move(request)); + } + + // Implements mojom::ServiceWorkerInstalledScriptsManager. + // Called on the IO thread. + void TransferInstalledScript( + mojom::ServiceWorkerScriptInfoPtr script_info) override {} +}; + +} // namespace + // static std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> -WebServiceWorkerInstalledScriptsManagerImpl::Create() { - // TODO(shimazu): Pass |installed_urls| from the browser. - std::vector<GURL> installed_urls; - // TODO(shimazu): Create and bind a mojom interface on the io thread. - return base::WrapUnique<WebServiceWorkerInstalledScriptsManagerImpl>( - new WebServiceWorkerInstalledScriptsManagerImpl( - std::move(installed_urls))); +WebServiceWorkerInstalledScriptsManagerImpl::Create( + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { + auto installed_scripts_manager = + base::WrapUnique<WebServiceWorkerInstalledScriptsManagerImpl>( + new WebServiceWorkerInstalledScriptsManagerImpl( + std::move(installed_scripts_info->installed_urls))); + // TODO(shimazu): Implement a container class which is shared among + // WebServiceWorkerInstalledScriptsManagerImpl and Internal to pass the data + // between the IO thread and the worker thread. + io_task_runner->PostTask( + FROM_HERE, + base::BindOnce(&Internal::Create, + std::move(installed_scripts_info->manager_request))); + return installed_scripts_manager; } WebServiceWorkerInstalledScriptsManagerImpl::
diff --git a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.h b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.h index 339a8ff..3632c68 100644 --- a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.h +++ b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.h
@@ -7,6 +7,7 @@ #include <set> +#include "content/common/service_worker/service_worker_installed_scripts_manager.mojom.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerInstalledScriptsManager.h" namespace content { @@ -14,8 +15,10 @@ class WebServiceWorkerInstalledScriptsManagerImpl final : NON_EXPORTED_BASE(public blink::WebServiceWorkerInstalledScriptsManager) { public: - static std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> - Create(); + // Called on the main thread. + static std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> Create( + mojom::ServiceWorkerInstalledScriptsInfoPtr installed_scripts_info, + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); ~WebServiceWorkerInstalledScriptsManagerImpl() override;
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java index a4bfd3fa9..152b48a 100644 --- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java +++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java
@@ -18,9 +18,9 @@ import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.process_launcher.FileDescriptorInfo; -import org.chromium.content.browser.ChildProcessConnection; import org.chromium.content.browser.ChildProcessLauncherHelper; /**
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java index 3cc80ad7..54f196f1 100644 --- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java +++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java
@@ -4,10 +4,10 @@ package org.chromium.content_shell_apk; +import org.chromium.base.process_launcher.ChildProcessConnection; import org.chromium.base.process_launcher.ChildProcessCreationParams; import org.chromium.base.process_launcher.FileDescriptorInfo; import org.chromium.base.process_launcher.IChildProcessService; -import org.chromium.content.browser.ChildProcessConnection; import org.chromium.content.browser.ChildProcessLauncherHelper; import org.chromium.content.browser.LauncherThread;
diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc index 7dd9ff9..f733a47e 100644 --- a/content/shell/app/shell_main_delegate.cc +++ b/content/shell/app/shell_main_delegate.cc
@@ -45,7 +45,6 @@ #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" #include "ui/display/display_switches.h" -#include "ui/gfx/color_space_switches.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_switches.h"
diff --git a/content/shell/browser/shell_net_log.cc b/content/shell/browser/shell_net_log.cc index aebbc092e..9d9e5565 100644 --- a/content/shell/browser/shell_net_log.cc +++ b/content/shell/browser/shell_net_log.cc
@@ -8,15 +8,15 @@ #include <utility> +#include "base/bind.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/files/scoped_file.h" #include "base/memory/ptr_util.h" #include "base/values.h" #include "build/build_config.h" #include "content/public/common/content_switches.h" +#include "net/log/file_net_log_observer.h" #include "net/log/net_log_util.h" -#include "net/log/write_to_file_net_log_observer.h" namespace content { @@ -43,43 +43,24 @@ } // namespace ShellNetLog::ShellNetLog(const std::string& app_name) { - // TODO(mmenke): Other than a different set of constants, this code is - // identical to code in ChromeNetLog. Consider merging the code. const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kLogNetLog)) { base::FilePath log_path = command_line->GetSwitchValuePath(switches::kLogNetLog); - // Much like logging.h, bypass threading restrictions by using fopen - // directly. Have to write on a thread that's shutdown to handle events on - // shutdown properly, and posting events to another thread as they occur - // would result in an unbounded buffer size, so not much can be gained by - // doing this on another thread. It's only used when debugging, so - // performance is not a big concern. - base::ScopedFILE file; -#if defined(OS_WIN) - file.reset(_wfopen(log_path.value().c_str(), L"w")); -#elif defined(OS_POSIX) - file.reset(fopen(log_path.value().c_str(), "w")); -#endif + net::NetLogCaptureMode capture_mode = net::NetLogCaptureMode::Default(); - if (!file) { - LOG(ERROR) << "Could not open file " << log_path.value() - << " for net logging"; - } else { - std::unique_ptr<base::Value> constants(GetShellConstants(app_name)); - write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); - write_to_file_observer_->StartObserving(this, std::move(file), - constants.get(), nullptr); - } + file_net_log_observer_ = net::FileNetLogObserver::CreateUnbounded( + log_path, GetShellConstants(app_name)); + file_net_log_observer_->StartObserving(this, capture_mode); } } ShellNetLog::~ShellNetLog() { // Remove the observer we own before we're destroyed. - if (write_to_file_observer_) - write_to_file_observer_->StopObserving(nullptr); + if (file_net_log_observer_) + file_net_log_observer_->StopObserving(nullptr, base::OnceClosure()); } } // namespace content
diff --git a/content/shell/browser/shell_net_log.h b/content/shell/browser/shell_net_log.h index 3f4cf87..13ac91b 100644 --- a/content/shell/browser/shell_net_log.h +++ b/content/shell/browser/shell_net_log.h
@@ -9,7 +9,11 @@ #include <string> #include "base/macros.h" -#include "net/log/write_to_file_net_log_observer.h" +#include "net/log/net_log.h" + +namespace net { +class FileNetLogObserver; +} namespace content { @@ -19,7 +23,7 @@ ~ShellNetLog() override; private: - std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; + std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_; DISALLOW_COPY_AND_ASSIGN(ShellNetLog); };
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index a612ebb..39c1e32d 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -923,8 +923,13 @@ interfaces->TestRunner()->ShouldGeneratePixelResults() && !interfaces->TestRunner()->ShouldDumpAsAudio()) { CHECK(render_view()->GetWebView()->IsAcceleratedCompositingActive()); + + // Test finish should only be processed in the BlinkTestRunner associated + // with the current, non-swapped-out RenderView. + DCHECK(render_view()->GetWebView()->MainFrame()->IsWebLocalFrame()); + interfaces->TestRunner()->DumpPixelsAsync( - render_view()->GetWebView(), + render_view()->GetWebView()->MainFrame()->ToWebLocalFrame(), base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted, base::Unretained(this))); return;
diff --git a/content/shell/test_runner/BUILD.gn b/content/shell/test_runner/BUILD.gn index ac15a4027..3882209 100644 --- a/content/shell/test_runner/BUILD.gn +++ b/content/shell/test_runner/BUILD.gn
@@ -113,6 +113,7 @@ "//cc", "//cc/blink", "//cc/paint", + "//components/viz/common", "//content/public/common", "//content/test:test_runner_support", "//device/gamepad/public/cpp:shared_with_blink",
diff --git a/content/shell/test_runner/pixel_dump.cc b/content/shell/test_runner/pixel_dump.cc index fe3459b..43f4a71 100644 --- a/content/shell/test_runner/pixel_dump.cc +++ b/content/shell/test_runner/pixel_dump.cc
@@ -24,33 +24,19 @@ #include "third_party/WebKit/public/platform/WebMockClipboard.h" #include "third_party/WebKit/public/platform/WebPoint.h" #include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebFrameWidget.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebPagePopup.h" #include "third_party/WebKit/public/web/WebPrintParams.h" -#include "third_party/WebKit/public/web/WebView.h" #include "ui/gfx/geometry/point.h" namespace test_runner { namespace { -struct PixelsDumpRequest { - PixelsDumpRequest(blink::WebView* web_view, - const LayoutTestRuntimeFlags& layout_test_runtime_flags, - const base::Callback<void(const SkBitmap&)>& callback) - : web_view(web_view), - layout_test_runtime_flags(layout_test_runtime_flags), - callback(callback) {} - - blink::WebView* web_view; - const LayoutTestRuntimeFlags& layout_test_runtime_flags; - base::Callback<void(const SkBitmap&)> callback; -}; - class CaptureCallback : public blink::WebCompositeAndReadbackAsyncCallback { public: - explicit CaptureCallback( - const base::Callback<void(const SkBitmap&)>& callback); + explicit CaptureCallback(base::OnceCallback<void(const SkBitmap&)> callback); virtual ~CaptureCallback(); void set_wait_for_popup(bool wait) { wait_for_popup_ = wait; } @@ -62,32 +48,18 @@ void DidCompositeAndReadback(const SkBitmap& bitmap) override; private: - base::Callback<void(const SkBitmap&)> callback_; + base::OnceCallback<void(const SkBitmap&)> callback_; SkBitmap main_bitmap_; bool wait_for_popup_; gfx::Point popup_position_; }; -void DrawSelectionRect(const PixelsDumpRequest& dump_request, - cc::PaintCanvas* canvas) { - // See if we need to draw the selection bounds rect. Selection bounds - // rect is the rect enclosing the (possibly transformed) selection. - // The rect should be drawn after everything is laid out and painted. - if (!dump_request.layout_test_runtime_flags.dump_selection_rect()) - return; - - // TODO(lukasza): https://crbug.com/667551: Support OOPIFs in pixel dumps. - CHECK(dump_request.web_view->MainFrame()->IsWebLocalFrame()) - << "This function cannot be called if the main frame is not a " - "local frame."; - - // If there is a selection rect - draw a red 1px border enclosing rect - blink::WebRect wr = dump_request.web_view->MainFrame() - ->ToWebLocalFrame() - ->GetSelectionBoundsRectForTesting(); - if (wr.IsEmpty()) - return; +void DrawSelectionRect( + const blink::WebRect& wr, + base::OnceCallback<void(const SkBitmap&)> original_callback, + const SkBitmap& bitmap) { // Render a red rectangle bounding selection rect + cc::SkiaPaintCanvas canvas(bitmap); cc::PaintFlags flags; flags.setColor(0xFFFF0000); // Fully opaque red flags.setStyle(cc::PaintFlags::kStroke_Style); @@ -95,20 +67,17 @@ flags.setStrokeWidth(1.0f); SkIRect rect; // Bounding rect rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height); - canvas->drawIRect(rect, flags); + canvas.drawIRect(rect, flags); + + std::move(original_callback).Run(bitmap); } -void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) { - dump_request->web_view->UpdateAllLifecyclePhases(); +void CapturePixelsForPrinting( + blink::WebLocalFrame* web_frame, + base::OnceCallback<void(const SkBitmap&)> callback) { + web_frame->FrameWidget()->UpdateAllLifecyclePhases(); - blink::WebSize page_size_in_pixels = dump_request->web_view->Size(); - - // TODO(lukasza): https://crbug.com/667551: Support OOPIFs in pixel dumps. - CHECK(dump_request->web_view->MainFrame()->IsWebLocalFrame()) - << "This function cannot be called if the main frame is not a " - "local frame."; - blink::WebLocalFrame* web_frame = - dump_request->web_view->MainFrame()->ToWebLocalFrame(); + blink::WebSize page_size_in_pixels = web_frame->FrameWidget()->Size(); int page_count = web_frame->PrintBegin(page_size_in_pixels); int totalHeight = page_count * (page_size_in_pixels.height + 1) - 1; @@ -120,7 +89,7 @@ is_opaque)) { LOG(ERROR) << "Failed to create bitmap width=" << page_size_in_pixels.width << " height=" << totalHeight; - dump_request->callback.Run(SkBitmap()); + std::move(callback).Run(SkBitmap()); return; } @@ -128,13 +97,12 @@ web_frame->PrintPagesForTesting(&canvas, page_size_in_pixels); web_frame->PrintEnd(); - DrawSelectionRect(*dump_request, &canvas); - dump_request->callback.Run(bitmap); + std::move(callback).Run(bitmap); } CaptureCallback::CaptureCallback( - const base::Callback<void(const SkBitmap&)>& callback) - : callback_(callback), wait_for_popup_(false) {} + base::OnceCallback<void(const SkBitmap&)> callback) + : callback_(std::move(callback)), wait_for_popup_(false) {} CaptureCallback::~CaptureCallback() {} @@ -142,7 +110,7 @@ TRACE_EVENT2("shell", "CaptureCallback::didCompositeAndReadback", "x", bitmap.info().width(), "y", bitmap.info().height()); if (!wait_for_popup_) { - callback_.Run(bitmap); + std::move(callback_).Run(bitmap); delete this; return; } @@ -155,42 +123,23 @@ } SkCanvas canvas(main_bitmap_); canvas.drawBitmap(bitmap, popup_position_.x(), popup_position_.y()); - callback_.Run(main_bitmap_); + std::move(callback_).Run(main_bitmap_); delete this; } -void DidCapturePixelsAsync(std::unique_ptr<PixelsDumpRequest> dump_request, - const SkBitmap& bitmap) { - cc::SkiaPaintCanvas canvas(bitmap); - DrawSelectionRect(*dump_request, &canvas); - if (!dump_request->callback.is_null()) - dump_request->callback.Run(bitmap); -} - } // namespace -void DumpPixelsAsync(blink::WebView* web_view, - const LayoutTestRuntimeFlags& layout_test_runtime_flags, +void DumpPixelsAsync(blink::WebLocalFrame* web_frame, float device_scale_factor_for_test, - const base::Callback<void(const SkBitmap&)>& callback) { - TRACE_EVENT0("shell", "WebViewTestProxyBase::CapturePixelsAsync"); + base::OnceCallback<void(const SkBitmap&)> callback) { + DCHECK(web_frame); + DCHECK_LT(0.0, device_scale_factor_for_test); DCHECK(!callback.is_null()); - DCHECK(!layout_test_runtime_flags.dump_drag_image()); - std::unique_ptr<PixelsDumpRequest> pixels_request( - new PixelsDumpRequest(web_view, layout_test_runtime_flags, callback)); - - if (layout_test_runtime_flags.is_printing()) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&CapturePixelsForPrinting, - base::Passed(std::move(pixels_request)))); - return; - } - - CaptureCallback* capture_callback = new CaptureCallback(base::Bind( - &DidCapturePixelsAsync, base::Passed(std::move(pixels_request)))); - web_view->CompositeAndReadbackAsync(capture_callback); - if (blink::WebPagePopup* popup = web_view->GetPagePopup()) { + blink::WebWidget* web_widget = web_frame->FrameWidget(); + CaptureCallback* capture_callback = new CaptureCallback(std::move(callback)); + web_widget->CompositeAndReadbackAsync(capture_callback); + if (blink::WebPagePopup* popup = web_widget->GetPagePopup()) { capture_callback->set_wait_for_popup(true); blink::WebPoint position = popup->PositionRelativeToOwner(); position.x *= device_scale_factor_for_test; @@ -200,30 +149,54 @@ } } +void PrintFrameAsync(blink::WebLocalFrame* web_frame, + base::OnceCallback<void(const SkBitmap&)> callback) { + DCHECK(web_frame); + DCHECK(!callback.is_null()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&CapturePixelsForPrinting, base::Unretained(web_frame), + base::Passed(std::move(callback)))); +} + +base::OnceCallback<void(const SkBitmap&)> +CreateSelectionBoundsRectDrawingCallback( + blink::WebLocalFrame* web_frame, + base::OnceCallback<void(const SkBitmap&)> original_callback) { + DCHECK(web_frame); + DCHECK(!original_callback.is_null()); + + // If there is no selection rect, just return the original callback. + blink::WebRect wr = web_frame->GetSelectionBoundsRectForTesting(); + if (wr.IsEmpty()) + return original_callback; + + return base::Bind(&DrawSelectionRect, wr, + base::Passed(std::move(original_callback))); +} + void CopyImageAtAndCapturePixels( - blink::WebView* web_view, + blink::WebLocalFrame* web_frame, int x, int y, - const base::Callback<void(const SkBitmap&)>& callback) { + base::OnceCallback<void(const SkBitmap&)> callback) { DCHECK(!callback.is_null()); uint64_t sequence_number = blink::Platform::Current()->Clipboard()->SequenceNumber( blink::WebClipboard::Buffer()); - // TODO(lukasza): Support image capture in OOPIFs for - // https://crbug.com/477150. - web_view->MainFrame()->ToWebLocalFrame()->CopyImageAt(blink::WebPoint(x, y)); + web_frame->CopyImageAt(blink::WebPoint(x, y)); if (sequence_number == blink::Platform::Current()->Clipboard()->SequenceNumber( blink::WebClipboard::Buffer())) { SkBitmap emptyBitmap; - callback.Run(emptyBitmap); + std::move(callback).Run(emptyBitmap); return; } blink::WebImage image = static_cast<blink::WebMockClipboard*>( blink::Platform::Current()->Clipboard()) ->ReadRawImage(blink::WebClipboard::Buffer()); - callback.Run(image.GetSkBitmap()); + std::move(callback).Run(image.GetSkBitmap()); } } // namespace test_runner
diff --git a/content/shell/test_runner/pixel_dump.h b/content/shell/test_runner/pixel_dump.h index a6c0a8a..9a2edb9 100644 --- a/content/shell/test_runner/pixel_dump.h +++ b/content/shell/test_runner/pixel_dump.h
@@ -6,34 +6,43 @@ #define CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ #include "base/callback_forward.h" -#include "content/shell/test_runner/test_runner_export.h" class SkBitmap; namespace blink { -class WebView; +class WebLocalFrame; } // namespace blink namespace test_runner { -class LayoutTestRuntimeFlags; +// Asks |web_frame|'s widget to dump its pixels and calls |callback| with the +// result. +void DumpPixelsAsync(blink::WebLocalFrame* web_frame, + float device_scale_factor_for_test, + base::OnceCallback<void(const SkBitmap&)> callback); -// Dumps image snapshot of |web_view|. Exact dump mode depends on |flags| (i.e. -// dump_selection_rect and/or is_printing). Caller needs to ensure that -// |layout_test_runtime_flags| stays alive until |callback| gets called. -TEST_RUNNER_EXPORT void DumpPixelsAsync( - blink::WebView* web_view, - const LayoutTestRuntimeFlags& layout_test_runtime_flags, - float device_scale_factor_for_test, - const base::Callback<void(const SkBitmap&)>& callback); +// Asks |web_frame| to print itself and calls |callback| with the result. +void PrintFrameAsync(blink::WebLocalFrame* web_frame, + base::OnceCallback<void(const SkBitmap&)> callback); -// Copy to clipboard the image present at |x|, |y| coordinates in |web_view| +// Captures the current selection bounds rect of |web_frame| and creates a +// callback that will draw the rect (if any) on top of the |original_bitmap|, +// before passing |bitmap_with_selection_bounds_rect| to the +// |original_callback|. Selection bounds rect is the rect enclosing the +// (possibly transformed) selection. +base::OnceCallback<void(const SkBitmap& original_bitmap)> +CreateSelectionBoundsRectDrawingCallback( + blink::WebLocalFrame* web_frame, + base::OnceCallback<void(const SkBitmap& bitmap_with_selection_bounds_rect)> + original_callback); + +// Copy to clipboard the image present at |x|, |y| coordinates in |web_frame| // and pass the captured image to |callback|. void CopyImageAtAndCapturePixels( - blink::WebView* web_view, + blink::WebLocalFrame* web_frame, int x, int y, - const base::Callback<void(const SkBitmap&)>& callback); + base::OnceCallback<void(const SkBitmap&)> callback); } // namespace test_runner
diff --git a/content/shell/test_runner/test_plugin.cc b/content/shell/test_runner/test_plugin.cc index f0850bb..37861ff 100644 --- a/content/shell/test_runner/test_plugin.cc +++ b/content/shell/test_runner/test_plugin.cc
@@ -241,7 +241,7 @@ rect_ = clip_rect; if (rect_.IsEmpty()) { - texture_mailbox_ = cc::TextureMailbox(); + texture_mailbox_ = viz::TextureMailbox(); } else if (gl_) { gl_->Viewport(0, 0, rect_.width, rect_.height); @@ -266,16 +266,16 @@ gpu::SyncToken sync_token; gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); - texture_mailbox_ = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); + texture_mailbox_ = viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); } else { std::unique_ptr<viz::SharedBitmap> bitmap = delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( gfx::Rect(rect_).size()); if (!bitmap) { - texture_mailbox_ = cc::TextureMailbox(); + texture_mailbox_ = viz::TextureMailbox(); } else { DrawSceneSoftware(bitmap->pixels()); - texture_mailbox_ = cc::TextureMailbox( + texture_mailbox_ = viz::TextureMailbox( bitmap.get(), gfx::Size(rect_.width, rect_.height)); shared_bitmap_ = std::move(bitmap); } @@ -297,7 +297,7 @@ bool lost) {} bool TestPlugin::PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) { if (!mailbox_changed_) return false;
diff --git a/content/shell/test_runner/test_plugin.h b/content/shell/test_runner/test_plugin.h index 5a209c2..d7faa7a 100644 --- a/content/shell/test_runner/test_plugin.h +++ b/content/shell/test_runner/test_plugin.h
@@ -91,7 +91,7 @@ // cc::TextureLayerClient methods: bool PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) override; private: @@ -150,7 +150,7 @@ std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_; gpu::gles2::GLES2Interface* gl_; GLuint color_texture_; - cc::TextureMailbox texture_mailbox_; + viz::TextureMailbox texture_mailbox_; std::unique_ptr<viz::SharedBitmap> shared_bitmap_; bool mailbox_changed_; GLuint framebuffer_;
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc index 3bc41601..e270fd72 100644 --- a/content/shell/test_runner/test_runner.cc +++ b/content/shell/test_runner/test_runner.cc
@@ -1768,8 +1768,8 @@ } void TestRunner::DumpPixelsAsync( - blink::WebView* web_view, - const base::Callback<void(const SkBitmap&)>& callback) { + blink::WebLocalFrame* frame, + base::OnceCallback<void(const SkBitmap&)> callback) { if (layout_test_runtime_flags_.dump_drag_image()) { if (drag_image_.IsNull()) { // This means the test called dumpDragImage but did not initiate a drag. @@ -1777,16 +1777,29 @@ SkBitmap bitmap; bitmap.allocN32Pixels(1, 1); bitmap.eraseColor(0); - callback.Run(bitmap); + std::move(callback).Run(bitmap); return; } - callback.Run(drag_image_.GetSkBitmap()); + std::move(callback).Run(drag_image_.GetSkBitmap()); return; } - test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_, - delegate_->GetDeviceScaleFactor(), callback); + // See if we need to draw the selection bounds rect on top of the snapshot. + if (layout_test_runtime_flags_.dump_selection_rect()) { + callback = + CreateSelectionBoundsRectDrawingCallback(frame, std::move(callback)); + } + + // Request appropriate kind of pixel dump. + if (layout_test_runtime_flags_.is_printing()) { + test_runner::PrintFrameAsync(frame, std::move(callback)); + } else { + // TODO(lukasza): Ask the |delegate_| to capture the pixels in the browser + // process, so that OOPIF pixels are also captured. + test_runner::DumpPixelsAsync(frame, delegate_->GetDeviceScaleFactor(), + std::move(callback)); + } } void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges(
diff --git a/content/shell/test_runner/test_runner.h b/content/shell/test_runner/test_runner.h index 02d978f..739d6de9 100644 --- a/content/shell/test_runner/test_runner.h +++ b/content/shell/test_runner/test_runner.h
@@ -93,8 +93,8 @@ bool IsRecursiveLayoutDumpRequested() override; std::string DumpLayout(blink::WebLocalFrame* frame) override; void DumpPixelsAsync( - blink::WebView* web_view, - const base::Callback<void(const SkBitmap&)>& callback) override; + blink::WebLocalFrame* frame, + base::OnceCallback<void(const SkBitmap&)> callback) override; void ReplicateLayoutTestRuntimeFlagsChanges( const base::DictionaryValue& changed_values) override; bool HasCustomTextDump(std::string* custom_text_dump) const override;
diff --git a/content/shell/test_runner/test_runner_for_specific_view.cc b/content/shell/test_runner/test_runner_for_specific_view.cc index 71310091..6253aff 100644 --- a/content/shell/test_runner/test_runner_for_specific_view.cc +++ b/content/shell/test_runner/test_runner_for_specific_view.cc
@@ -233,10 +233,14 @@ v8::UniquePersistent<v8::Function> persistent_callback( blink::MainThreadIsolate(), callback); + CHECK(web_view()->MainFrame()->IsWebLocalFrame()) + << "Layout tests harness doesn't currently support running " + << "testRuner.capturePixelsAsyncThen from an OOPIF"; + web_view_test_proxy_base_->test_interfaces() ->GetTestRunner() ->DumpPixelsAsync( - web_view(), + web_view()->MainFrame()->ToWebLocalFrame(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, weak_factory_.GetWeakPtr(), base::Passed(std::move(persistent_callback)))); @@ -289,8 +293,14 @@ v8::UniquePersistent<v8::Function> persistent_callback( blink::MainThreadIsolate(), callback); + // TODO(lukasza): Support image capture in OOPIFs for + // https://crbug.com/477150. + CHECK(web_view()->MainFrame()->IsWebLocalFrame()) + << "Layout tests harness doesn't support calling " + << "testRunner.copyImageAtAndCapturePixelsAsyncThen from an OOPIF."; + CopyImageAtAndCapturePixels( - web_view(), x, y, + web_view()->MainFrame()->ToWebLocalFrame(), x, y, base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, weak_factory_.GetWeakPtr(), base::Passed(std::move(persistent_callback))));
diff --git a/content/shell/test_runner/web_test_runner.h b/content/shell/test_runner/web_test_runner.h index 5dd449c4..6efaec3 100644 --- a/content/shell/test_runner/web_test_runner.h +++ b/content/shell/test_runner/web_test_runner.h
@@ -56,8 +56,8 @@ // and calls |callback| with the result. Caller needs to ensure that // |web_view| stays alive until |callback| is called. virtual void DumpPixelsAsync( - blink::WebView* web_view, - const base::Callback<void(const SkBitmap&)>& callback) = 0; + blink::WebLocalFrame* frame, + base::OnceCallback<void(const SkBitmap&)> callback) = 0; // Replicates changes to layout test runtime flags // (i.e. changes that happened in another renderer).
diff --git a/content/test/DEPS b/content/test/DEPS index a183ec4..873b1d4 100644 --- a/content/test/DEPS +++ b/content/test/DEPS
@@ -5,7 +5,7 @@ "+components/network_session_configurator/common", "+components/scheduler/renderer", "+components/scheduler/test", - "+components/viz/common/resources", + "+components/viz/common", "+cc/blink", "+chromeos/audio", # For WebRTC tests.
diff --git a/content/test/content_browser_test_utils_internal.h b/content/test/content_browser_test_utils_internal.h index 29746924..aa00f13 100644 --- a/content/test/content_browser_test_utils_internal.h +++ b/content/test/content_browser_test_utils_internal.h
@@ -18,7 +18,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/file_chooser_params.h"
diff --git a/content/test/data/accessibility/html/modal-dialog-closed-expected-win.txt b/content/test/data/accessibility/html/modal-dialog-closed-expected-win.txt index be1c7779..f1fc9ec 100644 --- a/content/test/data/accessibility/html/modal-dialog-closed-expected-win.txt +++ b/content/test/data/accessibility/html/modal-dialog-closed-expected-win.txt
@@ -2,6 +2,6 @@ ++ROLE_SYSTEM_STATICTEXT name='Test that elements respawn in the accessibility tree after a modal dialog closes.' ++IA2_ROLE_SECTION ++++ROLE_SYSTEM_COMBOBOX COLLAPSED FOCUSABLE HASPOPUP -++++++ROLE_SYSTEM_LIST INVISIBLE -++++++++ROLE_SYSTEM_LISTITEM name='This should be in the tree.' SELECTED FOCUSABLE +++++++ROLE_SYSTEM_MENUPOPUP INVISIBLE +++++++++ROLE_SYSTEM_MENUITEM name='This should be in the tree.' SELECTED FOCUSABLE ++IA2_ROLE_COLOR_CHOOSER FOCUSABLE \ No newline at end of file
diff --git a/content/test/data/accessibility/html/select-expected-win.txt b/content/test/data/accessibility/html/select-expected-win.txt index 1bb1f102..37c8ee04 100644 --- a/content/test/data/accessibility/html/select-expected-win.txt +++ b/content/test/data/accessibility/html/select-expected-win.txt
@@ -1,20 +1,20 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' ++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1><obj2><obj3><obj4>' ++++ROLE_SYSTEM_COMBOBOX COLLAPSED FOCUSABLE HASPOPUP ia2_hypertext='<obj0>' -++++++ROLE_SYSTEM_LIST INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' -++++++++ROLE_SYSTEM_LISTITEM name='Placeholder option' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Placeholder option' -++++++++ROLE_SYSTEM_LISTITEM name='Option 1' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 1' -++++++++ROLE_SYSTEM_LISTITEM name='Option 2' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 2' +++++++ROLE_SYSTEM_MENUPOPUP INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' +++++++++ROLE_SYSTEM_MENUITEM name='Placeholder option' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Placeholder option' +++++++++ROLE_SYSTEM_MENUITEM name='Option 1' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 1' +++++++++ROLE_SYSTEM_MENUITEM name='Option 2' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 2' ++++ROLE_SYSTEM_COMBOBOX COLLAPSED FOCUSABLE HASPOPUP ia2_hypertext='<obj0>' -++++++ROLE_SYSTEM_LIST INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' -++++++++ROLE_SYSTEM_LISTITEM name='Option 1' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 1' -++++++++ROLE_SYSTEM_LISTITEM name='Option 2' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 2' -++++++++ROLE_SYSTEM_LISTITEM name='Option 3' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 3' +++++++ROLE_SYSTEM_MENUPOPUP INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' +++++++++ROLE_SYSTEM_MENUITEM name='Option 1' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 1' +++++++++ROLE_SYSTEM_MENUITEM name='Option 2' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 2' +++++++++ROLE_SYSTEM_MENUITEM name='Option 3' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 3' ++++ROLE_SYSTEM_COMBOBOX COLLAPSED FOCUSABLE HASPOPUP IA2_STATE_REQUIRED ia2_hypertext='<obj0>' -++++++ROLE_SYSTEM_LIST INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' -++++++++ROLE_SYSTEM_LISTITEM name='Option 1' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 1' -++++++++ROLE_SYSTEM_LISTITEM name='Option 2' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 2' -++++++++ROLE_SYSTEM_LISTITEM name='Option 3' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 3' +++++++ROLE_SYSTEM_MENUPOPUP INVISIBLE ia2_hypertext='<obj0><obj1><obj2>' +++++++++ROLE_SYSTEM_MENUITEM name='Option 1' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 1' +++++++++ROLE_SYSTEM_MENUITEM name='Option 2' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 2' +++++++++ROLE_SYSTEM_MENUITEM name='Option 3' INVISIBLE FOCUSABLE SELECTABLE ia2_hypertext='Option 3' ++++ROLE_SYSTEM_LIST FOCUSABLE MULTISELECTABLE EXTSELECTABLE ia2_hypertext='<obj0><obj1><obj2>' ++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE ia2_hypertext='Option 1' ++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 55f60f8..a6a0947 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -71,16 +71,6 @@ 'tex-2d-rgb565-rgb-unsigned_short_5_6_5.html', ['win'], bug=736926) - # Failing intermittently with out-of-memory crashes on some Windows bots. - self.Flaky('deqp/functional/gles3/texturefiltering/*', - ['win'], bug=725664) - self.Flaky('deqp/functional/gles3/textureformat/*', - ['win'], bug=725664) - self.Flaky('deqp/functional/gles3/textureshadow/*', - ['win'], bug=725664) - self.Flaky('deqp/functional/gles3/texturespecification/*', - ['win'], bug=725664) - # Win / NVidia self.Flaky('deqp/functional/gles3/fbomultisample*', ['win', 'nvidia', 'd3d11'], bug=631317) @@ -697,16 +687,6 @@ 'vector-dynamic-indexing-swizzled-lvalue.html', ['linux', 'intel'], bug=709874) - # Intermittently running out of memory. - self.Flaky('deqp/functional/gles3/texturefiltering/*', - ['linux', 'intel'], bug=725664) - self.Flaky('deqp/functional/gles3/textureformat/*', - ['linux', 'intel'], bug=725664) - self.Flaky('deqp/functional/gles3/textureshadow/*', - ['linux', 'intel'], bug=725664) - self.Flaky('deqp/functional/gles3/texturespecification/*', - ['linux', 'intel'], bug=725664) - # Linux AMD only. # It looks like AMD shader compiler rejects many valid ES3 semantics. self.Fail('conformance/glsl/misc/shaders-with-invariance.html',
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index f85add0..427ab50 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc
@@ -416,7 +416,7 @@ std::move(context_provider), flipped_output_surface); } void DisplayReceivedLocalSurfaceId( - const cc::LocalSurfaceId& local_surface_id) override {} + const viz::LocalSurfaceId& local_surface_id) override {} void DisplayReceivedCompositorFrame( const cc::CompositorFrame& frame) override {} void DisplayWillDrawAndSwap( @@ -509,7 +509,7 @@ } else if (name == "adobeRGB") { return gfx::ICCProfileForTestingAdobeRGB().GetColorSpace(); } else if (name == "reset") { - return gfx::ICCProfileForLayoutTests().GetColorSpace(); + return display::Display::GetForcedColorProfile(); } return gfx::ColorSpace(); }
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc index 71239a1d..2d4c588 100644 --- a/content/test/test_render_view_host.cc +++ b/content/test/test_render_view_host.cc
@@ -204,7 +204,7 @@ } void TestRenderWidgetHostView::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { did_swap_compositor_frame_ = true; } @@ -216,7 +216,7 @@ void TestRenderWidgetHostView::UnlockMouse() { } -cc::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() { +viz::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() { return frame_sink_id_; }
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h index e562bb1..193b4fb 100644 --- a/content/test/test_render_view_host.h +++ b/content/test/test_render_view_host.h
@@ -13,7 +13,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "build/build_config.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/public/common/web_preferences.h" @@ -95,7 +95,7 @@ void DidCreateNewRendererCompositorFrameSink( cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void ClearCompositorFrame() override {} void SetNeedsBeginFrames(bool needs_begin_frames) override {} @@ -115,7 +115,7 @@ gfx::Rect GetBoundsInRootWindow() override; bool LockMouse() override; void UnlockMouse() override; - cc::FrameSinkId GetFrameSinkId() override; + viz::FrameSinkId GetFrameSinkId() override; bool is_showing() const { return is_showing_; } bool is_occluded() const { return is_occluded_; } @@ -130,7 +130,7 @@ protected: RenderWidgetHostImpl* rwh_; - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; private: bool is_showing_;
diff --git a/dbus/bus.cc b/dbus/bus.cc index b35718d..a3139e44 100644 --- a/dbus/bus.cc +++ b/dbus/bus.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/files/file_descriptor_watcher_posix.h" #include "base/logging.h" +#include "base/memory/weak_ptr.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/threading/thread.h" @@ -47,10 +48,10 @@ class Watch { public: explicit Watch(DBusWatch* watch) : raw_watch_(watch) { - dbus_watch_set_data(raw_watch_, this, NULL); + dbus_watch_set_data(raw_watch_, this, nullptr); } - ~Watch() { dbus_watch_set_data(raw_watch_, NULL, NULL); } + ~Watch() { dbus_watch_set_data(raw_watch_, nullptr, nullptr); } // Returns true if the underlying file descriptor is ready to be watched. bool IsReadyToBeWatched() { @@ -92,24 +93,23 @@ DBusWatch* raw_watch_; std::unique_ptr<base::FileDescriptorWatcher::Controller> read_watcher_; std::unique_ptr<base::FileDescriptorWatcher::Controller> write_watcher_; + + DISALLOW_COPY_AND_ASSIGN(Watch); }; // The class is used for monitoring the timeout used for D-Bus method // calls. -// -// Unlike Watch, Timeout is a ref counted object, to ensure that |this| of -// the object is is alive when HandleTimeout() is called. It's unlikely -// but it may be possible that HandleTimeout() is called after -// Bus::OnRemoveTimeout(). That's why we don't simply delete the object in -// Bus::OnRemoveTimeout(). -class Timeout : public base::RefCountedThreadSafe<Timeout> { +class Timeout { public: explicit Timeout(DBusTimeout* timeout) - : raw_timeout_(timeout), - monitoring_is_active_(false), - is_completed(false) { - dbus_timeout_set_data(raw_timeout_, this, NULL); - AddRef(); // Balanced on Complete(). + : raw_timeout_(timeout), weak_ptr_factory_(this) { + // Associated |this| with the underlying DBusTimeout. + dbus_timeout_set_data(raw_timeout_, this, nullptr); + } + + ~Timeout() { + // Remove the association between |this| and the |raw_timeout_|. + dbus_timeout_set_data(raw_timeout_, nullptr, nullptr); } // Returns true if the timeout is ready to be monitored. @@ -121,54 +121,27 @@ void StartMonitoring(Bus* bus) { bus->GetDBusTaskRunner()->PostDelayedTask( FROM_HERE, - base::Bind(&Timeout::HandleTimeout, this), + base::Bind(&Timeout::HandleTimeout, weak_ptr_factory_.GetWeakPtr()), GetInterval()); - monitoring_is_active_ = true; } // Stops monitoring the timeout. - void StopMonitoring() { - // We cannot take back the delayed task we posted in - // StartMonitoring(), so we just mark the monitoring is inactive now. - monitoring_is_active_ = false; - } + void StopMonitoring() { weak_ptr_factory_.InvalidateWeakPtrs(); } - // Returns the interval. base::TimeDelta GetInterval() { return base::TimeDelta::FromMilliseconds( dbus_timeout_get_interval(raw_timeout_)); } - // Cleans up the raw_timeout and marks that timeout is completed. - // See the class comment above for why we are doing this. - void Complete() { - dbus_timeout_set_data(raw_timeout_, NULL, NULL); - is_completed = true; - Release(); - } - private: - friend class base::RefCountedThreadSafe<Timeout>; - ~Timeout() { - } - - // Handles the timeout. - void HandleTimeout() { - // If the timeout is marked completed, we should do nothing. This can - // occur if this function is called after Bus::OnRemoveTimeout(). - if (is_completed) - return; - // Skip if monitoring is canceled. - if (!monitoring_is_active_) - return; - - const bool success = dbus_timeout_handle(raw_timeout_); - CHECK(success) << "Unable to allocate memory"; - } + // Calls DBus to handle the timeout. + void HandleTimeout() { CHECK(dbus_timeout_handle(raw_timeout_)); } DBusTimeout* raw_timeout_; - bool monitoring_is_active_; - bool is_completed; + + base::WeakPtrFactory<Timeout> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(Timeout); }; } // namespace @@ -187,7 +160,7 @@ dbus_task_runner_(options.dbus_task_runner), on_shutdown_(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED), - connection_(NULL), + connection_(nullptr), origin_thread_id_(base::PlatformThread::CurrentId()), async_operations_set_up_(false), shutdown_completed_(false), @@ -276,7 +249,7 @@ const base::Closure& callback) { AssertOnDBusThread(); - object_proxy.get()->Detach(); + object_proxy->Detach(); GetOriginTaskRunner()->PostTask(FROM_HERE, callback); } @@ -388,10 +361,10 @@ scoped_refptr<dbus::ObjectManager> object_manager, const base::Closure& callback) { AssertOnOriginThread(); - DCHECK(object_manager.get()); + DCHECK(object_manager); // Release the object manager and run the callback. - object_manager = NULL; + object_manager = nullptr; callback.Run(); } @@ -510,13 +483,13 @@ dbus_connection_unref(connection_); } - connection_ = NULL; + connection_ = nullptr; shutdown_completed_ = true; } void Bus::ShutdownOnDBusThreadAndBlock() { AssertOnOriginThread(); - DCHECK(dbus_task_runner_.get()); + DCHECK(dbus_task_runner_); GetDBusTaskRunner()->PostTask( FROM_HERE, @@ -622,27 +595,18 @@ // be called when the incoming data is ready. ProcessAllIncomingDataIfAny(); - bool success = dbus_connection_set_watch_functions(connection_, - &Bus::OnAddWatchThunk, - &Bus::OnRemoveWatchThunk, - &Bus::OnToggleWatchThunk, - this, - NULL); + bool success = dbus_connection_set_watch_functions( + connection_, &Bus::OnAddWatchThunk, &Bus::OnRemoveWatchThunk, + &Bus::OnToggleWatchThunk, this, nullptr); CHECK(success) << "Unable to allocate memory"; - success = dbus_connection_set_timeout_functions(connection_, - &Bus::OnAddTimeoutThunk, - &Bus::OnRemoveTimeoutThunk, - &Bus::OnToggleTimeoutThunk, - this, - NULL); + success = dbus_connection_set_timeout_functions( + connection_, &Bus::OnAddTimeoutThunk, &Bus::OnRemoveTimeoutThunk, + &Bus::OnToggleTimeoutThunk, this, nullptr); CHECK(success) << "Unable to allocate memory"; dbus_connection_set_dispatch_status_function( - connection_, - &Bus::OnDispatchStatusChangedThunk, - this, - NULL); + connection_, &Bus::OnDispatchStatusChangedThunk, this, nullptr); async_operations_set_up_ = true; @@ -692,8 +656,8 @@ return; } - const bool success = dbus_connection_add_filter( - connection_, filter_function, user_data, NULL); + const bool success = dbus_connection_add_filter(connection_, filter_function, + user_data, nullptr); CHECK(success) << "Unable to allocate memory"; filter_functions_added_.insert(filter_data_pair); } @@ -822,19 +786,19 @@ } base::TaskRunner* Bus::GetDBusTaskRunner() { - if (dbus_task_runner_.get()) + if (dbus_task_runner_) return dbus_task_runner_.get(); else return GetOriginTaskRunner(); } base::TaskRunner* Bus::GetOriginTaskRunner() { - DCHECK(origin_task_runner_.get()); + DCHECK(origin_task_runner_); return origin_task_runner_.get(); } bool Bus::HasDBusThread() { - return dbus_task_runner_.get() != NULL; + return dbus_task_runner_ != nullptr; } void Bus::AssertOnOriginThread() { @@ -844,7 +808,7 @@ void Bus::AssertOnDBusThread() { base::ThreadRestrictions::AssertIOAllowed(); - if (dbus_task_runner_.get()) { + if (dbus_task_runner_) { DCHECK(dbus_task_runner_->RunsTasksInCurrentSequence()); } else { AssertOnOriginThread(); @@ -1052,8 +1016,7 @@ dbus_bool_t Bus::OnAddTimeout(DBusTimeout* raw_timeout) { AssertOnDBusThread(); - // timeout will be deleted when raw_timeout is removed in - // OnRemoveTimeoutThunk(). + // |timeout| will be deleted by OnRemoveTimeoutThunk(). Timeout* timeout = new Timeout(raw_timeout); if (timeout->IsReadyToBeMonitored()) { timeout->StartMonitoring(this); @@ -1066,7 +1029,7 @@ AssertOnDBusThread(); Timeout* timeout = static_cast<Timeout*>(dbus_timeout_get_data(raw_timeout)); - timeout->Complete(); + delete timeout; --num_pending_timeouts_; }
diff --git a/docs/fuchsia_build_instructions.md b/docs/fuchsia_build_instructions.md index 1d9eb5a3..33103207 100644 --- a/docs/fuchsia_build_instructions.md +++ b/docs/fuchsia_build_instructions.md
@@ -93,6 +93,9 @@ $ gn gen out/fuchsia --args="is_debug=false dcheck_always_on=true is_component_build=false target_os=\"fuchsia\"" ``` +You can also build for Debug, with `is_debug=true`, but since we don't currently +have any Debug build-bots, it may be more broken than Release. + `use_goma=true` is fine to use also if you're a Googler. ## Build @@ -109,7 +112,7 @@ Once it is built, you can run by: ```shell -$ out/fuch/bin/run_base_unittests +$ out/fuchsia/bin/run_base_unittests ``` This packages the built binary and test data into a disk image, and runs a QEMU @@ -122,6 +125,6 @@ A useful alias (for "Build And Run Filtered") is: ```shell -alias barf='ninja -C out/fuchsia base_unittests -j1000 && out/fuch/bin/run_base_unittests --test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.base_unittests.filter' +alias barf='ninja -C out/fuchsia base_unittests -j1000 && out/fuchsia/bin/run_base_unittests --test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.base_unittests.filter' ``` to build and run only the tests that are not excluded/known-failing on the bot.
diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index 1e43a67..f3ea9b38 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn
@@ -61,6 +61,8 @@ "bindings/declarative_event.h", "bindings/event_emitter.cc", "bindings/event_emitter.h", + "bindings/exception_handler.cc", + "bindings/exception_handler.h", "blob_native_handler.cc", "blob_native_handler.h", "chrome_setting.cc", @@ -332,6 +334,7 @@ "bindings/binding_access_checker_unittest.cc", "bindings/declarative_event_unittest.cc", "bindings/event_emitter_unittest.cc", + "bindings/exception_handler_unittest.cc", "event_unittest.cc", "gc_callback_unittest.cc", "json_schema_unittest.cc",
diff --git a/extensions/renderer/bindings/api_binding_types.h b/extensions/renderer/bindings/api_binding_types.h index 3f2ee5306..87b1b76 100644 --- a/extensions/renderer/bindings/api_binding_types.h +++ b/extensions/renderer/bindings/api_binding_types.h
@@ -49,6 +49,10 @@ int argc, v8::Local<v8::Value>[])>; +// Adds an error message to the context's console. +using AddConsoleError = + base::Callback<void(v8::Local<v8::Context>, const std::string& error)>; + } // namespace binding } // namespace extensions
diff --git a/extensions/renderer/bindings/api_binding_unittest.cc b/extensions/renderer/bindings/api_binding_unittest.cc index b8e52c22..655146b 100644 --- a/extensions/renderer/bindings/api_binding_unittest.cc +++ b/extensions/renderer/bindings/api_binding_unittest.cc
@@ -103,8 +103,8 @@ request_handler_ = base::MakeUnique<APIRequestHandler>( base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)), base::Bind(&RunFunctionOnGlobalAndIgnoreResult), - APILastError(APILastError::GetParent(), - APILastError::AddConsoleError())); + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + nullptr); } void TearDown() override {
diff --git a/extensions/renderer/bindings/api_bindings_system.cc b/extensions/renderer/bindings/api_bindings_system.cc index e20e1a0..be402e4 100644 --- a/extensions/renderer/bindings/api_bindings_system.cc +++ b/extensions/renderer/bindings/api_bindings_system.cc
@@ -19,10 +19,15 @@ const APIRequestHandler::SendRequestMethod& send_request, const APIEventHandler::EventListenersChangedMethod& event_listeners_changed, const APIBinding::OnSilentRequest& on_silent_request, + const binding::AddConsoleError& add_console_error, APILastError last_error) : type_reference_map_(base::Bind(&APIBindingsSystem::InitializeType, base::Unretained(this))), - request_handler_(send_request, call_js, std::move(last_error)), + exception_handler_(add_console_error, call_js), + request_handler_(send_request, + call_js, + std::move(last_error), + &exception_handler_), event_handler_(call_js, call_js_sync, event_listeners_changed), access_checker_(is_available), call_js_(call_js),
diff --git a/extensions/renderer/bindings/api_bindings_system.h b/extensions/renderer/bindings/api_bindings_system.h index 82351c3..4487f348 100644 --- a/extensions/renderer/bindings/api_bindings_system.h +++ b/extensions/renderer/bindings/api_bindings_system.h
@@ -18,6 +18,7 @@ #include "extensions/renderer/bindings/api_request_handler.h" #include "extensions/renderer/bindings/api_type_reference_map.h" #include "extensions/renderer/bindings/binding_access_checker.h" +#include "extensions/renderer/bindings/exception_handler.h" namespace base { class DictionaryValue; @@ -52,6 +53,7 @@ const APIEventHandler::EventListenersChangedMethod& event_listeners_changed, const APIBinding::OnSilentRequest& on_silent_request, + const binding::AddConsoleError& add_console_error, APILastError last_error); ~APIBindingsSystem(); @@ -95,6 +97,7 @@ APIRequestHandler* request_handler() { return &request_handler_; } APIEventHandler* event_handler() { return &event_handler_; } APITypeReferenceMap* type_reference_map() { return &type_reference_map_; } + ExceptionHandler* exception_handler() { return &exception_handler_; } private: // Creates a new APIBinding for the given |api_name|. @@ -114,6 +117,9 @@ // The map of cached API reference types. APITypeReferenceMap type_reference_map_; + // The exception handler for the system. + ExceptionHandler exception_handler_; + // The request handler associated with the system. APIRequestHandler request_handler_;
diff --git a/extensions/renderer/bindings/api_bindings_system_unittest.cc b/extensions/renderer/bindings/api_bindings_system_unittest.cc index aea5e56..0b02f93 100644 --- a/extensions/renderer/bindings/api_bindings_system_unittest.cc +++ b/extensions/renderer/bindings/api_bindings_system_unittest.cc
@@ -123,10 +123,10 @@ base::Bind(&APIBindingsSystemTest::OnAPIRequest, base::Unretained(this)), base::Bind(&APIBindingsSystemTest::OnEventListenersChanged, base::Unretained(this)), - base::Bind(&DoNothingWithSilentRequest), + base::Bind(&DoNothingWithSilentRequest), binding::AddConsoleError(), APILastError(base::Bind(&APIBindingsSystemTest::GetLastErrorParent, base::Unretained(this)), - APILastError::AddConsoleError())); + binding::AddConsoleError())); } void APIBindingsSystemTest::TearDown() {
diff --git a/extensions/renderer/bindings/api_last_error.cc b/extensions/renderer/bindings/api_last_error.cc index 660cab61..404d1402 100644 --- a/extensions/renderer/bindings/api_last_error.cc +++ b/extensions/renderer/bindings/api_last_error.cc
@@ -113,7 +113,7 @@ } // namespace APILastError::APILastError(const GetParent& get_parent, - const AddConsoleError& add_console_error) + const binding::AddConsoleError& add_console_error) : get_parent_(get_parent), add_console_error_(add_console_error) {} APILastError::APILastError(APILastError&& other) = default; APILastError::~APILastError() = default;
diff --git a/extensions/renderer/bindings/api_last_error.h b/extensions/renderer/bindings/api_last_error.h index 1082409a..1fb9011 100644 --- a/extensions/renderer/bindings/api_last_error.h +++ b/extensions/renderer/bindings/api_last_error.h
@@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/macros.h" +#include "extensions/renderer/bindings/api_binding_types.h" #include "v8/include/v8.h" namespace extensions { @@ -26,12 +27,9 @@ using GetParent = base::Callback<v8::Local<v8::Object>( v8::Local<v8::Context>, v8::Local<v8::Object>* secondary_parent)>; - // Adds an error message to the context's console. - using AddConsoleError = - base::Callback<void(v8::Local<v8::Context>, const std::string& error)>; APILastError(const GetParent& get_parent, - const AddConsoleError& add_console_error); + const binding::AddConsoleError& add_console_error); APILastError(APILastError&& other); ~APILastError(); @@ -60,7 +58,7 @@ GetParent get_parent_; - AddConsoleError add_console_error_; + binding::AddConsoleError add_console_error_; DISALLOW_COPY_AND_ASSIGN(APILastError); };
diff --git a/extensions/renderer/bindings/api_request_handler.cc b/extensions/renderer/bindings/api_request_handler.cc index 2aa6e29..c4da6dcf 100644 --- a/extensions/renderer/bindings/api_request_handler.cc +++ b/extensions/renderer/bindings/api_request_handler.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "base/values.h" #include "content/public/child/v8_value_converter.h" +#include "extensions/renderer/bindings/exception_handler.h" #include "gin/converter.h" #include "gin/data_object_builder.h" #include "third_party/WebKit/public/web/WebScopedUserGesture.h" @@ -43,10 +44,12 @@ APIRequestHandler::APIRequestHandler(const SendRequestMethod& send_request, const CallJSFunction& call_js, - APILastError last_error) + APILastError last_error, + ExceptionHandler* exception_handler) : send_request_(send_request), call_js_(call_js), - last_error_(std::move(last_error)) {} + last_error_(std::move(last_error)), + exception_handler_(exception_handler) {} APIRequestHandler::~APIRequestHandler() {} @@ -141,10 +144,19 @@ if (!error.empty()) last_error_.SetError(context, error); + v8::TryCatch try_catch(isolate); // args.size() is converted to int, but args is controlled by chrome and is // never close to std::numeric_limits<int>::max. call_js_.Run(pending_request.callback.Get(isolate), context, args.size(), args.data()); + if (try_catch.HasCaught()) { + v8::Local<v8::Message> v8_message = try_catch.Message(); + base::Optional<std::string> message; + if (!v8_message.IsEmpty()) + message = gin::V8ToString(v8_message->Get()); + exception_handler_->HandleException(context, "Error handling response", + &try_catch); + } if (!error.empty()) last_error_.ClearError(context, true);
diff --git a/extensions/renderer/bindings/api_request_handler.h b/extensions/renderer/bindings/api_request_handler.h index a2ce5da8e..767f9cd 100644 --- a/extensions/renderer/bindings/api_request_handler.h +++ b/extensions/renderer/bindings/api_request_handler.h
@@ -21,6 +21,7 @@ } namespace extensions { +class ExceptionHandler; // A wrapper around a map for extension API calls. Contains all pending requests // and the associated context and callback. Designed to be used on a single @@ -54,7 +55,8 @@ APIRequestHandler(const SendRequestMethod& send_request, const CallJSFunction& call_js, - APILastError last_error); + APILastError last_error, + ExceptionHandler* exception_handler); ~APIRequestHandler(); // Begins the process of processing the request. Returns the identifier of the @@ -127,6 +129,10 @@ APILastError last_error_; + // The exception handler for the bindings system; guaranteed to be valid + // during this object's lifetime. + ExceptionHandler* const exception_handler_; + DISALLOW_COPY_AND_ASSIGN(APIRequestHandler); };
diff --git a/extensions/renderer/bindings/api_request_handler_unittest.cc b/extensions/renderer/bindings/api_request_handler_unittest.cc index 28860ef..a5d365a8 100644 --- a/extensions/renderer/bindings/api_request_handler_unittest.cc +++ b/extensions/renderer/bindings/api_request_handler_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/renderer/bindings/api_request_handler.h" + #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/optional.h" @@ -9,7 +11,7 @@ #include "base/values.h" #include "extensions/renderer/bindings/api_binding_test.h" #include "extensions/renderer/bindings/api_binding_test_util.h" -#include "extensions/renderer/bindings/api_request_handler.h" +#include "extensions/renderer/bindings/exception_handler.h" #include "gin/converter.h" #include "gin/function_template.h" #include "gin/public/context_holder.h" @@ -47,6 +49,14 @@ did_run_js_ = true; } + std::unique_ptr<APIRequestHandler> CreateRequestHandler() { + return base::MakeUnique<APIRequestHandler>( + base::Bind(&DoNothingWithRequest), + base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + nullptr); + } + protected: APIRequestHandlerTest() {} ~APIRequestHandlerTest() override {} @@ -65,41 +75,39 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); - EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); + EXPECT_TRUE(request_handler->GetPendingRequestIdsForTesting().empty()); v8::Local<v8::Function> function = FunctionFromString(context, kEchoArgs); ASSERT_FALSE(function.IsEmpty()); - int request_id = request_handler.StartRequest( + int request_id = request_handler->StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), function, v8::Local<v8::Function>(), binding::RequestThread::UI); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_id)); const char kArguments[] = "['foo',1,{'prop1':'bar'}]"; std::unique_ptr<base::ListValue> response_arguments = ListValueFromString(kArguments); ASSERT_TRUE(response_arguments); - request_handler.CompleteRequest(request_id, *response_arguments, - std::string()); + request_handler->CompleteRequest(request_id, *response_arguments, + std::string()); EXPECT_TRUE(did_run_js()); EXPECT_EQ(ReplaceSingleQuotes(kArguments), GetStringPropertyFromObject(context->Global(), context, "result")); - EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); + EXPECT_TRUE(request_handler->GetPendingRequestIdsForTesting().empty()); - request_id = request_handler.StartRequest( + request_id = request_handler->StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), v8::Local<v8::Function>(), v8::Local<v8::Function>(), binding::RequestThread::UI); EXPECT_NE(-1, request_id); - request_handler.CompleteRequest(request_id, base::ListValue(), std::string()); + request_handler->CompleteRequest(request_id, base::ListValue(), + std::string()); } // Tests that trying to run non-existent or invalided requests is a no-op. @@ -107,18 +115,15 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); v8::Local<v8::Function> function = FunctionFromString(context, kEchoArgs); ASSERT_FALSE(function.IsEmpty()); - int request_id = request_handler.StartRequest( + int request_id = request_handler->StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), function, v8::Local<v8::Function>(), binding::RequestThread::UI); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_id)); std::unique_ptr<base::ListValue> response_arguments = @@ -127,14 +132,14 @@ // Try running with a non-existent request id. int fake_request_id = 42; - request_handler.CompleteRequest(fake_request_id, *response_arguments, - std::string()); + request_handler->CompleteRequest(fake_request_id, *response_arguments, + std::string()); EXPECT_FALSE(did_run_js()); // Try running with a request from an invalidated context. - request_handler.InvalidateContext(context); - request_handler.CompleteRequest(request_id, *response_arguments, - std::string()); + request_handler->InvalidateContext(context); + request_handler->CompleteRequest(request_id, *response_arguments, + std::string()); EXPECT_FALSE(did_run_js()); } @@ -143,10 +148,7 @@ v8::Local<v8::Context> context_a = MainContext(); v8::Local<v8::Context> context_b = AddContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); // By having both different arguments and different behaviors in the // callbacks, we can easily verify that the right function is called in the @@ -156,23 +158,23 @@ v8::Local<v8::Function> function_b = FunctionFromString( context_b, "(function(res) { this.result = res + 'beta'; })"); - int request_a = request_handler.StartRequest( + int request_a = request_handler->StartRequest( context_a, kMethod, base::MakeUnique<base::ListValue>(), function_a, v8::Local<v8::Function>(), binding::RequestThread::UI); - int request_b = request_handler.StartRequest( + int request_b = request_handler->StartRequest( context_b, kMethod, base::MakeUnique<base::ListValue>(), function_b, v8::Local<v8::Function>(), binding::RequestThread::UI); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_a, request_b)); std::unique_ptr<base::ListValue> response_a = ListValueFromString("['response_a:']"); ASSERT_TRUE(response_a); - request_handler.CompleteRequest(request_a, *response_a, std::string()); + request_handler->CompleteRequest(request_a, *response_a, std::string()); EXPECT_TRUE(did_run_js()); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_b)); EXPECT_EQ( @@ -183,8 +185,8 @@ ListValueFromString("['response_b:']"); ASSERT_TRUE(response_b); - request_handler.CompleteRequest(request_b, *response_b, std::string()); - EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); + request_handler->CompleteRequest(request_b, *response_b, std::string()); + EXPECT_TRUE(request_handler->GetPendingRequestIdsForTesting().empty()); EXPECT_EQ( ReplaceSingleQuotes("'response_b:beta'"), @@ -195,10 +197,7 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); v8::Local<v8::Function> custom_callback = FunctionFromString(context, kEchoArgs); @@ -207,17 +206,17 @@ ASSERT_FALSE(callback.IsEmpty()); ASSERT_FALSE(custom_callback.IsEmpty()); - int request_id = request_handler.StartRequest( + int request_id = request_handler->StartRequest( context, "method", base::MakeUnique<base::ListValue>(), callback, custom_callback, binding::RequestThread::UI); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_id)); std::unique_ptr<base::ListValue> response_arguments = ListValueFromString("['response', 'arguments']"); ASSERT_TRUE(response_arguments); - request_handler.CompleteRequest(request_id, *response_arguments, - std::string()); + request_handler->CompleteRequest(request_id, *response_arguments, + std::string()); EXPECT_TRUE(did_run_js()); v8::Local<v8::Value> result = @@ -234,7 +233,7 @@ EXPECT_EQ("\"response\"", V8ToString(args[3], context)); EXPECT_EQ("\"arguments\"", V8ToString(args[4], context)); - EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); + EXPECT_TRUE(request_handler->GetPendingRequestIdsForTesting().empty()); } // Test that having a custom callback without an extension-provided callback @@ -243,23 +242,21 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); v8::Local<v8::Function> custom_callback = FunctionFromString(context, kEchoArgs); ASSERT_FALSE(custom_callback.IsEmpty()); v8::Local<v8::Function> empty_callback; - int request_id = request_handler.StartRequest( + int request_id = request_handler->StartRequest( context, "method", base::MakeUnique<base::ListValue>(), empty_callback, custom_callback, binding::RequestThread::UI); - EXPECT_THAT(request_handler.GetPendingRequestIdsForTesting(), + EXPECT_THAT(request_handler->GetPendingRequestIdsForTesting(), testing::UnorderedElementsAre(request_id)); - request_handler.CompleteRequest(request_id, base::ListValue(), std::string()); + request_handler->CompleteRequest(request_id, base::ListValue(), + std::string()); EXPECT_TRUE(did_run_js()); v8::Local<v8::Value> result = @@ -274,7 +271,7 @@ V8ToString(args[1], context)); EXPECT_TRUE(args[2]->IsUndefined()); - EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); + EXPECT_TRUE(request_handler->GetPendingRequestIdsForTesting().empty()); } // Test user gestures being curried around for API requests. @@ -282,10 +279,7 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - APIRequestHandler request_handler( - base::Bind(&DoNothingWithRequest), - base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + std::unique_ptr<APIRequestHandler> request_handler = CreateRequestHandler(); auto callback = [](base::Optional<bool>* ran_with_user_gesture) { *ran_with_user_gesture = @@ -302,11 +296,11 @@ function_template->GetFunction(context).ToLocalChecked(); // Try first without a user gesture. - int request_id = request_handler.StartRequest( + int request_id = request_handler->StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), v8_callback, v8::Local<v8::Function>(), binding::RequestThread::UI); - request_handler.CompleteRequest(request_id, *ListValueFromString("[]"), - std::string()); + request_handler->CompleteRequest(request_id, *ListValueFromString("[]"), + std::string()); ASSERT_TRUE(ran_with_user_gesture); EXPECT_FALSE(*ran_with_user_gesture); @@ -318,15 +312,15 @@ blink::WebScopedUserGesture user_gesture(nullptr); EXPECT_TRUE( blink::WebUserGestureIndicator::IsProcessingUserGestureThreadSafe()); - request_id = request_handler.StartRequest( + request_id = request_handler->StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), v8_callback, v8::Local<v8::Function>(), binding::RequestThread::UI); } EXPECT_FALSE( blink::WebUserGestureIndicator::IsProcessingUserGestureThreadSafe()); - request_handler.CompleteRequest(request_id, *ListValueFromString("[]"), - std::string()); + request_handler->CompleteRequest(request_id, *ListValueFromString("[]"), + std::string()); ASSERT_TRUE(ran_with_user_gesture); EXPECT_TRUE(*ran_with_user_gesture); // Sanity check - after the callback ran, there shouldn't be an active @@ -349,7 +343,8 @@ APIRequestHandler request_handler( base::Bind(on_request, &thread), base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + nullptr); request_handler.StartRequest( context, kMethod, base::MakeUnique<base::ListValue>(), @@ -386,7 +381,8 @@ base::Bind(&DoNothingWithRequest), base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), APILastError(base::Bind(get_parent), - base::Bind(log_error, &logged_error))); + base::Bind(log_error, &logged_error)), + nullptr); const char kReportExposedLastError[] = "(function() {\n" @@ -459,7 +455,8 @@ APIRequestHandler request_handler( base::Bind(handle_request, &dispatched_request), base::Bind(&APIRequestHandlerTest::RunJS, base::Unretained(this)), - APILastError(APILastError::GetParent(), APILastError::AddConsoleError())); + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + nullptr); EXPECT_TRUE(request_handler.GetPendingRequestIdsForTesting().empty()); v8::Local<v8::Function> function = FunctionFromString(context, kEchoArgs); @@ -486,4 +483,47 @@ EXPECT_FALSE(dispatched_request); } +// Tests that throwing an exception in a callback is properly handled. +TEST_F(APIRequestHandlerTest, ThrowExceptionInCallback) { + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context = MainContext(); + + auto add_console_error = [](base::Optional<std::string>* error_out, + v8::Local<v8::Context> context, + const std::string& error) { *error_out = error; }; + + // RunFunction* from the test util assert no errors; provide a version that + // allows them. + auto run_function_and_allow_errors = + [](v8::Local<v8::Function> function, v8::Local<v8::Context> context, + int argc, v8::Local<v8::Value> argv[]) { + ignore_result(function->Call(context, context->Global(), argc, argv)); + }; + + base::Optional<std::string> logged_error; + ExceptionHandler exception_handler( + base::Bind(add_console_error, &logged_error), + base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); + + APIRequestHandler request_handler( + base::Bind(&DoNothingWithRequest), + base::Bind(run_function_and_allow_errors), + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + &exception_handler); + + v8::TryCatch outer_try_catch(isolate()); + v8::Local<v8::Function> callback_throwing_error = + FunctionFromString(context, "(function() { throw new Error('hello'); })"); + int request_id = + request_handler.AddPendingRequest(context, callback_throwing_error); + request_handler.CompleteRequest(request_id, base::ListValue(), std::string()); + // |outer_try_catch| should not have caught an error. This is important to not + // disrupt our bindings code (or other running JS) when asynchronously + // returning from an API call. Instead, the error should be caught and handled + // by the exception handler. + EXPECT_FALSE(outer_try_catch.HasCaught()); + ASSERT_TRUE(logged_error); + EXPECT_EQ("Error handling response: Uncaught Error: hello", *logged_error); +} + } // namespace extensions
diff --git a/extensions/renderer/bindings/declarative_event_unittest.cc b/extensions/renderer/bindings/declarative_event_unittest.cc index 4bb29d06..4eaee5c 100644 --- a/extensions/renderer/bindings/declarative_event_unittest.cc +++ b/extensions/renderer/bindings/declarative_event_unittest.cc
@@ -94,8 +94,8 @@ request_handler_ = base::MakeUnique<APIRequestHandler>( base::Bind(&DeclarativeEventTest::OnRequest, base::Unretained(this)), base::Bind(&RunFunctionOnGlobalAndIgnoreResult), - APILastError(APILastError::GetParent(), - APILastError::AddConsoleError())); + APILastError(APILastError::GetParent(), binding::AddConsoleError()), + nullptr); } void TearDown() override {
diff --git a/extensions/renderer/bindings/exception_handler.cc b/extensions/renderer/bindings/exception_handler.cc new file mode 100644 index 0000000..2f4f773 --- /dev/null +++ b/extensions/renderer/bindings/exception_handler.cc
@@ -0,0 +1,95 @@ +// 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 "extensions/renderer/bindings/exception_handler.h" + +#include "base/logging.h" +#include "base/memory/ptr_util.h" +#include "base/strings/stringprintf.h" +#include "base/supports_user_data.h" +#include "gin/converter.h" +#include "gin/per_context_data.h" + +namespace extensions { + +namespace { + +const char kExtensionExceptionHandlerPerContextKey[] = + "extension_exception_handler"; + +struct ExceptionHandlerPerContextData : public base::SupportsUserData::Data { + v8::Global<v8::Function> custom_handler; +}; + +// TODO(devlin): Extract this to a utility method. +ExceptionHandlerPerContextData* GetContextData(v8::Local<v8::Context> context, + bool should_create) { + gin::PerContextData* per_context_data = gin::PerContextData::From(context); + if (!per_context_data) + return nullptr; + auto* data = static_cast<ExceptionHandlerPerContextData*>( + per_context_data->GetUserData(kExtensionExceptionHandlerPerContextKey)); + + if (!data && should_create) { + auto api_data = base::MakeUnique<ExceptionHandlerPerContextData>(); + data = api_data.get(); + per_context_data->SetUserData(kExtensionExceptionHandlerPerContextKey, + std::move(api_data)); + } + + return data; +} + +} // namespace + +ExceptionHandler::ExceptionHandler( + const binding::AddConsoleError& add_console_error, + const binding::RunJSFunction& run_js) + : add_console_error_(add_console_error), run_js_(run_js) {} +ExceptionHandler::~ExceptionHandler() {} + +void ExceptionHandler::HandleException(v8::Local<v8::Context> context, + const std::string& message, + v8::TryCatch* try_catch) { + DCHECK(try_catch->HasCaught()); + + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + v8::Local<v8::Message> v8_message = try_catch->Message(); + std::string full_message = + !v8_message.IsEmpty() + ? base::StringPrintf("%s: %s", message.c_str(), + gin::V8ToString(v8_message->Get()).c_str()) + : message; + + v8::Local<v8::Function> handler = GetCustomHandler(context); + if (!handler.IsEmpty()) { + v8::Local<v8::Value> arguments[] = { + gin::StringToV8(isolate, full_message), try_catch->Exception(), + }; + v8::TryCatch handler_try_catch(isolate); + run_js_.Run(handler, context, arraysize(arguments), arguments); + } else { + add_console_error_.Run(context, full_message); + } + + try_catch->Reset(); // Reset() to avoid handling the error more than once. +} + +void ExceptionHandler::SetHandlerForContext(v8::Local<v8::Context> context, + v8::Local<v8::Function> handler) { + ExceptionHandlerPerContextData* data = GetContextData(context, true); + DCHECK(data); + data->custom_handler.Reset(context->GetIsolate(), handler); +} + +v8::Local<v8::Function> ExceptionHandler::GetCustomHandler( + v8::Local<v8::Context> context) { + ExceptionHandlerPerContextData* data = GetContextData(context, false); + return data ? data->custom_handler.Get(context->GetIsolate()) + : v8::Local<v8::Function>(); +} + +} // namespace extensions
diff --git a/extensions/renderer/bindings/exception_handler.h b/extensions/renderer/bindings/exception_handler.h new file mode 100644 index 0000000..aa8e5fbe --- /dev/null +++ b/extensions/renderer/bindings/exception_handler.h
@@ -0,0 +1,53 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_RENDERER_BINDINGS_EXCEPTION_HANDLER +#define EXTENSIONS_RENDERER_BINDINGS_EXCEPTION_HANDLER + +#include <string> + +#include "base/macros.h" +#include "base/optional.h" +#include "extensions/renderer/bindings/api_binding_types.h" +#include "v8/include/v8.h" + +namespace extensions { + +// A class to handle uncaught exceptions encountered in the bindings system +// while running untrusted code, such as exceptions thrown during callback +// execution or event handling. +class ExceptionHandler { + public: + ExceptionHandler(const binding::AddConsoleError& add_console_error, + const binding::RunJSFunction& run_js); + ~ExceptionHandler(); + + // Handles an exception in the given |context|. |message| is a message to + // prefix the error message with, e.g. "Exception in response to foo". + // The |try_catch| is the TryCatch that caught the exception. + void HandleException(v8::Local<v8::Context> context, + const std::string& message, + v8::TryCatch* try_catch); + + // Sets a custom handler for the given context, which will be notified of + // exceptions thrown. This is only allowed to be called while the context is + // valid. + void SetHandlerForContext(v8::Local<v8::Context> context, + v8::Local<v8::Function> handler); + + private: + // Returns the custom handler for the given |context|, or an empty handle if + // no custom handle exists. + v8::Local<v8::Function> GetCustomHandler(v8::Local<v8::Context> context); + + binding::AddConsoleError add_console_error_; + + binding::RunJSFunction run_js_; + + DISALLOW_COPY_AND_ASSIGN(ExceptionHandler); +}; + +} // namespace extensions + +#endif // EXTENSIONS_RENDERER_BINDINGS_EXCEPTION_HANDLER
diff --git a/extensions/renderer/bindings/exception_handler_unittest.cc b/extensions/renderer/bindings/exception_handler_unittest.cc new file mode 100644 index 0000000..e79b351d --- /dev/null +++ b/extensions/renderer/bindings/exception_handler_unittest.cc
@@ -0,0 +1,144 @@ +// 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 "extensions/renderer/bindings/exception_handler.h" + +#include <string> + +#include "base/bind.h" +#include "base/optional.h" +#include "base/strings/stringprintf.h" +#include "extensions/renderer/bindings/api_binding_test.h" +#include "extensions/renderer/bindings/api_binding_test_util.h" +#include "gin/converter.h" + +namespace extensions { + +namespace { + +void PopulateError(base::Optional<std::string>* error_out, + v8::Local<v8::Context> context, + const std::string& error) { + *error_out = error; +} + +void ThrowException(v8::Local<v8::Context> context, + const std::string& to_throw, + ExceptionHandler* handler) { + v8::Isolate* isolate = context->GetIsolate(); + v8::TryCatch try_catch(isolate); + v8::Local<v8::Function> function = FunctionFromString( + context, + base::StringPrintf("(function() { throw %s; })", to_throw.c_str())); + ignore_result(function->Call(context, v8::Undefined(isolate), 0, nullptr)); + ASSERT_TRUE(try_catch.HasCaught()); + handler->HandleException(context, "handled", &try_catch); +} + +} // namespace + +using ExceptionHandlerTest = APIBindingTest; + +TEST_F(ExceptionHandlerTest, TestBasicHandling) { + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context = MainContext(); + + base::Optional<std::string> logged_error; + ExceptionHandler handler(base::Bind(&PopulateError, &logged_error), + base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); + + ThrowException(context, "new Error('some error')", &handler); + + ASSERT_TRUE(logged_error); + EXPECT_EQ("handled: Uncaught Error: some error", *logged_error); +} + +TEST_F(ExceptionHandlerTest, PerContextHandlers) { + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context_a = MainContext(); + v8::Local<v8::Context> context_b = AddContext(); + + base::Optional<std::string> logged_error; + ExceptionHandler handler(base::Bind(&PopulateError, &logged_error), + base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); + + v8::Local<v8::Function> custom_handler = FunctionFromString( + context_a, + "(function(message, exception) {\n" + " this.loggedMessage = message;\n" + " this.loggedExceptionMessage = exception && exception.message;\n" + "})"); + + handler.SetHandlerForContext(context_a, custom_handler); + ThrowException(context_a, "new Error('context a error')", &handler); + EXPECT_FALSE(logged_error); + EXPECT_EQ("\"handled: Uncaught Error: context a error\"", + GetStringPropertyFromObject(context_a->Global(), context_a, + "loggedMessage")); + EXPECT_EQ("\"context a error\"", + GetStringPropertyFromObject(context_a->Global(), context_a, + "loggedExceptionMessage")); + + ASSERT_TRUE(context_a->Global() + ->Set(context_a, + gin::StringToSymbol(isolate(), "loggedMessage"), + v8::Undefined(isolate())) + .ToChecked()); + ASSERT_TRUE( + context_a->Global() + ->Set(context_a, + gin::StringToSymbol(isolate(), "loggedExceptionMessage"), + v8::Undefined(isolate())) + .ToChecked()); + + ThrowException(context_b, "new Error('context b error')", &handler); + ASSERT_TRUE(logged_error); + EXPECT_EQ("handled: Uncaught Error: context b error", *logged_error); + EXPECT_EQ("undefined", GetStringPropertyFromObject( + context_a->Global(), context_a, "loggedMessage")); + EXPECT_EQ("undefined", + GetStringPropertyFromObject(context_a->Global(), context_a, + "loggedExceptionMessage")); +} + +TEST_F(ExceptionHandlerTest, ThrowingNonErrors) { + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context = MainContext(); + + base::Optional<std::string> logged_error; + ExceptionHandler handler(base::Bind(&PopulateError, &logged_error), + base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); + + ThrowException(context, "'hello'", &handler); + ASSERT_TRUE(logged_error); + EXPECT_EQ("handled: Uncaught hello", *logged_error); + logged_error.reset(); + + ThrowException(context, "{ message: 'hello' }", &handler); + ASSERT_TRUE(logged_error); + EXPECT_EQ("handled: Uncaught #<Object>", *logged_error); + logged_error.reset(); + + ThrowException(context, "{ toString: function() { throw 'goodbye' } }", + &handler); + ASSERT_TRUE(logged_error); + EXPECT_EQ("handled: Uncaught [object Object]", *logged_error); + + v8::Local<v8::Function> custom_handler = + FunctionFromString(context, + "(function(message, exception) {\n" + " this.loggedMessage = message;\n" + " this.loggedException = exception;\n" + "})"); + + handler.SetHandlerForContext(context, custom_handler); + ThrowException(context, "'hello'", &handler); + EXPECT_EQ( + "\"handled: Uncaught hello\"", + GetStringPropertyFromObject(context->Global(), context, "loggedMessage")); + EXPECT_EQ("\"hello\"", GetStringPropertyFromObject(context->Global(), context, + "loggedException")); +} + +} // namespace extensions
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc index f1808e53..e43e801e 100644 --- a/extensions/renderer/native_extension_bindings_system.cc +++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -363,6 +363,7 @@ base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged, base::Unretained(this)), base::Bind(&APIActivityLogger::LogAPICall), + base::Bind(&AddConsoleError), APILastError(base::Bind(&GetLastErrorParents), base::Bind(&AddConsoleError))), weak_factory_(this) {
diff --git a/extensions/shell/installer/linux/BUILD.gn b/extensions/shell/installer/linux/BUILD.gn index 08f8bfa..555d85a 100644 --- a/extensions/shell/installer/linux/BUILD.gn +++ b/extensions/shell/installer/linux/BUILD.gn
@@ -132,7 +132,7 @@ # TODO(thomasanderson): Move this variable into a .gni file # somewhere. It is currently copied from # buildtools/third_party/libc++/BUILD.gn. - libcpp_is_static = !is_component_build && !using_sanitizer + libcpp_is_static = !is_component_build && !is_asan && !is_msan && !is_tsan if (!libcpp_is_static && use_custom_libcxx) { public_deps += [ "//buildtools/third_party/libc++:libc++" ] } @@ -165,7 +165,7 @@ # TODO(thomasanderson): Move this variable into a .gni file # somewhere. It is currently copied from # buildtools/third_party/libc++/BUILD.gn. - libcpp_is_static = !is_component_build && !using_sanitizer + libcpp_is_static = !is_component_build && !is_asan && !is_msan && !is_tsan if (!libcpp_is_static && use_custom_libcxx) { packaging_files_binaries += [ "$root_out_dir/libc++.so" ] }
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc index 60104db..9273caa 100644 --- a/google_apis/gcm/tools/mcs_probe.cc +++ b/google_apis/gcm/tools/mcs_probe.cc
@@ -49,7 +49,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_server_properties_impl.h" #include "net/http/transport_security_state.h" -#include "net/log/write_to_file_net_log_observer.h" +#include "net/log/file_net_log_observer.h" #include "net/socket/client_socket_factory.h" #include "net/socket/ssl_client_socket.h" #include "net/ssl/channel_id_service.h" @@ -251,7 +251,7 @@ // Network state. scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; net::NetLog net_log_; - std::unique_ptr<net::WriteToFileNetLogObserver> logger_; + std::unique_ptr<net::FileNetLogObserver> logger_; std::unique_ptr<net::HostResolver> host_resolver_; std::unique_ptr<net::CertVerifier> cert_verifier_; std::unique_ptr<net::ChannelIDService> system_channel_id_service_; @@ -310,7 +310,7 @@ MCSProbe::~MCSProbe() { if (logger_) - logger_->StopObserving(nullptr); + logger_->StopObserving(nullptr, base::OnceClosure()); file_thread_.Stop(); } @@ -377,20 +377,12 @@ } void MCSProbe::InitializeNetworkState() { - base::ScopedFILE log_file; if (command_line_.HasSwitch(kLogFileSwitch)) { base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch); -#if defined(OS_WIN) - log_file.reset(_wfopen(log_path.value().c_str(), L"w")); -#elif defined(OS_POSIX) - log_file.reset(fopen(log_path.value().c_str(), "w")); -#endif - } - if (log_file.get()) { - logger_.reset(new net::WriteToFileNetLogObserver()); - logger_->set_capture_mode( - net::NetLogCaptureMode::IncludeCookiesAndCredentials()); - logger_->StartObserving(&net_log_, std::move(log_file), nullptr, nullptr); + logger_ = net::FileNetLogObserver::CreateUnbounded(log_path, nullptr); + net::NetLogCaptureMode capture_mode = + net::NetLogCaptureMode::IncludeCookiesAndCredentials(); + logger_->StartObserving(&net_log_, capture_mode); } host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_); @@ -520,6 +512,8 @@ base::RunLoop run_loop; run_loop.Run(); + base::TaskScheduler::GetInstance()->Shutdown(); + return 0; }
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h index e1b0c6ff..752531e 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.h +++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -313,6 +313,13 @@ GLES2_UTILS_EXPORT bool IsWebGL1OrES2ContextType(ContextType context_type); GLES2_UTILS_EXPORT bool IsWebGL2OrES3ContextType(ContextType context_type); +enum ColorSpace { + COLOR_SPACE_UNSPECIFIED, + COLOR_SPACE_SRGB, + COLOR_SPACE_DISPLAY_P3, + COLOR_SPACE_LAST = COLOR_SPACE_DISPLAY_P3 +}; + struct GLES2_UTILS_EXPORT ContextCreationAttribHelper { ContextCreationAttribHelper(); ContextCreationAttribHelper(const ContextCreationAttribHelper& other); @@ -339,6 +346,7 @@ bool single_buffer; ContextType context_type; + ColorSpace color_space = COLOR_SPACE_UNSPECIFIED; }; } // namespace gles2
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 6b776d9..4a8a74d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3180,8 +3180,8 @@ surface_ = surface; // Set workarounds for the surface. - surface_->SetRelyOnImplicitSync( - workarounds().rely_on_implicit_sync_for_swap_buffers); + if (workarounds().rely_on_implicit_sync_for_swap_buffers) + surface_->SetRelyOnImplicitSync(); // Create GPU Tracer for timing values. gpu_tracer_.reset(new GPUTracer(this));
diff --git a/gpu/ipc/common/gpu_command_buffer_traits_multi.h b/gpu/ipc/common/gpu_command_buffer_traits_multi.h index 997db41..0594b75 100644 --- a/gpu/ipc/common/gpu_command_buffer_traits_multi.h +++ b/gpu/ipc/common/gpu_command_buffer_traits_multi.h
@@ -27,6 +27,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(gl::GpuPreference, gl::GpuPreferenceLast) IPC_ENUM_TRAITS_MAX_VALUE(gpu::gles2::ContextType, gpu::gles2::CONTEXT_TYPE_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(gpu::gles2::ColorSpace, gpu::gles2::COLOR_SPACE_LAST) IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities::ShaderPrecision) IPC_STRUCT_TRAITS_MEMBER(min_range) @@ -169,4 +170,5 @@ IPC_STRUCT_TRAITS_MEMBER(should_use_native_gmb_for_backbuffer) IPC_STRUCT_TRAITS_MEMBER(own_offscreen_surface) IPC_STRUCT_TRAITS_MEMBER(single_buffer) + IPC_STRUCT_TRAITS_MEMBER(color_space) IPC_STRUCT_TRAITS_END()
diff --git a/gpu/ipc/service/direct_composition_surface_win.cc b/gpu/ipc/service/direct_composition_surface_win.cc index 706fa86e..066edf0 100644 --- a/gpu/ipc/service/direct_composition_surface_win.cc +++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -474,8 +474,8 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain( const ui::DCRendererLayerParams& params) { - gl::GLImageDXGI* image_dxgi = - gl::GLImageDXGI::FromGLImage(params.image[0].get()); + gl::GLImageDXGIBase* image_dxgi = + gl::GLImageDXGIBase::FromGLImage(params.image[0].get()); gl::GLImageMemory* y_image_memory = nullptr; gl::GLImageMemory* uv_image_memory = nullptr; if (params.image.size() >= 2) { @@ -557,9 +557,13 @@ base::win::ScopedComPtr<ID3D11Texture2D> input_texture; UINT input_level; + base::win::ScopedComPtr<IDXGIKeyedMutex> keyed_mutex; if (image_dxgi) { input_texture = image_dxgi->texture(); input_level = (UINT)image_dxgi->level(); + if (!input_texture) + return; + input_texture.CopyTo(keyed_mutex.GetAddressOf()); staging_texture_.Reset(); } else { DCHECK(y_image_memory); @@ -624,6 +628,19 @@ } { + if (keyed_mutex) { + // The producer may still be using this texture for a short period of + // time, so wait long enough to hopefully avoid glitches. For example, + // all levels of the texture share the same keyed mutex, so if the + // hardware decoder acquired the mutex to decode into a different array + // level then it still may block here temporarily. + const int kMaxSyncTimeMs = 1000; + HRESULT hr = keyed_mutex->AcquireSync(0, kMaxSyncTimeMs); + if (FAILED(hr)) { + DLOG(ERROR) << "Error acquiring keyed mutex: " << std::hex << hr; + return; + } + } D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC in_desc = {}; in_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D; in_desc.Texture2D.ArraySlice = input_level; @@ -652,6 +669,10 @@ hr = video_context_->VideoProcessorBlt(video_processor_.Get(), out_view_.Get(), 0, 1, &stream); CHECK(SUCCEEDED(hr)); + if (keyed_mutex) { + HRESULT hr = keyed_mutex->ReleaseSync(0); + DCHECK(SUCCEEDED(hr)); + } } if (first_present) {
diff --git a/gpu/ipc/service/direct_composition_surface_win_unittest.cc b/gpu/ipc/service/direct_composition_surface_win_unittest.cc index 62d9cb5..264c44b 100644 --- a/gpu/ipc/service/direct_composition_surface_win_unittest.cc +++ b/gpu/ipc/service/direct_composition_surface_win_unittest.cc
@@ -111,7 +111,8 @@ base::win::ScopedComPtr<ID3D11Texture2D> CreateNV12Texture( const base::win::ScopedComPtr<ID3D11Device>& d3d11_device, - const gfx::Size& size) { + const gfx::Size& size, + bool shared) { D3D11_TEXTURE2D_DESC desc = {}; desc.Width = size.width(); desc.Height = size.height(); @@ -121,6 +122,10 @@ desc.Usage = D3D11_USAGE_DEFAULT; desc.SampleDesc.Count = 1; desc.BindFlags = 0; + if (shared) { + desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | + D3D11_RESOURCE_MISC_SHARED_NTHANDLE; + } std::vector<char> image_data(size.width() * size.height() * 3 / 2); // Y, U, and V should all be Oxff. Output color should be pink. @@ -317,7 +322,7 @@ gfx::Size texture_size(50, 50); base::win::ScopedComPtr<ID3D11Texture2D> texture = - CreateNV12Texture(d3d11_device, texture_size); + CreateNV12Texture(d3d11_device, texture_size, false); scoped_refptr<gl::GLImageDXGI> image_dxgi( new gl::GLImageDXGI(texture_size, nullptr)); @@ -493,7 +498,7 @@ gfx::Size texture_size(50, 50); base::win::ScopedComPtr<ID3D11Texture2D> texture = - CreateNV12Texture(d3d11_device, texture_size); + CreateNV12Texture(d3d11_device, texture_size, false); scoped_refptr<gl::GLImageDXGI> image_dxgi( new gl::GLImageDXGI(texture_size, nullptr)); @@ -582,5 +587,55 @@ context = nullptr; DestroySurface(std::move(surface_)); } + +TEST_F(DirectCompositionPixelTest, VideoHandleSwapchain) { + if (!CheckIfDCSupported()) + return; + InitializeSurface(); + surface_->SetEnableDCLayers(true); + gfx::Size window_size(100, 100); + + scoped_refptr<gl::GLContext> context = gl::init::CreateGLContext( + nullptr, surface_.get(), gl::GLContextAttribs()); + EXPECT_TRUE(surface_->Resize(window_size, 1.0, true)); + + base::win::ScopedComPtr<ID3D11Device> d3d11_device = + gl::QueryD3D11DeviceObjectFromANGLE(); + + gfx::Size texture_size(50, 50); + base::win::ScopedComPtr<ID3D11Texture2D> texture = + CreateNV12Texture(d3d11_device, texture_size, true); + base::win::ScopedComPtr<IDXGIResource1> resource; + texture.CopyTo(resource.GetAddressOf()); + HANDLE handle; + resource->CreateSharedHandle(nullptr, DXGI_SHARED_RESOURCE_READ, nullptr, + &handle); + + scoped_refptr<gl::GLImageDXGIHandle> image_dxgi(new gl::GLImageDXGIHandle( + texture_size, base::win::ScopedHandle(handle), 0)); + ASSERT_TRUE(image_dxgi->Initialize()); + + ui::DCRendererLayerParams params( + false, gfx::Rect(), 1, gfx::Transform(), + std::vector<scoped_refptr<gl::GLImage>>{image_dxgi}, + gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(window_size), 0, 0, 1.0, + 0); + surface_->ScheduleDCLayer(params); + + EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers()); + + Sleep(1000); + + SkColor expected_color = SkColorSetRGB(0xff, 0xb7, 0xff); + SkColor actual_color = + ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); + EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) + << std::hex << "Expected " << expected_color << " Actual " + << actual_color; + + context = nullptr; + DestroySurface(std::move(surface_)); +} + } // namespace } // namespace gpu
diff --git a/gpu/ipc/service/gpu_command_buffer_stub.cc b/gpu/ipc/service/gpu_command_buffer_stub.cc index adb1011d..75c30e8 100644 --- a/gpu/ipc/service/gpu_command_buffer_stub.cc +++ b/gpu/ipc/service/gpu_command_buffer_stub.cc
@@ -689,6 +689,19 @@ surface_ = default_surface; } } else { + switch (init_params.attribs.color_space) { + case gles2::COLOR_SPACE_UNSPECIFIED: + surface_format.SetColorSpace( + gl::GLSurfaceFormat::COLOR_SPACE_UNSPECIFIED); + break; + case gles2::COLOR_SPACE_SRGB: + surface_format.SetColorSpace(gl::GLSurfaceFormat::COLOR_SPACE_SRGB); + break; + case gles2::COLOR_SPACE_DISPLAY_P3: + surface_format.SetColorSpace( + gl::GLSurfaceFormat::COLOR_SPACE_DISPLAY_P3); + break; + } surface_ = ImageTransportSurface::CreateNativeSurface( AsWeakPtr(), surface_handle_, surface_format); if (!surface_ || !surface_->Initialize(surface_format)) {
diff --git a/headless/BUILD.gn b/headless/BUILD.gn index d692ed5..cda14cd 100644 --- a/headless/BUILD.gn +++ b/headless/BUILD.gn
@@ -382,6 +382,10 @@ "lib/headless_content_main_delegate.h", "lib/renderer/headless_content_renderer_client.cc", "lib/renderer/headless_content_renderer_client.h", + "lib/renderer/headless_render_frame_controller_impl.cc", + "lib/renderer/headless_render_frame_controller_impl.h", + "lib/renderer/headless_tab_socket_bindings.cc", + "lib/renderer/headless_tab_socket_bindings.h", ] deps += [ @@ -436,12 +440,17 @@ "lib/headless_content_main_delegate.h", "lib/renderer/headless_content_renderer_client.cc", "lib/renderer/headless_content_renderer_client.h", + "lib/renderer/headless_render_frame_controller_impl.cc", + "lib/renderer/headless_render_frame_controller_impl.h", + "lib/renderer/headless_tab_socket_bindings.cc", + "lib/renderer/headless_tab_socket_bindings.h", ] deps = [ ":headless", "//third_party/WebKit/public:blink_headers", "//ui/base", + "//v8", ] if (enable_basic_printing) { deps += [ "//components/printing/renderer" ] @@ -596,6 +605,8 @@ "test/headless_browser_test.cc", "test/headless_browser_test.h", "test/headless_test_launcher.cc", + "test/tab_socket_test.cc", + "test/tab_socket_test.h", "test/test_protocol_handler.cc", "test/test_protocol_handler.h", "test/test_url_request_job.cc",
diff --git a/headless/lib/browser/headless_net_log.cc b/headless/lib/browser/headless_net_log.cc index ef733c2..08a26f68 100644 --- a/headless/lib/browser/headless_net_log.cc +++ b/headless/lib/browser/headless_net_log.cc
@@ -4,24 +4,22 @@ #include "headless/lib/browser/headless_net_log.h" -#include <stdio.h> - #include <utility> +#include "base/bind.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/files/scoped_file.h" #include "base/memory/ptr_util.h" #include "base/values.h" #include "build/build_config.h" #include "content/public/common/content_switches.h" +#include "net/log/file_net_log_observer.h" #include "net/log/net_log_util.h" -#include "net/log/write_to_file_net_log_observer.h" namespace headless { namespace { -std::unique_ptr<base::Value> GetHeadlessConstants() { +std::unique_ptr<base::DictionaryValue> GetHeadlessConstants() { std::unique_ptr<base::DictionaryValue> constants_dict = net::GetNetConstants(); @@ -35,43 +33,24 @@ constants_dict->Set("clientInfo", std::move(dict)); - return std::move(constants_dict); + return constants_dict; } } // namespace HeadlessNetLog::HeadlessNetLog(const base::FilePath& log_path) { - // TODO(mmenke): Other than a different set of constants, this code is - // identical to code in ChromeNetLog. Consider merging the code. - - // Much like logging.h, bypass threading restrictions by using fopen - // directly. Have to write on a thread that's shutdown to handle events on - // shutdown properly, and posting events to another thread as they occur - // would result in an unbounded buffer size, so not much can be gained by - // doing this on another thread. It's only used when debugging, so - // performance is not a big concern. - base::ScopedFILE file; -#if defined(OS_WIN) - file.reset(_wfopen(log_path.value().c_str(), L"w")); -#elif defined(OS_POSIX) - file.reset(fopen(log_path.value().c_str(), "w")); -#endif - - if (!file) { - LOG(ERROR) << "Could not open file " << log_path.value() - << " for net logging"; - } else { - std::unique_ptr<base::Value> constants(GetHeadlessConstants()); - write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); - write_to_file_observer_->StartObserving(this, std::move(file), - constants.get(), nullptr); + if (!log_path.empty()) { + net::NetLogCaptureMode capture_mode = net::NetLogCaptureMode::Default(); + file_net_log_observer_ = net::FileNetLogObserver::CreateUnbounded( + log_path, GetHeadlessConstants()); + file_net_log_observer_->StartObserving(this, capture_mode); } } HeadlessNetLog::~HeadlessNetLog() { // Remove the observer we own before we're destroyed. - if (write_to_file_observer_) - write_to_file_observer_->StopObserving(nullptr); + if (file_net_log_observer_) + file_net_log_observer_->StopObserving(nullptr, base::OnceClosure()); } } // namespace headless
diff --git a/headless/lib/browser/headless_net_log.h b/headless/lib/browser/headless_net_log.h index ac33ee5..7c5fabf 100644 --- a/headless/lib/browser/headless_net_log.h +++ b/headless/lib/browser/headless_net_log.h
@@ -9,12 +9,16 @@ #include <string> #include "base/macros.h" -#include "net/log/write_to_file_net_log_observer.h" +#include "net/log/net_log.h" namespace base { class FilePath; } +namespace net { +class FileNetLogObserver; +} + namespace headless { class HeadlessNetLog : public net::NetLog { @@ -23,7 +27,7 @@ ~HeadlessNetLog() override; private: - std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; + std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_; DISALLOW_COPY_AND_ASSIGN(HeadlessNetLog); };
diff --git a/headless/lib/browser/headless_print_manager.cc b/headless/lib/browser/headless_print_manager.cc index 6dc7066a..0e71c188 100644 --- a/headless/lib/browser/headless_print_manager.cc +++ b/headless/lib/browser/headless_print_manager.cc
@@ -107,8 +107,10 @@ if (range.from < 1 || range.from > range.to) return SYNTAX_ERROR; - if (range.to > pages_count) + if (range.from > pages_count) return LIMIT_ERROR; + if (range.to > pages_count) + range.to = pages_count; // Page numbers are 1-based in the dictionary. // Page numbers are 0-based for the print settings.
diff --git a/headless/lib/browser/headless_printing_unittest.cc b/headless/lib/browser/headless_printing_unittest.cc index 4979aad9..2c9ae2d 100644 --- a/headless/lib/browser/headless_printing_unittest.cc +++ b/headless/lib/browser/headless_printing_unittest.cc
@@ -154,37 +154,51 @@ std::vector<int> pages; std::vector<int> expected_pages; + // "-" is full range of pages. PM::PageRangeStatus status = PM::PageRangeTextToPages("-", 10, &pages); expected_pages = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; EXPECT_EQ(expected_pages, pages); EXPECT_EQ(PM::PRINT_NO_ERROR, status); + // If no start page is specified, we start at first page. status = PM::PageRangeTextToPages("-5", 10, &pages); expected_pages = {0, 1, 2, 3, 4}; EXPECT_EQ(expected_pages, pages); EXPECT_EQ(PM::PRINT_NO_ERROR, status); + // If no end page is specified, we end at last page. status = PM::PageRangeTextToPages("5-", 10, &pages); expected_pages = {4, 5, 6, 7, 8, 9}; EXPECT_EQ(expected_pages, pages); EXPECT_EQ(PM::PRINT_NO_ERROR, status); + // Multiple ranges are separated by commas. status = PM::PageRangeTextToPages("1-3,9-10,4-6", 10, &pages); expected_pages = {0, 1, 2, 3, 4, 5, 8, 9}; EXPECT_EQ(expected_pages, pages); EXPECT_EQ(PM::PRINT_NO_ERROR, status); + // White space is ignored. status = PM::PageRangeTextToPages("1- 3, 9-10,4 -6", 10, &pages); expected_pages = {0, 1, 2, 3, 4, 5, 8, 9}; EXPECT_EQ(expected_pages, pages); EXPECT_EQ(PM::PRINT_NO_ERROR, status); + // End page beyond number of pages is supported and capped to number of pages. + status = PM::PageRangeTextToPages("1-10", 5, &pages); + expected_pages = {0, 1, 2, 3, 4}; + EXPECT_EQ(expected_pages, pages); + EXPECT_EQ(PM::PRINT_NO_ERROR, status); + + // Start page beyond number of pages results in error. status = PM::PageRangeTextToPages("1-3,9-10,4-6", 5, &pages); EXPECT_EQ(PM::LIMIT_ERROR, status); + // Invalid input results in error. status = PM::PageRangeTextToPages("abcd", 10, &pages); EXPECT_EQ(PM::SYNTAX_ERROR, status); + // Invalid input results in error. status = PM::PageRangeTextToPages("1-3,9-a10,4-6", 10, &pages); EXPECT_EQ(PM::SYNTAX_ERROR, status); }
diff --git a/headless/lib/browser/headless_tab_socket_impl.cc b/headless/lib/browser/headless_tab_socket_impl.cc index 1fc89a5..05e562c 100644 --- a/headless/lib/browser/headless_tab_socket_impl.cc +++ b/headless/lib/browser/headless_tab_socket_impl.cc
@@ -4,31 +4,153 @@ #include "headless/lib/browser/headless_tab_socket_impl.h" +#include "base/stl_util.h" +#include "content/public/browser/devtools_agent_host.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" +#include "services/service_manager/public/cpp/binder_registry.h" +#include "services/service_manager/public/cpp/interface_provider.h" + namespace headless { -HeadlessTabSocketImpl::HeadlessTabSocketImpl() : listener_(nullptr) {} +HeadlessTabSocketImpl::HeadlessTabSocketImpl(content::WebContents* web_contents) + : web_contents_(web_contents), + listener_(nullptr), + weak_ptr_factory_(this) {} HeadlessTabSocketImpl::~HeadlessTabSocketImpl() {} -void HeadlessTabSocketImpl::SendMessageToTab(const std::string& message) { - AwaitNextMessageFromEmbedderCallback callback; +// Wrangles the async responses to +// HeadlessRenderFrameControllerImpl::InstallTabSocket for which at most one +// should succeed. +class TabSocketInstallationController + : public base::RefCounted<TabSocketInstallationController> { + public: + TabSocketInstallationController( + int v8_execution_context_id, + size_t render_frame_count, + base::WeakPtr<HeadlessTabSocketImpl> headless_tab_socket_impl, + base::Callback<void(bool)> callback) + : v8_execution_context_id_(v8_execution_context_id), + render_frame_count_(render_frame_count), + headless_tab_socket_impl_(headless_tab_socket_impl), + callback_(callback), + success_(false) {} - { - base::AutoLock lock(lock_); - if (waiting_for_message_cb_.is_null() || !outgoing_message_queue_.empty()) { - outgoing_message_queue_.push_back(message); - return; - } else { - callback = std::move(waiting_for_message_cb_); - DCHECK(waiting_for_message_cb_.is_null()); + void InstallTabSocketCallback(content::RenderFrameHost* render_frame_host, + bool success) { + render_frame_count_--; + + // It's possible the HeadlessTabSocketImpl went away, if that happened we + // don't want to pretend TabSocket installation succeeded. + if (!headless_tab_socket_impl_) + success = false; + + if (success) { + CHECK(!success_) << "At most one InstallTabSocket call should succeed!"; + success_ = true; + headless_tab_socket_impl_->v8_execution_context_id_to_render_frame_host_ + .insert(std::make_pair(v8_execution_context_id_, render_frame_host)); + + callback_.Run(true); + } else if (render_frame_count_ == 0 && !success_) { + callback_.Run(false); } } - std::move(callback).Run(message); + private: + int v8_execution_context_id_; + size_t render_frame_count_; + + base::WeakPtr<HeadlessTabSocketImpl> headless_tab_socket_impl_; + base::Callback<void(bool)> callback_; + bool success_; + + friend class base::RefCounted<TabSocketInstallationController>; + ~TabSocketInstallationController() {} +}; + +void HeadlessTabSocketImpl::InstallHeadlessTabSocketBindings( + int v8_execution_context_id, + base::Callback<void(bool)> callback) { + // We need to find the right RenderFrameHost to install the bindings on but + // the browser doesn't know which RenderFrameHost |v8_execution_context_id| + // corresponds to if any. So we try all of them. + scoped_refptr<TabSocketInstallationController> + tab_socket_installation_controller = new TabSocketInstallationController( + v8_execution_context_id, render_frame_hosts_.size(), + weak_ptr_factory_.GetWeakPtr(), callback); + for (content::RenderFrameHost* render_frame_host : render_frame_hosts_) { + HeadlessRenderFrameControllerPtr& headless_render_frame_controller = + render_frame_controllers_[render_frame_host]; + if (!headless_render_frame_controller.is_bound()) { + render_frame_host->GetRemoteInterfaces()->GetInterface( + &headless_render_frame_controller); + } + + // This will only succeed if the |render_frame_host_controller| contains + // |v8_execution_context_id|. The TabSocketInstallationController keeps + // track of how many callbacks have been received and if all of them have + // been unsuccessful it runs |callback| with false. If one of them succeeds + // it runs |callback| with true. + headless_render_frame_controller->InstallTabSocket( + v8_execution_context_id, + base::Bind(&TabSocketInstallationController::InstallTabSocketCallback, + tab_socket_installation_controller, render_frame_host)); + } +} + +void HeadlessTabSocketImpl::InstallMainFrameMainWorldHeadlessTabSocketBindings( + base::Callback<void(base::Optional<int>)> callback) { + content::RenderFrameHost* main_frame = web_contents_->GetMainFrame(); + HeadlessRenderFrameControllerPtr& headless_render_frame_controller = + render_frame_controllers_[main_frame]; + if (!headless_render_frame_controller.is_bound()) { + main_frame->GetRemoteInterfaces()->GetInterface( + &headless_render_frame_controller); + } + headless_render_frame_controller->InstallMainWorldTabSocket( + base::Bind(&HeadlessTabSocketImpl::OnInstallMainWorldTabSocket, + weak_ptr_factory_.GetWeakPtr(), callback)); +} + +void HeadlessTabSocketImpl::OnInstallMainWorldTabSocket( + base::Callback<void(base::Optional<int>)> callback, + int v8_execution_context_id) { + if (v8_execution_context_id == -1) { + callback.Run(base::nullopt); + } else { + v8_execution_context_id_to_render_frame_host_.insert( + std::make_pair(v8_execution_context_id, web_contents_->GetMainFrame())); + callback.Run(v8_execution_context_id); + } +} + +void HeadlessTabSocketImpl::SendMessageToContext( + const std::string& message, + int32_t v8_execution_context_id) { + auto render_frame_host = v8_execution_context_id_to_render_frame_host_.find( + v8_execution_context_id); + if (render_frame_host == + v8_execution_context_id_to_render_frame_host_.end()) { + LOG(WARNING) << "Unknown v8_execution_context_id " + << v8_execution_context_id; + return; + } + + auto render_frame_controller = + render_frame_controllers_.find(render_frame_host->second); + if (render_frame_controller == render_frame_controllers_.end()) { + LOG(WARNING) << "Unknown RenderFrameHist " << render_frame_host->second; + return; + } + render_frame_controller->second->SendMessageToTabSocket( + message, v8_execution_context_id); } void HeadlessTabSocketImpl::SetListener(Listener* listener) { - std::list<std::string> messages; + MessageQueue messages; { base::AutoLock lock(lock_); @@ -36,44 +158,33 @@ if (!listener) return; - std::swap(messages, incoming_message_queue_); + std::swap(messages, from_tab_message_queue_); } - for (const std::string& message : messages) { - listener_->OnMessageFromTab(message); + for (const Message& message : messages) { + listener_->OnMessageFromContext(message.first, message.second); } } -void HeadlessTabSocketImpl::SendMessageToEmbedder(const std::string& message) { +void HeadlessTabSocketImpl::SendMessageToEmbedder( + const std::string& message, + int32_t v8_execution_context_id) { Listener* listener = nullptr; { base::AutoLock lock(lock_); + CHECK(v8_execution_context_id_to_render_frame_host_.find( + v8_execution_context_id) != + v8_execution_context_id_to_render_frame_host_.end()) + << "Unknown v8_execution_context_id " << v8_execution_context_id; if (listener_) { listener = listener_; } else { - incoming_message_queue_.push_back(message); + from_tab_message_queue_.emplace_back(message, v8_execution_context_id); return; } } - listener->OnMessageFromTab(message); -} - -void HeadlessTabSocketImpl::AwaitNextMessageFromEmbedder( - AwaitNextMessageFromEmbedderCallback callback) { - std::string message; - { - base::AutoLock lock(lock_); - if (outgoing_message_queue_.empty()) { - waiting_for_message_cb_ = std::move(callback); - DCHECK(!waiting_for_message_cb_.is_null()); - return; - } else { - message = outgoing_message_queue_.front(); - outgoing_message_queue_.pop_front(); - } - } - std::move(callback).Run(message); + listener->OnMessageFromContext(message, v8_execution_context_id); } void HeadlessTabSocketImpl::CreateMojoService( @@ -81,4 +192,23 @@ mojo_bindings_.AddBinding(this, std::move(request)); } +void HeadlessTabSocketImpl::RenderFrameCreated( + content::RenderFrameHost* render_frame_host) { + render_frame_hosts_.insert(render_frame_host); +} + +void HeadlessTabSocketImpl::RenderFrameDeleted( + content::RenderFrameHost* render_frame_host) { + // Remove all entries from |v8_execution_context_id_to_render_frame_host_| + // where the mapped value is |render_frame_host|. + base::EraseIf(v8_execution_context_id_to_render_frame_host_, + [render_frame_host]( + const std::pair<int, content::RenderFrameHost*>& pair) { + return render_frame_host == pair.second; + }); + + render_frame_controllers_.erase(render_frame_host); + render_frame_hosts_.erase(render_frame_host); +} + } // namespace headless
diff --git a/headless/lib/browser/headless_tab_socket_impl.h b/headless/lib/browser/headless_tab_socket_impl.h index 45796be..e77f379 100644 --- a/headless/lib/browser/headless_tab_socket_impl.h +++ b/headless/lib/browser/headless_tab_socket_impl.h
@@ -8,38 +8,75 @@ #include <list> #include "base/synchronization/lock.h" +#include "headless/lib/headless_render_frame_controller.mojom.h" #include "headless/lib/tab_socket.mojom.h" #include "headless/public/headless_tab_socket.h" #include "mojo/public/cpp/bindings/binding_set.h" +namespace content { +class RenderFrameHost; +class WebContents; +} // namespace content + namespace headless { class HeadlessTabSocketImpl : public HeadlessTabSocket, public TabSocket { public: - HeadlessTabSocketImpl(); + explicit HeadlessTabSocketImpl(content::WebContents* web_contents); ~HeadlessTabSocketImpl() override; // HeadlessTabSocket implementation: - void SendMessageToTab(const std::string& message) override; + void InstallHeadlessTabSocketBindings( + int v8_execution_context_id, + base::Callback<void(bool)> callback) override; + void InstallMainFrameMainWorldHeadlessTabSocketBindings( + base::Callback<void(base::Optional<int>)> callback) override; + void SendMessageToContext(const std::string& message, + int v8_execution_context_id) override; void SetListener(Listener* listener) override; // TabSocket implementation: - void SendMessageToEmbedder(const std::string& message) override; - void AwaitNextMessageFromEmbedder( - AwaitNextMessageFromEmbedderCallback callback) override; + void SendMessageToEmbedder(const std::string& message, + int32_t v8_execution_context_id) override; void CreateMojoService(mojo::InterfaceRequest<TabSocket> request); + void RenderFrameCreated(content::RenderFrameHost* render_frame_host); + void RenderFrameDeleted(content::RenderFrameHost* render_frame_host); + private: + friend class TabSocketInstallationController; + + // Called by WebContents::ForEachFrame. If |render_frame_host| matches + // |target_devtools_frame_id|, then the RenderFrameController is used to + // install TabSocket bindings in |world_id|, otherwise it does nothing. + void MaybeInstallTabSocketBindings( + std::string target_devtools_frame_id, + int v8_execution_context_id, + base::Callback<void(bool)> callback, + content::RenderFrameHost* render_frame_host); + + void OnInstallMainWorldTabSocket( + base::Callback<void(base::Optional<int>)> callback, + int world_id); + base::Lock lock_; // Protects everything below. - AwaitNextMessageFromEmbedderCallback waiting_for_message_cb_; - std::list<std::string> outgoing_message_queue_; - std::list<std::string> incoming_message_queue_; + using Message = std::pair<std::string, int>; + using MessageQueue = std::list<Message>; + + MessageQueue from_tab_message_queue_; + content::WebContents* web_contents_; // NOT OWNED Listener* listener_; // NOT OWNED - // Must be listed last so it gets destructed before |waiting_for_message_cb_|. mojo::BindingSet<TabSocket> mojo_bindings_; + std::set<content::RenderFrameHost*> render_frame_hosts_; + std::map<int, content::RenderFrameHost*> + v8_execution_context_id_to_render_frame_host_; + std::map<content::RenderFrameHost*, HeadlessRenderFrameControllerPtr> + render_frame_controllers_; + base::WeakPtrFactory<HeadlessTabSocketImpl> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(HeadlessTabSocketImpl); };
diff --git a/headless/lib/browser/headless_url_request_context_getter.cc b/headless/lib/browser/headless_url_request_context_getter.cc index bb00b63a..3b1d2db 100644 --- a/headless/lib/browser/headless_url_request_context_getter.cc +++ b/headless/lib/browser/headless_url_request_context_getter.cc
@@ -29,8 +29,6 @@ net::NetLog* net_log, HeadlessBrowserContextImpl* headless_browser_context) : io_task_runner_(std::move(io_task_runner)), - file_task_runner_(base::CreateSingleThreadTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::BACKGROUND})), user_agent_(options->user_agent()), host_resolver_rules_(options->host_resolver_rules()), proxy_config_(options->proxy_config()), @@ -70,7 +68,6 @@ // TODO(skyostil): Make these configurable. builder.set_data_enabled(true); builder.set_file_enabled(true); - builder.SetFileTaskRunner(file_task_runner_); if (proxy_config_) { builder.set_proxy_service(net::ProxyService::CreateFixed(*proxy_config_)); } else {
diff --git a/headless/lib/browser/headless_url_request_context_getter.h b/headless/lib/browser/headless_url_request_context_getter.h index 5080fa89..5ee7c7f 100644 --- a/headless/lib/browser/headless_url_request_context_getter.h +++ b/headless/lib/browser/headless_url_request_context_getter.h
@@ -53,9 +53,6 @@ private: scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; - // TODO(eseckler): This should become a SequencedTaskRunner once net:: APIs - // accept a SequencedTaskRunner, see https://crbug.com/735368. - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; // The |options| object given to the constructor is not guaranteed to outlive // this class, so we make copies of the parts we need to access on the IO
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc index 5241fac..9b6ba0f 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -33,8 +33,6 @@ #include "headless/lib/browser/headless_devtools_client_impl.h" #include "headless/lib/browser/headless_tab_socket_impl.h" #include "printing/features/features.h" -#include "services/service_manager/public/cpp/binder_registry.h" -#include "services/service_manager/public/cpp/interface_provider.h" #if BUILDFLAG(ENABLE_BASIC_PRINTING) #include "headless/lib/browser/headless_print_manager.h" @@ -132,11 +130,11 @@ content::WebContents::Create(create_params), builder->browser_context_)); - if (builder->tab_socket_type_ != Builder::TabSocketType::NONE) { + if (builder->tab_sockets_allowed_) { headless_web_contents->headless_tab_socket_ = - base::MakeUnique<HeadlessTabSocketImpl>(); - headless_web_contents->inject_mojo_services_into_isolated_world_ = - builder->tab_socket_type_ == Builder::TabSocketType::ISOLATED_WORLD; + base::MakeUnique<HeadlessTabSocketImpl>( + headless_web_contents->web_contents_.get()); + headless_web_contents->inject_mojo_services_into_isolated_world_ = true; builder->mojo_services_.emplace_back( TabSocket::Name_, base::Bind(&CreateTabSocketMojoServiceForContents)); @@ -163,7 +161,8 @@ // Copy mojo services and tab socket settings from parent. child->mojo_services_ = parent->mojo_services_; if (parent->headless_tab_socket_) { - child->headless_tab_socket_ = base::MakeUnique<HeadlessTabSocketImpl>(); + child->headless_tab_socket_ = + base::MakeUnique<HeadlessTabSocketImpl>(child_contents); child->inject_mojo_services_into_isolated_world_ = parent->inject_mojo_services_into_isolated_world_; } @@ -227,30 +226,6 @@ void HeadlessWebContentsImpl::RenderFrameCreated( content::RenderFrameHost* render_frame_host) { - render_frame_host->GetRemoteInterfaces()->GetInterface( - &render_frame_controller_); - if (!mojo_services_.empty()) { - base::Closure callback; - // We only fire DevToolsTargetReady when the tab socket is set up for the - // main frame. - // TODO(eseckler): To indicate tab socket readiness for child frames, we - // need to send an event via the parent frame's DevTools connection instead. - if (render_frame_host == web_contents()->GetMainFrame()) { - callback = - base::Bind(&HeadlessWebContentsImpl::MainFrameTabSocketSetupComplete, - weak_ptr_factory_.GetWeakPtr()); - } - render_frame_controller_->AllowTabSocketBindings( - inject_mojo_services_into_isolated_world_ - ? MojoBindingsPolicy::ISOLATED_WORLD - : MojoBindingsPolicy::MAIN_WORLD, - callback); - } else if (render_frame_host == web_contents()->GetMainFrame()) { - // Pretend we set up the TabSocket, which allows the DevToolsTargetReady - // event to fire. - MainFrameTabSocketSetupComplete(); - } - service_manager::BinderRegistry* interface_registry = render_frame_host->GetInterfaceRegistry(); @@ -265,10 +240,14 @@ browser_context_->SetFrameTreeNodeId(render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID(), render_frame_host->GetFrameTreeNodeId()); + if (headless_tab_socket_) + headless_tab_socket_->RenderFrameCreated(render_frame_host); } void HeadlessWebContentsImpl::RenderFrameDeleted( content::RenderFrameHost* render_frame_host) { + if (headless_tab_socket_) + headless_tab_socket_->RenderFrameDeleted(render_frame_host); browser_context_->RemoveFrameTreeNode( render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID()); @@ -276,18 +255,6 @@ void HeadlessWebContentsImpl::RenderViewReady() { DCHECK(web_contents()->GetMainFrame()->IsRenderFrameLive()); - render_view_ready_ = true; - MaybeIssueDevToolsTargetReady(); -} - -void HeadlessWebContentsImpl::MainFrameTabSocketSetupComplete() { - main_frame_tab_socket_setup_complete_ = true; - MaybeIssueDevToolsTargetReady(); -} - -void HeadlessWebContentsImpl::MaybeIssueDevToolsTargetReady() { - if (!main_frame_tab_socket_setup_complete_ || !render_view_ready_) - return; for (auto& observer : observers_) observer.DevToolsTargetReady(); @@ -424,9 +391,9 @@ return *this; } -HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetTabSocketType( - TabSocketType type) { - tab_socket_type_ = type; +HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetAllowTabSockets( + bool tab_sockets_allowed) { + tab_sockets_allowed_ = tab_sockets_allowed; return *this; }
diff --git a/headless/lib/browser/headless_web_contents_impl.h b/headless/lib/browser/headless_web_contents_impl.h index f8fafb9..af14c7a 100644 --- a/headless/lib/browser/headless_web_contents_impl.h +++ b/headless/lib/browser/headless_web_contents_impl.h
@@ -15,7 +15,6 @@ #include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/web_contents_observer.h" #include "headless/lib/browser/headless_window_tree_host.h" -#include "headless/lib/headless_render_frame_controller.mojom.h" #include "headless/public/headless_devtools_target.h" #include "headless/public/headless_export.h" #include "headless/public/headless_web_contents.h" @@ -120,9 +119,6 @@ HeadlessWebContentsImpl(content::WebContents* web_contents, HeadlessBrowserContextImpl* browser_context); - void MainFrameTabSocketSetupComplete(); - void MaybeIssueDevToolsTargetReady(); - void InitializeWindow(const gfx::Rect& initial_bounds); using MojoService = HeadlessWebContents::Builder::MojoService; @@ -135,21 +131,17 @@ std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_; int window_id_ = 0; std::string window_state_; + std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_; std::unique_ptr<content::WebContents> web_contents_; scoped_refptr<content::DevToolsAgentHost> agent_host_; std::list<MojoService> mojo_services_; bool inject_mojo_services_into_isolated_world_; - std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_; - bool render_view_ready_ = false; - bool main_frame_tab_socket_setup_complete_ = false; HeadlessBrowserContextImpl* browser_context_; // Not owned. // TODO(alexclarke): With OOPIF there may be more than one renderer, we need // to fix this. See crbug.com/715924 content::RenderProcessHost* render_process_host_; // Not owned. - HeadlessRenderFrameControllerPtr render_frame_controller_; - base::ObserverList<HeadlessWebContents::Observer> observers_; base::WeakPtrFactory<HeadlessWebContentsImpl> weak_ptr_factory_;
diff --git a/headless/lib/headless_devtools_client_browsertest.cc b/headless/lib/headless_devtools_client_browsertest.cc index 47cecdf4..8a4e549 100644 --- a/headless/lib/headless_devtools_client_browsertest.cc +++ b/headless/lib/headless_devtools_client_browsertest.cc
@@ -1484,4 +1484,95 @@ HEADLESS_ASYNC_DEVTOOLED_TEST_F(DevToolsSetCookieTest); +class DevtoolsInterceptionWithAuthProxyTest + : public HeadlessAsyncDevTooledBrowserTest, + public network::ExperimentalObserver, + public page::Observer { + public: + DevtoolsInterceptionWithAuthProxyTest() + : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, + net::SpawnedTestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("headless/test/data"))) { + } + + void SetUp() override { + ASSERT_TRUE(proxy_server_.Start()); + HeadlessAsyncDevTooledBrowserTest::SetUp(); + } + + void RunDevTooledTest() override { + EXPECT_TRUE(embedded_test_server()->Start()); + devtools_client_->GetNetwork()->GetExperimental()->AddObserver(this); + devtools_client_->GetNetwork()->Enable(); + devtools_client_->GetNetwork() + ->GetExperimental() + ->SetRequestInterceptionEnabled( + network::SetRequestInterceptionEnabledParams::Builder() + .SetEnabled(true) + .Build()); + + devtools_client_->GetPage()->AddObserver(this); + + base::RunLoop run_loop; + devtools_client_->GetPage()->Enable(run_loop.QuitClosure()); + base::MessageLoop::ScopedNestableTaskAllower nest_loop( + base::MessageLoop::current()); + run_loop.Run(); + + devtools_client_->GetPage()->Navigate( + embedded_test_server()->GetURL("/dom_tree_test.html").spec()); + } + + void OnRequestIntercepted( + const network::RequestInterceptedParams& params) override { + if (params.HasAuthChallenge()) { + auth_challenge_seen_ = true; + devtools_client_->GetNetwork() + ->GetExperimental() + ->ContinueInterceptedRequest( + network::ContinueInterceptedRequestParams::Builder() + .SetInterceptionId(params.GetInterceptionId()) + .SetAuthChallengeResponse( + network::AuthChallengeResponse::Builder() + .SetResponse(network::AuthChallengeResponseResponse:: + PROVIDE_CREDENTIALS) + .SetUsername("foo") // These are tested by the proxy. + .SetPassword("bar") + .Build()) + .Build()); + } else { + devtools_client_->GetNetwork() + ->GetExperimental() + ->ContinueInterceptedRequest( + network::ContinueInterceptedRequestParams::Builder() + .SetInterceptionId(params.GetInterceptionId()) + .Build()); + GURL url(params.GetRequest()->GetUrl()); + files_loaded_.insert(url.path()); + } + } + + void OnLoadEventFired(const page::LoadEventFiredParams&) override { + EXPECT_TRUE(auth_challenge_seen_); + EXPECT_THAT(files_loaded_, + ElementsAre("/Ahem.ttf", "/dom_tree_test.css", + "/dom_tree_test.html", "/iframe.html")); + FinishAsynchronousTest(); + } + + std::unique_ptr<net::ProxyConfig> GetProxyConfig() override { + std::unique_ptr<net::ProxyConfig> proxy_config(new net::ProxyConfig); + proxy_config->proxy_rules().ParseFromString( + proxy_server_.host_port_pair().ToString()); + return proxy_config; + } + + private: + net::SpawnedTestServer proxy_server_; + bool auth_challenge_seen_ = false; + std::set<std::string> files_loaded_; +}; + +HEADLESS_ASYNC_DEVTOOLED_TEST_F(DevtoolsInterceptionWithAuthProxyTest); + } // namespace headless
diff --git a/headless/lib/headless_render_frame_controller.mojom b/headless/lib/headless_render_frame_controller.mojom index f8ff294..2d71341f1 100644 --- a/headless/lib/headless_render_frame_controller.mojom +++ b/headless/lib/headless_render_frame_controller.mojom
@@ -4,17 +4,18 @@ module headless; -enum MojoBindingsPolicy { - // No access to the TabSocket API from within the frame. - NONE, - // Allow main world JS content within the frame to access the TabSocket API. - MAIN_WORLD, - // Allow access to the TabSocket API only from within DevTools-created - // isolated worlds for the frame. - ISOLATED_WORLD -}; - interface HeadlessRenderFrameController { - // Set the bindings policy for TabSocket mojo services for a frame. - AllowTabSocketBindings(MojoBindingsPolicy policy) => (); + // Installs TabSocket bindings into a specified execution context. + InstallTabSocket(int32 v8_execution_context_id) => (bool success); + + // Installs TabSocket bindings into the main world. This is useful if you + // don't know the execution context id (e.g. you don't have devtools + // connected). + InstallMainWorldTabSocket() => (int32 v8_execution_context_id); + + // Send a message from the C++ embedder to the Tab. + SendMessageToTabSocket(string message, int32 v8_execution_context_id); + + // To send a message from tab to the embedder use + // TabSocket::SendMessageToEmbedder. };
diff --git a/headless/lib/headless_web_contents_browsertest.cc b/headless/lib/headless_web_contents_browsertest.cc index f13774ec..9d4196ccb 100644 --- a/headless/lib/headless_web_contents_browsertest.cc +++ b/headless/lib/headless_web_contents_browsertest.cc
@@ -8,16 +8,18 @@ #include "base/base64.h" #include "base/json/json_writer.h" +#include "base/strings/stringprintf.h" #include "content/public/test/browser_test.h" #include "headless/lib/browser/headless_web_contents_impl.h" +#include "headless/public/devtools/domains/dom_snapshot.h" #include "headless/public/devtools/domains/page.h" #include "headless/public/devtools/domains/runtime.h" #include "headless/public/devtools/domains/security.h" #include "headless/public/headless_browser.h" #include "headless/public/headless_devtools_client.h" -#include "headless/public/headless_tab_socket.h" #include "headless/public/headless_web_contents.h" #include "headless/test/headless_browser_test.h" +#include "headless/test/tab_socket_test.h" #include "printing/features/features.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -108,7 +110,8 @@ class HeadlessWindowOpenTabSocketTest : public HeadlessBrowserTest, public HeadlessTabSocket::Listener, public HeadlessBrowserContext::Observer, - public HeadlessWebContents::Observer { + public HeadlessWebContents::Observer, + public runtime::Observer { public: HeadlessWindowOpenTabSocketTest() : devtools_client_(HeadlessDevToolsClient::Create()) {} @@ -119,7 +122,8 @@ } // HeadlessTabSocket::Listener implementation. - void OnMessageFromTab(const std::string& message) override { + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { message_ = message; FinishAsynchronousTest(); } @@ -138,6 +142,49 @@ // Verify tab socket of child_contents works. child_->GetDevToolsTarget()->AttachClient(devtools_client_.get()); + + devtools_client_->GetPage()->Enable(); + devtools_client_->GetPage()->GetExperimental()->GetResourceTree( + page::GetResourceTreeParams::Builder().Build(), + base::Bind(&HeadlessWindowOpenTabSocketTest::OnResourceTree, + base::Unretained(this))); + } + + void OnResourceTree(std::unique_ptr<page::GetResourceTreeResult> result) { + child_frame_id_ = result->GetFrameTree()->GetFrame()->GetId(); + devtools_client_->GetRuntime()->AddObserver(this); + // This will trigger OnExecutionContextCreated getting called for all + // existing contexts. + devtools_client_->GetRuntime()->Enable(); + } + + // runtime::Observer implementation. + void OnExecutionContextCreated( + const runtime::ExecutionContextCreatedParams& params) override { + const base::DictionaryValue* dictionary; + std::string frame_id; + if (params.GetContext()->HasAuxData() && + params.GetContext()->GetAuxData()->GetAsDictionary(&dictionary) && + dictionary->GetString("frameId", &frame_id) && + frame_id == *child_frame_id_) { + child_frame_execution_context_id_ = params.GetContext()->GetId(); + + HeadlessTabSocket* tab_socket = child_->GetHeadlessTabSocket(); + CHECK(tab_socket); + tab_socket->InstallHeadlessTabSocketBindings( + *child_frame_execution_context_id_, + base::Bind(&HeadlessWindowOpenTabSocketTest::OnTabSocketInstalled, + base::Unretained(this))); + } + } + + void OnTabSocketInstalled(bool success) { + ASSERT_TRUE(success); + HeadlessTabSocket* tab_socket = child_->GetHeadlessTabSocket(); + CHECK(tab_socket); + tab_socket->SendMessageToContext("One", *child_frame_execution_context_id_); + tab_socket->SetListener(this); + devtools_client_->GetRuntime()->Evaluate( R"(window.TabSocket.onmessage = function(message) { @@ -150,14 +197,12 @@ void OnEvaluateResult(std::unique_ptr<runtime::EvaluateResult> result) { child_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); - - HeadlessTabSocket* tab_socket = child_->GetHeadlessTabSocket(); - tab_socket->SendMessageToTab("One"); - tab_socket->SetListener(this); } protected: std::string message_; + base::Optional<std::string> child_frame_id_; + base::Optional<int> child_frame_execution_context_id_; HeadlessWebContents* child_ = nullptr; std::unique_ptr<HeadlessDevToolsClient> devtools_client_; }; @@ -172,8 +217,7 @@ HeadlessWebContents* web_contents = browser_context->CreateWebContentsBuilder() - .SetTabSocketType( - HeadlessWebContents::Builder::TabSocketType::MAIN_WORLD) + .SetAllowTabSockets(true) .SetInitialURL(embedded_test_server()->GetURL("/window_open.html")) .Build(); EXPECT_TRUE(WaitForLoad(web_contents)); @@ -185,6 +229,66 @@ EXPECT_EQ("Embedder sent us: One", message_); } +class HeadlessNoDevToolsTabSocketTest : public HeadlessBrowserTest, + public HeadlessTabSocket::Listener { + public: + HeadlessNoDevToolsTabSocketTest() {} + + void SetUp() override { + options()->mojo_service_names.insert("headless::TabSocket"); + HeadlessBrowserTest::SetUp(); + } + + // HeadlessTabSocket::Listener implementation. + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { + EXPECT_EQ(*execution_context_id_, execution_context_id); + messages_.push_back(message); + + if (messages_.size() == 2) { + EXPECT_THAT(messages_, + ElementsAre("Hello world!", "Embedder sent us: One")); + FinishAsynchronousTest(); + } + } + + void OnInstalledHeadlessTabSocket(base::Optional<int> execution_context_id) { + EXPECT_TRUE(!!execution_context_id); + if (!execution_context_id) { + FinishAsynchronousTest(); + } else { + execution_context_id_ = execution_context_id; + tab_socket_->SendMessageToContext("One", *execution_context_id); + } + } + + std::vector<std::string> messages_; + HeadlessTabSocket* tab_socket_; + base::Optional<int> execution_context_id_; +}; + +IN_PROC_BROWSER_TEST_F(HeadlessNoDevToolsTabSocketTest, Test) { + EXPECT_TRUE(embedded_test_server()->Start()); + + HeadlessBrowserContext* browser_context = + browser()->CreateBrowserContextBuilder().Build(); + + HeadlessWebContents* web_contents = + browser_context->CreateWebContentsBuilder() + .SetAllowTabSockets(true) + .SetInitialURL(embedded_test_server()->GetURL("/tabsocket.html")) + .Build(); + + tab_socket_ = web_contents->GetHeadlessTabSocket(); + CHECK(tab_socket_); + tab_socket_->InstallMainFrameMainWorldHeadlessTabSocketBindings( + base::Bind(&HeadlessNoDevToolsTabSocketTest::OnInstalledHeadlessTabSocket, + base::Unretained(this))); + tab_socket_->SetListener(this); + + RunAsynchronousTest(); +} + IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, Focus) { EXPECT_TRUE(embedded_test_server()->Start()); @@ -424,40 +528,45 @@ FinishAsynchronousTest(); } - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::NONE; - } + bool GetAllowTabSockets() override { return false; } }; HEADLESS_ASYNC_DEVTOOLED_TEST_F(GetHeadlessTabSocketButNoTabSocket); -class HeadlessMainWorldTabSocketTest : public HeadlessAsyncDevTooledBrowserTest, - public HeadlessTabSocket::Listener { +class MainWorldHeadlessTabSocketTest : public TabSocketTest { public: - void SetUp() override { - options()->mojo_service_names.insert("headless::TabSocket"); - HeadlessAsyncDevTooledBrowserTest::SetUp(); + void RunTabSocketTest() override { + CreateMainWorldTabSocket( + main_frame_id(), + base::Bind( + &MainWorldHeadlessTabSocketTest::OnInstalledHeadlessTabSocket, + base::Unretained(this))); } - void RunDevTooledTest() override { + void OnInstalledHeadlessTabSocket(int execution_context_id) { devtools_client_->GetRuntime()->Evaluate( R"(window.TabSocket.onmessage = function(message) { window.TabSocket.send('Embedder sent us: ' + message); }; - )"); + )", + base::Bind(&MainWorldHeadlessTabSocketTest::FailOnJsEvaluateException, + base::Unretained(this))); HeadlessTabSocket* headless_tab_socket = web_contents_->GetHeadlessTabSocket(); DCHECK(headless_tab_socket); - headless_tab_socket->SendMessageToTab("One"); - headless_tab_socket->SendMessageToTab("Two"); - headless_tab_socket->SendMessageToTab("Three"); + headless_tab_socket->SendMessageToContext("One", execution_context_id); + headless_tab_socket->SendMessageToContext("Two", execution_context_id); + headless_tab_socket->SendMessageToContext("Three", execution_context_id); headless_tab_socket->SetListener(this); + main_frame_execution_context_id_ = execution_context_id; } - void OnMessageFromTab(const std::string& message) override { + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { + EXPECT_EQ(execution_context_id, *main_frame_execution_context_id_); messages_.push_back(message); if (messages_.size() == 3u) { EXPECT_THAT(messages_, @@ -467,216 +576,248 @@ } } - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::MAIN_WORLD; + private: + std::vector<std::string> messages_; + base::Optional<int> main_frame_execution_context_id_; +}; + +HEADLESS_ASYNC_DEVTOOLED_TEST_F(MainWorldHeadlessTabSocketTest); + +class MainWorldHeadlessTabSocketBindingsNotInstalledTest + : public TabSocketTest { + public: + void RunTabSocketTest() override { + CreateIsolatedWorldTabSocket( + "Test World", main_frame_id(), + base::Bind(&MainWorldHeadlessTabSocketBindingsNotInstalledTest:: + OnIsolatedWorldCreated, + base::Unretained(this))); } - private: + void OnIsolatedWorldCreated(int execution_context_id) { + // We expect this to fail because TabSocket bindings where injected into the + // isolated world not the main world. + devtools_client_->GetRuntime()->Evaluate( + "window.TabSocket.send('This should not work!');", + base::Bind(&MainWorldHeadlessTabSocketBindingsNotInstalledTest:: + ExpectJsException, + base::Unretained(this))); + + HeadlessTabSocket* headless_tab_socket = + web_contents_->GetHeadlessTabSocket(); + DCHECK(headless_tab_socket); + + headless_tab_socket->SetListener(this); + } + + void OnMessageFromContext(const std::string&, int) override { + FinishAsynchronousTest(); + FAIL() << "Should not receive a message from the tab!"; + } +}; + +HEADLESS_ASYNC_DEVTOOLED_TEST_F( + MainWorldHeadlessTabSocketBindingsNotInstalledTest); + +class IsolatedWorldHeadlessTabSocketTest : public TabSocketTest { + public: + void RunTabSocketTest() override { + CreateIsolatedWorldTabSocket( + "Test World", main_frame_id(), + base::Bind(&IsolatedWorldHeadlessTabSocketTest::OnIsolatedWorldCreated, + base::Unretained(this))); + } + + void OnIsolatedWorldCreated(int execution_context_id) { + main_frame_execution_context_id_ = execution_context_id; + + HeadlessTabSocket* headless_tab_socket = + web_contents_->GetHeadlessTabSocket(); + DCHECK(headless_tab_socket); + headless_tab_socket->SendMessageToContext( + "Hello!!!", *main_frame_execution_context_id_); + headless_tab_socket->SetListener(this); + + devtools_client_->GetRuntime()->Evaluate( + runtime::EvaluateParams::Builder() + .SetExpression( + R"(window.TabSocket.onmessage = + function(message) { + TabSocket.send('Embedder sent us: ' + message); + }; + )") + .SetContextId(GetV8ExecutionContextIdByWorldName("Test World")) + .Build(), + base::Bind( + &IsolatedWorldHeadlessTabSocketTest::FailOnJsEvaluateException, + base::Unretained(this))); + } + + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { + EXPECT_EQ("Embedder sent us: Hello!!!", message); + EXPECT_EQ(*main_frame_execution_context_id_, execution_context_id); + FinishAsynchronousTest(); + } + + base::Optional<int> main_frame_execution_context_id_; +}; + +HEADLESS_ASYNC_DEVTOOLED_TEST_F(IsolatedWorldHeadlessTabSocketTest); + +class MultipleIframesIsolatedWorldHeadlessTabSocketTest : public TabSocketTest { + public: + void RunTabSocketTest() override { + EXPECT_TRUE(embedded_test_server()->Start()); + devtools_client_->GetPage()->Navigate( + embedded_test_server()->GetURL("/two_iframes.html").spec()); + } + + void OnLoadEventFired(const page::LoadEventFiredParams& params) override { + devtools_client_->GetPage()->Disable(); + devtools_client_->GetPage()->RemoveObserver(this); + devtools_client_->GetDOMSnapshot()->GetExperimental()->GetSnapshot( + dom_snapshot::GetSnapshotParams::Builder() + .SetComputedStyleWhitelist(std::vector<std::string>()) + .Build(), + base::Bind( + &MultipleIframesIsolatedWorldHeadlessTabSocketTest::OnSnapshot, + base::Unretained(this))); + } + + void OnSnapshot(std::unique_ptr<dom_snapshot::GetSnapshotResult> result) { + bool seen_main_frame = false; + for (const auto& node : *result->GetDomNodes()) { + if (node->HasFrameId()) { + std::string frame_name; + if (node->GetNodeName() == "IFRAME") { + // Use the iframe id attribute for the name. + for (const auto& key_value : *node->GetAttributes()) { + if (key_value->GetName() == "id") { + frame_name = key_value->GetValue(); + } + } + CHECK(!frame_name.empty()); + } else { + if (seen_main_frame) + continue; + seen_main_frame = true; + frame_name = "main frame"; + } + CreateIsolatedWorldTabSocket( + frame_name, node->GetFrameId(), + base::Bind(&MultipleIframesIsolatedWorldHeadlessTabSocketTest:: + OnIsolatedWorldCreated, + base::Unretained(this), frame_name)); + } + } + } + + void OnIsolatedWorldCreated(std::string frame_name, + int execution_context_id) { + HeadlessTabSocket* headless_tab_socket = + web_contents_->GetHeadlessTabSocket(); + DCHECK(headless_tab_socket); + headless_tab_socket->SendMessageToContext("Hello!!!", execution_context_id); + headless_tab_socket->SetListener(this); + + devtools_client_->GetRuntime()->Evaluate( + runtime::EvaluateParams::Builder() + .SetExpression(base::StringPrintf( + R"(window.TabSocket.onmessage = + function(message) { + TabSocket.send('Echo from %s: ' + message); + }; + )", + frame_name.c_str())) + .SetContextId(execution_context_id) + .Build(), + base::Bind(&MultipleIframesIsolatedWorldHeadlessTabSocketTest:: + FailOnJsEvaluateException, + base::Unretained(this))); + } + + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { + messages_.push_back(message); + if (messages_.size() < 3) + return; + EXPECT_THAT(messages_, + UnorderedElementsAre("Echo from main frame: Hello!!!", + "Echo from iframe1: Hello!!!", + "Echo from iframe2: Hello!!!")); + FinishAsynchronousTest(); + } + std::vector<std::string> messages_; }; -HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessMainWorldTabSocketTest); +HEADLESS_ASYNC_DEVTOOLED_TEST_F( + MultipleIframesIsolatedWorldHeadlessTabSocketTest); -class HeadlessMainWorldTabSocketNotThereTest - : public HeadlessAsyncDevTooledBrowserTest, - public HeadlessTabSocket::Listener { +class SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest + : public TabSocketTest { public: - void SetUp() override { - options()->mojo_service_names.insert("headless::TabSocket"); - HeadlessAsyncDevTooledBrowserTest::SetUp(); + void RunTabSocketTest() override { + CreateIsolatedWorldTabSocket( + "Isolated World 1", main_frame_id(), + base::Bind(&SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest:: + OnIsolatedWorldCreated, + base::Unretained(this), "Isolated World 1")); + + CreateIsolatedWorldTabSocket( + "Isolated World 2", main_frame_id(), + base::Bind(&SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest:: + OnIsolatedWorldCreated, + base::Unretained(this), "Isolated World 2")); + + CreateIsolatedWorldTabSocket( + "Isolated World 3", main_frame_id(), + base::Bind(&SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest:: + OnIsolatedWorldCreated, + base::Unretained(this), "Isolated World 3")); } - void RunDevTooledTest() override { - // We expect this to fail because the TabSocket is being injected into - // isolated worlds. + void OnIsolatedWorldCreated(std::string frame_name, + int execution_context_id) { + HeadlessTabSocket* headless_tab_socket = + web_contents_->GetHeadlessTabSocket(); + DCHECK(headless_tab_socket); + headless_tab_socket->SendMessageToContext("Hello!!!", execution_context_id); + headless_tab_socket->SetListener(this); + devtools_client_->GetRuntime()->Evaluate( - "window.TabSocket.send('This should not work!');", - base::Bind(&HeadlessMainWorldTabSocketNotThereTest::EvaluateResult, + runtime::EvaluateParams::Builder() + .SetExpression(base::StringPrintf( + R"(window.TabSocket.onmessage = + function(message) { + TabSocket.send('Echo from %s: ' + message); + }; + )", + frame_name.c_str())) + .SetContextId(execution_context_id) + .Build(), + base::Bind(&SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest:: + FailOnJsEvaluateException, base::Unretained(this))); - - HeadlessTabSocket* headless_tab_socket = - web_contents_->GetHeadlessTabSocket(); - DCHECK(headless_tab_socket); - - headless_tab_socket->SetListener(this); } - void EvaluateResult(std::unique_ptr<runtime::EvaluateResult> result) { - EXPECT_TRUE(result->HasExceptionDetails()); + void OnMessageFromContext(const std::string& message, + int execution_context_id) override { + messages_.push_back(message); + if (messages_.size() < 3) + return; + EXPECT_THAT(messages_, + UnorderedElementsAre("Echo from Isolated World 1: Hello!!!", + "Echo from Isolated World 2: Hello!!!", + "Echo from Isolated World 3: Hello!!!")); FinishAsynchronousTest(); } - void OnMessageFromTab(const std::string&) override { -#ifdef OS_WIN - FinishAsynchronousTest(); - FAIL() << "Should not receive a message from the tab!"; -#else - FAIL() << "Should not receive a message from the tab!"; - FinishAsynchronousTest(); -#endif - } - - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::ISOLATED_WORLD; - } + std::vector<std::string> messages_; }; -HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessMainWorldTabSocketNotThereTest); - -class HeadlessIsolatedWorldTabSocketTest - : public HeadlessAsyncDevTooledBrowserTest, - public HeadlessTabSocket::Listener, - public runtime::Observer { - public: - void SetUp() override { - options()->mojo_service_names.insert("headless::TabSocket"); - HeadlessAsyncDevTooledBrowserTest::SetUp(); - } - - void RunDevTooledTest() override { - devtools_client_->GetRuntime()->AddObserver(this); - devtools_client_->GetRuntime()->Enable(); - - devtools_client_->GetPage()->GetExperimental()->GetResourceTree( - page::GetResourceTreeParams::Builder().Build(), - base::Bind(&HeadlessIsolatedWorldTabSocketTest::OnResourceTree, - base::Unretained(this))); - - HeadlessTabSocket* headless_tab_socket = - web_contents_->GetHeadlessTabSocket(); - DCHECK(headless_tab_socket); - headless_tab_socket->SendMessageToTab("Hello!!!"); - headless_tab_socket->SetListener(this); - } - - void OnResourceTree(std::unique_ptr<page::GetResourceTreeResult> result) { - main_frame_id_ = result->GetFrameTree()->GetFrame()->GetId(); - devtools_client_->GetPage()->GetExperimental()->CreateIsolatedWorld( - page::CreateIsolatedWorldParams::Builder() - .SetFrameId(main_frame_id_) - .Build()); - } - - void OnExecutionContextCreated( - const runtime::ExecutionContextCreatedParams& params) override { - const base::DictionaryValue* dictionary; - std::string frame_id; - bool is_main_world; - // If the isolated world was created then eval some script in it. - if (params.GetContext()->HasAuxData() && - params.GetContext()->GetAuxData()->GetAsDictionary(&dictionary) && - dictionary->GetString("frameId", &frame_id) && - frame_id == main_frame_id_ && - dictionary->GetBoolean("isDefault", &is_main_world) && !is_main_world) { - devtools_client_->GetRuntime()->Evaluate( - runtime::EvaluateParams::Builder() - .SetExpression( - R"(window.TabSocket.onmessage = - function(message) { - TabSocket.send('Embedder sent us: ' + message); - }; - )") - .SetContextId(params.GetContext()->GetId()) - .Build()); - } - } - - void OnMessageFromTab(const std::string& message) override { - EXPECT_EQ("Embedder sent us: Hello!!!", message); - FinishAsynchronousTest(); - } - - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::ISOLATED_WORLD; - } - - private: - std::string main_frame_id_; -}; - -HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessIsolatedWorldTabSocketTest); - -class HeadlessIsolatedWorldTabSocketNotThereTest - : public HeadlessAsyncDevTooledBrowserTest, - public HeadlessTabSocket::Listener, - public runtime::Observer { - public: - void SetUp() override { - options()->mojo_service_names.insert("headless::TabSocket"); - HeadlessAsyncDevTooledBrowserTest::SetUp(); - } - - void RunDevTooledTest() override { - devtools_client_->GetRuntime()->AddObserver(this); - devtools_client_->GetRuntime()->Enable(); - - devtools_client_->GetPage()->GetExperimental()->GetResourceTree( - page::GetResourceTreeParams::Builder().Build(), - base::Bind(&HeadlessIsolatedWorldTabSocketNotThereTest::OnResourceTree, - base::Unretained(this))); - - HeadlessTabSocket* headless_tab_socket = - web_contents_->GetHeadlessTabSocket(); - DCHECK(headless_tab_socket); - headless_tab_socket->SendMessageToTab("Hello!!!"); - headless_tab_socket->SetListener(this); - } - - void OnResourceTree(std::unique_ptr<page::GetResourceTreeResult> result) { - main_frame_id_ = result->GetFrameTree()->GetFrame()->GetId(); - devtools_client_->GetPage()->GetExperimental()->CreateIsolatedWorld( - page::CreateIsolatedWorldParams::Builder() - .SetFrameId(main_frame_id_) - .Build()); - } - - void OnExecutionContextCreated( - const runtime::ExecutionContextCreatedParams& params) override { - const base::DictionaryValue* dictionary; - std::string frame_id; - bool is_main_world; - // If the isolated world was created then eval some script in it. - if (params.GetContext()->HasAuxData() && - params.GetContext()->GetAuxData()->GetAsDictionary(&dictionary) && - dictionary->GetString("frameId", &frame_id) && - frame_id == main_frame_id_ && - dictionary->GetBoolean("isDefault", &is_main_world) && !is_main_world) { - // We expect this to fail because the TabSocket is being injected into the - // main world. - devtools_client_->GetRuntime()->Evaluate( - runtime::EvaluateParams::Builder() - .SetExpression("window.TabSocket.send('This should not work!');") - .SetContextId(params.GetContext()->GetId()) - .Build(), - base::Bind( - &HeadlessIsolatedWorldTabSocketNotThereTest::EvaluateResult, - base::Unretained(this))); - } - } - - void EvaluateResult(std::unique_ptr<runtime::EvaluateResult> result) { - EXPECT_TRUE(result->HasExceptionDetails()); - FinishAsynchronousTest(); - } - - void OnMessageFromTab(const std::string&) override { -#ifdef OS_WIN - FinishAsynchronousTest(); - FAIL() << "Should not receive a message from the tab!"; -#else - FAIL() << "Should not receive a message from the tab!"; - FinishAsynchronousTest(); -#endif - } - - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::MAIN_WORLD; - } - - private: - std::string main_frame_id_; -}; - -HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessIsolatedWorldTabSocketNotThereTest); +HEADLESS_ASYNC_DEVTOOLED_TEST_F( + SingleTabMultipleIsolatedWorldsHeadlessTabSocketTest); } // namespace headless
diff --git a/headless/lib/renderer/DEPS b/headless/lib/renderer/DEPS index 9e63386..fedcd88 100644 --- a/headless/lib/renderer/DEPS +++ b/headless/lib/renderer/DEPS
@@ -4,4 +4,5 @@ "+gin", "+printing", "+third_party/WebKit/public", + "+v8/include", ]
diff --git a/headless/lib/renderer/headless_content_renderer_client.cc b/headless/lib/renderer/headless_content_renderer_client.cc index b6437e4..a438df4 100644 --- a/headless/lib/renderer/headless_content_renderer_client.cc +++ b/headless/lib/renderer/headless_content_renderer_client.cc
@@ -5,25 +5,8 @@ #include "headless/lib/renderer/headless_content_renderer_client.h" #include "base/memory/ptr_util.h" -#include "base/strings/utf_string_conversions.h" -#include "content/public/common/bindings_policy.h" -#include "content/public/common/isolated_world_ids.h" -#include "content/public/renderer/render_frame.h" -#include "content/public/renderer/render_frame_observer.h" -#include "gin/handle.h" -#include "gin/object_template_builder.h" -#include "gin/wrappable.h" -#include "headless/lib/headless_render_frame_controller.mojom.h" -#include "headless/lib/tab_socket.mojom.h" -#include "mojo/public/cpp/bindings/binding_set.h" +#include "headless/lib/renderer/headless_render_frame_controller_impl.h" #include "printing/features/features.h" -#include "services/service_manager/public/cpp/bind_source_info.h" -#include "services/service_manager/public/cpp/binder_registry.h" -#include "services/service_manager/public/cpp/interface_provider.h" -#include "third_party/WebKit/public/platform/WebIsolatedWorldIds.h" -#include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h" #if BUILDFLAG(ENABLE_BASIC_PRINTING) #include "components/printing/renderer/print_web_view_helper.h" @@ -32,219 +15,6 @@ namespace headless { -class HeadlessTabSocketBindings - : public gin::Wrappable<HeadlessTabSocketBindings>, - public blink::WebScriptExecutionCallback { - public: - explicit HeadlessTabSocketBindings(content::RenderFrame* render_frame) - : render_frame_(render_frame), weak_ptr_factory_(this) {} - ~HeadlessTabSocketBindings() override {} - - void SetBindingsPolicy(MojoBindingsPolicy bindings_policy) { - bindings_policy_ = bindings_policy; - - if (world_id_) - return; - - // Update bindings for pre-existing script contexts. - v8::Isolate* isolate = blink::MainThreadIsolate(); - v8::HandleScope handle_scope(isolate); - if (bindings_policy == MojoBindingsPolicy::MAIN_WORLD) { - InitializeTabSocketBindings( - render_frame_->GetWebFrame()->MainWorldScriptContext(), - content::ISOLATED_WORLD_ID_GLOBAL); - } else if (bindings_policy == MojoBindingsPolicy::ISOLATED_WORLD) { - // TODO(eseckler): We currently only support a single isolated world - // context. InitializeTabSocketBindings will log a warning and ignore any - // but the first isolated world if called multiple times here. - for (const auto& entry : context_map_) { - if (entry.first != content::ISOLATED_WORLD_ID_GLOBAL) - InitializeTabSocketBindings(entry.second.Get(isolate), entry.first); - } - } - } - - void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) { - bool is_devtools_world = world_id >= blink::kDevToolsFirstIsolatedWorldId && - world_id <= blink::kDevToolsLastIsolatedWorldId; - if (world_id == content::ISOLATED_WORLD_ID_GLOBAL) { - context_map_[world_id].Reset(blink::MainThreadIsolate(), context); - - // For the main world, only inject TabSocket if MAIN_WORLD policy is set. - if (bindings_policy_ != MojoBindingsPolicy::MAIN_WORLD) - return; - } else if (is_devtools_world) { - context_map_[world_id].Reset(blink::MainThreadIsolate(), context); - - // For devtools-created isolated worlds, only inject TabSocket if - // ISOLATED_WORLD policy is set. - if (bindings_policy_ != MojoBindingsPolicy::ISOLATED_WORLD) - return; - } else { - // Other worlds don't receive TabSocket bindings. - return; - } - - InitializeTabSocketBindings(context, world_id); - } - - void WillReleaseScriptContext(v8::Local<v8::Context> context, int world_id) { - context_map_.erase(world_id); - if (world_id_ && *world_id_ == world_id) { - on_message_callback_.Reset(); - world_id_.reset(); - } - } - - // gin::WrappableBase implementation: - gin::ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) override { - return gin::Wrappable<HeadlessTabSocketBindings>::GetObjectTemplateBuilder( - isolate) - .SetMethod("send", &HeadlessTabSocketBindings::SendImpl) - .SetProperty("onmessage", &HeadlessTabSocketBindings::GetOnMessage, - &HeadlessTabSocketBindings::SetOnMessage); - } - - static gin::WrapperInfo kWrapperInfo; - - private: - void SendImpl(const std::string& message) { - EnsureTabSocketPtr()->SendMessageToEmbedder(message); - } - - v8::Local<v8::Value> GetOnMessage() { return GetOnMessageCallback(); } - - void SetOnMessage(v8::Local<v8::Function> callback) { - on_message_callback_.Reset(blink::MainThreadIsolate(), callback); - - EnsureTabSocketPtr()->AwaitNextMessageFromEmbedder( - base::Bind(&HeadlessTabSocketBindings::OnNextMessageFromEmbedder, - weak_ptr_factory_.GetWeakPtr())); - } - - void OnNextMessageFromEmbedder(const std::string& message) { - v8::Isolate* isolate = blink::MainThreadIsolate(); - v8::HandleScope handle_scope(isolate); - v8::Local<v8::Context> context = GetContext(); - v8::Local<v8::Value> argv[] = { - gin::Converter<std::string>::ToV8(isolate, message), - }; - - render_frame_->GetWebFrame()->RequestExecuteV8Function( - context, GetOnMessageCallback(), context->Global(), arraysize(argv), - argv, this); - - EnsureTabSocketPtr()->AwaitNextMessageFromEmbedder( - base::Bind(&HeadlessTabSocketBindings::OnNextMessageFromEmbedder, - weak_ptr_factory_.GetWeakPtr())); - } - - void InitializeTabSocketBindings(v8::Local<v8::Context> context, - int world_id) { - if (world_id_) { - // TODO(eseckler): Support multiple isolated worlds inside the same frame. - LOG(WARNING) << "TabSocket not created for world id " << world_id - << ". TabSocket only supports a single active world."; - return; - } - - DCHECK(context_map_.find(world_id) != context_map_.end()); - - // Add TabSocket bindings to the context. - v8::Isolate* isolate = blink::MainThreadIsolate(); - v8::HandleScope handle_scope(isolate); - if (context.IsEmpty()) - return; - - v8::Context::Scope context_scope(context); - gin::Handle<HeadlessTabSocketBindings> bindings = - gin::CreateHandle(isolate, this); - if (bindings.IsEmpty()) - return; - - v8::Local<v8::Object> global = context->Global(); - global->Set(gin::StringToV8(isolate, "TabSocket"), bindings.ToV8()); - world_id_ = world_id; - } - - headless::TabSocketPtr& EnsureTabSocketPtr() { - if (!tab_socket_ptr_.is_bound()) { - render_frame_->GetRemoteInterfaces()->GetInterface( - mojo::MakeRequest(&tab_socket_ptr_)); - } - return tab_socket_ptr_; - } - - v8::Local<v8::Context> GetContext() { - if (!world_id_) - return v8::Local<v8::Context>(); - DCHECK(context_map_.find(*world_id_) != context_map_.end()); - return context_map_[*world_id_].Get(blink::MainThreadIsolate()); - } - - v8::Local<v8::Function> GetOnMessageCallback() { - return v8::Local<v8::Function>::New(blink::MainThreadIsolate(), - on_message_callback_); - } - - content::RenderFrame* render_frame_; - MojoBindingsPolicy bindings_policy_ = MojoBindingsPolicy::NONE; - headless::TabSocketPtr tab_socket_ptr_; - base::Optional<int> world_id_; - base::flat_map<int, v8::UniquePersistent<v8::Context>> context_map_; - v8::UniquePersistent<v8::Function> on_message_callback_; - base::WeakPtrFactory<HeadlessTabSocketBindings> weak_ptr_factory_; -}; - -gin::WrapperInfo HeadlessTabSocketBindings::kWrapperInfo = { - gin::kEmbedderNativeGin}; - -class HeadlessRenderFrameControllerImpl : public HeadlessRenderFrameController, - public content::RenderFrameObserver { - public: - HeadlessRenderFrameControllerImpl(content::RenderFrame* render_frame) - : content::RenderFrameObserver(render_frame), - tab_socket_bindings_(render_frame) { - render_frame->GetInterfaceRegistry()->AddInterface(base::Bind( - &HeadlessRenderFrameControllerImpl::OnRenderFrameControllerRequest, - base::Unretained(this))); - } - - void OnRenderFrameControllerRequest( - const service_manager::BindSourceInfo& source_info, - headless::HeadlessRenderFrameControllerRequest request) { - headless_render_frame_controller_bindings_.AddBinding(this, - std::move(request)); - } - - // HeadlessRenderFrameController implementation: - void AllowTabSocketBindings( - MojoBindingsPolicy policy, - AllowTabSocketBindingsCallback callback) override { - tab_socket_bindings_.SetBindingsPolicy(policy); - std::move(callback).Run(); - } - - // content::RenderFrameObserverW implementation: - void DidCreateScriptContext(v8::Local<v8::Context> context, - int world_id) override { - tab_socket_bindings_.DidCreateScriptContext(context, world_id); - } - - void WillReleaseScriptContext(v8::Local<v8::Context> context, - int world_id) override { - tab_socket_bindings_.WillReleaseScriptContext(context, world_id); - } - - void OnDestruct() override { delete this; } - - private: - mojo::BindingSet<headless::HeadlessRenderFrameController> - headless_render_frame_controller_bindings_; - HeadlessTabSocketBindings tab_socket_bindings_; -}; - HeadlessContentRendererClient::HeadlessContentRendererClient() {} HeadlessContentRendererClient::~HeadlessContentRendererClient() {}
diff --git a/headless/lib/renderer/headless_render_frame_controller_impl.cc b/headless/lib/renderer/headless_render_frame_controller_impl.cc new file mode 100644 index 0000000..5f7f55d --- /dev/null +++ b/headless/lib/renderer/headless_render_frame_controller_impl.cc
@@ -0,0 +1,119 @@ +// 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 "headless/lib/renderer/headless_render_frame_controller_impl.h" + +#include "content/public/common/isolated_world_ids.h" +#include "services/service_manager/public/cpp/bind_source_info.h" +#include "services/service_manager/public/cpp/binder_registry.h" +#include "services/service_manager/public/cpp/interface_provider.h" +#include "v8/include/v8-inspector.h" + +namespace headless { + +HeadlessRenderFrameControllerImpl::HeadlessRenderFrameControllerImpl( + content::RenderFrame* render_frame) + : content::RenderFrameObserver(render_frame), + render_frame_(render_frame), + weak_ptr_factory_(this) { + render_frame->GetInterfaceRegistry()->AddInterface(base::Bind( + &HeadlessRenderFrameControllerImpl::OnRenderFrameControllerRequest, + base::Unretained(this))); +} + +HeadlessRenderFrameControllerImpl::~HeadlessRenderFrameControllerImpl() {} + +void HeadlessRenderFrameControllerImpl::OnRenderFrameControllerRequest( + const service_manager::BindSourceInfo& source_info, + headless::HeadlessRenderFrameControllerRequest request) { + headless_render_frame_controller_bindings_.AddBinding(this, + std::move(request)); +} + +void HeadlessRenderFrameControllerImpl::InstallTabSocket( + int32_t execution_context_id, + InstallTabSocketCallback callback) { + auto find_it = tab_socket_bindings_.find(execution_context_id); + if (find_it == tab_socket_bindings_.end()) { + LOG(WARNING) << "InstallTabSocket failed, unknown execution_context_id " + << execution_context_id; + std::move(callback).Run(false); + } else { + std::move(callback).Run(find_it->second.InitializeTabSocketBindings()); + } +} + +void HeadlessRenderFrameControllerImpl::InstallMainWorldTabSocket( + InstallMainWorldTabSocketCallback callback) { + // Check any pre-existing script contexts. + for (auto& pair : tab_socket_bindings_) { + if (pair.second.world_id() == content::ISOLATED_WORLD_ID_GLOBAL) { + std::move(callback).Run( + pair.second.InitializeTabSocketBindings() ? pair.first : -1); + return; + } + } + pending_install_main_world_tab_socket_callback_ = std::move(callback); +} + +void HeadlessRenderFrameControllerImpl::SendMessageToTabSocket( + const std::string& message, + int32_t world_id) { + auto find_it = tab_socket_bindings_.find(world_id); + if (find_it == tab_socket_bindings_.end()) { + LOG(WARNING) << "Dropping message for " << world_id + << " because the world doesn't exist."; + return; + } + + find_it->second.OnMessageFromEmbedder(message); +} + +void HeadlessRenderFrameControllerImpl::DidCreateScriptContext( + v8::Local<v8::Context> context, + int world_id) { + int v8_execution_context_id = + v8_inspector::V8ContextInfo::executionContextId(context); + auto find_it = tab_socket_bindings_.find(v8_execution_context_id); + if (find_it != tab_socket_bindings_.end()) + tab_socket_bindings_.erase(find_it); + + auto emplace_result = tab_socket_bindings_.emplace( + std::piecewise_construct, std::forward_as_tuple(v8_execution_context_id), + std::forward_as_tuple(this, render_frame_, context, world_id)); + + // If main world tab socket bindings have been requested and this is the main + // world then install the bindings. + if (world_id == content::ISOLATED_WORLD_ID_GLOBAL && + !pending_install_main_world_tab_socket_callback_.is_null()) { + std::move(pending_install_main_world_tab_socket_callback_) + .Run(emplace_result.first->second.InitializeTabSocketBindings() + ? v8_execution_context_id + : -1); + pending_install_main_world_tab_socket_callback_ = + InstallMainWorldTabSocketCallback(); + } +} + +void HeadlessRenderFrameControllerImpl::WillReleaseScriptContext( + v8::Local<v8::Context> context, + int world_id) { + tab_socket_bindings_.erase( + v8_inspector::V8ContextInfo::executionContextId(context)); +} + +void HeadlessRenderFrameControllerImpl::OnDestruct() { + delete this; +} + +headless::TabSocketPtr& +HeadlessRenderFrameControllerImpl::EnsureTabSocketPtr() { + if (!tab_socket_ptr_.is_bound()) { + render_frame_->GetRemoteInterfaces()->GetInterface( + mojo::MakeRequest(&tab_socket_ptr_)); + } + return tab_socket_ptr_; +} + +} // namespace headless
diff --git a/headless/lib/renderer/headless_render_frame_controller_impl.h b/headless/lib/renderer/headless_render_frame_controller_impl.h new file mode 100644 index 0000000..51d9331 --- /dev/null +++ b/headless/lib/renderer/headless_render_frame_controller_impl.h
@@ -0,0 +1,60 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef HEADLESS_LIB_RENDERER_HEADLESS_RENDER_FRAME_CONTROLLER_IMPL_H_ +#define HEADLESS_LIB_RENDERER_HEADLESS_RENDER_FRAME_CONTROLLER_IMPL_H_ + +#include "content/public/renderer/render_frame.h" +#include "content/public/renderer/render_frame_observer.h" +#include "headless/lib/headless_render_frame_controller.mojom.h" +#include "headless/lib/renderer/headless_tab_socket_bindings.h" +#include "headless/lib/tab_socket.mojom.h" +#include "mojo/public/cpp/bindings/binding_set.h" + +namespace headless { + +class HeadlessRenderFrameControllerImpl : public HeadlessRenderFrameController, + public content::RenderFrameObserver { + public: + explicit HeadlessRenderFrameControllerImpl( + content::RenderFrame* render_frame); + ~HeadlessRenderFrameControllerImpl() override; + + void OnRenderFrameControllerRequest( + const service_manager::BindSourceInfo& source_info, + headless::HeadlessRenderFrameControllerRequest request); + + // HeadlessRenderFrameController implementation: + void InstallTabSocket(int32_t v8_execution_context_id, + InstallTabSocketCallback callback) override; + void InstallMainWorldTabSocket( + InstallMainWorldTabSocketCallback callback) override; + void SendMessageToTabSocket(const std::string& message, + int32_t world_id) override; + + // content::RenderFrameObserver implementation: + void DidCreateScriptContext(v8::Local<v8::Context> context, + int world_id) override; + + void WillReleaseScriptContext(v8::Local<v8::Context> context, + int world_id) override; + + void OnDestruct() override; + + headless::TabSocketPtr& EnsureTabSocketPtr(); + + private: + content::RenderFrame* const render_frame_; // NOT OWNED + mojo::BindingSet<headless::HeadlessRenderFrameController> + headless_render_frame_controller_bindings_; + std::map<int, HeadlessTabSocketBindings> tab_socket_bindings_; + headless::TabSocketPtr tab_socket_ptr_; + InstallMainWorldTabSocketCallback + pending_install_main_world_tab_socket_callback_; + base::WeakPtrFactory<HeadlessRenderFrameControllerImpl> weak_ptr_factory_; +}; + +} // namespace headless + +#endif // HEADLESS_LIB_RENDERER_HEADLESS_RENDER_FRAME_CONTROLLER_IMPL_H_
diff --git a/headless/lib/renderer/headless_tab_socket_bindings.cc b/headless/lib/renderer/headless_tab_socket_bindings.cc new file mode 100644 index 0000000..94198ab --- /dev/null +++ b/headless/lib/renderer/headless_tab_socket_bindings.cc
@@ -0,0 +1,101 @@ +// 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 "headless/lib/renderer/headless_tab_socket_bindings.h" + +#include "headless/lib/renderer/headless_render_frame_controller_impl.h" +#include "third_party/WebKit/public/web/WebKit.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "v8/include/v8-inspector.h" + +namespace headless { + +HeadlessTabSocketBindings::HeadlessTabSocketBindings( + HeadlessRenderFrameControllerImpl* parent_controller, + content::RenderFrame* render_frame, + v8::Local<v8::Context> context, + int world_id) + : parent_controller_(parent_controller), + render_frame_(render_frame), + context_(blink::MainThreadIsolate(), context), + world_id_(world_id), + installed_(false) {} + +HeadlessTabSocketBindings::~HeadlessTabSocketBindings() {} + +bool HeadlessTabSocketBindings::InitializeTabSocketBindings() { + if (installed_) + return false; + + v8::Isolate* isolate = blink::MainThreadIsolate(); + v8::HandleScope handle_scope(isolate); + if (context_.IsEmpty()) + return false; + + v8::Local<v8::Context> context = context_.Get(blink::MainThreadIsolate()); + v8::Context::Scope context_scope(context); + gin::Handle<HeadlessTabSocketBindings> bindings = + gin::CreateHandle(isolate, this); + if (bindings.IsEmpty()) + return false; + + v8::Local<v8::Object> global = context->Global(); + global->Set(gin::StringToV8(isolate, "TabSocket"), bindings.ToV8()); + installed_ = true; + return true; +} + +void HeadlessTabSocketBindings::OnMessageFromEmbedder( + const std::string& message) { + if (on_message_callback_.IsEmpty()) { + pending_messages_.push_back(message); + return; + } + + v8::Isolate* isolate = blink::MainThreadIsolate(); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = context_.Get(isolate); + v8::Local<v8::Value> argv[] = { + gin::Converter<std::string>::ToV8(isolate, message), + }; + + render_frame_->GetWebFrame()->RequestExecuteV8Function( + context, GetOnMessageCallback(), context->Global(), arraysize(argv), argv, + this); +} + +gin::ObjectTemplateBuilder HeadlessTabSocketBindings::GetObjectTemplateBuilder( + v8::Isolate* isolate) { + return gin::Wrappable<HeadlessTabSocketBindings>::GetObjectTemplateBuilder( + isolate) + .SetMethod("send", &HeadlessTabSocketBindings::SendImpl) + .SetProperty("onmessage", &HeadlessTabSocketBindings::GetOnMessage, + &HeadlessTabSocketBindings::SetOnMessage); +} + +void HeadlessTabSocketBindings::SendImpl(const std::string& message) { + v8::Local<v8::Context> context = context_.Get(blink::MainThreadIsolate()); + int execution_context_id = + v8_inspector::V8ContextInfo::executionContextId(context); + parent_controller_->EnsureTabSocketPtr()->SendMessageToEmbedder( + message, execution_context_id); +} + +void HeadlessTabSocketBindings::SetOnMessage(v8::Local<v8::Function> callback) { + on_message_callback_.Reset(blink::MainThreadIsolate(), callback); + for (const std::string& message : pending_messages_) { + OnMessageFromEmbedder(message); + } + pending_messages_.clear(); +} + +v8::Local<v8::Function> HeadlessTabSocketBindings::GetOnMessageCallback() { + return v8::Local<v8::Function>::New(blink::MainThreadIsolate(), + on_message_callback_); +} + +gin::WrapperInfo HeadlessTabSocketBindings::kWrapperInfo = { + gin::kEmbedderNativeGin}; + +} // namespace headless
diff --git a/headless/lib/renderer/headless_tab_socket_bindings.h b/headless/lib/renderer/headless_tab_socket_bindings.h new file mode 100644 index 0000000..c284476 --- /dev/null +++ b/headless/lib/renderer/headless_tab_socket_bindings.h
@@ -0,0 +1,63 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef HEADLESS_LIB_RENDERER_HEADLESS_TAB_SOCKET_BINDINGS_H_ +#define HEADLESS_LIB_RENDERER_HEADLESS_TAB_SOCKET_BINDINGS_H_ + +#include "content/public/renderer/render_frame.h" +#include "gin/handle.h" +#include "gin/object_template_builder.h" +#include "gin/wrappable.h" +#include "headless/lib/tab_socket.mojom.h" +#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h" + +namespace headless { +class HeadlessRenderFrameControllerImpl; + +class HeadlessTabSocketBindings + : public gin::Wrappable<HeadlessTabSocketBindings>, + public blink::WebScriptExecutionCallback { + public: + HeadlessTabSocketBindings( + HeadlessRenderFrameControllerImpl* parent_controller, + content::RenderFrame* render_frame, + v8::Local<v8::Context> context, + int world_id); + + ~HeadlessTabSocketBindings() override; + + // Add TabSocket bindings to |context_|. + bool InitializeTabSocketBindings(); + + void OnMessageFromEmbedder(const std::string& message); + + // gin::WrappableBase implementation: + gin::ObjectTemplateBuilder GetObjectTemplateBuilder( + v8::Isolate* isolate) override; + + static gin::WrapperInfo kWrapperInfo; + + int world_id() const { return world_id_; } + + private: + void SendImpl(const std::string& message); + + v8::Local<v8::Value> GetOnMessage() { return GetOnMessageCallback(); } + + void SetOnMessage(v8::Local<v8::Function> callback); + + v8::Local<v8::Function> GetOnMessageCallback(); + + HeadlessRenderFrameControllerImpl* const parent_controller_; // NOT OWNED + content::RenderFrame* const render_frame_; // NOT OWNED + const v8::UniquePersistent<v8::Context> context_; + const int world_id_; + bool installed_; + std::list<std::string> pending_messages_; + v8::UniquePersistent<v8::Function> on_message_callback_; +}; + +} // namespace headless + +#endif // HEADLESS_LIB_RENDERER_HEADLESS_TAB_SOCKET_BINDINGS_H_
diff --git a/headless/lib/tab_socket.mojom b/headless/lib/tab_socket.mojom index cd90e70..2e6665c 100644 --- a/headless/lib/tab_socket.mojom +++ b/headless/lib/tab_socket.mojom
@@ -6,9 +6,8 @@ interface TabSocket { // Send a message from the Tab to C++ embedder. - SendMessageToEmbedder(string message); + SendMessageToEmbedder(string message, int32 v8_execution_context_id); - // Waits for the next message to sent from the embedder C++ to the tab. - // NB this is non-blocking. - AwaitNextMessageFromEmbedder() => (string message); + // To send a message to the tab use + // HeadlessRenderFrameController::SendMessageToTabSocket. };
diff --git a/headless/public/headless_tab_socket.h b/headless/public/headless_tab_socket.h index b8f0fa2..262b9fc57 100644 --- a/headless/public/headless_tab_socket.h +++ b/headless/public/headless_tab_socket.h
@@ -8,6 +8,7 @@ #include <string> #include "base/macros.h" +#include "base/optional.h" #include "headless/public/headless_export.h" namespace headless { @@ -20,15 +21,34 @@ Listener() {} virtual ~Listener() {} - // The |message| may be potentially sent by untrusted web content so it - // should be validated carefully. - virtual void OnMessageFromTab(const std::string& message) = 0; + // The |message| and |v8_execution_context_id| may be potentially sent by + // untrusted web content so it should be validated carefully. + virtual void OnMessageFromContext(const std::string& message, + int v8_execution_context_id) = 0; private: DISALLOW_COPY_AND_ASSIGN(Listener); }; - virtual void SendMessageToTab(const std::string& message) = 0; + // Installs headless tab socket bindings into the specified execution context. + // If the bindings are successfully installed then the |callback| is run with + // |success| = true, otherwise with |success| = false. + virtual void InstallHeadlessTabSocketBindings( + int v8_execution_context_id, + base::Callback<void(bool success)> callback) = 0; + + // Installs headless tab socket bindings into the main frame main world. If + // the bindings were installed correctly then |callback| is run with a + // non-empty base::Optional<int> containing the main world + // v8_execution_context_id, otherwise |callback| is run with an empty + // base::Optional<int>. + virtual void InstallMainFrameMainWorldHeadlessTabSocketBindings( + base::Callback<void(base::Optional<int> v8_execution_context_id)> + callback) = 0; + + // Note this will fail unless the bindings have been installed. + virtual void SendMessageToContext(const std::string& message, + int v8_execution_context_id) = 0; virtual void SetListener(Listener* listener) = 0;
diff --git a/headless/public/headless_web_contents.h b/headless/public/headless_web_contents.h index 01fb232b..dae0d72 100644 --- a/headless/public/headless_web_contents.h +++ b/headless/public/headless_web_contents.h
@@ -80,7 +80,8 @@ // Close this page. |HeadlessWebContents| object will be destroyed. virtual void Close() = 0; - // Returns the headless tab socket for JS -> C++ if one was created. + // Returns the headless tab socket interface for C++ <---> JS, or null if tab + // sockets are not allowed. virtual HeadlessTabSocket* GetHeadlessTabSocket() const = 0; // Returns the devtools frame id corresponding to the |frame_tree_node_id|, if @@ -112,15 +113,8 @@ // Specify the initial window size (default is configured in browser options). Builder& SetWindowSize(const gfx::Size& size); - enum class TabSocketType { - NONE, // No TabSocket binds created (default). - MAIN_WORLD, // TabSocket bindings available only to the main world. - ISOLATED_WORLD // TabSocket bindings available only to isolated worlds - // created via DevTools protocol. - }; - - // Sets the type of TabSocket to be created, if any. - Builder& SetTabSocketType(TabSocketType type); + // Specify whether or not TabSockets are allowed. + Builder& SetAllowTabSockets(bool tab_sockets_allowed); // The returned object is owned by HeadlessBrowser. Call // HeadlessWebContents::Close() to dispose it. @@ -153,7 +147,7 @@ GURL initial_url_ = GURL("about:blank"); gfx::Size window_size_; std::list<MojoService> mojo_services_; - TabSocketType tab_socket_type_ = TabSocketType::NONE; + bool tab_sockets_allowed_ = false; DISALLOW_COPY_AND_ASSIGN(Builder); };
diff --git a/headless/test/data/iframe2.html b/headless/test/data/iframe2.html new file mode 100644 index 0000000..0826be6c --- /dev/null +++ b/headless/test/data/iframe2.html
@@ -0,0 +1,5 @@ +<html> +<body> +<h2>Hello from the second iframe!</h2> +</body> +</html>
diff --git a/headless/test/data/tabsocket.html b/headless/test/data/tabsocket.html new file mode 100644 index 0000000..789191f --- /dev/null +++ b/headless/test/data/tabsocket.html
@@ -0,0 +1,21 @@ +<html> +<script> +function tabsocketTest() { + // Unfortunately, the order in which + // HeadlessRenderFrameControllerImpl::DidCreateScriptContext and + // HeadlessRenderFrameControllerImpl::InstallMainWorldTabSocket are called + // is non-deterministic. This means the TabSocket might not have been + // installed yet. If that happens just try again a bit later. + if (window.hasOwnProperty('TabSocket')) { + window.TabSocket.send('Hello world!'); + + window.TabSocket.onmessage = function(message) { + window.TabSocket.send('Embedder sent us: ' + message); + }; + } else { + setTimeout(tabsocketTest, 1); + } +} +tabsocketTest(); +</script> +</html>
diff --git a/headless/test/data/two_iframes.html b/headless/test/data/two_iframes.html new file mode 100644 index 0000000..cb016d9 --- /dev/null +++ b/headless/test/data/two_iframes.html
@@ -0,0 +1,6 @@ +<html> +<body> +<iframe id="iframe1" src="/iframe.html" width="400" height="200"></iframe> +<iframe id="iframe2" src="/iframe2.html" width="400" height="200"></iframe> +</body> +</html>
diff --git a/headless/test/headless_browser_test.cc b/headless/test/headless_browser_test.cc index 98e3b8ae7..e5aa3d7 100644 --- a/headless/test/headless_browser_test.cc +++ b/headless/test/headless_browser_test.cc
@@ -235,17 +235,20 @@ HeadlessBrowserContext::Builder builder = browser()->CreateBrowserContextBuilder(); builder.SetProtocolHandlers(GetProtocolHandlers()); - if (GetTabSocketType() != HeadlessWebContents::Builder::TabSocketType::NONE) { + if (GetAllowTabSockets()) { builder.EnableUnsafeNetworkAccessWithMojoBindings(true); builder.AddTabSocketMojoBindings(); } + std::unique_ptr<net::ProxyConfig> proxy_config = GetProxyConfig(); + if (proxy_config) + builder.SetProxyConfig(std::move(proxy_config)); browser_context_ = builder.Build(); browser()->SetDefaultBrowserContext(browser_context_); browser()->GetDevToolsTarget()->AttachClient(browser_devtools_client_.get()); web_contents_ = browser_context_->CreateWebContentsBuilder() - .SetTabSocketType(GetTabSocketType()) + .SetAllowTabSockets(GetAllowTabSockets()) .Build(); web_contents_->AddObserver(this); @@ -265,9 +268,8 @@ return ProtocolHandlerMap(); } -HeadlessWebContents::Builder::TabSocketType -HeadlessAsyncDevTooledBrowserTest::GetTabSocketType() { - return HeadlessWebContents::Builder::TabSocketType::NONE; +bool HeadlessAsyncDevTooledBrowserTest::GetAllowTabSockets() { + return false; } bool HeadlessAsyncDevTooledBrowserTest:: @@ -275,4 +277,9 @@ return false; } +std::unique_ptr<net::ProxyConfig> +HeadlessAsyncDevTooledBrowserTest::GetProxyConfig() { + return nullptr; +} + } // namespace headless
diff --git a/headless/test/headless_browser_test.h b/headless/test/headless_browser_test.h index 5181ba42..363334d 100644 --- a/headless/test/headless_browser_test.h +++ b/headless/test/headless_browser_test.h
@@ -138,13 +138,16 @@ // the map returned is empty. virtual ProtocolHandlerMap GetProtocolHandlers(); - // The TabSocket type to request when creating |web_contents_|. - virtual HeadlessWebContents::Builder::TabSocketType GetTabSocketType(); + // Whether to allow TabSockets when creating |web_contents_|. + virtual bool GetAllowTabSockets(); // Selects between creating the TabSocket only in an isolated world or the // main world. virtual bool GetCreateTabSocketOnlyForIsolatedWorld(); + // Returns the ProxyConfig to us, if any. By default null is returned. + virtual std::unique_ptr<net::ProxyConfig> GetProxyConfig(); + protected: void RunTest();
diff --git a/headless/test/headless_js_bindings_browsertest.cc b/headless/test/headless_js_bindings_browsertest.cc index 3d3088f..ed09e13 100644 --- a/headless/test/headless_js_bindings_browsertest.cc +++ b/headless/test/headless_js_bindings_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" +#include "content/public/common/isolated_world_ids.h" #include "content/public/test/browser_test.h" #include "headless/grit/headless_browsertest_resources.h" #include "headless/public/devtools/domains/runtime.h" @@ -19,7 +20,7 @@ #include "headless/public/headless_devtools_client.h" #include "headless/public/headless_tab_socket.h" #include "headless/public/headless_web_contents.h" -#include "headless/test/headless_browser_test.h" +#include "headless/test/tab_socket_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/resource/resource_bundle.h" @@ -27,15 +28,9 @@ namespace headless { class HeadlessJsBindingsTest - : public HeadlessAsyncDevTooledBrowserTest, - public HeadlessTabSocket::Listener, + : public TabSocketTest, public HeadlessDevToolsClient::RawProtocolListener { public: - void SetUp() override { - options()->mojo_service_names.insert("headless::TabSocket"); - HeadlessAsyncDevTooledBrowserTest::SetUp(); - } - void SetUpOnMainThread() override { base::ThreadRestrictions::SetIOAllowed(true); base::FilePath pak_path; @@ -45,15 +40,19 @@ pak_path, ui::SCALE_FACTOR_NONE); } - void RunDevTooledTest() override { - devtools_client_->SetRawProtocolListener(this); + void RunTabSocketTest() override { headless_tab_socket_ = web_contents_->GetHeadlessTabSocket(); - DCHECK(headless_tab_socket_); + CHECK(headless_tab_socket_); headless_tab_socket_->SetListener(this); - PrepareToRunJsBindingsTest(); + devtools_client_->SetRawProtocolListener(this); + CreateMainWorldTabSocket( + main_frame_id(), + base::Bind(&HeadlessJsBindingsTest::OnInstalledHeadlessTabSocket, + base::Unretained(this))); } - void PrepareToRunJsBindingsTest() { + void OnInstalledHeadlessTabSocket(int v8_exection_context_id) { + main_world_execution_context_id_ = v8_exection_context_id; devtools_client_->GetRuntime()->Evaluate( ResourceBundle::GetSharedInstance() .GetRawDataResource(DEVTOOLS_BINDINGS_TEST) @@ -73,22 +72,9 @@ } } - void FailOnJsEvaluateException( - std::unique_ptr<runtime::EvaluateResult> result) { - if (!result->HasExceptionDetails()) - return; - - FinishAsynchronousTest(); - - const runtime::ExceptionDetails* exception_details = - result->GetExceptionDetails(); - FAIL() << exception_details->GetText() - << (exception_details->HasException() - ? exception_details->GetException()->GetDescription().c_str() - : ""); - } - - void OnMessageFromTab(const std::string& json_message) override { + void OnMessageFromContext(const std::string& json_message, + int v8_execution_context_id) override { + EXPECT_EQ(main_world_execution_context_id_, v8_execution_context_id); std::unique_ptr<base::Value> message = base::JSONReader::Read(json_message, base::JSON_PARSE_RFC); const base::DictionaryValue* message_dict; @@ -115,10 +101,6 @@ devtools_client_->SendRawDevToolsMessage(json_message); } - HeadlessWebContents::Builder::TabSocketType GetTabSocketType() override { - return HeadlessWebContents::Builder::TabSocketType::MAIN_WORLD; - } - bool OnProtocolMessage(const std::string& devtools_agent_host_id, const std::string& json_message, const base::DictionaryValue& parsed_message) override { @@ -132,7 +114,8 @@ if ((id % 2) == 0) return false; - headless_tab_socket_->SendMessageToTab(json_message); + headless_tab_socket_->SendMessageToContext( + json_message, main_world_execution_context_id_); return true; } @@ -140,7 +123,8 @@ if (!parsed_message.GetString("method", &method)) return false; - headless_tab_socket_->SendMessageToTab(json_message); + headless_tab_socket_->SendMessageToContext( + json_message, main_world_execution_context_id_); // Check which domain the event belongs to, if it's the DOM domain then // assume js handled it. @@ -151,6 +135,7 @@ private: HeadlessTabSocket* headless_tab_socket_; + int main_world_execution_context_id_; }; class SimpleCommandJsBindingsTest : public HeadlessJsBindingsTest {
diff --git a/headless/test/tab_socket_test.cc b/headless/test/tab_socket_test.cc new file mode 100644 index 0000000..e994b59 --- /dev/null +++ b/headless/test/tab_socket_test.cc
@@ -0,0 +1,160 @@ +// 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 "headless/test/tab_socket_test.h" + +#include "headless/public/headless_devtools_client.h" +#include "headless/public/headless_tab_socket.h" + +namespace headless { + +TabSocketTest::TabSocketTest() {} +TabSocketTest::~TabSocketTest() {} + +void TabSocketTest::SetUp() { + options()->mojo_service_names.insert("headless::TabSocket"); + HeadlessAsyncDevTooledBrowserTest::SetUp(); +} + +void TabSocketTest::RunDevTooledTest() { + devtools_client_->GetRuntime()->AddObserver(this); + devtools_client_->GetRuntime()->Enable(); + // Note we must enable the page domain or the browser won't get told the + // devtools frame ids. + devtools_client_->GetPage()->AddObserver(this); + devtools_client_->GetPage()->Enable( + page::EnableParams::Builder().Build(), + base::Bind(&TabSocketTest::OnPageEnabled, base::Unretained(this))); +} + +void TabSocketTest::OnPageEnabled(std::unique_ptr<page::EnableResult> result) { + devtools_client_->GetPage()->GetExperimental()->GetResourceTree( + page::GetResourceTreeParams::Builder().Build(), + base::Bind(&TabSocketTest::OnResourceTree, base::Unretained(this))); +} + +void TabSocketTest::OnResourceTree( + std::unique_ptr<page::GetResourceTreeResult> result) { + main_frame_id_ = result->GetFrameTree()->GetFrame()->GetId(); + RunTabSocketTest(); +} + +void TabSocketTest::OnExecutionContextCreated( + const runtime::ExecutionContextCreatedParams& params) { + const base::DictionaryValue* dictionary; + bool is_main_world; + if (params.GetContext()->HasAuxData() && + params.GetContext()->GetAuxData()->GetAsDictionary(&dictionary)) { + if (dictionary->GetBoolean("isDefault", &is_main_world) && !is_main_world) { + world_name_to_v8_execution_context_id_[params.GetContext()->GetName()] = + params.GetContext()->GetId(); + } + std::string frame_id; + if (dictionary->GetString("frameId", &frame_id)) { + frame_id_to_v8_execution_context_ids_[frame_id].insert( + params.GetContext()->GetId()); + } + } +} + +void TabSocketTest::ExpectJsException( + std::unique_ptr<runtime::EvaluateResult> result) { + EXPECT_TRUE(result->HasExceptionDetails()); + FinishAsynchronousTest(); +} + +void TabSocketTest::FailOnJsEvaluateException( + std::unique_ptr<runtime::EvaluateResult> result) { + if (!result->HasExceptionDetails()) + return; + + FinishAsynchronousTest(); + + const runtime::ExceptionDetails* exception_details = + result->GetExceptionDetails(); + FAIL() << exception_details->GetText() + << (exception_details->HasException() + ? exception_details->GetException()->GetDescription().c_str() + : ""); +} + +bool TabSocketTest::GetAllowTabSockets() { + return true; +} + +int TabSocketTest::GetV8ExecutionContextIdByWorldName(const std::string& name) { + const auto find_it = world_name_to_v8_execution_context_id_.find(name); + if (find_it == world_name_to_v8_execution_context_id_.end()) { + FinishAsynchronousTest(); + CHECK(false) << "Unknown isolated world: " << name; + return -1; + } + return find_it->second; +} + +const std::set<int>* TabSocketTest::GetV8ExecutionContextIdsForFrame( + const std::string& devtools_frame_id) const { + const auto find_it = + frame_id_to_v8_execution_context_ids_.find(devtools_frame_id); + if (find_it == frame_id_to_v8_execution_context_ids_.end()) + return nullptr; + return &find_it->second; +} + +void TabSocketTest::CreateMainWorldTabSocket( + std::string devtools_frame_id, + base::Callback<void(int)> callback) { + const auto find_it = + frame_id_to_v8_execution_context_ids_.find(devtools_frame_id); + CHECK(find_it != frame_id_to_v8_execution_context_ids_.end()); + if (find_it->second.size() != 1u) { + FinishAsynchronousTest(); + FAIL() << "More than one v8 execution context exists for the main frame!"; + } + InstallHeadlessTabSocketBindings(callback, *find_it->second.begin()); +} + +void TabSocketTest::CreateIsolatedWorldTabSocket( + std::string isolated_world_name, + std::string devtools_frame_id, + base::Callback<void(int)> callback) { + devtools_client_->GetPage()->GetExperimental()->CreateIsolatedWorld( + page::CreateIsolatedWorldParams::Builder() + .SetFrameId(devtools_frame_id) + .SetWorldName(isolated_world_name) + .Build(), + base::Bind(&TabSocketTest::OnCreatedIsolatedWorld, base::Unretained(this), + std::move(callback))); +} + +void TabSocketTest::OnCreatedIsolatedWorld( + base::Callback<void(int)> callback, + std::unique_ptr<page::CreateIsolatedWorldResult> result) { + InstallHeadlessTabSocketBindings(callback, result->GetExecutionContextId()); +} + +void TabSocketTest::InstallHeadlessTabSocketBindings( + base::Callback<void(int)> callback, + int execution_context_id) { + HeadlessTabSocket* tab_socket = web_contents_->GetHeadlessTabSocket(); + CHECK(tab_socket); + tab_socket->InstallHeadlessTabSocketBindings( + execution_context_id, + base::Bind(&TabSocketTest::OnInstalledHeadlessTabSocketBindings, + base::Unretained(this), execution_context_id, + std::move(callback))); +} + +void TabSocketTest::OnInstalledHeadlessTabSocketBindings( + int execution_context_id, + base::Callback<void(int)> callback, + bool success) { + if (!success) { + FinishAsynchronousTest(); + CHECK(false) << "InstallHeadlessTabSocketBindings failed"; + } + callback.Run(execution_context_id); +} + +} // namespace headless
diff --git a/headless/test/tab_socket_test.h b/headless/test/tab_socket_test.h new file mode 100644 index 0000000..da08d56 --- /dev/null +++ b/headless/test/tab_socket_test.h
@@ -0,0 +1,91 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef HEADLESS_TEST_TAB_SOCKET_TEST_H_ +#define HEADLESS_TEST_TAB_SOCKET_TEST_H_ + +#include "headless/public/devtools/domains/page.h" +#include "headless/public/devtools/domains/runtime.h" +#include "headless/public/headless_tab_socket.h" +#include "headless/test/headless_browser_test.h" + +namespace headless { + +class TabSocketTest : public HeadlessAsyncDevTooledBrowserTest, + public headless::HeadlessTabSocket::Listener, + public page::Observer, + public runtime::Observer { + public: + TabSocketTest(); + ~TabSocketTest() override; + + // HeadlessAsyncDevTooledBrowserTest implementation: + void SetUp() override; + void RunDevTooledTest() override; + bool GetAllowTabSockets() override; + + // runtime::Observer implementation: + void OnExecutionContextCreated( + const runtime::ExecutionContextCreatedParams& params) override; + + void ExpectJsException(std::unique_ptr<runtime::EvaluateResult> result); + + void FailOnJsEvaluateException( + std::unique_ptr<runtime::EvaluateResult> result); + + // Note this will fail the test if an execution context corresponding to + // |name| doesn't exist. + int GetV8ExecutionContextIdByWorldName(const std::string& name); + + // Returns a pointer to the set of v8 execution context ids corresponding to + // |devtools_frame_id| or null if none exist. + const std::set<int>* GetV8ExecutionContextIdsForFrame( + const std::string& devtools_frame_id) const; + + // Attempts to install a main world TabSocket in |devtools_frame_id|. + // If successful |callback| will run with the execution context id of the + // main world tab socket. + void CreateMainWorldTabSocket(std::string devtools_frame_id, + base::Callback<void(int)> callback); + + // Attempts to create an isolated world in |isolated_world_name| and then + // install a world TabSocket. If successful |callback| will run with the + // execution context id of the newly created isolated world as a parameter. + // Note |isolated_world_name| must be unique. + void CreateIsolatedWorldTabSocket(std::string isolated_world_name, + std::string devtools_frame_id, + base::Callback<void(int)> callback); + + virtual void RunTabSocketTest() = 0; + + const std::string& main_frame_id() const { return *main_frame_id_; } + + private: + void OnPageEnabled(std::unique_ptr<page::EnableResult> result); + + void OnResourceTree(std::unique_ptr<page::GetResourceTreeResult> result); + + void CreateMainWorldTabSocketStep2(std::string devtools_frame_id, + base::Callback<void(int)> callback, + int v8_execution_context_id); + + void OnCreatedIsolatedWorld( + base::Callback<void(int)> callback, + std::unique_ptr<page::CreateIsolatedWorldResult> result); + + void InstallHeadlessTabSocketBindings(base::Callback<void(int)> callback, + int execution_context_id); + + void OnInstalledHeadlessTabSocketBindings(int execution_context_id, + base::Callback<void(int)> callback, + bool success); + + std::map<std::string, int> world_name_to_v8_execution_context_id_; + std::map<std::string, std::set<int>> frame_id_to_v8_execution_context_ids_; + base::Optional<std::string> main_frame_id_; +}; + +} // namespace headless + +#endif // HEADLESS_TEST_TAB_SOCKET_TEST_H_
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index d8437f1..55bab02e 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1245,6 +1245,12 @@ <message name="IDS_IOS_CONFIRM_PASSWORD_DELETION" desc="Label of a confirmation dialogue button which allows the user to confirm deletion of a stored password. [Length: one line] [iOS only]"> Delete Saved Password </message> + <message name="IDS_IOS_SETTINGS_PASSWORDS_SAVED_HEADING" desc="The title for a list of username/site/password items. These items are already saved by the browser and can be deleted/edited. [Length: one line] [iOS only]"> + Saved Passwords + </message> + <message name="IDS_IOS_SETTINGS_PASSWORDS_EXCEPTIONS_HEADING" desc="The title for a list of sites where passwords will not be saved. These items are already saved by the browser and can only be deleted. [Length: one line] [iOS only]"> + Never Saved + </message> <message name="IDS_IOS_SIGNED_IN_ACCOUNTS_VIEW_OK_BUTTON" desc="The title of the OK button of the Signed In Accounts view [iOS only] [20em]"> OK, Got It </message>
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm index e6693d3c..86529b30 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/strings/string16.h" #include "components/metrics/enabled_state_provider.h" #include "components/metrics/metrics_state_manager.h" #include "components/prefs/pref_service.h" @@ -103,7 +104,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); if (!metrics_state_manager_) { metrics_state_manager_ = metrics::MetricsStateManager::Create( - local_state_, enabled_state_provider_.get(), + local_state_, enabled_state_provider_.get(), base::string16(), base::Bind(&PostStoreMetricsClientInfo), base::Bind(&LoadMetricsClientInfo)); }
diff --git a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm index bd869908..b99c59d 100644 --- a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm +++ b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/macros.h" +#include "base/strings/string16.h" #include "base/test/histogram_tester.h" #include "base/test/test_simple_task_runner.h" #include "components/metrics/metrics_pref_names.h" @@ -147,7 +148,7 @@ was_last_shutdown_clean); metrics_state_ = metrics::MetricsStateManager::Create( &local_state_, new metrics::TestEnabledStateProvider(false, false), - metrics::MetricsStateManager::StoreClientInfoCallback(), + base::string16(), metrics::MetricsStateManager::StoreClientInfoCallback(), metrics::MetricsStateManager::LoadClientInfoCallback()); metrics_service_.reset(new metrics::MetricsService( metrics_state_.get(), &metrics_client_, &local_state_));
diff --git a/ios/chrome/browser/payments/payment_request.h b/ios/chrome/browser/payments/payment_request.h index d05b33b..4f54940c 100644 --- a/ios/chrome/browser/payments/payment_request.h +++ b/ios/chrome/browser/payments/payment_request.h
@@ -14,6 +14,8 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "components/autofill/core/browser/credit_card.h" +#include "components/payments/core/address_normalization_manager.h" +#include "components/payments/core/address_normalizer_impl.h" #include "components/payments/core/journey_logger.h" #include "components/payments/core/payment_options_provider.h" #include "components/payments/core/payment_request_base_delegate.h" @@ -28,7 +30,6 @@ namespace payments { class AddressNormalizer; -class AddressNormalizerImpl; class CurrencyFormatter; class PaymentInstrument; class AutofillPaymentInstrument; @@ -120,6 +121,10 @@ // hence the CurrencyFormatter is cached here. CurrencyFormatter* GetOrCreateCurrencyFormatter(); + AddressNormalizationManager* address_normalization_manager() { + return &address_normalization_manager_; + } + // Adds |profile| to the list of cached profiles, updates the list of // available shipping and contact profiles, and returns a reference to the // cached copy of |profile|. @@ -264,7 +269,10 @@ __weak id<PaymentRequestUIDelegate> payment_request_ui_delegate_; // The address normalizer to use for the duration of the Payment Request. - AddressNormalizerImpl* address_normalizer_; + AddressNormalizerImpl address_normalizer_; + + // Used to normalize the shipping address and the contact info. + AddressNormalizationManager address_normalization_manager_; // The currency formatter instance for this PaymentRequest flow. std::unique_ptr<CurrencyFormatter> currency_formatter_;
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm index 900fe519..2d1661af 100644 --- a/ios/chrome/browser/payments/payment_request.mm +++ b/ios/chrome/browser/payments/payment_request.mm
@@ -10,12 +10,12 @@ #include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "components/autofill/core/browser/autofill_country.h" #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/region_data_loader_impl.h" #include "components/autofill/core/browser/validation.h" -#include "components/payments/core/address_normalizer_impl.h" #include "components/payments/core/autofill_payment_instrument.h" #include "components/payments/core/currency_formatter.h" #include "components/payments/core/payment_instrument.h" @@ -65,10 +65,14 @@ web_state_(web_state), personal_data_manager_(personal_data_manager), payment_request_ui_delegate_(payment_request_ui_delegate), - address_normalizer_(new AddressNormalizerImpl( + address_normalizer_( GetAddressInputSource( personal_data_manager_->GetURLRequestContextGetter()), - GetAddressInputStorage())), + GetAddressInputStorage()), + address_normalization_manager_( + &address_normalizer_, + autofill::AutofillCountry::CountryCodeForLocale( + GetApplicationContext()->GetApplicationLocale())), selected_shipping_profile_(nullptr), selected_contact_profile_(nullptr), selected_payment_method_(nullptr), @@ -110,6 +114,17 @@ }); if (first_complete_payment_method != payment_methods_.end()) selected_payment_method_ = *first_complete_payment_method; + + // Kickoff the process of loading the rules (which is asynchronous) for each + // profile's country, to get faster address normalization later. + for (const autofill::AutofillProfile* profile : + personal_data_manager_->GetProfilesToSuggest()) { + std::string countryCode = + base::UTF16ToUTF8(profile->GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)); + if (autofill::data_util::IsValidCountryCode(countryCode)) { + address_normalizer_.LoadRulesForRegion(countryCode); + } + } } PaymentRequest::~PaymentRequest() {} @@ -144,7 +159,7 @@ } AddressNormalizer* PaymentRequest::GetAddressNormalizer() { - return address_normalizer_; + return &address_normalizer_; } autofill::RegionDataLoader* PaymentRequest::GetRegionDataLoader() {
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index d5c29b9..5dd0d84 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -377,6 +377,7 @@ "//ios/chrome/browser/ui/alert_coordinator", "//ios/chrome/browser/ui/authentication", "//ios/chrome/browser/ui/bookmarks", + "//ios/chrome/browser/ui/bubble", "//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/context_menu",
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 57fa19dc..0f6e5177 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -1851,7 +1851,7 @@ initWithBaseViewController:self browserState:_browserState]; [_paymentRequestManager setToolbarModel:_toolbarModelIOS.get()]; - [_paymentRequestManager setWebState:[_model currentTab].webState]; + [_paymentRequestManager setActiveWebState:[_model currentTab].webState]; } } @@ -4618,7 +4618,7 @@ if (fg) { [_contextualSearchController setTab:tab]; - [_paymentRequestManager setWebState:tab.webState]; + [_paymentRequestManager setActiveWebState:tab.webState]; } } @@ -4638,7 +4638,7 @@ [self updateVoiceSearchBarVisibilityAnimated:NO]; [_contextualSearchController setTab:newTab]; - [_paymentRequestManager setWebState:newTab.webState]; + [_paymentRequestManager setActiveWebState:newTab.webState]; [self tabSelected:newTab]; DCHECK_EQ(newTab, [model currentTab]); @@ -4701,10 +4701,12 @@ [_toolbarController selectedTabChanged]; } + [_paymentRequestManager stopTrackingWebState:tab.webState]; + [[UpgradeCenter sharedInstance] tabWillClose:tab.tabId]; if ([model count] == 1) { // About to remove the last tab. [_contextualSearchController setTab:nil]; - [_paymentRequestManager setWebState:nil]; + [_paymentRequestManager setActiveWebState:nullptr]; } }
diff --git a/ios/chrome/browser/ui/bubble/BUILD.gn b/ios/chrome/browser/ui/bubble/BUILD.gn new file mode 100644 index 0000000..bf0aeeb6 --- /dev/null +++ b/ios/chrome/browser/ui/bubble/BUILD.gn
@@ -0,0 +1,30 @@ +# 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. + +source_set("bubble") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "bubble_view.h", + "bubble_view.mm", + "bubble_view_controller.h", + "bubble_view_controller.mm", + ] + deps = [ + "//base", + ] + libs = [ "UIKit.framework" ] +} + +source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ + "bubble_view_controller_unittest.mm", + ] + deps = [ + ":bubble", + "//base", + "//testing/gtest", + ] +}
diff --git a/ios/chrome/browser/ui/bubble/OWNERS b/ios/chrome/browser/ui/bubble/OWNERS new file mode 100644 index 0000000..d122690d --- /dev/null +++ b/ios/chrome/browser/ui/bubble/OWNERS
@@ -0,0 +1,2 @@ +edchin@chromium.org +gchatz@chromium.org \ No newline at end of file
diff --git a/ios/chrome/browser/ui/bubble/bubble_view.h b/ios/chrome/browser/ui/bubble/bubble_view.h new file mode 100644 index 0000000..91927d3 --- /dev/null +++ b/ios/chrome/browser/ui/bubble/bubble_view.h
@@ -0,0 +1,43 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_H_ + +#import <UIKit/UIKit.h> + +// Direction for the bubble to point. +typedef NS_ENUM(NSInteger, BubbleArrowDirection) { + // Bubble is below the target UI element and the arrow is pointing up. + BubbleArrowDirectionUp = 0, + // Bubble is above the target UI element and the arrow is pointing down. + BubbleArrowDirectionDown = 1, +}; + +// Alignment of the bubble relative to the arrow. +typedef NS_ENUM(NSInteger, BubbleAlignment) { + BubbleAlignmentLeading = 0, + BubbleAlignmentCenter = 1, + BubbleAlignmentTrailing = 2, +}; + +// Speech bubble shaped view that displays a message. +@interface BubbleView : UIView + +// Initializes with the given text, direction that the bubble should point, and +// alignment of the bubble. +- (instancetype)initWithText:(NSString*)text + direction:(BubbleArrowDirection)arrowDirection + alignment:(BubbleAlignment)alignment + NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; + +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +#endif // IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_H_
diff --git a/ios/chrome/browser/ui/bubble/bubble_view.mm b/ios/chrome/browser/ui/bubble/bubble_view.mm new file mode 100644 index 0000000..6d820c93 --- /dev/null +++ b/ios/chrome/browser/ui/bubble/bubble_view.mm
@@ -0,0 +1,37 @@ +// 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. + +#import "ios/chrome/browser/ui/bubble/bubble_view.h" + +#include "base/logging.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface BubbleView () +// Label containing the text displayed on the bubble. +@property(nonatomic, weak) UILabel* label; +@end + +@implementation BubbleView + +@synthesize label = _label; + +- (instancetype)initWithText:(NSString*)text + direction:(BubbleArrowDirection)arrowDirection + alignment:(BubbleAlignment)alignment { + self = [super initWithFrame:CGRectZero]; + return self; +} + +#pragma mark - UIView overrides + +// Override sizeThatFits to return the bubble's optimal size. +- (CGSize)sizeThatFits:(CGSize)size { + NOTIMPLEMENTED(); + return size; +} + +@end
diff --git a/ios/chrome/browser/ui/bubble/bubble_view_controller.h b/ios/chrome/browser/ui/bubble/bubble_view_controller.h new file mode 100644 index 0000000..17e2495f --- /dev/null +++ b/ios/chrome/browser/ui/bubble/bubble_view_controller.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_CONTROLLER_H_ +#define IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_CONTROLLER_H_ + +#import "ios/chrome/browser/ui/bubble/bubble_view.h" + +#import <UIKit/UIKit.h> + +// View controller that manages a BubbleView, which points to a UI element of +// interest. +@interface BubbleViewController : UIViewController + +// Initializes the bubble with the given text, arrow direction, and alignment. +- (instancetype)initWithText:(NSString*)text + direction:(BubbleArrowDirection)arrowDirection + alignment:(BubbleAlignment)alignment + NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithNibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; + +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +// Animates the bubble in with a fade-in. +- (void)animateContentIn; + +// Dismisses the bubble. If |animated| is true, the bubble fades out. +- (void)dismissAnimated:(BOOL)animated; + +@end + +#endif // IOS_CHROME_BROWSER_UI_BUBBLE_BUBBLE_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/bubble/bubble_view_controller.mm b/ios/chrome/browser/ui/bubble/bubble_view_controller.mm new file mode 100644 index 0000000..be4eb9c --- /dev/null +++ b/ios/chrome/browser/ui/bubble/bubble_view_controller.mm
@@ -0,0 +1,49 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/bubble/bubble_view_controller.h" + +#include "base/logging.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface BubbleViewController () +@property(nonatomic, readonly) NSString* text; +@property(nonatomic, readonly) BubbleArrowDirection arrowDirection; +@property(nonatomic, readonly) BubbleAlignment alignment; +@end + +@implementation BubbleViewController + +@synthesize text = _text; +@synthesize arrowDirection = _arrowDirection; +@synthesize alignment = _alignment; + +- (instancetype)initWithText:(NSString*)text + direction:(BubbleArrowDirection)arrowDirection + alignment:(BubbleAlignment)alignment { + self = [super initWithNibName:nil bundle:nil]; + _text = text; + _arrowDirection = arrowDirection; + _alignment = alignment; + return self; +} + +- (void)loadView { + self.view = [[BubbleView alloc] initWithText:self.text + direction:self.arrowDirection + alignment:self.alignment]; +} + +- (void)animateContentIn { + NOTIMPLEMENTED(); +} + +- (void)dismissAnimated:(BOOL)animated { + NOTIMPLEMENTED(); +} + +@end
diff --git a/ios/chrome/browser/ui/bubble/bubble_view_controller_unittest.mm b/ios/chrome/browser/ui/bubble/bubble_view_controller_unittest.mm new file mode 100644 index 0000000..f5dc9f9 --- /dev/null +++ b/ios/chrome/browser/ui/bubble/bubble_view_controller_unittest.mm
@@ -0,0 +1,30 @@ +// 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. + +#import "ios/chrome/browser/ui/bubble/bubble_view_controller.h" + +#include "base/logging.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 + +// Fixture to test BubbleViewController. +class BubbleViewControllerTest : public PlatformTest {}; + +// Tests the bubble's intrinsic content size given short text. +TEST_F(BubbleViewControllerTest, BubbleSizeShortText) {} + +// Tests that the bubble accommodates text that exceeds the maximum bubble width +// by displaying the text on multiple lines. +TEST_F(BubbleViewControllerTest, BubbleSizeMultipleLineText) {} + +// Tests that the bubble attaches to the UI element when the layout is flipped +// for RTL languages. +TEST_F(BubbleViewControllerTest, RTL) {} + +// Tests that the accessibility label matches the display text. +TEST_F(BubbleViewControllerTest, Accessibility) {}
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index 7c53b521..8ff51fb 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -70,6 +70,7 @@ if (self) { _collectionUpdater = [[ContentSuggestionsCollectionUpdater alloc] initWithDataSource:dataSource]; + self.collectionView.prefetchingEnabled = NO; } return self; }
diff --git a/ios/chrome/browser/ui/payments/payment_request_manager.h b/ios/chrome/browser/ui/payments/payment_request_manager.h index 22595b9..180ef3d 100644 --- a/ios/chrome/browser/ui/payments/payment_request_manager.h +++ b/ios/chrome/browser/ui/payments/payment_request_manager.h
@@ -24,18 +24,13 @@ // interface. @interface PaymentRequestManager : NSObject -// YES if Payment Request is enabled on the current web state. -@property(readonly) BOOL enabled; - // IOS specific version of ToolbarModel that is used for grabbing security // info. @property(nonatomic, assign) ToolbarModelIOS* toolbarModel; -// The current web state being observed for PaymentRequest invocations. -@property(nonatomic, assign) web::WebState* webState; - -// The ios::ChromeBrowserState instance passed to the initializer. -@property(nonatomic, assign) ios::ChromeBrowserState* browserState; +// The WebState being observed for invocations of the Payment Request API. +// Should outlive this instance. May be nullptr. +@property(nonatomic, assign) web::WebState* activeWebState; // Designated initializer. - (instancetype)initWithBaseViewController:(UIViewController*)viewController @@ -45,12 +40,10 @@ - (instancetype)init NS_UNAVAILABLE; -// Sets the WebState to be observed for invocations of the Payment Request API. -// |webState|'s lifetime should be greater than the receiver's. |webState| can -// be nil. -- (void)setWebState:(web::WebState*)webState; +// Stops tracking instances of payments::PaymentRequest for |webState|. +- (void)stopTrackingWebState:(web::WebState*)webState; -// Enables or disables the Payment Request API for the current webState. If +// Enables or disables the Payment Request API for the active webState. If // |enabled| is YES, the API may still not be enabled if the flag is not set; // the -enabled property will indicate the current status. This method functions // asynchronously.
diff --git a/ios/chrome/browser/ui/payments/payment_request_manager.mm b/ios/chrome/browser/ui/payments/payment_request_manager.mm index fb191ef..1662d9c 100644 --- a/ios/chrome/browser/ui/payments/payment_request_manager.mm +++ b/ios/chrome/browser/ui/payments/payment_request_manager.mm
@@ -4,7 +4,10 @@ #import "ios/chrome/browser/ui/payments/payment_request_manager.h" +#include <memory> #include <string> +#include <unordered_map> +#include <vector> #include "base/ios/block_types.h" #include "base/ios/ios_util.h" @@ -16,13 +19,10 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #import "base/values.h" -#include "components/autofill/core/browser/autofill_country.h" -#include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/ios/browser/autofill_driver_ios.h" -#include "components/payments/core/address_normalization_manager.h" #include "components/payments/core/can_make_payment_query.h" #include "components/payments/core/payment_address.h" #include "components/payments/core/payment_prefs.h" @@ -94,21 +94,18 @@ // PersonalDataManager used to manage user credit cards and addresses. autofill::PersonalDataManager* _personalDataManager; - // Object that has a copy of web::PaymentRequest as provided by the page - // invoking the PaymentRequest API. Also caches credit cards and addresses - // provided by the _personalDataManager and manages selected ones for the - // current PaymentRequest flow. - std::unique_ptr<payments::PaymentRequest> _paymentRequest; + // The of map WebState to the list of payments::PaymentRequest instances + // maintained for that WebState. + std::unordered_map<web::WebState*, + std::vector<std::unique_ptr<payments::PaymentRequest>>> + _paymentRequests; - // WebState for the tab this object is attached to. - web::WebState* _webState; + // The observer for |_activeWebState|. + std::unique_ptr<web::WebStateObserverBridge> _activeWebStateObserver; - // Observer for |_webState|. - std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; - - // Boolean to track if the current WebState is enabled (JS callback is set + // Boolean to track if the active WebState is enabled (JS callback is set // up). - BOOL _webStateEnabled; + BOOL _activeWebStateEnabled; // True when close has been called and the PaymentRequest coordinator has // been destroyed. @@ -128,16 +125,17 @@ // page does not settle the pending update promise in a timely fashion. NSTimer* _updateEventTimeoutTimer; - // AddressNormalizationManager used to normalize the various addresses (e.g. - // shipping, contact, billing). - std::unique_ptr<payments::AddressNormalizationManager> - _addressNormalizationManager; - // Storage for data to return in the payment response, until we're ready to // send an actual PaymentResponse. PendingPaymentResponse _pendingPaymentResponse; } +// YES if Payment Request is enabled on the active web state. +@property(readonly) BOOL enabled; + +// The ios::ChromeBrowserState instance passed to the initializer. +@property(nonatomic, assign) ios::ChromeBrowserState* browserState; + // Object that manages JavaScript injection into the web view. @property(nonatomic, weak) JSPaymentRequestManager* paymentRequestJsManager; @@ -203,16 +201,17 @@ // Called when the relevant addresses from a Payment Request have been // normalized. Resolves the request promise with a PaymentResponse. -- (void)paymentRequestAddressNormalizationDidComplete; +- (void)paymentRequestAddressNormalizationDidCompleteForPaymentRequest: + (payments::PaymentRequest*)paymentRequest; @end @implementation PaymentRequestManager -@synthesize enabled = _enabled; @synthesize toolbarModel = _toolbarModel; -@synthesize webState = _webState; @synthesize browserState = _browserState; +@synthesize enabled = _enabled; +@synthesize activeWebState = _activeWebState; @synthesize paymentRequestJsManager = _paymentRequestJsManager; - (instancetype)initWithBaseViewController:(UIViewController*)viewController @@ -235,21 +234,32 @@ return nil; } -- (void)setWebState:(web::WebState*)webState { - [self disconnectWebState]; +- (void)setActiveWebState:(web::WebState*)webState { + [self disconnectActiveWebState]; if (webState) { _paymentRequestJsManager = base::mac::ObjCCastStrict<JSPaymentRequestManager>( [webState->GetJSInjectionReceiver() instanceOfClass:[JSPaymentRequestManager class]]); - _webState = webState; - _webStateObserver.reset(new web::WebStateObserverBridge(webState, self)); - [self enableCurrentWebState]; + _activeWebState = webState; + if (_paymentRequests.find(webState) == _paymentRequests.end()) { + _paymentRequests[webState] = + std::vector<std::unique_ptr<payments::PaymentRequest>>(); + } + _activeWebStateObserver = + base::MakeUnique<web::WebStateObserverBridge>(webState, self); + [self enableActiveWebState]; } else { - _webState = nullptr; + _activeWebState = nullptr; } } +- (void)stopTrackingWebState:(web::WebState*)webState { + const auto iterator = _paymentRequests.find(webState); + DCHECK(iterator != _paymentRequests.end()); + _paymentRequests.erase(iterator); +} + - (void)enablePaymentRequest:(BOOL)enabled { // Asynchronously enables PaymentRequest, so that some preferences // (UIAccessibilityIsVoiceOverRunning(), for example) have time to synchronize @@ -267,7 +277,7 @@ [self dismissUI]; } _enabled = enabled; - [self enableCurrentWebState]; + [self enableActiveWebState]; } } @@ -287,18 +297,18 @@ return; _closed = YES; - [self disableCurrentWebState]; - [self setWebState:nil]; + [self disableActiveWebState]; + [self setActiveWebState:nil]; [self dismissUI]; } -- (void)enableCurrentWebState { - if (![self webState]) { +- (void)enableActiveWebState { + if (!_activeWebState) { return; } if (_enabled) { - if (!_webStateEnabled) { + if (!_activeWebStateEnabled) { __weak PaymentRequestManager* weakSelf = self; auto callback = base::BindBlockArc( ^bool(const base::DictionaryValue& JSON, const GURL& originURL, @@ -306,27 +316,27 @@ // |originURL| and |userIsInteracting| aren't used. return [weakSelf handleScriptCommand:JSON]; }); - [self webState]->AddScriptCommandCallback(callback, kCommandPrefix); + _activeWebState->AddScriptCommandCallback(callback, kCommandPrefix); - _webStateEnabled = YES; + _activeWebStateEnabled = YES; } } else { - [self disableCurrentWebState]; + [self disableActiveWebState]; } } -- (void)disableCurrentWebState { - if (_webState && _webStateEnabled) { - _webState->RemoveScriptCommandCallback(kCommandPrefix); - _webStateEnabled = NO; +- (void)disableActiveWebState { + if (_activeWebState && _activeWebStateEnabled) { + _activeWebState->RemoveScriptCommandCallback(kCommandPrefix); + _activeWebStateEnabled = NO; } } -- (void)disconnectWebState { - if (_webState) { +- (void)disconnectActiveWebState { + if (_activeWebState) { _paymentRequestJsManager = nil; - _webStateObserver.reset(); - [self disableCurrentWebState]; + _activeWebStateObserver.reset(); + [self disableActiveWebState]; } } @@ -359,59 +369,40 @@ return NO; } -- (void)startAddressNormalizer { - autofill::PersonalDataManager* personalDataManager = - _paymentRequest->GetPersonalDataManager(); - - payments::AddressNormalizer* addressNormalizer = - _paymentRequest->GetAddressNormalizer(); - - // Kickoff the process of loading the rules (which is asynchronous) for each - // profile's country, to get faster address normalization later. - for (const autofill::AutofillProfile* profile : - personalDataManager->GetProfilesToSuggest()) { - std::string countryCode = - base::UTF16ToUTF8(profile->GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)); - if (autofill::data_util::IsValidCountryCode(countryCode)) { - addressNormalizer->LoadRulesForRegion(countryCode); - } - } - - const std::string default_country_code = - autofill::AutofillCountry::CountryCodeForLocale( - _paymentRequest->GetApplicationLocale()); - - _addressNormalizationManager = - base::MakeUnique<payments::AddressNormalizationManager>( - addressNormalizer, default_country_code); -} - -// Ensures that |_paymentRequest| is set to the correct value for |message|. -// Returns YES if |_paymentRequest| was already set to the right value, or if it -// was updated to match |message|. -- (BOOL)createPaymentRequestFromMessage:(const base::DictionaryValue&)message { +// Extracts a web::PaymentRequest from |message|. Returns the instance of +// payments::PaymentRequest that corresponds to the extracted +// web::PaymentRequest object, if one exists. Otherwise, creates and returns a +// new one which is initialized with the web::PaymentRequest object. Returns +// nullptr if it cannot extract a web::PaymentRequest from |message|. +- (payments::PaymentRequest*)getOrCreatePaymentRequestFromMessage: + (const base::DictionaryValue&)message { const base::DictionaryValue* paymentRequestData; web::PaymentRequest webPaymentRequest; if (!message.GetDictionary("payment_request", &paymentRequestData)) { DLOG(ERROR) << "JS message parameter 'payment_request' is missing"; - return NO; + return nullptr; } if (!webPaymentRequest.FromDictionaryValue(*paymentRequestData)) { DLOG(ERROR) << "JS message parameter 'payment_request' is invalid"; - return NO; + return nullptr; } - // TODO(crbug.com/711419): make sure multiple PaymentRequests can be active - // simultaneously. - if (_paymentRequest && - (_paymentRequest->web_payment_request() == webPaymentRequest)) { - return YES; + const auto iterator = _paymentRequests.find(_activeWebState); + DCHECK(iterator != _paymentRequests.end()); + const auto found = std::find_if( + iterator->second.begin(), iterator->second.end(), + [webPaymentRequest]( + const std::unique_ptr<payments::PaymentRequest>& paymentRequest) { + return paymentRequest->web_payment_request() == webPaymentRequest; + }); + if (found != iterator->second.end()) { + return (*found).get(); } - _paymentRequest = base::MakeUnique<payments::PaymentRequest>( - webPaymentRequest, _browserState, _webState, _personalDataManager, self); - - return YES; + iterator->second.push_back(base::MakeUnique<payments::PaymentRequest>( + webPaymentRequest, _browserState, _activeWebState, _personalDataManager, + self)); + return iterator->second.back().get(); } - (BOOL)handleRequestShow:(const base::DictionaryValue&)message { @@ -420,27 +411,28 @@ // credit card types) against the merchant supported types and return NO // if the intersection is empty. - if (![self createPaymentRequestFromMessage:message]) { + payments::PaymentRequest* paymentRequest = + [self getOrCreatePaymentRequestFromMessage:message]; + if (!paymentRequest) { return NO; } - [self startAddressNormalizer]; - UIImage* pageFavicon = nil; web::NavigationItem* navigationItem = - [self webState]->GetNavigationManager()->GetVisibleItem(); + _activeWebState->GetNavigationManager()->GetVisibleItem(); if (navigationItem && !navigationItem->GetFavicon().image.IsEmpty()) pageFavicon = navigationItem->GetFavicon().image.ToUIImage(); - NSString* pageTitle = base::SysUTF16ToNSString([self webState]->GetTitle()); + NSString* pageTitle = base::SysUTF16ToNSString(_activeWebState->GetTitle()); NSString* pageHost = - base::SysUTF8ToNSString([self webState]->GetLastCommittedURL().host()); + base::SysUTF8ToNSString(_activeWebState->GetLastCommittedURL().host()); BOOL connectionSecure = - [self webState]->GetLastCommittedURL().SchemeIs(url::kHttpsScheme); + _activeWebState->GetLastCommittedURL().SchemeIs(url::kHttpsScheme); autofill::AutofillManager* autofillManager = - autofill::AutofillDriverIOS::FromWebState(_webState)->autofill_manager(); + autofill::AutofillDriverIOS::FromWebState(_activeWebState) + ->autofill_manager(); _paymentRequestCoordinator = [[PaymentRequestCoordinator alloc] initWithBaseViewController:_baseViewController]; - [_paymentRequestCoordinator setPaymentRequest:_paymentRequest.get()]; + [_paymentRequestCoordinator setPaymentRequest:paymentRequest]; [_paymentRequestCoordinator setAutofillManager:autofillManager]; [_paymentRequestCoordinator setBrowserState:_browserState]; [_paymentRequestCoordinator setPageFavicon:pageFavicon]; @@ -479,7 +471,9 @@ } - (BOOL)handleCanMakePayment:(const base::DictionaryValue&)message { - if (![self createPaymentRequestFromMessage:message]) { + payments::PaymentRequest* paymentRequest = + [self getOrCreatePaymentRequestFromMessage:message]; + if (!paymentRequest) { // TODO(crbug.com/602666): Reject the promise with an error of // "InvalidStateError" type. [_paymentRequestJsManager @@ -488,21 +482,21 @@ return YES; } - if (_paymentRequest->IsIncognito()) { + if (paymentRequest->IsIncognito()) { [_paymentRequestJsManager resolveCanMakePaymentPromiseWithValue:YES completionHandler:nil]; return YES; } - BOOL canMakePayment = _paymentRequest->CanMakePayment(); + BOOL canMakePayment = paymentRequest->CanMakePayment(); payments::CanMakePaymentQuery* canMakePaymentQuery = IOSCanMakePaymentQueryFactory::GetInstance()->GetForBrowserState( _browserState); DCHECK(canMakePaymentQuery); if (canMakePaymentQuery->CanQuery( - [self webState]->GetLastCommittedURL().GetOrigin(), - _paymentRequest->stringified_method_data())) { + _activeWebState->GetLastCommittedURL().GetOrigin(), + paymentRequest->stringified_method_data())) { [_paymentRequestJsManager resolveCanMakePaymentPromiseWithValue:canMakePayment completionHandler:nil]; @@ -624,22 +618,22 @@ } - (BOOL)webStateContentIsSecureHTML { - if (![self webState]) { + if (!_activeWebState) { return NO; } - if (![self toolbarModel]) { + if (!_toolbarModel) { return NO; } // Checks if the current page is a web view with HTML and that the // origin is localhost, file://, or cryptographic. - if (!web::IsOriginSecure([self webState]->GetLastCommittedURL()) || - ![self webState]->ContentIsHTML()) { + if (!web::IsOriginSecure(_activeWebState->GetLastCommittedURL()) || + !_activeWebState->ContentIsHTML()) { return NO; } - if (![self webState]->GetLastCommittedURL().SchemeIsCryptographic()) { + if (!_activeWebState->GetLastCommittedURL().SchemeIsCryptographic()) { // The URL has a secure origin, but is not https, so it must be local. // Return YES at this point, because localhost and filesystem URLS are // considered secure regardless of scheme. @@ -692,36 +686,40 @@ _pendingPaymentResponse.methodName = methodName; _pendingPaymentResponse.stringifiedDetails = stringifiedDetails; - if (_paymentRequest->request_shipping()) { + if (coordinator.paymentRequest->request_shipping()) { // TODO(crbug.com/602666): User should get here only if they have selected // a shipping address. - DCHECK(_paymentRequest->selected_shipping_profile()); + DCHECK(coordinator.paymentRequest->selected_shipping_profile()); _pendingPaymentResponse.shippingAddress = - *_paymentRequest->selected_shipping_profile(); - _addressNormalizationManager->StartNormalizingAddress( - &_pendingPaymentResponse.shippingAddress); + *coordinator.paymentRequest->selected_shipping_profile(); + coordinator.paymentRequest->address_normalization_manager() + ->StartNormalizingAddress(&_pendingPaymentResponse.shippingAddress); } - if (_paymentRequest->request_payer_name() || - _paymentRequest->request_payer_email() || - _paymentRequest->request_payer_phone()) { + if (coordinator.paymentRequest->request_payer_name() || + coordinator.paymentRequest->request_payer_email() || + coordinator.paymentRequest->request_payer_phone()) { // TODO(crbug.com/602666): User should get here only if they have selected // a contact info. - DCHECK(_paymentRequest->selected_contact_profile()); + DCHECK(coordinator.paymentRequest->selected_contact_profile()); _pendingPaymentResponse.contactAddress = - *_paymentRequest->selected_contact_profile(); - _addressNormalizationManager->StartNormalizingAddress( - &_pendingPaymentResponse.contactAddress); + *coordinator.paymentRequest->selected_contact_profile(); + coordinator.paymentRequest->address_normalization_manager() + ->StartNormalizingAddress(&_pendingPaymentResponse.contactAddress); } __weak PaymentRequestManager* weakSelf = self; - _addressNormalizationManager->FinalizeWithCompletionCallback( - base::BindBlockArc(^() { - [weakSelf paymentRequestAddressNormalizationDidComplete]; + __weak PaymentRequestCoordinator* weakCoordinator = coordinator; + coordinator.paymentRequest->address_normalization_manager() + ->FinalizePendingRequestsWithCompletionCallback(base::BindBlockArc(^() { + [weakSelf + paymentRequestAddressNormalizationDidCompleteForPaymentRequest: + weakCoordinator.paymentRequest]; })); } -- (void)paymentRequestAddressNormalizationDidComplete { +- (void)paymentRequestAddressNormalizationDidCompleteForPaymentRequest: + (payments::PaymentRequest*)paymentRequest { web::PaymentResponse paymentResponse; paymentResponse.method_name = @@ -729,39 +727,39 @@ paymentResponse.details = _pendingPaymentResponse.stringifiedDetails; - if (_paymentRequest->request_shipping()) { + if (paymentRequest->request_shipping()) { paymentResponse.shipping_address = payments::data_util::GetPaymentAddressFromAutofillProfile( _pendingPaymentResponse.shippingAddress, - _paymentRequest->GetApplicationLocale()); + paymentRequest->GetApplicationLocale()); web::PaymentShippingOption* shippingOption = - _paymentRequest->selected_shipping_option(); + paymentRequest->selected_shipping_option(); DCHECK(shippingOption); paymentResponse.shipping_option = shippingOption->id; } - if (_paymentRequest->request_payer_name()) { + if (paymentRequest->request_payer_name()) { paymentResponse.payer_name = _pendingPaymentResponse.contactAddress.GetInfo( autofill::AutofillType(autofill::NAME_FULL), - _paymentRequest->GetApplicationLocale()); + paymentRequest->GetApplicationLocale()); } - if (_paymentRequest->request_payer_email()) { + if (paymentRequest->request_payer_email()) { paymentResponse.payer_email = _pendingPaymentResponse.contactAddress.GetRawInfo( autofill::EMAIL_ADDRESS); } - if (_paymentRequest->request_payer_phone()) { + if (paymentRequest->request_payer_phone()) { paymentResponse.payer_phone = _pendingPaymentResponse.contactAddress.GetRawInfo( autofill::PHONE_HOME_WHOLE_NUMBER); } - _paymentRequest->RecordUseStats(); + paymentRequest->RecordUseStats(); - _paymentRequest->GetPrefService()->SetBoolean( + paymentRequest->GetPrefService()->SetBoolean( payments::kPaymentsFirstTransactionCompleted, true); [_paymentRequestJsManager @@ -776,7 +774,7 @@ (const autofill::AutofillProfile&)shippingAddress { payments::PaymentAddress address = payments::data_util::GetPaymentAddressFromAutofillProfile( - shippingAddress, _paymentRequest->GetApplicationLocale()); + shippingAddress, coordinator.paymentRequest->GetApplicationLocale()); [_paymentRequestJsManager updateShippingAddress:address completionHandler:nil]; [self setUnblockEventQueueTimer]; @@ -798,7 +796,14 @@ didCommitNavigationWithDetails: (const web::LoadCommittedDetails&)load_details { [self dismissUI]; - [self enableCurrentWebState]; + [self enableActiveWebState]; + + // The lifetime of a PaymentRequest is tied to the WebState it is associated + // with and the current URL. Therefore, the PaymentRequest instance should get + // destroyed when the WebState goes away or the user navigates to a new URL. + const auto iterator = _paymentRequests.find(_activeWebState); + DCHECK(iterator != _paymentRequests.end()); + iterator->second.clear(); } @end
diff --git a/ios/chrome/browser/ui/reading_list/BUILD.gn b/ios/chrome/browser/ui/reading_list/BUILD.gn index 102db83..fe103cd 100644 --- a/ios/chrome/browser/ui/reading_list/BUILD.gn +++ b/ios/chrome/browser/ui/reading_list/BUILD.gn
@@ -24,6 +24,7 @@ ":reading_list_ui", "//base", "//components/favicon/core", + "//components/feature_engagement_tracker", "//components/reading_list/core", "//components/reading_list/ios", "//components/url_formatter", @@ -31,6 +32,7 @@ "//ios/chrome/browser", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/favicon", + "//ios/chrome/browser/feature_engagement_tracker", "//ios/chrome/browser/reading_list", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/alert_coordinator",
diff --git a/ios/chrome/browser/ui/reading_list/OWNERS b/ios/chrome/browser/ui/reading_list/OWNERS index ff4b85d..ad2440ad 100644 --- a/ios/chrome/browser/ui/reading_list/OWNERS +++ b/ios/chrome/browser/ui/reading_list/OWNERS
@@ -1,3 +1,6 @@ gambard@chromium.org noyau@chromium.org olivierrobin@chromium.org + +per-file *badge_view*=edchin@chromium.org +per-file *badge_view*=gchatz@chromium.org
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm b/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm index 3aa96e6..033b53c 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm
@@ -8,9 +8,12 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "components/feature_engagement_tracker/public/event_constants.h" +#include "components/feature_engagement_tracker/public/feature_engagement_tracker.h" #include "components/reading_list/core/reading_list_model.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" +#include "ios/chrome/browser/feature_engagement_tracker/feature_engagement_tracker_factory.h" #include "ios/chrome/browser/reading_list/offline_url_utils.h" #include "ios/chrome/browser/reading_list/reading_list_download_service.h" #include "ios/chrome/browser/reading_list/reading_list_download_service_factory.h" @@ -111,6 +114,11 @@ [self.baseViewController presentViewController:self.containerViewController animated:YES completion:nil]; + + // Send the "Viewed Reading List" event to the FeatureEngagementTracker when + // the user opens their reading list. + FeatureEngagementTrackerFactory::GetForBrowserState(self.browserState) + ->NotifyEvent(feature_engagement_tracker::events::kViewedReadingList); } - (void)stop {
diff --git a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm index d34eb1c..b38d68c 100644 --- a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
@@ -22,7 +22,6 @@ #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h" -#include "components/strings/grit/components_strings.h" #include "components/url_formatter/url_formatter.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" @@ -209,7 +208,7 @@ CollectionViewTextItem* headerItem = [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader]; headerItem.text = - l10n_util::GetNSString(IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE); + l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORDS_SAVED_HEADING); headerItem.textColor = [[MDCPalette greyPalette] tint500]; [model setHeader:headerItem forSectionWithIdentifier:SectionIdentifierSavedPasswords]; @@ -223,7 +222,7 @@ CollectionViewTextItem* headerItem = [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader]; headerItem.text = - l10n_util::GetNSString(IDS_PASSWORD_MANAGER_EXCEPTIONS_TAB_TITLE); + l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORDS_EXCEPTIONS_HEADING); headerItem.textColor = [[MDCPalette greyPalette] tint500]; [model setHeader:headerItem forSectionWithIdentifier:SectionIdentifierBlacklist];
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index bd39f8e..565c34d2 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -164,6 +164,7 @@ "//ios/chrome/browser/ui/autofill/cells:unit_tests", "//ios/chrome/browser/ui/bookmarks:unit_tests", "//ios/chrome/browser/ui/bookmarks/cells:unit_tests", + "//ios/chrome/browser/ui/bubble:unit_tests", "//ios/chrome/browser/ui/collection_view:unit_tests", "//ios/chrome/browser/ui/collection_view/cells:unit_tests", "//ios/chrome/browser/ui/commands:unit_tests",
diff --git a/ios/clean/chrome/test/perf/BUILD.gn b/ios/clean/chrome/test/perf/BUILD.gn index 2be9ae9..d984a55a 100644 --- a/ios/clean/chrome/test/perf/BUILD.gn +++ b/ios/clean/chrome/test/perf/BUILD.gn
@@ -11,7 +11,7 @@ tweak_info_plist("info_plist") { info_plists = [ "//ios/chrome/app/resources/Info.plist", - "//ios/chrome/app/resources/ChromeAddition+Info.plist", + "//ios/chrome/app/resources/EarlGreyAddition+Info.plist", ] if (ios_chrome_info_plist_additions != []) { info_plists += ios_chrome_info_plist_additions @@ -55,6 +55,8 @@ configs += [ "//build/config/compiler:enable_arc" ] + _eg_main_application_delegate = "MainApplicationDelegate" + extra_substitutions = [ "CHROMIUM_HANDOFF_ID=$chromium_handoff_id", "CHROMIUM_SHORT_NAME=$target_name", @@ -62,6 +64,7 @@ "CHROMIUM_URL_SCHEME_2=$url_secure_scheme", "CHROMIUM_URL_SCHEME_3=$url_x_callback_scheme", "CHROMIUM_URL_SCHEME_4=$url_channel_scheme", + "EG_MAIN_APPLICATION_DELEGATE=$_eg_main_application_delegate", "SSOAUTH_URL_SCHEME=$url_ssoauth_scheme", ]
diff --git a/ios/components/io_thread/ios_io_thread.h b/ios/components/io_thread/ios_io_thread.h index 0666c27..adad232e 100644 --- a/ios/components/io_thread/ios_io_thread.h +++ b/ios/components/io_thread/ios_io_thread.h
@@ -177,16 +177,6 @@ void Init() override; void CleanUp() override; - // Global state must be initialized on the IO thread, then this - // method must be invoked on the UI thread. - void InitSystemRequestContext(); - - // Lazy initialization of system request context for - // SystemURLRequestContextGetter. To be called on IO thread only - // after global state has been initialized on the IO thread, and - // SystemRequestContext state has been initialized on the UI thread. - void InitSystemRequestContextOnIOThread(); - // Sets up HttpAuthPreferences and HttpAuthHandlerFactory on Globals. void CreateDefaultAuthHandlerFactory();
diff --git a/ios/components/io_thread/ios_io_thread.mm b/ios/components/io_thread/ios_io_thread.mm index 8418588..ababca5 100644 --- a/ios/components/io_thread/ios_io_thread.mm +++ b/ios/components/io_thread/ios_io_thread.mm
@@ -242,6 +242,9 @@ pref_proxy_config_tracker_ = ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( local_state); + system_proxy_config_service_ = ProxyServiceFactory::CreateProxyConfigService( + pref_proxy_config_tracker_.get()); + ssl_config_service_manager_.reset( ssl_config::SSLConfigServiceManager::CreateDefaultManager( local_state, @@ -285,7 +288,11 @@ net::URLRequestContextGetter* IOSIOThread::system_url_request_context_getter() { DCHECK_CURRENTLY_ON(web::WebThread::UI); if (!system_url_request_context_getter_.get()) { - InitSystemRequestContext(); + // If we're in unit_tests, IOSIOThread may not be run. + if (!web::WebThread::IsMessageLoopValid(web::WebThread::IO)) + return nullptr; + system_url_request_context_getter_ = + new SystemURLRequestContextGetter(this); } return system_url_request_context_getter_.get(); } @@ -353,19 +360,12 @@ base::CommandLine(base::CommandLine::NO_PROGRAM), /*is_quic_force_disabled=*/false, quic_user_agent_id, ¶ms_); - // InitSystemRequestContext turns right around and posts a task back - // to the IO thread, so we can't let it run until we know the IO - // thread has started. - // - // Note that since we are at WebThread::Init time, the UI thread - // is blocked waiting for the thread to start. Therefore, posting - // this task to the main thread's message loop here is guaranteed to - // get it onto the message loop while the IOSIOThread object still - // exists. However, the message might not be processed on the UI - // thread until after IOSIOThread is gone, so use a weak pointer. - web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, - base::Bind(&IOSIOThread::InitSystemRequestContext, - weak_factory_.GetWeakPtr())); + globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( + net_log_, nullptr, globals_->system_network_delegate.get(), + std::move(system_proxy_config_service_), true /* quick_check_enabled */); + + globals_->system_request_context.reset( + ConstructSystemRequestContext(globals_, params_, net_log_)); } void IOSIOThread::CleanUp() { @@ -429,37 +429,6 @@ ClearHostCache(); } -void IOSIOThread::InitSystemRequestContext() { - if (system_url_request_context_getter_.get()) - return; - // If we're in unit_tests, IOSIOThread may not be run. - if (!web::WebThread::IsMessageLoopValid(web::WebThread::IO)) - return; - system_proxy_config_service_ = ProxyServiceFactory::CreateProxyConfigService( - pref_proxy_config_tracker_.get()); - - system_url_request_context_getter_ = new SystemURLRequestContextGetter(this); - // Safe to post an unretained this pointer, since IOSIOThread is - // guaranteed to outlive the IO WebThread. - web::WebThread::PostTask( - web::WebThread::IO, FROM_HERE, - base::Bind(&IOSIOThread::InitSystemRequestContextOnIOThread, - base::Unretained(this))); -} - -void IOSIOThread::InitSystemRequestContextOnIOThread() { - DCHECK_CURRENTLY_ON(web::WebThread::IO); - DCHECK(!globals_->system_proxy_service.get()); - DCHECK(system_proxy_config_service_.get()); - - globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( - net_log_, nullptr, globals_->system_network_delegate.get(), - std::move(system_proxy_config_service_), true /* quick_check_enabled */); - - globals_->system_request_context.reset( - ConstructSystemRequestContext(globals_, params_, net_log_)); -} - net::URLRequestContext* IOSIOThread::ConstructSystemRequestContext( IOSIOThread::Globals* globals, const net::HttpNetworkSession::Params& params,
diff --git a/ios/web/public/app/mojo/web_browser_manifest.json b/ios/web/public/app/mojo/web_browser_manifest.json index 7b1f690..7ee9a78 100644 --- a/ios/web/public/app/mojo/web_browser_manifest.json +++ b/ios/web/public/app/mojo/web_browser_manifest.json
@@ -11,6 +11,7 @@ "requires": { "*": [ "app" ], "service_manager": [ + "service_manager:client_process", "service_manager:instance_name", "service_manager:service_manager", "service_manager:user_id"
diff --git a/ios/web/public/app/mojo/web_packaged_services_manifest.json b/ios/web/public/app/mojo/web_packaged_services_manifest.json index f825185..1f0f496a 100644 --- a/ios/web/public/app/mojo/web_packaged_services_manifest.json +++ b/ios/web/public/app/mojo/web_packaged_services_manifest.json
@@ -19,6 +19,7 @@ "web_browser": [], "service_manager": [ "service_manager:all_users", + "service_manager:client_process", "service_manager:user_id" ] }
diff --git a/ios/web/web_state/js/crw_js_post_request_loader.h b/ios/web/web_state/js/crw_js_post_request_loader.h index 04aab27..09233337 100644 --- a/ios/web/web_state/js/crw_js_post_request_loader.h +++ b/ios/web/web_state/js/crw_js_post_request_loader.h
@@ -10,6 +10,8 @@ @class CRWWKScriptMessageRouter; // Class to load POST requests in a provided web view via JavaScript. +// TODO(crbug.com/740987): Remove |CRWJSPOSTRequestLoader| once iOS 10 is +// dropped. @interface CRWJSPOSTRequestLoader : NSObject // Asynchronously loads a POST |request| in provided |webView|.
diff --git a/ios/web/web_state/js/resources/post_request.js b/ios/web/web_state/js/resources/post_request.js index 65afcf4..bfc9d7a 100644 --- a/ios/web/web_state/js/resources/post_request.js +++ b/ios/web/web_state/js/resources/post_request.js
@@ -4,6 +4,7 @@ // Provides a way to implement POST requests via XMLHttpRequest. // Works around https://bugs.webkit.org/show_bug.cgi?id=145410 on WKWebView. +// TODO(crbug.com/740987): Remove |post_request.js| once iOS 10 is dropped. 'use strict';
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 0e71e2a..e567d02 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -565,6 +565,8 @@ // the data is passed to |_wkWebView| on main thread. // This is necessary because WKWebView ignores POST request body. // Workaround for https://bugs.webkit.org/show_bug.cgi?id=145410 +// TODO(crbug.com/740987): Remove |loadPOSTRequest:| workaround once iOS 10 is +// dropped. - (WKNavigation*)loadPOSTRequest:(NSMutableURLRequest*)request; // Loads the HTML into the page at the given URL. - (void)loadHTML:(NSString*)html forURL:(const GURL&)url; @@ -5060,6 +5062,7 @@ // As of iOS 11, WKWebView supports requests with POST data, so the // Javascript POST workaround only needs to be used if the OS version is // less than iOS 11. + // TODO(crbug.com/740987): Remove POST workaround once iOS 10 is dropped. if (!base::ios::IsRunningOnIOS11OrLater()) { GURL navigationURL = currentItem ? currentItem->GetURL() : GURL::EmptyGURL();
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn index c776d582..5046a63 100644 --- a/ipc/BUILD.gn +++ b/ipc/BUILD.gn
@@ -150,6 +150,7 @@ sources = [ "ipc_test.mojom", ] + support_lazy_serialization = true } # This is provided as a separate target so other targets can provide param
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc index 7219f2e..afd0e3c 100644 --- a/ipc/ipc_mojo_bootstrap.cc +++ b/ipc/ipc_mojo_bootstrap.cc
@@ -250,6 +250,8 @@ } } + bool PrefersSerializedMessages() override { return true; } + private: class Endpoint; class ControlMessageProxyThunk;
diff --git a/ipc/ipc_mojo_perftest.cc b/ipc/ipc_mojo_perftest.cc index fb39a2c2..70d3381e 100644 --- a/ipc/ipc_mojo_perftest.cc +++ b/ipc/ipc_mojo_perftest.cc
@@ -555,6 +555,31 @@ DISALLOW_COPY_AND_ASSIGN(MojoInterfacePerfTest); }; +enum class InProcessMessageMode { + kSerialized, + kUnserialized, +}; + +class MojoInProcessInterfacePerfTest + : public MojoInterfacePerfTest, + public testing::WithParamInterface<InProcessMessageMode> { + public: + MojoInProcessInterfacePerfTest() { + switch (GetParam()) { + case InProcessMessageMode::kSerialized: + mojo::Connector::OverrideDefaultSerializationBehaviorForTesting( + mojo::Connector::OutgoingSerializationMode::kEager, + mojo::Connector::IncomingSerializationMode::kDispatchAsIs); + break; + case InProcessMessageMode::kUnserialized: + mojo::Connector::OverrideDefaultSerializationBehaviorForTesting( + mojo::Connector::OutgoingSerializationMode::kLazy, + mojo::Connector::IncomingSerializationMode::kDispatchAsIs); + break; + } + } +}; + DEFINE_TEST_CLIENT_WITH_PIPE(PingPongClient, MojoInterfacePerfTest, h) { base::MessageLoop main_message_loop; return RunPingPongClient(h); @@ -570,7 +595,7 @@ } // A single process version of the above test. -TEST_F(MojoInterfacePerfTest, SingleProcessMultiThreadPingPong) { +TEST_P(MojoInProcessInterfacePerfTest, MultiThreadPingPong) { MojoHandle server_handle, client_handle; CreateMessagePipe(&server_handle, &client_handle); @@ -584,7 +609,7 @@ RunPingPongServer(server_handle, "SingleProcess"); } -TEST_F(MojoInterfacePerfTest, SingleProcessSingleThreadPingPong) { +TEST_P(MojoInProcessInterfacePerfTest, SingleThreadPingPong) { MojoHandle server_handle, client_handle; CreateMessagePipe(&server_handle, &client_handle); @@ -597,6 +622,11 @@ RunPingPongServer(server_handle, "SingleProcess"); } +INSTANTIATE_TEST_CASE_P(, + MojoInProcessInterfacePerfTest, + testing::Values(InProcessMessageMode::kSerialized, + InProcessMessageMode::kUnserialized)); + class CallbackPerfTest : public testing::Test { public: CallbackPerfTest()
diff --git a/mash/DEPS b/mash/DEPS index ef523d8..7304867 100644 --- a/mash/DEPS +++ b/mash/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+ash/public", "+components/prefs", + "+components/viz/common", "+mojo/common", "+mojo/converters", "+mojo/public",
diff --git a/mash/test/mash_test_suite.cc b/mash/test/mash_test_suite.cc index 3a6b208..19d3b68 100644 --- a/mash/test/mash_test_suite.cc +++ b/mash/test/mash_test_suite.cc
@@ -11,8 +11,8 @@ #include "base/memory/ptr_util.h" #include "base/path_service.h" #include "cc/output/context_provider.h" -#include "cc/surfaces/frame_sink_id_allocator.h" #include "cc/surfaces/surface_manager.h" +#include "components/viz/common/frame_sink_id_allocator.h" #include "ui/aura/env.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h"
diff --git a/media/BUILD.gn b/media/BUILD.gn index 8b4c81d..ebe115a 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn
@@ -85,12 +85,6 @@ } } -source_set("cdm_api") { - sources = [ - "cdm/api/content_decryption_module.h", - ] -} - # TODO(jrummell): Each subdirectory should have it's own BUILD.gn, and then # this component can depend on them. http://crbug.com/613033 component("media") { @@ -130,7 +124,6 @@ libs = [] defines = [] deps = [ - ":cdm_api", "//base", "//base:i18n", "//base/third_party/dynamic_annotations", @@ -183,56 +176,6 @@ "device_monitors/device_monitor_udev.h", ] } - - # TODO(xhwang): Move other library CDM related files to this block as well. - if (enable_pepper_cdms) { - deps += [ - ":cdm_paths", - - # TODO(xhwang): Remove this after Widevine specific logic is removed in - # CdmAdapterFactory. See http://crbug.com/510604 - "//third_party/widevine/cdm:headers", - ] - sources += [ - "cdm/cdm_adapter_factory.cc", - "cdm/cdm_adapter_factory.h", - ] - } -} - -config("cdm_manager_implementation") { - defines = [ "CDM_MANAGER_IMPLEMENTATION" ] -} - -# cdm_manager must not be a source_set() because CdmManager exposes a static -# singleton, shared by multiple component()s. -# -# TODO(xhwang): Remove this component once AVDA no longer depends on it. -component("cdm_manager") { - visibility = [ - "//media/gpu", - "//media/mojo/services:lib", - ] - sources = [ - "cdm/cdm_manager.cc", - "cdm/cdm_manager.h", - "cdm/cdm_manager_export.h", - ] - configs += [ ":cdm_manager_implementation" ] - deps = [ - ":media", - "//base", - ] -} - -static_library("cdm_paths") { - sources = [ - "cdm/cdm_paths.cc", - "cdm/cdm_paths.h", - ] - deps = [ - "//base", - ] } # TODO(xhwang): Move these into source_sets in respective subfolders. @@ -312,8 +255,6 @@ configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] deps = [ - ":cdm_api", - ":cdm_paths", ":media", ":test_support", "//base/test:test_support", @@ -322,6 +263,8 @@ "//gpu/command_buffer/common", "//media/audio:test_support", "//media/base:test_support", + "//media/cdm:cdm_api", + "//media/cdm:cdm_paths", "//ppapi/features", "//skia", # Direct dependency required to inherit config. "//testing/gmock",
diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn index 58b9323..311a3365 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn
@@ -34,7 +34,7 @@ # This should only be depended on by "media" target. Other targets should # depend on "media" target directly. visibility = [ - "//media", + "//media/cdm", "//media/formats", # TODO(xhwang): Clean up the dependency graph within "media" target. @@ -219,6 +219,7 @@ "renderer_factory_selector.h", "sample_format.cc", "sample_format.h", + "scoped_callback_runner.h", "seekable_buffer.cc", "seekable_buffer.h", "serial_runner.cc", @@ -462,6 +463,7 @@ "pipeline_impl_unittest.cc", "ranges_unittest.cc", "renderer_factory_selector_unittest.cc", + "scoped_callback_runner_unittest.cc", "seekable_buffer_unittest.cc", "serial_runner_unittest.cc", "silent_sink_suspender_unittest.cc",
diff --git a/media/base/scoped_callback_runner.h b/media/base/scoped_callback_runner.h new file mode 100644 index 0000000..0a6227e --- /dev/null +++ b/media/base/scoped_callback_runner.h
@@ -0,0 +1,86 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_BASE_SCOPED_CALLBACK_RUNNER_H_ +#define MEDIA_BASE_SCOPED_CALLBACK_RUNNER_H_ + +#include <memory> +#include <utility> + +#include "base/bind.h" +#include "base/callback_forward.h" +#include "base/macros.h" +#include "base/memory/ptr_util.h" + +// This is a helper utility to wrap a base::OnceCallback such that if the +// callback is destructed before it has a chance to run (e.g. the callback is +// bound into a task and the task is dropped), it will be run with the +// default arguments passed into ScopedCallbackRunner. +// +// Example: +// foo->DoWorkAndReturnResult( +// ScopedCallbackRunner(base::BindOnce(&Foo::OnResult, this), false)); +// +// If the callback is destructed without running, it'll be run with "false". + +namespace media { +namespace internal { + +// First, tell the compiler ScopedCallbackRunnerHelper is a class template with +// one type parameter. Then define specializations where the type is a function +// returning void and taking zero or more arguments. +template <typename Signature> +class ScopedCallbackRunnerHelper; + +// Only support callbacks that return void because otherwise it is odd to call +// the callback in the destructor and drop the return value immediately. +template <typename... Args> +class ScopedCallbackRunnerHelper<void(Args...)> { + public: + using CallbackType = base::OnceCallback<void(Args...)>; + + // Bound arguments may be different to the callback signature when wrappers + // are used, e.g. in base::Owned and base::Unretained case, they are + // OwnedWrapper and UnretainedWrapper. Use BoundArgs to help handle this. + template <typename... BoundArgs> + ScopedCallbackRunnerHelper(CallbackType callback, BoundArgs&&... args) + : callback_(std::move(callback)) { + destruction_callback_ = + base::BindOnce(&ScopedCallbackRunnerHelper::Run, base::Unretained(this), + std::forward<BoundArgs>(args)...); + } + + ~ScopedCallbackRunnerHelper() { + if (destruction_callback_) + std::move(destruction_callback_).Run(); + } + + void Run(Args... args) { + destruction_callback_.Reset(); + std::move(callback_).Run(std::forward<Args>(args)...); + } + + private: + CallbackType callback_; + base::OnceClosure destruction_callback_; + + DISALLOW_COPY_AND_ASSIGN(ScopedCallbackRunnerHelper); +}; + +} // namespace internal + +// Currently ScopedCallbackRunner only supports base::OnceCallback. If needed, +// we can easily add a specialization to support base::RepeatingCallback too. +template <typename T, typename... Args> +inline base::OnceCallback<T> ScopedCallbackRunner(base::OnceCallback<T> cb, + Args&&... args) { + return base::BindOnce( + &internal::ScopedCallbackRunnerHelper<T>::Run, + base::MakeUnique<internal::ScopedCallbackRunnerHelper<T>>( + std::move(cb), std::forward<Args>(args)...)); +} + +} // namespace media + +#endif // MEDIA_BASE_SCOPED_CALLBACK_RUNNER_H_
diff --git a/media/base/scoped_callback_runner_unittest.cc b/media/base/scoped_callback_runner_unittest.cc new file mode 100644 index 0000000..22b328b --- /dev/null +++ b/media/base/scoped_callback_runner_unittest.cc
@@ -0,0 +1,138 @@ +// 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 "media/base/scoped_callback_runner.h" + +#include <memory> +#include <string> +#include <utility> + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "base/memory/ptr_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media { + +namespace { + +void SetBool(bool* var, bool val) { + *var = val; +} + +void SetBoolFromRawPtr(bool* var, bool* val) { + *var = *val; +} + +void SetIntegers(int* a_var, int* b_var, int a_val, int b_val) { + *a_var = a_val; + *b_var = b_val; +} + +void SetIntegerFromUniquePtr(int* var, std::unique_ptr<int> val) { + *var = *val; +} + +void SetString(std::string* var, const std::string val) { + *var = val; +} + +} // namespace + +TEST(ScopedCallbackRunnerTest, Closure_Run) { + bool a = false; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetBool, &a, true)); + std::move(cb).Run(); + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, Closure_Destruction) { + bool a = false; + { auto cb = ScopedCallbackRunner(base::BindOnce(&SetBool, &a, true)); } + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, SetBool_Run) { + bool a = false; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetBool, &a), true); + std::move(cb).Run(true); + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, SetBoolFromRawPtr_Run) { + bool a = false; + bool* b = new bool(false); + bool c = true; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetBoolFromRawPtr, &a), + base::Owned(b)); + std::move(cb).Run(&c); + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, SetBoolFromRawPtr_Destruction) { + bool a = false; + bool* b = new bool(true); + { + auto cb = ScopedCallbackRunner(base::BindOnce(&SetBoolFromRawPtr, &a), + base::Owned(b)); + } + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, SetBool_Destruction) { + bool a = false; + { auto cb = ScopedCallbackRunner(base::BindOnce(&SetBool, &a), true); } + EXPECT_TRUE(a); +} + +TEST(ScopedCallbackRunnerTest, SetIntegers_Run) { + int a = 0; + int b = 0; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetIntegers, &a, &b), 3, 4); + std::move(cb).Run(1, 2); + EXPECT_EQ(a, 1); + EXPECT_EQ(b, 2); +} + +TEST(ScopedCallbackRunnerTest, SetIntegers_Destruction) { + int a = 0; + int b = 0; + { + auto cb = ScopedCallbackRunner(base::BindOnce(&SetIntegers, &a, &b), 3, 4); + } + EXPECT_EQ(a, 3); + EXPECT_EQ(b, 4); +} + +TEST(ScopedCallbackRunnerTest, SetIntegerFromUniquePtr_Run) { + int a = 0; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetIntegerFromUniquePtr, &a), + base::MakeUnique<int>(1)); + std::move(cb).Run(base::MakeUnique<int>(2)); + EXPECT_EQ(a, 2); +} + +TEST(ScopedCallbackRunnerTest, SetIntegerFromUniquePtr_Destruction) { + int a = 0; + { + auto cb = ScopedCallbackRunner(base::BindOnce(&SetIntegerFromUniquePtr, &a), + base::MakeUnique<int>(1)); + } + EXPECT_EQ(a, 1); +} + +TEST(ScopedCallbackRunnerTest, SetString_Run) { + std::string a; + auto cb = ScopedCallbackRunner(base::BindOnce(&SetString, &a), "hello"); + std::move(cb).Run("world"); + EXPECT_EQ(a, "world"); +} + +TEST(ScopedCallbackRunnerTest, SetString_Destruction) { + std::string a; + { auto cb = ScopedCallbackRunner(base::BindOnce(&SetString, &a), "hello"); } + EXPECT_EQ(a, "hello"); +} + +} // namespace media
diff --git a/media/cdm/BUILD.gn b/media/cdm/BUILD.gn new file mode 100644 index 0000000..0a26637 --- /dev/null +++ b/media/cdm/BUILD.gn
@@ -0,0 +1,116 @@ +# 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. + +import("//media/media_options.gni") + +source_set("cdm_api") { + sources = [ + "api/content_decryption_module.h", + ] +} + +source_set("cdm") { + visibility = [ "//media/*" ] + + sources = [ + "aes_decryptor.cc", + "aes_decryptor.h", + "cdm_adapter.cc", + "cdm_adapter.h", + "cdm_allocator.cc", + "cdm_allocator.h", + "cdm_file_adapter.cc", + "cdm_file_adapter.h", + "cdm_file_io.cc", + "cdm_file_io.h", + "cdm_helpers.cc", + "cdm_helpers.h", + "cdm_wrapper.h", + "default_cdm_factory.cc", + "default_cdm_factory.h", + "json_web_key.cc", + "json_web_key.h", + "player_tracker_impl.cc", + "player_tracker_impl.h", + "supported_cdm_versions.cc", + "supported_cdm_versions.h", + ] + + # TODO(wolenetz): Fix size_t to int truncation in win64. + # See http://crbug.com/171009 + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + + deps = [ + ":cdm_api", + "//crypto", + "//media:media_features", + "//media:shared_memory_support", + "//ui/gfx/geometry", + "//url", + ] + + public_deps = [ + "//media/formats", + ] + + configs += [ "//media:media_implementation" ] + all_dependent_configs = [ "//media:media_dependent_config" ] + + if (proprietary_codecs) { + sources += [ + "cenc_utils.cc", + "cenc_utils.h", + ] + } + + # TODO(xhwang): Move other library CDM related files to this block as well. + if (enable_pepper_cdms) { + deps += [ + ":cdm_paths", + + # TODO(xhwang): Remove this after Widevine specific logic is removed in + # CdmAdapterFactory. See http://crbug.com/510604 + "//third_party/widevine/cdm:headers", + ] + sources += [ + "cdm_adapter_factory.cc", + "cdm_adapter_factory.h", + ] + } +} + +config("cdm_manager_implementation") { + defines = [ "CDM_MANAGER_IMPLEMENTATION" ] +} + +# cdm_manager must not be a source_set() because CdmManager exposes a static +# singleton, shared by multiple component()s. +# +# TODO(xhwang): Remove this component once AVDA no longer depends on it. +component("cdm_manager") { + visibility = [ + "//media/gpu", + "//media/mojo/services:lib", + ] + sources = [ + "cdm_manager.cc", + "cdm_manager.h", + "cdm_manager_export.h", + ] + configs += [ ":cdm_manager_implementation" ] + deps = [ + "//base", + "//media", + ] +} + +static_library("cdm_paths") { + sources = [ + "cdm_paths.cc", + "cdm_paths.h", + ] + deps = [ + "//base", + ] +}
diff --git a/media/cdm/ppapi/BUILD.gn b/media/cdm/ppapi/BUILD.gn index 29f8465..e9c7b37 100644 --- a/media/cdm/ppapi/BUILD.gn +++ b/media/cdm/ppapi/BUILD.gn
@@ -31,8 +31,8 @@ "//base", "//build/config:exe_and_shlib_deps", "//media", # For media::AudioTimestampHelper - "//media:cdm_api", # For content_decryption_module.h "//media:shared_memory_support", # For media::AudioBus. + "//media/cdm:cdm_api", # For content_decryption_module.h "//url", ]
diff --git a/media/cdm/ppapi/ppapi_cdm_adapter.gni b/media/cdm/ppapi/ppapi_cdm_adapter.gni index b0af7c0..002c9801 100644 --- a/media/cdm/ppapi/ppapi_cdm_adapter.gni +++ b/media/cdm/ppapi/ppapi_cdm_adapter.gni
@@ -23,7 +23,7 @@ defines += [ "USE_PPAPI_CDM_ADAPTER" ] deps += [ "//build/config:exe_and_shlib_deps", - "//media:cdm_api", + "//media/cdm:cdm_api", "//ppapi/cpp", ] sources += [
diff --git a/media/filters/BUILD.gn b/media/filters/BUILD.gn index a89ce0f3..d33cf92 100644 --- a/media/filters/BUILD.gn +++ b/media/filters/BUILD.gn
@@ -90,31 +90,6 @@ "//media/muxers/webm_muxer.h", ] - # TODO(a.suchit): Needs to create separate BUILD.gn file for cdm. - sources += [ - "//media/cdm/aes_decryptor.cc", - "//media/cdm/aes_decryptor.h", - "//media/cdm/cdm_adapter.cc", - "//media/cdm/cdm_adapter.h", - "//media/cdm/cdm_allocator.cc", - "//media/cdm/cdm_allocator.h", - "//media/cdm/cdm_file_adapter.cc", - "//media/cdm/cdm_file_adapter.h", - "//media/cdm/cdm_file_io.cc", - "//media/cdm/cdm_file_io.h", - "//media/cdm/cdm_helpers.cc", - "//media/cdm/cdm_helpers.h", - "//media/cdm/cdm_wrapper.h", - "//media/cdm/default_cdm_factory.cc", - "//media/cdm/default_cdm_factory.h", - "//media/cdm/json_web_key.cc", - "//media/cdm/json_web_key.h", - "//media/cdm/player_tracker_impl.cc", - "//media/cdm/player_tracker_impl.h", - "//media/cdm/supported_cdm_versions.cc", - "//media/cdm/supported_cdm_versions.h", - ] - # TODO(a.suchit): Needs to create separate BUILD.gn file for video. sources += [ "//media/video/fake_video_encode_accelerator.cc", @@ -142,7 +117,6 @@ all_dependent_configs = [ "//media:media_dependent_config" ] deps = [ - "//media/formats", "//skia", "//third_party/libyuv", ] @@ -152,12 +126,10 @@ # //media/muxers dependencies deps += [ "//third_party/libwebm" ] - # //media/cdm dependencies - deps += [ "//crypto" ] - public_deps = [ "//media:media_features", "//media/audio", + "//media/cdm", ] if (proprietary_codecs) { @@ -167,14 +139,6 @@ ] } - # TODO(a.suchit): Needs to create separate BUILD.gn file for cdm. - if (proprietary_codecs) { - sources += [ - "//media/cdm/cenc_utils.cc", - "//media/cdm/cenc_utils.h", - ] - } - if (media_use_ffmpeg) { public_deps += [ "//media/ffmpeg" ] deps += [
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 43dca04..62e1b20 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc
@@ -372,9 +372,7 @@ const std::string& codecs) { ChunkDemuxer::Status status = demuxer_->AddId(source_id, mime_type, codecs); if (status == ChunkDemuxer::kOk) - demuxer_->SetTracksWatcher( - source_id, base::Bind(&ChunkDemuxerTest::InitSegmentReceived, - base::Unretained(this))); + demuxer_->SetTracksWatcher(source_id, init_segment_received_cb_); return status; } @@ -2334,11 +2332,7 @@ &host_, CreateInitDoneCB(kNoTimestamp, CHUNK_DEMUXER_ERROR_APPEND_FAILED), true); - ASSERT_EQ(demuxer_->AddId(kSourceId, "audio/webm", "vorbis"), - ChunkDemuxer::kOk); - demuxer_->SetTracksWatcher(kSourceId, - base::Bind(&ChunkDemuxerTest::InitSegmentReceived, - base::Unretained(this))); + ASSERT_EQ(AddId(kSourceId, "audio/webm", "vorbis"), ChunkDemuxer::kOk); // Video track is unexpected per mimetype. EXPECT_MEDIA_LOG(InitSegmentMismatchesMimeType("Video", "vp8")); @@ -2352,10 +2346,7 @@ &host_, CreateInitDoneCB(kNoTimestamp, CHUNK_DEMUXER_ERROR_APPEND_FAILED), true); - ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", "vp8"), ChunkDemuxer::kOk); - demuxer_->SetTracksWatcher(kSourceId, - base::Bind(&ChunkDemuxerTest::InitSegmentReceived, - base::Unretained(this))); + ASSERT_EQ(AddId(kSourceId, "video/webm", "vp8"), ChunkDemuxer::kOk); // Audio track is unexpected per mimetype. EXPECT_MEDIA_LOG(FoundStream("video")); @@ -2371,11 +2362,7 @@ &host_, CreateInitDoneCB(kNoTimestamp, CHUNK_DEMUXER_ERROR_APPEND_FAILED), true); - ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", "vorbis,vp8"), - ChunkDemuxer::kOk); - demuxer_->SetTracksWatcher(kSourceId, - base::Bind(&ChunkDemuxerTest::InitSegmentReceived, - base::Unretained(this))); + ASSERT_EQ(AddId(kSourceId, "video/webm", "vorbis,vp8"), ChunkDemuxer::kOk); // Video track is also expected per mimetype. EXPECT_MEDIA_LOG(FoundStream("audio")); @@ -2391,11 +2378,7 @@ &host_, CreateInitDoneCB(kNoTimestamp, CHUNK_DEMUXER_ERROR_APPEND_FAILED), true); - ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", "vorbis,vp8"), - ChunkDemuxer::kOk); - demuxer_->SetTracksWatcher(kSourceId, - base::Bind(&ChunkDemuxerTest::InitSegmentReceived, - base::Unretained(this))); + ASSERT_EQ(AddId(kSourceId, "video/webm", "vorbis,vp8"), ChunkDemuxer::kOk); // Audio track is also expected per mimetype. EXPECT_MEDIA_LOG(FoundStream("video")); @@ -3082,7 +3065,7 @@ #endif #endif - EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "avc1.4D4041"), expected); + EXPECT_EQ(AddId("source_id", "video/mp4", "avc1.4D4041"), expected); } // Test codec ID's that are not compliant with RFC6381, but have been @@ -3100,8 +3083,7 @@ }; for (size_t i = 0; i < arraysize(codec_ids); ++i) { - ChunkDemuxer::Status result = - demuxer_->AddId("source_id", "audio/mp4", codec_ids[i]); + ChunkDemuxer::Status result = AddId("source_id", "audio/mp4", codec_ids[i]); EXPECT_EQ(result, expected) << "Fail to add codec_id '" << codec_ids[i] << "'"; @@ -4804,8 +4786,7 @@ expected = ChunkDemuxer::kOk; #endif - EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "vp09.00.10.08"), - expected); + EXPECT_EQ(AddId("source_id", "video/mp4", "vp09.00.10.08"), expected); } // TODO(servolk): Add a unit test with multiple audio/video tracks using the
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn index 5a4cc5dd7..19d6fc30 100644 --- a/media/gpu/BUILD.gn +++ b/media/gpu/BUILD.gn
@@ -245,7 +245,7 @@ # Remove this dependency after VDAs are also running as part of the mojo # media service. See http://crbug.com/522298 if (mojo_media_host == "gpu") { - deps += [ "//media:cdm_manager" ] + deps += [ "//media/cdm:cdm_manager" ] } }
diff --git a/media/gpu/dxva_picture_buffer_win.cc b/media/gpu/dxva_picture_buffer_win.cc index d7df906d..dcd8e330 100644 --- a/media/gpu/dxva_picture_buffer_win.cc +++ b/media/gpu/dxva_picture_buffer_win.cc
@@ -530,7 +530,7 @@ result = eglStreamConsumerAcquireKHR(egl_display, stream_); RETURN_ON_FAILURE(result, "Could not post acquire stream", false); gl::GLImageDXGI* gl_image_dxgi = - gl::GLImageDXGI::FromGLImage(gl_image_.get()); + static_cast<gl::GLImageDXGI*>(gl_image_.get()); DCHECK(gl_image_dxgi); gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); @@ -646,14 +646,13 @@ DCHECK(decoder->d3d11_processor_); DCHECK(decoder->enumerator_); - gl::GLImageDXGI* gl_image_dxgi = - gl::GLImageDXGI::FromGLImage(gl_image_.get()); + gl::CopyingGLImageDXGI* gl_image_dxgi = + static_cast<gl::CopyingGLImageDXGI*>(gl_image_.get()); DCHECK(gl_image_dxgi); gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); - return static_cast<gl::CopyingGLImageDXGI*>(gl_image_dxgi) - ->InitializeVideoProcessor(decoder->d3d11_processor_, - decoder->enumerator_); + return gl_image_dxgi->InitializeVideoProcessor(decoder->d3d11_processor_, + decoder->enumerator_); } bool EGLStreamDelayedCopyPictureBuffer::AllowOverlay() const { @@ -802,7 +801,7 @@ result = eglStreamConsumerAcquireKHR(egl_display, stream_); RETURN_ON_FAILURE(result, "Could not post acquire stream", false); gl::GLImageDXGI* gl_image_dxgi = - gl::GLImageDXGI::FromGLImage(gl_image_.get()); + static_cast<gl::GLImageDXGI*>(gl_image_.get()); DCHECK(gl_image_dxgi); gl_image_dxgi->SetTexture(angle_copy_texture_, 0);
diff --git a/media/gpu/ipc/service/gpu_video_encode_accelerator.cc b/media/gpu/ipc/service/gpu_video_encode_accelerator.cc index 6c958d5..998d663f 100644 --- a/media/gpu/ipc/service/gpu_video_encode_accelerator.cc +++ b/media/gpu/ipc/service/gpu_video_encode_accelerator.cc
@@ -31,21 +31,6 @@ namespace { -bool MakeDecoderContextCurrent( - const base::WeakPtr<gpu::GpuCommandBufferStub> stub) { - if (!stub) { - DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; - return false; - } - - if (!stub->decoder()->MakeCurrent()) { - DLOG(ERROR) << "Failed to MakeCurrent()"; - return false; - } - - return true; -} - void DropSharedMemory(std::unique_ptr<base::SharedMemory> shm) { // Just let |shm| fall out of scope. } @@ -124,8 +109,6 @@ weak_this_factory_for_encoder_worker_.GetWeakPtr(); weak_this_ = weak_this_factory_.GetWeakPtr(); stub_->AddDestructionObserver(this); - make_context_current_ = - base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); } GpuVideoEncodeAccelerator::~GpuVideoEncodeAccelerator() {
diff --git a/media/gpu/ipc/service/gpu_video_encode_accelerator.h b/media/gpu/ipc/service/gpu_video_encode_accelerator.h index f6ed332..37e126d 100644 --- a/media/gpu/ipc/service/gpu_video_encode_accelerator.h +++ b/media/gpu/ipc/service/gpu_video_encode_accelerator.h
@@ -127,7 +127,6 @@ // Owned pointer to the underlying VideoEncodeAccelerator. std::unique_ptr<VideoEncodeAccelerator> encoder_; - base::Callback<bool(void)> make_context_current_; // Video encoding parameters. VideoPixelFormat input_format_;
diff --git a/media/gpu/media_foundation_video_encode_accelerator_win.cc b/media/gpu/media_foundation_video_encode_accelerator_win.cc index 06e326b..44d3608d 100644 --- a/media/gpu/media_foundation_video_encode_accelerator_win.cc +++ b/media/gpu/media_foundation_video_encode_accelerator_win.cc
@@ -181,11 +181,16 @@ VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kYPlane, input_visible_size_) .GetArea(); - v_plane_offset_ = - u_plane_offset_ + - VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane, - input_visible_size_) - .GetArea(); + v_plane_offset_ = u_plane_offset_ + VideoFrame::PlaneSize(PIXEL_FORMAT_I420, + VideoFrame::kUPlane, + input_visible_size_) + .GetArea(); + y_stride_ = VideoFrame::RowBytes(VideoFrame::kYPlane, PIXEL_FORMAT_I420, + input_visible_size_.width()); + u_stride_ = VideoFrame::RowBytes(VideoFrame::kUPlane, PIXEL_FORMAT_I420, + input_visible_size_.width()); + v_stride_ = VideoFrame::RowBytes(VideoFrame::kVPlane, PIXEL_FORMAT_I420, + input_visible_size_.width()); if (!SetEncoderModes()) { DLOG(ERROR) << "Failed setting encoder parameters."; @@ -513,12 +518,10 @@ frame->stride(VideoFrame::kVPlane), frame->visible_data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane), scoped_buffer.get(), - frame->stride(VideoFrame::kYPlane), - scoped_buffer.get() + u_plane_offset_, - frame->stride(VideoFrame::kUPlane), - scoped_buffer.get() + v_plane_offset_, - frame->stride(VideoFrame::kVPlane), - input_visible_size_.width(), input_visible_size_.height()); + y_stride_, scoped_buffer.get() + u_plane_offset_, + u_stride_, scoped_buffer.get() + v_plane_offset_, + v_stride_, input_visible_size_.width(), + input_visible_size_.height()); } input_sample_->SetSampleTime(frame->timestamp().InMicroseconds() *
diff --git a/media/gpu/media_foundation_video_encode_accelerator_win.h b/media/gpu/media_foundation_video_encode_accelerator_win.h index 1720a78b..1567df6 100644 --- a/media/gpu/media_foundation_video_encode_accelerator_win.h +++ b/media/gpu/media_foundation_video_encode_accelerator_win.h
@@ -123,6 +123,9 @@ uint32_t target_bitrate_; size_t u_plane_offset_; size_t v_plane_offset_; + size_t y_stride_; + size_t u_stride_; + size_t v_stride_; base::win::ScopedComPtr<IMFTransform> encoder_; base::win::ScopedComPtr<ICodecAPI> codec_api_;
diff --git a/media/mojo/BUILD.gn b/media/mojo/BUILD.gn index 6b9e99f..442a0cd 100644 --- a/media/mojo/BUILD.gn +++ b/media/mojo/BUILD.gn
@@ -90,8 +90,8 @@ "//base", "//base/test:test_support", "//media", - "//media:cdm_api", "//media/base:test_support", + "//media/cdm:cdm_api", "//media/mojo/clients", "//media/mojo/common", "//media/mojo/common:mojo_shared_buffer_video_frame",
diff --git a/media/mojo/interfaces/video_encode_accelerator.mojom b/media/mojo/interfaces/video_encode_accelerator.mojom index 55e20c7..59a29a7 100644 --- a/media/mojo/interfaces/video_encode_accelerator.mojom +++ b/media/mojo/interfaces/video_encode_accelerator.mojom
@@ -4,5 +4,72 @@ module media.mojom; -// TODO(mcasas): Finalize migrating the IPC messages https://crbug.com/736517. -interface VideoEncodeAccelerator{}; +import "media/mojo/interfaces/media_types.mojom"; +import "mojo/common/time.mojom"; +import "ui/gfx/geometry/mojo/geometry.mojom"; + +// This file is the Mojo version of the media::VideoEncodeAccelerator interface +// and describes the communication between a Client and a remote "service" +// VideoEncodeAccelerator (VEA) with the purpose of encoding Video Frames by +// means of hardware accelerated features. +// +// Client VideoEncodeAccelerator +// | ---> Initialize | +// | RequireBitstreamBuffers(N) <--- | +// | ---> UseOutputBitstreamBuffer(0) | +// | ---> UseOutputBitstreamBuffer(1) | +// | ... | +// = = +// The Client requests a remote Encode() and eventually the VEA will leave the +// encoded results in a pre-shared BitstreamBuffer, that is then restored to the +// VEA when the Client is finished with it. Note that there might not be a 1:1 +// relationship between Encode() and BitstreamBufferReady() calls. +// | ---> Encode() | +// | BitstreamBufferReady(k) <--- | +// | ---> UseOutputBitstreamBuffer(k) | +// = = +// At any time the VEA can send a NotifyError() to the Client. Similarly at any +// time the Client can send a RequestEncodingParametersChange() to the VEA. None +// of these messages are acknowledged. + +interface VideoEncodeAccelerator { + // Equivalent to media::VideoEncodeAccelerator::Error + // TODO(mcasas): Use EnumTraits, https://crbug.com/736517 + enum Error { + // An operation was attempted during an incompatible encoder state. + ILLEGAL_STATE_ERROR, + // Invalid argument was passed to an API method. + INVALID_ARGUMENT_ERROR, + // A failure occurred at the GPU process or one of its dependencies. Examples + // of such failures include GPU hardware failures, GPU driver failures, GPU + // library failures, GPU process programming errors, and so on. + PLATFORM_FAILURE_ERROR + }; + + // Responded by VideoEncodeAcceleratorClient.RequireBitstreamBuffers(). + Initialize(VideoPixelFormat input_format, + gfx.mojom.Size input_visible_size, + VideoCodecProfile output_profile, + uint32 initial_bitrate, + VideoEncodeAcceleratorClient client); + + // Encodes a |frame|, being completely done with it after its callback. + Encode(VideoFrame frame, bool force_keyframe) => (); + + UseOutputBitstreamBuffer(int32 bitstream_buffer_id, + handle<shared_buffer> buffer); + + RequestEncodingParametersChange(uint32 bitrate, uint32 framerate); +}; + +interface VideoEncodeAcceleratorClient { + // Response to VideoEncodeAccelerator.Initialize(). + RequireBitstreamBuffers(uint32 input_count, + gfx.mojom.Size input_coded_size, + uint32 output_buffer_size); + + BitstreamBufferReady(int32 bitstream_buffer_id, uint32 payload_size, + bool key_frame, mojo.common.mojom.TimeDelta timestamp); + + NotifyError(VideoEncodeAccelerator.Error error); +};
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index 8cd21c59..71b68ddd 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn
@@ -84,9 +84,9 @@ ] deps = [ - "//media:cdm_api", - "//media:cdm_manager", "//media:shared_memory_support", + "//media/cdm:cdm_api", + "//media/cdm:cdm_manager", "//media/mojo/common", "//media/mojo/common:mojo_shared_buffer_video_frame", "//mojo/common",
diff --git a/media/mojo/services/mojo_media_drm_storage.cc b/media/mojo/services/mojo_media_drm_storage.cc index f7dd3e1..0bf1e99b 100644 --- a/media/mojo/services/mojo_media_drm_storage.cc +++ b/media/mojo/services/mojo_media_drm_storage.cc
@@ -4,10 +4,12 @@ #include "media/mojo/services/mojo_media_drm_storage.h" +#include <string> #include <utility> #include "base/bind.h" #include "base/bind_helpers.h" +#include "media/base/scoped_callback_runner.h" namespace media { @@ -31,8 +33,7 @@ void MojoMediaDrmStorage::OnProvisioned(ResultCB result_cb) { DVLOG(1) << __func__; media_drm_storage_ptr_->OnProvisioned( - base::Bind(&MojoMediaDrmStorage::OnResult, weak_factory_.GetWeakPtr(), - base::Passed(&result_cb))); + ScopedCallbackRunner(std::move(result_cb), false)); } void MojoMediaDrmStorage::SavePersistentSession(const std::string& session_id, @@ -42,8 +43,7 @@ media_drm_storage_ptr_->SavePersistentSession( session_id, mojom::SessionData::New(session_data.key_set_id, session_data.mime_type), - base::Bind(&MojoMediaDrmStorage::OnResult, weak_factory_.GetWeakPtr(), - base::Passed(&result_cb))); + ScopedCallbackRunner(std::move(result_cb), false)); } void MojoMediaDrmStorage::LoadPersistentSession( @@ -51,23 +51,19 @@ LoadPersistentSessionCB load_persistent_session_cb) { DVLOG(1) << __func__; media_drm_storage_ptr_->LoadPersistentSession( - session_id, base::Bind(&MojoMediaDrmStorage::OnPersistentSessionLoaded, - weak_factory_.GetWeakPtr(), - base::Passed(&load_persistent_session_cb))); + session_id, + ScopedCallbackRunner( + base::BindOnce(&MojoMediaDrmStorage::OnPersistentSessionLoaded, + weak_factory_.GetWeakPtr(), + base::Passed(&load_persistent_session_cb)), + nullptr)); } void MojoMediaDrmStorage::RemovePersistentSession(const std::string& session_id, ResultCB result_cb) { DVLOG(1) << __func__; media_drm_storage_ptr_->RemovePersistentSession( - session_id, - base::Bind(&MojoMediaDrmStorage::OnResult, weak_factory_.GetWeakPtr(), - base::Passed(&result_cb))); -} - -void MojoMediaDrmStorage::OnResult(ResultCB result_cb, bool success) { - DVLOG(1) << __func__ << ": success = " << success; - std::move(result_cb).Run(success); + session_id, ScopedCallbackRunner(std::move(result_cb), false)); } void MojoMediaDrmStorage::OnPersistentSessionLoaded(
diff --git a/media/mojo/services/mojo_media_drm_storage.h b/media/mojo/services/mojo_media_drm_storage.h index 07d79e3..b74f9ded 100644 --- a/media/mojo/services/mojo_media_drm_storage.h +++ b/media/mojo/services/mojo_media_drm_storage.h
@@ -5,6 +5,8 @@ #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_DRM_STORAGE_H_ #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_DRM_STORAGE_H_ +#include <string> + #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -34,7 +36,6 @@ ResultCB result_cb) final; private: - void OnResult(ResultCB result_cb, bool success); void OnPersistentSessionLoaded( LoadPersistentSessionCB load_persistent_session_cb, mojom::SessionDataPtr session_data);
diff --git a/media/renderers/skcanvas_video_renderer.cc b/media/renderers/skcanvas_video_renderer.cc index ff0cc45e..ebcf1397 100644 --- a/media/renderers/skcanvas_video_renderer.cc +++ b/media/renderers/skcanvas_video_renderer.cc
@@ -22,6 +22,7 @@ #include "third_party/libyuv/include/libyuv.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkImageGenerator.h" +#include "third_party/skia/include/gpu/GrBackendSurface.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "ui/gfx/geometry/rect_f.h" @@ -224,18 +225,14 @@ source_texture = gl->CreateAndConsumeTextureCHROMIUM( mailbox_holder.texture_target, mailbox_holder.mailbox.name); } - GrBackendTextureDesc desc; - desc.fFlags = kNone_GrBackendTextureFlag; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fWidth = video_frame->coded_size().width(); - desc.fHeight = video_frame->coded_size().height(); - desc.fConfig = kRGBA_8888_GrPixelConfig; GrGLTextureInfo source_texture_info; source_texture_info.fID = source_texture; source_texture_info.fTarget = GL_TEXTURE_2D; - desc.fTextureHandle = - skia::GrGLTextureInfoToGrBackendObject(source_texture_info); - return SkImage::MakeFromAdoptedTexture(context_3d.gr_context, desc); + GrBackendTexture source_backend_texture( + video_frame->coded_size().width(), video_frame->coded_size().height(), + kRGBA_8888_GrPixelConfig, source_texture_info); + return SkImage::MakeFromAdoptedTexture( + context_3d.gr_context, source_backend_texture, kTopLeft_GrSurfaceOrigin); } } // anonymous namespace
diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn index a537e1d..4fc9fb6d 100644 --- a/mojo/common/BUILD.gn +++ b/mojo/common/BUILD.gn
@@ -96,3 +96,15 @@ "//base:i18n", ] } + +source_set("values_struct_traits") { + sources = [ + "values_struct_traits.cc", + "values_struct_traits.h", + ] + public_deps = [ + ":common_custom_types_shared_cpp_sources", + "//base", + "//mojo/public/cpp/bindings:bindings", + ] +}
diff --git a/mojo/common/values.typemap b/mojo/common/values.typemap index f1f3fc27..3bc75e7 100644 --- a/mojo/common/values.typemap +++ b/mojo/common/values.typemap
@@ -8,13 +8,14 @@ "//ipc/ipc_message_utils.h", "//mojo/common/values_struct_traits.h", ] + public_deps = [ "//base", "//ipc", ] -sources = [ - "values_struct_traits.cc", - "values_struct_traits.h", + +deps = [ + "//mojo/common:values_struct_traits", ] type_mappings = [
diff --git a/mojo/common/values_struct_traits.h b/mojo/common/values_struct_traits.h index 94faa82c..950cf30 100644 --- a/mojo/common/values_struct_traits.h +++ b/mojo/common/values_struct_traits.h
@@ -6,7 +6,7 @@ #define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ #include "base/values.h" -#include "mojo/common/values.mojom.h" +#include "mojo/common/values.mojom-shared.h" #include "mojo/public/cpp/bindings/array_traits.h" #include "mojo/public/cpp/bindings/clone_traits.h" #include "mojo/public/cpp/bindings/map_traits.h" @@ -116,6 +116,15 @@ }; template <> +struct StructTraits<common::mojom::NullValueDataView, void*> { + static bool IsNull(const void* value) { return true; } + static void SetToNull(void** value) {} + static bool Read(common::mojom::NullValueDataView data, void** value) { + return true; + } +}; + +template <> struct UnionTraits<common::mojom::ValueDataView, base::Value> { static common::mojom::ValueDataView::Tag GetTag(const base::Value& data) { switch (data.GetType()) { @@ -140,9 +149,7 @@ return common::mojom::ValueDataView::Tag::NULL_VALUE; } - static common::mojom::NullValuePtr null_value(const base::Value& value) { - return common::mojom::NullValuePtr(); - } + static void* null_value(const base::Value& value) { return nullptr; } static bool bool_value(const base::Value& value) { bool bool_value{}; @@ -209,8 +216,7 @@ *value); } - static common::mojom::NullValuePtr null_value( - const std::unique_ptr<base::Value>& value) { + static void* null_value(const std::unique_ptr<base::Value>& value) { return UnionTraits<common::mojom::ValueDataView, base::Value>::null_value( *value); }
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn index ef91acc..c05c8e6 100644 --- a/mojo/public/cpp/bindings/BUILD.gn +++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -82,6 +82,7 @@ "lib/may_auto_lock.h", "lib/message.cc", "lib/message_header_validator.cc", + "lib/message_internal.cc", "lib/message_internal.h", "lib/multiplex_router.cc", "lib/multiplex_router.h", @@ -107,6 +108,8 @@ "lib/sync_handle_registry.cc", "lib/sync_handle_watcher.cc", "lib/template_util.h", + "lib/unserialized_message_context.cc", + "lib/unserialized_message_context.h", "lib/validate_params.h", "lib/validation_context.cc", "lib/validation_context.h",
diff --git a/mojo/public/cpp/bindings/associated_group_controller.h b/mojo/public/cpp/bindings/associated_group_controller.h index 116c926..5c9d9e3 100644 --- a/mojo/public/cpp/bindings/associated_group_controller.h +++ b/mojo/public/cpp/bindings/associated_group_controller.h
@@ -69,6 +69,10 @@ // and notifies all interfaces running on this pipe. virtual void RaiseError() = 0; + // Indicates whether or this endpoint prefers to accept outgoing messages in + // serializaed form only. + virtual bool PrefersSerializedMessages() = 0; + protected: friend class base::RefCountedThreadSafe<AssociatedGroupController>;
diff --git a/mojo/public/cpp/bindings/connector.h b/mojo/public/cpp/bindings/connector.h index 340af92..e3ee8ffa 100644 --- a/mojo/public/cpp/bindings/connector.h +++ b/mojo/public/cpp/bindings/connector.h
@@ -19,6 +19,7 @@ #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/bindings/sync_handle_watcher.h" #include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/handle_signal_tracker.h" #include "mojo/public/cpp/system/simple_watcher.h" namespace base { @@ -47,12 +48,45 @@ MULTI_THREADED_SEND }; + // Determines how this Connector should behave with respect to serialization + // of outgoing messages. + enum class OutgoingSerializationMode { + // Lazy serialization. The Connector prefers to transmit serialized messages + // only when it knows its peer endpoint is remote. This ensures outgoing + // requests are unserialized by default (when possible, i.e. when generated + // bindings support it) and serialized only if and when necessary. + kLazy, + + // Eager serialization. The Connector always prefers serialized messages, + // ensuring that interface calls will be serialized immediately before + // sending on the Connector. + kEager, + }; + + // Determines how this Connector should behave with respect to serialization + // of incoming messages. + enum class IncomingSerializationMode { + // Accepts and dispatches either serialized or unserialized messages. This + // is the only mode that should be used in production. + kDispatchAsIs, + + // Accepts either serialized or unserialized messages, but always forces + // serialization (if applicable) before dispatch. Should be used only in + // test environments to coerce the lazy serialization of a message after + // transmission. + kSerializeBeforeDispatchForTesting, + }; + // The Connector takes ownership of |message_pipe|. Connector(ScopedMessagePipeHandle message_pipe, ConnectorConfig config, scoped_refptr<base::SequencedTaskRunner> runner); ~Connector() override; + // Sets outgoing serialization mode. + void SetOutgoingSerializationMode(OutgoingSerializationMode mode); + void SetIncomingSerializationMode(IncomingSerializationMode mode); + // Sets the receiver to handle messages read from the message pipe. The // Connector will read messages from the pipe regardless of whether or not an // incoming receiver has been set. @@ -121,6 +155,7 @@ void ResumeIncomingMethodCallProcessing(); // MessageReceiver implementation: + bool PrefersSerializedMessages() override; bool Accept(Message* message) override; MessagePipeHandle handle() const { @@ -154,6 +189,13 @@ // |tag| must be a const string literal. void SetWatcherHeapProfilerTag(const char* tag); + // Allows testing environments to override the default serialization behavior + // of newly constructed Connector instances. Must be called before any + // Connector instances are constructed. + static void OverrideDefaultSerializationBehaviorForTesting( + OutgoingSerializationMode outgoing_mode, + IncomingSerializationMode incoming_mode); + private: class ActiveDispatchTracker; class RunLoopNestingObserver; @@ -191,6 +233,7 @@ scoped_refptr<base::SequencedTaskRunner> task_runner_; std::unique_ptr<SimpleWatcher> handle_watcher_; + base::Optional<HandleSignalTracker> peer_remoteness_tracker_; bool error_ = false; bool drop_writes_ = false; @@ -198,6 +241,9 @@ bool paused_ = false; + OutgoingSerializationMode outgoing_serialization_mode_; + IncomingSerializationMode incoming_serialization_mode_; + // If sending messages is allowed from multiple threads, |lock_| is used to // protect modifications to |message_pipe_| and |drop_writes_|. base::Optional<base::Lock> lock_;
diff --git a/mojo/public/cpp/bindings/interface_endpoint_client.h b/mojo/public/cpp/bindings/interface_endpoint_client.h index 93c4ec8e..2c76c5ce 100644 --- a/mojo/public/cpp/bindings/interface_endpoint_client.h +++ b/mojo/public/cpp/bindings/interface_endpoint_client.h
@@ -95,6 +95,7 @@ // MessageReceiverWithResponder implementation: // They must only be called when the handle is not in pending association // state. + bool PrefersSerializedMessages() override; bool Accept(Message* message) override; bool AcceptWithResponder(Message* message, std::unique_ptr<MessageReceiver> responder) override;
diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc index 835e2831..55c9e03d 100644 --- a/mojo/public/cpp/bindings/lib/connector.cc +++ b/mojo/public/cpp/bindings/lib/connector.cc
@@ -31,6 +31,14 @@ base::LazyInstance<base::ThreadLocalPointer<base::RunLoop::NestingObserver>>:: Leaky g_tls_nesting_observer = LAZY_INSTANCE_INITIALIZER; +// The default outgoing serialization mode for new Connectors. +Connector::OutgoingSerializationMode g_default_outgoing_serialization_mode = + Connector::OutgoingSerializationMode::kLazy; + +// The default incoming serialization mode for new Connectors. +Connector::IncomingSerializationMode g_default_incoming_serialization_mode = + Connector::IncomingSerializationMode::kDispatchAsIs; + } // namespace // Used to efficiently maintain a doubly-linked list of all Connectors @@ -133,6 +141,8 @@ scoped_refptr<base::SequencedTaskRunner> runner) : message_pipe_(std::move(message_pipe)), task_runner_(std::move(runner)), + outgoing_serialization_mode_(g_default_outgoing_serialization_mode), + incoming_serialization_mode_(g_default_incoming_serialization_mode), nesting_observer_(RunLoopNestingObserver::GetForThread()), weak_factory_(this) { if (config == MULTI_THREADED_SEND) @@ -156,6 +166,16 @@ CancelWait(); } +void Connector::SetOutgoingSerializationMode(OutgoingSerializationMode mode) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + outgoing_serialization_mode_ = mode; +} + +void Connector::SetIncomingSerializationMode(IncomingSerializationMode mode) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + incoming_serialization_mode_ = mode; +} + void Connector::CloseMessagePipe() { // Throw away the returned message pipe. PassMessagePipe(); @@ -231,6 +251,14 @@ WaitToReadMore(); } +bool Connector::PrefersSerializedMessages() { + if (outgoing_serialization_mode_ == OutgoingSerializationMode::kEager) + return true; + DCHECK_EQ(OutgoingSerializationMode::kLazy, outgoing_serialization_mode_); + return peer_remoteness_tracker_ && + peer_remoteness_tracker_->last_known_state().peer_remote(); +} + bool Connector::Accept(Message* message) { if (!lock_) DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -310,6 +338,14 @@ } } +// static +void Connector::OverrideDefaultSerializationBehaviorForTesting( + OutgoingSerializationMode outgoing_mode, + IncomingSerializationMode incoming_mode) { + g_default_outgoing_serialization_mode = outgoing_mode; + g_default_incoming_serialization_mode = incoming_mode; +} + void Connector::OnWatcherHandleReady(MojoResult result) { OnHandleReadyInternal(result); } @@ -349,6 +385,11 @@ message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, base::Bind(&Connector::OnWatcherHandleReady, base::Unretained(this))); + if (message_pipe_.is_valid()) { + peer_remoteness_tracker_.emplace(message_pipe_.get(), + MOJO_HANDLE_SIGNAL_PEER_REMOTE); + } + if (rv != MOJO_RESULT_OK) { // If the watch failed because the handle is invalid or its conditions can // no longer be met, we signal the error asynchronously to avoid reentry. @@ -385,6 +426,14 @@ dispatch_tracker.emplace(weak_self); } + if (incoming_serialization_mode_ == + IncomingSerializationMode::kSerializeBeforeDispatchForTesting) { + message.SerializeIfNecessary(); + } else { + DCHECK_EQ(IncomingSerializationMode::kDispatchAsIs, + incoming_serialization_mode_); + } + TRACE_EVENT0("mojom", heap_profiler_tag_); receiver_result = incoming_receiver_ && incoming_receiver_->Accept(&message); @@ -446,6 +495,7 @@ } void Connector::CancelWait() { + peer_remoteness_tracker_.reset(); handle_watcher_.reset(); sync_watcher_.reset(); }
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc index bd4b8a51..819143f 100644 --- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc +++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -26,7 +26,7 @@ namespace { void DCheckIfInvalid(const base::WeakPtr<InterfaceEndpointClient>& client, - const std::string& message) { + const std::string& message) { bool is_valid = client && !client->encountered_error(); DCHECK(!is_valid) << message; } @@ -67,6 +67,10 @@ } // MessageReceiver implementation: + bool PrefersSerializedMessages() override { + return endpoint_client_ && endpoint_client_->PrefersSerializedMessages(); + } + bool Accept(Message* message) override { DCHECK(task_runner_->RunsTasksInCurrentSequence()); accept_was_invoked_ = true; @@ -93,7 +97,7 @@ task_runner_->PostTask( FROM_HERE, base::Bind(&DCheckIfInvalid, endpoint_client_, message)); } - } + } private: base::WeakPtr<InterfaceEndpointClient> endpoint_client_; @@ -211,6 +215,11 @@ handle.ResetWithReason(custom_reason, description); } +bool InterfaceEndpointClient::PrefersSerializedMessages() { + auto* controller = handle_.group_controller(); + return controller && controller->PrefersSerializedMessages(); +} + bool InterfaceEndpointClient::Accept(Message* message) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!message->has_flag(Message::kFlagExpectsResponse));
diff --git a/mojo/public/cpp/bindings/lib/message.cc b/mojo/public/cpp/bindings/lib/message.cc index 6658e60..a6d927c7 100644 --- a/mojo/public/cpp/bindings/lib/message.cc +++ b/mojo/public/cpp/bindings/lib/message.cc
@@ -18,6 +18,7 @@ #include "base/threading/thread_local.h" #include "mojo/public/cpp/bindings/associated_group_controller.h" #include "mojo/public/cpp/bindings/lib/array_internal.h" +#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" namespace mojo { @@ -33,12 +34,6 @@ message.NotifyBadMessage(error); } -template <typename HeaderType> -void AllocateHeaderFromBuffer(internal::Buffer* buffer, HeaderType** header) { - *header = static_cast<HeaderType*>(buffer->Allocate(sizeof(HeaderType))); - (*header)->num_bytes = sizeof(HeaderType); -} - // An internal serialization context used to initialize new serialized messages. struct MessageInfo { MessageInfo(size_t total_size, std::vector<ScopedHandle>* handles) @@ -80,32 +75,10 @@ &DestroyMessageInfo, }; -size_t ComputeHeaderSize(uint32_t flags, size_t payload_interface_id_count) { - if (payload_interface_id_count > 0) { - // Version 2 - return sizeof(internal::MessageHeaderV2); - } else if (flags & - (Message::kFlagExpectsResponse | Message::kFlagIsResponse)) { - // Version 1 - return sizeof(internal::MessageHeaderV1); - } else { - // Version 0 - return sizeof(internal::MessageHeader); - } -} - -size_t ComputeTotalSize(uint32_t flags, - size_t payload_size, - size_t payload_interface_id_count) { - const size_t header_size = - ComputeHeaderSize(flags, payload_interface_id_count); - if (payload_interface_id_count > 0) { - return internal::Align( - header_size + internal::Align(payload_size) + - internal::ArrayDataTraits<uint32_t>::GetStorageSize( - static_cast<uint32_t>(payload_interface_id_count))); - } - return internal::Align(header_size + payload_size); +template <typename HeaderType> +void AllocateHeaderFromBuffer(internal::Buffer* buffer, HeaderType** header) { + *header = static_cast<HeaderType*>(buffer->Allocate(sizeof(HeaderType))); + (*header)->num_bytes = sizeof(HeaderType); } void WriteMessageHeader(uint32_t name, @@ -146,9 +119,9 @@ ScopedMessageHandle* out_handle, internal::Buffer* out_buffer) { internal::Buffer buffer; - MessageInfo info( - ComputeTotalSize(flags, payload_size, payload_interface_id_count), - handles); + MessageInfo info(internal::ComputeSerializedMessageSize( + flags, payload_size, payload_interface_id_count), + handles); ScopedMessageHandle handle; MojoResult rv = mojo::CreateMessage(reinterpret_cast<uintptr_t>(&info), &kMessageInfoThunks, &handle); @@ -172,12 +145,73 @@ *out_buffer = std::move(info.payload_buffer); } +void GetSerializedSizeFromUnserializedContext(uintptr_t context, + size_t* num_bytes, + size_t* num_handles) { + reinterpret_cast<internal::UnserializedMessageContext*>(context) + ->GetSerializedSize(num_bytes, num_handles); +} + +void SerializeHandlesFromUnserializedContext(uintptr_t context, + MojoHandle* handles) { + reinterpret_cast<internal::UnserializedMessageContext*>(context) + ->SerializeHandles(handles); +} + +void SerializePayloadFromUnserializedContext(uintptr_t context_value, + void* storage) { + auto* context = + reinterpret_cast<internal::UnserializedMessageContext*>(context_value); + internal::Buffer payload_buffer(storage, context->total_serialized_size()); + WriteMessageHeader(context->message_name(), context->message_flags(), + 0 /* payload_interface_id_count */, &payload_buffer); + + // We need to copy additional header data which may have been set after + // message construction, as this codepath may be reached at some arbitrary + // time between message send and message dispatch. + static_cast<internal::MessageHeader*>(storage)->interface_id = + context->header()->interface_id; + if (context->header()->flags & + (Message::kFlagExpectsResponse | Message::kFlagIsResponse)) { + DCHECK_GE(context->header()->version, 1u); + static_cast<internal::MessageHeaderV1*>(storage)->request_id = + context->header()->request_id; + } + context->SerializePayload(&payload_buffer); +} + +void DestroyUnserializedContext(uintptr_t context) { + delete reinterpret_cast<internal::UnserializedMessageContext*>(context); +} + +const MojoMessageOperationThunks kUnserializedMessageContextThunks{ + sizeof(MojoMessageOperationThunks), + &GetSerializedSizeFromUnserializedContext, + &SerializeHandlesFromUnserializedContext, + &SerializePayloadFromUnserializedContext, + &DestroyUnserializedContext, +}; + +ScopedMessageHandle CreateUnserializedMessageObject( + std::unique_ptr<internal::UnserializedMessageContext> context) { + ScopedMessageHandle handle; + MojoResult rv = + mojo::CreateMessage(reinterpret_cast<uintptr_t>(context.release()), + &kUnserializedMessageContextThunks, &handle); + DCHECK_EQ(MOJO_RESULT_OK, rv); + DCHECK(handle.is_valid()); + return handle; +} + } // namespace Message::Message() = default; Message::Message(Message&& other) = default; +Message::Message(std::unique_ptr<internal::UnserializedMessageContext> context) + : Message(CreateUnserializedMessageObject(std::move(context))) {} + Message::Message(uint32_t name, uint32_t flags, size_t payload_size, @@ -189,38 +223,58 @@ data_ = payload_buffer_.data(); data_size_ = payload_buffer_.size(); transferable_ = true; + serialized_ = true; } Message::Message(ScopedMessageHandle handle) { DCHECK(handle.is_valid()); - // Extract any serialized handles if possible. - uint32_t num_bytes; - void* buffer; - uint32_t num_handles = 0; - MojoResult rv = MojoGetSerializedMessageContents( - handle->value(), &buffer, &num_bytes, nullptr, &num_handles, - MOJO_GET_SERIALIZED_MESSAGE_CONTENTS_FLAG_NONE); - if (rv == MOJO_RESULT_RESOURCE_EXHAUSTED) { - handles_.resize(num_handles); - rv = MojoGetSerializedMessageContents( - handle->value(), &buffer, &num_bytes, - reinterpret_cast<MojoHandle*>(handles_.data()), &num_handles, + uintptr_t context_value = 0; + MojoResult get_context_result = MojoGetMessageContext( + handle->value(), &context_value, MOJO_GET_MESSAGE_CONTEXT_FLAG_NONE); + if (get_context_result == MOJO_RESULT_NOT_FOUND) { + // It's a serialized message. Extract handles if possible. + uint32_t num_bytes; + void* buffer; + uint32_t num_handles = 0; + MojoResult rv = MojoGetSerializedMessageContents( + handle->value(), &buffer, &num_bytes, nullptr, &num_handles, MOJO_GET_SERIALIZED_MESSAGE_CONTENTS_FLAG_NONE); - } else { - // No handles, so it's safe to retransmit this message if the caller really - // wants to. - transferable_ = true; - } + if (rv == MOJO_RESULT_RESOURCE_EXHAUSTED) { + handles_.resize(num_handles); + rv = MojoGetSerializedMessageContents( + handle->value(), &buffer, &num_bytes, + reinterpret_cast<MojoHandle*>(handles_.data()), &num_handles, + MOJO_GET_SERIALIZED_MESSAGE_CONTENTS_FLAG_NONE); + } else { + // No handles, so it's safe to retransmit this message if the caller + // really wants to. + transferable_ = true; + } - if (rv != MOJO_RESULT_OK) { - // Failed to deserialize handles. Leave the Message uninitialized. - return; + if (rv != MOJO_RESULT_OK) { + // Failed to deserialize handles. Leave the Message uninitialized. + return; + } + + data_ = buffer; + data_size_ = num_bytes; + serialized_ = true; + } else { + DCHECK_EQ(MOJO_RESULT_OK, get_context_result); + auto* context = + reinterpret_cast<internal::UnserializedMessageContext*>(context_value); + // Dummy data address so common header accessors still behave properly. The + // choice is V1 reflects unserialized message capabilities: we may or may + // not need to support request IDs (which require at least V1), but we never + // (for now, anyway) need to support associated interface handles (V2). + data_ = context->header(); + data_size_ = sizeof(internal::MessageHeaderV1); + transferable_ = true; + serialized_ = false; } handle_ = std::move(handle); - data_ = buffer; - data_size_ = num_bytes; } Message::~Message() = default; @@ -234,6 +288,7 @@ data_ = nullptr; data_size_ = 0; transferable_ = false; + serialized_ = false; } const uint8_t* Message::payload() const { @@ -339,6 +394,43 @@ return result; } +void Message::SerializeIfNecessary() { + MojoResult rv = MojoSerializeMessage(handle_->value()); + if (rv == MOJO_RESULT_FAILED_PRECONDITION) + return; + + // Reconstruct this Message instance from the serialized message's handle. + *this = Message(std::move(handle_)); +} + +std::unique_ptr<internal::UnserializedMessageContext> +Message::TakeUnserializedContext( + const internal::UnserializedMessageContext::Tag* tag) { + DCHECK(handle_.is_valid()); + uintptr_t context_value = 0; + MojoResult rv = MojoGetMessageContext(handle_->value(), &context_value, + MOJO_GET_MESSAGE_CONTEXT_FLAG_NONE); + if (rv == MOJO_RESULT_NOT_FOUND) + return nullptr; + DCHECK_EQ(MOJO_RESULT_OK, rv); + + auto* context = + reinterpret_cast<internal::UnserializedMessageContext*>(context_value); + if (context->tag() != tag) + return nullptr; + + // Detach the context from the message. + rv = MojoGetMessageContext(handle_->value(), &context_value, + MOJO_GET_MESSAGE_CONTEXT_FLAG_RELEASE); + DCHECK_EQ(MOJO_RESULT_OK, rv); + DCHECK_EQ(context_value, reinterpret_cast<uintptr_t>(context)); + return base::WrapUnique(context); +} + +bool MessageReceiver::PrefersSerializedMessages() { + return false; +} + PassThroughFilter::PassThroughFilter() {} PassThroughFilter::~PassThroughFilter() {}
diff --git a/mojo/public/cpp/bindings/lib/message_header_validator.cc b/mojo/public/cpp/bindings/lib/message_header_validator.cc index 1f23256..f7fbb996 100644 --- a/mojo/public/cpp/bindings/lib/message_header_validator.cc +++ b/mojo/public/cpp/bindings/lib/message_header_validator.cc
@@ -117,6 +117,10 @@ } bool MessageHeaderValidator::Accept(Message* message) { + // Don't bother validating unserialized message headers. + if (!message->is_serialized()) + return true; + // Pass 0 as number of handles and associated endpoint handles because we // don't expect any in the header, even if |message| contains handles. internal::ValidationContext validation_context(
diff --git a/mojo/public/cpp/bindings/lib/message_internal.cc b/mojo/public/cpp/bindings/lib/message_internal.cc new file mode 100644 index 0000000..bd46e20 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/message_internal.cc
@@ -0,0 +1,51 @@ +// 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 "mojo/public/cpp/bindings/lib/message_internal.h" + +#include "mojo/public/cpp/bindings/lib/array_internal.h" +#include "mojo/public/cpp/bindings/lib/control_message_handler.h" +#include "mojo/public/cpp/bindings/message.h" + +namespace mojo { +namespace internal { + +namespace { + +size_t ComputeHeaderSize(uint32_t flags, size_t payload_interface_id_count) { + if (payload_interface_id_count > 0) { + // Version 2 + return sizeof(MessageHeaderV2); + } else if (flags & + (Message::kFlagExpectsResponse | Message::kFlagIsResponse)) { + // Version 1 + return sizeof(MessageHeaderV1); + } else { + // Version 0 + return sizeof(MessageHeader); + } +} + +} // namespace + +size_t ComputeSerializedMessageSize(uint32_t flags, + size_t payload_size, + size_t payload_interface_id_count) { + const size_t header_size = + ComputeHeaderSize(flags, payload_interface_id_count); + if (payload_interface_id_count > 0) { + return Align(header_size + Align(payload_size) + + ArrayDataTraits<uint32_t>::GetStorageSize( + static_cast<uint32_t>(payload_interface_id_count))); + } + return internal::Align(header_size + payload_size); +} + +bool IsUnserializedOrControlMessage(Message* message) { + return !message->is_serialized() || + ControlMessageHandler::IsControlMessage(message); +} + +} // namespace internal +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/message_internal.h b/mojo/public/cpp/bindings/lib/message_internal.h index 6693198..b2a5256 100644 --- a/mojo/public/cpp/bindings/lib/message_internal.h +++ b/mojo/public/cpp/bindings/lib/message_internal.h
@@ -76,6 +76,15 @@ static void SetCurrentSyncResponseMessage(Message* message); }; +MOJO_CPP_BINDINGS_EXPORT size_t +ComputeSerializedMessageSize(uint32_t flags, + size_t payload_size, + size_t payload_interface_id_count); + +// Used by generated bindings to bypass validation for unserialized message +// objects and control messages. +MOJO_CPP_BINDINGS_EXPORT bool IsUnserializedOrControlMessage(Message* message); + } // namespace internal } // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc index a648304..fc4b5b87 100644 --- a/mojo/public/cpp/bindings/lib/multiplex_router.cc +++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -351,9 +351,8 @@ connector_.AllowWokenUpBySyncWatchOnSameThread(); } connector_.set_incoming_receiver(&filters_); - connector_.set_connection_error_handler( - base::Bind(&MultiplexRouter::OnPipeConnectionError, - base::Unretained(this))); + connector_.set_connection_error_handler(base::Bind( + &MultiplexRouter::OnPipeConnectionError, base::Unretained(this))); std::unique_ptr<MessageHeaderValidator> header_validator = base::MakeUnique<MessageHeaderValidator>(); @@ -389,8 +388,8 @@ void MultiplexRouter::SetMasterInterfaceName(const char* name) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - header_validator_->SetDescription( - std::string(name) + " [master] MessageHeaderValidator"); + header_validator_->SetDescription(std::string(name) + + " [master] MessageHeaderValidator"); control_message_handler_.SetDescription( std::string(name) + " [master] PipeControlMessageHandler"); connector_.SetWatcherHeapProfilerTag(name); @@ -527,6 +526,11 @@ } } +bool MultiplexRouter::PrefersSerializedMessages() { + MayAutoLock locker(&lock_); + return connector_.PrefersSerializedMessages(); +} + void MultiplexRouter::CloseMessagePipe() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); connector_.CloseMessagePipe(); @@ -589,7 +593,8 @@ bool MultiplexRouter::Accept(Message* message) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (!message->DeserializeAssociatedEndpointHandles(this)) + if (message->is_serialized() && + !message->DeserializeAssociatedEndpointHandles(this)) return false; scoped_refptr<MultiplexRouter> protector(this);
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h index 68236ca..1da23bc0 100644 --- a/mojo/public/cpp/bindings/lib/multiplex_router.h +++ b/mojo/public/cpp/bindings/lib/multiplex_router.h
@@ -101,6 +101,7 @@ void DetachEndpointClient( const ScopedInterfaceEndpointHandle& handle) override; void RaiseError() override; + bool PrefersSerializedMessages() override; // --------------------------------------------------------------------------- // The following public methods are called on the creating thread.
diff --git a/mojo/public/cpp/bindings/lib/serialization_context.h b/mojo/public/cpp/bindings/lib/serialization_context.h index 9c523cd..d1e0da88 100644 --- a/mojo/public/cpp/bindings/lib/serialization_context.h +++ b/mojo/public/cpp/bindings/lib/serialization_context.h
@@ -93,6 +93,16 @@ Message* message); const std::vector<mojo::ScopedHandle>* handles() { return &handles_; } + std::vector<mojo::ScopedHandle>* mutable_handles() { return &handles_; } + + const std::vector<ScopedInterfaceEndpointHandle>* + associated_endpoint_handles() const { + return &associated_endpoint_handles_; + } + std::vector<ScopedInterfaceEndpointHandle>* + mutable_associated_endpoint_handles() { + return &associated_endpoint_handles_; + } // Takes handles from a received Message object and assumes ownership of them. // Individual handles can be extracted using Take* methods below.
diff --git a/mojo/public/cpp/bindings/lib/unserialized_message_context.cc b/mojo/public/cpp/bindings/lib/unserialized_message_context.cc new file mode 100644 index 0000000..48a0d68 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/unserialized_message_context.cc
@@ -0,0 +1,48 @@ +// 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 "mojo/public/cpp/bindings/lib/unserialized_message_context.h" + +namespace mojo { +namespace internal { + +UnserializedMessageContext::UnserializedMessageContext(const Tag* tag, + uint32_t message_name, + uint32_t message_flags) + : tag_(tag) { + header_.interface_id = 0; + header_.version = 1; + header_.name = message_name; + header_.flags = message_flags; +} + +UnserializedMessageContext::~UnserializedMessageContext() = default; + +void UnserializedMessageContext::GetSerializedSize(size_t* num_bytes, + size_t* num_handles) { + DCHECK(!serialization_context_.has_value()); + serialization_context_.emplace(); + + size_t payload_size = PrepareToSerialize(&serialization_context_.value()); + total_serialized_size_ = ComputeSerializedMessageSize( + header_.flags, payload_size, 0 /* payload_interface_id_count */); + *num_bytes = total_serialized_size_; + *num_handles = serialization_context_->handles()->size(); +} + +void UnserializedMessageContext::SerializeHandles(MojoHandle* handles) { + DCHECK(serialization_context_.has_value()); + for (auto& handle : *serialization_context_->mutable_handles()) { + *handles = handle.release().value(); + ++handles; + } +} + +void UnserializedMessageContext::SerializePayload(Buffer* buffer) { + DCHECK(serialization_context_.has_value()); + Serialize(&serialization_context_.value(), buffer); +} + +} // namespace internal +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/unserialized_message_context.h b/mojo/public/cpp/bindings/lib/unserialized_message_context.h new file mode 100644 index 0000000..7a83f988 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/unserialized_message_context.h
@@ -0,0 +1,79 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_UNSERIALIZED_MESSAGE_CONTEXT_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_UNSERIALIZED_MESSAGE_CONTEXT_H_ + +#include <stdint.h> + +#include "base/macros.h" +#include "base/optional.h" +#include "mojo/public/c/system/types.h" +#include "mojo/public/cpp/bindings/bindings_export.h" +#include "mojo/public/cpp/bindings/lib/buffer.h" +#include "mojo/public/cpp/bindings/lib/message_internal.h" +#include "mojo/public/cpp/bindings/lib/serialization_context.h" + +namespace mojo { +namespace internal { + +class MOJO_CPP_BINDINGS_EXPORT UnserializedMessageContext { + public: + struct Tag {}; + + UnserializedMessageContext(const Tag* tag, + uint32_t message_name, + uint32_t message_flags); + virtual ~UnserializedMessageContext(); + + template <typename MessageType> + MessageType* SafeCast() { + if (&MessageType::kMessageTag != tag_) + return nullptr; + return static_cast<MessageType*>(this); + } + + const Tag* tag() const { return tag_; } + uint32_t message_name() const { return header_.name; } + uint32_t message_flags() const { return header_.flags; } + size_t payload_interface_id_count() const { + DCHECK(serialization_context_.has_value()); + return serialization_context_->associated_endpoint_handles()->size(); + } + + MessageHeaderV1* header() { return &header_; } + + size_t total_serialized_size() const { return total_serialized_size_; } + + void GetSerializedSize(size_t* num_bytes, size_t* num_handles); + void SerializeHandles(MojoHandle* handles); + void SerializePayload(Buffer* buffer); + + virtual size_t PrepareToSerialize( + SerializationContext* serialization_context) = 0; + virtual void Serialize(SerializationContext* serialization_context, + Buffer* buffer) = 0; + + private: + // The |tag_| is used for run-time type identification of specific + // unserialized message types, e.g. messages generated by mojom bindings. This + // allows opaque message objects to be safely downcast once pulled off a pipe. + const Tag* const tag_; + + // We store message metadata in a serialized header structure to simplify + // Message implementation which needs to query such metadata for both + // serialized and unserialized message objects. + MessageHeaderV1 header_; + + // Intermediate state used during serialization. + base::Optional<SerializationContext> serialization_context_; + size_t total_serialized_size_ = 0; + + DISALLOW_COPY_AND_ASSIGN(UnserializedMessageContext); +}; + +} // namespace internal +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_UNSERIALIZED_MESSAGE_CONTEXT_H_
diff --git a/mojo/public/cpp/bindings/message.h b/mojo/public/cpp/bindings/message.h index cfd4664..2b6fd0b 100644 --- a/mojo/public/cpp/bindings/message.h +++ b/mojo/public/cpp/bindings/message.h
@@ -19,6 +19,7 @@ #include "mojo/public/cpp/bindings/bindings_export.h" #include "mojo/public/cpp/bindings/lib/buffer.h" #include "mojo/public/cpp/bindings/lib/message_internal.h" +#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "mojo/public/cpp/system/message.h" @@ -41,6 +42,14 @@ // Constructs an uninitialized Message object. Message(); + // See the move-assignment operator below. + Message(Message&& other); + + // Constructs a new message with an unserialized context attached. This + // message may be serialized later if necessary. + explicit Message( + std::unique_ptr<internal::UnserializedMessageContext> context); + // Constructs a new serialized Message object with optional handles attached. // This message is fully functional and may be exchanged for a // ScopedMessageHandle for transit over a message pipe. See TakeMojoMessage(). @@ -61,9 +70,6 @@ // another message pipe, but are otherwise safe to inspect and pass around. Message(ScopedMessageHandle handle); - // See the move-assignment operator below. - Message(Message&& other); - ~Message(); // Moves |other| into a new Message object. The moved-from Message becomes @@ -78,6 +84,9 @@ // Indicates whether this Message is uninitialized. bool IsNull() const { return !handle_.is_valid(); } + // Indicates whether this Message is serialized. + bool is_serialized() const { return serialized_; } + uint32_t data_num_bytes() const { return static_cast<uint32_t>(data_size_); } // Access the raw bytes of the message. @@ -167,6 +176,24 @@ bool DeserializeAssociatedEndpointHandles( AssociatedGroupController* group_controller); + // If this Message has an unserialized message context attached, force it to + // be serialized immediately. Otherwise this does nothing. + void SerializeIfNecessary(); + + // Takes the unserialized message context from this Message if its tag matches + // |tag|. + std::unique_ptr<internal::UnserializedMessageContext> TakeUnserializedContext( + const internal::UnserializedMessageContext::Tag* tag); + + template <typename MessageType> + std::unique_ptr<MessageType> TakeUnserializedContext() { + auto generic_context = TakeUnserializedContext(&MessageType::kMessageTag); + if (!generic_context) + return nullptr; + return base::WrapUnique( + generic_context.release()->template SafeCast<MessageType>()); + } + private: ScopedMessageHandle handle_; @@ -184,6 +211,9 @@ // identified by |handle_|. bool transferable_ = false; + // Indicates whether this Message object is serialized. + bool serialized_ = false; + // A Buffer which may be used to allocated blocks of data within the message // payload. May be invalid if there is no capacity remaining in the payload. internal::Buffer payload_buffer_; @@ -191,10 +221,13 @@ DISALLOW_COPY_AND_ASSIGN(Message); }; -class MessageReceiver { +class MOJO_CPP_BINDINGS_EXPORT MessageReceiver { public: virtual ~MessageReceiver() {} + // Indicates whether the receiver prefers to receive serialized messages. + virtual bool PrefersSerializedMessages(); + // The receiver may mutate the given message. Returns true if the message // was accepted and false otherwise, indicating that the message was invalid // or malformed.
diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn index d920dda..b45c1b7 100644 --- a/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/mojo/public/cpp/bindings/tests/BUILD.gn
@@ -11,6 +11,8 @@ "binding_callback_unittest.cc", "binding_set_unittest.cc", "binding_unittest.cc", + "bindings_test_base.cc", + "bindings_test_base.h", "buffer_unittest.cc", "connector_unittest.cc", "constant_unittest.cc", @@ -22,6 +24,7 @@ "handle_passing_unittest.cc", "hash_unittest.cc", "interface_ptr_unittest.cc", + "lazy_serialization_unittest.cc", "map_unittest.cc", "message_queue.cc", "message_queue.h",
diff --git a/mojo/public/cpp/bindings/tests/binding_set_unittest.cc b/mojo/public/cpp/bindings/tests/binding_set_unittest.cc index cfe8258..a945b301 100644 --- a/mojo/public/cpp/bindings/tests/binding_set_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_set_unittest.cc
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/associated_binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/strong_binding_set.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" #include "mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,18 +20,7 @@ namespace test { namespace { -class BindingSetTest : public testing::Test { - public: - BindingSetTest() {} - ~BindingSetTest() override {} - - base::MessageLoop& loop() { return loop_; } - - private: - base::MessageLoop loop_; - - DISALLOW_COPY_AND_ASSIGN(BindingSetTest); -}; +using BindingSetTest = BindingsTestBase; template <typename BindingSetType, typename ContextType> void ExpectContextHelper(BindingSetType* binding_set, @@ -114,7 +104,7 @@ base::Closure ping_handler_; }; -TEST_F(BindingSetTest, BindingSetContext) { +TEST_P(BindingSetTest, BindingSetContext) { PingImpl impl; BindingSet<PingService, int> bindings; @@ -155,7 +145,7 @@ EXPECT_TRUE(bindings.empty()); } -TEST_F(BindingSetTest, BindingSetDispatchBinding) { +TEST_P(BindingSetTest, BindingSetDispatchBinding) { PingImpl impl; BindingSet<PingService, int> bindings; @@ -196,7 +186,7 @@ EXPECT_TRUE(bindings.empty()); } -TEST_F(BindingSetTest, BindingSetConnectionErrorWithReason) { +TEST_P(BindingSetTest, BindingSetConnectionErrorWithReason) { PingImpl impl; PingServicePtr ptr; BindingSet<PingService> bindings; @@ -215,7 +205,7 @@ ptr.ResetWithReason(1024u, "bye"); } -TEST_F(BindingSetTest, BindingSetReportBadMessage) { +TEST_P(BindingSetTest, BindingSetReportBadMessage) { PingImpl impl; std::string last_received_error; @@ -252,7 +242,7 @@ edk::SetDefaultProcessErrorCallback(mojo::edk::ProcessErrorCallback()); } -TEST_F(BindingSetTest, BindingSetGetBadMessageCallback) { +TEST_P(BindingSetTest, BindingSetGetBadMessageCallback) { PingImpl impl; std::string last_received_error; @@ -302,7 +292,7 @@ edk::SetDefaultProcessErrorCallback(mojo::edk::ProcessErrorCallback()); } -TEST_F(BindingSetTest, BindingSetGetBadMessageCallbackOutlivesBindingSet) { +TEST_P(BindingSetTest, BindingSetGetBadMessageCallbackOutlivesBindingSet) { PingImpl impl; std::string last_received_error; @@ -370,7 +360,7 @@ base::Closure new_ping_handler_; }; -TEST_F(BindingSetTest, AssociatedBindingSetContext) { +TEST_P(BindingSetTest, AssociatedBindingSetContext) { AssociatedPingProviderPtr provider; PingProviderImpl impl; Binding<AssociatedPingProvider> binding(&impl, MakeRequest(&provider)); @@ -426,7 +416,7 @@ EXPECT_TRUE(impl.ping_bindings().empty()); } -TEST_F(BindingSetTest, MasterInterfaceBindingSetContext) { +TEST_P(BindingSetTest, MasterInterfaceBindingSetContext) { AssociatedPingProviderPtr provider_a, provider_b; PingProviderImpl impl; BindingSet<AssociatedPingProvider, int> bindings; @@ -471,7 +461,7 @@ EXPECT_TRUE(bindings.empty()); } -TEST_F(BindingSetTest, MasterInterfaceBindingSetDispatchBinding) { +TEST_P(BindingSetTest, MasterInterfaceBindingSetDispatchBinding) { AssociatedPingProviderPtr provider_a, provider_b; PingProviderImpl impl; BindingSet<AssociatedPingProvider, int> bindings; @@ -516,7 +506,7 @@ EXPECT_TRUE(bindings.empty()); } -TEST_F(BindingSetTest, PreDispatchHandler) { +TEST_P(BindingSetTest, PreDispatchHandler) { PingImpl impl; BindingSet<PingService, int> bindings; @@ -567,7 +557,7 @@ EXPECT_TRUE(bindings.empty()); } -TEST_F(BindingSetTest, AssociatedBindingSetConnectionErrorWithReason) { +TEST_P(BindingSetTest, AssociatedBindingSetConnectionErrorWithReason) { AssociatedPingProviderPtr master_ptr; PingProviderImpl master_impl; Binding<AssociatedPingProvider> master_binding(&master_impl, @@ -603,7 +593,7 @@ }; int PingInstanceCounter::instance_count = 0; -TEST_F(BindingSetTest, StrongBinding_Destructor) { +TEST_P(BindingSetTest, StrongBinding_Destructor) { PingServicePtr ping_a, ping_b; auto bindings = base::MakeUnique<StrongBindingSet<PingService>>(); @@ -619,7 +609,7 @@ EXPECT_EQ(0, PingInstanceCounter::instance_count); } -TEST_F(BindingSetTest, StrongBinding_ConnectionError) { +TEST_P(BindingSetTest, StrongBinding_ConnectionError) { PingServicePtr ping_a, ping_b; StrongBindingSet<PingService> bindings; bindings.AddBinding(base::MakeUnique<PingInstanceCounter>(), @@ -637,7 +627,7 @@ EXPECT_EQ(0, PingInstanceCounter::instance_count); } -TEST_F(BindingSetTest, StrongBinding_RemoveBinding) { +TEST_P(BindingSetTest, StrongBinding_RemoveBinding) { PingServicePtr ping_a, ping_b; StrongBindingSet<PingService> bindings; BindingId binding_id_a = bindings.AddBinding( @@ -653,6 +643,8 @@ EXPECT_EQ(0, PingInstanceCounter::instance_count); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(BindingSetTest); + } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc index e5d53f4..ffcb164 100644 --- a/mojo/public/cpp/bindings/tests/binding_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -17,6 +17,7 @@ #include "base/run_loop.h" #include "mojo/edk/embedder/embedder.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" @@ -25,19 +26,6 @@ namespace mojo { namespace { -class BindingTestBase : public testing::Test { - public: - BindingTestBase() {} - ~BindingTestBase() override {} - - base::MessageLoop& loop() { return loop_; } - - private: - base::MessageLoop loop_; - - DISALLOW_COPY_AND_ASSIGN(BindingTestBase); -}; - class ServiceImpl : public sample::Service { public: explicit ServiceImpl(bool* was_deleted = nullptr) @@ -80,9 +68,9 @@ // BindingTest ----------------------------------------------------------------- -using BindingTest = BindingTestBase; +using BindingTest = BindingsTestBase; -TEST_F(BindingTest, Close) { +TEST_P(BindingTest, Close) { bool called = false; sample::ServicePtr ptr; auto request = MakeRequest(&ptr); @@ -99,7 +87,7 @@ } // Tests that destroying a mojo::Binding closes the bound message pipe handle. -TEST_F(BindingTest, DestroyClosesMessagePipe) { +TEST_P(BindingTest, DestroyClosesMessagePipe) { bool encountered_error = false; ServiceImpl impl; sample::ServicePtr ptr; @@ -134,7 +122,7 @@ // Tests that the binding's connection error handler gets called when the other // end is closed. -TEST_F(BindingTest, ConnectionError) { +TEST_P(BindingTest, ConnectionError) { bool called = false; { ServiceImpl impl; @@ -155,7 +143,7 @@ // Tests that calling Close doesn't result in the connection error handler being // called. -TEST_F(BindingTest, CloseDoesntCallConnectionErrorHandler) { +TEST_P(BindingTest, CloseDoesntCallConnectionErrorHandler) { ServiceImpl impl; sample::ServicePtr ptr; Binding<sample::Service> binding(&impl, MakeRequest(&ptr)); @@ -199,7 +187,7 @@ }; // Tests that the binding may be deleted in the connection error handler. -TEST_F(BindingTest, SelfDeleteOnConnectionError) { +TEST_P(BindingTest, SelfDeleteOnConnectionError) { bool was_deleted = false; sample::ServicePtr ptr; // This should delete itself on connection error. @@ -213,7 +201,7 @@ } // Tests that explicitly calling Unbind followed by rebinding works. -TEST_F(BindingTest, Unbind) { +TEST_P(BindingTest, Unbind) { ServiceImpl impl; sample::ServicePtr ptr; Binding<sample::Service> binding(&impl, MakeRequest(&ptr)); @@ -263,7 +251,7 @@ DISALLOW_COPY_AND_ASSIGN(IntegerAccessorImpl); }; -TEST_F(BindingTest, PauseResume) { +TEST_P(BindingTest, PauseResume) { bool called = false; base::RunLoop run_loop; sample::ServicePtr ptr; @@ -286,7 +274,7 @@ } // Verifies the connection error handler is not run while a binding is paused. -TEST_F(BindingTest, ErrorHandleNotRunWhilePaused) { +TEST_P(BindingTest, ErrorHandleNotRunWhilePaused) { bool called = false; base::RunLoop run_loop; sample::ServicePtr ptr; @@ -352,7 +340,7 @@ // Verifies that message filters are notified in the order they were added and // are always notified before a message is dispatched. -TEST_F(BindingTest, MessageFilter) { +TEST_P(BindingTest, MessageFilter) { test::PingServicePtr ptr; PingServiceImpl impl; mojo::Binding<test::PingService> binding(&impl, MakeRequest(&ptr)); @@ -383,7 +371,7 @@ FAIL() << "Unexpected connection error"; } -TEST_F(BindingTest, FlushForTesting) { +TEST_P(BindingTest, FlushForTesting) { bool called = false; sample::ServicePtr ptr; auto request = MakeRequest(&ptr); @@ -402,7 +390,7 @@ EXPECT_TRUE(called); } -TEST_F(BindingTest, FlushForTestingWithClosedPeer) { +TEST_P(BindingTest, FlushForTestingWithClosedPeer) { bool called = false; sample::ServicePtr ptr; auto request = MakeRequest(&ptr); @@ -417,7 +405,7 @@ binding.FlushForTesting(); } -TEST_F(BindingTest, ConnectionErrorWithReason) { +TEST_P(BindingTest, ConnectionErrorWithReason) { sample::ServicePtr ptr; auto request = MakeRequest(&ptr); ServiceImpl impl; @@ -449,7 +437,7 @@ template <typename T> using WeakBinding = Binding<T, WeakPtrImplRefTraits<T>>; -TEST_F(BindingTest, CustomImplPointerType) { +TEST_P(BindingTest, CustomImplPointerType) { PingServiceImpl impl; base::WeakPtrFactory<test::PingService> weak_factory(&impl); @@ -479,7 +467,7 @@ } } -TEST_F(BindingTest, ReportBadMessage) { +TEST_P(BindingTest, ReportBadMessage) { bool called = false; test::PingServicePtr ptr; auto request = MakeRequest(&ptr); @@ -509,7 +497,7 @@ edk::SetDefaultProcessErrorCallback(mojo::edk::ProcessErrorCallback()); } -TEST_F(BindingTest, GetBadMessageCallback) { +TEST_P(BindingTest, GetBadMessageCallback) { test::PingServicePtr ptr; auto request = MakeRequest(&ptr); base::RunLoop run_loop; @@ -544,11 +532,11 @@ // StrongBindingTest ----------------------------------------------------------- -using StrongBindingTest = BindingTestBase; +using StrongBindingTest = BindingsTestBase; // Tests that destroying a mojo::StrongBinding closes the bound message pipe // handle but does *not* destroy the implementation object. -TEST_F(StrongBindingTest, DestroyClosesMessagePipe) { +TEST_P(StrongBindingTest, DestroyClosesMessagePipe) { base::RunLoop run_loop; bool encountered_error = false; bool was_deleted = false; @@ -580,7 +568,7 @@ // Tests the typical case, where the implementation object owns the // StrongBinding (and should be destroyed on connection error). -TEST_F(StrongBindingTest, ConnectionErrorDestroysImpl) { +TEST_P(StrongBindingTest, ConnectionErrorDestroysImpl) { sample::ServicePtr ptr; bool was_deleted = false; // Will delete itself. @@ -597,7 +585,7 @@ EXPECT_TRUE(was_deleted); } -TEST_F(StrongBindingTest, FlushForTesting) { +TEST_P(StrongBindingTest, FlushForTesting) { bool called = false; bool was_deleted = false; sample::ServicePtr ptr; @@ -625,7 +613,7 @@ EXPECT_TRUE(was_deleted); } -TEST_F(StrongBindingTest, FlushForTestingWithClosedPeer) { +TEST_P(StrongBindingTest, FlushForTestingWithClosedPeer) { bool called = false; bool was_deleted = false; sample::ServicePtr ptr; @@ -644,7 +632,7 @@ ASSERT_FALSE(binding); } -TEST_F(StrongBindingTest, ConnectionErrorWithReason) { +TEST_P(StrongBindingTest, ConnectionErrorWithReason) { sample::ServicePtr ptr; auto request = MakeRequest(&ptr); auto binding = @@ -664,5 +652,8 @@ run_loop.Run(); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(BindingTest); +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(StrongBindingTest); + } // namespace } // mojo
diff --git a/mojo/public/cpp/bindings/tests/bindings_test_base.cc b/mojo/public/cpp/bindings/tests/bindings_test_base.cc new file mode 100644 index 0000000..0243047 --- /dev/null +++ b/mojo/public/cpp/bindings/tests/bindings_test_base.cc
@@ -0,0 +1,40 @@ +// 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 "mojo/public/cpp/bindings/tests/bindings_test_base.h" + +#include "mojo/public/cpp/bindings/connector.h" + +namespace mojo { + +BindingsTestBase::BindingsTestBase() { + SetupSerializationBehavior(GetParam()); +} + +BindingsTestBase::~BindingsTestBase() = default; + +// static +void BindingsTestBase::SetupSerializationBehavior( + BindingsTestSerializationMode mode) { + switch (mode) { + case BindingsTestSerializationMode::kSerializeBeforeSend: + Connector::OverrideDefaultSerializationBehaviorForTesting( + Connector::OutgoingSerializationMode::kEager, + Connector::IncomingSerializationMode::kDispatchAsIs); + break; + case BindingsTestSerializationMode::kSerializeBeforeDispatch: + Connector::OverrideDefaultSerializationBehaviorForTesting( + Connector::OutgoingSerializationMode::kLazy, + Connector::IncomingSerializationMode :: + kSerializeBeforeDispatchForTesting); + break; + case BindingsTestSerializationMode::kNeverSerialize: + Connector::OverrideDefaultSerializationBehaviorForTesting( + Connector::OutgoingSerializationMode::kLazy, + Connector::IncomingSerializationMode::kDispatchAsIs); + break; + } +} + +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/bindings_test_base.h b/mojo/public/cpp/bindings/tests/bindings_test_base.h new file mode 100644 index 0000000..5f5c779 --- /dev/null +++ b/mojo/public/cpp/bindings/tests/bindings_test_base.h
@@ -0,0 +1,51 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_BASE_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_BASE_H_ + +#include "base/test/scoped_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { + +// Used to parameterize tests which inherit from BindingsTestBase to exercise +// various message serialization-related code paths for intra-process bindings +// usage. +enum class BindingsTestSerializationMode { + // Messages should be serialized immediately before sending. + kSerializeBeforeSend, + + // Messages should be serialized immediately before dispatching. + kSerializeBeforeDispatch, + + // Messages should never be serialized. + kNeverSerialize, +}; + +class BindingsTestBase + : public testing::Test, + public testing::WithParamInterface<BindingsTestSerializationMode> { + public: + BindingsTestBase(); + ~BindingsTestBase(); + + // Helper which other test fixtures can use. + static void SetupSerializationBehavior(BindingsTestSerializationMode mode); + + private: + base::test::ScopedTaskEnvironment task_environment_; +}; + +} // namespace mojo + +#define INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(fixture) \ + INSTANTIATE_TEST_CASE_P( \ + , fixture, \ + testing::Values( \ + mojo::BindingsTestSerializationMode::kSerializeBeforeSend, \ + mojo::BindingsTestSerializationMode::kSerializeBeforeDispatch, \ + mojo::BindingsTestSerializationMode::kNeverSerialize)) + +#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_BINDINGS_TEST_BASE_H_
diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc index 2ad109ec..b9bf41e 100644 --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -10,6 +10,7 @@ #include "base/run_loop.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/cpp/system/wait.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" @@ -150,7 +151,7 @@ Binding<sample::Factory> binding_; }; -class HandlePassingTest : public testing::Test { +class HandlePassingTest : public BindingsTestBase { public: HandlePassingTest() {} @@ -158,8 +159,6 @@ void PumpMessages() { base::RunLoop().RunUntilIdle(); } - private: - base::MessageLoop loop_; }; void DoStuff(bool* got_response, @@ -197,7 +196,7 @@ closure.Run(); } -TEST_F(HandlePassingTest, Basic) { +TEST_P(HandlePassingTest, Basic) { sample::FactoryPtr factory; SampleFactoryImpl factory_impl(MakeRequest(&factory)); @@ -232,7 +231,7 @@ EXPECT_EQ(1, ImportedInterfaceImpl::do_something_count() - count_before); } -TEST_F(HandlePassingTest, PassInvalid) { +TEST_P(HandlePassingTest, PassInvalid) { sample::FactoryPtr factory; SampleFactoryImpl factory_impl(MakeRequest(&factory)); @@ -254,7 +253,7 @@ } // Verifies DataPipeConsumer can be passed and read from. -TEST_F(HandlePassingTest, DataPipe) { +TEST_P(HandlePassingTest, DataPipe) { sample::FactoryPtr factory; SampleFactoryImpl factory_impl(MakeRequest(&factory)); @@ -292,7 +291,7 @@ EXPECT_EQ(expected_text_reply, got_text_reply); } -TEST_F(HandlePassingTest, PipesAreClosed) { +TEST_P(HandlePassingTest, PipesAreClosed) { sample::FactoryPtr factory; SampleFactoryImpl factory_impl(MakeRequest(&factory)); @@ -318,7 +317,7 @@ EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(handle1_value)); } -TEST_F(HandlePassingTest, CreateNamedObject) { +TEST_P(HandlePassingTest, CreateNamedObject) { sample::FactoryPtr factory; SampleFactoryImpl factory_impl(MakeRequest(&factory)); @@ -351,6 +350,8 @@ EXPECT_EQ(std::string("object2"), name2); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(HandlePassingTest); + } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc index 11a1ee7..1fcf169 100644 --- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc +++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -18,6 +18,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h" #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" @@ -196,15 +197,12 @@ base::Closure closure_; }; -class InterfacePtrTest : public testing::Test { +class InterfacePtrTest : public BindingsTestBase { public: InterfacePtrTest() {} ~InterfacePtrTest() override { base::RunLoop().RunUntilIdle(); } void PumpMessages() { base::RunLoop().RunUntilIdle(); } - - private: - base::test::ScopedTaskEnvironment task_environment; }; void SetFlagAndRunClosure(bool* flag, const base::Closure& closure) { @@ -223,7 +221,7 @@ closure.Run(); } -TEST_F(InterfacePtrTest, IsBound) { +TEST_P(InterfacePtrTest, IsBound) { math::CalculatorPtr calc; EXPECT_FALSE(calc.is_bound()); MathCalculatorImpl calc_impl(MakeRequest(&calc)); @@ -270,15 +268,15 @@ std::unique_ptr<MathCalculatorImpl> calc_impl_; }; -TEST_F(EndToEndInterfacePtrTest, EndToEnd) { +TEST_P(EndToEndInterfacePtrTest, EndToEnd) { RunTest(base::ThreadTaskRunnerHandle::Get()); } -TEST_F(EndToEndInterfacePtrTest, EndToEndOnSequence) { +TEST_P(EndToEndInterfacePtrTest, EndToEndOnSequence) { RunTest(base::CreateSequencedTaskRunnerWithTraits({})); } -TEST_F(InterfacePtrTest, Movable) { +TEST_P(InterfacePtrTest, Movable) { math::CalculatorPtr a; math::CalculatorPtr b; MathCalculatorImpl calc_impl(MakeRequest(&b)); @@ -292,7 +290,7 @@ EXPECT_TRUE(!b); } -TEST_F(InterfacePtrTest, Resettable) { +TEST_P(InterfacePtrTest, Resettable) { math::CalculatorPtr a; EXPECT_TRUE(!a); @@ -316,7 +314,7 @@ EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, CloseRaw(handle)); } -TEST_F(InterfacePtrTest, BindInvalidHandle) { +TEST_P(InterfacePtrTest, BindInvalidHandle) { math::CalculatorPtr ptr; EXPECT_FALSE(ptr.get()); EXPECT_FALSE(ptr); @@ -326,7 +324,7 @@ EXPECT_FALSE(ptr); } -TEST_F(InterfacePtrTest, EncounteredError) { +TEST_P(InterfacePtrTest, EncounteredError) { math::CalculatorPtr proxy; MathCalculatorImpl calc_impl(MakeRequest(&proxy)); @@ -355,7 +353,7 @@ EXPECT_TRUE(calculator_ui.encountered_error()); } -TEST_F(InterfacePtrTest, EncounteredErrorCallback) { +TEST_P(InterfacePtrTest, EncounteredErrorCallback) { math::CalculatorPtr proxy; MathCalculatorImpl calc_impl(MakeRequest(&proxy)); @@ -392,7 +390,7 @@ EXPECT_TRUE(encountered_error); } -TEST_F(InterfacePtrTest, DestroyInterfacePtrOnMethodResponse) { +TEST_P(InterfacePtrTest, DestroyInterfacePtrOnMethodResponse) { math::CalculatorPtr proxy; MathCalculatorImpl calc_impl(MakeRequest(&proxy)); @@ -407,7 +405,7 @@ EXPECT_EQ(0, SelfDestructingMathCalculatorUI::num_instances()); } -TEST_F(InterfacePtrTest, NestedDestroyInterfacePtrOnMethodResponse) { +TEST_P(InterfacePtrTest, NestedDestroyInterfacePtrOnMethodResponse) { math::CalculatorPtr proxy; MathCalculatorImpl calc_impl(MakeRequest(&proxy)); @@ -422,7 +420,7 @@ EXPECT_EQ(0, SelfDestructingMathCalculatorUI::num_instances()); } -TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) { +TEST_P(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) { sample::ServicePtr proxy; ReentrantServiceImpl impl(MakeRequest(&proxy)); @@ -440,7 +438,7 @@ EXPECT_EQ(2, impl.max_call_depth()); } -TEST_F(InterfacePtrTest, QueryVersion) { +TEST_P(InterfacePtrTest, QueryVersion) { IntegerAccessorImpl impl; sample::IntegerAccessorPtr ptr; Binding<sample::IntegerAccessor> binding(&impl, MakeRequest(&ptr)); @@ -455,7 +453,7 @@ EXPECT_EQ(3u, ptr.version()); } -TEST_F(InterfacePtrTest, RequireVersion) { +TEST_P(InterfacePtrTest, RequireVersion) { IntegerAccessorImpl impl; sample::IntegerAccessorPtr ptr; Binding<sample::IntegerAccessor> binding(&impl, MakeRequest(&ptr)); @@ -680,7 +678,7 @@ base::Closure closure_; }; -TEST_F(InterfacePtrTest, Scoping) { +TEST_P(InterfacePtrTest, Scoping) { APtr a; base::RunLoop run_loop; AImpl a_impl(MakeRequest(&a), run_loop.QuitClosure()); @@ -716,7 +714,7 @@ }; // Tests that FuseProxy does what it's supposed to do. -TEST_F(InterfacePtrTest, Fusion) { +TEST_P(InterfacePtrTest, Fusion) { sample::PingTestPtrInfo proxy_info; PingTestImpl impl(MakeRequest(&proxy_info)); @@ -736,7 +734,7 @@ FAIL() << "Unexpected connection error"; } -TEST_F(InterfacePtrTest, FlushForTesting) { +TEST_P(InterfacePtrTest, FlushForTesting) { math::CalculatorPtr calc; MathCalculatorImpl calc_impl(MakeRequest(&calc)); calc.set_connection_error_handler(base::Bind(&Fail)); @@ -757,7 +755,7 @@ *value = true; } -TEST_F(InterfacePtrTest, FlushForTestingWithClosedPeer) { +TEST_P(InterfacePtrTest, FlushForTestingWithClosedPeer) { math::CalculatorPtr calc; MakeRequest(&calc); bool called = false; @@ -767,7 +765,7 @@ calc.FlushForTesting(); } -TEST_F(InterfacePtrTest, ConnectionErrorWithReason) { +TEST_P(InterfacePtrTest, ConnectionErrorWithReason) { math::CalculatorPtr calc; MathCalculatorImpl calc_impl(MakeRequest(&calc)); @@ -786,7 +784,7 @@ run_loop.Run(); } -TEST_F(InterfacePtrTest, InterfaceRequestResetWithReason) { +TEST_P(InterfacePtrTest, InterfaceRequestResetWithReason) { math::CalculatorPtr calc; auto request = MakeRequest(&calc); @@ -805,7 +803,7 @@ run_loop.Run(); } -TEST_F(InterfacePtrTest, CallbackIsPassedInterfacePtr) { +TEST_P(InterfacePtrTest, CallbackIsPassedInterfacePtr) { sample::PingTestPtr ptr; auto request = mojo::MakeRequest(&ptr); @@ -824,7 +822,7 @@ run_loop.Run(); } -TEST_F(InterfacePtrTest, ConnectionErrorHandlerOwnsInterfacePtr) { +TEST_P(InterfacePtrTest, ConnectionErrorHandlerOwnsInterfacePtr) { sample::PingTestPtr* ptr = new sample::PingTestPtr; auto request = mojo::MakeRequest(ptr); @@ -846,7 +844,7 @@ run_loop.Run(); } -TEST_F(InterfacePtrTest, ThreadSafeInterfacePointer) { +TEST_P(InterfacePtrTest, ThreadSafeInterfacePointer) { math::CalculatorPtr ptr; MathCalculatorImpl calc_impl(MakeRequest(&ptr)); scoped_refptr<math::ThreadSafeCalculatorPtr> thread_safe_ptr = @@ -882,7 +880,7 @@ run_loop.Run(); } -TEST_F(InterfacePtrTest, ThreadSafeInterfacePointerWithTaskRunner) { +TEST_P(InterfacePtrTest, ThreadSafeInterfacePointerWithTaskRunner) { const scoped_refptr<base::SequencedTaskRunner> other_thread_task_runner = base::CreateSequencedTaskRunnerWithTraits({}); @@ -936,6 +934,8 @@ thread_safe_ptr = nullptr; } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(InterfacePtrTest); + } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc b/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc new file mode 100644 index 0000000..3dbe4b9d --- /dev/null +++ b/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc
@@ -0,0 +1,80 @@ +// 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 "base/macros.h" +#include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" +#include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { +namespace { + +class LazySerializationTest : public testing::Test { + public: + LazySerializationTest() {} + ~LazySerializationTest() override {} + + private: + base::test::ScopedTaskEnvironment task_environment_; + + DISALLOW_COPY_AND_ASSIGN(LazySerializationTest); +}; + +class TestUnserializedStructImpl : public test::TestUnserializedStruct { + public: + explicit TestUnserializedStructImpl( + test::TestUnserializedStructRequest request) + : binding_(this, std::move(request)) {} + ~TestUnserializedStructImpl() override {} + + // test::TestUnserializedStruct: + void PassUnserializedStruct( + const test::StructWithUnreachableTraitsImpl& s, + const PassUnserializedStructCallback& callback) override { + callback.Run(s); + } + + private: + mojo::Binding<test::TestUnserializedStruct> binding_; + + DISALLOW_COPY_AND_ASSIGN(TestUnserializedStructImpl); +}; + +TEST_F(LazySerializationTest, NeverSerialize) { + // Basic sanity check to ensure that no messages are serialized by default in + // environments where lazy serialization is supported, on an interface which + // supports lazy serialization, and where both ends of the interface are in + // the same process. + + test::TestUnserializedStructPtr ptr; + TestUnserializedStructImpl impl(MakeRequest(&ptr)); + + const int32_t kTestMagicNumber = 42; + + test::StructWithUnreachableTraitsImpl data; + EXPECT_EQ(0, data.magic_number); + data.magic_number = kTestMagicNumber; + + // Send our data over the pipe and wait for it to come back. The value should + // be preserved. We know the data was never serialized because the + // StructTraits for this type will DCHECK if executed in any capacity. + int received_number = 0; + base::RunLoop loop; + ptr->PassUnserializedStruct( + data, base::Bind( + [](base::RunLoop* loop, int* received_number, + const test::StructWithUnreachableTraitsImpl& passed) { + *received_number = passed.magic_number; + loop->Quit(); + }, + &loop, &received_number)); + loop.Run(); + EXPECT_EQ(kTestMagicNumber, received_number); +} + +} // namespace +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/pickle_unittest.cc b/mojo/public/cpp/bindings/tests/pickle_unittest.cc index 39f0572..afb553e 100644 --- a/mojo/public/cpp/bindings/tests/pickle_unittest.cc +++ b/mojo/public/cpp/bindings/tests/pickle_unittest.cc
@@ -172,6 +172,25 @@ return proxy; } + protected: + static void ForceMessageSerialization(bool forced) { + // Force messages to be serialized in this test since it intentionally + // exercises StructTraits logic. + Connector::OverrideDefaultSerializationBehaviorForTesting( + forced ? Connector::OutgoingSerializationMode::kEager + : Connector::OutgoingSerializationMode::kLazy, + Connector::IncomingSerializationMode::kDispatchAsIs); + } + + class ScopedForceMessageSerialization { + public: + ScopedForceMessageSerialization() { ForceMessageSerialization(true); } + ~ScopedForceMessageSerialization() { ForceMessageSerialization(false); } + + private: + DISALLOW_COPY_AND_ASSIGN(ScopedForceMessageSerialization); + }; + private: base::MessageLoop loop_; ChromiumPicklePasserImpl chromium_service_; @@ -311,6 +330,7 @@ } TEST_F(PickleTest, PickleArray) { + ScopedForceMessageSerialization force_serialization; auto proxy = ConnectToChromiumService(); auto pickles = std::vector<PickledStructChromium>(2); pickles[0].set_foo(1); @@ -342,6 +362,7 @@ } TEST_F(PickleTest, PickleArrayArray) { + ScopedForceMessageSerialization force_serialization; auto proxy = ConnectToChromiumService(); auto pickle_arrays = std::vector<std::vector<PickledStructChromium>>(2); for (size_t i = 0; i < 2; ++i) @@ -388,6 +409,7 @@ } TEST_F(PickleTest, PickleContainer) { + ScopedForceMessageSerialization force_serialization; auto proxy = ConnectToChromiumService(); PickleContainerPtr pickle_container = PickleContainer::New(); pickle_container->f_struct.set_foo(42);
diff --git a/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc b/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc index 3235770..711c1a9bd 100644 --- a/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc +++ b/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc
@@ -10,6 +10,7 @@ #include "mojo/edk/embedder/embedder.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/message.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/interfaces/bindings/tests/test_bad_messages.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -57,7 +58,7 @@ DISALLOW_COPY_AND_ASSIGN(TestBadMessagesImpl); }; -class ReportBadMessageTest : public testing::Test { +class ReportBadMessageTest : public BindingsTestBase { public: ReportBadMessageTest() {} @@ -88,13 +89,12 @@ error_handler_.Run(); } - base::MessageLoop message_loop; TestBadMessagesPtr proxy_; TestBadMessagesImpl impl_; base::Closure error_handler_; }; -TEST_F(ReportBadMessageTest, Request) { +TEST_P(ReportBadMessageTest, Request) { // Verify that basic immediate error reporting works. bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -102,7 +102,7 @@ EXPECT_TRUE(error); } -TEST_F(ReportBadMessageTest, RequestAsync) { +TEST_P(ReportBadMessageTest, RequestAsync) { bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -119,7 +119,7 @@ EXPECT_TRUE(error); } -TEST_F(ReportBadMessageTest, Response) { +TEST_P(ReportBadMessageTest, Response) { bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -137,7 +137,7 @@ EXPECT_TRUE(error); } -TEST_F(ReportBadMessageTest, ResponseAsync) { +TEST_P(ReportBadMessageTest, ResponseAsync) { bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -161,7 +161,7 @@ EXPECT_TRUE(error); } -TEST_F(ReportBadMessageTest, ResponseSync) { +TEST_P(ReportBadMessageTest, ResponseSync) { bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -173,7 +173,7 @@ EXPECT_TRUE(error); } -TEST_F(ReportBadMessageTest, ResponseSyncDeferred) { +TEST_P(ReportBadMessageTest, ResponseSyncDeferred) { bool error = false; SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); @@ -189,6 +189,8 @@ EXPECT_TRUE(error); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(ReportBadMessageTest); + } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/request_response_unittest.cc b/mojo/public/cpp/bindings/tests/request_response_unittest.cc index 43b8f0dc..3d330cd 100644 --- a/mojo/public/cpp/bindings/tests/request_response_unittest.cc +++ b/mojo/public/cpp/bindings/tests/request_response_unittest.cc
@@ -8,6 +8,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h" #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" @@ -82,18 +83,15 @@ closure.Run(); } -class RequestResponseTest : public testing::Test { +class RequestResponseTest : public BindingsTestBase { public: RequestResponseTest() {} ~RequestResponseTest() override { base::RunLoop().RunUntilIdle(); } void PumpMessages() { base::RunLoop().RunUntilIdle(); } - - private: - base::MessageLoop loop_; }; -TEST_F(RequestResponseTest, EchoString) { +TEST_P(RequestResponseTest, EchoString) { sample::ProviderPtr provider; ProviderImpl provider_impl(MakeRequest(&provider)); @@ -107,7 +105,7 @@ EXPECT_EQ(std::string("hello"), buf); } -TEST_F(RequestResponseTest, EchoStrings) { +TEST_P(RequestResponseTest, EchoStrings) { sample::ProviderPtr provider; ProviderImpl provider_impl(MakeRequest(&provider)); @@ -121,7 +119,7 @@ EXPECT_EQ(std::string("hello world"), buf); } -TEST_F(RequestResponseTest, EchoMessagePipeHandle) { +TEST_P(RequestResponseTest, EchoMessagePipeHandle) { sample::ProviderPtr provider; ProviderImpl provider_impl(MakeRequest(&provider)); @@ -139,7 +137,7 @@ EXPECT_EQ(std::string("hello"), value); } -TEST_F(RequestResponseTest, EchoEnum) { +TEST_P(RequestResponseTest, EchoEnum) { sample::ProviderPtr provider; ProviderImpl provider_impl(MakeRequest(&provider)); @@ -152,6 +150,8 @@ EXPECT_EQ(sample::Enum::VALUE, value); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(RequestResponseTest); + } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc index 1f95a27a..10fd32d 100644 --- a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
@@ -9,6 +9,7 @@ #include <string> #include <utility> +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -278,6 +279,8 @@ class SimpleMessageReceiver : public mojo::MessageReceiverWithResponder { public: + bool PrefersSerializedMessages() override { return true; } + bool Accept(mojo::Message* message) override { // Imagine some IPC happened here. @@ -302,9 +305,9 @@ } }; -using BindingsSampleTest = testing::Test; +using BindingsSampleTest = mojo::BindingsTestBase; -TEST_F(BindingsSampleTest, Basic) { +TEST_P(BindingsSampleTest, Basic) { SimpleMessageReceiver receiver; // User has a proxy to a Service somehow. @@ -326,7 +329,7 @@ delete service; } -TEST_F(BindingsSampleTest, DefaultValues) { +TEST_P(BindingsSampleTest, DefaultValues) { DefaultsTestPtr defaults(DefaultsTest::New()); EXPECT_EQ(-12, defaults->a0); EXPECT_EQ(kTwelve, defaults->a1); @@ -358,5 +361,7 @@ EXPECT_EQ(-0x123456789, defaults->a25); } +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(BindingsSampleTest); + } // namespace } // namespace sample
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits.typemap b/mojo/public/cpp/bindings/tests/struct_with_traits.typemap index 752ce44..8c7837d 100644 --- a/mojo/public/cpp/bindings/tests/struct_with_traits.typemap +++ b/mojo/public/cpp/bindings/tests/struct_with_traits.typemap
@@ -18,6 +18,7 @@ type_mappings = [ "mojo.test.EnumWithTraits=mojo::test::EnumWithTraitsImpl", "mojo.test.StructWithTraits=mojo::test::StructWithTraitsImpl", + "mojo.test.StructWithUnreachableTraits=mojo::test::StructWithUnreachableTraitsImpl", "mojo.test.NestedStructWithTraits=mojo::test::NestedStructWithTraitsImpl", "mojo.test.TrivialStructWithTraits=mojo::test::TrivialStructWithTraitsImpl[copyable_pass_by_value]", "mojo.test.MoveOnlyStructWithTraits=mojo::test::MoveOnlyStructWithTraitsImpl[move_only]",
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h index 7b007cc08..ce8a2293 100644 --- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h +++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h
@@ -98,6 +98,14 @@ std::map<std::string, NestedStructWithTraitsImpl> struct_map_; }; +// A type which corresponds nominally to the +// mojo::test::StructWithUnreachableTraits mojom type. Used to test that said +// type is never serialized, i.e. objects of this type are simply copied into +// a message as-is when written to an intra-process interface. +struct StructWithUnreachableTraitsImpl { + int32_t magic_number = 0; +}; + // A type which knows how to look like a mojo::test::TrivialStructWithTraits // mojom type by way of mojo::StructTraits. struct TrivialStructWithTraitsImpl {
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h index adcad8aa..3590bd55 100644 --- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h +++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
@@ -99,6 +99,22 @@ }; template <> +struct StructTraits<test::StructWithUnreachableTraitsDataView, + test::StructWithUnreachableTraitsImpl> { + public: + static bool ignore_me(const test::StructWithUnreachableTraitsImpl& input) { + NOTREACHED(); + return false; + } + + static bool Read(test::StructWithUnreachableTraitsDataView data, + test::StructWithUnreachableTraitsImpl* out) { + NOTREACHED(); + return false; + } +}; + +template <> struct StructTraits<test::TrivialStructWithTraitsDataView, test::TrivialStructWithTraitsImpl> { // Deserialization to test::TrivialStructTraitsImpl.
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc index 25bb9db..4cbffe2 100644 --- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -14,6 +14,7 @@ #include "base/threading/thread.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" #include "mojo/public/interfaces/bindings/tests/test_sync_methods.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -243,7 +244,9 @@ // The type parameter for SyncMethodCommonTests and // SyncMethodOnSequenceCommonTests for varying the Interface and whether to use // InterfacePtr or ThreadSafeInterfacePtr. -template <typename InterfaceT, bool use_thread_safe_ptr> +template <typename InterfaceT, + bool use_thread_safe_ptr, + BindingsTestSerializationMode serialization_mode> struct TestParams { using Interface = InterfaceT; static const bool kIsThreadSafeInterfacePtrTest = use_thread_safe_ptr; @@ -256,6 +259,9 @@ return PtrWrapper<Interface>(std::move(ptr)); } } + + static const BindingsTestSerializationMode kSerializationMode = + serialization_mode; }; template <typename Interface> @@ -309,11 +315,15 @@ base::test::ScopedTaskEnvironment task_environment; }; -template <typename T> +template <typename TypeParam> class SyncMethodCommonTest : public SyncMethodTest { public: SyncMethodCommonTest() {} ~SyncMethodCommonTest() override {} + + void SetUp() override { + BindingsTestBase::SetupSerializationBehavior(TypeParam::kSerializationMode); + } }; class SyncMethodAssociatedTest : public SyncMethodTest { @@ -445,6 +455,7 @@ class SyncMethodOnSequenceCommonTest : public SequencedTaskRunnerTestBase { public: void SetUp() override { + BindingsTestBase::SetupSerializationBehavior(TypeParam::kSerializationMode); impl_ = base::MakeUnique<ImplTypeFor<typename TypeParam::Interface>>( MakeRequest(&ptr_)); } @@ -468,11 +479,42 @@ // interfaces) exercise MultiplexRouter with different configurations. // Each test is run once with an InterfacePtr and once with a // ThreadSafeInterfacePtr to ensure that they behave the same with respect to -// sync calls. -using InterfaceTypes = testing::Types<TestParams<TestSync, true>, - TestParams<TestSync, false>, - TestParams<TestSyncMaster, true>, - TestParams<TestSyncMaster, false>>; +// sync calls. Finally, all such combinations are tested in different message +// serialization modes. +using InterfaceTypes = testing::Types< + TestParams<TestSync, + true, + BindingsTestSerializationMode::kSerializeBeforeSend>, + TestParams<TestSync, + false, + BindingsTestSerializationMode::kSerializeBeforeSend>, + TestParams<TestSyncMaster, + true, + BindingsTestSerializationMode::kSerializeBeforeSend>, + TestParams<TestSyncMaster, + false, + BindingsTestSerializationMode::kSerializeBeforeSend>, + TestParams<TestSync, + true, + BindingsTestSerializationMode::kSerializeBeforeDispatch>, + TestParams<TestSync, + false, + BindingsTestSerializationMode::kSerializeBeforeDispatch>, + TestParams<TestSyncMaster, + true, + BindingsTestSerializationMode::kSerializeBeforeDispatch>, + TestParams<TestSyncMaster, + false, + BindingsTestSerializationMode::kSerializeBeforeDispatch>, + TestParams<TestSync, true, BindingsTestSerializationMode::kNeverSerialize>, + TestParams<TestSync, false, BindingsTestSerializationMode::kNeverSerialize>, + TestParams<TestSyncMaster, + true, + BindingsTestSerializationMode::kNeverSerialize>, + TestParams<TestSyncMaster, + false, + BindingsTestSerializationMode::kNeverSerialize>>; + TYPED_TEST_CASE(SyncMethodCommonTest, InterfaceTypes); TYPED_TEST_CASE(SequencedTaskRunnerTestLauncher, InterfaceTypes);
diff --git a/mojo/public/cpp/bindings/thread_safe_interface_ptr.h b/mojo/public/cpp/bindings/thread_safe_interface_ptr.h index f8d072d..c15c6e3 100644 --- a/mojo/public/cpp/bindings/thread_safe_interface_ptr.h +++ b/mojo/public/cpp/bindings/thread_safe_interface_ptr.h
@@ -74,6 +74,13 @@ private: // MessageReceiverWithResponder implementation: + bool PrefersSerializedMessages() override { + // TSIP is primarily used because it emulates legacy IPC threading behavior. + // In practice this means it's only for cross-process messaging and we can + // just always assume messages should be serialized. + return true; + } + bool Accept(Message* message) override { if (!message->associated_endpoint_handles()->empty()) { // If this DCHECK fails, it is likely because:
diff --git a/mojo/public/cpp/system/BUILD.gn b/mojo/public/cpp/system/BUILD.gn index 9513aeb..5dbbd36 100644 --- a/mojo/public/cpp/system/BUILD.gn +++ b/mojo/public/cpp/system/BUILD.gn
@@ -29,6 +29,8 @@ "data_pipe.h", "functions.h", "handle.h", + "handle_signal_tracker.cc", + "handle_signal_tracker.h", "handle_signals_state.h", "message.h", "message_pipe.cc",
diff --git a/mojo/public/cpp/system/handle_signal_tracker.cc b/mojo/public/cpp/system/handle_signal_tracker.cc new file mode 100644 index 0000000..37b2c93 --- /dev/null +++ b/mojo/public/cpp/system/handle_signal_tracker.cc
@@ -0,0 +1,66 @@ +// 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 "mojo/public/cpp/system/handle_signal_tracker.h" + +#include "base/synchronization/lock.h" +#include "mojo/public/cpp/system/handle_signals_state.h" + +namespace mojo { + +HandleSignalTracker::HandleSignalTracker(Handle handle, + MojoHandleSignals signals) + : high_watcher_(FROM_HERE, SimpleWatcher::ArmingPolicy::MANUAL), + low_watcher_(FROM_HERE, SimpleWatcher::ArmingPolicy::MANUAL) { + MojoResult rv = high_watcher_.Watch( + handle, signals, MOJO_WATCH_CONDITION_SATISFIED, + base::Bind(&HandleSignalTracker::OnNotify, base::Unretained(this))); + DCHECK_EQ(MOJO_RESULT_OK, rv); + + rv = low_watcher_.Watch( + handle, signals, MOJO_WATCH_CONDITION_NOT_SATISFIED, + base::Bind(&HandleSignalTracker::OnNotify, base::Unretained(this))); + DCHECK_EQ(MOJO_RESULT_OK, rv); + + last_known_state_ = handle.QuerySignalsState(); + + Arm(); +} + +HandleSignalTracker::~HandleSignalTracker() = default; + +void HandleSignalTracker::Arm() { + // Arm either the low watcher or high watcher. We cycle until one of them + // succeeds, which should almost always happen within two iterations. + bool arm_low_watcher = true; + for (;;) { + MojoResult ready_result; + SimpleWatcher& watcher = arm_low_watcher ? low_watcher_ : high_watcher_; + MojoResult result = watcher.Arm(&ready_result, &last_known_state_); + if (result == MOJO_RESULT_OK) { + // Successfully armed one of the watchers, so we can go back to waiting + // for a notification. + return; + } + + DCHECK_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); + if (ready_result == MOJO_RESULT_FAILED_PRECONDITION && !arm_low_watcher) { + // The high watcher failed to arm because the watched signal will never + // be satisfied again. We can also return in this case, and + // |last_known_state_| will remain with its current value indefinitely. + return; + } + arm_low_watcher = !arm_low_watcher; + } +} + +void HandleSignalTracker::OnNotify(MojoResult result, + const HandleSignalsState& state) { + last_known_state_ = state; + Arm(); + if (notification_callback_) + notification_callback_.Run(state); +} + +} // namespace mojo
diff --git a/mojo/public/cpp/system/handle_signal_tracker.h b/mojo/public/cpp/system/handle_signal_tracker.h new file mode 100644 index 0000000..7df6b7f --- /dev/null +++ b/mojo/public/cpp/system/handle_signal_tracker.h
@@ -0,0 +1,69 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_SYSTEM_HANDLE_SIGNAL_TRACKER_H_ +#define MOJO_PUBLIC_CPP_SYSTEM_HANDLE_SIGNAL_TRACKER_H_ + +#include "base/callback.h" +#include "base/macros.h" +#include "mojo/public/c/system/types.h" +#include "mojo/public/cpp/system/handle.h" +#include "mojo/public/cpp/system/simple_watcher.h" +#include "mojo/public/cpp/system/system_export.h" + +namespace mojo { + +// This class helps track the state of specific signal on a handle so that +// the user doesn't have to manually query the signal state every time they +// want to know the handle's state. +// +// Usage of this class is specifically targeting cases where the signal state +// changes infrequently but must be queried frequently. If either condition does +// not hold, consider using Handle::QuerySignalsState (or +// MojoQueryHandleSignalsState) directly instead. +class MOJO_CPP_SYSTEM_EXPORT HandleSignalTracker { + public: + using NotificationCallback = + base::Callback<void(const HandleSignalsState& signals_state)>; + + // Constructs a tracker which tracks |signals| on |handle|. |signals| may + // be any single signal flag or any combination of signal flags. + HandleSignalTracker(Handle handle, MojoHandleSignals signals); + ~HandleSignalTracker(); + + const HandleSignalsState& last_known_state() const { + return last_known_state_; + } + + // Sets an optional callback to be invoked any time the tracker is notified of + // a relevant state change. + void set_notification_callback(const NotificationCallback& callback) { + notification_callback_ = callback; + } + + private: + class State; + + void Arm(); + void OnNotify(MojoResult result, const HandleSignalsState& state); + + NotificationCallback notification_callback_; + + // The last known signaliing state of the handle. + HandleSignalsState last_known_state_ = {0, 0}; + + // Watches for the signal(s) to be signaled. May only be armed when + // |low_watcher_| is not. + SimpleWatcher high_watcher_; + + // Watches for the signal(s) to be cleared. May only be armed when + // |high_watcher_| is not. + SimpleWatcher low_watcher_; + + DISALLOW_COPY_AND_ASSIGN(HandleSignalTracker); +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_SIGNAL_TRACKER_H_
diff --git a/mojo/public/cpp/system/simple_watcher.cc b/mojo/public/cpp/system/simple_watcher.cc index a8b5a0d..3654a0e5 100644 --- a/mojo/public/cpp/system/simple_watcher.cc +++ b/mojo/public/cpp/system/simple_watcher.cc
@@ -96,17 +96,19 @@ return; } + HandleSignalsState state(signals_state.satisfied_signals, + signals_state.satisfiable_signals); if ((flags & MOJO_WATCHER_NOTIFICATION_FLAG_FROM_SYSTEM) && task_runner_->RunsTasksInCurrentSequence() && weak_watcher_ && weak_watcher_->is_default_task_runner_) { // System notifications will trigger from the task runner passed to // mojo::edk::ScopedIPCSupport. In Chrome this happens to always be the // default task runner for the IO thread. - weak_watcher_->OnHandleReady(watch_id_, result); + weak_watcher_->OnHandleReady(watch_id_, result, state); } else { task_runner_->PostTask( FROM_HERE, base::Bind(&SimpleWatcher::OnHandleReady, weak_watcher_, - watch_id_, result)); + watch_id_, result, state)); } } @@ -148,7 +150,7 @@ MojoResult SimpleWatcher::Watch(Handle handle, MojoHandleSignals signals, MojoWatchCondition condition, - const ReadyCallback& callback) { + const ReadyCallbackWithState& callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!IsWatching()); DCHECK(!callback.is_null()); @@ -203,15 +205,19 @@ DCHECK(rv == MOJO_RESULT_OK || rv == MOJO_RESULT_NOT_FOUND); } -MojoResult SimpleWatcher::Arm(MojoResult* ready_result) { +MojoResult SimpleWatcher::Arm(MojoResult* ready_result, + HandleSignalsState* ready_state) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); uint32_t num_ready_contexts = 1; uintptr_t ready_context; MojoResult local_ready_result; - MojoHandleSignalsState ready_state; + HandleSignalsState local_ready_state; + if (!ready_state) + ready_state = &local_ready_state; MojoResult rv = MojoArmWatcher(watcher_handle_.get().value(), &num_ready_contexts, - &ready_context, &local_ready_result, &ready_state); + &ready_context, &local_ready_result, + reinterpret_cast<MojoHandleSignalsState*>(ready_state)); if (rv == MOJO_RESULT_FAILED_PRECONDITION) { DCHECK(context_); DCHECK_EQ(1u, num_ready_contexts); @@ -231,17 +237,21 @@ return; MojoResult ready_result; - MojoResult rv = Arm(&ready_result); + HandleSignalsState ready_state; + MojoResult rv = Arm(&ready_result, &ready_state); if (rv == MOJO_RESULT_OK) return; DCHECK_EQ(MOJO_RESULT_FAILED_PRECONDITION, rv); - task_runner_->PostTask(FROM_HERE, base::Bind(&SimpleWatcher::OnHandleReady, - weak_factory_.GetWeakPtr(), - watch_id_, ready_result)); + task_runner_->PostTask( + FROM_HERE, + base::Bind(&SimpleWatcher::OnHandleReady, weak_factory_.GetWeakPtr(), + watch_id_, ready_result, ready_state)); } -void SimpleWatcher::OnHandleReady(int watch_id, MojoResult result) { +void SimpleWatcher::OnHandleReady(int watch_id, + MojoResult result, + const HandleSignalsState& state) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // This notification may be for a previously watched context, in which case @@ -249,7 +259,7 @@ if (watch_id != watch_id_) return; - ReadyCallback callback = callback_; + ReadyCallbackWithState callback = callback_; if (result == MOJO_RESULT_CANCELLED) { // Implicit cancellation due to someone closing the watched handle. We clear // the SimppleWatcher's state before dispatching this. @@ -263,7 +273,7 @@ TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION event(heap_profiler_tag_); base::WeakPtr<SimpleWatcher> weak_self = weak_factory_.GetWeakPtr(); - callback.Run(result); + callback.Run(result, state); if (!weak_self) return;
diff --git a/mojo/public/cpp/system/simple_watcher.h b/mojo/public/cpp/system/simple_watcher.h index 86e38ecd..a697e46 100644 --- a/mojo/public/cpp/system/simple_watcher.h +++ b/mojo/public/cpp/system/simple_watcher.h
@@ -5,6 +5,7 @@ #ifndef MOJO_PUBLIC_CPP_SYSTEM_SIMPLE_WATCHER_H_ #define MOJO_PUBLIC_CPP_SYSTEM_SIMPLE_WATCHER_H_ +#include "base/bind.h" #include "base/callback.h" #include "base/location.h" #include "base/macros.h" @@ -13,6 +14,7 @@ #include "base/sequence_checker.h" #include "base/threading/sequenced_task_runner_handle.h" #include "mojo/public/c/system/types.h" +#include "mojo/public/cpp/system/handle_signals_state.h" #include "mojo/public/cpp/system/system_export.h" #include "mojo/public/cpp/system/watcher.h" @@ -50,6 +52,11 @@ // with |MOJO_RESULT_CANCELLED| even while the SimpleWatcher is disarmed. using ReadyCallback = base::Callback<void(MojoResult result)>; + // Like above but also receives the last known handle signal state at the time + // of the notification. + using ReadyCallbackWithState = + base::Callback<void(MojoResult result, const HandleSignalsState& state)>; + // Selects how this SimpleWatcher is to be armed. enum class ArmingPolicy { // The SimpleWatcher is armed automatically on Watch() and rearmed again @@ -112,13 +119,18 @@ MojoResult Watch(Handle handle, MojoHandleSignals signals, MojoWatchCondition condition, - const ReadyCallback& callback); + const ReadyCallbackWithState& callback); // DEPRECATED: Please use the above signature instead. + // + // This watches a handle for |signals| to be satisfied, provided with a + // callback which takes only a MojoResult value corresponding to the result of + // a notification. MojoResult Watch(Handle handle, MojoHandleSignals signals, const ReadyCallback& callback) { - return Watch(handle, signals, MOJO_WATCH_CONDITION_SATISFIED, callback); + return Watch(handle, signals, MOJO_WATCH_CONDITION_SATISFIED, + base::Bind(&DiscardReadyState, callback)); } // Cancels the current watch. Once this returns, the ReadyCallback previously @@ -143,11 +155,14 @@ // is NOT armed, and this call fails with a return value of // |MOJO_RESULT_FAILED_PRECONDITION|. In that case, what would have been the // result code for that immediate notification is instead placed in - // |*ready_result| if |ready_result| is non-null. + // |*ready_result| if |ready_result| is non-null, and the last known signaling + // state of the handle is placed in |*ready_state| if |ready_state| is + // non-null. // // If the watcher is successfully armed, this returns |MOJO_RESULT_OK| and - // |ready_result| is ignored. - MojoResult Arm(MojoResult* ready_result = nullptr); + // |ready_result| and |ready_state| are ignored. + MojoResult Arm(MojoResult* ready_result = nullptr, + HandleSignalsState* ready_state = nullptr); // Manually arms the SimpleWatcher OR posts a task to invoke the ReadyCallback // with the ready result of the failed arming attempt. @@ -161,7 +176,7 @@ void ArmOrNotify(); Handle handle() const { return handle_; } - ReadyCallback ready_callback() const { return callback_; } + ReadyCallbackWithState ready_callback() const { return callback_; } // Sets the tag used by the heap profiler. // |tag| must be a const string literal. @@ -172,7 +187,15 @@ private: class Context; - void OnHandleReady(int watch_id, MojoResult result); + static void DiscardReadyState(const ReadyCallback& callback, + MojoResult result, + const HandleSignalsState& state) { + callback.Run(result); + } + + void OnHandleReady(int watch_id, + MojoResult result, + const HandleSignalsState& state); SEQUENCE_CHECKER(sequence_checker_); @@ -203,7 +226,7 @@ int watch_id_ = 0; // The callback to call when the handle is signaled. - ReadyCallback callback_; + ReadyCallbackWithState callback_; // Tracks if the SimpleWatcher has already notified of unsatisfiability. This // is used to prevent redundant notifications in AUTOMATIC mode.
diff --git a/mojo/public/cpp/system/tests/BUILD.gn b/mojo/public/cpp/system/tests/BUILD.gn index 705d009c..2cfa209 100644 --- a/mojo/public/cpp/system/tests/BUILD.gn +++ b/mojo/public/cpp/system/tests/BUILD.gn
@@ -7,6 +7,7 @@ sources = [ "core_unittest.cc", + "handle_signal_tracker_unittest.cc", "handle_signals_state_unittest.cc", "simple_watcher_unittest.cc", "wait_set_unittest.cc", @@ -15,6 +16,7 @@ deps = [ "//base", + "//base/test:test_support", "//mojo/public/c/system/tests", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils",
diff --git a/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc b/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc new file mode 100644 index 0000000..b9922ac --- /dev/null +++ b/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc
@@ -0,0 +1,116 @@ +// 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 "mojo/public/cpp/system/handle_signal_tracker.h" + +#include "base/macros.h" +#include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" +#include "mojo/public/cpp/system/message_pipe.h" +#include "mojo/public/cpp/system/wait.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { +namespace { + +class HandleSignalTrackerTest : public testing::Test { + public: + HandleSignalTrackerTest() {} + ~HandleSignalTrackerTest() override {} + + void WaitForNextNotification(HandleSignalTracker* tracker) { + base::RunLoop loop; + tracker->set_notification_callback(base::Bind( + [](base::RunLoop* loop, const HandleSignalsState& signals_state) { + loop->Quit(); + }, + &loop)); + loop.Run(); + tracker->set_notification_callback( + HandleSignalTracker::NotificationCallback()); + } + + private: + base::test::ScopedTaskEnvironment task_environment_; + + DISALLOW_COPY_AND_ASSIGN(HandleSignalTrackerTest); +}; + +TEST_F(HandleSignalTrackerTest, StartsWithCorrectState) { + MessagePipe pipe; + { + HandleSignalTracker tracker(pipe.handle0.get(), + MOJO_HANDLE_SIGNAL_READABLE); + EXPECT_FALSE(tracker.last_known_state().readable()); + } + + WriteMessageRaw(pipe.handle1.get(), "hi", 2, nullptr, 0, + MOJO_WRITE_MESSAGE_FLAG_NONE); + Wait(pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, + MOJO_WATCH_CONDITION_SATISFIED); + + { + HandleSignalTracker tracker(pipe.handle0.get(), + MOJO_HANDLE_SIGNAL_READABLE); + EXPECT_TRUE(tracker.last_known_state().readable()); + } +} + +TEST_F(HandleSignalTrackerTest, BasicTracking) { + MessagePipe pipe; + HandleSignalTracker tracker(pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE); + EXPECT_FALSE(tracker.last_known_state().readable()); + + WriteMessageRaw(pipe.handle1.get(), "hi", 2, nullptr, 0, + MOJO_WRITE_MESSAGE_FLAG_NONE); + WaitForNextNotification(&tracker); + EXPECT_TRUE(tracker.last_known_state().readable()); + + std::vector<uint8_t> bytes; + ReadMessageRaw(pipe.handle0.get(), &bytes, nullptr, + MOJO_READ_MESSAGE_FLAG_NONE); + WaitForNextNotification(&tracker); + EXPECT_FALSE(tracker.last_known_state().readable()); +} + +TEST_F(HandleSignalTrackerTest, DoesntUpdateOnIrrelevantChanges) { + MessagePipe pipe; + HandleSignalTracker readable_tracker(pipe.handle0.get(), + MOJO_HANDLE_SIGNAL_READABLE); + HandleSignalTracker peer_closed_tracker(pipe.handle0.get(), + MOJO_HANDLE_SIGNAL_PEER_CLOSED); + EXPECT_FALSE(readable_tracker.last_known_state().readable()); + EXPECT_FALSE(peer_closed_tracker.last_known_state().peer_closed()); + + WriteMessageRaw(pipe.handle1.get(), "hi", 2, nullptr, 0, + MOJO_WRITE_MESSAGE_FLAG_NONE); + WaitForNextNotification(&readable_tracker); + EXPECT_TRUE(readable_tracker.last_known_state().readable()); + EXPECT_FALSE(readable_tracker.last_known_state().peer_closed()); + + // Closing the peer won't change the |readable_tracker|'s state since there's + // still an unread message. Therefore the tracker's last known state should + // continue to reflect the state prior to peer closure even after the handle's + // signals state has updated. + pipe.handle1.reset(); + WaitForNextNotification(&peer_closed_tracker); + EXPECT_TRUE(pipe.handle0->QuerySignalsState().peer_closed()); + EXPECT_TRUE(peer_closed_tracker.last_known_state().peer_closed()); + EXPECT_FALSE(readable_tracker.last_known_state().peer_closed()); + + // Now read the message, which will ultimately trigger the pipe becoming + // unreadable. + std::vector<uint8_t> bytes; + ReadMessageRaw(pipe.handle0.get(), &bytes, nullptr, + MOJO_READ_MESSAGE_FLAG_NONE); + WaitForNextNotification(&readable_tracker); + EXPECT_FALSE(readable_tracker.last_known_state().readable()); + + // And note that the |peer_closed_tracker| should not have seen the readable + // state change above since it's not relevant to its tracked signal. + EXPECT_TRUE(peer_closed_tracker.last_known_state().readable()); +} + +} // namespace +} // namespace mojo
diff --git a/mojo/public/interfaces/bindings/tests/BUILD.gn b/mojo/public/interfaces/bindings/tests/BUILD.gn index fade413..fdda16d 100644 --- a/mojo/public/interfaces/bindings/tests/BUILD.gn +++ b/mojo/public/interfaces/bindings/tests/BUILD.gn
@@ -71,6 +71,8 @@ # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. use_once_callback = false + + support_lazy_serialization = true } component("test_export_component") { @@ -191,6 +193,8 @@ # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. use_once_callback = false + + support_lazy_serialization = true } mojom("test_associated_interfaces") {
diff --git a/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom index f53a188..b3797239 100644 --- a/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom +++ b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom
@@ -29,6 +29,10 @@ map<string, NestedStructWithTraits> f_struct_map; }; +struct StructWithUnreachableTraits { + bool ignore_me; +}; + // Test that this container can be cloned. struct StructWithTraitsContainer { StructWithTraits f_struct; @@ -82,6 +86,11 @@ EchoUnionWithTraits(UnionWithTraits u) => (UnionWithTraits passed); }; +interface TestUnserializedStruct { + PassUnserializedStruct(StructWithUnreachableTraits s) + => (StructWithUnreachableTraits passed); +}; + // Test that specifying default value for a typemapped enum field works. struct EnumWithTraitsContainer { EnumWithTraits f_field = EnumWithTraits.VALUE_1;
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl index 941820ae..e105918c 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -30,13 +30,6 @@ {%- endfor %} {%- endmacro %} -{%- macro build_message(struct, input_pattern, struct_display_name, - serialization_context, message) -%} - {{struct_macros.serialize(struct, struct_display_name, input_pattern, - "params", "(%s)->payload_buffer()"|format(message), - serialization_context)}} -{%- endmacro %} - {#--- Begin #} const char {{class_name}}::Name_[] = "{{namespace_as_string}}::{{class_name}}"; @@ -85,23 +78,6 @@ {%- endfor -%} DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_HandleSyncResponse); }; -bool {{class_name}}_{{method.name}}_HandleSyncResponse::Accept( - mojo::Message* message) { - internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = - reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_Data*>( - message->mutable_payload()); - -{%- set desc = class_name~"::"~method.name~" response" %} - {{alloc_params(method.response_param_struct, "params", "message", desc)}} - -{%- for param in method.response_parameters %} - *out_{{param.name}}_ = std::move(p_{{param.name}}); -{%- endfor %} - mojo::internal::SyncMessageResponseSetup::SetCurrentSyncResponseMessage( - message); - *result_ = true; - return true; -} {%- endif %} class {{class_name}}_{{method.name}}_ForwardToCallback @@ -120,20 +96,6 @@ {{class_name}}::{{method.name}}Callback callback_; DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ForwardToCallback); }; -bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept( - mojo::Message* message) { - internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = - reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_Data*>( - message->mutable_payload()); - -{%- set desc = class_name~"::"~method.name~" response" %} - {{alloc_params(method.response_param_struct, "params", "message", desc)}} - if (!callback_.is_null()) { - mojo::internal::MessageDispatchContext context(message); - std::move(callback_).Run({{pass_params(method.response_parameters)}}); - } - return true; -} {%- endif %} {%- endfor %} @@ -149,19 +111,34 @@ {%- set params_struct = method.param_struct %} {%- set params_description = "%s.%s request"|format(interface.name, method.name) %} +{%- set message_typename = "%s_%s_Message"|format(proxy_name, method.name) %} + +{%- if method|method_supports_lazy_serialization %} +{{interface_macros.define_message_type( + interface, message_typename, message_name, False, method, method.parameters, + params_struct, params_description, use_once_callback)}} +{%- endif %} + {%- if method.sync %} bool {{proxy_name}}::{{method.name}}( {{interface_macros.declare_sync_method_params("param_", method)}}) { - mojo::internal::SerializationContext serialization_context; - {{struct_macros.get_serialized_size(params_struct, "param_%s", - "&serialization_context")}} + const bool kExpectsResponse = true; + const bool kIsSync = true; +{%- if method|method_supports_lazy_serialization %} + const bool kSerialize = receiver_->PrefersSerializedMessages(); + auto message = {{message_typename}}::Build( + kSerialize, kExpectsResponse, kIsSync +{%- for param in method.parameters -%} + , std::move(param_{{param.name}}) +{%- endfor %}); +{%- else %} mojo::Message message; - serialization_context.PrepareMessage( - {{message_name}}, - mojo::Message::kFlagIsSync | mojo::Message::kFlagExpectsResponse, size, - &message); - {{build_message(params_struct, "param_%s", params_description, - "&serialization_context", "&message")}} + {{interface_macros.build_message_flags(False, "kIsSync", "kExpectsResponse", + "kFlags")}} + {{interface_macros.build_serialized_message( + message_name, "param_%s", params_struct, params_description, "kFlags", + "&message")}} +{%- endif %} bool result = false; std::unique_ptr<mojo::MessageReceiver> responder( @@ -177,19 +154,27 @@ void {{proxy_name}}::{{method.name}}( {{interface_macros.declare_request_params("in_", method, use_once_callback)}}) { - mojo::internal::SerializationContext serialization_context; - {{struct_macros.get_serialized_size(params_struct, "in_%s", - "&serialization_context")}} {%- if method.response_parameters != None %} - constexpr uint32_t kFlags = mojo::Message::kFlagExpectsResponse; + const bool kExpectsResponse = true; {%- else %} - constexpr uint32_t kFlags = 0; + const bool kExpectsResponse = false; {%- endif %} + const bool kIsSync = false; +{%- if method|method_supports_lazy_serialization %} + const bool kSerialize = receiver_->PrefersSerializedMessages(); + auto message = {{message_typename}}::Build( + kSerialize, kExpectsResponse, kIsSync +{%- for param in method.parameters -%} + , std::move(in_{{param.name}}) +{%- endfor %}); +{%- else %} mojo::Message message; - serialization_context.PrepareMessage({{message_name}}, kFlags, size, - &message); - {{build_message(params_struct, "in_%s", params_description, - "&serialization_context", "&message")}} + {{interface_macros.build_message_flags(False, "kIsSync", "kExpectsResponse", + "kFlags")}} + {{interface_macros.build_serialized_message( + message_name, "in_%s", params_struct, params_description, "kFlags", + "&message")}} +{%- endif %} {%- if method.response_parameters != None %} std::unique_ptr<mojo::MessageReceiver> responder( @@ -212,6 +197,8 @@ {%- set response_params_struct = method.response_param_struct %} {%- set params_description = "%s.%s response"|format(interface.name, method.name) %} +{%- set response_message_typename = + "%s_%s_Response_Message"|format(interface.name, method.name) %} class {{class_name}}_{{method.name}}_ProxyToResponder { public: static {{class_name}}::{{method.name}}Callback CreateCallback( @@ -250,8 +237,7 @@ } void Run( - {{interface_macros.declare_responder_params( - "in_", method.response_parameters, for_blink)}}); + {{interface_macros.declare_params("in_", method.response_parameters)}}); uint64_t request_id_; bool is_sync_; @@ -260,18 +246,62 @@ DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); }; +{%- if method|method_supports_lazy_serialization %} +{{interface_macros.define_message_type( + interface, response_message_typename, message_name, True, method, + method.response_parameters, response_params_struct, params_description, + use_once_callback)}} +{%- endif %} + +bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept( + mojo::Message* message) { +{%- if method|method_supports_lazy_serialization %} + mojo::internal::MessageDispatchContext dispatch_context(message); + if (!message->is_serialized()) { + auto context = + message->TakeUnserializedContext<{{response_message_typename}}>(); + if (!context) { + // The Message was not of the expected type. It may be a valid message + // which was build using a different variant of these bindings. Force + // serialization before dispatch in this case. + message->SerializeIfNecessary(); + } else { + if (!callback_.is_null()) + context->Dispatch(&callback_); + return true; + } + } +{%- endif %} + + DCHECK(message->is_serialized()); + internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = + reinterpret_cast< + internal::{{class_name}}_{{method.name}}_ResponseParams_Data*>( + message->mutable_payload()); + +{%- set desc = class_name~"::"~method.name~" response" %} + {{alloc_params(method.response_param_struct, "params", "message", desc)}} + if (!callback_.is_null()) + std::move(callback_).Run({{pass_params(method.response_parameters)}}); + return true; +} + void {{class_name}}_{{method.name}}_ProxyToResponder::Run( - {{interface_macros.declare_responder_params( - "in_", method.response_parameters, for_blink)}}) { - mojo::internal::SerializationContext serialization_context; - {{struct_macros.get_serialized_size(response_params_struct, "in_%s", - "&serialization_context")}} - uint32_t flags = (is_sync_ ? mojo::Message::kFlagIsSync : 0) | - mojo::Message::kFlagIsResponse; + {{interface_macros.declare_params("in_", method.response_parameters)}}) { +{%- if method|method_supports_lazy_serialization %} + const bool kSerialize = responder_->PrefersSerializedMessages(); + auto message = {{response_message_typename}}::Build(kSerialize, is_sync_ +{%- for param in method.response_parameters -%} + , std::move(in_{{param.name}}) +{%- endfor %}); +{%- else %} mojo::Message message; - serialization_context.PrepareMessage({{message_name}}, flags, size, &message); - {{build_message(response_params_struct, "in_%s", params_description, - "&serialization_context", "&message")}} + {{interface_macros.build_message_flags(True, "is_sync_", "false", "kFlags")}} + {{interface_macros.build_serialized_message( + message_name, "in_%s", response_params_struct, + response_params_description, "kFlags", "&message")}} +{%- endif %} + message.set_request_id(request_id_); ignore_result(responder_->Accept(&message)); // TODO(darin): Accept() returning false indicates a malformed message, and @@ -280,6 +310,51 @@ responder_ = nullptr; } {%- endif -%} + +{%- if method.sync %} +bool {{class_name}}_{{method.name}}_HandleSyncResponse::Accept( + mojo::Message* message) { +{%- if method|method_supports_lazy_serialization %} + if (!message->is_serialized()) { + auto context = + message->TakeUnserializedContext<{{response_message_typename}}>(); + if (!context) { + // The Message was not of the expected type. It may be a valid message + // which was built using a different variant of these bindings. Force + // serialization before dispatch in this case. + message->SerializeIfNecessary(); + } else { + context->HandleSyncResponse( +{%- for param in method.response_parameters %} + out_{{param.name}}_ +{%- if not loop.last -%}, {% endif -%} +{%- endfor %}); + *result_ = true; + mojo::internal::SyncMessageResponseSetup::SetCurrentSyncResponseMessage( + message); + return true; + } + } +{%- endif %} + + DCHECK(message->is_serialized()); + internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = + reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_Data*>( + message->mutable_payload()); + +{%- set desc = class_name~"::"~method.name~" response" %} + {{alloc_params(method.response_param_struct, "params", "message", desc)}} + +{%- for param in method.response_parameters %} + *out_{{param.name}}_ = std::move(p_{{param.name}}); +{%- endfor %} + mojo::internal::SyncMessageResponseSetup::SetCurrentSyncResponseMessage( + message); + *result_ = true; + return true; +} +{%- endif %} + {%- endfor %} {#--- StubDispatch definition #} @@ -293,6 +368,24 @@ {%- for method in interface.methods %} case internal::k{{class_name}}_{{method.name}}_Name: { {%- if method.response_parameters == None %} + mojo::internal::MessageDispatchContext context(message); +{%- if method|method_supports_lazy_serialization %} + if (!message->is_serialized()) { + auto context = message->TakeUnserializedContext< + {{proxy_name}}_{{method.name}}_Message>(); + if (!context) { + // The Message was not of the expected type. It may be a valid message + // which was serialized using a different variant of these bindings. + // Force serialization before dispatch in this case. + message->SerializeIfNecessary(); + } else { + context->Dispatch(impl); + return true; + } + } +{%- endif %} + + DCHECK(message->is_serialized()); internal::{{class_name}}_{{method.name}}_Params_Data* params = reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*>( message->mutable_payload()); @@ -302,7 +395,6 @@ indent(4)}} // A null |impl| means no implementation was bound. assert(impl); - mojo::internal::MessageDispatchContext context(message); impl->{{method.name}}({{pass_params(method.parameters)}}); return true; {%- else %} @@ -325,9 +417,32 @@ {%- for method in interface.methods %} case internal::k{{class_name}}_{{method.name}}_Name: { {%- if method.response_parameters != None %} + mojo::internal::MessageDispatchContext context(message); +{%- if method|method_supports_lazy_serialization %} + if (!message->is_serialized()) { + auto context = message->TakeUnserializedContext< + {{proxy_name}}_{{method.name}}_Message>(); + if (!context) { + // The Message was not of the expected type. It may be a valid message + // which was built using a different variant of these bindings. Force + // serialization before dispatch in this case. + message->SerializeIfNecessary(); + } else { + {{class_name}}::{{method.name}}Callback callback = + {{class_name}}_{{method.name}}_ProxyToResponder::CreateCallback( + message->request_id(), + message->has_flag(mojo::Message::kFlagIsSync), + std::move(responder)); + context->Dispatch(impl, std::move(callback)); + return true; + } + } +{%- endif %} + internal::{{class_name}}_{{method.name}}_Params_Data* params = - reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*>( - message->mutable_payload()); + reinterpret_cast< + internal::{{class_name}}_{{method.name}}_Params_Data*>( + message->mutable_payload()); {%- set desc = class_name~"::"~method.name %} {{alloc_params(method.param_struct, "params", "message", desc)| @@ -339,7 +454,6 @@ std::move(responder)); // A null |impl| means no implementation was bound. assert(impl); - mojo::internal::MessageDispatchContext context(message); impl->{{method.name}}( {%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}std::move(callback)); return true; @@ -356,7 +470,7 @@ {#--- Request validator definitions #} bool {{class_name}}RequestValidator::Accept(mojo::Message* message) { - if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) + if (mojo::internal::IsUnserializedOrControlMessage(message)) return true; mojo::internal::ValidationContext validation_context( @@ -400,7 +514,7 @@ {#--- Response validator definitions #} {% if interface|has_callbacks %} bool {{class_name}}ResponseValidator::Accept(mojo::Message* message) { - if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) + if (mojo::internal::IsUnserializedOrControlMessage(message)) return true; mojo::internal::ValidationContext validation_context(
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl index 8649273..9e479b7b 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl
@@ -1,11 +1,6 @@ -{%- macro declare_params(prefix, parameters) %} -{%- for param in parameters -%} -{{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} -{%- if not loop.last %}, {% endif %} -{%- endfor %} -{%- endmacro %} +{%- import "struct_macros.tmpl" as struct_macros %} -{%- macro declare_responder_params(prefix, parameters, for_blink) %} +{%- macro declare_params(prefix, parameters) %} {%- for param in parameters -%} {{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} {%- if not loop.last %}, {% endif %} @@ -47,3 +42,149 @@ {%- endfor %} {%- endif -%} {%- endmacro -%} + +{%- macro build_message_flags(is_response, is_sync_text, expects_response_text, + flags_name) %} +{%- if is_response %} + const uint32_t kFlags = mojo::Message::kFlagIsResponse | + (({{is_sync_text}}) ? mojo::Message::kFlagIsSync : 0); +{%- else %} + const uint32_t kFlags = + (({{expects_response_text}}) ? mojo::Message::kFlagExpectsResponse : 0) | + (({{is_sync_text}}) ? mojo::Message::kFlagIsSync : 0); +{%- endif %} +{%- endmacro %} + +{%- macro build_serialized_message(message_name, param_name_prefix, + params_struct, params_description, + flags_text, message_object) %} + mojo::internal::SerializationContext serialization_context; + {{struct_macros.get_serialized_size(params_struct, param_name_prefix, + "&serialization_context")}} + serialization_context.PrepareMessage( + {{message_name}}, + {{flags_text}}, size, {{message_object}}); + auto* buffer = ({{message_object}})->payload_buffer(); + {{struct_macros.serialize(params_struct, params_description, + param_name_prefix, "params", "buffer", + "&serialization_context")}} +{%- endmacro %} + +{%- macro define_message_type(interface, message_typename, message_name, + is_response, method, parameters, params_struct, + params_description, use_once_callback) -%} +class {{message_typename}} + : public mojo::internal::UnserializedMessageContext { + public: + static mojo::internal::UnserializedMessageContext::Tag kMessageTag; + + explicit {{message_typename}}( + uint32_t message_flags +{%- for param in parameters %} + , {{param.kind|cpp_wrapper_param_type}} param_{{param.name}} +{%- endfor %} + ) + : mojo::internal::UnserializedMessageContext( + &kMessageTag, + {{message_name}}, + message_flags) +{%- for param in parameters %} + , param_{{param.name}}_(std::move(param_{{param.name}})) +{%- endfor -%} {} + ~{{message_typename}}() override = default; + + static mojo::Message Build( + bool serialize, +{%- if not is_response %} + bool expects_response, +{%- endif %} + bool is_sync +{%- if parameters -%} + , + {{declare_params("param_", parameters)}} +{%- endif %}) { + + {{build_message_flags(is_response, "is_sync", "expects_response", + "kFlags")}} + + if (!serialize) { + return mojo::Message(base::MakeUnique<{{message_typename}}>( + kFlags +{%- for param in parameters %} + , std::move(param_{{param.name}}) +{%- endfor %} + )); + } + + DCHECK(serialize); + mojo::Message message; + {{build_serialized_message(message_name, "param_%s", params_struct, + params_description, "kFlags", "&message")}} + return message; + } + +{% if not is_response %} + void Dispatch({{interface.name}}* impl +{%- if method.response_parameters != None -%} +{%- if use_once_callback -%} + , {{interface.name}}::{{method.name}}Callback callback +{%- else -%} + , const {{interface.name}}::{{method.name}}Callback& callback +{%- endif -%} +{%- endif -%}) { + impl->{{method.name}}( +{%- for param in parameters %} + std::move(param_{{param.name}}_) + {%- if not loop.last -%}, {%- endif %} +{%- endfor %} +{%- if method.response_parameters != None %} + {%- if parameters -%}, {% endif -%}std::move(callback) +{%- endif -%}); + } +{%- else %} + void Dispatch({{interface.name}}::{{method.name}}Callback* callback) { + std::move(*callback).Run( +{%- for param in parameters %} + std::move(param_{{param.name}}_) + {%- if not loop.last -%}, {% endif -%} +{%- endfor -%}); + } + +{% if method.sync %} + void HandleSyncResponse( +{% for param in parameters %} + {{param.kind|cpp_wrapper_type}}* out_{{param.name}} + {%- if not loop.last -%}, {% endif -%} +{%- endfor -%}) { +{% for param in parameters %} + *out_{{param.name}} = std::move(param_{{param.name}}_); +{% endfor %} + } +{%- endif -%} +{%- endif %} + + private: + // mojo::internal::UnserializedMessageContext: + size_t PrepareToSerialize( + mojo::internal::SerializationContext* serialization_context) override { + {{struct_macros.get_serialized_size(params_struct, "param_%s_", + "serialization_context")}} + return size; + } + + void Serialize(mojo::internal::SerializationContext* serialization_context, + mojo::internal::Buffer* buffer) override { + {{struct_macros.serialize(params_struct, params_description, "param_%s_", + "params", "buffer", "serialization_context")}} + } + +{%- for param in parameters %} + {{param.kind|cpp_wrapper_type}} param_{{param.name}}_; +{%- endfor %} + + DISALLOW_COPY_AND_ASSIGN({{message_typename}}); +}; + +mojo::internal::UnserializedMessageContext::Tag +{{message_typename}}::kMessageTag = {}; +{%- endmacro -%}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl index 2a0f849..3956995 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -25,7 +25,9 @@ #include <utility> #include "base/logging.h" +#include "mojo/public/cpp/bindings/lib/message_internal.h" #include "mojo/public/cpp/bindings/lib/serialization_util.h" +#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" #include "mojo/public/cpp/bindings/lib/validate_params.h" #include "mojo/public/cpp/bindings/lib/validation_context.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h"
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py index 4679f089a..ef445fb4 100644 --- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -285,23 +285,24 @@ all_enums.extend(interface.enums) return { + "all_enums": all_enums, + "enums": self.module.enums, + "export_attribute": self.export_attribute, + "export_header": self.export_header, + "extra_public_headers": self._GetExtraPublicHeaders(), + "extra_traits_headers": self._GetExtraTraitsHeaders(), + "for_blink": self.for_blink, + "imports": self.module.imports, + "interfaces": self.module.interfaces, + "kinds": self.module.kinds, "module": self.module, "namespace": self.module.namespace, "namespaces_as_array": NamespaceToArray(self.module.namespace), - "imports": self.module.imports, - "kinds": self.module.kinds, - "enums": self.module.enums, - "all_enums": all_enums, "structs": self.module.structs, + "support_lazy_serialization": self.support_lazy_serialization, "unions": self.module.unions, - "interfaces": self.module.interfaces, - "variant": self.variant, - "extra_traits_headers": self._GetExtraTraitsHeaders(), - "extra_public_headers": self._GetExtraPublicHeaders(), - "for_blink": self.for_blink, "use_once_callback": self.use_once_callback, - "export_attribute": self.export_attribute, - "export_header": self.export_header, + "variant": self.variant, } @staticmethod @@ -332,6 +333,8 @@ "get_qualified_name_for_kind": self._GetQualifiedNameForKind, "has_callbacks": mojom.HasCallbacks, "has_sync_methods": mojom.HasSyncMethods, + "method_supports_lazy_serialization": + self._MethodSupportsLazySerialization, "requires_context_for_data_view": RequiresContextForDataView, "should_inline": ShouldInlineStruct, "should_inline_union": ShouldInlineUnion, @@ -570,7 +573,8 @@ if mojom.IsArrayKind(kind): return self._IsMoveOnlyKind(kind.kind) if mojom.IsMapKind(kind): - return self._IsMoveOnlyKind(kind.value_kind) + return (self._IsMoveOnlyKind(kind.value_kind) or + self._IsMoveOnlyKind(kind.key_kind)) if mojom.IsAnyHandleOrInterfaceKind(kind): return True return False @@ -647,6 +651,11 @@ add_same_module_namespaces=True) return self._GetCppWrapperType(kind, add_same_module_namespaces=True) + def _MethodSupportsLazySerialization(self, method): + return self.support_lazy_serialization and ( + not mojom.MethodPassesAssociatedKinds(method) and + not mojom.MethodPassesInterfaces(method)) + def _TranslateConstants(self, token, kind): if isinstance(token, mojom.NamedValue): return self._GetNameForKind(token, flatten_nested_kind=True)
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 081636af..5018a7b 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -167,6 +167,13 @@ # TODO(yzshen): Convert all users to use new JS bindings and remove the # old mode. # +# support_lazy_serialization (optional) +# If set to |true|, generated C++ bindings will effectively prefer to +# transmit messages in an unserialized form when going between endpoints +# in the same process. This avoids the runtime cost of serialization, +# deserialization, and validation logic at the expensive of increased +# code size. Defaults to |false|. +# # component_output_prefix (optional) # The prefix to use for the output_name of any component library emitted # for generated C++ bindings. If this is omitted, C++ bindings targets are @@ -651,6 +658,11 @@ if (!defined(invoker.use_once_callback) || invoker.use_once_callback) { args += [ "--use_once_callback" ] } + + if (defined(invoker.support_lazy_serialization) && + invoker.support_lazy_serialization) { + args += [ "--support_lazy_serialization" ] + } } }
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.py b/mojo/public/tools/bindings/mojom_bindings_generator.py index a7f6233..cc81016 100755 --- a/mojo/public/tools/bindings/mojom_bindings_generator.py +++ b/mojo/public/tools/bindings/mojom_bindings_generator.py
@@ -207,7 +207,8 @@ js_bindings_mode=args.js_bindings_mode, export_attribute=args.export_attribute, export_header=args.export_header, - generate_non_variant_code=args.generate_non_variant_code) + generate_non_variant_code=args.generate_non_variant_code, + support_lazy_serialization=args.support_lazy_serialization) filtered_args = [] if hasattr(generator_module, 'GENERATOR_PREFIX'): prefix = '--' + generator_module.GENERATOR_PREFIX + '_' @@ -362,6 +363,10 @@ generate_parser.add_argument( "--scrambled_message_id_salt", help="If non-empty, the salt for generating scrambled message IDs.") + generate_parser.add_argument( + "--support_lazy_serialization", + help="If set, generated bindings will serialize lazily when possible.", + action="store_true") generate_parser.set_defaults(func=_Generate) precompile_parser = subparsers.add_parser("precompile",
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py index 56546c2..4d81a13d 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
@@ -156,7 +156,8 @@ def __init__(self, module, output_dir=None, typemap=None, variant=None, bytecode_path=None, for_blink=False, use_once_callback=False, js_bindings_mode="new", export_attribute=None, - export_header=None, generate_non_variant_code=False): + export_header=None, generate_non_variant_code=False, + support_lazy_serialization=False): self.module = module self.output_dir = output_dir self.typemap = typemap or {} @@ -168,6 +169,7 @@ self.export_attribute = export_attribute self.export_header = export_header self.generate_non_variant_code = generate_non_variant_code + self.support_lazy_serialization = support_lazy_serialization def Write(self, contents, filename): if self.output_dir is None:
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py index c8e17b7..8208f7b 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -898,41 +898,50 @@ return False -# Finds out whether a method passes associated interfaces and associated -# interface requests. -def MethodPassesAssociatedKinds(method, visited_kinds=None): - def _ContainsAssociatedKinds(kind): +def _AnyMethodParameterRecursive(method, predicate, visited_kinds=None): + def _HasProperty(kind): if kind in visited_kinds: # No need to examine the kind again. return False visited_kinds.add(kind) - if IsAssociatedKind(kind): + if predicate(kind): return True if IsArrayKind(kind): - return _ContainsAssociatedKinds(kind.kind) + return _HasProperty(kind.kind) if IsStructKind(kind) or IsUnionKind(kind): for field in kind.fields: - if _ContainsAssociatedKinds(field.kind): + if _HasProperty(field.kind): return True if IsMapKind(kind): - # No need to examine the key kind, only primitive kinds and non-nullable - # string are allowed to be key kinds. - return _ContainsAssociatedKinds(kind.value_kind) + if _HasProperty(kind.key_kind) or _HasProperty(kind.value_kind): + return True return False if visited_kinds is None: visited_kinds = set() for param in method.parameters: - if _ContainsAssociatedKinds(param.kind): + if _HasProperty(param.kind): return True if method.response_parameters != None: for param in method.response_parameters: - if _ContainsAssociatedKinds(param.kind): + if _HasProperty(param.kind): return True return False +# Finds out whether a method passes associated interfaces and associated +# interface requests. +def MethodPassesAssociatedKinds(method, visited_kinds=None): + return _AnyMethodParameterRecursive(method, IsAssociatedKind, + visited_kinds=visited_kinds) + + +# Determines whether a method passes interfaces. +def MethodPassesInterfaces(method): + return _AnyMethodParameterRecursive(method, IsInterfaceKind) + + def HasSyncMethods(interface): for method in interface.methods: if method.sync:
diff --git a/net/BUILD.gn b/net/BUILD.gn index 79a79db5..c80da91 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -979,8 +979,14 @@ "http2/http2_structures.h", "http2/platform/api/http2_export.h", "http2/platform/api/http2_reconstruct_object.h", + "http2/platform/api/http2_string.h", + "http2/platform/api/http2_string_piece.h", + "http2/platform/api/http2_string_utils.h", "http2/platform/impl/http2_export_impl.h", "http2/platform/impl/http2_reconstruct_object_impl.h", + "http2/platform/impl/http2_string_impl.h", + "http2/platform/impl/http2_string_piece_impl.h", + "http2/platform/impl/http2_string_utils_impl.h", "http2/tools/http2_bug_tracker.h", "log/file_net_log_observer.cc", "log/file_net_log_observer.h", @@ -4541,7 +4547,9 @@ "base/network_change_notifier_unittest.cc", "base/network_change_notifier_win_unittest.cc", "base/network_interfaces_getifaddrs_unittest.cc", + "base/network_interfaces_linux_unittest.cc", "base/network_interfaces_unittest.cc", + "base/network_interfaces_win_unittest.cc", "base/network_throttle_manager_impl_unittest.cc", "base/parse_number_unittest.cc", "base/percentile_estimator_unittest.cc", @@ -4791,6 +4799,7 @@ "http2/http2_structures_test.cc", "http2/http2_structures_test_util.cc", "http2/http2_structures_test_util.h", + "http2/platform/api/http2_string_utils_test.cc", "http2/test_tools/frame_parts.cc", "http2/test_tools/frame_parts.h", "http2/test_tools/frame_parts_collector.cc", @@ -5465,7 +5474,10 @@ ] android_manifest = "//net/android/unittest_support/AndroidManifest.xml" set_sources_assignment_filter([]) - sources += [ "base/address_tracker_linux_unittest.cc" ] + sources += [ + "base/address_tracker_linux_unittest.cc", + "base/network_interfaces_linux_unittest.cc", + ] set_sources_assignment_filter(sources_assignment_filter) shard_timeout = 300 }
diff --git a/net/base/network_interfaces_linux_unittest.cc b/net/base/network_interfaces_linux_unittest.cc new file mode 100644 index 0000000..85a7367 --- /dev/null +++ b/net/base/network_interfaces_linux_unittest.cc
@@ -0,0 +1,195 @@ +// 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 "net/base/network_interfaces_linux.h" + +#include <net/if.h> +#include <netinet/in.h> + +#include <ostream> +#include <string> +#include <unordered_set> + +#include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "net/base/address_tracker_linux.h" +#include "net/base/ip_endpoint.h" +#include "net/base/network_interfaces_posix.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { + +namespace { + +static const char kIfnameEm1[] = "em1"; +static const char kIfnameVmnet[] = "vmnet"; +static const unsigned char kIPv6LocalAddr[] = {0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1}; +static const unsigned char kIPv6Addr[] = {0x24, 0x01, 0xfa, 0x00, 0x00, 0x04, + 0x10, 0x00, 0xbe, 0x30, 0x5b, 0xff, + 0xfe, 0xe5, 0x00, 0xc3}; + +char* CopyInterfaceName(const char* ifname, int ifname_size, char* output) { + EXPECT_LT(ifname_size, IF_NAMESIZE); + memcpy(output, ifname, ifname_size); + return output; +} + +char* GetInterfaceName(int interface_index, char* ifname) { + return CopyInterfaceName(kIfnameEm1, arraysize(kIfnameEm1), ifname); +} + +char* GetInterfaceNameVM(int interface_index, char* ifname) { + return CopyInterfaceName(kIfnameVmnet, arraysize(kIfnameVmnet), ifname); +} + +TEST(NetworkInterfacesTest, NetworkListTrimmingLinux) { + IPAddress ipv6_local_address(kIPv6LocalAddr); + IPAddress ipv6_address(kIPv6Addr); + + NetworkInterfaceList results; + std::unordered_set<int> online_links; + internal::AddressTrackerLinux::AddressMap address_map; + + // Interface 1 is offline. + struct ifaddrmsg msg = { + AF_INET6, // Address type + 1, // Prefix length + IFA_F_TEMPORARY, // Address flags + 0, // Link scope + 1 // Link index + }; + + // Address of offline links should be ignored. + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceName)); + EXPECT_EQ(results.size(), 0ul); + + // Mark interface 1 online. + online_links.insert(1); + + // Local address should be trimmed out. + address_map.clear(); + ASSERT_TRUE( + address_map.insert(std::make_pair(ipv6_local_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceName)); + EXPECT_EQ(results.size(), 0ul); + + // vmware address should return by default. + address_map.clear(); + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceNameVM)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].name, kIfnameVmnet); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + results.clear(); + + // vmware address should be trimmed out if policy specified so. + address_map.clear(); + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceNameVM)); + EXPECT_EQ(results.size(), 0ul); + results.clear(); + + // Addresses with banned attributes should be ignored. + address_map.clear(); + msg.ifa_flags = IFA_F_TENTATIVE; + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceName)); + EXPECT_EQ(results.size(), 0ul); + results.clear(); + + // Addresses with allowed attribute IFA_F_TEMPORARY should be returned and + // attributes should be translated correctly. + address_map.clear(); + msg.ifa_flags = IFA_F_TEMPORARY; + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceName)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].name, kIfnameEm1); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_TEMPORARY); + results.clear(); + + // Addresses with allowed attribute IFA_F_DEPRECATED should be returned and + // attributes should be translated correctly. + address_map.clear(); + msg.ifa_flags = IFA_F_DEPRECATED; + ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, + address_map, GetInterfaceName)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].name, kIfnameEm1); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_DEPRECATED); + results.clear(); +} + +const char kWiFiSSID[] = "TestWiFi"; +const char kInterfaceWithDifferentSSID[] = "wlan999"; + +std::string TestGetInterfaceSSID(const std::string& ifname) { + return (ifname == kInterfaceWithDifferentSSID) ? "AnotherSSID" : kWiFiSSID; +} + +TEST(NetworkInterfacesTest, GetWifiSSIDFromInterfaceList) { + NetworkInterfaceList list; + EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( + list, TestGetInterfaceSSID)); + + NetworkInterface interface1; + interface1.name = "wlan0"; + interface1.type = NetworkChangeNotifier::CONNECTION_WIFI; + list.push_back(interface1); + ASSERT_EQ(1u, list.size()); + EXPECT_EQ(std::string(kWiFiSSID), + internal::GetWifiSSIDFromInterfaceListInternal( + list, TestGetInterfaceSSID)); + + NetworkInterface interface2; + interface2.name = "wlan1"; + interface2.type = NetworkChangeNotifier::CONNECTION_WIFI; + list.push_back(interface2); + ASSERT_EQ(2u, list.size()); + EXPECT_EQ(std::string(kWiFiSSID), + internal::GetWifiSSIDFromInterfaceListInternal( + list, TestGetInterfaceSSID)); + + NetworkInterface interface3; + interface3.name = kInterfaceWithDifferentSSID; + interface3.type = NetworkChangeNotifier::CONNECTION_WIFI; + list.push_back(interface3); + ASSERT_EQ(3u, list.size()); + EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( + list, TestGetInterfaceSSID)); + + list.pop_back(); + NetworkInterface interface4; + interface4.name = "eth0"; + interface4.type = NetworkChangeNotifier::CONNECTION_ETHERNET; + list.push_back(interface4); + ASSERT_EQ(3u, list.size()); + EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( + list, TestGetInterfaceSSID)); +} + +} // namespace + +} // namespace net
diff --git a/net/base/network_interfaces_unittest.cc b/net/base/network_interfaces_unittest.cc index 7882d99..1469b49 100644 --- a/net/base/network_interfaces_unittest.cc +++ b/net/base/network_interfaces_unittest.cc
@@ -13,42 +13,17 @@ #include "net/base/ip_endpoint.h" #include "testing/gtest/include/gtest/gtest.h" -#if !defined(OS_NACL) && !defined(OS_WIN) +#if defined(OS_POSIX) && !defined(OS_ANDROID) #include <net/if.h> -#include <netinet/in.h> -#endif // !OS_NACL && !OS_WIN - -#if defined(OS_WIN) +#elif defined(OS_WIN) #include <iphlpapi.h> #include <objbase.h> -#endif // OS_WIN - -#if defined(OS_LINUX) || defined(OS_ANDROID) -#include "net/base/address_tracker_linux.h" -#endif // OS_LINUX || OS_ANDROID - -#if defined(OS_WIN) -#include "net/base/network_interfaces_win.h" -#else // OS_WIN -#include "net/base/network_interfaces_posix.h" -#if defined(OS_LINUX) || defined(OS_ANDROID) -#include "net/base/network_interfaces_linux.h" -#endif // OS_LINUX || OS_ANDROID -#endif // OS_WIN +#endif namespace net { namespace { -#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_CHROMEOS) -const char kWiFiSSID[] = "TestWiFi"; -const char kInterfaceWithDifferentSSID[] = "wlan999"; - -std::string TestGetInterfaceSSID(const std::string& ifname) { - return (ifname == kInterfaceWithDifferentSSID) ? "AnotherSSID" : kWiFiSSID; -} -#endif - // Verify GetNetworkList(). TEST(NetworkInterfacesTest, GetNetworkList) { NetworkInterfaceList list; @@ -82,7 +57,7 @@ if (it->type == NetworkChangeNotifier::CONNECTION_WIFI) { EXPECT_NE(WIFI_PHY_LAYER_PROTOCOL_NONE, GetWifiPHYLayerProtocol()); } -#elif !defined(OS_ANDROID) +#elif defined(OS_POSIX) && !defined(OS_ANDROID) char name[IF_NAMESIZE]; EXPECT_TRUE(if_indextoname(it->interface_index, name)); EXPECT_STREQ(it->name.c_str(), name); @@ -90,297 +65,6 @@ } } -#if defined(OS_LINUX) || defined(OS_ANDROID) - -static const char kIfnameEm1[] = "em1"; -static const char kIfnameVmnet[] = "vmnet"; -static const unsigned char kIPv6LocalAddr[] = {0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1}; -static const unsigned char kIPv6Addr[] = {0x24, 0x01, 0xfa, 0x00, 0x00, 0x04, - 0x10, 0x00, 0xbe, 0x30, 0x5b, 0xff, - 0xfe, 0xe5, 0x00, 0xc3}; - -char* CopyInterfaceName(const char* ifname, int ifname_size, char* output) { - EXPECT_LT(ifname_size, IF_NAMESIZE); - memcpy(output, ifname, ifname_size); - return output; -} - -char* GetInterfaceName(int interface_index, char* ifname) { - return CopyInterfaceName(kIfnameEm1, arraysize(kIfnameEm1), ifname); -} - -char* GetInterfaceNameVM(int interface_index, char* ifname) { - return CopyInterfaceName(kIfnameVmnet, arraysize(kIfnameVmnet), ifname); -} - -TEST(NetworkInterfacesTest, NetworkListTrimmingLinux) { - IPAddress ipv6_local_address(kIPv6LocalAddr); - IPAddress ipv6_address(kIPv6Addr); - - NetworkInterfaceList results; - std::unordered_set<int> online_links; - internal::AddressTrackerLinux::AddressMap address_map; - - // Interface 1 is offline. - struct ifaddrmsg msg = { - AF_INET6, // Address type - 1, // Prefix length - IFA_F_TEMPORARY, // Address flags - 0, // Link scope - 1 // Link index - }; - - // Address of offline links should be ignored. - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceName)); - EXPECT_EQ(results.size(), 0ul); - - // Mark interface 1 online. - online_links.insert(1); - - // Local address should be trimmed out. - address_map.clear(); - ASSERT_TRUE( - address_map.insert(std::make_pair(ipv6_local_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceName)); - EXPECT_EQ(results.size(), 0ul); - - // vmware address should return by default. - address_map.clear(); - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceNameVM)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].name, kIfnameVmnet); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - results.clear(); - - // vmware address should be trimmed out if policy specified so. - address_map.clear(); - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceNameVM)); - EXPECT_EQ(results.size(), 0ul); - results.clear(); - - // Addresses with banned attributes should be ignored. - address_map.clear(); - msg.ifa_flags = IFA_F_TENTATIVE; - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceName)); - EXPECT_EQ(results.size(), 0ul); - results.clear(); - - // Addresses with allowed attribute IFA_F_TEMPORARY should be returned and - // attributes should be translated correctly. - address_map.clear(); - msg.ifa_flags = IFA_F_TEMPORARY; - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceName)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].name, kIfnameEm1); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_TEMPORARY); - results.clear(); - - // Addresses with allowed attribute IFA_F_DEPRECATED should be returned and - // attributes should be translated correctly. - address_map.clear(); - msg.ifa_flags = IFA_F_DEPRECATED; - ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links, - address_map, GetInterfaceName)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].name, kIfnameEm1); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_DEPRECATED); - results.clear(); -} - -#elif defined(OS_WIN) // !OS_LINUX || OS_ANDROID - -static const char kIfnameEm1[] = "em1"; -static const char kIfnameVmnet[] = "VMnet"; - -static const unsigned char kIPv6LocalAddr[] = {0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1}; - -static const unsigned char kIPv6Addr[] = {0x24, 0x01, 0xfa, 0x00, 0x00, 0x04, - 0x10, 0x00, 0xbe, 0x30, 0x5b, 0xff, - 0xfe, 0xe5, 0x00, 0xc3}; -static const unsigned char kIPv6AddrPrefix[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// Helper function to create a valid IP_ADAPTER_ADDRESSES with reasonable -// default value. The output is the |adapter_address|. All the rests are input -// to fill the |adapter_address|. |sock_addrs| are temporary storage used by -// |adapter_address| once the function is returned. -bool FillAdapterAddress(IP_ADAPTER_ADDRESSES* adapter_address, - const char* ifname, - const IPAddress& ip_address, - const IPAddress& ip_netmask, - sockaddr_storage sock_addrs[2]) { - adapter_address->AdapterName = const_cast<char*>(ifname); - adapter_address->FriendlyName = const_cast<PWCHAR>(L"interface"); - adapter_address->IfType = IF_TYPE_ETHERNET_CSMACD; - adapter_address->OperStatus = IfOperStatusUp; - adapter_address->FirstUnicastAddress->DadState = IpDadStatePreferred; - adapter_address->FirstUnicastAddress->PrefixOrigin = IpPrefixOriginOther; - adapter_address->FirstUnicastAddress->SuffixOrigin = IpSuffixOriginOther; - adapter_address->FirstUnicastAddress->PreferredLifetime = 100; - adapter_address->FirstUnicastAddress->ValidLifetime = 1000; - - socklen_t sock_len = sizeof(sockaddr_storage); - - // Convert to sockaddr for next check. - if (!IPEndPoint(ip_address, 0) - .ToSockAddr(reinterpret_cast<sockaddr*>(&sock_addrs[0]), - &sock_len)) { - return false; - } - adapter_address->FirstUnicastAddress->Address.lpSockaddr = - reinterpret_cast<sockaddr*>(&sock_addrs[0]); - adapter_address->FirstUnicastAddress->Address.iSockaddrLength = sock_len; - adapter_address->FirstUnicastAddress->OnLinkPrefixLength = 1; - - sock_len = sizeof(sockaddr_storage); - if (!IPEndPoint(ip_netmask, 0) - .ToSockAddr(reinterpret_cast<sockaddr*>(&sock_addrs[1]), - &sock_len)) { - return false; - } - adapter_address->FirstPrefix->Address.lpSockaddr = - reinterpret_cast<sockaddr*>(&sock_addrs[1]); - adapter_address->FirstPrefix->Address.iSockaddrLength = sock_len; - adapter_address->FirstPrefix->PrefixLength = 1; - - DCHECK_EQ(sock_addrs[0].ss_family, sock_addrs[1].ss_family); - if (sock_addrs[0].ss_family == AF_INET6) { - adapter_address->Ipv6IfIndex = 0; - } else { - DCHECK_EQ(sock_addrs[0].ss_family, AF_INET); - adapter_address->IfIndex = 0; - } - - return true; -} - -TEST(NetworkInterfacesTest, NetworkListTrimmingWindows) { - IPAddress ipv6_local_address(kIPv6LocalAddr); - IPAddress ipv6_address(kIPv6Addr); - IPAddress ipv6_prefix(kIPv6AddrPrefix); - - NetworkInterfaceList results; - sockaddr_storage addresses[2]; - IP_ADAPTER_ADDRESSES adapter_address = {}; - IP_ADAPTER_UNICAST_ADDRESS address = {}; - IP_ADAPTER_PREFIX adapter_prefix = {}; - adapter_address.FirstUnicastAddress = &address; - adapter_address.FirstPrefix = &adapter_prefix; - - // Address of offline links should be ignored. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, - ipv6_prefix, addresses)); - adapter_address.OperStatus = IfOperStatusDown; - - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - - EXPECT_EQ(results.size(), 0ul); - - // Address on loopback interface should be trimmed out. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, - ipv6_local_address, ipv6_prefix, addresses)); - adapter_address.IfType = IF_TYPE_SOFTWARE_LOOPBACK; - - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 0ul); - - // vmware address should return by default. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameVmnet, ipv6_address, - ipv6_prefix, addresses)); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].name, kIfnameVmnet); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_NONE); - results.clear(); - - // vmware address should be trimmed out if policy specified so. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameVmnet, ipv6_address, - ipv6_prefix, addresses)); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 0ul); - results.clear(); - - // Addresses with incomplete DAD should be ignored. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, - ipv6_prefix, addresses)); - adapter_address.FirstUnicastAddress->DadState = IpDadStateTentative; - - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 0ul); - results.clear(); - - // Addresses with allowed attribute IpSuffixOriginRandom should be returned - // and attributes should be translated correctly to - // IP_ADDRESS_ATTRIBUTE_TEMPORARY. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, - ipv6_prefix, addresses)); - adapter_address.FirstUnicastAddress->PrefixOrigin = - IpPrefixOriginRouterAdvertisement; - adapter_address.FirstUnicastAddress->SuffixOrigin = IpSuffixOriginRandom; - - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].name, kIfnameEm1); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_TEMPORARY); - results.clear(); - - // Addresses with preferred lifetime 0 should be returned and - // attributes should be translated correctly to - // IP_ADDRESS_ATTRIBUTE_DEPRECATED. - ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, - ipv6_prefix, addresses)); - adapter_address.FirstUnicastAddress->PreferredLifetime = 0; - adapter_address.FriendlyName = const_cast<PWCHAR>(L"FriendlyInterfaceName"); - EXPECT_TRUE(internal::GetNetworkListImpl( - &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); - EXPECT_EQ(results.size(), 1ul); - EXPECT_EQ(results[0].friendly_name, "FriendlyInterfaceName"); - EXPECT_EQ(results[0].name, kIfnameEm1); - EXPECT_EQ(results[0].prefix_length, 1ul); - EXPECT_EQ(results[0].address, ipv6_address); - EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_DEPRECATED); - results.clear(); -} - -#endif // OS_WIN - TEST(NetworkInterfacesTest, GetWifiSSID) { // We can't check the result of GetWifiSSID() directly, since the result // will differ across machines. Simply exercise the code path and hope that it @@ -388,154 +72,6 @@ EXPECT_NE((const char*)NULL, GetWifiSSID().c_str()); } -#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_CHROMEOS) -TEST(NetworkInterfacesTest, GetWifiSSIDFromInterfaceList) { - NetworkInterfaceList list; - EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( - list, TestGetInterfaceSSID)); - - NetworkInterface interface1; - interface1.name = "wlan0"; - interface1.type = NetworkChangeNotifier::CONNECTION_WIFI; - list.push_back(interface1); - ASSERT_EQ(1u, list.size()); - EXPECT_EQ(std::string(kWiFiSSID), - internal::GetWifiSSIDFromInterfaceListInternal( - list, TestGetInterfaceSSID)); - - NetworkInterface interface2; - interface2.name = "wlan1"; - interface2.type = NetworkChangeNotifier::CONNECTION_WIFI; - list.push_back(interface2); - ASSERT_EQ(2u, list.size()); - EXPECT_EQ(std::string(kWiFiSSID), - internal::GetWifiSSIDFromInterfaceListInternal( - list, TestGetInterfaceSSID)); - - NetworkInterface interface3; - interface3.name = kInterfaceWithDifferentSSID; - interface3.type = NetworkChangeNotifier::CONNECTION_WIFI; - list.push_back(interface3); - ASSERT_EQ(3u, list.size()); - EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( - list, TestGetInterfaceSSID)); - - list.pop_back(); - NetworkInterface interface4; - interface4.name = "eth0"; - interface4.type = NetworkChangeNotifier::CONNECTION_ETHERNET; - list.push_back(interface4); - ASSERT_EQ(3u, list.size()); - EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal( - list, TestGetInterfaceSSID)); -} -#endif // OS_LINUX - -#if defined(OS_WIN) -bool read_int_or_bool(DWORD data_size, - PVOID data) { - switch (data_size) { - case 1: - return !!*reinterpret_cast<uint8_t*>(data); - case 4: - return !!*reinterpret_cast<uint32_t*>(data); - default: - LOG(FATAL) << "That is not a type I know!"; - return false; - } -} - -int GetWifiOptions() { - const internal::WlanApi& wlanapi = internal::WlanApi::GetInstance(); - if (!wlanapi.initialized) - return -1; - - internal::WlanHandle client; - DWORD cur_version = 0; - const DWORD kMaxClientVersion = 2; - DWORD result = wlanapi.OpenHandle( - kMaxClientVersion, &cur_version, &client); - if (result != ERROR_SUCCESS) - return -1; - - WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL; - result = wlanapi.enum_interfaces_func(client.Get(), NULL, - &interface_list_ptr); - if (result != ERROR_SUCCESS) - return -1; - std::unique_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> - interface_list(interface_list_ptr); - - for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) { - WLAN_INTERFACE_INFO* info = &interface_list->InterfaceInfo[i]; - DWORD data_size; - PVOID data; - int options = 0; - result = wlanapi.query_interface_func( - client.Get(), - &info->InterfaceGuid, - wlan_intf_opcode_background_scan_enabled, - NULL, - &data_size, - &data, - NULL); - if (result != ERROR_SUCCESS) - continue; - if (!read_int_or_bool(data_size, data)) { - options |= WIFI_OPTIONS_DISABLE_SCAN; - } - internal::WlanApi::GetInstance().free_memory_func(data); - - result = wlanapi.query_interface_func( - client.Get(), - &info->InterfaceGuid, - wlan_intf_opcode_media_streaming_mode, - NULL, - &data_size, - &data, - NULL); - if (result != ERROR_SUCCESS) - continue; - if (read_int_or_bool(data_size, data)) { - options |= WIFI_OPTIONS_MEDIA_STREAMING_MODE; - } - internal::WlanApi::GetInstance().free_memory_func(data); - - // Just the the options from the first succesful - // interface. - return options; - } - - // No wifi interface found. - return -1; -} - -#else // OS_WIN - -int GetWifiOptions() { - // Not supported. - return -1; -} - -#endif // OS_WIN - -void TryChangeWifiOptions(int options) { - int previous_options = GetWifiOptions(); - std::unique_ptr<ScopedWifiOptions> scoped_options = SetWifiOptions(options); - EXPECT_EQ(previous_options | options, GetWifiOptions()); - scoped_options.reset(); - EXPECT_EQ(previous_options, GetWifiOptions()); -} - -// Test SetWifiOptions(). -TEST(NetworkInterfacesTest, SetWifiOptionsTest) { - TryChangeWifiOptions(0); - TryChangeWifiOptions(WIFI_OPTIONS_DISABLE_SCAN); - TryChangeWifiOptions(WIFI_OPTIONS_MEDIA_STREAMING_MODE); - TryChangeWifiOptions(WIFI_OPTIONS_DISABLE_SCAN | - WIFI_OPTIONS_MEDIA_STREAMING_MODE); -} - TEST(NetworkInterfacesTest, GetHostName) { // We can't check the result of GetHostName() directly, since the result // will differ across machines. Our goal here is to simply exercise the
diff --git a/net/base/network_interfaces_win_unittest.cc b/net/base/network_interfaces_win_unittest.cc new file mode 100644 index 0000000..4d112f3b --- /dev/null +++ b/net/base/network_interfaces_win_unittest.cc
@@ -0,0 +1,276 @@ +// 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 "net/base/network_interfaces_win.h" + +#include <iphlpapi.h> +#include <objbase.h> + +#include <ostream> +#include <string> +#include <unordered_set> + +#include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "net/base/ip_endpoint.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { + +namespace { + +static const char kIfnameEm1[] = "em1"; +static const char kIfnameVmnet[] = "VMnet"; + +static const unsigned char kIPv6LocalAddr[] = {0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1}; + +static const unsigned char kIPv6Addr[] = {0x24, 0x01, 0xfa, 0x00, 0x00, 0x04, + 0x10, 0x00, 0xbe, 0x30, 0x5b, 0xff, + 0xfe, 0xe5, 0x00, 0xc3}; +static const unsigned char kIPv6AddrPrefix[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// Helper function to create a valid IP_ADAPTER_ADDRESSES with reasonable +// default value. The output is the |adapter_address|. All the rests are input +// to fill the |adapter_address|. |sock_addrs| are temporary storage used by +// |adapter_address| once the function is returned. +bool FillAdapterAddress(IP_ADAPTER_ADDRESSES* adapter_address, + const char* ifname, + const IPAddress& ip_address, + const IPAddress& ip_netmask, + sockaddr_storage sock_addrs[2]) { + adapter_address->AdapterName = const_cast<char*>(ifname); + adapter_address->FriendlyName = const_cast<PWCHAR>(L"interface"); + adapter_address->IfType = IF_TYPE_ETHERNET_CSMACD; + adapter_address->OperStatus = IfOperStatusUp; + adapter_address->FirstUnicastAddress->DadState = IpDadStatePreferred; + adapter_address->FirstUnicastAddress->PrefixOrigin = IpPrefixOriginOther; + adapter_address->FirstUnicastAddress->SuffixOrigin = IpSuffixOriginOther; + adapter_address->FirstUnicastAddress->PreferredLifetime = 100; + adapter_address->FirstUnicastAddress->ValidLifetime = 1000; + + socklen_t sock_len = sizeof(sockaddr_storage); + + // Convert to sockaddr for next check. + if (!IPEndPoint(ip_address, 0) + .ToSockAddr(reinterpret_cast<sockaddr*>(&sock_addrs[0]), + &sock_len)) { + return false; + } + adapter_address->FirstUnicastAddress->Address.lpSockaddr = + reinterpret_cast<sockaddr*>(&sock_addrs[0]); + adapter_address->FirstUnicastAddress->Address.iSockaddrLength = sock_len; + adapter_address->FirstUnicastAddress->OnLinkPrefixLength = 1; + + sock_len = sizeof(sockaddr_storage); + if (!IPEndPoint(ip_netmask, 0) + .ToSockAddr(reinterpret_cast<sockaddr*>(&sock_addrs[1]), + &sock_len)) { + return false; + } + adapter_address->FirstPrefix->Address.lpSockaddr = + reinterpret_cast<sockaddr*>(&sock_addrs[1]); + adapter_address->FirstPrefix->Address.iSockaddrLength = sock_len; + adapter_address->FirstPrefix->PrefixLength = 1; + + DCHECK_EQ(sock_addrs[0].ss_family, sock_addrs[1].ss_family); + if (sock_addrs[0].ss_family == AF_INET6) { + adapter_address->Ipv6IfIndex = 0; + } else { + DCHECK_EQ(sock_addrs[0].ss_family, AF_INET); + adapter_address->IfIndex = 0; + } + + return true; +} + +TEST(NetworkInterfacesTest, NetworkListTrimmingWindows) { + IPAddress ipv6_local_address(kIPv6LocalAddr); + IPAddress ipv6_address(kIPv6Addr); + IPAddress ipv6_prefix(kIPv6AddrPrefix); + + NetworkInterfaceList results; + sockaddr_storage addresses[2]; + IP_ADAPTER_ADDRESSES adapter_address = {}; + IP_ADAPTER_UNICAST_ADDRESS address = {}; + IP_ADAPTER_PREFIX adapter_prefix = {}; + adapter_address.FirstUnicastAddress = &address; + adapter_address.FirstPrefix = &adapter_prefix; + + // Address of offline links should be ignored. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, + ipv6_prefix, addresses)); + adapter_address.OperStatus = IfOperStatusDown; + + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + + EXPECT_EQ(results.size(), 0ul); + + // Address on loopback interface should be trimmed out. + ASSERT_TRUE(FillAdapterAddress( + &adapter_address /* adapter_address */, kIfnameEm1 /* ifname */, + ipv6_local_address /* ip_address */, ipv6_prefix /* ip_netmask */, + addresses /* sock_addrs */)); + adapter_address.IfType = IF_TYPE_SOFTWARE_LOOPBACK; + + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 0ul); + + // vmware address should return by default. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameVmnet, ipv6_address, + ipv6_prefix, addresses)); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].name, kIfnameVmnet); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_NONE); + results.clear(); + + // vmware address should be trimmed out if policy specified so. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameVmnet, ipv6_address, + ipv6_prefix, addresses)); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 0ul); + results.clear(); + + // Addresses with incomplete DAD should be ignored. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, + ipv6_prefix, addresses)); + adapter_address.FirstUnicastAddress->DadState = IpDadStateTentative; + + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 0ul); + results.clear(); + + // Addresses with allowed attribute IpSuffixOriginRandom should be returned + // and attributes should be translated correctly to + // IP_ADDRESS_ATTRIBUTE_TEMPORARY. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, + ipv6_prefix, addresses)); + adapter_address.FirstUnicastAddress->PrefixOrigin = + IpPrefixOriginRouterAdvertisement; + adapter_address.FirstUnicastAddress->SuffixOrigin = IpSuffixOriginRandom; + + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].name, kIfnameEm1); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_TEMPORARY); + results.clear(); + + // Addresses with preferred lifetime 0 should be returned and + // attributes should be translated correctly to + // IP_ADDRESS_ATTRIBUTE_DEPRECATED. + ASSERT_TRUE(FillAdapterAddress(&adapter_address, kIfnameEm1, ipv6_address, + ipv6_prefix, addresses)); + adapter_address.FirstUnicastAddress->PreferredLifetime = 0; + adapter_address.FriendlyName = const_cast<PWCHAR>(L"FriendlyInterfaceName"); + EXPECT_TRUE(internal::GetNetworkListImpl( + &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &adapter_address)); + EXPECT_EQ(results.size(), 1ul); + EXPECT_EQ(results[0].friendly_name, "FriendlyInterfaceName"); + EXPECT_EQ(results[0].name, kIfnameEm1); + EXPECT_EQ(results[0].prefix_length, 1ul); + EXPECT_EQ(results[0].address, ipv6_address); + EXPECT_EQ(results[0].ip_address_attributes, IP_ADDRESS_ATTRIBUTE_DEPRECATED); + results.clear(); +} + +bool read_int_or_bool(DWORD data_size, PVOID data) { + switch (data_size) { + case 1: + return !!*reinterpret_cast<uint8_t*>(data); + case 4: + return !!*reinterpret_cast<uint32_t*>(data); + default: + LOG(FATAL) << "That is not a type I know!"; + return false; + } +} + +int GetWifiOptions() { + const internal::WlanApi& wlanapi = internal::WlanApi::GetInstance(); + if (!wlanapi.initialized) + return -1; + + internal::WlanHandle client; + DWORD cur_version = 0; + const DWORD kMaxClientVersion = 2; + DWORD result = wlanapi.OpenHandle(kMaxClientVersion, &cur_version, &client); + if (result != ERROR_SUCCESS) + return -1; + + WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL; + result = + wlanapi.enum_interfaces_func(client.Get(), NULL, &interface_list_ptr); + if (result != ERROR_SUCCESS) + return -1; + std::unique_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> + interface_list(interface_list_ptr); + + for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) { + WLAN_INTERFACE_INFO* info = &interface_list->InterfaceInfo[i]; + DWORD data_size; + PVOID data; + int options = 0; + result = + wlanapi.query_interface_func(client.Get(), &info->InterfaceGuid, + wlan_intf_opcode_background_scan_enabled, + NULL, &data_size, &data, NULL); + if (result != ERROR_SUCCESS) + continue; + if (!read_int_or_bool(data_size, data)) { + options |= WIFI_OPTIONS_DISABLE_SCAN; + } + internal::WlanApi::GetInstance().free_memory_func(data); + + result = wlanapi.query_interface_func(client.Get(), &info->InterfaceGuid, + wlan_intf_opcode_media_streaming_mode, + NULL, &data_size, &data, NULL); + if (result != ERROR_SUCCESS) + continue; + if (read_int_or_bool(data_size, data)) { + options |= WIFI_OPTIONS_MEDIA_STREAMING_MODE; + } + internal::WlanApi::GetInstance().free_memory_func(data); + + // Just the the options from the first succesful + // interface. + return options; + } + + // No wifi interface found. + return -1; +} + +void TryChangeWifiOptions(int options) { + int previous_options = GetWifiOptions(); + std::unique_ptr<ScopedWifiOptions> scoped_options = SetWifiOptions(options); + EXPECT_EQ(previous_options | options, GetWifiOptions()); + scoped_options.reset(); + EXPECT_EQ(previous_options, GetWifiOptions()); +} + +// Test SetWifiOptions(). +TEST(NetworkInterfacesTest, SetWifiOptions) { + TryChangeWifiOptions(0); + TryChangeWifiOptions(WIFI_OPTIONS_DISABLE_SCAN); + TryChangeWifiOptions(WIFI_OPTIONS_MEDIA_STREAMING_MODE); + TryChangeWifiOptions(WIFI_OPTIONS_DISABLE_SCAN | + WIFI_OPTIONS_MEDIA_STREAMING_MODE); +} + +} // namespace + +} // namespace net
diff --git a/net/base/registry_controlled_domains/effective_tld_names.dat b/net/base/registry_controlled_domains/effective_tld_names.dat index 7598355..1157a7f 100644 --- a/net/base/registry_controlled_domains/effective_tld_names.dat +++ b/net/base/registry_controlled_domains/effective_tld_names.dat
@@ -171,7 +171,7 @@ // aq : https://en.wikipedia.org/wiki/.aq aq -// ar : https://nic.ar/normativa-vigente.xhtml +// ar : https://nic.ar/nic-argentina/normativa-vigente ar com.ar edu.ar @@ -179,6 +179,7 @@ gov.ar int.ar mil.ar +musica.ar net.ar org.ar tur.ar @@ -406,6 +407,7 @@ art.br ato.br b.br +belem.br bio.br blog.br bmd.br @@ -414,6 +416,8 @@ cnt.br com.br coop.br +cri.br +def.br ecn.br eco.br edu.br @@ -424,6 +428,7 @@ eti.br far.br flog.br +floripa.br fm.br fnd.br fot.br @@ -431,9 +436,38 @@ g12.br ggf.br gov.br +// gov.br 26 states + df https://en.wikipedia.org/wiki/States_of_Brazil +ac.gov.br +al.gov.br +am.gov.br +ap.gov.br +ba.gov.br +ce.gov.br +df.gov.br +es.gov.br +go.gov.br +ma.gov.br +mg.gov.br +ms.gov.br +mt.gov.br +pa.gov.br +pb.gov.br +pe.gov.br +pi.gov.br +pr.gov.br +rj.gov.br +rn.gov.br +ro.gov.br +rr.gov.br +rs.gov.br +sc.gov.br +se.gov.br +sp.gov.br +to.gov.br imb.br ind.br inf.br +jampa.br jor.br jus.br leg.br @@ -449,6 +483,7 @@ ntr.br odo.br org.br +poa.br ppg.br pro.br psc.br @@ -456,6 +491,7 @@ qsl.br radio.br rec.br +recife.br slg.br srv.br taxi.br @@ -465,6 +501,7 @@ tur.br tv.br vet.br +vix.br vlog.br wiki.br zlg.br @@ -4406,6 +4443,7 @@ // nc : http://www.cctld.nc/ nc asso.nc +nom.nc // ne : https://en.wikipedia.org/wiki/.ne ne @@ -6555,6 +6593,9 @@ // xn--54b7fta0cc ("Bangla", Bangla) : BD বাংলা +// xn--90ae ("bg", Bulgarian) : BG +бг + // xn--90ais ("bel", Belarusian/Russian Cyrillic) : BY // Operated by .by registry бел @@ -6590,6 +6631,34 @@ // https://www2.hkirc.hk/register/rules.jsp 香港 +// xn--2scrj9c ("Bharat", Kannada) : IN +// India +ಭಾರತ + +// xn--3hcrj9c ("Bharat", Oriya) : IN +// India +ଭାରତ + +// xn--45br5cyl ("Bharatam", Assamese) : IN +// India +ভাৰত + +// xn--h2breg3eve ("Bharatam", Sanskrit) : IN +// India +भारतम् + +// xn--h2brj9c8c ("Bharot", Santali) : IN +// India +भारोत + +// xn--mgbgu82a ("Bharat", Sindhi) : IN +// India +ڀارت + +// xn--rvc1e0am3e ("Bharatam", Malayalam) : IN +// India +ഭാരതം + // xn--h2brj9c ("Bharat", Devanagari) : IN // India भारत @@ -6731,6 +6800,12 @@ // xn--o3cw4h ("Thai", Thai) : TH // http://www.thnic.co.th ไทย +ศึกษา.ไทย +ธุรกิจ.ไทย +รัฐบาล.ไทย +ทหาร.ไทย +เน็ต.ไทย +องค์กร.ไทย // xn--pgbs0dh ("Tunisia", Arabic) : TN // http://nic.tn @@ -9039,9 +9114,6 @@ // organic : 2014-03-27 Afilias Limited organic -// orientexpress : 2015-02-05 -orientexpress - // origins : 2015-10-01 The Estée Lauder Companies Inc. origins @@ -10478,6 +10550,12 @@ // ===BEGIN PRIVATE DOMAINS=== // (Note: these are in alphabetical order by company name) +// 1GB LLC : https://www.1gb.ua/ +// Submitted by 1GB LLC <noc@1gb.com.ua> +cc.ua +inf.ua +ltd.ua + // Agnat sp. z o.o. : https://domena.pl // Submitted by Przemyslaw Plewa <it-admin@domena.pl> beep.pl @@ -10495,7 +10573,7 @@ // Submitted by Donavan Miller <donavanm@amazon.com> cloudfront.net -// Amazon Elastic Compute Cloud: https://aws.amazon.com/ec2/ +// Amazon Elastic Compute Cloud : https://aws.amazon.com/ec2/ // Submitted by Luke Wells <psl-maintainers@amazon.com> *.compute.amazonaws.com *.compute-1.amazonaws.com @@ -10610,15 +10688,28 @@ // Submitted by Nathan O'Sullivan <nathan@mammoth.com.au> bnr.la +// Boomla : https://boomla.com +// Submitted by Tibor Halter <thalter@boomla.com> +boomla.net + // Boxfuse : https://boxfuse.com // Submitted by Axel Fontaine <axel@boxfuse.com> boxfuse.io +// bplaced : https://www.bplaced.net/ +// Submitted by Miroslav Bozic <security@bplaced.net> +square7.ch +bplaced.com +bplaced.de +square7.de +bplaced.net +square7.net + // BrowserSafetyMark // Submitted by Dave Tharp <browsersafetymark.io@quicinc.com> browsersafetymark.io -// callidomus: https://www.callidomus.com/ +// callidomus : https://www.callidomus.com/ // Submitted by Marcus Popp <admin@callidomus.com> mycd.eu @@ -10692,6 +10783,14 @@ // Submitted by Khash Sajadi <khash@cloud66.com> c66.me +// CloudAccess.net : https://www.cloudaccess.net/ +// Submitted by Pawel Panek <noc@cloudaccess.net> +jdevcloud.com +wpdevcloud.com +cloudaccess.host +freesite.host +cloudaccess.net + // cloudControl : https://www.cloudcontrol.com/ // Submitted by Tobias Wilken <tw@cloudcontrol.com> cloudcontrolled.com @@ -10730,12 +10829,7 @@ co.nl co.no -// Commerce Guys, SAS -// Submitted by Damien Tournoud <damien@commerceguys.com> -// CHROMIUM - Disabled as per https://code.google.com/p/chromium/issues/detail?id=459802 -// *.platform.sh - -// COSIMO GmbH http://www.cosimo.de +// COSIMO GmbH : http://www.cosimo.de // Submitted by Rene Marticke <rmarticke@cosimo.de> dyn.cosidns.de dynamisches-dns.de @@ -10785,6 +10879,10 @@ // Submitted by Norbert Auler <mail@dnshome.de> dnshome.de +// DrayTek Corp. : https://www.draytek.com/ +// Submitted by Paul Fang <mis@draytek.com> +drayddns.com + // DreamHost : http://www.dreamhost.com/ // Submitted by Andrew Farmer <andrew.farmer@dreamhost.com> dreamhosters.com @@ -11100,14 +11198,43 @@ myhome-server.de ddnss.org +// Definima : http://www.definima.com/ +// Submitted by Maxence Bitterli <maxence@definima.com> +definima.net +definima.io + +// Dynu.com : https://www.dynu.com/ +// Submitted by Sue Ye <sue@dynu.com> +ddnsfree.com +ddnsgeek.com +giize.com +gleeze.com +kozow.com +loseyourip.com +ooguy.com +theworkpc.com +casacam.net +dynu.net +accesscam.org +camdvr.org +freeddns.org +mywire.org +webredirect.org +myddns.rocks +blogsite.xyz + // dynv6 : https://dynv6.com -// Submitted by Dominik Menke <dom@digineo.de> 2016-01-18 +// Submitted by Dominik Menke <dom@digineo.de> dynv6.net // E4YOU spol. s.r.o. : https://e4you.cz/ // Submitted by Vladimir Dudr <info@e4you.cz> e4.cz +// Enalean SAS: https://www.enalean.com +// Submitted by Thomas Cottier <thomas.cottier@enalean.com> +mytuleap.com + // Enonic : http://enonic.com/ // Submitted by Erik Kaareng-Sunde <esu@enonic.com> enonic.io @@ -11177,9 +11304,19 @@ eu-1.evennode.com eu-2.evennode.com eu-3.evennode.com +eu-4.evennode.com us-1.evennode.com us-2.evennode.com us-3.evennode.com +us-4.evennode.com + +// eDirect Corp. : https://hosting.url.com.tw/ +// Submitted by C.S. chang <cschang@corp.url.com.tw> +twmail.cc +twmail.net +twmail.org +mymailer.com.tw +url.tw // Facebook, Inc. // Submitted by Peter Ruibal <public-suffix@fb.com> @@ -11283,6 +11420,10 @@ fedorapeople.org cloud.fedoraproject.org +// Filegear Inc. : https://www.filegear.com +// Submitted by Jason Zhu <jason@owtware.com> +filegear.me + // Firebase, Inc. // Submitted by Chris Raynor <chris@firebase.com> firebaseapp.com @@ -11290,6 +11431,7 @@ // Flynn : https://flynn.io // Submitted by Jonathan Rudenberg <jonathan@flynn.io> flynnhub.com +flynnhosting.net // Freebox : http://www.freebox.fr // Submitted by Romain Fliedel <rfliedel@freebox.fr> @@ -11320,11 +11462,6 @@ // Submitted by Patrick Toomey <security@github.com> github.io githubusercontent.com -githubcloud.com -*.api.githubcloud.com -*.ext.githubcloud.com -gist.githubcloud.com -*.githubcloudusercontent.com // GitLab, Inc. // Submitted by Alex Hanselka <alex@gitlab.com> @@ -11422,6 +11559,7 @@ blogspot.ug blogspot.vn cloudfunctions.net +cloud.goog codespot.com googleapis.com googlecode.com @@ -11458,6 +11596,10 @@ biz.at info.at +// info.cx : http://info.cx +// Submitted by Jacob Slater <whois@igloo.to> +info.cx + // Interlegis : http://www.interlegis.leg.br // Submitted by Gabriel Ferreira <registrobr@interlegis.leg.br> ac.leg.br @@ -11513,10 +11655,40 @@ co.krd edu.krd +// LCube - Professional hosting e.K. : https://www.lcube-webhosting.de +// Submitted by Lars Laehn <info@lcube.de> +git-repos.de +lcube-server.de +svn-repos.de + +// LiquidNet Ltd : http://www.liquidnetlimited.com/ +// Submitted by Victor Velchev <admin@liquidnetlimited.com> +we.bs + +// Lukanet Ltd : https://lukanet.com +// Submitted by Anton Avramov <register@lukanet.com> +barsy.bg +barsyonline.com +barsy.de +barsy.eu +barsy.in +barsy.net +barsy.online +barsy.support + // Magento Commerce // Submitted by Damien Tournoud <dtournoud@magento.cloud> *.magentosite.cloud +// Mail.Ru Group : https://hb.cldmail.ru +// Submitted by Ilya Zaretskiy <zaretskiy@corp.mail.ru> +hb.cldmail.ru + +// MetaCentrum, CESNET z.s.p.o. : https://www.metacentrum.cz/en/ +// Submitted by Zdeněk Šustr <zdenek.sustr@cesnet.cz> +cloud.metacentrum.cz +custom.metacentrum.cz + // Meteor Development Group : https://www.meteor.com/hosting // Submitted by Pierre Carrier <pierre@meteor.com> meteorapp.com @@ -11535,6 +11707,11 @@ // Submitted by glob <glob@mozilla.com> bmoattachments.org +// Netlify : https://www.netlify.com +// Submitted by Jessica Parsons <jessica@netlify.com> +bitballoon.com +netlify.com + // Neustar Inc. // Submitted by Trung Tran <Trung.Tran@neustar.biz> 4u.com @@ -11640,10 +11817,59 @@ webhop.me zapto.org +// NodeArt : https://nodeart.io +// Submitted by Konstantin Nosov <Nosov@nodeart.io> +stage.nodeart.io + +// Nodum B.V. : https://nodum.io/ +// Submitted by Wietse Wind <hello+publicsuffixlist@nodum.io> +nodum.co +nodum.io + // NYC.mn : http://www.information.nyc.mn // Submitted by Matthew Brown <mattbrown@nyc.mn> nyc.mn +// NymNom : https://nymnom.com/ +// Submitted by Dave McCormack <dave.mccormack@nymnom.com> +nom.ae +nom.ai +nom.al +nym.by +nym.bz +nom.cl +nom.gd +nom.gl +nym.gr +nom.gt +nom.hn +nom.im +nym.kz +nym.la +nom.li +nym.li +nym.lt +nym.lu +nym.me +nom.mk +nym.mx +nom.nu +nym.nz +nym.pe +nym.pt +nom.pw +nom.qa +nom.rs +nom.si +nym.sk +nym.su +nym.sx +nym.tw +nom.ug +nom.uy +nom.vc +nom.vg + // Octopodal Solutions, LLC. : https://ulterius.io/ // Submitted by Andrew Sampson <andrew@ulterius.io> cya.gg @@ -11701,6 +11927,12 @@ // Submitted by Frédéric VANNIÈRE <f.vanniere@planet-work.com> on-web.fr +// Platform.sh : https://platform.sh +// Submitted by Nikola Kotur <nikola@platform.sh> +// CHROMIUM - Disabled as per https://code.google.com/p/chromium/issues/detail?id=459802 +// *.platform.sh +*.platformsh.site + // prgmr.com : https://prgmr.com/ // Submitted by Sarah Newman <owner@prgmr.com> xen.prgmr.com @@ -11727,6 +11959,15 @@ alpha-myqnapcloud.com myqnapcloud.com +// Quip : https://quip.com +// Submitted by Patrick Linehan <plinehan@quip.com> +*.quipelements.com + +// Qutheory LLC : http://qutheory.io +// Submitted by Jonas Schwartz <jonas@qutheory.io> +vapor.cloud +vaporcloud.io + // Rackmaze LLC : https://www.rackmaze.com // Submitted by Kirill Pertsev <kika@rackmaze.com> rackmaze.com @@ -11768,6 +12009,10 @@ myfirewall.org spdns.org +// SensioLabs, SAS : https://sensiolabs.com/ +// Submitted by Fabien Potencier <fabien.potencier@sensiolabs.com> +*.sensiosite.cloud + // Service Online LLC : http://drs.ua/ // Submitted by Serhii Bulakh <support@drs.ua> biz.ua @@ -11819,6 +12064,10 @@ // Submitted by Philip Hutchins <hostmaster@storj.io> storj.farm +// Sub 6 Limited: http://www.sub6.com +// Submitted by Dan Miller <dm@sub6.com> +temp-dns.com + // Synology, Inc. : https://www.synology.com/ // Submitted by Rony Weng <ronyweng@synology.com> diskstation.me @@ -11847,11 +12096,40 @@ med.pl sopot.pl +// Thingdust AG : https://thingdust.com/ +// Submitted by Adrian Imboden <adi@thingdust.com> +cust.dev.thingdust.io +cust.disrec.thingdust.io +cust.prod.thingdust.io +cust.testing.thingdust.io + // TownNews.com : http://www.townnews.com // Submitted by Dustin Ward <dward@townnews.com> bloxcms.com townnews-staging.com +// TrafficPlex GmbH : https://www.trafficplex.de/ +// Submitted by Phillipp Röll <phillipp.roell@trafficplex.de> +12hp.at +2ix.at +4lima.at +lima-city.at +12hp.ch +2ix.ch +4lima.ch +lima-city.ch +trafficplex.cloud +de.cool +12hp.de +2ix.de +4lima.de +lima-city.de +1337.pictures +clan.rip +lima-city.rocks +webspace.rocks +lima.zone + // TransIP : htts://www.transip.nl // Submitted by Rory Breuk <rbreuk@transip.nl> *.transurl.be @@ -11897,6 +12175,11 @@ // Submitted by Simon Kissel <hostmaster@viprinet.com> router.management +// WeDeploy by Liferay, Inc. : https://www.wedeploy.com +// Submitted by Henrique Vicente <security@wedeploy.com> +wedeploy.io +wedeploy.me + // Western Digital Technologies, Inc : https://www.wdc.com // Submitted by Jung Jin <jungseok.jin@wdc.com> remotewd.com @@ -11905,8 +12188,10 @@ // Submitted by Yuvi Panda <yuvipanda@wikimedia.org> wmflabs.org -// XS4ALL Internet bv: https://www.xs4all.nl/ +// XS4ALL Internet bv : https://www.xs4all.nl/ // Submitted by Daniel Mostertman <unixbeheer+publicsuffix@xs4all.net> +cistron.nl +demon.nl xs4all.space // Yola : https://www.yola.com/ @@ -11932,10 +12217,4 @@ // Submitted by Olli Vanhoja <olli@zeit.co> now.sh -// 1GB LLC : https://www.1gb.ua/ -// Submitted by 1GB LLC <noc@1gb.com.ua> -cc.ua -inf.ua -ltd.ua - // ===END PRIVATE DOMAINS===
diff --git a/net/base/registry_controlled_domains/effective_tld_names.gperf b/net/base/registry_controlled_domains/effective_tld_names.gperf index ba49a41..549579bb 100644 --- a/net/base/registry_controlled_domains/effective_tld_names.gperf +++ b/net/base/registry_controlled_domains/effective_tld_names.gperf
@@ -14,12 +14,22 @@ 0.bg, 0 0emm.com, 6 1.bg, 0 +12hp.at, 4 +12hp.ch, 4 +12hp.de, 4 +1337.pictures, 4 1kapp.com, 4 2.bg, 0 2000.hu, 0 +2ix.at, 4 +2ix.ch, 4 +2ix.de, 4 3.bg, 0 3utilities.com, 4 4.bg, 0 +4lima.at, 4 +4lima.ch, 4 +4lima.de, 4 4u.com, 4 5.bg, 0 6.bg, 0 @@ -62,6 +72,7 @@ ac.cr, 0 ac.cy, 0 ac.gn, 0 +ac.gov.br, 0 ac.id, 0 ac.il, 0 ac.im, 0 @@ -98,6 +109,7 @@ academy, 0 academy.museum, 0 accenture, 0 +accesscam.org, 4 accident-investigation.aero, 0 accident-prevention.aero, 0 accountant, 0 @@ -205,6 +217,7 @@ akune.kagoshima.jp, 0 al, 0 al.eu.org, 4 +al.gov.br, 0 al.it, 0 al.leg.br, 4 al.no, 0 @@ -236,6 +249,7 @@ alwaysdata.net, 6 am, 0 am.br, 0 +am.gov.br, 0 am.leg.br, 4 ama.aichi.jp, 0 ama.shimane.jp, 0 @@ -297,11 +311,11 @@ aosta.it, 0 aostavalley.it, 0 aoste.it, 0 +ap.gov.br, 0 ap.gov.pl, 0 ap.it, 0 ap.leg.br, 4 apartments, 0 -api.githubcloud.com, 6 app, 0 appchizi.com, 4 apple, 0 @@ -488,6 +502,7 @@ b.se, 0 b.ssl.fastly.net, 4 ba, 0 +ba.gov.br, 0 ba.it, 0 ba.leg.br, 4 babia-gora.pl, 0 @@ -533,6 +548,14 @@ barreau.bj, 0 barrel-of-knowledge.info, 4 barrell-of-knowledge.info, 4 +barsy.bg, 4 +barsy.de, 4 +barsy.eu, 4 +barsy.in, 4 +barsy.net, 4 +barsy.online, 4 +barsy.support, 4 +barsyonline.com, 4 barum.no, 0 bas.it, 0 baseball, 0 @@ -572,6 +595,7 @@ beiarn.no, 0 bel.tr, 0 belau.pw, 0 +belem.br, 0 bellevue.museum, 0 belluno.it, 0 benevento.it, 0 @@ -627,6 +651,7 @@ birdart.museum, 0 birkenes.no, 0 birthplace.museum, 0 +bitballoon.com, 4 biz, 0 biz.at, 4 biz.az, 0 @@ -666,6 +691,7 @@ blogdns.net, 4 blogdns.org, 4 blogsite.org, 4 +blogsite.xyz, 4 blogspot.ae, 4 blogspot.al, 4 blogspot.am, 4 @@ -775,6 +801,7 @@ boo, 0 book, 0 booking, 0 +boomla.net, 4 boots, 0 bosch, 0 bostik, 0 @@ -791,6 +818,9 @@ box, 0 boxfuse.io, 4 bozen.it, 0 +bplaced.com, 4 +bplaced.de, 4 +bplaced.net, 4 br, 0 br.com, 4 br.it, 0 @@ -885,6 +915,7 @@ cam, 0 cam.it, 0 cambridge.museum, 0 +camdvr.org, 4 camera, 0 camp, 0 campania.it, 0 @@ -915,6 +946,7 @@ cartier, 0 cartoonart.museum, 0 casa, 0 +casacam.net, 4 casadelamoneda.museum, 0 case, 0 caseih, 0 @@ -998,6 +1030,7 @@ cd, 0 cd.eu.org, 4 cdn77-ssl.net, 4 +ce.gov.br, 0 ce.it, 0 ce.leg.br, 4 ceb, 0 @@ -1097,6 +1130,7 @@ circus.museum, 0 cisco, 0 ciscofreak.com, 4 +cistron.nl, 4 citadel, 0 citi, 0 citic, 0 @@ -1119,6 +1153,7 @@ cl, 0 cl.it, 0 claims, 0 +clan.rip, 4 cleaning, 0 click, 0 clinic, 0 @@ -1128,6 +1163,10 @@ clothing, 0 cloud, 0 cloud.fedoraproject.org, 4 +cloud.goog, 4 +cloud.metacentrum.cz, 4 +cloudaccess.host, 4 +cloudaccess.net, 4 cloudapp.net, 4 cloudcontrolapp.com, 4 cloudcontrolled.com, 4 @@ -1441,6 +1480,7 @@ creditunion, 0 cremona.it, 0 crew.aero, 0 +cri.br, 0 cri.nz, 0 cricket, 0 crimea.ua, 0 @@ -1461,6 +1501,11 @@ culture.museum, 0 cuneo.it, 0 cupcake.is, 4 +cust.dev.thingdust.io, 4 +cust.disrec.thingdust.io, 4 +cust.prod.thingdust.io, 4 +cust.testing.thingdust.io, 4 +custom.metacentrum.cz, 4 customer.enonic.io, 4 cv, 0 cv.ua, 0 @@ -1513,6 +1558,8 @@ dd-dns.de, 4 ddns.me, 4 ddns.net, 4 +ddnsfree.com, 4 +ddnsgeek.com, 4 ddnsking.com, 4 ddnss.de, 4 ddnss.org, 4 @@ -1520,6 +1567,7 @@ dds, 0 de, 0 de.com, 4 +de.cool, 4 de.eu.org, 4 de.us, 0 deal, 0 @@ -1528,7 +1576,10 @@ deatnu.no, 0 decorativearts.museum, 0 dedyn.io, 4 +def.br, 0 defense.tn, 0 +definima.io, 4 +definima.net, 4 degree, 0 delaware.museum, 0 delivery, 0 @@ -1539,6 +1590,7 @@ deloitte, 0 delta, 0 democrat, 0 +demon.nl, 4 denmark.museum, 0 dental, 0 dentist, 0 @@ -1553,6 +1605,7 @@ dev, 0 dev-myqnapcloud.com, 4 dev.static.land, 4 +df.gov.br, 0 df.leg.br, 4 dgca.aero, 0 dhl, 0 @@ -1624,6 +1677,7 @@ drammen.no, 0 drangedal.no, 0 dray-dns.de, 4 +drayddns.com, 4 draydns.de, 4 dreamhosters.com, 4 drive, 0 @@ -1684,6 +1738,7 @@ dyndns.ws, 4 dyndns1.de, 4 dynns.com, 4 +dynu.net, 4 dynv6.net, 4 dynvpn.de, 4 dyroy.no, 0 @@ -1912,6 +1967,7 @@ erotika.hu, 0 es, 0 es.eu.org, 4 +es.gov.br, 0 es.kr, 0 es.leg.br, 4 esan.hokkaido.jp, 0 @@ -1939,6 +1995,7 @@ eu-1.evennode.com, 4 eu-2.evennode.com, 4 eu-3.evennode.com, 4 +eu-4.evennode.com, 4 eu.com, 4 eu.int, 0 eu.meteorapp.com, 4 @@ -1962,7 +2019,6 @@ exposed, 0 express, 0 express.aero, 0 -ext.githubcloud.com, 6 extraspace, 0 f.bg, 0 f.se, 0 @@ -2026,6 +2082,7 @@ field.museum, 0 figueres.museum, 0 filatelia.museum, 0 +filegear.me, 4 film, 0 film.hu, 0 film.museum, 0 @@ -2078,10 +2135,12 @@ flora.no, 0 florence.it, 0 florida.museum, 0 +floripa.br, 0 florist, 0 floro.no, 0 flowers, 0 fly, 0 +flynnhosting.net, 4 flynnhub.com, 4 fm, 0 fm.br, 0 @@ -2133,7 +2192,9 @@ freebox-os.fr, 4 freeboxos.com, 4 freeboxos.fr, 4 +freeddns.org, 4 freemasonry.museum, 0 +freesite.host, 4 freetls.fastly.net, 4 frei.no, 0 freiburg.museum, 0 @@ -2360,15 +2421,14 @@ gifts, 0 gifu.gifu.jp, 0 gifu.jp, 0 +giize.com, 4 gildeskal.no, 0 ginan.gifu.jp, 0 ginowan.okinawa.jp, 0 ginoza.okinawa.jp, 0 giske.no, 0 -gist.githubcloud.com, 4 +git-repos.de, 4 github.io, 4 -githubcloud.com, 4 -githubcloudusercontent.com, 6 githubusercontent.com, 4 gitlab.io, 4 gives, 0 @@ -2384,6 +2444,7 @@ glass, 0 glass.museum, 0 gle, 0 +gleeze.com, 4 gliding.aero, 0 gliwice.pl, 4 global, 0 @@ -2403,6 +2464,7 @@ go.ci, 0 go.cr, 0 go.dyndns.org, 4 +go.gov.br, 0 go.id, 0 go.it, 0 go.jp, 0 @@ -2761,6 +2823,7 @@ hayakawa.yamanashi.jp, 0 hayashima.okayama.jp, 0 hazu.aichi.jp, 0 +hb.cldmail.ru, 4 hb.cn, 0 hbo, 0 hdfc, 0 @@ -3115,6 +3178,7 @@ info.az, 0 info.bb, 0 info.co, 0 +info.cx, 4 info.ec, 0 info.et, 0 info.ht, 0 @@ -3348,11 +3412,13 @@ jaguar, 0 jambyl.su, 4 jamison.museum, 0 +jampa.br, 0 jan-mayen.no, 0 java, 0 jaworzno.pl, 0 jcb, 0 jcp, 0 +jdevcloud.com, 4 je, 0 jeep, 0 jefferson.museum, 0 @@ -3784,6 +3850,7 @@ koza.wakayama.jp, 0 kozagawa.wakayama.jp, 0 kozaki.chiba.jp, 0 +kozow.com, 4 kp, 0 kpmg, 0 kpn, 0 @@ -3935,6 +4002,7 @@ lb, 0 lc, 0 lc.it, 0 +lcube-server.de, 4 lds, 0 le.it, 0 leangaviika.no, 0 @@ -4042,6 +4110,11 @@ lillehammer.no, 0 lillesand.no, 0 lilly, 0 +lima-city.at, 4 +lima-city.ch, 4 +lima-city.de, 4 +lima-city.rocks, 4 +lima.zone, 4 limanowa.pl, 0 limited, 0 limo, 0 @@ -4087,6 +4160,7 @@ loppa.no, 0 lorenskog.no, 0 losangeles.museum, 0 +loseyourip.com, 4 loten.no, 0 lotte, 0 lotto, 0 @@ -4141,6 +4215,7 @@ m.bg, 0 m.se, 0 ma, 0 +ma.gov.br, 0 ma.leg.br, 4 ma.us, 0 macerata.it, 0 @@ -4300,6 +4375,7 @@ metlife, 0 mex.com, 4 mg, 0 +mg.gov.br, 0 mg.leg.br, 4 mh, 0 mi.it, 0 @@ -4581,6 +4657,7 @@ mr.no, 0 mragowo.pl, 0 ms, 0 +ms.gov.br, 0 ms.it, 0 ms.kr, 0 ms.leg.br, 4 @@ -4590,6 +4667,7 @@ msk.su, 4 mt, 0 mt.eu.org, 4 +mt.gov.br, 0 mt.it, 0 mt.leg.br, 4 mt.us, 0 @@ -4628,6 +4706,7 @@ museumcenter.museum, 0 museumvereniging.museum, 0 music.museum, 0 +musica.ar, 0 mutsu.aomori.jp, 0 mutsuzawa.chiba.jp, 0 mutual, 0 @@ -4647,6 +4726,7 @@ myactivedirectory.com, 4 myasustor.com, 4 mycd.eu, 4 +myddns.rocks, 4 mydissent.net, 4 mydrobo.com, 4 myds.me, 4 @@ -4658,6 +4738,7 @@ myfusion.cloud, 4 myhome-server.de, 4 mykolaiv.ua, 0 +mymailer.com.tw, 4 mymediapc.net, 4 myoko.niigata.jp, 0 mypep.link, 4 @@ -4670,7 +4751,9 @@ mysecuritycamera.org, 4 myshopblocks.com, 4 mytis.ru, 4 +mytuleap.com, 4 myvnc.com, 4 +mywire.org, 4 mz, 0 n.bg, 0 n.se, 0 @@ -4963,6 +5046,7 @@ net.zm, 0 netbank, 0 netflix, 0 +netlify.com, 4 network, 0 neues.museum, 0 neustar, 0 @@ -5070,6 +5154,8 @@ noboribetsu.hokkaido.jp, 0 noda.chiba.jp, 0 noda.iwate.jp, 0 +nodum.co, 4 +nodum.io, 4 nogata.fukuoka.jp, 0 nogi.tochigi.jp, 0 noheji.aomori.jp, 0 @@ -5077,20 +5163,41 @@ noip.us, 4 nokia, 0 nom.ad, 0 +nom.ae, 4 nom.ag, 0 +nom.ai, 4 +nom.al, 4 nom.br, 2 +nom.cl, 4 nom.co, 0 nom.es, 0 nom.fr, 0 +nom.gd, 4 +nom.gl, 4 +nom.gt, 4 +nom.hn, 4 +nom.im, 4 nom.km, 0 +nom.li, 4 nom.mg, 0 +nom.mk, 4 +nom.nc, 0 nom.ni, 0 +nom.nu, 4 nom.pa, 0 nom.pe, 0 nom.pl, 0 +nom.pw, 4 +nom.qa, 4 nom.re, 0 nom.ro, 0 +nom.rs, 4 +nom.si, 4 nom.tm, 0 +nom.ug, 4 +nom.uy, 4 +nom.vc, 4 +nom.vg, 4 nom.za, 0 nome.pt, 0 nomi.ishikawa.jp, 0 @@ -5159,6 +5266,23 @@ nyc, 0 nyc.mn, 4 nyc.museum, 0 +nym.by, 4 +nym.bz, 4 +nym.gr, 4 +nym.kz, 4 +nym.la, 4 +nym.li, 4 +nym.lt, 4 +nym.lu, 4 +nym.me, 4 +nym.mx, 4 +nym.nz, 4 +nym.pe, 4 +nym.pt, 4 +nym.sk, 4 +nym.su, 4 +nym.sx, 4 +nym.tw, 4 nyny.museum, 0 nysa.pl, 0 nyuzen.toyama.jp, 0 @@ -5303,6 +5427,7 @@ ontario.museum, 0 onthewifi.com, 4 onyourside, 0 +ooguy.com, 4 ookuwa.nagano.jp, 0 ooo, 0 ooshika.nagano.jp, 0 @@ -5477,7 +5602,6 @@ org.zm, 0 org.zw, 0 organic, 0 -orientexpress, 0 origins, 0 oristano.it, 0 orkanger.no, 0 @@ -5556,6 +5680,7 @@ p.bg, 0 p.se, 0 pa, 0 +pa.gov.br, 0 pa.gov.pl, 0 pa.it, 0 pa.leg.br, 4 @@ -5596,6 +5721,7 @@ pavia.it, 0 pay, 0 pb.ao, 0 +pb.gov.br, 0 pb.leg.br, 4 pc.it, 0 pc.pl, 0 @@ -5603,6 +5729,7 @@ pd.it, 0 pe, 0 pe.ca, 0 +pe.gov.br, 0 pe.it, 0 pe.kr, 0 pe.leg.br, 4 @@ -5641,6 +5768,7 @@ photography.museum, 0 photos, 0 physio, 0 +pi.gov.br, 0 pi.it, 0 pi.leg.br, 4 piacenza.it, 0 @@ -5675,6 +5803,7 @@ planetarium.museum, 0 plantation.museum, 0 plants.museum, 0 +platformsh.site, 6 play, 0 playstation, 0 plaza.museum, 0 @@ -5691,6 +5820,7 @@ pnc, 0 po.gov.pl, 0 po.it, 0 +poa.br, 0 podhale.pl, 0 podlasie.pl, 0 podzone.net, 4 @@ -5730,6 +5860,7 @@ pp.ua, 4 ppg.br, 0 pr, 0 +pr.gov.br, 0 pr.it, 0 pr.leg.br, 4 pr.us, 0 @@ -5833,6 +5964,7 @@ quebec.museum, 0 quest, 0 quicksytes.com, 4 +quipelements.com, 6 qvc, 0 r.bg, 0 r.cdn77.net, 4 @@ -5881,6 +6013,7 @@ rec.ro, 0 rec.ve, 0 recht.pro, 0 +recife.br, 0 recipes, 0 recreation.aero, 0 red, 0 @@ -5951,10 +6084,12 @@ rissa.no, 0 ritto.shiga.jp, 0 rivne.ua, 0 +rj.gov.br, 0 rj.leg.br, 4 rl.no, 0 rm.it, 0 rmit, 0 +rn.gov.br, 0 rn.it, 0 rn.leg.br, 4 rnrt.tn, 0 @@ -5962,6 +6097,7 @@ rnu.tn, 0 ro, 0 ro.eu.org, 4 +ro.gov.br, 0 ro.im, 4 ro.it, 0 ro.leg.br, 4 @@ -5989,8 +6125,10 @@ rovno.ua, 0 royken.no, 0 royrvik.no, 0 +rr.gov.br, 0 rr.leg.br, 4 rs, 0 +rs.gov.br, 0 rs.leg.br, 4 rsc.cdn77.org, 4 rsvp, 0 @@ -6189,6 +6327,7 @@ sbs, 0 sc, 0 sc.cn, 0 +sc.gov.br, 0 sc.kr, 0 sc.leg.br, 4 sc.tz, 0 @@ -6246,6 +6385,7 @@ se, 0 se.com, 4 se.eu.org, 4 +se.gov.br, 0 se.leg.br, 4 se.net, 4 seaport.museum, 0 @@ -6285,6 +6425,7 @@ sendai.jp, 2 sener, 0 sennan.osaka.jp, 0 +sensiosite.cloud, 6 seoul.kr, 0 sera.hiroshima.jp, 0 seranishi.hiroshima.jp, 0 @@ -6565,6 +6706,7 @@ southwest.museum, 0 sowa.ibaraki.jp, 0 soy, 0 +sp.gov.br, 0 sp.it, 0 sp.leg.br, 4 space, 0 @@ -6584,6 +6726,9 @@ spy.museum, 0 spydeberg.no, 0 square.museum, 0 +square7.ch, 4 +square7.de, 4 +square7.net, 4 sr, 0 sr.gov.pl, 0 sr.it, 0 @@ -6597,6 +6742,7 @@ stackspace.space, 4 stada, 0 stadt.museum, 0 +stage.nodeart.io, 4 stalbans.museum, 0 stalowa-wola.pl, 0 stange.no, 0 @@ -6703,6 +6849,7 @@ sveio.no, 0 svelvik.no, 0 svizzera.museum, 0 +svn-repos.de, 4 swatch, 0 sweden.museum, 0 sweetpepper.org, 4 @@ -6861,6 +7008,7 @@ telekommunikation.museum, 0 television.museum, 0 temasek, 0 +temp-dns.com, 4 tempio-olbia.it, 0 tempioolbia.it, 0 tendo.yamagata.jp, 0 @@ -6887,6 +7035,7 @@ theater, 0 theater.museum, 0 theatre, 0 +theworkpc.com, 4 thruhere.net, 4 tiaa, 0 tickets, 0 @@ -6927,6 +7076,7 @@ tn.it, 0 tn.us, 0 to, 0 +to.gov.br, 0 to.it, 0 to.leg.br, 4 toba.mie.jp, 0 @@ -7042,6 +7192,7 @@ trading, 0 trading.aero, 0 traeumtgerade.de, 4 +trafficplex.cloud, 4 trainer.aero, 0 training, 0 trana.no, 0 @@ -7161,6 +7312,9 @@ tvs, 0 tw, 0 tw.cn, 0 +twmail.cc, 4 +twmail.net, 4 +twmail.org, 4 tx.us, 0 tychy.pl, 0 tydal.no, 0 @@ -7240,6 +7394,7 @@ urbinopesaro.it, 0 ureshino.mie.jp, 0 uri.arpa, 0 +url.tw, 4 urn.arpa, 0 uruma.okinawa.jp, 0 uryu.hokkaido.jp, 0 @@ -7247,6 +7402,7 @@ us-1.evennode.com, 4 us-2.evennode.com, 4 us-3.evennode.com, 4 +us-4.evennode.com, 4 us-east-1.amazonaws.com, 4 us.com, 4 us.eu.org, 4 @@ -7320,6 +7476,8 @@ vantaa.museum, 0 vanylven.no, 0 vao.it, 0 +vapor.cloud, 4 +vaporcloud.io, 4 vardo.no, 0 varese.it, 0 varggat.no, 0 @@ -7398,6 +7556,7 @@ viterbo.it, 0 viva, 0 vivo, 0 +vix.br, 0 vlaanderen, 0 vlaanderen.museum, 0 vladikavkaz.ru, 4 @@ -7469,6 +7628,7 @@ watches, 0 waw.pl, 0 wazuka.kyoto.jp, 0 +we.bs, 4 weather, 0 weatherchannel, 0 web.co, 0 @@ -7489,9 +7649,13 @@ webhop.me, 4 webhop.net, 4 webhop.org, 4 +webredirect.org, 4 website, 0 +webspace.rocks, 4 wed, 0 wedding, 0 +wedeploy.io, 4 +wedeploy.me, 4 wegrow.pl, 0 weibo, 0 weir, 0 @@ -7540,6 +7704,7 @@ world, 0 worse-than.tv, 4 wow, 0 +wpdevcloud.com, 4 writesthisblog.com, 4 wroc.pl, 4 wroclaw.pl, 0 @@ -7567,20 +7732,26 @@ xj.cn, 0 xn--0trq7p7nn.jp, 0 xn--11b4c3d, 0 +xn--12c1fe0br.xn--o3cw4h, 0 +xn--12cfi8ixb8l.xn--o3cw4h, 0 +xn--12co0c3b4eva.xn--o3cw4h, 0 xn--1ck2e1b, 0 xn--1ctwo.jp, 0 xn--1lqs03n.jp, 0 xn--1lqs71d.jp, 0 xn--1qqw23a, 0 xn--2m4a15e.jp, 0 +xn--2scrj9c, 0 xn--30rr7y, 0 xn--32vp30h.jp, 0 xn--3bst00m, 0 xn--3ds443g, 0 xn--3e0b707e, 0 +xn--3hcrj9c, 0 xn--3oq18vl8pn36a, 0 xn--3pxu8k, 0 xn--42c2d9a, 0 +xn--45br5cyl, 0 xn--45brj9c, 0 xn--45q11c, 0 xn--4gbrim, 0 @@ -7612,6 +7783,7 @@ xn--8pvr4u.jp, 0 xn--8y0a063a, 0 xn--90a3ac, 0 +xn--90ae, 0 xn--90ais, 0 xn--90azh.xn--90a3ac, 0 xn--9dbhblg6di.museum, 0 @@ -7707,7 +7879,10 @@ xn--gmqw5a.hk, 0 xn--h-2fa.no, 0 xn--h1aegh.museum, 0 +xn--h2breg3eve, 0 xn--h2brj9c, 0 +xn--h2brj9c8c, 0 +xn--h3cuzk1di.xn--o3cw4h, 0 xn--hbmer-xqa.no, 0 xn--hcesuolo-7ya35b.no, 0 xn--hery-ira.nordland.no, 0 @@ -7777,6 +7952,7 @@ xn--lt-liac.no, 0 xn--lten-gra.no, 0 xn--lury-ira.no, 0 +xn--m3ch0j3a.xn--o3cw4h, 0 xn--mely-ira.no, 0 xn--merker-kua.no, 0 xn--mgb2ddes, 0 @@ -7799,6 +7975,7 @@ xn--mgbca7dzdo, 0 xn--mgberp4a5d4a87g, 0 xn--mgberp4a5d4ar, 0 +xn--mgbgu82a, 0 xn--mgbi4ecexp, 0 xn--mgbpl2fh, 0 xn--mgbqly7c0a67fbc, 0 @@ -7843,6 +8020,7 @@ xn--o1ac.xn--90a3ac, 0 xn--o1ach.xn--90a3ac, 0 xn--o3cw4h, 0 +xn--o3cyx2a.xn--o3cw4h, 0 xn--od0alg.cn, 0 xn--od0alg.hk, 0 xn--od0aq3b.hk, 0 @@ -7883,6 +8061,7 @@ xn--rskog-uua.no, 0 xn--rst-0na.no, 0 xn--rsta-fra.no, 0 +xn--rvc1e0am3e, 0 xn--ryken-vua.no, 0 xn--ryrvik-bya.no, 0 xn--s-1fa.no, 0
diff --git a/net/http2/PRESUBMIT.py b/net/http2/PRESUBMIT.py new file mode 100644 index 0000000..9e6980d1 --- /dev/null +++ b/net/http2/PRESUBMIT.py
@@ -0,0 +1,62 @@ +# 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. + +import re + +def CheckForbiddenRegex(change, forbidden_regex, message_type, message): + problems = [] + for path, change_per_file in change: + line_num = 1 + for line in change_per_file: + if forbidden_regex.match(line): + problems.extend([" %s:%d" % (path, line_num)]) + line_num += 1 + if not problems: + return [] + return [message_type(message + ":\n" + "\n".join(problems))] + + +def CheckChange(input_api, message_type): + result = [] + shared_source_files = re.compile("^net/http2/(?!platform/impl/).*\.(h|cc)$") + change = [(affected_file.LocalPath(), affected_file.NewContents()) + for affected_file in input_api.AffectedTestableFiles() + if shared_source_files.match(affected_file.LocalPath())] + forbidden_regex_list = [ + r"^#include \"net/base/net_export.h\"$", + r"\bNET_EXPORT\b", + r"\bNET_EXPORT_PRIVATE\b", + "^#include <string>$", + r"\bstd::string\b", + r"^#include \"base/strings/string_piece.h\"$", + r"\bbase::StringPiece\b", + r"\bbase::StringPrintf\b", + r"\bbase::StringAppendF\b", + r"\bbase::HexDigitToInt\b", + ] + messages = [ + "Include \"http2/platform/api/http2_export.h\" " + "instead of \"net/base/net_export.h\"", + "Use HTTP2_EXPORT instead of NET_EXPORT", + "Use HTTP2_EXPORT_PRIVATE instead of NET_EXPORT_PRIVATE", + "Include \"http2/platform/api/http2_string.h\" instead of <string>", + "Use Http2String instead of std::string", + "Include \"http2/platform/api/http2_string_piece.h\" " + "instead of \"base/strings/string_piece.h\"", + "Use Http2StringPiece instead of base::StringPiece", + "Use Http2StringPrintf instead of base::StringPrintf", + ] + for forbidden_regex, message in zip(forbidden_regex_list, messages): + result.extend(CheckForbiddenRegex( + change, re.compile(forbidden_regex), message_type, message)) + return result + +# Warn before uploading but allow developer to skip warning +# so that CLs can be shared and reviewed before addressing all issues. +def CheckChangeOnUpload(input_api, output_api): + return CheckChange(input_api, output_api.PresubmitPromptWarning) + +# Do not allow code with forbidden patterns to be checked in. +def CheckChangeOnCommit(input_api, output_api): + return CheckChange(input_api, output_api.PresubmitError)
diff --git a/net/http2/decoder/decode_buffer.h b/net/http2/decoder/decode_buffer.h index e23ca683..622e571 100644 --- a/net/http2/decoder/decode_buffer.h +++ b/net/http2/decoder/decode_buffer.h
@@ -19,8 +19,8 @@ #include "base/logging.h" #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { class DecodeBufferSubset; @@ -32,7 +32,7 @@ DCHECK(buffer != nullptr); DCHECK_LE(len, MaxDecodeBufferLength()); } - explicit DecodeBuffer(base::StringPiece s) + explicit DecodeBuffer(Http2StringPiece s) : DecodeBuffer(s.data(), s.size()) {} // Constructor for character arrays, typically in tests. For example: // const char input[] = { 0x11 };
diff --git a/net/http2/decoder/decode_buffer_test.cc b/net/http2/decoder/decode_buffer_test.cc index 4494122..b982d4c9 100644 --- a/net/http2/decoder/decode_buffer_test.cc +++ b/net/http2/decoder/decode_buffer_test.cc
@@ -4,16 +4,10 @@ #include "net/http2/decoder/decode_buffer.h" -#include <string> - #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/tools/http2_random.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; -using std::string; - namespace net { namespace test { namespace {
diff --git a/net/http2/decoder/decode_http2_structures.cc b/net/http2/decoder/decode_http2_structures.cc index e03be23..889e282 100644 --- a/net/http2/decoder/decode_http2_structures.cc +++ b/net/http2/decoder/decode_http2_structures.cc
@@ -4,8 +4,6 @@ #include "net/http2/decoder/decode_http2_structures.h" -#include <string.h> - #include "base/logging.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/http2_constants.h"
diff --git a/net/http2/decoder/decode_http2_structures_test.cc b/net/http2/decoder/decode_http2_structures_test.cc index 09e6b56..82200f2 100644 --- a/net/http2/decoder/decode_http2_structures_test.cc +++ b/net/http2/decoder/decode_http2_structures_test.cc
@@ -8,14 +8,14 @@ // in net/http2/http2_structures.h). #include <stddef.h> -#include <string> #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/http2_frame_builder.h" #include "net/http2/tools/http2_random.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,20 +23,18 @@ using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; -using std::string; namespace net { namespace test { namespace { template <typename T, size_t N> -StringPiece ToStringPiece(T (&data)[N]) { - return StringPiece(reinterpret_cast<const char*>(data), N * sizeof(T)); +Http2StringPiece ToStringPiece(T (&data)[N]) { + return Http2StringPiece(reinterpret_cast<const char*>(data), N * sizeof(T)); } template <class S> -string SerializeStructure(const S& s) { +Http2String SerializeStructure(const S& s) { Http2FrameBuilder fb; fb.Append(s); EXPECT_EQ(S::EncodedSize(), fb.size()); @@ -57,7 +55,7 @@ // Fully decodes the Structure at the start of data, and confirms it matches // *expected (if provided). - void DecodeLeadingStructure(const S* expected, StringPiece data) { + void DecodeLeadingStructure(const S* expected, Http2StringPiece data) { ASSERT_LE(S::EncodedSize(), data.size()); DecodeBuffer db(data); Randomize(&structure_); @@ -70,13 +68,13 @@ template <size_t N> void DecodeLeadingStructure(const char (&data)[N]) { - DecodeLeadingStructure(nullptr, StringPiece(data, N)); + DecodeLeadingStructure(nullptr, Http2StringPiece(data, N)); } // Encode the structure |in_s| into bytes, then decode the bytes // and validate that the decoder produced the same field values. void EncodeThenDecode(const S& in_s) { - string bytes = SerializeStructure(in_s); + Http2String bytes = SerializeStructure(in_s); EXPECT_EQ(S::EncodedSize(), bytes.size()); DecodeLeadingStructure(&in_s, bytes); } @@ -295,7 +293,8 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(StringPiece(kData, 8), ToStringPiece(structure_.opaque_data)); + EXPECT_EQ(Http2StringPiece(kData, 8), + ToStringPiece(structure_.opaque_data)); } } { @@ -305,7 +304,8 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(StringPiece(kData, 8), ToStringPiece(structure_.opaque_data)); + EXPECT_EQ(Http2StringPiece(kData, 8), + ToStringPiece(structure_.opaque_data)); } } { @@ -314,7 +314,8 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(StringPiece(kData, 8), ToStringPiece(structure_.opaque_data)); + EXPECT_EQ(Http2StringPiece(kData, 8), + ToStringPiece(structure_.opaque_data)); } } }
diff --git a/net/http2/decoder/http2_frame_decoder_test.cc b/net/http2/decoder/http2_frame_decoder_test.cc index 28e2ef26..a1d8483 100644 --- a/net/http2/decoder/http2_frame_decoder_test.cc +++ b/net/http2/decoder/http2_frame_decoder_test.cc
@@ -6,13 +6,13 @@ // Tests of Http2FrameDecoder. -#include <memory> -#include <string> #include <vector> #include "base/logging.h" #include "net/http2/http2_constants.h" #include "net/http2/platform/api/http2_reconstruct_object.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector_listener.h" #include "net/http2/tools/failure.h" @@ -20,8 +20,6 @@ #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; -using std::string; using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -86,7 +84,7 @@ // The decoder will discard the remaining bytes, but not go beyond that, // which these conditions verify. size_t extra = 10; - string junk(remaining + extra, '0'); + Http2String junk(remaining + extra, '0'); DecodeBuffer tmp(junk); EXPECT_EQ(DecodeStatus::kDecodeDone, decoder_.DecodeFrame(&tmp)); EXPECT_EQ(remaining, tmp.Offset()); @@ -122,7 +120,7 @@ VERIFY_AND_RETURN_SUCCESS(expected.VerifyEquals(*collector_.frame(0))); } - AssertionResult DecodePayloadAndValidateSeveralWays(StringPiece payload, + AssertionResult DecodePayloadAndValidateSeveralWays(Http2StringPiece payload, Validator validator) { DecodeBuffer db(payload); bool start_decoding_requires_non_empty = false; @@ -136,7 +134,7 @@ // payload will be decoded several times with different partitionings // of the payload, and after each the validator will be called. AssertionResult DecodePayloadAndValidateSeveralWays( - StringPiece payload, + Http2StringPiece payload, const FrameParts& expected) { Validator validator = [&expected, this]( const DecodeBuffer& input, DecodeStatus status) -> AssertionResult { @@ -150,8 +148,8 @@ VERIFY_GT(slow_decode_count_, 0u); // Repeat with more input; it should stop without reading that input. - string next_frame = Random().RandString(10); - string input(payload.data(), payload.size()); + Http2String next_frame = Random().RandString(10); + Http2String input(payload.data(), payload.size()); input += next_frame; ResetDecodeSpeedCounters(); @@ -167,14 +165,15 @@ AssertionResult DecodePayloadAndValidateSeveralWays( const char (&buf)[N], const FrameParts& expected) { - return DecodePayloadAndValidateSeveralWays(StringPiece(buf, N), expected); + return DecodePayloadAndValidateSeveralWays(Http2StringPiece(buf, N), + expected); } template <size_t N> AssertionResult DecodePayloadAndValidateSeveralWays( const char (&buf)[N], const Http2FrameHeader& header) { - return DecodePayloadAndValidateSeveralWays(StringPiece(buf, N), + return DecodePayloadAndValidateSeveralWays(Http2StringPiece(buf, N), FrameParts(header)); }
diff --git a/net/http2/decoder/http2_structure_decoder_test.cc b/net/http2/decoder/http2_structure_decoder_test.cc index 477da7f..90d4161 100644 --- a/net/http2/decoder/http2_structure_decoder_test.cc +++ b/net/http2/decoder/http2_structure_decoder_test.cc
@@ -19,15 +19,15 @@ // frame payload. #include <stddef.h> -#include <string> #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" #include "net/http2/platform/api/http2_reconstruct_object.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_frame_builder.h" #include "net/http2/tools/random_decoder_test.h" @@ -36,8 +36,6 @@ using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; -using std::string; namespace net { namespace test { @@ -94,7 +92,8 @@ // Fully decodes the Structure at the start of data, and confirms it matches // *expected (if provided). - AssertionResult DecodeLeadingStructure(const S* expected, StringPiece data) { + AssertionResult DecodeLeadingStructure(const S* expected, + Http2StringPiece data) { VERIFY_LE(S::EncodedSize(), data.size()); DecodeBuffer original(data); @@ -146,7 +145,7 @@ template <size_t N> AssertionResult DecodeLeadingStructure(const char (&data)[N]) { VERIFY_AND_RETURN_SUCCESS( - DecodeLeadingStructure(nullptr, StringPiece(data, N))); + DecodeLeadingStructure(nullptr, Http2StringPiece(data, N))); } template <size_t N> @@ -158,7 +157,7 @@ // Encode the structure |in_s| into bytes, then decode the bytes // and validate that the decoder produced the same field values. AssertionResult EncodeThenDecode(const S& in_s) { - string bytes = SerializeStructure(in_s); + Http2String bytes = SerializeStructure(in_s); VERIFY_EQ(S::EncodedSize(), bytes.size()); VERIFY_AND_RETURN_SUCCESS(DecodeLeadingStructure(&in_s, bytes)); }
diff --git a/net/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc index 87f9074a..c58d80f8 100644 --- a/net/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/http2_frame_builder.h" @@ -20,8 +19,6 @@ #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { @@ -112,8 +109,8 @@ ::testing::Values(0, 1, 3, 65537))); TEST_P(AltSvcPayloadLengthTests, ValidOriginAndValueLength) { - string origin = Random().RandString(origin_length_); - string value = Random().RandString(value_length_); + Http2String origin = Random().RandString(origin_length_); + Http2String value = Random().RandString(value_length_); Http2FrameBuilder fb; fb.Append(Http2AltSvcFields{origin_length_}); fb.Append(origin);
diff --git a/net/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc index 33657f9..01a9a9e 100644 --- a/net/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include <string> #include <type_traits> #include "base/logging.h" @@ -14,13 +13,12 @@ #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { @@ -81,7 +79,7 @@ ::testing::Values(0, 1, 2, 3, 4, 5, 6)); TEST_P(ContinuationPayloadDecoderTest, ValidLength) { - string hpack_payload = Random().RandString(length_); + Http2String hpack_payload = Random().RandString(length_); Http2FrameHeader frame_header(length_, Http2FrameType::CONTINUATION, RandFlags(), RandStreamId()); set_frame_header(frame_header);
diff --git a/net/http2/decoder/payload_decoders/data_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/data_payload_decoder_test.cc index c6dabad2..be0b34ab 100644 --- a/net/http2/decoder/payload_decoders/data_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/data_payload_decoder_test.cc
@@ -6,14 +6,13 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/failure.h" @@ -23,7 +22,6 @@ #include "testing/gtest/include/gtest/gtest.h" using ::testing::AssertionResult; -using std::string; namespace net { namespace test { @@ -91,7 +89,7 @@ Reset(); uint8_t flags = RandFlags(); - string data_payload = Random().RandString(data_size); + Http2String data_payload = Random().RandString(data_size); frame_builder_.Append(data_payload); MaybeAppendTrailingPadding();
diff --git a/net/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc index 28092bae..ccb01146 100644 --- a/net/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/http2_frame_builder.h" @@ -20,8 +19,6 @@ #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { @@ -100,7 +97,7 @@ TEST_P(GoAwayOpaqueDataLengthTests, ValidLength) { Http2GoAwayFields goaway; Randomize(&goaway, RandomPtr()); - string opaque_data = Random().RandString(length_); + Http2String opaque_data = Random().RandString(length_); Http2FrameBuilder fb; fb.Append(goaway); fb.Append(opaque_data);
diff --git a/net/http2/decoder/payload_decoders/headers_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/headers_payload_decoder_test.cc index 0fdce71..55bd73f 100644 --- a/net/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/headers_payload_decoder_test.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/http2_frame_builder.h" @@ -20,8 +19,6 @@ #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { @@ -125,7 +122,7 @@ frame_builder_.Append(priority); } - string hpack_payload = Random().RandString(hpack_size); + Http2String hpack_payload = Random().RandString(hpack_size); frame_builder_.Append(hpack_payload); MaybeAppendTrailingPadding();
diff --git a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc index 4fd4aba..10c5652 100644 --- a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc +++ b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc
@@ -75,7 +75,7 @@ ::testing::AssertionResult PayloadDecoderBaseTest::DecodePayloadAndValidateSeveralWays( - base::StringPiece payload, + Http2StringPiece payload, Validator validator) { VERIFY_TRUE(frame_header_is_set_); // Cap the payload to be decoded at the declared payload length. This is @@ -85,7 +85,7 @@ // Note that it is OK if the payload is too short; the validator may be // designed to check for that. if (payload.size() > frame_header_.payload_length) { - payload = base::StringPiece(payload.data(), frame_header_.payload_length); + payload = Http2StringPiece(payload.data(), frame_header_.payload_length); } DecodeBuffer db(payload); ResetDecodeSpeedCounters();
diff --git a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index fad3c8d..43be7b5 100644 --- a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -9,10 +9,7 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/decoder/frame_decoder_state.h" @@ -21,6 +18,8 @@ #include "net/http2/http2_constants_test_util.h" #include "net/http2/http2_structures.h" #include "net/http2/platform/api/http2_reconstruct_object.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/tools/http2_frame_builder.h" #include "net/http2/tools/random_decoder_test.h" @@ -87,7 +86,7 @@ // Given the specified payload (without the common frame header), decode // it with several partitionings of the payload. ::testing::AssertionResult DecodePayloadAndValidateSeveralWays( - base::StringPiece payload, + Http2StringPiece payload, Validator validator); // TODO(jamessynge): Add helper method for verifying these are both non-zero, @@ -196,7 +195,7 @@ // will be decoded several times with different partitionings of the payload, // and after each the validator will be called. AssertionResult DecodePayloadAndValidateSeveralWays( - base::StringPiece payload, + Http2StringPiece payload, const FrameParts& expected) { NoArgValidator validator = [&expected, this]() -> AssertionResult { VERIFY_FALSE(listener_.IsInProgress()); @@ -215,7 +214,7 @@ // std::nullptr_t (not extra validation). template <typename WrappedValidator> ::testing::AssertionResult VerifyDetectsFrameSizeError( - base::StringPiece payload, + Http2StringPiece payload, const Http2FrameHeader& header, WrappedValidator wrapped_validator) { set_frame_header(header); @@ -254,7 +253,7 @@ // randomly selected flag bits not excluded by FlagsAffectingPayloadDecoding. ::testing::AssertionResult VerifyDetectsMultipleFrameSizeErrors( uint8_t required_flags, - base::StringPiece unpadded_payload, + Http2StringPiece unpadded_payload, ApproveSize approve_size, int total_pad_length) { // required_flags should come from those that are defined for the frame @@ -312,7 +311,7 @@ // As above, but for frames without padding. ::testing::AssertionResult VerifyDetectsFrameSizeError( uint8_t required_flags, - base::StringPiece unpadded_payload, + Http2StringPiece unpadded_payload, ApproveSize approve_size) { Http2FrameType frame_type = DecoderPeer::FrameType(); uint8_t known_flags = KnownFlagsMaskForFrameType(frame_type); @@ -392,7 +391,7 @@ // amount of missing padding is as specified. header.IsPadded must be true, // and the payload must be empty or the PadLength field must be too large. ::testing::AssertionResult VerifyDetectsPaddingTooLong( - base::StringPiece payload, + Http2StringPiece payload, const Http2FrameHeader& header, size_t expected_missing_length) { set_frame_header(header); @@ -435,7 +434,7 @@ } VLOG(1) << "payload_length=" << payload_length; - std::string payload = fb.buffer().substr(0, payload_length); + Http2String payload = fb.buffer().substr(0, payload_length); // The missing length is the amount we cut off the end, unless // payload_length is zero, in which case the decoder knows only that 1
diff --git a/net/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc index f4b9340..0739687 100644 --- a/net/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include <string> - #include "base/logging.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/http2_frame_builder.h" @@ -20,8 +19,6 @@ #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { @@ -107,7 +104,7 @@ for (size_t hpack_size : {0, 1, 2, 3, 255, 256, 1024}) { LOG(INFO) << "########### hpack_size = " << hpack_size << " ###########"; Reset(); - string hpack_payload = Random().RandString(hpack_size); + Http2String hpack_payload = Random().RandString(hpack_size); Http2PushPromiseFields push_promise{RandStreamId()}; frame_builder_.Append(push_promise); frame_builder_.Append(hpack_payload);
diff --git a/net/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc b/net/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc index 05650c28..27a9548 100644 --- a/net/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +++ b/net/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include <string> #include <type_traits> #include "base/logging.h" @@ -14,14 +13,13 @@ #include "net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/test_tools/frame_parts.h" #include "net/http2/test_tools/frame_parts_collector.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" -using std::string; - namespace net { namespace test { namespace { @@ -90,7 +88,7 @@ ::testing::Values(0, 1, 2, 3, 255, 256)); TEST_P(UnknownPayloadDecoderTest, ValidLength) { - string unknown_payload = Random().RandString(length_); + Http2String unknown_payload = Random().RandString(length_); Http2FrameHeader frame_header(length_, g_unknown_frame_type, Random().Rand8(), RandStreamId()); set_frame_header(frame_header);
diff --git a/net/http2/hpack/decoder/hpack_block_collector.cc b/net/http2/hpack/decoder/hpack_block_collector.cc index 94f58ee4..4e433e0e 100644 --- a/net/http2/hpack/decoder/hpack_block_collector.cc +++ b/net/http2/hpack/decoder/hpack_block_collector.cc
@@ -13,9 +13,6 @@ using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using std::string; - -using base::StringPiece; namespace net { namespace test { @@ -77,17 +74,18 @@ entries_.push_back( HpackEntryCollector(HpackEntryType::kDynamicTableSizeUpdate, size)); } -void HpackBlockCollector::ExpectNameIndexAndLiteralValue(HpackEntryType type, - size_t index, - bool value_huffman, - const string& value) { +void HpackBlockCollector::ExpectNameIndexAndLiteralValue( + HpackEntryType type, + size_t index, + bool value_huffman, + const Http2String& value) { entries_.push_back(HpackEntryCollector(type, index, value_huffman, value)); } void HpackBlockCollector::ExpectLiteralNameAndValue(HpackEntryType type, bool name_huffman, - const string& name, + const Http2String& name, bool value_huffman, - const string& value) { + const Http2String& value) { entries_.push_back( HpackEntryCollector(type, name_huffman, name, value_huffman, value)); } @@ -115,7 +113,7 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - StringPiece expected_value) const { + Http2StringPiece expected_value) const { VERIFY_TRUE(pending_entry_.IsClear()); VERIFY_EQ(1u, entries_.size()); VERIFY_TRUE(entries_.front().ValidateLiteralValueHeader( @@ -125,9 +123,9 @@ AssertionResult HpackBlockCollector::ValidateSoleLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - StringPiece expected_name, + Http2StringPiece expected_name, bool expected_value_huffman, - StringPiece expected_value) const { + Http2StringPiece expected_value) const { VERIFY_TRUE(pending_entry_.IsClear()); VERIFY_EQ(1u, entries_.size()); VERIFY_TRUE(entries_.front().ValidateLiteralNameValueHeader(
diff --git a/net/http2/hpack/decoder/hpack_block_collector.h b/net/http2/hpack/decoder/hpack_block_collector.h index 2b283b9..08f4df3 100644 --- a/net/http2/hpack/decoder/hpack_block_collector.h +++ b/net/http2/hpack/decoder/hpack_block_collector.h
@@ -15,14 +15,14 @@ #include <stddef.h> -#include <string> #include <vector> -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_entry_collector.h" #include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/hpack/tools/hpack_block_builder.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -65,14 +65,14 @@ void ExpectNameIndexAndLiteralValue(HpackEntryType type, size_t index, bool value_huffman, - const std::string& value); + const Http2String& value); // Add an HPACK entry for a header entry with a literal name and value. void ExpectLiteralNameAndValue(HpackEntryType type, bool name_huffman, - const std::string& name, + const Http2String& name, bool value_huffman, - const std::string& value); + const Http2String& value); // Shuffle the entries, in support of generating an HPACK block of entries // in some random order. @@ -96,16 +96,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - base::StringPiece expected_value) const; + Http2StringPiece expected_value) const; // Return AssertionSuccess if there is just one entry, and it is a Header // with a literal name and literal value. ::testing::AssertionResult ValidateSoleLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - base::StringPiece expected_name, + Http2StringPiece expected_name, bool expected_value_huffman, - base::StringPiece expected_value) const; + Http2StringPiece expected_value) const; bool IsNotPending() const { return pending_entry_.IsClear(); } bool IsClear() const { return IsNotPending() && entries_.empty(); }
diff --git a/net/http2/hpack/decoder/hpack_block_decoder.cc b/net/http2/hpack/decoder/hpack_block_decoder.cc index 29b6869..afa3de3 100644 --- a/net/http2/hpack/decoder/hpack_block_decoder.cc +++ b/net/http2/hpack/decoder/hpack_block_decoder.cc
@@ -7,9 +7,9 @@ #include <stdint.h> #include <sstream> -#include <string> #include "base/logging.h" +#include "net/http2/platform/api/http2_string_utils.h" namespace net { @@ -50,12 +50,11 @@ return DecodeStatus::kDecodeDone; } -std::string HpackBlockDecoder::DebugString() const { - std::stringstream ss; - ss << "HpackBlockDecoder(" << entry_decoder_.DebugString() << ", listener@" - << std::hex << reinterpret_cast<intptr_t>(listener_) - << (before_entry_ ? ", between entries)" : ", in an entry)"); - return ss.str(); +Http2String HpackBlockDecoder::DebugString() const { + return Http2StrCat("HpackBlockDecoder(", entry_decoder_.DebugString(), + ", listener@", std::hex, + reinterpret_cast<intptr_t>(listener_), + (before_entry_ ? ", between entries)" : ", in an entry)")); } std::ostream& operator<<(std::ostream& out, const HpackBlockDecoder& v) {
diff --git a/net/http2/hpack/decoder/hpack_block_decoder.h b/net/http2/hpack/decoder/hpack_block_decoder.h index c5e3409..8a32c5b9 100644 --- a/net/http2/hpack/decoder/hpack_block_decoder.h +++ b/net/http2/hpack/decoder/hpack_block_decoder.h
@@ -10,8 +10,6 @@ // or dynamic table support, so table indices remain indices at this level. // Reports the entries to an HpackEntryDecoderListener. -#include <string> - #include "base/logging.h" #include "base/macros.h" #include "net/http2/decoder/decode_buffer.h" @@ -19,6 +17,7 @@ #include "net/http2/hpack/decoder/hpack_entry_decoder.h" #include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -55,7 +54,7 @@ // first byte of a new HPACK entry)? bool before_entry() const { return before_entry_; } - std::string DebugString() const; + Http2String DebugString() const; private: HpackEntryDecoder entry_decoder_;
diff --git a/net/http2/hpack/decoder/hpack_block_decoder_test.cc b/net/http2/hpack/decoder/hpack_block_decoder_test.cc index 37e33da..2a74c84 100644 --- a/net/http2/hpack/decoder/hpack_block_decoder_test.cc +++ b/net/http2/hpack/decoder/hpack_block_decoder_test.cc
@@ -13,14 +13,13 @@ #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/hpack/tools/hpack_block_builder.h" #include "net/http2/hpack/tools/hpack_example.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" using ::testing::AssertionSuccess; -using std::string; -using base::StringPiece; namespace net { namespace test { @@ -67,16 +66,16 @@ } AssertionResult DecodeHpackExampleAndValidateSeveralWays( - StringPiece hpack_example, + Http2StringPiece hpack_example, Validator validator) { - string input = HpackExampleToStringOrDie(hpack_example); + Http2String input = HpackExampleToStringOrDie(hpack_example); DecodeBuffer db(input); return DecodeAndValidateSeveralWays(&db, validator); } uint8_t Rand8() { return Random().Rand8(); } - string Rand8String() { return Random().RandString(Rand8()); } + Http2String Rand8String() { return Random().RandString(Rand8()); } HpackBlockCollector collector_; HpackEntryDecoderVLoggingListener listener_; @@ -159,7 +158,7 @@ } // http://httpwg.org/specs/rfc7541.html#rfc.section.C.3.1 TEST_F(HpackBlockDecoderTest, SpecExample_C_3_1) { - string example = R"( + Http2String example = R"( 82 | == Indexed - Add == | idx = 2 | -> :method: GET @@ -193,7 +192,7 @@ // http://httpwg.org/specs/rfc7541.html#rfc.section.C.5.1 TEST_F(HpackBlockDecoderTest, SpecExample_C_5_1) { - string example = R"( + Http2String example = R"( 48 | == Literal indexed == | Indexed name (idx = 8) | :status
diff --git a/net/http2/hpack/decoder/hpack_decoder_listener.cc b/net/http2/hpack/decoder/hpack_decoder_listener.cc index 8bb0e47..8f0e0a0 100644 --- a/net/http2/hpack/decoder/hpack_decoder_listener.cc +++ b/net/http2/hpack/decoder/hpack_decoder_listener.cc
@@ -4,8 +4,6 @@ #include "net/http2/hpack/decoder/hpack_decoder_listener.h" -using base::StringPiece; - namespace net { HpackDecoderListener::HpackDecoderListener() {} @@ -20,7 +18,7 @@ const HpackString& value) {} void HpackDecoderNoOpListener::OnHeaderListEnd() {} void HpackDecoderNoOpListener::OnHeaderErrorDetected( - StringPiece error_message) {} + Http2StringPiece error_message) {} // static HpackDecoderNoOpListener* HpackDecoderNoOpListener::NoOpListener() {
diff --git a/net/http2/hpack/decoder/hpack_decoder_listener.h b/net/http2/hpack/decoder/hpack_decoder_listener.h index 9c14168..3a6a54cb 100644 --- a/net/http2/hpack/decoder/hpack_decoder_listener.h +++ b/net/http2/hpack/decoder/hpack_decoder_listener.h
@@ -8,10 +8,10 @@ #ifndef NET_HTTP2_HPACK_DECODER_HPACK_DECODER_LISTENER_H_ #define NET_HTTP2_HPACK_DECODER_HPACK_DECODER_LISTENER_H_ -#include "base/strings/string_piece.h" #include "net/http2/hpack/hpack_string.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { @@ -39,7 +39,7 @@ // OnHeaderErrorDetected is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - virtual void OnHeaderErrorDetected(base::StringPiece error_message) = 0; + virtual void OnHeaderErrorDetected(Http2StringPiece error_message) = 0; }; // A no-op implementation of HpackDecoderListener, useful for ignoring @@ -55,7 +55,7 @@ const HpackString& name, const HpackString& value) override; void OnHeaderListEnd() override; - void OnHeaderErrorDetected(base::StringPiece error_message) override; + void OnHeaderErrorDetected(Http2StringPiece error_message) override; // Returns a listener that ignores all the calls. static HpackDecoderNoOpListener* NoOpListener();
diff --git a/net/http2/hpack/decoder/hpack_decoder_state.cc b/net/http2/hpack/decoder/hpack_decoder_state.cc index d1a868f..ff02db5 100644 --- a/net/http2/hpack/decoder/hpack_decoder_state.cc +++ b/net/http2/hpack/decoder/hpack_decoder_state.cc
@@ -8,8 +8,6 @@ #include "net/http2/hpack/hpack_string.h" #include "net/http2/http2_constants.h" -using base::StringPiece; - namespace net { namespace { @@ -192,7 +190,7 @@ lowest_header_table_size_ = final_header_table_size_; } -void HpackDecoderState::OnHpackDecodeError(StringPiece error_message) { +void HpackDecoderState::OnHpackDecodeError(Http2StringPiece error_message) { DVLOG(2) << "HpackDecoderState::OnHpackDecodeError " << error_message; if (!error_detected_) { ReportError(error_message); @@ -213,7 +211,7 @@ } } -void HpackDecoderState::ReportError(StringPiece error_message) { +void HpackDecoderState::ReportError(Http2StringPiece error_message) { DVLOG(2) << "HpackDecoderState::ReportError is new=" << (!error_detected_ ? "true" : "false") << ", error_message: " << error_message;
diff --git a/net/http2/hpack/decoder/hpack_decoder_state.h b/net/http2/hpack/decoder/hpack_decoder_state.h index d3fae76..bf852bb2 100644 --- a/net/http2/hpack/decoder/hpack_decoder_state.h +++ b/net/http2/hpack/decoder/hpack_decoder_state.h
@@ -16,13 +16,13 @@ #include <stdint.h> #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_decoder_listener.h" #include "net/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/http2/hpack/decoder/hpack_decoder_tables.h" #include "net/http2/hpack/decoder/hpack_whole_entry_listener.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -74,7 +74,7 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer) override; void OnDynamicTableSizeUpdate(size_t size) override; - void OnHpackDecodeError(base::StringPiece error_message) override; + void OnHpackDecodeError(Http2StringPiece error_message) override; // OnHeaderBlockEnd notifies this object that an entire HPACK block has been // decoded, which might have extended into CONTINUATION blocks. @@ -92,7 +92,7 @@ friend class test::HpackDecoderStatePeer; // Reports an error to the listener IF this is the first error detected. - void ReportError(base::StringPiece error_message); + void ReportError(Http2StringPiece error_message); // The static and dynamic HPACK tables. HpackDecoderTables decoder_tables_;
diff --git a/net/http2/hpack/decoder/hpack_decoder_state_test.cc b/net/http2/hpack/decoder/hpack_decoder_state_test.cc index 629370fe..3674db0 100644 --- a/net/http2/hpack/decoder/hpack_decoder_state_test.cc +++ b/net/http2/hpack/decoder/hpack_decoder_state_test.cc
@@ -6,13 +6,13 @@ // Tests of HpackDecoderState. -#include <string> #include <utility> #include <vector> #include "base/logging.h" #include "net/http2/hpack/hpack_string.h" #include "net/http2/http2_constants.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/tools/failure.h" #include "net/test/gtest_util.h" #include "testing/gmock/include/gmock/gmock-matchers.h" @@ -25,7 +25,6 @@ using ::testing::HasSubstr; using ::testing::Mock; using ::testing::StrictMock; -using base::StringPiece; namespace net { namespace test { @@ -38,11 +37,11 @@ namespace { -// Define HasSubstr() for base::StringPiece arguments. +// Define HasSubstr() for Http2StringPiece arguments. // This shadows ::testing::HasSubstr(), which only works on argument types -// that can be implicilty converted to a std::string. +// that can be implicilty converted to a Http2String. inline ::testing::PolymorphicMatcher<StringPieceHasSubstrMatcher> HasSubstr( - const std::string& substring) { + const Http2String& substring) { return ::testing::MakePolymorphicMatcher( StringPieceHasSubstrMatcher(substring)); } @@ -55,7 +54,7 @@ const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, void(StringPiece error_message)); + MOCK_METHOD1(OnHeaderErrorDetected, void(Http2StringPiece error_message)); }; enum StringBacking { STATIC, UNBUFFERED, BUFFERED }; @@ -529,7 +528,7 @@ TEST_F(HpackDecoderStateTest, ErrorsSuppressCallbacks) { SendStartAndVerifyCallback(); EXPECT_CALL(listener_, - OnHeaderErrorDetected(StringPiece("Huffman decode error."))); + OnHeaderErrorDetected(Http2StringPiece("Huffman decode error."))); decoder_state_.OnHpackDecodeError("Huffman decode error."); // Further decoded entries are ignored.
diff --git a/net/http2/hpack/decoder/hpack_decoder_string_buffer.cc b/net/http2/hpack/decoder/hpack_decoder_string_buffer.cc index e00c155b..3e4451c 100644 --- a/net/http2/hpack/decoder/hpack_decoder_string_buffer.cc +++ b/net/http2/hpack/decoder/hpack_decoder_string_buffer.cc
@@ -10,9 +10,6 @@ #include "base/trace_event/memory_usage_estimator.h" #include "net/http2/tools/http2_bug_tracker.h" -using base::StringPiece; -using std::string; - namespace net { std::ostream& operator<<(std::ostream& out, @@ -63,7 +60,7 @@ state_ = State::RESET; } -void HpackDecoderStringBuffer::Set(StringPiece value, bool is_static) { +void HpackDecoderStringBuffer::Set(Http2StringPiece value, bool is_static) { DVLOG(2) << "HpackDecoderStringBuffer::Set"; DCHECK_EQ(state_, State::RESET); value_ = value; @@ -103,7 +100,7 @@ backing_ = Backing::RESET; // OnData is not called for empty (zero length) strings, so make sure that // value_ is cleared. - value_ = StringPiece(); + value_ = Http2StringPiece(); } } @@ -116,7 +113,7 @@ if (is_huffman_encoded_) { DCHECK_EQ(backing_, Backing::BUFFERED); - return decoder_.Decode(StringPiece(data, len), &buffer_); + return decoder_.Decode(Http2StringPiece(data, len), &buffer_); } if (backing_ == Backing::RESET) { @@ -124,7 +121,7 @@ // don't copy the string. If we later find that the HPACK entry is split // across input buffers, then we'll copy the string into buffer_. if (remaining_len_ == 0) { - value_ = StringPiece(data, len); + value_ = Http2StringPiece(data, len); backing_ = Backing::UNBUFFERED; return true; } @@ -189,13 +186,13 @@ return IsBuffered() ? buffer_.size() : 0; } -StringPiece HpackDecoderStringBuffer::str() const { +Http2StringPiece HpackDecoderStringBuffer::str() const { DVLOG(3) << "HpackDecoderStringBuffer::str"; DCHECK_EQ(state_, State::COMPLETE); return value_; } -string HpackDecoderStringBuffer::ReleaseString() { +Http2String HpackDecoderStringBuffer::ReleaseString() { DVLOG(3) << "HpackDecoderStringBuffer::ReleaseString"; DCHECK_EQ(state_, State::COMPLETE); DCHECK_EQ(backing_, Backing::BUFFERED);
diff --git a/net/http2/hpack/decoder/hpack_decoder_string_buffer.h b/net/http2/hpack/decoder/hpack_decoder_string_buffer.h index 6b927b23..5136d94 100644 --- a/net/http2/hpack/decoder/hpack_decoder_string_buffer.h +++ b/net/http2/hpack/decoder/hpack_decoder_string_buffer.h
@@ -12,12 +12,12 @@ #include <stddef.h> #include <ostream> -#include <string> #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/hpack/huffman/http2_hpack_huffman_decoder.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { @@ -30,7 +30,7 @@ ~HpackDecoderStringBuffer(); void Reset(); - void Set(base::StringPiece value, bool is_static); + void Set(Http2StringPiece value, bool is_static); // Note that for Huffman encoded strings the length of the string after // decoding may be larger (expected), the same or even smaller; the latter @@ -45,18 +45,18 @@ // Accessors for the completely collected string (i.e. Set or OnEnd has just // been called, and no reset of the state has occurred). - // Returns a StringPiece pointing to the backing store for the string, either - // the internal buffer or the original transport buffer (e.g. for a literal - // value that wasn't Huffman encoded, and that wasn't split across transport - // buffers). - base::StringPiece str() const; + // Returns a Http2StringPiece pointing to the backing store for the string, + // either the internal buffer or the original transport buffer (e.g. for a + // literal value that wasn't Huffman encoded, and that wasn't split across + // transport buffers). + Http2StringPiece str() const; // Returns the completely collected string by value, using std::move in an // effort to avoid unnecessary copies. ReleaseString() must not be called // unless the string has been buffered (to avoid forcing a potentially // unnecessary copy). ReleaseString() also resets the instance so that it can // be used to collect another string. - std::string ReleaseString(); + Http2String ReleaseString(); State state_for_testing() const { return state_; } Backing backing_for_testing() const { return backing_; } @@ -68,11 +68,12 @@ private: // Storage for the string being buffered, if buffering is necessary // (e.g. if Huffman encoded, buffer_ is storage for the decoded string). - std::string buffer_; + Http2String buffer_; - // The StringPiece to be returned by HpackDecoderStringBuffer::str(). If a - // string has been collected, but not buffered, value_ points to that string. - base::StringPiece value_; + // The Http2StringPiece to be returned by HpackDecoderStringBuffer::str(). If + // a string has been collected, but not buffered, value_ points to that + // string. + Http2StringPiece value_; // The decoder to use if the string is Huffman encoded. HpackHuffmanDecoder decoder_;
diff --git a/net/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc b/net/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc index a62b0d8..72846ad 100644 --- a/net/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc +++ b/net/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
@@ -7,10 +7,8 @@ // Tests of HpackDecoderStringBuffer. #include <sstream> -#include <string> #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/tools/failure.h" #include "net/spdy/core/spdy_test_utils.h" #include "testing/gmock/include/gmock/gmock.h" @@ -19,8 +17,6 @@ using ::testing::AssertionResult; using ::testing::AssertionSuccess; using ::testing::HasSubstr; -using base::StringPiece; -using std::string; namespace net { namespace test { @@ -36,11 +32,11 @@ // We want to know that LOG(x) << buf_ will work in production should that // be needed, so we test that it outputs the expected values. - AssertionResult VerifyLogHasSubstrs(std::initializer_list<string> strs) { + AssertionResult VerifyLogHasSubstrs(std::initializer_list<Http2String> strs) { VLOG(1) << buf_; std::ostringstream ss; buf_.OutputDebugStringTo(ss); - string dbg_str(ss.str()); + Http2String dbg_str(ss.str()); for (const auto& expected : strs) { VERIFY_THAT(dbg_str, HasSubstr(expected)); } @@ -51,7 +47,7 @@ }; TEST_F(HpackDecoderStringBufferTest, SetStatic) { - StringPiece data("static string"); + Http2StringPiece data("static string"); EXPECT_EQ(state(), State::RESET); EXPECT_TRUE(VerifyLogHasSubstrs({"state=RESET"})); @@ -76,7 +72,7 @@ } TEST_F(HpackDecoderStringBufferTest, PlainWhole) { - StringPiece data("some text."); + Http2StringPiece data("some text."); LOG(INFO) << buf_; EXPECT_EQ(state(), State::RESET); @@ -97,7 +93,7 @@ EXPECT_TRUE(VerifyLogHasSubstrs( {"state=COMPLETE", "backing=UNBUFFERED", "value: some text."})); - // We expect that the string buffer points to the passed in StringPiece's + // We expect that the string buffer points to the passed in Http2StringPiece's // backing store. EXPECT_EQ(data.data(), buf_.str().data()); @@ -114,9 +110,9 @@ } TEST_F(HpackDecoderStringBufferTest, PlainSplit) { - StringPiece data("some text."); - StringPiece part1 = data.substr(0, 1); - StringPiece part2 = data.substr(1); + Http2StringPiece data("some text."); + Http2StringPiece part1 = data.substr(0, 1); + Http2StringPiece part2 = data.substr(1); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ false, data.size()); @@ -142,7 +138,7 @@ EXPECT_EQ(buf_.BufferedLength(), data.size()); LOG(INFO) << buf_; - StringPiece buffered = buf_.str(); + Http2StringPiece buffered = buf_.str(); EXPECT_EQ(data, buffered); EXPECT_NE(data.data(), buffered.data()); @@ -156,8 +152,8 @@ } TEST_F(HpackDecoderStringBufferTest, HuffmanWhole) { - string encoded = a2b_hex("f1e3c2e5f23a6ba0ab90f4ff"); - StringPiece decoded("www.example.com"); + Http2String encoded = a2b_hex("f1e3c2e5f23a6ba0ab90f4ff"); + Http2StringPiece decoded("www.example.com"); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); @@ -175,16 +171,16 @@ EXPECT_TRUE(VerifyLogHasSubstrs( {"{state=COMPLETE", "backing=BUFFERED", "buffer: www.example.com}"})); - string s = buf_.ReleaseString(); + Http2String s = buf_.ReleaseString(); EXPECT_EQ(s, decoded); EXPECT_EQ(state(), State::RESET); } TEST_F(HpackDecoderStringBufferTest, HuffmanSplit) { - string encoded = a2b_hex("f1e3c2e5f23a6ba0ab90f4ff"); - string part1 = encoded.substr(0, 5); - string part2 = encoded.substr(5); - StringPiece decoded("www.example.com"); + Http2String encoded = a2b_hex("f1e3c2e5f23a6ba0ab90f4ff"); + Http2String part1 = encoded.substr(0, 5); + Http2String part2 = encoded.substr(5); + Http2StringPiece decoded("www.example.com"); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); @@ -220,7 +216,7 @@ TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnData) { // Explicitly encode the End-of-String symbol, a no-no. - string encoded = a2b_hex("ffffffff"); + Http2String encoded = a2b_hex("ffffffff"); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); EXPECT_EQ(state(), State::COLLECTING); @@ -234,7 +230,7 @@ TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnEnd) { // Last byte of string doesn't end with prefix of End-of-String symbol. - string encoded = a2b_hex("00"); + Http2String encoded = a2b_hex("00"); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); EXPECT_EQ(state(), State::COLLECTING);
diff --git a/net/http2/hpack/decoder/hpack_decoder_tables_test.cc b/net/http2/hpack/decoder/hpack_decoder_tables_test.cc index 13bdb6f..e9e6c54 100644 --- a/net/http2/hpack/decoder/hpack_decoder_tables_test.cc +++ b/net/http2/hpack/decoder/hpack_decoder_tables_test.cc
@@ -5,11 +5,11 @@ #include "net/http2/hpack/decoder/hpack_decoder_tables.h" #include <algorithm> -#include <string> #include <tuple> #include <vector> #include "base/logging.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_util.h" @@ -18,7 +18,6 @@ using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using std::string; namespace net { namespace test { @@ -95,7 +94,7 @@ EXPECT_TRUE(VerifyStaticTableContents()); } -size_t Size(const string& name, const string& value) { +size_t Size(const Http2String& name, const Http2String& value) { return name.size() + value.size() + 32; } @@ -104,11 +103,11 @@ // dynamic table containing FakeHpackEntry instances. We can thus compare the // contents of the actual table with those in fake_dynamic_table_. -typedef std::tuple<string, string, size_t> FakeHpackEntry; -const string& Name(const FakeHpackEntry& entry) { +typedef std::tuple<Http2String, Http2String, size_t> FakeHpackEntry; +const Http2String& Name(const FakeHpackEntry& entry) { return std::get<0>(entry); } -const string& Value(const FakeHpackEntry& entry) { +const Http2String& Value(const FakeHpackEntry& entry) { return std::get<1>(entry); } size_t Size(const FakeHpackEntry& entry) { @@ -132,7 +131,7 @@ } // Insert the name and value into fake_dynamic_table_. - void FakeInsert(const string& name, const string& value) { + void FakeInsert(const Http2String& name, const Http2String& value) { FakeHpackEntry entry(name, value, Size(name, value)); fake_dynamic_table_.insert(fake_dynamic_table_.begin(), entry); } @@ -203,7 +202,7 @@ // Insert an entry into the dynamic table, confirming that trimming of entries // occurs if the total size is greater than the limit, and that older entries // move up by 1 index. - AssertionResult Insert(const string& name, const string& value) { + AssertionResult Insert(const Http2String& name, const Http2String& value) { size_t old_count = num_dynamic_entries(); if (tables_.Insert(HpackString(name), HpackString(value))) { VERIFY_GT(current_dynamic_size(), 0u); @@ -250,9 +249,9 @@ for (size_t limit : table_sizes) { ASSERT_TRUE(DynamicTableSizeUpdate(limit)); for (int insert_count = 0; insert_count < 100; ++insert_count) { - string name = GenerateHttp2HeaderName( + Http2String name = GenerateHttp2HeaderName( GenerateUniformInRange(2, 40, RandomPtr()), RandomPtr()); - string value = GenerateWebSafeString( + Http2String value = GenerateWebSafeString( GenerateUniformInRange(2, 600, RandomPtr()), RandomPtr()); ASSERT_TRUE(Insert(name, value)); }
diff --git a/net/http2/hpack/decoder/hpack_entry_collector.cc b/net/http2/hpack/decoder/hpack_entry_collector.cc index ea4feb6..d4d39d4c 100644 --- a/net/http2/hpack/decoder/hpack_entry_collector.cc +++ b/net/http2/hpack/decoder/hpack_entry_collector.cc
@@ -5,17 +5,15 @@ #include "net/http2/hpack/decoder/hpack_entry_collector.h" #include <sstream> -#include <string> #include "base/logging.h" #include "net/http2/hpack/decoder/hpack_string_collector.h" #include "net/http2/hpack/http2_hpack_constants.h" +#include "net/http2/platform/api/http2_string_utils.h" #include "net/http2/tools/failure.h" #include "testing/gtest/include/gtest/gtest.h" using ::testing::AssertionResult; -using std::string; -using base::StringPiece; namespace net { namespace test { @@ -44,7 +42,7 @@ HpackEntryCollector::HpackEntryCollector(HpackEntryType type, size_t index, bool value_huffman, - const string& value) + const Http2String& value) : header_type_(type), index_(index), value_(value, value_huffman), @@ -52,9 +50,9 @@ ended_(true) {} HpackEntryCollector::HpackEntryCollector(HpackEntryType type, bool name_huffman, - const string& name, + const Http2String& name, bool value_huffman, - const string& value) + const Http2String& value) : header_type_(type), index_(0), name_(name, name_huffman), @@ -175,7 +173,7 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - StringPiece expected_value) const { + Http2StringPiece expected_value) const { VERIFY_TRUE(started_); VERIFY_TRUE(ended_); VERIFY_EQ(expected_type, header_type_); @@ -188,9 +186,9 @@ AssertionResult HpackEntryCollector::ValidateLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - StringPiece expected_name, + Http2StringPiece expected_name, bool expected_value_huffman, - StringPiece expected_value) const { + Http2StringPiece expected_value) const { VERIFY_TRUE(started_); VERIFY_TRUE(ended_); VERIFY_EQ(expected_type, header_type_); @@ -241,8 +239,8 @@ } } -string HpackEntryCollector::ToString() const { - string result("Type="); +Http2String HpackEntryCollector::ToString() const { + Http2String result("Type="); switch (header_type_) { case HpackEntryType::kIndexedHeader: result += "IndexedHeader"; @@ -263,32 +261,25 @@ if (header_type_ == kInvalidHeaderType) { result += "<unset>"; } else { - std::stringstream ss; - ss << header_type_; - result.append(ss.str()); + Http2StrAppend(&result, header_type_); } } if (index_ != 0) { - result.append(" Index="); - std::stringstream ss; - ss << index_; - result.append(ss.str()); + Http2StrAppend(&result, " Index=", index_); } if (!name_.IsClear()) { - result.append(" Name"); - result.append(name_.ToString()); + Http2StrAppend(&result, " Name", name_.ToString()); } if (!value_.IsClear()) { - result.append(" Value"); - result.append(value_.ToString()); + Http2StrAppend(&result, " Value", value_.ToString()); } if (!started_) { EXPECT_FALSE(ended_); - result.append(" !started"); + Http2StrAppend(&result, " !started"); } else if (!ended_) { - result.append(" !ended"); + Http2StrAppend(&result, " !ended"); } else { - result.append(" Complete"); + Http2StrAppend(&result, " Complete"); } return result; }
diff --git a/net/http2/hpack/decoder/hpack_entry_collector.h b/net/http2/hpack/decoder/hpack_entry_collector.h index 876e0b0..ceb9108 100644 --- a/net/http2/hpack/decoder/hpack_entry_collector.h +++ b/net/http2/hpack/decoder/hpack_entry_collector.h
@@ -13,13 +13,13 @@ #include <stddef.h> #include <iosfwd> -#include <string> -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/http2/hpack/decoder/hpack_string_collector.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/hpack/tools/hpack_block_builder.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -36,12 +36,12 @@ HpackEntryCollector(HpackEntryType type, size_t index, bool value_huffman, - const std::string& value); + const Http2String& value); HpackEntryCollector(HpackEntryType type, bool name_huffman, - const std::string& name, + const Http2String& name, bool value_huffman, - const std::string& value); + const Http2String& value); ~HpackEntryCollector() override; @@ -84,16 +84,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - base::StringPiece expected_value) const; + Http2StringPiece expected_value) const; // Returns success if collected a Header with an literal name and literal // value. ::testing::AssertionResult ValidateLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - base::StringPiece expected_name, + Http2StringPiece expected_name, bool expected_value_huffman, - base::StringPiece expected_value) const; + Http2StringPiece expected_value) const; // Returns success if collected a Dynamic Table Size Update, // with the specified size. @@ -121,7 +121,7 @@ void AppendToHpackBlockBuilder(HpackBlockBuilder* hbb) const; // Returns a debug string. - std::string ToString() const; + Http2String ToString() const; private: void Init(HpackEntryType type, size_t maybe_index);
diff --git a/net/http2/hpack/decoder/hpack_entry_decoder.cc b/net/http2/hpack/decoder/hpack_entry_decoder.cc index c47ef0c..32557f5 100644 --- a/net/http2/hpack/decoder/hpack_entry_decoder.cc +++ b/net/http2/hpack/decoder/hpack_entry_decoder.cc
@@ -199,7 +199,7 @@ << ", " << string_decoder_ << ")"; } -std::string HpackEntryDecoder::DebugString() const { +Http2String HpackEntryDecoder::DebugString() const { std::stringstream s; s << *this; return s.str();
diff --git a/net/http2/hpack/decoder/hpack_entry_decoder.h b/net/http2/hpack/decoder/hpack_entry_decoder.h index 4ade5d6..a1265d2 100644 --- a/net/http2/hpack/decoder/hpack_entry_decoder.h +++ b/net/http2/hpack/decoder/hpack_entry_decoder.h
@@ -10,8 +10,6 @@ // must provide a non-empty decode buffer. Continue with calls to Resume() if // Start, and any subsequent calls to Resume, returns kDecodeInProgress. -#include <string> - #include "base/logging.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" @@ -20,6 +18,7 @@ #include "net/http2/hpack/decoder/hpack_string_decoder.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -94,7 +93,7 @@ // in decoding the entry type and its varint. DecodeStatus Resume(DecodeBuffer* db, HpackEntryDecoderListener* listener); - std::string DebugString() const; + Http2String DebugString() const; void OutputDebugString(std::ostream& out) const; private:
diff --git a/net/http2/hpack/decoder/hpack_entry_decoder_test.cc b/net/http2/hpack/decoder/hpack_entry_decoder_test.cc index 6a1c293f..54c7ce8 100644 --- a/net/http2/hpack/decoder/hpack_entry_decoder_test.cc +++ b/net/http2/hpack/decoder/hpack_entry_decoder_test.cc
@@ -14,7 +14,6 @@ #include "testing/gtest/include/gtest/gtest.h" using ::testing::AssertionResult; -using std::string; namespace net { namespace test { @@ -169,7 +168,7 @@ for (int n = 0; n < 10; n++) { const uint32_t ndx = 1 + Random().Rand8(); const bool value_is_huffman_encoded = (n % 2) == 0; - const string value = Random().RandString(Random().Rand8()); + const Http2String value = Random().RandString(Random().Rand8()); HpackBlockBuilder hbb; hbb.AppendNameIndexAndLiteralValue(entry_type_, ndx, value_is_huffman_encoded, value); @@ -188,10 +187,10 @@ for (int n = 0; n < 10; n++) { const bool name_is_huffman_encoded = (n & 1) == 0; const int name_len = 1 + Random().Rand8(); - const string name = Random().RandString(name_len); + const Http2String name = Random().RandString(name_len); const bool value_is_huffman_encoded = (n & 2) == 0; const int value_len = Random().Skewed(10); - const string value = Random().RandString(value_len); + const Http2String value = Random().RandString(value_len); HpackBlockBuilder hbb; hbb.AppendLiteralNameAndValue(entry_type_, name_is_huffman_encoded, name, value_is_huffman_encoded, value);
diff --git a/net/http2/hpack/decoder/hpack_entry_type_decoder.cc b/net/http2/hpack/decoder/hpack_entry_type_decoder.cc index a05d48b..67876bd 100644 --- a/net/http2/hpack/decoder/hpack_entry_type_decoder.cc +++ b/net/http2/hpack/decoder/hpack_entry_type_decoder.cc
@@ -4,17 +4,15 @@ #include "net/http2/hpack/decoder/hpack_entry_type_decoder.h" -#include <sstream> - #include "base/logging.h" +#include "net/http2/platform/api/http2_string_utils.h" namespace net { -std::string HpackEntryTypeDecoder::DebugString() const { - std::stringstream ss; - ss << "HpackEntryTypeDecoder(varint_decoder=" << varint_decoder_.DebugString() - << ", entry_type=" << entry_type_ << ")"; - return ss.str(); +Http2String HpackEntryTypeDecoder::DebugString() const { + return Http2StrCat( + "HpackEntryTypeDecoder(varint_decoder=", varint_decoder_.DebugString(), + ", entry_type = ", entry_type_, ") "); } std::ostream& operator<<(std::ostream& out, const HpackEntryTypeDecoder& v) {
diff --git a/net/http2/hpack/decoder/hpack_entry_type_decoder.h b/net/http2/hpack/decoder/hpack_entry_type_decoder.h index 1dd5149..371cd45a 100644 --- a/net/http2/hpack/decoder/hpack_entry_type_decoder.h +++ b/net/http2/hpack/decoder/hpack_entry_type_decoder.h
@@ -10,14 +10,13 @@ // The integer represents an index into static or dynamic table, which may be // zero, or is the new size limit of the dynamic table. -#include <string> - #include "base/logging.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/hpack/decoder/hpack_varint_decoder.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -39,7 +38,7 @@ // preceding call to Start or Resume returned kDecodeDone. uint32_t varint() const { return varint_decoder_.value(); } - std::string DebugString() const; + Http2String DebugString() const; private: HpackVarintDecoder varint_decoder_;
diff --git a/net/http2/hpack/decoder/hpack_string_collector.cc b/net/http2/hpack/decoder/hpack_string_collector.cc index e7e8195..9e60b04 100644 --- a/net/http2/hpack/decoder/hpack_string_collector.cc +++ b/net/http2/hpack/decoder/hpack_string_collector.cc
@@ -8,14 +8,12 @@ #include <iosfwd> #include <ostream> -#include <string> #include "net/base/escape.h" +#include "net/http2/platform/api/http2_string_utils.h" #include "net/http2/tools/failure.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; - namespace net { namespace test { namespace { @@ -39,7 +37,7 @@ Clear(); } -HpackStringCollector::HpackStringCollector(const std::string& str, bool huffman) +HpackStringCollector::HpackStringCollector(const Http2String& str, bool huffman) : s(str), len(str.size()), huffman_encoded(huffman), state(kEnded) {} void HpackStringCollector::Clear() { @@ -70,10 +68,10 @@ } void HpackStringCollector::OnStringData(const char* data, size_t length) { - StringPiece sp(data, length); + Http2StringPiece sp(data, length); EXPECT_TRUE(IsInProgress()) << ToString(); EXPECT_LE(sp.size(), len) << ToString(); - sp.AppendToString(&s); + Http2StrAppend(&s, sp); EXPECT_LE(s.size(), len) << ToString(); } @@ -84,7 +82,7 @@ } ::testing::AssertionResult HpackStringCollector::Collected( - StringPiece str, + Http2StringPiece str, bool is_huffman_encoded) const { VERIFY_TRUE(HasEnded()); VERIFY_EQ(str.size(), len); @@ -93,7 +91,7 @@ return ::testing::AssertionSuccess(); } -std::string HpackStringCollector::ToString() const { +Http2String HpackStringCollector::ToString() const { std::stringstream ss; ss << *this; return ss.str();
diff --git a/net/http2/hpack/decoder/hpack_string_collector.h b/net/http2/hpack/decoder/hpack_string_collector.h index 1bc5831..7a72292 100644 --- a/net/http2/hpack/decoder/hpack_string_collector.h +++ b/net/http2/hpack/decoder/hpack_string_collector.h
@@ -10,10 +10,10 @@ #include <stddef.h> #include <iosfwd> -#include <string> -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_string_decoder_listener.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -29,7 +29,7 @@ }; HpackStringCollector(); - HpackStringCollector(const std::string& str, bool huffman); + HpackStringCollector(const Http2String& str, bool huffman); void Clear(); bool IsClear() const; @@ -40,12 +40,12 @@ void OnStringData(const char* data, size_t length) override; void OnStringEnd() override; - ::testing::AssertionResult Collected(base::StringPiece str, + ::testing::AssertionResult Collected(Http2StringPiece str, bool is_huffman_encoded) const; - std::string ToString() const; + Http2String ToString() const; - std::string s; + Http2String s; size_t len; bool huffman_encoded; CollectorState state;
diff --git a/net/http2/hpack/decoder/hpack_string_decoder.cc b/net/http2/hpack/decoder/hpack_string_decoder.cc index 4131e01..932ca2e 100644 --- a/net/http2/hpack/decoder/hpack_string_decoder.cc +++ b/net/http2/hpack/decoder/hpack_string_decoder.cc
@@ -4,21 +4,19 @@ #include "net/http2/hpack/decoder/hpack_string_decoder.h" -#include <sstream> +#include "net/http2/platform/api/http2_string_utils.h" namespace net { -std::string HpackStringDecoder::DebugString() const { - std::stringstream ss; - ss << "HpackStringDecoder(state=" << StateToString(state_) - << ", length=" << length_decoder_.DebugString() - << ", remaining=" << remaining_ - << ", huffman=" << (huffman_encoded_ ? "true)" : "false)"); - return ss.str(); +Http2String HpackStringDecoder::DebugString() const { + return Http2StrCat("HpackStringDecoder(state=", StateToString(state_), + ", length=", length_decoder_.DebugString(), + ", remaining=", remaining_, + ", huffman=", huffman_encoded_ ? "true)" : "false)"); } // static -std::string HpackStringDecoder::StateToString(StringDecoderState v) { +Http2String HpackStringDecoder::StateToString(StringDecoderState v) { switch (v) { case kStartDecodingLength: return "kStartDecodingLength"; @@ -27,9 +25,7 @@ case kResumeDecodingLength: return "kResumeDecodingLength"; } - std::stringstream ss; - ss << "UNKNOWN_STATE(" << static_cast<uint32_t>(v) << ")"; - return ss.str(); + return Http2StrCat("UNKNOWN_STATE(", static_cast<uint32_t>(v), ")"); } std::ostream& operator<<(std::ostream& out, const HpackStringDecoder& v) {
diff --git a/net/http2/hpack/decoder/hpack_string_decoder.h b/net/http2/hpack/decoder/hpack_string_decoder.h index 144d230..75f09d0 100644 --- a/net/http2/hpack/decoder/hpack_string_decoder.h +++ b/net/http2/hpack/decoder/hpack_string_decoder.h
@@ -12,7 +12,6 @@ #include <stddef.h> #include <algorithm> -#include <string> #include "base/logging.h" #include "base/macros.h" @@ -20,6 +19,7 @@ #include "net/http2/decoder/decode_status.h" #include "net/http2/hpack/decoder/hpack_varint_decoder.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -140,10 +140,10 @@ } } - std::string DebugString() const; + Http2String DebugString() const; private: - static std::string StateToString(StringDecoderState v); + static Http2String StateToString(StringDecoderState v); // Returns true if the length is fully decoded and the listener wants the // decoding to continue, false otherwise; status is set to the status from
diff --git a/net/http2/hpack/decoder/hpack_string_decoder_test.cc b/net/http2/hpack/decoder/hpack_string_decoder_test.cc index 614fa0d..bb80205 100644 --- a/net/http2/hpack/decoder/hpack_string_decoder_test.cc +++ b/net/http2/hpack/decoder/hpack_string_decoder_test.cc
@@ -6,10 +6,10 @@ // Tests of HpackStringDecoder. -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_string_collector.h" #include "net/http2/hpack/decoder/hpack_string_decoder_listener.h" #include "net/http2/hpack/tools/hpack_block_builder.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_decoder_test.h" @@ -17,8 +17,6 @@ using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; -using std::string; namespace net { namespace test { @@ -67,16 +65,17 @@ return decoder_.Resume(b, &listener_); } - AssertionResult Collected(StringPiece s, bool huffman_encoded) { + AssertionResult Collected(Http2StringPiece s, bool huffman_encoded) { VLOG(1) << collector_; return collector_.Collected(s, huffman_encoded); } - // expected_str is a string rather than a const string& or StringPiece so that - // the lambda makes a copy of the string, and thus the string to be passed to - // Collected outlives the call to MakeValidator. + // expected_str is a Http2String rather than a const Http2String& or + // Http2StringPiece so that the lambda makes a copy of the string, and thus + // the string to be passed to Collected outlives the call to MakeValidator. - Validator MakeValidator(const string& expected_str, bool expected_huffman) { + Validator MakeValidator(const Http2String& expected_str, + bool expected_huffman) { return [expected_str, expected_huffman, this]( const DecodeBuffer& input, DecodeStatus status) -> AssertionResult { @@ -136,7 +135,7 @@ { Validator validator = ValidateDoneAndOffset(11, MakeValidator("start end.", kUncompressed)); - StringPiece data("\x0astart end."); + Http2StringPiece data("\x0astart end."); DecodeBuffer b(data); EXPECT_TRUE( DecodeAndValidateSeveralWays(&b, kMayReturnZeroOnFirst, validator)); @@ -144,8 +143,8 @@ } TEST_P(HpackStringDecoderTest, DecodeLongStrings) { - string name = Random().RandString(1024); - string value = Random().RandString(65536); + Http2String name = Random().RandString(1024); + Http2String value = Random().RandString(65536); HpackBlockBuilder hbb; hbb.AppendString(false, name);
diff --git a/net/http2/hpack/decoder/hpack_varint_decoder.cc b/net/http2/hpack/decoder/hpack_varint_decoder.cc index f04bd89d..8f3a192 100644 --- a/net/http2/hpack/decoder/hpack_varint_decoder.cc +++ b/net/http2/hpack/decoder/hpack_varint_decoder.cc
@@ -4,14 +4,13 @@ #include "net/http2/hpack/decoder/hpack_varint_decoder.h" -#include <sstream> +#include "net/http2/platform/api/http2_string_utils.h" namespace net { -std::string HpackVarintDecoder::DebugString() const { - std::stringstream ss; - ss << "HpackVarintDecoder(value=" << value_ << ", offset=" << offset_ << ")"; - return ss.str(); +Http2String HpackVarintDecoder::DebugString() const { + return Http2StrCat("HpackVarintDecoder(value=", value_, ", offset=", offset_, + ")"); } DecodeStatus HpackVarintDecoder::StartForTest(uint8_t prefix_value,
diff --git a/net/http2/hpack/decoder/hpack_varint_decoder.h b/net/http2/hpack/decoder/hpack_varint_decoder.h index 0ce9a9d..15e2d37d4f 100644 --- a/net/http2/hpack/decoder/hpack_varint_decoder.h +++ b/net/http2/hpack/decoder/hpack_varint_decoder.h
@@ -27,12 +27,11 @@ #ifndef NET_HTTP2_HPACK_DECODER_HPACK_VARINT_DECODER_H_ #define NET_HTTP2_HPACK_DECODER_HPACK_VARINT_DECODER_H_ -#include <string> - #include "base/logging.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { // Decodes an HPACK variable length unsigned integer, in a resumable fashion @@ -124,7 +123,7 @@ // All the public methods below are for supporting assertions and tests. - std::string DebugString() const; + Http2String DebugString() const; // For benchmarking, these methods ensure the decoder // is NOT inlined into the caller.
diff --git a/net/http2/hpack/decoder/hpack_varint_decoder_test.cc b/net/http2/hpack/decoder/hpack_varint_decoder_test.cc index 088697d7..91a3d3530 100644 --- a/net/http2/hpack/decoder/hpack_varint_decoder_test.cc +++ b/net/http2/hpack/decoder/hpack_varint_decoder_test.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "net/http2/hpack/decoder/hpack_varint_decoder.h" +#include "net/http2/platform/api/http2_string_utils.h" // Tests of HpackVarintDecoder. @@ -17,9 +18,8 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" -#include "base/strings/stringprintf.h" #include "net/http2/hpack/tools/hpack_block_builder.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_decoder_test.h" @@ -27,9 +27,6 @@ using ::testing::AssertionFailure; using ::testing::AssertionSuccess; -using base::StringPiece; -using base::StringPrintf; -using std::string; namespace net { namespace test { @@ -158,7 +155,7 @@ << "), prefix_length=" << std::dec << prefix_length << ", expected_bytes=" << expected_bytes << std::endl << HexEncode(buffer_); - string msg(ss.str()); + Http2String msg(ss.str()); if (value == minimum) { LOG(INFO) << "Checking minimum; " << msg; @@ -228,7 +225,7 @@ } HpackVarintDecoder decoder_; - string buffer_; + Http2String buffer_; uint8_t prefix_mask_ = 0; uint8_t prefix_length_ = 0; }; @@ -269,15 +266,15 @@ for (uint32_t value : values) { EncodeNoRandom(value, prefix_length); - string dump = HexEncode(buffer_); - LOG(INFO) << StringPrintf("%10u %0#10x ", value, value) + Http2String dump = HexEncode(buffer_); + LOG(INFO) << Http2StringPrintf("%10u %0#10x ", value, value) << HexEncode(buffer_); } } } TEST_F(HpackVarintDecoderTest, FromSpec1337) { - DecodeBuffer b(StringPiece("\x1f\x9a\x0a")); + DecodeBuffer b(Http2StringPiece("\x1f\x9a\x0a")); uint32_t prefix_length = 5; uint32_t prefix_mask = (1 << prefix_length) - 1; uint8_t p = b.DecodeUInt8();
diff --git a/net/http2/hpack/decoder/hpack_whole_entry_buffer.cc b/net/http2/hpack/decoder/hpack_whole_entry_buffer.cc index 429938f..f7044f1 100644 --- a/net/http2/hpack/decoder/hpack_whole_entry_buffer.cc +++ b/net/http2/hpack/decoder/hpack_whole_entry_buffer.cc
@@ -7,8 +7,6 @@ #include "base/logging.h" #include "base/trace_event/memory_usage_estimator.h" -using base::StringPiece; - namespace net { HpackWholeEntryBuffer::HpackWholeEntryBuffer(HpackWholeEntryListener* listener, @@ -68,7 +66,7 @@ void HpackWholeEntryBuffer::OnNameData(const char* data, size_t len) { DVLOG(2) << "HpackWholeEntryBuffer::OnNameData: len=" << len - << "\n data: " << StringPiece(data, len); + << "\n data: " << Http2StringPiece(data, len); DCHECK_EQ(maybe_name_index_, 0u); if (!error_detected_ && !name_.OnData(data, len)) { ReportError("Error decoding HPACK entry name."); @@ -99,7 +97,7 @@ void HpackWholeEntryBuffer::OnValueData(const char* data, size_t len) { DVLOG(2) << "HpackWholeEntryBuffer::OnValueData: len=" << len - << "\n data: " << StringPiece(data, len); + << "\n data: " << Http2StringPiece(data, len); if (!error_detected_ && !value_.OnData(data, len)) { ReportError("Error decoding HPACK entry value."); } @@ -129,7 +127,7 @@ listener_->OnDynamicTableSizeUpdate(size); } -void HpackWholeEntryBuffer::ReportError(StringPiece error_message) { +void HpackWholeEntryBuffer::ReportError(Http2StringPiece error_message) { if (!error_detected_) { DVLOG(1) << "HpackWholeEntryBuffer::ReportError: " << error_message; error_detected_ = true;
diff --git a/net/http2/hpack/decoder/hpack_whole_entry_buffer.h b/net/http2/hpack/decoder/hpack_whole_entry_buffer.h index ede16a59..89d6e18a 100644 --- a/net/http2/hpack/decoder/hpack_whole_entry_buffer.h +++ b/net/http2/hpack/decoder/hpack_whole_entry_buffer.h
@@ -13,12 +13,12 @@ #include <stddef.h> #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/http2/hpack/decoder/hpack_whole_entry_listener.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { @@ -77,7 +77,7 @@ void OnDynamicTableSizeUpdate(size_t size) override; private: - void ReportError(base::StringPiece error_message); + void ReportError(Http2StringPiece error_message); HpackWholeEntryListener* listener_; HpackDecoderStringBuffer name_, value_;
diff --git a/net/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc b/net/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc index 0b5564f..b7260e29 100644 --- a/net/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc +++ b/net/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc
@@ -7,12 +7,12 @@ // Tests of HpackWholeEntryBuffer: does it buffer correctly, and does it // detect Huffman decoding errors and oversize string errors? +#include "net/http2/platform/api/http2_string.h" #include "net/test/gtest_util.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; using ::testing::AllOf; using ::testing::HasSubstr; using ::testing::InSequence; @@ -26,11 +26,11 @@ constexpr size_t kMaxStringSize = 20; -// Define HasSubstr() for base::StringPiece arguments. +// Define HasSubstr() for Http2StringPiece arguments. // This shadows ::testing::HasSubstr(), which only works on argument types -// that can be implicilty converted to a std::string. +// that can be implicitly converted to a Http2String. inline ::testing::PolymorphicMatcher<StringPieceHasSubstrMatcher> HasSubstr( - const std::string& substring) { + const Http2String& substring) { return ::testing::MakePolymorphicMatcher( StringPieceHasSubstrMatcher(substring)); } @@ -49,7 +49,7 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer)); MOCK_METHOD1(OnDynamicTableSizeUpdate, void(size_t size)); - MOCK_METHOD1(OnHpackDecodeError, void(StringPiece error_message)); + MOCK_METHOD1(OnHpackDecodeError, void(Http2StringPiece error_message)); }; class HpackWholeEntryBufferTest : public ::testing::Test {
diff --git a/net/http2/hpack/decoder/hpack_whole_entry_listener.cc b/net/http2/hpack/decoder/hpack_whole_entry_listener.cc index b10bcd5..ed18ff1 100644 --- a/net/http2/hpack/decoder/hpack_whole_entry_listener.cc +++ b/net/http2/hpack/decoder/hpack_whole_entry_listener.cc
@@ -4,8 +4,6 @@ #include "net/http2/hpack/decoder/hpack_whole_entry_listener.h" -using base::StringPiece; - namespace net { HpackWholeEntryListener::~HpackWholeEntryListener() {} @@ -23,7 +21,7 @@ HpackDecoderStringBuffer* value_buffer) {} void HpackWholeEntryNoOpListener::OnDynamicTableSizeUpdate(size_t size) {} void HpackWholeEntryNoOpListener::OnHpackDecodeError( - StringPiece error_message) {} + Http2StringPiece error_message) {} // static HpackWholeEntryNoOpListener* HpackWholeEntryNoOpListener::NoOpListener() {
diff --git a/net/http2/hpack/decoder/hpack_whole_entry_listener.h b/net/http2/hpack/decoder/hpack_whole_entry_listener.h index 9a53573..c5f4809 100644 --- a/net/http2/hpack/decoder/hpack_whole_entry_listener.h +++ b/net/http2/hpack/decoder/hpack_whole_entry_listener.h
@@ -11,10 +11,10 @@ #include <stddef.h> -#include "base/strings/string_piece.h" #include "net/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/http2/hpack/http2_hpack_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { @@ -51,7 +51,7 @@ // OnHpackDecodeError is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - virtual void OnHpackDecodeError(base::StringPiece error_message) = 0; + virtual void OnHpackDecodeError(Http2StringPiece error_message) = 0; }; // A no-op implementation of HpackWholeEntryDecoderListener, useful for ignoring @@ -69,7 +69,7 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer) override; void OnDynamicTableSizeUpdate(size_t size) override; - void OnHpackDecodeError(base::StringPiece error_message) override; + void OnHpackDecodeError(Http2StringPiece error_message) override; // Returns a listener that ignores all the calls. static HpackWholeEntryNoOpListener* NoOpListener();
diff --git a/net/http2/hpack/decoder/http2_hpack_decoder.cc b/net/http2/hpack/decoder/http2_hpack_decoder.cc index 607bec1..4a31db3 100644 --- a/net/http2/hpack/decoder/http2_hpack_decoder.cc +++ b/net/http2/hpack/decoder/http2_hpack_decoder.cc
@@ -8,8 +8,6 @@ #include "base/trace_event/memory_usage_estimator.h" #include "net/http2/decoder/decode_status.h" -using base::StringPiece; - namespace net { Http2HpackDecoder::Http2HpackDecoder(HpackDecoderListener* listener, @@ -121,7 +119,7 @@ return base::trace_event::EstimateMemoryUsage(entry_buffer_); } -void Http2HpackDecoder::ReportError(StringPiece error_message) { +void Http2HpackDecoder::ReportError(Http2StringPiece error_message) { DVLOG(3) << "Http2HpackDecoder::ReportError is new=" << (!error_detected_ ? "true" : "false") << ", error_message: " << error_message;
diff --git a/net/http2/hpack/decoder/http2_hpack_decoder.h b/net/http2/hpack/decoder/http2_hpack_decoder.h index 421135bb..c9055cd 100644 --- a/net/http2/hpack/decoder/http2_hpack_decoder.h +++ b/net/http2/hpack/decoder/http2_hpack_decoder.h
@@ -23,7 +23,6 @@ #include <stdint.h> #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/hpack/decoder/hpack_block_decoder.h" #include "net/http2/hpack/decoder/hpack_decoder_listener.h" @@ -31,6 +30,7 @@ #include "net/http2/hpack/decoder/hpack_decoder_tables.h" #include "net/http2/hpack/decoder/hpack_whole_entry_buffer.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -102,7 +102,7 @@ friend class test::Http2HpackDecoderPeer; // Reports an error to the listener IF this is the first error detected. - void ReportError(base::StringPiece error_message); + void ReportError(Http2StringPiece error_message); // The decompressor state, as defined by HPACK (i.e. the static and dynamic // tables).
diff --git a/net/http2/hpack/decoder/http2_hpack_decoder_test.cc b/net/http2/hpack/decoder/http2_hpack_decoder_test.cc index bbc81c44a..2293fc7 100644 --- a/net/http2/hpack/decoder/http2_hpack_decoder_test.cc +++ b/net/http2/hpack/decoder/http2_hpack_decoder_test.cc
@@ -6,13 +6,11 @@ // Tests of Http2HpackDecoder. -#include <string> #include <tuple> #include <utility> #include <vector> #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/hpack/decoder/hpack_decoder_listener.h" #include "net/http2/hpack/decoder/hpack_decoder_state.h" @@ -22,14 +20,13 @@ #include "net/http2/hpack/tools/hpack_block_builder.h" #include "net/http2/hpack/tools/hpack_example.h" #include "net/http2/http2_constants.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; -using std::string; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -56,7 +53,7 @@ namespace { -typedef std::tuple<HpackEntryType, string, string> HpackHeaderEntry; +typedef std::tuple<HpackEntryType, Http2String, Http2String> HpackHeaderEntry; typedef std::vector<HpackHeaderEntry> HpackHeaderEntries; // TODO(jamessynge): Create a ...test_utils.h file with the mock listener @@ -69,7 +66,7 @@ const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, void(StringPiece error_message)); + MOCK_METHOD1(OnHeaderErrorDetected, void(Http2StringPiece error_message)); }; class Http2HpackDecoderTest : public ::testing::TestWithParam<bool>, @@ -118,7 +115,7 @@ // OnHeaderErrorDetected is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - void OnHeaderErrorDetected(StringPiece error_message) override { + void OnHeaderErrorDetected(Http2StringPiece error_message) override { ASSERT_TRUE(saw_start_); error_messages_.push_back(error_message.as_string()); // No further callbacks should be made at this point, so replace 'this' as @@ -127,7 +124,7 @@ decoder_.set_listener(&mock_listener_); } - AssertionResult DecodeBlock(StringPiece block) { + AssertionResult DecodeBlock(Http2StringPiece block) { VLOG(1) << "Http2HpackDecoderTest::DecodeBlock"; VERIFY_FALSE(decoder_.error_detected()); @@ -219,7 +216,7 @@ Http2HpackDecoder decoder_; testing::StrictMock<MockHpackDecoderListener> mock_listener_; HpackHeaderEntries header_entries_; - std::vector<string> error_messages_; + std::vector<Http2String> error_messages_; bool fragment_the_hpack_block_; bool saw_start_ = false; bool saw_end_ = false; @@ -232,7 +229,7 @@ // http://httpwg.org/specs/rfc7541.html#rfc.section.C.3 TEST_P(Http2HpackDecoderTest, C3_RequestExamples) { // C.3.1 First Request - string hpack_block = HpackExampleToStringOrDie(R"( + Http2String hpack_block = HpackExampleToStringOrDie(R"( 82 | == Indexed - Add == | idx = 2 | -> :method: GET @@ -367,7 +364,7 @@ // http://httpwg.org/specs/rfc7541.html#rfc.section.C.4 TEST_P(Http2HpackDecoderTest, C4_RequestExamplesWithHuffmanEncoding) { // C.4.1 First Request - string hpack_block = HpackExampleToStringOrDie(R"( + Http2String hpack_block = HpackExampleToStringOrDie(R"( 82 | == Indexed - Add == | idx = 2 | -> :method: GET @@ -526,7 +523,7 @@ // date: Mon, 21 Oct 2013 20:13:21 GMT // location: https://www.example.com - string hpack_block = HpackExampleToStringOrDie(R"( + Http2String hpack_block = HpackExampleToStringOrDie(R"( 48 | == Literal indexed == | Indexed name (idx = 8) | :status @@ -751,7 +748,7 @@ // cache-control: private // date: Mon, 21 Oct 2013 20:13:21 GMT // location: https://www.example.com - string hpack_block = HpackExampleToStringOrDie(R"( + Http2String hpack_block = HpackExampleToStringOrDie(R"( 48 | == Literal indexed == | Indexed name (idx = 8) | :status
diff --git a/net/http2/hpack/hpack_string.cc b/net/http2/hpack/hpack_string.cc index 1ed38e6..4db9f48a 100644 --- a/net/http2/hpack/hpack_string.cc +++ b/net/http2/hpack/hpack_string.cc
@@ -7,39 +7,37 @@ #include <utility> #include "base/logging.h" - -using base::StringPiece; -using std::string; +#include "net/http2/platform/api/http2_string_utils.h" namespace net { HpackString::HpackString(const char* data) : str_(data) {} -HpackString::HpackString(StringPiece str) : str_(str.as_string()) {} -HpackString::HpackString(string str) : str_(std::move(str)) {} +HpackString::HpackString(Http2StringPiece str) : str_(str.as_string()) {} +HpackString::HpackString(Http2String str) : str_(std::move(str)) {} HpackString::HpackString(const HpackString& other) : str_(other.str_) {} HpackString::~HpackString() {} -StringPiece HpackString::ToStringPiece() const { +Http2StringPiece HpackString::ToStringPiece() const { return str_; } bool HpackString::operator==(const HpackString& other) const { return str_ == other.str_; } -bool HpackString::operator==(StringPiece str) const { +bool HpackString::operator==(Http2StringPiece str) const { return str == str_; } -bool operator==(StringPiece a, const HpackString& b) { +bool operator==(Http2StringPiece a, const HpackString& b) { return b == a; } -bool operator!=(StringPiece a, const HpackString& b) { +bool operator!=(Http2StringPiece a, const HpackString& b) { return !(b == a); } bool operator!=(const HpackString& a, const HpackString& b) { return !(a == b); } -bool operator!=(const HpackString& a, StringPiece b) { +bool operator!=(const HpackString& a, Http2StringPiece b) { return !(a == b); } std::ostream& operator<<(std::ostream& out, const HpackString& v) { @@ -52,7 +50,7 @@ DVLOG(3) << DebugString() << " ctor"; } -HpackStringPair::HpackStringPair(StringPiece name, StringPiece value) +HpackStringPair::HpackStringPair(Http2StringPiece name, Http2StringPiece value) : name(name), value(value) { DVLOG(3) << DebugString() << " ctor"; } @@ -61,13 +59,9 @@ DVLOG(3) << DebugString() << " dtor"; } -string HpackStringPair::DebugString() const { - string debug_string("HpackStringPair(name="); - debug_string.append(name.ToString()); - debug_string.append(", value="); - debug_string.append(value.ToString()); - debug_string.append(")"); - return debug_string; +Http2String HpackStringPair::DebugString() const { + return Http2StrCat("HpackStringPair(name=", name.ToString(), + ", value=", value.ToString(), ")"); } std::ostream& operator<<(std::ostream& os, const HpackStringPair& p) {
diff --git a/net/http2/hpack/hpack_string.h b/net/http2/hpack/hpack_string.h index ac9ecf9..b797be9 100644 --- a/net/http2/hpack/hpack_string.h +++ b/net/http2/hpack/hpack_string.h
@@ -13,18 +13,18 @@ #include <stddef.h> #include <iosfwd> -#include <string> -#include "base/strings/string_piece.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { class HTTP2_EXPORT_PRIVATE HpackString { public: explicit HpackString(const char* data); - explicit HpackString(base::StringPiece str); - explicit HpackString(std::string str); + explicit HpackString(Http2StringPiece str); + explicit HpackString(Http2String str); HpackString(const HpackString& other); // Not sure yet whether this move ctor is required/sensible. @@ -35,35 +35,35 @@ ~HpackString(); size_t size() const { return str_.size(); } - const std::string& ToString() const { return str_; } - base::StringPiece ToStringPiece() const; + const Http2String& ToString() const { return str_; } + Http2StringPiece ToStringPiece() const; bool operator==(const HpackString& other) const; - bool operator==(base::StringPiece str) const; + bool operator==(Http2StringPiece str) const; private: - std::string str_; + Http2String str_; }; -HTTP2_EXPORT_PRIVATE bool operator==(base::StringPiece a, const HpackString& b); -HTTP2_EXPORT_PRIVATE bool operator!=(base::StringPiece a, const HpackString& b); +HTTP2_EXPORT_PRIVATE bool operator==(Http2StringPiece a, const HpackString& b); +HTTP2_EXPORT_PRIVATE bool operator!=(Http2StringPiece a, const HpackString& b); HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, const HpackString& b); -HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, base::StringPiece b); +HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, Http2StringPiece b); HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, const HpackString& v); struct HTTP2_EXPORT_PRIVATE HpackStringPair { HpackStringPair(const HpackString& name, const HpackString& value); - HpackStringPair(base::StringPiece name, base::StringPiece value); + HpackStringPair(Http2StringPiece name, Http2StringPiece value); ~HpackStringPair(); // Returns the size of a header entry with this name and value, per the RFC: // http://httpwg.org/specs/rfc7541.html#calculating.table.size size_t size() const { return 32 + name.size() + value.size(); } - std::string DebugString() const; + Http2String DebugString() const; HpackString name; HpackString value;
diff --git a/net/http2/hpack/hpack_string_test.cc b/net/http2/hpack/hpack_string_test.cc index 337a3011..74b3ef89 100644 --- a/net/http2/hpack/hpack_string_test.cc +++ b/net/http2/hpack/hpack_string_test.cc
@@ -15,8 +15,6 @@ using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; -using std::string; namespace net { namespace test { @@ -28,9 +26,9 @@ class HpackStringTest : public ::testing::Test { protected: AssertionResult VerifyNotEqual(HpackString* actual, - const string& not_expected_str) { + const Http2String& not_expected_str) { const char* not_expected_ptr = not_expected_str.c_str(); - StringPiece not_expected_sp(not_expected_str); + Http2StringPiece not_expected_sp(not_expected_str); VERIFY_NE(*actual, not_expected_ptr); VERIFY_NE(*actual, not_expected_sp); @@ -53,11 +51,12 @@ return AssertionSuccess(); } - AssertionResult VerifyEqual(HpackString* actual, const string& expected_str) { + AssertionResult VerifyEqual(HpackString* actual, + const Http2String& expected_str) { VERIFY_EQ(actual->size(), expected_str.size()); const char* expected_ptr = expected_str.c_str(); - const StringPiece expected_sp(expected_str); + const Http2StringPiece expected_sp(expected_str); VERIFY_EQ(*actual, expected_ptr); VERIFY_EQ(*actual, expected_sp); @@ -92,31 +91,31 @@ } TEST_F(HpackStringTest, StringPieceConstructor) { - StringPiece sp0(kStr0); + Http2StringPiece sp0(kStr0); HpackString hs0(sp0); EXPECT_TRUE(VerifyEqual(&hs0, kStr0)); EXPECT_TRUE(VerifyNotEqual(&hs0, kStr1)); - StringPiece sp1(kStr1); + Http2StringPiece sp1(kStr1); HpackString hs1(sp1); EXPECT_TRUE(VerifyEqual(&hs1, kStr1)); EXPECT_TRUE(VerifyNotEqual(&hs1, kStr0)); } TEST_F(HpackStringTest, MoveStringConstructor) { - string str0(kStr0); + Http2String str0(kStr0); HpackString hs0(str0); EXPECT_TRUE(VerifyEqual(&hs0, kStr0)); EXPECT_TRUE(VerifyNotEqual(&hs0, kStr1)); - string str1(kStr1); + Http2String str1(kStr1); HpackString hs1(str1); EXPECT_TRUE(VerifyEqual(&hs1, kStr1)); EXPECT_TRUE(VerifyNotEqual(&hs1, kStr0)); } TEST_F(HpackStringTest, CopyConstructor) { - StringPiece sp0(kStr0); + Http2StringPiece sp0(kStr0); HpackString hs0(sp0); HpackString hs1(hs0); EXPECT_EQ(hs0, hs1); @@ -129,7 +128,7 @@ } TEST_F(HpackStringTest, MoveConstructor) { - StringPiece sp0(kStr0); + Http2StringPiece sp0(kStr0); HpackString hs0(sp0); EXPECT_TRUE(VerifyEqual(&hs0, kStr0)); EXPECT_TRUE(VerifyNotEqual(&hs0, ""));
diff --git a/net/http2/hpack/http2_hpack_constants.cc b/net/http2/hpack/http2_hpack_constants.cc index bc0ee9e..d283122 100644 --- a/net/http2/hpack/http2_hpack_constants.cc +++ b/net/http2/hpack/http2_hpack_constants.cc
@@ -6,9 +6,11 @@ #include <sstream> +#include "net/http2/platform/api/http2_string_utils.h" + namespace net { -std::string HpackEntryTypeToString(HpackEntryType v) { +Http2String HpackEntryTypeToString(HpackEntryType v) { switch (v) { case HpackEntryType::kIndexedHeader: return "kIndexedHeader"; @@ -21,9 +23,7 @@ case HpackEntryType::kNeverIndexedLiteralHeader: return "kNeverIndexedLiteralHeader"; } - std::stringstream ss; - ss << "UnknownHpackEntryType(" << static_cast<int>(v) << ")"; - return ss.str(); + return Http2StrCat("UnknownHpackEntryType(", static_cast<int>(v), ")"); } std::ostream& operator<<(std::ostream& out, HpackEntryType v) {
diff --git a/net/http2/hpack/http2_hpack_constants.h b/net/http2/hpack/http2_hpack_constants.h index f771fc7..a2a29e32 100644 --- a/net/http2/hpack/http2_hpack_constants.h +++ b/net/http2/hpack/http2_hpack_constants.h
@@ -11,9 +11,9 @@ // https://http2.github.io/http2-spec/compression.html#rfc.section.6 #include <ostream> -#include <string> #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -50,7 +50,7 @@ }; // Returns the name of the enum member. -HTTP2_EXPORT_PRIVATE std::string HpackEntryTypeToString(HpackEntryType v); +HTTP2_EXPORT_PRIVATE Http2String HpackEntryTypeToString(HpackEntryType v); // Inserts the name of the enum member into |out|. HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
diff --git a/net/http2/hpack/huffman/http2_hpack_huffman_decoder.cc b/net/http2/hpack/huffman/http2_hpack_huffman_decoder.cc index 189d34a..eda6ed38 100644 --- a/net/http2/hpack/huffman/http2_hpack_huffman_decoder.cc +++ b/net/http2/hpack/huffman/http2_hpack_huffman_decoder.cc
@@ -9,9 +9,6 @@ #include "base/logging.h" -using base::StringPiece; -using std::string; - // Terminology: // // Symbol - a plain text (unencoded) character (uint8), or the End-of-String @@ -359,7 +356,7 @@ count_ = 0; } -size_t HuffmanBitBuffer::AppendBytes(StringPiece input) { +size_t HuffmanBitBuffer::AppendBytes(Http2StringPiece input) { HuffmanAccumulatorBitCount free_cnt = free_count(); size_t bytes_available = input.size(); if (free_cnt < 8 || bytes_available == 0) { @@ -406,7 +403,7 @@ return false; } -string HuffmanBitBuffer::DebugString() const { +Http2String HuffmanBitBuffer::DebugString() const { std::stringstream ss; ss << "{accumulator: " << HuffmanAccumulatorBitSet(accumulator_) << "; count: " << count_ << "}"; @@ -417,15 +414,15 @@ HpackHuffmanDecoder::~HpackHuffmanDecoder() {} -bool HpackHuffmanDecoder::Decode(StringPiece input, string* output) { +bool HpackHuffmanDecoder::Decode(Http2StringPiece input, Http2String* output) { return DecodeShortCodesFirst(input, output); } // "Legacy" decoder, used until cl/129771019 submitted, which added // DecodeShortCodesFirst() as primary decoder method. // TODO(jamessynge): Remove this once satisfied that there is no going back. -bool HpackHuffmanDecoder::DecodeWithIfTreeAndStruct(StringPiece input, - string* output) { +bool HpackHuffmanDecoder::DecodeWithIfTreeAndStruct(Http2StringPiece input, + Http2String* output) { DVLOG(1) << "HpackHuffmanDecoder::DecodeWithIfTreeAndStruct"; // Fill bit_buffer_ from input. @@ -468,8 +465,8 @@ } } -bool HpackHuffmanDecoder::DecodeShortCodesFirst(StringPiece input, - string* output) { +bool HpackHuffmanDecoder::DecodeShortCodesFirst(Http2StringPiece input, + Http2String* output) { DVLOG(1) << "HpackHuffmanDecoder::DecodeShortCodesFirst"; // Fill bit_buffer_ from input. @@ -535,7 +532,7 @@ } } -string HpackHuffmanDecoder::DebugString() const { +Http2String HpackHuffmanDecoder::DebugString() const { return bit_buffer_.DebugString(); }
diff --git a/net/http2/hpack/huffman/http2_hpack_huffman_decoder.h b/net/http2/hpack/huffman/http2_hpack_huffman_decoder.h index b0ab0e11..18f8ec5 100644 --- a/net/http2/hpack/huffman/http2_hpack_huffman_decoder.h +++ b/net/http2/hpack/huffman/http2_hpack_huffman_decoder.h
@@ -15,10 +15,10 @@ #include <stddef.h> #include <iosfwd> -#include <string> -#include "base/strings/string_piece.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { @@ -46,7 +46,7 @@ // Add as many whole bytes to the accumulator (accumulator_) as possible, // returning the number of bytes added. - size_t AppendBytes(base::StringPiece input); + size_t AppendBytes(Http2StringPiece input); // Get the bits of the accumulator. HuffmanAccumulator value() const { return accumulator_; } @@ -73,7 +73,7 @@ // of them 1. Otherwise returns false. bool InputProperlyTerminated() const; - std::string DebugString() const; + Http2String DebugString() const; private: HuffmanAccumulator accumulator_; @@ -108,7 +108,7 @@ // will contain the leading bits of the code for that symbol, but not the // final bits of that code. // Note that output should be empty, but that it is not cleared by Decode(). - bool Decode(base::StringPiece input, std::string* output); + bool Decode(Http2StringPiece input, Http2String* output); // Is what remains in the bit_buffer_ valid at the end of an encoded string? // Call after passing the the final portion of a Huffman string to Decode, @@ -119,7 +119,7 @@ bool IsEmptyForTest() const { return bit_buffer_.IsEmpty(); } - std::string DebugString() const; + Http2String DebugString() const; ////////////////////////////////////////////////////////////////////////////// // Alternate implementations of Decode: @@ -127,13 +127,13 @@ // As above, implemented using a tree of if statements to determine the code // length, etc., which are returned as a tree. See PrefixToInfo. This is the // original implementation, current as of 2016-8-8. - bool DecodeWithIfTreeAndStruct(base::StringPiece input, std::string* output); + bool DecodeWithIfTreeAndStruct(Http2StringPiece input, Http2String* output); // Based on DecodeWithIfTreeAndStruct, but adds an optimization for the common // case of short codes (5, 6 or 7), which make up a large fraction of the // frequency distribution on which the HPACK table was based. // TODO(jamessynge): Be precise about that fraction. - bool DecodeShortCodesFirst(base::StringPiece input, std::string* output); + bool DecodeShortCodesFirst(Http2StringPiece input, Http2String* output); private: HuffmanBitBuffer bit_buffer_;
diff --git a/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc b/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc index 971b6e4..e607f0a 100644 --- a/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc +++ b/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc
@@ -7,10 +7,8 @@ // Tests of HpackHuffmanDecoder and HuffmanBitBuffer. #include <iostream> -#include <string> #include "base/macros.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/tools/failure.h" @@ -20,8 +18,6 @@ using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; -using std::string; namespace net { namespace test { @@ -37,11 +33,11 @@ } TEST(HuffmanBitBufferTest, AppendBytesAligned) { - string s; + Http2String s; s.push_back('\x11'); s.push_back('\x22'); s.push_back('\x33'); - StringPiece sp(s); + Http2StringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -86,11 +82,11 @@ } TEST(HuffmanBitBufferTest, ConsumeBits) { - string s; + Http2String s; s.push_back('\x11'); s.push_back('\x22'); s.push_back('\x33'); - StringPiece sp(s); + Http2StringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -108,7 +104,7 @@ } TEST(HuffmanBitBufferTest, AppendBytesUnaligned) { - string s; + Http2String s; s.push_back('\x11'); s.push_back('\x22'); s.push_back('\x33'); @@ -122,7 +118,7 @@ s.push_back('\xbb'); s.push_back('\xcc'); s.push_back('\xdd'); - StringPiece sp(s); + Http2StringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -170,10 +166,10 @@ DecodeStatus ResumeDecoding(DecodeBuffer* b) override { input_bytes_seen_ += b->Remaining(); - StringPiece sp(b->cursor(), b->Remaining()); + Http2StringPiece sp(b->cursor(), b->Remaining()); if (DecodeFragment(sp)) { b->AdvanceCursor(b->Remaining()); - // Successfully decoded (or buffered) the bytes in StringPiece. + // Successfully decoded (or buffered) the bytes in Http2StringPiece. EXPECT_LE(input_bytes_seen_, input_bytes_expected_); // Have we reached the end of the encoded string? if (input_bytes_expected_ == input_bytes_seen_) { @@ -188,7 +184,7 @@ return DecodeStatus::kDecodeError; } - bool DecodeFragment(StringPiece sp) { + bool DecodeFragment(Http2StringPiece sp) { switch (GetParam()) { case DecoderChoice::IF_TREE: return decoder_.DecodeWithIfTreeAndStruct(sp, &output_buffer_); @@ -201,8 +197,8 @@ } AssertionResult HuffmanDecodeAndValidateSeveralWays( - StringPiece encoded, - StringPiece expected_plain) { + Http2StringPiece encoded, + Http2StringPiece expected_plain) { input_bytes_expected_ = encoded.size(); NoArgValidator validator = [expected_plain, this]() -> AssertionResult { VERIFY_EQ(output_buffer_.size(), expected_plain.size()); @@ -216,7 +212,7 @@ } HpackHuffmanDecoder decoder_; - string output_buffer_; + Http2String output_buffer_; size_t input_bytes_seen_; size_t input_bytes_expected_; }; @@ -227,7 +223,7 @@ TEST_P(HpackHuffmanDecoderTest, SpecRequestExamples) { HpackHuffmanDecoder decoder; - string test_table[] = { + Http2String test_table[] = { a2b_hex("f1e3c2e5f23a6ba0ab90f4ff"), "www.example.com", a2b_hex("a8eb10649cbf"), @@ -238,9 +234,9 @@ "custom-value", }; for (size_t i = 0; i != arraysize(test_table); i += 2) { - const string& huffman_encoded(test_table[i]); - const string& plain_string(test_table[i + 1]); - string buffer; + const Http2String& huffman_encoded(test_table[i]); + const Http2String& plain_string(test_table[i + 1]); + Http2String buffer; decoder.Reset(); EXPECT_TRUE(decoder.Decode(huffman_encoded, &buffer)) << decoder; EXPECT_TRUE(decoder.InputProperlyTerminated()) << decoder; @@ -251,7 +247,7 @@ TEST_P(HpackHuffmanDecoderTest, SpecResponseExamples) { HpackHuffmanDecoder decoder; // clang-format off - string test_table[] = { + Http2String test_table[] = { a2b_hex("6402"), "302", a2b_hex("aec3771a4b"), @@ -269,9 +265,9 @@ }; // clang-format on for (size_t i = 0; i != arraysize(test_table); i += 2) { - const string& huffman_encoded(test_table[i]); - const string& plain_string(test_table[i + 1]); - string buffer; + const Http2String& huffman_encoded(test_table[i]); + const Http2String& plain_string(test_table[i + 1]); + Http2String buffer; decoder.Reset(); EXPECT_TRUE(decoder.Decode(huffman_encoded, &buffer)) << decoder; EXPECT_TRUE(decoder.InputProperlyTerminated()) << decoder;
diff --git a/net/http2/hpack/tools/hpack_block_builder.cc b/net/http2/hpack/tools/hpack_block_builder.cc index 0c8929e..8229942 100644 --- a/net/http2/hpack/tools/hpack_block_builder.cc +++ b/net/http2/hpack/tools/hpack_block_builder.cc
@@ -73,7 +73,7 @@ } void HpackBlockBuilder::AppendString(bool is_huffman_encoded, - base::StringPiece str) { + Http2StringPiece str) { uint8_t high_bits = is_huffman_encoded ? 0x80 : 0; uint8_t prefix_length = 7; AppendHighBitsAndVarint(high_bits, prefix_length, str.size());
diff --git a/net/http2/hpack/tools/hpack_block_builder.h b/net/http2/hpack/tools/hpack_block_builder.h index f594a30..ad82115 100644 --- a/net/http2/hpack/tools/hpack_block_builder.h +++ b/net/http2/hpack/tools/hpack_block_builder.h
@@ -16,10 +16,10 @@ // the support for very large varints will not be needed in production code. #include <stddef.h> -#include <string> -#include "base/strings/string_piece.h" #include "net/http2/hpack/http2_hpack_constants.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -27,13 +27,13 @@ class HpackBlockBuilder { public: - explicit HpackBlockBuilder(base::StringPiece initial_contents) + explicit HpackBlockBuilder(Http2StringPiece initial_contents) : buffer_(initial_contents.data(), initial_contents.size()) {} HpackBlockBuilder() {} ~HpackBlockBuilder() {} size_t size() const { return buffer_.size(); } - const std::string& buffer() const { return buffer_; } + const Http2String& buffer() const { return buffer_; } //---------------------------------------------------------------------------- // Methods for appending a valid HPACK entry. @@ -49,7 +49,7 @@ void AppendNameIndexAndLiteralValue(HpackEntryType entry_type, uint64_t name_index, bool value_is_huffman_encoded, - base::StringPiece value) { + Http2StringPiece value) { // name_index==0 would indicate that the entry includes a literal name. // Call AppendLiteralNameAndValue in that case. EXPECT_NE(0u, name_index); @@ -59,9 +59,9 @@ void AppendLiteralNameAndValue(HpackEntryType entry_type, bool name_is_huffman_encoded, - base::StringPiece name, + Http2StringPiece name, bool value_is_huffman_encoded, - base::StringPiece value) { + Http2StringPiece value) { AppendEntryTypeAndVarint(entry_type, 0); AppendString(name_is_huffman_encoded, name); AppendString(value_is_huffman_encoded, value); @@ -82,10 +82,10 @@ // Append a header string (i.e. a header name or value) in HPACK format. // Does NOT perform Huffman encoding. - void AppendString(bool is_huffman_encoded, base::StringPiece str); + void AppendString(bool is_huffman_encoded, Http2StringPiece str); private: - std::string buffer_; + Http2String buffer_; }; } // namespace test
diff --git a/net/http2/hpack/tools/hpack_block_builder_test.cc b/net/http2/hpack/tools/hpack_block_builder_test.cc index 43f37aa..f5251bf 100644 --- a/net/http2/hpack/tools/hpack_block_builder_test.cc +++ b/net/http2/hpack/tools/hpack_block_builder_test.cc
@@ -7,8 +7,6 @@ #include "net/spdy/core/spdy_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; - namespace net { namespace test { namespace { @@ -98,7 +96,7 @@ // 0x0000: 8286 8441 0f77 7777 2e65 7861 6d70 6c65 ...A.www.example // 0x0010: 2e63 6f6d .com - const std::string expected = + const Http2String expected = a2b_hex("828684410f7777772e6578616d706c652e636f6d"); EXPECT_EQ(expected, b.buffer()); } @@ -122,14 +120,14 @@ 0xabu, 0x90u, 0xf4u, 0xffu}; b.AppendNameIndexAndLiteralValue( HpackEntryType::kIndexedLiteralHeader, 1, kCompressed, - StringPiece(kHuffmanWwwExampleCom, sizeof kHuffmanWwwExampleCom)); + Http2StringPiece(kHuffmanWwwExampleCom, sizeof kHuffmanWwwExampleCom)); EXPECT_EQ(17u, b.size()); // Hex dump of encoded data (copied from RFC): // 0x0000: 8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4 ...A......:k.... // 0x0010: ff . - const std::string expected = a2b_hex("828684418cf1e3c2e5f23a6ba0ab90f4ff"); + const Http2String expected = a2b_hex("828684418cf1e3c2e5f23a6ba0ab90f4ff"); EXPECT_EQ(expected, b.buffer()); } } @@ -141,7 +139,7 @@ EXPECT_EQ(1u, b.size()); const char kData[] = {0x20}; - StringPiece expected(kData, sizeof kData); + Http2StringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } { @@ -150,7 +148,7 @@ EXPECT_EQ(3u, b.size()); const char kData[] = {0x3f, 0xe1u, 0x1f}; - StringPiece expected(kData, sizeof kData); + Http2StringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } { @@ -159,7 +157,7 @@ EXPECT_EQ(7u, b.size()); const char kData[] = {0x3fu, 0xe1u, 0x9fu, 0x94u, 0xa5u, 0x8du, 0x1du}; - StringPiece expected(kData, sizeof kData); + Http2StringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } }
diff --git a/net/http2/hpack/tools/hpack_example.cc b/net/http2/hpack/tools/hpack_example.cc index d1a5a979..0d0ba11 100644 --- a/net/http2/hpack/tools/hpack_example.cc +++ b/net/http2/hpack/tools/hpack_example.cc
@@ -9,14 +9,11 @@ #include "base/logging.h" #include "net/spdy/core/spdy_test_utils.h" -using base::StringPiece; -using std::string; - namespace net { namespace test { namespace { -void HpackExampleToStringOrDie(StringPiece example, string* output) { +void HpackExampleToStringOrDie(Http2StringPiece example, Http2String* output) { while (!example.empty()) { const char c0 = example[0]; if (isxdigit(c0)) { @@ -34,7 +31,7 @@ if (example.starts_with("|")) { // Start of a comment. Skip to end of line or of input. auto pos = example.find('\n'); - if (pos == StringPiece::npos) { + if (pos == Http2StringPiece::npos) { // End of input. break; } @@ -51,8 +48,8 @@ } // namespace -string HpackExampleToStringOrDie(StringPiece example) { - string output; +Http2String HpackExampleToStringOrDie(Http2StringPiece example) { + Http2String output; HpackExampleToStringOrDie(example, &output); return output; }
diff --git a/net/http2/hpack/tools/hpack_example.h b/net/http2/hpack/tools/hpack_example.h index 1567cbf..b4905fd 100644 --- a/net/http2/hpack/tools/hpack_example.h +++ b/net/http2/hpack/tools/hpack_example.h
@@ -5,6 +5,9 @@ #ifndef NET_HTTP2_HPACK_TOOLS_HPACK_EXAMPLE_H_ #define NET_HTTP2_HPACK_TOOLS_HPACK_EXAMPLE_H_ +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" + // Parses HPACK examples in the format seen in the HPACK specification, // RFC 7541. For example: // @@ -17,14 +20,10 @@ // // (excluding the leading "//"). -#include <string> - -#include "base/strings/string_piece.h" - namespace net { namespace test { -std::string HpackExampleToStringOrDie(base::StringPiece example); +Http2String HpackExampleToStringOrDie(Http2StringPiece example); } // namespace test } // namespace net
diff --git a/net/http2/http2_constants.cc b/net/http2/http2_constants.cc index dce2ccb..1687c9cc41 100644 --- a/net/http2/http2_constants.cc +++ b/net/http2/http2_constants.cc
@@ -8,15 +8,12 @@ #include <sstream> #include "base/logging.h" -#include "base/strings/string_piece.h" -#include "base/strings/stringprintf.h" - -using base::StringPrintf; -using std::string; +#include "net/http2/platform/api/http2_string_piece.h" +#include "net/http2/platform/api/http2_string_utils.h" namespace net { -string Http2FrameTypeToString(Http2FrameType v) { +Http2String Http2FrameTypeToString(Http2FrameType v) { switch (v) { case Http2FrameType::DATA: return "DATA"; @@ -41,23 +38,22 @@ case Http2FrameType::ALTSVC: return "ALTSVC"; } - std::stringstream ss; - ss << "UnknownFrameType(" << static_cast<int>(v) << ")"; - return ss.str(); + return Http2StrCat("UnknownFrameType(", static_cast<int>(v), ")"); } -string Http2FrameTypeToString(uint8_t v) { + +Http2String Http2FrameTypeToString(uint8_t v) { return Http2FrameTypeToString(static_cast<Http2FrameType>(v)); } -string Http2FrameFlagsToString(Http2FrameType type, uint8_t flags) { - string s; - // Closure to append flag name |v| to the string |s|, and to clear - // |bit| from |flags|. - auto append_and_clear = [&s, &flags](base::StringPiece v, uint8_t bit) { +Http2String Http2FrameFlagsToString(Http2FrameType type, uint8_t flags) { + Http2String s; + // Closure to append flag name |v| to the Http2String |s|, + // and to clear |bit| from |flags|. + auto append_and_clear = [&s, &flags](Http2StringPiece v, uint8_t bit) { if (!s.empty()) { s.push_back('|'); } - s.append(v.data(), v.size()); + Http2StrAppend(&s, v); flags ^= bit; }; if (flags & 0x01) { @@ -87,16 +83,16 @@ } } if (flags != 0) { - append_and_clear(StringPrintf("0x%02x", flags), flags); + append_and_clear(Http2StringPrintf("0x%02x", flags), flags); } DCHECK_EQ(0, flags); return s; } -string Http2FrameFlagsToString(uint8_t type, uint8_t flags) { +Http2String Http2FrameFlagsToString(uint8_t type, uint8_t flags) { return Http2FrameFlagsToString(static_cast<Http2FrameType>(type), flags); } -string Http2ErrorCodeToString(uint32_t v) { +Http2String Http2ErrorCodeToString(uint32_t v) { switch (v) { case 0x0: return "NO_ERROR"; @@ -131,11 +127,11 @@ ss << "UnknownErrorCode(0x" << std::hex << v << ")"; return ss.str(); } -string Http2ErrorCodeToString(Http2ErrorCode v) { +Http2String Http2ErrorCodeToString(Http2ErrorCode v) { return Http2ErrorCodeToString(static_cast<uint32_t>(v)); } -string Http2SettingsParameterToString(uint32_t v) { +Http2String Http2SettingsParameterToString(uint32_t v) { switch (v) { case 0x1: return "HEADER_TABLE_SIZE"; @@ -154,7 +150,7 @@ ss << "UnknownSettingsParameter(0x" << std::hex << v << ")"; return ss.str(); } -string Http2SettingsParameterToString(Http2SettingsParameter v) { +Http2String Http2SettingsParameterToString(Http2SettingsParameter v) { return Http2SettingsParameterToString(static_cast<uint32_t>(v)); }
diff --git a/net/http2/http2_constants.h b/net/http2/http2_constants.h index c948584fc..bf04992 100644 --- a/net/http2/http2_constants.h +++ b/net/http2/http2_constants.h
@@ -11,9 +11,9 @@ #include <iosfwd> #include <ostream> -#include <string> #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -57,8 +57,8 @@ // each unsupported value. Since these are just used for debugging/error // messages, that isn't a cost to we need to worry about. // The same applies to the functions later in this file. -HTTP2_EXPORT_PRIVATE std::string Http2FrameTypeToString(Http2FrameType v); -HTTP2_EXPORT_PRIVATE std::string Http2FrameTypeToString(uint8_t v); +HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(Http2FrameType v); +HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(uint8_t v); HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out, Http2FrameType v) { return out << Http2FrameTypeToString(v); @@ -78,9 +78,9 @@ // Formats zero or more flags for the specified type of frame. Returns an // empty string if flags==0. -HTTP2_EXPORT_PRIVATE std::string Http2FrameFlagsToString(Http2FrameType type, +HTTP2_EXPORT_PRIVATE Http2String Http2FrameFlagsToString(Http2FrameType type, uint8_t flags); -HTTP2_EXPORT_PRIVATE std::string Http2FrameFlagsToString(uint8_t type, +HTTP2_EXPORT_PRIVATE Http2String Http2FrameFlagsToString(uint8_t type, uint8_t flags); // Error codes for GOAWAY and RST_STREAM frames. @@ -145,8 +145,8 @@ } // Format the specified error code. -HTTP2_EXPORT_PRIVATE std::string Http2ErrorCodeToString(uint32_t v); -HTTP2_EXPORT_PRIVATE std::string Http2ErrorCodeToString(Http2ErrorCode v); +HTTP2_EXPORT_PRIVATE Http2String Http2ErrorCodeToString(uint32_t v); +HTTP2_EXPORT_PRIVATE Http2String Http2ErrorCodeToString(Http2ErrorCode v); HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out, Http2ErrorCode v) { return out << Http2ErrorCodeToString(v); @@ -226,9 +226,9 @@ } // Format the specified settings parameter. -HTTP2_EXPORT_PRIVATE std::string Http2SettingsParameterToString(uint32_t v); -HTTP2_EXPORT_PRIVATE std::string Http2SettingsParameterToString( - Http2SettingsParameter v); +HTTP2_EXPORT_PRIVATE Http2String Http2SettingsParameterToString(uint32_t v); +HTTP2_EXPORT_PRIVATE Http2String +Http2SettingsParameterToString(Http2SettingsParameter v); inline std::ostream& operator<<(std::ostream& out, Http2SettingsParameter v) { return out << Http2SettingsParameterToString(v); }
diff --git a/net/http2/http2_structures.cc b/net/http2/http2_structures.cc index 83360430..f840559 100644 --- a/net/http2/http2_structures.cc +++ b/net/http2/http2_structures.cc
@@ -6,13 +6,10 @@ #include <cstring> // For std::memcmp #include <sstream> -#include <string> #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" - -using std::string; -using base::StringPiece; +#include "net/http2/platform/api/http2_string_utils.h" namespace net { @@ -24,14 +21,13 @@ flags == '/'); // "/" } -string Http2FrameHeader::ToString() const { - std::stringstream ss; - ss << "length=" << payload_length << ", type=" << Http2FrameTypeToString(type) - << ", flags=" << FlagsToString() << ", stream=" << stream_id; - return ss.str(); +Http2String Http2FrameHeader::ToString() const { + return Http2StrCat("length=", payload_length, + ", type=", Http2FrameTypeToString(type), + ", flags=", FlagsToString(), ", stream=", stream_id); } -string Http2FrameHeader::FlagsToString() const { +Http2String Http2FrameHeader::FlagsToString() const { return Http2FrameFlagsToString(type, flags); } @@ -50,7 +46,7 @@ return a.stream_dependency == b.stream_dependency && a.weight == b.weight; } -std::string Http2PriorityFields::ToString() const { +Http2String Http2PriorityFields::ToString() const { std::stringstream ss; ss << "E=" << (is_exclusive ? "true" : "false") << ", stream=" << stream_dependency @@ -101,7 +97,7 @@ } std::ostream& operator<<(std::ostream& out, const Http2PingFields& v) { - string s = base::HexEncode(v.opaque_data, sizeof v.opaque_data); + Http2String s = base::HexEncode(v.opaque_data, sizeof v.opaque_data); base::CollapseWhitespaceASCII(s, /*trim_sequences_with_line_breaks=*/false); return out << "opaque_data=[" << s << "]"; }
diff --git a/net/http2/http2_structures.h b/net/http2/http2_structures.h index 1e18677b..5aa1735 100644 --- a/net/http2/http2_structures.h +++ b/net/http2/http2_structures.h
@@ -29,11 +29,11 @@ #include <stdint.h> #include <ostream> -#include <string> #include "base/logging.h" #include "net/http2/http2_constants.h" #include "net/http2/platform/api/http2_export.h" +#include "net/http2/platform/api/http2_string.h" namespace net { @@ -106,8 +106,8 @@ bool IsProbableHttpResponse() const; // Produce strings useful for debugging/logging messages. - std::string ToString() const; - std::string FlagsToString() const; + Http2String ToString() const; + Http2String FlagsToString() const; // 24 bit length of the payload after the header, including any padding. // First field in encoding. @@ -158,7 +158,7 @@ static constexpr size_t EncodedSize() { return 5; } // Produce strings useful for debugging/logging messages. - std::string ToString() const; + Http2String ToString() const; // A 31-bit stream identifier for the stream that this stream depends on. uint32_t stream_dependency;
diff --git a/net/http2/http2_structures_test.cc b/net/http2/http2_structures_test.cc index d0e914e..0121a67 100644 --- a/net/http2/http2_structures_test.cc +++ b/net/http2/http2_structures_test.cc
@@ -19,6 +19,7 @@ #include <vector> #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_string_utils.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "testing/gmock/include/gmock/gmock.h" @@ -33,7 +34,6 @@ using ::testing::Not; using ::testing::Values; using ::testing::ValuesIn; -using std::string; namespace net { namespace test { @@ -139,7 +139,7 @@ TEST_P(IsEndStreamTest, IsEndStream) { const bool is_set = (flags_ & Http2FrameFlag::END_STREAM) == Http2FrameFlag::END_STREAM; - string flags_string; + Http2String flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::DATA: @@ -176,7 +176,7 @@ Values(~Http2FrameFlag::ACK, 0xff))); TEST_P(IsACKTest, IsAck) { const bool is_set = (flags_ & Http2FrameFlag::ACK) == Http2FrameFlag::ACK; - string flags_string; + Http2String flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::SETTINGS: @@ -214,7 +214,7 @@ TEST_P(IsEndHeadersTest, IsEndHeaders) { const bool is_set = (flags_ & Http2FrameFlag::END_HEADERS) == Http2FrameFlag::END_HEADERS; - string flags_string; + Http2String flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::HEADERS: @@ -255,7 +255,7 @@ TEST_P(IsPaddedTest, IsPadded) { const bool is_set = (flags_ & Http2FrameFlag::PADDED) == Http2FrameFlag::PADDED; - string flags_string; + Http2String flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::DATA: @@ -294,7 +294,7 @@ TEST_P(HasPriorityTest, HasPriority) { const bool is_set = (flags_ & Http2FrameFlag::PRIORITY) == Http2FrameFlag::PRIORITY; - string flags_string; + Http2String flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::HEADERS: @@ -399,11 +399,9 @@ EXPECT_EQ(promised_stream_id, v.promised_stream_id); EXPECT_EQ(v, v); - std::stringstream s1; - s1 << "promised_stream_id=" << promised_stream_id; - std::stringstream s2; - s2 << v; - EXPECT_EQ(s1.str(), s2.str()); + std::stringstream s; + s << v; + EXPECT_EQ(Http2StrCat("promised_stream_id=", promised_stream_id), s.str()); // High-bit is reserved, but not used, so we can set it. promised_stream_id |= 0x80000000; @@ -445,11 +443,10 @@ EXPECT_EQ(window_size_increment, v.window_size_increment); EXPECT_EQ(v, v); - std::stringstream s1; - s1 << "window_size_increment=" << window_size_increment; - std::stringstream s2; - s2 << v; - EXPECT_EQ(s1.str(), s2.str()); + std::stringstream s; + s << v; + EXPECT_EQ(Http2StrCat("window_size_increment=", window_size_increment), + s.str()); // High-bit is reserved, but not used, so we can set it. window_size_increment |= 0x80000000; @@ -469,11 +466,9 @@ EXPECT_EQ(origin_length, v.origin_length); EXPECT_EQ(v, v); - std::stringstream s1; - s1 << "origin_length=" << origin_length; - std::stringstream s2; - s2 << v; - EXPECT_EQ(s1.str(), s2.str()); + std::stringstream s; + s << v; + EXPECT_EQ(Http2StrCat("origin_length=", origin_length), s.str()); Http2AltSvcFields w{++origin_length}; EXPECT_EQ(w, w);
diff --git a/net/http2/http2_structures_test_util.h b/net/http2/http2_structures_test_util.h index 710a530..ce50df0e 100644 --- a/net/http2/http2_structures_test_util.h +++ b/net/http2/http2_structures_test_util.h
@@ -5,9 +5,8 @@ #ifndef NET_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_ #define NET_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_ -#include <string> - #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_string.h" #include "net/http2/tools/http2_frame_builder.h" #include "testing/gtest/include/gtest/gtest.h" @@ -17,7 +16,7 @@ class RandomBase; template <class S> -std::string SerializeStructure(const S& s) { +Http2String SerializeStructure(const S& s) { Http2FrameBuilder fb; fb.Append(s); EXPECT_EQ(S::EncodedSize(), fb.size());
diff --git a/net/http2/platform/api/http2_string.h b/net/http2/platform/api/http2_string.h new file mode 100644 index 0000000..a013a240 --- /dev/null +++ b/net/http2/platform/api/http2_string.h
@@ -0,0 +1,16 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_API_HTTP2_STRING_H_ +#define NET_HTTP2_PLATFORM_API_HTTP2_STRING_H_ + +#include "net/http2/platform/impl/http2_string_impl.h" + +namespace net { + +using Http2String = Http2StringImpl; + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_API_HTTP2_STRING_H_
diff --git a/net/http2/platform/api/http2_string_piece.h b/net/http2/platform/api/http2_string_piece.h new file mode 100644 index 0000000..100b6e6 --- /dev/null +++ b/net/http2/platform/api/http2_string_piece.h
@@ -0,0 +1,16 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_ +#define NET_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_ + +#include "net/http2/platform/impl/http2_string_piece_impl.h" + +namespace net { + +using Http2StringPiece = Http2StringPieceImpl; + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_
diff --git a/net/http2/platform/api/http2_string_utils.h b/net/http2/platform/api/http2_string_utils.h new file mode 100644 index 0000000..b03e69b5 --- /dev/null +++ b/net/http2/platform/api/http2_string_utils.h
@@ -0,0 +1,32 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ +#define NET_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ + +#include <utility> + +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/impl/http2_string_utils_impl.h" + +namespace net { + +template <typename... Args> +inline Http2String Http2StrCat(const Args&... args) { + return Http2StrCatImpl(std::forward<const Args&>(args)...); +} + +template <typename... Args> +inline void Http2StrAppend(Http2String* output, const Args&... args) { + Http2StrAppendImpl(output, std::forward<const Args&>(args)...); +} + +template <typename... Args> +inline Http2String Http2StringPrintf(const Args&... args) { + return Http2StringPrintfImpl(std::forward<const Args&>(args)...); +} + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
diff --git a/net/http2/platform/api/http2_string_utils_test.cc b/net/http2/platform/api/http2_string_utils_test.cc new file mode 100644 index 0000000..310ae31 --- /dev/null +++ b/net/http2/platform/api/http2_string_utils_test.cc
@@ -0,0 +1,178 @@ +// 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 "net/http2/platform/api/http2_string_utils.h" + +#include <cstdint> + +#include "net/http2/platform/api/http2_string_piece.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { +namespace test { +namespace { + +TEST(Http2StringUtilsTest, Http2StrCat) { + // No arguments. + EXPECT_EQ("", Http2StrCat()); + + // Single string-like argument. + const char kFoo[] = "foo"; + const Http2String string_foo(kFoo); + const Http2StringPiece stringpiece_foo(string_foo); + EXPECT_EQ("foo", Http2StrCat(kFoo)); + EXPECT_EQ("foo", Http2StrCat(string_foo)); + EXPECT_EQ("foo", Http2StrCat(stringpiece_foo)); + + // Two string-like arguments. + const char kBar[] = "bar"; + const Http2StringPiece stringpiece_bar(kBar); + const Http2String string_bar(kBar); + EXPECT_EQ("foobar", Http2StrCat(kFoo, kBar)); + EXPECT_EQ("foobar", Http2StrCat(kFoo, string_bar)); + EXPECT_EQ("foobar", Http2StrCat(kFoo, stringpiece_bar)); + EXPECT_EQ("foobar", Http2StrCat(string_foo, kBar)); + EXPECT_EQ("foobar", Http2StrCat(string_foo, string_bar)); + EXPECT_EQ("foobar", Http2StrCat(string_foo, stringpiece_bar)); + EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, kBar)); + EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, string_bar)); + EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, stringpiece_bar)); + + // Many-many arguments. + EXPECT_EQ( + "foobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud", + Http2StrCat("foo", "bar", "baz", "qux", "quux", "quuz", "corge", "grault", + "garply", "waldo", "fred", "plugh", "xyzzy", "thud")); + + // Numerical arguments. + const int16_t i = 1; + const uint64_t u = 8; + const double d = 3.1415; + + EXPECT_EQ("1 8", Http2StrCat(i, " ", u)); + EXPECT_EQ("3.14151181", Http2StrCat(d, i, i, u, i)); + EXPECT_EQ("i: 1, u: 8, d: 3.1415", + Http2StrCat("i: ", i, ", u: ", u, ", d: ", d)); + + // Boolean arguments. + const bool t = true; + const bool f = false; + + EXPECT_EQ("1", Http2StrCat(t)); + EXPECT_EQ("0", Http2StrCat(f)); + EXPECT_EQ("0110", Http2StrCat(f, t, t, f)); + + // Mixed string-like, numerical, and Boolean arguments. + EXPECT_EQ("foo1foo081bar3.14151", + Http2StrCat(kFoo, i, string_foo, f, u, t, stringpiece_bar, d, t)); + EXPECT_EQ("3.141511bar18bar13.14150", + Http2StrCat(d, t, t, string_bar, i, u, kBar, t, d, f)); +} + +TEST(Http2StringUtilsTest, Http2StrAppend) { + // No arguments on empty string. + Http2String output; + Http2StrAppend(&output); + EXPECT_TRUE(output.empty()); + + // Single string-like argument. + const char kFoo[] = "foo"; + const Http2String string_foo(kFoo); + const Http2StringPiece stringpiece_foo(string_foo); + Http2StrAppend(&output, kFoo); + EXPECT_EQ("foo", output); + Http2StrAppend(&output, string_foo); + EXPECT_EQ("foofoo", output); + Http2StrAppend(&output, stringpiece_foo); + EXPECT_EQ("foofoofoo", output); + + // No arguments on non-empty string. + Http2StrAppend(&output); + EXPECT_EQ("foofoofoo", output); + + output.clear(); + + // Two string-like arguments. + const char kBar[] = "bar"; + const Http2StringPiece stringpiece_bar(kBar); + const Http2String string_bar(kBar); + Http2StrAppend(&output, kFoo, kBar); + EXPECT_EQ("foobar", output); + Http2StrAppend(&output, kFoo, string_bar); + EXPECT_EQ("foobarfoobar", output); + Http2StrAppend(&output, kFoo, stringpiece_bar); + EXPECT_EQ("foobarfoobarfoobar", output); + Http2StrAppend(&output, string_foo, kBar); + EXPECT_EQ("foobarfoobarfoobarfoobar", output); + + output.clear(); + + Http2StrAppend(&output, string_foo, string_bar); + EXPECT_EQ("foobar", output); + Http2StrAppend(&output, string_foo, stringpiece_bar); + EXPECT_EQ("foobarfoobar", output); + Http2StrAppend(&output, stringpiece_foo, kBar); + EXPECT_EQ("foobarfoobarfoobar", output); + Http2StrAppend(&output, stringpiece_foo, string_bar); + EXPECT_EQ("foobarfoobarfoobarfoobar", output); + + output.clear(); + + Http2StrAppend(&output, stringpiece_foo, stringpiece_bar); + EXPECT_EQ("foobar", output); + + // Many-many arguments. + Http2StrAppend(&output, "foo", "bar", "baz", "qux", "quux", "quuz", "corge", + "grault", "garply", "waldo", "fred", "plugh", "xyzzy", "thud"); + EXPECT_EQ( + "foobarfoobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud", + output); + + output.clear(); + + // Numerical arguments. + const int16_t i = 1; + const uint64_t u = 8; + const double d = 3.1415; + + Http2StrAppend(&output, i, " ", u); + EXPECT_EQ("1 8", output); + Http2StrAppend(&output, d, i, i, u, i); + EXPECT_EQ("1 83.14151181", output); + Http2StrAppend(&output, "i: ", i, ", u: ", u, ", d: ", d); + EXPECT_EQ("1 83.14151181i: 1, u: 8, d: 3.1415", output); + + output.clear(); + + // Boolean arguments. + const bool t = true; + const bool f = false; + + Http2StrAppend(&output, t); + EXPECT_EQ("1", output); + Http2StrAppend(&output, f); + EXPECT_EQ("10", output); + Http2StrAppend(&output, f, t, t, f); + EXPECT_EQ("100110", output); + + output.clear(); + + // Mixed string-like, numerical, and Boolean arguments. + Http2StrAppend(&output, kFoo, i, string_foo, f, u, t, stringpiece_bar, d, t); + EXPECT_EQ("foo1foo081bar3.14151", output); + Http2StrAppend(&output, d, t, t, string_bar, i, u, kBar, t, d, f); + EXPECT_EQ("foo1foo081bar3.141513.141511bar18bar13.14150", output); +} + +TEST(Http2StringUtilsTest, Http2StringPrintf) { + EXPECT_EQ("", Http2StringPrintf("%s", "")); + EXPECT_EQ("foobar", Http2StringPrintf("%sbar", "foo")); + EXPECT_EQ("foobar", Http2StringPrintf("%s%s", "foo", "bar")); + EXPECT_EQ("foo: 1, bar: 2.0", + Http2StringPrintf("foo: %d, bar: %.1f", 1, 2.0)); +} + +} // namespace +} // namespace test +} // namespace net
diff --git a/net/http2/platform/impl/http2_string_impl.h b/net/http2/platform/impl/http2_string_impl.h new file mode 100644 index 0000000..b8142a04a --- /dev/null +++ b/net/http2/platform/impl/http2_string_impl.h
@@ -0,0 +1,16 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_IMPL_H_ +#define NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_IMPL_H_ + +#include <string> + +namespace net { + +using Http2StringImpl = std::string; + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_IMPL_H_
diff --git a/net/http2/platform/impl/http2_string_piece_impl.h b/net/http2/platform/impl/http2_string_piece_impl.h new file mode 100644 index 0000000..6dcaac7 --- /dev/null +++ b/net/http2/platform/impl/http2_string_piece_impl.h
@@ -0,0 +1,16 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_PIECE_IMPL_H_ +#define NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_PIECE_IMPL_H_ + +#include "base/strings/string_piece.h" + +namespace net { + +using Http2StringPieceImpl = base::StringPiece; + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_PIECE_IMPL_H_
diff --git a/net/http2/platform/impl/http2_string_utils_impl.h b/net/http2/platform/impl/http2_string_utils_impl.h new file mode 100644 index 0000000..8d0ff089 --- /dev/null +++ b/net/http2/platform/impl/http2_string_utils_impl.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_UTILS_IMPL_H_ +#define NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_UTILS_IMPL_H_ + +#include <sstream> +#include <utility> + +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "net/http2/platform/api/http2_string.h" + +namespace net { + +template <typename... Args> +inline Http2String Http2StrCatImpl(const Args&... args) { + std::ostringstream oss; + int dummy[] = {1, (oss << args, 0)...}; + static_cast<void>(dummy); + return oss.str(); +} + +template <typename... Args> +inline void Http2StrAppendImpl(Http2String* output, Args... args) { + output->append(Http2StrCatImpl(args...)); +} + +template <typename... Args> +inline Http2String Http2StringPrintfImpl(const Args&... args) { + return base::StringPrintf(std::forward<const Args&>(args)...); +} + +} // namespace net + +#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_STRING_UTILS_IMPL_H_
diff --git a/net/http2/test_tools/frame_parts.cc b/net/http2/test_tools/frame_parts.cc index b7079dd..db0ee356 100644 --- a/net/http2/test_tools/frame_parts.cc +++ b/net/http2/test_tools/frame_parts.cc
@@ -12,8 +12,6 @@ #include "net/http2/tools/failure.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; -using std::string; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -52,14 +50,14 @@ VLOG(1) << "FrameParts, header: " << frame_header; } -FrameParts::FrameParts(const Http2FrameHeader& header, StringPiece payload) +FrameParts::FrameParts(const Http2FrameHeader& header, Http2StringPiece payload) : FrameParts(header) { VLOG(1) << "FrameParts with payload.size() = " << payload.size(); this->payload.append(payload.data(), payload.size()); opt_payload_length = payload.size(); } FrameParts::FrameParts(const Http2FrameHeader& header, - StringPiece payload, + Http2StringPiece payload, size_t total_pad_length) : FrameParts(header, payload) { VLOG(1) << "FrameParts with total_pad_length=" << total_pad_length; @@ -117,7 +115,8 @@ } } -void FrameParts::SetAltSvcExpected(StringPiece origin, StringPiece value) { +void FrameParts::SetAltSvcExpected(Http2StringPiece origin, + Http2StringPiece value) { altsvc_origin.append(origin.data(), origin.size()); altsvc_value.append(value.data(), value.size()); opt_altsvc_origin_length = origin.size(); @@ -139,7 +138,7 @@ VLOG(1) << "OnDataPayload: len=" << len << "; frame_header: " << frame_header; ASSERT_TRUE(InFrameOfType(Http2FrameType::DATA)) << *this; ASSERT_TRUE( - AppendString(StringPiece(data, len), &payload, &opt_payload_length)); + AppendString(Http2StringPiece(data, len), &payload, &opt_payload_length)); } void FrameParts::OnDataEnd() { @@ -171,7 +170,7 @@ ASSERT_FALSE(got_end_callback); ASSERT_TRUE(FrameCanHaveHpackPayload(frame_header)) << *this; ASSERT_TRUE( - AppendString(StringPiece(data, len), &payload, &opt_payload_length)); + AppendString(Http2StringPiece(data, len), &payload, &opt_payload_length)); } void FrameParts::OnHeadersEnd() { @@ -214,7 +213,7 @@ VLOG(1) << "OnPadding: skipped_length=" << skipped_length; ASSERT_TRUE(InPaddedFrame()) << *this; ASSERT_TRUE(opt_pad_length); - ASSERT_TRUE(AppendString(StringPiece(pad, skipped_length), &padding, + ASSERT_TRUE(AppendString(Http2StringPiece(pad, skipped_length), &padding, &opt_pad_length)); } @@ -310,7 +309,7 @@ VLOG(1) << "OnGoAwayOpaqueData: len=" << len; ASSERT_TRUE(InFrameOfType(Http2FrameType::GOAWAY)) << *this; ASSERT_TRUE( - AppendString(StringPiece(data, len), &payload, &opt_payload_length)); + AppendString(Http2StringPiece(data, len), &payload, &opt_payload_length)); } void FrameParts::OnGoAwayEnd() { @@ -344,14 +343,14 @@ void FrameParts::OnAltSvcOriginData(const char* data, size_t len) { VLOG(1) << "OnAltSvcOriginData: len=" << len; ASSERT_TRUE(InFrameOfType(Http2FrameType::ALTSVC)) << *this; - ASSERT_TRUE(AppendString(StringPiece(data, len), &altsvc_origin, + ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &altsvc_origin, &opt_altsvc_origin_length)); } void FrameParts::OnAltSvcValueData(const char* data, size_t len) { VLOG(1) << "OnAltSvcValueData: len=" << len; ASSERT_TRUE(InFrameOfType(Http2FrameType::ALTSVC)) << *this; - ASSERT_TRUE(AppendString(StringPiece(data, len), &altsvc_value, + ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &altsvc_value, &opt_altsvc_value_length)); } @@ -375,7 +374,7 @@ ASSERT_TRUE(got_start_callback); ASSERT_FALSE(got_end_callback); ASSERT_TRUE( - AppendString(StringPiece(data, len), &payload, &opt_payload_length)); + AppendString(Http2StringPiece(data, len), &payload, &opt_payload_length)); } void FrameParts::OnUnknownEnd() { @@ -504,8 +503,8 @@ return AssertionSuccess(); } -AssertionResult FrameParts::AppendString(StringPiece source, - string* target, +AssertionResult FrameParts::AppendString(Http2StringPiece source, + Http2String* target, base::Optional<size_t>* opt_length) { target->append(source.data(), source.size()); if (opt_length != nullptr) {
diff --git a/net/http2/test_tools/frame_parts.h b/net/http2/test_tools/frame_parts.h index f2d9dce..1846929b 100644 --- a/net/http2/test_tools/frame_parts.h +++ b/net/http2/test_tools/frame_parts.h
@@ -15,15 +15,15 @@ #include <stddef.h> -#include <string> #include <vector> #include "base/logging.h" #include "base/optional.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/http2_frame_decoder_listener.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -39,12 +39,12 @@ explicit FrameParts(const Http2FrameHeader& header); // For use in tests where the expected frame has a variable size payload. - FrameParts(const Http2FrameHeader& header, base::StringPiece payload); + FrameParts(const Http2FrameHeader& header, Http2StringPiece payload); // For use in tests where the expected frame has a variable size payload // and may be padded. FrameParts(const Http2FrameHeader& header, - base::StringPiece payload, + Http2StringPiece payload, size_t total_pad_length); // Copy constructor. @@ -63,7 +63,7 @@ void SetTotalPadLength(size_t total_pad_length); // Set the origin and value expected in an ALTSVC frame. - void SetAltSvcExpected(base::StringPiece origin, base::StringPiece value); + void SetAltSvcExpected(Http2StringPiece origin, Http2StringPiece value); // Http2FrameDecoderListener methods: bool OnFrameHeader(const Http2FrameHeader& header) override; @@ -117,10 +117,10 @@ const Http2FrameHeader frame_header; - std::string payload; - std::string padding; - std::string altsvc_origin; - std::string altsvc_value; + Http2String payload; + Http2String padding; + Http2String altsvc_origin; + Http2String altsvc_value; base::Optional<Http2PriorityFields> opt_priority; base::Optional<Http2ErrorCode> opt_rst_stream_error_code; @@ -166,8 +166,8 @@ // Append source to target. If opt_length is not nullptr, then verifies that // the optional has a value (i.e. that the necessary On*Start method has been // called), and that target is not longer than opt_length->value(). - ::testing::AssertionResult AppendString(base::StringPiece source, - std::string* target, + ::testing::AssertionResult AppendString(Http2StringPiece source, + Http2String* target, base::Optional<size_t>* opt_length); };
diff --git a/net/http2/tools/failure.cc b/net/http2/tools/failure.cc index b354be1e..98eef8d 100644 --- a/net/http2/tools/failure.cc +++ b/net/http2/tools/failure.cc
@@ -10,7 +10,7 @@ // This is a copy of the same named method in ::testing::internal. // TODO(jamessynge): See about getting something like VERIFY_* adopted by // gUnit (probably a very difficult task!). -std::string GetBoolAssertionFailureMessage( +Http2String GetBoolAssertionFailureMessage( const ::testing::AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value,
diff --git a/net/http2/tools/failure.h b/net/http2/tools/failure.h index aa36d79..bae1784 100644 --- a/net/http2/tools/failure.h +++ b/net/http2/tools/failure.h
@@ -14,9 +14,9 @@ #include <iosfwd> #include <sstream> -#include <string> #include "base/macros.h" +#include "net/http2/platform/api/http2_string.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -39,21 +39,21 @@ operator bool() const { return matches_; } - const std::string& printed_value() const { return printed_value_; } - const std::string& matcher_description() const { + const Http2String& printed_value() const { return printed_value_; } + const Http2String& matcher_description() const { return matcher_description_; } private: bool matches_; - std::string printed_value_; - std::string matcher_description_; + Http2String printed_value_; + Http2String matcher_description_; DISALLOW_COPY_AND_ASSIGN(VerifyThatHelper); }; // Constructs a failure message for Boolean assertions such as VERIFY_TRUE. -std::string GetBoolAssertionFailureMessage( +Http2String GetBoolAssertionFailureMessage( const ::testing::AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value,
diff --git a/net/http2/tools/http2_frame_builder.cc b/net/http2/tools/http2_frame_builder.cc index c072525..4be9fec 100644 --- a/net/http2/tools/http2_frame_builder.cc +++ b/net/http2/tools/http2_frame_builder.cc
@@ -11,10 +11,9 @@ #include <netinet/in.h> // for htonl, htons #endif +#include "net/http2/platform/api/http2_string_utils.h" #include "testing/gtest/include/gtest/gtest.h" -using base::StringPiece; - namespace net { namespace test { @@ -31,12 +30,12 @@ Append(v); } -void Http2FrameBuilder::Append(StringPiece s) { - s.AppendToString(&buffer_); +void Http2FrameBuilder::Append(Http2StringPiece s) { + Http2StrAppend(&buffer_, s); } void Http2FrameBuilder::AppendBytes(const void* data, uint32_t num_bytes) { - Append(StringPiece(static_cast<const char*>(data), num_bytes)); + Append(Http2StringPiece(static_cast<const char*>(data), num_bytes)); } void Http2FrameBuilder::AppendZeroes(size_t num_zero_bytes) { @@ -144,7 +143,7 @@ // Methods for changing existing buffer contents. -void Http2FrameBuilder::WriteAt(StringPiece s, size_t offset) { +void Http2FrameBuilder::WriteAt(Http2StringPiece s, size_t offset) { ASSERT_LE(offset, buffer_.size()); size_t len = offset + s.size(); if (len > buffer_.size()) { @@ -158,7 +157,7 @@ void Http2FrameBuilder::WriteBytesAt(const void* data, uint32_t num_bytes, size_t offset) { - WriteAt(StringPiece(static_cast<const char*>(data), num_bytes), offset); + WriteAt(Http2StringPiece(static_cast<const char*>(data), num_bytes), offset); } void Http2FrameBuilder::WriteUInt24At(uint32_t value, size_t offset) {
diff --git a/net/http2/tools/http2_frame_builder.h b/net/http2/tools/http2_frame_builder.h index c665c759..cd78a0f 100644 --- a/net/http2/tools/http2_frame_builder.h +++ b/net/http2/tools/http2_frame_builder.h
@@ -15,11 +15,10 @@ #include <stddef.h> // for size_t -#include <string> - -#include "base/strings/string_piece.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -32,13 +31,13 @@ ~Http2FrameBuilder() {} size_t size() const { return buffer_.size(); } - const std::string& buffer() const { return buffer_; } + const Http2String& buffer() const { return buffer_; } //---------------------------------------------------------------------------- // Methods for appending to the end of the buffer. // Append a sequence of bytes from various sources. - void Append(base::StringPiece s); + void Append(Http2StringPiece s); void AppendBytes(const void* data, uint32_t num_bytes); // Append an array of type T[N] to the string. Intended for tests with arrays @@ -79,7 +78,7 @@ // Methods for changing existing buffer contents (mostly focused on updating // the payload length). - void WriteAt(base::StringPiece s, size_t offset); + void WriteAt(Http2StringPiece s, size_t offset); void WriteBytesAt(const void* data, uint32_t num_bytes, size_t offset); void WriteUInt24At(uint32_t value, size_t offset); @@ -91,7 +90,7 @@ size_t SetPayloadLength(); private: - std::string buffer_; + Http2String buffer_; }; } // namespace test
diff --git a/net/http2/tools/http2_random.cc b/net/http2/tools/http2_random.cc index 12dd7436..f56f969 100644 --- a/net/http2/tools/http2_random.cc +++ b/net/http2/tools/http2_random.cc
@@ -48,10 +48,10 @@ return Rand32() & mask; } -std::string Http2Random::RandString(int length) { +Http2String Http2Random::RandString(int length) { std::unique_ptr<char[]> buffer(new char[length]); base::RandBytes(buffer.get(), length); - return std::string(buffer.get(), length); + return Http2String(buffer.get(), length); } } // namespace test
diff --git a/net/http2/tools/http2_random.h b/net/http2/tools/http2_random.h index eb3f6aa..18e8d53 100644 --- a/net/http2/tools/http2_random.h +++ b/net/http2/tools/http2_random.h
@@ -8,7 +8,8 @@ #include <stdint.h> #include <limits> -#include <string> + +#include "net/http2/platform/api/http2_string.h" namespace net { namespace test { @@ -24,7 +25,7 @@ virtual uint64_t Rand64() = 0; virtual int32_t Next() = 0; virtual int32_t Skewed(int max_log) = 0; - virtual std::string RandString(int length) = 0; + virtual Http2String RandString(int length) = 0; // STL UniformRandomNumberGenerator implementation. typedef uint32_t result_type; @@ -48,7 +49,7 @@ uint64_t Rand64() override; int32_t Next() override; int32_t Skewed(int max_log) override; - std::string RandString(int length) override; + Http2String RandString(int length) override; }; } // namespace test
diff --git a/net/http2/tools/random_decoder_test.cc b/net/http2/tools/random_decoder_test.cc index 224a825..84201a8 100644 --- a/net/http2/tools/random_decoder_test.cc +++ b/net/http2/tools/random_decoder_test.cc
@@ -11,7 +11,6 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" #include "net/http2/http2_constants.h" @@ -25,12 +24,11 @@ using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; -using base::StringPiece; namespace net { namespace test { -std::string HexEncode(StringPiece s) { +Http2String HexEncode(Http2StringPiece s) { return base::HexEncode(s.data(), s.size()); }
diff --git a/net/http2/tools/random_decoder_test.h b/net/http2/tools/random_decoder_test.h index ea61dc7f..36adf9fc 100644 --- a/net/http2/tools/random_decoder_test.h +++ b/net/http2/tools/random_decoder_test.h
@@ -14,13 +14,13 @@ #include <functional> #include <memory> -#include <string> #include <type_traits> #include "base/logging.h" -#include "base/strings/string_piece.h" #include "net/http2/decoder/decode_buffer.h" #include "net/http2/decoder/decode_status.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,12 +31,12 @@ // Some helpers. template <typename T, size_t N> -base::StringPiece ToStringPiece(T (&data)[N]) { - return base::StringPiece(reinterpret_cast<const char*>(data), N * sizeof(T)); +Http2StringPiece ToStringPiece(T (&data)[N]) { + return Http2StringPiece(reinterpret_cast<const char*>(data), N * sizeof(T)); } -// strings/hex_ascii_dump.h doesn't support StringPiece args for this case. -std::string HexEncode(base::StringPiece s); +// strings/hex_ascii_dump.h doesn't support Http2StringPiece args for this case. +Http2String HexEncode(Http2StringPiece s); // Overwrite the enum with some random value, probably not a valid value for // the enum type, but which fits into its storage.
diff --git a/net/http2/tools/random_util.cc b/net/http2/tools/random_util.cc index 90933b5f..b50dd50 100644 --- a/net/http2/tools/random_util.cc +++ b/net/http2/tools/random_util.cc
@@ -9,9 +9,6 @@ #include "base/rand_util.h" #include "net/http2/tools/http2_random.h" -using std::string; -using base::StringPiece; - namespace net { namespace test { namespace { @@ -36,8 +33,8 @@ } // anonymous namespace -string RandomString(RandomBase* rng, int len, StringPiece alphabet) { - string random_string; +Http2String RandomString(RandomBase* rng, int len, Http2StringPiece alphabet) { + Http2String random_string; random_string.reserve(len); for (int i = 0; i < len; ++i) random_string.push_back(alphabet[rng->Uniform(alphabet.size())]); @@ -53,8 +50,8 @@ // Here "word" means something that starts with a lower-case letter, and has // zero or more additional characters that are numbers or lower-case letters. -string GenerateHttp2HeaderName(size_t len, RandomBase* rng) { - StringPiece alpha_lc = "abcdefghijklmnopqrstuvwxyz"; +Http2String GenerateHttp2HeaderName(size_t len, RandomBase* rng) { + Http2StringPiece alpha_lc = "abcdefghijklmnopqrstuvwxyz"; // If the name is short, just make it one word. if (len < 8) { return RandomString(rng, len, alpha_lc); @@ -62,16 +59,16 @@ // If the name is longer, ensure it starts with a word, and after that may // have any character in alphanumdash_lc. 4 is arbitrary, could be as low // as 1. - StringPiece alphanumdash_lc = "abcdefghijklmnopqrstuvwxyz0123456789-"; + Http2StringPiece alphanumdash_lc = "abcdefghijklmnopqrstuvwxyz0123456789-"; return RandomString(rng, 4, alpha_lc) + RandomString(rng, len - 4, alphanumdash_lc); } -string GenerateWebSafeString(size_t len, RandomBase* rng) { +Http2String GenerateWebSafeString(size_t len, RandomBase* rng) { return RandomString(rng, len, kWebsafe64); } -string GenerateWebSafeString(size_t lo, size_t hi, RandomBase* rng) { +Http2String GenerateWebSafeString(size_t lo, size_t hi, RandomBase* rng) { return GenerateWebSafeString(GenerateUniformInRange(lo, hi, rng), rng); }
diff --git a/net/http2/tools/random_util.h b/net/http2/tools/random_util.h index aeeb3c6..266506117 100644 --- a/net/http2/tools/random_util.h +++ b/net/http2/tools/random_util.h
@@ -7,9 +7,8 @@ #include <stddef.h> -#include <string> - -#include "base/strings/string_piece.h" +#include "net/http2/platform/api/http2_string.h" +#include "net/http2/platform/api/http2_string_piece.h" namespace net { namespace test { @@ -18,20 +17,20 @@ // Returns a random string of length |len|, each character drawn uniformly and // independently fom |alphabet|. -std::string RandomString(RandomBase* rng, int len, base::StringPiece alphabet); +Http2String RandomString(RandomBase* rng, int len, Http2StringPiece alphabet); // Returns a random integer in the range [lo, hi). size_t GenerateUniformInRange(size_t lo, size_t hi, RandomBase* rng); // Generate a string with the allowed character set for HTTP/2 / HPACK header // names. -std::string GenerateHttp2HeaderName(size_t len, RandomBase* rng); +Http2String GenerateHttp2HeaderName(size_t len, RandomBase* rng); // Generate a string with the web-safe string character set of specified len. -std::string GenerateWebSafeString(size_t len, RandomBase* rng); +Http2String GenerateWebSafeString(size_t len, RandomBase* rng); // Generate a string with the web-safe string character set of length [lo, hi). -std::string GenerateWebSafeString(size_t lo, size_t hi, RandomBase* rng); +Http2String GenerateWebSafeString(size_t lo, size_t hi, RandomBase* rng); // Returns a random integer in the range [0, max], with a bias towards producing // lower numbers.
diff --git a/net/spdy/chromium/buffered_spdy_framer.cc b/net/spdy/chromium/buffered_spdy_framer.cc index a6004c06..8acb698 100644 --- a/net/spdy/chromium/buffered_spdy_framer.cc +++ b/net/spdy/chromium/buffered_spdy_framer.cc
@@ -216,6 +216,11 @@ spdy_framer_.UpdateHeaderDecoderTableSize(value); } +void BufferedSpdyFramer::set_max_decode_buffer_size_bytes( + size_t max_decode_buffer_size_bytes) { + spdy_framer_.set_max_decode_buffer_size_bytes(max_decode_buffer_size_bytes); +} + void BufferedSpdyFramer::Reset() { spdy_framer_.Reset(); }
diff --git a/net/spdy/chromium/buffered_spdy_framer.h b/net/spdy/chromium/buffered_spdy_framer.h index c175a11..935eb37 100644 --- a/net/spdy/chromium/buffered_spdy_framer.h +++ b/net/spdy/chromium/buffered_spdy_framer.h
@@ -179,6 +179,7 @@ // SpdyFramer methods. size_t ProcessInput(const char* data, size_t len); void UpdateHeaderDecoderTableSize(uint32_t value); + void set_max_decode_buffer_size_bytes(size_t max_decode_buffer_size_bytes); void Reset(); SpdyFramer::SpdyFramerError spdy_framer_error() const; SpdyFramer::SpdyState state() const;
diff --git a/net/spdy/chromium/header_coalescer.cc b/net/spdy/chromium/header_coalescer.cc index d7931c2..019f8062 100644 --- a/net/spdy/chromium/header_coalescer.cc +++ b/net/spdy/chromium/header_coalescer.cc
@@ -31,8 +31,6 @@ } // namespace -const size_t kMaxHeaderListSize = 256 * 1024; - HeaderCoalescer::HeaderCoalescer(const NetLogWithSource& net_log) : net_log_(net_log) {}
diff --git a/net/spdy/chromium/header_coalescer.h b/net/spdy/chromium/header_coalescer.h index dc24494..b2d6d8f7 100644 --- a/net/spdy/chromium/header_coalescer.h +++ b/net/spdy/chromium/header_coalescer.h
@@ -13,6 +13,8 @@ namespace net { +const size_t kMaxHeaderListSize = 256 * 1024; + class NET_EXPORT_PRIVATE HeaderCoalescer : public SpdyHeadersHandlerInterface { public: explicit HeaderCoalescer(const NetLogWithSource& net_log);
diff --git a/net/spdy/chromium/spdy_session.cc b/net/spdy/chromium/spdy_session.cc index 4a6afcc5..47dd11e 100644 --- a/net/spdy/chromium/spdy_session.cc +++ b/net/spdy/chromium/spdy_session.cc
@@ -45,6 +45,7 @@ #include "net/proxy/proxy_server.h" #include "net/socket/socket.h" #include "net/socket/ssl_client_socket.h" +#include "net/spdy/chromium/header_coalescer.h" #include "net/spdy/chromium/spdy_buffer_producer.h" #include "net/spdy/chromium/spdy_http_utils.h" #include "net/spdy/chromium/spdy_log_util.h" @@ -894,6 +895,9 @@ buffered_spdy_framer_->set_visitor(this); buffered_spdy_framer_->set_debug_visitor(this); buffered_spdy_framer_->UpdateHeaderDecoderTableSize(max_header_table_size_); + // Do not bother decoding response headers more than a factor over the limit. + buffered_spdy_framer_->set_max_decode_buffer_size_bytes(2 * + kMaxHeaderListSize); net_log_.AddEvent(NetLogEventType::HTTP2_SESSION_INITIALIZED, base::Bind(&NetLogSpdyInitializedCallback,
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index b3b53d1..4955f6b 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc
@@ -258,6 +258,11 @@ ct_verifier_ = std::move(ct_verifier); } +void URLRequestContextBuilder::set_ct_policy_enforcer( + std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer) { + ct_policy_enforcer_ = std::move(ct_policy_enforcer); +} + void URLRequestContextBuilder::SetCertVerifier( std::unique_ptr<CertVerifier> cert_verifier) { cert_verifier_ = std::move(cert_verifier); @@ -286,9 +291,9 @@ channel_id_service_ = std::move(channel_id_service); } -void URLRequestContextBuilder::SetFileTaskRunner( - const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { - file_task_runner_ = task_runner; +void URLRequestContextBuilder::SetCacheThreadTaskRunner( + scoped_refptr<base::SingleThreadTaskRunner> cache_thread_task_runner) { + cache_thread_task_runner_ = std::move(cache_thread_task_runner); } void URLRequestContextBuilder::SetProtocolHandler( @@ -378,7 +383,7 @@ // user-visible. Block shutdown to ensure it does get persisted to disk, // since it contains security-relevant information. scoped_refptr<base::SequencedTaskRunner> task_runner( - GetFileSequencedTaskRunner( + base::CreateSequencedTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::BACKGROUND, base::TaskShutdownBehavior::BLOCK_SHUTDOWN})); @@ -410,7 +415,11 @@ ct_verifier->AddLogs(ct::CreateLogVerifiersForKnownLogs()); storage->set_cert_transparency_verifier(std::move(ct_verifier)); } - storage->set_ct_policy_enforcer(base::MakeUnique<CTPolicyEnforcer>()); + if (ct_policy_enforcer_) { + storage->set_ct_policy_enforcer(std::move(ct_policy_enforcer_)); + } else { + storage->set_ct_policy_enforcer(base::MakeUnique<CTPolicyEnforcer>()); + } if (throttling_enabled_) { storage->set_throttler_manager( @@ -450,16 +459,19 @@ if (http_cache_enabled_) { std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { + if (!cache_thread_task_runner_) { + cache_thread_task_runner_ = + base::CreateSingleThreadTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_BLOCKING, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); + } BackendType backend_type = http_cache_params_.type == HttpCacheParams::DISK ? CACHE_BACKEND_DEFAULT : CACHE_BACKEND_SIMPLE; http_cache_backend.reset(new HttpCache::DefaultBackend( DISK_CACHE, backend_type, http_cache_params_.path, - http_cache_params_.max_size, - GetFileSingleThreadTaskRunner( - {base::MayBlock(), base::TaskPriority::USER_BLOCKING, - base::TaskShutdownBehavior::BLOCK_SHUTDOWN}))); + http_cache_params_.max_size, cache_thread_task_runner_)); } else { http_cache_backend = HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); @@ -490,7 +502,7 @@ if (file_enabled_) { job_factory->SetProtocolHandler( url::kFileScheme, - base::MakeUnique<FileProtocolHandler>(GetFileTaskRunner( + base::MakeUnique<FileProtocolHandler>(base::CreateTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::USER_BLOCKING, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); } @@ -536,27 +548,4 @@ std::move(proxy_config_service), net_log); } -scoped_refptr<base::TaskRunner> URLRequestContextBuilder::GetFileTaskRunner( - const base::TaskTraits& traits) { - if (file_task_runner_) - return file_task_runner_; - return base::CreateTaskRunnerWithTraits(traits); -} - -scoped_refptr<base::SequencedTaskRunner> -URLRequestContextBuilder::GetFileSequencedTaskRunner( - const base::TaskTraits& traits) { - if (file_task_runner_) - return file_task_runner_; - return base::CreateSequencedTaskRunnerWithTraits(traits); -} - -scoped_refptr<base::SingleThreadTaskRunner> -URLRequestContextBuilder::GetFileSingleThreadTaskRunner( - const base::TaskTraits& traits) { - if (file_task_runner_) - return file_task_runner_; - return base::CreateSingleThreadTaskRunnerWithTraits(traits); -} - } // namespace net
diff --git a/net/url_request/url_request_context_builder.h b/net/url_request/url_request_context_builder.h index 5bd634c9..9f695c3 100644 --- a/net/url_request/url_request_context_builder.h +++ b/net/url_request/url_request_context_builder.h
@@ -44,8 +44,6 @@ namespace base { class SingleThreadTaskRunner; -class SequencedTaskRunner; -class TaskRunner; } namespace net { @@ -53,6 +51,7 @@ class CertVerifier; class ChannelIDService; class CookieStore; +class CTPolicyEnforcer; class CTVerifier; class HttpAuthHandlerFactory; class HttpServerProperties; @@ -255,6 +254,8 @@ } void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); + void set_ct_policy_enforcer( + std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer); void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); @@ -279,10 +280,12 @@ std::unique_ptr<CookieStore> cookie_store, std::unique_ptr<ChannelIDService> channel_id_service); - // Sets the task runner used to perform file operations. If not set, - // TaskSchedulers will be used instead. - void SetFileTaskRunner( - const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); + // Sets the SingleThreadTaskRunner used to perform cache operations. If not + // set, one will be created via a TaskScheduler instead. Other file tasks will + // use the task scheduler, but the cache needs a SingleThreadTaskRunner, so + // best to keep that configurable by the consumer. + void SetCacheThreadTaskRunner( + scoped_refptr<base::SingleThreadTaskRunner> cache_thread_task_runner); // Note that if SDCH is enabled without a policy object observing // the SDCH manager and handling at least Get-Dictionary events, the @@ -312,16 +315,6 @@ NetworkDelegate* network_delegate, NetLog* net_log); - // Returns a TaskRunner with the specified traits. If |file_task_runner_| is - // non-NULL, uses that. Otherwise, uses base/task_scheduler/ and the specified - // traits. - scoped_refptr<base::TaskRunner> GetFileTaskRunner( - const base::TaskTraits& traits); - scoped_refptr<base::SequencedTaskRunner> GetFileSequencedTaskRunner( - const base::TaskTraits& traits); - scoped_refptr<base::SingleThreadTaskRunner> GetFileSingleThreadTaskRunner( - const base::TaskTraits& traits); - private: const char* name_; bool enable_brotli_; @@ -344,7 +337,7 @@ bool sdch_enabled_; bool cookie_store_set_by_client_; - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> cache_thread_task_runner_; HttpCacheParams http_cache_params_; HttpNetworkSession::Params http_network_session_params_; base::FilePath transport_security_persister_path_; @@ -362,6 +355,7 @@ std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; std::unique_ptr<CertVerifier> cert_verifier_; std::unique_ptr<CTVerifier> ct_verifier_; + std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer_; #if BUILDFLAG(ENABLE_REPORTING) std::unique_ptr<net::ReportingPolicy> reporting_policy_; #endif // BUILDFLAG(ENABLE_REPORTING)
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index f71ef7ce..37fef306 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc
@@ -1653,8 +1653,10 @@ // selection has changed. If so, set plugin text selection. std::string selected_form_text = selected_form_text_; selected_form_text_ = base::UTF16ToUTF8(selected_form_text16); - if (selected_form_text != selected_form_text_) + if (selected_form_text != selected_form_text_) { + DCHECK(in_form_text_area_); pp::PDF::SetSelectedText(GetPluginInstance(), selected_form_text_.c_str()); + } } void PDFiumEngine::PrintEnd() { @@ -1725,7 +1727,8 @@ SetMouseLeftButtonDown(event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT); - SelectionChangeInvalidator selection_invalidator(this); + auto selection_invalidator = + base::MakeUnique<SelectionChangeInvalidator>(this); selection_.clear(); int page_index = -1; @@ -1755,6 +1758,14 @@ if (form_type > FPDF_FORMFIELD_UNKNOWN) { // returns -1 sometimes... mouse_down_state_.Set(PDFiumPage::FormTypeToArea(form_type), target); + // Destroy SelectionChangeInvalidator object before SetInFormTextArea() + // changes plugin's focus to be in form text area. This way, regular text + // selection can be cleared when a user clicks into a form text area + // because the pp::PDF::SetSelectedText() call in + // ~SelectionChangeInvalidator() still goes to the Mimehandler + // (not the Renderer). + selection_invalidator.reset(); + bool is_valid_control = (form_type == FPDF_FORMFIELD_TEXTFIELD || form_type == FPDF_FORMFIELD_COMBOBOX); @@ -3583,6 +3594,7 @@ } void PDFiumEngine::OnSelectionChanged() { + DCHECK(!in_form_text_area_); pp::PDF::SetSelectedText(GetPluginInstance(), GetSelectedText().c_str()); } @@ -3621,6 +3633,13 @@ } void PDFiumEngine::SetInFormTextArea(bool in_form_text_area) { + // If focus was previously in form text area, clear form text selection. + // Clearing needs to be done before changing focus to ensure the correct + // observer is notified of the change in selection. When |in_form_text_area_| + // is true, this is the Renderer. After it flips, the MimeHandler is notified. + if (in_form_text_area_) + pp::PDF::SetSelectedText(GetPluginInstance(), ""); + client_->FormTextFieldFocusChange(in_form_text_area); in_form_text_area_ = in_form_text_area; }
diff --git a/ppapi/api/private/ppb_platform_verification_private.idl b/ppapi/api/private/ppb_platform_verification_private.idl index 87df6af7..afd41bd 100644 --- a/ppapi/api/private/ppb_platform_verification_private.idl +++ b/ppapi/api/private/ppb_platform_verification_private.idl
@@ -11,7 +11,7 @@ [generate_thunk] label Chrome { - M32 = 0.2 + M61 = 0.3 }; /** @@ -82,4 +82,21 @@ [out] PP_Var signed_data_signature, [out] PP_Var platform_key_certificate, [in] PP_CompletionCallback callback); + + /** + * Requests the device's storage ID. + * + * @param[out] storage_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> that contains the storage ID. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called after + * the storage ID has been obtained. This callback will only run if + * the return code is <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t GetStorageId( + [in] PP_Resource instance, + [out] PP_Var storage_id, + [in] PP_CompletionCallback callback); };
diff --git a/ppapi/c/pp_macros.h b/ppapi/c/pp_macros.h index ec2eacd..0381e17 100644 --- a/ppapi/c/pp_macros.h +++ b/ppapi/c/pp_macros.h
@@ -3,13 +3,13 @@ * found in the LICENSE file. */ -/* From pp_macros.idl modified Tue Apr 4 15:29:47 2017. */ +/* From pp_macros.idl modified Fri Oct 9 11:08:46 2015. */ #ifndef PPAPI_C_PP_MACROS_H_ #define PPAPI_C_PP_MACROS_H_ -#define PPAPI_RELEASE 60 +#define PPAPI_RELEASE 61 /** * @file
diff --git a/ppapi/c/private/ppb_platform_verification_private.h b/ppapi/c/private/ppb_platform_verification_private.h index 17ff1e8..83f6860 100644 --- a/ppapi/c/private/ppb_platform_verification_private.h +++ b/ppapi/c/private/ppb_platform_verification_private.h
@@ -4,7 +4,7 @@ */ /* From private/ppb_platform_verification_private.idl, - * modified Fri Oct 18 15:02:09 2013. + * modified Tue Jun 13 15:47:24 2017. */ #ifndef PPAPI_C_PRIVATE_PPB_PLATFORM_VERIFICATION_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 \ - "PPB_PlatformVerification_Private;0.2" +#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_3 \ + "PPB_PlatformVerification_Private;0.3" #define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE \ - PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 + PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_3 /** * @file @@ -39,7 +39,7 @@ * services to verify that the underlying platform is trusted. An example of a * trusted platform is a Chrome OS device in verified boot mode. */ -struct PPB_PlatformVerification_Private_0_2 { +struct PPB_PlatformVerification_Private_0_3 { /** * Create() creates a <code>PPB_PlatformVerification_Private</code> object. * @@ -98,9 +98,24 @@ struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback); + /** + * Requests the device's storage ID. + * + * @param[out] storage_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> that contains the storage ID. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called after + * the storage ID has been obtained. This callback will only run if + * the return code is <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*GetStorageId)(PP_Resource instance, + struct PP_Var* storage_id, + struct PP_CompletionCallback callback); }; -typedef struct PPB_PlatformVerification_Private_0_2 +typedef struct PPB_PlatformVerification_Private_0_3 PPB_PlatformVerification_Private; /** * @}
diff --git a/ppapi/cpp/private/platform_verification.cc b/ppapi/cpp/private/platform_verification.cc index e199a71..e3c29563 100644 --- a/ppapi/cpp/private/platform_verification.cc +++ b/ppapi/cpp/private/platform_verification.cc
@@ -15,16 +15,17 @@ namespace { -template <> const char* interface_name<PPB_PlatformVerification_Private_0_2>() { - return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2; +template <> +const char* interface_name<PPB_PlatformVerification_Private_0_3>() { + return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_3; } inline bool HasInterface() { - return has_interface<PPB_PlatformVerification_Private_0_2>(); + return has_interface<PPB_PlatformVerification_Private_0_3>(); } -inline const PPB_PlatformVerification_Private_0_2* GetInterface() { - return get_interface<PPB_PlatformVerification_Private_0_2>(); +inline const PPB_PlatformVerification_Private_0_3* GetInterface() { + return get_interface<PPB_PlatformVerification_Private_0_3>(); } } // namespace @@ -54,4 +55,14 @@ callback.pp_completion_callback()); } +int32_t PlatformVerification::GetStorageId(Var* storage_id, + const CompletionCallback& callback) { + if (!HasInterface()) + return callback.MayForce(PP_ERROR_NOINTERFACE); + + return GetInterface()->GetStorageId( + pp_resource(), const_cast<PP_Var*>(&storage_id->pp_var()), + callback.pp_completion_callback()); +} + } // namespace pp
diff --git a/ppapi/cpp/private/platform_verification.h b/ppapi/cpp/private/platform_verification.h index a9f73fa..ac97a0e 100644 --- a/ppapi/cpp/private/platform_verification.h +++ b/ppapi/cpp/private/platform_verification.h
@@ -26,6 +26,7 @@ Var* signed_data_signature, Var* platform_key_certificate, const CompletionCallback& callback); + int32_t GetStorageId(Var* storage_id, const CompletionCallback& callback); }; } // namespace pp
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 1dae01fa..ee11545 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -194,7 +194,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_OutputProtection_Private_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3; @@ -4113,24 +4113,29 @@ /* End wrapper methods for PPB_OutputProtection_Private_0_1 */ -/* Begin wrapper methods for PPB_PlatformVerification_Private_0_2 */ +/* Begin wrapper methods for PPB_PlatformVerification_Private_0_3 */ -static PP_Resource Pnacl_M32_PPB_PlatformVerification_Private_Create(PP_Instance instance) { - const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; +static PP_Resource Pnacl_M61_PPB_PlatformVerification_Private_Create(PP_Instance instance) { + const struct PPB_PlatformVerification_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3.real_iface; return iface->Create(instance); } -static PP_Bool Pnacl_M32_PPB_PlatformVerification_Private_IsPlatformVerification(PP_Resource resource) { - const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; +static PP_Bool Pnacl_M61_PPB_PlatformVerification_Private_IsPlatformVerification(PP_Resource resource) { + const struct PPB_PlatformVerification_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3.real_iface; return iface->IsPlatformVerification(resource); } -static int32_t Pnacl_M32_PPB_PlatformVerification_Private_ChallengePlatform(PP_Resource instance, struct PP_Var* service_id, struct PP_Var* challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback* callback) { - const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; +static int32_t Pnacl_M61_PPB_PlatformVerification_Private_ChallengePlatform(PP_Resource instance, struct PP_Var* service_id, struct PP_Var* challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback* callback) { + const struct PPB_PlatformVerification_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3.real_iface; return iface->ChallengePlatform(instance, *service_id, *challenge, signed_data, signed_data_signature, platform_key_certificate, *callback); } -/* End wrapper methods for PPB_PlatformVerification_Private_0_2 */ +static int32_t Pnacl_M61_PPB_PlatformVerification_Private_GetStorageId(PP_Resource instance, struct PP_Var* storage_id, struct PP_CompletionCallback* callback) { + const struct PPB_PlatformVerification_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3.real_iface; + return iface->GetStorageId(instance, storage_id, *callback); +} + +/* End wrapper methods for PPB_PlatformVerification_Private_0_3 */ /* Begin wrapper methods for PPB_TCPServerSocket_Private_0_1 */ @@ -5894,10 +5899,11 @@ .EnableProtection = (int32_t (*)(PP_Resource resource, uint32_t desired_protection_mask, struct PP_CompletionCallback callback))&Pnacl_M31_PPB_OutputProtection_Private_EnableProtection }; -static const struct PPB_PlatformVerification_Private_0_2 Pnacl_Wrappers_PPB_PlatformVerification_Private_0_2 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M32_PPB_PlatformVerification_Private_Create, - .IsPlatformVerification = (PP_Bool (*)(PP_Resource resource))&Pnacl_M32_PPB_PlatformVerification_Private_IsPlatformVerification, - .ChallengePlatform = (int32_t (*)(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback))&Pnacl_M32_PPB_PlatformVerification_Private_ChallengePlatform +static const struct PPB_PlatformVerification_Private_0_3 Pnacl_Wrappers_PPB_PlatformVerification_Private_0_3 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M61_PPB_PlatformVerification_Private_Create, + .IsPlatformVerification = (PP_Bool (*)(PP_Resource resource))&Pnacl_M61_PPB_PlatformVerification_Private_IsPlatformVerification, + .ChallengePlatform = (int32_t (*)(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback))&Pnacl_M61_PPB_PlatformVerification_Private_ChallengePlatform, + .GetStorageId = (int32_t (*)(PP_Resource instance, struct PP_Var* storage_id, struct PP_CompletionCallback callback))&Pnacl_M61_PPB_PlatformVerification_Private_GetStorageId }; static const struct PPB_TCPServerSocket_Private_0_1 Pnacl_Wrappers_PPB_TCPServerSocket_Private_0_1 = { @@ -6663,9 +6669,9 @@ .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2 = { - .iface_macro = PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2, - .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_PlatformVerification_Private_0_2, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3 = { + .iface_macro = PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_3, + .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_PlatformVerification_Private_0_3, .real_iface = NULL }; @@ -6858,7 +6864,7 @@ &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1, &Pnacl_WrapperInfo_PPB_OutputProtection_Private_0_1, - &Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2, + &Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_3, &Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1, &Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_2, &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3,
diff --git a/ppapi/proxy/platform_verification_private_resource.cc b/ppapi/proxy/platform_verification_private_resource.cc index ac709c2..d9fbf998 100644 --- a/ppapi/proxy/platform_verification_private_resource.cc +++ b/ppapi/proxy/platform_verification_private_resource.cc
@@ -100,5 +100,38 @@ output_params.callback->Run(params.result()); } +int32_t PlatformVerificationPrivateResource::GetStorageId( + PP_Var* storage_id, + const scoped_refptr<TrackedCallback>& callback) { + // Prevent null types for obvious reasons, but also ref-counted types to + // avoid leaks on failures (since they're only written to on success). + if (!storage_id || VarTracker::IsVarTypeRefcounted(storage_id->type)) { + return PP_ERROR_BADARGUMENT; + } + + GetStorageIdParams output_params = {storage_id, callback}; + + Call<PpapiHostMsg_PlatformVerification_GetStorageIdReply>( + BROWSER, PpapiHostMsg_PlatformVerification_GetStorageId(), + base::Bind(&PlatformVerificationPrivateResource::OnGetStorageIdReply, + base::Unretained(this), output_params)); + return PP_OK_COMPLETIONPENDING; +} + +void PlatformVerificationPrivateResource::OnGetStorageIdReply( + GetStorageIdParams output_params, + const ResourceMessageReplyParams& params, + const std::string& storage_id) { + if (!TrackedCallback::IsPending(output_params.callback) || + TrackedCallback::IsScheduledToRun(output_params.callback)) { + return; + } + + if (params.result() == PP_OK) { + *(output_params.storage_id) = (new StringVar(storage_id))->GetPPVar(); + } + output_params.callback->Run(params.result()); +} + } // namespace proxy } // namespace ppapi
diff --git a/ppapi/proxy/platform_verification_private_resource.h b/ppapi/proxy/platform_verification_private_resource.h index ae3cd13..031e9ef 100644 --- a/ppapi/proxy/platform_verification_private_resource.h +++ b/ppapi/proxy/platform_verification_private_resource.h
@@ -29,6 +29,10 @@ PP_Var* platform_key_certificate; scoped_refptr<TrackedCallback> callback; }; + struct GetStorageIdParams { + PP_Var* storage_id; + scoped_refptr<TrackedCallback> callback; + }; ~PlatformVerificationPrivateResource() override; @@ -50,6 +54,11 @@ const std::vector<uint8_t>& raw_signed_data, const std::vector<uint8_t>& raw_signed_data_signature, const std::string& raw_platform_key_certificate); + int32_t GetStorageId(PP_Var* storage_id, + const scoped_refptr<TrackedCallback>& callback) override; + void OnGetStorageIdReply(GetStorageIdParams output_params, + const ResourceMessageReplyParams& params, + const std::string& storage_id); DISALLOW_COPY_AND_ASSIGN(PlatformVerificationPrivateResource); };
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index ada507c..2d098d8d 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h
@@ -1841,6 +1841,9 @@ std::vector<uint8_t> /* signed_data */, std::vector<uint8_t> /* signed_data_signature */, std::string /* platform_key_certificate */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_PlatformVerification_GetStorageId) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_PlatformVerification_GetStorageIdReply, + std::string /* storage_id */) // Printing. IPC_MESSAGE_CONTROL0(PpapiHostMsg_Printing_Create)
diff --git a/ppapi/tests/test_case.html b/ppapi/tests/test_case.html index e28091e7..374ada6f 100644 --- a/ppapi/tests/test_case.html +++ b/ppapi/tests/test_case.html
@@ -168,10 +168,8 @@ } function sendAutomationMessage(msg) { - if (window.domAutomationController) { - window.domAutomationController.setAutomationId(0); + if (window.domAutomationController) window.domAutomationController.send(msg); - } } function LogTestTime(test_time) {
diff --git a/ppapi/tests/test_platform_verification_private.cc b/ppapi/tests/test_platform_verification_private.cc index 422fe9f..84b8196 100644 --- a/ppapi/tests/test_platform_verification_private.cc +++ b/ppapi/tests/test_platform_verification_private.cc
@@ -22,6 +22,7 @@ void TestPlatformVerificationPrivate::RunTests(const std::string& filter) { RUN_CALLBACK_TEST(TestPlatformVerificationPrivate, ChallengePlatform, filter); + RUN_CALLBACK_TEST(TestPlatformVerificationPrivate, StorageId, filter); } std::string TestPlatformVerificationPrivate::TestChallengePlatform() { @@ -43,3 +44,14 @@ ASSERT_EQ(PP_ERROR_FAILED, callback.result()); PASS(); } + +std::string TestPlatformVerificationPrivate::TestStorageId() { + pp::PlatformVerification platform_verification_api(instance_); + TestCompletionCallback callback(instance_->pp_instance(), callback_type()); + pp::Var storage_id; + callback.WaitForResult(platform_verification_api.GetStorageId( + &storage_id, callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + PASS(); +}
diff --git a/ppapi/tests/test_platform_verification_private.h b/ppapi/tests/test_platform_verification_private.h index 929fa9b..06d7e29 100644 --- a/ppapi/tests/test_platform_verification_private.h +++ b/ppapi/tests/test_platform_verification_private.h
@@ -18,6 +18,7 @@ private: std::string TestChallengePlatform(); + std::string TestStorageId(); }; #endif // PAPPI_TESTS_TEST_PLATFORM_VERIFICATION_PRIVATE_H_
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 8de6950..1d44b27 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -43,8 +43,8 @@ PPB_OutputProtection_Private_0_1) PROXIED_IFACE(PPB_PDF_INTERFACE, PPB_PDF) -PROXIED_IFACE(PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2, - PPB_PlatformVerification_Private_0_2) +PROXIED_IFACE(PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_3, + PPB_PlatformVerification_Private_0_3) PROXIED_IFACE(PPB_URLLOADERTRUSTED_INTERFACE_0_3, PPB_URLLoaderTrusted_0_3) #endif // !defined(OS_NACL)
diff --git a/ppapi/thunk/ppb_platform_verification_api.h b/ppapi/thunk/ppb_platform_verification_api.h index 2a12e296..ea98f0d8 100644 --- a/ppapi/thunk/ppb_platform_verification_api.h +++ b/ppapi/thunk/ppb_platform_verification_api.h
@@ -27,6 +27,10 @@ PP_Var* signed_data_signature, PP_Var* platform_key_certificate, const scoped_refptr<TrackedCallback>& callback) = 0; + + virtual int32_t GetStorageId( + PP_Var* storage_id, + const scoped_refptr<TrackedCallback>& callback) = 0; }; } // namespace thunk
diff --git a/ppapi/thunk/ppb_platform_verification_private_thunk.cc b/ppapi/thunk/ppb_platform_verification_private_thunk.cc index 786ef6e..bc50ae59 100644 --- a/ppapi/thunk/ppb_platform_verification_private_thunk.cc +++ b/ppapi/thunk/ppb_platform_verification_private_thunk.cc
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From private/ppb_platform_verification_private.idl modified Wed Jan 27 -// 17:10:16 2016. +// From private/ppb_platform_verification_private.idl modified Fri Jun 9 +// 14:13:47 2017. #include <stdint.h> @@ -50,15 +50,26 @@ platform_key_certificate, enter.callback())); } -const PPB_PlatformVerification_Private_0_2 - g_ppb_platformverification_private_thunk_0_2 = { - &Create, &IsPlatformVerification, &ChallengePlatform}; +int32_t GetStorageId(PP_Resource instance, + struct PP_Var* storage_id, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_PlatformVerification_Private::GetStorageId()"; + EnterResource<PPB_PlatformVerification_API> enter(instance, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult( + enter.object()->GetStorageId(storage_id, enter.callback())); +} + +const PPB_PlatformVerification_Private_0_3 + g_ppb_platformverification_private_thunk_0_3 = { + &Create, &IsPlatformVerification, &ChallengePlatform, &GetStorageId}; } // namespace -PPAPI_THUNK_EXPORT const PPB_PlatformVerification_Private_0_2* -GetPPB_PlatformVerification_Private_0_2_Thunk() { - return &g_ppb_platformverification_private_thunk_0_2; +PPAPI_THUNK_EXPORT const PPB_PlatformVerification_Private_0_3* +GetPPB_PlatformVerification_Private_0_3_Thunk() { + return &g_ppb_platformverification_private_thunk_0_3; } } // namespace thunk
diff --git a/remoting/android/BUILD.gn b/remoting/android/BUILD.gn index 46798cb..fdb35cbd 100644 --- a/remoting/android/BUILD.gn +++ b/remoting/android/BUILD.gn
@@ -101,5 +101,6 @@ "//base:base_java", "//base:base_java_test_support", "//third_party/android_support_test_runner:runner_java", + "//third_party/junit:junit", ] }
diff --git a/remoting/android/client_java_tmpl.gni b/remoting/android/client_java_tmpl.gni index 4a99d7c..27e4326 100644 --- a/remoting/android/client_java_tmpl.gni +++ b/remoting/android/client_java_tmpl.gni
@@ -9,7 +9,6 @@ android_library(target_name) { _java_file_prefix = "//remoting/android/java/src/org/chromium/chromoting" _java_files = [ - "AccountsAdapter.java", "ActivityLifecycleListener.java", "AnimationJob.java", "Capabilities.java", @@ -55,6 +54,7 @@ "TrackpadInputStrategy.java", "TapEventParameter.java", "TwoPointsEventParameter.java", + "accountswitcher/AccountManagerCompat.java", "accountswitcher/AccountSwitcher.java", "accountswitcher/AccountSwitcherBase.java", "accountswitcher/AccountSwitcherBasic.java",
diff --git a/remoting/android/java/res/layout/account_dropdown.xml b/remoting/android/java/res/layout/account_dropdown.xml deleted file mode 100644 index 488c5e9b..0000000 --- a/remoting/android/java/res/layout/account_dropdown.xml +++ /dev/null
@@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- 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. ---> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:drawablePadding="15sp" - android:padding="15sp" - android:gravity="center_vertical" - style="@style/NavigationTextStyle"/>
diff --git a/remoting/android/java/res/layout/account_ui.xml b/remoting/android/java/res/layout/account_ui.xml new file mode 100644 index 0000000..d1cedb7 --- /dev/null +++ b/remoting/android/java/res/layout/account_ui.xml
@@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- Copyright 2017 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="vertical" + android:padding="16dp"> + <TextView + android:id="@+id/account_name" + android:layout_height="wrap_content" + android:layout_width="match_parent"/> + <Button + android:id="@+id/choose_account" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/change_account"/> +</LinearLayout>
diff --git a/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java b/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java deleted file mode 100644 index 0703ab6..0000000 --- a/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java +++ /dev/null
@@ -1,46 +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. - -package org.chromium.chromoting; - -import android.accounts.Account; -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.TextView; - -/** SpinnerAdapter class used for the ActionBar accounts spinner. */ -public class AccountsAdapter extends ArrayAdapter<Account> { - private LayoutInflater mInflater; - - public AccountsAdapter(Context context, Account[] accounts) { - // ArrayAdapter only uses the |resource| parameter to return a View from getView() and - // getDropDownView(). But these methods are overridden here to return custom Views, so it's - // OK to provide 0 as the resource for the base class. - super(context, 0, accounts); - mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View view = convertView; - if (view == null) { - view = mInflater.inflate(R.layout.account_selected, parent, false); - } - Account account = getItem(position); - TextView target = (TextView) view; - target.setText(account.name); - return view; - } - - @Override - public View getDropDownView(int position, View convertView, ViewGroup parent) { - TextView view = (TextView) mInflater.inflate(R.layout.account_dropdown, parent, false); - Account account = getItem(position); - view.setText(account.name); - return view; - } -}
diff --git a/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountManagerCompat.java b/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountManagerCompat.java new file mode 100644 index 0000000..0deb0a90 --- /dev/null +++ b/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountManagerCompat.java
@@ -0,0 +1,34 @@ +// 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. + +package org.chromium.chromoting.accountswitcher; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; + +import java.util.ArrayList; + +/** API compatibility wrapper for AccountManager methods. */ +public class AccountManagerCompat { + /** + * @see android.accounts.AccountManager#newChooseAccountIntent() + */ + @SuppressWarnings("deprecation") + public static Intent newChooseAccountIntent(Account selectedAccount, + ArrayList<Account> allowableAccounts, String[] allowableAccountTypes, + String descriptionOverrideText, String addAccountAuthTokenType, + String[] addAccountRequiredFeatures, Bundle addAccountOptions) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + return AccountManager.newChooseAccountIntent(selectedAccount, allowableAccounts, + allowableAccountTypes, descriptionOverrideText, addAccountAuthTokenType, + addAccountRequiredFeatures, addAccountOptions); + } + return AccountManager.newChooseAccountIntent(selectedAccount, allowableAccounts, + allowableAccountTypes, false, descriptionOverrideText, addAccountAuthTokenType, + addAccountRequiredFeatures, addAccountOptions); + } +}
diff --git a/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountSwitcherBasic.java b/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountSwitcherBasic.java index 72875d8e..07e0e63 100644 --- a/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountSwitcherBasic.java +++ b/remoting/android/java/src/org/chromium/chromoting/accountswitcher/AccountSwitcherBasic.java
@@ -4,38 +4,59 @@ package org.chromium.chromoting.accountswitcher; -import android.Manifest; import android.accounts.Account; import android.accounts.AccountManager; import android.app.Activity; import android.content.Intent; -import android.content.pm.PackageManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.view.View; -import android.widget.AdapterView; +import android.widget.Button; import android.widget.LinearLayout; -import android.widget.Spinner; +import android.widget.TextView; -import org.chromium.chromoting.AccountsAdapter; +import org.chromium.chromoting.R; /** - * This class implements a basic UI for a user account switcher. + * This class implements a basic UI for a user account switcher. This implementation works on + * Android O where the app can only see a list of accounts that have already been authorised for + * the app. The only way to present a list of all Google accounts is by launching the Intent from + * {@link android.accounts.AccountManager#newChooseAccountIntent()}. Accounts only become + * authorised after the user has selected them from that list. So instead of showing a drop-down + * list of all accounts, this implementation simply provides a label showing the current account, + * and a button for the user to launch the Intent to select a new account. + * <p> + * A consequence is that this implementation never calls + * {@link AccountSwitcher.Callback#onAccountsListEmpty()} because there is no way to distinguish + * "the device has no accounts" from "no accounts are authorised for the app". + * <p> + * This implementation needs no special Android permissions, as it only tries to access the list + * of accounts via launching an Intent, which needs no permissions. */ public class AccountSwitcherBasic extends AccountSwitcherBase { /** Only accounts of this type will be selectable. */ private static final String ACCOUNT_TYPE = "com.google"; + /** + * Request code used for showing the choose-account dialog. It must be different from other + * REQUEST_CODEs in the app. + */ + private static final int REQUEST_CODE_CHOOSE_ACCOUNT = 200; + + /** The currently-selected account. Can be null if no account is selected yet. */ private String mSelectedAccount; - private Spinner mAccountsSpinner; + /** + * UI which appears above the navigation menu, showing currently-selected account and button. + */ + private View mAccountsUi; + private LinearLayout mContainer; + /** Label showing the currently selected account name. */ + private TextView mAccountName; + private Activity mActivity; - /** - * The registered callback instance. - */ + /** The registered callback instance. */ private Callback mCallback; /** @@ -47,15 +68,17 @@ public AccountSwitcherBasic(Activity activity, Callback callback) { mActivity = activity; mCallback = callback; - mAccountsSpinner = new Spinner(activity); - mAccountsSpinner.setLayoutParams(new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); - int padding = (int) (activity.getResources().getDisplayMetrics().density * 16f); - mAccountsSpinner.setPadding(padding, padding, padding, padding); mContainer = new LinearLayout(activity); mContainer.setOrientation(LinearLayout.VERTICAL); - mContainer.addView(mAccountsSpinner); + mAccountsUi = activity.getLayoutInflater().inflate(R.layout.account_ui, mContainer, false); + mContainer.addView(mAccountsUi); + mAccountName = (TextView) mAccountsUi.findViewById(R.id.account_name); + Button chooseAccount = (Button) mAccountsUi.findViewById(R.id.choose_account); + chooseAccount.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + onChooseAccount(); + } + }); } @Override @@ -66,7 +89,7 @@ @Override public void setNavigation(View view) { mContainer.removeAllViews(); - mContainer.addView(mAccountsSpinner); + mContainer.addView(mAccountsUi); mContainer.addView(view); } @@ -78,6 +101,7 @@ public void setSelectedAndRecentAccounts(String selected, String[] recents) { // This implementation does not support recents. mSelectedAccount = selected; + mAccountName.setText(selected); } @Override @@ -87,60 +111,36 @@ @Override public void reloadAccounts() { - // AccountManager.getAccountsByType() requires the GET_ACCOUNTS permission, which is - // classed as a dangerous permission. If the permission is not granted, an exception might - // be thrown or the account-list might wrongly appear to be empty. Check if the permission - // has been granted, and request it if not, so the user is aware of the cause of this - // problem. - if (ContextCompat.checkSelfPermission(mActivity, Manifest.permission.GET_ACCOUNTS) - != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(mActivity, - new String[] {Manifest.permission.GET_ACCOUNTS}, 0); - return; + // This implementation does not maintain a list of accounts, so there's nothing to reload. + // Instead, trigger the app to reload the host-list for any currently-selected account. + // This ensures the host-list gets loaded when the user launches the app. + if (mSelectedAccount != null) { + mCallback.onAccountSelected(mSelectedAccount); } - - Account[] accounts = AccountManager.get(mActivity).getAccountsByType(ACCOUNT_TYPE); - if (accounts.length == 0) { - mCallback.onAccountsListEmpty(); - return; - } - - // Arbitrarily default to the first account if the currently-selected account is not in the - // list. - int selectedIndex = 0; - for (int i = 0; i < accounts.length; i++) { - if (accounts[i].name.equals(mSelectedAccount)) { - selectedIndex = i; - break; - } - } - mSelectedAccount = accounts[selectedIndex].name; - - AccountsAdapter adapter = new AccountsAdapter(getView().getContext(), accounts); - mAccountsSpinner.setAdapter(adapter); - mAccountsSpinner.setSelection(selectedIndex); - mAccountsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView<?> parent, View view, int itemPosition, - long itemId) { - Account selected = (Account) parent.getItemAtPosition(itemPosition); - mSelectedAccount = selected.name; - mCallback.onAccountSelected(mSelectedAccount); - } - - @Override - public void onNothingSelected(AdapterView<?> parent) { - } - }); - - mCallback.onAccountSelected(mSelectedAccount); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_CODE_CHOOSE_ACCOUNT && resultCode == Activity.RESULT_OK) { + mSelectedAccount = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); + mAccountName.setText(mSelectedAccount); + mCallback.onAccountSelected(mSelectedAccount); + mCallback.onRequestCloseDrawer(); + } } @Override public void destroy() { } + + /** Called when the choose-account button is pressed. */ + private void onChooseAccount() { + Account selected = null; + if (mSelectedAccount != null) { + selected = new Account(mSelectedAccount, ACCOUNT_TYPE); + } + Intent intent = AccountManagerCompat.newChooseAccountIntent( + selected, null, new String[] {ACCOUNT_TYPE}, null, null, null, null); + mActivity.startActivityForResult(intent, REQUEST_CODE_CHOOSE_ACCOUNT); + } }
diff --git a/remoting/android/javatests/AndroidManifest.xml.jinja2 b/remoting/android/javatests/AndroidManifest.xml.jinja2 index 0f660406..6f3a961 100644 --- a/remoting/android/javatests/AndroidManifest.xml.jinja2 +++ b/remoting/android/javatests/AndroidManifest.xml.jinja2
@@ -19,4 +19,8 @@ <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="{{ APK_PACKAGE_NAME }}" android:label="Tests for {{ APK_PACKAGE_NAME }}"/> + <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" + android:targetPackage="{{ APK_PACKAGE_NAME }}" + android:label="Tests for {{ APK_PACKAGE_NAME }}" + chromium-junit4="true"/> </manifest>
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/EventTest.java b/remoting/android/javatests/src/org/chromium/chromoting/EventTest.java index a13fc8ca..58acbcb 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/EventTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/EventTest.java
@@ -8,8 +8,12 @@ import android.os.Looper; import android.support.test.filters.MediumTest; import android.support.test.filters.SmallTest; -import android.test.InstrumentationTestCase; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; import org.chromium.chromoting.test.util.MutableReference; @@ -19,10 +23,12 @@ /** * Tests for {@link Event}. */ -public class EventTest extends InstrumentationTestCase { +@RunWith(BaseJUnit4ClassRunner.class) +public class EventTest { + @Test @SmallTest @Feature({"Chromoting"}) - public static void testBasicScenario() { + public void testBasicScenario() { Event.Raisable<Void> event = new Event.Raisable<>(); final MutableReference<Integer> callTimes = new MutableReference<Integer>(0); Object eventId1 = event.add(new Event.ParameterRunnable<Void>() { @@ -41,21 +47,21 @@ @Override public void run(Void nil) { // Should not reach. - fail(); + Assert.fail(); callTimes.set(callTimes.get() + 1); } }); - assertNotNull(eventId1); - assertNotNull(eventId2); - assertNotNull(eventId3); - assertTrue(event.remove(eventId3)); + Assert.assertNotNull(eventId1); + Assert.assertNotNull(eventId2); + Assert.assertNotNull(eventId3); + Assert.assertTrue(event.remove(eventId3)); for (int i = 0; i < 100; i++) { - assertEquals(event.raise(null), 2); - assertEquals(callTimes.get().intValue(), (i + 1) << 1); + Assert.assertEquals(event.raise(null), 2); + Assert.assertEquals(callTimes.get().intValue(), (i + 1) << 1); } - assertTrue(event.remove(eventId1)); - assertTrue(event.remove(eventId2)); - assertFalse(event.remove(eventId3)); + Assert.assertTrue(event.remove(eventId1)); + Assert.assertTrue(event.remove(eventId2)); + Assert.assertFalse(event.remove(eventId3)); } private static class MultithreadingTestRunner extends Thread { @@ -99,9 +105,10 @@ } } + @Test @MediumTest @Feature({"Chromoting"}) - public static void testMultithreading() { + public void testMultithreading() { Event.Raisable<Void> event = new Event.Raisable<>(); final int threadCount = 10; final MutableReference<Boolean> error = new MutableReference<>(); @@ -114,15 +121,16 @@ try { threads[i].join(); } catch (InterruptedException exception) { - fail(); + Assert.fail(); } } - assertNull(error.get()); + Assert.assertNull(error.get()); } + @Test @SmallTest @Feature({"Chromoting"}) - public static void testSelfRemovable() { + public void testSelfRemovable() { Event.Raisable<Void> event = new Event.Raisable<>(); final MutableReference<Boolean> called = new MutableReference<>(); final MutableReference<Boolean> nextReturn = new MutableReference<>(); @@ -134,28 +142,29 @@ return nextReturn.get(); } }); - assertEquals(event.raise(null), 1); - assertTrue(called.get()); - assertFalse(event.isEmpty()); + Assert.assertEquals(event.raise(null), 1); + Assert.assertTrue(called.get()); + Assert.assertFalse(event.isEmpty()); called.set(false); nextReturn.set(false); - assertEquals(event.raise(null), 1); - assertTrue(called.get()); - assertTrue(event.isEmpty()); + Assert.assertEquals(event.raise(null), 1); + Assert.assertTrue(called.get()); + Assert.assertTrue(event.isEmpty()); called.set(false); nextReturn.set(true); - assertEquals(event.raise(null), 0); - assertFalse(called.get()); - assertTrue(event.isEmpty()); + Assert.assertEquals(event.raise(null), 0); + Assert.assertFalse(called.get()); + Assert.assertTrue(event.isEmpty()); } + @Test @SmallTest @Feature({"Chromoting"}) - public static void testPromisedEvent() { + public void testPromisedEvent() { Thread thread = new Thread(new Runnable() { @Override public void run() { - assertNull(Looper.myLooper()); + Assert.assertNull(Looper.myLooper()); Event.Raisable<Object> event = new Event.PromisedRaisable<>(); final List<Object> called1 = new ArrayList<>(); final List<Object> called2 = new ArrayList<>(); @@ -196,26 +205,26 @@ } }); - assertEquals(called1.size(), 3); - assertEquals(called2.size(), 3); - assertEquals(called3.size(), 2); - assertEquals(called4.size(), 1); + Assert.assertEquals(called1.size(), 3); + Assert.assertEquals(called2.size(), 3); + Assert.assertEquals(called3.size(), 2); + Assert.assertEquals(called4.size(), 1); for (int i = 0; i < 3; i++) { - assertTrue(called1.get(i) == parameters.get(i)); - assertTrue(called2.get(i) == parameters.get(i)); + Assert.assertTrue(called1.get(i) == parameters.get(i)); + Assert.assertTrue(called2.get(i) == parameters.get(i)); } for (int i = 0; i < 2; i++) { - assertTrue(called3.get(i) == parameters.get(i + 1)); + Assert.assertTrue(called3.get(i) == parameters.get(i + 1)); } - assertTrue(called4.get(0) == parameters.get(2)); + Assert.assertTrue(called4.get(0) == parameters.get(2)); } }); thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { // Forward exceptions from test thread. - assertFalse(true); + Assert.assertFalse(true); } }); thread.start(); @@ -224,10 +233,12 @@ } catch (InterruptedException ex) { } } + @Test @SmallTest @Feature({"Chromoting"}) - public static void testPromisedEventWithLooper() { - assertNotNull(Looper.myLooper()); + public void testPromisedEventWithLooper() { + Looper.prepare(); + Assert.assertNotNull(Looper.myLooper()); Event.Raisable<Object> event = new Event.PromisedRaisable<>(); final List<Object> called1 = new ArrayList<>(); final List<Object> called2 = new ArrayList<>(); @@ -277,19 +288,19 @@ }); Looper.loop(); - assertEquals(called1.size(), 3); - assertEquals(called2.size(), 3); - assertEquals(called3.size(), 2); - assertEquals(called4.size(), 1); + Assert.assertEquals(called1.size(), 3); + Assert.assertEquals(called2.size(), 3); + Assert.assertEquals(called3.size(), 2); + Assert.assertEquals(called4.size(), 1); for (int i = 0; i < 3; i++) { - assertTrue(called1.get(i) == parameters.get(i)); + Assert.assertTrue(called1.get(i) == parameters.get(i)); } - assertTrue(called2.get(0) == parameters.get(1)); + Assert.assertTrue(called2.get(0) == parameters.get(1)); for (int i = 0; i < 2; i++) { - assertTrue(called2.get(i + 1) == parameters.get(2)); - assertTrue(called3.get(i) == parameters.get(2)); + Assert.assertTrue(called2.get(i + 1) == parameters.get(2)); + Assert.assertTrue(called3.get(i) == parameters.get(2)); } - assertTrue(called4.get(0) == parameters.get(2)); + Assert.assertTrue(called4.get(0) == parameters.get(2)); } }
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/MockInputStub.java b/remoting/android/javatests/src/org/chromium/chromoting/MockInputStub.java index b7b89912..a5aa2382 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/MockInputStub.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/MockInputStub.java
@@ -6,7 +6,7 @@ import android.graphics.PointF; -import junit.framework.Assert; +import org.junit.Assert; import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.chromoting.jni.TouchEventData;
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java b/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java index a0158477..85a1b1e 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java
@@ -6,16 +6,23 @@ import android.content.Context; import android.os.SystemClock; +import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; -import android.test.InstrumentationTestCase; import android.view.InputDevice; import android.view.MotionEvent; import android.view.ViewConfiguration; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; /** Tests for {@link SwipePinchDetector}. */ -public class SwipePinchDetectorTest extends InstrumentationTestCase { +@RunWith(BaseJUnit4ClassRunner.class) +public class SwipePinchDetectorTest { private SwipePinchDetector mDetector; private float mTouchSlop; private MotionEvent.PointerProperties[] mPointers; @@ -24,9 +31,9 @@ // initialized during setUp(). private MotionEvent.PointerCoords[] mCurrentPositions; - @Override + @Before public void setUp() { - Context context = getInstrumentation().getTargetContext(); + Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); mDetector = new SwipePinchDetector(context); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); MotionEvent.PointerProperties pointer0 = new MotionEvent.PointerProperties(); @@ -59,38 +66,41 @@ } /** Verifies that a simple swipe gesture is recognized as a swipe. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testSwipeRecognition() throws Exception { injectEvent(MotionEvent.ACTION_POINTER_DOWN); - assertFalse(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); // Any distance greater than the touch-slop threshold should work. mCurrentPositions[0].y += mTouchSlop * 2; mCurrentPositions[1].y += mTouchSlop * 2; injectEvent(MotionEvent.ACTION_MOVE); - assertTrue(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertTrue(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); } /** Verifies that a simple pinch gesture is recognized. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testPinchRecognition() throws Exception { injectEvent(MotionEvent.ACTION_POINTER_DOWN); - assertFalse(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); // Any distance greater than the touch-slop threshold should work. mCurrentPositions[0].x -= mTouchSlop * 2; mCurrentPositions[1].x += mTouchSlop * 2; injectEvent(MotionEvent.ACTION_MOVE); - assertFalse(mDetector.isSwiping()); - assertTrue(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertTrue(mDetector.isPinching()); } /** Verifies that motion less than touch-slop does not trigger anything. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testNoMotion() throws Exception { @@ -100,11 +110,12 @@ mCurrentPositions[1].x -= mTouchSlop / 2; mCurrentPositions[1].y -= mTouchSlop / 2; injectEvent(MotionEvent.ACTION_MOVE); - assertFalse(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); } /** Verifies that a pinch with one finger stationary is detected. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerStationary() throws Exception { @@ -113,21 +124,22 @@ // The triggering threshold in this case (one finger stationary) is mTouchSlop * 2; mCurrentPositions[1].x += mTouchSlop * 3; injectEvent(MotionEvent.ACTION_MOVE); - assertFalse(mDetector.isSwiping()); - assertTrue(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertTrue(mDetector.isPinching()); // Do the same test for the other finger. injectEvent(MotionEvent.ACTION_POINTER_DOWN); mCurrentPositions[0].x += mTouchSlop * 3; injectEvent(MotionEvent.ACTION_MOVE); - assertFalse(mDetector.isSwiping()); - assertTrue(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertTrue(mDetector.isPinching()); } /** * Verifies that a pinch is recognized, when the fingers cross the motion threshold at * different times. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testUnevenPinch() throws Exception { @@ -138,11 +150,12 @@ injectEvent(MotionEvent.ACTION_MOVE); } - assertFalse(mDetector.isSwiping()); - assertTrue(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertTrue(mDetector.isPinching()); } /** Same test as testUnevenPinch() except the slow/fast fingers are reversed. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testUnevenPinch2() throws Exception { @@ -153,11 +166,12 @@ injectEvent(MotionEvent.ACTION_MOVE); } - assertFalse(mDetector.isSwiping()); - assertTrue(mDetector.isPinching()); + Assert.assertFalse(mDetector.isSwiping()); + Assert.assertTrue(mDetector.isPinching()); } /** Verifies that a swipe is recognized, even if the fingers move at different rates. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testUnevenSwipe() throws Exception { @@ -171,11 +185,12 @@ injectEvent(MotionEvent.ACTION_MOVE); } - assertTrue(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertTrue(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); } /** Same test as testUnevenSwipe() except the slow/fast fingers are reversed. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testUnevenSwipe2() throws Exception { @@ -189,30 +204,31 @@ injectEvent(MotionEvent.ACTION_MOVE); } - assertTrue(mDetector.isSwiping()); - assertFalse(mDetector.isPinching()); + Assert.assertTrue(mDetector.isSwiping()); + Assert.assertFalse(mDetector.isPinching()); } /** Verifies that the detector is reset when a gesture terminates or a new gesture begins. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testDetectorReset() throws Exception { injectEvent(MotionEvent.ACTION_POINTER_DOWN); mCurrentPositions[0].x += mTouchSlop * 3; injectEvent(MotionEvent.ACTION_MOVE); - assertTrue(mDetector.isPinching()); + Assert.assertTrue(mDetector.isPinching()); // ACTION_POINTER_UP should terminate the gesture. injectEvent(MotionEvent.ACTION_POINTER_UP); - assertFalse(mDetector.isPinching()); + Assert.assertFalse(mDetector.isPinching()); // Repeat the same test, but use ACTION_POINTER_DOWN to start a new gesture, which should // terminate the current one. injectEvent(MotionEvent.ACTION_POINTER_DOWN); mCurrentPositions[0].x += mTouchSlop * 3; injectEvent(MotionEvent.ACTION_MOVE); - assertTrue(mDetector.isPinching()); + Assert.assertTrue(mDetector.isPinching()); injectEvent(MotionEvent.ACTION_POINTER_DOWN); - assertFalse(mDetector.isPinching()); + Assert.assertFalse(mDetector.isPinching()); } }
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java b/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java index a70845e..024cda6 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java
@@ -4,16 +4,23 @@ package org.chromium.chromoting; +import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; -import android.test.InstrumentationTestCase; import android.view.MotionEvent; import android.view.ViewConfiguration; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.chromium.base.ThreadUtils; +import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; /** Tests for {@link TapGestureDetector}. */ -public class TapGestureDetectorTest extends InstrumentationTestCase { +@RunWith(BaseJUnit4ClassRunner.class) +public class TapGestureDetectorTest { private static class MockListener implements TapGestureDetector.OnTapListener { private static final float COMPARISON_DELTA = 0.01f; int mTapCount = -1; @@ -23,9 +30,9 @@ @Override public boolean onTap(int pointerCount, float x, float y) { - assertEquals(-1, mTapCount); - assertEquals(-1, mTapX, COMPARISON_DELTA); - assertEquals(-1, mTapY, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapCount); + Assert.assertEquals(-1, mTapX, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapY, COMPARISON_DELTA); mTapCount = pointerCount; mTapX = x; mTapY = y; @@ -34,33 +41,33 @@ @Override public void onLongPress(int pointerCount, float x, float y) { - assertEquals(-1, mLongPressCount); - assertEquals(-1, mTapX, COMPARISON_DELTA); - assertEquals(-1, mTapY, COMPARISON_DELTA); + Assert.assertEquals(-1, mLongPressCount); + Assert.assertEquals(-1, mTapX, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapY, COMPARISON_DELTA); mLongPressCount = pointerCount; mTapX = x; mTapY = y; } public void assertTapDetected(int expectedCount, float expectedX, float expectedY) { - assertEquals(expectedCount, mTapCount); - assertEquals(expectedX, mTapX, COMPARISON_DELTA); - assertEquals(expectedY, mTapY, COMPARISON_DELTA); - assertEquals(-1, mLongPressCount); + Assert.assertEquals(expectedCount, mTapCount); + Assert.assertEquals(expectedX, mTapX, COMPARISON_DELTA); + Assert.assertEquals(expectedY, mTapY, COMPARISON_DELTA); + Assert.assertEquals(-1, mLongPressCount); } public void assertLongPressDetected(int expectedCount, float expectedX, float expectedY) { - assertEquals(expectedCount, mLongPressCount); - assertEquals(expectedX, mTapX, COMPARISON_DELTA); - assertEquals(expectedY, mTapY, COMPARISON_DELTA); - assertEquals(-1, mTapCount); + Assert.assertEquals(expectedCount, mLongPressCount); + Assert.assertEquals(expectedX, mTapX, COMPARISON_DELTA); + Assert.assertEquals(expectedY, mTapY, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapCount); } public void assertNothingDetected() { - assertEquals(-1, mTapCount); - assertEquals(-1, mLongPressCount); - assertEquals(-1, mTapX, COMPARISON_DELTA); - assertEquals(-1, mTapY, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapCount); + Assert.assertEquals(-1, mLongPressCount); + Assert.assertEquals(-1, mTapX, COMPARISON_DELTA); + Assert.assertEquals(-1, mTapY, COMPARISON_DELTA); } } @@ -89,14 +96,21 @@ event.recycle(); } - @Override + @Before public void setUp() { mListener = new MockListener(); - mDetector = new TapGestureDetector(getInstrumentation().getTargetContext(), mListener); + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + mDetector = new TapGestureDetector( + InstrumentationRegistry.getInstrumentation().getTargetContext(), mListener); + } + }); mEventGenerator = new TouchEventGenerator(); } /** Verifies that a simple down/up is detected as a tap. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerDownUp() throws Exception { @@ -106,6 +120,7 @@ } /** Verifies that a simple multi-finger down/up is detected as a tap. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testMultipleFingerDownUp() throws Exception { @@ -119,6 +134,7 @@ } /** Verifies that a multi-finger tap is detected when lifting the fingers in reverse order. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testMultipleFingerDownUpReversed() throws Exception { @@ -132,6 +148,7 @@ } /** Verifies that small movement of multiple fingers is still detected as a tap. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testMultipleFingerSmallMovements() throws Exception { @@ -148,6 +165,7 @@ } /** Verifies that large motion of a finger prevents a tap being detected. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testLargeMotion() throws Exception { @@ -162,6 +180,7 @@ } /** Verifies that a long-press is detected. */ + @Test @SmallTest @Feature({"Chromoting"}) public void testLongPress() throws Exception { @@ -171,7 +190,7 @@ // Ensure the gesture-detector is created on the UI thread, so that it uses the // Handler for the UI thread for LongPress notifications. mDetector = new TapGestureDetector( - getInstrumentation().getTargetContext(), mListener); + InstrumentationRegistry.getInstrumentation().getTargetContext(), mListener); injectDownEvent(0, 0, 0); }
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java index 1b2687b..aa7c87a 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java
@@ -6,14 +6,20 @@ import android.graphics.PointF; import android.support.test.filters.SmallTest; -import android.test.InstrumentationTestCase; import android.view.MotionEvent; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; import org.chromium.chromoting.jni.TouchEventData; /** Tests for {@link TouchInputStrategy}. */ -public class TouchInputStrategyTest extends InstrumentationTestCase { +@RunWith(BaseJUnit4ClassRunner.class) +public class TouchInputStrategyTest { // Tests are run using a screen which is smaller than the size of the remote desktop and is // translated to the middle of the remote desktop area. This allows us to verify that the // remote events which are 'injected' are correctly mapped and represent the remote coordinates. @@ -47,7 +53,7 @@ event.recycle(); } - @Override + @Before public void setUp() { mRenderData = new RenderData(); mInputInjector = new MockInputStub(); @@ -62,13 +68,15 @@ mRenderData.transform.postTranslate(-TRANSLATE_OFFSET_PX, -TRANSLATE_OFFSET_PX); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOnTapWithNoEvents() throws Exception { - assertFalse(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); + Assert.assertFalse(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerTap() throws Exception { @@ -76,12 +84,13 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); + Assert.assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); mInputInjector.assertTapInjected(TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testLifoTwoFingerTap() throws Exception { @@ -93,12 +102,13 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onTap(InputStub.BUTTON_RIGHT)); + Assert.assertTrue(mInputStrategy.onTap(InputStub.BUTTON_RIGHT)); mInputInjector.assertRightClickInjected(TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testFifoTwoFingerTap() throws Exception { @@ -110,12 +120,13 @@ injectUpEvent(1); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onTap(InputStub.BUTTON_RIGHT)); + Assert.assertTrue(mInputStrategy.onTap(InputStub.BUTTON_RIGHT)); mInputInjector.assertRightClickInjected(TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testThreeFingerTap() throws Exception { @@ -127,10 +138,11 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertFalse(mInputStrategy.onTap(InputStub.BUTTON_MIDDLE)); + Assert.assertFalse(mInputStrategy.onTap(InputStub.BUTTON_MIDDLE)); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerTapSequence() throws Exception { @@ -140,7 +152,7 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); + Assert.assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); int remoteOffsetPx = TRANSLATE_OFFSET_PX + i; mInputInjector.assertTapInjected(remoteOffsetPx, remoteOffsetPx); @@ -148,6 +160,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testInvalidThenValidTap() throws Exception { @@ -160,7 +173,7 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertFalse(mInputStrategy.onTap(InputStub.BUTTON_MIDDLE)); + Assert.assertFalse(mInputStrategy.onTap(InputStub.BUTTON_MIDDLE)); mInputInjector.assertEmpty(); // Next a valid tap, verify it is handled. @@ -168,26 +181,28 @@ injectUpEvent(0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); + Assert.assertTrue(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); mInputInjector.assertTapInjected(TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOnPressAndHoldWithNoEvents() throws Exception { - assertFalse(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); + Assert.assertFalse(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerLongPress() throws Exception { injectDownEvent(0, 0, 0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); + Assert.assertTrue(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); mInputInjector.assertTouchEventInjected(TouchEventData.EventType.TOUCH_EVENT_START, TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); @@ -197,13 +212,14 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerLongPressThenPan() throws Exception { injectDownEvent(0, 0, 0); mInputInjector.assertEmpty(); - assertTrue(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); + Assert.assertTrue(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); mInputInjector.assertTouchEventInjected(TouchEventData.EventType.TOUCH_EVENT_START, TRANSLATE_OFFSET_PX, TRANSLATE_OFFSET_PX); @@ -219,6 +235,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testTwoFingerLongPress() throws Exception { @@ -226,7 +243,7 @@ injectDownEvent(1, 1, 1); mInputInjector.assertEmpty(); - assertFalse(mInputStrategy.onPressAndHold(InputStub.BUTTON_RIGHT)); + Assert.assertFalse(mInputStrategy.onPressAndHold(InputStub.BUTTON_RIGHT)); mInputInjector.assertEmpty(); injectUpEvent(0); @@ -234,6 +251,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testOneFingerPan() throws Exception { @@ -249,6 +267,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testVerticalTwoFingerPan() throws Exception { @@ -289,6 +308,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testHorizontalTwoFingerPan() throws Exception { @@ -329,6 +349,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testCancelledTwoFingerPan() throws Exception { @@ -378,6 +399,7 @@ mInputInjector.assertEmpty(); } + @Test @SmallTest @Feature({"Chromoting"}) public void testTooManyEventsCancelsGesture() throws Exception {
diff --git a/remoting/base/url_request_context_getter.cc b/remoting/base/url_request_context_getter.cc index 693726f..ec9348a 100644 --- a/remoting/base/url_request_context_getter.cc +++ b/remoting/base/url_request_context_getter.cc
@@ -25,7 +25,6 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { if (!url_request_context_.get()) { net::URLRequestContextBuilder builder; - builder.SetFileTaskRunner(file_task_runner_); net_log_.reset(new VlogNetLog()); builder.set_net_log(net_log_.get()); builder.DisableHttpCache();
diff --git a/remoting/base/url_request_context_getter.h b/remoting/base/url_request_context_getter.h index d6c9916..f3916bd3 100644 --- a/remoting/base/url_request_context_getter.h +++ b/remoting/base/url_request_context_getter.h
@@ -23,6 +23,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { public: + // TODO(mmenke): Remove |file_task_runner|, as it's no longer used. URLRequestContextGetter( scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
diff --git a/remoting/ios/app/BUILD.gn b/remoting/ios/app/BUILD.gn index 23b5da4..98552b8 100644 --- a/remoting/ios/app/BUILD.gn +++ b/remoting/ios/app/BUILD.gn
@@ -50,6 +50,8 @@ "session_reconnect_view.mm", "side_menu_items.h", "side_menu_items.mm", + "user_status_presenter.h", + "user_status_presenter.mm", ] deps = [
diff --git a/remoting/ios/app/app_delegate.mm b/remoting/ios/app/app_delegate.mm index b437fce..184e164 100644 --- a/remoting/ios/app/app_delegate.mm +++ b/remoting/ios/app/app_delegate.mm
@@ -17,6 +17,7 @@ #import "remoting/ios/app/app_view_controller.h" #import "remoting/ios/app/help_and_feedback.h" #import "remoting/ios/app/remoting_view_controller.h" +#import "remoting/ios/app/user_status_presenter.h" #import "remoting/ios/facade/remoting_oauth_authentication.h" @interface AppDelegate () { @@ -108,6 +109,7 @@ [[AppViewController alloc] initWithMainViewController:navController]; self.window.rootViewController = _appViewController; [self.window makeKeyAndVisible]; + [UserStatusPresenter.instance start]; } #pragma mark - AppDelegate
diff --git a/remoting/ios/app/remoting_theme.h b/remoting/ios/app/remoting_theme.h index 4f19702..f544fb0 100644 --- a/remoting/ios/app/remoting_theme.h +++ b/remoting/ios/app/remoting_theme.h
@@ -23,6 +23,7 @@ @property(class, nonatomic, readonly) UIColor* setupListBackgroundColor; @property(class, nonatomic, readonly) UIColor* setupListTextColor; @property(class, nonatomic, readonly) UIColor* setupListNumberColor; +@property(class, nonatomic, readonly) UIColor* sideMenuIconColor; // Icons @@ -37,6 +38,8 @@ @property(class, nonatomic, readonly) UIImage* radioOutlineIcon; @property(class, nonatomic, readonly) UIImage* refreshIcon; @property(class, nonatomic, readonly) UIImage* settingsIcon; +@property(class, nonatomic, readonly) UIImage* helpIcon; +@property(class, nonatomic, readonly) UIImage* feedbackIcon; @end
diff --git a/remoting/ios/app/remoting_theme.mm b/remoting/ios/app/remoting_theme.mm index 1b4a86c..4ea48e7 100644 --- a/remoting/ios/app/remoting_theme.mm +++ b/remoting/ios/app/remoting_theme.mm
@@ -99,6 +99,15 @@ return UIColor.whiteColor; } ++ (UIColor*)sideMenuIconColor { + static UIColor* color; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + color = [UIColor colorWithWhite:0.f alpha:0.54f]; + }); + return color; +} + #pragma mark - Icons + (UIImage*)arrowIcon { @@ -200,4 +209,22 @@ return icon; } ++ (UIImage*)helpIcon { + static UIImage* icon; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + icon = [UIImage imageNamed:@"ic_help"]; + }); + return icon; +} + ++ (UIImage*)feedbackIcon { + static UIImage* icon; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + icon = [UIImage imageNamed:@"ic_feedback"]; + }); + return icon; +} + @end
diff --git a/remoting/ios/app/remoting_view_controller.mm b/remoting/ios/app/remoting_view_controller.mm index ea9666ea..a180de4 100644 --- a/remoting/ios/app/remoting_view_controller.mm +++ b/remoting/ios/app/remoting_view_controller.mm
@@ -36,8 +36,6 @@ @interface RemotingViewController ()<HostCollectionViewControllerDelegate, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate> { - BOOL _isAuthenticated; - BOOL _showSignedInAccount; MDCDialogTransitionController* _dialogTransitionController; MDCAppBar* _appBar; HostCollectionViewController* _collectionViewController; @@ -54,8 +52,6 @@ @implementation RemotingViewController - (instancetype)init { - _isAuthenticated = NO; - _showSignedInAccount = YES; UICollectionViewFlowLayout* layout = [[MDCCollectionViewFlowLayout alloc] init]; layout.minimumInteritemSpacing = 0; @@ -153,9 +149,6 @@ [super viewDidAppear:animated]; if (!_remotingService.authentication.user.isAuthenticated) { [AppDelegate.instance presentSignInFlow]; - MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; - message.text = @"Please login."; - [MDCSnackbarManager showMessage:message]; } } @@ -170,25 +163,9 @@ } - (void)userDidUpdateNotification:(NSNotification*)notification { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - [self - nowAuthenticated:_remotingService.authentication.user.isAuthenticated]; - }]; -} - -#pragma mark - RemotingAuthenticationDelegate - -- (void)nowAuthenticated:(BOOL)authenticated { - _isAuthenticated = authenticated; - if (authenticated) { - _showSignedInAccount = YES; - [self presentStatus]; - } else { - MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; - message.text = @"Please sign-in."; - [MDCSnackbarManager showMessage:message]; + if (!_remotingService.authentication.user.isAuthenticated) { + [AppDelegate.instance presentSignInFlow]; } - [self refreshContent]; } #pragma mark - HostCollectionViewControllerDelegate @@ -246,10 +223,6 @@ #pragma mark - Private -- (void)closeViewController { - [self dismissViewControllerAnimated:true completion:nil]; -} - - (void)didSelectRefresh { // TODO(nicholss): Might want to rate limit this. Maybe remoting service // controls that. @@ -260,17 +233,6 @@ [AppDelegate.instance showMenuAnimated:YES]; } -- (void)presentStatus { - MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; - if (_isAuthenticated && _showSignedInAccount) { - _showSignedInAccount = NO; - message.text = [NSString - stringWithFormat:@"Currently signed in as %@.", - _remotingService.authentication.user.userEmail]; - [MDCSnackbarManager showMessage:message]; - } -} - - (void)refreshContent { if (_remotingService.hostListState == HostListStateNotFetched) { self.contentViewController = nil;
diff --git a/remoting/ios/app/resources/BUILD.gn b/remoting/ios/app/resources/BUILD.gn index 69eb25e..5642a5cd 100644 --- a/remoting/ios/app/resources/BUILD.gn +++ b/remoting/ios/app/resources/BUILD.gn
@@ -16,6 +16,8 @@ "//third_party/material_design_icons:ic_chevron_left_white_36pt", "//third_party/material_design_icons:ic_close_white", "//third_party/material_design_icons:ic_desktop_windows_white", + "//third_party/material_design_icons:ic_feedback", + "//third_party/material_design_icons:ic_help", "//third_party/material_design_icons:ic_menu_white", "//third_party/material_design_icons:ic_radio_button_checked_white", "//third_party/material_design_icons:ic_radio_button_unchecked_white",
diff --git a/remoting/ios/app/side_menu_items.mm b/remoting/ios/app/side_menu_items.mm index 4bf4057..efe7d70 100644 --- a/remoting/ios/app/side_menu_items.mm +++ b/remoting/ios/app/side_menu_items.mm
@@ -9,6 +9,7 @@ #import "remoting/ios/app/side_menu_items.h" #import "remoting/ios/app/app_delegate.h" +#import "remoting/ios/app/remoting_theme.h" static NSString* const kFeedbackContext = @"SideMenuFeedbackContext"; @@ -48,16 +49,15 @@ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ items = @[ @[ - // TODO(yuweih): Add icons when crbug.com/734054 is fixed. [[SideMenuItem alloc] initWithTitle:@"Send Feedback" - icon:nil + icon:RemotingTheme.feedbackIcon action:^{ [AppDelegate.instance presentFeedbackFlowWithContext:kFeedbackContext]; }], [[SideMenuItem alloc] initWithTitle:@"Help" - icon:nil + icon:RemotingTheme.helpIcon action:^{ NSLog(@"Tapped help"); }],
diff --git a/remoting/ios/app/user_status_presenter.h b/remoting/ios/app/user_status_presenter.h new file mode 100644 index 0000000..400d7cf --- /dev/null +++ b/remoting/ios/app/user_status_presenter.h
@@ -0,0 +1,22 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_IOS_APP_USER_STATUS_PRESENTER_H_ +#define REMOTING_IOS_APP_USER_STATUS_PRESENTER_H_ + +#import <UIKit/UIKit.h> + +// A simple utility that presents toast and show the user info when the user +// switches account or just logs in. +@interface UserStatusPresenter : NSObject + +- (void)start; + +- (void)stop; + +@property(nonatomic, readonly, class) UserStatusPresenter* instance; + +@end + +#endif // REMOTING_IOS_APP_USER_STATUS_PRESENTER_H_
diff --git a/remoting/ios/app/user_status_presenter.mm b/remoting/ios/app/user_status_presenter.mm new file mode 100644 index 0000000..9d0afba3 --- /dev/null +++ b/remoting/ios/app/user_status_presenter.mm
@@ -0,0 +1,82 @@ +// 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. + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +#import "remoting/ios/app/user_status_presenter.h" + +#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" +#import "remoting/ios/facade/remoting_authentication.h" +#import "remoting/ios/facade/remoting_service.h" + +@interface UserStatusPresenter () { + BOOL _isStarted; +} +@end + +@implementation UserStatusPresenter + +- (instancetype)init { + _isStarted = NO; + return self; +} + +- (void)dealloc { + [self stop]; +} + +- (void)start { + if (_isStarted) { + return; + } + _isStarted = YES; + if ([RemotingService.instance.authentication.user isAuthenticated]) { + [self presentUserStatus]; + } + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(userDidUpdateNotification:) + name:kUserDidUpdate + object:nil]; +} + +- (void)stop { + if (!_isStarted) { + return; + } + _isStarted = NO; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + ++ (UserStatusPresenter*)instance { + static UserStatusPresenter* presenter; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + presenter = [[UserStatusPresenter alloc] init]; + }); + return presenter; +} + +#pragma mark - Private + +- (void)userDidUpdateNotification:(NSNotification*)notification { + [self presentUserStatus]; +} + +- (void)presentUserStatus { + UserInfo* user = RemotingService.instance.authentication.user; + if (![user isAuthenticated]) { + // No need to show the toast since we will pop up a sign-in view in this + // case. + return; + } + MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; + message.text = + [NSString stringWithFormat:@"Currently signed in as %@.", user.userEmail]; + [MDCSnackbarManager showMessage:message]; +} + +@end
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index e578cb0..4edf76c 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd
@@ -619,6 +619,9 @@ <message desc="Label for the button on the Android popup dialog that is shown when there are no Google accounts on the device. Pressing this button launches the Android system screen for adding a new Google account to the device." name="IDS_NOACCOUNTS_ADD_ACCOUNT" formatter_data="android_java"> Add account </message> + <message desc="Button which appears below the user's current account name. Pressing it brings up an account-chooser dialog." name="IDS_CHANGE_ACCOUNT" formatter_data="android_java"> + Change account + </message> <message desc="Error that is shown if a network error occurs, including the case where the device is off-line." name="IDS_ERROR_NETWORK_ERROR" formatter_data="android_java"> A network error occurred. Please check that your device is on-line and try again. </message>
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn index dd0910ea..f8c6dba 100644 --- a/sandbox/linux/BUILD.gn +++ b/sandbox/linux/BUILD.gn
@@ -44,6 +44,9 @@ if (use_seccomp_bpf || is_nacl_nonsfi) { public_deps += [ ":seccomp_bpf" ] } + if (is_android) { + public_deps += [ ":seccomp_starter_android" ] + } } source_set("sandbox_linux_test_utils") { @@ -268,6 +271,29 @@ } } +if (is_android) { + # This target is available even if use_seccomp_bpf is disabled, but it also + # works when it is enabled. + component("seccomp_starter_android") { + sources = [ + "seccomp-bpf-helpers/seccomp_starter_android.cc", + "seccomp-bpf-helpers/seccomp_starter_android.h", + ] + + defines = [ "SANDBOX_IMPLEMENTATION" ] + + deps = [ + "//base", + ] + + if (use_seccomp_bpf) { + deps += [ ":seccomp_bpf" ] + } + + visibility = [ ":*" ] + } +} + if (is_linux) { # The setuid sandbox for Linux. executable("chrome_sandbox") {
diff --git a/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.cc b/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.cc new file mode 100644 index 0000000..37f0bb3 --- /dev/null +++ b/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.cc
@@ -0,0 +1,85 @@ +// 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 "sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h" + +#include <signal.h> +#include <string.h> + +#include "base/logging.h" + +#if BUILDFLAG(USE_SECCOMP_BPF) +#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" +#endif + +namespace sandbox { + +SeccompStarterAndroid::SeccompStarterAndroid(int build_sdk, const char* device) + : sdk_int_(build_sdk), device_(device) {} + +SeccompStarterAndroid::~SeccompStarterAndroid() = default; + +bool SeccompStarterAndroid::StartSandbox() { +#if BUILDFLAG(USE_SECCOMP_BPF) + DCHECK(policy_); + + if (!IsSupportedBySDK()) + return false; + + // Do run-time detection to ensure that support is present. + if (!SandboxBPF::SupportsSeccompSandbox( + SandboxBPF::SeccompLevel::MULTI_THREADED)) { + status_ = SeccompSandboxStatus::DETECTION_FAILED; + LOG(WARNING) << "Seccomp support should be present, but detection " + << "failed. Continuing without Seccomp-BPF."; + return false; + } + + sig_t old_handler = signal(SIGSYS, SIG_DFL); + if (old_handler != SIG_DFL) { + // On Android O and later, the zygote applies a seccomp filter to all + // apps. It has its own SIGSYS handler that must be un-hooked so that + // the Chromium one can be used instead. If pre-O devices have a SIGSYS + // handler, then warn about that. + DLOG_IF(WARNING, sdk_int_ < 26) + << "Un-hooking existing SIGSYS handler before starting " + << "Seccomp sandbox"; + } + + SandboxBPF sandbox(policy_.release()); + CHECK(sandbox.StartSandbox(SandboxBPF::SeccompLevel::MULTI_THREADED)); + + status_ = SeccompSandboxStatus::ENGAGED; + return true; +#else + return false; +#endif +} + +bool SeccompStarterAndroid::IsSupportedBySDK() const { +#if BUILDFLAG(USE_SECCOMP_BPF) + if (sdk_int_ < 22) { + // Seccomp was never available pre-Lollipop. + return false; + } else if (sdk_int_ == 22) { + // On Lollipop-MR1, only select Nexus devices have Seccomp available. + const char* const kDevices[] = { + "deb", "flo", "hammerhead", "mako", + "manta", "shamu", "sprout", "volantis", + }; + + for (auto* device : kDevices) { + if (strcmp(device, device_) == 0) { + return true; + } + } + } else { + // On Marshmallow and higher, Seccomp is required by CTS. + return true; + } +#endif + return false; +} + +} // namespace sandbox
diff --git a/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h b/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h new file mode 100644 index 0000000..c5f253f --- /dev/null +++ b/sandbox/linux/seccomp-bpf-helpers/seccomp_starter_android.h
@@ -0,0 +1,73 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SECCOMP_STARTER_ANDROID_H_ +#define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SECCOMP_STARTER_ANDROID_H_ + +#include "base/macros.h" +#include "sandbox/sandbox_export.h" +#include "sandbox/sandbox_features.h" + +#if BUILDFLAG(USE_SECCOMP_BPF) +#include <memory> + +#include "sandbox/linux/bpf_dsl/policy.h" +#endif + +namespace sandbox { + +namespace bpf_dsl { +class Policy; +} + +enum class SeccompSandboxStatus { + NOT_SUPPORTED = 0, // Seccomp is not supported. + DETECTION_FAILED, // Run-time detection of Seccomp+TSYNC failed. + FEATURE_DISABLED, // Sandbox was disabled by FeatureList. Obsolete/unused. + FEATURE_ENABLED, // Sandbox was enabled by FeatureList. Obsolete/unused. + ENGAGED, // Sandbox was enabled and successfully turned on. + STATUS_MAX + // This enum is used by an UMA histogram, so only append values. +}; + +// This helper class can be used to start a Seccomp-BPF sandbox on Android. It +// helps by doing compile- and run-time checks to see if Seccomp should be +// supported on the given device. +class SANDBOX_EXPORT SeccompStarterAndroid { + public: + // Constructs a sandbox starter helper. The |build_sdk_int| and |device| are + // used to detect whether Seccomp is supported. + SeccompStarterAndroid(int build_sdk_int, const char* device); + ~SeccompStarterAndroid(); + + // Sets the BPF policy to apply. This must be called before StartSandbox() + // if BUILDFLAG(USE_SECCOMP_BPF) is true. + void set_policy(std::unique_ptr<bpf_dsl::Policy> policy) { + policy_ = std::move(policy); + } + + // Attempts to turn on the seccomp sandbox. Returns true iff the sandbox + // was started successfully. + bool StartSandbox(); + + // Returns detailed status information about the sandbox. This will only + // yield an interesting value after StartSandbox() is called. + SeccompSandboxStatus status() const { return status_; } + + private: + // Determines if the running device should support Seccomp, based on the + // Android SDK version. + bool IsSupportedBySDK() const; + + const int sdk_int_; + const char* const device_; + SeccompSandboxStatus status_ = SeccompSandboxStatus::NOT_SUPPORTED; + std::unique_ptr<bpf_dsl::Policy> policy_; + + DISALLOW_COPY_AND_ASSIGN(SeccompStarterAndroid); +}; + +} // namespace sandbox + +#endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SECCOMP_STARTER_ANDROID_H_
diff --git a/sandbox/mac/seatbelt_sandbox_design.md b/sandbox/mac/seatbelt_sandbox_design.md new file mode 100644 index 0000000..d103747 --- /dev/null +++ b/sandbox/mac/seatbelt_sandbox_design.md
@@ -0,0 +1,232 @@ +# **Mac Sandbox V2 Design Doc** +*Status: Final, Authors: kerrnel@chromium.org,rsesek@chromium.org, Last Updated: 2017-07-10* + +# **Objective** + +To improve security on macOS by sandboxing the currently unsandboxed +warmup phase of Chromium child processes, and to remove legacy artifacts +in the sandbox profiles by rewriting them to use the most modern +profile features. + +# **Background** + +Chromium currently runs an unsandboxed warm up routine to acquire +system resources, before entering the sandbox. The design doc +provides a full implementation design and deployment strategy to +sandbox the warmup phase. This document also provides a high level +overview of the macOS provided sandbox. + +In the current warm up phase, Chromium calls system frameworks which +acquires an unspecified number of resources before being sandboxed, +and those resources change with every new OS update from Apple. +This [2009 Chromium blog +post](https://blog.chromium.org/2009/06/google-chrome-sandboxing-and-mac-os-x.html&sa=D&ust=1492473048358000&usg=AFQjCNGEbmCLUqoH9-BeudDcNf5NmW-UcQ) +explains that the warmup phase exists because it was unknown how +to determine what resources those APIs used at the time. By explicitly +enumerating all resources in the sandbox profiles, it is possible +to accurately audit Chromium's attack surface for each new macOS +version. + +Anyone wishing to know more about the macOS sandbox profile language +should read the [Apple Sandbox +Guide](http://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v1.0.pdf) +from reverse.put.as, or see the Appendix of this doc. + +# **Current versus New Implementation** + +The new sandbox will continue to use the OS provided sandboxing +framework and the "deny resource access by default" policy that the +sandbox currently uses. The change introduced by the new implementation +is the removal of the unsandboxed warmup phase. + +# **Compatibility and Security Risk** + +Chromium's sandbox incurs two levels of risk which must be weighed: +compatibility risk and security risk. Compatibility risk is the +risk that Apple changes the resources that a system framework +accesses, causing Chromium's sandbox to block the access. Security +risk is the possibility that Chromium will be compromised because the +sandbox allowed access to dangerous resources. + +A more permissive sandbox profile reduces compatibility risk but +increases security risk and vice versa. See +[crbug.com/619981](https://bugs.chromium.org/p/chromium/issues/detail?id=619981) +for an example of how the current sandbox implementation already +incurs compatibility risk in favor of security risk. + +The current sandbox also incurs a large security risk at the warmup +time, since that phase is unsandboxed. Rather than incurring both +compatibility and security risk during execution, the new sandbox +shifts the risk profile to take on more compatibility risk, since +the warmup phase is eliminated, but it eliminates security risk. + +# **Success Criteria** + +The V2 sandbox will be deemed a success when it has been deployed +to stable users for all processes in Chromium, and Chromium does not +lose functionality due to the new sandbox rules. + +# **Design Overview** + +The Chromium Helper executable will now receive a sandbox profile +and list of sandbox parameters (for example, the location of the +user's home directory). The Helper executable will then apply the +sandbox profile, with the parameters, to the process and then +continue its execution into the ChromeMain function. + +# **Detailed Design** + +## Sandbox Profile Principles + +The sandbox profiles will use the following principles when +implementing the profiles for each process type. +* The profiles deny resource access to anything not explicitly allowed. +* Processes may access all system libraries and frameworks. +* Explicitly list which system resources (files, folders, mach services, sysctls, IPC, IOKit calls) Chromium may access. Analyze each resource access for safety first. + +## Sandbox Design + +The current sandbox code lives in content/common/sandbox_mac.mm. +This file will continue to exist until the current sandbox is +officially deprecated and removed for all process types. Chromium +will use a switch to skip the current sandboxing code for each +process type as it is ported to the new sandbox. + +The new sandbox will rewrite the Chromium code and profiles from +scratch, in order to leverage the most modern OS APIs and constructs, +which are easier to use and maintain. + +## Code Structure + +Chromium's architecture is multi-process with a main browser process +and some number of helper processes which performs tasks such as +rendering web pages, running GPU processes, or various utility +functions. The main browser process launches the other processes +using the "Google Chromium Helper" executable. The browser passes +command line flags to the Helper executable indicating what type +of process it should execute as. + +The browser will now create a pipe to the Helper executable, and +using that pipe, the Helper executable will read a protobuf message +from the browser process. The profobuf message will contain the +profile string and a map of the sandbox parameters, and using a +lightweight protobuf prevents the error prone parsing code for a +whole parameters list from being re-implemented. This must happen +in the main executable itself, as the process must be sandboxed +before the framework is loaded. + +The Helper executable will immediately initialize the sandbox, using +the profile and parameters, before continuing execution to the +ChromiumMain function. + +# **Design Alternatives** + +One alternative design is the current design where process acquires +numerous system resources early in the execution phase and then +applies the sandbox. However, this means that we do not have a +consistent and auditable way to track what resources Chromium is using +over time. Chromium's attack surface can increase significantly with +a new OS release, and we would not know. The new explicit profiles +make the attack surface very auditable and easy to understand. + +Another alternative would have been the [Bootstrap +Sandbox](https://docs.google.com/presentation/d/1Npdbl7UF06wgKRsRWakiI3-qIlPDNN_-AT8H5tQjbYc/edit#slide=id.p) +plan, which proposed intercepting all mach connections to limit the +attack surface. However, with the "new" launchd released in OS X +10.10 Yosemite, messages could no longer be intercepted and forward. +This design solves the same problem by sandboxing the warmup phase, +and allowing the existing system sandbox to enforce the security. + +# **Appendix** + +## Sandbox Profile Language + +This document has referenced sandbox profiles, which are written +in a subset of Scheme. This is a macOS supplied format called Sandbox +Profile Language (SBPL). As there is no official OS-provided +documentation for the SBPL, this design doc provides a short +description below so that other engineers can understand the +constructs that Chromium is leveraging. + +SBPL files accept parameters. A parameter is a way to pass variable +information into the sandbox profile that is not known at compile-time, +for example the location of the user's home directory. A short +sample profile which uses parameters is below. + + +``` +(version 1) +(deny default) +(allow file-read* (subpath (param "USER_HOME_DIR"))) +``` + +This profile will allow the application to read all files in the +user's home directory, and nothing else. The (subpath) directive +says that it applies to all paths underneath the specified path, +and not just the actual path. The following code will apply the +sandbox, pass the parameters, and access a file in the home directory. + + +``` +#import <Foundation/Foundation.h> +#import <sandbox.h> +#import <sys/stat.h> +// sandbox_init* functions are not in the public header. +int sandbox_init_with_parameters(const char *profile, + uint64_t flags, + const char *const parameters[], + char **errorbuf); + +int main(int argc, const char * argv[]) { + const char profile[] = "(version 1)" \ + "(deny default)" \ + "(allow file-read* (subpath (param \"USER_HOME_DIR\")))"; + + const char* home_dir = [NSHomeDirectory() UTF8String]; + // Parameters are passed as an array containing key,value,NULL. + const char* parameters[] = { "USER_HOME_DIR", home_dir, NULL }; + + if (sandbox_init_with_parameters(profile, 0, parameters, NULL)) + exit(1); + + const char* vim_rc = + [[NSHomeDirectory() stringByAppendingString:@"/.vimrc"] + UTF8String]; + + struct stat sb; + if (stat(vim_rc, &sb) == 0) + printf(".vimrc file exists\n"); + + return 0; +} +``` + +The following information must be collected as parameters for the +sandbox profiles to function: + +* Whether or not the sandbox should log failures +* The user's home directory +* Information about the specific OS version (10.9, 10.10, etc.) +* The path to the main `Google Chromium.app` bundle +* The PID of the Chromium process +* If applicable, the path to the permitted directory that the process can read and write to. + +The sandbox directives most commonly used in Chromium's V2 profiles +are documented here for future reference. + +```(deny default)``` - All resource access is denied by default. The +sandbox must list allow rules for all resources. + +```(path "/path")``` - Match exactly this path. + +```(subpath "/path")``` - Match this path and all subpaths of this +path. ("/path", "/path/foo", etc.) + +```(allow process-exec*)``` - Allows the specified binary to be +executed as a process. + +```(allow mach-lookup (global-name "com.apple.system.logger"))``` - +Allows the process to communicate with the specified system service. + +```(allow sysctl-read)``` - Allow access to sysctl() to read property +values.
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h index 9025577..bf21eb9b 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h
@@ -54,7 +54,8 @@ // Called whenever a |property| within the |coordination_unit|'s // internal property store has changed. virtual void OnPropertyChanged(const CoordinationUnitImpl* coordination_unit, - const mojom::PropertyPtr& property) {} + const mojom::PropertyType property_type, + const base::Value& value) {} // Called whenever parent-child relationship ends where the // |coordination_unit| was the parent and the |child_coordination_unit|.
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc index 8b217b4..bd792a2f 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc
@@ -64,8 +64,10 @@ const CoordinationUnitImpl* parent_coordination_unit) override { ++parent_added_count_; } + void OnPropertyChanged(const CoordinationUnitImpl* coordination_unit, - const mojom::PropertyPtr& property) override { + const mojom::PropertyType property_type, + const base::Value& value) override { ++property_changed_count_; } void OnChildRemoved( @@ -159,10 +161,10 @@ // |root_frame_coordination_unit| and |frame_coordination_unit| because // they are CoordinationUnitType::kFrame, so OnPropertyChanged // will only be called for |root_frame_coordination_unit|. - root_frame_coordination_unit->SetProperty(mojom::Property::New( - mojom::PropertyType::kTest, base::MakeUnique<base::Value>(42))); - process_coordination_unit->SetProperty(mojom::Property::New( - mojom::PropertyType::kTest, base::MakeUnique<base::Value>(42))); + root_frame_coordination_unit->SetProperty(mojom::PropertyType::kTest, + base::MakeUnique<base::Value>(42)); + process_coordination_unit->SetProperty(mojom::PropertyType::kTest, + base::MakeUnique<base::Value>(42)); EXPECT_EQ(1u, observer->property_changed_count()); coordination_unit_manager().OnBeforeCoordinationUnitDestroyed(
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc index da6840ae..f5f79a78 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
@@ -303,30 +303,21 @@ const mojom::PropertyType property_type) const { auto value_it = properties_.find(property_type); - return value_it != properties_.end() ? value_it->second : base::Value(); -} - -void CoordinationUnitImpl::ClearProperty( - const mojom::PropertyType property_type) { - properties_.erase(property_type); -} - -void CoordinationUnitImpl::SetProperty(mojom::PropertyPtr property) { - SetProperty(property->property_type, *property->value); - PropagateProperty(property); - NOTIFY_OBSERVERS(observers_, OnPropertyChanged, this, property); + return value_it != properties_.end() ? base::Value(*value_it->second) + : base::Value(); } void CoordinationUnitImpl::SetProperty(mojom::PropertyType property_type, - base::Value value) { - // setting a property with an empty value is effectively clearing the - // value from storage - if (value.IsType(base::Value::Type::NONE)) { - ClearProperty(property_type); - return; - } - - properties_[property_type] = value; + std::unique_ptr<base::Value> value) { + // The |CoordinationUnitGraphObserver| API specification dictates that + // the property is guarranteed to be set on the |CoordinationUnitImpl| + // and propagated to the appropriate associated |CoordianationUnitImpl| + // before |OnPropertyChanged| is invoked on all of the registered observers. + const base::Value& property = + *(properties_[property_type] = std::move(value)); + PropagateProperty(property_type, property); + NOTIFY_OBSERVERS(observers_, OnPropertyChanged, this, property_type, + property); } void CoordinationUnitImpl::BeforeDestroyed() {
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h index 62cdb2e..4dd1894d 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
@@ -37,7 +37,8 @@ void AddBinding(mojom::CoordinationUnitRequest request) override; void AddChild(const CoordinationUnitID& child_id) override; void RemoveChild(const CoordinationUnitID& child_id) override; - void SetProperty(mojom::PropertyPtr property) override; + void SetProperty(mojom::PropertyType property_type, + std::unique_ptr<base::Value> value) override; // TODO(crbug.com/691886) Consider removing this. void SetCoordinationPolicyCallback( mojom::CoordinationPolicyCallbackPtr callback) override; @@ -52,7 +53,7 @@ // Operations performed on the internal key-value store. base::Value GetProperty(const mojom::PropertyType property_type) const; - void ClearProperty(const mojom::PropertyType property_type); + // Methods utilized by the |CoordinationUnitGraphObserver| framework. void BeforeDestroyed(); void AddObserver(CoordinationUnitGraphObserver* observer); @@ -62,14 +63,15 @@ const CoordinationUnitID& id() const { return id_; } const std::set<CoordinationUnitImpl*>& children() const { return children_; } const std::set<CoordinationUnitImpl*>& parents() const { return parents_; } - const std::map<mojom::PropertyType, base::Value>& properties_for_testing() - const { + const std::map<mojom::PropertyType, std::unique_ptr<base::Value>>& + properties_for_testing() const { return properties_; } protected: // Propagate property change to relevant |CoordinationUnitImpl| instances. - virtual void PropagateProperty(const mojom::PropertyPtr& property) {} + virtual void PropagateProperty(mojom::PropertyType property_type, + const base::Value& value) {} // Coordination unit graph traversal helper functions. std::set<CoordinationUnitImpl*> GetChildCoordinationUnitsOfType( @@ -96,13 +98,12 @@ void RemoveParent(CoordinationUnitImpl* parent); bool HasParent(CoordinationUnitImpl* unit); bool HasChild(CoordinationUnitImpl* unit); - void SetProperty(mojom::PropertyType property_type, base::Value value); bool SelfOrParentHasFlagSet(StateFlags state); // TODO(crbug.com/691886) Consider removing these. void RecalcCoordinationPolicy(); void UnregisterCoordinationPolicyCallback(); - std::map<mojom::PropertyType, base::Value> properties_; + std::map<mojom::PropertyType, std::unique_ptr<base::Value>> properties_; std::unique_ptr<service_manager::ServiceContextRef> service_ref_; mojo::BindingSet<mojom::CoordinationUnit> bindings_;
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc index 03369f18..da2c5fc 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc
@@ -212,22 +212,12 @@ EXPECT_EQ(base::Value(), coordination_unit->GetProperty(mojom::PropertyType::kTest)); - // An empty value should be able to set a property - coordination_unit->SetProperty(mojom::Property::New( - mojom::PropertyType::kTest, base::MakeUnique<base::Value>())); - EXPECT_EQ(0u, coordination_unit->properties_for_testing().size()); - - base::Value int_val(41); - // Perform a valid storage property set - coordination_unit->SetProperty(mojom::Property::New( - mojom::PropertyType::kTest, base::MakeUnique<base::Value>(int_val))); + coordination_unit->SetProperty(mojom::PropertyType::kTest, + base::MakeUnique<base::Value>(41)); EXPECT_EQ(1u, coordination_unit->properties_for_testing().size()); - EXPECT_EQ(int_val, + EXPECT_EQ(base::Value(41), coordination_unit->GetProperty(mojom::PropertyType::kTest)); - - coordination_unit->ClearProperty(mojom::PropertyType::kTest); - EXPECT_EQ(0u, coordination_unit->properties_for_testing().size()); } TEST_F(CoordinationUnitImplTest,
diff --git a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc index f2894a1..c929532 100644 --- a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc
@@ -84,8 +84,8 @@ } void ProcessCoordinationUnitImpl::PropagateProperty( - const mojom::PropertyPtr& property) { - mojom::PropertyType property_type = property->property_type; + mojom::PropertyType property_type, + const base::Value& value) { // Trigger tab coordination units to recalculate their CPU usage. if (property_type == mojom::PropertyType::kCPUUsage) { for (auto* tab_coordination_unit : GetAssociatedCoordinationUnitsOfType( @@ -98,9 +98,9 @@ void ProcessCoordinationUnitImpl::MeasureProcessCPUUsage() { double cpu_usage = process_metrics_->GetPlatformIndependentCPUUsage(); - mojom::PropertyPtr property = mojom::Property::New( - mojom::PropertyType::kCPUUsage, base::MakeUnique<base::Value>(cpu_usage)); - SetProperty(std::move(property)); + + SetProperty(mojom::PropertyType::kCPUUsage, + base::MakeUnique<base::Value>(cpu_usage)); repeating_timer_.Start( FROM_HERE, base::TimeDelta::FromSeconds(kCPUProfilingIntervalInSeconds),
diff --git a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h index b519c5d63..317a5d7 100644 --- a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h
@@ -27,7 +27,8 @@ private: // CoordinationUnitImpl implementation. - void PropagateProperty(const mojom::PropertyPtr& property) override; + void PropagateProperty(mojom::PropertyType property_type, + const base::Value& value) override; void MeasureProcessCPUUsage();
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc index 36ad583..19c9d80 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc
@@ -69,10 +69,9 @@ const mojom::PropertyType property_type) { if (property_type == mojom::PropertyType::kCPUUsage) { double cpu_usage = CalculateCPUUsage(); - mojom::PropertyPtr property = - mojom::Property::New(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(cpu_usage)); - SetProperty(std::move(property)); + + SetProperty(mojom::PropertyType::kCPUUsage, + base::MakeUnique<base::Value>(cpu_usage)); } }
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc index d2c9346..06990a1 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc
@@ -18,6 +18,7 @@ #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_request_args.h" #include "base/trace_event/trace_event.h" +#include "build/build_config.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h" #include "services/resource_coordinator/public/interfaces/memory_instrumentation/constants.mojom.h" #include "services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom.h" @@ -84,7 +85,7 @@ } CoordinatorImpl::CoordinatorImpl(service_manager::Connector* connector) - : failed_memory_dump_count_(0), next_dump_id_(0) { + : next_dump_id_(0) { process_map_ = base::MakeUnique<ProcessMap>(connector); DCHECK(!g_coordinator_impl); g_coordinator_impl = this; @@ -182,88 +183,199 @@ void CoordinatorImpl::UnregisterClientProcess( mojom::ClientProcess* client_process) { - // Check if we are waiting for an ack from this client process. - if (pending_clients_for_current_dump_.count(client_process)) { - DCHECK(!queued_memory_dump_requests_.empty()); - OnProcessMemoryDumpResponse( - client_process, false /* success */, - queued_memory_dump_requests_.front().args.dump_guid, - nullptr /* process_memory_dump */); + QueuedMemoryDumpRequest* request = GetCurrentRequest(); + if (request != nullptr) { + // Check if we are waiting for an ack from this client process. + auto it = request->pending_responses.begin(); + while (it != request->pending_responses.end()) { + // The calls to On*MemoryDumpResponse below, if executed, will delete the + // element under the iterator which invalidates it. To avoid this we + // increment the iterator in advance while keeping a reference to the + // current element. + std::set<QueuedMemoryDumpRequest::PendingResponse>::iterator current = + it++; + if (current->client != client_process) + continue; + + switch (current->type) { + case QueuedMemoryDumpRequest::PendingResponse::Type::kProcessDump: { + OnProcessMemoryDumpResponse(client_process, false /* success */, + request->args.dump_guid, + nullptr /* process_memory_dump */); + break; + } + case QueuedMemoryDumpRequest::PendingResponse::Type::kOSDump: { + OSMemDumpMap results; + OnOSMemoryDumpResponse(client_process, false /* success */, results); + break; + } + } + } } size_t num_deleted = clients_.erase(client_process); DCHECK(num_deleted == 1); } void CoordinatorImpl::PerformNextQueuedGlobalMemoryDump() { + using ResponseType = QueuedMemoryDumpRequest::PendingResponse::Type; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(!queued_memory_dump_requests_.empty()); - const base::trace_event::MemoryDumpRequestArgs& args = - queued_memory_dump_requests_.front().args; + QueuedMemoryDumpRequest* request = GetCurrentRequest(); + if (request == nullptr) { + NOTREACHED() << "No current dump request."; + return; + } TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( base::trace_event::MemoryDumpManager::kTraceCategory, "GlobalMemoryDump", - TRACE_ID_LOCAL(args.dump_guid), "dump_type", - base::trace_event::MemoryDumpTypeToString(args.dump_type), + TRACE_ID_LOCAL(request->args.dump_guid), "dump_type", + base::trace_event::MemoryDumpTypeToString(request->args.dump_type), "level_of_detail", - base::trace_event::MemoryDumpLevelOfDetailToString(args.level_of_detail)); + base::trace_event::MemoryDumpLevelOfDetailToString( + request->args.level_of_detail)); + + request->failed_memory_dump_count = 0; // Note: the service process itself is registered as a ClientProcess and // will be treated like any other process for the sake of memory dumps. - pending_clients_for_current_dump_.clear(); - failed_memory_dump_count_ = 0; + request->pending_responses.clear(); + for (const auto& kv : clients_) { mojom::ClientProcess* client = kv.second->client.get(); - pending_clients_for_current_dump_.insert(client); + service_manager::Identity client_identity = kv.second->identity; + const base::ProcessId pid = GetProcessIdForClientIdentity(client_identity); + if (pid == base::kNullProcessId) { + // TODO(hjd): Change to NOTREACHED when crbug.com/739710 is fixed. + VLOG(1) << "Couldn't find a PID for client \"" << client_identity.name() + << "." << client_identity.instance() << "\""; + } + request->responses[client].process_id = pid; + request->responses[client].process_type = kv.second->process_type; + request->pending_responses.insert({client, ResponseType::kProcessDump}); auto callback = base::Bind(&CoordinatorImpl::OnProcessMemoryDumpResponse, base::Unretained(this), client); - client->RequestProcessMemoryDump(args, callback); + client->RequestProcessMemoryDump(request->args, callback); + +// On most platforms each process can dump data about their own process +// so ask each process to do so Linux is special see below. +#if !defined(OS_LINUX) + request->pending_responses.insert({client, ResponseType::kOSDump}); + auto os_callback = base::Bind(&CoordinatorImpl::OnOSMemoryDumpResponse, + base::Unretained(this), client); + client->RequestOSMemoryDump({pid}, os_callback); +#endif // !defined(OS_LINUX) } + +// In some cases, OS stats can only be dumped from a privileged process to +// get around to sandboxing/selinux restrictions (see crbug.com/461788). +#if defined(OS_LINUX) + std::vector<base::ProcessId> pids; + mojom::ClientProcess* browser_client = nullptr; + pids.reserve(clients_.size()); + for (const auto& kv : clients_) { + service_manager::Identity client_identity = kv.second->identity; + const base::ProcessId pid = GetProcessIdForClientIdentity(client_identity); + pids.push_back(pid); + if (kv.second->process_type == mojom::ProcessType::BROWSER) { + browser_client = kv.first; + } + } + + if (clients_.size() > 0) { + DCHECK(browser_client); + } + if (browser_client) { + request->pending_responses.insert({browser_client, ResponseType::kOSDump}); + auto callback = base::Bind(&CoordinatorImpl::OnOSMemoryDumpResponse, + base::Unretained(this), browser_client); + browser_client->RequestOSMemoryDump(pids, callback); + } +#endif // defined(OS_LINUX) + // Run the callback in case there are no client processes registered. FinalizeGlobalMemoryDumpIfAllManagersReplied(); } +CoordinatorImpl::QueuedMemoryDumpRequest* CoordinatorImpl::GetCurrentRequest() { + if (queued_memory_dump_requests_.empty()) { + return nullptr; + } + return &queued_memory_dump_requests_.front(); +} + void CoordinatorImpl::OnProcessMemoryDumpResponse( - mojom::ClientProcess* client_process, + mojom::ClientProcess* client, bool success, uint64_t dump_guid, mojom::RawProcessMemoryDumpPtr process_memory_dump) { + using ResponseType = QueuedMemoryDumpRequest::PendingResponse::Type; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - auto it = pending_clients_for_current_dump_.find(client_process); + QueuedMemoryDumpRequest* request = GetCurrentRequest(); + if (request == nullptr) { + NOTREACHED() << "No current dump request."; + return; + } - if (queued_memory_dump_requests_.empty() || - queued_memory_dump_requests_.front().args.dump_guid != dump_guid || - it == pending_clients_for_current_dump_.end()) { + auto it = + request->pending_responses.find({client, ResponseType::kProcessDump}); + + if (request->args.dump_guid != dump_guid || + it == request->pending_responses.end()) { VLOG(1) << "Unexpected memory dump response, dump-id:" << dump_guid; return; } - auto iter = clients_.find(client_process); + auto iter = clients_.find(client); if (iter == clients_.end()) { VLOG(1) << "Received a memory dump response from an unregistered client"; return; } if (process_memory_dump) { - const service_manager::Identity& client_identity = iter->second->identity; - const mojom::ProcessType& process_type = iter->second->process_type; - const base::ProcessId pid = GetProcessIdForClientIdentity(client_identity); - - auto response = base::MakeUnique<QueuedMemoryDumpRequest::Response>( - process_type, std::move(process_memory_dump)); - - if (pid != base::kNullProcessId) { - queued_memory_dump_requests_.front().responses.push_back( - std::make_pair(pid, std::move(response))); - } else { - VLOG(1) << "Couldn't find a PID for client \"" << client_identity.name() - << "." << client_identity.instance() << "\""; - } + request->responses[client].dump_ptr = std::move(process_memory_dump); + } else { + request->responses[client].dump_ptr = mojom::RawProcessMemoryDump::New(); } - pending_clients_for_current_dump_.erase(it); + request->pending_responses.erase(it); if (!success) { - ++failed_memory_dump_count_; + request->failed_memory_dump_count++; + VLOG(1) << "RequestGlobalMemoryDump() FAIL: NACK from client process"; + } + + FinalizeGlobalMemoryDumpIfAllManagersReplied(); +} + +void CoordinatorImpl::OnOSMemoryDumpResponse(mojom::ClientProcess* client, + bool success, + const OSMemDumpMap& os_dumps) { + using ResponseType = QueuedMemoryDumpRequest::PendingResponse::Type; + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + QueuedMemoryDumpRequest* request = GetCurrentRequest(); + if (request == nullptr) { + NOTREACHED() << "No current dump request."; + return; + } + + auto it = request->pending_responses.find({client, ResponseType::kOSDump}); + + if (it == request->pending_responses.end()) { + VLOG(1) << "Unexpected memory dump response"; + return; + } + + auto iter = clients_.find(client); + if (iter == clients_.end()) { + VLOG(1) << "Received a memory dump response from an unregistered client"; + return; + } + + request->responses[client].os_dumps = os_dumps; + + request->pending_responses.erase(it); + + if (!success) { + request->failed_memory_dump_count++; VLOG(1) << "RequestGlobalMemoryDump() FAIL: NACK from client process"; } @@ -271,11 +383,10 @@ } void CoordinatorImpl::FinalizeGlobalMemoryDumpIfAllManagersReplied() { - if (pending_clients_for_current_dump_.size() > 0) - return; - DCHECK(!queued_memory_dump_requests_.empty()); QueuedMemoryDumpRequest* request = &queued_memory_dump_requests_.front(); + if (request->pending_responses.size() > 0) + return; // Reconstruct a map of pid -> ProcessMemoryDump by reassembling the responses // received by the clients for this dump. In some cases the response coming @@ -286,32 +397,41 @@ std::map<base::ProcessId, OSMemDump> os_dumps; for (auto& response : request->responses) { - const base::ProcessId pid = response.first; - const OSMemDump dump = response.second->dump_ptr->os_dump; + const base::ProcessId pid = response.second.process_id; + const OSMemDump dump = response.second.dump_ptr->os_dump; // TODO(hjd): We should have a better way to tell if os_dump is filled. + // TODO(hjd): Remove this if when we collect OS dumps separately. if (dump.resident_set_kb > 0) { DCHECK_EQ(0u, os_dumps.count(pid)); os_dumps[pid] = dump; } - for (auto& extra : response.second->dump_ptr->extra_processes_dumps) { + // TODO(hjd): Remove this for loop when we collect OS dumps separately. + for (auto& extra : response.second.dump_ptr->extra_processes_dumps) { const base::ProcessId extra_pid = extra.first; const OSMemDump extra_dump = extra.second; DCHECK_EQ(0u, os_dumps.count(extra_pid)); os_dumps[extra_pid] = extra_dump; } + + for (auto& kv : response.second.os_dumps) { + const base::ProcessId pid = kv.first; + const OSMemDump dump = kv.second; + DCHECK_EQ(0u, os_dumps.count(pid)); + os_dumps[pid] = dump; + } } std::map<base::ProcessId, mojom::ProcessMemoryDumpPtr> finalized_pmds; for (auto& response : request->responses) { - const base::ProcessId pid = response.first; + const base::ProcessId pid = response.second.process_id; mojom::ProcessMemoryDumpPtr& pmd = finalized_pmds[pid]; if (!pmd) pmd = mojom::ProcessMemoryDump::New(); - pmd->process_type = response.second->process_type; - pmd->chrome_dump = response.second->dump_ptr->chrome_dump; + pmd->process_type = response.second.process_type; + pmd->chrome_dump = response.second.dump_ptr->chrome_dump; pmd->os_dump = CreatePublicOSDump(os_dumps[pid]); } @@ -329,7 +449,7 @@ } const auto& callback = request->callback; - const bool global_success = failed_memory_dump_count_ == 0; + const bool global_success = request->failed_memory_dump_count == 0; callback.Run(global_success, request->args.dump_guid, std::move(global_dump)); char guid_str[20]; @@ -351,11 +471,7 @@ } } -CoordinatorImpl::QueuedMemoryDumpRequest::Response::Response( - mojom::ProcessType process_type, - mojom::RawProcessMemoryDumpPtr dump_ptr) - : process_type(process_type), dump_ptr(std::move(dump_ptr)) {} - +CoordinatorImpl::QueuedMemoryDumpRequest::Response::Response() {} CoordinatorImpl::QueuedMemoryDumpRequest::Response::~Response() {} CoordinatorImpl::QueuedMemoryDumpRequest::QueuedMemoryDumpRequest( @@ -374,4 +490,14 @@ process_type(process_type) {} CoordinatorImpl::ClientInfo::~ClientInfo() {} +CoordinatorImpl::QueuedMemoryDumpRequest::PendingResponse::PendingResponse( + const mojom::ClientProcess* client, + Type type) + : client(client), type(type) {} + +bool CoordinatorImpl::QueuedMemoryDumpRequest::PendingResponse::operator<( + const PendingResponse& other) const { + return std::tie(client, type) < std::tie(other.client, other.type); +} + } // namespace memory_instrumentation
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h index a3ee3e1..2d31868 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h
@@ -8,6 +8,7 @@ #include <list> #include <map> #include <set> +#include <unordered_map> #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" @@ -58,6 +59,9 @@ ~CoordinatorImpl() override; private: + using OSMemDumpMap = std::unordered_map< + base::ProcessId, + base::trace_event::MemoryDumpCallbackResult::OSMemDump>; friend std::default_delete<CoordinatorImpl>; // For testing friend class CoordinatorImplTest; // For testing @@ -70,17 +74,36 @@ const base::trace_event::MemoryDumpRequestArgs args; const RequestGlobalMemoryDumpCallback callback; - struct Response { - Response(mojom::ProcessType, mojom::RawProcessMemoryDumpPtr); - ~Response(); + struct PendingResponse { + enum Type { + kProcessDump, + kOSDump, + }; + PendingResponse(const mojom::ClientProcess* client, const Type type); - const mojom::ProcessType process_type; - const mojom::RawProcessMemoryDumpPtr dump_ptr; + bool operator<(const PendingResponse& other) const; + + const mojom::ClientProcess* client; + const Type type; }; - // Collects the data received from OnProcessMemoryDumpResponse(). - std::vector<std::pair<base::ProcessId, std::unique_ptr<Response>>> - responses; + struct Response { + Response(); + ~Response(); + + base::ProcessId process_id; + mojom::ProcessType process_type; + mojom::RawProcessMemoryDumpPtr dump_ptr; + OSMemDumpMap os_dumps; + }; + + // When a dump, requested via RequestGlobalMemoryDump(), is in progress this + // set contains a |PendingResponse| for each |RequestProcessMemoryDump| and + // |RequestOSMemoryDump| call that has not yet replied or been canceled (due + // to the client disconnecting). + std::set<QueuedMemoryDumpRequest::PendingResponse> pending_responses; + std::map<mojom::ClientProcess*, Response> responses; + int failed_memory_dump_count = 0; }; // Holds the identity and remote reference of registered clients. @@ -95,15 +118,21 @@ const mojom::ProcessType process_type; }; - // Callback of RequestProcessMemoryInternalDump. + // Callback of RequestProcessMemoryDump. void OnProcessMemoryDumpResponse( mojom::ClientProcess*, bool success, uint64_t dump_guid, mojom::RawProcessMemoryDumpPtr process_memory_dump); + // Callback of RequestOSMemoryDump. + void OnOSMemoryDumpResponse(mojom::ClientProcess*, + bool success, + const OSMemDumpMap&); + void PerformNextQueuedGlobalMemoryDump(); void FinalizeGlobalMemoryDumpIfAllManagersReplied(); + QueuedMemoryDumpRequest* GetCurrentRequest(); mojo::BindingSet<mojom::Coordinator, service_manager::Identity> bindings_; @@ -113,16 +142,8 @@ // Oustanding dump requests, enqueued via RequestGlobalMemoryDump(). std::list<QueuedMemoryDumpRequest> queued_memory_dump_requests_; - // When a dump, requested via RequestGlobalMemoryDump(), is in progress this - // set contains the subset of registerd |clients_| that have not yet replied - // to the local dump request (via RequestProcessMemoryDump()) . - std::set<mojom::ClientProcess*> pending_clients_for_current_dump_; - - int failed_memory_dump_count_; - // Maintains a map of service_manager::Identity -> pid for registered clients. std::unique_ptr<ProcessMap> process_map_; - uint64_t next_dump_id_; THREAD_CHECKER(thread_checker_);
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc b/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc index fb7f055..98b648428 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc
@@ -8,6 +8,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/trace_event/memory_dump_request_args.h" +#include "build/build_config.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "services/resource_coordinator/memory_instrumentation/process_map.h" @@ -31,7 +32,9 @@ using ::testing::Pointee; using ::testing::Field; using ::testing::Eq; +using ::testing::AllOf; +using OSMemDump = base::trace_event::MemoryDumpCallbackResult::OSMemDump; using RequestGlobalMemoryDumpCallback = memory_instrumentation::CoordinatorImpl::RequestGlobalMemoryDumpCallback; using memory_instrumentation::mojom::GlobalMemoryDumpPtr; @@ -109,6 +112,13 @@ callback.Run(true, args.dump_guid, nullptr); })); + + ON_CALL(*this, RequestOSMemoryDump(_, _)) + .WillByDefault(Invoke([](const std::vector<base::ProcessId> pids, + const RequestOSMemoryDumpCallback& callback) { + std::unordered_map<base::ProcessId, OSMemDump> results; + callback.Run(true, results); + })); } ~MockClientProcess() override {} @@ -117,6 +127,10 @@ void(const MemoryDumpRequestArgs& args, const RequestProcessMemoryDumpCallback& callback)); + MOCK_METHOD2(RequestOSMemoryDump, + void(const std::vector<base::ProcessId>& args, + const RequestOSMemoryDumpCallback& callback)); + private: mojo::Binding<mojom::ClientProcess> binding_; }; @@ -154,9 +168,9 @@ TEST_F(CoordinatorImplTest, SeveralClients) { base::RunLoop run_loop; - MockClientProcess client_process_1(this); - MockClientProcess client_process_2(this); - + NiceMock<MockClientProcess> client_process_1(this, 1, + mojom::ProcessType::BROWSER); + NiceMock<MockClientProcess> client_process_2(this); EXPECT_CALL(client_process_1, RequestProcessMemoryDump(_, _)).Times(1); EXPECT_CALL(client_process_2, RequestProcessMemoryDump(_, _)).Times(1); @@ -180,7 +194,8 @@ 0, base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; - auto client_process_1 = base::MakeUnique<NiceMock<MockClientProcess>>(this); + auto client_process_1 = base::MakeUnique<NiceMock<MockClientProcess>>( + this, 1, mojom::ProcessType::BROWSER); auto client_process_2 = base::MakeUnique<NiceMock<MockClientProcess>>(this); // One of the client processes dies after a global dump is requested and @@ -218,8 +233,10 @@ TEST_F(CoordinatorImplTest, GlobalMemoryDumpStruct) { base::RunLoop run_loop; - MockClientProcess client_process_1(this, 1, mojom::ProcessType::BROWSER); - MockClientProcess client_process_2(this, 2, mojom::ProcessType::RENDERER); + NiceMock<MockClientProcess> client_process_1(this, 1, + mojom::ProcessType::BROWSER); + NiceMock<MockClientProcess> client_process_2(this, 2, + mojom::ProcessType::RENDERER); EXPECT_CALL(client_process_1, RequestProcessMemoryDump(_, _)) .WillOnce( Invoke([](const MemoryDumpRequestArgs& args, @@ -270,4 +287,85 @@ run_loop.Run(); } +TEST_F(CoordinatorImplTest, OsDumps) { + base::RunLoop run_loop; + + MockClientProcess browser_client(this, 1, mojom::ProcessType::BROWSER); + MockClientProcess renderer_client(this, 2, mojom::ProcessType::RENDERER); + + EXPECT_CALL(browser_client, RequestProcessMemoryDump(_, _)) + .WillOnce( + Invoke([](const MemoryDumpRequestArgs& args, + const MockClientProcess::RequestProcessMemoryDumpCallback& + callback) { + auto dump = mojom::RawProcessMemoryDump::New(); + dump->chrome_dump.malloc_total_kb = 1; + callback.Run(args.dump_guid, true, std::move(dump)); + })); + EXPECT_CALL(renderer_client, RequestProcessMemoryDump(_, _)) + .WillOnce( + Invoke([](const MemoryDumpRequestArgs& args, + const MockClientProcess::RequestProcessMemoryDumpCallback& + callback) { + auto dump = mojom::RawProcessMemoryDump::New(); + dump->chrome_dump.malloc_total_kb = 2; + callback.Run(args.dump_guid, true, std::move(dump)); + })); +#if defined(OS_LINUX) + EXPECT_CALL(browser_client, + RequestOSMemoryDump(AllOf(Contains(1), Contains(2)), _)) + .WillOnce(Invoke( + [](const std::vector<base::ProcessId>& pids, + const MockClientProcess::RequestOSMemoryDumpCallback& callback) { + std::unordered_map<base::ProcessId, OSMemDump> results; + results[1].resident_set_kb = 1; + results[2].resident_set_kb = 2; + callback.Run(true, results); + })); + EXPECT_CALL(renderer_client, RequestOSMemoryDump(_, _)).Times(0); +#else + EXPECT_CALL(browser_client, RequestOSMemoryDump(Contains(1), _)) + .WillOnce(Invoke( + [](const std::vector<base::ProcessId>& pids, + const MockClientProcess::RequestOSMemoryDumpCallback& callback) { + std::unordered_map<base::ProcessId, OSMemDump> results; + results[1].resident_set_kb = 1; + callback.Run(true, results); + })); + EXPECT_CALL(renderer_client, RequestOSMemoryDump(Contains(2), _)) + .WillOnce(Invoke( + [](const std::vector<base::ProcessId>& pids, + const MockClientProcess::RequestOSMemoryDumpCallback& callback) { + std::unordered_map<base::ProcessId, OSMemDump> results; + results[2].resident_set_kb = 2; + callback.Run(true, results); + })); +#endif // defined(OS_LINUX) + + MockGlobalMemoryDumpCallback callback; + EXPECT_CALL(callback, OnCall(true, Ne(0u), NotNull())) + .WillOnce(Invoke([&run_loop](bool success, uint64_t dump_guid, + GlobalMemoryDump* global_dump) { + EXPECT_EQ(2U, global_dump->process_dumps.size()); + mojom::ProcessMemoryDumpPtr browser_dump = nullptr; + mojom::ProcessMemoryDumpPtr renderer_dump = nullptr; + for (mojom::ProcessMemoryDumpPtr& dump : global_dump->process_dumps) { + if (dump->process_type == mojom::ProcessType::BROWSER) { + browser_dump = std::move(dump); + } else if (dump->process_type == mojom::ProcessType::RENDERER) { + renderer_dump = std::move(dump); + } + } + EXPECT_EQ(browser_dump->os_dump->resident_set_kb, 1u); + EXPECT_EQ(renderer_dump->os_dump->resident_set_kb, 2u); + run_loop.Quit(); + })); + + base::trace_event::MemoryDumpRequestArgs args = { + 0, base::trace_event::MemoryDumpType::SUMMARY_ONLY, + base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND}; + RequestGlobalMemoryDump(args, callback.Get()); + run_loop.Run(); +} + } // namespace memory_instrumentation
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.cc b/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.cc index 1b323af..726739c 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.cc +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.cc
@@ -101,10 +101,19 @@ base::Unretained(this), args)); return; } + coordinator_->RequestGlobalMemoryDump( args, mojom::Coordinator::RequestGlobalMemoryDumpCallback()); } +void ClientProcessImpl::RequestOSMemoryDump( + const std::vector<base::ProcessId>& ids, + const RequestOSMemoryDumpCallback& callback) { + using OSMemDump = base::trace_event::MemoryDumpCallbackResult::OSMemDump; + std::unordered_map<base::ProcessId, OSMemDump> results; + callback.Run(true, results); +} + ClientProcessImpl::Config::Config(service_manager::Connector* connector, const std::string& service_name, mojom::ProcessType process_type)
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h b/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h index c657cd8..0335f9f7 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h
@@ -69,6 +69,11 @@ uint64_t dump_guid, const base::Optional<base::trace_event::MemoryDumpCallbackResult>&); + // mojom::ClientProcess implementation. The Coordinator calls this. + void RequestOSMemoryDump( + const std::vector<base::ProcessId>& ids, + const RequestOSMemoryDumpCallback& callback) override; + mojom::CoordinatorPtr coordinator_; mojo::Binding<mojom::ClientProcess> binding_; const mojom::ProcessType process_type_;
diff --git a/services/resource_coordinator/public/interfaces/coordination_unit.mojom b/services/resource_coordinator/public/interfaces/coordination_unit.mojom index 57ead38..6e5372e 100644 --- a/services/resource_coordinator/public/interfaces/coordination_unit.mojom +++ b/services/resource_coordinator/public/interfaces/coordination_unit.mojom
@@ -37,13 +37,6 @@ kCPUUsage, }; -// Key-value pair that corresponds to an entry in the CoordinationUnitImpl's -// internal key-value store -struct Property { - PropertyType property_type; - mojo.common.mojom.Value value; -}; - interface CoordinationUnit { SendEvent(Event event); @@ -65,5 +58,5 @@ SetCoordinationPolicyCallback(CoordinationPolicyCallback callback); // Sets a property on the CoordinationUnitImpl's internal key-value store. - SetProperty(Property property); + SetProperty(PropertyType property_type, mojo.common.mojom.Value value); };
diff --git a/services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom b/services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom index 540c310b..c95373f 100644 --- a/services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom +++ b/services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom
@@ -110,6 +110,22 @@ // returned in case of success. RequestProcessMemoryDump(RequestArgs args) => (bool success, uint64 dump_id, RawProcessMemoryDump? process_memory_dump); + + // Requests an OSMemDump for each pid in |pids|. + // The Memory-infra service deals with two kinds of information: + // 1) Chrome's view of its own memory use (recorded as ChromeMemDumps) + // 2) The OS's view of Chrome's memory use (recorded as OSMemDumps) + // Both of these are collected per process. On most platforms each process + // can make the system calls to collect its own OSMemDump however on some + // platforms *cough* Linux *cough* due to sandboxing only the browser + // process can collect OSMemDumps. This API allows for these two cases. + // On most platforms we send this message to each ClientProcess with + // with one pid - kNullProcessId - meaning return just your own OSMemDump. + // On Linux we call this once on the browser process ClientProcess passing + // the pids for all processes. + // See crbug.com/461788 + RequestOSMemoryDump(array<mojo.common.mojom.ProcessId> pids) => + (bool success, map<mojo.common.mojom.ProcessId, RawOSMemDump> dumps); }; // The memory-infra service implements this interface. There is one instance for
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc index 429bbb1..916a33c3 100644 --- a/services/service_manager/service_manager.cc +++ b/services/service_manager/service_manager.cc
@@ -455,8 +455,10 @@ mojom::PIDReceiverRequest pid_receiver_request, StartServiceWithProcessCallback callback) override { Identity target = in_target; + mojom::ServicePtr service; + service.Bind(mojom::ServicePtrInfo(std::move(service_handle), 0)); mojom::ConnectResult result = - ValidateConnectParams(&target, nullptr, nullptr); + ValidateConnectParams(&target, &service, &pid_receiver_request); if (!Succeeded(result)) { std::move(callback).Run(result, Identity()); return; @@ -466,8 +468,6 @@ params->set_source(identity_); params->set_target(target); - mojom::ServicePtr service; - service.Bind(mojom::ServicePtrInfo(std::move(service_handle), 0)); params->set_client_process_info(std::move(service), std::move(pid_receiver_request)); params->set_start_service_callback(std::move(callback));
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest.cc b/services/service_manager/tests/service_manager/service_manager_unittest.cc index 11b4597..044b16b1 100644 --- a/services/service_manager/tests/service_manager/service_manager_unittest.cc +++ b/services/service_manager/tests/service_manager/service_manager_unittest.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" +#include "base/guid.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" @@ -26,6 +27,7 @@ #include "mojo/public/cpp/bindings/binding_set.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/service.h" +#include "services/service_manager/public/cpp/service_context.h" #include "services/service_manager/public/cpp/service_test.h" #include "services/service_manager/public/interfaces/constants.mojom.h" #include "services/service_manager/public/interfaces/service_manager.mojom.h" @@ -85,6 +87,44 @@ DISALLOW_COPY_AND_ASSIGN(ServiceManagerTestClient); }; +class SimpleService { + public: + explicit SimpleService(mojom::ServiceRequest request) + : context_(base::MakeUnique<ServiceImpl>(this), std::move(request)) {} + ~SimpleService() {} + + Connector* connector() { return context_.connector(); } + + void WaitForDisconnect() { + base::RunLoop loop; + connection_lost_closure_ = loop.QuitClosure(); + loop.Run(); + } + + private: + class ServiceImpl : public Service { + public: + explicit ServiceImpl(SimpleService* service) : service_(service) {} + ~ServiceImpl() override {} + + bool OnServiceManagerConnectionLost() override { + if (service_->connection_lost_closure_) + std::move(service_->connection_lost_closure_).Run(); + return true; + } + + private: + SimpleService* service_; + + DISALLOW_COPY_AND_ASSIGN(ServiceImpl); + }; + + ServiceContext context_; + base::OnceClosure connection_lost_closure_; + + DISALLOW_COPY_AND_ASSIGN(SimpleService); +}; + } // namespace class ServiceManagerTest : public test::ServiceTest, @@ -161,6 +201,21 @@ service_pid_received_callback_ = callback; } + void WaitForInstanceToStart(const Identity& identity) { + base::RunLoop loop; + set_service_started_callback(base::Bind( + [](base::RunLoop* loop, const Identity* expected_identity, + const Identity& identity) { + EXPECT_EQ(expected_identity->name(), identity.name()); + EXPECT_EQ(expected_identity->user_id(), identity.user_id()); + EXPECT_EQ(expected_identity->instance(), identity.instance()); + loop->Quit(); + }, + &loop, &identity)); + loop.Run(); + set_service_started_callback(ServiceStartedCallback()); + } + void StartTarget() { base::FilePath target_path; CHECK(base::PathService::Get(base::DIR_EXE, &target_path)); @@ -408,4 +463,40 @@ } } +TEST_F(ServiceManagerTest, ClientProcessCapabilityEnforced) { + AddListenerAndWaitForApplications(); + + const std::string kTestService = "service_manager_unittest_target"; + const Identity kInstance1Id(kTestService, mojom::kRootUserID, "1"); + const Identity kInstance2Id(kTestService, mojom::kRootUserID); + + // Introduce a new service instance for service_manager_unittest_target, + // using the client_process capability. + mojom::ServicePtr test_service_proxy1; + SimpleService test_service1(mojo::MakeRequest(&test_service_proxy1)); + mojom::PIDReceiverPtr pid_receiver1; + connector()->StartService(kInstance1Id, std::move(test_service_proxy1), + mojo::MakeRequest(&pid_receiver1)); + pid_receiver1->SetPID(42); + WaitForInstanceToStart(kInstance1Id); + EXPECT_EQ(1u, instances().size()); + EXPECT_TRUE(ContainsInstanceWithName("service_manager_unittest_target")); + + // Now use the new instance (which does not have client_process capability) + // to attempt introduction of yet another instance. This should fail. + mojom::ServicePtr test_service_proxy2; + SimpleService test_service2(mojo::MakeRequest(&test_service_proxy2)); + mojom::PIDReceiverPtr pid_receiver2; + test_service1.connector()->StartService(kInstance2Id, + std::move(test_service_proxy2), + mojo::MakeRequest(&pid_receiver2)); + pid_receiver2->SetPID(43); + + // The new service should be disconnected immediately. + test_service2.WaitForDisconnect(); + + // And still only one service instance around. + EXPECT_EQ(1u, instances().size()); +} + } // namespace service_manager
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest_manifest.json b/services/service_manager/tests/service_manager/service_manager_unittest_manifest.json index e8dbbb8..11ca3ca 100644 --- a/services/service_manager/tests/service_manager/service_manager_unittest_manifest.json +++ b/services/service_manager/tests/service_manager/service_manager_unittest_manifest.json
@@ -11,7 +11,8 @@ "requires": { "service_manager": [ "service_manager:service_manager", - "service_manager:client_process" + "service_manager:client_process", + "service_manager:instance_name" ], "service_manager_unittest_embedder": [ "service_manager_unittest:embedder"
diff --git a/services/service_manager/tests/service_manager/target_manifest.json b/services/service_manager/tests/service_manager/target_manifest.json index c1029b9..ff8696cd 100644 --- a/services/service_manager/tests/service_manager/target_manifest.json +++ b/services/service_manager/tests/service_manager/target_manifest.json
@@ -6,7 +6,8 @@ "requires": { "service_manager_unittest": [ "service_manager_unittest:create_instance_test" - ] + ], + "service_manager_unittest_target": [] } } }
diff --git a/services/ui/DEPS b/services/ui/DEPS index 4aa373f..2138825 100644 --- a/services/ui/DEPS +++ b/services/ui/DEPS
@@ -3,6 +3,7 @@ "+chromeos/system", "+components/discardable_memory/service", "+components/discardable_memory/public", + "+components/viz/common", "+ipc", "+mojo/common", "+mojo/converters",
diff --git a/services/ui/display/screen_manager_forwarding.cc b/services/ui/display/screen_manager_forwarding.cc index 8953a30..1955edb 100644 --- a/services/ui/display/screen_manager_forwarding.cc +++ b/services/ui/display/screen_manager_forwarding.cc
@@ -7,11 +7,13 @@ #include <utility> #include "base/bind.h" +#include "chromeos/system/devicemode.h" #include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "ui/display/screen_base.h" #include "ui/display/types/display_constants.h" #include "ui/display/types/display_snapshot_mojo.h" +#include "ui/display/types/fake_display_controller.h" #include "ui/display/types/native_display_delegate.h" #include "ui/ozone/public/ozone_platform.h" @@ -38,7 +40,9 @@ } // namespace ScreenManagerForwarding::ScreenManagerForwarding() - : screen_(base::MakeUnique<display::ScreenBase>()), binding_(this) { + : screen_(base::MakeUnique<display::ScreenBase>()), + binding_(this), + test_controller_binding_(this) { Screen::SetScreenInstance(screen_.get()); } @@ -53,13 +57,24 @@ registry->AddInterface<mojom::NativeDisplayDelegate>( base::Bind(&ScreenManagerForwarding::BindNativeDisplayDelegateRequest, base::Unretained(this))); + registry->AddInterface<mojom::TestDisplayController>( + base::Bind(&ScreenManagerForwarding::BindTestDisplayControllerRequest, + base::Unretained(this))); } void ScreenManagerForwarding::Init(ScreenManagerDelegate* delegate) { // Done in NativeDisplayDelegate::Initialize() instead. } -void ScreenManagerForwarding::RequestCloseDisplay(int64_t display_id) {} +void ScreenManagerForwarding::RequestCloseDisplay(int64_t display_id) { + if (!fake_display_controller_) + return; + + // Tell NativeDisplayDelegate to remove the display. This triggers an + // OnConfigurationChanged() and the corresponding display snapshot will be + // gone. + fake_display_controller_->RemoveDisplay(display_id); +} display::ScreenBase* ScreenManagerForwarding::GetScreen() { return screen_.get(); @@ -85,6 +100,12 @@ native_display_delegate_->AddObserver(this); native_display_delegate_->Initialize(); + // FakeDisplayController is only applicable when not running on a CrOS device. + if (!chromeos::IsRunningAsSystemCompositor()) { + fake_display_controller_ = + native_display_delegate_->GetFakeDisplayController(); + } + // Provide the list of display snapshots initially. ForwardingDisplayDelegate // will wait synchronously for this. native_display_delegate_->GetDisplays( @@ -179,6 +200,31 @@ gamma_lut, correction_matrix); } +void ScreenManagerForwarding::ToggleAddRemoveDisplay() { + if (!fake_display_controller_) + return; + + int num_displays = screen_->GetNumDisplays(); + if (num_displays == 1) { + // If we have one display, add a second display with the same size. + Display primary_display = screen_->GetPrimaryDisplay(); + fake_display_controller_->AddDisplay(primary_display.GetSizeInPixel()); + } else if (num_displays > 1) { + // If we have more than one display, remove the first display we find that + // isn't the primary display. + Display primary_display = screen_->GetPrimaryDisplay(); + for (auto& display : screen_->display_list().displays()) { + if (display.id() != primary_display.id()) { + fake_display_controller_->RemoveDisplay(display.id()); + break; + } + } + } else { + // If we have no displays, add one with a default size. + fake_display_controller_->AddDisplay(gfx::Size(1024, 768)); + } +} + void ScreenManagerForwarding::BindNativeDisplayDelegateRequest( const service_manager::BindSourceInfo& source_info, mojom::NativeDisplayDelegateRequest request) { @@ -186,6 +232,13 @@ binding_.Bind(std::move(request)); } +void ScreenManagerForwarding::BindTestDisplayControllerRequest( + const service_manager::BindSourceInfo& source_info, + mojom::TestDisplayControllerRequest request) { + DCHECK(!test_controller_binding_.is_bound()); + test_controller_binding_.Bind(std::move(request)); +} + void ScreenManagerForwarding::ForwardGetDisplays( const GetDisplaysCallback& callback, const std::vector<DisplaySnapshot*>& snapshots) {
diff --git a/services/ui/display/screen_manager_forwarding.h b/services/ui/display/screen_manager_forwarding.h index 204cc50..40cca54 100644 --- a/services/ui/display/screen_manager_forwarding.h +++ b/services/ui/display/screen_manager_forwarding.h
@@ -6,12 +6,13 @@ #define SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_ #include <memory> -#include <unordered_map> #include <vector> +#include "base/containers/flat_map.h" #include "base/macros.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/ui/display/screen_manager.h" +#include "services/ui/public/interfaces/display/test_display_controller.mojom.h" #include "ui/display/mojo/native_display_delegate.mojom.h" #include "ui/display/types/native_display_observer.h" @@ -21,12 +22,14 @@ namespace display { +class FakeDisplayController; class NativeDisplayDelegate; // ScreenManager implementation that implements mojom::NativeDisplayDelegate. // This will own a real NativeDisplayDelegate and forwards calls to and // responses from it over Mojo. class ScreenManagerForwarding : public ScreenManager, + public mojom::TestDisplayController, public NativeDisplayObserver, public mojom::NativeDisplayDelegate { public: @@ -65,10 +68,16 @@ const std::vector<display::GammaRampRGBEntry>& gamma_lut, const std::vector<float>& correction_matrix) override; + // mojom::TestDisplayController: + void ToggleAddRemoveDisplay() override; + private: void BindNativeDisplayDelegateRequest( const service_manager::BindSourceInfo& source_info, mojom::NativeDisplayDelegateRequest request); + void BindTestDisplayControllerRequest( + const service_manager::BindSourceInfo& source_info, + mojom::TestDisplayControllerRequest request); // Forwards results from GetDisplays() back with |callback|. void ForwardGetDisplays(const GetDisplaysCallback& callback, @@ -86,10 +95,16 @@ mojo::Binding<mojom::NativeDisplayDelegate> binding_; mojom::NativeDisplayObserverPtr observer_; + mojo::Binding<mojom::TestDisplayController> test_controller_binding_; + std::unique_ptr<display::NativeDisplayDelegate> native_display_delegate_; // Cached pointers to snapshots owned by the |native_display_delegate_|. - std::unordered_map<int64_t, DisplaySnapshot*> snapshot_map_; + base::flat_map<int64_t, DisplaySnapshot*> snapshot_map_; + + // If not null it provides a way to modify the display state when running off + // device (eg. running mustash on Linux). + FakeDisplayController* fake_display_controller_ = nullptr; DISALLOW_COPY_AND_ASSIGN(ScreenManagerForwarding); };
diff --git a/services/ui/display/screen_manager_ozone_internal.cc b/services/ui/display/screen_manager_ozone_internal.cc index de6e10b..1353802 100644 --- a/services/ui/display/screen_manager_ozone_internal.cc +++ b/services/ui/display/screen_manager_ozone_internal.cc
@@ -201,31 +201,6 @@ } } -void ScreenManagerOzoneInternal::ToggleDisplayResolution() { - if (primary_display_id_ == kInvalidDisplayId) - return; - - // Internal displays don't have alternate resolutions. - if (Display::HasInternalDisplay() && - primary_display_id_ == Display::InternalDisplayId()) - return; - - DVLOG(1) << "ToggleDisplayResolution"; - - const ManagedDisplayInfo& info = - display_manager_->GetDisplayInfo(primary_display_id_); - scoped_refptr<ManagedDisplayMode> mode = - GetDisplayModeForNextResolution(info, true); - - // Loop back to first mode from last. - if (mode->size() == info.bounds_in_native().size()) - mode = info.display_modes()[0]; - - // Set mode only if it's different from current. - if (mode->size() != info.bounds_in_native().size()) - display_manager_->SetDisplayMode(primary_display_id_, mode); -} - void ScreenManagerOzoneInternal::IncreaseInternalDisplayZoom() { if (Display::HasInternalDisplay()) display_manager_->ZoomInternalDisplay(false);
diff --git a/services/ui/display/screen_manager_ozone_internal.h b/services/ui/display/screen_manager_ozone_internal.h index 9b821bd..cb623ad 100644 --- a/services/ui/display/screen_manager_ozone_internal.h +++ b/services/ui/display/screen_manager_ozone_internal.h
@@ -55,7 +55,6 @@ // mojom::TestDisplayController: void ToggleAddRemoveDisplay() override; - void ToggleDisplayResolution() override; // mojom::DisplayController: void IncreaseInternalDisplayZoom() override;
diff --git a/services/ui/public/interfaces/display/test_display_controller.mojom b/services/ui/public/interfaces/display/test_display_controller.mojom index 78c820e..5a1b9adb 100644 --- a/services/ui/public/interfaces/display/test_display_controller.mojom +++ b/services/ui/public/interfaces/display/test_display_controller.mojom
@@ -10,9 +10,6 @@ // Toggles adding or removing a fake display. If there is only one display // a second display is added. If there is more than one display then the last - // display is removed. + // display is removed. ToggleAddRemoveDisplay(); - - // Toggles the primary display resolution size. - ToggleDisplayResolution(); };
diff --git a/services/ui/ws/compositor_frame_sink_client_binding.cc b/services/ui/ws/compositor_frame_sink_client_binding.cc index 4d7e171..4b59d88 100644 --- a/services/ui/ws/compositor_frame_sink_client_binding.cc +++ b/services/ui/ws/compositor_frame_sink_client_binding.cc
@@ -24,7 +24,7 @@ } void CompositorFrameSinkClientBinding::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { if (local_surface_id != local_surface_id_) { local_surface_id_ = local_surface_id;
diff --git a/services/ui/ws/compositor_frame_sink_client_binding.h b/services/ui/ws/compositor_frame_sink_client_binding.h index 76ef6a2..a032d5a 100644 --- a/services/ui/ws/compositor_frame_sink_client_binding.h +++ b/services/ui/ws/compositor_frame_sink_client_binding.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "cc/ipc/compositor_frame_sink.mojom.h" #include "cc/ipc/frame_sink_manager.mojom.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "mojo/public/cpp/bindings/binding.h" namespace ui { @@ -29,7 +29,7 @@ private: // cc::mojom::CompositorFrameSink implementation: - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void SetNeedsBeginFrame(bool needs_begin_frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; @@ -37,8 +37,8 @@ mojo::Binding<cc::mojom::CompositorFrameSinkClient> binding_; cc::mojom::DisplayPrivateAssociatedPtr display_private_; cc::mojom::CompositorFrameSinkAssociatedPtr compositor_frame_sink_; - cc::LocalSurfaceId local_surface_id_; - cc::LocalSurfaceIdAllocator id_allocator_; + viz::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceIdAllocator id_allocator_; gfx::Size last_submitted_frame_size_; DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkClientBinding);
diff --git a/services/ui/ws/display.h b/services/ui/ws/display.h index 9cd3a75c..2276a8c7 100644 --- a/services/ui/ws/display.h +++ b/services/ui/ws/display.h
@@ -14,7 +14,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "services/ui/common/types.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "services/ui/public/interfaces/window_tree_host.mojom.h" @@ -228,7 +228,7 @@ ServerWindowTracker activation_parents_; - cc::LocalSurfaceIdAllocator allocator_; + viz::LocalSurfaceIdAllocator allocator_; WindowManagerDisplayRootMap window_manager_display_root_map_;
diff --git a/services/ui/ws/frame_generator.h b/services/ui/ws/frame_generator.h index 3763149..0c801f9 100644 --- a/services/ui/ws/frame_generator.h +++ b/services/ui/ws/frame_generator.h
@@ -10,9 +10,9 @@ #include "base/macros.h" #include "cc/ipc/compositor_frame_sink.mojom.h" #include "cc/scheduler/begin_frame_source.h" -#include "cc/surfaces/local_surface_id_allocator.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" +#include "components/viz/common/local_surface_id_allocator.h" +#include "components/viz/common/surface_id.h" #include "services/ui/ws/compositor_frame_sink_client_binding.h" #include "ui/gfx/geometry/rect.h" @@ -66,8 +66,8 @@ cc::BeginFrameAck current_begin_frame_ack_; bool high_contrast_mode_enabled_ = false; gfx::Size last_submitted_frame_size_; - cc::LocalSurfaceId local_surface_id_; - cc::LocalSurfaceIdAllocator id_allocator_; + viz::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceIdAllocator id_allocator_; float last_device_scale_factor_ = 0.0f; cc::SurfaceInfo window_manager_surface_info_;
diff --git a/services/ui/ws/frame_generator_unittest.cc b/services/ui/ws/frame_generator_unittest.cc index 88c273f..9cba8f1d 100644 --- a/services/ui/ws/frame_generator_unittest.cc +++ b/services/ui/ws/frame_generator_unittest.cc
@@ -23,9 +23,9 @@ constexpr float kArbitraryScaleFactor = 0.5f; constexpr gfx::Size kArbitrarySize(3, 4); constexpr gfx::Size kAnotherArbitrarySize(5, 6); -const cc::SurfaceId kArbitrarySurfaceId( - cc::FrameSinkId(1, 1), - cc::LocalSurfaceId(1, base::UnguessableToken::Create())); +const viz::SurfaceId kArbitrarySurfaceId( + viz::FrameSinkId(1, 1), + viz::LocalSurfaceId(1, base::UnguessableToken::Create())); const cc::SurfaceInfo kArbitrarySurfaceInfo(kArbitrarySurfaceId, 1.0f, gfx::Size(100, 100)); @@ -41,7 +41,7 @@ ~TestClientBinding() override = default; // cc::mojom::CompositorFrameSink implementation: - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override { ++frames_submitted_; last_frame_ = std::move(frame); @@ -191,7 +191,7 @@ // Verify that the CompositorFrame refers to the window manager's surface via // referenced_surfaces. const cc::CompositorFrameMetadata& last_metadata = LastMetadata(); - const std::vector<cc::SurfaceId>& referenced_surfaces = + const std::vector<viz::SurfaceId>& referenced_surfaces = last_metadata.referenced_surfaces; EXPECT_EQ(1lu, referenced_surfaces.size()); EXPECT_EQ(kArbitrarySurfaceId, referenced_surfaces.front());
diff --git a/services/ui/ws/frame_sink_manager_client_binding.cc b/services/ui/ws/frame_sink_manager_client_binding.cc index d0b2cda..220fe664 100644 --- a/services/ui/ws/frame_sink_manager_client_binding.cc +++ b/services/ui/ws/frame_sink_manager_client_binding.cc
@@ -22,7 +22,7 @@ FrameSinkManagerClientBinding::~FrameSinkManagerClientBinding() = default; void FrameSinkManagerClientBinding::CreateRootCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -35,7 +35,7 @@ } void FrameSinkManagerClientBinding::CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client) { @@ -45,21 +45,21 @@ } void FrameSinkManagerClientBinding::RegisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) { frame_sink_manager_->RegisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } void FrameSinkManagerClientBinding::UnregisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) { + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) { frame_sink_manager_->UnregisterFrameSinkHierarchy(parent_frame_sink_id, child_frame_sink_id); } void FrameSinkManagerClientBinding::DropTemporaryReference( - const cc::SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { frame_sink_manager_->DropTemporaryReference(surface_id); }
diff --git a/services/ui/ws/frame_sink_manager_client_binding.h b/services/ui/ws/frame_sink_manager_client_binding.h index d951153..22de990 100644 --- a/services/ui/ws/frame_sink_manager_client_binding.h +++ b/services/ui/ws/frame_sink_manager_client_binding.h
@@ -29,7 +29,7 @@ private: // cc::mojom::FrameSinkManager: void CreateRootCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, gpu::SurfaceHandle surface_handle, cc::mojom::CompositorFrameSinkAssociatedRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, @@ -37,17 +37,17 @@ cc::mojom::DisplayPrivateAssociatedRequest display_private_request) override; void CreateCompositorFrameSink( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, cc::mojom::CompositorFrameSinkRequest request, cc::mojom::CompositorFrameSinkPrivateRequest private_request, cc::mojom::CompositorFrameSinkClientPtr client) override; void RegisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) override; + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) override; void UnregisterFrameSinkHierarchy( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& child_frame_sink_id) override; - void DropTemporaryReference(const cc::SurfaceId& surface_id) override; + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) override; + void DropTemporaryReference(const viz::SurfaceId& surface_id) override; mojo::Binding<cc::mojom::FrameSinkManagerClient> frame_sink_manager_client_binding_;
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc index 889f5a7..0d417eaf 100644 --- a/services/ui/ws/server_window.cc +++ b/services/ui/ws/server_window.cc
@@ -175,7 +175,7 @@ void ServerWindow::SetBounds( const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { if (bounds_ == bounds && current_local_surface_id_ == local_surface_id) return;
diff --git a/services/ui/ws/server_window.h b/services/ui/ws/server_window.h index 10fb18dc..fc1d0c3 100644 --- a/services/ui/ws/server_window.h +++ b/services/ui/ws/server_window.h
@@ -73,9 +73,9 @@ const WindowId& id() const { return id_; } - const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } + const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } - const base::Optional<cc::LocalSurfaceId>& current_local_surface_id() const { + const base::Optional<viz::LocalSurfaceId>& current_local_surface_id() const { return current_local_surface_id_; } @@ -89,7 +89,7 @@ // Sets the bounds. If the size changes this implicitly resets the client // area to fill the whole bounds. void SetBounds(const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id = + const base::Optional<viz::LocalSurfaceId>& local_surface_id = base::nullopt); const std::vector<gfx::Rect>& additional_client_areas() const { @@ -239,8 +239,8 @@ ServerWindowDelegate* delegate_; const WindowId id_; - cc::FrameSinkId frame_sink_id_; - base::Optional<cc::LocalSurfaceId> current_local_surface_id_; + viz::FrameSinkId frame_sink_id_; + base::Optional<viz::LocalSurfaceId> current_local_surface_id_; ServerWindow* parent_; Windows children_;
diff --git a/services/ui/ws/server_window_compositor_frame_sink_manager.cc b/services/ui/ws/server_window_compositor_frame_sink_manager.cc index caec9a8c..9e442a3 100644 --- a/services/ui/ws/server_window_compositor_frame_sink_manager.cc +++ b/services/ui/ws/server_window_compositor_frame_sink_manager.cc
@@ -55,7 +55,7 @@ } void ServerWindowCompositorFrameSinkManager::ClaimTemporaryReference( - const cc::SurfaceId& surface_id) { + const viz::SurfaceId& surface_id) { if (!compositor_frame_sink_.is_bound()) { pending_compositor_frame_sink_request_ = mojo::MakeRequest(&compositor_frame_sink_);
diff --git a/services/ui/ws/server_window_compositor_frame_sink_manager.h b/services/ui/ws/server_window_compositor_frame_sink_manager.h index 5c7ba94..47cd74be 100644 --- a/services/ui/ws/server_window_compositor_frame_sink_manager.h +++ b/services/ui/ws/server_window_compositor_frame_sink_manager.h
@@ -9,7 +9,7 @@ #include "cc/ipc/compositor_frame.mojom.h" #include "cc/ipc/frame_sink_manager.mojom.h" #include "cc/output/context_provider.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/ui/public/interfaces/window_tree.mojom.h" @@ -39,7 +39,7 @@ // Claims this FrameSinkId will embed |surface_id| so it should own the // temporary reference to |surface_id|. - void ClaimTemporaryReference(const cc::SurfaceId& surface_id); + void ClaimTemporaryReference(const viz::SurfaceId& surface_id); private: ServerWindow* const window_;
diff --git a/services/ui/ws/test_change_tracker.cc b/services/ui/ws/test_change_tracker.cc index ac992ec..4371e5cf 100644 --- a/services/ui/ws/test_change_tracker.cc +++ b/services/ui/ws/test_change_tracker.cc
@@ -265,7 +265,7 @@ Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { Change change; change.type = CHANGE_TYPE_NODE_BOUNDS_CHANGED; change.window_id = window_id; @@ -318,7 +318,7 @@ void TestChangeTracker::OnFrameSinkIdAllocated( Id window_id, - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { Change change; change.type = CHANGE_TYPE_FRAME_SINK_ID_ALLOCATED; change.window_id = window_id;
diff --git a/services/ui/ws/test_change_tracker.h b/services/ui/ws/test_change_tracker.h index 6cc1d007..ef10ede 100644 --- a/services/ui/ws/test_change_tracker.h +++ b/services/ui/ws/test_change_tracker.h
@@ -80,8 +80,8 @@ Id window_id3; gfx::Rect bounds; gfx::Rect bounds2; - cc::FrameSinkId frame_sink_id; - base::Optional<cc::LocalSurfaceId> local_surface_id; + viz::FrameSinkId frame_sink_id; + base::Optional<viz::LocalSurfaceId> local_surface_id; int32_t event_action; bool matches_pointer_watcher; std::string embed_url; @@ -92,7 +92,7 @@ std::string property_value; ui::CursorType cursor_type; uint32_t change_id; - cc::SurfaceId surface_id; + viz::SurfaceId surface_id; gfx::Size frame_size; float device_scale_factor; gfx::Transform transform; @@ -151,14 +151,14 @@ void OnUnembed(Id window_id); void OnCaptureChanged(Id new_capture_window_id, Id old_capture_window_id); void OnFrameSinkIdAllocated(Id window_id, - const cc::FrameSinkId& frame_sink_id); + const viz::FrameSinkId& frame_sink_id); void OnTransientWindowAdded(Id window_id, Id transient_window_id); void OnTransientWindowRemoved(Id window_id, Id transient_window_id); void OnWindowBoundsChanged( Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); void OnWindowTransformChanged(Id window_id); void OnWindowHierarchyChanged(Id window_id, Id old_parent_id,
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc index 0a96497..8d9bafa9 100644 --- a/services/ui/ws/test_utils.cc +++ b/services/ui/ws/test_utils.cc
@@ -232,7 +232,7 @@ const display::Display& display, ui::mojom::WindowDataPtr root, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { display_added_count_++; } @@ -311,7 +311,7 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { // TODO(sky): add test coverage of |focused_window_id|. tracker_.OnEmbed(client_id, std::move(root), drawn); } @@ -331,7 +331,7 @@ void TestWindowTreeClient::OnFrameSinkIdAllocated( Id window_id, - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { tracker_.OnFrameSinkIdAllocated(window_id, frame_sink_id); } @@ -340,7 +340,7 @@ mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { tracker_.OnTopLevelCreated(change_id, std::move(data), drawn); } @@ -348,7 +348,7 @@ uint32_t window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { tracker_.OnWindowBoundsChanged(window, std::move(old_bounds), std::move(new_bounds), local_surface_id); }
diff --git a/services/ui/ws/test_utils.h b/services/ui/ws/test_utils.h index 1734541..633fefb 100644 --- a/services/ui/ws/test_utils.h +++ b/services/ui/ws/test_utils.h
@@ -355,7 +355,7 @@ const display::Display& display, ui::mojom::WindowDataPtr root, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void WmDisplayRemoved(int64_t display_id) override; void WmDisplayModified(const display::Display& display) override {} void WmSetBounds(uint32_t change_id, @@ -438,24 +438,24 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnEmbeddedAppDisconnected(uint32_t window) override; void OnUnembed(Id window_id) override; void OnCaptureChanged(Id new_capture_window_id, Id old_capture_window_id) override; void OnFrameSinkIdAllocated(Id window_id, - const cc::FrameSinkId& frame_sink_id) override; + const viz::FrameSinkId& frame_sink_id) override; void OnTopLevelCreated( uint32_t change_id, mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnWindowBoundsChanged( uint32_t window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnWindowTransformChanged(uint32_t window, const gfx::Transform& old_transform, const gfx::Transform& new_transform) override;
diff --git a/services/ui/ws/window_manager_display_root.h b/services/ui/ws/window_manager_display_root.h index a0a9b28..c53d0ee 100644 --- a/services/ui/ws/window_manager_display_root.h +++ b/services/ui/ws/window_manager_display_root.h
@@ -10,7 +10,7 @@ #include <memory> #include "base/macros.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" namespace ui { namespace ws { @@ -64,7 +64,7 @@ // the root ServerWindow of the Display. std::unique_ptr<ServerWindow> root_; WindowManagerState* window_manager_state_ = nullptr; - cc::LocalSurfaceIdAllocator allocator_; + viz::LocalSurfaceIdAllocator allocator_; DISALLOW_COPY_AND_ASSIGN(WindowManagerDisplayRoot); };
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc index 2bd8b322..cb26903 100644 --- a/services/ui/ws/window_server.cc +++ b/services/ui/ws/window_server.cc
@@ -386,7 +386,7 @@ const ServerWindow* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { for (auto& pair : tree_map_) { pair.second->ProcessWindowBoundsChanged(window, old_bounds, new_bounds, IsOperationSource(pair.first), @@ -654,7 +654,7 @@ } void WindowServer::HandleTemporaryReferenceForNewSurface( - const cc::SurfaceId& surface_id, + const viz::SurfaceId& surface_id, ServerWindow* window) { // TODO(kylechar): Investigate adding tests for this. const ClientSpecificId window_client_id = window->id().client_id; @@ -900,7 +900,7 @@ } void WindowServer::OnClientConnectionClosed( - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { // TODO(kylechar): Notify observers }
diff --git a/services/ui/ws/window_server.h b/services/ui/ws/window_server.h index 667fc22c..090948a 100644 --- a/services/ui/ws/window_server.h +++ b/services/ui/ws/window_server.h
@@ -186,7 +186,7 @@ const ServerWindow* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); void ProcessWindowTransformChanged(const ServerWindow* window, const gfx::Transform& old_transform, const gfx::Transform& new_transform); @@ -307,7 +307,7 @@ // of the temporary reference. If no parent client is found then tell GPU to // immediately drop the temporary reference. |window| is the ServerWindow // that corresponds to |surface_id|. - void HandleTemporaryReferenceForNewSurface(const cc::SurfaceId& surface_id, + void HandleTemporaryReferenceForNewSurface(const viz::SurfaceId& surface_id, ServerWindow* window); // Overridden from ServerWindowDelegate: @@ -359,7 +359,7 @@ // cc::mojom::FrameSinkManagerClient: void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; - void OnClientConnectionClosed(const cc::FrameSinkId& frame_sink_id) override; + void OnClientConnectionClosed(const viz::FrameSinkId& frame_sink_id) override; // UserIdTrackerObserver: void OnActiveUserIdChanged(const UserId& previously_active_id, @@ -403,7 +403,7 @@ WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; - cc::SurfaceId root_surface_id_; + viz::SurfaceId root_surface_id_; // Provides interfaces to create and manage FrameSinks. std::unique_ptr<cc::mojom::FrameSinkManager> frame_sink_manager_;
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc index 4a503e1..319fbee 100644 --- a/services/ui/ws/window_tree.cc +++ b/services/ui/ws/window_tree.cc
@@ -722,7 +722,7 @@ const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, bool originated_change, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { ClientWindowId client_window_id; if (originated_change || !IsWindowKnown(window, &client_window_id)) return; @@ -1536,7 +1536,7 @@ uint32_t change_id, Id window_id, const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); if (window && ShouldRouteToWindowManager(window)) { DVLOG(3) << "Redirecting request to change bounds for "
diff --git a/services/ui/ws/window_tree.h b/services/ui/ws/window_tree.h index 841721b9..f63970f 100644 --- a/services/ui/ws/window_tree.h +++ b/services/ui/ws/window_tree.h
@@ -231,7 +231,7 @@ const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, bool originated_change, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); void ProcessWindowTransformChanged(const ServerWindow* window, const gfx::Transform& old_transform, const gfx::Transform& new_transform, @@ -442,7 +442,7 @@ uint32_t change_id, Id window_id, const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void SetWindowTransform(uint32_t change_id, Id window_id, const gfx::Transform& transform) override;
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc index 425d3b56..09e05fab 100644 --- a/services/ui/ws/window_tree_client_unittest.cc +++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -11,7 +11,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/service_manager/public/cpp/binder_registry.h" @@ -280,7 +280,7 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override { // TODO(sky): add coverage of |focused_window_id|. ASSERT_TRUE(root); root_window_id_ = root->window_id; @@ -299,20 +299,20 @@ tracker()->OnCaptureChanged(new_capture_window_id, old_capture_window_id); } void OnFrameSinkIdAllocated(Id window_id, - const cc::FrameSinkId& frame_sink_id) override {} + const viz::FrameSinkId& frame_sink_id) override {} void OnTopLevelCreated( uint32_t change_id, mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override { tracker()->OnTopLevelCreated(change_id, std::move(data), drawn); } void OnWindowBoundsChanged( Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override { // The bounds of the root may change during startup on Android at random // times. As this doesn't matter, and shouldn't impact test exepctations, // it is ignored. @@ -455,7 +455,7 @@ const display::Display& display, mojom::WindowDataPtr root_data, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override { NOTIMPLEMENTED(); } void WmDisplayRemoved(int64_t display_id) override { NOTIMPLEMENTED(); } @@ -1354,8 +1354,8 @@ wt_client2_->set_track_root_bounds_changes(true); - cc::LocalSurfaceIdAllocator allocator; - cc::LocalSurfaceId local_surface_id = allocator.GenerateId(); + viz::LocalSurfaceIdAllocator allocator; + viz::LocalSurfaceId local_surface_id = allocator.GenerateId(); wt1()->SetWindowBounds(10, window_1_1, gfx::Rect(0, 0, 100, 100), local_surface_id); ASSERT_TRUE(wt_client1()->WaitForChangeCompleted(10)); @@ -2212,7 +2212,7 @@ compositor_frame.metadata.device_scale_factor = 1.f; compositor_frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); - cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); surface_ptr->SubmitCompositorFrame(local_surface_id, std::move(compositor_frame)); } @@ -2250,7 +2250,7 @@ compositor_frame.metadata.device_scale_factor = 1.f; compositor_frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); - cc::LocalSurfaceId local_surface_id(2, base::UnguessableToken::Create()); + viz::LocalSurfaceId local_surface_id(2, base::UnguessableToken::Create()); surface_ptr->SubmitCompositorFrame(local_surface_id, std::move(compositor_frame)); }
diff --git a/services/video_capture/device_media_to_mojo_adapter.cc b/services/video_capture/device_media_to_mojo_adapter.cc index a55d93d..25d6d1f 100644 --- a/services/video_capture/device_media_to_mojo_adapter.cc +++ b/services/video_capture/device_media_to_mojo_adapter.cc
@@ -19,13 +19,6 @@ // those frames get dropped. static const int kMaxBufferCount = 3; -void RunSuccessfulGetPhotoStateCallback( - video_capture::mojom::Device::GetPhotoStateCallback callback, - scoped_refptr<base::SingleThreadTaskRunner> task_runner, - media::mojom::PhotoStatePtr result) { - task_runner->PostTask(FROM_HERE, base::Bind(callback, base::Passed(&result))); -} - void RunFailedGetPhotoStateCallback( base::Callback<void(media::mojom::PhotoStatePtr)> cb) { cb.Run(nullptr); @@ -35,13 +28,6 @@ cb.Run(false); } -void RunSuccessfulTakePhotoCallback( - video_capture::mojom::Device::TakePhotoCallback callback, - scoped_refptr<base::SingleThreadTaskRunner> task_runner, - media::mojom::BlobPtr blob) { - task_runner->PostTask(FROM_HERE, base::Bind(callback, base::Passed(&blob))); -} - void RunFailedTakePhotoCallback( base::Callback<void(media::mojom::BlobPtr blob)> cb) { cb.Run(nullptr); @@ -129,10 +115,7 @@ void DeviceMediaToMojoAdapter::GetPhotoState( const GetPhotoStateCallback& callback) { media::VideoCaptureDevice::GetPhotoStateCallback scoped_callback( - // Cannot use BindToCurrentLoop() here, because it does not support - // callbacks with unbound move-only parameters. - base::Bind(&RunSuccessfulGetPhotoStateCallback, std::move(callback), - base::ThreadTaskRunnerHandle::Get()), + media::BindToCurrentLoop(callback), media::BindToCurrentLoop(base::Bind(&RunFailedGetPhotoStateCallback))); device_->GetPhotoState(std::move(scoped_callback)); } @@ -150,10 +133,7 @@ void DeviceMediaToMojoAdapter::TakePhoto(const TakePhotoCallback& callback) { media::ScopedResultCallback<media::mojom::ImageCapture::TakePhotoCallback> scoped_callback( - // Cannot use BindToCurrentLoop() here, because it does not support - // callbacks with unbound move-only parameters. - base::Bind(&RunSuccessfulTakePhotoCallback, std::move(callback), - base::ThreadTaskRunnerHandle::Get()), + media::BindToCurrentLoop(callback), media::BindToCurrentLoop(base::Bind(&RunFailedTakePhotoCallback))); device_->TakePhoto(std::move(scoped_callback)); }
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 6d1edca..2f5fc2bbc 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -232,6 +232,10 @@ #define SK_SUPPORT_LEGACY_MASK_BLUR #endif +#ifndef SK_SUPPORT_LEGACY_RECT +#define SK_SUPPORT_LEGACY_RECT +#endif + ///////////////////////// Imported from BUILD.gn and skia_common.gypi /* In some places Skia can use static initializers for global initialization,
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index f5ebb724..52d4113 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -10817,7 +10817,8 @@ }, "Fuchsia": { "additional_compile_targets": [ - "d8" + "d8", + "net_unittests" ], "gtest_tests": [ { @@ -10842,7 +10843,8 @@ }, "Fuchsia (dbg)": { "additional_compile_targets": [ - "d8" + "d8", + "net_unittests" ], "gtest_tests": [ {
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index 8b2bf384..ff8d6d7 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -30325,7 +30325,5132 @@ ] }, "Linux Perf": { - "isolated_scripts": [] + "isolated_scripts": [ + { + "args": [ + "battor.steady_state", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "battor.steady_state", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "battor.steady_state", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "battor.steady_state.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "battor.trivial_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "battor.trivial_pages", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "battor.trivial_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "battor.trivial_pages.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.bindings", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.bindings", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.bindings", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.bindings.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.canvas", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.canvas", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.canvas", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.canvas.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.css", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.css", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.css", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.css.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.dom", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.dom", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.dom", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.dom.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.events", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.events", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.events", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.events.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.layout", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.layout", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.layout", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.layout.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.paint", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.paint", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.paint", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.paint.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.parser", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.parser", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.parser", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.parser.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.shadow_dom", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.shadow_dom", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.shadow_dom", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.shadow_dom.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.svg", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.svg", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blink_perf.svg", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.svg.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "blob_storage.blob_storage", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blob_storage.blob_storage", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "blob_storage.blob_storage", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blob_storage.blob_storage.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoreattr", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoreattr", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoreattr", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoreattr.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoremodify", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoremodify", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoremodify", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoremodify.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcorequery", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcorequery", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcorequery", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcorequery.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoretraverse", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoretraverse", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dromaeo.domcoretraverse", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dromaeo.domcoretraverse.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dummy_benchmark.noisy_benchmark_1", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dummy_benchmark.noisy_benchmark_1", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dummy_benchmark.noisy_benchmark_1", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dummy_benchmark.noisy_benchmark_1.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "dummy_benchmark.stable_benchmark_1", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dummy_benchmark.stable_benchmark_1", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "dummy_benchmark.stable_benchmark_1", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "dummy_benchmark.stable_benchmark_1.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "image_decoding.image_decoding_measurement", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "image_decoding.image_decoding_measurement", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "image_decoding.image_decoding_measurement", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "image_decoding.image_decoding_measurement.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "jetstream", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "jetstream", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "jetstream", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "jetstream.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "kraken", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "kraken", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "kraken", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "kraken.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [], + "isolate_name": "load_library_perf_tests", + "name": "load_library_perf_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "loading.desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "loading.desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "loading.desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "loading.desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.mse_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.mse_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.mse_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.mse_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.tough_video_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.tough_video_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.tough_video_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.tough_video_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.tough_video_cases_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.tough_video_cases_tbmv2", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "media.tough_video_cases_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "media.tough_video_cases_tbmv2.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [], + "isolate_name": "media_perftests", + "name": "media_perftests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.long_running_idle_gmail_background_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.long_running_idle_gmail_background_tbmv2", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.long_running_idle_gmail_background_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.long_running_idle_gmail_background_tbmv2.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.long_running_idle_gmail_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.long_running_idle_gmail_tbmv2", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "memory.long_running_idle_gmail_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "memory.long_running_idle_gmail_tbmv2.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [], + "isolate_name": "net_perftests", + "name": "net_perftests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "octane", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "octane", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "octane", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "octane.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "oortonline", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "oortonline", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "oortonline", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "oortonline.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "oortonline_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "oortonline_tbmv2", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "oortonline_tbmv2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "oortonline_tbmv2.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "page_cycler_v2.basic_oopif", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "page_cycler_v2.basic_oopif", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "page_cycler_v2.basic_oopif", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "page_cycler_v2.basic_oopif.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "page_cycler_v2_site_isolation.basic_oopif", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "page_cycler_v2_site_isolation.basic_oopif", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "page_cycler_v2_site_isolation.basic_oopif", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "page_cycler_v2_site_isolation.basic_oopif.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "power.idle_platform", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "power.idle_platform", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "power.steady_state", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "power.steady_state", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "power.steady_state", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "power.steady_state.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "power.trivial_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "power.trivial_pages", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "power.trivial_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "power.trivial_pages.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "rasterize_and_record_micro.partial_invalidation", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "rasterize_and_record_micro.partial_invalidation", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "rasterize_and_record_micro.partial_invalidation", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "rasterize_and_record_micro.partial_invalidation.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "rasterize_and_record_micro.top_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "rasterize_and_record_micro.top_25", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "rasterize_and_record_micro.top_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "rasterize_and_record_micro.top_25.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "scheduler.tough_scheduling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "scheduler.tough_scheduling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "service_worker.service_worker", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "service_worker.service_worker", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "service_worker.service_worker", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "service_worker.service_worker.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "service_worker.service_worker_micro_benchmark", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "service_worker.service_worker_micro_benchmark", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "service_worker.service_worker_micro_benchmark", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "service_worker.service_worker_micro_benchmark.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.desktop_tough_pinch_zoom_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "smoothness.desktop_tough_pinch_zoom_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.desktop_tough_pinch_zoom_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization.tough_filters_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization.tough_filters_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization.tough_path_rendering_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization.tough_path_rendering_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.gpu_rasterization_and_decoding.image_decoding_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.image_decoding_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.image_decoding_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.key_desktop_move_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.key_desktop_move_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.maps", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.maps", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.scrolling_tough_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "smoothness.scrolling_tough_ad_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.scrolling_tough_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "smoothness.scrolling_tough_ad_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.top_25_smooth", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.top_25_smooth", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_animation_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_animation_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_canvas_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_canvas_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_filters_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_filters_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_image_decode_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_image_decode_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_path_rendering_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_path_rendering_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_scrolling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_scrolling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_texture_upload_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_texture_upload_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_webgl_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_webgl_ad_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_webgl_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "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:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "smoothness.tough_webgl_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--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:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "speedometer", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "speedometer", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "speedometer", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "speedometer.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "speedometer2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "speedometer2", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "speedometer2", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "speedometer2.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_ext.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_ext.cold.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_ext.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_ext.cold.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_ext.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_ext.warm.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_ext.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_ext.warm.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_url.cold.startup_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_url.cold.startup_pages", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_url.cold.startup_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_url.cold.startup_pages.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_url.warm.startup_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_url.warm.startup_pages", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "start_with_url.warm.startup_pages", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "start_with_url.warm.startup_pages.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.cold.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.cold.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.large_profile.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.large_profile.cold.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.large_profile.cold.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.large_profile.cold.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.large_profile.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.large_profile.warm.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.large_profile.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.large_profile.warm.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.warm.blank_page", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "startup.warm.blank_page", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "startup.warm.blank_page.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "storage.indexeddb_endure", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "storage.indexeddb_endure", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "storage.indexeddb_endure", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "storage.indexeddb_endure.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "storage.indexeddb_endure_tracing", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "storage.indexeddb_endure_tracing", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "storage.indexeddb_endure_tracing", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "storage.indexeddb_endure_tracing.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.common_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.common_desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.common_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.common_desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.memory_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.memory_desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.memory_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.memory_desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.webview_startup", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.webview_startup", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "system_health.webview_startup", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "system_health.webview_startup.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build152-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "tab_switching.typical_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tab_switching.typical_25", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "tab_switching.typical_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tab_switching.typical_25.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "thread_times.tough_compositor_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "thread_times.tough_compositor_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "thread_times.tough_compositor_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "thread_times.tough_compositor_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "thread_times.tough_scrolling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "thread_times.tough_scrolling_cases", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "thread_times.tough_scrolling_cases", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "thread_times.tough_scrolling_cases.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "tracing.tracing_with_background_memory_infra", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tracing.tracing_with_background_memory_infra", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "tracing.tracing_with_background_memory_infra", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tracing.tracing_with_background_memory_infra.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "tracing.tracing_with_debug_overhead", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tracing.tracing_with_debug_overhead", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "tracing.tracing_with_debug_overhead", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "tracing.tracing_with_debug_overhead.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build148-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [], + "isolate_name": "tracing_perftests", + "name": "tracing_perftests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build150-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.browsing_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.browsing_desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.browsing_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.browsing_desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.detached_context_age_in_gc", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.detached_context_age_in_gc", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.detached_context_age_in_gc", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.detached_context_age_in_gc.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.runtime_stats.top_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.runtime_stats.top_25", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.runtime_stats.top_25", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.runtime_stats.top_25.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.runtimestats.browsing_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.runtimestats.browsing_desktop", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "v8.runtimestats.browsing_desktop", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "v8.runtimestats.browsing_desktop.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build151-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + }, + { + "args": [ + "webrtc", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=release" + ], + "isolate_name": "telemetry_perf_tests", + "name": "webrtc", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 3600 + } + }, + { + "args": [ + "webrtc", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=reference", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "webrtc.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 3600 + } + } + ] }, "Mac 10.11 Perf": { "isolated_scripts": [
diff --git a/testing/buildbot/filters/ash_unittests_mash.filter b/testing/buildbot/filters/ash_unittests_mash.filter index 29ff5d0..6ff02fb 100644 --- a/testing/buildbot/filters/ash_unittests_mash.filter +++ b/testing/buildbot/filters/ash_unittests_mash.filter
@@ -1,14 +1,19 @@ # Failures and crashes --AppListPresenterDelegateTest.AppListViewDragHandler --AppListPresenterDelegateTest.AppListViewDragHandlerMaximizeModeFromAllApps --AppListPresenterDelegateTest.AppListViewDragHandlerMaximizeModeFromSearch --AppListPresenterDelegateTest.BottomShelfAlignmentTextStateTransitions --AppListPresenterDelegateTest.HalfToFullscreenWhenMaximizeModeIsActive --AppListPresenterDelegateTest.MaximizeModeTextStateTransitions --AppListPresenterDelegateTest.PeekingToFullscreenWhenMaximizeModeIsActive --AppListPresenterDelegateTest.SideShelfAlignmentTextStateTransitions --AppListPresenterDelegateTest.TapAndClickOutsideClosesPeekingAppList --AppListPresenterDelegateTest.TapAndClickOutsideClosesHalfAppList +-FullscreenAppListPresenterDelegateTest.AppListViewDragHandler +-FullscreenAppListPresenterDelegateTest.AppListViewDragHandlerMaximizeModeFromSearch +-FullscreenAppListPresenterDelegateTest.BottomShelfAlignmentTextStateTransitions +-FullscreenAppListPresenterDelegateTest.HalfToFullscreenWhenMaximizeModeIsActive +-FullscreenAppListPresenterDelegateTest.KeyPressEnablesSearchBox +-FullscreenAppListPresenterDelegateTest.MaximizeModeTextStateTransitions +-FullscreenAppListPresenterDelegateTest.PeekingToFullscreenWhenMaximizeModeIsActive +-FullscreenAppListPresenterDelegateTest.SideShelfAlignmentTextStateTransitions +-FullscreenAppListPresenterDelegateTest.StateTransitionsByTapAndClickingAppListBodyFromHalf/0 +-FullscreenAppListPresenterDelegateTest.StateTransitionsByTapAndClickingAppListBodyFromHalf/1 +-FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/0 +-FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/1 +-FullscreenAppListPresenterDelegateTest.TapAndClickEnablesSearchBox +-FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesHalfAppList +-FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesPeekingAppList -NativeCursorManagerAshTest.FractionalScale -NativeCursorManagerAshTest.LockCursor -NativeCursorManagerAshTest.SetCursor
diff --git a/testing/buildbot/filters/ash_unittests_mus.filter b/testing/buildbot/filters/ash_unittests_mus.filter index 0849d5e..dec585b 100644 --- a/testing/buildbot/filters/ash_unittests_mus.filter +++ b/testing/buildbot/filters/ash_unittests_mus.filter
@@ -1,7 +1,3 @@ -# TODO: fix these. They fail because ShellPortMash::IsMouseEventsEnabled() isn't -# implemented. http://crbug.com/734808. --ImmersiveFullscreenControllerTest.EndRevealViaGesture - # TODO: fix these. They all timeout. http://crbug.com/734811. -ScreenRotationAnimatorSmoothAnimationTest.OverviewButtonTrayHideAnimationAlwaysCompletes -ScreenRotationAnimatorSmoothAnimationTest.RemoveExternalPrimaryDisplayBeforeSecondCopyCallback
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 973a15dc..bfd707f 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1312,6 +1312,31 @@ ] } ], + "IncognitoWindowPromo": [ + { + "platforms": [ + "linux", + "win" + ], + "experiments": [ + { + "name": "Enabled", + "params": { + "availability": "any", + "event_history_deleted": "name:history_deleted;comparator:>=1;window:3650;storage:3650", + "event_incognito_window_opened": "name:incognito_window_opened;comparator:==0;window:3650;storage:3650", + "event_session_time": "name:session_time;comparator:>=1;window:3650;storage:3650", + "event_trigger": "name:incognito_window_trigger;comparator:any;window:3650;storage:3650", + "event_used": "name:incognito_window_clicked;comparator:any;window:3650;storage:3650", + "session_rate": "<=3" + }, + "enable_features": [ + "IPH_IncognitoWindow" + ] + } + ] + } + ], "InstanceID": [ { "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 747b4af..34e47cfe 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -51,7 +51,7 @@ crbug.com/591099 accessibility/aria-text-role.html [ Failure ] crbug.com/591099 accessibility/aria-toggle-button-with-title.html [ Failure ] crbug.com/591099 accessibility/aria-used-on-image-maps.html [ Failure ] -crbug.com/591099 accessibility/bounds-calc.html [ Crash Failure ] +crbug.com/591099 accessibility/bounds-calc.html [ Crash Failure Pass ] crbug.com/591099 accessibility/br-element-has-correct-title.html [ Failure ] crbug.com/591099 accessibility/button-title-uses-inner-img-alt.html [ Failure ] crbug.com/591099 accessibility/calling-accessibility-methods-with-pending-layout-causes-crash.html [ Failure ] @@ -334,15 +334,7 @@ crbug.com/591099 animations/prefixed/animation-inherit-initial-unprefixed.html [ Failure ] crbug.com/591099 animations/prefixed/keyframes-cssom-prefixed-02.html [ Failure ] crbug.com/591099 animations/prefixed/keyframes-cssom-unprefixed-02.html [ Failure ] -crbug.com/591099 animations/responsive/animations-responsive-to-color-change.html [ Crash Pass ] -crbug.com/591099 animations/responsive/interpolation/d-responsive.html [ Crash Pass ] crbug.com/591099 animations/responsive/interpolation/line-height-responsive.html [ Pass Timeout ] -crbug.com/591099 animations/responsive/interpolation/svg-d-responsive.html [ Crash Pass ] -crbug.com/591099 animations/responsive/interpolation/svg-points-responsive.html [ Crash Pass ] -crbug.com/591099 animations/responsive/interpolation/svg-tableValues-responsive.html [ Crash Pass ] -crbug.com/591099 animations/responsive/interpolation/svg-transform-responsive.html [ Crash Pass ] -crbug.com/591099 animations/responsive/interpolation/svg-x-list-responsive.html [ Crash Pass ] -crbug.com/591099 animations/responsive/svg-responsive-to-timing-updates.html [ Crash Pass ] crbug.com/591099 animations/rotate-transform-equivalent.html [ Failure ] crbug.com/591099 animations/skew-notsequential-compositor.html [ Failure ] crbug.com/591099 animations/stability/animation-end-event-destroy-renderer.html [ Failure ] @@ -507,9 +499,6 @@ crbug.com/591099 animations/svg-attribute-interpolation/svg-xChannelSelector-interpolation.html [ Crash Pass ] crbug.com/591099 animations/svg-attribute-interpolation/svg-y-list-interpolation.html [ Crash Pass ] crbug.com/591099 animations/svg-attribute-interpolation/svg-z-interpolation.html [ Crash Pass ] -crbug.com/591099 animations/svg/clear-svg-animation-effects.html [ Crash Pass ] -crbug.com/591099 animations/svg/css-animation-overrides-svg-presentation-attribute-animation.html [ Crash Pass ] -crbug.com/591099 animations/svg/svg-presentation-attribute-animation.html [ Crash Pass ] crbug.com/591099 animations/timing/timing-model.html [ Pass Timeout ] crbug.com/591099 battery-status/api-defined.html [ Failure ] crbug.com/591099 battery-status/detached-no-crash.html [ Failure ] @@ -617,7 +606,7 @@ crbug.com/591099 compositing/gestures/gesture-tapHighlight-img-transformed.html [ Failure ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-img.html [ Failure Pass ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-overflowing-text-crash.html [ Failure ] -crbug.com/591099 compositing/gestures/gesture-tapHighlight-pixel-rotated-link.html [ Failure ] +crbug.com/591099 compositing/gestures/gesture-tapHighlight-pixel-rotated-link.html [ Failure Pass ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-shadow-tree.html [ Failure Pass ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-with-box-shadow.html [ Failure ] crbug.com/591099 compositing/iframes/become-composited-nested-iframes.html [ Failure ] @@ -714,6 +703,7 @@ crbug.com/591099 compositing/overflow/border-radius-on-grandparent-composited-grandchild.html [ Failure ] crbug.com/591099 compositing/overflow/border-radius-on-parent-composited-grandchild.html [ Failure ] crbug.com/591099 compositing/overflow/border-radius-on-two-ancestors-composited-grandchild.html [ Failure ] +crbug.com/591099 compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor.html [ Failure ] crbug.com/591099 compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ] crbug.com/591099 compositing/overflow/clear-scroll-parent.html [ Failure ] crbug.com/591099 compositing/overflow/clip-descendents.html [ Failure ] @@ -1170,9 +1160,6 @@ crbug.com/591099 css2.1/20110323/table-caption-optional-002.htm [ Failure ] crbug.com/591099 css2.1/20110323/table-height-algorithm-023.htm [ Failure ] crbug.com/591099 css2.1/20110323/table-height-algorithm-024.htm [ Failure ] -crbug.com/591099 css2.1/20110323/text-indent-intrinsic-002.htm [ Failure ] -crbug.com/591099 css2.1/20110323/text-indent-intrinsic-003.htm [ Failure ] -crbug.com/591099 css2.1/20110323/text-indent-intrinsic-004.htm [ Failure ] crbug.com/591099 css2.1/t010403-shand-border-00-c.html [ Failure ] crbug.com/591099 css2.1/t010403-shand-font-00-b.html [ Failure Pass ] crbug.com/591099 css2.1/t010403-shand-font-01-b.html [ Failure Pass ] @@ -1828,7 +1815,7 @@ crbug.com/591099 css3/flexbox/flexbox-baseline.html [ Failure ] crbug.com/591099 css3/flexbox/flexbox-wordwrap.html [ Failure ] crbug.com/591099 css3/flexbox/floated-flexbox.html [ Failure ] -crbug.com/591099 css3/flexbox/floated-flexitem.html [ Failure ] +crbug.com/591099 css3/flexbox/floated-flexitem.html [ Failure Pass ] crbug.com/591099 css3/flexbox/inline-flex-crash.html [ Crash Pass ] crbug.com/591099 css3/flexbox/inline-flex-crash2.html [ Crash Pass ] crbug.com/591099 css3/flexbox/inline-flex.html [ Crash Pass ] @@ -2892,7 +2879,6 @@ crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement02.html [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement03.html [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement04.html [ Crash Pass ] -crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement05.html [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement06.html [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement07.html [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/html/level2/html/HTMLIFrameElement09.html [ Crash Pass ] @@ -3110,12 +3096,9 @@ crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLIFrameElement07.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLIFrameElement08.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLIFrameElement09.xhtml [ Crash Pass ] -crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLIFrameElement10.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLIFrameElement11.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement03.xhtml [ Crash Pass ] -crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement04.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement05.xhtml [ Crash Pass ] -crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement07.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement09.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement12.xhtml [ Crash Pass ] crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLObjectElement01.xhtml [ Crash Pass ] @@ -4188,39 +4171,6 @@ crbug.com/591099 external/wpt/content-security-policy/svg/svg-policy-resource-doc-includes.html [ Crash Pass ] crbug.com/591099 external/wpt/content-security-policy/svg/svg-policy-with-resource.html [ Crash Pass ] crbug.com/591099 external/wpt/cors/remote-origin.htm [ Crash Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-001.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-002.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-003.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-tiled-001.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-tiled-002.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-background-image-tiled-003.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-border-image-001.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-border-image-002.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-border-image-003.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-border-image-004.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/geometry-border-image-005.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/paint2d-zoom.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-001.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-002.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-003.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-004.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-005.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-006.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-007.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-008.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-009.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-010.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-011.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-012.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-013.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-014.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-015.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-016.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/parse-input-arguments-017.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/registered-properties-in-custom-paint.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/style-background-image.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/style-before-pseudo.html [ Failure Pass ] -crbug.com/591099 external/wpt/css-paint-api/style-first-letter-pseudo.html [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/abspos/abspos-containing-block-initial-001.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/abspos/abspos-containing-block-initial-009a.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/floats-clear/float-replaced-width-002.xht [ Failure ] @@ -4287,7 +4237,7 @@ crbug.com/591099 external/wpt/css/CSS2/normal-flow/blocks-025.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-non-replaced-height-002.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-valign-001.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure ] +crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-replaced-width-012.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-replaced-width-015.xht [ Failure Pass ] @@ -4369,9 +4319,6 @@ crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-014.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-015.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-indent-012.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/text/text-indent-intrinsic-002.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/text/text-indent-intrinsic-003.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/text/text-indent-intrinsic-004.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-indent-percent-001.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-transform-capitalize-003.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/white-space-mixed-002.xht [ Failure ] @@ -4603,10 +4550,10 @@ crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-015.html [ Failure ] crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-016.html [ Failure ] crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-017.html [ Failure ] -crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-001.html [ Crash Failure ] +crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-001.html [ Crash Failure Pass ] crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-002.html [ Crash Failure ] -crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-003.html [ Crash Failure ] -crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-004.html [ Crash Failure ] +crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-003.html [ Crash Failure Pass ] +crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-004.html [ Crash Failure Pass ] crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-005.html [ Crash Failure ] crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-006.html [ Crash Failure ] crbug.com/591099 external/wpt/css/css-grid-1/alignment/grid-self-alignment-stretch-007.html [ Crash Failure ] @@ -5010,6 +4957,7 @@ crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-013.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-019.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-024.xht [ Failure ] +crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-025.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-026.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-plaintext-004.html [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/border-vlr-007.xht [ Failure Pass ] @@ -5673,7 +5621,6 @@ crbug.com/591099 external/wpt/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html [ Crash Pass ] crbug.com/591099 external/wpt/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html [ Crash Pass ] crbug.com/591099 external/wpt/http/basic-auth-cache-test.html [ Crash Timeout ] -crbug.com/591099 external/wpt/http/content_length.html [ Crash Pass ] crbug.com/591099 external/wpt/innerText/getter.html [ Crash Failure ] crbug.com/591099 external/wpt/input-events/input-events-typing-data-manual.html [ Crash Pass ] crbug.com/591099 external/wpt/intersection-observer/client-rect.html [ Crash Pass ] @@ -5704,7 +5651,7 @@ crbug.com/591099 external/wpt/media-source/mediasource-config-change-webm-v-bitrate.html [ Crash Pass ] crbug.com/591099 external/wpt/media-source/mediasource-config-change-webm-v-framerate.html [ Crash Pass ] crbug.com/591099 external/wpt/media-source/mediasource-config-change-webm-v-framesize.html [ Crash Pass ] -crbug.com/591099 external/wpt/media-source/mediasource-detach.html [ Crash Pass ] +crbug.com/591099 external/wpt/media-source/mediasource-detach.html [ Crash Failure Pass ] crbug.com/591099 external/wpt/media-source/mediasource-duration-boundaryconditions.html [ Crash Pass ] crbug.com/591099 external/wpt/media-source/mediasource-duration.html [ Crash Pass ] crbug.com/591099 external/wpt/media-source/mediasource-endofstream-invaliderror.html [ Crash Pass ] @@ -7069,6 +7016,7 @@ crbug.com/591099 fast/borders/border-radius-split-inline.html [ Failure Pass ] crbug.com/591099 fast/borders/border-radius-wide-border-01.html [ Failure ] crbug.com/591099 fast/borders/border-styles-split.html [ Failure ] +crbug.com/591099 fast/borders/border-width-below-1.html [ Failure ] crbug.com/591099 fast/borders/border-width-percent.html [ Failure ] crbug.com/591099 fast/borders/borderRadiusAllStylesAllCorners.html [ Failure Pass ] crbug.com/591099 fast/borders/different-color-borders.html [ Failure ] @@ -7258,6 +7206,7 @@ crbug.com/591099 fast/canvas/canvas-text-baseline-tiny-fonts.html [ Failure Pass ] crbug.com/591099 fast/canvas/canvas-text-space-characters.html [ Crash Pass ] crbug.com/591099 fast/canvas/canvas-textMetrics-width.html [ Failure ] +crbug.com/591099 fast/canvas/canvas-toDataURL-webp.html [ Failure ] crbug.com/591099 fast/canvas/canvas-transforms-during-path.html [ Failure ] crbug.com/591099 fast/canvas/canvas-transforms-fillRect-shadow.html [ Crash Pass ] crbug.com/591099 fast/canvas/currentTransform-null.html [ Failure ] @@ -7651,7 +7600,7 @@ crbug.com/591099 fast/css-grid-layout/should-not-collapse-anonymous-blocks.html [ Failure ] crbug.com/591099 fast/css-grid-layout/stale-grid-layout.html [ Failure Pass ] crbug.com/591099 fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html [ Failure ] -crbug.com/591099 fast/css-intrinsic-dimensions/fill-available-with-zero-width.html [ Crash Failure ] +crbug.com/591099 fast/css-intrinsic-dimensions/fill-available-with-zero-width.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/fillavailable-minmax-content-inlinesize-contribution-nonreplaced-blocks.html [ Crash Failure ] crbug.com/591099 fast/css-intrinsic-dimensions/fit-content-container-with-replaced-child.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/fitcontent-minmax-content-inlinesize-contribution-nonreplaced-blocks.html [ Crash Failure ] @@ -7665,12 +7614,12 @@ crbug.com/591099 fast/css-intrinsic-dimensions/indefinite-percent-minmax-content-inlinesize-contribution-nonreplaced-blocks.html [ Failure ] crbug.com/591099 fast/css-intrinsic-dimensions/intrinsic-sized-blocks.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/max-width-constrained.html [ Crash Failure Pass ] -crbug.com/591099 fast/css-intrinsic-dimensions/max-width-unconstrained.html [ Crash Failure ] +crbug.com/591099 fast/css-intrinsic-dimensions/max-width-unconstrained.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/maxcontent-minmax-content-inlinesize-contribution-nonreplaced-blocks.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/min-width.html [ Crash Failure ] crbug.com/591099 fast/css-intrinsic-dimensions/mincontent-minmax-content-inlinesize-contribution-nonreplaced-blocks.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/resize-inside-percent-width-overflow-hidden.html [ Failure ] -crbug.com/591099 fast/css-intrinsic-dimensions/width-avoid-floats.html [ Crash Failure ] +crbug.com/591099 fast/css-intrinsic-dimensions/width-avoid-floats.html [ Crash Failure Pass ] crbug.com/591099 fast/css-intrinsic-dimensions/width-property-value.html [ Failure ] crbug.com/591099 fast/css-intrinsic-dimensions/width.html [ Crash Failure ] crbug.com/591099 fast/css/001.html [ Crash Failure ] @@ -9991,7 +9940,7 @@ crbug.com/591099 fast/events/keypress-focus-change.html [ Failure ] crbug.com/591099 fast/events/keypress-removed-node.html [ Crash Failure ] crbug.com/591099 fast/events/main-world-does-not-override-keystate.html [ Failure ] -crbug.com/591099 fast/events/max-tabindex-focus.html [ Crash Pass ] +crbug.com/591099 fast/events/max-tabindex-focus.html [ Crash Pass Timeout ] crbug.com/591099 fast/events/media-element-focus-tab.html [ Failure ] crbug.com/591099 fast/events/media-focus-in-standalone-media-document.html [ Crash Pass ] crbug.com/591099 fast/events/menu-key-context-menu-document-pinch-zoom.html [ Failure ] @@ -11770,12 +11719,12 @@ crbug.com/591099 fast/html/tab-order.html [ Crash Failure ] crbug.com/591099 fast/html/tabindex-nonfocusable.html [ Crash Pass ] crbug.com/591099 fast/html/unknown-tag.html [ Crash Failure ] -crbug.com/591099 fast/inline-block/001.html [ Failure ] +crbug.com/591099 fast/inline-block/001.html [ Failure Pass ] crbug.com/591099 fast/inline-block/002.html [ Failure ] crbug.com/591099 fast/inline-block/003.html [ Failure ] crbug.com/591099 fast/inline-block/004.html [ Failure ] crbug.com/591099 fast/inline-block/005.html [ Failure ] -crbug.com/591099 fast/inline-block/006.html [ Failure ] +crbug.com/591099 fast/inline-block/006.html [ Failure Pass ] crbug.com/591099 fast/inline-block/14498-positionForCoordinates.html [ Failure ] crbug.com/591099 fast/inline-block/baseline-vertical.html [ Failure ] crbug.com/591099 fast/inline-block/contenteditable-baseline.html [ Failure ] @@ -12751,7 +12700,7 @@ crbug.com/591099 fast/overflow/overflow-rtl.html [ Crash Failure ] crbug.com/591099 fast/overflow/overflow-stacking.html [ Failure ] crbug.com/591099 fast/overflow/overflow-update-transform.html [ Failure ] -crbug.com/591099 fast/overflow/overflow-visible-should-ignore-scroll.html [ Failure ] +crbug.com/591099 fast/overflow/overflow-visible-should-ignore-scroll.html [ Failure Pass ] crbug.com/591099 fast/overflow/overflow-with-local-background-attachment.html [ Crash Failure ] crbug.com/591099 fast/overflow/overflow-x-y.html [ Crash Failure ] crbug.com/591099 fast/overflow/overflow-y-scroll.html [ Failure ] @@ -13367,6 +13316,7 @@ crbug.com/591099 fast/table/add-before-anonymous-child.html [ Failure ] crbug.com/591099 fast/table/add-cell-with-large-border.html [ Failure ] crbug.com/591099 fast/table/align-right-within-left-aligned-div.html [ Failure Pass ] +crbug.com/591099 fast/table/anonymous-table-no-baseline-align.html [ Failure ] crbug.com/591099 fast/table/append-cells.html [ Failure ] crbug.com/591099 fast/table/append-cells2.html [ Failure ] crbug.com/591099 fast/table/assert-autotablelayout-maxlogicalwidth.html [ Failure ] @@ -14490,41 +14440,26 @@ crbug.com/591099 http/tests/appcache/404-manifest.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/404-resource-cross-origin.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/404-resource.html [ Crash Failure ] -crbug.com/591099 http/tests/appcache/abort-cache-onchecking-manifest-404.html [ Crash ] -crbug.com/591099 http/tests/appcache/abort-cache-onchecking-resource-404.html [ Crash ] -crbug.com/591099 http/tests/appcache/abort-cache-onchecking.html [ Crash Pass ] -crbug.com/591099 http/tests/appcache/abort-cache-ondownloading-resource-404.html [ Crash Pass ] -crbug.com/591099 http/tests/appcache/abort-cache-ondownloading.html [ Crash Pass ] -crbug.com/591099 http/tests/appcache/abort-cache-onprogress.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/access-via-redirect.php [ Failure ] -crbug.com/591099 http/tests/appcache/crash-when-navigating-away-then-back.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/credential-url.html [ Crash Failure Timeout ] crbug.com/591099 http/tests/appcache/cyrillic-uri.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/deferred-events-delete-while-raising-timer.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/deferred-events-delete-while-raising.html [ Crash Failure ] -crbug.com/591099 http/tests/appcache/deferred-events.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/destroyed-frame.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/detached-iframe.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/different-https-origin-resource-main.html [ Failure ] crbug.com/591099 http/tests/appcache/different-origin-manifest.html [ Failure ] crbug.com/591099 http/tests/appcache/different-scheme.html [ Failure Timeout ] -crbug.com/591099 http/tests/appcache/document-write-html-element-2.html [ Crash ] -crbug.com/591099 http/tests/appcache/document-write-html-element.html [ Crash Pass ] -crbug.com/591099 http/tests/appcache/empty-manifest.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/exceptions.html [ Crash Failure ] -crbug.com/591099 http/tests/appcache/fail-on-update-2.html [ Crash Pass ] -crbug.com/591099 http/tests/appcache/fail-on-update.html [ Crash ] crbug.com/591099 http/tests/appcache/fallback.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/foreign-fallback.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/foreign-iframe-main.html [ Crash Failure Timeout ] -crbug.com/591099 http/tests/appcache/insert-html-element-with-manifest-2.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/local-content.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/main-resource-hash.html [ Crash Failure Timeout ] crbug.com/591099 http/tests/appcache/main-resource-redirect.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/manifest-parsing.html [ Failure ] crbug.com/591099 http/tests/appcache/manifest-redirect-2.html [ Failure ] crbug.com/591099 http/tests/appcache/manifest-redirect.html [ Failure ] -crbug.com/591099 http/tests/appcache/manifest-with-empty-file.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/modified-manifest.html [ Failure ] crbug.com/591099 http/tests/appcache/multi-fallback.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/non-html.xhtml [ Failure ] @@ -14532,12 +14467,10 @@ crbug.com/591099 http/tests/appcache/offline-access.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/online-fallback-layering.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/online-whitelist.html [ Crash Failure ] -crbug.com/591099 http/tests/appcache/progress-counter.html [ Crash Pass ] crbug.com/591099 http/tests/appcache/reload.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/remove-cache.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/resource-redirect-2.html [ Failure ] crbug.com/591099 http/tests/appcache/resource-redirect.html [ Crash Failure ] -crbug.com/591099 http/tests/appcache/simple.html [ Crash ] crbug.com/591099 http/tests/appcache/top-frame-1.html [ Failure ] crbug.com/591099 http/tests/appcache/top-frame-2.html [ Crash Failure Timeout ] crbug.com/591099 http/tests/appcache/top-frame-3.html [ Crash Failure ] @@ -14549,34 +14482,10 @@ crbug.com/591099 http/tests/appcache/wrong-signature-2.html [ Crash Failure ] crbug.com/591099 http/tests/appcache/wrong-signature.html [ Failure ] crbug.com/591099 http/tests/appcache/xhr-foreign-resource.html [ Crash Failure ] -crbug.com/591099 http/tests/background_fetch/background-fetch-fail-event.https.html [ Crash Pass ] -crbug.com/591099 http/tests/background_fetch/background-fetch-manager-fetch.https.html [ Crash Pass ] -crbug.com/591099 http/tests/background_fetch/background-fetch-manager-get.https.html [ Crash Pass ] -crbug.com/591099 http/tests/background_sync/chromium/stop-worker-no-crash.html [ Crash Pass ] -crbug.com/591099 http/tests/background_sync/oneshot-register-failure-worker-not-activated.html [ Crash Pass ] -crbug.com/591099 http/tests/background_sync/permission_denied.html [ Crash ] -crbug.com/591099 http/tests/budget/get-budget-in-service-worker.html [ Crash Pass ] -crbug.com/591099 http/tests/budget/get-budget.html [ Crash ] -crbug.com/591099 http/tests/budget/get-cost-fails-in-service-worker.html [ Crash ] -crbug.com/591099 http/tests/budget/get-cost.html [ Crash Pass ] -crbug.com/591099 http/tests/budget/interfaces-in-service-worker.html [ Crash ] -crbug.com/591099 http/tests/cache/cached-main-resource.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/cancel-multiple-post-xhrs.html [ Crash Pass ] crbug.com/591099 http/tests/cache/content-type-ignored-during-revalidation.html [ Failure ] crbug.com/591099 http/tests/cache/history-only-cached-subresource-loads-max-age-https.html [ Crash Failure ] crbug.com/591099 http/tests/cache/history-only-cached-subresource-loads.html [ Failure ] -crbug.com/591099 http/tests/cache/iframe-304-crash.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/image-with-dpr-header-cached.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/loaded-from-cache-after-reload-within-iframe.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/loaded-from-cache-after-reload.html [ Crash Pass ] crbug.com/591099 http/tests/cache/network-error-during-revalidation.html [ Failure ] -crbug.com/591099 http/tests/cache/post-redirect-get.php [ Crash Pass ] -crbug.com/591099 http/tests/cache/post-with-cached-subresources.php [ Crash Pass ] -crbug.com/591099 http/tests/cache/preload-cleared-after-parsing-canceled-by-js.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/smil-usecounter-in-cached-image.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/subresource-expiration-1.html [ Crash Pass ] -crbug.com/591099 http/tests/cache/subresource-expiration-2.html [ Crash ] -crbug.com/591099 http/tests/cache/subresource-failover-to-network.html [ Crash Pass ] crbug.com/591099 http/tests/cache/subresource-fragment-identifier.html [ Crash Failure ] crbug.com/591099 http/tests/cache/subresource-multiple-instances.html [ Crash Failure ] crbug.com/591099 http/tests/cache/subresource-revalidation-referrer.html [ Failure ] @@ -14584,57 +14493,31 @@ crbug.com/591099 http/tests/cache/xhr-body.html [ Crash Failure ] crbug.com/591099 http/tests/cache/xhr-vary-header.html [ Crash Failure ] crbug.com/591099 http/tests/cache/zero-length-xhr.html [ Failure ] -crbug.com/591099 http/tests/cachestorage/serviceworker/credentials.html [ Crash Pass ] crbug.com/591099 http/tests/canvas/canvas-filter-svg-external-multiple.html [ Crash Failure ] crbug.com/591099 http/tests/canvas/canvas-filter-svg-external.html [ Crash Failure ] -crbug.com/591099 http/tests/canvas/philip/tests/security.drawImage.image.html [ Crash ] -crbug.com/591099 http/tests/canvas/philip/tests/security.pattern.canvas.fillStyle.html [ Crash Pass ] -crbug.com/591099 http/tests/canvas/philip/tests/security.pattern.canvas.timing.html [ Crash Pass ] -crbug.com/591099 http/tests/canvas/philip/tests/security.pattern.cross.html [ Crash Pass ] -crbug.com/591099 http/tests/canvas/philip/tests/security.reset.html [ Crash Pass ] crbug.com/591099 http/tests/canvas/webgl/origin-clean-conformance.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/double-quoted-value-with-semi-colon.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/http-get-cookie-set-in-js.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/js-get-and-set-http-only-cookie.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/js-set-null.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/multiple-cookies.html [ Crash Failure ] -crbug.com/591099 http/tests/cookies/same-site/basics.html [ Crash Pass ] -crbug.com/591099 http/tests/cookies/same-site/popup-cross-site.html [ Crash ] -crbug.com/591099 http/tests/cookies/set-cookie-on-redirect.html [ Crash Pass ] crbug.com/591099 http/tests/cookies/simple-cookies-expired.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/simple-cookies-max-age.html [ Crash Failure ] crbug.com/591099 http/tests/cookies/single-quoted-value.html [ Failure ] -crbug.com/591099 http/tests/credentialmanager/credentialscontainer-create-basics.html [ Crash Pass ] crbug.com/591099 http/tests/credentialmanager/credentialscontainer-frame-errors.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/credentialscontainer-get-basics.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/credentialscontainer-get-warnings.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/credentialscontainer-preventsilentaccess-basics.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/credentialscontainer-requireusermediation-basics.html [ Crash ] -crbug.com/591099 http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/passwordcredential-fetch.html [ Crash Pass ] -crbug.com/591099 http/tests/credentialmanager/passwordcredential-redirect.html [ Crash Pass ] crbug.com/591099 http/tests/css/border-image-loading.html [ Failure ] -crbug.com/591099 http/tests/css/cross-fade-reload.html [ Crash Pass ] crbug.com/591099 http/tests/css/css-image-loading.html [ Crash Failure ] crbug.com/591099 http/tests/css/css-image-valued-shape.html [ Crash Failure ] -crbug.com/591099 http/tests/css/css-imports-redirect-cycle.html [ Crash Pass ] -crbug.com/591099 http/tests/css/css-imports-url-fragment.html [ Crash ] crbug.com/591099 http/tests/css/css-non-blocking.html [ Failure ] -crbug.com/591099 http/tests/css/css-resources-referrer-srcdoc.html [ Crash ] crbug.com/591099 http/tests/css/font-face-src-loading.html [ Failure ] crbug.com/591099 http/tests/css/image-value-cached.html [ Crash Pass ] crbug.com/591099 http/tests/css/mask-image-loading.html [ Crash Failure ] -crbug.com/591099 http/tests/css/missing-repaint-after-slow-style-sheet.pl [ Crash Pass ] -crbug.com/591099 http/tests/css/object-fit-delayed-img-svg.html [ Crash ] crbug.com/591099 http/tests/css/pending-stylesheet-offset-width.html [ Failure ] crbug.com/591099 http/tests/css/performance-info-with-cached-sheet.html [ Failure ] crbug.com/591099 http/tests/css/reflection-mask-image-loading.html [ Failure ] -crbug.com/591099 http/tests/css/remove-blocking-with-loading-import.html [ Crash ] crbug.com/591099 http/tests/css/shape-image-file.html [ Failure ] crbug.com/591099 http/tests/css/shared-stylesheet-mutation-preconstruct.html [ Crash Failure ] crbug.com/591099 http/tests/css/shared-stylesheet-mutation.html [ Failure ] -crbug.com/591099 http/tests/css/vertical-align-baseline-after-image-load-3.html [ Crash Pass ] -crbug.com/591099 http/tests/css/vertical-align-baseline-after-image-load.html [ Crash ] crbug.com/591099 http/tests/csspaint/border-color.html [ Failure ] crbug.com/591099 http/tests/csspaint/invalidation-background-image.html [ Timeout ] crbug.com/591099 http/tests/csspaint/invalidation-border-image.html [ Timeout ] @@ -14643,17 +14526,12 @@ crbug.com/591099 http/tests/dom/EventListener-incumbent-global-2.html [ Crash Pass ] crbug.com/591099 http/tests/dom/create-contextual-fragment-from-bodyless-svg-document-range.html [ Failure ] crbug.com/591099 http/tests/dom/create-contextual-fragment-from-svg-document-range.html [ Crash Failure ] -crbug.com/591099 http/tests/dom/document-contentType-xhr.html [ Crash Pass ] -crbug.com/591099 http/tests/dom/document-contentType.html [ Crash Pass ] -crbug.com/591099 http/tests/dom/iframe-crash-reload-from-encoding-detection.html [ Crash Pass ] crbug.com/591099 http/tests/dom/location-stringify.html [ Crash Failure ] crbug.com/591099 http/tests/download/basic-ascii.html [ Failure ] crbug.com/591099 http/tests/download/default-encoding.html [ Failure Timeout ] crbug.com/591099 http/tests/download/inherited-encoding-form-submission-result.html [ Failure ] crbug.com/591099 http/tests/download/inherited-encoding.html [ Failure Timeout ] crbug.com/591099 http/tests/download/literal-utf-8.html [ Failure ] -crbug.com/591099 http/tests/encoding/meta-switch-mid-parse-with-title.html [ Crash Pass ] -crbug.com/591099 http/tests/encoding/meta-switch-mid-parse.html [ Crash Pass ] crbug.com/591099 http/tests/eventsource/eventsource-bad-mime-type.html [ Failure ] crbug.com/591099 http/tests/eventsource/eventsource-content-type-charset.html [ Crash Failure ] crbug.com/591099 http/tests/eventsource/eventsource-cors-basic.html [ Crash Failure ] @@ -14704,17 +14582,7 @@ crbug.com/591099 http/tests/feature-policy/payment-disabled.php [ Crash Failure ] crbug.com/591099 http/tests/feature-policy/payment-enabledforall.php [ Crash Failure ] crbug.com/591099 http/tests/feature-policy/payment-enabledforself.php [ Crash Pass ] -crbug.com/591099 http/tests/feature-policy/xslt-document-insertion.xml [ Crash ] -crbug.com/591099 http/tests/fetch/chromium/close-worker-while-requesting.html [ Crash ] -crbug.com/591099 http/tests/fetch/chromium/data-saver.html [ Crash Pass ] crbug.com/591099 http/tests/fetch/chromium/discarded-window.html [ Crash Pass ] -crbug.com/591099 http/tests/fetch/referrer/no-referrer-document.html [ Crash ] -crbug.com/591099 http/tests/fetch/referrer/origin-when-cross-origin-document.html [ Crash Pass ] -crbug.com/591099 http/tests/fetch/referrer/serviceworker-from-origin-only-document.html [ Crash ] -crbug.com/591099 http/tests/fetch/serviceworker-proxied/thorough/redirect-password.html [ Crash ] -crbug.com/591099 http/tests/fetch/serviceworker/headers-guard-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 http/tests/fetch/serviceworker/referrer-base-https-other-https.html [ Crash ] -crbug.com/591099 http/tests/fetch/serviceworker/response-base-https-other-https.html [ Crash ] crbug.com/591099 http/tests/fetch/window/pageimportancesignals.html [ Failure ] crbug.com/591099 http/tests/fileapi/blob-url-in-subframe.html [ Failure ] crbug.com/591099 http/tests/fileapi/create-blob-url-from-data-url.html [ Failure ] @@ -15191,7 +15059,7 @@ crbug.com/591099 http/tests/media/media-source/mediasource-timestamp-offset.html [ Crash Pass ] crbug.com/591099 http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-default-buffers.html [ Crash Pass ] crbug.com/591099 http/tests/media/pdf-served-as-pdf.html [ Crash Pass ] -crbug.com/591099 http/tests/media/progress-events-generated-correctly.html [ Crash Pass ] +crbug.com/591099 http/tests/media/progress-events-generated-correctly.html [ Crash Failure Pass ] crbug.com/591099 http/tests/media/reload-after-dialog.html [ Crash Pass ] crbug.com/591099 http/tests/media/remove-while-loading.html [ Crash Pass ] crbug.com/591099 http/tests/media/text-served-as-text.html [ Crash Pass ] @@ -15209,7 +15077,7 @@ crbug.com/591099 http/tests/media/video-load-with-userpass.html [ Crash Pass ] crbug.com/591099 http/tests/media/video-play-progress.html [ Crash Pass ] crbug.com/591099 http/tests/media/video-play-stall-before-meta-data.html [ Crash Pass ] -crbug.com/591099 http/tests/media/video-play-stall.html [ Crash Timeout ] +crbug.com/591099 http/tests/media/video-play-stall.html [ Crash Pass Timeout ] crbug.com/591099 http/tests/media/video-query-url.html [ Crash Pass ] crbug.com/591099 http/tests/media/video-referer.html [ Crash Pass ] crbug.com/591099 http/tests/media/video-seek-to-duration.html [ Crash Pass ] @@ -15354,7 +15222,6 @@ crbug.com/591099 http/tests/navigation/onload-navigation-iframe-2.html [ Failure ] crbug.com/591099 http/tests/navigation/ping-cookie.html [ Crash Pass ] crbug.com/591099 http/tests/navigation/ping-cross-origin-from-https.html [ Crash Pass ] -crbug.com/591099 http/tests/navigation/ping-cross-origin.html [ Crash Pass ] crbug.com/591099 http/tests/navigation/post-basic.html [ Crash Failure ] crbug.com/591099 http/tests/navigation/post-frames-goback1.html [ Crash Failure ] crbug.com/591099 http/tests/navigation/post-frames.html [ Crash Failure ] @@ -15450,7 +15317,7 @@ crbug.com/591099 http/tests/security/contentSecurityPolicy/cached-frame-csp.html [ Crash Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/cascade/cross-origin-with-own-policy.html [ Crash Pass ] crbug.com/591099 http/tests/security/contentSecurityPolicy/cascade/cross-origin.html [ Crash Pass ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/cascade/same-origin-with-own-policy.html [ Crash Pass ] +crbug.com/591099 http/tests/security/contentSecurityPolicy/cascade/same-origin-with-own-policy.html [ Crash Pass Timeout ] crbug.com/591099 http/tests/security/contentSecurityPolicy/cascade/same-origin.html [ Crash Pass ] crbug.com/591099 http/tests/security/contentSecurityPolicy/directive-parsing-01.html [ Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/directive-parsing-02.html [ Failure ] @@ -15509,7 +15376,7 @@ crbug.com/591099 http/tests/security/cookies/websocket/third-party-cookie-blocked-on-same-origin-websocket.html [ Crash Pass ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-appcache.html [ Crash Failure ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-basic.html [ Crash Pass ] -crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.html [ Crash Pass ] +crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.html [ Crash Failure Pass ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp.html [ Crash Pass ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-serviceworker-basic.html [ Crash Pass ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-sharedworker-basic.html [ Crash Pass ] @@ -16736,7 +16603,7 @@ crbug.com/591099 inspector/editor/text-editor-reveal-line.html [ Crash Failure Timeout ] crbug.com/591099 inspector/editor/text-editor-search-replace.html [ Crash Failure ] crbug.com/591099 inspector/editor/text-editor-selection-to-search.html [ Crash Failure Timeout ] -crbug.com/591099 inspector/editor/text-editor-smart-braces.html [ Crash Failure ] +crbug.com/591099 inspector/editor/text-editor-smart-braces.html [ Crash Failure Timeout ] crbug.com/591099 inspector/editor/text-editor-token-at-position.html [ Crash Failure ] crbug.com/591099 inspector/editor/text-editor-word-jumps.html [ Crash Failure Timeout ] crbug.com/591099 inspector/elements/accessibility/autocomplete-attribute.html [ Crash Failure Timeout ] @@ -20440,201 +20307,100 @@ crbug.com/591099 vibration/vibration-exceptions.html [ Failure ] crbug.com/591099 vibration/vibration-iframe.html [ Timeout ] crbug.com/591099 vibration/vibration-patterns.html [ Failure ] -crbug.com/591099 virtual/android/fast/rootscroller/root-scroller-apply-filter-to-parent.html [ Crash Pass ] crbug.com/591099 virtual/android/fast/rootscroller/set-root-scroller.html [ Crash Failure ] crbug.com/591099 virtual/android/fullscreen/anonymous-block-merge-crash.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/api/element-request-fullscreen-two-elements.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/api/element-request-fullscreen-two-iframes.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/api/element-request-fullscreen-vs-exit.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/compositor-touch-hit-rects-fullscreen-video-controls.html [ Failure ] -crbug.com/591099 virtual/android/fullscreen/enter-exit-full-screen-hover.html [ Crash ] crbug.com/591099 virtual/android/fullscreen/exit-full-screen-iframe.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-api.html [ Crash ] crbug.com/591099 virtual/android/fullscreen/full-screen-cancel-nested.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-cancel.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-child-not-allowed-crash.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-contentEditable-crash.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-crash-offsetLeft.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-css.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-detached-document.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-element-stack.html [ Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-enabled.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-frameset.html [ Failure ] crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-allowed-nested.html [ Crash Timeout ] -crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-allowed-video.html [ Crash ] crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-allowed.html [ Crash Failure ] crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-legacy.html [ Failure ] crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-not-allowed.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-ua-style.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-inline-split-crash.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-keyboard-enabled.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-no-style-sharing.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/full-screen-not-enabled-when-unsupported.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-placeholder.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-remove-ancestor-after.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-remove-ancestor.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-remove-children.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/full-screen-remove-sibling.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-remove.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-render-inline.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-request-removed.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-request.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-restrictions.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-ruleset-crash.html [ Crash ] crbug.com/591099 virtual/android/fullscreen/full-screen-table-section.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-twice.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-unprefixed-and-prefixed.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/full-screen-will-change.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/full-screen-with-css-reference-filter.html [ Failure ] crbug.com/591099 virtual/android/fullscreen/full-screen-with-flex-item.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/full-screen-zIndex-after.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/model/fully-exit-fullscreen-nested-iframe.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/model/fully-exit-fullscreen-nested.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/model/fully-exit-fullscreen-single.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/non-ancestor-iframe.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/notify-paint-crash.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/orthogonal-writing-mode-full-screen-crash.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/orthogonal-writing-mode-full-screen-reattach-crash.html [ Crash Pass ] crbug.com/591099 virtual/android/fullscreen/video-controls-override.html [ Crash Failure ] crbug.com/591099 virtual/android/fullscreen/video-controls-timeline.html [ Failure ] crbug.com/591099 virtual/android/fullscreen/video-fail-to-enter-full-screen.html [ Crash Failure ] -crbug.com/591099 virtual/android/fullscreen/video-fixed-at-top-left.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/video-fixed-background.html [ Crash Pass ] -crbug.com/591099 virtual/android/fullscreen/video-specified-size.html [ Crash ] -crbug.com/591099 virtual/android/fullscreen/video-transform.html [ Crash Pass ] +crbug.com/591099 virtual/android/fullscreen/video-specified-size.html [ Crash Failure ] crbug.com/591099 virtual/android/media/mediadocument/media-document-with-download-button.html [ Failure ] -crbug.com/591099 virtual/color_space/fast/canvas/color-space/imageData-colorSpace.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.composite.globalAlpha.fillPath.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.fillText.gradient.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.text.draw.fill.maxWidth.gradient.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.text.draw.fill.maxWidth.negative.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/2d.text.draw.fill.maxWidth.verySmall.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/CanvasRendering2D-prototype-chain.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-2d-drawImage-in-worker.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-2d-drawImage.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-2d-imageSmoothing-in-worker.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-2d-pattern.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-ImageBitmapSource.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-commit-invalid-call.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-commit-promise.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-constructor-in-worker.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-convertToBlob-noIdleTask.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-currentColor.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-fillRect-in-worker.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-getContext-in-worker.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-invalid-args-in-worker.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-opaque-background-compositing.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-placeholder-image-source-with-worker.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-placeholder-image-source.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-resize.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-transferToImageBitmap.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-transferable-exceptions.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-transferable.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/OffscreenCanvas-zero-size-readback.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/access-zero-sized-canvas.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/alpha.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/arc-crash.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/arc360.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/bug412718.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/bug535171.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/bug544329.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-2d-clip-anti-aliasing.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-2d-imageData-create-nonfinite.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ImageBitmap-close.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ImageBitmap-structured-clone.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ImageBitmap-transferable.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ImageData-neutered-source.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ImageData-workers.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-after-destroy-iframe.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-after-detachment.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-alphaImageData-behavior.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-arc-circumference.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-arc-connecting-line.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-arc-zero-lineto.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-background-alpha.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-bezier-same-endpoint.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blend-solid.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-color-over-color.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-fill-style.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-gradient-over-image.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-gradient-over-pattern.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-image-over-color.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-image-over-gradient.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-image-over-image.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-pattern-over-image.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-text.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-blending-transforms.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-clearRect.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-clip-stack-persistence.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-closePath-single-point.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-alpha.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-canvas.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-fill-repaint.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-image.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-stroke-alpha.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-text-alpha.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-video-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-composite-video.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-context-attributes-default-value.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-blob-in-workers.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-colorClamping.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-createPattern.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-data-in-workers.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-data-preserves-alpha.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-drawImage-video.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-drawImage.html [ Timeout ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-immutable.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-invalid-args-in-workers.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-invalid-args.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-invalid-blob-in-workers.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-recursive.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-resize.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-svg.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createImageBitmap-webgl.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-createPattern-fillRect-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-currentColor.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-direction.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-draw-canvas-on-canvas-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-animated-images.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-animated.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-bleed.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-live-video.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-out-of-bounds-src.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-drawImage-svg.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-360-winding.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-circumference.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-connecting-line.html [ Failure Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-negative-radius.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse-zero-lineto.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-ellipse.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-empty-image-pattern.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fill-zeroSizeGradient.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillPath-alpha-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillPath-gradient-shadow.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillPath-pattern-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillPath-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillRect-gradient-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillRect-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillRect-zeroSizeGradient.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillRect.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillStyle-strokeStyle-stringification.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-fillText-zeroSizeGradient.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-drop-shadow.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-fill-liveness.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-fill-paint-color.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-fill-paint-gradient.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-fill-paint-pattern.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-liveness.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-removed.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-stroke-liveness.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-stroke-paint-color.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-stroke-paint-gradient.html [ Failure ] @@ -20643,21 +20409,12 @@ crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-svg-inline.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-svg-liveness.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-svg-off-screen.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-undefined.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-units-off-screen.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-width-height-hidpi-scale.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-width-height-hidpi.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-width-height-scale.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-filter-width-height.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-font-cache.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-getImageData-linear-rgb.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-getImageData-p3.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-getImageData-rec2020.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-getImageData-rounding.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-getImageData.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-gradient-without-path.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hides-fallback.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hidpi-blurry.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-accessibility-test.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-basic-test.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-clear-test.html [ Crash Pass ] @@ -20674,8 +20431,6 @@ crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-path2d-transform-test.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-scale-factor.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-hit-regions-transform-test.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-patterns.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingEnabled-repaint.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-imageSmoothingQuality.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-invalid-fillstyle.html [ Crash Pass ] @@ -20684,37 +20439,25 @@ crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-isPointInStroke-with-path.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-isPointInStroke.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-large-dimensions.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-large-pattern.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lineDash-input-sequence.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lineDash-invalid.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lineDash.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lineWidth.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-longlived-context.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lose-restore-googol-size.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-lost-gpu-context.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-measure-bidi-text.html [ Failure Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-negative-size.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-normalize-string.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-overloads-drawImage.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-overloads-strokeText.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-path-context-clip.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-path-context-fill.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-path-context-stroke.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-path-object.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-path-with-inf-nan-dimensions.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-pattern-behaviour.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-pattern-modify.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-pattern-set-transform.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-putImageData.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-quadratic-same-endpoint.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-radial-gradient-spreadMethod.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-render-layer.html [ Failure Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-resetTransform.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-resize-after-paint-without-layout.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-resize-after-paint.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-resize-reset.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-save-restore-with-path.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-scale-drawImage-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-scale-fillPath-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-scale-fillRect-shadow.html [ Crash Pass ] @@ -20723,7 +20466,6 @@ crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-scroll-path-into-view.html [ Crash Failure Timeout ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-shadow-source-in.html [ Failure Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-shadow.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-skia-excessive-size.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-strokePath-alpha-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-strokePath-cap-join.html [ Crash Pass ] @@ -20733,110 +20475,55 @@ crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-strokeRect-gradient-shadow.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-text-baseline-tiny-fonts.html [ Failure Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-text-space-characters.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-textMetrics-all.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-textMetrics-width.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-toBlob-jpeg-maximum-quality.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-toDataURL-jpeg-crash.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-toDataURL-webp-alpha.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-toDataURL-webp.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-transform-identity.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-transform-nan.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-transform-skewed.html [ Crash Pass ] +crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-toDataURL-webp.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-transforms-during-path.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-transforms-fillRect-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas-zero-length-lineCap.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/canvas_arc_largeangles.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/change-context.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/color-space/display_linear-rgb.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/currentTransform-null.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/downsample-quality.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/draw-focus-if-needed-invisible-crash.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/draw-focus-if-needed-on-event.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/draw-focus-if-needed-with-path2d.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/draw-focus-if-needed.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/drawImage-with-bad-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/drawImage-with-globalAlpha.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/drawImage-with-negative-source-destination.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fallback-content.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/feimage-with-foreignobject-taint-canvas-2.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/feimage-with-foreignobject-taint-canvas.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fill-stroke-clip-reset-path.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fillText-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fillrect-gradient-zero-stops.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fillrect_gradient.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/font-no-zoom.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/getPutImageDataPairTest.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/gradient-addColorStop-with-invalid-offset.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/gradient-with-clip.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/image-with-foreignobject-taint-canvas-2.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/image-with-foreignobject-taint-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/imagebitmap/transferFromImageBitmap-alpha.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/imagebitmap/transferFromImageBitmap-no-alpha.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/imagebitmap/transferFromImageBitmap.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/linearGradient-infinite-values.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/painting-on-bad-canvas.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/pattern-with-transform.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/pixelated-resize.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/pixelated.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/quadraticCurveTo.xml [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/resize-while-save-active.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/set-empty-font-crash.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/setWidthResetAfterForcedRender.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/shadow-huge-blur.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/shadow-offset-1.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/strokeText-missing-args.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/synchronous-create-pattern.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/toDataURL-alpha.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/toDataURL-noData.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/toDataURL-supportedTypes.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/transformed-canvas-reset.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/unclosed-canvas-1.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/unclosed-canvas-2.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/unclosed-canvas-3.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/unclosed-canvas-4.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/canvas-getContext-crash.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/canvas-resize-crash.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/canvas-to-data-url.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/compressed-tex-image.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/context-destroyed-crash.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/context-gc-custom-properties.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/draw-webgl-to-canvas-2d.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/offscreenCanvas-APIs-NOT-alter-webgl-states.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/offscreenCanvas-context-lost-restored-worker.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/offscreenCanvas-context-lost-worker.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/offscreenCanvas-transferToImageBitmap-texImage2D.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/pixelated.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/renderer-and-vendor-strings.html [ Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/shader-deleted-by-accessor.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/tex-sub-image-cube-maps.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-blob.html [ Crash ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-image-resize.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-image.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-blob.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-image.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-imageData.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-video-resize.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-from-video.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-structured-clone.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texImage-imageBitmap-transferable.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/texture-color-profile.html [ Crash Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-composite-modes-repaint.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-composite-modes-tabswitching.html [ Crash ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-context-attributes-default-value.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-error-response.html [ Crash Pass ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-shadow-no-alpha.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-texture-binding-preserved.html [ Crash Failure ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-viewport-parameters-preserved.html [ Failure ] -crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/yuv-video-on-accelerated-canvas.html [ Crash Pass ] crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/zero-size-fill-rect.html [ Crash Pass ] crbug.com/591099 virtual/enable_wasm/external/wpt/wasm/wasm_local_iframe_test.html [ Crash Pass Timeout ] -crbug.com/591099 virtual/enable_wasm/external/wpt/wasm/wasm_serialization_tests.html [ Crash Pass ] -crbug.com/591099 virtual/enable_wasm/external/wpt/wasm/wasm_service_worker_test.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/12-55.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/182.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/2-comp.html [ Crash Failure ] @@ -20845,11 +20532,8 @@ crbug.com/591099 virtual/exotic-color-space/images/55.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/alt-text-wrapping.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/animated-background-image-crash.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/animated-gif-fast-crash.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/animated-gif-with-offsets.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/animated-png.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-jpeg-with-color-profile.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-animate-rotate.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-background-clip-text.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-background-image-cover.html [ Crash Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-background-image-cross-fade-png.html [ Failure Pass ] @@ -20857,9 +20541,7 @@ crbug.com/591099 virtual/exotic-color-space/images/color-profile-background-image-repeat.html [ Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-background-image-space.html [ Crash Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-border-image-source.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-border-image.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-border-radius.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-clip.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-drag-image.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-filter.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-group.html [ Crash Failure ] @@ -20871,41 +20553,24 @@ crbug.com/591099 virtual/exotic-color-space/images/color-profile-image-profile-match.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-image-pseudo-content.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-image-shape.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-image-svg-resource-url.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-image.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-layer-filter.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-layer.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-mask-image-svg.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-munsell-adobe-to-srgb.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-munsell-srgb-to-srgb.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-object.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/color-profile-svg-foreign-object.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/color-profile-svg.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/content-url-broken-image-with-alt-text.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/content-url-image-with-alt-text-dynamic-2.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/content-url-image-with-alt-text-dynamic.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/crash-bad-cast.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/crash-when-zoom-factor-changes.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-background-size.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-blending.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/cross-fade-broken-image.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-invalidation.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-overflow-position.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-simple.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-sizing.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/cross-fade-svg-fragments.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-svg-size-diff.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-svg-size.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/cross-fade-tiled.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/destroyed-image-load-event.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/dispose-previous.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/dont-crash-with-null-gif-frames.html [ Crash ] -crbug.com/591099 virtual/exotic-color-space/images/drag-image-descendant-painting-sibling.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/drag-image-transformed-parent.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/drag-pdf-as-image.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/drag-svg-image.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/embed-does-not-propagate-dimensions-to-object-ancestor.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/embed-image.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/exif-orientation-css.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/exif-orientation-height-image-document.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/exif-orientation-image-document.html [ Crash Failure ] @@ -20945,8 +20610,6 @@ crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-with-paint-root-offset.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-with-scale-transform.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-zero-outline-width.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-zoom-style-default-shape.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-zoom-style.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring-zoom.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/imagemap-focus-ring.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/imagemap-overflowing-circle-focus-ring.html [ Failure ] @@ -20955,41 +20618,22 @@ crbug.com/591099 virtual/exotic-color-space/images/imagemap-scroll.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/img-dimensions-styled.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/invalid-image-url-crash.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/jpeg-with-color-profile.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/jpeg-yuv-image-decoding.html [ Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/jpeg-yuv-progressive-canvas.html [ Crash Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/jpeg-yuv-progressive-image.html [ Crash Failure Pass ] crbug.com/591099 virtual/exotic-color-space/images/link-body-content-imageDimensionChanged-crash.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/load-img-with-empty-src.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/mask-box-image-crash.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/motion-jpeg-single-frame.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/move-image-to-new-document.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/multiple-inflight-error-event-crash.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/natural-dimensions-correct-after-image-reset.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/onload-event-when-reloading-image-after-successful-image-load.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/optimize-contrast-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/optimize-contrast-image.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/paint-subrect-grid.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/paletted-png-with-color-profile.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/pdf-as-background.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/pdf-as-tiled-background.html [ Failure ] crbug.com/591099 virtual/exotic-color-space/images/percent-height-image.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/percentage-height-image-with-auto-height-container-computes-as-percentage.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/pixel-crack-image-background-webkit-transform-scale.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/pixelated-border-image.html [ Crash ] -crbug.com/591099 virtual/exotic-color-space/images/pixelated-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/pixelated-hidpi.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/pixelated-image.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/pixelated-svg-image.html [ Crash ] -crbug.com/591099 virtual/exotic-color-space/images/png-color-profile-ignore-gamma.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/png-extra-row-crash.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/png-missing-plte-before-trns-crash.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/png-suite/test.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/png-with-color-profile.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/png_per_row_alpha_decoding.html [ Failure ] -crbug.com/591099 virtual/exotic-color-space/images/read-past-end-of-buffer.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-0px-images-quirk.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-0px-images.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-10px-images.html [ Crash Failure ] @@ -20998,10 +20642,7 @@ crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-block-flow-images.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-images-empty-alt.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/rendering-broken-images.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/rgb-jpeg-with-adobe-marker-only.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/rgb-png-with-cmyk-color-profile.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/script-counter-imageDimensionChanged-crash.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/size-failure.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/sprite-no-bleed.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/style-access-during-imageChanged-crash.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/style-access-during-imageChanged-style-freeze.html [ Crash Pass ] @@ -21010,14 +20651,7 @@ crbug.com/591099 virtual/exotic-color-space/images/update-alt-text.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/viewport-in-standalone-image-document.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/webgl-teximage2d.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/webp-color-profile-crash.html [ Crash ] -crbug.com/591099 virtual/exotic-color-space/images/webp-color-profile-lossless.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/webp-color-profile-lossy-alpha.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/webp-color-profile-lossy.html [ Crash ] crbug.com/591099 virtual/exotic-color-space/images/webp-flip.html [ Crash Failure ] -crbug.com/591099 virtual/exotic-color-space/images/webp-image-decoding.html [ Crash ] -crbug.com/591099 virtual/exotic-color-space/images/ycbcr-with-cmyk-color-profile.html [ Crash Pass ] -crbug.com/591099 virtual/exotic-color-space/images/zoomed-img-height-acid3.html [ Crash Pass ] crbug.com/591099 virtual/exotic-color-space/images/zoomed-img-size.html [ Crash Failure ] crbug.com/591099 virtual/exotic-color-space/images/zoomed-offset-size.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/12-55.html [ Failure ] @@ -21028,11 +20662,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/55.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/alt-text-wrapping.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/animated-background-image-crash.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/animated-gif-advance-frames.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/animated-gif-fast-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/animated-gif-with-offsets.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/animated-png.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/cHRM_color_spin.html [ Crash ] crbug.com/591099 virtual/gpu-rasterization/images/color-jpeg-with-color-profile.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-background-clip-text.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-background-image-cover.html [ Crash Failure Pass ] @@ -21041,46 +20670,34 @@ crbug.com/591099 virtual/gpu-rasterization/images/color-profile-background-image-repeat.html [ Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-background-image-space.html [ Crash Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-border-image-source.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-border-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-border-radius.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-drag-image.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-filter.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-group.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-iframe.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-canvas-pattern.html [ Crash Failure Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-canvas-svg.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-canvas.html [ Crash Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-filter-all.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-object-fit.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-profile-match.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-pseudo-content.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-shape.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-svg-resource-url.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-layer-filter.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-layer.html [ Crash Failure Timeout ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-mask-image-svg.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-object.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-reflection.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-svg-foreign-object.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/content-url-image-with-alt-text-dynamic-2.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/content-url-image-with-alt-text.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/crash-when-fallback-content-deleted.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/crash-when-zoom-factor-changes.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-background-size.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-blending.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-broken-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-invalidation.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-overflow-position.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-simple.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-sizing.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-svg-fragments.html [ Crash ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-tiled.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/destroyed-image-load-event.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/drag-image-2.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/drag-image-transformed-child.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/drag-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/drag-svg-image.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/embed-does-not-propagate-dimensions-to-object-ancestor.html [ Crash Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/exif-orientation-css.html [ Crash Failure ] @@ -21115,8 +20732,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/image-zoom-to-25.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/image-zoom-to-500.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/imagemap-circle-focus-ring.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/imagemap-duplicate-outlines-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/imagemap-dynamic-area-updates.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/imagemap-focus-ring-in-positioned-container.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html [ Failure ] @@ -21132,7 +20747,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/imagemap-scroll.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/img-dimensions-styled.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/invalid-image-url-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/jpeg-with-color-profile.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/jpeg-yuv-image-decoding.html [ Crash Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/jpeg-yuv-progressive-canvas.html [ Crash Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/jpeg-yuv-progressive-image.html [ Crash Failure Pass ] @@ -21141,22 +20755,10 @@ crbug.com/591099 virtual/gpu-rasterization/images/motion-jpeg-single-frame.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/move-image-to-new-document.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/multiple-inflight-error-event-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/natural-dimensions-correct-after-image-reset.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/object-image.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html [ Crash ] -crbug.com/591099 virtual/gpu-rasterization/images/optimize-contrast-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/paint-subrect-grid.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/paletted-png-with-color-profile.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/pdf-as-background.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/pdf-as-tiled-background.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/percent-height-image.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/percentage-height-image-with-auto-height-container-computes-as-percentage.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/pixel-crack-image-background-webkit-transform-scale.html [ Crash Failure Timeout ] -crbug.com/591099 virtual/gpu-rasterization/images/pixelated-background-image.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/pixelated-border-image.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/pixelated-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/pixelated-svg-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/png-extra-row-crash.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/png-suite/test.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/png_per_row_alpha_decoding.html [ Crash Failure ] @@ -21168,9 +20770,7 @@ crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-block-flow-images.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-images-empty-alt.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-images.html [ Crash Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/rgb-jpeg-endian-pixels.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/script-counter-imageDimensionChanged-crash.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/size-failure.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/sprite-no-bleed.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/style-access-during-imageChanged-crash.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/style-access-during-imageChanged-style-freeze.html [ Crash Pass ] @@ -21179,9 +20779,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/update-alt-text.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/viewport-in-standalone-image-document.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/webgl-teximage2d.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/webp-animation.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/webp-color-profile-lossless.html [ Crash Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/webp-color-profile-lossy-alpha.html [ Crash Pass ] crbug.com/591099 virtual/gpu-rasterization/images/webp-flip.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/zoomed-img-size.html [ Crash Failure ] crbug.com/591099 virtual/gpu-rasterization/images/zoomed-offset-size.html [ Crash Pass ] @@ -21191,37 +20788,14 @@ crbug.com/591099 virtual/gpu/fast/canvas/2d.text.draw.fill.maxWidth.negative.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/2d.text.draw.fill.maxWidth.verySmall.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/CanvasRendering2D-prototype-chain.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-2d-globalAlpha.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-2d-imageData-in-worker.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-2d-imageSmoothing-in-worker.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-ImageBitmapSource.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-commit-frameless-doc.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-commit-promise.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-commit-retains-backing.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-constructor-in-worker.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-convertToBlob-noIdleTask.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-currentColor.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-filter-in-worker.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-invalid-args-in-worker.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-opaque-background-compositing.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-paths-in-worker.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-placeholder-image-source-with-worker.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-resize.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-transferable-exceptions.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-transferable.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-transform-shadow-in-worker.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-webgl-preserveDrawingBuffer.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/access-zero-sized-canvas.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/alpha.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/arc-crash.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/arc360.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/bidi-multi-run.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/bug445162.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/bug532148.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/bug535171.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/bug544329.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-2d-clip-anti-aliasing.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-ImageBitmap-close.html [ Failure ] @@ -21231,30 +20805,16 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-ImageData-workers.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-after-destroy-iframe.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-alphaImageData-behavior.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-arc-360-winding.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-arc-connecting-line.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-arc-zero-lineto.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-before-css.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-bezier-same-endpoint.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-color-over-image.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-color-over-pattern.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-gradient-over-color.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-gradient-over-pattern.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-image-over-image.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-image-over-pattern.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-pattern-over-gradient.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-pattern-over-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-text.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-clip-stack-persistence.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-closePath-single-point.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-alpha.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-canvas.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-image.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-stroke-alpha.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-text-alpha.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-composite-video.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-context-attributes-default-value.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-animated.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-blob-in-workers.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-createPattern.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-data-in-workers.html [ Crash Failure ] @@ -21262,22 +20822,18 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-drawImage-video.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-drawImage.html [ Crash Timeout ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-immutable.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-invalid-args-in-workers.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-invalid-args.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-invalid-blob-in-workers.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-recursive.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-resize.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-svg.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-webgl.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createPattern-fillRect-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-currentColor.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-direction.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-draw-canvas-on-canvas-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-animated-images.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-animated.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-incomplete.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-live-video.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-ellipse-360-winding.html [ Crash Pass ] @@ -21295,11 +20851,6 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-fill-paint-color.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-fill-paint-gradient.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-fill-paint-pattern.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-frameless-document.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-liveness.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-modified.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-multiple-drop-shadows.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-origin-clean.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-stroke-liveness.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-stroke-paint-color.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-stroke-paint-gradient.html [ Failure ] @@ -21308,17 +20859,12 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-svg-inline.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-svg-liveness.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-svg-off-screen.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-undefined-then-defined.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-width-height-hidpi-scale.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-width-height-hidpi.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-width-height-scale.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-filter-width-height.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-font-cache.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-getImageData-invalid.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-getImageData-negative-source.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-gradient-without-path.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hides-fallback.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-hidpi-blurry.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-accessibility-test.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-basic-test.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-clear-test.html [ Crash Pass ] @@ -21335,17 +20881,11 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-path2d-transform-test.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-scale-factor.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-hit-regions-transform-test.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingEnabled-patterns.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingEnabled-repaint.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingEnabled-zero-size.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingEnabled.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingQuality.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-incremental-repaint-3.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-invalid-fillstyle.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-invalid-strokestyle.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-invalid-values.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-invalid-video.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-isPointInPath-winding.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-isPointInStroke-with-path.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-isPointInStroke.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-large-dimensions.html [ Crash Pass ] @@ -21355,28 +20895,19 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-lost-gpu-context.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-measure-bidi-text.html [ Failure Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-measureText.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-negative-size.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-no-alpha-invalidation.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-normalize-string.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-overloads-strokeText.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-addpath.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-constructors.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-context-clip.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-context-fill.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-context-stroke.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-object.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-path-with-inf-nan-dimensions.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-pattern-behaviour.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-pattern-set-transform.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-putImageData.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-quadratic-same-endpoint.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-render-layer.html [ Failure Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-resetTransform.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-resize-after-paint.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-save-restore.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-scale-drawImage-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-scale-fillPath-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-scale-fillRect-shadow.html [ Crash Pass ] @@ -21385,216 +20916,86 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-scroll-path-into-view.html [ Failure Timeout ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-shadow-source-in.html [ Failure Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-skia-excessive-size.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-state-persistence-no-dirty.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokePath-alpha-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokePath-cap-join.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokePath-gradient-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokePath-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokeRect-alpha-shadow.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-strokeRect-gradient-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-style-intact-after-text.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-text-baseline-tiny-fonts.html [ Failure Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-text-baseline.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-text-ideographic-space.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-text-space-characters.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-textMetrics-width.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toBlob-invalid.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toBlob-jpeg-medium-quality.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toDataURL-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toDataURL-jpeg-maximum-quality.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-toDataURL-webp-alpha.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-transform-nan.html [ Crash ] +crbug.com/591099 virtual/gpu/fast/canvas/canvas-toDataURL-webp.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-transforms-during-path.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-transforms-fillRect-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas-with-illegal-args.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/canvasDrawingIntoSelf.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/canvas_arc_largeangles.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/change-context.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/color-space/display_linear-rgb.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/currentTransform-null.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/downsample-quality.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/draw-focus-if-needed-invisible-crash.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/draw-focus-if-needed-on-event.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/draw-focus-if-needed-with-path2d.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/draw-focus-if-needed.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/drawImage-with-bad-canvas.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/drawImage-with-negative-source-destination.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/drawImage-with-valid-image.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/fallback-content.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/feimage-with-foreignobject-taint-canvas-2.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/feimage-with-foreignobject-taint-canvas.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/fill-stroke-clip-reset-path.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/fillText-shadow.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/fillrect-gradient-zero-stops.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/fillrect_gradient.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/font-no-zoom.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/font-update.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/getPutImageDataPairTest.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/gradient-addColorStop-with-invalid-offset.html [ Crash Pass ] +crbug.com/591099 virtual/gpu/fast/canvas/getPutImageDataPairTest.html [ Crash Timeout ] crbug.com/591099 virtual/gpu/fast/canvas/gradient-with-clip.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/image-object-in-canvas.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/image-pattern-rotate.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/image-with-foreignobject-taint-canvas-2.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/image-with-foreignobject-taint-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/imagebitmap/transferFromImageBitmap-alpha.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/invalid-set-font-crash.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/linearGradient-infinite-values.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/painting-on-bad-canvas.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/pattern-with-transform.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/patternfill-repeat.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/pixelated-off-screen.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/quadraticCurveTo.xml [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/resize-while-save-active.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/rgba-parsing.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/set-colors.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/set-empty-font-crash.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/setWidthResetAfterForcedRender.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/shadow-huge-blur.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/shadow-offset-1.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/text-globalAlpha.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/thin-drawImages.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/toDataURL-alpha.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/toDataURL-noData.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/toDataURL-supportedTypes.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/transformed-canvas-reset.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/translate-text.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/unclosed-canvas-1.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/unclosed-canvas-3.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/unclosed-canvas-4.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/canvas-getContext-crash.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/canvas-resize-crash.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/canvas-to-data-url.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/compressed-tex-image.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/context-gc-custom-properties.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/draw-webgl-to-canvas-2d.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/offscreenCanvas-APIs-NOT-alter-webgl-states.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/offscreenCanvas-context-lost-restored.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/offscreenCanvas-context-lost.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/offscreenCanvas-transferToImageBitmap-invalid-mailbox.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/offscreenCanvas-transferToImageBitmap-texImage2D.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/renderer-and-vendor-strings.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/shader-deleted-by-accessor.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/tex-sub-image-cube-maps.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-blob.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-canvas.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-image.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-blob.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-image.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-imageBitmap-from-imageData.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-imageData.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-video-resize.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-from-video.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/texImage-imageBitmap-transferable.html [ Crash Pass ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/texture-color-profile.html [ Crash Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-composite-modes-repaint.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-composite-modes-tabswitching.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-error-response.html [ Crash ] -crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-layer-update.html [ Crash ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-texture-binding-preserved.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/webgl/webgl-viewport-parameters-preserved.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/zero-size-fill-rect.html [ Crash Pass ] -crbug.com/591099 virtual/high-contrast-mode/paint/high-contrast-mode/image-filter-all/gradient-invert.html [ Crash Pass ] -crbug.com/591099 virtual/high-contrast-mode/paint/high-contrast-mode/image-filter-all/image-invert.html [ Crash Pass ] crbug.com/591099 virtual/high-contrast-mode/paint/high-contrast-mode/image-filter-all/text-on-backgrounds.html [ Crash Failure ] -crbug.com/591099 virtual/high-contrast-mode/paint/high-contrast-mode/image-filter-none/image-noinvert.html [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-004b.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-004c.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-004d.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-004e.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-005a.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-005b.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-009e.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/abspos/abspos-containing-block-initial-009f.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/adjacent-floats-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-002.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-003.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-000.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-004.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-005.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-009.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-012.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-015.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-float-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-float-004.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-float-005.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-float-007.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-initial-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-inline-001.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-006.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-002.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-005.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-008.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-009.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-013.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-015.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-003.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-004.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-007.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-009.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-011.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-005.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-006.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-007.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-002.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-004.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-006.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-007.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-002.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-005.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-007.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-015.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-019.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-023.xht [ Crash ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-026.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-030.xht [ Crash ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-031.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-036.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-038.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-101.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-112.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-116.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-119.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-120.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-121.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-122.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-136.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-139.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-142.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-143.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-144.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-149.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-153.xht [ Crash Pass ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-144.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-018.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-024.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-035.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-123.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-134.xht [ Crash ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-134.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-142.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-166.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-clear-003.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/margin-collapse-clear-016.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-placement-vertical-001a.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-placement-vertical-001b.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-placement-vertical-001c.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-placement-vertical-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-placement-vertical-004.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-rule3-outside-left-002.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-rule3-outside-right-001.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-rule3-outside-right-002.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-001-right-table.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-002-right-table.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-003-left-table.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-003-right-overflow.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-003-right-table.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-004.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-005.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-bfc-006.xht [ Crash Failure ] @@ -21602,131 +21003,24 @@ crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-bfc-001r.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-bfc-003r.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-001r.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-002l.xht [ Crash ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-002l.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-002r.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-003l.xht [ Crash ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-003l.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-wrap-top-below-inline-003r.xht [ Failure Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/floats/floats-zero-height-wrap-001.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/empty-inline-002.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-box-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-011.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-015.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-023.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/leading-001.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-016.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-018.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-035.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-037.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-039.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-040.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-048.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-049.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-050.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-059.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-061.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-072.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-079.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-083.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-084.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-093.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-095.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-102.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-105.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-126.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-129.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-applies-to-001.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-applies-to-006.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-applies-to-008.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-applies-to-013.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-004.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-008.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-019.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-020.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-032.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-065.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-067.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-076.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-088.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-089.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-091.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-092.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-100.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-104.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-109.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-110.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-117a.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-applies-to-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-applies-to-004.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-applies-to-005.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-applies-to-008.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-applies-to-013.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-baseline-007.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-baseline-008.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-sub-001.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-super-001.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-formatting-contexts-012.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-inline-empty-004.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-inline-insert-001c.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-height-007.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-width-006.xht [ Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-013.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-019.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-017.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-029.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-061.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-084.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-applies-to-009.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-percentage-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-height-002.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-replaced-width-008.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-table-width-001a.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-table-zorder-003.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inlines-016.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inlines-017.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-038.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-023.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-058.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-083.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-092.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-093.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-width-percentage-001.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-024.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-034.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-045.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-062.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-093.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-103.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-height-111.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-049.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-062.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-078.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-079.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-applies-to-016.xht [ Crash Pass ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Crash Failure ] +crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inlines-017.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/root-box-001.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/width-006.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/width-058.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/width-068.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/width-091.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-height-004.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-018.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-replaced-height-016.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-replaced-width-003b.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-025.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/bottom-008.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/dynamic-top-change-004.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/left-019.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/right-030.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/right-101.xht [ Crash Pass ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/right-offset-004.xht [ Crash Pass ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-019.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-020.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-031.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-032.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-043.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-044.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-053.xht [ Crash ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-055.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-056.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-067.xht [ Crash Failure ] @@ -21738,13 +21032,9 @@ crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-103.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-104.xht [ Crash Failure ] crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-113.xht [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-offset-003.xht [ Crash ] -crbug.com/591099 virtual/layout_ng/fast/block/basic/002.html [ Crash ] crbug.com/591099 virtual/layout_ng/fast/block/basic/016.html [ Crash Failure ] crbug.com/591099 virtual/layout_ng/fast/block/basic/adding-near-anonymous-block.html [ Crash Failure ] crbug.com/591099 virtual/layout_ng/fast/block/basic/fieldset-stretch-to-legend.html [ Crash Failure ] -crbug.com/591099 virtual/layout_ng/fast/block/basic/minheight.html [ Crash ] -crbug.com/591099 virtual/layout_ng/fast/block/basic/quirk-percent-height-table-cell.html [ Crash ] crbug.com/591099 virtual/layout_ng/fast/block/float/002.html [ Failure ] crbug.com/591099 virtual/layout_ng/fast/block/float/014.html [ Crash Failure ] crbug.com/591099 virtual/layout_ng/fast/block/float/017.html [ Failure ] @@ -21753,174 +21043,12 @@ crbug.com/591099 virtual/layout_ng/fast/block/float/formatting-context-changes.html [ Crash Failure ] crbug.com/591099 virtual/layout_ng/fast/block/float/overhanging-float-add-in-static-position-block.html [ Failure Pass ] crbug.com/591099 virtual/layout_ng/fast/block/float/overhanging-float-add-in-static-position-block2.html [ Failure Pass ] -crbug.com/591099 virtual/layout_ng/fast/block/float/previous-sibling-abspos-002.html [ Crash ] +crbug.com/591099 virtual/layout_ng/fast/block/float/previous-sibling-abspos-002.html [ Crash Pass ] crbug.com/591099 virtual/layout_ng/fast/block/float/rubybase-children-made-inline-crash.html [ Failure ] crbug.com/591099 virtual/layout_ng/fast/block/float/rubybase-children-moved-crash-2.html [ Crash Failure ] crbug.com/591099 virtual/layout_ng/fast/block/float/rubybase-children-moved-crash.html [ Failure ] crbug.com/591099 virtual/layout_ng/fast/block/margin-collapse/line-beside-float-complex-margin-collapsing.html [ Failure ] crbug.com/591099 virtual/layout_ng/fast/block/margin-collapse/self-collapsing-block-creates-block-formatting-context.html [ Failure ] -crbug.com/591099 virtual/mojo-loading/http/tests/canvas/canvas-filter-svg-external-multiple.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/cookies/multiple-cookies.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/credentialmanager/credentialscontainer-frame-errors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/dom/mutationobserver-parserappend-childlist.php [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/dom/script-module-load-incomplete-no-crash.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/download/default-encoding.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/eventsource-cors-redirect.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/eventsource-retry-precision.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/workers/eventsource-cors-basic.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/workers/eventsource-cors-with-credentials.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/workers/eventsource-eof.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/eventsource/workers/eventsource-url-attribute.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy-relocate-and-no-reload.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy/fullscreen-disabled.php [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy/payment-allowed-by-container-policy.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/feature-policy/payment-enabledforself.php [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/chromium/data-saver.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/chromium/discarded-window.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/chromium/mime-sniffing.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/referrer/origin-when-cross-origin-dedicated-worker.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/access-control-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/access-control.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/auth-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/auth-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/auth-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/auth.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cookie-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cookie-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cookie-nocors.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cookie.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cors-preflight-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cors-preflight.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cors-preflight2-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cors-preflight2.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/cors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/nocors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-credentials-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-loop-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-nocors.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect-password-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/redirect.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/scheme-blob-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker-proxied/thorough/scheme-blob.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/cache-override-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/filtered-response-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/filtered-response-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/headers-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/headers-guard-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/headers-guard.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/referrer-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/request-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/response-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/response-content-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/response-content.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/response.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/stream-reader.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/access-control-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/auth-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/auth-nocors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/auth-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/auth.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cookie-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cookie-nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cookie-nocors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cookie-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cookie.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-preflight-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-preflight2-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-preflight2-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/cors-preflight2.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/nocors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-credentials-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-credentials-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-credentials.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-loop-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-loop.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-nocors.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-password-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect-password-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/redirect.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/scheme-blob-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/scheme-data-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/serviceworker/thorough/scheme-data.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/block-mixed-content-nocors-base-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/body-mixin-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/cache-override.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/fetch-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/fetch.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/filtered-response-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/headers-guard-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/headers.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/pageimportancesignals.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/referrer-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/referrer.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/request.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/response-content.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/stream-reader-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/access-control-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/auth-nocors.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cookie-nocors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cookie.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cors-preflight-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cors-preflight.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cors-preflight2.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/cors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/nocors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/nocors-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-credentials-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-credentials-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-credentials.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-loop-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-loop.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-nocors-base-https-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-password-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-password-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/scheme-blob-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/scheme-blob.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/window/thorough/scheme-data-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/body-mixin-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/body-mixin.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/filtered-response.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/headers-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/request-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/request.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/stream-reader.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/auth-nocors-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/auth-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/cookie-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/cors-preflight-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/cors-preflight.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/cors-preflight2-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/cors.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/redirect-loop-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/redirect-nocors-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/redirect-other-https.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/redirect-password-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/redirect.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/scheme-blob-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/fetch/workers/thorough/scheme-data-base-https-other-https.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/post-replace-state-reload.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/push-state-in-grandchild-after-reload.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/redirect-303.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/redirect-307.html [ Crash Pass ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/redirect-js-location-assign-before-load.html [ Crash ] -crbug.com/591099 virtual/mojo-loading/http/tests/history/redirect-meta-refresh-0-seconds.html [ Crash ] crbug.com/591099 virtual/mojo-loading/http/tests/inspector-protocol/network/disable-interception-midway.html [ Failure Pass Timeout ] crbug.com/591099 virtual/mojo-loading/http/tests/inspector/appcache/appcache-iframe-manifests.html [ Pass Timeout ] crbug.com/591099 virtual/mojo-loading/http/tests/inspector/application-panel/storage-view-reports-quota.html [ Failure Pass Timeout ] @@ -22181,6 +21309,7 @@ crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-grandparent-composited-grandchild.html [ Failure ] crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-parent-composited-grandchild.html [ Failure ] crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-on-two-ancestors-composited-grandchild.html [ Failure ] +crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor.html [ Failure ] crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ] crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent.html [ Failure ] crbug.com/591099 virtual/prefer_compositing_to_lcd_text/compositing/overflow/clip-descendents.html [ Failure ] @@ -22611,15 +21740,7 @@ crbug.com/591099 virtual/threaded/animations/prefixed/animation-inherit-initial-unprefixed.html [ Failure ] crbug.com/591099 virtual/threaded/animations/prefixed/keyframes-cssom-prefixed-02.html [ Failure ] crbug.com/591099 virtual/threaded/animations/prefixed/keyframes-cssom-unprefixed-02.html [ Failure ] -crbug.com/591099 virtual/threaded/animations/responsive/animations-responsive-to-color-change.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/d-responsive.html [ Crash Pass ] crbug.com/591099 virtual/threaded/animations/responsive/interpolation/line-height-responsive.html [ Pass Timeout ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/svg-d-responsive.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/svg-points-responsive.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/svg-tableValues-responsive.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/svg-transform-responsive.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/interpolation/svg-x-list-responsive.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/responsive/svg-responsive-to-timing-updates.html [ Crash Pass ] crbug.com/591099 virtual/threaded/animations/rotate-transform-equivalent.html [ Failure Timeout ] crbug.com/591099 virtual/threaded/animations/skew-notsequential-compositor.html [ Failure Timeout ] crbug.com/591099 virtual/threaded/animations/stability/animation-end-event-destroy-renderer.html [ Failure ] @@ -22784,9 +21905,6 @@ crbug.com/591099 virtual/threaded/animations/svg-attribute-interpolation/svg-xChannelSelector-interpolation.html [ Crash Pass ] crbug.com/591099 virtual/threaded/animations/svg-attribute-interpolation/svg-y-list-interpolation.html [ Crash Pass ] crbug.com/591099 virtual/threaded/animations/svg-attribute-interpolation/svg-z-interpolation.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/svg/clear-svg-animation-effects.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/svg/css-animation-overrides-svg-presentation-attribute-animation.html [ Crash Pass ] -crbug.com/591099 virtual/threaded/animations/svg/svg-presentation-attribute-animation.html [ Crash Pass ] crbug.com/591099 virtual/threaded/animations/timing/timing-model.html [ Pass Timeout ] crbug.com/591099 virtual/threaded/compositing/visibility/compositing-and-visibility-turned-off-together.html [ Failure ] crbug.com/591099 virtual/threaded/compositing/visibility/hidden-iframe.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService index b683361b..3c5589f3 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
@@ -1474,7 +1474,7 @@ Bug(none) external/wpt/resource-timing/resource_connection_reuse.html [ Failure Timeout ] Bug(none) external/wpt/resource-timing/test_resource_timing.html [ Failure Timeout ] Bug(none) external/wpt/secure-contexts/basic-popup-and-iframe-tests.html [ Failure Timeout ] -Bug(none) external/wpt/service-workers [ Failure Timeout ] +Bug(none) external/wpt/service-workers [ Crash Failure Timeout ] Bug(none) external/wpt/storage/estimate-indexeddb-worker.https.html [ Failure Timeout ] Bug(none) external/wpt/storage/estimate-indexeddb.https.html [ Failure Timeout ] Bug(none) external/wpt/storage/interfaces.https.html [ Failure Timeout ] @@ -1590,6 +1590,7 @@ Bug(none) fast/canvas/canvas-createImageBitmap-drawImage.html [ Crash Failure ] Bug(none) fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html [ Timeout ] Bug(none) fast/canvas/canvas-createImageBitmap-immutable.html [ Crash Timeout ] +Bug(none) fast/canvas/canvas-createImageBitmap-invalid-args.html [ Crash ] Bug(none) fast/canvas/canvas-createImageBitmap-invalid-blob-in-workers.html [ Crash ] Bug(none) fast/canvas/canvas-createImageBitmap-resize.html [ Crash Failure ] Bug(none) fast/canvas/canvas-createImageBitmap-size-tooBig.html [ Crash ] @@ -1624,7 +1625,7 @@ Bug(none) fast/dom/Range/surround-contents-font-face-crash.svg [ Timeout ] Bug(none) fast/dom/StyleSheet/gc-parent-rule.html [ Timeout ] Bug(none) fast/dom/StyleSheet/gc-rule-children-wrappers.html [ Timeout ] -Bug(none) fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml [ Timeout ] +Bug(none) fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml [ Failure Timeout ] Bug(none) fast/dom/Window/customized-property-survives-gc.html [ Timeout ] Bug(none) fast/dom/Window/property-access-on-cached-properties-after-frame-navigated.html [ Timeout ] Bug(none) fast/dom/Window/property-access-on-cached-window-after-frame-navigated.html [ Timeout ] @@ -1865,7 +1866,7 @@ Bug(none) http/tests/appcache/update-cache.html [ Timeout ] Bug(none) http/tests/appcache/video.html [ Failure Timeout ] Bug(none) http/tests/appcache/whitelist-wildcard.html [ Failure ] -Bug(none) http/tests/appcache/xhr-foreign-resource.html [ Failure Timeout ] +Bug(none) http/tests/appcache/xhr-foreign-resource.html [ Crash Failure Timeout ] Bug(none) http/tests/background_fetch/background-fetch-click-event.https.html [ Timeout ] Bug(none) http/tests/background_fetch/background-fetch-event.https.html [ Timeout ] Bug(none) http/tests/background_fetch/background-fetch-fail-event.https.html [ Timeout ] @@ -1999,7 +2000,7 @@ Bug(none) http/tests/fetch/serviceworker/headers.html [ Failure Timeout ] Bug(none) http/tests/fetch/serviceworker/referrer-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/serviceworker/referrer.html [ Failure Timeout ] -Bug(none) http/tests/fetch/serviceworker/request-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/serviceworker/request-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/serviceworker/request.html [ Failure Timeout ] Bug(none) http/tests/fetch/serviceworker/response-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/serviceworker/response-content-base-https-other-https.html [ Timeout ] @@ -2056,10 +2057,10 @@ Bug(none) http/tests/fetch/serviceworker/thorough/scheme-data.html [ Timeout ] Bug(none) http/tests/fetch/window/block-mixed-content-base-https.html [ Timeout ] Bug(none) http/tests/fetch/window/block-mixed-content-nocors-base-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/body-mixin-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/body-mixin-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/body-mixin.html [ Failure ] Bug(none) http/tests/fetch/window/cache-override-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/fetch-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/fetch-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/fetch.html [ Failure ] Bug(none) http/tests/fetch/window/filtered-response-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/filtered-response-other-https.html [ Failure ] @@ -2072,22 +2073,22 @@ Bug(none) http/tests/fetch/window/response-content-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/response-content.html [ Failure ] Bug(none) http/tests/fetch/window/response.html [ Failure ] -Bug(none) http/tests/fetch/window/stream-reader-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/stream-reader-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/stream-reader.html [ Failure ] -Bug(none) http/tests/fetch/window/thorough/access-control-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/access-control-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/access-control.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/auth-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/auth-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/auth-nocors-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/auth-nocors-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/auth-nocors.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/auth-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/auth.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie-nocors-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie-nocors-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie-nocors.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/cookie.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/auth-nocors-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/auth-nocors.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/auth-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/auth.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie-nocors-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie-nocors-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie-nocors.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/cookie.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/cors-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/cors-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/cors-preflight-base-https-other-https.html [ Timeout ] @@ -2097,20 +2098,20 @@ Bug(none) http/tests/fetch/window/thorough/cors-preflight2-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/cors-preflight2.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/cors.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/nocors-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/nocors-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/nocors-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/nocors.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-credentials-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-credentials-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-credentials.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/nocors.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-credentials-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-credentials-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-credentials.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/redirect-loop-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-loop-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-loop-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/redirect-loop.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-nocors-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-nocors-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-nocors.html [ Timeout ] -Bug(none) http/tests/fetch/window/thorough/redirect-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-nocors-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-nocors-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-nocors.html [ Failure Timeout ] +Bug(none) http/tests/fetch/window/thorough/redirect-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/window/thorough/redirect-password-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/redirect-password-other-https.html [ Timeout ] Bug(none) http/tests/fetch/window/thorough/redirect-password.html [ Timeout ] @@ -2123,10 +2124,10 @@ Bug(none) http/tests/fetch/window/thorough/scheme-data.html [ Timeout ] Bug(none) http/tests/fetch/workers/block-mixed-content-base-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/block-mixed-content-nocors-base-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/body-mixin-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/workers/body-mixin-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/body-mixin.html [ Failure ] Bug(none) http/tests/fetch/workers/cache-override-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/fetch-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/workers/fetch-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/fetch.html [ Failure ] Bug(none) http/tests/fetch/workers/filtered-response-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/filtered-response-other-https.html [ Failure ] @@ -2139,22 +2140,22 @@ Bug(none) http/tests/fetch/workers/response-content-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/response-content.html [ Failure ] Bug(none) http/tests/fetch/workers/response.html [ Failure ] -Bug(none) http/tests/fetch/workers/stream-reader-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/workers/stream-reader-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/stream-reader.html [ Failure ] Bug(none) http/tests/fetch/workers/thorough/access-control-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/access-control.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/auth-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/workers/thorough/access-control.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/auth-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/thorough/auth-nocors-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/auth-nocors-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/auth-nocors.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/auth-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/auth.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie-nocors-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie-nocors-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie-nocors.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/cookie.html [ Timeout ] +Bug(none) http/tests/fetch/workers/thorough/auth-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/auth.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie-nocors-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie-nocors-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie-nocors.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/cookie.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/thorough/cors-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/cors-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/cors-preflight-base-https-other-https.html [ Timeout ] @@ -2167,14 +2168,14 @@ Bug(none) http/tests/fetch/workers/thorough/nocors-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/nocors-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/nocors.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/redirect-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/redirect-credentials-base-https-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/redirect-credentials-other-https.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/redirect-credentials.html [ Timeout ] +Bug(none) http/tests/fetch/workers/thorough/redirect-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/redirect-credentials-base-https-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/redirect-credentials-other-https.html [ Failure Timeout ] +Bug(none) http/tests/fetch/workers/thorough/redirect-credentials.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-loop-base-https-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-loop-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-loop.html [ Timeout ] -Bug(none) http/tests/fetch/workers/thorough/redirect-nocors-base-https-other-https.html [ Timeout ] +Bug(none) http/tests/fetch/workers/thorough/redirect-nocors-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-nocors-other-https.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-nocors.html [ Timeout ] Bug(none) http/tests/fetch/workers/thorough/redirect-other-https.html [ Timeout ] @@ -2433,7 +2434,7 @@ Bug(none) http/tests/security/contentSecurityPolicy/cascade/same-origin-with-own-policy-window-open.html [ Timeout ] Bug(none) http/tests/security/contentSecurityPolicy/cascade/same-origin-with-own-policy.html [ Timeout ] Bug(none) http/tests/security/contentSecurityPolicy/cascade/same-origin.html [ Timeout ] -Bug(none) http/tests/security/contentSecurityPolicy/frame-src-child-frame-navigates-to-blocked-origin.html [ Timeout ] +Bug(none) http/tests/security/contentSecurityPolicy/frame-src-child-frame-navigates-to-blocked-origin.html [ Failure Timeout ] Bug(none) http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html [ Failure ] Bug(none) http/tests/security/contentSecurityPolicy/frame-src-redirect-blocked.html [ Failure ] Bug(none) http/tests/security/contentSecurityPolicy/register-bypassing-scheme-script.https.html [ Timeout ] @@ -2474,7 +2475,7 @@ Bug(none) http/tests/security/mixedContent/blocked-blob-url-script-in-data-iframe.https.html [ Timeout ] Bug(none) http/tests/security/mixedContent/data-url-iframe-in-main-frame.html [ Timeout ] Bug(none) http/tests/security/mixedContent/data-url-script-in-data-iframe.https.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/filesystem-url-in-iframe.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/filesystem-url-in-iframe.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/insecure-async-post-xhr-blocked.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-audio-video-in-main-frame.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-css-image-with-reload.html [ Timeout ] @@ -2490,11 +2491,11 @@ Bug(none) http/tests/security/mixedContent/insecure-formSubmission-in-main-frame-blocked.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-formSubmission-in-main-frame-javascript-allowed.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-formSubmission-in-main-frame.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/insecure-frame-in-data-iframe-in-main-frame-blocked.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/insecure-frame-in-data-iframe-in-main-frame-blocked.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/insecure-iframe-in-iframe.html [ Failure ] -Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame-allowed.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame-blocked.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame-allowed.html [ Failure Timeout ] +Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame-blocked.html [ Failure Timeout ] +Bug(none) http/tests/security/mixedContent/insecure-iframe-in-main-frame.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/insecure-iframe-with-hsts.https.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-image-in-iframe.html [ Failure ] Bug(none) http/tests/security/mixedContent/insecure-image-in-main-frame-allowed.html [ Timeout ] @@ -2510,15 +2511,15 @@ Bug(none) http/tests/security/mixedContent/insecure-script-in-main-frame-blocked.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-script-through-redirection.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-srcset-in-main-frame-blocked.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/insecure-sync-post-xhr-allowed.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/insecure-sync-post-xhr-allowed.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/insecure-sync-post-xhr-blocked.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-texttrack-in-main-frame-blocked.html [ Timeout ] Bug(none) http/tests/security/mixedContent/insecure-xhr-in-main-frame.https.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/nonwebby-scheme-in-iframe-allowed.https.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/nonwebby-scheme-in-iframe-allowed.https.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/preload-insecure-image-in-main-frame-blocked.html [ Timeout ] -Bug(none) http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe.html [ Failure ] -Bug(none) http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html [ Timeout ] +Bug(none) http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html [ Failure Timeout ] Bug(none) http/tests/security/mixedContent/redirect-https-to-http-script-in-iframe.html [ Failure ] Bug(none) http/tests/security/mixedContent/strict-mode-image-blocked.https.html [ Timeout ] Bug(none) http/tests/security/mixedContent/strict-mode-image-in-frame-blocked.https.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests index a08b1ed1..f27a391 100644 --- a/third_party/WebKit/LayoutTests/SlowTests +++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -389,6 +389,8 @@ crbug.com/676572 [ Debug ] external/wpt/webstorage/storage_local_setitem_quotaexceedederr.html [ Slow ] +crbug.com/741259 editing/selection/select-bidi-run.html [ Slow ] + # These tests were previously marked Slow in ASANExpectations. crbug.com/451577 [ Linux ] inspector/elements/user-properties.html [ Slow ] crbug.com/451577 [ Linux ] inspector/layers/layer-canvas-log.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 1fb955be..b9e4821 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -419,21 +419,15 @@ # Inline: vertical-align. crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-table-zorder-005.xht [ Failure ] -# Inline: atomic inline preferred width. -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-valign-001.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure ] - # Inline: misc. crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-012.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-015.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inlines-013.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inlines-017.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/root-box-001.xht [ Failure ] # Margin collapsing quirks # https://html.spec.whatwg.org/multipage/rendering.html#margin-collapsing-quirks -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-width-007.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-025.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-002.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-003.xht [ Skip ] @@ -1862,9 +1856,6 @@ crbug.com/724251 virtual/threaded/animations/svg-attribute-interpolation/svg-startOffset-interpolation.html [ Failure Pass ] -crbug.com/739965 inspector/console/console-log-linkify-stack-in-errors.html [ NeedsManualRebaseline ] -crbug.com/739965 fast/events/window-onerror-12.html [ NeedsManualRebaseline ] - crbug.com/736050 external/wpt/IndexedDB/idbcursor_advance_index.htm [ Pass Failure ] crbug.com/736050 external/wpt/IndexedDB/idbcursor-continue-exception-order.htm [ Pass Failure ] crbug.com/736050 external/wpt/IndexedDB/idbcursor_continue_index2.htm [ Pass Failure ] @@ -2700,6 +2691,7 @@ # Sheriff failures 2017-03-10 crbug.com/402805 inspector-protocol/input/emulateTouchFromMouseEvent.js [ Timeout ] +crbug.com/741210 [ Mac ] inspector-protocol/emulation/device-emulation-restore.js [ Failure ] crbug.com/700374 [ Win ] virtual/mojo-loading/http/tests/inspector/workers-on-navigation.html [ Failure Pass ] crbug.com/700374 [ Win ] http/tests/inspector/workers-on-navigation.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.png b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.png new file mode 100644 index 0000000..29a0c21 --- /dev/null +++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.txt new file mode 100644 index 0000000..b65ecbaf --- /dev/null +++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor-expected.txt
@@ -0,0 +1,11 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x216 + LayoutBlockFlow {HTML} at (0,0) size 800x216 + LayoutBlockFlow {BODY} at (8,8) size 784x200 +layer at (8,8) size 200x200 + LayoutBlockFlow {DIV} at (0,0) size 200x200 [bgcolor=#D3D3D3] +layer at (8,308) size 100x100 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 100x100 +layer at (8,308) size 100x100 + LayoutBlockFlow {DIV} at (0,0) size 100x100 [bgcolor=#ADD8E6]
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor.html b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor.html new file mode 100644 index 0000000..021a3bfd --- /dev/null +++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-outside-bounds-of-compositing-ancestor.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<!-- Passes if there is a blue rounded-corner rect below the gray one --> +<div style="width: 200px; height: 200px; isolation: isolate; will-change: transform; background: lightgray"> + <div id=border-radius style="border-radius: 10px; overflow: hidden; position: relative; top: 300px; width: 100px; height: 100px;"> + <div id=child style="width: 100px; height: 100px; background: lightblue; will-change: transform"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run-expected.txt b/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run-expected.txt deleted file mode 100644 index ef0b8f5..0000000 --- a/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run-expected.txt +++ /dev/null
@@ -1,141 +0,0 @@ -This test ensures WebKit lets user select bidirectional text intuitively. To manually test, select text in blue box in each test case below by a mouse drag from left to right. The changes in the selected text should match the expectations before |. Do the same by a mouse drag from right to left and expectations are after |. - -Test "abcABC" in "abcABC": -Selecting from left to right -PASS selected "a" -PASS selected "ab" -PASS selected "abc" -PASS selected "abcAB" -PASS selected "abcA" -PASS selected "abcABC" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" -PASS selected "cABC" -PASS selected "bcABC" -PASS selected "abcABC" - -Test "ABCdef" in "ABCdef": -Selecting from left to right -PASS selected "C" -PASS selected "BC" -PASS selected "ABC" -PASS selected "ABCd" -FAIL selected "ABCde" but expected "ABCef" -PASS selected "ABCdef" -Selecting from right to left -PASS selected "f" -PASS selected "ef" -PASS selected "def" -PASS selected "BCdef" -PASS selected "Cdef" -PASS selected "ABCdef" - -Test "ABC" in "abcABCdef": -Selecting from left to right -PASS selected "C" -PASS selected "BC" -PASS selected "ABC" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" - -Test "ABC" in "ABCdef": -Selecting from left to right -PASS selected "C" -PASS selected "BC" -PASS selected "ABC" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" - -Test "ef" in "ABCdef": -Selecting from left to right -PASS selected "e" -PASS selected "ef" -Selecting from right to left -PASS selected "f" -PASS selected "ef" - -Test "AB" in "abcABC": -Selecting from left to right -PASS selected "B" -PASS selected "AB" -Selecting from right to left -PASS selected "A" -PASS selected "AB" - -Test "12" in "aXM12JNd": -Selecting from left to right -PASS selected "1" -PASS selected "12" -Selecting from right to left -PASS selected "2" -PASS selected "12" - -Test "ABC 123" in "ABC 123": -Selecting from left to right -PASS selected "1" -PASS selected "12" -PASS selected "123" -PASS selected " 123" -PASS selected "C 123" -PASS selected "BC 123" -PASS selected "ABC 123" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" -PASS selected "ABC " -PASS selected "ABC 12" -PASS selected "ABC 1" -PASS selected "ABC 123" - -Test "ABC 123" in "ABC 123": -Selecting from left to right -PASS selected "1" -PASS selected "12" -FAIL selected "123" but expected " 123" -FAIL selected " " but expected "C 123" -FAIL selected "C " but expected "BC 123" -FAIL selected "BC " but expected "ABC 123" -FAIL selected "123" but expected "undefined" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" -FAIL selected "" but expected "ABC " -PASS selected "ABC 12" -PASS selected "ABC 1" -FAIL selected "123" but expected "ABC 123" - -Test "ABC" in "aABCb": -Selecting from left to right -PASS selected "C" -PASS selected "BC" -PASS selected "ABC" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" - -Test "ABC" in "ABC": -Selecting from left to right -PASS selected "C" -PASS selected "BC" -PASS selected "ABC" -Selecting from right to left -PASS selected "A" -PASS selected "AB" -PASS selected "ABC" - -PASS successfullyParsed is true - -TEST COMPLETE - - - -
diff --git a/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run.html b/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run.html index de48643..b5c56af 100644 --- a/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run.html +++ b/third_party/WebKit/LayoutTests/editing/selection/select-bidi-run.html
@@ -1,158 +1,414 @@ -<!DOCTYPE html> -<html> -<head> -<meta http-equiv="content-type" content="text/html; charset=utf-8"> -<script src="../../resources/js-test.js"></script> -<style type="text/css"> -#tests { font-size: 2.5em; padding: 0px; margin: 0px; } -dt { width: 15ex; padding: 0px 10px; margin: 0px; } -dd { font-size: 0.6em; margin: 0px; padding: 0px 10px; } -.target { background-color: #bbeeff; } -.targetContainer { position: absolute; left: 10px; top: 0px; z-index: -5; } -</style> -</head> -<body> -<p>This test ensures WebKit lets user select bidirectional text intuitively. -To manually test, select text in blue box in each test case below by a mouse drag from left to right. -The changes in the selected text should match the expectations before |. -Do the same by a mouse drag from right to left and expectations are after |.</p> -<div>Selected text: <span id="log"></span></div> -<dl id="tests"> -<dt contenteditable><span class="target">abcאבג</span></dt> -<dd>a,ab,abc,abcAB,abcA,abcABC|A,AB,ABC,cABC,bcABC,abcABC</dd> +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> +<script> +// For https://bugs.webkit.org/show_bug.cgi?id=57340, which introduce +// VisibleSelection::Visible{Base,Extent}() and |original_base_| in +// |SelectionController|. -<dt contenteditable><span class="target">אבגdef</span></dt> -<dd>C,BC,ABC,ABCd,ABCef,ABCdef|f,ef,def,BCdef,Cdef,ABCdef</dd> +// TODO(editing-dev): We should make this test faster[1], e.g. do not drag +// all characters. +// [1] http://crbug.com/741259 +const kFontSize = '20px'; +const kMouseStep = 5; -<dt contenteditable>abc<span class="target">אבג</span>def</dt> -<dd>C,BC,ABC|A,AB,ABC</dd> - -<dt dir="rtl" contenteditable><span class="target">אבג</span>def</dt> -<dd>C,BC,ABC|A,AB,ABC</dd> - -<dt dir="rtl">אבגd<span class="target">ef</span></dt> -<dd>e,ef|f,ef</dd> - -<dt contenteditable>abc<span class="target">אב</span>ג</dt> -<dd>B,AB|A,AB</dd> - -<dt contenteditable>aקל<span class="target">12</span>יםd</dt> -<dd>1,12|2,12</dd> - -<dt contenteditable dir="rtl"><span class="target">אבג 123</span></dt> -<dd>1,12,123, 123,C 123,BC 123,ABC 123|A,AB,ABC,ABC ,ABC 12,ABC 1,ABC 123</dd> - -<dt contenteditable><span class="target">אבג 123</span></dt> -<dd>1,12, 123,C 123,BC 123,ABC 123|A,AB,ABC,ABC ,ABC 12,ABC 1,ABC 123</dd> - -<dt contenteditable style="position: relative;">aאבגb<div class="targetContainer">a<span class="target">אבג</span>b</div></dt> -<dd>C,BC,ABC|A,AB,ABC</dd> - -<dt contenteditable dir="ltr"><span class="target" dir="rtl">אבג<br></span></dt> -<dd>C,BC,ABC|A,AB,ABC</dd> - -<!--<dt contenteditable><span class="target">אבג 123 - 456</span></dt> -<dd>1,12, 123,C 123,BC 123,ABC 123|A,AB,ABC,ABC ,ABC 12,ABC 1,ABC 123</dd>--> - -</dl> -<div id="console"></div> -<pre><script> -var tests = document.getElementById('tests'); - -String.prototype.fold = function () { - var result = ''; - for (var i = 0; i < this.length; i++) { - var code = this.charCodeAt(i); - if (0x05d0 <= code && code <= 0x05ea)// Hebrew Alef - code += -0x05d0 + 'A'.charCodeAt(0); - result += String.fromCharCode(code); - } - return result; +function fold(string) { + const results = []; + for (let i = 0; i < string.length; i++) { + let code = string.charCodeAt(i); + if (0x05d0 <= code && code <= 0x05ea)// Hebrew Alef + code += -0x05d0 + 'A'.charCodeAt(0); + results.push(String.fromCharCode(code)); + } + return results.join(''); } -function assertEqual(expected, actual) { - document.writeln('E:' + expected + ' A:' + actual); +function startDrag(x, y) { + assert_exists(window, 'eventSender', 'This test requires window.eventSender'); + eventSender.dragMode = false; + + // Clear click count + eventSender.mouseMoveTo(0, 0); + eventSender.mouseDown(); + eventSender.mouseUp(); + + eventSender.mouseMoveTo(x, y); + eventSender.mouseDown(); } -function selectByMouseDragAndVerifyResult(target, leftToRight, expectations) { - var y = target.offsetTop + target.offsetHeight / 2; - var left = target.offsetLeft; - - offsetParent = target.offsetParent; - while (offsetParent) { - y += offsetParent.offsetTop; - left += offsetParent.offsetLeft; - offsetParent = offsetParent.offsetParent; - } - - var startX = left + (leftToRight ? 0 : target.offsetWidth); - eventSender.dragMode = false; - - // Clear click count - eventSender.mouseMoveTo(0, 0); - eventSender.mouseDown(); - eventSender.mouseUp(); - - eventSender.mouseMoveTo(startX, y); - eventSender.mouseDown(); - eventSender.leapForward(10); - - var previousSelectedText = ''; - var j = 0; - var xIncrement = leftToRight ? 1 : -1; - for (var x = startX; left <= x && x <= left + target.offsetWidth; x += xIncrement) { - eventSender.mouseMoveTo(x, y); - - var selectedText = window.getSelection().toString().fold(); - if (previousSelectedText != selectedText) { - if (expectations[j] == selectedText) - testPassed('selected "' + selectedText + '"'); - else - testFailed('selected "' + selectedText + '" but expected "' + expectations[j] + '"'); - previousSelectedText = selectedText; - j++; - } - } - - eventSender.mouseUp(); +function endDrag() { + eventSender.mouseUp(); } -if (window.testRunner) { - testRunner.dumpAsText(); +class StaticRange { + constructor(selection) { + this.anchorNode_ = selection.anchorNode; + this.anchorOffset_ = selection.anchorOffset; + this.focusNode_ = selection.focusNode; + this.focusOffset_ = selection.focusOffset; + } - var tests = document.getElementById('tests').getElementsByTagName('dt'); - var testExpectations = document.getElementById('tests').getElementsByTagName('dd'); - - for (var i = 0; i < tests.length; i++) { - tests[i].style.display = null; - testExpectations[i].style.display = null; - - var target = tests[i].getElementsByClassName('target')[0]; - var relativeTargets = tests[i].getElementsByClassName('relativeTarget'); - var testExpectation = testExpectations[i].textContent; - - debug('Test "' + target.textContent.fold() + '" in "' + target.parentNode.textContent.fold() + '":'); - debug('Selecting from left to right'); - selectByMouseDragAndVerifyResult(target, true, testExpectation.split(/\|/)[0].split(/,/)); - debug('Selecting from right to left'); - selectByMouseDragAndVerifyResult(target, false, testExpectation.split(/\|/)[1].split(/,/)); - debug(''); - - // Some tests may be ouside of the window so bring them in as we process. - tests[i].style.display = 'none'; - testExpectations[i].style.display = 'none'; - } - - document.getElementById('tests').style.display = 'none'; - document.getElementById('log').parentNode.style.display = 'none'; -} else { - debug('This test requires eventSender'); - document.onselectionchange = function () { - document.getElementById('log').textContent = window.getSelection().toString().fold(); - } + equals(other) { + return this.anchorNode_ == other.anchorNode_ && + this.anchorOffset_ == other.anchorOffset_ && + this.focusNode_ == other.focusNode_ && + this.focusOffset_ == other.focusOffset_; + } } +function moveRightUntilSelectionChanged(selection, left, right, y) { + const startRange = new StaticRange(selection); + for (let x = left; x <= right; x += kMouseStep) { + eventSender.mouseMoveTo(x, y); + if (!startRange.equals(new StaticRange(selection))) + return x; + } + throw 'moveRightUntilSelectionChanged failed'; +} +function moveLeftUntilSelectionChanged(selection, left, right, y) { + const startRange = new StaticRange(selection); + for (let x = right; x >= left; x -= kMouseStep) { + eventSender.mouseMoveTo(x, y); + if (!startRange.equals(new StaticRange(selection))) + return x; + } + throw 'moveLeftUntilSelectionChanged failed'; +} + +function dragLeftToRight(selection, count) { + const target = selection.document.querySelector('.target'); + const left = selection.computeLeft(target); + const right = left + target.offsetWidth; + const y = selection.computeTop(target); + startDrag(left, y); + let x = left; + for (let i = 0; i < count; ++i) + x = moveRightUntilSelectionChanged(selection, x, right, y); + endDrag(); +} + +function dragRightToLeft(selection, numberOfSelectionChanges) { + const target = selection.document.querySelector('.target'); + const left = selection.computeLeft(target); + const right = left + target.offsetWidth - 1; + const y = selection.computeTop(target); + startDrag(right, y); + let x = right; + for (let i = 0; i < numberOfSelectionChanges; ++i) + x = moveLeftUntilSelectionChanged(selection, left, x, y); + endDrag(); +} + +function testIt(drag, caseIndex, count, sample, expected, expectedText) { + test(() => assert_selection( + sample, + selection => { + selection.document.body.style.fontFamily = 'monospace'; + selection.document.body.style.fontSize = kFontSize; + drag(selection, count); + assert_equals(fold(selection.toString()), expectedText); + }, + expected), + `${caseIndex}-${count}: ${drag.name} expects "${expectedText}".`); +} + +const kSample1 = '<span class="target">abc\u05d0\u05d1\u05d2</span>'; +testIt(dragLeftToRight, 1, 1, kSample1, + '<span class="target">^a|bc\u05d0\u05d1\u05d2</span>', 'a'); +testIt(dragLeftToRight, 1, 2, kSample1, + '<span class="target">^ab|c\u05d0\u05d1\u05d2</span>', 'ab'); +testIt(dragLeftToRight, 1, 3, kSample1, + '<span class="target">^abc|\u05d0\u05d1\u05d2</span>', 'abc'); +testIt(dragLeftToRight, 1, 4, kSample1, + '<span class="target">^abc\u05d0\u05d1|\u05d2</span>', 'abcAB'); +testIt(dragLeftToRight, 1, 5, kSample1, + '<span class="target">^abc\u05d0|\u05d1\u05d2</span>', 'abcA'); +testIt(dragLeftToRight, 1, 6, kSample1, + '<span class="target">^abc\u05d0\u05d1\u05d2|</span>', 'abcABC'); + +testIt(dragRightToLeft, 1, 1, kSample1, + '<span class="target">abc^\u05d0|\u05d1\u05d2</span>', 'A'); +testIt(dragRightToLeft, 1, 2, kSample1, + '<span class="target">abc^\u05d0\u05d1|\u05d2</span>', 'AB'); +testIt(dragRightToLeft, 1, 3, kSample1, + '<span class="target">abc|\u05d0\u05d1\u05d2^</span>', 'ABC'); +testIt(dragRightToLeft, 1, 4, kSample1, + '<span class="target">ab|c\u05d0\u05d1\u05d2^</span>', 'cABC'); +testIt(dragRightToLeft, 1, 5, kSample1, + '<span class="target">a|bc\u05d0\u05d1\u05d2^</span>', 'bcABC'); +testIt(dragRightToLeft, 1, 6, kSample1, + '<span class="target">|abc\u05d0\u05d1\u05d2^</span>', 'abcABC'); + +const kSample2 = '<span class="target">\u05d0\u05d1\u05d2def</span>'; +testIt(dragLeftToRight, 2, 1, kSample2, + '<span class="target">\u05d0\u05d1|\u05d2^def</span>', 'C'); +testIt(dragLeftToRight, 2, 2, kSample2, + '<span class="target">\u05d0|\u05d1\u05d2^def</span>', 'BC'); +testIt(dragLeftToRight, 2, 3, kSample2, + '<span class="target">^\u05d0\u05d1\u05d2|def</span>', 'ABC'); +testIt(dragLeftToRight, 2, 4, kSample2, + '<span class="target">^\u05d0\u05d1\u05d2d|ef</span>', 'ABCd'); +testIt(dragLeftToRight, 2, 5, kSample2, + // TODO(editing-dev): This should be 'ABCef' instead of 'ABCde'. + '<span class="target">^\u05d0\u05d1\u05d2de|f</span>', 'ABCde'); +testIt(dragLeftToRight, 2, 6, kSample2, + '<span class="target">^\u05d0\u05d1\u05d2def|</span>', 'ABCdef'); + +testIt(dragRightToLeft, 2, 1, kSample2, + '<span class="target">\u05d0\u05d1\u05d2de|f^</span>', 'f'); +testIt(dragRightToLeft, 2, 2, kSample2, + '<span class="target">\u05d0\u05d1\u05d2d|ef^</span>', 'ef'); +testIt(dragRightToLeft, 2, 3, kSample2, + '<span class="target">\u05d0\u05d1\u05d2|def^</span>', 'def'); +testIt(dragRightToLeft, 2, 4, kSample2, + '<span class="target">\u05d0|\u05d1\u05d2def^</span>', 'BCdef'); +testIt(dragRightToLeft, 2, 5, kSample2, + '<span class="target">\u05d0\u05d1|\u05d2def^</span>', 'Cdef'); +testIt(dragRightToLeft, 2, 6, kSample2, + '<span class="target">|\u05d0\u05d1\u05d2def^</span>', 'ABCdef'); + +const kSample3 = 'abc<span class="target">\u05d0\u05d1\u05d2</span>def'; +testIt(dragLeftToRight, 3, 1, kSample3, + 'abc<span class="target">\u05d0\u05d1|\u05d2^</span>def', 'C'); +testIt(dragLeftToRight, 3, 2, kSample3, + 'abc<span class="target">\u05d0|\u05d1\u05d2^</span>def', 'BC'); +testIt(dragLeftToRight, 3, 3, kSample3, + 'abc<span class="target">^\u05d0\u05d1\u05d2|</span>def', 'ABC'); + +testIt(dragRightToLeft, 3, 1, kSample3, + 'abc<span class="target">^\u05d0|\u05d1\u05d2</span>def', 'A'); +testIt(dragRightToLeft, 3, 2, kSample3, + 'abc<span class="target">^\u05d0\u05d1|\u05d2</span>def', 'AB'); +testIt(dragRightToLeft, 3, 3, kSample3, + 'abc<span class="target">|\u05d0\u05d1\u05d2^</span>def', 'ABC'); + +const kSample4 = [ + '<div dir="rtl">', + '<span class="target">\u05d0\u05d1\u05d2</span>def', + '</div>', +].join(''); +testIt(dragLeftToRight, 4, 1, kSample4, + '<div dir="rtl"><span class="target">\u05d0\u05d1|\u05d2^</span>def</div>', + 'C'); +testIt(dragLeftToRight, 4, 2, kSample4, + '<div dir="rtl"><span class="target">\u05d0|\u05d1\u05d2^</span>def</div>', + 'BC'); +testIt(dragLeftToRight, 4, 3, kSample4, + '<div dir="rtl"><span class="target">|\u05d0\u05d1\u05d2^</span>def</div>', + 'ABC'); + +testIt(dragRightToLeft, 4, 1, kSample4, + '<div dir="rtl"><span class="target">^\u05d0|\u05d1\u05d2</span>def</div>', + 'A'); +testIt(dragRightToLeft, 4, 2, kSample4, + '<div dir="rtl"><span class="target">^\u05d0\u05d1|\u05d2</span>def</div>', + 'AB'); +testIt(dragRightToLeft, 4, 3, kSample4, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2|</span>def</div>', + 'ABC'); + +const kSample5 = '\u05d0\u05d1\u05d2d<span class="target">ef</span>'; +testIt(dragLeftToRight, 5, 1, kSample5, + '\u05d0\u05d1\u05d2d<span class="target">^e|f</span>', 'e'); +testIt(dragLeftToRight, 5, 2, kSample5, + '\u05d0\u05d1\u05d2d<span class="target">^ef|</span>', 'ef'); + +testIt(dragRightToLeft, 5, 1, kSample5, + '\u05d0\u05d1\u05d2d<span class="target">e|f^</span>', 'f'); +testIt(dragRightToLeft, 5, 2, kSample5, + '\u05d0\u05d1\u05d2d<span class="target">|ef^</span>', 'ef'); + +const kSample6 = 'abc<span class="target">\u05d0\u05d1</span>\u05d2'; +testIt(dragLeftToRight, 6, 1, kSample6, + 'abc<span class="target">\u05d0|\u05d1^</span>\u05d2', 'B'); +testIt(dragLeftToRight, 6, 2, kSample6, + 'abc<span class="target">|\u05d0\u05d1^</span>\u05d2', 'AB'); + +testIt(dragRightToLeft, 6, 1, kSample6, + 'abc<span class="target">^\u05d0|\u05d1</span>\u05d2', 'A'); +testIt(dragRightToLeft, 6, 2, kSample6, + 'abc<span class="target">^\u05d0\u05d1|</span>\u05d2', 'AB'); + +const kSample7 = 'a\u05e7\u05dc<span class="target">12</span>\u05d9\u05ddd'; +testIt(dragLeftToRight, 7, 1, kSample7, + 'a\u05e7\u05dc<span class="target">^1|2</span>\u05d9\u05ddd', '1'); +testIt(dragLeftToRight, 7, 2, kSample7, + 'a\u05e7\u05dc<span class="target">^12|</span>\u05d9\u05ddd', '12'); + +testIt(dragRightToLeft, 7, 1, kSample7, + 'a\u05e7\u05dc<span class="target">1|2^</span>\u05d9\u05ddd', '2'); +testIt(dragRightToLeft, 7, 2, kSample7, + 'a\u05e7\u05dc<span class="target">|12^</span>\u05d9\u05ddd', '12'); + +const kSample8 = [ + '<div dir="rtl">', + '<span class="target">\u05d0\u05d1\u05d2 123</span>', + '</div>', +].join(''); +testIt(dragLeftToRight, 8, 1, kSample8, + '<div dir="rtl"><span class="target">\u05d0\u05d1\u05d2 ^1|23</span></div>', + '1'); +testIt(dragLeftToRight, 8, 2, kSample8, + '<div dir="rtl"><span class="target">\u05d0\u05d1\u05d2 ^12|3</span></div>', + '12'); +testIt(dragLeftToRight, 8, 3, kSample8, + '<div dir="rtl"><span class="target">\u05d0\u05d1\u05d2 |123^</span></div>', + '123'); +testIt(dragLeftToRight, 8, 4, kSample8, + '<div dir="rtl"><span class="target">\u05d0\u05d1\u05d2| 123^</span></div>', + ' 123'); +testIt(dragLeftToRight, 8, 5, kSample8, + '<div dir="rtl"><span class="target">\u05d0\u05d1|\u05d2 123^</span></div>', + 'C 123'); +testIt(dragLeftToRight, 8, 6, kSample8, + '<div dir="rtl"><span class="target">\u05d0|\u05d1\u05d2 123^</span></div>', + 'BC 123'); +testIt(dragLeftToRight, 8, 7, kSample8, + '<div dir="rtl"><span class="target">|\u05d0\u05d1\u05d2 123^</span></div>', + 'ABC 123'); + +testIt(dragRightToLeft, 8, 1, kSample8, + '<div dir="rtl"><span class="target">^\u05d0|\u05d1\u05d2 123</span></div>', + 'A'); +testIt(dragRightToLeft, 8, 2, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1|\u05d2 123</span></div>', + 'AB'); +testIt(dragRightToLeft, 8, 3, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2| 123</span></div>', + 'ABC'); +testIt(dragRightToLeft, 8, 4, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2 |123</span></div>', + 'ABC '); +testIt(dragRightToLeft, 8, 5, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2 12|3</span></div>', + 'ABC 12'); +testIt(dragRightToLeft, 8, 6, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2 1|23</span></div>', + 'ABC 1'); +testIt(dragRightToLeft, 8, 7, kSample8, + '<div dir="rtl"><span class="target">^\u05d0\u05d1\u05d2 123|</span></div>', + 'ABC 123'); + +const kSample9 = '<span class="target">\u05d0\u05d1\u05d2 123</span>'; +testIt(dragLeftToRight, 9, 1, kSample9, + '<span class="target">\u05d0\u05d1\u05d2 ^1|23</span>', '1'); +testIt(dragLeftToRight, 9, 2, kSample9, + '<span class="target">\u05d0\u05d1\u05d2 ^12|3</span>', '12'); +testIt(dragLeftToRight, 9, 3, kSample9, + // TODO(editing-dev): This should be ' 123' instead of '123'. + '<span class="target">\u05d0\u05d1\u05d2 ^123|</span>', '123'); +testIt(dragLeftToRight, 9, 4, kSample9, + // TODO(editing-dev): This should be 'C 123' instead of ' '. + '<span class="target">\u05d0\u05d1\u05d2| ^123</span>', ' '); +testIt(dragLeftToRight, 9, 5, kSample9, + // TODO(editing-dev): This should be 'BC 123' instead of 'C '. + '<span class="target">\u05d0\u05d1|\u05d2 ^123</span>', 'C '); +testIt(dragLeftToRight, 9, 6, kSample9, + // TODO(editing-dev): This should be 'ABC 123' instead of 'BC '. + '<span class="target">\u05d0|\u05d1\u05d2 ^123</span>', 'BC '); +testIt(dragLeftToRight, 9, 7, kSample9, + // TODO(editing-dev): This should be '' instead of '123'. + '<span class="target">\u05d0\u05d1\u05d2 ^123|</span>', '123'); + +testIt(dragRightToLeft, 9, 1, kSample9, + '<span class="target">^\u05d0|\u05d1\u05d2 123</span>', 'A'); +testIt(dragRightToLeft, 9, 2, kSample9, + '<span class="target">^\u05d0\u05d1|\u05d2 123</span>', 'AB'); +testIt(dragRightToLeft, 9, 3, kSample9, + '<span class="target">^\u05d0\u05d1\u05d2| 123</span>', 'ABC'); +testIt(dragRightToLeft, 9, 4, kSample9, + // TODO(editing-dev): This should be 'ABC ' instead of ''. + '<span class="target">\u05d0\u05d1\u05d2 123|</span>', ''); +testIt(dragRightToLeft, 9, 5, kSample9, + '<span class="target">^\u05d0\u05d1\u05d2 12|3</span>', 'ABC 12'); +testIt(dragRightToLeft, 9, 6, kSample9, + '<span class="target">^\u05d0\u05d1\u05d2 1|23</span>', 'ABC 1'); +testIt(dragRightToLeft, 9, 7, kSample9, + // TODO(editing-dev): This should be 'ABC 123' instead of ''. + '<span class="target">\u05d0\u05d1\u05d2 |123^</span>', '123'); + +// For https://bugs.webkit.org/show_bug.cgi?id=73056 +const kStyle10 = 'position: absolute; left: 0px; top: 0px; z-index: -5;'; +const kSample10 = [ + '<div style="position: relative;">', + 'a\u05d0\u05d1\u05d2b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' +].join(''); + +testIt(dragLeftToRight, 10, 1, kSample10, + [ + '<div style="position: relative;">', + 'a\u05d0\u05d1|\u05d2^b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'C'); +testIt(dragLeftToRight, 10, 2, kSample10, + [ + '<div style="position: relative;">', + 'a\u05d0|\u05d1\u05d2^b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'BC'); +testIt(dragLeftToRight, 10, 3, kSample10, + [ + '<div style="position: relative;">', + 'a^\u05d0\u05d1\u05d2|b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'ABC'); + +testIt(dragRightToLeft, 10, 1, kSample10, + [ + '<div style="position: relative;">', + 'a^\u05d0|\u05d1\u05d2b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'A'); +testIt(dragRightToLeft, 10, 2, kSample10, + [ + '<div style="position: relative;">', + 'a^\u05d0\u05d1|\u05d2b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'AB'); +; +testIt(dragRightToLeft, 10, 3, kSample10, + [ + '<div style="position: relative;">', + 'a|\u05d0\u05d1\u05d2^b', + `<div style="${kStyle10}">`, + 'a<span class="target">\u05d0\u05d1\u05d2</span>b', + '</div>', + '</div>' + ].join(''), 'ABC'); + +const kSample11 = '<span class="target" dir="rtl">\u05d0\u05d1\u05d2<br></span>'; +testIt(dragLeftToRight, 11, 1, kSample11, + '<span class="target" dir="rtl">\u05d0\u05d1|\u05d2^<br></span>', 'C'); +testIt(dragLeftToRight, 11, 2, kSample11, + '<span class="target" dir="rtl">\u05d0|\u05d1\u05d2^<br></span>', 'BC'); +testIt(dragLeftToRight, 11, 3, kSample11, + '<span class="target" dir="rtl">^\u05d0\u05d1\u05d2|<br></span>', 'ABC'); + +testIt(dragRightToLeft, 11, 1, kSample11, + '<span class="target" dir="rtl">^\u05d0|\u05d1\u05d2<br></span>', 'A'); +testIt(dragRightToLeft, 11, 2, kSample11, + '<span class="target" dir="rtl">^\u05d0\u05d1|\u05d2<br></span>', 'AB'); +testIt(dragRightToLeft, 11, 3, kSample11, + '<span class="target" dir="rtl">|\u05d0\u05d1\u05d2^<br></span>', 'ABC'); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary-expected.txt b/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary-expected.txt deleted file mode 100644 index f7166c5..0000000 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary-expected.txt +++ /dev/null
@@ -1,32 +0,0 @@ -mac -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 5 -PASS selection.focusNode.data is "rd " -PASS selection.focusOffset is 2 -PASS selection.toString() is "word" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -win -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 7 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 7 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -unix -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 7 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 7 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -android -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 7 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 7 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary.html b/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary.html deleted file mode 100644 index db18303a..0000000 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-combined-delete-boundary.html +++ /dev/null
@@ -1,52 +0,0 @@ -<!DOCTYPE html> -<html> -<body> -<div id="container"> -<p id="description"></p> -<p>To test manually, place the cursor after 'o' in 'word' and delete it character by character. Do ctrl+z. On Mac, 'word' should be selected. On other platforms 'word' should not be selected and the cursor should be placed after 'o' in 'word'.</p> -<div id="test" style="border: 2px solid red;" contenteditable>This wo<b>rd </b>should be selected only on mac.</div> -</div> -<div id="console"></div> -<script src="../../resources/js-test.js"></script> -<script> -description('Verifies the selection behavior on undoing a text deletion.'); -var sampleHTML = 'This wo<b>rd </b>should be selected only on mac.'; -var selectionNode = document.getElementById('test').firstChild; // Text node 'This wo' -var selectionOffset = selectionNode.length; -var endNodeMac = document.getElementById('test').childNodes[1].firstChild; // Text node 'rd ' -var endOffsetMac = endNodeMac.length - 1; -var startOffsetMac = selectionNode.data.indexOf(' ')+1; -var selection = window.getSelection(); - -function $(id) { return document.getElementById(id); } - -function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndNode, expectedEndOffset, selectedText) { - debug(platform); - internals.settings.setEditingBehavior(platform); - - selection.collapse(selectionNode, selectionOffset); - for (var i = 0; i < 2; i++) - document.execCommand('delete'); - for (var i = 0; i < 2; i++) - document.execCommand('forwarddelete'); - document.execCommand('undo'); - - shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data); - shouldBe('selection.anchorOffset', expectedStartOffset + ''); - shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data); - shouldBe('selection.focusOffset', expectedEndOffset + ''); - shouldBeEqualToString('selection.toString()', selectedText); - shouldBeEqualToString('$("test").innerHTML', sampleHTML); -} - -if (window.internals) { - undoTest('mac', selectionNode, startOffsetMac, endNodeMac, endOffsetMac, 'word'); - undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('android', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); -} -if (window.testRunner) - document.getElementById('container').outerHTML = ''; -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary-expected.txt b/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary-expected.txt deleted file mode 100644 index 7650073..0000000 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary-expected.txt +++ /dev/null
@@ -1,32 +0,0 @@ -mac -PASS selection.anchorNode.data is "rd " -PASS selection.anchorOffset is 2 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 5 -PASS selection.toString() is "word" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -win -PASS selection.anchorNode.data is "rd " -PASS selection.anchorOffset is 2 -PASS selection.focusNode.data is "rd " -PASS selection.focusOffset is 2 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -unix -PASS selection.anchorNode.data is "rd " -PASS selection.anchorOffset is 2 -PASS selection.focusNode.data is "rd " -PASS selection.focusOffset is 2 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -android -PASS selection.anchorNode.data is "rd " -PASS selection.anchorOffset is 2 -PASS selection.focusNode.data is "rd " -PASS selection.focusOffset is 2 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary.html b/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary.html index 1e5da23..849271c0 100644 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary.html +++ b/third_party/WebKit/LayoutTests/editing/undo/undo-delete-boundary.html
@@ -1,49 +1,74 @@ -<!DOCTYPE html> -<html> -<body> -<div id="container"> -<p id="description"></p> -<p>To test manually, place the cursor at the end of 'word' and delete it completely character by character. Do ctrl+z. On Mac, 'word' should be selected. On other platforms 'word' should not be selected and the cursor should be placed at the end of 'word'.</p> -<div id="test" style="border: 2px solid red;" contenteditable >This wo<b>rd </b>should be selected only on mac.</div> -</div> -<div id="console"></div> -<script src="../../resources/js-test.js"></script> +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> <script> -description('Verifies the selection behavior on undoing a text deletion.'); -var sampleHTML = 'This wo<b>rd </b>should be selected only on mac.'; -var selectionNode = document.getElementById('test').childNodes[1].firstChild; // Text node 'rd ' -var selectionOffset = selectionNode.length - 1; -var endNodeMac = document.getElementById('test').firstChild; // Text node 'This wo' -var endOffsetMac = endNodeMac.data.indexOf(' ') + 1; -var selection = window.getSelection(); +// Verifies the selection behavior on undoing a text deletion. +function undoTest(behavior) { + if (window.internals) + internals.settings.setEditingBehavior(behavior); + test(() => assert_selection( + [ + '<div contenteditable>', + 'This wo<b>rd| </b>should be selected only on mac.', + '</div>' + ].join(''), + selection => { + for (let i = 0; i < 4; ++i) + selection.document.execCommand('delete'); + selection.document.execCommand('undo'); + }, + [ + '<div contenteditable>', + behavior === 'mac' + ? 'This |wo<b>rd^ </b>should be selected only on mac.' + : 'This wo<b>rd| </b>should be selected only on mac.', + '</div>', + ].join('')), + `${behavior}: backward delete`); -function $(id) { return document.getElementById(id); } + test(() => assert_selection( + [ + '<div contenteditable>', + 'This |wo<b>rd </b>should be selected only on mac.', + '</div>' + ].join(''), + selection => { + for (let i = 0; i < 4; ++i) + selection.document.execCommand('forwardDelete'); + selection.document.execCommand('undo'); + }, + [ + '<div contenteditable>', + behavior === 'mac' + ? 'This ^wo<b>rd| </b>should be selected only on mac.' + : 'This |wo<b>rd </b>should be selected only on mac.', + '</div>', + ].join('')), + `${behavior}: forward delete`); -function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndNode, expectedEndOffset, selectedText) { - debug(platform); - internals.settings.setEditingBehavior(platform); - - selection.collapse(selectionNode, selectionOffset); - for (var i = 0; i < 4; i++) - document.execCommand('delete'); - document.execCommand('undo'); - - shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data); - shouldBe('selection.anchorOffset', expectedStartOffset + ''); - shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data); - shouldBe('selection.focusOffset', expectedEndOffset + ''); - shouldBeEqualToString('selection.toString()', selectedText); - shouldBeEqualToString('$("test").innerHTML', sampleHTML); + test(() => assert_selection( + [ + '<div contenteditable>', + 'This wo|<b>rd </b>should be selected only on mac.', + '</div>' + ].join(''), + selection => { + for (let i = 0; i < 2; ++i) + selection.document.execCommand('delete'); + for (let i = 0; i < 2; ++i) + selection.document.execCommand('forwardDelete'); + selection.document.execCommand('undo'); + }, + [ + '<div contenteditable>', + behavior === 'mac' + ? 'This ^wo<b>rd| </b>should be selected only on mac.' + : 'This wo|<b>rd </b>should be selected only on mac.', + '</div>', + ].join('')), + `${behavior}: backward and forward delete`); } - -if (window.internals) { - undoTest('mac', selectionNode, selectionOffset, endNodeMac, endOffsetMac, 'word'); - undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('android', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); -} -if (window.testRunner) - document.getElementById('container').outerHTML = ''; +for (let behavior of ['android', 'mac', 'unix', 'win']) + undoTest(behavior); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary-expected.txt b/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary-expected.txt deleted file mode 100644 index eba38e0..0000000 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary-expected.txt +++ /dev/null
@@ -1,32 +0,0 @@ -mac -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 5 -PASS selection.focusNode.data is "rd " -PASS selection.focusOffset is 2 -PASS selection.toString() is "word" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -win -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 5 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 5 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -unix -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 5 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 5 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -android -PASS selection.anchorNode.data is "This wo" -PASS selection.anchorOffset is 5 -PASS selection.focusNode.data is "This wo" -PASS selection.focusOffset is 5 -PASS selection.toString() is "" -PASS $("test").innerHTML is "This wo<b>rd </b>should be selected only on mac." -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary.html b/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary.html deleted file mode 100644 index c1aeffa..0000000 --- a/third_party/WebKit/LayoutTests/editing/undo/undo-forward-delete-boundary.html +++ /dev/null
@@ -1,49 +0,0 @@ -<!DOCTYPE html> -<html> -<body> -<div id="container"> -<p id="description"></p> -<p>To test manually, place the cursor before 'w' of 'word' and delete it completely character by character. Do ctrl+z. On Mac, 'word' should be selected. On other platforms 'word' should not be selected and the cursor should be placed before 'w' of 'word'.</p> -<div id="test" style="border: 2px solid red;" contenteditable>This wo<b>rd </b>should be selected only on mac.</div> -</div> -<div id="console"></div> -<script src="../../resources/js-test.js"></script> -<script> -description('Verifies the selection behavior on undoing a text deletion.'); -var sampleHTML = 'This wo<b>rd </b>should be selected only on mac.'; -var selectionNode = document.getElementById('test').firstChild; // Text node 'This wo' -var selectionOffset = selectionNode.data.indexOf(' ') + 1; -var endNodeMac = document.getElementById('test').childNodes[1].firstChild; // Text node 'rd ' -var endOffsetMac = endNodeMac.length - 1; -var selection = window.getSelection(); - -function $(id) { return document.getElementById(id); } - -function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndNode, expectedEndOffset, selectedText) { - debug(platform); - internals.settings.setEditingBehavior(platform); - - selection.collapse(selectionNode, selectionOffset); - for (var i = 0; i < 4; i++) - document.execCommand('forwarddelete'); - document.execCommand('undo'); - - shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data); - shouldBe('selection.anchorOffset', expectedStartOffset + ''); - shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data); - shouldBe('selection.focusOffset', expectedEndOffset + ''); - shouldBeEqualToString('selection.toString()', selectedText); - shouldBeEqualToString('$("test").innerHTML', sampleHTML); -} - -if (window.internals) { - undoTest('mac', selectionNode, selectionOffset, endNodeMac, endOffsetMac, 'word'); - undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); - undoTest('android', selectionNode, selectionOffset, selectionNode, selectionOffset, ''); -} -if (window.testRunner) - document.getElementById('container').outerHTML = ''; -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote-expected.txt index 0b6d0e0..7f11df0e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE ERROR: line 29: Not allowed to load local resource: localScript.js +CONSOLE ERROR: line 35: Not allowed to load local resource: localScript.js This test is to see if a remote file can run a local script. Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote.html b/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote.html index 72346fc..66e45d2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/local-JavaScript-from-remote.html
@@ -4,8 +4,10 @@ var secretness = 0; function test() { - if (window.testRunner) + if (window.testRunner) { testRunner.dumpAsText(); + testRunner.waitUntilDone(); + } var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js"; if (window.testRunner) @@ -19,11 +21,15 @@ tag.innerHTML = "Test Failed. Local script loaded and run."; else tag.innerHTML = "Test Failed. Local script loaded, but not successfully run."; + if (window.testRunner) + testRunner.notifyDone(); }); localScriptElement.addEventListener("error", function() { var tag = document.getElementById("result"); tag.innerHTML = "Test Passed: Local script not loaded."; + if (window.testRunner) + testRunner.notifyDone(); }); document.body.appendChild(localScriptElement)
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml-expected.txt index b0d4a300..fc1fcdd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml-expected.txt
@@ -1,5 +1,4 @@ CONSOLE ERROR: Failed to find a valid digest in the 'integrity' attribute for resource 'http://127.0.0.1:8000/security/subresourceIntegrity/resources/shared-with-xhtml.js' with computed SHA-256 integrity 'yM5ZyzNsyKfaXRY78zSGapeQKtl0oGdpPpYxgwl8XW8='. The resource has been blocked. -ALERT: FAIL -This test passes if only one 'FAIL' alert appears. +This test passes if no 'FAIL' alert appears.
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml.html b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml.html index 46aab8d0..a0fa8ac 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml.html
@@ -6,7 +6,7 @@ testRunner.dumpAsText(); </script> <p> - This test passes if only one 'FAIL' alert appears. + This test passes if no 'FAIL' alert appears. </p> <iframe src="resources/shared-with-xhtml.xhtml"></iframe> <iframe src="resources/shared-with-xhtml.html"></iframe>
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml-expected.txt new file mode 100644 index 0000000..2e25c64 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml-expected.txt
@@ -0,0 +1,4 @@ +CONSOLE ERROR: Failed to find a valid digest in the 'integrity' attribute for resource 'http://127.0.0.1:8000/security/subresourceIntegrity/fail.js?test=xhtml' with computed SHA-256 integrity 'yM5ZyzNsyKfaXRY78zSGapeQKtl0oGdpPpYxgwl8XW8='. The resource has been blocked. +CONSOLE ERROR: Failed to find a valid digest in the 'integrity' attribute for resource 'http://127.0.0.1:8000/security/subresourceIntegrity/fail.js?test=xhtml' with computed SHA-256 integrity 'yM5ZyzNsyKfaXRY78zSGapeQKtl0oGdpPpYxgwl8XW8='. The resource has been blocked. +CONSOLE ERROR: Failed to find a valid digest in the 'integrity' attribute for resource 'http://127.0.0.1:8000/security/subresourceIntegrity/fail.js?test=xhtml' with computed SHA-256 integrity 'yM5ZyzNsyKfaXRY78zSGapeQKtl0oGdpPpYxgwl8XW8='. The resource has been blocked. +This test passes if no 'FAIL' alert appears.
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml.xhtml b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml.xhtml new file mode 100644 index 0000000..eb15687 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-xhtml.xhtml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <body> + <script> + if (window.testRunner) + testRunner.dumpAsText(); + </script> + <p> + This test passes if no 'FAIL' alert appears. + </p> + <script src='fail.js?test=xhtml' integrity="sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE="></script> + <script src='fail.js?test=xhtml' integrity="sha384-XVVXBGoYw6AJOh9J_Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup_tA1v5GPr"></script> + <script src='fail.js?test=xhtml' integrity="sha512-tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ-07yMK81ytlg0MPaIrPAjcHqba5csorDWtKg=="></script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-2-expected.png index aa15f9a..1883126 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-2-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-2-expected.png index 1af98782..cdcb0a7c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-2-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index 9889630..4e696b1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -759,6 +759,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index 593448a..38903fe 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -759,6 +759,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-2-expected.png index 03399fe..5771c04 100644 --- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-2-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-expected.html new file mode 100644 index 0000000..1547d19 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-expected.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<style> + html { + background-color: grey; + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-expected.html new file mode 100644 index 0000000..1547d19 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-expected.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<style> + html { + background-color: grey; + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller-expected.html new file mode 100644 index 0000000..1547d19 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller-expected.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<style> + html { + background-color: grey; + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller.html new file mode 100644 index 0000000..493d8383 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe-scroller.html
@@ -0,0 +1,57 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be grey. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + var iframe = document.getElementById("iframe"); + document.rootScroller = iframe; + iframe.contentDocument.rootScroller = iframe.contentDocument.getElementById("scroller"); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #iframe { + position: absolute; + width: 100%; + height: 100%; + border: 0; + } +</style> + +<iframe id="iframe" srcdoc=" + <style> + html,body { + height: 100vh; + width: 100%; + margin:0; + background-color: maroon; + } + #scroller { + position: absolute; + width: 100%; + height: 100%; + background-color: grey; + overflow: auto; + } + </style> + <div id='scroller'></div>"></iframe>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe.html new file mode 100644 index 0000000..011489a --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-iframe.html
@@ -0,0 +1,39 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be grey. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + document.rootScroller = document.getElementById("scroller"); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #scroller { + position: absolute; + width: 100%; + height: 100%; + border: 0; + } +</style> + +<iframe id="scroller" srcdoc="<style>html {background-color: grey;}</style>"></iframe>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified-expected.html new file mode 100644 index 0000000..1547d19 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified-expected.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<style> + html { + background-color: grey; + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified.html new file mode 100644 index 0000000..7308996 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background-modified.html
@@ -0,0 +1,51 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be grey. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + testRunner.waitUntilDone(); + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + document.rootScroller = document.getElementById("scroller"); + requestAnimationFrame(function() { + document.rootScroller.style.backgroundColor = "grey"; + requestAnimationFrame(function() { + testRunner.notifyDone(); + }); + }); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #scroller { + width: 100%; + height: 100%; + overflow: auto; + } + #content { + width: 10px; + height: 20px; + } +</style> + +<div id="scroller"> + <div id="content"></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background.html new file mode 100644 index 0000000..ccfee3db --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-background.html
@@ -0,0 +1,46 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be grey. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + document.rootScroller = document.getElementById("scroller"); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #scroller { + position: absolute; + width: 100%; + height: 100%; + overflow: auto; + background-color: grey; + } + #content { + width: 10px; + height: 20px; + } +</style> + +<div id="scroller"> + <div id="content"></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-expected.html new file mode 100644 index 0000000..05d5627 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-expected.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html { + height: 100%; + background: linear-gradient(green, blue); + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-expected.html new file mode 100644 index 0000000..05d5627 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-expected.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html { + height: 100%; + background: linear-gradient(green, blue); + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller-expected.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller-expected.html new file mode 100644 index 0000000..05d5627 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller-expected.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html { + height: 100%; + background: linear-gradient(green, blue); + } +</style>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller.html new file mode 100644 index 0000000..ea868f4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe-scroller.html
@@ -0,0 +1,58 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be a green-blue gradient that starts + // repeating 100px from the bottom. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + var iframe = document.getElementById("iframe"); + document.rootScroller = iframe; + iframe.contentDocument.rootScroller = iframe.contentDocument.getElementById("scroller"); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #iframe { + position: absolute; + width: 100%; + height: 100%; + border: 0; + } +</style> + +<iframe id="iframe" srcdoc=" + <style> + html,body { + height: 100vh; + width: 100%; + margin:0; + background-color: maroon; + } + #scroller { + position: absolute; + width: 100%; + height: 100%; + background: linear-gradient(green, blue); + overflow: auto; + } + </style> + <div id='scroller'></div>"></iframe>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe.html new file mode 100644 index 0000000..f778751 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background-iframe.html
@@ -0,0 +1,39 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should be a green-blue gradient that starts + // repeating 100px from the bottom. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + document.rootScroller = document.getElementById("scroller"); + }); +</script> +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #scroller { + width: 100%; + height: 100%; + border: 0; + } +</style> + +<iframe id="scroller" srcdoc="<style>html {height: 100%; background: linear-gradient(green, blue);}</style>"></iframe>
diff --git a/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background.html b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background.html new file mode 100644 index 0000000..169c0b6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/android/fast/rootscroller/browser-controls-gradient-background.html
@@ -0,0 +1,49 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no" /> +<script> + // Set the browser control height but set them to be hidden so that the + // viewport is taller than the root scroller. This test passes if the root + // scroller's background is painted into the enitre height of the viewport. + // That is, the full viewport should have a red-orange gradient that repeats + // near the bottom. + // NOTE: It is important that this test be run with the Android viewport + // flags turned on. + if (window.internals) { + window.internals.setBrowserControlsState(100, false); + } + + addEventListener("load", function() { + document.rootScroller = document.getElementById("scroller"); + }); +</script> +<style> + +<style> + ::-webkit-scrollbar { + width: 0px; + height: 0px; + } + html, body { + height: 100%; + width: 100%; + margin: 0; + } + body { + background-color: red; + } + #scroller { + position: absolute; + width: 100%; + height: 100%; + overflow: auto; + background: linear-gradient(green, blue); + } + #content { + width: 10px; + height: 20px; + } +</style> + +<div id="scroller"> + <div id="content"></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt index 4232580..59e2341 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -974,6 +974,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt index 3f242fd..d7d9625 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -974,6 +974,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index 029d6f1b7..8247901 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -760,6 +760,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index 2ffc9bf..d4f6a25f 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -760,6 +760,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 7db7f71b..7c83dff 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -982,6 +982,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt index 41bc19b..8c28435 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -982,6 +982,11 @@ [Worker] method unwrapKey [Worker] method verify [Worker] method wrapKey +[Worker] interface SyncManager +[Worker] attribute @@toStringTag +[Worker] method constructor +[Worker] method getTags +[Worker] method register [Worker] interface TextDecoder [Worker] attribute @@toStringTag [Worker] getter encoding
diff --git a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp index 4786b79..c2b32d16 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp
@@ -402,7 +402,8 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_TRUE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), UnorderedElementsAre("encrypt", "decrypt")); + EXPECT_EQ(kWebCryptoKeyUsageEncrypt | kWebCryptoKeyUsageDecrypt, + new_key->Key().Usages()); // Check that the keys have the same raw representation. WebVector<uint8_t> key_raw = @@ -438,7 +439,7 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_FALSE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), UnorderedElementsAre("decrypt")); + EXPECT_EQ(kWebCryptoKeyUsageDecrypt, new_key->Key().Usages()); // Check that it can successfully decrypt data. Vector<uint8_t> iv(16, 0); @@ -473,7 +474,8 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_TRUE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), UnorderedElementsAre("sign", "verify")); + EXPECT_EQ(kWebCryptoKeyUsageSign | kWebCryptoKeyUsageVerify, + new_key->Key().Usages()); // Check that the keys have the same raw representation. WebVector<uint8_t> key_raw = @@ -510,7 +512,7 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_FALSE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), UnorderedElementsAre("verify")); + EXPECT_EQ(kWebCryptoKeyUsageVerify, new_key->Key().Usages()); // Check that it can successfully verify a signature. Vector<uint8_t> message{1, 2, 3}; @@ -547,7 +549,7 @@ CryptoKey* new_private_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("private", new_private_key->type()); EXPECT_TRUE(new_private_key->extractable()); - EXPECT_THAT(new_private_key->usages(), UnorderedElementsAre("sign")); + EXPECT_EQ(kWebCryptoKeyUsageSign, new_private_key->Key().Usages()); // Check that the keys have the same PKCS8 representation. WebVector<uint8_t> key_raw = @@ -593,7 +595,7 @@ CryptoKey* new_public_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("public", new_public_key->type()); EXPECT_TRUE(new_public_key->extractable()); - EXPECT_THAT(new_public_key->usages(), UnorderedElementsAre("verify")); + EXPECT_EQ(kWebCryptoKeyUsageVerify, new_public_key->Key().Usages()); // Check that it can successfully verify a signature. Vector<uint8_t> message{1, 2, 3}; @@ -638,7 +640,7 @@ CryptoKey* new_private_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("private", new_private_key->type()); EXPECT_TRUE(new_private_key->extractable()); - EXPECT_THAT(new_private_key->usages(), UnorderedElementsAre("sign")); + EXPECT_EQ(kWebCryptoKeyUsageSign, new_private_key->Key().Usages()); // Check that the keys have the same PKCS8 representation. WebVector<uint8_t> key_raw = @@ -679,7 +681,7 @@ CryptoKey* new_public_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("public", new_public_key->type()); EXPECT_TRUE(new_public_key->extractable()); - EXPECT_THAT(new_public_key->usages(), UnorderedElementsAre("verify")); + EXPECT_EQ(kWebCryptoKeyUsageVerify, new_public_key->Key().Usages()); // Check that it can successfully verify a signature. Vector<uint8_t> message{1, 2, 3}; @@ -714,7 +716,7 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_FALSE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), UnorderedElementsAre("deriveBits")); + EXPECT_EQ(kWebCryptoKeyUsageDeriveBits, new_key->Key().Usages()); // Check that the keys derive the same bits. WebCryptoAlgorithm hash(kWebCryptoAlgorithmIdSha256, nullptr); @@ -744,8 +746,8 @@ CryptoKey* new_key = V8CryptoKey::toImpl(result.As<v8::Object>()); EXPECT_EQ("secret", new_key->type()); EXPECT_FALSE(new_key->extractable()); - EXPECT_THAT(new_key->usages(), - UnorderedElementsAre("deriveKey", "deriveBits")); + EXPECT_EQ(kWebCryptoKeyUsageDeriveKey | kWebCryptoKeyUsageDeriveBits, + new_key->Key().Usages()); // Check that it derives the right bits. WebCryptoAlgorithm hash(kWebCryptoAlgorithmIdSha256, nullptr);
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 7bb7cd3..438f54a9 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -594,12 +594,19 @@ "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIFont.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIFontVariant.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIMargin.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIOutline.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIOverflow.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIOffset.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPITextDecoration.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitTextEmphasis.h", + "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.h", ] } @@ -1554,6 +1561,7 @@ "workers/ThreadedWorkletTest.cpp", "workers/WorkerThreadTest.cpp", "workers/WorkerThreadTestHelper.h", + "workers/WorkletModuleResponsesMapTest.cpp", "xml/XPathFunctionsTest.cpp", "xml/parser/SharedBufferReaderTest.cpp", ]
diff --git a/third_party/WebKit/Source/core/css/BUILD.gn b/third_party/WebKit/Source/core/css/BUILD.gn index 4406da3..a68b6db 100644 --- a/third_party/WebKit/Source/core/css/BUILD.gn +++ b/third_party/WebKit/Source/core/css/BUILD.gn
@@ -544,11 +544,18 @@ "properties/CSSShorthandPropertyAPIFontVariant.cpp", "properties/CSSShorthandPropertyAPIMargin.cpp", "properties/CSSShorthandPropertyAPIOffset.cpp", + "properties/CSSShorthandPropertyAPIOutline.cpp", "properties/CSSShorthandPropertyAPIOverflow.cpp", + "properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp", "properties/CSSShorthandPropertyAPITextDecoration.cpp", + "properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp", + "properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp", + "properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp", + "properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp", "properties/CSSShorthandPropertyAPIWebkitMarginCollapse.cpp", "properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.cpp", "properties/CSSShorthandPropertyAPIWebkitTextEmphasis.cpp", + "properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp", "resolver/AnimatedStyleBuilder.cpp", "resolver/AnimatedStyleBuilder.h", "resolver/CSSPropertyPriority.h",
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index 2f9e9dbc..a6edc158 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -3802,6 +3802,8 @@ { name: "outline", longhands: ["outline-color", "outline-style", "outline-width"], + api_class: true, + api_methods: ["parseShorthand"], }, { name: "overflow", @@ -3833,6 +3835,8 @@ { name: "scroll-padding-block", longhands: ["scroll-padding-block-start", "scroll-padding-block-end"], + api_class: true, + api_methods: ["parseShorthand"], runtime_flag: "CSSScrollSnapPoints", }, { @@ -3862,18 +3866,26 @@ { name: "-webkit-border-after", longhands: ["-webkit-border-after-width", "-webkit-border-after-style", "-webkit-border-after-color"], + api_class: true, + api_methods: ["parseShorthand"], }, { name: "-webkit-border-before", longhands: ["-webkit-border-before-width", "-webkit-border-before-style", "-webkit-border-before-color"], + api_class: true, + api_methods: ["parseShorthand"], }, { name: "-webkit-border-end", longhands: ["-webkit-border-end-width", "-webkit-border-end-style", "-webkit-border-end-color"], + api_class: true, + api_methods: ["parseShorthand"], }, { name: "-webkit-border-start", longhands: ["-webkit-border-start-width", "-webkit-border-start-style", "-webkit-border-start-color"], + api_class: true, + api_methods: ["parseShorthand"], }, { name: "-webkit-column-break-after", @@ -3930,6 +3942,8 @@ { name: "-webkit-text-stroke", longhands: ["-webkit-text-stroke-width", "-webkit-text-stroke-color"], + api_class: true, + api_methods: ["parseShorthand"], }, // Aliases; these map to the same CSSPropertyID
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index d65ea97..a968158 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -2356,18 +2356,6 @@ return ConsumeShorthandGreedily(textDecorationShorthand(), important); case CSSPropertyPadding: return Consume4Values(paddingShorthand(), important); - case CSSPropertyOutline: - return ConsumeShorthandGreedily(outlineShorthand(), important); - case CSSPropertyWebkitBorderStart: - return ConsumeShorthandGreedily(webkitBorderStartShorthand(), important); - case CSSPropertyWebkitBorderEnd: - return ConsumeShorthandGreedily(webkitBorderEndShorthand(), important); - case CSSPropertyWebkitBorderBefore: - return ConsumeShorthandGreedily(webkitBorderBeforeShorthand(), important); - case CSSPropertyWebkitBorderAfter: - return ConsumeShorthandGreedily(webkitBorderAfterShorthand(), important); - case CSSPropertyWebkitTextStroke: - return ConsumeShorthandGreedily(webkitTextStrokeShorthand(), important); case CSSPropertyMarker: { const CSSValue* marker = ParseSingleValue(CSSPropertyMarkerStart); if (!marker || !range_.AtEnd()) @@ -2483,8 +2471,6 @@ return ConsumePlaceSelfShorthand(important); case CSSPropertyScrollPadding: return Consume4Values(scrollPaddingShorthand(), important); - case CSSPropertyScrollPaddingBlock: - return Consume2Values(scrollPaddingBlockShorthand(), important); case CSSPropertyScrollPaddingInline: return Consume2Values(scrollPaddingInlineShorthand(), important); case CSSPropertyScrollSnapMargin:
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp index 52702f1..d0a9b46e 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -1582,7 +1582,38 @@ return nullptr; } -bool ConsumeShorthandVia4LonghandsAPI( +bool ConsumeShorthandVia2LonghandAPIs( + const StylePropertyShorthand& shorthand, + bool important, + const CSSParserContext& context, + CSSParserTokenRange& range, + HeapVector<CSSProperty, 256>& properties) { + DCHECK_EQ(shorthand.length(), 2u); + const CSSPropertyID* longhands = shorthand.properties(); + bool needs_legacy_parsing = false; + + const CSSValue* start = ParseLonghandViaAPI( + longhands[0], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); + + if (!start) + return false; + + const CSSValue* end = ParseLonghandViaAPI( + longhands[1], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); + + if (!end) + end = start; + AddProperty(longhands[0], shorthand.id(), *start, important, + IsImplicitProperty::kNotImplicit, properties); + AddProperty(longhands[1], shorthand.id(), *end, important, + IsImplicitProperty::kNotImplicit, properties); + + return range.AtEnd(); +} + +bool ConsumeShorthandVia4LonghandAPIs( const StylePropertyShorthand& shorthand, bool important, const CSSParserContext& context,
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h index a1850cb..5e0b998 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
@@ -131,12 +131,14 @@ CSSParserTokenRange&, bool& needs_legacy_parsing); -// ConsumeShorthandVia4LonghandsAPI and ConsumeShorthandGreedilyViaLonghandAPIs -// are based on CSSPropertyParsers' Consume4Values and ConsumeShorthandGreedily. -// They both delegate parsing of a shorthand property to its respective longhand +// ConsumeShorthandVia2LonghandAPIs, ConsumeShorthandVia4LonghandAPIs and +// ConsumeShorthandGreedilyViaLonghandAPIs are based on CSSPropertyParsers' +// Consume2Values, Consume4Values and ConsumeShorthandGreedily. +// They all delegate parsing of a shorthand property to its respective longhand // components. The difference is the functions in this Helpers file expect -// component longhands to have API implementations already. -// Consume4Values and ConsumeShorthandGreedily will be deprecated soon, when +// component longhands to have API implementations already because each +// shorthand will call its component longhand APIs' parseShorthand method. +// Consume4Values and ConsumeShorthandGreedily will be removed soon, when // shorthand properties are ribbonised (i.e. have their own APIs). Until then, // there is a slight code duplication between the two versions for the following // reasons: @@ -149,9 +151,15 @@ // to the old Consume* which longhands have no APIs and thus are not parsed. // The old Consume* will then have to parse these longhands separately. // Hence there's added code complexity with little code reduction. -// 2. All shorthand properties will have APIs soon, hence such code duplication -// is temporary only. -bool ConsumeShorthandVia4LonghandsAPI(const StylePropertyShorthand&, +// 2. All longhand & shorthand properties will have APIs soon, hence such code +// duplication is temporary only. +bool ConsumeShorthandVia2LonghandAPIs(const StylePropertyShorthand&, + bool important, + const CSSParserContext&, + CSSParserTokenRange&, + HeapVector<CSSProperty, 256>& properties); + +bool ConsumeShorthandVia4LonghandAPIs(const StylePropertyShorthand&, bool important, const CSSParserContext&, CSSParserTokenRange&,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp index 30831b5..cd69b20 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp
@@ -15,7 +15,7 @@ const CSSParserContext& context, const CSSParserLocalContext& local_context, HeapVector<CSSProperty, 256>& properties) { - return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandsAPI( + return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( marginShorthand(), important, context, range, properties); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp new file mode 100644 index 0000000..311c8233 --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIOutline.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIOutline::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + outlineShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp new file mode 100644 index 0000000..925e114 --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp
@@ -0,0 +1,21 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.h" + +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIScrollPaddingBlock::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( + scrollPaddingBlockShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp new file mode 100644 index 0000000..a19f0cc --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIWebkitBorderAfter::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + webkitBorderAfterShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp new file mode 100644 index 0000000..48e299a --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIWebkitBorderBefore::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + webkitBorderBeforeShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp new file mode 100644 index 0000000..1ad0489 --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIWebkitBorderEnd::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + webkitBorderEndShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp new file mode 100644 index 0000000..3ca4c2b --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIWebkitBorderStart::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + webkitBorderStartShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp new file mode 100644 index 0000000..fcf80b3 --- /dev/null +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.h" +#include "core/StylePropertyShorthand.h" +#include "core/css/parser/CSSPropertyParserHelpers.h" + +namespace blink { + +bool CSSShorthandPropertyAPIWebkitTextStroke::parseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSProperty, 256>& properties) { + return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( + webkitTextStrokeShorthand(), important, context, range, properties); +} +} // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 5e859cb1..a8ce765 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1875,6 +1875,24 @@ if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !background_style->HasBackground()) background_style = body_style.Get(); + + // If the page set a rootScroller, we should use its background for painting + // the document background. + Node& root_scroller = GetRootScrollerController().EffectiveRootScroller(); + RefPtr<ComputedStyle> root_scroller_style; + if (this != &root_scroller) { + DCHECK(root_scroller.IsElementNode()); + Element* root_scroller_element = ToElement(&root_scroller); + root_scroller_style = root_scroller_element->MutableComputedStyle(); + + if (!root_scroller_style || root_scroller_element->NeedsStyleRecalc()) { + root_scroller_style = + EnsureStyleResolver().StyleForElement(root_scroller_element); + } + + background_style = root_scroller_style.Get(); + } + Color background_color = background_style->VisitedDependentColor(CSSPropertyBackgroundColor); FillLayer background_layers = background_style->BackgroundLayers();
diff --git a/third_party/WebKit/Source/core/dom/ScriptElementBase.h b/third_party/WebKit/Source/core/dom/ScriptElementBase.h index 1dd774a..5b7a651 100644 --- a/third_party/WebKit/Source/core/dom/ScriptElementBase.h +++ b/third_party/WebKit/Source/core/dom/ScriptElementBase.h
@@ -38,9 +38,6 @@ public: static ScriptElementBase* FromElementIfPossible(Element*); - virtual void DispatchLoadEvent() = 0; - virtual void DispatchErrorEvent() = 0; - virtual bool AsyncAttributeValue() const = 0; virtual String CharsetAttributeValue() const = 0; virtual String CrossOriginAttributeValue() const = 0; @@ -73,6 +70,10 @@ ScriptLoader* InitializeScriptLoader(bool parser_inserted, bool already_started, bool created_during_document_write); + + friend class ScriptLoader; + virtual void DispatchLoadEvent() = 0; + virtual void DispatchErrorEvent() = 0; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index 82d5fa7d..067b2a8e 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -973,13 +973,6 @@ return; } - if (ErrorOccurred()) { - context_document->GetScriptRunner()->NotifyScriptLoadError( - this, async_exec_type_); - DetachPendingScript(); - DispatchErrorEvent(); - return; - } context_document->GetScriptRunner()->NotifyScriptReady(this, async_exec_type_); pending_script_->StopWatchingForLoad();
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.h b/third_party/WebKit/Source/core/dom/ScriptLoader.h index 678a63f..99921822 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.h +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.h
@@ -95,19 +95,9 @@ // FetchClassicScript()/FetchModuleScriptTree(). PendingScript* CreatePendingScript(); - enum class ExecuteScriptResult { - kShouldFireErrorEvent, - kShouldFireLoadEvent, - kShouldFireNone - }; - WARN_UNUSED_RESULT ExecuteScriptResult ExecuteScript(const Script*); - // The entry point only for ScriptRunner that wraps ExecuteScriptBlock(). virtual void Execute(); - // XML parser calls these - void DispatchLoadEvent(); - void DispatchErrorEvent(); bool IsScriptTypeSupported(LegacyTypeSupport, ScriptType& out_script_type) const; @@ -180,7 +170,15 @@ ParserDisposition, WebURLRequest::FetchCredentialsMode); + enum class ExecuteScriptResult { + kShouldFireErrorEvent, + kShouldFireLoadEvent, + kShouldFireNone + }; + WARN_UNUSED_RESULT ExecuteScriptResult ExecuteScript(const Script*); ExecuteScriptResult DoExecuteScript(const Script*); + void DispatchLoadEvent(); + void DispatchErrorEvent(); // Clears the connection to the PendingScript. void DetachPendingScript();
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp index 0a9c58b..6a6af83 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -96,10 +96,6 @@ void ScriptRunner::ScheduleReadyInOrderScripts() { while (!pending_in_order_scripts_.IsEmpty() && pending_in_order_scripts_.front()->IsReady()) { - // A ScriptLoader that failed is responsible for cancelling itself - // notifyScriptLoadError(); it continues this draining of ready scripts. - if (pending_in_order_scripts_.front()->ErrorOccurred()) - break; in_order_scripts_to_execute_soon_.push_back( pending_in_order_scripts_.TakeFirst()); PostTask(BLINK_FROM_HERE); @@ -148,28 +144,6 @@ return true; } -void ScriptRunner::NotifyScriptLoadError(ScriptLoader* script_loader, - AsyncExecutionType execution_type) { - switch (execution_type) { - case kAsync: { - // See notifyScriptReady() comment. - SECURITY_CHECK(pending_async_scripts_.Contains(script_loader)); - pending_async_scripts_.erase(script_loader); - break; - } - case kInOrder: { - SECURITY_CHECK(RemovePendingInOrderScript(script_loader)); - ScheduleReadyInOrderScripts(); - break; - } - case kNone: { - NOTREACHED(); - break; - } - } - document_->DecrementLoadEventDelayCount(); -} - void ScriptRunner::MovePendingScript(Document& old_document, Document& new_document, ScriptLoader* script_loader) {
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.h b/third_party/WebKit/Source/core/dom/ScriptRunner.h index 5a69ac5..72d6f66d 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunner.h +++ b/third_party/WebKit/Source/core/dom/ScriptRunner.h
@@ -61,7 +61,6 @@ void Suspend(); void Resume(); void NotifyScriptReady(ScriptLoader*, AsyncExecutionType); - void NotifyScriptLoadError(ScriptLoader*, AsyncExecutionType); static void MovePendingScript(Document&, Document&, ScriptLoader*);
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 764848a..d7d8c4a 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -1508,10 +1508,7 @@ // sequence, but we want to do these things (matches AppKit). if (selection_did_not_change_dom_position) { Client().RespondToChangedSelection( - frame_, GetFrame() - .Selection() - .GetSelectionInDOMTree() - .SelectionTypeWithLegacyGranularity()); + frame_, GetFrame().Selection().GetSelectionInDOMTree().Type()); } } @@ -1760,11 +1757,8 @@ const Position& old_selection_start, FrameSelection::SetSelectionOptions options) { GetSpellChecker().RespondToChangedSelection(old_selection_start, options); - Client().RespondToChangedSelection(&GetFrame(), - GetFrame() - .Selection() - .GetSelectionInDOMTree() - .SelectionTypeWithLegacyGranularity()); + Client().RespondToChangedSelection( + &GetFrame(), GetFrame().Selection().GetSelectionInDOMTree().Type()); SetStartNewKillRingSequence(true); }
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp index 6c246c20..5350f5b 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -303,7 +303,6 @@ builder.SetAffinity(new_selection.Affinity()) .SetBaseAndExtent(ToPositionInDOMTree(new_selection.Base()), ToPositionInDOMTree(new_selection.Extent())) - .SetGranularity(new_selection.Granularity()) .SetIsDirectional(new_selection.IsDirectional()) .SetIsHandleVisible(new_selection.IsHandleVisible()); return SetSelection(builder.Build(), options, align, granularity); @@ -593,8 +592,7 @@ // Check if the selection contains the entire frame contents; if not, then // there is nothing to do. - if (GetSelectionInDOMTree().SelectionTypeWithLegacyGranularity() != - kRangeSelection) { + if (GetSelectionInDOMTree().Type() != kRangeSelection) { return; }
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategy.h b/third_party/WebKit/Source/core/editing/GranularityStrategy.h index 46fa3ba2..47925df16 100644 --- a/third_party/WebKit/Source/core/editing/GranularityStrategy.h +++ b/third_party/WebKit/Source/core/editing/GranularityStrategy.h
@@ -11,6 +11,8 @@ namespace blink { +enum class TextGranularity; + class GranularityStrategy { USING_FAST_MALLOC(GranularityStrategy);
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp index 7585134d..70eb6c2 100644 --- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp +++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -114,34 +114,52 @@ kRange, kBlockCursor, }; + static SelectionMode ComputeSelectionMode( - const FrameSelection& frame_selection, - const VisibleSelectionInFlatTree& selection) { - if (selection.IsRange()) + const FrameSelection& frame_selection) { + const SelectionInDOMTree& selection_in_dom = + frame_selection.GetSelectionInDOMTree(); + if (selection_in_dom.IsRange()) return SelectionMode::kRange; + DCHECK(selection_in_dom.IsCaret()); if (!frame_selection.ShouldShowBlockCursor()) return SelectionMode::kNone; - if (IsLogicalEndOfLine(selection.VisibleStart())) + if (IsLogicalEndOfLine(CreateVisiblePosition(selection_in_dom.Base()))) return SelectionMode::kNone; return SelectionMode::kBlockCursor; } static EphemeralRangeInFlatTree CalcSelection( const FrameSelection& frame_selection) { - const VisibleSelectionInFlatTree& original_selection = - frame_selection.ComputeVisibleSelectionInFlatTree(); - switch (ComputeSelectionMode(frame_selection, original_selection)) { + const SelectionInDOMTree& selection_in_dom = + frame_selection.GetSelectionInDOMTree(); + switch (ComputeSelectionMode(frame_selection)) { case SelectionMode::kNone: return {}; - case SelectionMode::kRange: - return {original_selection.Start(), original_selection.End()}; + case SelectionMode::kRange: { + const PositionInFlatTree& base = + CreateVisiblePosition(ToPositionInFlatTree(selection_in_dom.Base())) + .DeepEquivalent(); + const PositionInFlatTree& extent = + CreateVisiblePosition(ToPositionInFlatTree(selection_in_dom.Extent())) + .DeepEquivalent(); + if (base.IsNull() || extent.IsNull() || base == extent) + return {}; + const bool base_is_first = base.CompareTo(extent) <= 0; + const PositionInFlatTree& start = base_is_first ? base : extent; + const PositionInFlatTree& end = base_is_first ? extent : base; + return {MostForwardCaretPosition(start), MostBackwardCaretPosition(end)}; + } case SelectionMode::kBlockCursor: { - const PositionInFlatTree end_position = NextPositionOf( - original_selection.Start(), PositionMoveType::kGraphemeCluster); - const VisibleSelectionInFlatTree& block_cursor = CreateVisibleSelection( - SelectionInFlatTree::Builder() - .SetBaseAndExtent(original_selection.Start(), end_position) - .Build()); + const PositionInFlatTree& base = + CreateVisiblePosition(ToPositionInFlatTree(selection_in_dom.Base())) + .DeepEquivalent(); + const PositionInFlatTree end_position = + NextPositionOf(base, PositionMoveType::kGraphemeCluster); + const VisibleSelectionInFlatTree& block_cursor = + CreateVisibleSelection(SelectionInFlatTree::Builder() + .SetBaseAndExtent(base, end_position) + .Build()); return {block_cursor.Start(), block_cursor.End()}; } }
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp index b314ef6..ca7aa444 100644 --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -1195,7 +1195,7 @@ const SelectionInDOMTree& selection = this->Selection().GetSelectionInDOMTree(); - switch (selection.SelectionTypeWithLegacyGranularity()) { + switch (selection.Type()) { case kNoSelection: selection_state_ = SelectionState::kHaveNotStartedSelection; return;
diff --git a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp index a0a37ee..29c609b9 100644 --- a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
@@ -415,7 +415,6 @@ else if (extent.IsNotNull()) builder.Collapse(extent); builder.SetAffinity(selection_.Affinity()) - .SetGranularity(selection_.Granularity()) .SetIsDirectional(selection_.IsDirectional()); cached_visible_selection_in_flat_tree_ = CreateVisibleSelection(builder.Build());
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp index 4446a2a..0dcc99e 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp
@@ -243,46 +243,48 @@ return AdjustBackwardPositionForUserSelectAll(pos); } -VisiblePosition SelectionModifier::ModifyExtendingForward( +VisiblePosition SelectionModifier::ModifyExtendingForwardInternal( TextGranularity granularity) { - VisiblePosition pos = - CreateVisiblePosition(selection_.Extent(), selection_.Affinity()); switch (granularity) { case TextGranularity::kCharacter: - pos = NextPositionOf(pos, kCanSkipOverEditingBoundary); - break; + return NextPositionOf( + CreateVisiblePosition(selection_.Extent(), selection_.Affinity()), + kCanSkipOverEditingBoundary); case TextGranularity::kWord: - pos = NextWordPositionForPlatform(pos); - break; + return NextWordPositionForPlatform( + CreateVisiblePosition(selection_.Extent(), selection_.Affinity())); case TextGranularity::kSentence: - pos = NextSentencePosition(pos); - break; + return NextSentencePosition( + CreateVisiblePosition(selection_.Extent(), selection_.Affinity())); case TextGranularity::kLine: - pos = NextLinePosition(pos, LineDirectionPointForBlockDirectionNavigation( - selection_.Extent())); - break; - case TextGranularity::kParagraph: - pos = NextParagraphPosition( - pos, + return NextLinePosition( + CreateVisiblePosition(selection_.Extent(), selection_.Affinity()), LineDirectionPointForBlockDirectionNavigation(selection_.Extent())); - break; + case TextGranularity::kParagraph: + return NextParagraphPosition( + CreateVisiblePosition(selection_.Extent(), selection_.Affinity()), + LineDirectionPointForBlockDirectionNavigation(selection_.Extent())); case TextGranularity::kSentenceBoundary: - pos = EndOfSentence(EndForPlatform()); - break; + return EndOfSentence(EndForPlatform()); case TextGranularity::kLineBoundary: - pos = LogicalEndOfLine(EndForPlatform()); - break; + return LogicalEndOfLine(EndForPlatform()); case TextGranularity::kParagraphBoundary: - pos = EndOfParagraph(EndForPlatform()); + return EndOfParagraph(EndForPlatform()); break; - case TextGranularity::kDocumentBoundary: - pos = EndForPlatform(); + case TextGranularity::kDocumentBoundary: { + const VisiblePosition& pos = EndForPlatform(); if (IsEditablePosition(pos.DeepEquivalent())) - pos = EndOfEditableContent(pos); - else - pos = EndOfDocument(pos); - break; + return EndOfEditableContent(pos); + return EndOfDocument(pos); + } } + NOTREACHED() << static_cast<int>(granularity); + return VisiblePosition(); +} + +VisiblePosition SelectionModifier::ModifyExtendingForward( + TextGranularity granularity) { + const VisiblePosition pos = ModifyExtendingForwardInternal(granularity); if (DirectionOfEnclosingBlock() == TextDirection::kLtr) return AdjustForwardPositionForUserSelectAll(pos); return AdjustBackwardPositionForUserSelectAll(pos);
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifier.h b/third_party/WebKit/Source/core/editing/SelectionModifier.h index 6d7b336..62fbaa7a 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifier.h +++ b/third_party/WebKit/Source/core/editing/SelectionModifier.h
@@ -69,6 +69,7 @@ LayoutUnit LineDirectionPointForBlockDirectionNavigation(const Position&); VisiblePosition ModifyExtendingRight(TextGranularity); VisiblePosition ModifyExtendingForward(TextGranularity); + VisiblePosition ModifyExtendingForwardInternal(TextGranularity); VisiblePosition ModifyMovingRight(TextGranularity); VisiblePosition ModifyMovingForward(TextGranularity); VisiblePosition ModifyExtendingLeft(TextGranularity);
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp index aac91864..2cc9a11 100644 --- a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
@@ -14,7 +14,6 @@ : base_(other.base_), extent_(other.extent_), affinity_(other.affinity_), - granularity_(other.granularity_), is_directional_(other.is_directional_), is_handle_visible_(other.is_handle_visible_) #if DCHECK_IS_ON() @@ -39,7 +38,7 @@ return false; DCHECK_EQ(base_.GetDocument(), other.GetDocument()) << *this << ' ' << other; return base_ == other.base_ && extent_ == other.extent_ && - affinity_ == other.affinity_ && granularity_ == other.granularity_ && + affinity_ == other.affinity_ && is_directional_ == other.is_directional_ && is_handle_visible_ == other.is_handle_visible_; } @@ -78,14 +77,12 @@ template <typename Strategy> bool SelectionTemplate<Strategy>::IsCaret() const { - return base_.IsNotNull() && base_ == extent_ && - granularity_ == TextGranularity::kCharacter; + return base_.IsNotNull() && base_ == extent_; } template <typename Strategy> bool SelectionTemplate<Strategy>::IsRange() const { - return base_ != extent_ || - (base_.IsNotNull() && granularity_ != TextGranularity::kCharacter); + return base_ != extent_; } template <typename Strategy> @@ -155,11 +152,10 @@ } template <typename Strategy> -SelectionType SelectionTemplate<Strategy>::SelectionTypeWithLegacyGranularity() - const { +SelectionType SelectionTemplate<Strategy>::Type() const { if (base_.IsNull()) return kNoSelection; - if (base_ == extent_ && granularity_ == TextGranularity::kCharacter) + if (base_ == extent_) return kCaretSelection; return kRangeSelection; } @@ -304,14 +300,6 @@ template <typename Strategy> typename SelectionTemplate<Strategy>::Builder& -SelectionTemplate<Strategy>::Builder::SetGranularity( - TextGranularity granularity) { - selection_.granularity_ = granularity; - return *this; -} - -template <typename Strategy> -typename SelectionTemplate<Strategy>::Builder& SelectionTemplate<Strategy>::Builder::SetIsDirectional(bool is_directional) { selection_.is_directional_ = is_directional; return *this;
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.h b/third_party/WebKit/Source/core/editing/SelectionTemplate.h index 73adfec..68470b87 100644 --- a/third_party/WebKit/Source/core/editing/SelectionTemplate.h +++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.h
@@ -13,7 +13,6 @@ #include "core/editing/PositionWithAffinity.h" #include "core/editing/SelectionType.h" #include "core/editing/TextAffinity.h" -#include "core/editing/TextGranularity.h" #include "platform/wtf/Allocator.h" namespace blink { @@ -64,7 +63,6 @@ const PositionTemplate<Strategy>& extent); Builder& SetAffinity(TextAffinity); - Builder& SetGranularity(TextGranularity); Builder& SetIsDirectional(bool); Builder& SetIsHandleVisible(bool); @@ -85,7 +83,6 @@ const PositionTemplate<Strategy>& Base() const; const PositionTemplate<Strategy>& Extent() const; TextAffinity Affinity() const { return affinity_; } - TextGranularity Granularity() const { return granularity_; } bool IsCaret() const; bool IsDirectional() const { return is_directional_; } bool IsHandleVisible() const { return is_handle_visible_; } @@ -100,12 +97,8 @@ const PositionTemplate<Strategy>& ComputeEndPosition() const; const PositionTemplate<Strategy>& ComputeStartPosition() const; - // Returns |SelectionType| for |this| based on |m_base| and |m_extent| - // If |m_granularity| is |CharacterGranularity|, otherwise this function - // returns |RangeSelection| event if |m_base| == |m_extent|. - // Note: |m_granularity| will be removed, using this function is not - // encouraged. - SelectionType SelectionTypeWithLegacyGranularity() const; + // Returns |SelectionType| for |this| based on |base_| and |extent_|. + SelectionType Type() const; DECLARE_TRACE(); @@ -122,7 +115,6 @@ PositionTemplate<Strategy> base_; PositionTemplate<Strategy> extent_; TextAffinity affinity_ = TextAffinity::kDownstream; - TextGranularity granularity_ = TextGranularity::kCharacter; bool is_directional_ = false; bool is_handle_visible_ = false; #if DCHECK_IS_ON()
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplateTest.cpp b/third_party/WebKit/Source/core/editing/SelectionTemplateTest.cpp index ce1b3003..7ad8a8f 100644 --- a/third_party/WebKit/Source/core/editing/SelectionTemplateTest.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionTemplateTest.cpp
@@ -15,7 +15,6 @@ SelectionInDOMTree selection; EXPECT_EQ(TextAffinity::kDownstream, selection.Affinity()); - EXPECT_EQ(TextGranularity::kCharacter, selection.Granularity()); EXPECT_FALSE(selection.IsDirectional()); EXPECT_FALSE(selection.IsHandleVisible()); EXPECT_TRUE(selection.IsNone()); @@ -33,7 +32,6 @@ const SelectionInDOMTree& selection = builder.Build(); EXPECT_EQ(TextAffinity::kDownstream, selection.Affinity()); - EXPECT_EQ(TextGranularity::kCharacter, selection.Granularity()); EXPECT_FALSE(selection.IsDirectional()); EXPECT_FALSE(selection.IsHandleVisible()); EXPECT_FALSE(selection.IsNone()); @@ -53,7 +51,6 @@ const SelectionInDOMTree& selection = builder.Build(); EXPECT_EQ(TextAffinity::kDownstream, selection.Affinity()); - EXPECT_EQ(TextGranularity::kCharacter, selection.Granularity()); EXPECT_FALSE(selection.IsDirectional()); EXPECT_FALSE(selection.IsHandleVisible()); EXPECT_FALSE(selection.IsNone());
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp index 71aef32..3b252bc 100644 --- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -62,7 +62,7 @@ template <typename Strategy> VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::Create( const SelectionTemplate<Strategy>& selection) { - return VisibleSelectionTemplate(selection, selection.Granularity()); + return VisibleSelectionTemplate(selection, TextGranularity::kCharacter); } VisibleSelection CreateVisibleSelection(const SelectionInDOMTree& selection) {
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp index 5cad4703..b69b161 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -692,6 +692,23 @@ return true; } +// If there are multiple Unicode code points to be deleted, adjust the +// range to match platform conventions. +static VisibleSelection AdjustSelectionForBackwardDelete( + const VisibleSelection& selection) { + if (selection.End().ComputeContainerNode() != + selection.Start().ComputeContainerNode()) + return selection; + if (selection.End().ComputeOffsetInContainerNode() - + selection.Start().ComputeOffsetInContainerNode() <= + 1) + return selection; + return VisibleSelection::CreateWithoutValidationDeprecated( + selection.End(), + PreviousPositionOf(selection.End(), PositionMoveType::kBackwardDeletion), + selection.Affinity()); +} + void TypingCommand::DeleteKeyPressed(TextGranularity granularity, bool kill_ring, EditingState* editing_state) { @@ -701,14 +718,11 @@ frame->GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(false); - VisibleSelection selection_to_delete; - VisibleSelection selection_after_undo; - switch (EndingSelection().GetSelectionType()) { case kRangeSelection: - selection_to_delete = EndingSelection(); - selection_after_undo = selection_to_delete; - break; + DeleteKeyPressedInternal(EndingSelection(), EndingSelection(), kill_ring, + editing_state); + return; case kCaretSelection: { // After breaking out of an empty mail blockquote, we still want continue // with the deletion so actual content will get deleted, and not just the @@ -801,44 +815,40 @@ return; } - selection_to_delete = selection_modifier.Selection(); - - if (granularity == TextGranularity::kCharacter && - selection_to_delete.End().ComputeContainerNode() == - selection_to_delete.Start().ComputeContainerNode() && - selection_to_delete.End().ComputeOffsetInContainerNode() - - selection_to_delete.Start().ComputeOffsetInContainerNode() > - 1) { - // If there are multiple Unicode code points to be deleted, adjust the - // range to match platform conventions. - selection_to_delete = - VisibleSelection::CreateWithoutValidationDeprecated( - selection_to_delete.End(), - PreviousPositionOf(selection_to_delete.End(), - PositionMoveType::kBackwardDeletion), - selection_to_delete.Affinity()); - } + const VisibleSelection& selection_to_delete = + granularity == TextGranularity::kCharacter + ? AdjustSelectionForBackwardDelete(selection_modifier.Selection()) + : selection_modifier.Selection(); if (!StartingSelection().IsRange() || selection_to_delete.Base() != StartingSelection().Start()) { - selection_after_undo = selection_to_delete; - } else { - // It's a little tricky to compute what the starting selection would - // have been in the original document. We can't let the VisibleSelection - // class's validation kick in or it'll adjust for us based on the - // current state of the document and we'll get the wrong result. - selection_after_undo = - VisibleSelection::CreateWithoutValidationDeprecated( - StartingSelection().End(), selection_to_delete.Extent(), - selection_after_undo.Affinity()); + DeleteKeyPressedInternal(selection_to_delete, selection_to_delete, + kill_ring, editing_state); + return; } - break; + // It's a little tricky to compute what the starting selection would + // have been in the original document. We can't let the VisibleSelection + // class's validation kick in or it'll adjust for us based on the + // current state of the document and we'll get the wrong result. + const VisibleSelection& selection_after_undo = + VisibleSelection::CreateWithoutValidationDeprecated( + StartingSelection().End(), selection_to_delete.Extent(), + selection_to_delete.Affinity()); + DeleteKeyPressedInternal(selection_to_delete, selection_after_undo, + kill_ring, editing_state); + return; } case kNoSelection: NOTREACHED(); break; } +} +void TypingCommand::DeleteKeyPressedInternal( + const VisibleSelection& selection_to_delete, + const VisibleSelection& selection_after_undo, + bool kill_ring, + EditingState* editing_state) { DCHECK(!selection_to_delete.IsNone()); if (selection_to_delete.IsNone()) return; @@ -846,6 +856,9 @@ if (selection_to_delete.IsCaret()) return; + LocalFrame* frame = GetDocument().GetFrame(); + DCHECK(frame); + if (kill_ring) frame->GetEditor().AddToKillRing( selection_to_delete.ToNormalizedEphemeralRange());
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h index dec97a8..4151d9d 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
@@ -164,6 +164,11 @@ bool IsIncrementalInsertion() const { return is_incremental_insertion_; } + void DeleteKeyPressedInternal(const VisibleSelection& selection_to_delete, + const VisibleSelection& selection_after_undo, + bool kill_ring, + EditingState*); + void DeleteSelectionIfRange(const VisibleSelection&, EditingState*, bool smart_delete = false,
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp index e134664..403a8f2 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
@@ -130,8 +130,9 @@ web_plugin_->UpdateAllLifecyclePhases(); } -LayoutEmbeddedContent* WebPluginContainerImpl::OwnerLayoutObject() const { - return element_->GetLayoutEmbeddedContent(); +void WebPluginContainerImpl::SetFrameRect(const IntRect& frame_rect) { + frame_rect_ = frame_rect; + ReportGeometry(); } void WebPluginContainerImpl::Paint(GraphicsContext& context, @@ -172,6 +173,11 @@ context.Restore(); } +void WebPluginContainerImpl::UpdateGeometry() { + if (LayoutEmbeddedContent* layout = element_->GetLayoutEmbeddedContent()) + layout->UpdateGeometry(*this); +} + void WebPluginContainerImpl::InvalidateRect(const IntRect& rect) { // InvalidateRect can be called from Dispose when this plugin is no longer // attached. In this case, we return immediately. @@ -241,10 +247,6 @@ ReportGeometry(); } -void WebPluginContainerImpl::GeometryMayHaveChanged() { - ReportGeometry(); -} - void WebPluginContainerImpl::EventListenersRemoved() { // We're no longer registered to receive touch events, so don't try to remove // the touch event handlers in our destructor. @@ -436,8 +438,9 @@ } void WebPluginContainerImpl::ReportGeometry() { - // We cannot compute geometry without a layoutObject. - if (!element_ || !element_->GetLayoutObject() || !web_plugin_) + // Ignore when SetFrameRect/ReportGeometry is called from + // UpdateOnEmbeddedContentViewChange before plugin is attached. + if (!is_attached_) return; IntRect window_rect, clip_rect, unobscured_rect;
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h index e8abae0..bf240f2 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h
@@ -51,7 +51,6 @@ class HTMLPlugInElement; class IntRect; class KeyboardEvent; -class LayoutEmbeddedContent; class LocalFrameView; class MouseEvent; class ResourceError; @@ -89,18 +88,15 @@ void SetFocused(bool, WebFocusType) override; void HandleEvent(Event*) override; void FrameRectsChanged() override; - void GeometryMayHaveChanged() override; bool IsPluginContainer() const override { return true; } bool IsErrorplaceholder() override; void EventListenersRemoved() override; // EmbeddedContentView methods - LayoutEmbeddedContent* OwnerLayoutObject() const override; - void SetFrameRect(const IntRect& frame_rect) override { - frame_rect_ = frame_rect; - } + void SetFrameRect(const IntRect&) override; const IntRect& FrameRect() const override { return frame_rect_; } void Paint(GraphicsContext&, const CullRect&) const override; + void UpdateGeometry() override; void Show() override; void Hide() override;
diff --git a/third_party/WebKit/Source/core/frame/EmbeddedContentView.h b/third_party/WebKit/Source/core/frame/EmbeddedContentView.h index 2497006..66f02fa 100644 --- a/third_party/WebKit/Source/core/frame/EmbeddedContentView.h +++ b/third_party/WebKit/Source/core/frame/EmbeddedContentView.h
@@ -13,7 +13,6 @@ class CullRect; class GraphicsContext; class IntRect; -class LayoutEmbeddedContent; // EmbeddedContentView is a pure virtual class which is implemented by // LocalFrameView, RemoteFrameView, and PluginView. @@ -24,7 +23,6 @@ virtual bool IsLocalFrameView() const { return false; } virtual bool IsPluginView() const { return false; } - virtual LayoutEmbeddedContent* OwnerLayoutObject() const = 0; virtual void AttachToLayout() = 0; virtual void DetachFromLayout() = 0; virtual bool IsAttached() const = 0; @@ -33,6 +31,10 @@ virtual void FrameRectsChanged() = 0; virtual const IntRect& FrameRect() const = 0; virtual void Paint(GraphicsContext&, const CullRect&) const = 0; + // Called when the size of the view changes. Implementations of + // EmbeddedContentView should call LayoutEmbeddedContent::UpdateGeometry in + // addition to any internal logic. + virtual void UpdateGeometry() = 0; virtual void Show() = 0; virtual void Hide() = 0; virtual void Dispose() = 0;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp index 2c6a3e9e..87d4fc5 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -1291,13 +1291,12 @@ } // Reset m_layoutSchedulingEnabled to its previous value. CheckDoesNotNeedLayout(); - DocumentLifecycle::Scope lifecycle_scope(Lifecycle(), - DocumentLifecycle::kLayoutClean); + Lifecycle().AdvanceTo(DocumentLifecycle::kLayoutClean); frame_timing_requests_dirty_ = true; - // FIXME: Could find the common ancestor layer of all dirty subtrees and mark - // from there. crbug.com/462719 + // FIXME: Could find the common ancestor layer of all dirty subtrees and + // mark from there. crbug.com/462719 GetLayoutViewItem().EnclosingLayer()->UpdateLayerPositionsAfterLayout(); TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( @@ -1443,36 +1442,50 @@ return nullptr; } -LayoutEmbeddedContent* LocalFrameView::OwnerLayoutObject() const { - return frame_->OwnerLayoutObject(); -} - void LocalFrameView::UpdateGeometries() { - Vector<LayoutEmbeddedContent*> parts; - ForAllChildViewsAndPlugins([&](EmbeddedContentView& embedded_content_view) { - if (LayoutEmbeddedContent* part = embedded_content_view.OwnerLayoutObject()) - parts.push_back(part); - }); + HeapVector<Member<EmbeddedContentView>> views; + ForAllChildViewsAndPlugins( + [&](EmbeddedContentView& view) { views.push_back(view); }); - for (auto part : parts) { + for (const auto& view : views) { // Script or plugins could detach the frame so abort processing if that // happens. if (GetLayoutViewItem().IsNull()) break; - if (part->GetEmbeddedContentView()) { - if (LocalFrameView* frame_view = part->ChildFrameView()) { - bool did_need_layout = frame_view->NeedsLayout(); - part->UpdateGeometry(); - if (!did_need_layout && !frame_view->ShouldThrottleRendering()) - frame_view->CheckDoesNotNeedLayout(); - } else { - part->UpdateGeometry(); - } - } + view->UpdateGeometry(); } } +void LocalFrameView::UpdateGeometry() { + LayoutEmbeddedContent* layout = frame_->OwnerLayoutObject(); + if (!layout) + return; + + bool did_need_layout = NeedsLayout(); + + LayoutRect new_frame = layout->ReplacedContentRect(); + DCHECK(new_frame.Size() == RoundedIntSize(new_frame.Size())); + bool bounds_will_change = LayoutSize(Size()) != new_frame.Size(); + + // If frame bounds are changing mark the view for layout. Also check the + // frame's page to make sure that the frame isn't in the process of being + // destroyed. If iframe scrollbars needs reconstruction from native to custom + // scrollbar, then also we need to layout the frameview. + if (bounds_will_change || NeedsScrollbarReconstruction()) + SetNeedsLayout(); + + layout->UpdateGeometry(*this); + // If view needs layout, either because bounds have changed or possibly + // indicating content size is wrong, we have to do a layout to set the right + // LocalFrameView size. + if (NeedsLayout()) + UpdateLayout(); + + if (!did_need_layout && !ShouldThrottleRendering()) + CheckDoesNotNeedLayout(); +} + void LocalFrameView::AddPartToUpdate(LayoutEmbeddedObject& object) { DCHECK(IsInPerformLayout()); // Tell the DOM element that it needs a Plugin update. @@ -2500,7 +2513,8 @@ if (element->NeedsPluginUpdate()) element->UpdatePlugin(); - object.UpdateGeometry(); + if (EmbeddedContentView* view = element->OwnedEmbeddedContentView()) + view->UpdateGeometry(); // Prevent plugins from causing infinite updates of themselves. // FIXME: Do we really need to prevent this?
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.h b/third_party/WebKit/Source/core/frame/LocalFrameView.h index f5180c2..d775ce9a 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.h +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.h
@@ -120,7 +120,6 @@ void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } void InvalidateRect(const IntRect&); - LayoutEmbeddedContent* OwnerLayoutObject() const override; void SetFrameRect(const IntRect&) override; const IntRect& FrameRect() const override { return frame_rect_; } int X() const { return frame_rect_.X(); } @@ -181,6 +180,7 @@ void SetNeedsLayout(); void SetNeedsUpdateGeometries() { needs_update_geometries_ = true; } + void UpdateGeometry() override; // Methods for getting/setting the size Blink should use to layout the // contents. @@ -281,8 +281,6 @@ safe_to_propagate_scroll_to_parent_ = is_safe; } - void UpdateGeometries(); - void AddPartToUpdate(LayoutEmbeddedObject&); Color DocumentBackgroundColor() const; @@ -953,6 +951,7 @@ void DidChangeGlobalRootScroller() override; void UpdateGeometriesIfNeeded(); + void UpdateGeometries(); bool WasViewportResized(); void SendResizeEventIfNeeded();
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp index 6992d279d1..52bfe60 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
@@ -53,10 +53,6 @@ return view; } -LayoutEmbeddedContent* RemoteFrameView::OwnerLayoutObject() const { - return remote_frame_->OwnerLayoutObject(); -} - void RemoteFrameView::UpdateViewportIntersectionsForSubtree( DocumentLifecycle::LifecycleState target_state) { if (!remote_frame_->OwnerLayoutObject()) @@ -134,6 +130,11 @@ remote_frame_->Client()->FrameRectsChanged(new_rect); } +void RemoteFrameView::UpdateGeometry() { + if (LayoutEmbeddedContent* layout = remote_frame_->OwnerLayoutObject()) + layout->UpdateGeometry(*this); +} + void RemoteFrameView::Hide() { self_visible_ = false; remote_frame_->Client()->VisibilityChanged(false);
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameView.h b/third_party/WebKit/Source/core/frame/RemoteFrameView.h index 3287da1..c8166a52 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrameView.h +++ b/third_party/WebKit/Source/core/frame/RemoteFrameView.h
@@ -35,7 +35,6 @@ return *remote_frame_; } - LayoutEmbeddedContent* OwnerLayoutObject() const override; void Dispose() override; // Override to notify remote frame that its viewport size has changed. void FrameRectsChanged() override; @@ -43,6 +42,7 @@ void SetFrameRect(const IntRect&) override; const IntRect& FrameRect() const override { return frame_rect_; } void Paint(GraphicsContext&, const CullRect&) const override {} + void UpdateGeometry() override; void Hide() override; void Show() override; void SetParentVisible(bool) override;
diff --git a/third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp b/third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp index f927d88..a5fe39aad 100644 --- a/third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp +++ b/third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp
@@ -214,8 +214,7 @@ Resource* CreateTestResource(const KURL& url, const KURL* allow_origin_url, ServiceWorkerMode service_worker_mode) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(context, context->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(context); ResourceLoadScheduler* scheduler = ResourceLoadScheduler::Create(); Resource* resource = RawResource::CreateForTest(url, Resource::kRaw); ResourceLoader* loader =
diff --git a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp index 7f873bfc..e721716 100644 --- a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
@@ -450,4 +450,21 @@ HTMLPlugInElement::AttachLayoutTree(context); } +const HTMLObjectElement* ToHTMLObjectElementFromListedElement( + const ListedElement* element) { + SECURITY_DCHECK(!element || !element->IsFormControlElement()); + const HTMLObjectElement* object_element = + static_cast<const HTMLObjectElement*>(element); + // We need to assert after the cast because ListedElement doesn't + // have hasTagName. + SECURITY_DCHECK(!object_element || + object_element->HasTagName(HTMLNames::objectTag)); + return object_element; +} + +const HTMLObjectElement& ToHTMLObjectElementFromListedElement( + const ListedElement& element) { + return *ToHTMLObjectElementFromListedElement(&element); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLObjectElement.h b/third_party/WebKit/Source/core/html/HTMLObjectElement.h index 2b86ba1..41fad5b 100644 --- a/third_party/WebKit/Source/core/html/HTMLObjectElement.h +++ b/third_party/WebKit/Source/core/html/HTMLObjectElement.h
@@ -124,39 +124,12 @@ bool use_fallback_content_ : 1; }; -// Intentionally left unimplemented, template specialization needs to be -// provided for specific return types. -template <typename T> -inline const T& ToElement(const ListedElement&); -template <typename T> -inline const T* ToElement(const ListedElement*); - -// Make toHTMLObjectElement() accept a ListedElement as input instead of -// a Node. -template <> -inline const HTMLObjectElement* ToElement<HTMLObjectElement>( - const ListedElement* element) { - SECURITY_DCHECK(!element || !element->IsFormControlElement()); - const HTMLObjectElement* object_element = - static_cast<const HTMLObjectElement*>(element); - // We need to assert after the cast because ListedElement doesn't - // have hasTagName. - SECURITY_DCHECK(!object_element || - object_element->HasTagName(HTMLNames::objectTag)); - return object_element; -} - -template <> -inline const HTMLObjectElement& ToElement<HTMLObjectElement>( - const ListedElement& element) { - SECURITY_DCHECK(!element.IsFormControlElement()); - const HTMLObjectElement& object_element = - static_cast<const HTMLObjectElement&>(element); - // We need to assert after the cast because ListedElement doesn't - // have hasTagName. - SECURITY_DCHECK(object_element.HasTagName(HTMLNames::objectTag)); - return object_element; -} +// Like toHTMLObjectElement() but accepts a ListedElement as input +// instead of a Node. +const HTMLObjectElement* ToHTMLObjectElementFromListedElement( + const ListedElement*); +const HTMLObjectElement& ToHTMLObjectElementFromListedElement( + const ListedElement&); } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/ListedElement.cpp b/third_party/WebKit/Source/core/html/ListedElement.cpp index ed88266..a4a746a8 100644 --- a/third_party/WebKit/Source/core/html/ListedElement.cpp +++ b/third_party/WebKit/Source/core/html/ListedElement.cpp
@@ -283,7 +283,7 @@ const HTMLElement& ToHTMLElement(const ListedElement& listed_element) { if (listed_element.IsFormControlElement()) return ToHTMLFormControlElement(listed_element); - return toHTMLObjectElement(listed_element); + return ToHTMLObjectElementFromListedElement(listed_element); } const HTMLElement* ToHTMLElement(const ListedElement* listed_element) {
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp index c66669e0d..799d5c4a 100644 --- a/third_party/WebKit/Source/core/html/TextControlElement.cpp +++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -744,7 +744,7 @@ return; const SelectionInDOMTree& selection = frame->Selection().GetSelectionInDOMTree(); - if (selection.SelectionTypeWithLegacyGranularity() != kRangeSelection) + if (selection.Type() != kRangeSelection) return; DispatchEvent(Event::CreateBubble(EventTypeNames::select)); }
diff --git a/third_party/WebKit/Source/core/html/forms/resources/validation_bubble.css b/third_party/WebKit/Source/core/html/forms/resources/validation_bubble.css index 53b33d7..aafbe2e 100644 --- a/third_party/WebKit/Source/core/html/forms/resources/validation_bubble.css +++ b/third_party/WebKit/Source/core/html/forms/resources/validation_bubble.css
@@ -17,7 +17,18 @@ max-width: 50%; opacity: 0; position: absolute; - transition: opacity 0.3s; + will-change: opacity, transform; +} + +#container.shown-initially { + /* If scaleY is smaller than 0.2, an assertion failure occurs in Skia. */ + transform: scaleY(0.2); +} + +#container.shown-fully { + opacity: 1.0; + transform: scaleY(1); + transition: opacity 0.3s, transform 0.3s; } #bubble-body {
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp index 90e3642..7b010e6 100644 --- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp +++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -361,15 +361,8 @@ for (unsigned i = 0; i < last_coalesced_touch_event_.touches_length; ++i) { if (last_coalesced_touch_event_.touches[i].id == web_pointer_event.id) { - last_coalesced_touch_event_.touches[i].movement_x = - web_pointer_event.movement_x; - last_coalesced_touch_event_.touches[i].movement_y = - web_pointer_event.movement_y; - last_coalesced_touch_event_.SetTimeStampSeconds( - web_pointer_event.TimeStampSeconds()); - last_coalesced_touch_event_.touches[i].state = - TouchPointStateFromPointerEventType(web_pointer_event.GetType(), - false); + last_coalesced_touch_event_.touches[i] = + CreateWebTouchPointFromWebPointerEvent(web_pointer_event, false); result.AddCoalescedEvent(last_coalesced_touch_event_); // Remove up and canceled points.
diff --git a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp index 9179193..aabd872 100644 --- a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp
@@ -217,7 +217,8 @@ emulation_params_.screen_position == params.screen_position && emulation_params_.device_scale_factor == params.device_scale_factor && emulation_params_.offset == params.offset && - emulation_params_.scale == params.scale) { + emulation_params_.scale == params.scale && + emulation_params_.viewport_offset == params.viewport_offset) { return; } if (emulation_params_.device_scale_factor != params.device_scale_factor || @@ -238,7 +239,11 @@ DisableMobileEmulation(); web_view_->SetCompositorDeviceScaleFactorOverride(params.device_scale_factor); - UpdateRootLayerTransform(); + if (params.viewport_offset.x >= 0) + ForceViewport(params.viewport_offset, params.viewport_scale); + else + ResetViewport(); + // TODO(dgozman): mainFrameImpl() is null when it's remote. Figure out how // we end up with enabling emulation in this case. if (web_view_->MainFrameImpl()) { @@ -385,8 +390,10 @@ } void DevToolsEmulator::ResetViewport() { - if (!viewport_override_) + if (!viewport_override_) { + UpdateRootLayerTransform(); return; + } bool original_masking = viewport_override_->original_visual_viewport_masking; viewport_override_ = WTF::nullopt;
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json index b122a515..9156182 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.json +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -213,6 +213,19 @@ { "name": "clientHeight", "type": "number", "description": "Height (CSS pixels), excludes scrollbar if present." }, { "name": "scale", "type": "number", "description": "Scale relative to the ideal viewport (size at width=device-width)." } ] + }, + { + "id": "Viewport", + "type": "object", + "description": "Viewport for capturing screenshot.", + "experimental": true, + "properties": [ + { "name": "x", "type": "number", "description": "X offset in CSS pixels." }, + { "name": "y", "type": "number", "description": "Y offset in CSS pixels" }, + { "name": "width", "type": "number", "description": "Rectangle width in CSS pixels" }, + { "name": "height", "type": "number", "description": "Rectangle height in CSS pixels" }, + { "name": "scale", "type": "number", "description": "Page scale factor." } + ] } ], "commands": [ @@ -453,6 +466,7 @@ "parameters": [ { "name": "format", "type": "string", "optional": true, "enum": ["jpeg", "png"], "description": "Image compression format (defaults to png)." }, { "name": "quality", "type": "integer", "optional": true, "description": "Compression quality from range [0..100] (jpeg only)." }, + { "name": "clip", "$ref": "Viewport", "optional": true, "description": "Capture the screenshot of a given region only.", "experimental": true }, { "name": "fromSurface", "type": "boolean", "optional": true, "description": "Capture the screenshot from the surface, rather than the view. Defaults to true.", "experimental": true } ], "returns": [
diff --git a/third_party/WebKit/Source/core/layout/BUILD.gn b/third_party/WebKit/Source/core/layout/BUILD.gn index ce9de84..cdbb2b5 100644 --- a/third_party/WebKit/Source/core/layout/BUILD.gn +++ b/third_party/WebKit/Source/core/layout/BUILD.gn
@@ -347,6 +347,8 @@ "ng/geometry/ng_static_position.cc", "ng/geometry/ng_static_position.h", "ng/inline/empty_offset_mapping_builder.h", + "ng/inline/ng_baseline.cc", + "ng/inline/ng_baseline.h", "ng/inline/ng_bidi_paragraph.cc", "ng/inline/ng_bidi_paragraph.h", "ng/inline/ng_inline_box_state.cc",
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index 403034d..68b55f5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1723,11 +1723,23 @@ return -1; } +bool LayoutBlock::UseLogicalBottomMarginEdgeForInlineBlockBaseline() const { + // CSS2.1 states that the baseline of an 'inline-block' is: + // the baseline of the last line box in the normal flow, unless it has + // either no in-flow line boxes or if its 'overflow' property has a computed + // value other than 'visible', in which case the baseline is the bottom + // margin edge. + // We likewise avoid using the last line box in the case of size containment, + // where the block's contents shouldn't be considered when laying out its + // ancestors or siblings. + return (!Style()->IsOverflowVisible() && + !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) || + Style()->ContainsSize(); +} + int LayoutBlock::InlineBlockBaseline(LineDirectionMode line_direction) const { DCHECK(!ChildrenInline()); - if ((!Style()->IsOverflowVisible() && - !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) || - Style()->ContainsSize()) { + if (UseLogicalBottomMarginEdgeForInlineBlockBaseline()) { // We are not calling LayoutBox::baselinePosition here because the caller // should add the margin-top/margin-right, not us. return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom()
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h index bf17849..df1e1a2 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -133,6 +133,7 @@ bool first_line, LineDirectionMode, LinePositionMode = kPositionOnContainingLine) const override; + bool UseLogicalBottomMarginEdgeForInlineBlockBaseline() const; LayoutUnit MinLineHeightForReplacedObject(bool is_first_line, LayoutUnit replaced_height) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 0a9ba37..025d62c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2606,18 +2606,7 @@ int LayoutBlockFlow::InlineBlockBaseline( LineDirectionMode line_direction) const { - // CSS2.1 states that the baseline of an 'inline-block' is: - // the baseline of the last line box in the normal flow, unless it has - // either no in-flow line boxes or if its 'overflow' property has a computed - // value other than 'visible', in which case the baseline is the bottom - // margin edge. - // We likewise avoid using the last line box in the case of size containment, - // where the block's contents shouldn't be considered when laying out its - // ancestors or siblings. - - if ((!Style()->IsOverflowVisible() && - !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) || - Style()->ContainsSize()) { + if (UseLogicalBottomMarginEdgeForInlineBlockBaseline()) { // We are not calling baselinePosition here because the caller should add // the margin-top/margin-right, not us. return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom()
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h index 88d4969..133f171 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.h +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -1191,36 +1191,40 @@ // for vertical writing modes). if (!UNLIKELY(HasFlippedBlocksWritingMode())) return position; - return LogicalHeight() - position; + DCHECK(!IsHorizontalWritingMode()); + return frame_rect_.Width() - position; } WARN_UNUSED_RESULT LayoutPoint FlipForWritingMode(const LayoutPoint& position) const { if (!UNLIKELY(HasFlippedBlocksWritingMode())) return position; - return IsHorizontalWritingMode() - ? LayoutPoint(position.X(), frame_rect_.Height() - position.Y()) - : LayoutPoint(frame_rect_.Width() - position.X(), position.Y()); + DCHECK(!IsHorizontalWritingMode()); + return LayoutPoint(frame_rect_.Width() - position.X(), position.Y()); } WARN_UNUSED_RESULT LayoutSize FlipForWritingMode(const LayoutSize& offset) const { if (!UNLIKELY(HasFlippedBlocksWritingMode())) return offset; + DCHECK(!IsHorizontalWritingMode()); return LayoutSize(frame_rect_.Width() - offset.Width(), offset.Height()); } void FlipForWritingMode(LayoutRect& rect) const { if (!UNLIKELY(HasFlippedBlocksWritingMode())) return; + DCHECK(!IsHorizontalWritingMode()); rect.SetX(frame_rect_.Width() - rect.MaxX()); } WARN_UNUSED_RESULT FloatPoint FlipForWritingMode(const FloatPoint& position) const { if (!UNLIKELY(HasFlippedBlocksWritingMode())) return position; + DCHECK(!IsHorizontalWritingMode()); return FloatPoint(frame_rect_.Width() - position.X(), position.Y()); } void FlipForWritingMode(FloatRect& rect) const { if (!UNLIKELY(HasFlippedBlocksWritingMode())) return; + DCHECK(!IsHorizontalWritingMode()); rect.SetX(frame_rect_.Width() - rect.MaxX()); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp index 8cbe1e35..fd3cb6a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp
@@ -322,7 +322,7 @@ return; if (!NeedsLayout()) - UpdateGeometryInternal(*embedded_content_view); + UpdateGeometry(*embedded_content_view); if (Style()->Visibility() != EVisibility::kVisible) { embedded_content_view->Hide(); @@ -334,39 +334,7 @@ } } -void LayoutEmbeddedContent::UpdateGeometry() { - EmbeddedContentView* embedded_content_view = GetEmbeddedContentView(); - if (!embedded_content_view) - return; - - LayoutRect new_frame = ReplacedContentRect(); - DCHECK(new_frame.Size() == RoundedIntSize(new_frame.Size())); - bool bounds_will_change = - LayoutSize(embedded_content_view->FrameRect().Size()) != new_frame.Size(); - - // If frame bounds are changing mark the view for layout. Also check the - // frame's page to make sure that the frame isn't in the process of being - // destroyed. If iframe scrollbars needs reconstruction from native to custom - // scrollbar, then also we need to layout the frameview. - LocalFrameView* frame_view = ChildFrameView(); - if (frame_view && frame_view->GetFrame().GetPage() && - (bounds_will_change || frame_view->NeedsScrollbarReconstruction())) - frame_view->SetNeedsLayout(); - - UpdateGeometryInternal(*embedded_content_view); - - // If view needs layout, either because bounds have changed or possibly - // indicating content size is wrong, we have to do a layout to set the right - // LocalFrameView size. - if (frame_view && frame_view->NeedsLayout() && - frame_view->GetFrame().GetPage()) - frame_view->UpdateLayout(); - - if (PluginView* plugin = Plugin()) - plugin->GeometryMayHaveChanged(); -} - -void LayoutEmbeddedContent::UpdateGeometryInternal( +void LayoutEmbeddedContent::UpdateGeometry( EmbeddedContentView& embedded_content_view) { // Ignore transform here, as we only care about the sub-pixel accumulation. // TODO(trchen): What about multicol? Need a LayoutBox function to query @@ -390,8 +358,6 @@ LocalToAbsoluteQuad(FloatRect(ReplacedContentRect())).BoundingBox(); frame_rect.SetLocation(RoundedIntPoint(absolute_bounding_box.Location())); - // Why is the protector needed? - RefPtr<LayoutEmbeddedContent> protector(this); embedded_content_view.SetFrameRect(frame_rect); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h index 8fe30ea..800d5cd 100644 --- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h +++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h
@@ -61,7 +61,7 @@ LayoutRect ReplacedContentRect() const final; void UpdateOnEmbeddedContentViewChange(); - void UpdateGeometry(); + void UpdateGeometry(EmbeddedContentView&); bool IsLayoutEmbeddedContent() const final { return true; } virtual void PaintContents(const PaintInfo&, const LayoutPoint&) const; @@ -77,7 +77,6 @@ CursorDirective GetCursor(const LayoutPoint&, Cursor&) const final; private: - void UpdateGeometryInternal(EmbeddedContentView&); CompositingReasons AdditionalCompositingReasons() const override; void WillBeDestroyed() final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h index 68ea703f..e5f0913 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -600,11 +600,6 @@ bitfields_.SetHasCounterNodeMap(has_counter_node_map); } - bool LayoutNGInline() const { return bitfields_.LayoutNGInline(); } - void SetLayoutNGInline(bool layout_ng_inline) { - bitfields_.SetLayoutNGInline(layout_ng_inline); - } - bool IsTruncated() const { return bitfields_.IsTruncated(); } void SetIsTruncated(bool is_truncated) { bitfields_.SetIsTruncated(is_truncated); @@ -2280,7 +2275,6 @@ background_changed_since_last_paint_invalidation_(false), outline_may_be_affected_by_descendants_(false), previous_outline_may_be_affected_by_descendants_(false), - layout_ng_inline_(false), is_truncated_(false), positioned_state_(kIsStaticallyPositioned), selection_state_(static_cast<unsigned>(SelectionState::kNone)), @@ -2481,13 +2475,11 @@ ADD_BOOLEAN_BITFIELD(previous_outline_may_be_affected_by_descendants_, PreviousOutlineMayBeAffectedByDescendants); - ADD_BOOLEAN_BITFIELD(layout_ng_inline_, LayoutNGInline); - ADD_BOOLEAN_BITFIELD(is_truncated_, IsTruncated); protected: // Use protected to avoid warning about unused variable. - unsigned unused_bits_ : 2; + unsigned unused_bits_ : 3; private: // This is the cached 'position' value of this object
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc new file mode 100644 index 0000000..b85f373 --- /dev/null +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.cc
@@ -0,0 +1,42 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/layout/ng/inline/ng_baseline.h" + +#include "core/layout/LayoutBlock.h" +#include "core/layout/ng/ng_block_node.h" +#include "core/layout/ng/ng_layout_input_node.h" + +namespace blink { + +bool NGBaseline::ShouldPropagateBaselines(const NGLayoutInputNode node) { + if (node.IsInline()) + return true; + + return ShouldPropagateBaselines(ToLayoutBox(node.GetLayoutObject())); +} + +bool NGBaseline::ShouldPropagateBaselines(LayoutBox* layout_box) { + // Test if this node should use its own box to synthesize the baseline. + if (!layout_box->IsLayoutBlock() || + layout_box->IsFloatingOrOutOfFlowPositioned() || + layout_box->IsWritingModeRoot()) + return false; + + // If this node is LayoutBlock that uses old layout, this may be a subclass + // that overrides baseline functions. Propagate baseline requests so that we + // call virtual functions. + if (!NGBlockNode(layout_box).CanUseNewLayout()) + return true; + + // CSS defines certain cases to synthesize baselines from box. See comments in + // UseLogicalBottomMarginEdgeForInlineBlockBaseline(). + const LayoutBlock* layout_block = ToLayoutBlock(layout_box); + if (layout_block->UseLogicalBottomMarginEdgeForInlineBlockBaseline()) + return false; + + return true; +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h new file mode 100644 index 0000000..226dca1 --- /dev/null +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_baseline.h
@@ -0,0 +1,45 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NGBaseline_h +#define NGBaseline_h + +#include "platform/LayoutUnit.h" +#include "platform/fonts/FontBaseline.h" + +namespace blink { + +class LayoutBox; +class NGLayoutInputNode; + +enum class NGBaselineAlgorithmType { + // Compute baselines for atomic inlines. + kAtomicInline, + // Compute baselines for atomic inlines using the first line style. + kAtomicInlineForFirstLine, + // Compute baseline of first line box. + kFirstLine +}; + +// Baselines are products of layout. +// To compute baseline, add requests to NGConstraintSpace and run Layout(). +struct NGBaselineRequest { + NGBaselineAlgorithmType algorithm_type; + FontBaseline baseline_type; +}; + +// Represents a computed baseline position. +struct NGBaseline { + NGBaselineAlgorithmType algorithm_type; + FontBaseline baseline_type; + LayoutUnit offset; + + // @return if the node needs to propagate baseline requests/results. + static bool ShouldPropagateBaselines(const NGLayoutInputNode); + static bool ShouldPropagateBaselines(LayoutBox*); +}; + +} // namespace blink + +#endif // NGBaseline_h
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 039538b..d3a558cb 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -4,6 +4,7 @@ #include "core/layout/ng/inline/ng_inline_layout_algorithm.h" +#include "core/layout/ng/inline/ng_baseline.h" #include "core/layout/ng/inline/ng_bidi_paragraph.h" #include "core/layout/ng/inline/ng_inline_break_token.h" #include "core/layout/ng/inline/ng_inline_node.h" @@ -287,25 +288,15 @@ NGInlineBoxState* box = box_states_.OnOpenTag(item, *item_result, line_box, position); - // For replaced elements, inline-block elements, and inline-table elements, - // the height is the height of their margin box. - // https://drafts.csswg.org/css2/visudet.html#line-height NGBoxFragment fragment( ConstraintSpace().WritingMode(), ToNGPhysicalBoxFragment( item_result->layout_result->PhysicalFragment().Get())); - LayoutUnit block_size = - fragment.BlockSize() + item_result->margins.BlockSum(); - - // TODO(kojii): Add baseline position to NGPhysicalFragment. - LayoutBox* layout_box = ToLayoutBox(item.GetLayoutObject()); - LineDirectionMode line_direction_mode = - IsHorizontalWritingMode() ? LineDirectionMode::kHorizontalLine - : LineDirectionMode::kVerticalLine; - LayoutUnit baseline_offset(layout_box->BaselinePosition( - baseline_type_, line_info.UseFirstLineStyle(), line_direction_mode)); - - NGLineHeightMetrics metrics(baseline_offset, block_size - baseline_offset); + NGLineHeightMetrics metrics = fragment.BaselineMetrics( + {line_info.UseFirstLineStyle() + ? NGBaselineAlgorithmType::kAtomicInlineForFirstLine + : NGBaselineAlgorithmType::kAtomicInline, + baseline_type_}); box->metrics.Unite(metrics); // TODO(kojii): Figure out what to do with OOF in NGLayoutResult. @@ -315,7 +306,7 @@ // |fragment| directly. Currently |CopyFragmentDataToLayoutBlockFlow| // requires a text fragment. text_builder->SetDirection(style.Direction()); - text_builder->SetSize({fragment.InlineSize(), block_size}); + text_builder->SetSize({fragment.InlineSize(), metrics.LineHeight()}); LayoutUnit line_top = item_result->margins.block_start - metrics.ascent; RefPtr<NGPhysicalTextFragment> text_fragment = text_builder->ToTextFragment( item_result->item_index, item_result->start_offset, @@ -406,6 +397,50 @@ return content_size; } +// Add a baseline from a child line box. +// @return false if the specified child is not a line box. +bool NGInlineLayoutAlgorithm::AddBaseline(const NGBaselineRequest& request, + unsigned child_index) { + const NGPhysicalFragment* child = + container_builder_.Children()[child_index].Get(); + if (!child->IsLineBox()) + return false; + + const NGPhysicalLineBoxFragment* line_box = + ToNGPhysicalLineBoxFragment(child); + LayoutUnit offset = line_box->BaselinePosition(request.baseline_type); + container_builder_.AddBaseline( + request.algorithm_type, request.baseline_type, + offset + container_builder_.Offsets()[child_index].block_offset); + return true; +} + +// Compute requested baselines from child line boxes. +void NGInlineLayoutAlgorithm::PropagateBaselinesFromChildren() { + const Vector<NGBaselineRequest>& requests = + ConstraintSpace().BaselineRequests(); + if (requests.IsEmpty()) + return; + + for (const auto& request : requests) { + switch (request.algorithm_type) { + case NGBaselineAlgorithmType::kAtomicInline: + case NGBaselineAlgorithmType::kAtomicInlineForFirstLine: + for (unsigned i = container_builder_.Children().size(); i--;) { + if (AddBaseline(request, i)) + break; + } + break; + case NGBaselineAlgorithmType::kFirstLine: + for (unsigned i = 0; i < container_builder_.Children().size(); i++) { + if (AddBaseline(request, i)) + break; + } + break; + } + } +} + RefPtr<NGLayoutResult> NGInlineLayoutAlgorithm::Layout() { // Line boxes should start at (0,0). // The parent NGBlockLayoutAlgorithm places the anonymous wrapper using the @@ -440,6 +475,8 @@ container_builder_.SetEndMarginStrut(ConstraintSpace().MarginStrut()); } + PropagateBaselinesFromChildren(); + return container_builder_.ToBoxFragment(); }
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h index 1c6d622..e7a67472 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
@@ -67,6 +67,9 @@ LayoutUnit ComputeContentSize(const NGLineInfo&, LayoutUnit line_bottom); + void PropagateBaselinesFromChildren(); + bool AddBaseline(const NGBaselineRequest&, unsigned); + NGInlineLayoutStateStack box_states_; LayoutUnit content_size_; LayoutUnit max_inline_size_;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc index aec4c53..765e4577 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
@@ -245,9 +245,8 @@ } // namespace NGInlineNode::NGInlineNode(LayoutNGBlockFlow* block) - : NGLayoutInputNode(block) { + : NGLayoutInputNode(block, kInline) { DCHECK(block); - block->SetLayoutNGInline(true); if (!block->HasNGInlineNodeData()) block->ResetNGInlineNodeData(); } @@ -359,10 +358,7 @@ return result; } -enum class ContentSizeMode { Max, Sum }; - static LayoutUnit ComputeContentSize(NGInlineNode node, - ContentSizeMode mode, LayoutUnit available_inline_size) { const ComputedStyle& style = node.Style(); NGWritingMode writing_mode = FromPlatformWritingMode(style.GetWritingMode()); @@ -384,11 +380,7 @@ LayoutUnit inline_size = line_info.TextIndent(); for (const NGInlineItemResult item_result : line_info.Results()) inline_size += item_result.inline_size; - if (mode == ContentSizeMode::Max) { - result = std::max(inline_size, result); - } else { - result += inline_size; - } + result = std::max(inline_size, result); } return result; } @@ -407,15 +399,16 @@ // size. This gives the min-content, the width where lines wrap at every // break opportunity. MinMaxContentSize sizes; - sizes.min_content = - ComputeContentSize(*this, ContentSizeMode::Max, LayoutUnit()); + sizes.min_content = ComputeContentSize(*this, LayoutUnit()); // Compute the sum of inline sizes of all inline boxes with no line breaks. // TODO(kojii): NGConstraintSpaceBuilder does not allow NGSizeIndefinite // inline available size. We can allow it, or make this more efficient // without using NGLineBreaker. - sizes.max_content = - ComputeContentSize(*this, ContentSizeMode::Sum, LayoutUnit::Max()); + sizes.max_content = ComputeContentSize(*this, LayoutUnit::Max()); + + // Negative text-indent can make min > max. Ensure min is the minimum size. + sizes.min_content = std::min(sizes.min_content, sizes.max_content); return sizes; }
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc index f5eadaa..bcea6b9 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
@@ -164,7 +164,7 @@ if (item.Type() == NGInlineItem::kText) { state = HandleText(*item_results, item, item_result); } else if (item.Type() == NGInlineItem::kAtomicInline) { - state = HandleAtomicInline(item, item_result); + state = HandleAtomicInline(item, item_result, *line_info); } else if (item.Type() == NGInlineItem::kControl) { state = HandleControlItem(item, item_result); if (state == LineBreakState::kForcedBreak) { @@ -349,13 +349,26 @@ NGLineBreaker::LineBreakState NGLineBreaker::HandleAtomicInline( const NGInlineItem& item, - NGInlineItemResult* item_result) { + NGInlineItemResult* item_result, + const NGLineInfo& line_info) { DCHECK_EQ(item.Type(), NGInlineItem::kAtomicInline); should_create_line_box_ = true; - NGBlockNode node = NGBlockNode(ToLayoutBox(item.GetLayoutObject())); + LayoutBox* layout_box = ToLayoutBox(item.GetLayoutObject()); + NGBlockNode node = NGBlockNode(layout_box); const ComputedStyle& style = node.Style(); NGConstraintSpaceBuilder constraint_space_builder(constraint_space_); + // Request to compute baseline during the layout, except when we know the box + // would synthesize box-baseline. + if (NGBaseline::ShouldPropagateBaselines(layout_box)) { + constraint_space_builder.AddBaselineRequest( + line_info.UseFirstLineStyle() + ? NGBaselineAlgorithmType::kAtomicInlineForFirstLine + : NGBaselineAlgorithmType::kAtomicInline, + IsHorizontalWritingMode(constraint_space_->WritingMode()) + ? FontBaseline::kAlphabeticBaseline + : FontBaseline::kIdeographicBaseline); + } RefPtr<NGConstraintSpace> constraint_space = constraint_space_builder.SetIsNewFormattingContext(true) .SetIsShrinkToFit(true)
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h index 6d8c2256..421b5de1 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
@@ -72,7 +72,9 @@ LayoutUnit available_width); LineBreakState HandleControlItem(const NGInlineItem&, NGInlineItemResult*); - LineBreakState HandleAtomicInline(const NGInlineItem&, NGInlineItemResult*); + LineBreakState HandleAtomicInline(const NGInlineItem&, + NGInlineItemResult*, + const NGLineInfo&); void HandleFloat(const NGInlineItem&, NGInlineItemResults*);
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.cc index 3e1b38f..ef10d587 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.cc
@@ -19,4 +19,11 @@ children_.swap(children); } +LayoutUnit NGPhysicalLineBoxFragment::BaselinePosition(FontBaseline) const { + // TODO(kojii): Computing other baseline types than the used one is not + // implemented yet. + // TODO(kojii): We might need locale/script to look up OpenType BASE table. + return metrics_.ascent; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.h index 94aabeb..386e449 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_physical_line_box_fragment.h
@@ -9,6 +9,7 @@ #include "core/layout/ng/geometry/ng_logical_offset.h" #include "core/layout/ng/inline/ng_line_height_metrics.h" #include "core/layout/ng/ng_physical_fragment.h" +#include "platform/fonts/FontBaseline.h" namespace blink { @@ -26,6 +27,9 @@ const NGLineHeightMetrics& Metrics() const { return metrics_; } + // Compute baseline for the specified baseline type. + LayoutUnit BaselinePosition(FontBaseline) const; + private: Vector<RefPtr<NGPhysicalFragment>> children_;
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc index f50fa2c..68dcf1d 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc
@@ -55,4 +55,17 @@ ng_inline_node_data_ = WTF::MakeUnique<NGInlineNodeData>(); } +int LayoutNGBlockFlow::FirstLineBoxBaseline() const { + // TODO(kojii): Implement. This will stop working once we stop creating line + // boxes. + return LayoutBlockFlow::FirstLineBoxBaseline(); +} + +int LayoutNGBlockFlow::InlineBlockBaseline( + LineDirectionMode line_direction) const { + // TODO(kojii): Implement. This will stop working once we stop creating line + // boxes. + return LayoutBlockFlow::InlineBlockBaseline(line_direction); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.h b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.h index 171b0f4a..e00a287 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.h +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.h
@@ -26,6 +26,9 @@ void ResetNGInlineNodeData(); bool HasNGInlineNodeData() const { return ng_inline_node_data_.get(); } + int FirstLineBoxBaseline() const override; + int InlineBlockBaseline(LineDirectionMode) const override; + private: bool IsOfType(LayoutObjectType) const override;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc index 24d4112..b5244aa 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -337,6 +337,8 @@ ConstraintSpace().HasBlockFragmentation()) FinalizeForFragmentation(); + PropagateBaselinesFromChildren(); + return container_builder_.ToBoxFragment(); } @@ -679,6 +681,9 @@ space_builder.SetAvailableSize(child_available_size_) .SetPercentageResolutionSize(child_percentage_size_); + if (NGBaseline::ShouldPropagateBaselines(child)) + space_builder.AddBaselineRequests(ConstraintSpace().BaselineRequests()); + bool is_new_fc = child.CreatesNewFormattingContext(); space_builder.SetIsNewFormattingContext(is_new_fc) .SetBfcOffset(child_data.bfc_offset_estimate) @@ -720,4 +725,52 @@ return space_builder.ToConstraintSpace( FromPlatformWritingMode(child_style.GetWritingMode())); } + +bool NGBlockLayoutAlgorithm::AddBaseline(const NGBaselineRequest& request, + unsigned child_index) { + const NGPhysicalFragment* child = + container_builder_.Children()[child_index].Get(); + if (!child->IsBox()) + return false; + LayoutObject* layout_object = child->GetLayoutObject(); + if (layout_object->IsFloatingOrOutOfFlowPositioned()) + return false; + + const NGPhysicalBoxFragment* box = ToNGPhysicalBoxFragment(child); + if (const NGBaseline* baseline = box->Baseline(request)) { + container_builder_.AddBaseline( + request.algorithm_type, request.baseline_type, + baseline->offset + + container_builder_.Offsets()[child_index].block_offset); + return true; + } + return false; +} + +// Propagate computed baselines from children. +// Skip children that do not produce baselines (e.g., empty blocks.) +void NGBlockLayoutAlgorithm::PropagateBaselinesFromChildren() { + const Vector<NGBaselineRequest>& requests = + ConstraintSpace().BaselineRequests(); + if (requests.IsEmpty()) + return; + + for (const auto& request : requests) { + switch (request.algorithm_type) { + case NGBaselineAlgorithmType::kAtomicInline: + case NGBaselineAlgorithmType::kAtomicInlineForFirstLine: + for (unsigned i = container_builder_.Children().size(); i--;) { + if (AddBaseline(request, i)) + break; + } + break; + case NGBaselineAlgorithmType::kFirstLine: + for (unsigned i = 0; i < container_builder_.Children().size(); i++) { + if (AddBaseline(request, i)) + break; + } + break; + } + } +} } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h index f93787e1..b24ab278 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
@@ -120,6 +120,9 @@ // token if we're out of space. void FinalizeForFragmentation(); + void PropagateBaselinesFromChildren(); + bool AddBaseline(const NGBaselineRequest&, unsigned); + // Calculates logical offset for the current fragment using either // {@code content_size_} when the fragment doesn't know it's offset // or {@code known_fragment_offset} if the fragment knows it's offset
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index 771d4b4..6fea69c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -120,10 +120,7 @@ } // namespace -NGBlockNode::NGBlockNode(LayoutBox* box) : NGLayoutInputNode(box) { - if (box) - box->SetLayoutNGInline(false); -} +NGBlockNode::NGBlockNode(LayoutBox* box) : NGLayoutInputNode(box, kBlock) {} RefPtr<NGLayoutResult> NGBlockNode::Layout(NGConstraintSpace* constraint_space, NGBreakToken* break_token) { @@ -360,9 +357,64 @@ .SetDirection(box_->StyleRef().Direction()) .SetWritingMode(writing_mode) .SetOverflowSize(overflow_size); + CopyBaselinesFromOldLayout(constraint_space, &builder); return builder.ToBoxFragment(); } +void NGBlockNode::CopyBaselinesFromOldLayout( + const NGConstraintSpace& constraint_space, + NGFragmentBuilder* builder) { + const Vector<NGBaselineRequest>& requests = + constraint_space.BaselineRequests(); + if (requests.IsEmpty()) + return; + + for (const auto& request : requests) { + switch (request.algorithm_type) { + case NGBaselineAlgorithmType::kAtomicInline: + AddAtomicInlineBaselineFromOldLayout(request, false, builder); + break; + case NGBaselineAlgorithmType::kAtomicInlineForFirstLine: + AddAtomicInlineBaselineFromOldLayout(request, true, builder); + break; + case NGBaselineAlgorithmType::kFirstLine: { + int position = box_->FirstLineBoxBaseline(); + if (position != -1) { + builder->AddBaseline(request.algorithm_type, request.baseline_type, + LayoutUnit(position)); + } + break; + } + } + } +} + +void NGBlockNode::AddAtomicInlineBaselineFromOldLayout( + const NGBaselineRequest& request, + bool is_first_line, + NGFragmentBuilder* builder) { + LineDirectionMode line_direction = + IsHorizontalWritingMode(builder->WritingMode()) + ? LineDirectionMode::kHorizontalLine + : LineDirectionMode::kVerticalLine; + LayoutUnit position = LayoutUnit(box_->BaselinePosition( + request.baseline_type, is_first_line, line_direction)); + + // Some form controls return 0 for BaselinePosition() if 'display:block'. + // Blocks without line boxes should not produce baselines. + if (!position && !box_->IsAtomicInlineLevel() && + !box_->IsLayoutNGBlockFlow() && + box_->InlineBlockBaseline(line_direction) == -1) { + return; + } + + // BaselinePosition() uses margin edge for atomic inlines. + if (box_->IsAtomicInlineLevel()) + position -= box_->MarginOver(); + + builder->AddBaseline(request.algorithm_type, request.baseline_type, position); +} + void NGBlockNode::UseOldOutOfFlowPositioning() { DCHECK(box_->IsOutOfFlowPositioned()); box_->ContainingBlock()->InsertPositionedObject(box_);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.h b/third_party/WebKit/Source/core/layout/ng/ng_block_node.h index 8abc2b6..55b602d1 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.h
@@ -16,6 +16,7 @@ class LayoutObject; class NGBreakToken; class NGConstraintSpace; +class NGFragmentBuilder; class NGLayoutResult; struct NGLogicalOffset; struct MinMaxContentSize; @@ -59,6 +60,11 @@ // After we run the layout algorithm, this function copies back the geometry // data to the layout box. void CopyFragmentDataToLayoutBox(const NGConstraintSpace&, NGLayoutResult*); + + void CopyBaselinesFromOldLayout(const NGConstraintSpace&, NGFragmentBuilder*); + void AddAtomicInlineBaselineFromOldLayout(const NGBaselineRequest&, + bool, + NGFragmentBuilder*); }; DEFINE_TYPE_CASTS(NGBlockNode,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.cc index 99db6d8..175c163 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.cc
@@ -4,7 +4,9 @@ #include "core/layout/ng/ng_box_fragment.h" +#include "core/layout/LayoutBox.h" #include "core/layout/ng/geometry/ng_logical_size.h" +#include "core/layout/ng/inline/ng_line_height_metrics.h" #include "core/layout/ng/ng_macros.h" #include "core/layout/ng/ng_physical_box_fragment.h" @@ -15,4 +17,40 @@ return physical_fragment->OverflowSize().ConvertToLogical(WritingMode()); } +NGLineHeightMetrics NGBoxFragment::BaselineMetrics( + const NGBaselineRequest& request) const { + LayoutBox* layout_box = ToLayoutBox(physical_fragment_->GetLayoutObject()); + + // Find the baseline from the computed results. + const NGPhysicalBoxFragment* physical_fragment = + ToNGPhysicalBoxFragment(physical_fragment_); + if (const NGBaseline* baseline = physical_fragment->Baseline(request)) { + LayoutUnit ascent = baseline->offset; + LayoutUnit descent = BlockSize() - ascent; + + // For replaced elements, inline-block elements, and inline-table + // elements, the height is the height of their margin box. + // https://drafts.csswg.org/css2/visudet.html#line-height + if (layout_box->IsAtomicInlineLevel()) { + ascent += layout_box->MarginOver(); + descent += layout_box->MarginUnder(); + } + + return NGLineHeightMetrics(ascent, descent); + } + + // The baseline type was not found. This is either this box should synthesize + // box-baseline without propagating from children, or caller forgot to add + // baseline requests to constraint space when it called Layout(). + LayoutUnit block_size = BlockSize(); + + // If atomic inline, use the margin box. See above. + if (layout_box->IsAtomicInlineLevel()) + block_size += layout_box->MarginLogicalHeight(); + + if (request.baseline_type == kAlphabeticBaseline) + return NGLineHeightMetrics(block_size, LayoutUnit()); + return NGLineHeightMetrics(block_size - block_size / 2, block_size / 2); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.h index 60c14c8..b14c1af 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_box_fragment.h
@@ -12,6 +12,7 @@ namespace blink { +struct NGLineHeightMetrics; struct NGLogicalSize; class CORE_EXPORT NGBoxFragment final : public NGFragment { @@ -22,6 +23,12 @@ // Returns the total size, including the contents outside of the border-box. NGLogicalSize OverflowSize() const; + + // Compute baseline metrics (ascent/descent) for this box. + // + // Baseline requests must be added to constraint space when this fragment was + // laid out. + NGLineHeightMetrics BaselineMetrics(const NGBaselineRequest&) const; }; DEFINE_TYPE_CASTS(NGBoxFragment,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc index 5652b301..c4b3ac7 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -30,7 +30,8 @@ const WTF::Optional<NGLogicalOffset>& floats_bfc_offset, const std::shared_ptr<NGExclusions>& exclusions, Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats, - const WTF::Optional<LayoutUnit>& clearance_offset) + const WTF::Optional<LayoutUnit>& clearance_offset, + Vector<NGBaselineRequest>& baseline_requests) : available_size_(available_size), percentage_resolution_size_(percentage_resolution_size), initial_containing_block_size_(initial_containing_block_size), @@ -53,6 +54,7 @@ exclusions_(exclusions), clearance_offset_(clearance_offset) { unpositioned_floats_.swap(unpositioned_floats); + baseline_requests_.swap(baseline_requests); } RefPtr<NGConstraintSpace> NGConstraintSpace::CreateFromLayoutObject(
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h index e33bdc9..21fe728 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
@@ -10,6 +10,7 @@ #include "core/layout/ng/geometry/ng_logical_size.h" #include "core/layout/ng/geometry/ng_margin_strut.h" #include "core/layout/ng/geometry/ng_physical_size.h" +#include "core/layout/ng/inline/ng_baseline.h" #include "core/layout/ng/ng_exclusion.h" #include "core/layout/ng/ng_unpositioned_float.h" #include "core/layout/ng/ng_writing_mode.h" @@ -155,6 +156,10 @@ return clearance_offset_; } + const Vector<NGBaselineRequest>& BaselineRequests() const { + return baseline_requests_; + } + bool operator==(const NGConstraintSpace&) const; bool operator!=(const NGConstraintSpace&) const; @@ -182,7 +187,8 @@ const WTF::Optional<NGLogicalOffset>& floats_bfc_offset, const std::shared_ptr<NGExclusions>& exclusions, Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats, - const WTF::Optional<LayoutUnit>& clearance_offset); + const WTF::Optional<LayoutUnit>& clearance_offset, + Vector<NGBaselineRequest>& baseline_requests); NGPhysicalSize InitialContainingBlockSize() const { return initial_containing_block_size_; @@ -220,6 +226,8 @@ const std::shared_ptr<NGExclusions> exclusions_; WTF::Optional<LayoutUnit> clearance_offset_; Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; + + Vector<NGBaselineRequest> baseline_requests_; }; inline std::ostream& operator<<(std::ostream& stream,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc index 6b04a0c7..89880d1b 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
@@ -149,6 +149,19 @@ return *this; } +void NGConstraintSpaceBuilder::AddBaselineRequests( + const Vector<NGBaselineRequest>& requests) { + baseline_requests_.AppendVector(requests); +} + +NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::AddBaselineRequest( + NGBaselineAlgorithmType algorithm_type, + FontBaseline baseline_type) { + baseline_requests_.push_back( + NGBaselineRequest{algorithm_type, baseline_type}); + return *this; +} + RefPtr<NGConstraintSpace> NGConstraintSpaceBuilder::ToConstraintSpace( NGWritingMode out_writing_mode) { // Whether the child and the containing block are parallel to each other. @@ -213,7 +226,7 @@ is_block_direction_triggers_scrollbar_, static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions, - unpositioned_floats_, clearance_offset)); + unpositioned_floats_, clearance_offset, baseline_requests_)); } return AdoptRef(new NGConstraintSpace( out_writing_mode, static_cast<TextDirection>(text_direction_), @@ -224,7 +237,7 @@ is_inline_direction_triggers_scrollbar_, static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions, - unpositioned_floats_, clearance_offset)); + unpositioned_floats_, clearance_offset, baseline_requests_)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h index 60006fdf..6dd79da1 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
@@ -60,6 +60,10 @@ NGConstraintSpaceBuilder& SetClearanceOffset( const WTF::Optional<LayoutUnit>& clearance_offset); + void AddBaselineRequests(const Vector<NGBaselineRequest>&); + NGConstraintSpaceBuilder& AddBaselineRequest(NGBaselineAlgorithmType, + FontBaseline); + // Creates a new constraint space. This may be called multiple times, for // example the constraint space will be different for a child which: // - Establishes a new formatting context. @@ -95,6 +99,7 @@ std::shared_ptr<NGExclusions> exclusions_; WTF::Optional<LayoutUnit> clearance_offset_; Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; + Vector<NGBaselineRequest> baseline_requests_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc index f8cc737..edf3598 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
@@ -4,6 +4,7 @@ #include "core/layout/ng/ng_fragment_builder.h" +#include "core/layout/ng/inline/ng_physical_line_box_fragment.h" #include "core/layout/ng/inline/ng_physical_text_fragment.h" #include "core/layout/ng/ng_block_break_token.h" #include "core/layout/ng/ng_block_node.h" @@ -192,6 +193,12 @@ return *this; } +void NGFragmentBuilder::AddBaseline(NGBaselineAlgorithmType algorithm_type, + FontBaseline baseline_type, + LayoutUnit offset) { + baselines_.push_back(NGBaseline{algorithm_type, baseline_type, offset}); +} + RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() { DCHECK_EQ(type_, NGPhysicalFragment::kFragmentBox); DCHECK_EQ(offsets_.size(), children_.size()); @@ -229,8 +236,8 @@ RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_), - children_, positioned_floats_, border_edges_.ToPhysical(writing_mode_), - std::move(break_token))); + children_, positioned_floats_, baselines_, + border_edges_.ToPhysical(writing_mode_), std::move(break_token))); return AdoptRef( new NGLayoutResult(std::move(fragment), oof_positioned_descendants_,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h index 5ea8559..056871f9 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
@@ -6,6 +6,7 @@ #define NGFragmentBuilder_h #include "core/layout/ng/geometry/ng_static_position.h" +#include "core/layout/ng/inline/ng_baseline.h" #include "core/layout/ng/inline/ng_physical_text_fragment.h" #include "core/layout/ng/ng_break_token.h" #include "core/layout/ng/ng_constraint_space.h" @@ -31,6 +32,7 @@ using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; + NGWritingMode WritingMode() const { return writing_mode_; } NGFragmentBuilder& SetWritingMode(NGWritingMode); NGFragmentBuilder& SetDirection(TextDirection); @@ -128,6 +130,8 @@ return children_; } + const Vector<NGLogicalOffset>& Offsets() const { return offsets_; } + bool DidBreak() const { return did_break_; } NGFragmentBuilder& SetBorderEdges(NGBorderEdges border_edges) { @@ -135,6 +139,8 @@ return *this; } + void AddBaseline(NGBaselineAlgorithmType, FontBaseline, LayoutUnit); + private: // An out-of-flow positioned-candidate is a temporary data structure used // within the NGFragmentBuilder. @@ -187,6 +193,8 @@ WTF::Optional<NGLogicalOffset> bfc_offset_; NGMarginStrut end_margin_strut_; + Vector<NGBaseline> baselines_; + NGBorderEdges border_edges_; };
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc index b8654624..fa02cb5 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc
@@ -57,11 +57,11 @@ } // namespace bool NGLayoutInputNode::IsInline() const { - return box_->LayoutNGInline(); + return type_ == kInline; } bool NGLayoutInputNode::IsBlock() const { - return !IsInline(); + return type_ == kBlock; } bool NGLayoutInputNode::IsFloating() const {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h index d5ae7a3..c3836a4 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h
@@ -25,7 +25,13 @@ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); public: - NGLayoutInputNode(std::nullptr_t) : box_(nullptr) {} + enum NGLayoutInputNodeType { + kBlock, + kInline + // When adding new values, ensure type_ below has enough bits. + }; + + NGLayoutInputNode(std::nullptr_t) : box_(nullptr), type_(kBlock) {} bool IsInline() const; bool IsBlock() const; @@ -64,9 +70,12 @@ #endif protected: - explicit NGLayoutInputNode(LayoutBox* box) : box_(box) {} + NGLayoutInputNode(LayoutBox* box, NGLayoutInputNodeType type) + : box_(box), type_(type) {} LayoutBox* box_; + + unsigned type_ : 1; // NGLayoutInputNodeType }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc index 6146b2f..5f5aa39 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc
@@ -14,6 +14,7 @@ NGPhysicalSize overflow, Vector<RefPtr<NGPhysicalFragment>>& children, Vector<NGPositionedFloat>& positioned_floats, + Vector<NGBaseline>& baselines, unsigned border_edges, // NGBorderEdges::Physical RefPtr<NGBreakToken> break_token) : NGPhysicalFragment(layout_object, @@ -23,7 +24,18 @@ overflow_(overflow), positioned_floats_(positioned_floats) { children_.swap(children); + baselines_.swap(baselines); border_edge_ = border_edges; } +const NGBaseline* NGPhysicalBoxFragment::Baseline( + const NGBaselineRequest& request) const { + for (const auto& baseline : baselines_) { + if (baseline.algorithm_type == request.algorithm_type && + baseline.baseline_type == request.baseline_type) + return &baseline; + } + return nullptr; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h index 7e1ec6a..e62095f 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
@@ -8,6 +8,7 @@ #include "core/CoreExport.h" #include "core/layout/ng/geometry/ng_logical_offset.h" #include "core/layout/ng/geometry/ng_margin_strut.h" +#include "core/layout/ng/inline/ng_baseline.h" #include "core/layout/ng/ng_physical_fragment.h" #include "core/layout/ng/ng_positioned_float.h" #include "platform/wtf/Optional.h" @@ -22,6 +23,7 @@ NGPhysicalSize overflow, Vector<RefPtr<NGPhysicalFragment>>& children, Vector<NGPositionedFloat>& positioned_floats, + Vector<NGBaseline>& baselines, unsigned, // NGBorderEdges::Physical RefPtr<NGBreakToken> break_token = nullptr); @@ -39,10 +41,13 @@ return positioned_floats_; } + const NGBaseline* Baseline(const NGBaselineRequest&) const; + private: NGPhysicalSize overflow_; Vector<RefPtr<NGPhysicalFragment>> children_; Vector<NGPositionedFloat> positioned_floats_; + Vector<NGBaseline> baselines_; }; DEFINE_TYPE_CASTS(NGPhysicalBoxFragment,
diff --git a/third_party/WebKit/Source/core/loader/BUILD.gn b/third_party/WebKit/Source/core/loader/BUILD.gn index 13f291d7..96a5d00 100644 --- a/third_party/WebKit/Source/core/loader/BUILD.gn +++ b/third_party/WebKit/Source/core/loader/BUILD.gn
@@ -77,6 +77,7 @@ "appcache/ApplicationCache.h", "appcache/ApplicationCacheHost.cpp", "appcache/ApplicationCacheHost.h", + "modulescript/ModuleScriptCreationParams.h", "modulescript/ModuleScriptFetchRequest.h", "modulescript/ModuleScriptLoader.cpp", "modulescript/ModuleScriptLoader.h",
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptCreationParams.h b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptCreationParams.h new file mode 100644 index 0000000..a8c602b --- /dev/null +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptCreationParams.h
@@ -0,0 +1,49 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ModuleScriptCreationParams_h +#define ModuleScriptCreationParams_h + +#include "platform/CrossThreadCopier.h" +#include "platform/loader/fetch/AccessControlStatus.h" +#include "platform/weborigin/KURL.h" +#include "platform/wtf/Optional.h" +#include "platform/wtf/text/WTFString.h" +#include "public/platform/WebURLRequest.h" + +namespace blink { + +// A ModuleScriptCreationParams carries parameters for creating ModuleScript. +class ModuleScriptCreationParams { + public: + ModuleScriptCreationParams( + const KURL& response_url, + const String& source_text, + WebURLRequest::FetchCredentialsMode fetch_credentials_mode, + AccessControlStatus access_control_status) + : response_url_(response_url), + source_text_(source_text), + fetch_credentials_mode_(fetch_credentials_mode), + access_control_status_(access_control_status) {} + ~ModuleScriptCreationParams() = default; + + const KURL& GetResponseUrl() const { return response_url_; }; + const String& GetSourceText() const { return source_text_; } + WebURLRequest::FetchCredentialsMode GetFetchCredentialsMode() const { + return fetch_credentials_mode_; + } + AccessControlStatus GetAccessControlStatus() const { + return access_control_status_; + } + + private: + const KURL response_url_; + const String source_text_; + const WebURLRequest::FetchCredentialsMode fetch_credentials_mode_; + const AccessControlStatus access_control_status_; +}; + +} // namespace blink + +#endif // ModuleScriptCreationParams_h
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderTest.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderTest.cpp index 5ee8a06..0744e5ee 100644 --- a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderTest.cpp
@@ -130,7 +130,7 @@ GetDocument().SetURL(KURL(NullURL(), "https://example.test")); auto* context = MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); - fetcher_ = ResourceFetcher::Create(context, context->GetTaskRunner().Get()); + fetcher_ = ResourceFetcher::Create(context); modulator_ = new ModuleScriptLoaderTestModulator( ToScriptStateForMainWorld(&GetFrame()), GetDocument().GetSecurityOrigin());
diff --git a/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp b/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp index 5fdbc90b..0347391 100644 --- a/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp +++ b/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp
@@ -45,8 +45,7 @@ MockFetchContext* context = MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); - ResourceFetcher* fetcher = - ResourceFetcher::Create(context, context->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(context); // Fetch to cache a resource. ResourceRequest request1(url); @@ -105,8 +104,7 @@ auto* context = MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); - ResourceFetcher* fetcher = - ResourceFetcher::Create(context, context->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(context); FetchParameters fetch_params{ResourceRequest(url)}; fetch_params.SetCacheAwareLoadingEnabled(kIsCacheAwareLoadingEnabled);
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp index 50f4449..36e4c77 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
@@ -340,9 +340,8 @@ } ResourceFetcher* CreateFetcher() { - auto* context = - MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); - return ResourceFetcher::Create(context, context->GetTaskRunner()); + return ResourceFetcher::Create( + MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource)); } using ScopedClientPlaceholderForServerLoFiForTest =
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp index 0f69ad25..a4b44e5 100644 --- a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp +++ b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp
@@ -7,6 +7,7 @@ #include "core/dom/Element.h" #include "core/frame/Settings.h" #include "core/frame/VisualViewport.h" +#include "core/layout/LayoutView.h" #include "core/loader/EmptyClients.h" #include "core/page/Page.h" #include "core/page/PagePopupClient.h" @@ -94,6 +95,11 @@ page_->GetVisualViewport().SetSize(view_size); } AdjustBubblePosition(view_size); + + // This manual invalidation is necessary to avoid a DCHECK failure in + // FindVisualRectNeedingUpdateScopeBase::CheckVisualRect(). + FrameView().GetLayoutView()->SetMayNeedPaintInvalidationSubtree(); + FrameView().UpdateAllLifecyclePhases(); } @@ -141,6 +147,8 @@ bubble_size_.Expand(1, 0); container.SetInlineStyleProperty(CSSPropertyMinWidth, bubble_size_.Width(), CSSPrimitiveValue::UnitType::kPixels); + container.setAttribute(HTMLNames::classAttr, "shown-initially"); + FrameView().UpdateAllLifecyclePhases(); } void ValidationMessageOverlayDelegate::WriteDocument(SharedBuffer* data) { @@ -208,12 +216,14 @@ CSSPrimitiveValue::UnitType::kPixels); container.SetInlineStyleProperty(CSSPropertyTop, bubble_y, CSSPrimitiveValue::UnitType::kPixels); - container.SetInlineStyleProperty(CSSPropertyOpacity, 1.0, - CSSPrimitiveValue::UnitType::kNumber); - if (show_bottom_arrow) - container.setAttribute(HTMLNames::classAttr, "bottom-arrow"); - else - container.removeAttribute(HTMLNames::classAttr); + if (show_bottom_arrow) { + container.setAttribute(HTMLNames::classAttr, "shown-fully bottom-arrow"); + container.SetInlineStyleProperty(CSSPropertyTransformOrigin, + "center bottom"); + } else { + container.setAttribute(HTMLNames::classAttr, "shown-fully"); + container.SetInlineStyleProperty(CSSPropertyTransformOrigin, "center top"); + } // Should match to --arrow-size in validation_bubble.css. const int kArrowSize = 8;
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp index 59c6422c..1300095 100644 --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
@@ -6,6 +6,7 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" +#include "core/dom/StyleChangeReason.h" #include "core/frame/LocalFrameView.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/layout/LayoutBox.h" @@ -84,6 +85,7 @@ } void RootScrollerController::DidUpdateLayout() { + DCHECK(document_->Lifecycle().GetState() == DocumentLifecycle::kLayoutClean); RecomputeEffectiveRootScroller(); } @@ -132,6 +134,14 @@ ApplyRootScrollerProperties(*old_effective_root_scroller); ApplyRootScrollerProperties(*effective_root_scroller_); + // Document (i.e. LayoutView) gets its background style from the rootScroller + // so we need to recalc its style. Ensure that we get back to a LayoutClean + // state after. + document_->SetNeedsStyleRecalc(kLocalStyleChange, + StyleChangeReasonForTracing::Create( + StyleChangeReason::kStyleInvalidator)); + document_->UpdateStyleAndLayout(); + if (Page* page = document_->GetPage()) page->GlobalRootScrollerController().DidChangeRootScroller(); } @@ -190,18 +200,15 @@ void RootScrollerController::UpdateIFrameGeometryAndLayoutSize( HTMLFrameOwnerElement& frame_owner) const { - LayoutEmbeddedContent* part = frame_owner.GetLayoutEmbeddedContent(); - if (!part) - return; + DCHECK(document_->GetFrame()); + DCHECK(document_->GetFrame()->View()); - part->UpdateGeometry(); + LocalFrameView* view = + ToLocalFrameView(frame_owner.OwnedEmbeddedContentView()); + view->UpdateGeometry(); - if (!document_->GetFrame() || !document_->GetFrame()->View()) - return; - - LocalFrameView* frame_view = document_->GetFrame()->View(); - if (part->ChildFrameView() && (&EffectiveRootScroller() == &frame_owner)) - part->ChildFrameView()->SetLayoutSize(frame_view->GetLayoutSize()); + if (&EffectiveRootScroller() == frame_owner) + view->SetLayoutSize(document_->GetFrame()->View()->GetLayoutSize()); } PaintLayer* RootScrollerController::RootScrollerPaintLayer() const {
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h index c7864cc3..2bfbc392 100644 --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h
@@ -66,7 +66,7 @@ // This class needs to be informed of changes in layout so that it can // determine if the current root scroller is still valid or if it must be - // replaced by the default root scroller. + // replaced by the default root scroller. Must be called from LayoutClean. void DidUpdateLayout(); // This class needs to be informed when the FrameView of its Document changes
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp index 869ab04..d6e5f41 100644 --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp
@@ -1164,6 +1164,49 @@ &MainFrameView()->GetRootFrameViewport()->LayoutViewport()); } +// Ensure that background style is propagated to the layout view. +TEST_P(RootScrollerTest, PropagateBackgroundToLayoutView) { + Initialize(); + + WebURL base_url = URLTestHelpers::ToKURL("http://www.test.com/"); + FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrameImpl(), + "<!DOCTYPE html>" + "<style>" + " body, html {" + " width: 100%;" + " height: 100%;" + " margin: 0px;" + " background-color: #ff0000;" + " }" + " #container {" + " width: 100%;" + " height: 100%;" + " overflow: auto;" + " background-color: #0000ff;" + " }" + "</style>" + "<div id='container'>" + " <div style='height:1000px'>test</div>" + "</div>", + base_url); + MainFrameView()->UpdateAllLifecyclePhases(); + + Document* document = MainFrame()->GetDocument(); + ASSERT_EQ(Color(255, 0, 0), + document->GetLayoutView()->Style()->VisitedDependentColor( + CSSPropertyBackgroundColor)); + + Element* container = MainFrame()->GetDocument()->getElementById("container"); + document->setRootScroller(container, ASSERT_NO_EXCEPTION); + + document->setRootScroller(container); + MainFrameView()->UpdateAllLifecyclePhases(); + + EXPECT_EQ(Color(0, 0, 255), + document->GetLayoutView()->Style()->VisitedDependentColor( + CSSPropertyBackgroundColor)); +} + class RootScrollerHitTest : public RootScrollerTest { public: void CheckHitTestAtBottomOfScreen() {
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp index 163f586..446e2eaa 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -469,11 +469,12 @@ if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) { // Fragment offsets have been computed in the clipping container's // layer's coordinate system, but for the rest of painting we need - // them in the layer coordinate. So move them and the foreground rect - // that is also in the clipper's space. + // them in the layer coordinate. So move them and the + // foreground/background rects that are also in the clipper's space. LayoutSize negative_offset(-offset_to_clipper.X(), -offset_to_clipper.Y()); for (auto& fragment : layer_fragments) { + fragment.background_rect.Move(negative_offset); fragment.foreground_rect.Move(negative_offset); fragment.pagination_offset.Move(negative_offset); }
diff --git a/third_party/WebKit/Source/core/plugins/PluginView.h b/third_party/WebKit/Source/core/plugins/PluginView.h index 6592e58..b82760744 100644 --- a/third_party/WebKit/Source/core/plugins/PluginView.h +++ b/third_party/WebKit/Source/core/plugins/PluginView.h
@@ -53,7 +53,6 @@ bool IsPluginView() const override { return true; } virtual void SetFocused(bool, WebFocusType) = 0; - virtual void GeometryMayHaveChanged() = 0; virtual void HandleEvent(Event*) = 0; virtual void EventListenersRemoved() = 0; virtual bool IsPluginContainer() const { return false; }
diff --git a/third_party/WebKit/Source/core/workers/BUILD.gn b/third_party/WebKit/Source/core/workers/BUILD.gn index d6157b7..cba5ec0 100644 --- a/third_party/WebKit/Source/core/workers/BUILD.gn +++ b/third_party/WebKit/Source/core/workers/BUILD.gn
@@ -81,6 +81,8 @@ "WorkletGlobalScope.cpp", "WorkletGlobalScope.h", "WorkletGlobalScopeProxy.h", + "WorkletModuleResponsesMap.cpp", + "WorkletModuleResponsesMap.h", "WorkletModuleTreeClient.cpp", "WorkletModuleTreeClient.h", "WorkletPendingTasks.cpp",
diff --git a/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.cpp b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.cpp new file mode 100644 index 0000000..09e2978 --- /dev/null +++ b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.cpp
@@ -0,0 +1,133 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/workers/WorkletModuleResponsesMap.h" + +#include "platform/wtf/Optional.h" + +namespace blink { + +class WorkletModuleResponsesMap::Entry + : public GarbageCollectedFinalized<Entry> { + public: + enum class State { kFetching, kFetched, kFailed }; + + State GetState() const { return state_; } + ModuleScriptCreationParams GetParams() const { return *params_; } + + void AddClient(Client* client) { + // Clients can be added only while a module script is being fetched. + DCHECK_EQ(State::kFetching, state_); + clients_.push_back(client); + } + + void NotifyUpdate(const ModuleScriptCreationParams& params) { + AdvanceState(State::kFetched); + params_.emplace(params); + for (Client* client : clients_) + client->OnRead(params); + clients_.clear(); + } + + void NotifyFailure() { + AdvanceState(State::kFailed); + for (Client* client : clients_) + client->OnFailed(); + clients_.clear(); + } + + DEFINE_INLINE_TRACE() { visitor->Trace(clients_); } + + private: + void AdvanceState(State new_state) { + switch (state_) { + case State::kFetching: + DCHECK(new_state == State::kFetched || new_state == State::kFailed); + break; + case State::kFetched: + case State::kFailed: + NOTREACHED(); + break; + } + state_ = new_state; + } + + State state_ = State::kFetching; + WTF::Optional<ModuleScriptCreationParams> params_; + HeapVector<Member<Client>> clients_; +}; + +// Implementation of the first half of the custom fetch defined in the +// "fetch a worklet script" algorithm: +// https://drafts.css-houdini.org/worklets/#fetch-a-worklet-script +// +// "To perform the fetch given request, perform the following steps:" +// Step 1: "Let cache be the moduleResponsesMap." +// Step 2: "Let url be request's url." +void WorkletModuleResponsesMap::ReadOrCreateEntry(const KURL& url, + Client* client) { + DCHECK(IsMainThread()); + + auto it = entries_.find(url); + if (it != entries_.end()) { + Entry* entry = it->value; + switch (entry->GetState()) { + case Entry::State::kFetching: + // Step 3: "If cache contains an entry with key url whose value is + // "fetching", wait until that entry's value changes, then proceed to + // the next step." + entry->AddClient(client); + return; + case Entry::State::kFetched: + // Step 4: "If cache contains an entry with key url, asynchronously + // complete this algorithm with that entry's value, and abort these + // steps." + client->OnRead(entry->GetParams()); + return; + case Entry::State::kFailed: + // Module fetching failed before. Abort following steps. + client->OnFailed(); + return; + } + } + + // Step 5: "Create an entry in cache with key url and value "fetching"." + entries_.insert(url, new Entry); + + // Step 6: "Fetch request." + // Running the callback with an empty params will make the fetcher to fallback + // to regular module loading and Write() will be called once the fetch is + // complete. + client->OnFetchNeeded(); +} + +// Implementation of the second half of the custom fetch defined in the +// "fetch a worklet script" algorithm: +// https://drafts.css-houdini.org/worklets/#fetch-a-worklet-script +void WorkletModuleResponsesMap::UpdateEntry( + const KURL& url, + const ModuleScriptCreationParams& params) { + DCHECK(IsMainThread()); + DCHECK(entries_.Contains(url)); + Entry* entry = entries_.find(url)->value; + + // Step 7: "Let response be the result of fetch when it asynchronously + // completes." + // Step 8: "Set the value of the entry in cache whose key is url to response, + // and asynchronously complete this algorithm with response." + entry->NotifyUpdate(params); +} + +void WorkletModuleResponsesMap::InvalidateEntry(const KURL& url) { + DCHECK(IsMainThread()); + DCHECK(entries_.Contains(url)); + Entry* entry = entries_.find(url)->value; + entry->NotifyFailure(); +} + +DEFINE_TRACE(WorkletModuleResponsesMap) { + visitor->Trace(entries_); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.h b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.h new file mode 100644 index 0000000..68815e5 --- /dev/null +++ b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.h
@@ -0,0 +1,65 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WorkletModuleResponsesMap_h +#define WorkletModuleResponsesMap_h + +#include "core/CoreExport.h" +#include "core/loader/modulescript/ModuleScriptCreationParams.h" +#include "platform/heap/Heap.h" +#include "platform/heap/HeapAllocator.h" +#include "platform/weborigin/KURL.h" +#include "platform/weborigin/KURLHash.h" + +namespace blink { + +// WorkletModuleResponsesMap implements the module responses map concept and the +// "fetch a worklet script" algorithm: +// https://drafts.css-houdini.org/worklets/#module-responses-map +// https://drafts.css-houdini.org/worklets/#fetch-a-worklet-script +class CORE_EXPORT WorkletModuleResponsesMap + : public GarbageCollectedFinalized<WorkletModuleResponsesMap> { + public: + // Used for notifying results of ReadOrCreateEntry(). See comments on the + // function for details. + class Client : public GarbageCollectedMixin { + public: + virtual ~Client() {} + virtual void OnRead(const ModuleScriptCreationParams&) = 0; + virtual void OnFetchNeeded() = 0; + virtual void OnFailed() = 0; + }; + + WorkletModuleResponsesMap() = default; + + // Reads an entry for a given URL, or creates a placeholder entry: + // 1) If an entry is already fetched, synchronously calls Client::OnRead(). + // 2) If an entry is now being fetched, pushes a given client into the entry's + // waiting queue and asynchronously calls Client::OnRead() on the + // completion of the fetch. + // 3) If an entry doesn't exist, creates a placeholder entry and synchronously + // calls Client::OnFetchNeeded. A caller is required to fetch a module + // script and update the entry via UpdateEntry(). + void ReadOrCreateEntry(const KURL&, Client*); + + // Updates an entry in 'fetching' state to 'fetched'. + void UpdateEntry(const KURL&, const ModuleScriptCreationParams&); + + // Marks an entry as "failed" state and calls OnFailed() for waiting clients. + void InvalidateEntry(const KURL&); + + DECLARE_TRACE(); + + private: + class Entry; + + // TODO(nhiroki): Keep the insertion order of top-level modules to replay + // addModule() calls for a newly created global scope. + // See https://drafts.css-houdini.org/worklets/#creating-a-workletglobalscope + HeapHashMap<KURL, Member<Entry>> entries_; +}; + +} // namespace blink + +#endif // WorkletModuleResponsesMap_h
diff --git a/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp new file mode 100644 index 0000000..0012a9cf --- /dev/null +++ b/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMapTest.cpp
@@ -0,0 +1,158 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/loader/modulescript/ModuleScriptCreationParams.h" +#include "core/workers/WorkletModuleResponsesMap.h" +#include "platform/weborigin/KURL.h" +#include "platform/wtf/Functional.h" +#include "platform/wtf/Optional.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +namespace { + +class ClientImpl final : public GarbageCollectedFinalized<ClientImpl>, + public WorkletModuleResponsesMap::Client { + USING_GARBAGE_COLLECTED_MIXIN(ClientImpl); + + public: + enum class Result { kInitial, kOK, kNeedsFetching, kFailed }; + + void OnRead(const ModuleScriptCreationParams& params) override { + ASSERT_EQ(Result::kInitial, result_); + result_ = Result::kOK; + params_.emplace(params); + } + + void OnFetchNeeded() override { + ASSERT_EQ(Result::kInitial, result_); + result_ = Result::kNeedsFetching; + } + + void OnFailed() override { + ASSERT_EQ(Result::kInitial, result_); + result_ = Result::kFailed; + } + + Result GetResult() const { return result_; } + WTF::Optional<ModuleScriptCreationParams> GetParams() const { + return params_; + } + + private: + Result result_ = Result::kInitial; + WTF::Optional<ModuleScriptCreationParams> params_; +}; + +} // namespace + +TEST(WorkletModuleResponsesMapTest, Basic) { + WorkletModuleResponsesMap* map = new WorkletModuleResponsesMap; + const KURL kUrl(kParsedURLString, "https://example.com/foo.js"); + + // An initial read call creates a placeholder entry and asks the client to + // fetch a module script. + ClientImpl* client1 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client1); + EXPECT_EQ(ClientImpl::Result::kNeedsFetching, client1->GetResult()); + EXPECT_FALSE(client1->GetParams().has_value()); + + // The entry is now being fetched. Following read calls should wait for the + // completion. + ClientImpl* client2 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client2); + EXPECT_EQ(ClientImpl::Result::kInitial, client2->GetResult()); + + ClientImpl* client3 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client3); + EXPECT_EQ(ClientImpl::Result::kInitial, client3->GetResult()); + + // An update call should notify the waiting clients. + ModuleScriptCreationParams params(kUrl, "// dummy script", + WebURLRequest::kFetchCredentialsModeOmit, + kNotSharableCrossOrigin); + map->UpdateEntry(kUrl, params); + EXPECT_EQ(ClientImpl::Result::kOK, client2->GetResult()); + EXPECT_TRUE(client2->GetParams().has_value()); + EXPECT_EQ(ClientImpl::Result::kOK, client3->GetResult()); + EXPECT_TRUE(client3->GetParams().has_value()); +} + +TEST(WorkletModuleResponsesMapTest, Failure) { + WorkletModuleResponsesMap* map = new WorkletModuleResponsesMap; + const KURL kUrl(kParsedURLString, "https://example.com/foo.js"); + + // An initial read call creates a placeholder entry and asks the client to + // fetch a module script. + ClientImpl* client1 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client1); + EXPECT_EQ(ClientImpl::Result::kNeedsFetching, client1->GetResult()); + EXPECT_FALSE(client1->GetParams().has_value()); + + // The entry is now being fetched. Following read calls should wait for the + // completion. + ClientImpl* client2 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client2); + EXPECT_EQ(ClientImpl::Result::kInitial, client2->GetResult()); + + ClientImpl* client3 = new ClientImpl; + map->ReadOrCreateEntry(kUrl, client3); + EXPECT_EQ(ClientImpl::Result::kInitial, client3->GetResult()); + + // An invalidation call should notify the waiting clients. + map->InvalidateEntry(kUrl); + EXPECT_EQ(ClientImpl::Result::kFailed, client2->GetResult()); + EXPECT_FALSE(client2->GetParams().has_value()); + EXPECT_EQ(ClientImpl::Result::kFailed, client3->GetResult()); + EXPECT_FALSE(client3->GetParams().has_value()); +} + +TEST(WorkletModuleResponsesMapTest, Isolation) { + WorkletModuleResponsesMap* map = new WorkletModuleResponsesMap; + const KURL kUrl1(kParsedURLString, "https://example.com/foo.js"); + const KURL kUrl2(kParsedURLString, "https://example.com/bar.js"); + + // An initial read call for |kUrl1| creates a placeholder entry and asks the + // client to fetch a module script. + ClientImpl* client1 = new ClientImpl; + map->ReadOrCreateEntry(kUrl1, client1); + EXPECT_EQ(ClientImpl::Result::kNeedsFetching, client1->GetResult()); + EXPECT_FALSE(client1->GetParams().has_value()); + + // The entry is now being fetched. Following read calls for |kUrl1| should + // wait for the completion. + ClientImpl* client2 = new ClientImpl; + map->ReadOrCreateEntry(kUrl1, client2); + EXPECT_EQ(ClientImpl::Result::kInitial, client2->GetResult()); + + // An initial read call for |kUrl2| also creates a placeholder entry and asks + // the client to fetch a module script. + ClientImpl* client3 = new ClientImpl; + map->ReadOrCreateEntry(kUrl2, client3); + EXPECT_EQ(ClientImpl::Result::kNeedsFetching, client3->GetResult()); + EXPECT_FALSE(client3->GetParams().has_value()); + + // The entry is now being fetched. Following read calls for |kUrl2| should + // wait for the completion. + ClientImpl* client4 = new ClientImpl; + map->ReadOrCreateEntry(kUrl2, client4); + EXPECT_EQ(ClientImpl::Result::kInitial, client4->GetResult()); + + // The read call for |kUrl2| should not affect the other entry for |kUrl1|. + EXPECT_EQ(ClientImpl::Result::kInitial, client2->GetResult()); + + // An update call for |kUrl2| should notify the waiting clients for |kUrl2|. + ModuleScriptCreationParams params(kUrl2, "// dummy script", + WebURLRequest::kFetchCredentialsModeOmit, + kNotSharableCrossOrigin); + map->UpdateEntry(kUrl2, params); + EXPECT_EQ(ClientImpl::Result::kOK, client4->GetResult()); + EXPECT_TRUE(client4->GetParams().has_value()); + + // ... but should not notify the waiting clients for |kUrl1|. + EXPECT_EQ(ClientImpl::Result::kInitial, client2->GetResult()); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index 267fb29..15d9905 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -376,9 +376,8 @@ void XMLDocumentParser::Detach() { if (pending_script_) { - pending_script_->RemoveClient(this); + pending_script_->StopWatchingForLoad(); pending_script_ = nullptr; - parser_blocking_pending_script_load_start_time_ = 0.0; } ClearCurrentNodeStack(); ScriptableDocumentParser::Detach(); @@ -433,21 +432,14 @@ xml_errors_.InsertErrorMessageBlock(); } -void XMLDocumentParser::NotifyFinished(Resource* unused_resource) { - DCHECK_EQ(unused_resource, pending_script_); - - pending_script_->CheckResourceIntegrity(*GetDocument()); - - ScriptSourceCode source_code(pending_script_.Get()); - bool error_occurred = pending_script_->ErrorOccurred(); - bool was_canceled = pending_script_->WasCanceled(); - double script_parser_blocking_time = - parser_blocking_pending_script_load_start_time_; - parser_blocking_pending_script_load_start_time_ = 0.0; - - pending_script_->RemoveClient(this); +void XMLDocumentParser::PendingScriptFinished( + PendingScript* unused_pending_script) { + DCHECK_EQ(unused_pending_script, pending_script_); + PendingScript* pending_script = pending_script_; pending_script_ = nullptr; + pending_script->StopWatchingForLoad(); + Element* e = script_element_; script_element_ = nullptr; @@ -456,27 +448,17 @@ DCHECK(script_loader); CHECK_EQ(script_loader->GetScriptType(), ScriptType::kClassic); - if (error_occurred) { - script_loader->DispatchErrorEvent(); - } else if (!was_canceled) { + if (!pending_script->ErrorOccurred()) { + const double script_parser_blocking_time = + pending_script->ParserBlockingLoadStartTime(); if (script_parser_blocking_time > 0.0) { DocumentParserTiming::From(*GetDocument()) .RecordParserBlockedOnScriptLoadDuration( MonotonicallyIncreasingTime() - script_parser_blocking_time, script_loader->WasCreatedDuringDocumentWrite()); } - - switch (script_loader->ExecuteScript(ClassicScript::Create(source_code))) { - case ScriptLoader::ExecuteScriptResult::kShouldFireErrorEvent: - script_loader->DispatchErrorEvent(); - break; - case ScriptLoader::ExecuteScriptResult::kShouldFireLoadEvent: - script_loader->DispatchLoadEvent(); - break; - case ScriptLoader::ExecuteScriptResult::kShouldFireNone: - break; - } } + script_loader->ExecuteScriptBlock(pending_script, NullURL()); script_element_ = nullptr; @@ -784,7 +766,6 @@ finish_called_(false), xml_errors_(&document), script_start_position_(TextPosition::BelowRangePosition()), - parser_blocking_pending_script_load_start_time_(0.0), parsing_fragment_(false) { // This is XML being used as a document resource. if (frame_view && document.IsXMLDocument()) @@ -859,7 +840,7 @@ visitor->Trace(pending_script_); visitor->Trace(script_element_); ScriptableDocumentParser::Trace(visitor); - ScriptResourceClient::Trace(visitor); + PendingScriptClient::Trace(visitor); } void XMLDocumentParser::DoWrite(const String& parse_string) { @@ -1143,14 +1124,11 @@ } else if (script_loader->WillBeParserExecuted()) { // 1st/2nd Clauses, Step 23 of // https://html.spec.whatwg.org/#prepare-a-script - pending_script_ = script_loader->GetResource(); - DCHECK_EQ(parser_blocking_pending_script_load_start_time_, 0.0); - parser_blocking_pending_script_load_start_time_ = - MonotonicallyIncreasingTime(); + pending_script_ = script_loader->CreatePendingScript(); + pending_script_->MarkParserBlockingLoadStartTime(); script_element_ = element; - pending_script_->AddClient(this); - // m_pendingScript will be 0 if script was already loaded and - // addClient() executed it. + pending_script_->WatchForLoad(this); + // pending_script_ will be null if script was already ready. if (pending_script_) PauseParsing(); } else {
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h index 42201338..e193103 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h
@@ -29,6 +29,7 @@ #include <libxml/tree.h> #include <memory> #include "core/dom/ParserContentPolicy.h" +#include "core/dom/PendingScript.h" #include "core/dom/ScriptableDocumentParser.h" #include "core/loader/resource/ScriptResource.h" #include "core/xml/parser/XMLErrors.h" @@ -67,7 +68,7 @@ }; class XMLDocumentParser final : public ScriptableDocumentParser, - public ScriptResourceClient { + public PendingScriptClient { USING_GARBAGE_COLLECTED_MIXIN(XMLDocumentParser); public: @@ -129,9 +130,8 @@ OrdinalNumber LineNumber() const override; OrdinalNumber ColumnNumber() const; - // from ResourceClient - void NotifyFinished(Resource*) override; - String DebugName() const override { return "XMLDocumentParser"; } + // from PendingScriptClient + void PendingScriptFinished(PendingScript*) override; void end(); @@ -208,10 +208,9 @@ XMLErrors xml_errors_; - Member<ScriptResource> pending_script_; + Member<PendingScript> pending_script_; Member<Element> script_element_; TextPosition script_start_position_; - double parser_blocking_pending_script_load_start_time_; bool parsing_fragment_; AtomicString default_namespace_uri_;
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js index f9d670c..c21cbd8 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js +++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
@@ -108,10 +108,22 @@ return Audits2.Audits2Panel.Presets.some(preset => preset.setting.get()); } + /** + * @return {?string} + */ + _unauditablePageMessage() { + var inspectedURL = SDK.targetManager.mainTarget().inspectedURL(); + if (/^about:/.test(inspectedURL)) + return Common.UIString('Cannot audit about:* pages. Navigate to a different page to start an audit.'); + + return null; + } + _updateStartButtonEnabled() { var hasActiveServiceWorker = this._hasActiveServiceWorker(); var hasAtLeastOneCategory = this._hasAtLeastOneCategory(); - var isDisabled = hasActiveServiceWorker || !hasAtLeastOneCategory; + var unauditablePageMessage = this._unauditablePageMessage(); + var isDisabled = hasActiveServiceWorker || !hasAtLeastOneCategory || !!unauditablePageMessage; if (this._dialogHelpText && hasActiveServiceWorker) { this._dialogHelpText.textContent = Common.UIString( @@ -122,6 +134,9 @@ if (this._dialogHelpText && !hasAtLeastOneCategory) this._dialogHelpText.textContent = Common.UIString('At least one category must be selected.'); + if (this._dialogHelpText && unauditablePageMessage) + this._dialogHelpText.textContent = unauditablePageMessage; + if (this._dialogHelpText) this._dialogHelpText.classList.toggle('hidden', !isDisabled);
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js index 04707a9..aa2011b 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -166,6 +166,9 @@ this._populate(); this._searchThrottler = new Common.Throttler(0); + + for (var existingProfile of this._profiles()) + existingProfile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); } /** @@ -607,33 +610,33 @@ _updateBaseOptions() { var list = this._profiles(); - // We're assuming that snapshots can only be added. - if (this._baseSelect.size() === list.length) - return; + var selectedIndex = this._baseSelect.selectedIndex(); - for (var i = this._baseSelect.size(), n = list.length; i < n; ++i) { - var title = list[i].title; - this._baseSelect.createOption(title); - } + this._baseSelect.removeOptions(); + for (var item of list) + this._baseSelect.createOption(item.title); + + if (selectedIndex > -1) + this._baseSelect.setSelectedIndex(selectedIndex); } _updateFilterOptions() { var list = this._profiles(); - // We're assuming that snapshots can only be added. - if (this._filterSelect.size() - 1 === list.length) - return; + var selectedIndex = this._filterSelect.selectedIndex(); - if (!this._filterSelect.size()) - this._filterSelect.createOption(Common.UIString('All objects')); - - for (var i = this._filterSelect.size() - 1, n = list.length; i < n; ++i) { - var title = list[i].title; + this._filterSelect.removeOptions(); + this._filterSelect.createOption(Common.UIString('All objects')); + for (var i = 0; i < list.length; ++i) { + var title; if (!i) - title = Common.UIString('Objects allocated before %s', title); + title = Common.UIString('Objects allocated before %s', list[i].title); else - title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title); + title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, list[i].title); this._filterSelect.createOption(title); } + + if (selectedIndex > -1) + this._filterSelect.setSelectedIndex(selectedIndex); } _updateControls() { @@ -647,6 +650,8 @@ */ _onReceiveSnapshot(event) { this._updateControls(); + var profile = event.data; + profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); } /** @@ -654,6 +659,8 @@ */ _onProfileHeaderRemoved(event) { var profile = event.data; + profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); + if (this._profile === profile) { this.detach(); this._profile.profileType().removeEventListener(
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js index 08f9dd0..ded0834 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js
@@ -19,6 +19,14 @@ } /** + * @param {string} title + */ + setTitle(title) { + this.title = title; + this.dispatchEventToListeners(Profiler.ProfileHeader.Events.ProfileTitleChanged, this); + } + + /** * @return {!Profiler.ProfileType} */ profileType() { @@ -108,5 +116,6 @@ /** @enum {symbol} */ Profiler.ProfileHeader.Events = { UpdateStatus: Symbol('UpdateStatus'), - ProfileReceived: Symbol('ProfileReceived') + ProfileReceived: Symbol('ProfileReceived'), + ProfileTitleChanged: Symbol('ProfileTitleChanged') };
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js index 29059af..d264ee90 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -641,6 +641,41 @@ this.listItemElement.classList.toggle('wait', statusUpdate.wait); } + /** + * @override + * @param {!Event} event + * @return {boolean} + */ + ondblclick(event) { + if (!this._editing) + this._startEditing(/** @type {!Element} */ (event.target)); + return false; + } + + /** + * @param {!Element} eventTarget + */ + _startEditing(eventTarget) { + var container = eventTarget.enclosingNodeOrSelfWithClass('title'); + if (!container) + return; + var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this)); + this._editing = UI.InplaceEditor.startEditing(container, config); + } + + /** + * @param {!Element} container + * @param {string} newTitle + */ + _editingCommitted(container, newTitle) { + delete this._editing; + this.profile.setTitle(newTitle); + } + + _editingCancelled() { + delete this._editing; + } + dispose() { this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceived, this._onProfileReceived, this);
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ScreenCaptureModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ScreenCaptureModel.js index 5ae1d13..d25afafea 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/ScreenCaptureModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/ScreenCaptureModel.js
@@ -46,7 +46,7 @@ * @return {!Promise<?string>} */ captureScreenshot(format, quality) { - return this._agent.captureScreenshot(format, quality, true); + return this._agent.captureScreenshot(format, quality, undefined, true); } /**
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncManager.idl b/third_party/WebKit/Source/modules/background_sync/SyncManager.idl index b4734ce6..d3eff06d 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncManager.idl +++ b/third_party/WebKit/Source/modules/background_sync/SyncManager.idl
@@ -5,7 +5,7 @@ // https://wicg.github.io/BackgroundSync/spec/#sync-manager-interface [ - Exposed=(Window,ServiceWorker), + Exposed=(Window,Worker), RuntimeEnabled=BackgroundSync ] interface SyncManager { [MeasureAs=BackgroundSyncRegister,CallWith=ScriptState,ImplementedAs=registerFunction] Promise<void> register(DOMString tag);
diff --git a/third_party/WebKit/Source/modules/crypto/CryptoKey.cpp b/third_party/WebKit/Source/modules/crypto/CryptoKey.cpp index 4e68917f..2a3b028 100644 --- a/third_party/WebKit/Source/modules/crypto/CryptoKey.cpp +++ b/third_party/WebKit/Source/modules/crypto/CryptoKey.cpp
@@ -34,6 +34,7 @@ #include "bindings/core/v8/V8ObjectBuilder.h" #include "bindings/core/v8/V8Uint8Array.h" #include "platform/CryptoResult.h" +#include "platform/bindings/ToV8.h" #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebCryptoKeyAlgorithm.h" #include "public/platform/WebString.h" @@ -153,14 +154,17 @@ // instead is return the same (immutable) array. (Javascript callers can // distinguish this by doing an == test on the arrays and seeing they are // different). -Vector<String> CryptoKey::usages() const { +ScriptValue CryptoKey::usages(ScriptState* script_state) { Vector<String> result; for (size_t i = 0; i < WTF_ARRAY_LENGTH(kKeyUsageMappings); ++i) { WebCryptoKeyUsage usage = kKeyUsageMappings[i].value; if (key_.Usages() & usage) result.push_back(KeyUsageToString(usage)); } - return result; + + return ScriptValue(script_state, + ToV8(result, script_state->GetContext()->Global(), + script_state->GetIsolate())); } bool CryptoKey::CanBeUsedForAlgorithm(const WebCryptoAlgorithm& algorithm,
diff --git a/third_party/WebKit/Source/modules/crypto/CryptoKey.h b/third_party/WebKit/Source/modules/crypto/CryptoKey.h index 93e40d3..6d6d3e7 100644 --- a/third_party/WebKit/Source/modules/crypto/CryptoKey.h +++ b/third_party/WebKit/Source/modules/crypto/CryptoKey.h
@@ -58,7 +58,7 @@ String type() const; bool extractable() const; ScriptValue algorithm(ScriptState*); - Vector<String> usages() const; + ScriptValue usages(ScriptState*); const WebCryptoKey& Key() const { return key_; }
diff --git a/third_party/WebKit/Source/modules/crypto/CryptoKey.idl b/third_party/WebKit/Source/modules/crypto/CryptoKey.idl index bce2c91..4063752 100644 --- a/third_party/WebKit/Source/modules/crypto/CryptoKey.idl +++ b/third_party/WebKit/Source/modules/crypto/CryptoKey.idl
@@ -36,6 +36,5 @@ readonly attribute DOMString type; readonly attribute boolean extractable; [CallWith=ScriptState] readonly attribute object algorithm; - // TODO(jyasskin): |usages| should be of type object. - readonly attribute DOMString[] usages; + [CallWith=ScriptState] readonly attribute object usages; };
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.cpp b/third_party/WebKit/Source/platform/SharedBuffer.cpp index a7cc14c..b9b9bda7 100644 --- a/third_party/WebKit/Source/platform/SharedBuffer.cpp +++ b/third_party/WebKit/Source/platform/SharedBuffer.cpp
@@ -262,4 +262,26 @@ } } +SharedBuffer::DeprecatedFlatData::DeprecatedFlatData( + PassRefPtr<const SharedBuffer> buffer) + : buffer_(std::move(buffer)) { + DCHECK(buffer_); + + if (buffer_->size() <= buffer_->buffer_.size()) { + // The SharedBuffer is not segmented - just point to its data. + data_ = buffer_->buffer_.data(); + return; + } + + // Merge all segments. + flat_buffer_.ReserveInitialCapacity(buffer_->size()); + buffer_->ForEachSegment([this](const char* segment, size_t segment_size, + size_t segment_offset) -> bool { + flat_buffer_.Append(segment, segment_size); + return true; + }); + + data_ = flat_buffer_.data(); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.h b/third_party/WebKit/Source/platform/SharedBuffer.h index f6b40b8..cca33df 100644 --- a/third_party/WebKit/Source/platform/SharedBuffer.h +++ b/third_party/WebKit/Source/platform/SharedBuffer.h
@@ -70,7 +70,7 @@ ~SharedBuffer(); - // DEPRECATED: use a segment iterator or Copy() instead. + // DEPRECATED: use a segment iterator, FlatData or Copy() instead. // // Calling this function will force internal segmented buffers to be merged // into a flat buffer. Use getSomeData() whenever possible for better @@ -151,6 +151,24 @@ } } + // Helper for providing a contiguous view of the data. If the SharedBuffer is + // segmented, this will copy/merge all segments into a temporary buffer. + // In general, clients should use the efficient/segmented accessors. + class PLATFORM_EXPORT DeprecatedFlatData { + STACK_ALLOCATED(); + + public: + explicit DeprecatedFlatData(PassRefPtr<const SharedBuffer>); + + const char* Data() const { return data_; } + size_t size() const { return buffer_->size(); } + + private: + RefPtr<const SharedBuffer> buffer_; + Vector<char> flat_buffer_; + const char* data_; + }; + private: SharedBuffer(); explicit SharedBuffer(size_t);
diff --git a/third_party/WebKit/Source/platform/SharedBufferTest.cpp b/third_party/WebKit/Source/platform/SharedBufferTest.cpp index 8fb9b0e4..7db3b08ca 100644 --- a/third_party/WebKit/Source/platform/SharedBufferTest.cpp +++ b/third_party/WebKit/Source/platform/SharedBufferTest.cpp
@@ -153,4 +153,32 @@ ASSERT_EQ(length, shared_buffer->GetSomeData(data, static_cast<size_t>(0u))); } +TEST(SharedBufferTest, FlatData) { + auto check_flat_data = [](RefPtr<const SharedBuffer> shared_buffer) { + const SharedBuffer::DeprecatedFlatData flat_buffer(shared_buffer); + + EXPECT_EQ(shared_buffer->size(), flat_buffer.size()); + shared_buffer->ForEachSegment([&flat_buffer]( + const char* segment, size_t segment_size, + size_t segment_offset) -> bool { + EXPECT_EQ( + memcmp(segment, flat_buffer.Data() + segment_offset, segment_size), + 0); + + // If the SharedBuffer is not segmented, FlatData doesn't copy any data. + EXPECT_EQ(segment_size == flat_buffer.size(), + segment == flat_buffer.Data()); + return true; + }); + }; + + RefPtr<SharedBuffer> shared_buffer = SharedBuffer::Create(); + + // Add enough data to hit a couple of segments. + while (shared_buffer->size() < 10000) { + check_flat_data(shared_buffer); + shared_buffer->Append("FooBarBaz", 9u); + } +} + } // namespace blink
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 6d50da8..4fc596d 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -539,7 +539,7 @@ TEST_F(TimerTest, UserSuppliedWebTaskRunner) { scoped_refptr<scheduler::TaskQueue> task_runner( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner = scheduler::WebTaskRunnerImpl::Create(task_runner); TimerForTest<TimerTest> timer(web_task_runner, this, @@ -627,7 +627,7 @@ scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner1 = scheduler::WebTaskRunnerImpl::Create(task_runner1); TaskObserver task_observer1(web_task_runner1, &run_order); @@ -635,7 +635,7 @@ scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner2 = scheduler::WebTaskRunnerImpl::Create(task_runner2); TaskObserver task_observer2(web_task_runner2, &run_order); @@ -667,7 +667,7 @@ scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner1 = scheduler::WebTaskRunnerImpl::Create(task_runner1); TaskObserver task_observer1(web_task_runner1, &run_order); @@ -675,7 +675,7 @@ scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner2 = scheduler::WebTaskRunnerImpl::Create(task_runner2); TaskObserver task_observer2(web_task_runner2, &run_order); @@ -709,13 +709,13 @@ TEST_F(TimerTest, MoveToNewTaskRunnerWithoutTasks) { scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner1 = scheduler::WebTaskRunnerImpl::Create(task_runner1); scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetRendererScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::TEST)); + scheduler::MainThreadTaskQueue::QueueType::FRAME_TIMER)); RefPtr<scheduler::WebTaskRunnerImpl> web_task_runner2 = scheduler::WebTaskRunnerImpl::Create(task_runner2);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp index 9ab70802..1ebfad4 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
@@ -284,9 +284,6 @@ x += runs_[i]->width_; } - if (Rtl()) - x -= Width(); - // The position in question might be just after the text. if (!offset_x && absolute_offset == NumCharacters()) return Rtl() ? 0 : width_;
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index b2343ea..38e63d1 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -28,7 +28,7 @@ #include <memory> #include "base/memory/ptr_util.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" #include "platform/Histogram.h" @@ -240,7 +240,7 @@ #if USE_IOSURFACE_FOR_2D_CANVAS bool Canvas2DLayerBridge::PrepareIOSurfaceMailboxFromImage( SkImage* image, - cc::TextureMailbox* out_mailbox) { + viz::TextureMailbox* out_mailbox) { // Need to flush skia's internal queue, because the texture is about to be // accessed directly. GrContext* gr_context = context_provider_->GetGrContext(); @@ -279,8 +279,8 @@ info.mailbox_ = mailbox; *out_mailbox = - cc::TextureMailbox(mailbox, sync_token, texture_target, gfx::Size(size_), - is_overlay_candidate, secure_output_only); + viz::TextureMailbox(mailbox, sync_token, texture_target, gfx::Size(size_), + is_overlay_candidate, secure_output_only); if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled()) { gfx::ColorSpace color_space = color_params_.GetGfxColorSpace(); out_mailbox->set_color_space(color_space); @@ -372,7 +372,7 @@ bool Canvas2DLayerBridge::PrepareMailboxFromImage( sk_sp<SkImage> image, - cc::TextureMailbox* out_mailbox) { + viz::TextureMailbox* out_mailbox) { CreateMailboxInfo(); MailboxInfo& mailbox_info = mailboxes_.front(); @@ -436,7 +436,7 @@ gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); } mailbox_info.mailbox_ = mailbox; - *out_mailbox = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); + *out_mailbox = viz::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); gl->BindTexture(GL_TEXTURE_2D, 0); // Because we are changing the texture binding without going through skia, @@ -896,7 +896,7 @@ } bool Canvas2DLayerBridge::PrepareTextureMailbox( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { if (destruction_in_progress_) { // It can be hit in the following sequence.
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h index d312ceda..369adff8 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
@@ -28,7 +28,7 @@ #include "build/build_config.h" #include "cc/layers/texture_layer_client.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "platform/PlatformExport.h" #include "platform/geometry/IntSize.h" #include "platform/graphics/ImageBufferSurface.h" @@ -99,7 +99,7 @@ ~Canvas2DLayerBridge() override; // cc::TextureLayerClient implementation. - bool PrepareTextureMailbox(cc::TextureMailbox* out_mailbox, + bool PrepareTextureMailbox(viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) override; @@ -216,7 +216,7 @@ // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the // mailbox was successfully prepared. |mailbox| is an out parameter only // populated on success. - bool PrepareIOSurfaceMailboxFromImage(SkImage*, cc::TextureMailbox*); + bool PrepareIOSurfaceMailboxFromImage(SkImage*, viz::TextureMailbox*); // Creates an IOSurface-backed texture. Returns an ImageInfo, which is empty // on failure. The caller takes ownership of both the texture and the image. @@ -234,7 +234,7 @@ // Returns whether the mailbox was successfully prepared from the SkImage. // The mailbox is an out parameter only populated on success. - bool PrepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*); + bool PrepareMailboxFromImage(sk_sp<SkImage>, viz::TextureMailbox*); // Resets Skia's texture bindings. This method should be called after // changing texture bindings.
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 161a5e2..7f381e2d 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -26,8 +26,8 @@ #include "platform/graphics/Canvas2DLayerBridge.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" #include "cc/test/test_gpu_memory_buffer_manager.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/capabilities.h" #include "platform/CrossThreadFunctional.h" @@ -244,7 +244,7 @@ // GL frames for the compositor or not, so fail to generate frames. gl.SetIsContextLost(true); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; EXPECT_FALSE( bridge->PrepareTextureMailbox(&texture_mailbox, &release_callback)); @@ -272,7 +272,7 @@ // restore while the GPU process is down. bridge->RestoreSurface(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; EXPECT_FALSE( bridge->PrepareTextureMailbox(&texture_mailbox, &release_callback)); @@ -290,7 +290,7 @@ Canvas2DLayerBridge::kForceAccelerationForTesting, CanvasColorParams()))); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; EXPECT_TRUE( bridge->PrepareTextureMailbox(&texture_mailbox, &release_callback)); @@ -305,7 +305,7 @@ std::unique_ptr<FakeWebGraphicsContext3DProvider> context_provider = WTF::WrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; { @@ -1224,7 +1224,7 @@ ::testing::Mock::VerifyAndClearExpectations(mock_logger_ptr); // Test prepareMailbox while hibernating - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; EXPECT_FALSE( bridge->PrepareTextureMailbox(&texture_mailbox, &release_callback)); @@ -1284,7 +1284,7 @@ EXPECT_TRUE(bridge->CheckSurfaceValid()); // Test prepareMailbox while background rendering - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; EXPECT_FALSE( bridge->PrepareTextureMailbox(&texture_mailbox, &release_callback)); @@ -1306,7 +1306,7 @@ std::unique_ptr<FakeWebGraphicsContext3DProvider> context_provider = WTF::WrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; {
diff --git a/third_party/WebKit/Source/platform/graphics/DEPS b/third_party/WebKit/Source/platform/graphics/DEPS index 767e09e6..cc6619c8 100644 --- a/third_party/WebKit/Source/platform/graphics/DEPS +++ b/third_party/WebKit/Source/platform/graphics/DEPS
@@ -8,7 +8,7 @@ "+base/threading/thread_checker.h", "+cc", "-cc/blink", - "+components/viz/common/quads", + "+components/viz/common", "+gpu/command_buffer/client/gles2_interface.h", "+gpu/command_buffer/client/gpu_memory_buffer_manager.h", "+gpu/command_buffer/common/capabilities.h",
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index e6f773c..e3ed1b5 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -41,7 +41,7 @@ int width, int height) : OffscreenCanvasFrameDispatcher(client), - frame_sink_id_(cc::FrameSinkId(client_id, sink_id)), + frame_sink_id_(viz::FrameSinkId(client_id, sink_id)), width_(width), height_(height), change_size_for_next_commit_(false),
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h index cf013338..a772b05 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
@@ -8,9 +8,9 @@ #include <memory> #include "cc/ipc/compositor_frame_sink.mojom-blink.h" #include "cc/output/begin_frame_args.h" -#include "cc/surfaces/local_surface_id_allocator.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/common/quads/shared_bitmap.h" +#include "components/viz/common/surface_id.h" #include "mojo/public/cpp/bindings/binding.h" #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" #include "platform/graphics/StaticBitmapImage.h" @@ -60,9 +60,9 @@ private: // Surface-related - cc::LocalSurfaceIdAllocator local_surface_id_allocator_; - const cc::FrameSinkId frame_sink_id_; - cc::LocalSurfaceId current_local_surface_id_; + viz::LocalSurfaceIdAllocator local_surface_id_allocator_; + const viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId current_local_surface_id_; int width_; int height_;
diff --git a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp index f5c7cc1..e4dcb3dd 100644 --- a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp
@@ -8,9 +8,9 @@ #include "cc/layers/solid_color_layer.h" #include "cc/layers/surface_layer.h" #include "cc/surfaces/sequence_surface_reference_factory.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_info.h" #include "cc/surfaces/surface_sequence.h" +#include "components/viz/common/surface_id.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/mojo/MojoHelper.h" #include "platform/wtf/Functional.h" @@ -35,7 +35,7 @@ ~SequenceSurfaceReferenceFactoryImpl() override = default; // cc::SequenceSurfaceReferenceFactory implementation: - void RequireSequence(const cc::SurfaceId& id, + void RequireSequence(const viz::SurfaceId& id, const cc::SurfaceSequence& sequence) const override { DCHECK(bridge_); bridge_->RequireCallback(id, sequence); @@ -60,7 +60,7 @@ binding_(this), frame_sink_id_(Platform::Current()->GenerateFrameSinkId()), parent_frame_sink_id_(layer_tree_view ? layer_tree_view->GetFrameSinkId() - : cc::FrameSinkId()) { + : viz::FrameSinkId()) { ref_factory_ = new SequenceSurfaceReferenceFactoryImpl(weak_factory_.GetWeakPtr()); @@ -89,7 +89,7 @@ service_->Satisfy(sequence); } -void SurfaceLayerBridge::RequireCallback(const cc::SurfaceId& surface_id, +void SurfaceLayerBridge::RequireCallback(const viz::SurfaceId& surface_id, const cc::SurfaceSequence& sequence) { service_->Require(surface_id, sequence); }
diff --git a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h index 1eb2e3a..50f432ae 100644 --- a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h
@@ -8,8 +8,8 @@ #include <memory> #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference_factory.h" +#include "components/viz/common/surface_id.h" #include "mojo/public/cpp/bindings/binding.h" #include "platform/PlatformExport.h" #include "public/platform/WebSurfaceLayerBridge.h" @@ -46,12 +46,12 @@ // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient void OnSurfaceCreated(const cc::SurfaceInfo&) override; void SatisfyCallback(const cc::SurfaceSequence&); - void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); + void RequireCallback(const viz::SurfaceId&, const cc::SurfaceSequence&); // Implementation of WebSurfaceLayerBridge. WebLayer* GetWebLayer() const override { return web_layer_.get(); } - const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } + const viz::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } private: mojom::blink::OffscreenCanvasSurfacePtr service_; @@ -66,9 +66,9 @@ mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; - const cc::FrameSinkId frame_sink_id_; - cc::SurfaceId current_surface_id_; - const cc::FrameSinkId parent_frame_sink_id_; + const viz::FrameSinkId frame_sink_id_; + viz::SurfaceId current_surface_id_; + const viz::FrameSinkId parent_frame_sink_id_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 2a0d33c..9a6209f 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -251,7 +251,7 @@ } bool DrawingBuffer::PrepareTextureMailbox( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { ScopedStateRestorer scoped_state_restorer(this); bool force_gpu_result = false; @@ -260,7 +260,7 @@ } bool DrawingBuffer::PrepareTextureMailboxInternal( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback, bool force_gpu_result) { DCHECK(state_restorer_); @@ -296,7 +296,7 @@ } bool DrawingBuffer::FinishPrepareTextureMailboxSoftware( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { DCHECK(state_restorer_); std::unique_ptr<viz::SharedBitmap> bitmap = CreateOrRecycleBitmap(); @@ -317,7 +317,7 @@ op); } - *out_mailbox = cc::TextureMailbox(bitmap.get(), size_); + *out_mailbox = viz::TextureMailbox(bitmap.get(), size_); out_mailbox->set_color_space(color_space_); // This holds a ref on the DrawingBuffer that will keep it alive until the @@ -337,7 +337,7 @@ } bool DrawingBuffer::FinishPrepareTextureMailboxGpu( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { DCHECK(state_restorer_); if (web_gl_version_ > kWebGL1) { @@ -395,7 +395,7 @@ { bool is_overlay_candidate = color_buffer_for_mailbox->image_id != 0; bool secure_output_only = false; - *out_mailbox = cc::TextureMailbox( + *out_mailbox = viz::TextureMailbox( color_buffer_for_mailbox->mailbox, color_buffer_for_mailbox->produce_sync_token, color_buffer_for_mailbox->parameters.target, gfx::Size(size_), @@ -468,7 +468,7 @@ // grContext(). GrContext* gr_context = ContextProvider()->GetGrContext(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; bool success = false; if (gr_context) {
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index 3644969..f3ea0097 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -193,7 +193,7 @@ WebGraphicsContext3DProvider* ContextProvider(); // cc::TextureLayerClient implementation. - bool PrepareTextureMailbox(cc::TextureMailbox* out_mailbox, + bool PrepareTextureMailbox(viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) override; @@ -364,16 +364,16 @@ void ResolveIfNeeded(); bool PrepareTextureMailboxInternal( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback, bool force_gpu_result); // Helper functions to be called only by prepareTextureMailboxInternal. bool FinishPrepareTextureMailboxGpu( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback); bool FinishPrepareTextureMailboxSoftware( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback); // Callbacks for mailboxes given to the compositor from
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferSoftwareRenderingTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferSoftwareRenderingTest.cpp index ade6f6f..c1332ac 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferSoftwareRenderingTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferSoftwareRenderingTest.cpp
@@ -5,7 +5,7 @@ #include "platform/graphics/gpu/DrawingBuffer.h" #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_interface_stub.h" #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" @@ -66,7 +66,7 @@ }; TEST_F(DrawingBufferSoftwareRenderingTest, BitmapRecycling) { - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback1; std::unique_ptr<cc::SingleReleaseCallback> release_callback2; std::unique_ptr<cc::SingleReleaseCallback> release_callback3; @@ -105,7 +105,7 @@ TEST_F(DrawingBufferSoftwareRenderingTest, FramebufferBinding) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; IntSize initial_size(kInitialWidth, kInitialHeight); GLint drawBinding = 0, readBinding = 0;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index db0a033..8bb7fab 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -32,8 +32,8 @@ #include <memory> #include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" #include "cc/test/test_gpu_memory_buffer_manager.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_interface_stub.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/sync_token.h" @@ -158,7 +158,7 @@ TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); VerifyStateWasRestored(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; IntSize initial_size(kInitialWidth, kInitialHeight); @@ -213,11 +213,11 @@ bool live = true; drawing_buffer_->live_ = &live; - cc::TextureMailbox texture_mailbox1; + viz::TextureMailbox texture_mailbox1; std::unique_ptr<cc::SingleReleaseCallback> release_callback1; - cc::TextureMailbox texture_mailbox2; + viz::TextureMailbox texture_mailbox2; std::unique_ptr<cc::SingleReleaseCallback> release_callback2; - cc::TextureMailbox texture_mailbox3; + viz::TextureMailbox texture_mailbox3; std::unique_ptr<cc::SingleReleaseCallback> release_callback3; IntSize initial_size(kInitialWidth, kInitialHeight); @@ -262,11 +262,11 @@ bool live = true; drawing_buffer_->live_ = &live; - cc::TextureMailbox texture_mailbox1; + viz::TextureMailbox texture_mailbox1; std::unique_ptr<cc::SingleReleaseCallback> release_callback1; - cc::TextureMailbox texture_mailbox2; + viz::TextureMailbox texture_mailbox2; std::unique_ptr<cc::SingleReleaseCallback> release_callback2; - cc::TextureMailbox texture_mailbox3; + viz::TextureMailbox texture_mailbox3; std::unique_ptr<cc::SingleReleaseCallback> release_callback3; EXPECT_FALSE(drawing_buffer_->MarkContentsChanged()); @@ -303,11 +303,11 @@ } TEST_F(DrawingBufferTest, verifyOnlyOneRecycledMailboxMustBeKept) { - cc::TextureMailbox texture_mailbox1; + viz::TextureMailbox texture_mailbox1; std::unique_ptr<cc::SingleReleaseCallback> release_callback1; - cc::TextureMailbox texture_mailbox2; + viz::TextureMailbox texture_mailbox2; std::unique_ptr<cc::SingleReleaseCallback> release_callback2; - cc::TextureMailbox texture_mailbox3; + viz::TextureMailbox texture_mailbox3; std::unique_ptr<cc::SingleReleaseCallback> release_callback3; // Produce mailboxes. @@ -331,7 +331,7 @@ // The first recycled mailbox must be 2. 1 and 3 were deleted by FIFO order // because DrawingBuffer never keeps more than one mailbox. - cc::TextureMailbox recycled_texture_mailbox1; + viz::TextureMailbox recycled_texture_mailbox1; std::unique_ptr<cc::SingleReleaseCallback> recycled_release_callback1; EXPECT_FALSE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTextureMailbox( @@ -339,7 +339,7 @@ EXPECT_EQ(texture_mailbox2.mailbox(), recycled_texture_mailbox1.mailbox()); // The second recycled mailbox must be a new mailbox. - cc::TextureMailbox recycled_texture_mailbox2; + viz::TextureMailbox recycled_texture_mailbox2; std::unique_ptr<cc::SingleReleaseCallback> recycled_release_callback2; EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTextureMailbox( @@ -355,7 +355,7 @@ TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncTokenCorrectly) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; // Produce mailboxes. @@ -424,7 +424,7 @@ TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; IntSize initial_size(kInitialWidth, kInitialHeight); @@ -506,11 +506,11 @@ TEST_F(DrawingBufferImageChromiumTest, allocationFailure) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); - cc::TextureMailbox texture_mailbox1; + viz::TextureMailbox texture_mailbox1; std::unique_ptr<cc::SingleReleaseCallback> release_callback1; - cc::TextureMailbox texture_mailbox2; + viz::TextureMailbox texture_mailbox2; std::unique_ptr<cc::SingleReleaseCallback> release_callback2; - cc::TextureMailbox texture_mailbox3; + viz::TextureMailbox texture_mailbox3; std::unique_ptr<cc::SingleReleaseCallback> release_callback3; // Request a mailbox. An image should already be created. Everything works @@ -705,7 +705,7 @@ TEST_F(DrawingBufferTest, verifySetIsHiddenProperlyAffectsMailboxes) { GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); - cc::TextureMailbox texture_mailbox; + viz::TextureMailbox texture_mailbox; std::unique_ptr<cc::SingleReleaseCallback> release_callback; // Produce mailboxes.
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp index 4a84e0a..0e5f38c0 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp
@@ -4,8 +4,8 @@ #include "platform/graphics/gpu/ImageLayerBridge.h" -#include "cc/resources/texture_mailbox.h" #include "components/viz/common/quads/shared_bitmap.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "platform/graphics/ColorBehavior.h" #include "platform/graphics/GraphicsLayer.h" @@ -65,7 +65,7 @@ } bool ImageLayerBridge::PrepareTextureMailbox( - cc::TextureMailbox* out_mailbox, + viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { if (disposed_) return false; @@ -80,8 +80,8 @@ if (image_->IsTextureBacked()) { image_->EnsureMailbox(); - *out_mailbox = cc::TextureMailbox(image_->GetMailbox(), - image_->GetSyncToken(), GL_TEXTURE_2D); + *out_mailbox = viz::TextureMailbox(image_->GetMailbox(), + image_->GetSyncToken(), GL_TEXTURE_2D); auto func = WTF::Bind(&ImageLayerBridge::MailboxReleasedGpu, WrapWeakPersistent(this), image_); *out_release_callback = cc::SingleReleaseCallback::Create( @@ -107,7 +107,7 @@ return false; } - *out_mailbox = cc::TextureMailbox( + *out_mailbox = viz::TextureMailbox( bitmap.get(), gfx::Size(image_->width(), image_->height())); auto func = WTF::Bind(&ImageLayerBridge::MailboxReleasedSoftware, WrapWeakPersistent(this), base::Passed(&bitmap),
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.h b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.h index 31f9d435..6f2c3e6 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.h
@@ -32,7 +32,7 @@ void Dispose(); // cc::TextureLayerClient implementation. - bool PrepareTextureMailbox(cc::TextureMailbox* out_mailbox, + bool PrepareTextureMailbox(viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) override;
diff --git a/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.cpp b/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.cpp index ec9a960..4243f8c 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.cpp
@@ -64,7 +64,8 @@ ClearIfNeeded(); } -void BufferingDataPipeWriter::OnWritable(MojoResult) { +void BufferingDataPipeWriter::OnWritable(MojoResult, + const mojo::HandleSignalsState&) { if (!handle_.is_valid()) return; waiting_ = false;
diff --git a/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.h b/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.h index baf6792..ee0fbd0 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.h +++ b/third_party/WebKit/Source/platform/loader/fetch/BufferingDataPipeWriter.h
@@ -28,7 +28,7 @@ void Finish(); private: - void OnWritable(MojoResult); + void OnWritable(MojoResult, const mojo::HandleSignalsState&); void ClearIfNeeded(); void Clear();
diff --git a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp index 1dfab66..36ed404 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
@@ -103,9 +103,8 @@ // Save the global memory cache to restore it upon teardown. global_memory_cache_ = ReplaceMemoryCacheForTesting(MemoryCache::Create()); - auto* context = - MockFetchContext::Create(MockFetchContext::kShouldNotLoadNewResource); - fetcher_ = ResourceFetcher::Create(context, context->GetTaskRunner().Get()); + fetcher_ = ResourceFetcher::Create( + MockFetchContext::Create(MockFetchContext::kShouldNotLoadNewResource)); } void TearDown() override { GetMemoryCache()->EvictResources();
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h index 3b94db8..910daab4 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
@@ -67,8 +67,11 @@ public: static ResourceFetcher* Create(FetchContext* context, - RefPtr<WebTaskRunner> task_runner) { - return new ResourceFetcher(context, std::move(task_runner)); + RefPtr<WebTaskRunner> task_runner = nullptr) { + return new ResourceFetcher( + context, task_runner + ? std::move(task_runner) + : context->GetFrameScheduler()->LoadingTaskRunner()); } virtual ~ResourceFetcher(); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp index adaf7bc..8adb2dd 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
@@ -127,8 +127,7 @@ } TEST_F(ResourceFetcherTest, UseExistingResource) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.html"); ResourceResponse response; @@ -161,8 +160,7 @@ resource->Finish(); ASSERT_TRUE(resource->MustReloadDueToVaryHeader(ResourceRequest(url))); - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest resource_request(url); resource_request.SetRequestContext(WebURLRequest::kRequestContextInternal); FetchParameters fetch_params(resource_request); @@ -179,8 +177,7 @@ response.SetURL(url); response.SetHTTPStatusCode(200); - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest resource_request(url); resource_request.SetFrameType(WebURLRequest::kFrameTypeNested); resource_request.SetRequestContext(WebURLRequest::kRequestContextForm); @@ -213,8 +210,7 @@ } TEST_F(ResourceFetcherTest, VaryOnBack) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.html"); Resource* resource = RawResource::CreateForTest(url, Resource::kRaw); @@ -237,8 +233,7 @@ } TEST_F(ResourceFetcherTest, VaryResource) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.html"); ResourceResponse response; @@ -272,8 +267,7 @@ EXPECT_EQ(resource_, resource); MockFetchContext* context = MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); - ResourceFetcher* fetcher2 = - ResourceFetcher::Create(context, context->GetTaskRunner()); + ResourceFetcher* fetcher2 = ResourceFetcher::Create(context); ResourceRequest resource_request2(resource_->Url()); resource_request2.SetCachePolicy(WebCachePolicy::kValidatingCacheData); FetchParameters fetch_params2(resource_request2); @@ -303,8 +297,7 @@ response.SetHTTPHeaderField(HTTPNames::Cache_Control, "max-age=3600"); response.SetHTTPHeaderField(HTTPNames::ETag, "1234567890"); RegisterMockedURLLoadWithCustomResponse(url, response); - ResourceFetcher* fetcher1 = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher1 = ResourceFetcher::Create(Context()); ResourceRequest request1(url); request1.SetHTTPHeaderField(HTTPNames::Cache_Control, "no-cache"); FetchParameters fetch_params1(request1); @@ -318,8 +311,7 @@ } TEST_F(ResourceFetcherTest, DontReuseMediaDataUrl) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest request(KURL(kParsedURLString, "data:text/html,foo")); request.SetRequestContext(WebURLRequest::kRequestContextVideo); request.SetFetchCredentialsMode(WebURLRequest::kFetchCredentialsModeOmit); @@ -383,8 +375,7 @@ KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest resource_request(url); resource_request.SetRequestContext(WebURLRequest::kRequestContextInternal); FetchParameters fetch_params(resource_request); @@ -421,8 +412,7 @@ } void Request(const WebString& url) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(context_, context_->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(context_); ResourceRequest resource_request(url); resource_request.SetRequestContext(WebURLRequest::kRequestContextInternal); FetchParameters fetch_params(resource_request); @@ -476,8 +466,7 @@ KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest resource_request(url); resource_request.SetRequestContext(WebURLRequest::kRequestContextInternal); FetchParameters fetch_params(resource_request); @@ -489,8 +478,7 @@ } TEST_F(ResourceFetcherTest, PreloadResourceTwice) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -516,8 +504,7 @@ } TEST_F(ResourceFetcherTest, LinkPreloadResourceAndUse) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -551,8 +538,7 @@ } TEST_F(ResourceFetcherTest, PreloadMatchWithBypassingCache) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -572,10 +558,8 @@ } TEST_F(ResourceFetcherTest, CrossFramePreloadMatchIsNotAllowed) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); - ResourceFetcher* fetcher2 = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); + ResourceFetcher* fetcher2 = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -598,8 +582,7 @@ } TEST_F(ResourceFetcherTest, RepetitiveLinkPreloadShouldBeMerged) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -628,8 +611,7 @@ } TEST_F(ResourceFetcherTest, RepetitiveSpeculativePreloadShouldBeMerged) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -659,8 +641,7 @@ } TEST_F(ResourceFetcherTest, SpeculativePreloadShouldBePromotedToLinkePreload) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -708,8 +689,7 @@ resource->ResponseReceived(response, nullptr); resource->Finish(); - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); ResourceRequest resource_request(url); resource_request.SetRequestContext(WebURLRequest::kRequestContextInternal); FetchParameters fetch_params(resource_request); @@ -722,10 +702,8 @@ } TEST_F(ResourceFetcherTest, LinkPreloadResourceMultipleFetchersAndMove) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); - ResourceFetcher* fetcher2 = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); + ResourceFetcher* fetcher2 = ResourceFetcher::Create(Context()); KURL url(kParsedURLString, "http://127.0.0.1:8000/foo.png"); RegisterMockedURLLoad(url); @@ -748,8 +726,7 @@ } TEST_F(ResourceFetcherTest, ContentTypeDataURL) { - ResourceFetcher* fetcher = - ResourceFetcher::Create(Context(), Context()->GetTaskRunner()); + ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); FetchParameters fetch_params{ResourceRequest("data:text/testmimetype,foo")}; Resource* resource = MockResource::Fetch(fetch_params, fetcher); ASSERT_TRUE(resource);
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp index 1482ccd..2933b3cd 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp
@@ -130,7 +130,6 @@ void ResourceLoadScheduler::SetOutstandingLimitForTesting(size_t limit) { SetOutstandingLimitAndMaybeRun(limit); - is_enabled_ = limit != 0u; } void ResourceLoadScheduler::OnThrottlingStateChanged(
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.h index 133aff0..841c18d 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.h +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.h
@@ -31,6 +31,8 @@ // ResourceLoadSchedulerClient instances and calls Run() on them to dispatch // them possibly with additional throttling/scheduling. This also keeps track of // in-flight requests that are granted but are not released (by Release()) yet. +// Note: If FetchContext can not provide a WebFrameScheduler, throttling and +// scheduling functionalities will be completely disabled. class PLATFORM_EXPORT ResourceLoadScheduler final : public GarbageCollectedFinalized<ResourceLoadScheduler>, public WebFrameScheduler::Observer { @@ -78,8 +80,7 @@ // step, bug the ReleaseOption must be kReleaseOnly in such a case. bool Release(ClientId, ReleaseOption); - // Sets outstanding limit for testing. Should be reset with - // kOutstandingUnlimited before calling Shutdown(). + // Sets outstanding limit for testing. void SetOutstandingLimitForTesting(size_t limit); // WebFrameScheduler::Observer overrides:
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp index bbfdb30e..733e75f 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp
@@ -4,6 +4,8 @@ #include "platform/loader/fetch/ResourceLoadScheduler.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/loader/testing/MockFetchContext.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { @@ -31,13 +33,17 @@ class ResourceLoadSchedulerTest : public ::testing::Test { public: void SetUp() override { - scheduler_ = ResourceLoadScheduler::Create(); + // TODO(toyoshim): blink_platform_unittests should enable experimental + // runtime features by default. + DCHECK(!RuntimeEnabledFeatures::ResourceLoadSchedulerEnabled()); + RuntimeEnabledFeatures::SetResourceLoadSchedulerEnabled(true); + scheduler_ = ResourceLoadScheduler::Create( + MockFetchContext::Create(MockFetchContext::kShouldNotLoadNewResource)); scheduler()->SetOutstandingLimitForTesting(1); } void TearDown() override { - scheduler()->SetOutstandingLimitForTesting( - ResourceLoadScheduler::kOutstandingUnlimited); scheduler()->Shutdown(); + RuntimeEnabledFeatures::SetResourceLoadSchedulerEnabled(false); } ResourceLoadScheduler* scheduler() { return scheduler_; }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp index 3514a6ec..2f6a077b 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderTest.cpp
@@ -108,8 +108,7 @@ << static_cast<unsigned>(test.expectation)); context_->SetSecurityOrigin(SecurityOrigin::Create(test.origin)); - ResourceFetcher* fetcher = - ResourceFetcher::Create(context_, context_->GetTaskRunner().Get()); + ResourceFetcher* fetcher = ResourceFetcher::Create(context_); Resource* resource = RawResource::CreateForTest(test.target, test.resource_type);
diff --git a/third_party/WebKit/Source/platform/loader/testing/FetchTestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/loader/testing/FetchTestingPlatformSupport.cpp index c91aab3fc..13bfef99 100644 --- a/third_party/WebKit/Source/platform/loader/testing/FetchTestingPlatformSupport.cpp +++ b/third_party/WebKit/Source/platform/loader/testing/FetchTestingPlatformSupport.cpp
@@ -27,9 +27,8 @@ MockFetchContext* FetchTestingPlatformSupport::Context() { if (!context_) { - context_ = MockFetchContext::Create( - MockFetchContext::kShouldLoadNewResource, - CurrentThread()->Scheduler()->LoadingTaskRunner()); + context_ = + MockFetchContext::Create(MockFetchContext::kShouldLoadNewResource); } return context_; }
diff --git a/third_party/WebKit/Source/platform/loader/testing/MockFetchContext.h b/third_party/WebKit/Source/platform/loader/testing/MockFetchContext.h index 7b6b6d69..5684baa 100644 --- a/third_party/WebKit/Source/platform/loader/testing/MockFetchContext.h +++ b/third_party/WebKit/Source/platform/loader/testing/MockFetchContext.h
@@ -5,6 +5,7 @@ #ifndef MockFetchContext_h #define MockFetchContext_h +#include "platform/WebFrameScheduler.h" #include "platform/exported/WrappedResourceRequest.h" #include "platform/loader/fetch/FetchContext.h" #include "platform/loader/fetch/FetchParameters.h" @@ -29,13 +30,8 @@ kShouldLoadNewResource, kShouldNotLoadNewResource, }; - // TODO(toyoshim): Disallow to pass nullptr for |taskRunner|, and force to use - // FetchTestingPlatformSupport's WebTaskRunner. Probably, MockFetchContext - // would be available only through the FetchTestingPlatformSupport in the - // future. - static MockFetchContext* Create(LoadPolicy load_policy, - RefPtr<WebTaskRunner> task_runner = nullptr) { - return new MockFetchContext(load_policy, std::move(task_runner)); + static MockFetchContext* Create(LoadPolicy load_policy) { + return new MockFetchContext(load_policy); } ~MockFetchContext() override {} @@ -90,20 +86,41 @@ wrapped, runner_->ToSingleThreadTaskRunner()); } - RefPtr<WebTaskRunner> GetTaskRunner() { return runner_; } + WebFrameScheduler* GetFrameScheduler() override { + return frame_scheduler_.get(); + } private: - MockFetchContext(LoadPolicy load_policy, RefPtr<WebTaskRunner> task_runner) + class MockFrameScheduler final : public WebFrameScheduler { + public: + MockFrameScheduler(RefPtr<WebTaskRunner> runner) + : runner_(std::move(runner)) {} + void AddThrottlingObserver(ObserverType, Observer*) override {} + void RemoveThrottlingObserver(ObserverType, Observer*) override {} + RefPtr<WebTaskRunner> TimerTaskRunner() override { return runner_; } + RefPtr<WebTaskRunner> LoadingTaskRunner() override { return runner_; } + RefPtr<WebTaskRunner> SuspendableTaskRunner() override { return runner_; } + RefPtr<WebTaskRunner> UnthrottledTaskRunner() override { return runner_; } + RefPtr<WebTaskRunner> UnthrottledButBlockableTaskRunner() override { + return runner_; + } + + private: + RefPtr<WebTaskRunner> runner_; + }; + + MockFetchContext(LoadPolicy load_policy) : load_policy_(load_policy), - runner_(task_runner ? std::move(task_runner) - : AdoptRef(new scheduler::FakeWebTaskRunner)), + runner_(AdoptRef(new scheduler::FakeWebTaskRunner)), security_origin_(SecurityOrigin::CreateUnique()), + frame_scheduler_(new MockFrameScheduler(runner_)), complete_(false), transfer_size_(-1) {} enum LoadPolicy load_policy_; RefPtr<WebTaskRunner> runner_; RefPtr<SecurityOrigin> security_origin_; + std::unique_ptr<WebFrameScheduler> frame_scheduler_; bool complete_; long long transfer_size_; };
diff --git a/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp b/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp index 9a03d64..767e2d0 100644 --- a/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp +++ b/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp
@@ -222,8 +222,9 @@ } else { // FIXME: ideally we would encode the content as a stream without having to // fetch it all. - const char* data = resource.data->Data(); - size_t data_length = resource.data->size(); + const SharedBuffer::DeprecatedFlatData flat_data(resource.data); + const char* data = flat_data.Data(); + size_t data_length = flat_data.size(); Vector<char> encoded_data; if (!strcmp(content_encoding, kQuotedPrintable)) { QuotedPrintableEncode(data, data_length, encoded_data);
diff --git a/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni b/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni index 093434f5..307da216 100644 --- a/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni +++ b/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni
@@ -4,6 +4,7 @@ typemaps = [ "//mojo/common/file_path.typemap", + "//mojo/common/values.typemap", "//third_party/WebKit/Source/platform/mojo/File.typemap", "//third_party/WebKit/Source/platform/mojo/Geometry.typemap", "//third_party/WebKit/Source/platform/mojo/KURL.typemap",
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector.h index 12a8c20c..7c53b48 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector.h +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector.h
@@ -66,8 +66,9 @@ virtual void OnTaskQueueEnabled(internal::TaskQueueImpl* queue) = 0; // Called when the selector tried to select a task from a disabled work - // queue. See TaskQueue::Spec::SetShouldReportWhenExecutionBlocked. A single - // call to SelectWorkQueueToService will only result in up to one + // queue. See + // TaskQueue::QueueCreationParams::SetShouldReportWhenExecutionBlocked. A + // single call to SelectWorkQueueToService will only result in up to one // blocking notification even if multiple disabled queues could have been // selected. virtual void OnTriedToSelectBlockedWorkQueue(
diff --git a/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc index c2a20ad..9190c07 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc
@@ -38,13 +38,14 @@ mock_task_runner_, base::WrapUnique(new TestTimeSource(clock_.get())))), scheduler_helper_(new MainThreadSchedulerHelper(delegate_, nullptr)), - idle_helper_(new IdleHelper(scheduler_helper_.get(), - this, - "test", - base::TimeDelta::FromSeconds(30), - scheduler_helper_->NewTaskQueue( - MainThreadTaskQueue::QueueType::TEST, - TaskQueue::Spec("test_idle_tq")))), + idle_helper_( + new IdleHelper(scheduler_helper_.get(), + this, + "test", + base::TimeDelta::FromSeconds(30), + scheduler_helper_->NewTaskQueue( + MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::TEST)))), idle_canceled_delayed_taks_sweeper_( new IdleCanceledDelayedTaskSweeper(scheduler_helper_.get(), idle_helper_->IdleTaskRunner())),
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool_unittest.cc index 2f1e7252..822c3e1 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool_unittest.cc
@@ -133,8 +133,8 @@ WakeUpBudgetPool* pool = task_queue_throttler_->CreateWakeUpBudgetPool("test"); - scoped_refptr<TaskQueue> queue = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<TaskQueue> queue = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); pool->SetWakeUpRate(0.1); pool->SetWakeUpDuration(base::TimeDelta::FromMilliseconds(10));
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc index c8e59e0..7f11964 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc
@@ -16,15 +16,13 @@ : SchedulerHelper(task_queue_manager_delegate), renderer_scheduler_(renderer_scheduler), default_task_queue_( - NewTaskQueue(MainThreadTaskQueue::QueueType::DEFAULT, - MainThreadTaskQueue::CreateSpecForType( + NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( MainThreadTaskQueue::QueueType::DEFAULT) .SetShouldMonitorQuiescence(true))), control_task_queue_( - NewTaskQueue(MainThreadTaskQueue::QueueType::CONTROL, - MainThreadTaskQueue::CreateSpecForType( + NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( MainThreadTaskQueue::QueueType::CONTROL) - .SetShouldNotifyObservers(false))) { + .SetShouldNotifyObservers(true))) { InitDefaultQueues(default_task_queue_, control_task_queue_); } @@ -49,10 +47,9 @@ } scoped_refptr<MainThreadTaskQueue> MainThreadSchedulerHelper::NewTaskQueue( - MainThreadTaskQueue::QueueType type, - const TaskQueue::Spec& spec) { + const MainThreadTaskQueue::QueueCreationParams& params) { return task_queue_manager_->CreateTaskQueue<MainThreadTaskQueue>( - spec, type, renderer_scheduler_); + params.spec, params, renderer_scheduler_); } } // namespace scheduler
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.h b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.h index bf70cf1..6df96e72 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.h
@@ -22,8 +22,7 @@ ~MainThreadSchedulerHelper() override; scoped_refptr<MainThreadTaskQueue> NewTaskQueue( - MainThreadTaskQueue::QueueType type, - const TaskQueue::Spec& spec); + const MainThreadTaskQueue::QueueCreationParams& params); scoped_refptr<MainThreadTaskQueue> DefaultMainThreadTaskQueue(); scoped_refptr<MainThreadTaskQueue> ControlMainThreadTaskQueue();
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.cc b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.cc index 15fb1a0..b4a0755 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.cc
@@ -44,18 +44,44 @@ return nullptr; } -// static -TaskQueue::Spec MainThreadTaskQueue::CreateSpecForType( - MainThreadTaskQueue::QueueType queue_type) { - return TaskQueue::Spec(NameForQueueType(queue_type)); +MainThreadTaskQueue::QueueClass MainThreadTaskQueue::QueueClassForQueueType( + QueueType type) { + switch (type) { + case QueueType::CONTROL: + case QueueType::DEFAULT: + case QueueType::IDLE: + case QueueType::TEST: + return QueueClass::NONE; + case QueueType::DEFAULT_LOADING: + case QueueType::FRAME_LOADING: + return QueueClass::LOADING; + case QueueType::DEFAULT_TIMER: + case QueueType::FRAME_TIMER: + // Unthrottled tasks are considered timers which can't be throttled and + // fall into TIMER class. + case QueueType::FRAME_UNTHROTTLED: + case QueueType::UNTHROTTLED: + return QueueClass::TIMER; + case QueueType::COMPOSITOR: + return QueueClass::COMPOSITOR; + case QueueType::COUNT: + DCHECK(false); + return QueueClass::COUNT; + } + NOTREACHED(); + return QueueClass::NONE; } MainThreadTaskQueue::MainThreadTaskQueue( std::unique_ptr<internal::TaskQueueImpl> impl, - MainThreadTaskQueue::QueueType queue_type, + const QueueCreationParams& params, RendererSchedulerImpl* renderer_scheduler) : TaskQueue(std::move(impl)), - queue_type_(queue_type), + queue_type_(params.queue_type), + queue_class_(QueueClassForQueueType(params.queue_type)), + can_be_blocked_(params.can_be_blocked), + can_be_throttled_(params.can_be_throttled), + can_be_suspended_(params.can_be_suspended), renderer_scheduler_(renderer_scheduler) { GetTaskQueueImpl()->SetOnTaskCompletedHandler(base::Bind( &MainThreadTaskQueue::OnTaskCompleted, base::Unretained(this)));
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.h b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.h index 09bbe245..9715b68 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_task_queue.h
@@ -36,13 +36,83 @@ // lifetime. static const char* NameForQueueType(QueueType queue_type); - // Create spec with correct name for given type. - static TaskQueue::Spec CreateSpecForType(QueueType queue_type); + // High-level category used by RendererScheduler to make scheduling decisions. + enum class QueueClass { + NONE = 0, + LOADING = 1, + TIMER = 2, + COMPOSITOR = 4, + + COUNT = 5 + }; + + static QueueClass QueueClassForQueueType(QueueType type); + + struct QueueCreationParams { + explicit QueueCreationParams(QueueType queue_type) + : queue_type(queue_type), + spec(NameForQueueType(queue_type)), + can_be_blocked(false), + can_be_throttled(false), + can_be_suspended(false) {} + + QueueCreationParams SetCanBeBlocked(bool value) { + can_be_blocked = value; + return *this; + } + + QueueCreationParams SetCanBeThrottled(bool value) { + can_be_throttled = value; + return *this; + } + + QueueCreationParams SetCanBeSuspended(bool value) { + can_be_suspended = value; + return *this; + } + + // Forwarded calls to |spec|. + + QueueCreationParams SetShouldMonitorQuiescence(bool should_monitor) { + spec = spec.SetShouldMonitorQuiescence(should_monitor); + return *this; + } + + QueueCreationParams SetShouldNotifyObservers(bool run_observers) { + spec = spec.SetShouldNotifyObservers(run_observers); + return *this; + } + + QueueCreationParams SetTimeDomain(TimeDomain* domain) { + spec = spec.SetTimeDomain(domain); + return *this; + } + + QueueCreationParams SetShouldReportWhenExecutionBlocked( + bool should_report) { + spec = spec.SetShouldReportWhenExecutionBlocked(should_report); + return *this; + } + + QueueType queue_type; + TaskQueue::Spec spec; + bool can_be_blocked; + bool can_be_throttled; + bool can_be_suspended; + }; ~MainThreadTaskQueue() override; QueueType queue_type() const { return queue_type_; } + QueueClass queue_class() const { return queue_class_; } + + bool CanBeBlocked() const { return can_be_blocked_; } + + bool CanBeThrottled() const { return can_be_throttled_; } + + bool CanBeSuspended() const { return can_be_suspended_; } + void OnTaskCompleted(base::TimeTicks start, base::TimeTicks end); // Override base method to notify RendererScheduler about unregistered queue. @@ -50,12 +120,16 @@ private: MainThreadTaskQueue(std::unique_ptr<internal::TaskQueueImpl> impl, - QueueType queue_type, + const QueueCreationParams& params, RendererSchedulerImpl* renderer_scheduler); friend class TaskQueueManager; QueueType queue_type_; + QueueClass queue_class_; + const bool can_be_blocked_; + const bool can_be_throttled_; + const bool can_be_suspended_; // Needed to notify renderer scheduler about completed tasks. RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index e5e244f..ca57b27a 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -95,16 +95,14 @@ this, "RendererSchedulerIdlePeriod", base::TimeDelta(), - helper_.NewTaskQueue(MainThreadTaskQueue::QueueType::IDLE, - MainThreadTaskQueue::CreateSpecForType( - MainThreadTaskQueue::QueueType::IDLE))), + helper_.NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::IDLE))), idle_canceled_delayed_task_sweeper_(&helper_, idle_helper_.IdleTaskRunner()), render_widget_scheduler_signals_(this), control_task_queue_(helper_.ControlMainThreadTaskQueue()), compositor_task_queue_( - helper_.NewTaskQueue(MainThreadTaskQueue::QueueType::COMPOSITOR, - MainThreadTaskQueue::CreateSpecForType( + helper_.NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( MainThreadTaskQueue::QueueType::COMPOSITOR) .SetShouldMonitorQuiescence(true))), compositor_task_queue_enabled_voter_( @@ -127,6 +125,14 @@ end_renderer_hidden_idle_period_closure_.Reset(base::Bind( &RendererSchedulerImpl::EndIdlePeriod, weak_factory_.GetWeakPtr())); + // Compositor task queue and default task queue should be managed by + // RendererScheduler. Control task queue should not. + task_runners_.insert( + std::make_pair(helper_.DefaultMainThreadTaskQueue(), nullptr)); + task_runners_.insert( + std::make_pair(compositor_task_queue_, + compositor_task_queue_->CreateQueueEnabledVoter())); + default_loading_task_queue_ = NewLoadingTaskQueue(MainThreadTaskQueue::QueueType::DEFAULT_LOADING); default_timer_task_queue_ = @@ -152,13 +158,21 @@ TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "RendererScheduler", this); - for (auto& pair : loading_task_runners_) { - pair.first->RemoveTaskObserver( - &GetMainThreadOnly().loading_task_cost_estimator); - } - for (auto& pair : timer_task_runners_) { - pair.first->RemoveTaskObserver( - &GetMainThreadOnly().timer_task_cost_estimator); + for (auto& pair : task_runners_) { + TaskCostEstimator* observer = nullptr; + switch (pair.first->queue_class()) { + case MainThreadTaskQueue::QueueClass::LOADING: + observer = &GetMainThreadOnly().loading_task_cost_estimator; + break; + case MainThreadTaskQueue::QueueClass::TIMER: + observer = &GetMainThreadOnly().timer_task_cost_estimator; + break; + default: + observer = nullptr; + } + + if (observer) + pair.first->RemoveTaskObserver(observer); } if (virtual_time_domain_) @@ -356,76 +370,59 @@ return virtual_time_control_task_queue_; } +scoped_refptr<MainThreadTaskQueue> RendererSchedulerImpl::NewTaskQueue( + const MainThreadTaskQueue::QueueCreationParams& params) { + helper_.CheckOnValidThread(); + scoped_refptr<MainThreadTaskQueue> task_queue(helper_.NewTaskQueue(params)); + + std::unique_ptr<TaskQueue::QueueEnabledVoter> voter; + if (params.can_be_blocked || params.can_be_suspended) + voter = task_queue->CreateQueueEnabledVoter(); + + auto insert_result = + task_runners_.insert(std::make_pair(task_queue, std::move(voter))); + auto queue_class = task_queue->queue_class(); + if (queue_class == MainThreadTaskQueue::QueueClass::TIMER) { + task_queue->AddTaskObserver(&GetMainThreadOnly().timer_task_cost_estimator); + } else if (queue_class == MainThreadTaskQueue::QueueClass::LOADING) { + task_queue->AddTaskObserver( + &GetMainThreadOnly().loading_task_cost_estimator); + } + + ApplyTaskQueuePolicy( + task_queue.get(), insert_result.first->second.get(), TaskQueuePolicy(), + GetMainThreadOnly().current_policy.GetQueuePolicy(queue_class)); + + if (task_queue->CanBeThrottled()) + AddQueueToWakeUpBudgetPool(task_queue.get()); + + return task_queue; +} + scoped_refptr<MainThreadTaskQueue> RendererSchedulerImpl::NewLoadingTaskQueue( MainThreadTaskQueue::QueueType queue_type) { - helper_.CheckOnValidThread(); - scoped_refptr<MainThreadTaskQueue> loading_task_queue(helper_.NewTaskQueue( - queue_type, MainThreadTaskQueue::CreateSpecForType(queue_type) - .SetShouldMonitorQuiescence(true) - .SetTimeDomain(GetMainThreadOnly().use_virtual_time - ? GetVirtualTimeDomain() - : nullptr))); - auto insert_result = loading_task_runners_.insert(std::make_pair( - loading_task_queue, loading_task_queue->CreateQueueEnabledVoter())); - insert_result.first->second->SetQueueEnabled( - GetMainThreadOnly().current_policy.loading_queue_policy.is_enabled); - loading_task_queue->SetQueuePriority( - GetMainThreadOnly().current_policy.loading_queue_policy.priority); - if (GetMainThreadOnly() - .current_policy.loading_queue_policy.time_domain_type == - TimeDomainType::THROTTLED) { - task_queue_throttler_->IncreaseThrottleRefCount(loading_task_queue.get()); - } - loading_task_queue->AddTaskObserver( - &GetMainThreadOnly().loading_task_cost_estimator); - AddQueueToWakeUpBudgetPool(loading_task_queue.get()); - return loading_task_queue; + DCHECK_EQ(MainThreadTaskQueue::QueueClassForQueueType(queue_type), + MainThreadTaskQueue::QueueClass::LOADING); + return NewTaskQueue(MainThreadTaskQueue::QueueCreationParams(queue_type) + .SetCanBeSuspended(true) + .SetCanBeBlocked(true)); } scoped_refptr<MainThreadTaskQueue> RendererSchedulerImpl::NewTimerTaskQueue( MainThreadTaskQueue::QueueType queue_type) { - helper_.CheckOnValidThread(); - // TODO(alexclarke): Consider using ApplyTaskQueuePolicy() for brevity. - scoped_refptr<MainThreadTaskQueue> timer_task_queue(helper_.NewTaskQueue( - queue_type, MainThreadTaskQueue::CreateSpecForType(queue_type) - .SetShouldMonitorQuiescence(true) - .SetShouldReportWhenExecutionBlocked(true) - .SetTimeDomain(GetMainThreadOnly().use_virtual_time - ? GetVirtualTimeDomain() - : nullptr))); - auto insert_result = timer_task_runners_.insert(std::make_pair( - timer_task_queue, timer_task_queue->CreateQueueEnabledVoter())); - insert_result.first->second->SetQueueEnabled( - GetMainThreadOnly().current_policy.timer_queue_policy.is_enabled); - timer_task_queue->SetQueuePriority( - GetMainThreadOnly().current_policy.timer_queue_policy.priority); - if (GetMainThreadOnly().current_policy.timer_queue_policy.time_domain_type == - TimeDomainType::THROTTLED) { - task_queue_throttler_->IncreaseThrottleRefCount(timer_task_queue.get()); - } + DCHECK_EQ(MainThreadTaskQueue::QueueClassForQueueType(queue_type), + MainThreadTaskQueue::QueueClass::TIMER); + auto timer_task_queue = + NewTaskQueue(MainThreadTaskQueue::QueueCreationParams(queue_type) + .SetShouldReportWhenExecutionBlocked(true) + .SetCanBeSuspended(true) + .SetCanBeBlocked(true) + .SetCanBeThrottled(true)); if (GetMainThreadOnly().virtual_time_paused) timer_task_queue->InsertFence(TaskQueue::InsertFencePosition::NOW); - timer_task_queue->AddTaskObserver( - &GetMainThreadOnly().timer_task_cost_estimator); - AddQueueToWakeUpBudgetPool(timer_task_queue.get()); return timer_task_queue; } -scoped_refptr<MainThreadTaskQueue> -RendererSchedulerImpl::NewUnthrottledTaskQueue( - MainThreadTaskQueue::QueueType queue_type) { - helper_.CheckOnValidThread(); - scoped_refptr<MainThreadTaskQueue> unthrottled_task_queue( - helper_.NewTaskQueue( - queue_type, MainThreadTaskQueue::CreateSpecForType(queue_type) - .SetShouldMonitorQuiescence(true) - .SetTimeDomain(GetMainThreadOnly().use_virtual_time - ? GetVirtualTimeDomain() - : nullptr))); - unthrottled_task_runners_.insert(unthrottled_task_queue); - return unthrottled_task_queue; -} - std::unique_ptr<RenderWidgetSchedulingState> RendererSchedulerImpl::NewRenderWidgetSchedulingState() { return render_widget_scheduler_signals_.NewRenderWidgetSchedulingState(); @@ -436,18 +433,17 @@ if (task_queue_throttler_) task_queue_throttler_->UnregisterTaskQueue(task_queue.get()); - if (loading_task_runners_.find(task_queue) != loading_task_runners_.end()) { - task_queue->RemoveTaskObserver( - &GetMainThreadOnly().loading_task_cost_estimator); - loading_task_runners_.erase(task_queue); - } else if (timer_task_runners_.find(task_queue) != - timer_task_runners_.end()) { - task_queue->RemoveTaskObserver( - &GetMainThreadOnly().timer_task_cost_estimator); - timer_task_runners_.erase(task_queue); - } else if (unthrottled_task_runners_.find(task_queue) != - unthrottled_task_runners_.end()) { - unthrottled_task_runners_.erase(task_queue); + if (task_runners_.erase(task_queue)) { + switch (task_queue->queue_class()) { + case MainThreadTaskQueue::QueueClass::TIMER: + task_queue->RemoveTaskObserver( + &GetMainThreadOnly().timer_task_cost_estimator); + case MainThreadTaskQueue::QueueClass::LOADING: + task_queue->RemoveTaskObserver( + &GetMainThreadOnly().loading_task_cost_estimator); + default: + break; + } } } @@ -1091,29 +1087,30 @@ Policy new_policy; ExpensiveTaskPolicy expensive_task_policy = ExpensiveTaskPolicy::RUN; - new_policy.rail_mode = v8::PERFORMANCE_ANIMATION; + new_policy.rail_mode() = v8::PERFORMANCE_ANIMATION; switch (use_case) { case UseCase::COMPOSITOR_GESTURE: if (touchstart_expected_soon) { - new_policy.rail_mode = v8::PERFORMANCE_RESPONSE; + new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE; expensive_task_policy = ExpensiveTaskPolicy::BLOCK; - new_policy.compositor_queue_policy.priority = TaskQueue::HIGH_PRIORITY; + new_policy.compositor_queue_policy().priority = + TaskQueue::HIGH_PRIORITY; } else { // What we really want to do is priorize loading tasks, but that doesn't // seem to be safe. Instead we do that by proxy by deprioritizing // compositor tasks. This should be safe since we've already gone to the // pain of fixing ordering issues with them. - new_policy.compositor_queue_policy.priority = TaskQueue::LOW_PRIORITY; + new_policy.compositor_queue_policy().priority = TaskQueue::LOW_PRIORITY; } break; case UseCase::SYNCHRONIZED_GESTURE: - new_policy.compositor_queue_policy.priority = + new_policy.compositor_queue_policy().priority = main_thread_compositing_is_fast ? TaskQueue::HIGH_PRIORITY : TaskQueue::NORMAL_PRIORITY; if (touchstart_expected_soon) { - new_policy.rail_mode = v8::PERFORMANCE_RESPONSE; + new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE; expensive_task_policy = ExpensiveTaskPolicy::BLOCK; } else { expensive_task_policy = ExpensiveTaskPolicy::THROTTLE; @@ -1125,7 +1122,7 @@ // about which things we should be prioritizing, so we don't attempt to // block expensive tasks because we don't know whether they were integral // to the page's functionality or not. - new_policy.compositor_queue_policy.priority = + new_policy.compositor_queue_policy().priority = main_thread_compositing_is_fast ? TaskQueue::HIGH_PRIORITY : TaskQueue::NORMAL_PRIORITY; break; @@ -1135,9 +1132,9 @@ // by the main thread. Since we know the established gesture type, we can // be a little more aggressive about prioritizing compositing and input // handling over other tasks. - new_policy.compositor_queue_policy.priority = TaskQueue::HIGH_PRIORITY; + new_policy.compositor_queue_policy().priority = TaskQueue::HIGH_PRIORITY; if (touchstart_expected_soon) { - new_policy.rail_mode = v8::PERFORMANCE_RESPONSE; + new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE; expensive_task_policy = ExpensiveTaskPolicy::BLOCK; } else { expensive_task_policy = ExpensiveTaskPolicy::THROTTLE; @@ -1145,29 +1142,29 @@ break; case UseCase::TOUCHSTART: - new_policy.rail_mode = v8::PERFORMANCE_RESPONSE; - new_policy.compositor_queue_policy.priority = TaskQueue::HIGH_PRIORITY; - new_policy.loading_queue_policy.is_enabled = false; - new_policy.timer_queue_policy.is_enabled = false; + new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE; + new_policy.compositor_queue_policy().priority = TaskQueue::HIGH_PRIORITY; + new_policy.loading_queue_policy().is_blocked = true; + new_policy.timer_queue_policy().is_blocked = true; // NOTE this is a nop due to the above. expensive_task_policy = ExpensiveTaskPolicy::BLOCK; break; case UseCase::NONE: - new_policy.compositor_queue_policy.priority = + new_policy.compositor_queue_policy().priority = main_thread_compositing_is_fast ? TaskQueue::HIGH_PRIORITY : TaskQueue::NORMAL_PRIORITY; // It's only safe to block tasks that if we are expecting a compositor // driven gesture. if (touchstart_expected_soon && GetAnyThread().last_gesture_was_compositor_driven) { - new_policy.rail_mode = v8::PERFORMANCE_RESPONSE; + new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE; expensive_task_policy = ExpensiveTaskPolicy::BLOCK; } break; case UseCase::LOADING: - new_policy.rail_mode = v8::PERFORMANCE_LOAD; + new_policy.rail_mode() = v8::PERFORMANCE_LOAD; // TODO(skyostil): Experiment with increasing loading and default queue // priorities and throttling rendering frame rate. break; @@ -1178,7 +1175,7 @@ // TODO(skyostil): Add an idle state for foreground tabs too. if (GetMainThreadOnly().renderer_hidden) - new_policy.rail_mode = v8::PERFORMANCE_IDLE; + new_policy.rail_mode() = v8::PERFORMANCE_IDLE; if (expensive_task_policy == ExpensiveTaskPolicy::BLOCK && (!GetMainThreadOnly().have_seen_a_begin_main_frame || @@ -1192,19 +1189,17 @@ case ExpensiveTaskPolicy::BLOCK: if (loading_tasks_seem_expensive) - new_policy.loading_queue_policy.is_enabled = false; + new_policy.loading_queue_policy().is_blocked = true; if (timer_tasks_seem_expensive) - new_policy.timer_queue_policy.is_enabled = false; + new_policy.timer_queue_policy().is_blocked = true; break; case ExpensiveTaskPolicy::THROTTLE: if (loading_tasks_seem_expensive) { - new_policy.loading_queue_policy.time_domain_type = - TimeDomainType::THROTTLED; + new_policy.loading_queue_policy().is_throttled = true; } if (timer_tasks_seem_expensive) { - new_policy.timer_queue_policy.time_domain_type = - TimeDomainType::THROTTLED; + new_policy.timer_queue_policy().is_throttled = true; } break; } @@ -1212,25 +1207,22 @@ if (GetMainThreadOnly().timer_queue_suspend_count != 0 || GetMainThreadOnly().timer_queue_suspended_when_backgrounded) { - new_policy.timer_queue_policy.is_enabled = false; - // TODO(alexclarke): Figure out if we really need to do this. - new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL; + new_policy.timer_queue_policy().is_suspended = true; } if (GetMainThreadOnly().renderer_suspended) { - new_policy.loading_queue_policy.is_enabled = false; - new_policy.timer_queue_policy.is_enabled = false; + new_policy.loading_queue_policy().is_suspended = true; + new_policy.timer_queue_policy().is_suspended = true; } if (GetMainThreadOnly().use_virtual_time) { - new_policy.compositor_queue_policy.time_domain_type = - TimeDomainType::VIRTUAL; - new_policy.default_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; - new_policy.loading_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; - new_policy.timer_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; + new_policy.compositor_queue_policy().use_virtual_time = true; + new_policy.default_queue_policy().use_virtual_time = true; + new_policy.loading_queue_policy().use_virtual_time = true; + new_policy.timer_queue_policy().use_virtual_time = true; } - new_policy.should_disable_throttling = + new_policy.should_disable_throttling() = ShouldDisableThrottlingBecauseOfAudio(now) || GetMainThreadOnly().use_virtual_time; @@ -1240,7 +1232,7 @@ TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "use_case", use_case); TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "rail_mode", - new_policy.rail_mode); + new_policy.rail_mode()); TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "touchstart_expected_soon", GetMainThreadOnly().touchstart_expected_soon); @@ -1259,41 +1251,25 @@ return; } - ApplyTaskQueuePolicy( - compositor_task_queue_.get(), compositor_task_queue_enabled_voter_.get(), - GetMainThreadOnly().current_policy.compositor_queue_policy, - new_policy.compositor_queue_policy); + for (const auto& pair : task_runners_) { + MainThreadTaskQueue::QueueClass queue_class = pair.first->queue_class(); - for (const auto& pair : loading_task_runners_) { ApplyTaskQueuePolicy( pair.first.get(), pair.second.get(), - GetMainThreadOnly().current_policy.loading_queue_policy, - new_policy.loading_queue_policy); + GetMainThreadOnly().current_policy.GetQueuePolicy(queue_class), + new_policy.GetQueuePolicy(queue_class)); } - for (const auto& pair : timer_task_runners_) { - ApplyTaskQueuePolicy(pair.first.get(), pair.second.get(), - GetMainThreadOnly().current_policy.timer_queue_policy, - new_policy.timer_queue_policy); - } - GetMainThreadOnly().have_reported_blocking_intervention_in_current_policy = - false; - - // TODO(alexclarke): We shouldn't have to prioritize the default queue, but it - // appears to be necessary since the order of loading tasks and IPCs (which - // are mostly dispatched on the default queue) need to be preserved. - ApplyTaskQueuePolicy(helper_.DefaultMainThreadTaskQueue().get(), nullptr, - GetMainThreadOnly().current_policy.default_queue_policy, - new_policy.default_queue_policy); if (GetMainThreadOnly().rail_mode_observer && - new_policy.rail_mode != GetMainThreadOnly().current_policy.rail_mode) { + new_policy.rail_mode() != + GetMainThreadOnly().current_policy.rail_mode()) { GetMainThreadOnly().rail_mode_observer->OnRAILModeChanged( - new_policy.rail_mode); + new_policy.rail_mode()); } - if (new_policy.should_disable_throttling != - GetMainThreadOnly().current_policy.should_disable_throttling) { - if (new_policy.should_disable_throttling) { + if (new_policy.should_disable_throttling() != + GetMainThreadOnly().current_policy.should_disable_throttling()) { + if (new_policy.should_disable_throttling()) { task_queue_throttler()->DisableThrottling(); } else { task_queue_throttler()->EnableThrottling(); @@ -1312,28 +1288,32 @@ TaskQueue::QueueEnabledVoter* task_queue_enabled_voter, const TaskQueuePolicy& old_task_queue_policy, const TaskQueuePolicy& new_task_queue_policy) const { - if (task_queue_enabled_voter && - old_task_queue_policy.is_enabled != new_task_queue_policy.is_enabled) { - task_queue_enabled_voter->SetQueueEnabled(new_task_queue_policy.is_enabled); + DCHECK(old_task_queue_policy.IsQueueEnabled(task_queue) || + task_queue_enabled_voter); + if (task_queue_enabled_voter) { + task_queue_enabled_voter->SetQueueEnabled( + new_task_queue_policy.IsQueueEnabled(task_queue)); } // Make sure if there's no voter that the task queue is enabled. - DCHECK(task_queue_enabled_voter || old_task_queue_policy.is_enabled); + DCHECK(task_queue_enabled_voter || + old_task_queue_policy.IsQueueEnabled(task_queue)); - if (old_task_queue_policy.priority != new_task_queue_policy.priority) - task_queue->SetQueuePriority(new_task_queue_policy.priority); + task_queue->SetQueuePriority(new_task_queue_policy.GetPriority(task_queue)); - if (old_task_queue_policy.time_domain_type != - new_task_queue_policy.time_domain_type) { - if (old_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) { + TimeDomainType old_time_domain_type = + old_task_queue_policy.GetTimeDomainType(task_queue); + TimeDomainType new_time_domain_type = + new_task_queue_policy.GetTimeDomainType(task_queue); + + if (old_time_domain_type != new_time_domain_type) { + if (old_time_domain_type == TimeDomainType::THROTTLED) { task_queue->SetTimeDomain(real_time_domain()); task_queue_throttler_->DecreaseThrottleRefCount(task_queue); - } else if (new_task_queue_policy.time_domain_type == - TimeDomainType::THROTTLED) { + } else if (new_time_domain_type == TimeDomainType::THROTTLED) { task_queue->SetTimeDomain(real_time_domain()); task_queue_throttler_->IncreaseThrottleRefCount(task_queue); - } else if (new_task_queue_policy.time_domain_type == - TimeDomainType::VIRTUAL) { + } else if (new_time_domain_type == TimeDomainType::VIRTUAL) { DCHECK(virtual_time_domain_); task_queue->SetTimeDomain(virtual_time_domain_.get()); } else { @@ -1464,8 +1444,11 @@ ForceUpdatePolicy(); #ifndef NDEBUG DCHECK(!default_timer_task_queue_->IsQueueEnabled()); - for (const auto& runner : timer_task_runners_) { - DCHECK(!runner.first->IsQueueEnabled()); + for (const auto& pair : task_runners_) { + if (pair.first->queue_class() == MainThreadTaskQueue::QueueClass::TIMER && + pair.first->CanBeSuspended()) { + DCHECK(!pair.first->IsQueueEnabled()); + } } #endif } @@ -1479,19 +1462,24 @@ void RendererSchedulerImpl::VirtualTimePaused() { DCHECK(!GetMainThreadOnly().virtual_time_paused); GetMainThreadOnly().virtual_time_paused = true; - for (const auto& pair : timer_task_runners_) { - DCHECK(!task_queue_throttler_->IsThrottled(pair.first.get())); - DCHECK(!pair.first->HasFence()); - pair.first->InsertFence(TaskQueue::InsertFencePosition::NOW); + for (const auto& pair : task_runners_) { + if (pair.first->queue_class() == MainThreadTaskQueue::QueueClass::TIMER) { + DCHECK(!task_queue_throttler_->IsThrottled(pair.first.get())); + DCHECK(!pair.first->HasFence()); + pair.first->InsertFence(TaskQueue::InsertFencePosition::NOW); + } } } void RendererSchedulerImpl::VirtualTimeResumed() { DCHECK(GetMainThreadOnly().virtual_time_paused); GetMainThreadOnly().virtual_time_paused = false; - for (const auto& pair : timer_task_runners_) { - DCHECK(!task_queue_throttler_->IsThrottled(pair.first.get())); - pair.first->RemoveFence(); + for (const auto& pair : task_runners_) { + if (pair.first->queue_class() == MainThreadTaskQueue::QueueClass::TIMER) { + DCHECK(!task_queue_throttler_->IsThrottled(pair.first.get())); + DCHECK(pair.first->HasFence()); + pair.first->RemoveFence(); + } } } @@ -1656,34 +1644,62 @@ return std::move(state); } +bool RendererSchedulerImpl::TaskQueuePolicy::IsQueueEnabled( + MainThreadTaskQueue* task_queue) const { + if (!is_enabled) + return false; + if (is_suspended && task_queue->CanBeSuspended()) + return false; + if (is_blocked && task_queue->CanBeBlocked()) + return false; + return true; +} + +TaskQueue::QueuePriority RendererSchedulerImpl::TaskQueuePolicy::GetPriority( + MainThreadTaskQueue* task_queue) const { + return priority; +} + +RendererSchedulerImpl::TimeDomainType +RendererSchedulerImpl::TaskQueuePolicy::GetTimeDomainType( + MainThreadTaskQueue* task_queue) const { + if (use_virtual_time) + return TimeDomainType::VIRTUAL; + if (is_throttled && task_queue->CanBeThrottled()) + return TimeDomainType::THROTTLED; + return TimeDomainType::REAL; +} + void RendererSchedulerImpl::TaskQueuePolicy::AsValueInto( base::trace_event::TracedValue* state) const { state->SetBoolean("is_enabled", is_enabled); + state->SetBoolean("is_suspended", is_suspended); + state->SetBoolean("is_throttled", is_throttled); + state->SetBoolean("is_blocked", is_blocked); + state->SetBoolean("use_virtual_time", use_virtual_time); state->SetString("priority", TaskQueue::PriorityToString(priority)); - state->SetString("time_domain_type", - TimeDomainTypeToString(time_domain_type)); } void RendererSchedulerImpl::Policy::AsValueInto( base::trace_event::TracedValue* state) const { state->BeginDictionary("compositor_queue_policy"); - compositor_queue_policy.AsValueInto(state); + compositor_queue_policy().AsValueInto(state); state->EndDictionary(); state->BeginDictionary("loading_queue_policy"); - loading_queue_policy.AsValueInto(state); + loading_queue_policy().AsValueInto(state); state->EndDictionary(); state->BeginDictionary("timer_queue_policy"); - timer_queue_policy.AsValueInto(state); + timer_queue_policy().AsValueInto(state); state->EndDictionary(); state->BeginDictionary("default_queue_policy"); - default_queue_policy.AsValueInto(state); + default_queue_policy().AsValueInto(state); state->EndDictionary(); - state->SetString("rail_mode", RAILModeToString(rail_mode)); - state->SetBoolean("should_disable_throttling", should_disable_throttling); + state->SetString("rail_mode", RAILModeToString(rail_mode())); + state->SetBoolean("should_disable_throttling", should_disable_throttling()); } void RendererSchedulerImpl::OnIdlePeriodStarted() { @@ -2177,20 +2193,13 @@ void RendererSchedulerImpl::EnableVirtualTime() { GetMainThreadOnly().use_virtual_time = true; - // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). - AutoAdvancingVirtualTimeDomain* time_domain = GetVirtualTimeDomain(); - for (const scoped_refptr<MainThreadTaskQueue>& task_queue : - unthrottled_task_runners_) - task_queue->SetTimeDomain(time_domain); - DCHECK(!virtual_time_control_task_queue_); virtual_time_control_task_queue_ = - helper_.NewTaskQueue(MainThreadTaskQueue::QueueType::CONTROL, - MainThreadTaskQueue::CreateSpecForType( - MainThreadTaskQueue::QueueType::CONTROL)); + helper_.NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::CONTROL)); virtual_time_control_task_queue_->SetQueuePriority( TaskQueue::CONTROL_PRIORITY); - virtual_time_control_task_queue_->SetTimeDomain(time_domain); + virtual_time_control_task_queue_->SetTimeDomain(GetVirtualTimeDomain()); ForceUpdatePolicy(); } @@ -2198,11 +2207,6 @@ void RendererSchedulerImpl::DisableVirtualTimeForTesting() { GetMainThreadOnly().use_virtual_time = false; - RealTimeDomain* time_domain = real_time_domain(); - // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). - for (const scoped_refptr<MainThreadTaskQueue>& task_queue : - unthrottled_task_runners_) - task_queue->SetTimeDomain(time_domain); virtual_time_control_task_queue_->UnregisterTaskQueue(); virtual_time_control_task_queue_ = nullptr;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h index e14c904..5d7e2265 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h
@@ -152,6 +152,10 @@ scoped_refptr<MainThreadTaskQueue> LoadingTaskQueue(); scoped_refptr<MainThreadTaskQueue> TimerTaskQueue(); + // Returns a new task queue created with given params. + scoped_refptr<MainThreadTaskQueue> NewTaskQueue( + const MainThreadTaskQueue::QueueCreationParams& params); + // Returns a new loading task queue. This queue is intended for tasks related // to resource dispatch, foreground HTML parsing, etc... scoped_refptr<MainThreadTaskQueue> NewLoadingTaskQueue( @@ -161,10 +165,6 @@ scoped_refptr<MainThreadTaskQueue> NewTimerTaskQueue( MainThreadTaskQueue::QueueType queue_type); - // Returns a task queue for tasks which should never get throttled. - scoped_refptr<MainThreadTaskQueue> NewUnthrottledTaskQueue( - MainThreadTaskQueue::QueueType queue_type); - // Returns a task queue where tasks run at the highest possible priority. scoped_refptr<MainThreadTaskQueue> ControlTaskQueue(); @@ -268,41 +268,111 @@ static const char* TimeDomainTypeToString(TimeDomainType domain_type); struct TaskQueuePolicy { + // Default constructor of TaskQueuePolicy should match behaviour of a + // newly-created task queue. TaskQueuePolicy() : is_enabled(true), - priority(TaskQueue::NORMAL_PRIORITY), - time_domain_type(TimeDomainType::REAL) {} + is_suspended(false), + is_throttled(false), + is_blocked(false), + use_virtual_time(false), + priority(TaskQueue::NORMAL_PRIORITY) {} bool is_enabled; + bool is_suspended; + bool is_throttled; + bool is_blocked; + bool use_virtual_time; TaskQueue::QueuePriority priority; - TimeDomainType time_domain_type; + + bool IsQueueEnabled(MainThreadTaskQueue* task_queue) const; + + TaskQueue::QueuePriority GetPriority(MainThreadTaskQueue* task_queue) const; + + TimeDomainType GetTimeDomainType(MainThreadTaskQueue* task_queue) const; bool operator==(const TaskQueuePolicy& other) const { - return is_enabled == other.is_enabled && priority == other.priority && - time_domain_type == other.time_domain_type; + return is_enabled == other.is_enabled && + is_suspended == other.is_suspended && + is_throttled == other.is_throttled && + is_blocked == other.is_blocked && + use_virtual_time == other.use_virtual_time && + priority == other.priority; } void AsValueInto(base::trace_event::TracedValue* state) const; }; - struct Policy { - TaskQueuePolicy compositor_queue_policy; - TaskQueuePolicy loading_queue_policy; - TaskQueuePolicy timer_queue_policy; - TaskQueuePolicy default_queue_policy; - v8::RAILMode rail_mode = v8::PERFORMANCE_ANIMATION; - bool should_disable_throttling = false; + class Policy { + public: + Policy() + : rail_mode_(v8::PERFORMANCE_ANIMATION), + should_disable_throttling_(false) {} + ~Policy() {} + + TaskQueuePolicy& compositor_queue_policy() { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::COMPOSITOR)]; + } + const TaskQueuePolicy& compositor_queue_policy() const { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::COMPOSITOR)]; + } + + TaskQueuePolicy& loading_queue_policy() { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::LOADING)]; + } + const TaskQueuePolicy& loading_queue_policy() const { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::LOADING)]; + } + + TaskQueuePolicy& timer_queue_policy() { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::TIMER)]; + } + const TaskQueuePolicy& timer_queue_policy() const { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::TIMER)]; + } + + TaskQueuePolicy& default_queue_policy() { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::NONE)]; + } + const TaskQueuePolicy& default_queue_policy() const { + return policies_[static_cast<size_t>( + MainThreadTaskQueue::QueueClass::NONE)]; + } + + const TaskQueuePolicy& GetQueuePolicy( + MainThreadTaskQueue::QueueClass queue_class) const { + return policies_[static_cast<size_t>(queue_class)]; + } + + v8::RAILMode& rail_mode() { return rail_mode_; } + v8::RAILMode rail_mode() const { return rail_mode_; } + + bool& should_disable_throttling() { return should_disable_throttling_; } + bool should_disable_throttling() const { + return should_disable_throttling_; + } bool operator==(const Policy& other) const { - return compositor_queue_policy == other.compositor_queue_policy && - loading_queue_policy == other.loading_queue_policy && - timer_queue_policy == other.timer_queue_policy && - default_queue_policy == other.default_queue_policy && - rail_mode == other.rail_mode && - should_disable_throttling == other.should_disable_throttling; + return policies_ == other.policies_ && rail_mode_ == other.rail_mode_ && + should_disable_throttling_ == other.should_disable_throttling_; } void AsValueInto(base::trace_event::TracedValue* state) const; + + private: + v8::RAILMode rail_mode_; + bool should_disable_throttling_; + + std::array<TaskQueuePolicy, + static_cast<size_t>(MainThreadTaskQueue::QueueClass::COUNT)> + policies_; }; class PollableNeedsUpdateFlag { @@ -453,9 +523,8 @@ std::map<scoped_refptr<MainThreadTaskQueue>, std::unique_ptr<TaskQueue::QueueEnabledVoter>>; - TaskQueueVoterMap loading_task_runners_; - TaskQueueVoterMap timer_task_runners_; - std::set<scoped_refptr<MainThreadTaskQueue>> unthrottled_task_runners_; + TaskQueueVoterMap task_runners_; + scoped_refptr<MainThreadTaskQueue> default_loading_task_queue_; scoped_refptr<MainThreadTaskQueue> default_timer_task_queue_;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc index 9d0c2094..5e6b448 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -528,7 +528,7 @@ } v8::RAILMode GetRAILMode() { - return scheduler_->GetMainThreadOnly().current_policy.rail_mode; + return scheduler_->GetMainThreadOnly().current_policy.rail_mode(); } bool BeginFrameNotExpectedSoon() { @@ -3702,8 +3702,8 @@ // task runner. SimulateCompositorGestureStart(TouchEventPolicy::SEND_TOUCH_START); scoped_refptr<TaskQueue> unthrottled_task_runner = - scheduler_->NewUnthrottledTaskQueue( - MainThreadTaskQueue::QueueType::UNTHROTTLED); + scheduler_->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::UNTHROTTLED)); size_t timer_count = 0; size_t unthrottled_count = 0; @@ -3746,12 +3746,14 @@ TEST_F(RendererSchedulerImplTest, EnableVirtualTime) { scheduler_->EnableVirtualTime(); - scoped_refptr<TaskQueue> loading_tq = - scheduler_->NewLoadingTaskQueue(MainThreadTaskQueue::QueueType::TEST); - scoped_refptr<TaskQueue> timer_tq = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); - scoped_refptr<TaskQueue> unthrottled_tq = - scheduler_->NewUnthrottledTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<MainThreadTaskQueue> loading_tq = + scheduler_->NewLoadingTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_LOADING); + scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); + scoped_refptr<MainThreadTaskQueue> unthrottled_tq = + scheduler_->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::UNTHROTTLED)); EXPECT_EQ(scheduler_->DefaultTaskQueue()->GetTimeDomain(), scheduler_->GetVirtualTimeDomain()); @@ -3774,25 +3776,34 @@ scheduler_->GetVirtualTimeDomain()); EXPECT_EQ( - scheduler_->NewLoadingTaskQueue(MainThreadTaskQueue::QueueType::TEST) + scheduler_ + ->NewLoadingTaskQueue(MainThreadTaskQueue::QueueType::FRAME_LOADING) ->GetTimeDomain(), scheduler_->GetVirtualTimeDomain()); - EXPECT_EQ(scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST) + EXPECT_EQ( + scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::FRAME_TIMER) + ->GetTimeDomain(), + scheduler_->GetVirtualTimeDomain()); + EXPECT_EQ(scheduler_ + ->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::UNTHROTTLED)) ->GetTimeDomain(), scheduler_->GetVirtualTimeDomain()); - EXPECT_EQ( - scheduler_->NewUnthrottledTaskQueue(MainThreadTaskQueue::QueueType::TEST) - ->GetTimeDomain(), - scheduler_->GetVirtualTimeDomain()); + EXPECT_EQ(scheduler_ + ->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::TEST)) + ->GetTimeDomain(), + scheduler_->GetVirtualTimeDomain()); } TEST_F(RendererSchedulerImplTest, DisableVirtualTimeForTesting) { scheduler_->EnableVirtualTime(); - scoped_refptr<TaskQueue> timer_tq = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); - scoped_refptr<TaskQueue> unthrottled_tq = - scheduler_->NewUnthrottledTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); + scoped_refptr<MainThreadTaskQueue> unthrottled_tq = + scheduler_->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::UNTHROTTLED)); scheduler_->DisableVirtualTimeForTesting(); EXPECT_EQ(scheduler_->DefaultTaskQueue()->GetTimeDomain(),
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc index 80f44e3..ea861d3c 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc
@@ -89,8 +89,8 @@ mock_task_runner_, base::MakeUnique<TestTimeSource>(clock_.get())); scheduler_.reset(new RendererSchedulerImpl(delegate_)); task_queue_throttler_ = scheduler_->task_queue_throttler(); - timer_queue_ = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); + timer_queue_ = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); } void TearDown() override { @@ -744,8 +744,8 @@ TwoQueuesTimeBudgetThrottling) { std::vector<base::TimeTicks> run_times; - scoped_refptr<TaskQueue> second_queue = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<TaskQueue> second_queue = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); CPUTimeBudgetPool* pool = task_queue_throttler_->CreateCPUTimeBudgetPool("test"); @@ -1069,8 +1069,9 @@ DisabledQueueThenEnabledQueue) { std::vector<base::TimeTicks> run_times; - scoped_refptr<TaskQueue> second_queue = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<MainThreadTaskQueue> second_queue = + scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); task_queue_throttler_->IncreaseThrottleRefCount(timer_queue_.get()); task_queue_throttler_->IncreaseThrottleRefCount(second_queue.get()); @@ -1105,8 +1106,8 @@ TEST_P(TaskQueueThrottlerWithAutoAdvancingTimeTest, TwoBudgetPools) { std::vector<base::TimeTicks> run_times; - scoped_refptr<TaskQueue> second_queue = - scheduler_->NewTimerTaskQueue(MainThreadTaskQueue::QueueType::TEST); + scoped_refptr<TaskQueue> second_queue = scheduler_->NewTimerTaskQueue( + MainThreadTaskQueue::QueueType::FRAME_TIMER); CPUTimeBudgetPool* pool1 = task_queue_throttler_->CreateCPUTimeBudgetPool("test");
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc index 35341de..d6264b7 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc
@@ -187,8 +187,11 @@ if (!suspendable_web_task_runner_) { // TODO(altimin): Split FRAME_UNTHROTTLED into FRAME_UNTHROTTLED and // FRAME_UNSUSPENDED. - suspendable_task_queue_ = renderer_scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED); + suspendable_task_queue_ = renderer_scheduler_->NewTaskQueue( + MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED) + .SetCanBeBlocked(true) + .SetCanBeSuspended(true)); suspendable_task_queue_->SetBlameContext(blame_context_); suspendable_web_task_runner_ = WebTaskRunnerImpl::Create(suspendable_task_queue_); @@ -202,8 +205,9 @@ RefPtr<blink::WebTaskRunner> WebFrameSchedulerImpl::UnthrottledTaskRunner() { DCHECK(parent_web_view_scheduler_); if (!unthrottled_web_task_runner_) { - unthrottled_task_queue_ = renderer_scheduler_->NewUnthrottledTaskQueue( - MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED); + unthrottled_task_queue_ = renderer_scheduler_->NewTaskQueue( + MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED)); unthrottled_task_queue_->SetBlameContext(blame_context_); unthrottled_web_task_runner_ = WebTaskRunnerImpl::Create(unthrottled_task_queue_); @@ -215,9 +219,10 @@ WebFrameSchedulerImpl::UnthrottledButBlockableTaskRunner() { DCHECK(parent_web_view_scheduler_); if (!unthrottled_but_blockable_web_task_runner_) { - unthrottled_but_blockable_task_queue_ = - renderer_scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED); + unthrottled_but_blockable_task_queue_ = renderer_scheduler_->NewTaskQueue( + MainThreadTaskQueue::QueueCreationParams( + MainThreadTaskQueue::QueueType::FRAME_UNTHROTTLED) + .SetCanBeBlocked(true)); unthrottled_but_blockable_task_queue_->SetBlameContext(blame_context_); unthrottled_but_blockable_web_task_runner_ = WebTaskRunnerImpl::Create(unthrottled_but_blockable_task_queue_);
diff --git a/third_party/WebKit/Source/platform/wtf/StackUtil.cpp b/third_party/WebKit/Source/platform/wtf/StackUtil.cpp index c547b58e..13c3f907 100644 --- a/third_party/WebKit/Source/platform/wtf/StackUtil.cpp +++ b/third_party/WebKit/Source/platform/wtf/StackUtil.cpp
@@ -28,7 +28,8 @@ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size // correctly for the main thread. -#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) +#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) // pthread_getattr_np() can fail if the thread is not invoked by // pthread_create() (e.g., the main thread of webkit_unit_tests). // If so, a conservative size estimate is returned. @@ -95,7 +96,8 @@ } void* GetStackStart() { -#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) +#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) pthread_attr_t attr; int error; #if defined(OS_FREEBSD)
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn index 2f3f1cf..e46c9516 100644 --- a/third_party/WebKit/public/BUILD.gn +++ b/third_party/WebKit/public/BUILD.gn
@@ -833,8 +833,16 @@ export_header_blink = "third_party/WebKit/public/platform/WebCommon.h" } +# Note that this intentionally depends on the generator target of the mojom +# target instead of the mojom target itself directly. This is to ensure that the +# dependencies are header-only and don't link against any bindings code. group("generate_mojo_bindings") { deps = [ + # It's important to generate both the regular and the Blink variants. The + # Blink public API exposes a number of Mojo interfaces; omitting it will + # cause non-deterministic compile failures for code that uses the regular + # variant of the generated files. + ":mojo_bindings__generator", ":mojo_bindings_blink__generator", ":offscreen_canvas_mojo_bindings_blink__generator", ]
diff --git a/third_party/WebKit/public/platform/DEPS b/third_party/WebKit/public/platform/DEPS index 3835db5b..8ae4b91 100644 --- a/third_party/WebKit/public/platform/DEPS +++ b/third_party/WebKit/public/platform/DEPS
@@ -11,7 +11,7 @@ "-bindings", "+cc", "-cc/blink", - "+components/viz/common/quads", + "+components/viz/common", "-core", "-modules", # TODO(toyoshim): Remove following media/midi direct dependency in public
diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h index 542b7ecc..4198c6f 100644 --- a/third_party/WebKit/public/platform/Platform.h +++ b/third_party/WebKit/public/platform/Platform.h
@@ -59,7 +59,7 @@ #include "WebVector.h" #include "base/metrics/user_metrics_action.h" #include "base/time/time.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "components/viz/common/quads/shared_bitmap.h" #include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/message_pipe.h" @@ -322,7 +322,7 @@ virtual uint32_t GetUniqueIdForProcess() { return 0; } // Returns a unique FrameSinkID for the current renderer process - virtual cc::FrameSinkId GenerateFrameSinkId() { return cc::FrameSinkId(); } + virtual viz::FrameSinkId GenerateFrameSinkId() { return viz::FrameSinkId(); } // Message Ports -------------------------------------------------------
diff --git a/third_party/WebKit/public/platform/WebLayerTreeView.h b/third_party/WebKit/public/platform/WebLayerTreeView.h index dd162199..8145a786 100644 --- a/third_party/WebKit/public/platform/WebLayerTreeView.h +++ b/third_party/WebKit/public/platform/WebLayerTreeView.h
@@ -35,7 +35,7 @@ #include "WebImageLayer.h" #include "WebSize.h" #include "base/callback.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkRefCnt.h" @@ -170,7 +170,7 @@ virtual void SetHaveScrollEventHandlers(bool) {} // Returns the FrameSinkId of the widget associated with this layer tree view. - virtual cc::FrameSinkId GetFrameSinkId() { return cc::FrameSinkId(); } + virtual viz::FrameSinkId GetFrameSinkId() { return viz::FrameSinkId(); } // Debugging / dangerous ---------------------------------------------
diff --git a/third_party/WebKit/public/web/WebDeviceEmulationParams.h b/third_party/WebKit/public/web/WebDeviceEmulationParams.h index 411b139..e49bd7d 100644 --- a/third_party/WebKit/public/web/WebDeviceEmulationParams.h +++ b/third_party/WebKit/public/web/WebDeviceEmulationParams.h
@@ -44,6 +44,13 @@ // Scale of emulated view inside available space, not in fit to view mode. float scale; + // Forced viewport offset for screenshots during emulation, (-1, -1) for + // disabled. + WebFloatPoint viewport_offset; + + // Viewport scale for screenshots during emulation, 0 for current. + float viewport_scale; + // Optional screen orientation type, with WebScreenOrientationUndefined // value meaning no emulation necessary. WebScreenOrientationType screen_orientation_type; @@ -56,6 +63,8 @@ device_scale_factor(0), fit_to_view(false), scale(1), + viewport_offset(-1, -1), + viewport_scale(0), screen_orientation_type(kWebScreenOrientationUndefined), screen_orientation_angle(0) {} }; @@ -68,7 +77,9 @@ a.view_size == b.view_size && a.fit_to_view == b.fit_to_view && a.offset == b.offset && a.scale == b.scale && a.screen_orientation_type == b.screen_orientation_type && - a.screen_orientation_angle == b.screen_orientation_angle; + a.screen_orientation_angle == b.screen_orientation_angle && + a.viewport_offset == b.viewport_offset && + a.viewport_scale == b.viewport_scale; } inline bool operator!=(const WebDeviceEmulationParams& a,
diff --git a/third_party/boringssl/BUILD.generated.gni b/third_party/boringssl/BUILD.generated.gni index 38b6830..60fcf0b 100644 --- a/third_party/boringssl/BUILD.generated.gni +++ b/third_party/boringssl/BUILD.generated.gni
@@ -360,6 +360,7 @@ "src/ssl/ssl_session.c", "src/ssl/ssl_stat.c", "src/ssl/ssl_transcript.c", + "src/ssl/ssl_versions.c", "src/ssl/ssl_x509.c", "src/ssl/t1_enc.c", "src/ssl/t1_lib.c",
diff --git a/third_party/boringssl/BUILD.generated_tests.gni b/third_party/boringssl/BUILD.generated_tests.gni index efc91b4..62dd6153 100644 --- a/third_party/boringssl/BUILD.generated_tests.gni +++ b/third_party/boringssl/BUILD.generated_tests.gni
@@ -12,6 +12,7 @@ "src/crypto/test/test_util.cc", "src/crypto/test/test_util.h", "src/ssl/test/async_bio.h", + "src/ssl/test/fuzzer.h", "src/ssl/test/packeted_bio.h", "src/ssl/test/test_config.h", ] @@ -62,55 +63,11 @@ "src/crypto/test/gtest_main.cc", "src/crypto/thread_test.cc", "src/crypto/x509/x509_test.cc", + "src/crypto/x509v3/tab_test.cc", + "src/crypto/x509v3/v3name_test.cc", ] ssl_test_sources = [ "src/crypto/test/gtest_main.cc", "src/ssl/ssl_test.cc", ] - -template("create_tests") { - executable("boringssl_example_mul") { - sources = [ - "src/crypto/fipsmodule/ec/example_mul.c", - ] - sources += test_support_sources - if (defined(invoker.configs_exclude)) { - configs -= invoker.configs_exclude - } - configs += invoker.configs - deps = invoker.deps + [ "//build/config:exe_and_shlib_deps" ] - } - - executable("boringssl_tab_test") { - sources = [ - "src/crypto/x509v3/tab_test.c", - ] - sources += test_support_sources - if (defined(invoker.configs_exclude)) { - configs -= invoker.configs_exclude - } - configs += invoker.configs - deps = invoker.deps + [ "//build/config:exe_and_shlib_deps" ] - } - - executable("boringssl_v3name_test") { - sources = [ - "src/crypto/x509v3/v3name_test.c", - ] - sources += test_support_sources - if (defined(invoker.configs_exclude)) { - configs -= invoker.configs_exclude - } - configs += invoker.configs - deps = invoker.deps + [ "//build/config:exe_and_shlib_deps" ] - } - - group(target_name) { - deps = [ - ":boringssl_example_mul", - ":boringssl_tab_test", - ":boringssl_v3name_test", - ] - } -}
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn index 6ac0125..9839ef9 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn
@@ -194,33 +194,6 @@ } if (build_with_chromium) { - create_tests("boringssl_tests") { - configs_exclude = [ "//build/config/compiler:chromium_code" ] - configs = [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - deps = [ - ":boringssl", - "//build/win:default_exe_manifest", - ] - } - - if (!is_ios) { - test("boringssl_unittests") { - deps = [ - ":boringssl_tests", - "//base", - "//base/test:run_all_unittests", - "//base/test:test_support", - "//testing/gtest", - ] - sources = [ - "boringssl_unittest.cc", - ] - } - } - config("fuzzer_config") { visibility = [ ":*" ] # Only targets in this file can depend on this. defines = [
diff --git a/third_party/boringssl/DEPS b/third_party/boringssl/DEPS index d2e250f..4e147a1 100644 --- a/third_party/boringssl/DEPS +++ b/third_party/boringssl/DEPS
@@ -1,8 +1,4 @@ specific_include_rules = { - "boringssl_unittest\.cc": [ - "+base", - "+testing", - ], "gtest_main_chromium\.cc": [ "+base", "+testing",
diff --git a/third_party/boringssl/boringssl_unittest.cc b/third_party/boringssl/boringssl_unittest.cc deleted file mode 100644 index 934ef73..0000000 --- a/third_party/boringssl/boringssl_unittest.cc +++ /dev/null
@@ -1,113 +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. - -#include <memory> -#include <string> - -#include "base/base_paths.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/logging.h" -#include "base/json/json_reader.h" -#include "base/path_service.h" -#include "base/process/launch.h" -#include "base/strings/string_util.h" -#include "base/values.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -void TestProcess(const std::string& name, - const std::vector<base::CommandLine::StringType>& args) { - base::FilePath exe_dir; - ASSERT_TRUE(PathService::Get(base::DIR_EXE, &exe_dir)); - base::FilePath test_binary = exe_dir.AppendASCII("boringssl_" + name); - base::CommandLine cmd(test_binary); - - for (size_t i = 0; i < args.size(); ++i) { - cmd.AppendArgNative(args[i]); - } - - std::string output; - EXPECT_TRUE(base::GetAppOutput(cmd, &output)); - // Account for Windows line endings. - base::ReplaceSubstringsAfterOffset(&output, 0, "\r\n", "\n"); - - const bool ok = output.size() >= 5 && - memcmp("PASS\n", &output[output.size() - 5], 5) == 0 && - (output.size() == 5 || output[output.size() - 6] == '\n'); - - EXPECT_TRUE(ok) << output; -} - -bool BoringSSLPath(base::FilePath* result) { - if (!PathService::Get(base::DIR_SOURCE_ROOT, result)) - return false; - - *result = result->Append(FILE_PATH_LITERAL("third_party")); - *result = result->Append(FILE_PATH_LITERAL("boringssl")); - *result = result->Append(FILE_PATH_LITERAL("src")); - return true; -} - -} // anonymous namespace - -// Runs all the tests specified in BoringSSL's all_tests.json file to ensure -// that BoringSSL, as built with Chromium's settings, is functional. -TEST(BoringSSL, UnitTests) { - base::FilePath boringssl_path; - ASSERT_TRUE(BoringSSLPath(&boringssl_path)); - - std::string data; - ASSERT_TRUE( - base::ReadFileToString(boringssl_path.Append(FILE_PATH_LITERAL("util")) - .Append(FILE_PATH_LITERAL("all_tests.json")), - &data)); - - std::unique_ptr<base::Value> value = base::JSONReader::Read(data); - ASSERT_TRUE(value); - - base::ListValue* tests; - ASSERT_TRUE(value->GetAsList(&tests)); - - for (size_t i = 0; i < tests->GetSize(); i++) { - SCOPED_TRACE(i); - base::ListValue* test; - ASSERT_TRUE(tests->GetList(i, &test)); - ASSERT_FALSE(test->empty()); - - std::string name; - ASSERT_TRUE(test->GetString(0, &name)); - - // Skip libdecrepit tests. Chromium does not build libdecrepit. - if (base::StartsWith(name, "decrepit/", base::CompareCase::SENSITIVE)) - continue; - - // Skip the GTest tests. This wrapper will be removed once all the tests are - // converted to GTest. See https://crbug.com/boringssl/129 - if (base::EndsWith(name, "crypto_test", base::CompareCase::SENSITIVE) || - base::EndsWith(name, "ssl_test", base::CompareCase::SENSITIVE)) { - continue; - } - - name = name.substr(name.find_last_of('/') + 1); - SCOPED_TRACE(name); - - std::vector<base::CommandLine::StringType> args; - for (size_t j = 1; j < test->GetSize(); j++) { - base::CommandLine::StringType arg; - ASSERT_TRUE(test->GetString(j, &arg)); - - // If the argument contains a /, assume it is a file path. - if (arg.find('/') != base::CommandLine::StringType::npos) { - arg = boringssl_path.Append(arg).value(); - } - - args.push_back(arg); - } - - TestProcess(name, args); - } -}
diff --git a/third_party/boringssl/crypto_test_data.cc b/third_party/boringssl/crypto_test_data.cc index b2dd0cb6..dd1dbd6 100644 --- a/third_party/boringssl/crypto_test_data.cc +++ b/third_party/boringssl/crypto_test_data.cc
@@ -2424,20 +2424,20 @@ "# Public key algorithm tests\n\n# Keys used for PKEY operations.\n\n# RSA 2048 bit key.\nPrivateKey = RSA-2048\nType = RSA\nInput = 308204bc020100300d06092a864886f70d0101010500048204a6308204a20201000282010100cd0081ea7b2ae1ea06d59f7c73d9ffb94a09615c2e4ba7c636cef08dd3533ec3185525b015c769b99a77d6725bf9c3532a9b6e5f6627d5fb85160768d3dda9cbd35974511717dc3d309d2fc47ee41f97e32adb7f9dd864a1c4767a666ecd71bc1aacf5e7517f4b38594fea9b05e42d5ada9912008013e45316a4d9bb8ed086b88d28758bacaf922d46a868b485d239c9baeb0e2b64592710f42b2d1ea0a4b4802c0becab328f8a68b0073bdb546feea9809d2849912b390c1532bc7e29c7658f8175fae46f34332ff87bcab3e40649b98577869da0ea718353f0722754886913648760d122be676e0fc483dd20ffc31bda96a31966c9aa2e75ad03de47e1c44f02030100010282010060297ac7991b167a06d6b24758b8cbe208beb9b2d9ec9738bd80f90a2e35005dd7ce292d9e29ba885bd316fef1f20913bc0ac90d6b0808b2414d82104441d8624a33ce0233c8f780a48b375aff02d76712228a702484db3f9ebecccfbbee1709dba182800d949e9e4216e0bff3558388f8bd90da373a1d82743ec3fbdd1427fd16825a657a316912e8695365117ca2f845c909405fcac55f895fc15d20386c26ee78c9e99075029a178a6c1e4cf0c200e8a9cfb27e9d156f86e6c2adc22b1a84a1cd5ca5b2790875d79407c84b352395cb81cc3fed5bb043b69ede0c07204550025cee8c5f440170b6120bb48e0f747bcd8f522110850df043c428dfd187053102818100f6f961b47cbc035d3aedebc7de850a956b65ecdb9cf60764063f15aa48553c58d972fe6675056e35ddfdc37bf3b9f2f622ee271337256849c9bef2176fe8f7c3f8bb91ba374dd53baf3dec814d2bdec10c1fdc88cdd16876f26b1edfa3f094197edf4d42ff1fb2971103b898ca859c427287086a842ab410bb69cf2d35af6be302818100d47e724a7ff41048b270c2524a4101878b73159bb73d3dbc187b220e635b3534f96e243a184d93f860b6bfbb6b71c1ed9a1e1f458583023c301e96a692c1a08b53d0ec9ca910100d80451e3b7dc6a01bac4aecef8df798846bc235a08cbba2cf4c06804cc11219e95608c714e3f1430d491fadbba32a5751a04f97745834c9a502818021f2452bb9b95dfd028c914bf799f1ca77e89a95d50d3c16d384f8455f8bd7af9eb3dfa3d591d9842def235f7630a8e48c088ff6642e101794535a933e1e976fa8509fc728b2da0c4a1a08d7fcf37abaae1ff3001aca1dc1bbb05d9dffbaa1a09f7fb1eef38237d9ebccc722b9338436dde7119112798c26809c1a8dec4320610281801f7510aa62c2d8de4a3c53282781f41e02d0e8b402ae78432e449c48110161a11403f02d01880a8dcc938152d79721a4711a607ac4471ebf964810f95be47a45e60499e29f4c9773c83773404f606637728c2d0351bb03c326c8bb73a721e7fa5440ea2172bba1465fcc30dcb0d9f89930e815aa1f7f9729a857e00e0338dd590281804d1f0d756fe77e01099a652f50a88b7b685dc5bf00981d5d2376fd0c6fe29cd5b638734479305a73ad3c1599d39eae3bae035fbd6fed07c28de705933879a06e48e6a603686ed8e2560a5f6af1f2c24faf4aa960e382186f15eedce9a2491ae730680dd4cf778b70faa86826ab3223477cc91377b19a6d5a2eaea219760beed5\n\n# The public half of the same key encoded as a SubjectPublicKeyInfo.\nPublicKey = RSA-2048-SPKI\nType = RSA\nInput = 30820122300d06092a864886f70d01010105000382010f003082010a0282010100cd0081ea7b2ae1ea06d59f7c73d9ffb94a09615c2e4ba7c636cef08dd3533ec3185525b015c769b99a77d6725bf9c3532a9b6e5f6627d5fb85160768d3dda9cbd35974511717dc3d309d2fc47ee41f97e32adb7f9dd864a1c4767a666ecd71bc1aacf5e7517f4b38594fea9b05e42d5ada9912008013e45316a4d9bb8ed086b88d28758bacaf922d46a868b485d239c9baeb0e2b64592710f42b2d1ea0a4b4802c0becab328f8a68b0073bdb546feea9809d2849912b390c1532bc7e29c7658f8175fae46f34332ff87bcab3e40649b98577869da0ea718353f0722754886913648760d122be676e0fc483dd20ffc31bda96a31966c9aa2e75ad03de47e1c44f0203010001\n\n# The same key but with missing parameters rather than a NULL.\nPublicKey = RSA-2048-SPKI-Invalid\nInput = 30820120300b06092a864886f70d0101010382010f003082010a0282010100cd0081ea7b2ae1ea06d59f7c73d9ffb94a09615c2e4ba7c636cef08dd3533ec3185525b015c769b99a77d6725bf9c3532a9b6e5f6627d5fb85160768d3dda9cbd35974511717dc3d309d2fc47ee41f97e32adb7f9dd864a1c4767a666ecd71bc1aacf5e7517f4b38594fea9b05e42d5ada9912008013e45316a4d9bb8ed086b88d28758bacaf922d46a868b485d239c9baeb0e2b64592710f42b2d1ea0a4b4802c0becab328f8a68b0073bdb546feea9809d2849912b390c1532bc7e29c7658f8175fae46f34332ff87bcab3e40649b98577869da0ea718353f0722754886913648760d122be676e0fc483dd20ffc31bda96a31966c9aa2e75ad03de47e1c44f0203010001\nError = DECODE_ERROR\n\n# The same key but with an incorrectly-encoded length prefix.\nPublicKey = RSA-2048-SPKI-Invalid2\nInput = 3083000122300d06092a864886f70d01010105000382010f003082010a0282010100cd0081ea7b2ae1ea06d59f7c73d9ffb94a09615c2e4ba7c636cef08dd3533ec3185525b015c769b99a77d6725bf9c3532a9b6e5f6627d5fb85160768d3dda9cbd35974511717dc3d309d2fc47ee41f97e32adb7f9dd864a1c4767a666ecd71bc1aacf5e7517f4b38594fea9b05e42d5ada9912008013e45316a4d9bb8ed086b88d28758bacaf922d46a868b485d239c9baeb0e2b64592710f42b2d1ea0a4b4802c0becab328f8a68b0073bdb546feea9809d2849912b390c1532bc7e29c7658f8175fae46f34332ff87bcab3e40649b98577869da0ea718353f0722754886913648760d122be676e0fc483dd20ffc31bda96a31966c9aa2e75ad03de47e1c44f0203010001\nError = DECODE_ERROR\n\n# RSA 512 bit key.\nPrivateKey = RSA-512\nType = RSA\nInput = 30820154020100300d06092a864886f70d01010105000482013e3082013a020100024100dd20403d976a38c9d79152d87b5c8e9f05033eadd7b7de709bf5b0c4a5182a97d18483526b02362b992e154a9f37faa396ca2685cdab8fec09877ebe705f4dd70203010001024055bebcca655d7e39de8a6eaa9d636db682161907064039544755c53eeb99ec618c03a210dbc61471eaba10c5c365c9726d6b7a96f54d455f7d168d49367270e1022100f21a05d9fd6817301ce49ce10448f9bdd44f5ef5b7557cd7d83155db46382ae7022100e9d1f7157783db2feab1936954ddc4e83aa365695868144cda1be6813b61d791022100d6001eb0040920860ce41fafdf23ca6dfbdf74e6e9f98cf3164cf5c16f9e727d02206f6f73f4b52b10517be6f9bc5f87fa0a3bb817e2e711636b651f9af1c85d4f21022063eff2e57f5b4ca20342cfe793e25526624e3692f192461f9e1ce7f13f2d72c8\n\n# RSA 515 bit key.\nPrivateKey = RSA-515\nType = RSA\nInput = 30820157020100300d06092a864886f70d0101010500048201413082013d0201000241054fa166e205e658bbe8a2dc35311c0c2b75b7e4569fd9642c8bae809279271fc824f26baa1166ea46298ca63379ea76adbada2b61e5066820a35beaec1aca227f020301000102410266c972be0d30e53ac2acb1aa13b4bd0401cccf212452a66b4615f7e943831f67b4ca48560582d0ca886044aaaaf87945252a848c1947944186e6eb83969bf91102210309e631761842cc8a2ccfd372c20a9cba21de1a199c30ab440bc6b51079f4e825022101bf715c1db432627ca7c29a293b9210f2eff1e92d12f306ebaa5334f8ee03dcd30221018ac58a765f2b8f37d434081fe5ff92b81735ead2f263f4968ccf63d61fbe3d0d0221015b247a1159a2d5a25d0db049593c6405f77f3a278c521d066e290c2a2d8fb59d0221026224aa31fd95c14d24fd03b8a195bba4cc88df7c37f5370a5ab19f882f1404d6\n\n# EC P-256 key\nPrivateKey = P-256\nType = EC\nInput = 308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104208a872fb62893c4d1ffc5b9f0f91758069f8352e08fa05a49f8db926cb5728725a144034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\n\n# The same key as above with the optional public key omitted.\nPrivateKey = P-256-MissingPublic\nType = EC\nInput = 3041020100301306072a8648ce3d020106082a8648ce3d0301070427302502010104208a872fb62893c4d1ffc5b9f0f91758069f8352e08fa05a49f8db926cb5728725\n\n# The same key as above with redundant parameters.\nPrivateKey = P-256-ExtraParameters\nType = EC\nInput = 308193020100301306072a8648ce3d020106082a8648ce3d0301070479307702010104208a872fb62893c4d1ffc5b9f0f91758069f8352e08fa05a49f8db926cb5728725a00a06082a8648ce3d030107a144034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\n# The key re-encodes with the parameters removed.\nOutput = 308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104208a872fb62893c4d1ffc5b9f0f91758069f8352e08fa05a49f8db926cb5728725a144034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\n\n# The same key, but with the redundant parameters in the ECPrivateKey mismatched.\nPrivateKey = P-256-BadInnerParameters\nInput = 308190020100301306072a8648ce3d020106082a8648ce3d0301070476307402010104208a872fb62893c4d1ffc5b9f0f91758069f8352e08fa05a49f8db926cb5728725a00706052b81040022a144034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\nError = GROUP_MISMATCH\n\n# The public half of the same key encoded as a PublicKey.\nPublicKey = P-256-SPKI\nType = EC\nInput = 3059301306072a8648ce3d020106082a8648ce3d030107034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cd", "b664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\n\n# The same as above, but with the curve explicitly spelled out.\nPublicKey = P-256-SPKI\nInput = 3082014b3082010306072a8648ce3d02013081f7020101302c06072a8648ce3d0101022100ffffffff00000001000000000000000000000000ffffffffffffffffffffffff305b0420ffffffff00000001000000000000000000000000fffffffffffffffffffffffc04205ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b031500c49d360886e704936a6678e1139d26b7819f7e900441046b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2964fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5022100ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551020101034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\nError = DECODE_ERROR\n\n# The same as above, but with trailing data after the curve name.\nPublicKey = P-256-SPKI\nInput = 305b301506072a8648ce3d020106082a8648ce3d0301070500034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9\nError = DECODE_ERROR\n\n# A DSA private key.\nPrivateKey = DSA-1024\nType = DSA\nInput = 308202650201003082023906072a8648ce3804013082022c02820101009e12fab3de12213501dd82aa10ca2d101d2d4ebfef4d2a3f8daa0fe0cedad8d6af85616aa2f3252c0a2b5a6db09e6f14900e0ddb8311876dd8f9669525f99ed65949e184d5064793271169a228680b95ec12f59a8e20b21f2b58eb2a2012d35bde2ee351822fe8f32d0a330565dcce5c672b7259c14b2433d0b5b2ca2b2db0ab626e8f13f47fe0345d904e7294bb038e9ce21a9e580b83356278706cfe768436c69de149ccff98b4aab8cb4f6385c9f102ce59346eaeef27e0ad222d53d6e89cc8cde5776dd00057b03f2d88ab3cedbafd7b585f0b7f7835e17a3728bbf25ea62572f245dc111f3ce39cb6ffacc31b0a2790e7bde90224ea9b09315362af3d2b022100f381dcf53ebf724f8b2e5ca82c010fb4b5eda9358d0fd88ed278589488b54fc3028201000c402a725dcc3a62e02bf4cf43cd17f4a493591220223669cf4193edab423ad08dfb552e308a6a57a5ffbc7cd0fb2087f81f8df0cb08ab2133287d2b6968714a94f633c940845a48a3e16708dde761cc6a8eab2d84db21b6ea5b07681493cc9c31fbc368b243f6ddf8c932a8b4038f44e7b15ca876344a147859f2b43b39458668ad5e0a1a9a669546dd2812e3b3617a0aef99d58e3bb4cc87fd94225e01d2dcc469a77268146c51918f18e8b4d70aa1f0c7623bcc52cf3731d38641b2d2830b7eecb2f09552ff137d046e494e7f33c3590002b16d1b97d936fda28f90c3ed3ca35338168ac16f77c3c57adc2e8f7c6c2256e41a5f65450590dbb5bcf06d66610423022100b0c768702743bc51242993a971a52889795444f7c6452203d0ce84fe6117d46e\n\n# A DSA public key.\nPublicKey = DSA-1024-SPKI\nType = DSA\nInput = 308201b73082012c06072a8648ce3804013082011f02818100b3429b8b128c9079f9b72e86857e98d265e5d91661ed8b5f4cc56e5eed1e571da30186983a9dd76297eab73ee13a1db841f8800d04a7cab478af6cde2ea4a2868531af169a24858c6268efa39ceb7ed0d4227eb5bbb01124a2a5a26038c7bcfb8cc827f68f5202345166e4718596799b65c9def82828ce44e62e38e41a0d24b1021500c5a56c81ddd87f47e676546c56d05706421624cf0281810094de40d27314fe929e47ff9b1ac65cfc73ef38c4d381c890be6217b15039ae18190e6b421af8c0bda35a5cfd050f58ae2644adce83e68c8e5ba11729df56bbb21e227a60b816cc033fa799a38fe1ba5b4aa1801b6f841ce3df99feb3b4fb96950c960af13fa2ce920aabc12dd24ad2044a35063ea0e25f67f560f4cfbdc5598303818400028180258c30ebbb7f34fdc873ce679f6cea373c7886d75d4421b90920db034daedd292c64d8edd8cdbdd7f3ad23d74cfa2135247d0cef6ecf2e14f99e19d22a8c1266bd8fb8719c0e5667c716c45c7adbdabe548085bdad2dfee636f8d52fd6adb2193df6c4f0520fbd171b91882e0e4f321f8250ffecf4dbea00e114427d3ef96c1a\n\n# The same key as above, but without the parameters.\nPublicKey = DSA-1024-SPKI-No-Params\nType = DSA\nInput = 308192300906072a8648ce38040103818400028180258c30ebbb7f34fdc873ce679f6cea373c7886d75d4421b90920db034daedd292c64d8edd8cdbdd7f3ad23d74cfa2135247d0cef6ecf2e14f99e19d22a8c1266bd8fb8719c0e5667c716c45c7adbdabe548085bdad2dfee636f8d52fd6adb2193df6c4f0520fbd171b91882e0e4f321f8250ffecf4dbea00e114427d3ef96c1a\n\n# Private keys from RFC 8032.\nPrivateKey = Ed25519\nType = Ed25519\nInput = 302e020100300506032b6570042204209d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60\n\nPrivateKey = Ed25519-2\nType = Ed25519\nInput = 302e020100300506032b6570042204204ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb\n\nPrivateKey = Ed25519-3\nType = Ed25519\nInput = 302e020100300506032b657004220420c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7\n\nPrivateKey = Ed25519-4\nType = Ed25519\nInput = 302e020100300506032b657004220420f5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5\n\nPrivateKey = Ed25519-5\nType = Ed25519\nInput = 302e020100300506032b657004220420833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42\n\n# Public keys from RFC 8032.\nPublicKey = Ed25519-SPKI\nType = Ed25519\nInput = 302a300506032b6570032100d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a\n\nPublicKey = Ed25519-SPKI-2\nType = Ed25519\nInput = 302a300506032b65700321003d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c\n\nPublicKey = Ed25519-SPKI-3\nType = Ed25519\nInput = 302a300506032b6570032100fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025\n\nPublicKey = Ed25519-SPKI-4\nType = Ed25519\nInput = 302a300506032b6570032100278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e\n\nPublicKey = Ed25519-SPKI-5\nType = Ed25519\nInput = 302a300506032b6570032100ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf\n\n# The first key, private and public, with invalid NULL parameters.\nPrivateKey = Ed25519-NULL\nInput = 3030020100300706032b65700500042204209d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60\nError = DECODE_ERROR\n\nPublicKey = Ed25519-SPKI-NULL\nInput = 302c300706032b65700500032100d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a\nError = DECODE_ERROR\n\n# Sample public key from draft-ietf-curdle-pkix-04.\nPublicKey = Ed25519-SPKI-Spec\nType = Ed25519\nInput = 302a300506032b657003210019bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1\n\n# Sample private key from draft-ietf-curdle-pkix-04.\nPrivateKey = Ed25519-Spec\nType = Ed25519\nInput = 302e020100300506032b657004220420d4ee72dbf913584ad5b6d8f1f769f8ad3afe7c28cbf1d4fbe097a88f44755842\n\n\n# RSA tests\n\nSign = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\n\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\n\nVerify = RSA-2048-SPKI\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\n\n# Digest too long\nSign = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF12345\"\nError = INVALID_MESSAGE_LENGTH\n\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF12345\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db1", "5dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\nError = INVALID_MESSAGE_LENGTH\n\n# Digest too short\nSign = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF123\"\nError = INVALID_MESSAGE_LENGTH\n\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF123\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\nError = INVALID_MESSAGE_LENGTH\n\n# Digest too large for key.\nSign = RSA-512\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nError = DIGEST_TOO_BIG_FOR_RSA_KEY\n\n# Mismatched digest\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1233\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad\nError = BAD_SIGNATURE\n\n# Corrupted signature\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1233\"\nOutput = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ae\nError = BLOCK_TYPE_IS_NOT_01\n\n# parameter missing (NOTE: this differs from upstream)\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3ec3fc29eb6e122bd7aa361cd09fe1bcbe85311096a7b9e4799cedfb2351ce0ab7fe4e75b4f6b37f67edd9c60c800f9ab941c0c157d7d880ca9de40c951d60fd293ae220d4bc510b1572d6e85a1bbbd8605b52e05f1c64fafdae59a1c2fbed214b7844d0134619de62851d5a0522e32e556e5950f3f97b8150e3f0dffee612c924201c27cd9bc8b423a71533380c276d3d59fcba35a2e80a1a192ec266a6c2255012cd86a349fe90a542b355fa3355b04da6cdf1df77f0e7bd44a90e880e1760266d233e465226f5db1c68857847d82072861ee266ddfc2e596845b77e1803274a579835ab5e4975d81d20b7df9cec7795489e4a2bdb8c1cf6a6b359945ac92c\nError = BAD_SIGNATURE\n\n# embedded digest too long\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = afec9a0d5330a08f54283bb4a9d4e7e7e70fc1342336c4c766fba713f66970151c6e27413c48c33864ea45a0238787004f338ed3e21b53b0fe9c1151c42c388cbc7cba5a06b706c407a5b48324fbe994dc7afc3a19fb3d2841e66222596c14cd72a0f0a7455a019d8eb554f59c0183f9552b75aa96fee8bf935945e079ca283d2bd3534a86f11351f6d6181fbf433e5b01a6d1422145c7a72214d3aacdd5d3af12b2d6bf6438f9f9a64010d8aeed801c87f0859412b236150b86a545f7239be022f4a7ad246b59df87514294cb4a4c7c5a997ee53c66054d9f38ca4e76c1f7af83c30f737ef70f83a45aebe18238ddb95e1998814ca4fc72388f1533147c169d\nError = BAD_SIGNATURE\n\n# embedded digest too short\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = afec9a0d5330a08f54283bb4a9d4e7e7e70fc1342336c4c766fba713f66970151c6e27413c48c33864ea45a0238787004f338ed3e21b53b0fe9c1151c42c388cbc7cba5a06b706c407a5b48324fbe994dc7afc3a19fb3d2841e66222596c14cd72a0f0a7455a019d8eb554f59c0183f9552b75aa96fee8bf935945e079ca283d2bd3534a86f11351f6d6181fbf433e5b01a6d1422145c7a72214d3aacdd5d3af12b2d6bf6438f9f9a64010d8aeed801c87f0859412b236150b86a545f7239be022f4a7ad246b59df87514294cb4a4c7c5a997ee53c66054d9f38ca4e76c1f7af83c30f737ef70f83a45aebe18238ddb95e1998814ca4fc72388f1533147c169d\nError = BAD_SIGNATURE\n\n# Garbage after DigestInfo\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 9ee34872d4271a7d8808af0a4052a145a6d6a8437d00da3ed14428c7f087cd39f4d43334c41af63e7fa1ba363fee7bcef401d9d36a662abbab55ce89a696e1be0dfa19a5d09ca617dd488787b6048baaefeb29bc8688b2fe3882de2b77c905b5a8b56cf9616041e5ec934ba6de863efe93acc4eef783fe7f72a00fa65d6093ed32bf98ce527e62ccb1d56317f4be18b7e0f55d7c36617d2d0678a306e3350956b662ac15df45215dd8f6b314babb9788e6c272fa461e4c9b512a11a4b92bc77c3a4c95c903fccb238794eca5c750477bf56ea6ee6a167367d881b485ae3889e7c489af8fdf38e0c0f2aed780831182e34abedd43c39281b290774bf35cc25274\nError = BAD_SIGNATURE\n\n# invalid tag for parameter\nVerify = RSA-2048\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 49525db4d44c755e560cba980b1d85ea604b0e077fcadd4ba44072a3487bbddb835016200a7d8739cce2dc3223d9c20cbdd25059ab02277f1f21318efd18e21038ec89aa9d40680987129e8b41ba33bceb86518bdf47268b921cce2037acabca6575d832499538d6f40cdba0d40bd7f4d8ea6ca6e2eec87f294efc971407857f5d7db09f6a7b31e301f571c6d82a5e3d08d2bb3a36e673d28b910f5bec57f0fcc4d968fd7c94d0b9226dec17f5192ad8b42bcab6f26e1bea1fdc3b958199acb00f14ebcb2a352f3afcedd4c09000128a603bbeb9696dea13040445253972d46237a25c7845e3b464e6984c2348ea1f1210a9ff0b00d2d72b50db00c009bb39f9\nError = BAD_SIGNATURE\n\n\n# RSA-PSS tests.\n\n# Zero salt length makes the output deterministic\nSign = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n\n# Verify of above signature\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n\n# Auto-detected salt length\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n\n# Wrong digest\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"00000000000000000000000000000000\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13", - "848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = BAD_SIGNATURE\n\n# Digest too short\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDE\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = INVALID_MESSAGE_LENGTH\n\n# Digest too long\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF0\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = INVALID_MESSAGE_LENGTH\n\n# Wrong salt length\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 2\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = SLEN_CHECK_FAILED\n\n# Wrong salt length using implicit hash length\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = -1\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = SLEN_CHECK_FAILED\n\n# Wrong MGF1 digest, SHA-1\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nMGF1Digest = SHA1\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n# If SHA-1, this input happens to succeed recovering a salt length, but it does\n# not match.\nError = SLEN_CHECK_FAILED\n\n# Wrong MGF1 digest, SHA-384\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nMGF1Digest = SHA384\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n# If SHA-384, this input happens fail to recover the salt length altogether.\nError = SLEN_RECOVERY_FAILED\n\n# The salt length is too large for the modulus (signing).\nSign = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 223\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE_FOR_KEY_SIZE\n\n# The salt length is too large for the modulus (verifying).\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 223\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = DATA_TOO_LARGE\n\n# The hash is too large for the modulus (signing).\nSign = RSA-512\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE_FOR_KEY_SIZE\n\nSign = RSA-512\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE_FOR_KEY_SIZE\n\n# The hash is too large for the modulus (verifying).\nVerify = RSA-512\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nOutput = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nError = DATA_TOO_LARGE\n\nVerify = RSA-512\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nOutput = 457001d9ca50a93385fc5ec721c9dbbe7a0f2e9e4a2f846a30a8811dde66347b83901c7492039243537c7a667fafffd69049bcbd36afd0010d9b425e2d8785c1\nError = DATA_TOO_LARGE\n\n# Sample RSA-515 signature.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 00c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\n\n# The above, but with too few leading zeros.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\nError = DATA_LEN_NOT_EQUAL_TO_MOD_LEN\n\n# The above, but with too many leading zeros.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 0000c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\nError = DATA_LEN_NOT_EQUAL_TO_MOD_LEN\n\n# The above with an invalid leading byte. The top few bits of EM are required to\n# be cleared.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 007f803c832a2090aea04013d9fa9c1630732a1625232826d235f0950f7050d3fb0eb06ef9ea8b260fad68e1165a2d770a8c7fc7a8aaa68620b021fc19c97e0041\nError = FIRST_OCTET_INVALID\n\n# The above with an invalid trailing byte.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 03e68555035891eb08d96c0967db22328cd892ad2856d88516ecb946bfdba732bb029b5c0dfa2119ed7349", - "897d2324e95e86d91d0c4afc82700a36db8933abbf58\nError = LAST_OCTET_INVALID\n\n# Non-zero salt length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 32\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n# Non-zero salt length, wrong salt length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 31\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\nError = SLEN_CHECK_FAILED\n\n# Non-zero salt length, match hash length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = -1\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n# Non-zero salt length, auto-detected.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n\n# RSA decrypt\n\nDecrypt = RSA-2048\nInput = 550af55a2904e7b9762352f8fb7fa235a9cb053aacb2d5fcb8ca48453cb2ee3619746c701abf2d4cc67003471a187900b05aa812bd25ed05c675dfc8c97a24a7bf49bd6214992cad766d05a9a2b57b74f26a737e0237b8b76c45f1f226a836d7cfbc75ba999bdbe48dbc09227aa46c88f21dccba7840141ad5a5d71fd122e6bd6ac3e564780dfe623fc1ca9b995a6037bf0bbd43b205a84ac5444f34202c05ce9113087176432476576de6ffff9a52ea57c08be3ec2f49676cb8e12f762ac71fa3c321e00ac988910c85ff52f93825666ce0d40ffaa0592078919d4493f46d95ccf76364c6d57760dd0b64805f9afc76a2365a5575ca301d5103f0ea76cb9a78\nOutput = \"Hello World\"\n\n# Corrupted ciphertext\nDecrypt = RSA-2048\nInput = 550af55a2904e7b9762352f8fb7fa235a9cb053aacb2d5fcb8ca48453cb2ee3619746c701abf2d4cc67003471a187900b05aa812bd25ed05c675dfc8c97a24a7bf49bd6214992cad766d05a9a2b57b74f26a737e0237b8b76c45f1f226a836d7cfbc75ba999bdbe48dbc09227aa46c88f21dccba7840141ad5a5d71fd122e6bd6ac3e564780dfe623fc1ca9b995a6037bf0bbd43b205a84ac5444f34202c05ce9113087176432476576de6ffff9a52ea57c08be3ec2f49676cb8e12f762ac71fa3c321e00ac988910c85ff52f93825666ce0d40ffaa0592078919d4493f46d95ccf76364c6d57760dd0b64805f9afc76a2365a5575ca301d5103f0ea76cb9a79\nError = PKCS_DECODING_ERROR\n\n# OAEP padding\nDecrypt = RSA-2048\nRSAPadding = OAEP\nInput = 458708dfbd42a1297ce7a9c86c7087ab80b1754810929b89c5107ca55368587686986fce94d86cc1595b3fb736223a656ec0f34d18ba1cc5665593610f56c58e26b272d584f3d983a5c91085700755aebd921fb280bba3eda7046ec07b43e7298e52d59edc92be4639a8ce08b2f85976ecf6d98cc469eeb9d5d8e2a32ea8a6626edafe1038b3df455668a9f3c77cad8b92fb872e00058c3d2a7ede1a1f03fc5622084ae04d9d24f6bf0995c58d35b93b699b9763595e123f2ab0863cc9229eb290e2ede7715c7a8f39e0b9a3e2e1b56ebb62f1cbfbb5986fb212ebd785b83d01d968b11d1756c7337f70c1f1a63bff03608e24f3a2fd44e67f832a8701c5d5af\nOutput = \"Hello World\"\n\n# OAEP padding, corrupted ciphertext\nDecrypt = RSA-2048\nRSAPadding = OAEP\nInput = 458708dfbd42a1297ce7a9c86c7087ab80b1754810929b89c5107ca55368587686986fce94d86cc1595b3fb736223a656ec0f34d18ba1cc5665593610f56c58e26b272d584f3d983a5c91085700755aebd921fb280bba3eda7046ec07b43e7298e52d59edc92be4639a8ce08b2f85976ecf6d98cc469eeb9d5d8e2a32ea8a6626edafe1038b3df455668a9f3c77cad8b92fb872e00058c3d2a7ede1a1f03fc5622084ae04d9d24f6bf0995c58d35b93b699b9763595e123f2ab0863cc9229eb290e2ede7715c7a8f39e0b9a3e2e1b56ebb62f1cbfbb5986fb212ebd785b83d01d968b11d1756c7337f70c1f1a63bff03608e24f3a2fd44e67f832a8701c5d5ac\nError = OAEP_DECODING_ERROR\n\n\n# EC tests\n\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\n\nVerify = P-256-SPKI\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\n\n# Digest too long\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF12345\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Digest too short\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF123\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Digest invalid\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1235\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Invalid signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec7\nError = BAD_SIGNATURE\n\n# Garbage after signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec800\nError = BAD_SIGNATURE\n\n# BER signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3080022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec80000\nError = BAD_SIGNATURE\n\n\n# Additional RSA-PSS and RSA-OAEP tests converted from\n# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip\n\nPublicKey = RSA-PSS-1\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818100a56e4a0e701017589a5187dc7ea841d156f2ec0e36ad52a44dfeb1e61f7ad991d8c51056ffedb162b4c0f283a12a88a394dff526ab7291cbb307ceabfce0b1dfd5cd9508096d5b2b8b6df5d671ef6377c0921cb23c270a70e2598e6ff89d19f105acc2d3f0cb35f29280e1386b6f64c4ef22e1e1f20d0ce8cffb2249bd9a21370203010001\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = cd8b6538cb8e8de566b68bd067569dbf1ee2718e\nOutput = 9074308fb598e9701b2294388e52f971faac2b60a5145af185df5287b5ed2887e57ce7fd44dc8634e407c8e0e4360bc226f3ec227f9d9e54638e8d31f5051215df6ebb9c2f9579aa77598a38f914b5b9c1bd83c4e2f9f382a0d0aa3542ffee65984a601bc69eb28deb27dca12c82c2d4c3f66cd500f1ff2b994d8a4e30cbb33c\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e35befc17a1d160b9ce35fbd8eb16e7ee491d3fd\nOutput = 3ef7f46e831bf92b32274142a585ffcefbdca7b32a", - "e90d10fb0f0c729984f04ef29a9df0780775ce43739b97838390db0a5505e63de927028d9d29b219ca2c4517832558a55d694a6d25b9dab66003c4cccd907802193be5170d26147d37b93590241be51c25055f47ef62752cfbe21418fafe98c22c4d4d47724fdb5669e843\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0652ec67bcee30f9d2699122b91c19abdba89f91\nOutput = 666026fba71bd3e7cf13157cc2c51a8e4aa684af9778f91849f34335d141c00154c4197621f9624a675b5abc22ee7d5baaffaae1c9baca2cc373b3f33e78e6143c395a91aa7faca664eb733afd14d8827259d99a7550faca501ef2b04e33c23aa51f4b9e8282efdb728cc0ab09405a91607c6369961bc8270d2d4f39fce612b1\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 39c21c4cceda9c1adf839c744e1212a6437575ec\nOutput = 4609793b23e9d09362dc21bb47da0b4f3a7622649a47d464019b9aeafe53359c178c91cd58ba6bcb78be0346a7bc637f4b873d4bab38ee661f199634c547a1ad8442e03da015b136e543f7ab07c0c13e4225b8de8cce25d4f6eb8400f81f7e1833b7ee6e334d370964ca79fdb872b4d75223b5eeb08101591fb532d155a6de87\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 36dae913b77bd17cae6e7b09453d24544cebb33c\nOutput = 1d2aad221ca4d31ddf13509239019398e3d14b32dc34dc5af4aeaea3c095af73479cf0a45e5629635a53a018377615b16cb9b13b3e09d671eb71e387b8545c5960da5a64776e768e82b2c93583bf104c3fdb23512b7b4e89f633dd0063a530db4524b01c3f384c09310e315a79dcd3d684022a7f31c865a664e316978b759fad\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 45eef191f4f79c31fe5d2ede7e5098994e929d2d\nOutput = 2a34f6125e1f6b0bf971e84fbd41c632be8f2c2ace7de8b6926e31ff93e9af987fbc06e51e9be14f5198f91f3f953bd67da60a9df59764c3dc0fe08e1cbef0b75f868d10ad3fba749fef59fb6dac46a0d6e504369331586f58e4628f39aa278982543bc0eeb537dc61958019b394fb273f215858a0a01ac4d650b955c67f4c58\n\nPublicKey = RSA-PSS-2\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818101d40c1bcf97a68ae7cdbd8a7bf3e34fa19dcca4ef75a47454375f94514d88fed006fb829f8419ff87d6315da68a1ff3a0938e9abb3464011c303ad99199cf0c7c7a8b477dce829e8844f625b115e5e9c4a59cf8f8113b6834336a2fd2689b472cbb5e5cabe674350c59b6c17e176874fb42f8fc3d176a017edc61fd326c4b33c90203010001\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 5c81a3e2a658246628cd0ee8b00bb4c012bc9739\nOutput = 014c5ba5338328ccc6e7a90bf1c0ab3fd606ff4796d3c12e4b639ed9136a5fec6c16d8884bdd99cfdc521456b0742b736868cf90de099adb8d5ffd1deff39ba4007ab746cefdb22d7df0e225f54627dc65466131721b90af445363a8358b9f607642f78fab0ab0f43b7168d64bae70d8827848d8ef1e421c5754ddf42c2589b5b3\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 27f71611446aa6eabf037f7dedeede3203244991\nOutput = 010991656cca182b7f29d2dbc007e7ae0fec158eb6759cb9c45c5ff87c7635dd46d150882f4de1e9ae65e7f7d9018f6836954a47c0a81a8a6b6f83f2944d6081b1aa7c759b254b2c34b691da67cc0226e20b2f18b42212761dcd4b908a62b371b5918c5742af4b537e296917674fb914194761621cc19a41f6fb953fbcbb649dea\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 03ecc2c33e93f05fc7224fcc0d461356cb897217\nOutput = 007f0030018f53cdc71f23d03659fde54d4241f758a750b42f185f87578520c30742afd84359b6e6e8d3ed959dc6fe486bedc8e2cf001f63a7abe16256a1b84df0d249fc05d3194ce5f0912742dbbf80dd174f6c51f6bad7f16cf3364eba095a06267dc3793803ac7526aebe0a475d38b8c2247ab51c4898df7047dc6adf52c6c4\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 246c727b4b9494849dddb068d582e179ac20999c\nOutput = 009cd2f4edbe23e12346ae8c76dd9ad3230a62076141f16c152ba18513a48ef6f010e0e37fd3df10a1ec629a0cb5a3b5d2893007298c30936a95903b6ba85555d9ec3673a06108fd62a2fda56d1ce2e85c4db6b24a81ca3b496c36d4fd06eb7c9166d8e94877c42bea622b3bfe9251fdc21d8d5371badad78a488214796335b40b\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e8617ca3ea66ce6a58ede2d11af8c3ba8a6ba912\nOutput = 00ec430824931ebd3baa43034dae98ba646b8c36013d1671c3cf1cf8260c374b19f8e1cc8d965012405e7e9bf7378612dfcc85fce12cda11f950bd0ba8876740436c1d2595a64a1b32efcfb74a21c873b3cc33aaf4e3dc3953de67f0674c0453b4fd9f604406d441b816098cb106fe3472bc251f815f59db2e4378a3addc181ecf\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7a6fdc1a4e434ecbc35d657ad49a2f4fafd43bc8\nOutput = 00475b1648f814a8dc0abdc37b5527f543b666bb6e39d30e5b49d3b876dccc58eac14e32a2d55c2616014456ad2f246fc8e3d560da3ddf379a1c0bd200f10221df078c219a151bc8d4ec9d2fc2564467811014ef15d8ea01c2ebbff8c2c8efab38096e55fcbe3285c7aa558851254faffa92c1c72b78758663ef4582843139d7a6\n\nPublicKey = RSA-PSS-3\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818102f246ef451ed3eebb9a310200cc25859c048e4be798302991112eb68ce6db674e280da21feded1ae74880ca522b18db249385012827c515f0e466a1ffa691d98170574e9d0eadb087586ca48933da3cc953d95bd0ed50de10ddcb6736107d6c831c7f663e833ca4c097e700ce0fb945f88fb85fe8e5a773172565b914a471a4430203010001\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3552be69dd74bdc56d2cf8c38ef7bafe269040fe\nOutput = 0088b135fb1794b6b96c4a3e678197f8cac52b64b2fe907d6f27de761124964a99a01a882740ecfaed6c01a47464bb05182313c01338a8cd097214cd68ca103bd57d3bc9e816213e61d784f182467abf8a01cf253e99a156eaa8e3e1f90e3c6e4e3aa2d83ed0345b89fafc9c26077c14b6ac51454fa26e446e3a2f153b2b16797f\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 609143ff7240e55c062aba8b9e4426a781919bc9\nOutput = 02a5f0a858a0864a4f65017a7d69454f3f973a2999839b7bbc48bf78641169179556f595fa41f6ff18e286c2783079bc0910ee9cc34f49ba681124f923dfa88f426141a368a5f5a930c628c2c3c200e18a7644721a0cbec6dd3f6279bde3e8f2be5e2d4ee56f97e7ceaf33054be7042bd91a63bb09f897bd41e81197dee99b11af\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0afd22f879a9cda7c584f4135f8f1c961db114c0\nOutput = 0244bcd1c8c16955736c803be401272e18cb990811b14f72db964124d5fa760649cbb57afb8755dbb62bf51f466cf23a0a1607576e983d778fceffa92df7548aea8ea4ecad2c29dd9f95bc07fe91ecf8bee255bfe8762fd7690aa9bfa4fa0849ef728c2c42c4532364522df2ab7f9f8a03b63f7a499175828668f5ef5a29e3802c\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 405dd56d395ef0f01b555c48f748cc32b210650b\nOutput = 0196f12a005b98129c8df13c4cb16f8aa887d3c40d96df3a88e7532ef39cd992f273abc370bc1be6f097cfebbf0118fd9ef4b927155f3df22b904d90702d1f7ba7a52bed8b8942f412cd7bd676c9d18e170391dcd345c06a730964b3f30bcce0bb20ba106f9ab0eeb39cf8a6607f75c0347f0af79f16afa081d2c92d1ee6f836b8\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = a2c313b0440c8a0c47233b87f0a160c61af3eae7\nOutput = 021eca3ab4892264ec22411a752d92221076d4e01c0e6f0dde9afd26ba5acf6d739ef987545d16683e5674c9e70f1de649d7e61d48d0caeb4fb4d8b24fba84a6e3108fee7d0705973266ac524b4ad280f7ae17dc59d96d3351586b5a3bdb895d1e1f7820ac6135d8753480998382ba32b7349559608c38745290a85ef4e9f9bd83\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f1bf6ca7b4bbdbb6bf20a4bf55728725d177154a\nOutput = 012fafec862f56e9e92f60ab0c77824f4299a0ca734ed26e0644d5d222c7f0bde03964f8e70a5cb65ed44e44d56ae0edf1ff86ca032cc5dd4404dbb76ab854586c44eed8336d08d457ce6c03693b45c0f1efef93624b95b8ec169c616d20e5538ebc0b6737a6f82b4bc0570924fc6b35759a3348426279f8b3d7744e2d222426ce\n\nPublicKey = RSA-PSS-4\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181054adb7886447efe6f57e0368f06cf52b0a3370760d161cef126b91be7f89c421b62a6ec1da3c311d75ed50e0ab5fff3fd338acc3aa8a4e77ee26369acb81ba900fa83f5300cf9bb6c53ad1dc8a178b815db4235a9a9da0c06de4e615ea1277ce559e9c108de58c14a81aa77f5a6f8d1335494498848c8b95940740be7bf7c37050203010001\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f8b0abf70fec0bca74f0accbc24f75e6e90d3bfd\nOutput = 0323d5b7bf20ba4539289ae452ae4297080feff4518423ff4811a817837e7d82f1836cdfab54514ff0887bddeebf40bf99b047abc3ecfa6a37a3ef00f4a0c4a88aae0904b745c846c4107e8797723e8ac810d9e3d95dfa30ff4966f4d75d13768d20857f2b1406f264cfe75e27d7652f4b5ed3575f28a702f8c4ed9cf9b2d44948\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 04a10944bfe11ab801e77889f3fd3d7f4ff0b629\nOutput = 049d0185845a264d28feb1e69edaec090609e8e46d93abb38371ce51f4aa65a599bdaaa81d24fba66a08a116cb644f3f1e653d95c89db8bbd5daac2709c8984000178410a7c6aa8667ddc38c741f710ec8665aa9052be929d4e3b16782c1662114c5414bb0353455c392fc28f3db59054b5f365c49e1d156f876ee10cb4fd70598\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ba01243db223eb97fb86d746c3148adaaa0ca344\nOutput = 03fbc410a2ced59500fb99f9e2af2781ada74e13145624602782e2994813eefca0519ecd253", - "b855fb626a90d771eae028b0c47a199cbd9f8e3269734af4163599090713a3fa910fa0960652721432b971036a7181a2bc0cab43b0b598bc6217461d7db305ff7e954c5b5bb231c39e791af6bcfa76b147b081321f72641482a2aad\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 934bb0d38d6836daec9de82a9648d4593da67cd2\nOutput = 0486644bc66bf75d28335a6179b10851f43f09bded9fac1af33252bb9953ba4298cd6466b27539a70adaa3f89b3db3c74ab635d122f4ee7ce557a61e59b82ffb786630e5f9db53c77d9a0c12fab5958d4c2ce7daa807cd89ba2cc7fcd02ff470ca67b229fcce814c852c73cc93bea35be68459ce478e9d4655d121c8472f371d4f\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ec35d81abd1cceac425a935758b683465c8bd879\nOutput = 022a80045353904cb30cbb542d7d4990421a6eec16a8029a8422adfd22d6aff8c4cc0294af110a0c067ec86a7d364134459bb1ae8ff836d5a8a2579840996b320b19f13a13fad378d931a65625dae2739f0c53670b35d9d3cbac08e733e4ec2b83af4b9196d63e7c4ff1ddeae2a122791a125bfea8deb0de8ccf1f4ffaf6e6fb0a\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 72ce251d17b04dd3970d6ff1fbe3624899e9e941\nOutput = 00938dcb6d583046065f69c78da7a1f1757066a7fa75125a9d2929f0b79a60b627b082f11f5b196f28eb9daa6f21c05e5140f6aef1737d2023075c05ecf04a028c686a2ab3e7d5a0664f295ce12995e890908b6ad21f0839eb65b70393a7b5afd9871de0caa0cedec5b819626756209d13ab1e7bb9546a26ff37e9a51af9fd562e\n\nPublicKey = RSA-PSS-5\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d003081890281810d10f661f29940f5ed39aa260966deb47843679d2b6fb25b3de370f3ac7c19916391fd25fb527ebfa6a4b4df45a1759d996c4bb4ebd18828c44fc52d0191871740525f47a4b0cc8da325ed8aa676b0d0f626e0a77f07692170acac8082f42faa7dc7cd123e730e31a87985204cabcbe6670d43a2dd2b2ddef5e05392fc213bc5070203010001\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = d98b7061943510bc3dd9162f7169aabdbdcd0222\nOutput = 0ba373f76e0921b70a8fbfe622f0bf77b28a3db98e361051c3d7cb92ad0452915a4de9c01722f6823eeb6adf7e0ca8290f5de3e549890ac2a3c5950ab217ba58590894952de96f8df111b2575215da6c161590c745be612476ee578ed384ab33e3ece97481a252f5c79a98b5532ae00cdd62f2ecc0cd1baefe80d80b962193ec1d\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7ae8e699f754988f4fd645e463302e49a2552072\nOutput = 08180de825e4b8b014a32da8ba761555921204f2f90d5f24b712908ff84f3e220ad17997c0dd6e706630ba3e84add4d5e7ab004e58074b549709565d43ad9e97b5a7a1a29e85b9f90f4aafcdf58321de8c5974ef9abf2d526f33c0f2f82e95d158ea6b81f1736db8d1af3d6ac6a83b32d18bae0ff1b2fe27de4c76ed8c7980a34e\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 8d46c7c05534c1ba2cc7624500d48a4531604bff\nOutput = 05e0fdbdf6f756ef733185ccfa8ced2eb6d029d9d56e35561b5db8e70257ee6fd019d2f0bbf669fe9b9821e78df6d41e31608d58280f318ee34f559941c8df13287574bac000b7e58dc4f414ba49fb127f9d0f8936638c76e85356c994f79750f7fa3cf4fd482df75e3fb9978cd061f7abb17572e6e63e0bde12cbdcf18c68b979\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ee3de96783fd0a157c8b20bf5566124124dcfe65\nOutput = 0bc989853bc2ea86873271ce183a923ab65e8a53100e6df5d87a24c4194eb797813ee2a187c097dd872d591da60c568605dd7e742d5af4e33b11678ccb63903204a3d080b0902c89aba8868f009c0f1c0cb85810bbdd29121abb8471ff2d39e49fd92d56c655c8e037ad18fafbdc92c95863f7f61ea9efa28fea401369d19daea1\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 1204df0b03c2724e2709c23fc71789a21b00ae4c\nOutput = 0aefa943b698b9609edf898ad22744ac28dc239497cea369cbbd84f65c95c0ad776b594740164b59a739c6ff7c2f07c7c077a86d95238fe51e1fcf33574a4ae0684b42a3f6bf677d91820ca89874467b2c23add77969c80717430d0efc1d3695892ce855cb7f7011630f4df26def8ddf36fc23905f57fa6243a485c770d5681fcd\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 29926bc3280c841f601acd0d6f17ea38023eddbc\nOutput = 02802dccfa8dfaf5279bf0b4a29ba1b157611faeaaf419b8919d15941900c1339e7e92e6fae562c53e6cc8e84104b110bce03ad18525e3c49a0eadad5d3f28f244a8ed89edbafbb686277cfa8ae909714d6b28f4bf8e293aa04c41efe7c0a81266d5c061e2575be032aa464674ff71626219bd74cc45f0e7ed4e3ff96eee758e8f\n\nPublicKey = RSA-PSS-6\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181164ca31cff609f3a0e7101b039f2e4fe6dd37519ab98598d179e174996598071f47d3a04559158d7be373cf1aa53f0aa6ef09039e5678c2a4c63900514c8c4f8aaed5de12a5f10b09c311af8c0ffb5b7a297f2efc63b8d6b0510931f0b98e48bf5fc6ec4e7b8db1ffaeb08c38e02adb8f03a48229c99e969431f61cb8c4dc698d10203010001\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ab464e8cb65ae5fdea47a53fa84b234d6bfd52f6\nOutput = 04c0cfacec04e5badbece159a5a1103f69b3f32ba593cb4cc4b1b7ab455916a96a27cd2678ea0f46ba37f7fc9c86325f29733b389f1d97f43e7201c0f348fc45fe42892335362eee018b5b161f2f9393031225c713012a576bc88e23052489868d9010cbf033ecc568e8bc152bdc59d560e41291915d28565208e22aeec9ef85d1\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 92d0bcae82b641f578f040f5151be8eda6d42299\nOutput = 0a2314250cf52b6e4e908de5b35646bcaa24361da8160fb0f9257590ab3ace42b0dc3e77ad2db7c203a20bd952fbb56b1567046ecfaa933d7b1000c3de9ff05b7d989ba46fd43bc4c2d0a3986b7ffa13471d37eb5b47d64707bd290cfd6a9f393ad08ec1e3bd71bb5792615035cdaf2d8929aed3be098379377e777ce79aaa4773\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3569bd8fd2e28f2443375efa94f186f6911ffc2b\nOutput = 086df6b500098c120f24ff8423f727d9c61a5c9007d3b6a31ce7cf8f3cbec1a26bb20e2bd4a046793299e03e37a21b40194fb045f90b18bf20a47992ccd799cf9c059c299c0526854954aade8a6ad9d97ec91a1145383f42468b231f4d72f23706d9853c3fa43ce8ace8bfe7484987a1ec6a16c8daf81f7c8bf42774707a9df456\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7abbb7b42de335730a0b641f1e314b6950b84f98\nOutput = 0b5b11ad549863ffa9c51a14a1106c2a72cc8b646e5c7262509786105a984776534ca9b54c1cc64bf2d5a44fd7e8a69db699d5ea52087a4748fd2abc1afed1e5d6f7c89025530bdaa2213d7e030fa55df6f34bcf1ce46d2edf4e3ae4f3b01891a068c9e3a44bbc43133edad6ecb9f35400c4252a5762d65744b99cb9f4c559329f\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 55b7eb27be7a787a59eb7e5fac468db8917a7725\nOutput = 02d71fa9b53e4654fefb7f08385cf6b0ae3a817942ebf66c35ac67f0b069952a3ce9c7e1f1b02e480a9500836de5d64cdb7ecde04542f7a79988787e24c2ba05f5fd482c023ed5c30e04839dc44bed2a3a3a4fee01113c891a47d32eb8025c28cb050b5cdb576c70fe76ef523405c08417faf350b037a43c379339fcb18d3a356b\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = de2fa0367ef49083ff89b9905d3fd646fcc12c38\nOutput = 0a40a16e2fe2b38d1df90546167cf9469c9e3c3681a3442b4b2c2f581deb385ce99fc6188bb02a841d56e76d301891e24560550fcc2a26b55f4ccb26d837d350a154bcaca8392d98fa67959e9727b78cad03269f56968fc56b68bd679926d83cc9cb215550645ccda31c760ff35888943d2d8a1d351e81e5d07b86182e751081ef\n\nPublicKey = RSA-PSS-7\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818137c9da4a66c8c408b8da27d0c9d79f8ccb1eafc1d2fe48746d940b7c4ef5dee18ad12647cefaa0c4b3188b221c515386759b93f02024b25ab9242f8357d8f3fd49640ee5e643eaf6c64deefa7089727c8ff03993333915c6ef21bf5975b6e50d118b51008ec33e9f01a0a545a10a836a43ddbca9d8b5c5d3548022d7064ea29ab30203010001\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 8be4afbdd76bd8d142c5f4f46dba771ee5d6d29d\nOutput = 187f390723c8902591f0154bae6d4ecbffe067f0e8b795476ea4f4d51ccc810520bb3ca9bca7d0b1f2ea8a17d873fa27570acd642e3808561cb9e975ccfd80b23dc5771cdb3306a5f23159dacbd3aa2db93d46d766e09ed15d900ad897a8d274dc26b47e994a27e97e2268a766533ae4b5e42a2fcaf755c1c4794b294c60555823\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 402140dc605b2f5c5ec0d15bce9f9ba8857fe117\nOutput = 10fd89768a60a67788abb5856a787c8561f3edcf9a83e898f7dc87ab8cce79429b43e56906941a886194f137e591fe7c339555361fbbe1f24feb2d4bcdb80601f3096bc9132deea60ae13082f44f9ad41cd628936a4d51176e42fc59cb76db815ce5ab4db99a104aafea68f5d330329ebf258d4ede16064bd1d00393d5e1570eb8\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3e885205892ff2b6b37c2c4eb486c4bf2f9e7f20\nOutput = 2b31fde99859b977aa09586d8e274662b25a2a640640b457f594051cb1e7f7a911865455242926cf88fe80dfa3a75ba9689844a11e634a82b075afbd69c12a0df9d25f84ad4945df3dc8fe90c3cefdf26e95f0534304b5bdba20d3e5640a2ebfb898aac35ae40f26fce5563c2f9f24f3042af76f3c7072d687bbfb959a88460af1\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 1fc2201d0c442a4736cd8b2cd00c959c47a3bf42\nOutput = 32c7ca38ff26949a15000c4ba04b2b13b35a3810e568184d7ecabaa166b7ffabddf2b6cf4ba07124923790f2e5b1a5be04", - "0aea36fe132ec130e1f10567982d17ac3e89b8d26c3094034e762d2e031264f01170beecb3d1439e05846f25458367a7d9c02060444672671e64e877864559ca19b2074d588a281b5804d23772fbbe19\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e4351b66819e5a31501f89acc7faf57030e9aac5\nOutput = 07eb651d75f1b52bc263b2e198336e99fbebc4f332049a922a10815607ee2d989db3a4495b7dccd38f58a211fb7e193171a3d891132437ebca44f318b280509e52b5fa98fcce8205d9697c8ee4b7ff59d4c59c79038a1970bd2a0d451ecdc5ef11d9979c9d35f8c70a6163717607890d586a7c6dc01c79f86a8f28e85235f8c2f1\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 49f6cc58365e514e1a3f301f4de16f9fb5347ff2\nOutput = 18da3cdcfe79bfb77fd9c32f377ad399146f0a8e810620233271a6e3ed3248903f5cdc92dc79b55d3e11615aa056a795853792a3998c349ca5c457e8ca7d29d796aa24f83491709befcfb1510ea513c92829a3f00b104f655634f320752e130ec0ccf6754ff893db302932bb025eb60e87822598fc619e0e981737a9a4c4152d33\n\nPublicKey = RSA-PSS-8\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181495370a1fb18543c16d3631e3163255df62be6eee890d5f25509e4f778a8ea6fbbbcdf85dff64e0d972003ab3681fbba6dd41fd541829b2e582de9f2a4a4e0a2d0900bef4753db3cee0ee06c7dfae8b1d53b5953218f9cceea695b08668edeaadced9463b1d790d5ebf27e9115b46cad4d9a2b8efab0561b0810344739ada0733f0203010001\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = a1dd230d8ead860199b6277c2ecfe3d95f6d9160\nOutput = 0262ac254bfa77f3c1aca22c5179f8f040422b3c5bafd40a8f21cf0fa5a667ccd5993d42dbafb409c520e25fce2b1ee1e716577f1efa17f3da28052f40f0419b23106d7845aaf01125b698e7a4dfe92d3967bb00c4d0d35ba3552ab9a8b3eef07c7fecdbc5424ac4db1e20cb37d0b2744769940ea907e17fbbca673b20522380c5\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f6e68e53c602c5c65fa67b5aa6d786e5524b12ab\nOutput = 2707b9ad5115c58c94e932e8ec0a280f56339e44a1b58d4ddcff2f312e5f34dcfe39e89c6a94dcee86dbbdae5b79ba4e0819a9e7bfd9d982e7ee6c86ee68396e8b3a14c9c8f34b178eb741f9d3f121109bf5c8172fada2e768f9ea1433032c004a8aa07eb990000a48dc94c8bac8aabe2b09b1aa46c0a2aa0e12f63fbba775ba7e\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = d6f9fcd3ae27f32bb2c7c93536782eba52af1f76\nOutput = 2ad20509d78cf26d1b6c406146086e4b0c91a91c2bd164c87b966b8faa42aa0ca446022323ba4b1a1b89706d7f4c3be57d7b69702d168ab5955ee290356b8c4a29ed467d547ec23cbadf286ccb5863c6679da467fc9324a151c7ec55aac6db4084f82726825cfe1aa421bc64049fb42f23148f9c25b2dc300437c38d428aa75f96\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7ff2a53ce2e2d900d468e498f230a5f5dd0020de\nOutput = 1e24e6e58628e5175044a9eb6d837d48af1260b0520e87327de7897ee4d5b9f0df0be3e09ed4dea8c1454ff3423bb08e1793245a9df8bf6ab3968c8eddc3b5328571c77f091cc578576912dfebd164b9de5454fe0be1c1f6385b328360ce67ec7a05f6e30eb45c17c48ac70041d2cab67f0a2ae7aafdcc8d245ea3442a6300ccc7\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 4eb309f7022ba0b03bb78601b12931ec7c1be8d3\nOutput = 33341ba3576a130a50e2a5cf8679224388d5693f5accc235ac95add68e5eb1eec31666d0ca7a1cda6f70a1aa762c05752a51950cdb8af3c5379f18cfe6b5bc55a4648226a15e912ef19ad77adeea911d67cfefd69ba43fa4119135ff642117ba985a7e0100325e9519f1ca6a9216bda055b5785015291125e90dcd07a2ca9673ee\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 65033bc2f67d6aba7d526acb873b8d9241e5e4d9\nOutput = 1ed1d848fb1edb44129bd9b354795af97a069a7a00d0151048593e0c72c3517ff9ff2a41d0cb5a0ac860d736a199704f7cb6a53986a88bbd8abcc0076a2ce847880031525d449da2ac78356374c536e343faa7cba42a5aaa6506087791c06a8e989335aed19bfab2d5e67e27fb0c2875af896c21b6e8e7309d04e4f6727e69463e\n\nPublicKey = RSA-PSS-9\nType = RSA\nInput = 3081df300d06092a864886f70d01010105000381cd003081c90281c100e6bd692ac96645790403fdd0f5beb8b9bf92ed10007fc365046419dd06c05c5b5b2f48ecf989e4ce269109979cbb40b4a0ad24d22483d1ee315ad4ccb1534268352691c524f6dd8e6c29d224cf246973aec86c5bf6b1401a850d1b9ad1bb8cbcec47b06f0f8c7f45d3fc8f319299c5433ddbc2b3053b47ded2ecd4a4caefd614833dc8bb622f317ed076b8057fe8de3f84480ad5e83e4a61904a4f248fb397027357e1d30e463139815c6fd4fd5ac5b8172a45230ecb6318a04f1455d84e5a8b0203010001\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 2715a49b8b0012cd7aee84c116446e6dfe3faec0\nOutput = 586107226c3ce013a7c8f04d1a6a2959bb4b8e205ba43a27b50f124111bc35ef589b039f5932187cb696d7d9a32c0c38300a5cdda4834b62d2eb240af33f79d13dfbf095bf599e0d9686948c1964747b67e89c9aba5cd85016236f566cc5802cb13ead51bc7ca6bef3b94dcbdbb1d570469771df0e00b1a8a06777472d2316279edae86474668d4e1efff95f1de61c6020da32ae92bbf16520fef3cf4d88f61121f24bbd9fe91b59caf1235b2a93ff81fc403addf4ebdea84934a9cdaf8e1a9e\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 2dac956d53964748ac364d06595827c6b4f143cd\nOutput = 80b6d643255209f0a456763897ac9ed259d459b49c2887e5882ecb4434cfd66dd7e1699375381e51cd7f554f2c271704b399d42b4be2540a0eca61951f55267f7c2878c122842dadb28b01bd5f8c025f7e228418a673c03d6bc0c736d0a29546bd67f786d9d692ccea778d71d98c2063b7a71092187a4d35af108111d83e83eae46c46aa34277e06044589903788f1d5e7cee25fb485e92949118814d6f2c3ee361489016f327fb5bc517eb50470bffa1afa5f4ce9aa0ce5b8ee19bf5501b958\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 28d98c46cccafbd3bc04e72f967a54bd3ea12298\nOutput = 484408f3898cd5f53483f80819efbf2708c34d27a8b2a6fae8b322f9240237f981817aca1846f1084daa6d7c0795f6e5bf1af59c38e1858437ce1f7ec419b98c8736adf6dd9a00b1806d2bd3ad0a73775e05f52dfef3a59ab4b08143f0df05cd1ad9d04bececa6daa4a2129803e200cbc77787caf4c1d0663a6c5987b605952019782caf2ec1426d68fb94ed1d4be816a7ed081b77e6ab330b3ffc073820fecde3727fcbe295ee61a050a343658637c3fd659cfb63736de32d9f90d3c2f63eca\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0866d2ff5a79f25ef668cd6f31b42dee421e4c0e\nOutput = 84ebeb481be59845b46468bafb471c0112e02b235d84b5d911cbd1926ee5074ae0424495cb20e82308b8ebb65f419a03fb40e72b78981d88aad143053685172c97b29c8b7bf0ae73b5b2263c403da0ed2f80ff7450af7828eb8b86f0028bd2a8b176a4d228cccea18394f238b09ff758cc00bc04301152355742f282b54e663a919e709d8da24ade5500a7b9aa50226e0ca52923e6c2d860ec50ff480fa57477e82b0565f4379f79c772d5c2da80af9fbf325ece6fc20b00961614bee89a183e\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 6a5b4be4cd36cc97dfde9995efbf8f097a4a991a\nOutput = 82102df8cb91e7179919a04d26d335d64fbc2f872c44833943241de8454810274cdf3db5f42d423db152af7135f701420e39b494a67cbfd19f9119da233a23da5c6439b5ba0d2bc373eee3507001378d4a4073856b7fe2aba0b5ee93b27f4afec7d4d120921c83f606765b02c19e4d6a1a3b95fa4c422951be4f52131077ef17179729cddfbdb56950dbaceefe78cb16640a099ea56d24389eef10f8fecb31ba3ea3b227c0a86698bb89e3e9363905bf22777b2a3aa521b65b4cef76d83bde4c\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = b9dfd1df76a461c51e6576c6c8ed0a923d1c50e7\nOutput = a7fdb0d259165ca2c88d00bbf1028a867d337699d061193b17a9648e14ccbbaadeacaacdec815e7571294ebb8a117af205fa078b47b0712c199e3ad05135c504c24b81705115740802487992ffd511d4afc6b854491eb3f0dd523139542ff15c3101ee85543517c6a3c79417c67e2dd9aa741e9a29b06dcb593c2336b3670ae3afbac7c3e76e215473e866e338ca244de00b62624d6b9426822ceae9f8cc460895f41250073fd45c5a1e7b425c204a423a699159f6903e710b37a7bb2bc8049f\n\nPublicKey = RSA-PSS-10\nType = RSA\nInput = 30820122300d06092a864886f70d01010105000382010f003082010a0282010100a5dd867ac4cb02f90b9457d48c14a770ef991c56c39c0ec65fd11afa8937cea57b9be7ac73b45c0017615b82d622e318753b6027c0fd157be12f8090fee2a7adcd0eef759f88ba4997c7a42d58c9aa12cb99ae001fe521c13bb5431445a8d5ae4f5e4c7e948ac227d3604071f20e577e905fbeb15dfaf06d1de5ae6253d63a6a2120b31a5da5dabc9550600e20f27d3739e2627925fea3cc509f21dff04e6eea4549c540d6809ff9307eede91fff58733d8385a237d6d3705a33e391900992070df7adf1357cf7e3700ce3667de83f17b8df1778db381dce09cb4ad058a511001a738198ee27cf55a13b754539906582ec8b174bd58d5d1f3d767c613721ae050203010001\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 9596bb630cf6a8d4ea4600422b9eba8b13675dd4\nOutput = 82c2b160093b8aa3c0f7522b19f87354066c77847abf2a9fce542d0e84e920c5afb49ffdfdace16560ee94a1369601148ebad7a0e151cf16331791a5727d05f21e74e7eb811440206935d744765a15e79f015cb66c532c87a6a05961c8bfad741a9a6657022894393e7223739796c02a77455d0f555b0ec01ddf259b6207fd0fd57614cef1a5573baaff4ec00069951659b85f24300a25160ca8522dc6e6727e57d019d7e63629b8fe5e89e25cc15beb3a647577559299280b9b28f79b0409000be25bbd96408ba3b43cc486184dd1c8e62553fa1af4040f60663de7f5e49c04388e257f1ce", - "89c95dab48a315d9b66b1b7628233876ff2385230d070d07e1666\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = b503319399277fd6c1c8f1033cbf04199ea21716\nOutput = 14ae35d9dd06ba92f7f3b897978aed7cd4bf5ff0b585a40bd46ce1b42cd2703053bb9044d64e813d8f96db2dd7007d10118f6f8f8496097ad75e1ff692341b2892ad55a633a1c55e7f0a0ad59a0e203a5b8278aec54dd8622e2831d87174f8caff43ee6c46445345d84a59659bfb92ecd4c818668695f34706f66828a89959637f2bf3e3251c24bdba4d4b7649da0022218b119c84e79a6527ec5b8a5f861c159952e23ec05e1e717346faefe8b1686825bd2b262fb2531066c0de09acde2e4231690728b5d85e115a2f6b92b79c25abc9bd9399ff8bcf825a52ea1f56ea76dd26f43baafa18bfa92a504cbd35699e26d1dcc5a2887385f3c63232f06f3244c3\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 50aaede8536b2c307208b275a67ae2df196c7628\nOutput = 6e3e4d7b6b15d2fb46013b8900aa5bbb3939cf2c095717987042026ee62c74c54cffd5d7d57efbbf950a0f5c574fa09d3fc1c9f513b05b4ff50dd8df7edfa20102854c35e592180119a70ce5b085182aa02d9ea2aa90d1df03f2daae885ba2f5d05afdac97476f06b93b5bc94a1a80aa9116c4d615f333b098892b25fface266f5db5a5a3bcc10a824ed55aad35b727834fb8c07da28fcf416a5d9b2224f1f8b442b36f91e456fdea2d7cfe3367268de0307a4c74e924159ed33393d5e0655531c77327b89821bdedf880161c78cd4196b5419f7acc3f13e5ebf161b6e7c6724716ca33b85c2e25640192ac2859651d50bde7eb976e51cec828b98b6563b86bb\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = aa0b72b8b371ddd10c8ae474425ccccf8842a294\nOutput = 34047ff96c4dc0dc90b2d4ff59a1a361a4754b255d2ee0af7d8bf87c9bc9e7ddeede33934c63ca1c0e3d262cb145ef932a1f2c0a997aa6a34f8eaee7477d82ccf09095a6b8acad38d4eec9fb7eab7ad02da1d11d8e54c1825e55bf58c2a23234b902be124f9e9038a8f68fa45dab72f66e0945bf1d8bacc9044c6f07098c9fcec58a3aab100c805178155f030a124c450e5acbda47d0e4f10b80a23f803e774d023b0015c20b9f9bbe7c91296338d5ecb471cafb032007b67a60be5f69504a9f01abb3cb467b260e2bce860be8d95bf92c0c8e1496ed1e528593a4abb6df462dde8a0968dffe4683116857a232f5ebf6c85be238745ad0f38f767a5fdbf486fb\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = fad3902c9750622a2bc672622c48270cc57d3ea8\nOutput = 7e0935ea18f4d6c1d17ce82eb2b3836c55b384589ce19dfe743363ac9948d1f346b7bfddfe92efd78adb21faefc89ade42b10f374003fe122e67429a1cb8cbd1f8d9014564c44d120116f4990f1a6e38774c194bd1b8213286b077b0499d2e7b3f434ab12289c556684deed78131934bb3dd6537236f7c6f3dcb09d476be07721e37e1ceed9b2f7b406887bd53157305e1c8b4f84d733bc1e186fe06cc59b6edb8f4bd7ffefdf4f7ba9cfb9d570689b5a1a4109a746a690893db3799255a0cb9215d2d1cd490590e952e8c8786aa0011265252470c041dfbc3eec7c3cbf71c24869d115c0cb4a956f56d530b80ab589acfefc690751ddf36e8d383f83cedd2cc\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 122196deb5d122bd8c6fc781ff6924d7c695aade\nOutput = 6d3b5b87f67ea657af21f75441977d2180f91b2c5f692de82955696a686730d9b9778d970758ccb26071c2209ffbd6125be2e96ea81b67cb9b9308239fda17f7b2b64ecda096b6b935640a5a1cb42a9155b1c9ef7a633a02c59f0d6ee59b852c43b35029e73c940ff0410e8f114eed46bbd0fae165e42be2528a401c3b28fd818ef3232dca9f4d2a0f5166ec59c42396d6c11dbc1215a56fa17169db9575343ef34f9de32a49cdc3174922f229c23e18e45df9353119ec4319cedce7a17c64088c1f6f52be29634100b3919d38f3d1ed94e6891e66a73b8fb849f5874df59459e298c7bbce2eee782a195aa66fe2d0732b25e595f57d3e061b1fc3e4063bf98f\n\nPrivateKey = RSA-OAEP-1\nType = RSA\nInput = 30820276020100300d06092a864886f70d0101010500048202603082025c02010002818100a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb020301000102818053339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1024100d32737e7267ffe1341b2d5c0d150a81b586fb3132bed2f8d5262864a9cb9f30af38be448598d413a172efb802c21acf1c11c520c2f26a471dcad212eac7ca39d024100cc8853d1d54da630fac004f471f281c7b8982d8224a490edbeb33d3e3d5cc93c4765703d1dd791642f1f116a0dd852be2419b2af72bfe9a030e860b0288b5d7702400e12bf1718e9cef5599ba1c3882fe8046a90874eefce8f2ccc20e4f2741fb0a33a3848aec9c9305fbecbd2d76819967d4671acc6431e4037968db37878e695c102410095297b0f95a2fa67d00707d609dfd4fc05c89dafc2ef6d6ea55bec771ea333734d9251e79082ecda866efef13c459e1a631386b7e354c899f5f112ca85d7158302404f456c502493bdc0ed2ab756a3a6ed4d67352a697d4216e93212b127a63d5411ce6fa98d5dbefd73263e3728142743818166ed7dd63687dd2a8ca1d2f4fbd8e1\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 354fe67b4a126d5d35fe36c777791a3f7ba13def484e2d3908aff722fad468fb21696de95d0be911c2d3174f8afcc201035f7b6d8e69402de5451618c21a535fa9d7bfc5b8dd9fc243f8cf927db31322d6e881eaa91a996170e657a05a266426d98c88003f8477c1227094a0d9fa1e8c4024309ce1ecccb5210035d47ac72e8a\nOutput = 6628194e12073db03ba94cda9ef9532397d50dba79b987004afefe34\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 640db1acc58e0568fe5407e5f9b701dff8c3c91e716c536fc7fcec6cb5b71c1165988d4a279e1577d730fc7a29932e3f00c81515236d8d8e31017a7a09df4352d904cdeb79aa583adcc31ea698a4c05283daba9089be5491f67c1a4ee48dc74bbbe6643aef846679b4cb395a352d5ed115912df696ffe0702932946d71492b44\nOutput = 750c4047f547e8e41411856523298ac9bae245efaf1397fbe56f9dd5\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 423736ed035f6026af276c35c0b3741b365e5f76ca091b4e8c29e2f0befee603595aa8322d602d2e625e95eb81b2f1c9724e822eca76db8618cf09c5343503a4360835b5903bc637e3879fb05e0ef32685d5aec5067cd7cc96fe4b2670b6eac3066b1fcf5686b68589aafb7d629b02d8f8625ca3833624d4800fb081b1cf94eb\nOutput = d94ae0832e6445ce42331cb06d531a82b1db4baad30f746dc916df24d4e3c2451fff59a6423eb0e1d02d4fe646cf699dfd818c6e97b051\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 45ead4ca551e662c9800f1aca8283b0525e6abae30be4b4aba762fa40fd3d38e22abefc69794f6ebbbc05ddbb11216247d2f412fd0fba87c6e3acd888813646fd0e48e785204f9c3f73d6d8239562722dddd8771fec48b83a31ee6f592c4cfd4bc88174f3b13a112aae3b9f7b80e0fc6f7255ba880dc7d8021e22ad6a85f0755\nOutput = 52e650d98e7f2a048b4f86852153b97e01dd316f346a19f67a85\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 36f6e34d94a8d34daacba33a2139d00ad85a9345a86051e73071620056b920e219005855a213a0f23897cdcd731b45257c777fe908202befdd0b58386b1244ea0cf539a05d5d10329da44e13030fd760dcd644cfef2094d1910d3f433e1c7c6dd18bc1f2df7f643d662fb9dd37ead9059190f4fa66ca39e869c4eb449cbdc439\nOutput = 8da89fd9e5f974a29feffb462b49180f6cf9e802\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 42cee2617b1ecea4db3f4829386fbd61dafbf038e180d837c96366df24c097b4ab0fac6bdf590d821c9f10642e681ad05b8d78b378c0f46ce2fad63f74e0ad3df06b075d7eb5f5636f8d403b9059ca761b5c62bb52aa45002ea70baace08ded243b9d8cbd62a68ade265832b56564e43a6fa42ed199a099769742df1539e8255\nOutput = 26521050844271\n\nPrivateKey = RSA-OAEP-2\nType = RSA\nInput = 30820276020100300d06092a864886f70d0101010500048202603082025c02010002818101947c7fce90425f47279e70851f25d5e62316fe8a1df19371e3e628e260543e4901ef6081f68c0b8141190d2ae8daba7d1250ec6db636e944ec3722877c7c1d0a67f14b1694c5f0379451a43e49a32dde83670b73da91a1c99bc23b436a60055c610f0baf99c1a079565b95a3f1526632d1d4da60f20eda25e653c4f002766f4502030100010281800823f20fadb5da89088a9d00893e21fa4a1b11fbc93c64a3be0baaea97fb3b93c3ff713704c19c963c1d107aae99054739f79e02e186de86f87a6ddefea6d8ccd1d3c81a47bfa7255be20601a4a4b2f08a167b5e279d715b1b455bdd7eab245941d9768b9acefb3ccda5952da3cee72525b4501663a8ee15c9e992d92462fe3902410159dbde04a33ef06fb608b80b190f4d3e22bcc13ac8e4a081033abfa416edb0b338aa08b57309ea5a5240e7dc6e54378c69414c31d97ddb1f406db3769cc41a430241012b652f30403b38b40995fd6ff41a1acc8ada70373236b7202d39b2ee30cfb46db09511f6f307cc61cc21606c18a75b8a62f822df031ba0df0dafd5506f568bd70240436ef508de736519c2da4c580d98c82cb7452a3fb5efadc3b9c7789a1bc6584f795addbbd32439c74686552ecb6c2c307a4d3af7f539eec157248c7b31f1a2550241012b15a89f3dfb2b39073e73f02bdd0c1a7b379dd435f05cdde2eff9e462948b7cec62ee9050d5e0816e0785a856b49108dcb75f3683874d1ca6329a19013066ff02400270db17d5914b018d76118b24389a7350ec836b0063a21721236fd8edb6d89b51e7eeb87b611b7132cb7ea7356c23151c1e7751507c786d9ee1794170a8c8e8\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest ", - "= SHA1\nInput = 0181af8922b9fcb4d79d92ebe19815992fc0c1439d8bcd491398a0f4ad3a329a5bd9385560db532683c8b7da04e4b12aed6aacdf471c34c9cda891addcc2df3456653aa6382e9ae59b54455257eb099d562bbe10453f2b6d13c59c02e10f1f8abb5da0d0570932dacf2d0901db729d0fefcc054e70968ea540c81b04bcaefe720e\nOutput = 8ff00caa605c702830634d9a6c3d42c652b58cf1d92fec570beee7\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 018759ff1df63b2792410562314416a8aeaf2ac634b46f940ab82d64dbf165eee33011da749d4bab6e2fcd18129c9e49277d8453112b429a222a8471b070993998e758861c4d3f6d749d91c4290d332c7a4ab3f7ea35ff3a07d497c955ff0ffc95006b62c6d296810d9bfab024196c7934012c2df978ef299aba239940cba10245\nOutput = 2d\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 018802bab04c60325e81c4962311f2be7c2adce93041a00719c88f957575f2c79f1b7bc8ced115c706b311c08a2d986ca3b6a9336b147c29c6f229409ddec651bd1fdd5a0b7f610c9937fdb4a3a762364b8b3206b4ea485fd098d08f63d4aa8bb2697d027b750c32d7f74eaf5180d2e9b66b17cb2fa55523bc280da10d14be2053\nOutput = 74fc88c51bc90f77af9d5e9a4a70133d4b4e0b34da3c37c7ef8e\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00a4578cbc176318a638fba7d01df15746af44d4f6cd96d7e7c495cbf425b09c649d32bf886da48fbaf989a2117187cafb1fb580317690e3ccd446920b7af82b31db5804d87d01514acbfa9156e782f867f6bed9449e0e9a2c09bcecc6aa087636965e34b3ec766f2fe2e43018a2fddeb140616a0e9d82e5331024ee0652fc7641\nOutput = a7eb2a5036931d27d4e891326d99692ffadda9bf7efd3e34e622c4adc085f721dfe885072c78a203b151739be540fa8c153a10f00a\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00ebc5f5fda77cfdad3c83641a9025e77d72d8a6fb33a810f5950f8d74c73e8d931e8634d86ab1246256ae07b6005b71b7f2fb98351218331ce69b8ffbdc9da08bbc9c704f876deb9df9fc2ec065cad87f9090b07acc17aa7f997b27aca48806e897f771d95141fe4526d8a5301b678627efab707fd40fbebd6e792a25613e7aec\nOutput = 2ef2b066f854c33f3bdcbb5994a435e73d6c6c\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 010839ec20c27b9052e55befb9b77e6fc26e9075d7a54378c646abdf51e445bd5715de81789f56f1803d9170764a9e93cb78798694023ee7393ce04bc5d8f8c5a52c171d43837e3aca62f609eb0aa5ffb0960ef04198dd754f57f7fbe6abf765cf118b4ca443b23b5aab266f952326ac4581100644325f8b721acd5d04ff14ef3a\nOutput = 8a7fb344c8b6cb2cf2ef1f643f9a3218f6e19bba89c0\n\nPrivateKey = RSA-OAEP-3\nType = RSA\nInput = 30820277020100300d06092a864886f70d0101010500048202613082025d02010002818102b58fec039a860700a4d7b6462f93e6cdd491161ddd74f4e810b40e3c1652006a5c277b2774c11305a4cbab5a78efa57e17a86df7a3fa36fc4b1d2249f22ec7c2dd6a463232accea906d66ebe80b5704b10729da6f833234abb5efdd4a292cbfad33b4d33fa7a14b8c397b56e3acd21203428b77cdfa33a6da706b3d8b0fc43e9020301000102818015b48a5b5683a94670e23b5718f814fa0e13f85038f50711182cba61510581f3d22c7e232ef937e22e551d68b86e2f8cb1aad8be2e488f5df7efd279e3f568d4eaf36f80cf7141ace60fcc9113fb6c4a841fd50bbc7c512ffcbeff21487aa811eb3ca8c62005346a86de86bfa1d8a948fd3f348c22eaadf333c3ce6ce13208fd024101bf01d216d73595cf0270c2beb78d40a0d8447d31da919a983f7eea781b77d85fe371b3e9373e7b69217d3150a02d8958de7fad9d555160958b4454127e0e7eaf0241018d3399658166db3829816d7b295416759e9c91987f5b2d8aecd63b04b48bd7b2fcf229bb7f8a6dc88ba13dd2e39ad55b6d1a06160708f9700be80b8fd3744ce7024006c0a249d20a6f2ee75c88b494d53f6aae99aa427c88c28b163a769445e5f390cf40c274fd6ea6329a5ce7c7ce03a2158396ee2a7845786e09e2885a9728e4e5024100d1d27c29fedd92d86c348edd0ccbfac14f746e051ce1d1811df35d61f2ee1c97d4bf2804802f6427187ba8e90a8af44243b4079b03445e602e29fa5193e64fe90241008cb2f756bd8941b1d3b770e5ad31ee373b28acda69ff9b6f40fe578b9f1afb85836f9627d37acff73c2779e634bb26011c2c8f7f3361ae2a9ea65ed689e3639a\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 026a0485d96aebd96b4382085099b962e6a2bdec3d90c8db625e14372de85e2d5b7baab65c8faf91bb5504fb495afce5c988b3f6a52e20e1d6cbd3566c5cd1f2b8318bb542cc0ea25c4aab9932afa20760eaddec784396a07ea0ef24d4e6f4d37e5052a7a31e146aa480a111bbe926401307e00f410033842b6d82fe5ce4dfae80\nOutput = 087820b569e8fa8d\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 024db89c7802989be0783847863084941bf209d761987e38f97cb5f6f1bc88da72a50b73ebaf11c879c4f95df37b850b8f65d7622e25b1b889e80fe80baca2069d6e0e1d829953fc459069de98ea9798b451e557e99abf8fe3d9ccf9096ebbf3e5255d3b4e1c6d2ecadf067a359eea86405acd47d5e165517ccafd47d6dbee4bf5\nOutput = 4653acaf171960b01f52a7be63a3ab21dc368ec43b50d82ec3781e04\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0239bce681032441528877d6d1c8bb28aa3bc97f1df584563618995797683844ca86664732f4bed7a0aab083aaabfb7238f582e30958c2024e44e57043b97950fd543da977c90cdde5337d618442f99e60d7783ab59ce6dd9d69c47ad1e962bec22d05895cff8d3f64ed5261d92b2678510393484990ba3f7f06818ae6ffce8a3a\nOutput = d94cd0e08fa404ed89\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 02994c62afd76f498ba1fd2cf642857fca81f4373cb08f1cbaee6f025c3b512b42c3e8779113476648039dbe0493f9246292fac28950600e7c0f32edf9c81b9dec45c3bde0cc8d8847590169907b7dc5991ceb29bb0714d613d96df0f12ec5d8d3507c8ee7ae78dd83f216fa61de100363aca48a7e914ae9f42ddfbe943b09d9a0\nOutput = 6cc641b6b61e6f963974dad23a9013284ef1\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0162042ff6969592a6167031811a239834ce638abf54fec8b99478122afe2ee67f8c5b18b0339805bfdbc5a4e6720b37c59cfba942464c597ff532a119821545fd2e59b114e61daf71820529f5029cf524954327c34ec5e6f5ba7efcc4de943ab8ad4ed787b1454329f70db798a3a8f4d92f8274e2b2948ade627ce8ee33e43c60\nOutput = df5151832b61f4f25891fb4172f328d2eddf8371ffcfdbe997939295f30eca6918017cfda1153bf7a6af87593223\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00112051e75d064943bc4478075e43482fd59cee0679de6893eec3a943daa490b9691c93dfc0464b6623b9f3dbd3e70083264f034b374f74164e1a00763725e574744ba0b9db83434f31df96f6e2a26f6d8eba348bd4686c2238ac07c37aac3785d1c7eea2f819fd91491798ed8e9cef5e43b781b0e0276e37c43ff9492d005730\nOutput = 3c3bad893c544a6d520ab022319188c8d504b7a788b850903b85972eaa18552e1134a7ad6098826254ff7ab672b3d8eb3158fac6d4cbaef1\n\nPrivateKey = RSA-OAEP-4\nType = RSA\nInput = 30820277020100300d06092a864886f70d0101010500048202613082025d020100028181051240b6cc0004fa48d0134671c078c7c8dec3b3e2f25bc2564467339db38853d06b85eea5b2de353bff42ac2e46bc97fae6ac9618da9537a5c8f553c1e357625991d6108dcd7885fb3a25413f53efcad948cb35cd9b9ae9c1c67626d113d57dde4c5bea76bb5bb7de96c00d07372e9685a6d75cf9d239fa148d70931b5f3fb03902030100010281800411ffca3b7ca5e9e9be7fe38a85105e353896db05c5796aecd2a725161eb3651c8629a9b862b904d7b0c7b37f8cb5a1c2b54001018a00a1eb2cafe4ee4e9492c348bc2bedab4b9ebbf064e8eff322b9009f8eec653905f40df88a3cdc49d4567f75627d41aca624129b46a0b7c698e5e65f2b7ba102c749a10135b6540d04010241027458c19ec1636919e736c9af25d609a51b8f561d19c6bf6943dd1ee1ab8a4a3f232100bd40b88decc6ba235548b6ef792a11c9de823d0a7922c7095b6eba570102410210ee9b33ab61716e27d251bd465f4b35a1a232e2da00901c294bf22350ce490d099f642b5375612db63ba1f20386492bf04d34b3c22bceb909d13441b53b5139024039fa028b826e88c1121b750a8b242fa9a35c5b66bdfd1fa637d3cc48a84a4f457a194e7727e49f7bcc6e5a5a412657fc470c7322ebc37416ef458c307a8c09010241015d99a84195943979fa9e1be2c3c1b69f432f46fd03e47d5befbbbfd6b1d1371d83efb330a3e020942b2fed115e5d02be24fd92c9019d1cecd6dd4cf1e54cc899024101f0b7015170b3f5e42223ba30301c41a6d87cbb70e30cb7d3c67d25473db1f6cbf03e3f9126e3e97968279a865b2c2b426524cfc52a683d31ed30eb984be412ba\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 04cce19614845e094152a3fe18e54e3330c44e5efbc64ae16886cb1869014cc5781b1f8f9e045384d0112a135ca0d12e9c88a8e4063416deaae3844f60d6e96fe155145f4525b9a34431ca3766180f70e15a5e5d8e8b1a516ff870609f13f896935ced188279a58ed13d07114277d75c6568607e0ab092fd803a223e4a8ee0b1a8\nOutput = 4a86609534ee434a6cbca3f7e962e76d455e3264c19f605f6e5ff6137c65c56d7fb344cd52bc93374f3d166c9f0c6f9c506bad19330972d2\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0097b698c6165645b303486fbf5a2a4479c0ee85889b541a6f0b858d6b6597b13b854eb4f839af03399a80d79bda6578c841f90d645715b280d37143992dd186c80b949b775cae97370e4ec97443136c6da484e970ffdb1323a20847821d3b18381de13bb49aaea66530c4a4b8271f3eae172cd366e07e6636f1019d2a28aed15e\nOutput = b0adc4f3fe11da59ce992773d9059943c03046497ee9d9f9a06df1166db46d98f58d27ec074c02eee6cbe2449c8b9fc5080c5c3f4433092512ec46aa793743c8\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1", - "\nInput = 0301f935e9c47abcb48acbbe09895d9f5971af14839da4ff95417ee453d1fd77319072bb7297e1b55d7561cd9d1bb24c1a9a37c619864308242804879d86ebd001dce5183975e1506989b70e5a83434154d5cbfd6a24787e60eb0c658d2ac193302d1192c6e622d4a12ad4b53923bca246df31c6395e37702c6a78ae081fb9d065\nOutput = bf6d42e701707b1d0206b0c8b45a1c72641ff12889219a82bdea965b5e79a96b0d0163ed9d578ec9ada20f2fbcf1ea3c4089d83419ba81b0c60f3606da99\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 02d110ad30afb727beb691dd0cf17d0af1a1e7fa0cc040ec1a4ba26a42c59d0a796a2e22c8f357ccc98b6519aceb682e945e62cb734614a529407cd452bee3e44fece8423cc19e55548b8b994b849c7ecde4933e76037e1d0ce44275b08710c68e430130b929730ed77e09b015642c5593f04e4ffb9410798102a8e96ffdfe11e4\nOutput = fb2ef112f5e766eb94019297934794f7be2f6fc1c58e\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00dbb8a7439d90efd919a377c54fae8fe11ec58c3b858362e23ad1b8a44310799066b99347aa525691d2adc58d9b06e34f288c170390c5f0e11c0aa3645959f18ee79e8f2be8d7ac5c23d061f18dd74b8c5f2a58fcb5eb0c54f99f01a83247568292536583340948d7a8c97c4acd1e98d1e29dc320e97a260532a8aa7a758a1ec2\nOutput = 28ccd447bb9e85166dabb9e5b7d1adadc4b9d39f204e96d5e440ce9ad928bc1c2284\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00a5ffa4768c8bbecaee2db77e8f2eec99595933545520835e5ba7db9493d3e17cddefe6a5f567624471908db4e2d83a0fbee60608fc84049503b2234a07dc83b27b22847ad8920ff42f674ef79b76280b00233d2b51b8cb2703a9d42bfbc8250c96ec32c051e57f1b4ba528db89c37e4c54e27e6e64ac69635ae887d9541619a9\nOutput = f22242751ec6b1\n\nPrivateKey = RSA-OAEP-5\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f0201000281810aadf3f9c125e5d891f31ac448e993defe580f802b45f9d7f22ba5021e9c47576b5a1e68031ba9db4e6dabe4d96a1d6f3d267268cff408005f118efcadb99888d1c234467166b2a2b849a05a889c060ac0da0c5fae8b55f309ba62e703742fa0326f2d10b011021489ff497770190d895fd39f52293c39efd73a698bdab9f10ed902030100010281810256eb4cba7067f2d2be540dcdff4582a36b7d31d1c9099bb214b79848466a268f80f58a49ac04c0e3648934a0206c04537c19b236643a6082732144df75fa217588f794682be89168276dc726c5c0cbdb84d31bbf26d0a43af495717f7d528acfee341561f6ff3cae05c578f8470d9682f9c0d072f9f6068b56d5880f682be2c5024103b0d3962f6d17549cbfca11294348dcf0e7e39f8c2bc6824f2164b606d687860dae1e632393cfedf513228229069e2f60e4acd7e633a436063f82385f48993707024102e4c32e2f517269b7072309f00c0e31365f7ce28b236b82912df239abf39572cf0ed604b02982e53564c52d6a05397de5c052a2fddc141ef7189836346aeb331f024101e84b119d25161fa67b00256a5bd9b645d2b232ecb05b015180029a88622adc3f09b3aeacde6161ab7cde22c2ad26e7797df54e072cbd3b2673800b3e4338dbd5024100eb90aa1a40135b4cea07197cedc8819be1e7cbff2547662116f465a4a9f487ab12f3ba4fef13822265a65297d98b7bded9372e3ffe81a38b3e9600fed055754f0241012f7f8138f9404062eb85a42924520b38f5bb886a0196f48bb8dcea60fd92cc027f18e78158a34a5c5d5f860a0f6c04071a7d01312c065062f1eb48b79d1c83cb\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 036046a4a47d9ed3ba9a89139c105038eb7492b05a5d68bfd53accff4597f7a68651b47b4a4627d927e485eed7b4566420e8b409879e5d606eae251d22a5df799f7920bfc117b992572a53b1263146bcea03385cc5e853c9a101c8c3e1bda31a519807496c6cb5e5efb408823a352b8fa0661fb664efadd593deb99fff5ed000e5\nOutput = af71a901e3a61d3132f0fc1fdb474f9ea6579257ffc24d164170145b3dbde8\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 03d6eb654edce615bc59f455265ed4e5a18223cbb9be4e4069b473804d5de96f54dcaaa603d049c5d94aa1470dfcd2254066b7c7b61ff1f6f6770e3215c51399fd4e34ec5082bc48f089840ad04354ae66dc0f1bd18e461a33cc1258b443a2837a6df26759aa2302334986f87380c9cc9d53be9f99605d2c9a97da7b0915a4a7ad\nOutput = a3b844a08239a8ac41605af17a6cfda4d350136585903a417a79268760519a4b4ac3303ec73f0f87cfb32399\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0770952181649f9f9f07ff626ff3a22c35c462443d905d456a9fd0bff43cac2ca7a9f554e9478b9acc3ac838b02040ffd3e1847de2e4253929f9dd9ee4044325a9b05cabb808b2ee840d34e15d105a3f1f7b27695a1a07a2d73fe08ecaaa3c9c9d4d5a89ff890d54727d7ae40c0ec1a8dd86165d8ee2c6368141016a48b55b6967\nOutput = 308b0ecbd2c76cb77fc6f70c5edd233fd2f20929d629f026953bb62a8f4a3a314bde195de85b5f816da2aab074d26cb6acddf323ae3b9c678ac3cf12fbdde7\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0812b76768ebcb642d040258e5f4441a018521bd96687e6c5e899fcd6c17588ff59a82cc8ae03a4b45b31299af1788c329f7dcd285f8cf4ced82606b97612671a45bedca133442144d1617d114f802857f0f9d739751c57a3f9ee400912c61e2e6992be031a43dd48fa6ba14eef7c422b5edc4e7afa04fdd38f402d1c8bb719abf\nOutput = 15c5b9ee1185\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 07b60e14ec954bfd29e60d0047e789f51d57186c63589903306793ced3f68241c743529aba6a6374f92e19e0163efa33697e196f7661dfaaa47aac6bde5e51deb507c72c589a2ca1693d96b1460381249b2cdb9eac44769f2489c5d3d2f99f0ee3c7ee5bf64a5ac79c42bd433f149be8cb59548361640595513c97af7bc2509723\nOutput = 21026e6800c7fa728fcaaba0d196ae28d7a2ac4ffd8abce794f0985f60c8a6737277365d3fea11db8923a2029a\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 08c36d4dda33423b2ed6830d85f6411ba1dcf470a1fae0ebefee7c089f256cef74cb96ea69c38f60f39abee44129bcb4c92de7f797623b20074e3d9c2899701ed9071e1efa0bdd84d4c3e5130302d8f0240baba4b84a71cc032f2235a5ff0fae277c3e8f9112bef44c9ae20d175fc9a4058bfc930ba31b02e2e4f444483710f24a\nOutput = 541e37b68b6c8872b84c02\n\nPrivateKey = RSA-OAEP-6\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f02010002818112b17f6dad2ecd19ff46dc13f7860f09e0e0cfb677b38a52592305ceaf022c166db90d04ac29e33f7dd12d9faf66e0816bb63ead267cc7d46c17c37be214bca2a22d723a64e44407436b6fc965729aefc2554f376cd5dcea68293780a62bf39d0029485a160bbb9e5dc0972d21a504f52e5ee028aa416332f510b2e9cff5f722af02030100010281810295eca3560618369559cecd303aa9cfdafc1d9f06959df75ffef929aa896961bcd190dc6997eda7f5963e724d07b4dc11f3065e5ae97d96835112280b9084bb14f2a21ebd4e889d41b9c4132ec1956fcab8bb2fed0575884936522c5ff7d33261904824e7cadee4e0bb372d2457cf78e2bd1286228ff83f10731ce63c90cff3f9024104a6ce8b7358dfa69bdcf742617005afb5385f5f3a58a24ef74a22a8c05cb7cc38ebd4cc9d9a9d789a62cd0f60f0cb941d3423c9692efa4fe3adff290c4749a38b02410404c9a803371fedb4c5be39f3c00b009e5e08a63be1e40035cdaca5011cc701cf7eebcb99f0ffe17cfd0a4bf7befd2dd536ac946db797fdbc4abe8f29349b91ed024103961c8f760aa2bd5154c7aafd77225b3bacd0139ae7b5948ea3311fccd86fb95c75afa767284b9b2de559572f15d8d044c7eb83a1be5fadf2cc377c0d8475294b0241022197e066742196aabc03fa2feeb4e70b15cb787d617acd31bb75c7bc234ad706f7c48d2182d1f0ff9c228dcf41967b6c0ba6d2c0ad110a1b857831ec245e2cb102410401c4c0c53d45dbdb5e9d96d0fecf4275df0974bc4a0736b4a74c3269053efb686ace2406e22c9e058ddb4ae540627ae2fdb08261e8e7e4bcbc994daafa305c45\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0630eebcd2856c24f798806e41f9e67345eda9ceda386acc9facaea1eeed06ace583709718d9d169fadf414d5c76f92996833ef305b75b1e4b95f662a20faedc3bae0c4827a8bf8a88edbd57ec203a27a841f02e43a615bab1a8cac0701de34debdef62a088089b55ec36ea7522fd3ec8d06b6a073e6df833153bc0aefd93bd1a3\nOutput = 4046ca8baa3347ca27f49e0d81f9cc1d71be9ba517d4\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0ebc37376173a4fd2f89cc55c2ca62b26b11d51c3c7ce49e8845f74e7607317c436bc8d23b9667dfeb9d087234b47bc6837175ae5c0559f6b81d7d22416d3e50f4ac533d8f0812f2db9e791fe9c775ac8b6ad0f535ad9ceb23a4a02014c58ab3f8d3161499a260f39348e714ae2a1d3443208fd8b722ccfdfb393e98011f99e63f\nOutput = 5cc72c60231df03b3d40f9b57931bc31109f972527f28b19e7480c7288cb3c92b22512214e4be6c914792ddabdf57faa8aa7\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0a98bf1093619394436cf68d8f38e2f158fde8ea54f3435f239b8d06b8321844202476aeed96009492480ce3a8d705498c4c8c68f01501dc81db608f60087350c8c3b0bd2e9ef6a81458b7c801b89f2e4fe99d4900ba6a4b5e5a96d865dc676c7755928794130d6280a8160a190f2df3ea7cf9aa0271d88e9e6905ecf1c5152d65\nOutput = b20e651303092f4bccb43070c0f86d23049362ed96642fc5632c27db4a52e3d831f2ab068b23b149879c002f6bf3feee97591112562c\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 008e7a67cacfb5c4e24bec7dee149117f19598ce8c45808fef88c608ff9cd6e695263b9a3c0ad4b8ba4c95238e96a8422b8535629c8d5382374479ad13fa39974b242f9a759eeaf9c83ad5a8ca18940a0162ba755876df263f4bd50c6525c56090267c1f0e09ce0899a0cf359e88120abd9bf893445b3cae77d3607359ae9a52f8\nOutput = 684e3038c5c041f7\n\nDe", - "crypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00003474416c7b68bdf961c385737944d7f1f40cb395343c693cc0b4fe63b31fedf1eaeeac9ccc0678b31dc32e0977489514c4f09085f6298a9653f01aea4045ff582ee887be26ae575b73eef7f3774921e375a3d19adda0ca31aa1849887c1f42cac9677f7a2f4e923f6e5a868b38c084ef187594dc9f7f048fea2e02955384ab\nOutput = 32488cb262d041d6e4dd35f987bf3ca696db1f06ac29a44693\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0a026dda5fc8785f7bd9bf75327b63e85e2c0fdee5dadb65ebdcac9ae1de95c92c672ab433aa7a8e69ce6a6d8897fac4ac4a54de841ae5e5bbce7687879d79634cea7a30684065c714d52409b928256bbf53eabcd5231eb7259504537399bd29164b726d33a46da701360a4168a091ccab72d44a62fed246c0ffea5b1348ab5470\nOutput = 50ba14be8462720279c306ba\n\nPrivateKey = RSA-OAEP-7\nType = RSA\nInput = 30820278020100300d06092a864886f70d0101010500048202623082025e020100028181311179f0bcfc9b9d3ca315d00ef30d7bdd3a2cfae9911bfedcb948b3a4782d0732b6ab44aa4bf03741a644dc01bec3e69b01a033e675d8acd7c4925c6b1aec3119051dfd89762d215d45475ffcb59f908148623f37177156f6ae86dd7a7c5f43dc1e1f908254058a284a5f06c0021793a87f1ac5feff7dcaee69c5e51a3789e3730203010001028181070cfcff2feb8276e27432c45dfee48f49b7917d6530e1f0ca3460f32e0276174487c56e22a45d2500d7775495219d7d165a9cf3bd92c32af9a98d8dc9cc296800adc94a0a54fb40f34291bf84ee8ea12b6f109359c6d3542a50f9c767f5cfff05a681c2e656fb77caaadb4be9468d8abcd4df98f58e86d2053fa1349f748e21b102410749262c111cd470ec2566e6b3732fc09329469aa19071d3b9c01906514c6f1d26baa14beab0971c8b7e611a4f79009d6fea776928ca25285b0de3643d1a3f8c71024106bc1e50e96c02bf636e9eea8b899bbebf7651de77dd474c3e9bc23bad8182b61904c7d97dfbebfb1e00108878b6e67e415391d67942c2b2bf9b4435f88b0cb023024103bc7ea7f0aab143abc6ce8b97118636a30172e4cfe02c8fa0dda3b7baaf90f8092982985525f488bdfcb4bd726e22639ac64a3092ab7ffcbf1d5334cfa50b5bf102410262a6aa29c2a3c67dc5346c06381afd987aa3cc93cfbfecf54fdd9f9d787d7f59a523d398979da137a2f6381fe94801f7c94da21518dc34cb40870c4697994ad90240649d4c17b6ee1721e772d0389a559c3d3cdf9550d457c46b037b74641b1d52166af8a213c8396206cdfba4422f18d6f61dbcb5d214c971bf482aeb976a7370c2\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1688e4ce7794bba6cb7014169ecd559cede2a30b56a52b68d9fe18cf1973ef97b2a03153951c755f6294aa49adbdb55845ab6875fb3986c93ecf927962840d282f9e54ce8b690f7c0cb8bbd73440d9571d1b16cd9260f9eab4783cc482e5223dc60973871783ec27b0ae0fd47732cbc286a173fc92b00fb4ba6824647cd93c85c1\nOutput = 47aae909\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1052ed397b2e01e1d0ee1c50bf24363f95e504f4a03434a08fd822574ed6b9736edbb5f390db10321479a8a139350e2bd4977c3778ef331f3e78ae118b268451f20a2f01d471f5d53c566937171b2dbc2d4bde459a5799f0372d6574239b2323d245d0bb81c286b63c89a361017337e4902f88a467f4c7f244bfd5ab46437ff3b6\nOutput = 1d9b2e2223d9bc13bfb9f162ce735db48ba7c68f6822a0a1a7b6ae165834e7\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2155cd843ff24a4ee8badb7694260028a490813ba8b369a4cbf106ec148e5298707f5965be7d101c1049ea8584c24cd63455ad9c104d686282d3fb803a4c11c1c2e9b91c7178801d1b6640f003f5728df007b8a4ccc92bce05e41a27278d7c85018c52414313a5077789001d4f01910b72aad05d220aa14a58733a7489bc54556b\nOutput = d976fc\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0ab14c373aeb7d4328d0aaad8c094d88b9eb098b95f21054a29082522be7c27a312878b637917e3d819e6c3c568db5d843802b06d51d9e98a2be0bf40c031423b00edfbff8320efb9171bd2044653a4cb9c5122f6c65e83cda2ec3c126027a9c1a56ba874d0fea23f380b82cf240b8cf540004758c4c77d934157a74f3fc12bfac\nOutput = d4738623df223aa43843df8467534c41d013e0c803c624e263666b239bde40a5f29aeb8de79e3daa61dd0370f49bd4b013834b98212aef6b1c5ee373b3cb\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 028387a318277434798b4d97f460068df5298faba5041ba11761a1cb7316b24184114ec500257e2589ed3b607a1ebbe97a6cc2e02bf1b681f42312a33b7a77d8e7855c4a6de03e3c04643f786b91a264a0d6805e2cea91e68177eb7a64d9255e4f27e713b7ccec00dc200ebd21c2ea2bb890feae4942df941dc3f97890ed347478\nOutput = bb47231ca5ea1d3ad46c99345d9a8a61\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 14c678a94ad60525ef39e959b2f3ba5c097a94ff912b67dbace80535c187abd47d075420b1872152bba08f7fc31f313bbf9273c912fc4c0149a9b0cfb79807e346eb332069611bec0ff9bcd168f1f7c33e77313cea454b94e2549eecf002e2acf7f6f2d2845d4fe0aab2e5a92ddf68c480ae11247935d1f62574842216ae674115\nOutput = 2184827095d35c3f86f600e8e59754013296\n\nPrivateKey = RSA-OAEP-8\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f0201000281815bdf0e30d321dda5147f882408fa69195480df8f80d3f6e8bf5818504f36427ca9b1f5540b9c65a8f6974cf8447a244d9280201bb49fcbbe6378d1944cd227e230f96e3d10f819dcef276c64a00b2a4b6701e7d01de5fabde3b1e9a0df82f4631359cd22669647fbb1717246134ed7b497cfffbdc42b59c73a96ed90166212dff702030100010281810f7d1e9e5aaa25fd13e4a0663ae144e0d15f5cd18bcdb09df2cc7e64e3c5e915ad62645304161d098c715bb7ab8bd01d07eaf3fed7c7ed08af2a8a62ef44ab16b320e14af72a48f96afe262a0ae4cf65e635e910790cd4ee5cea768a4b2639f7e6f677b3f0bb6be32b75747d8909036f0264f58d401cdba131716157a75ecf633102410a02ef8448d9fad8bbd0d004c8c2aa9751ef9721c1b0d03236a54b0df947cbaed5a255ee9e8e20d491ea1723fe094704a9762e88afd16ebb5994412ca966dc4f9f0241092d362e7ed3a0bfd9e9fd0e6c0301b6df29159cf50cc83b9b0cf4d6eea71a61e002b46e0ae9f2de62d25b5d7452d498b81c9ac6fc58593d4c3fb4f5d72dfbb0a9024107c71410af103962db367404e37ae850baa4e9c29dd92145815294a67c7d1c6ded263aa030a9b633ae50303e14035d1af014123eba687820308d8ebc85b6957d7d024100ae2c75380c02c016ad05891b3301de881f28ae1171182b6b2c83bea7c515eca9ca298c7b1cab5817a597068fc85060de4da8a016378aae43c7f967bcc37904b902410598d1059e3ada4f6320752c09d805ff7d1f1ae0d017aeeee9cefa0d7dd7ff775e44b578322f6405d6211da19519666aa87fdc4cd8c88f6b6e3d67e961dcbba3d0\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 09b3683d8a2eb0fb295b62ed1fb9290b714457b7825319f4647872af889b30409472020ad12912bf19b11d4819f49614824ffd84d09c0a17e7d17309d12919790410aa2995699f6a86dbe3242b5acc23af45691080d6b1ae810fb3e3057087f0970092ce00be9562ff4053b6262ce0caa93e13723d2e3a5ba075d45f0d61b54b61\nOutput = 050b755e5e6880f7b9e9d692a74c37aae449b31bfea6deff83747a897f6c2c825bb1adbf850a3c96994b5de5b33cbc7d4a17913a7967\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2ecf15c97c5a15b1476ae986b371b57a24284f4a162a8d0c8182e7905e792256f1812ba5f83f1f7a130e42dcc02232844edc14a31a68ee97ae564a383a3411656424c5f62ddb646093c367be1fcda426cf00a06d8acb7e57776fbbd855ac3df506fc16b1d7c3f2110f3d8068e91e186363831c8409680d8da9ecd8cf1fa20ee39d\nOutput = 4eb68dcd93ca9b19df111bd43608f557026fe4aa1d5cfac227a3eb5ab9548c18a06dded23f81825986b2fcd71109ecef7eff88873f075c2aa0c469f69c92bc\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 4bc89130a5b2dabb7c2fcf90eb5d0eaf9e681b7146a38f3173a3d9cfec52ea9e0a41932e648a9d69344c50da763f51a03c95762131e8052254dcd2248cba40fd31667786ce05a2b7b531ac9dac9ed584a59b677c1a8aed8c5d15d68c05569e2be780bf7db638fd2bfd2a85ab276860f3777338fca989ffd743d13ee08e0ca9893f\nOutput = 8604ac56328c1ab5ad917861\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2e456847d8fc36ff0147d6993594b9397227d577752c79d0f904fcb039d4d812fea605a7b574dd82ca786f93752348438ee9f5b5454985d5f0e1699e3e7ad175a32e15f03deb042ab9fe1dd9db1bb86f8c089ccb45e7ef0c5ee7ca9b7290ca6b15bed47039788a8a93ff83e0e8d6244c71006362deef69b6f416fb3c684383fbd0\nOutput = fdda5fbf6ec361a9d9a4ac68af216a0686f438b1e0e5c36b955f74e107f39c0dddcc\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1fb9356fd5c4b1796db2ebf7d0d393cc810adf6145defc2fce714f79d93800d5e2ac211ea8bbecca4b654b94c3b18b30dd576ce34dc95436ef57a09415645923359a5d7b4171ef22c24670f1b229d3603e91f76671b7df97e7317c97734476d5f3d17d21cf82b5ba9f83df2e588d36984fd1b584468bd23b2e875f32f68953f7b2\nOutput = 4a5f4914bee25de3c69341de07\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 3afd9c6600147b21798d818c655a0f4c9212db26d0b0dfdc2a7594ccb3d22f5bf1d7c3e112cd73fc7d509c7a8bafdd3c274d1399009f9609ec4be6477e453f075aa33db382870c1c3409aef392d7386ae3a696b99a94b4da0589447e955d16c98b17602a59bd736279fcd8fb280c4462d590bfa9bf13fed570eafde97330a2c210\nOutput = 8e07d66f7b880a72563abcd3f35092bc33409fb7f88f2472be\n\nPrivateKey = RSA-OAEP-9\nType = RSA\nInput = 30820397020100300d06092a864886f70d0101010500048203813082037d0201000281c100cf2cd41", - "e34ca3a728ea5cb8aff64c36d27bdef5364e336fd68d3123c5a196a8c287013e853d5156d58d151954520fb4f6d7b17abb6817765909c576119659d902b1906ed8a2b10c155c24d124528dab9eeae379beac66e4a411786dcb8fd0062ebc030de1219a04c2a8c1b7dd3131e4d6b6caee2e31a5ed41ac1509b2ef1ee2ab18364be568ca941c25ecc84ff9d643b5ec1aaae102a20d73f479b780fd6da91075212d9eac03a0674d899eba2e431f4c44b615b6ba2232bd4b33baed73d625d02030100010281c0198c141e23715a92bccf6a119a5bc11389468d2811f548d727e17b4ab0eb986d6f211efb53b71f7ccbea87ee69c75ee615008c5332deb52bf390abdfbfe37d7205368159b2638c1de326e21d22251f0fb5848b3bf15005d2a74330f0afe916ee62ccc1344d1d83a709e60676273840f7f377424a5e0a4da75f01b31ff76819cf9cbfdd215243c3917c03ef38199312e567b3bf7aed3ab457f371ef8a1423f45b68c6e282ec111bba2833b987fd69fad83bc1b8c613c5e1ea16c11ed125ea7ec1026100fc8d6c04bec4eb9a8192ca7900cbe536e2e8b519decf33b2459798c6909df4f176db7d23190fc72b8865a718af895f1bcd9145298027423b605e70a47cf58390a8c3e88fc8c48e8b32e3da210dfbe3e881ea5674b6a348c21e93f9e55ea65efd026100d200d45e788aacea606a401d0460f87dd5c1027e12dc1a0d7586e8939d9cf789b40f51ac0442961de7d21cc21e05c83155c1f2aa9193387cfdf956cb48d153ba270406f9bbba537d4987d9e2f9942d7a14cbfffea74fecdda928d23e259f5ee1026100db16802f79a2f0d45f358d69fd33e44b81fae828622e93a54253e997d01b0743759da0e812b4aa4e6c8beab2328d5431955a418a67ff26a8c5c807a5da354e05ef31cc8cf758f463732950b03e265726fb94e39d6a572a26244ab08db75752ad026100a0a317cfe7df1423f87a6dee8451f4e2b4a67e5497f29b4f1e4e830b9fadd9401167026f5596e5a39c97817e0f5f16e27e19ec9902e01d7ea6fb9aa3c760afee1e381b69de6ac9c07585a06ad9c4ba00bf75c8ad2fa898a479e80ae294fed2a102600b21f335c353342eb44c3aa24445780c2d655b940174cae38c7c8a4e6493c0ba9fd303748267b083b9a7a6cb61e42db362b8c9896db7064e02ad5ae61587da15b4649c90594909feb37dbcb654beb7268ec801e5a8b4aa3911bebd88542f05be\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 267bcd118acab1fc8ba81c85d73003cb8610fa55c1d97da8d48a7c7f06896a4db751aa284255b9d36ad65f37653d829f1b37f97b8001942545b2fc2c55a7376ca7a1be4b1760c8e05a33e5aa2526b8d98e317088e7834c755b2a59b12631a182c05d5d43ab1779264f8456f515ce57dfdf512d5493dab7b7338dc4b7d78db9c091ac3baf537a69fc7f549d979f0eff9a94fda4169bd4d1d19a69c99e33c3b55490d501b39b1edae118ff6793a153261584d3a5f39f6e682e3d17c8cd1261fa72\nOutput = f735fd55ba92592c3b52b8f9c4f69aaa1cbef8fe88add095595412467f9cf4ec0b896c59eda16210e7549c8abb10cdbc21a12ec9b6b5b8fd2f10399eb6\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 93ac9f0671ec29acbb444effc1a5741351d60fdb0e393fbf754acf0de49761a14841df7772e9bc82773966a1584c4d72baea00118f83f35cca6e537cbd4d811f5583b29783d8a6d94cd31be70d6f526c10ff09c6fa7ce069795a3fcd0511fd5fcb564bcc80ea9c78f38b80012539d8a4ddf6fe81e9cddb7f50dbbbbcc7e5d86097ccf4ec49189fb8bf318be6d5a0715d516b49af191258cd32dc833ce6eb4673c03a19bbace88cc54895f636cc0c1ec89096d11ce235a265ca1764232a689ae8\nOutput = 81b906605015a63aabe42ddf11e1978912f5404c7474b26dce3ed482bf961ecc818bf420c54659\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 81ebdd95054b0c822ef9ad7693f5a87adfb4b4c4ce70df2df84ed49c04da58ba5fc20a19e1a6e8b7a3900b22796dc4e869ee6b42792d15a8eceb56c09c69914e813cea8f6931e4b8ed6f421af298d595c97f4789c7caa612c7ef360984c21b93edc5401068b5af4c78a8771b984d53b8ea8adf2f6a7d4a0ba76c75e1dd9f658f20ded4a46071d46d7791b56803d8fea7f0b0f8e41ae3f09383a6f9585fe7753eaaffd2bf94563108beecc207bbb535f5fcc705f0dde9f708c62f49a9c90371d3\nOutput = fd326429df9b890e09b54b18b8f34f1e24\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = bcc35f94cde66cb1136625d625b94432a35b22f3d2fa11a613ff0fca5bd57f87b902ccdc1cd0aebcb0715ee869d1d1fe395f6793003f5eca465059c88660d446ff5f0818552022557e38c08a67ead991262254f10682975ec56397768537f4977af6d5f6aaceb7fb25dec5937230231fd8978af49119a29f29e424ab8272b47562792d5c94f774b8829d0b0d9f1a8c9eddf37574d5fa248eefa9c5271fc5ec2579c81bdd61b410fa61fe36e424221c113addb275664c801d34ca8c6351e4a858\nOutput = f1459b5f0c92f01a0f723a2e5662484d8f8c0a20fc29dad6acd43bb5f3effdf4e1b63e07fdfe6628d0d74ca19bf2d69e4a0abf86d293925a796772f8088e\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 232afbc927fa08c2f6a27b87d4a5cb09c07dc26fae73d73a90558839f4fd66d281b87ec734bce237ba166698ed829106a7de6942cd6cdce78fed8d2e4d81428e66490d036264cef92af941d3e35055fe3981e14d29cbb9a4f67473063baec79a1179f5a17c9c1832f2838fd7d5e59bb9659d56dce8a019edef1bb3accc697cc6cc7a778f60a064c7f6f5d529c6210262e003de583e81e3167b89971fb8c0e15d44fffef89b53d8d64dd797d159b56d2b08ea5307ea12c241bd58d4ee278a1f2e\nOutput = 53e6e8c729d6f9c319dd317e74b0db8e4ccca25f3c8305746e137ac63a63ef3739e7b595abb96e8d55e54f7bd41ab433378ffb911d\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 438cc7dc08a68da249e42505f8573ba60e2c2773d5b290f4cf9dff718e842081c383e67024a0f29594ea987b9d25e4b738f285970d195abb3a8c8054e3d79d6b9c9a8327ba596f1259e27126674766907d8d582ff3a8476154929adb1e6d1235b2ccb4ec8f663ba9cc670a92bebd853c8dbf69c6436d016f61add836e94732450434207f9fd4c43dec2a12a958efa01efe2669899b5e604c255c55fb7166de5589e369597bb09168c06dd5db177e06a1740eb2d5c82faeca6d92fcee9931ba9f\nOutput = b6b28ea2198d0c1008bc64\n\nPrivateKey = RSA-OAEP-10\nType = RSA\nInput = 308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb020301000102820100056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e7902818100ecf5aecd1e5515fffacbd75a2816c6ebf49018cdfb4638e185d66a7396b6f8090f8018c7fd95cc34b857dc17f0cc6516bb1346ab4d582cadad7b4103352387b70338d084047c9d9539b6496204b3dd6ea442499207bec01f964287ff6336c3984658336846f56e46861881c10233d2176bf15a5e96ddc780bc868aa77d3ce76902818100bc46c464fc6ac4ca783b0eb08a3c841b772f7e9b2f28babd588ae885e1a0c61e4858a0fb25ac299990f35be85164c259ba1175cdd7192707135184992b6c29b746dd0d2cabe142835f7d148cc161524b4a09946d48b828473f1ce76b6cb6886c345c03e05f41d51b5c3a90a3f24073c7d74a4fe25d9cf21c75960f3fc386318302818100c73564571d00fb15d08a3de9957a50915d7126e9442dacf42bc82e862e5673ff6a008ed4d2e374617df89f17a160b43b7fda9cb6b6b74218609815f7d45ca263c159aa32d272d127faf4bc8ca2d77378e8aeb19b0ad7da3cb3de0ae7314980f62b6d4b0a875d1df03c1bae39ccd833ef6cd7e2d9528bf084d1f969e794e9f6c10281802658b37f6df9c1030be1db68117fa9d87e39ea2b693b7e6d3a2f70947413eec6142e18fb8dfcb6ac545d7c86a0ad48f8457170f0efb26bc48126c53efd1d16920198dc2a1107dc282db6a80cd3062360ba3fa13f70e4312ff1a6cd6b8fc4cd9c5c3db17c6d6a57212f73ae29f619327bad59b153858585ba4e28b60a62a45e490281806f38526b3925085534ef3e415a836ede8b86158a2c7cbfeccb0bd834304fec683ba8d4f479c433d43416e63269623cea100776d85aff401d3fff610ee65411ce3b1363d63a9709eede42647cea561493d54570a879c18682cd97710b96205ec31117d73b5f36223fadd6e8ba90dd7c0ee61d44e163251e20c7f66eb305117cb8\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 53ea5dc08cd260fb3b858567287fa91552c30b2febfba213f0ae87702d068d19bab07fe574523dfb42139d68c3c5afeee0bfe4cb7969cbf382b804d6e61396144e2d0e60741f8993c3014b58b9b1957a8babcd23af854f4c356fb1662aa72bfcc7e586559dc4280d160c126785a723ebeebeff71f11594440aaef87d10793a8774a239d4a04c87fe1467b9daf85208ec6c7255794a96cc29142f9a8bd418e3c1fd67344b0cd0829df3b2bec60253196293c6b34d3f75d32f213dd45c6273d505adf4cced1057cb758fc26aeefa441255ed4e64c199ee075e7f16646182fdb464739b68ab5daff0e63e9552016824f054bf4d3c8c90a97bb6b6553284eb429fcc\nOutput = 8bba6bf82a6c0f86d5f1756e97956870b08953b06b4eb205bc1694ee\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Dig", - "est = SHA1\nInput = a2b1a430a9d657e2fa1c2bb5ed43ffb25c05a308fe9093c01031795f5874400110828ae58fb9b581ce9dddd3e549ae04a0985459bde6c626594e7b05dc4278b2a1465c1368408823c85e96dc66c3a30983c639664fc4569a37fe21e5a195b5776eed2df8d8d361af686e750229bbd663f161868a50615e0c337bec0ca35fec0bb19c36eb2e0bbcc0582fa1d93aacdb061063f59f2ce1ee43605e5d89eca183d2acdfe9f81011022ad3b43a3dd417dac94b4e11ea81b192966e966b182082e71964607b4f8002f36299844a11f2ae0faeac2eae70f8f4f98088acdcd0ac556e9fccc511521908fad26f04c64201450305778758b0538bf8b5bb144a828e629795\nOutput = e6ad181f053b58a904f2457510373e57\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 9886c3e6764a8b9a84e84148ebd8c3b1aa8050381a78f668714c16d9cfd2a6edc56979c535d9dee3b44b85c18be8928992371711472216d95dda98d2ee8347c9b14dffdff84aa48d25ac06f7d7e65398ac967b1ce90925f67dce049b7f812db0742997a74d44fe81dbe0e7a3feaf2e5c40af888d550ddbbe3bc20657a29543f8fc2913b9bd1a61b2ab2256ec409bbd7dc0d17717ea25c43f42ed27df8738bf4afc6766ff7aff0859555ee283920f4c8a63c4a7340cbafddc339ecdb4b0515002f96c932b5b79167af699c0ad3fccfdf0f44e85a70262bf2e18fe34b850589975e867ff969d48eabf212271546cdc05a69ecb526e52870c836f307bd798780ede\nOutput = 510a2cf60e866fa2340553c94ea39fbc256311e83e94454b4124\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 6318e9fb5c0d05e5307e1683436e903293ac4642358aaa223d7163013aba87e2dfda8e60c6860e29a1e92686163ea0b9175f329ca3b131a1edd3a77759a8b97bad6a4f8f4396f28cf6f39ca58112e48160d6e203daa5856f3aca5ffed577af499408e3dfd233e3e604dbe34a9c4c9082de65527cac6331d29dc80e0508a0fa7122e7f329f6cca5cfa34d4d1da417805457e008bec549e478ff9e12a763c477d15bbb78f5b69bd57830fc2c4ed686d79bc72a95d85f88134c6b0afe56a8ccfbc855828bb339bd17909cf1d70de3335ae07039093e606d655365de6550b872cd6de1d440ee031b61945f629ad8a353b0d40939e96a3c450d2a8d5eee9f678093c8\nOutput = bcdd190da3b7d300df9a06e22caae2a75f10c91ff667b7c16bde8b53064a2649a94045c9\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 75290872ccfd4a4505660d651f56da6daa09ca1301d890632f6a992f3d565cee464afded40ed3b5be9356714ea5aa7655f4a1366c2f17c728f6f2c5a5d1f8e28429bc4e6f8f2cff8da8dc0e0a9808e45fd09ea2fa40cb2b6ce6ffff5c0e159d11b68d90a85f7b84e103b09e682666480c657505c0929259468a314786d74eab131573cf234bf57db7d9e66cc6748192e002dc0deea930585f0831fdcd9bc33d51f79ed2ffc16bcf4d59812fcebcaa3f9069b0e445686d644c25ccf63b456ee5fa6ffe96f19cdf751fed9eaf35957754dbf4bfea5216aa1844dc507cb2d080e722eba150308c2b5ff1193620f1766ecf4481bafb943bd292877f2136ca494aba0\nOutput = a7dd6c7dc24b46f9dd5f1e91ada4c3b3df947e877232a9\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2d207a73432a8fb4c03051b3f73b28a61764098dfa34c47a20995f8115aa6816679b557e82dbee584908c6e69782d7deb34dbd65af063d57fca76a5fd069492fd6068d9984d209350565a62e5c77f23038c12cb10c6634709b547c46f6b4a709bd85ca122d74465ef97762c29763e06dbc7a9e738c78bfca0102dc5e79d65b973f28240caab2e161a78b57d262457ed8195d53e3c7ae9da021883c6db7c24afdd2322eac972ad3c354c5fcef1e146c3a0290fb67adf007066e00428d2cec18ce58f9328698defef4b2eb5ec76918fde1c198cbb38b7afc67626a9aefec4322bfd90d2563481c9a221f78c8272c82d1b62ab914e1c69f6af6ef30ca5260db4a46\nOutput = eaf1a73a1b0c4609537de69cd9228bbcfb9a8ca8c6c3efaf056fe4a7f4634ed00b7c39ec6922d7b8ea2c04ebac\n\n\n# Single-shot signing tests.\n\nSignMessage = RSA-2048\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = RSA-2048\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = RSA-2048-SPKI\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = P-256\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 304502204c66004635c267394bd6857c1e0b53b22a2bab1ca7dff9d5c1b42143858b3ea7022100ae81228510e03cd49a8863d2ebd1c05fe0c87eacd1150433132b909994cd0dbd\n\n# Digest can't be omitted in many algorithms.\nSignMessage = RSA-2048\nInput = \"Hello world\"\nError = NO_DEFAULT_DIGEST\n\nVerifyMessage = RSA-2048\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\nError = NO_DEFAULT_DIGEST\n\n# Signing test vectors from RFC 8032.\nSignMessage = Ed25519\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nSignMessage = Ed25519-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nSignMessage = Ed25519-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nSignMessage = Ed25519-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497", - "f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nSignMessage = Ed25519-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\n# Signing with public keys is not allowed.\nSignMessage = Ed25519-SPKI\nInput = \"\"\nError = NOT_A_PRIVATE_KEY\n\n# Verify test vectors from RFC 8032. Test verifying with both the public and\n# private key.\nVerifyMessage = Ed25519\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nVerifyMessage = Ed25519-SPKI\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nVerifyMessage = Ed25519-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nVerifyMessage = Ed25519-SPKI-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nVerifyMessage = Ed25519-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nVerifyMessage = Ed25519-SPKI-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nVerifyMessage = Ed25519-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nVerifyMessage = Ed25519-SPKI-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nVerifyMessage = Ed25519-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\nVerifyMessage = Ed25519-SPKI-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\n# Length is wrong.\nVerifyMessage = Ed25519-SPKI\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a10\nError = INVALID_SIGNATURE\n\n# Message is wrong.\nVerifyMessage = Ed25519-SPKI\nInput = \"Hello world\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\nError = INVALID_SIGNATURE\n\n# Ed25519 does not support configuring a digest.\nSignMessage = Ed25519\nInput = \"\"\nDigest = SHA256\nError = COMMAND_NOT_SUPPORTED\n\n# Ed25519 does not support signing a pre-hashed value.\nSign = Ed25519\nInput = \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\"\nError = OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\n\nVerify = Ed25519\nInput = \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\nError = OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\n", + "848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = BAD_SIGNATURE\n\n# Digest too short\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDE\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = INVALID_MESSAGE_LENGTH\n\n# Digest too long\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF0\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = INVALID_MESSAGE_LENGTH\n\n# Wrong salt length\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 2\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = SLEN_CHECK_FAILED\n\n# Wrong salt length using implicit hash length\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = -1\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = SLEN_CHECK_FAILED\n\n# Wrong MGF1 digest, SHA-1\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nMGF1Digest = SHA1\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n# If SHA-1, this input happens to succeed recovering a salt length, but it does\n# not match.\nError = SLEN_CHECK_FAILED\n\n# Wrong MGF1 digest, SHA-384\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nMGF1Digest = SHA384\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\n# If SHA-384, this input happens fail to recover the salt length altogether.\nError = SLEN_RECOVERY_FAILED\n\n# The salt length is too large for the modulus (signing).\nSign = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 223\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE\n\n# The salt length is too large for the modulus (verifying).\nVerify = RSA-2048\nRSAPadding = PSS\nPSSSaltLength = 223\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4de433d5844043ef08d354da03cb29068780d52706d7d1e4d50efb7d58c9d547d83a747ddd0635a96b28f854e50145518482cb49e963054621b53c60c498d07c16e9c2789c893cf38d4d86900de71bde463bd2761d1271e358c7480a1ac0bab930ddf39602ad1bc165b5d7436b516b7a7858e8eb7ab1c420eeb482f4d207f0e462b1724959320a084e13848d11d10fb593e66bf680bf6d3f345fc3e9c3de60abbac37e1c6ec80a268c8d9fc49626c679097aa690bc1aa662b95eb8db70390861aa0898229f9349b4b5fdd030d4928c47084708a933144be23bd3c6e661b85b2c0ef9ed36d498d5b7320e8194d363d4ad478c059bae804181965e0b81b663158a\nError = DATA_TOO_LARGE\n\n# The hash is too large for the modulus (signing).\nSign = RSA-512\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE\n\nSign = RSA-512\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nError = DATA_TOO_LARGE\n\n# The hash is too large for the modulus (verifying).\nVerify = RSA-512\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nOutput = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nError = DATA_TOO_LARGE\n\nVerify = RSA-512\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA512\nInput = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\"\nOutput = 457001d9ca50a93385fc5ec721c9dbbe7a0f2e9e4a2f846a30a8811dde66347b83901c7492039243537c7a667fafffd69049bcbd36afd0010d9b425e2d8785c1\nError = DATA_TOO_LARGE\n\n# Sample RSA-515 signature.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 00c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\n\n# The above, but with too few leading zeros.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\nError = DATA_LEN_NOT_EQUAL_TO_MOD_LEN\n\n# The above, but with too many leading zeros.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 0000c5926600f160f85e7fe950cfe123908384211cd8fe25c90cb8e8cc0593308e9aa2efe3acbf100ec1658ded8f72f506525fc2c44f06251b08d896e7bb3f05b135\nError = DATA_LEN_NOT_EQUAL_TO_MOD_LEN\n\n# The above with an invalid leading byte. The top few bits of EM are required to\n# be cleared.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 007f803c832a2090aea04013d9fa9c1630732a1625232826d235f0950f7050d3fb0eb06ef9ea8b260fad68e1165a2d770a8c7fc7a8aaa68620b021fc19c97e0041\nError = FIRST_OCTET_INVALID\n\n# The above with an invalid trailing byte.\nVerify = RSA-515\nRSAPadding = PSS\nPSSSaltLength = 0\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 03e68555035891eb08d96c0967db22328cd892ad2856d88516ecb946bfdba732bb029b5c0dfa2119ed7349897d2324e95e86d91d0c4afc82700a36db8933a", + "bbf58\nError = LAST_OCTET_INVALID\n\n# Non-zero salt length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 32\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n# Non-zero salt length, wrong salt length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = 31\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\nError = SLEN_CHECK_FAILED\n\n# Non-zero salt length, match hash length.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = -1\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n# Non-zero salt length, auto-detected.\nVerify = RSA-2048-SPKI\nRSAPadding = PSS\nPSSSaltLength = -2\nDigest = SHA256\nInput = \"0123456789ABCDEF0123456789ABCDEF\"\nOutput = 4065b284b0a6e98d4c41a8427007f878d8dd61599c87764fa79b8bf03f030c48127a4b1a5af5a6e0cf9055e57a1f47e5b0c0d8c600e78369cf1c39374899fac91a812692aa2216ba10900ce85a5cf7fddcafb726e4b83479c5bb7b3b84b08ffe183b4c2973aa3193ec7b7d4ea73bf1b579c6657b78ad7800e1975a4838c28ffe353fafef96be27b5c69677760a71b6f4df65ba6fe6b3565580a536f966928294c6e9ece807a90c1477779bcbfa3a250e98d685097c162c1c8c56ab02bd2e16eec7a019b51c067bdba7fa8cd5460796e22c607a8b6d12e1deb9be51c6943c46590f416800c48bb4cbb8c409d316573e59eadf7d3b9e6e5c2d0e570692e511e139\n\n\n# RSA decrypt\n\nDecrypt = RSA-2048\nInput = 550af55a2904e7b9762352f8fb7fa235a9cb053aacb2d5fcb8ca48453cb2ee3619746c701abf2d4cc67003471a187900b05aa812bd25ed05c675dfc8c97a24a7bf49bd6214992cad766d05a9a2b57b74f26a737e0237b8b76c45f1f226a836d7cfbc75ba999bdbe48dbc09227aa46c88f21dccba7840141ad5a5d71fd122e6bd6ac3e564780dfe623fc1ca9b995a6037bf0bbd43b205a84ac5444f34202c05ce9113087176432476576de6ffff9a52ea57c08be3ec2f49676cb8e12f762ac71fa3c321e00ac988910c85ff52f93825666ce0d40ffaa0592078919d4493f46d95ccf76364c6d57760dd0b64805f9afc76a2365a5575ca301d5103f0ea76cb9a78\nOutput = \"Hello World\"\n\n# Corrupted ciphertext\nDecrypt = RSA-2048\nInput = 550af55a2904e7b9762352f8fb7fa235a9cb053aacb2d5fcb8ca48453cb2ee3619746c701abf2d4cc67003471a187900b05aa812bd25ed05c675dfc8c97a24a7bf49bd6214992cad766d05a9a2b57b74f26a737e0237b8b76c45f1f226a836d7cfbc75ba999bdbe48dbc09227aa46c88f21dccba7840141ad5a5d71fd122e6bd6ac3e564780dfe623fc1ca9b995a6037bf0bbd43b205a84ac5444f34202c05ce9113087176432476576de6ffff9a52ea57c08be3ec2f49676cb8e12f762ac71fa3c321e00ac988910c85ff52f93825666ce0d40ffaa0592078919d4493f46d95ccf76364c6d57760dd0b64805f9afc76a2365a5575ca301d5103f0ea76cb9a79\nError = PKCS_DECODING_ERROR\n\n# OAEP padding\nDecrypt = RSA-2048\nRSAPadding = OAEP\nInput = 458708dfbd42a1297ce7a9c86c7087ab80b1754810929b89c5107ca55368587686986fce94d86cc1595b3fb736223a656ec0f34d18ba1cc5665593610f56c58e26b272d584f3d983a5c91085700755aebd921fb280bba3eda7046ec07b43e7298e52d59edc92be4639a8ce08b2f85976ecf6d98cc469eeb9d5d8e2a32ea8a6626edafe1038b3df455668a9f3c77cad8b92fb872e00058c3d2a7ede1a1f03fc5622084ae04d9d24f6bf0995c58d35b93b699b9763595e123f2ab0863cc9229eb290e2ede7715c7a8f39e0b9a3e2e1b56ebb62f1cbfbb5986fb212ebd785b83d01d968b11d1756c7337f70c1f1a63bff03608e24f3a2fd44e67f832a8701c5d5af\nOutput = \"Hello World\"\n\n# OAEP padding, corrupted ciphertext\nDecrypt = RSA-2048\nRSAPadding = OAEP\nInput = 458708dfbd42a1297ce7a9c86c7087ab80b1754810929b89c5107ca55368587686986fce94d86cc1595b3fb736223a656ec0f34d18ba1cc5665593610f56c58e26b272d584f3d983a5c91085700755aebd921fb280bba3eda7046ec07b43e7298e52d59edc92be4639a8ce08b2f85976ecf6d98cc469eeb9d5d8e2a32ea8a6626edafe1038b3df455668a9f3c77cad8b92fb872e00058c3d2a7ede1a1f03fc5622084ae04d9d24f6bf0995c58d35b93b699b9763595e123f2ab0863cc9229eb290e2ede7715c7a8f39e0b9a3e2e1b56ebb62f1cbfbb5986fb212ebd785b83d01d968b11d1756c7337f70c1f1a63bff03608e24f3a2fd44e67f832a8701c5d5ac\nError = OAEP_DECODING_ERROR\n\n\n# EC tests\n\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\n\nVerify = P-256-SPKI\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\n\n# Digest too long\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF12345\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Digest too short\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF123\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Digest invalid\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1235\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec8\nError = BAD_SIGNATURE\n\n# Invalid signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec7\nError = BAD_SIGNATURE\n\n# Garbage after signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3045022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec800\nError = BAD_SIGNATURE\n\n# BER signature\nVerify = P-256\nDigest = SHA1\nInput = \"0123456789ABCDEF1234\"\nOutput = 3080022100b1d1cb1a577035bccdd5a86c6148c2cc7c633cd42b7234139b593076d041e15202201898cdd52b41ca502098184b409cf83a21bc945006746e3b7cea52234e043ec80000\nError = BAD_SIGNATURE\n\n\n# Additional RSA-PSS and RSA-OAEP tests converted from\n# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip\n\nPublicKey = RSA-PSS-1\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818100a56e4a0e701017589a5187dc7ea841d156f2ec0e36ad52a44dfeb1e61f7ad991d8c51056ffedb162b4c0f283a12a88a394dff526ab7291cbb307ceabfce0b1dfd5cd9508096d5b2b8b6df5d671ef6377c0921cb23c270a70e2598e6ff89d19f105acc2d3f0cb35f29280e1386b6f64c4ef22e1e1f20d0ce8cffb2249bd9a21370203010001\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = cd8b6538cb8e8de566b68bd067569dbf1ee2718e\nOutput = 9074308fb598e9701b2294388e52f971faac2b60a5145af185df5287b5ed2887e57ce7fd44dc8634e407c8e0e4360bc226f3ec227f9d9e54638e8d31f5051215df6ebb9c2f9579aa77598a38f914b5b9c1bd83c4e2f9f382a0d0aa3542ffee65984a601bc69eb28deb27dca12c82c2d4c3f66cd500f1ff2b994d8a4e30cbb33c\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e35befc17a1d160b9ce35fbd8eb16e7ee491d3fd\nOutput = 3ef7f46e831bf92b32274142a585ffcefbdca7b32ae90d10fb0f0c729984f04ef29a9df0780775ce4", + "3739b97838390db0a5505e63de927028d9d29b219ca2c4517832558a55d694a6d25b9dab66003c4cccd907802193be5170d26147d37b93590241be51c25055f47ef62752cfbe21418fafe98c22c4d4d47724fdb5669e843\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0652ec67bcee30f9d2699122b91c19abdba89f91\nOutput = 666026fba71bd3e7cf13157cc2c51a8e4aa684af9778f91849f34335d141c00154c4197621f9624a675b5abc22ee7d5baaffaae1c9baca2cc373b3f33e78e6143c395a91aa7faca664eb733afd14d8827259d99a7550faca501ef2b04e33c23aa51f4b9e8282efdb728cc0ab09405a91607c6369961bc8270d2d4f39fce612b1\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 39c21c4cceda9c1adf839c744e1212a6437575ec\nOutput = 4609793b23e9d09362dc21bb47da0b4f3a7622649a47d464019b9aeafe53359c178c91cd58ba6bcb78be0346a7bc637f4b873d4bab38ee661f199634c547a1ad8442e03da015b136e543f7ab07c0c13e4225b8de8cce25d4f6eb8400f81f7e1833b7ee6e334d370964ca79fdb872b4d75223b5eeb08101591fb532d155a6de87\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 36dae913b77bd17cae6e7b09453d24544cebb33c\nOutput = 1d2aad221ca4d31ddf13509239019398e3d14b32dc34dc5af4aeaea3c095af73479cf0a45e5629635a53a018377615b16cb9b13b3e09d671eb71e387b8545c5960da5a64776e768e82b2c93583bf104c3fdb23512b7b4e89f633dd0063a530db4524b01c3f384c09310e315a79dcd3d684022a7f31c865a664e316978b759fad\n\nVerify = RSA-PSS-1\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 45eef191f4f79c31fe5d2ede7e5098994e929d2d\nOutput = 2a34f6125e1f6b0bf971e84fbd41c632be8f2c2ace7de8b6926e31ff93e9af987fbc06e51e9be14f5198f91f3f953bd67da60a9df59764c3dc0fe08e1cbef0b75f868d10ad3fba749fef59fb6dac46a0d6e504369331586f58e4628f39aa278982543bc0eeb537dc61958019b394fb273f215858a0a01ac4d650b955c67f4c58\n\nPublicKey = RSA-PSS-2\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818101d40c1bcf97a68ae7cdbd8a7bf3e34fa19dcca4ef75a47454375f94514d88fed006fb829f8419ff87d6315da68a1ff3a0938e9abb3464011c303ad99199cf0c7c7a8b477dce829e8844f625b115e5e9c4a59cf8f8113b6834336a2fd2689b472cbb5e5cabe674350c59b6c17e176874fb42f8fc3d176a017edc61fd326c4b33c90203010001\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 5c81a3e2a658246628cd0ee8b00bb4c012bc9739\nOutput = 014c5ba5338328ccc6e7a90bf1c0ab3fd606ff4796d3c12e4b639ed9136a5fec6c16d8884bdd99cfdc521456b0742b736868cf90de099adb8d5ffd1deff39ba4007ab746cefdb22d7df0e225f54627dc65466131721b90af445363a8358b9f607642f78fab0ab0f43b7168d64bae70d8827848d8ef1e421c5754ddf42c2589b5b3\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 27f71611446aa6eabf037f7dedeede3203244991\nOutput = 010991656cca182b7f29d2dbc007e7ae0fec158eb6759cb9c45c5ff87c7635dd46d150882f4de1e9ae65e7f7d9018f6836954a47c0a81a8a6b6f83f2944d6081b1aa7c759b254b2c34b691da67cc0226e20b2f18b42212761dcd4b908a62b371b5918c5742af4b537e296917674fb914194761621cc19a41f6fb953fbcbb649dea\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 03ecc2c33e93f05fc7224fcc0d461356cb897217\nOutput = 007f0030018f53cdc71f23d03659fde54d4241f758a750b42f185f87578520c30742afd84359b6e6e8d3ed959dc6fe486bedc8e2cf001f63a7abe16256a1b84df0d249fc05d3194ce5f0912742dbbf80dd174f6c51f6bad7f16cf3364eba095a06267dc3793803ac7526aebe0a475d38b8c2247ab51c4898df7047dc6adf52c6c4\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 246c727b4b9494849dddb068d582e179ac20999c\nOutput = 009cd2f4edbe23e12346ae8c76dd9ad3230a62076141f16c152ba18513a48ef6f010e0e37fd3df10a1ec629a0cb5a3b5d2893007298c30936a95903b6ba85555d9ec3673a06108fd62a2fda56d1ce2e85c4db6b24a81ca3b496c36d4fd06eb7c9166d8e94877c42bea622b3bfe9251fdc21d8d5371badad78a488214796335b40b\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e8617ca3ea66ce6a58ede2d11af8c3ba8a6ba912\nOutput = 00ec430824931ebd3baa43034dae98ba646b8c36013d1671c3cf1cf8260c374b19f8e1cc8d965012405e7e9bf7378612dfcc85fce12cda11f950bd0ba8876740436c1d2595a64a1b32efcfb74a21c873b3cc33aaf4e3dc3953de67f0674c0453b4fd9f604406d441b816098cb106fe3472bc251f815f59db2e4378a3addc181ecf\n\nVerify = RSA-PSS-2\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7a6fdc1a4e434ecbc35d657ad49a2f4fafd43bc8\nOutput = 00475b1648f814a8dc0abdc37b5527f543b666bb6e39d30e5b49d3b876dccc58eac14e32a2d55c2616014456ad2f246fc8e3d560da3ddf379a1c0bd200f10221df078c219a151bc8d4ec9d2fc2564467811014ef15d8ea01c2ebbff8c2c8efab38096e55fcbe3285c7aa558851254faffa92c1c72b78758663ef4582843139d7a6\n\nPublicKey = RSA-PSS-3\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818102f246ef451ed3eebb9a310200cc25859c048e4be798302991112eb68ce6db674e280da21feded1ae74880ca522b18db249385012827c515f0e466a1ffa691d98170574e9d0eadb087586ca48933da3cc953d95bd0ed50de10ddcb6736107d6c831c7f663e833ca4c097e700ce0fb945f88fb85fe8e5a773172565b914a471a4430203010001\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3552be69dd74bdc56d2cf8c38ef7bafe269040fe\nOutput = 0088b135fb1794b6b96c4a3e678197f8cac52b64b2fe907d6f27de761124964a99a01a882740ecfaed6c01a47464bb05182313c01338a8cd097214cd68ca103bd57d3bc9e816213e61d784f182467abf8a01cf253e99a156eaa8e3e1f90e3c6e4e3aa2d83ed0345b89fafc9c26077c14b6ac51454fa26e446e3a2f153b2b16797f\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 609143ff7240e55c062aba8b9e4426a781919bc9\nOutput = 02a5f0a858a0864a4f65017a7d69454f3f973a2999839b7bbc48bf78641169179556f595fa41f6ff18e286c2783079bc0910ee9cc34f49ba681124f923dfa88f426141a368a5f5a930c628c2c3c200e18a7644721a0cbec6dd3f6279bde3e8f2be5e2d4ee56f97e7ceaf33054be7042bd91a63bb09f897bd41e81197dee99b11af\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0afd22f879a9cda7c584f4135f8f1c961db114c0\nOutput = 0244bcd1c8c16955736c803be401272e18cb990811b14f72db964124d5fa760649cbb57afb8755dbb62bf51f466cf23a0a1607576e983d778fceffa92df7548aea8ea4ecad2c29dd9f95bc07fe91ecf8bee255bfe8762fd7690aa9bfa4fa0849ef728c2c42c4532364522df2ab7f9f8a03b63f7a499175828668f5ef5a29e3802c\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 405dd56d395ef0f01b555c48f748cc32b210650b\nOutput = 0196f12a005b98129c8df13c4cb16f8aa887d3c40d96df3a88e7532ef39cd992f273abc370bc1be6f097cfebbf0118fd9ef4b927155f3df22b904d90702d1f7ba7a52bed8b8942f412cd7bd676c9d18e170391dcd345c06a730964b3f30bcce0bb20ba106f9ab0eeb39cf8a6607f75c0347f0af79f16afa081d2c92d1ee6f836b8\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = a2c313b0440c8a0c47233b87f0a160c61af3eae7\nOutput = 021eca3ab4892264ec22411a752d92221076d4e01c0e6f0dde9afd26ba5acf6d739ef987545d16683e5674c9e70f1de649d7e61d48d0caeb4fb4d8b24fba84a6e3108fee7d0705973266ac524b4ad280f7ae17dc59d96d3351586b5a3bdb895d1e1f7820ac6135d8753480998382ba32b7349559608c38745290a85ef4e9f9bd83\n\nVerify = RSA-PSS-3\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f1bf6ca7b4bbdbb6bf20a4bf55728725d177154a\nOutput = 012fafec862f56e9e92f60ab0c77824f4299a0ca734ed26e0644d5d222c7f0bde03964f8e70a5cb65ed44e44d56ae0edf1ff86ca032cc5dd4404dbb76ab854586c44eed8336d08d457ce6c03693b45c0f1efef93624b95b8ec169c616d20e5538ebc0b6737a6f82b4bc0570924fc6b35759a3348426279f8b3d7744e2d222426ce\n\nPublicKey = RSA-PSS-4\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181054adb7886447efe6f57e0368f06cf52b0a3370760d161cef126b91be7f89c421b62a6ec1da3c311d75ed50e0ab5fff3fd338acc3aa8a4e77ee26369acb81ba900fa83f5300cf9bb6c53ad1dc8a178b815db4235a9a9da0c06de4e615ea1277ce559e9c108de58c14a81aa77f5a6f8d1335494498848c8b95940740be7bf7c37050203010001\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f8b0abf70fec0bca74f0accbc24f75e6e90d3bfd\nOutput = 0323d5b7bf20ba4539289ae452ae4297080feff4518423ff4811a817837e7d82f1836cdfab54514ff0887bddeebf40bf99b047abc3ecfa6a37a3ef00f4a0c4a88aae0904b745c846c4107e8797723e8ac810d9e3d95dfa30ff4966f4d75d13768d20857f2b1406f264cfe75e27d7652f4b5ed3575f28a702f8c4ed9cf9b2d44948\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 04a10944bfe11ab801e77889f3fd3d7f4ff0b629\nOutput = 049d0185845a264d28feb1e69edaec090609e8e46d93abb38371ce51f4aa65a599bdaaa81d24fba66a08a116cb644f3f1e653d95c89db8bbd5daac2709c8984000178410a7c6aa8667ddc38c741f710ec8665aa9052be929d4e3b16782c1662114c5414bb0353455c392fc28f3db59054b5f365c49e1d156f876ee10cb4fd70598\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ba01243db223eb97fb86d746c3148adaaa0ca344\nOutput = 03fbc410a2ced59500fb99f9e2af2781ada74e13145624602782e2994813eefca0519ecd253b855fb626a90d771eae028b0c47a199cbd9f8e3", + "269734af4163599090713a3fa910fa0960652721432b971036a7181a2bc0cab43b0b598bc6217461d7db305ff7e954c5b5bb231c39e791af6bcfa76b147b081321f72641482a2aad\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 934bb0d38d6836daec9de82a9648d4593da67cd2\nOutput = 0486644bc66bf75d28335a6179b10851f43f09bded9fac1af33252bb9953ba4298cd6466b27539a70adaa3f89b3db3c74ab635d122f4ee7ce557a61e59b82ffb786630e5f9db53c77d9a0c12fab5958d4c2ce7daa807cd89ba2cc7fcd02ff470ca67b229fcce814c852c73cc93bea35be68459ce478e9d4655d121c8472f371d4f\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ec35d81abd1cceac425a935758b683465c8bd879\nOutput = 022a80045353904cb30cbb542d7d4990421a6eec16a8029a8422adfd22d6aff8c4cc0294af110a0c067ec86a7d364134459bb1ae8ff836d5a8a2579840996b320b19f13a13fad378d931a65625dae2739f0c53670b35d9d3cbac08e733e4ec2b83af4b9196d63e7c4ff1ddeae2a122791a125bfea8deb0de8ccf1f4ffaf6e6fb0a\n\nVerify = RSA-PSS-4\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 72ce251d17b04dd3970d6ff1fbe3624899e9e941\nOutput = 00938dcb6d583046065f69c78da7a1f1757066a7fa75125a9d2929f0b79a60b627b082f11f5b196f28eb9daa6f21c05e5140f6aef1737d2023075c05ecf04a028c686a2ab3e7d5a0664f295ce12995e890908b6ad21f0839eb65b70393a7b5afd9871de0caa0cedec5b819626756209d13ab1e7bb9546a26ff37e9a51af9fd562e\n\nPublicKey = RSA-PSS-5\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d003081890281810d10f661f29940f5ed39aa260966deb47843679d2b6fb25b3de370f3ac7c19916391fd25fb527ebfa6a4b4df45a1759d996c4bb4ebd18828c44fc52d0191871740525f47a4b0cc8da325ed8aa676b0d0f626e0a77f07692170acac8082f42faa7dc7cd123e730e31a87985204cabcbe6670d43a2dd2b2ddef5e05392fc213bc5070203010001\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = d98b7061943510bc3dd9162f7169aabdbdcd0222\nOutput = 0ba373f76e0921b70a8fbfe622f0bf77b28a3db98e361051c3d7cb92ad0452915a4de9c01722f6823eeb6adf7e0ca8290f5de3e549890ac2a3c5950ab217ba58590894952de96f8df111b2575215da6c161590c745be612476ee578ed384ab33e3ece97481a252f5c79a98b5532ae00cdd62f2ecc0cd1baefe80d80b962193ec1d\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7ae8e699f754988f4fd645e463302e49a2552072\nOutput = 08180de825e4b8b014a32da8ba761555921204f2f90d5f24b712908ff84f3e220ad17997c0dd6e706630ba3e84add4d5e7ab004e58074b549709565d43ad9e97b5a7a1a29e85b9f90f4aafcdf58321de8c5974ef9abf2d526f33c0f2f82e95d158ea6b81f1736db8d1af3d6ac6a83b32d18bae0ff1b2fe27de4c76ed8c7980a34e\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 8d46c7c05534c1ba2cc7624500d48a4531604bff\nOutput = 05e0fdbdf6f756ef733185ccfa8ced2eb6d029d9d56e35561b5db8e70257ee6fd019d2f0bbf669fe9b9821e78df6d41e31608d58280f318ee34f559941c8df13287574bac000b7e58dc4f414ba49fb127f9d0f8936638c76e85356c994f79750f7fa3cf4fd482df75e3fb9978cd061f7abb17572e6e63e0bde12cbdcf18c68b979\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ee3de96783fd0a157c8b20bf5566124124dcfe65\nOutput = 0bc989853bc2ea86873271ce183a923ab65e8a53100e6df5d87a24c4194eb797813ee2a187c097dd872d591da60c568605dd7e742d5af4e33b11678ccb63903204a3d080b0902c89aba8868f009c0f1c0cb85810bbdd29121abb8471ff2d39e49fd92d56c655c8e037ad18fafbdc92c95863f7f61ea9efa28fea401369d19daea1\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 1204df0b03c2724e2709c23fc71789a21b00ae4c\nOutput = 0aefa943b698b9609edf898ad22744ac28dc239497cea369cbbd84f65c95c0ad776b594740164b59a739c6ff7c2f07c7c077a86d95238fe51e1fcf33574a4ae0684b42a3f6bf677d91820ca89874467b2c23add77969c80717430d0efc1d3695892ce855cb7f7011630f4df26def8ddf36fc23905f57fa6243a485c770d5681fcd\n\nVerify = RSA-PSS-5\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 29926bc3280c841f601acd0d6f17ea38023eddbc\nOutput = 02802dccfa8dfaf5279bf0b4a29ba1b157611faeaaf419b8919d15941900c1339e7e92e6fae562c53e6cc8e84104b110bce03ad18525e3c49a0eadad5d3f28f244a8ed89edbafbb686277cfa8ae909714d6b28f4bf8e293aa04c41efe7c0a81266d5c061e2575be032aa464674ff71626219bd74cc45f0e7ed4e3ff96eee758e8f\n\nPublicKey = RSA-PSS-6\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181164ca31cff609f3a0e7101b039f2e4fe6dd37519ab98598d179e174996598071f47d3a04559158d7be373cf1aa53f0aa6ef09039e5678c2a4c63900514c8c4f8aaed5de12a5f10b09c311af8c0ffb5b7a297f2efc63b8d6b0510931f0b98e48bf5fc6ec4e7b8db1ffaeb08c38e02adb8f03a48229c99e969431f61cb8c4dc698d10203010001\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = ab464e8cb65ae5fdea47a53fa84b234d6bfd52f6\nOutput = 04c0cfacec04e5badbece159a5a1103f69b3f32ba593cb4cc4b1b7ab455916a96a27cd2678ea0f46ba37f7fc9c86325f29733b389f1d97f43e7201c0f348fc45fe42892335362eee018b5b161f2f9393031225c713012a576bc88e23052489868d9010cbf033ecc568e8bc152bdc59d560e41291915d28565208e22aeec9ef85d1\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 92d0bcae82b641f578f040f5151be8eda6d42299\nOutput = 0a2314250cf52b6e4e908de5b35646bcaa24361da8160fb0f9257590ab3ace42b0dc3e77ad2db7c203a20bd952fbb56b1567046ecfaa933d7b1000c3de9ff05b7d989ba46fd43bc4c2d0a3986b7ffa13471d37eb5b47d64707bd290cfd6a9f393ad08ec1e3bd71bb5792615035cdaf2d8929aed3be098379377e777ce79aaa4773\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3569bd8fd2e28f2443375efa94f186f6911ffc2b\nOutput = 086df6b500098c120f24ff8423f727d9c61a5c9007d3b6a31ce7cf8f3cbec1a26bb20e2bd4a046793299e03e37a21b40194fb045f90b18bf20a47992ccd799cf9c059c299c0526854954aade8a6ad9d97ec91a1145383f42468b231f4d72f23706d9853c3fa43ce8ace8bfe7484987a1ec6a16c8daf81f7c8bf42774707a9df456\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7abbb7b42de335730a0b641f1e314b6950b84f98\nOutput = 0b5b11ad549863ffa9c51a14a1106c2a72cc8b646e5c7262509786105a984776534ca9b54c1cc64bf2d5a44fd7e8a69db699d5ea52087a4748fd2abc1afed1e5d6f7c89025530bdaa2213d7e030fa55df6f34bcf1ce46d2edf4e3ae4f3b01891a068c9e3a44bbc43133edad6ecb9f35400c4252a5762d65744b99cb9f4c559329f\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 55b7eb27be7a787a59eb7e5fac468db8917a7725\nOutput = 02d71fa9b53e4654fefb7f08385cf6b0ae3a817942ebf66c35ac67f0b069952a3ce9c7e1f1b02e480a9500836de5d64cdb7ecde04542f7a79988787e24c2ba05f5fd482c023ed5c30e04839dc44bed2a3a3a4fee01113c891a47d32eb8025c28cb050b5cdb576c70fe76ef523405c08417faf350b037a43c379339fcb18d3a356b\n\nVerify = RSA-PSS-6\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = de2fa0367ef49083ff89b9905d3fd646fcc12c38\nOutput = 0a40a16e2fe2b38d1df90546167cf9469c9e3c3681a3442b4b2c2f581deb385ce99fc6188bb02a841d56e76d301891e24560550fcc2a26b55f4ccb26d837d350a154bcaca8392d98fa67959e9727b78cad03269f56968fc56b68bd679926d83cc9cb215550645ccda31c760ff35888943d2d8a1d351e81e5d07b86182e751081ef\n\nPublicKey = RSA-PSS-7\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d0030818902818137c9da4a66c8c408b8da27d0c9d79f8ccb1eafc1d2fe48746d940b7c4ef5dee18ad12647cefaa0c4b3188b221c515386759b93f02024b25ab9242f8357d8f3fd49640ee5e643eaf6c64deefa7089727c8ff03993333915c6ef21bf5975b6e50d118b51008ec33e9f01a0a545a10a836a43ddbca9d8b5c5d3548022d7064ea29ab30203010001\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 8be4afbdd76bd8d142c5f4f46dba771ee5d6d29d\nOutput = 187f390723c8902591f0154bae6d4ecbffe067f0e8b795476ea4f4d51ccc810520bb3ca9bca7d0b1f2ea8a17d873fa27570acd642e3808561cb9e975ccfd80b23dc5771cdb3306a5f23159dacbd3aa2db93d46d766e09ed15d900ad897a8d274dc26b47e994a27e97e2268a766533ae4b5e42a2fcaf755c1c4794b294c60555823\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 402140dc605b2f5c5ec0d15bce9f9ba8857fe117\nOutput = 10fd89768a60a67788abb5856a787c8561f3edcf9a83e898f7dc87ab8cce79429b43e56906941a886194f137e591fe7c339555361fbbe1f24feb2d4bcdb80601f3096bc9132deea60ae13082f44f9ad41cd628936a4d51176e42fc59cb76db815ce5ab4db99a104aafea68f5d330329ebf258d4ede16064bd1d00393d5e1570eb8\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 3e885205892ff2b6b37c2c4eb486c4bf2f9e7f20\nOutput = 2b31fde99859b977aa09586d8e274662b25a2a640640b457f594051cb1e7f7a911865455242926cf88fe80dfa3a75ba9689844a11e634a82b075afbd69c12a0df9d25f84ad4945df3dc8fe90c3cefdf26e95f0534304b5bdba20d3e5640a2ebfb898aac35ae40f26fce5563c2f9f24f3042af76f3c7072d687bbfb959a88460af1\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 1fc2201d0c442a4736cd8b2cd00c959c47a3bf42\nOutput = 32c7ca38ff26949a15000c4ba04b2b13b35a3810e568184d7ecabaa166b7ffabddf2b6cf4ba07124923790f2e5b1a5be040aea36fe132ec130e1f10567982d17ac3e89b8d", + "26c3094034e762d2e031264f01170beecb3d1439e05846f25458367a7d9c02060444672671e64e877864559ca19b2074d588a281b5804d23772fbbe19\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = e4351b66819e5a31501f89acc7faf57030e9aac5\nOutput = 07eb651d75f1b52bc263b2e198336e99fbebc4f332049a922a10815607ee2d989db3a4495b7dccd38f58a211fb7e193171a3d891132437ebca44f318b280509e52b5fa98fcce8205d9697c8ee4b7ff59d4c59c79038a1970bd2a0d451ecdc5ef11d9979c9d35f8c70a6163717607890d586a7c6dc01c79f86a8f28e85235f8c2f1\n\nVerify = RSA-PSS-7\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 49f6cc58365e514e1a3f301f4de16f9fb5347ff2\nOutput = 18da3cdcfe79bfb77fd9c32f377ad399146f0a8e810620233271a6e3ed3248903f5cdc92dc79b55d3e11615aa056a795853792a3998c349ca5c457e8ca7d29d796aa24f83491709befcfb1510ea513c92829a3f00b104f655634f320752e130ec0ccf6754ff893db302932bb025eb60e87822598fc619e0e981737a9a4c4152d33\n\nPublicKey = RSA-PSS-8\nType = RSA\nInput = 30819f300d06092a864886f70d010101050003818d00308189028181495370a1fb18543c16d3631e3163255df62be6eee890d5f25509e4f778a8ea6fbbbcdf85dff64e0d972003ab3681fbba6dd41fd541829b2e582de9f2a4a4e0a2d0900bef4753db3cee0ee06c7dfae8b1d53b5953218f9cceea695b08668edeaadced9463b1d790d5ebf27e9115b46cad4d9a2b8efab0561b0810344739ada0733f0203010001\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = a1dd230d8ead860199b6277c2ecfe3d95f6d9160\nOutput = 0262ac254bfa77f3c1aca22c5179f8f040422b3c5bafd40a8f21cf0fa5a667ccd5993d42dbafb409c520e25fce2b1ee1e716577f1efa17f3da28052f40f0419b23106d7845aaf01125b698e7a4dfe92d3967bb00c4d0d35ba3552ab9a8b3eef07c7fecdbc5424ac4db1e20cb37d0b2744769940ea907e17fbbca673b20522380c5\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = f6e68e53c602c5c65fa67b5aa6d786e5524b12ab\nOutput = 2707b9ad5115c58c94e932e8ec0a280f56339e44a1b58d4ddcff2f312e5f34dcfe39e89c6a94dcee86dbbdae5b79ba4e0819a9e7bfd9d982e7ee6c86ee68396e8b3a14c9c8f34b178eb741f9d3f121109bf5c8172fada2e768f9ea1433032c004a8aa07eb990000a48dc94c8bac8aabe2b09b1aa46c0a2aa0e12f63fbba775ba7e\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = d6f9fcd3ae27f32bb2c7c93536782eba52af1f76\nOutput = 2ad20509d78cf26d1b6c406146086e4b0c91a91c2bd164c87b966b8faa42aa0ca446022323ba4b1a1b89706d7f4c3be57d7b69702d168ab5955ee290356b8c4a29ed467d547ec23cbadf286ccb5863c6679da467fc9324a151c7ec55aac6db4084f82726825cfe1aa421bc64049fb42f23148f9c25b2dc300437c38d428aa75f96\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 7ff2a53ce2e2d900d468e498f230a5f5dd0020de\nOutput = 1e24e6e58628e5175044a9eb6d837d48af1260b0520e87327de7897ee4d5b9f0df0be3e09ed4dea8c1454ff3423bb08e1793245a9df8bf6ab3968c8eddc3b5328571c77f091cc578576912dfebd164b9de5454fe0be1c1f6385b328360ce67ec7a05f6e30eb45c17c48ac70041d2cab67f0a2ae7aafdcc8d245ea3442a6300ccc7\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 4eb309f7022ba0b03bb78601b12931ec7c1be8d3\nOutput = 33341ba3576a130a50e2a5cf8679224388d5693f5accc235ac95add68e5eb1eec31666d0ca7a1cda6f70a1aa762c05752a51950cdb8af3c5379f18cfe6b5bc55a4648226a15e912ef19ad77adeea911d67cfefd69ba43fa4119135ff642117ba985a7e0100325e9519f1ca6a9216bda055b5785015291125e90dcd07a2ca9673ee\n\nVerify = RSA-PSS-8\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 65033bc2f67d6aba7d526acb873b8d9241e5e4d9\nOutput = 1ed1d848fb1edb44129bd9b354795af97a069a7a00d0151048593e0c72c3517ff9ff2a41d0cb5a0ac860d736a199704f7cb6a53986a88bbd8abcc0076a2ce847880031525d449da2ac78356374c536e343faa7cba42a5aaa6506087791c06a8e989335aed19bfab2d5e67e27fb0c2875af896c21b6e8e7309d04e4f6727e69463e\n\nPublicKey = RSA-PSS-9\nType = RSA\nInput = 3081df300d06092a864886f70d01010105000381cd003081c90281c100e6bd692ac96645790403fdd0f5beb8b9bf92ed10007fc365046419dd06c05c5b5b2f48ecf989e4ce269109979cbb40b4a0ad24d22483d1ee315ad4ccb1534268352691c524f6dd8e6c29d224cf246973aec86c5bf6b1401a850d1b9ad1bb8cbcec47b06f0f8c7f45d3fc8f319299c5433ddbc2b3053b47ded2ecd4a4caefd614833dc8bb622f317ed076b8057fe8de3f84480ad5e83e4a61904a4f248fb397027357e1d30e463139815c6fd4fd5ac5b8172a45230ecb6318a04f1455d84e5a8b0203010001\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 2715a49b8b0012cd7aee84c116446e6dfe3faec0\nOutput = 586107226c3ce013a7c8f04d1a6a2959bb4b8e205ba43a27b50f124111bc35ef589b039f5932187cb696d7d9a32c0c38300a5cdda4834b62d2eb240af33f79d13dfbf095bf599e0d9686948c1964747b67e89c9aba5cd85016236f566cc5802cb13ead51bc7ca6bef3b94dcbdbb1d570469771df0e00b1a8a06777472d2316279edae86474668d4e1efff95f1de61c6020da32ae92bbf16520fef3cf4d88f61121f24bbd9fe91b59caf1235b2a93ff81fc403addf4ebdea84934a9cdaf8e1a9e\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 2dac956d53964748ac364d06595827c6b4f143cd\nOutput = 80b6d643255209f0a456763897ac9ed259d459b49c2887e5882ecb4434cfd66dd7e1699375381e51cd7f554f2c271704b399d42b4be2540a0eca61951f55267f7c2878c122842dadb28b01bd5f8c025f7e228418a673c03d6bc0c736d0a29546bd67f786d9d692ccea778d71d98c2063b7a71092187a4d35af108111d83e83eae46c46aa34277e06044589903788f1d5e7cee25fb485e92949118814d6f2c3ee361489016f327fb5bc517eb50470bffa1afa5f4ce9aa0ce5b8ee19bf5501b958\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 28d98c46cccafbd3bc04e72f967a54bd3ea12298\nOutput = 484408f3898cd5f53483f80819efbf2708c34d27a8b2a6fae8b322f9240237f981817aca1846f1084daa6d7c0795f6e5bf1af59c38e1858437ce1f7ec419b98c8736adf6dd9a00b1806d2bd3ad0a73775e05f52dfef3a59ab4b08143f0df05cd1ad9d04bececa6daa4a2129803e200cbc77787caf4c1d0663a6c5987b605952019782caf2ec1426d68fb94ed1d4be816a7ed081b77e6ab330b3ffc073820fecde3727fcbe295ee61a050a343658637c3fd659cfb63736de32d9f90d3c2f63eca\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 0866d2ff5a79f25ef668cd6f31b42dee421e4c0e\nOutput = 84ebeb481be59845b46468bafb471c0112e02b235d84b5d911cbd1926ee5074ae0424495cb20e82308b8ebb65f419a03fb40e72b78981d88aad143053685172c97b29c8b7bf0ae73b5b2263c403da0ed2f80ff7450af7828eb8b86f0028bd2a8b176a4d228cccea18394f238b09ff758cc00bc04301152355742f282b54e663a919e709d8da24ade5500a7b9aa50226e0ca52923e6c2d860ec50ff480fa57477e82b0565f4379f79c772d5c2da80af9fbf325ece6fc20b00961614bee89a183e\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 6a5b4be4cd36cc97dfde9995efbf8f097a4a991a\nOutput = 82102df8cb91e7179919a04d26d335d64fbc2f872c44833943241de8454810274cdf3db5f42d423db152af7135f701420e39b494a67cbfd19f9119da233a23da5c6439b5ba0d2bc373eee3507001378d4a4073856b7fe2aba0b5ee93b27f4afec7d4d120921c83f606765b02c19e4d6a1a3b95fa4c422951be4f52131077ef17179729cddfbdb56950dbaceefe78cb16640a099ea56d24389eef10f8fecb31ba3ea3b227c0a86698bb89e3e9363905bf22777b2a3aa521b65b4cef76d83bde4c\n\nVerify = RSA-PSS-9\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = b9dfd1df76a461c51e6576c6c8ed0a923d1c50e7\nOutput = a7fdb0d259165ca2c88d00bbf1028a867d337699d061193b17a9648e14ccbbaadeacaacdec815e7571294ebb8a117af205fa078b47b0712c199e3ad05135c504c24b81705115740802487992ffd511d4afc6b854491eb3f0dd523139542ff15c3101ee85543517c6a3c79417c67e2dd9aa741e9a29b06dcb593c2336b3670ae3afbac7c3e76e215473e866e338ca244de00b62624d6b9426822ceae9f8cc460895f41250073fd45c5a1e7b425c204a423a699159f6903e710b37a7bb2bc8049f\n\nPublicKey = RSA-PSS-10\nType = RSA\nInput = 30820122300d06092a864886f70d01010105000382010f003082010a0282010100a5dd867ac4cb02f90b9457d48c14a770ef991c56c39c0ec65fd11afa8937cea57b9be7ac73b45c0017615b82d622e318753b6027c0fd157be12f8090fee2a7adcd0eef759f88ba4997c7a42d58c9aa12cb99ae001fe521c13bb5431445a8d5ae4f5e4c7e948ac227d3604071f20e577e905fbeb15dfaf06d1de5ae6253d63a6a2120b31a5da5dabc9550600e20f27d3739e2627925fea3cc509f21dff04e6eea4549c540d6809ff9307eede91fff58733d8385a237d6d3705a33e391900992070df7adf1357cf7e3700ce3667de83f17b8df1778db381dce09cb4ad058a511001a738198ee27cf55a13b754539906582ec8b174bd58d5d1f3d767c613721ae050203010001\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 9596bb630cf6a8d4ea4600422b9eba8b13675dd4\nOutput = 82c2b160093b8aa3c0f7522b19f87354066c77847abf2a9fce542d0e84e920c5afb49ffdfdace16560ee94a1369601148ebad7a0e151cf16331791a5727d05f21e74e7eb811440206935d744765a15e79f015cb66c532c87a6a05961c8bfad741a9a6657022894393e7223739796c02a77455d0f555b0ec01ddf259b6207fd0fd57614cef1a5573baaff4ec00069951659b85f24300a25160ca8522dc6e6727e57d019d7e63629b8fe5e89e25cc15beb3a647577559299280b9b28f79b0409000be25bbd96408ba3b43cc486184dd1c8e62553fa1af4040f60663de7f5e49c04388e257f1ce89c95dab48a315d9b66b1b7628233876ff23852", + "30d070d07e1666\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = b503319399277fd6c1c8f1033cbf04199ea21716\nOutput = 14ae35d9dd06ba92f7f3b897978aed7cd4bf5ff0b585a40bd46ce1b42cd2703053bb9044d64e813d8f96db2dd7007d10118f6f8f8496097ad75e1ff692341b2892ad55a633a1c55e7f0a0ad59a0e203a5b8278aec54dd8622e2831d87174f8caff43ee6c46445345d84a59659bfb92ecd4c818668695f34706f66828a89959637f2bf3e3251c24bdba4d4b7649da0022218b119c84e79a6527ec5b8a5f861c159952e23ec05e1e717346faefe8b1686825bd2b262fb2531066c0de09acde2e4231690728b5d85e115a2f6b92b79c25abc9bd9399ff8bcf825a52ea1f56ea76dd26f43baafa18bfa92a504cbd35699e26d1dcc5a2887385f3c63232f06f3244c3\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 50aaede8536b2c307208b275a67ae2df196c7628\nOutput = 6e3e4d7b6b15d2fb46013b8900aa5bbb3939cf2c095717987042026ee62c74c54cffd5d7d57efbbf950a0f5c574fa09d3fc1c9f513b05b4ff50dd8df7edfa20102854c35e592180119a70ce5b085182aa02d9ea2aa90d1df03f2daae885ba2f5d05afdac97476f06b93b5bc94a1a80aa9116c4d615f333b098892b25fface266f5db5a5a3bcc10a824ed55aad35b727834fb8c07da28fcf416a5d9b2224f1f8b442b36f91e456fdea2d7cfe3367268de0307a4c74e924159ed33393d5e0655531c77327b89821bdedf880161c78cd4196b5419f7acc3f13e5ebf161b6e7c6724716ca33b85c2e25640192ac2859651d50bde7eb976e51cec828b98b6563b86bb\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = aa0b72b8b371ddd10c8ae474425ccccf8842a294\nOutput = 34047ff96c4dc0dc90b2d4ff59a1a361a4754b255d2ee0af7d8bf87c9bc9e7ddeede33934c63ca1c0e3d262cb145ef932a1f2c0a997aa6a34f8eaee7477d82ccf09095a6b8acad38d4eec9fb7eab7ad02da1d11d8e54c1825e55bf58c2a23234b902be124f9e9038a8f68fa45dab72f66e0945bf1d8bacc9044c6f07098c9fcec58a3aab100c805178155f030a124c450e5acbda47d0e4f10b80a23f803e774d023b0015c20b9f9bbe7c91296338d5ecb471cafb032007b67a60be5f69504a9f01abb3cb467b260e2bce860be8d95bf92c0c8e1496ed1e528593a4abb6df462dde8a0968dffe4683116857a232f5ebf6c85be238745ad0f38f767a5fdbf486fb\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = fad3902c9750622a2bc672622c48270cc57d3ea8\nOutput = 7e0935ea18f4d6c1d17ce82eb2b3836c55b384589ce19dfe743363ac9948d1f346b7bfddfe92efd78adb21faefc89ade42b10f374003fe122e67429a1cb8cbd1f8d9014564c44d120116f4990f1a6e38774c194bd1b8213286b077b0499d2e7b3f434ab12289c556684deed78131934bb3dd6537236f7c6f3dcb09d476be07721e37e1ceed9b2f7b406887bd53157305e1c8b4f84d733bc1e186fe06cc59b6edb8f4bd7ffefdf4f7ba9cfb9d570689b5a1a4109a746a690893db3799255a0cb9215d2d1cd490590e952e8c8786aa0011265252470c041dfbc3eec7c3cbf71c24869d115c0cb4a956f56d530b80ab589acfefc690751ddf36e8d383f83cedd2cc\n\nVerify = RSA-PSS-10\nRSAPadding = PSS\nMGF1Digest = SHA1\nInput = 122196deb5d122bd8c6fc781ff6924d7c695aade\nOutput = 6d3b5b87f67ea657af21f75441977d2180f91b2c5f692de82955696a686730d9b9778d970758ccb26071c2209ffbd6125be2e96ea81b67cb9b9308239fda17f7b2b64ecda096b6b935640a5a1cb42a9155b1c9ef7a633a02c59f0d6ee59b852c43b35029e73c940ff0410e8f114eed46bbd0fae165e42be2528a401c3b28fd818ef3232dca9f4d2a0f5166ec59c42396d6c11dbc1215a56fa17169db9575343ef34f9de32a49cdc3174922f229c23e18e45df9353119ec4319cedce7a17c64088c1f6f52be29634100b3919d38f3d1ed94e6891e66a73b8fb849f5874df59459e298c7bbce2eee782a195aa66fe2d0732b25e595f57d3e061b1fc3e4063bf98f\n\nPrivateKey = RSA-OAEP-1\nType = RSA\nInput = 30820276020100300d06092a864886f70d0101010500048202603082025c02010002818100a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb020301000102818053339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1024100d32737e7267ffe1341b2d5c0d150a81b586fb3132bed2f8d5262864a9cb9f30af38be448598d413a172efb802c21acf1c11c520c2f26a471dcad212eac7ca39d024100cc8853d1d54da630fac004f471f281c7b8982d8224a490edbeb33d3e3d5cc93c4765703d1dd791642f1f116a0dd852be2419b2af72bfe9a030e860b0288b5d7702400e12bf1718e9cef5599ba1c3882fe8046a90874eefce8f2ccc20e4f2741fb0a33a3848aec9c9305fbecbd2d76819967d4671acc6431e4037968db37878e695c102410095297b0f95a2fa67d00707d609dfd4fc05c89dafc2ef6d6ea55bec771ea333734d9251e79082ecda866efef13c459e1a631386b7e354c899f5f112ca85d7158302404f456c502493bdc0ed2ab756a3a6ed4d67352a697d4216e93212b127a63d5411ce6fa98d5dbefd73263e3728142743818166ed7dd63687dd2a8ca1d2f4fbd8e1\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 354fe67b4a126d5d35fe36c777791a3f7ba13def484e2d3908aff722fad468fb21696de95d0be911c2d3174f8afcc201035f7b6d8e69402de5451618c21a535fa9d7bfc5b8dd9fc243f8cf927db31322d6e881eaa91a996170e657a05a266426d98c88003f8477c1227094a0d9fa1e8c4024309ce1ecccb5210035d47ac72e8a\nOutput = 6628194e12073db03ba94cda9ef9532397d50dba79b987004afefe34\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 640db1acc58e0568fe5407e5f9b701dff8c3c91e716c536fc7fcec6cb5b71c1165988d4a279e1577d730fc7a29932e3f00c81515236d8d8e31017a7a09df4352d904cdeb79aa583adcc31ea698a4c05283daba9089be5491f67c1a4ee48dc74bbbe6643aef846679b4cb395a352d5ed115912df696ffe0702932946d71492b44\nOutput = 750c4047f547e8e41411856523298ac9bae245efaf1397fbe56f9dd5\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 423736ed035f6026af276c35c0b3741b365e5f76ca091b4e8c29e2f0befee603595aa8322d602d2e625e95eb81b2f1c9724e822eca76db8618cf09c5343503a4360835b5903bc637e3879fb05e0ef32685d5aec5067cd7cc96fe4b2670b6eac3066b1fcf5686b68589aafb7d629b02d8f8625ca3833624d4800fb081b1cf94eb\nOutput = d94ae0832e6445ce42331cb06d531a82b1db4baad30f746dc916df24d4e3c2451fff59a6423eb0e1d02d4fe646cf699dfd818c6e97b051\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 45ead4ca551e662c9800f1aca8283b0525e6abae30be4b4aba762fa40fd3d38e22abefc69794f6ebbbc05ddbb11216247d2f412fd0fba87c6e3acd888813646fd0e48e785204f9c3f73d6d8239562722dddd8771fec48b83a31ee6f592c4cfd4bc88174f3b13a112aae3b9f7b80e0fc6f7255ba880dc7d8021e22ad6a85f0755\nOutput = 52e650d98e7f2a048b4f86852153b97e01dd316f346a19f67a85\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 36f6e34d94a8d34daacba33a2139d00ad85a9345a86051e73071620056b920e219005855a213a0f23897cdcd731b45257c777fe908202befdd0b58386b1244ea0cf539a05d5d10329da44e13030fd760dcd644cfef2094d1910d3f433e1c7c6dd18bc1f2df7f643d662fb9dd37ead9059190f4fa66ca39e869c4eb449cbdc439\nOutput = 8da89fd9e5f974a29feffb462b49180f6cf9e802\n\nDecrypt = RSA-OAEP-1\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 42cee2617b1ecea4db3f4829386fbd61dafbf038e180d837c96366df24c097b4ab0fac6bdf590d821c9f10642e681ad05b8d78b378c0f46ce2fad63f74e0ad3df06b075d7eb5f5636f8d403b9059ca761b5c62bb52aa45002ea70baace08ded243b9d8cbd62a68ade265832b56564e43a6fa42ed199a099769742df1539e8255\nOutput = 26521050844271\n\nPrivateKey = RSA-OAEP-2\nType = RSA\nInput = 30820276020100300d06092a864886f70d0101010500048202603082025c02010002818101947c7fce90425f47279e70851f25d5e62316fe8a1df19371e3e628e260543e4901ef6081f68c0b8141190d2ae8daba7d1250ec6db636e944ec3722877c7c1d0a67f14b1694c5f0379451a43e49a32dde83670b73da91a1c99bc23b436a60055c610f0baf99c1a079565b95a3f1526632d1d4da60f20eda25e653c4f002766f4502030100010281800823f20fadb5da89088a9d00893e21fa4a1b11fbc93c64a3be0baaea97fb3b93c3ff713704c19c963c1d107aae99054739f79e02e186de86f87a6ddefea6d8ccd1d3c81a47bfa7255be20601a4a4b2f08a167b5e279d715b1b455bdd7eab245941d9768b9acefb3ccda5952da3cee72525b4501663a8ee15c9e992d92462fe3902410159dbde04a33ef06fb608b80b190f4d3e22bcc13ac8e4a081033abfa416edb0b338aa08b57309ea5a5240e7dc6e54378c69414c31d97ddb1f406db3769cc41a430241012b652f30403b38b40995fd6ff41a1acc8ada70373236b7202d39b2ee30cfb46db09511f6f307cc61cc21606c18a75b8a62f822df031ba0df0dafd5506f568bd70240436ef508de736519c2da4c580d98c82cb7452a3fb5efadc3b9c7789a1bc6584f795addbbd32439c74686552ecb6c2c307a4d3af7f539eec157248c7b31f1a2550241012b15a89f3dfb2b39073e73f02bdd0c1a7b379dd435f05cdde2eff9e462948b7cec62ee9050d5e0816e0785a856b49108dcb75f3683874d1ca6329a19013066ff02400270db17d5914b018d76118b24389a7350ec836b0063a21721236fd8edb6d89b51e7eeb87b611b7132cb7ea7356c23151c1e7751507c786d9ee1794170a8c8e8\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0181af8922b9fcb4d79d92eb", + "e19815992fc0c1439d8bcd491398a0f4ad3a329a5bd9385560db532683c8b7da04e4b12aed6aacdf471c34c9cda891addcc2df3456653aa6382e9ae59b54455257eb099d562bbe10453f2b6d13c59c02e10f1f8abb5da0d0570932dacf2d0901db729d0fefcc054e70968ea540c81b04bcaefe720e\nOutput = 8ff00caa605c702830634d9a6c3d42c652b58cf1d92fec570beee7\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 018759ff1df63b2792410562314416a8aeaf2ac634b46f940ab82d64dbf165eee33011da749d4bab6e2fcd18129c9e49277d8453112b429a222a8471b070993998e758861c4d3f6d749d91c4290d332c7a4ab3f7ea35ff3a07d497c955ff0ffc95006b62c6d296810d9bfab024196c7934012c2df978ef299aba239940cba10245\nOutput = 2d\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 018802bab04c60325e81c4962311f2be7c2adce93041a00719c88f957575f2c79f1b7bc8ced115c706b311c08a2d986ca3b6a9336b147c29c6f229409ddec651bd1fdd5a0b7f610c9937fdb4a3a762364b8b3206b4ea485fd098d08f63d4aa8bb2697d027b750c32d7f74eaf5180d2e9b66b17cb2fa55523bc280da10d14be2053\nOutput = 74fc88c51bc90f77af9d5e9a4a70133d4b4e0b34da3c37c7ef8e\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00a4578cbc176318a638fba7d01df15746af44d4f6cd96d7e7c495cbf425b09c649d32bf886da48fbaf989a2117187cafb1fb580317690e3ccd446920b7af82b31db5804d87d01514acbfa9156e782f867f6bed9449e0e9a2c09bcecc6aa087636965e34b3ec766f2fe2e43018a2fddeb140616a0e9d82e5331024ee0652fc7641\nOutput = a7eb2a5036931d27d4e891326d99692ffadda9bf7efd3e34e622c4adc085f721dfe885072c78a203b151739be540fa8c153a10f00a\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00ebc5f5fda77cfdad3c83641a9025e77d72d8a6fb33a810f5950f8d74c73e8d931e8634d86ab1246256ae07b6005b71b7f2fb98351218331ce69b8ffbdc9da08bbc9c704f876deb9df9fc2ec065cad87f9090b07acc17aa7f997b27aca48806e897f771d95141fe4526d8a5301b678627efab707fd40fbebd6e792a25613e7aec\nOutput = 2ef2b066f854c33f3bdcbb5994a435e73d6c6c\n\nDecrypt = RSA-OAEP-2\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 010839ec20c27b9052e55befb9b77e6fc26e9075d7a54378c646abdf51e445bd5715de81789f56f1803d9170764a9e93cb78798694023ee7393ce04bc5d8f8c5a52c171d43837e3aca62f609eb0aa5ffb0960ef04198dd754f57f7fbe6abf765cf118b4ca443b23b5aab266f952326ac4581100644325f8b721acd5d04ff14ef3a\nOutput = 8a7fb344c8b6cb2cf2ef1f643f9a3218f6e19bba89c0\n\nPrivateKey = RSA-OAEP-3\nType = RSA\nInput = 30820277020100300d06092a864886f70d0101010500048202613082025d02010002818102b58fec039a860700a4d7b6462f93e6cdd491161ddd74f4e810b40e3c1652006a5c277b2774c11305a4cbab5a78efa57e17a86df7a3fa36fc4b1d2249f22ec7c2dd6a463232accea906d66ebe80b5704b10729da6f833234abb5efdd4a292cbfad33b4d33fa7a14b8c397b56e3acd21203428b77cdfa33a6da706b3d8b0fc43e9020301000102818015b48a5b5683a94670e23b5718f814fa0e13f85038f50711182cba61510581f3d22c7e232ef937e22e551d68b86e2f8cb1aad8be2e488f5df7efd279e3f568d4eaf36f80cf7141ace60fcc9113fb6c4a841fd50bbc7c512ffcbeff21487aa811eb3ca8c62005346a86de86bfa1d8a948fd3f348c22eaadf333c3ce6ce13208fd024101bf01d216d73595cf0270c2beb78d40a0d8447d31da919a983f7eea781b77d85fe371b3e9373e7b69217d3150a02d8958de7fad9d555160958b4454127e0e7eaf0241018d3399658166db3829816d7b295416759e9c91987f5b2d8aecd63b04b48bd7b2fcf229bb7f8a6dc88ba13dd2e39ad55b6d1a06160708f9700be80b8fd3744ce7024006c0a249d20a6f2ee75c88b494d53f6aae99aa427c88c28b163a769445e5f390cf40c274fd6ea6329a5ce7c7ce03a2158396ee2a7845786e09e2885a9728e4e5024100d1d27c29fedd92d86c348edd0ccbfac14f746e051ce1d1811df35d61f2ee1c97d4bf2804802f6427187ba8e90a8af44243b4079b03445e602e29fa5193e64fe90241008cb2f756bd8941b1d3b770e5ad31ee373b28acda69ff9b6f40fe578b9f1afb85836f9627d37acff73c2779e634bb26011c2c8f7f3361ae2a9ea65ed689e3639a\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 026a0485d96aebd96b4382085099b962e6a2bdec3d90c8db625e14372de85e2d5b7baab65c8faf91bb5504fb495afce5c988b3f6a52e20e1d6cbd3566c5cd1f2b8318bb542cc0ea25c4aab9932afa20760eaddec784396a07ea0ef24d4e6f4d37e5052a7a31e146aa480a111bbe926401307e00f410033842b6d82fe5ce4dfae80\nOutput = 087820b569e8fa8d\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 024db89c7802989be0783847863084941bf209d761987e38f97cb5f6f1bc88da72a50b73ebaf11c879c4f95df37b850b8f65d7622e25b1b889e80fe80baca2069d6e0e1d829953fc459069de98ea9798b451e557e99abf8fe3d9ccf9096ebbf3e5255d3b4e1c6d2ecadf067a359eea86405acd47d5e165517ccafd47d6dbee4bf5\nOutput = 4653acaf171960b01f52a7be63a3ab21dc368ec43b50d82ec3781e04\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0239bce681032441528877d6d1c8bb28aa3bc97f1df584563618995797683844ca86664732f4bed7a0aab083aaabfb7238f582e30958c2024e44e57043b97950fd543da977c90cdde5337d618442f99e60d7783ab59ce6dd9d69c47ad1e962bec22d05895cff8d3f64ed5261d92b2678510393484990ba3f7f06818ae6ffce8a3a\nOutput = d94cd0e08fa404ed89\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 02994c62afd76f498ba1fd2cf642857fca81f4373cb08f1cbaee6f025c3b512b42c3e8779113476648039dbe0493f9246292fac28950600e7c0f32edf9c81b9dec45c3bde0cc8d8847590169907b7dc5991ceb29bb0714d613d96df0f12ec5d8d3507c8ee7ae78dd83f216fa61de100363aca48a7e914ae9f42ddfbe943b09d9a0\nOutput = 6cc641b6b61e6f963974dad23a9013284ef1\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0162042ff6969592a6167031811a239834ce638abf54fec8b99478122afe2ee67f8c5b18b0339805bfdbc5a4e6720b37c59cfba942464c597ff532a119821545fd2e59b114e61daf71820529f5029cf524954327c34ec5e6f5ba7efcc4de943ab8ad4ed787b1454329f70db798a3a8f4d92f8274e2b2948ade627ce8ee33e43c60\nOutput = df5151832b61f4f25891fb4172f328d2eddf8371ffcfdbe997939295f30eca6918017cfda1153bf7a6af87593223\n\nDecrypt = RSA-OAEP-3\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00112051e75d064943bc4478075e43482fd59cee0679de6893eec3a943daa490b9691c93dfc0464b6623b9f3dbd3e70083264f034b374f74164e1a00763725e574744ba0b9db83434f31df96f6e2a26f6d8eba348bd4686c2238ac07c37aac3785d1c7eea2f819fd91491798ed8e9cef5e43b781b0e0276e37c43ff9492d005730\nOutput = 3c3bad893c544a6d520ab022319188c8d504b7a788b850903b85972eaa18552e1134a7ad6098826254ff7ab672b3d8eb3158fac6d4cbaef1\n\nPrivateKey = RSA-OAEP-4\nType = RSA\nInput = 30820277020100300d06092a864886f70d0101010500048202613082025d020100028181051240b6cc0004fa48d0134671c078c7c8dec3b3e2f25bc2564467339db38853d06b85eea5b2de353bff42ac2e46bc97fae6ac9618da9537a5c8f553c1e357625991d6108dcd7885fb3a25413f53efcad948cb35cd9b9ae9c1c67626d113d57dde4c5bea76bb5bb7de96c00d07372e9685a6d75cf9d239fa148d70931b5f3fb03902030100010281800411ffca3b7ca5e9e9be7fe38a85105e353896db05c5796aecd2a725161eb3651c8629a9b862b904d7b0c7b37f8cb5a1c2b54001018a00a1eb2cafe4ee4e9492c348bc2bedab4b9ebbf064e8eff322b9009f8eec653905f40df88a3cdc49d4567f75627d41aca624129b46a0b7c698e5e65f2b7ba102c749a10135b6540d04010241027458c19ec1636919e736c9af25d609a51b8f561d19c6bf6943dd1ee1ab8a4a3f232100bd40b88decc6ba235548b6ef792a11c9de823d0a7922c7095b6eba570102410210ee9b33ab61716e27d251bd465f4b35a1a232e2da00901c294bf22350ce490d099f642b5375612db63ba1f20386492bf04d34b3c22bceb909d13441b53b5139024039fa028b826e88c1121b750a8b242fa9a35c5b66bdfd1fa637d3cc48a84a4f457a194e7727e49f7bcc6e5a5a412657fc470c7322ebc37416ef458c307a8c09010241015d99a84195943979fa9e1be2c3c1b69f432f46fd03e47d5befbbbfd6b1d1371d83efb330a3e020942b2fed115e5d02be24fd92c9019d1cecd6dd4cf1e54cc899024101f0b7015170b3f5e42223ba30301c41a6d87cbb70e30cb7d3c67d25473db1f6cbf03e3f9126e3e97968279a865b2c2b426524cfc52a683d31ed30eb984be412ba\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 04cce19614845e094152a3fe18e54e3330c44e5efbc64ae16886cb1869014cc5781b1f8f9e045384d0112a135ca0d12e9c88a8e4063416deaae3844f60d6e96fe155145f4525b9a34431ca3766180f70e15a5e5d8e8b1a516ff870609f13f896935ced188279a58ed13d07114277d75c6568607e0ab092fd803a223e4a8ee0b1a8\nOutput = 4a86609534ee434a6cbca3f7e962e76d455e3264c19f605f6e5ff6137c65c56d7fb344cd52bc93374f3d166c9f0c6f9c506bad19330972d2\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0097b698c6165645b303486fbf5a2a4479c0ee85889b541a6f0b858d6b6597b13b854eb4f839af03399a80d79bda6578c841f90d645715b280d37143992dd186c80b949b775cae97370e4ec97443136c6da484e970ffdb1323a20847821d3b18381de13bb49aaea66530c4a4b8271f3eae172cd366e07e6636f1019d2a28aed15e\nOutput = b0adc4f3fe11da59ce992773d9059943c03046497ee9d9f9a06df1166db46d98f58d27ec074c02eee6cbe2449c8b9fc5080c5c3f4433092512ec46aa793743c8\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0301f935e9c47abcb48acbbe09895d", + "9f5971af14839da4ff95417ee453d1fd77319072bb7297e1b55d7561cd9d1bb24c1a9a37c619864308242804879d86ebd001dce5183975e1506989b70e5a83434154d5cbfd6a24787e60eb0c658d2ac193302d1192c6e622d4a12ad4b53923bca246df31c6395e37702c6a78ae081fb9d065\nOutput = bf6d42e701707b1d0206b0c8b45a1c72641ff12889219a82bdea965b5e79a96b0d0163ed9d578ec9ada20f2fbcf1ea3c4089d83419ba81b0c60f3606da99\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 02d110ad30afb727beb691dd0cf17d0af1a1e7fa0cc040ec1a4ba26a42c59d0a796a2e22c8f357ccc98b6519aceb682e945e62cb734614a529407cd452bee3e44fece8423cc19e55548b8b994b849c7ecde4933e76037e1d0ce44275b08710c68e430130b929730ed77e09b015642c5593f04e4ffb9410798102a8e96ffdfe11e4\nOutput = fb2ef112f5e766eb94019297934794f7be2f6fc1c58e\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00dbb8a7439d90efd919a377c54fae8fe11ec58c3b858362e23ad1b8a44310799066b99347aa525691d2adc58d9b06e34f288c170390c5f0e11c0aa3645959f18ee79e8f2be8d7ac5c23d061f18dd74b8c5f2a58fcb5eb0c54f99f01a83247568292536583340948d7a8c97c4acd1e98d1e29dc320e97a260532a8aa7a758a1ec2\nOutput = 28ccd447bb9e85166dabb9e5b7d1adadc4b9d39f204e96d5e440ce9ad928bc1c2284\n\nDecrypt = RSA-OAEP-4\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 00a5ffa4768c8bbecaee2db77e8f2eec99595933545520835e5ba7db9493d3e17cddefe6a5f567624471908db4e2d83a0fbee60608fc84049503b2234a07dc83b27b22847ad8920ff42f674ef79b76280b00233d2b51b8cb2703a9d42bfbc8250c96ec32c051e57f1b4ba528db89c37e4c54e27e6e64ac69635ae887d9541619a9\nOutput = f22242751ec6b1\n\nPrivateKey = RSA-OAEP-5\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f0201000281810aadf3f9c125e5d891f31ac448e993defe580f802b45f9d7f22ba5021e9c47576b5a1e68031ba9db4e6dabe4d96a1d6f3d267268cff408005f118efcadb99888d1c234467166b2a2b849a05a889c060ac0da0c5fae8b55f309ba62e703742fa0326f2d10b011021489ff497770190d895fd39f52293c39efd73a698bdab9f10ed902030100010281810256eb4cba7067f2d2be540dcdff4582a36b7d31d1c9099bb214b79848466a268f80f58a49ac04c0e3648934a0206c04537c19b236643a6082732144df75fa217588f794682be89168276dc726c5c0cbdb84d31bbf26d0a43af495717f7d528acfee341561f6ff3cae05c578f8470d9682f9c0d072f9f6068b56d5880f682be2c5024103b0d3962f6d17549cbfca11294348dcf0e7e39f8c2bc6824f2164b606d687860dae1e632393cfedf513228229069e2f60e4acd7e633a436063f82385f48993707024102e4c32e2f517269b7072309f00c0e31365f7ce28b236b82912df239abf39572cf0ed604b02982e53564c52d6a05397de5c052a2fddc141ef7189836346aeb331f024101e84b119d25161fa67b00256a5bd9b645d2b232ecb05b015180029a88622adc3f09b3aeacde6161ab7cde22c2ad26e7797df54e072cbd3b2673800b3e4338dbd5024100eb90aa1a40135b4cea07197cedc8819be1e7cbff2547662116f465a4a9f487ab12f3ba4fef13822265a65297d98b7bded9372e3ffe81a38b3e9600fed055754f0241012f7f8138f9404062eb85a42924520b38f5bb886a0196f48bb8dcea60fd92cc027f18e78158a34a5c5d5f860a0f6c04071a7d01312c065062f1eb48b79d1c83cb\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 036046a4a47d9ed3ba9a89139c105038eb7492b05a5d68bfd53accff4597f7a68651b47b4a4627d927e485eed7b4566420e8b409879e5d606eae251d22a5df799f7920bfc117b992572a53b1263146bcea03385cc5e853c9a101c8c3e1bda31a519807496c6cb5e5efb408823a352b8fa0661fb664efadd593deb99fff5ed000e5\nOutput = af71a901e3a61d3132f0fc1fdb474f9ea6579257ffc24d164170145b3dbde8\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 03d6eb654edce615bc59f455265ed4e5a18223cbb9be4e4069b473804d5de96f54dcaaa603d049c5d94aa1470dfcd2254066b7c7b61ff1f6f6770e3215c51399fd4e34ec5082bc48f089840ad04354ae66dc0f1bd18e461a33cc1258b443a2837a6df26759aa2302334986f87380c9cc9d53be9f99605d2c9a97da7b0915a4a7ad\nOutput = a3b844a08239a8ac41605af17a6cfda4d350136585903a417a79268760519a4b4ac3303ec73f0f87cfb32399\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0770952181649f9f9f07ff626ff3a22c35c462443d905d456a9fd0bff43cac2ca7a9f554e9478b9acc3ac838b02040ffd3e1847de2e4253929f9dd9ee4044325a9b05cabb808b2ee840d34e15d105a3f1f7b27695a1a07a2d73fe08ecaaa3c9c9d4d5a89ff890d54727d7ae40c0ec1a8dd86165d8ee2c6368141016a48b55b6967\nOutput = 308b0ecbd2c76cb77fc6f70c5edd233fd2f20929d629f026953bb62a8f4a3a314bde195de85b5f816da2aab074d26cb6acddf323ae3b9c678ac3cf12fbdde7\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0812b76768ebcb642d040258e5f4441a018521bd96687e6c5e899fcd6c17588ff59a82cc8ae03a4b45b31299af1788c329f7dcd285f8cf4ced82606b97612671a45bedca133442144d1617d114f802857f0f9d739751c57a3f9ee400912c61e2e6992be031a43dd48fa6ba14eef7c422b5edc4e7afa04fdd38f402d1c8bb719abf\nOutput = 15c5b9ee1185\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 07b60e14ec954bfd29e60d0047e789f51d57186c63589903306793ced3f68241c743529aba6a6374f92e19e0163efa33697e196f7661dfaaa47aac6bde5e51deb507c72c589a2ca1693d96b1460381249b2cdb9eac44769f2489c5d3d2f99f0ee3c7ee5bf64a5ac79c42bd433f149be8cb59548361640595513c97af7bc2509723\nOutput = 21026e6800c7fa728fcaaba0d196ae28d7a2ac4ffd8abce794f0985f60c8a6737277365d3fea11db8923a2029a\n\nDecrypt = RSA-OAEP-5\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 08c36d4dda33423b2ed6830d85f6411ba1dcf470a1fae0ebefee7c089f256cef74cb96ea69c38f60f39abee44129bcb4c92de7f797623b20074e3d9c2899701ed9071e1efa0bdd84d4c3e5130302d8f0240baba4b84a71cc032f2235a5ff0fae277c3e8f9112bef44c9ae20d175fc9a4058bfc930ba31b02e2e4f444483710f24a\nOutput = 541e37b68b6c8872b84c02\n\nPrivateKey = RSA-OAEP-6\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f02010002818112b17f6dad2ecd19ff46dc13f7860f09e0e0cfb677b38a52592305ceaf022c166db90d04ac29e33f7dd12d9faf66e0816bb63ead267cc7d46c17c37be214bca2a22d723a64e44407436b6fc965729aefc2554f376cd5dcea68293780a62bf39d0029485a160bbb9e5dc0972d21a504f52e5ee028aa416332f510b2e9cff5f722af02030100010281810295eca3560618369559cecd303aa9cfdafc1d9f06959df75ffef929aa896961bcd190dc6997eda7f5963e724d07b4dc11f3065e5ae97d96835112280b9084bb14f2a21ebd4e889d41b9c4132ec1956fcab8bb2fed0575884936522c5ff7d33261904824e7cadee4e0bb372d2457cf78e2bd1286228ff83f10731ce63c90cff3f9024104a6ce8b7358dfa69bdcf742617005afb5385f5f3a58a24ef74a22a8c05cb7cc38ebd4cc9d9a9d789a62cd0f60f0cb941d3423c9692efa4fe3adff290c4749a38b02410404c9a803371fedb4c5be39f3c00b009e5e08a63be1e40035cdaca5011cc701cf7eebcb99f0ffe17cfd0a4bf7befd2dd536ac946db797fdbc4abe8f29349b91ed024103961c8f760aa2bd5154c7aafd77225b3bacd0139ae7b5948ea3311fccd86fb95c75afa767284b9b2de559572f15d8d044c7eb83a1be5fadf2cc377c0d8475294b0241022197e066742196aabc03fa2feeb4e70b15cb787d617acd31bb75c7bc234ad706f7c48d2182d1f0ff9c228dcf41967b6c0ba6d2c0ad110a1b857831ec245e2cb102410401c4c0c53d45dbdb5e9d96d0fecf4275df0974bc4a0736b4a74c3269053efb686ace2406e22c9e058ddb4ae540627ae2fdb08261e8e7e4bcbc994daafa305c45\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0630eebcd2856c24f798806e41f9e67345eda9ceda386acc9facaea1eeed06ace583709718d9d169fadf414d5c76f92996833ef305b75b1e4b95f662a20faedc3bae0c4827a8bf8a88edbd57ec203a27a841f02e43a615bab1a8cac0701de34debdef62a088089b55ec36ea7522fd3ec8d06b6a073e6df833153bc0aefd93bd1a3\nOutput = 4046ca8baa3347ca27f49e0d81f9cc1d71be9ba517d4\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0ebc37376173a4fd2f89cc55c2ca62b26b11d51c3c7ce49e8845f74e7607317c436bc8d23b9667dfeb9d087234b47bc6837175ae5c0559f6b81d7d22416d3e50f4ac533d8f0812f2db9e791fe9c775ac8b6ad0f535ad9ceb23a4a02014c58ab3f8d3161499a260f39348e714ae2a1d3443208fd8b722ccfdfb393e98011f99e63f\nOutput = 5cc72c60231df03b3d40f9b57931bc31109f972527f28b19e7480c7288cb3c92b22512214e4be6c914792ddabdf57faa8aa7\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0a98bf1093619394436cf68d8f38e2f158fde8ea54f3435f239b8d06b8321844202476aeed96009492480ce3a8d705498c4c8c68f01501dc81db608f60087350c8c3b0bd2e9ef6a81458b7c801b89f2e4fe99d4900ba6a4b5e5a96d865dc676c7755928794130d6280a8160a190f2df3ea7cf9aa0271d88e9e6905ecf1c5152d65\nOutput = b20e651303092f4bccb43070c0f86d23049362ed96642fc5632c27db4a52e3d831f2ab068b23b149879c002f6bf3feee97591112562c\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 008e7a67cacfb5c4e24bec7dee149117f19598ce8c45808fef88c608ff9cd6e695263b9a3c0ad4b8ba4c95238e96a8422b8535629c8d5382374479ad13fa39974b242f9a759eeaf9c83ad5a8ca18940a0162ba755876df263f4bd50c6525c56090267c1f0e09ce0899a0cf359e88120abd9bf893445b3cae77d3607359ae9a52f8\nOutput = 684e3038c5c041f7\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMG", + "F1Digest = SHA1\nInput = 00003474416c7b68bdf961c385737944d7f1f40cb395343c693cc0b4fe63b31fedf1eaeeac9ccc0678b31dc32e0977489514c4f09085f6298a9653f01aea4045ff582ee887be26ae575b73eef7f3774921e375a3d19adda0ca31aa1849887c1f42cac9677f7a2f4e923f6e5a868b38c084ef187594dc9f7f048fea2e02955384ab\nOutput = 32488cb262d041d6e4dd35f987bf3ca696db1f06ac29a44693\n\nDecrypt = RSA-OAEP-6\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0a026dda5fc8785f7bd9bf75327b63e85e2c0fdee5dadb65ebdcac9ae1de95c92c672ab433aa7a8e69ce6a6d8897fac4ac4a54de841ae5e5bbce7687879d79634cea7a30684065c714d52409b928256bbf53eabcd5231eb7259504537399bd29164b726d33a46da701360a4168a091ccab72d44a62fed246c0ffea5b1348ab5470\nOutput = 50ba14be8462720279c306ba\n\nPrivateKey = RSA-OAEP-7\nType = RSA\nInput = 30820278020100300d06092a864886f70d0101010500048202623082025e020100028181311179f0bcfc9b9d3ca315d00ef30d7bdd3a2cfae9911bfedcb948b3a4782d0732b6ab44aa4bf03741a644dc01bec3e69b01a033e675d8acd7c4925c6b1aec3119051dfd89762d215d45475ffcb59f908148623f37177156f6ae86dd7a7c5f43dc1e1f908254058a284a5f06c0021793a87f1ac5feff7dcaee69c5e51a3789e3730203010001028181070cfcff2feb8276e27432c45dfee48f49b7917d6530e1f0ca3460f32e0276174487c56e22a45d2500d7775495219d7d165a9cf3bd92c32af9a98d8dc9cc296800adc94a0a54fb40f34291bf84ee8ea12b6f109359c6d3542a50f9c767f5cfff05a681c2e656fb77caaadb4be9468d8abcd4df98f58e86d2053fa1349f748e21b102410749262c111cd470ec2566e6b3732fc09329469aa19071d3b9c01906514c6f1d26baa14beab0971c8b7e611a4f79009d6fea776928ca25285b0de3643d1a3f8c71024106bc1e50e96c02bf636e9eea8b899bbebf7651de77dd474c3e9bc23bad8182b61904c7d97dfbebfb1e00108878b6e67e415391d67942c2b2bf9b4435f88b0cb023024103bc7ea7f0aab143abc6ce8b97118636a30172e4cfe02c8fa0dda3b7baaf90f8092982985525f488bdfcb4bd726e22639ac64a3092ab7ffcbf1d5334cfa50b5bf102410262a6aa29c2a3c67dc5346c06381afd987aa3cc93cfbfecf54fdd9f9d787d7f59a523d398979da137a2f6381fe94801f7c94da21518dc34cb40870c4697994ad90240649d4c17b6ee1721e772d0389a559c3d3cdf9550d457c46b037b74641b1d52166af8a213c8396206cdfba4422f18d6f61dbcb5d214c971bf482aeb976a7370c2\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1688e4ce7794bba6cb7014169ecd559cede2a30b56a52b68d9fe18cf1973ef97b2a03153951c755f6294aa49adbdb55845ab6875fb3986c93ecf927962840d282f9e54ce8b690f7c0cb8bbd73440d9571d1b16cd9260f9eab4783cc482e5223dc60973871783ec27b0ae0fd47732cbc286a173fc92b00fb4ba6824647cd93c85c1\nOutput = 47aae909\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1052ed397b2e01e1d0ee1c50bf24363f95e504f4a03434a08fd822574ed6b9736edbb5f390db10321479a8a139350e2bd4977c3778ef331f3e78ae118b268451f20a2f01d471f5d53c566937171b2dbc2d4bde459a5799f0372d6574239b2323d245d0bb81c286b63c89a361017337e4902f88a467f4c7f244bfd5ab46437ff3b6\nOutput = 1d9b2e2223d9bc13bfb9f162ce735db48ba7c68f6822a0a1a7b6ae165834e7\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2155cd843ff24a4ee8badb7694260028a490813ba8b369a4cbf106ec148e5298707f5965be7d101c1049ea8584c24cd63455ad9c104d686282d3fb803a4c11c1c2e9b91c7178801d1b6640f003f5728df007b8a4ccc92bce05e41a27278d7c85018c52414313a5077789001d4f01910b72aad05d220aa14a58733a7489bc54556b\nOutput = d976fc\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 0ab14c373aeb7d4328d0aaad8c094d88b9eb098b95f21054a29082522be7c27a312878b637917e3d819e6c3c568db5d843802b06d51d9e98a2be0bf40c031423b00edfbff8320efb9171bd2044653a4cb9c5122f6c65e83cda2ec3c126027a9c1a56ba874d0fea23f380b82cf240b8cf540004758c4c77d934157a74f3fc12bfac\nOutput = d4738623df223aa43843df8467534c41d013e0c803c624e263666b239bde40a5f29aeb8de79e3daa61dd0370f49bd4b013834b98212aef6b1c5ee373b3cb\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 028387a318277434798b4d97f460068df5298faba5041ba11761a1cb7316b24184114ec500257e2589ed3b607a1ebbe97a6cc2e02bf1b681f42312a33b7a77d8e7855c4a6de03e3c04643f786b91a264a0d6805e2cea91e68177eb7a64d9255e4f27e713b7ccec00dc200ebd21c2ea2bb890feae4942df941dc3f97890ed347478\nOutput = bb47231ca5ea1d3ad46c99345d9a8a61\n\nDecrypt = RSA-OAEP-7\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 14c678a94ad60525ef39e959b2f3ba5c097a94ff912b67dbace80535c187abd47d075420b1872152bba08f7fc31f313bbf9273c912fc4c0149a9b0cfb79807e346eb332069611bec0ff9bcd168f1f7c33e77313cea454b94e2549eecf002e2acf7f6f2d2845d4fe0aab2e5a92ddf68c480ae11247935d1f62574842216ae674115\nOutput = 2184827095d35c3f86f600e8e59754013296\n\nPrivateKey = RSA-OAEP-8\nType = RSA\nInput = 30820279020100300d06092a864886f70d0101010500048202633082025f0201000281815bdf0e30d321dda5147f882408fa69195480df8f80d3f6e8bf5818504f36427ca9b1f5540b9c65a8f6974cf8447a244d9280201bb49fcbbe6378d1944cd227e230f96e3d10f819dcef276c64a00b2a4b6701e7d01de5fabde3b1e9a0df82f4631359cd22669647fbb1717246134ed7b497cfffbdc42b59c73a96ed90166212dff702030100010281810f7d1e9e5aaa25fd13e4a0663ae144e0d15f5cd18bcdb09df2cc7e64e3c5e915ad62645304161d098c715bb7ab8bd01d07eaf3fed7c7ed08af2a8a62ef44ab16b320e14af72a48f96afe262a0ae4cf65e635e910790cd4ee5cea768a4b2639f7e6f677b3f0bb6be32b75747d8909036f0264f58d401cdba131716157a75ecf633102410a02ef8448d9fad8bbd0d004c8c2aa9751ef9721c1b0d03236a54b0df947cbaed5a255ee9e8e20d491ea1723fe094704a9762e88afd16ebb5994412ca966dc4f9f0241092d362e7ed3a0bfd9e9fd0e6c0301b6df29159cf50cc83b9b0cf4d6eea71a61e002b46e0ae9f2de62d25b5d7452d498b81c9ac6fc58593d4c3fb4f5d72dfbb0a9024107c71410af103962db367404e37ae850baa4e9c29dd92145815294a67c7d1c6ded263aa030a9b633ae50303e14035d1af014123eba687820308d8ebc85b6957d7d024100ae2c75380c02c016ad05891b3301de881f28ae1171182b6b2c83bea7c515eca9ca298c7b1cab5817a597068fc85060de4da8a016378aae43c7f967bcc37904b902410598d1059e3ada4f6320752c09d805ff7d1f1ae0d017aeeee9cefa0d7dd7ff775e44b578322f6405d6211da19519666aa87fdc4cd8c88f6b6e3d67e961dcbba3d0\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 09b3683d8a2eb0fb295b62ed1fb9290b714457b7825319f4647872af889b30409472020ad12912bf19b11d4819f49614824ffd84d09c0a17e7d17309d12919790410aa2995699f6a86dbe3242b5acc23af45691080d6b1ae810fb3e3057087f0970092ce00be9562ff4053b6262ce0caa93e13723d2e3a5ba075d45f0d61b54b61\nOutput = 050b755e5e6880f7b9e9d692a74c37aae449b31bfea6deff83747a897f6c2c825bb1adbf850a3c96994b5de5b33cbc7d4a17913a7967\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2ecf15c97c5a15b1476ae986b371b57a24284f4a162a8d0c8182e7905e792256f1812ba5f83f1f7a130e42dcc02232844edc14a31a68ee97ae564a383a3411656424c5f62ddb646093c367be1fcda426cf00a06d8acb7e57776fbbd855ac3df506fc16b1d7c3f2110f3d8068e91e186363831c8409680d8da9ecd8cf1fa20ee39d\nOutput = 4eb68dcd93ca9b19df111bd43608f557026fe4aa1d5cfac227a3eb5ab9548c18a06dded23f81825986b2fcd71109ecef7eff88873f075c2aa0c469f69c92bc\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 4bc89130a5b2dabb7c2fcf90eb5d0eaf9e681b7146a38f3173a3d9cfec52ea9e0a41932e648a9d69344c50da763f51a03c95762131e8052254dcd2248cba40fd31667786ce05a2b7b531ac9dac9ed584a59b677c1a8aed8c5d15d68c05569e2be780bf7db638fd2bfd2a85ab276860f3777338fca989ffd743d13ee08e0ca9893f\nOutput = 8604ac56328c1ab5ad917861\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2e456847d8fc36ff0147d6993594b9397227d577752c79d0f904fcb039d4d812fea605a7b574dd82ca786f93752348438ee9f5b5454985d5f0e1699e3e7ad175a32e15f03deb042ab9fe1dd9db1bb86f8c089ccb45e7ef0c5ee7ca9b7290ca6b15bed47039788a8a93ff83e0e8d6244c71006362deef69b6f416fb3c684383fbd0\nOutput = fdda5fbf6ec361a9d9a4ac68af216a0686f438b1e0e5c36b955f74e107f39c0dddcc\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 1fb9356fd5c4b1796db2ebf7d0d393cc810adf6145defc2fce714f79d93800d5e2ac211ea8bbecca4b654b94c3b18b30dd576ce34dc95436ef57a09415645923359a5d7b4171ef22c24670f1b229d3603e91f76671b7df97e7317c97734476d5f3d17d21cf82b5ba9f83df2e588d36984fd1b584468bd23b2e875f32f68953f7b2\nOutput = 4a5f4914bee25de3c69341de07\n\nDecrypt = RSA-OAEP-8\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 3afd9c6600147b21798d818c655a0f4c9212db26d0b0dfdc2a7594ccb3d22f5bf1d7c3e112cd73fc7d509c7a8bafdd3c274d1399009f9609ec4be6477e453f075aa33db382870c1c3409aef392d7386ae3a696b99a94b4da0589447e955d16c98b17602a59bd736279fcd8fb280c4462d590bfa9bf13fed570eafde97330a2c210\nOutput = 8e07d66f7b880a72563abcd3f35092bc33409fb7f88f2472be\n\nPrivateKey = RSA-OAEP-9\nType = RSA\nInput = 30820397020100300d06092a864886f70d0101010500048203813082037d0201000281c100cf2cd41e34ca3a728ea5cb8aff64c36d27bdef5364e336", + "fd68d3123c5a196a8c287013e853d5156d58d151954520fb4f6d7b17abb6817765909c576119659d902b1906ed8a2b10c155c24d124528dab9eeae379beac66e4a411786dcb8fd0062ebc030de1219a04c2a8c1b7dd3131e4d6b6caee2e31a5ed41ac1509b2ef1ee2ab18364be568ca941c25ecc84ff9d643b5ec1aaae102a20d73f479b780fd6da91075212d9eac03a0674d899eba2e431f4c44b615b6ba2232bd4b33baed73d625d02030100010281c0198c141e23715a92bccf6a119a5bc11389468d2811f548d727e17b4ab0eb986d6f211efb53b71f7ccbea87ee69c75ee615008c5332deb52bf390abdfbfe37d7205368159b2638c1de326e21d22251f0fb5848b3bf15005d2a74330f0afe916ee62ccc1344d1d83a709e60676273840f7f377424a5e0a4da75f01b31ff76819cf9cbfdd215243c3917c03ef38199312e567b3bf7aed3ab457f371ef8a1423f45b68c6e282ec111bba2833b987fd69fad83bc1b8c613c5e1ea16c11ed125ea7ec1026100fc8d6c04bec4eb9a8192ca7900cbe536e2e8b519decf33b2459798c6909df4f176db7d23190fc72b8865a718af895f1bcd9145298027423b605e70a47cf58390a8c3e88fc8c48e8b32e3da210dfbe3e881ea5674b6a348c21e93f9e55ea65efd026100d200d45e788aacea606a401d0460f87dd5c1027e12dc1a0d7586e8939d9cf789b40f51ac0442961de7d21cc21e05c83155c1f2aa9193387cfdf956cb48d153ba270406f9bbba537d4987d9e2f9942d7a14cbfffea74fecdda928d23e259f5ee1026100db16802f79a2f0d45f358d69fd33e44b81fae828622e93a54253e997d01b0743759da0e812b4aa4e6c8beab2328d5431955a418a67ff26a8c5c807a5da354e05ef31cc8cf758f463732950b03e265726fb94e39d6a572a26244ab08db75752ad026100a0a317cfe7df1423f87a6dee8451f4e2b4a67e5497f29b4f1e4e830b9fadd9401167026f5596e5a39c97817e0f5f16e27e19ec9902e01d7ea6fb9aa3c760afee1e381b69de6ac9c07585a06ad9c4ba00bf75c8ad2fa898a479e80ae294fed2a102600b21f335c353342eb44c3aa24445780c2d655b940174cae38c7c8a4e6493c0ba9fd303748267b083b9a7a6cb61e42db362b8c9896db7064e02ad5ae61587da15b4649c90594909feb37dbcb654beb7268ec801e5a8b4aa3911bebd88542f05be\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 267bcd118acab1fc8ba81c85d73003cb8610fa55c1d97da8d48a7c7f06896a4db751aa284255b9d36ad65f37653d829f1b37f97b8001942545b2fc2c55a7376ca7a1be4b1760c8e05a33e5aa2526b8d98e317088e7834c755b2a59b12631a182c05d5d43ab1779264f8456f515ce57dfdf512d5493dab7b7338dc4b7d78db9c091ac3baf537a69fc7f549d979f0eff9a94fda4169bd4d1d19a69c99e33c3b55490d501b39b1edae118ff6793a153261584d3a5f39f6e682e3d17c8cd1261fa72\nOutput = f735fd55ba92592c3b52b8f9c4f69aaa1cbef8fe88add095595412467f9cf4ec0b896c59eda16210e7549c8abb10cdbc21a12ec9b6b5b8fd2f10399eb6\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 93ac9f0671ec29acbb444effc1a5741351d60fdb0e393fbf754acf0de49761a14841df7772e9bc82773966a1584c4d72baea00118f83f35cca6e537cbd4d811f5583b29783d8a6d94cd31be70d6f526c10ff09c6fa7ce069795a3fcd0511fd5fcb564bcc80ea9c78f38b80012539d8a4ddf6fe81e9cddb7f50dbbbbcc7e5d86097ccf4ec49189fb8bf318be6d5a0715d516b49af191258cd32dc833ce6eb4673c03a19bbace88cc54895f636cc0c1ec89096d11ce235a265ca1764232a689ae8\nOutput = 81b906605015a63aabe42ddf11e1978912f5404c7474b26dce3ed482bf961ecc818bf420c54659\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 81ebdd95054b0c822ef9ad7693f5a87adfb4b4c4ce70df2df84ed49c04da58ba5fc20a19e1a6e8b7a3900b22796dc4e869ee6b42792d15a8eceb56c09c69914e813cea8f6931e4b8ed6f421af298d595c97f4789c7caa612c7ef360984c21b93edc5401068b5af4c78a8771b984d53b8ea8adf2f6a7d4a0ba76c75e1dd9f658f20ded4a46071d46d7791b56803d8fea7f0b0f8e41ae3f09383a6f9585fe7753eaaffd2bf94563108beecc207bbb535f5fcc705f0dde9f708c62f49a9c90371d3\nOutput = fd326429df9b890e09b54b18b8f34f1e24\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = bcc35f94cde66cb1136625d625b94432a35b22f3d2fa11a613ff0fca5bd57f87b902ccdc1cd0aebcb0715ee869d1d1fe395f6793003f5eca465059c88660d446ff5f0818552022557e38c08a67ead991262254f10682975ec56397768537f4977af6d5f6aaceb7fb25dec5937230231fd8978af49119a29f29e424ab8272b47562792d5c94f774b8829d0b0d9f1a8c9eddf37574d5fa248eefa9c5271fc5ec2579c81bdd61b410fa61fe36e424221c113addb275664c801d34ca8c6351e4a858\nOutput = f1459b5f0c92f01a0f723a2e5662484d8f8c0a20fc29dad6acd43bb5f3effdf4e1b63e07fdfe6628d0d74ca19bf2d69e4a0abf86d293925a796772f8088e\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 232afbc927fa08c2f6a27b87d4a5cb09c07dc26fae73d73a90558839f4fd66d281b87ec734bce237ba166698ed829106a7de6942cd6cdce78fed8d2e4d81428e66490d036264cef92af941d3e35055fe3981e14d29cbb9a4f67473063baec79a1179f5a17c9c1832f2838fd7d5e59bb9659d56dce8a019edef1bb3accc697cc6cc7a778f60a064c7f6f5d529c6210262e003de583e81e3167b89971fb8c0e15d44fffef89b53d8d64dd797d159b56d2b08ea5307ea12c241bd58d4ee278a1f2e\nOutput = 53e6e8c729d6f9c319dd317e74b0db8e4ccca25f3c8305746e137ac63a63ef3739e7b595abb96e8d55e54f7bd41ab433378ffb911d\n\nDecrypt = RSA-OAEP-9\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 438cc7dc08a68da249e42505f8573ba60e2c2773d5b290f4cf9dff718e842081c383e67024a0f29594ea987b9d25e4b738f285970d195abb3a8c8054e3d79d6b9c9a8327ba596f1259e27126674766907d8d582ff3a8476154929adb1e6d1235b2ccb4ec8f663ba9cc670a92bebd853c8dbf69c6436d016f61add836e94732450434207f9fd4c43dec2a12a958efa01efe2669899b5e604c255c55fb7166de5589e369597bb09168c06dd5db177e06a1740eb2d5c82faeca6d92fcee9931ba9f\nOutput = b6b28ea2198d0c1008bc64\n\nPrivateKey = RSA-OAEP-10\nType = RSA\nInput = 308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb020301000102820100056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e7902818100ecf5aecd1e5515fffacbd75a2816c6ebf49018cdfb4638e185d66a7396b6f8090f8018c7fd95cc34b857dc17f0cc6516bb1346ab4d582cadad7b4103352387b70338d084047c9d9539b6496204b3dd6ea442499207bec01f964287ff6336c3984658336846f56e46861881c10233d2176bf15a5e96ddc780bc868aa77d3ce76902818100bc46c464fc6ac4ca783b0eb08a3c841b772f7e9b2f28babd588ae885e1a0c61e4858a0fb25ac299990f35be85164c259ba1175cdd7192707135184992b6c29b746dd0d2cabe142835f7d148cc161524b4a09946d48b828473f1ce76b6cb6886c345c03e05f41d51b5c3a90a3f24073c7d74a4fe25d9cf21c75960f3fc386318302818100c73564571d00fb15d08a3de9957a50915d7126e9442dacf42bc82e862e5673ff6a008ed4d2e374617df89f17a160b43b7fda9cb6b6b74218609815f7d45ca263c159aa32d272d127faf4bc8ca2d77378e8aeb19b0ad7da3cb3de0ae7314980f62b6d4b0a875d1df03c1bae39ccd833ef6cd7e2d9528bf084d1f969e794e9f6c10281802658b37f6df9c1030be1db68117fa9d87e39ea2b693b7e6d3a2f70947413eec6142e18fb8dfcb6ac545d7c86a0ad48f8457170f0efb26bc48126c53efd1d16920198dc2a1107dc282db6a80cd3062360ba3fa13f70e4312ff1a6cd6b8fc4cd9c5c3db17c6d6a57212f73ae29f619327bad59b153858585ba4e28b60a62a45e490281806f38526b3925085534ef3e415a836ede8b86158a2c7cbfeccb0bd834304fec683ba8d4f479c433d43416e63269623cea100776d85aff401d3fff610ee65411ce3b1363d63a9709eede42647cea561493d54570a879c18682cd97710b96205ec31117d73b5f36223fadd6e8ba90dd7c0ee61d44e163251e20c7f66eb305117cb8\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 53ea5dc08cd260fb3b858567287fa91552c30b2febfba213f0ae87702d068d19bab07fe574523dfb42139d68c3c5afeee0bfe4cb7969cbf382b804d6e61396144e2d0e60741f8993c3014b58b9b1957a8babcd23af854f4c356fb1662aa72bfcc7e586559dc4280d160c126785a723ebeebeff71f11594440aaef87d10793a8774a239d4a04c87fe1467b9daf85208ec6c7255794a96cc29142f9a8bd418e3c1fd67344b0cd0829df3b2bec60253196293c6b34d3f75d32f213dd45c6273d505adf4cced1057cb758fc26aeefa441255ed4e64c199ee075e7f16646182fdb464739b68ab5daff0e63e9552016824f054bf4d3c8c90a97bb6b6553284eb429fcc\nOutput = 8bba6bf82a6c0f86d5f1756e97956870b08953b06b4eb205bc1694ee\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = a2b1a430a9d657e2fa1c", + "2bb5ed43ffb25c05a308fe9093c01031795f5874400110828ae58fb9b581ce9dddd3e549ae04a0985459bde6c626594e7b05dc4278b2a1465c1368408823c85e96dc66c3a30983c639664fc4569a37fe21e5a195b5776eed2df8d8d361af686e750229bbd663f161868a50615e0c337bec0ca35fec0bb19c36eb2e0bbcc0582fa1d93aacdb061063f59f2ce1ee43605e5d89eca183d2acdfe9f81011022ad3b43a3dd417dac94b4e11ea81b192966e966b182082e71964607b4f8002f36299844a11f2ae0faeac2eae70f8f4f98088acdcd0ac556e9fccc511521908fad26f04c64201450305778758b0538bf8b5bb144a828e629795\nOutput = e6ad181f053b58a904f2457510373e57\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 9886c3e6764a8b9a84e84148ebd8c3b1aa8050381a78f668714c16d9cfd2a6edc56979c535d9dee3b44b85c18be8928992371711472216d95dda98d2ee8347c9b14dffdff84aa48d25ac06f7d7e65398ac967b1ce90925f67dce049b7f812db0742997a74d44fe81dbe0e7a3feaf2e5c40af888d550ddbbe3bc20657a29543f8fc2913b9bd1a61b2ab2256ec409bbd7dc0d17717ea25c43f42ed27df8738bf4afc6766ff7aff0859555ee283920f4c8a63c4a7340cbafddc339ecdb4b0515002f96c932b5b79167af699c0ad3fccfdf0f44e85a70262bf2e18fe34b850589975e867ff969d48eabf212271546cdc05a69ecb526e52870c836f307bd798780ede\nOutput = 510a2cf60e866fa2340553c94ea39fbc256311e83e94454b4124\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 6318e9fb5c0d05e5307e1683436e903293ac4642358aaa223d7163013aba87e2dfda8e60c6860e29a1e92686163ea0b9175f329ca3b131a1edd3a77759a8b97bad6a4f8f4396f28cf6f39ca58112e48160d6e203daa5856f3aca5ffed577af499408e3dfd233e3e604dbe34a9c4c9082de65527cac6331d29dc80e0508a0fa7122e7f329f6cca5cfa34d4d1da417805457e008bec549e478ff9e12a763c477d15bbb78f5b69bd57830fc2c4ed686d79bc72a95d85f88134c6b0afe56a8ccfbc855828bb339bd17909cf1d70de3335ae07039093e606d655365de6550b872cd6de1d440ee031b61945f629ad8a353b0d40939e96a3c450d2a8d5eee9f678093c8\nOutput = bcdd190da3b7d300df9a06e22caae2a75f10c91ff667b7c16bde8b53064a2649a94045c9\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 75290872ccfd4a4505660d651f56da6daa09ca1301d890632f6a992f3d565cee464afded40ed3b5be9356714ea5aa7655f4a1366c2f17c728f6f2c5a5d1f8e28429bc4e6f8f2cff8da8dc0e0a9808e45fd09ea2fa40cb2b6ce6ffff5c0e159d11b68d90a85f7b84e103b09e682666480c657505c0929259468a314786d74eab131573cf234bf57db7d9e66cc6748192e002dc0deea930585f0831fdcd9bc33d51f79ed2ffc16bcf4d59812fcebcaa3f9069b0e445686d644c25ccf63b456ee5fa6ffe96f19cdf751fed9eaf35957754dbf4bfea5216aa1844dc507cb2d080e722eba150308c2b5ff1193620f1766ecf4481bafb943bd292877f2136ca494aba0\nOutput = a7dd6c7dc24b46f9dd5f1e91ada4c3b3df947e877232a9\n\nDecrypt = RSA-OAEP-10\nRSAPadding = OAEP\nMGF1Digest = SHA1\nInput = 2d207a73432a8fb4c03051b3f73b28a61764098dfa34c47a20995f8115aa6816679b557e82dbee584908c6e69782d7deb34dbd65af063d57fca76a5fd069492fd6068d9984d209350565a62e5c77f23038c12cb10c6634709b547c46f6b4a709bd85ca122d74465ef97762c29763e06dbc7a9e738c78bfca0102dc5e79d65b973f28240caab2e161a78b57d262457ed8195d53e3c7ae9da021883c6db7c24afdd2322eac972ad3c354c5fcef1e146c3a0290fb67adf007066e00428d2cec18ce58f9328698defef4b2eb5ec76918fde1c198cbb38b7afc67626a9aefec4322bfd90d2563481c9a221f78c8272c82d1b62ab914e1c69f6af6ef30ca5260db4a46\nOutput = eaf1a73a1b0c4609537de69cd9228bbcfb9a8ca8c6c3efaf056fe4a7f4634ed00b7c39ec6922d7b8ea2c04ebac\n\n\n# Single-shot signing tests.\n\nSignMessage = RSA-2048\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = RSA-2048\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = RSA-2048-SPKI\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\n\nVerifyMessage = P-256\nDigest = SHA256\nInput = \"Hello world\"\nOutput = 304502204c66004635c267394bd6857c1e0b53b22a2bab1ca7dff9d5c1b42143858b3ea7022100ae81228510e03cd49a8863d2ebd1c05fe0c87eacd1150433132b909994cd0dbd\n\n# Digest can't be omitted in many algorithms.\nSignMessage = RSA-2048\nInput = \"Hello world\"\nError = NO_DEFAULT_DIGEST\n\nVerifyMessage = RSA-2048\nInput = \"Hello world\"\nOutput = 301894798b49d6ec55d32dcc74314f04230591a515781f3eb4492f5324b56046836c4bc3e25942af341e88558cb4c3814a849207575d343189147989b16e296b5138dbbc717116dc416f201dfa35943d15060493953cda1f04a13ff89845cf7fd69e1a78d5d38522a77bb234e5d0ba2ae17ada6e22fdae27a4052fdb8ac267507dfe06ed7a865e61a52b530bbbf65c7caa89739613df10ae3b0e62ff6831ee0770086aad39c329462aede9f1b29a501bc3d09e0fe4034aa5d6831d44491d508111d88a1d7ba50cee5ef7e701b3a589adc09a752a974a6805956f4a1a0582f66309a1e02e9fb6b10d2c820fe98bb2eb04f435bc8a649cc9ab6c5a4c03e83800d1\nError = NO_DEFAULT_DIGEST\n\n# Signing test vectors from RFC 8032.\nSignMessage = Ed25519\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nSignMessage = Ed25519-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nSignMessage = Ed25519-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nSignMessage = Ed25519-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496af", + "c5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nSignMessage = Ed25519-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\n# Signing with public keys is not allowed.\nSignMessage = Ed25519-SPKI\nInput = \"\"\nError = NOT_A_PRIVATE_KEY\n\n# Verify test vectors from RFC 8032. Test verifying with both the public and\n# private key.\nVerifyMessage = Ed25519\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nVerifyMessage = Ed25519-SPKI\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\n\nVerifyMessage = Ed25519-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nVerifyMessage = Ed25519-SPKI-2\nInput = 72\nOutput = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00\n\nVerifyMessage = Ed25519-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nVerifyMessage = Ed25519-SPKI-3\nInput = af82\nOutput = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a\n\nVerifyMessage = Ed25519-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nVerifyMessage = Ed25519-SPKI-4\nInput = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0\nOutput = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03\n\nVerifyMessage = Ed25519-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\nVerifyMessage = Ed25519-SPKI-5\nInput = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\nOutput = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704\n\n# Length is wrong.\nVerifyMessage = Ed25519-SPKI\nInput = \"\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a10\nError = INVALID_SIGNATURE\n\n# Message is wrong.\nVerifyMessage = Ed25519-SPKI\nInput = \"Hello world\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\nError = INVALID_SIGNATURE\n\n# Ed25519 does not support configuring a digest.\nSignMessage = Ed25519\nInput = \"\"\nDigest = SHA256\nError = COMMAND_NOT_SUPPORTED\n\n# Ed25519 does not support signing a pre-hashed value.\nSign = Ed25519\nInput = \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\"\nError = OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\n\nVerify = Ed25519\nInput = \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\"\nOutput = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b\nError = OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\n", }; -static const size_t kLen32 = 122874; +static const size_t kLen32 = 122835; static const char *kData33[] = { "#\n# Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.\n#\n# Licensed under the OpenSSL license (the \"License\"). You may not use\n# this file except in compliance with the License. You can obtain a copy\n# in the file LICENSE in the source distribution or at\n# https://www.openssl.org/source/license.html\n\nPassword = \"\"\nSalt = \"\"\nN = 16\nr = 1\np = 1\nKey = 77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906\n\nPassword = \"password\"\nSalt = \"NaCl\"\nN = 1024\nr = 8\np = 16\nKey = fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640\n\nPassword = \"pleaseletmein\"\nSalt = \"SodiumChloride\"\nN = 16384\nr = 8\np = 1\nKey = 7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887\n\n# NB: this test requires more than 1GB of memory to run so it is disabled by\n# default. Uncomment it to run.\n# Password = \"pleaseletmein\"\n# Salt = \"SodiumChloride\"\n# N = 1048576\n# r = 8\n# p = 1\n# Key = 2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4\n# MaxMemory = 10000000000\n",
diff --git a/third_party/boringssl/ios-arm/crypto/chacha/chacha-armv4.S b/third_party/boringssl/ios-arm/crypto/chacha/chacha-armv4.S index ec3555de..8c61ca5 100644 --- a/third_party/boringssl/ios-arm/crypto/chacha/chacha-armv4.S +++ b/third_party/boringssl/ios-arm/crypto/chacha/chacha-armv4.S
@@ -1,8 +1,10 @@ #include <openssl/arm_arch.h> .text -#if defined(__thumb2__) +#if defined(__thumb2__) || defined(__clang__) .syntax unified +#endif +#if defined(__thumb2__) .thumb #else .code 32
diff --git a/third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S b/third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S index 0784fc7..6c947734fe 100644 --- a/third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S +++ b/third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S
@@ -2,8 +2,10 @@ #include <openssl/arm_arch.h> .text -#if defined(__thumb2__) +#if defined(__thumb2__) || defined(__clang__) .syntax unified +#endif +#if defined(__thumb2__) .thumb #else .code 32
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index 7a0f4ad0..4a6f9a3 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc
@@ -426,7 +426,11 @@ char buf[512]; base::snprintf(buf, sizeof(buf), "%s (ChromeMethodBFE: %d::%s::%d)", message.c_str(), method, MethodIDToString(method), -error); - return Status::IOError(filename, buf); + if (error == base::File::FILE_ERROR_NOT_FOUND) { + return Status::NotFound(filename, buf); + } else { + return Status::IOError(filename, buf); + } } Status MakeIOError(Slice filename,
diff --git a/third_party/material_design_icons/BUILD.gn b/third_party/material_design_icons/BUILD.gn index 6a3af431..a074c03 100644 --- a/third_party/material_design_icons/BUILD.gn +++ b/third_party/material_design_icons/BUILD.gn
@@ -14,6 +14,8 @@ "action/ic_account_circle", "action/ic_account_circle_48pt", "action/ic_delete", + "action/ic_feedback", + "action/ic_help", "action/ic_info", "action/ic_lock_18pt", "action/ic_open_in_browser",
diff --git a/tools/determinism/deterministic_build_whitelist.pyl b/tools/determinism/deterministic_build_whitelist.pyl index ef4a9c9..728349c 100644 --- a/tools/determinism/deterministic_build_whitelist.pyl +++ b/tools/determinism/deterministic_build_whitelist.pyl
@@ -39,7 +39,6 @@ 'blink_platform_perftests', 'blink_platform_unittests', 'bluetooth_metrics_hash', - 'boringssl_unittests', 'browser_tests', 'cacheinvalidation_unittests', 'capture_unittests',
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 0b4820b6..c40af94d 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -5220,6 +5220,14 @@ <description>The user dismissed the in-product help.</description> </action> +<action name="InProductHelp.NotifyEvent.IPH_BadgedReadingList"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + An event related to the badged reading list in-product help experiment. + </description> +</action> + <action name="InProductHelp.NotifyEvent.IPH_DataSaverDetail"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5258,12 +5266,34 @@ <description>The user triggered an event in in-product help.</description> </action> +<action name="InProductHelp.NotifyEvent.IPH_NewIncognitoTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + An event related to the new incognito tab tip in-product help experiment. + </description> +</action> + <action name="InProductHelp.NotifyEvent.IPH_NewTab"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <description>The user triggered an event in in-product help.</description> </action> +<action name="InProductHelp.NotifyEvent.IPH_NewTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + An event related to the new tab tip in-product help experiment. + </description> +</action> + +<action name="InProductHelp.NotifyUsedEvent.IPH_BadgedReadingList"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>The user triggered a used event in in-product help.</description> +</action> + <action name="InProductHelp.NotifyUsedEvent.IPH_DataSaverDetail"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5300,12 +5330,33 @@ <description>The user triggered a used event in in-product help.</description> </action> +<action name="InProductHelp.NotifyUsedEvent.IPH_NewIncognitoTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>The user triggered a used event in in-product help.</description> +</action> + <action name="InProductHelp.NotifyUsedEvent.IPH_NewTab"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <description>The user triggered a used event in in-product help.</description> </action> +<action name="InProductHelp.NotifyUsedEvent.IPH_NewTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>The user triggered a used event in in-product help.</description> +</action> + +<action name="InProductHelp.ShouldTriggerHelpUI.IPH_BadgedReadingList"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + The feature engagement tracker tried to determine whether in-product help + should be shown to the user. + </description> +</action> + <action name="InProductHelp.ShouldTriggerHelpUI.IPH_DataSaverDetail"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5360,6 +5411,15 @@ </description> </action> +<action name="InProductHelp.ShouldTriggerHelpUI.IPH_NewIncognitoTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + The feature engagement tracker tried to determine whether in-product help + should be shown to the user. + </description> +</action> + <action name="InProductHelp.ShouldTriggerHelpUI.IPH_NewTab"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5369,6 +5429,24 @@ </description> </action> +<action name="InProductHelp.ShouldTriggerHelpUI.IPH_NewTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + The feature engagement tracker tried to determine whether in-product help + should be shown to the user. + </description> +</action> + +<action + name="InProductHelp.ShouldTriggerHelpUIResult.NotTriggered.IPH_BadgedReadingList"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + A user action that could have triggered In-Product Help did not. + </description> +</action> + <action name="InProductHelp.ShouldTriggerHelpUIResult.NotTriggered.IPH_DataSaverDetail"> <owner>nyquist@chromium.org</owner> @@ -5423,6 +5501,15 @@ </description> </action> +<action + name="InProductHelp.ShouldTriggerHelpUIResult.NotTriggered.IPH_NewIncognitoTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + A user action that could have triggered In-Product Help did not. + </description> +</action> + <action name="InProductHelp.ShouldTriggerHelpUIResult.NotTriggered.IPH_NewTab"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5432,6 +5519,22 @@ </action> <action + name="InProductHelp.ShouldTriggerHelpUIResult.NotTriggered.IPH_NewTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description> + A user action that could have triggered In-Product Help did not. + </description> +</action> + +<action + name="InProductHelp.ShouldTriggerHelpUIResult.Triggered.IPH_BadgedReadingList"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>A user action triggered In-Product Help.</description> +</action> + +<action name="InProductHelp.ShouldTriggerHelpUIResult.Triggered.IPH_DataSaverDetail"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> @@ -5473,12 +5576,25 @@ <description>A user action triggered In-Product Help.</description> </action> +<action + name="InProductHelp.ShouldTriggerHelpUIResult.Triggered.IPH_NewIncognitoTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>A user action triggered In-Product Help.</description> +</action> + <action name="InProductHelp.ShouldTriggerHelpUIResult.Triggered.IPH_NewTab"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <description>A user action triggered In-Product Help.</description> </action> +<action name="InProductHelp.ShouldTriggerHelpUIResult.Triggered.IPH_NewTabTip"> + <owner>edchin@chromium.org</owner> + <owner>gchatz@chromium.org</owner> + <description>A user action triggered In-Product Help.</description> +</action> + <action name="Indent"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 0c8a9641..f36a0b4 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -20557,7 +20557,8 @@ <enum name="InstantTethering_ConnectionToHostResult_Failure_ClientConnection"> <int value="0" label="Timeout while waiting to connect"/> - <int value="1" label="Canceled by a new connection attempt"/> + <int value="1" label="Canceled"/> + <int value="2" label="Internal error"/> </enum> <enum name="InstantTethering_ConnectionToHostResult_Failure_TetheringTimeout"> @@ -20778,6 +20779,11 @@ <int value="2" label="Failed to determine"/> </enum> +<enum name="IsSyncPasswordHashSaved"> + <int value="0" label="Not saved"/> + <int value="1" label="Saved"/> +</enum> + <enum name="JavaScriptAPIName"> <int value="0" label="GetUserMedia"/> <int value="1" label="PeerConnection00"/> @@ -22077,6 +22083,14 @@ <int value="10" label="Fedora Other"/> <int value="11" label="Fedora 24"/> <int value="12" label="Fedora 25"/> + <int value="13" label="Fedora 26"/> + <int value="14" label="Debian 9"/> + <int value="15" label="Arch"/> + <int value="16" label="CentOS"/> + <int value="17" label="elementary OS"/> + <int value="18" label="Mint"/> + <int value="19" label="RHEL"/> + <int value="20" label="SUSE Linux Enterprise"/> </enum> <enum name="LinuxGlibcVersion"> @@ -22757,6 +22771,7 @@ <int value="-856016114" label="NTPOfflinePages:disabled"/> <int value="-855130893" label="enable-touch-calibration-setting"/> <int value="-853594220" label="disable-new-avatar-menu"/> + <int value="-848691867" label="DesktopPWAWindowing:enabled"/> <int value="-844537521" label="HttpFormWarning:disabled"/> <int value="-842438090" label="enable-md-feedback"/> <int value="-836123854" label="wallet-service-use-sandbox"/> @@ -22949,6 +22964,7 @@ <int value="-146552997" label="enable-affiliation-based-matching"/> <int value="-144134779" label="AndroidPayIntegrationV2:disabled"/> <int value="-143382681" label="InstantTethering:enabled"/> + <int value="-138983372" label="DesktopPWAWindowing:disabled"/> <int value="-138773929" label="PassiveDocumentEventListeners:enabled"/> <int value="-122492389" label="enable-browser-task-scheduler"/> <int value="-119055644" label="GenericSensor:enabled"/> @@ -23344,6 +23360,7 @@ <int value="1253698118" label="ash-disable-stable-overview-order"/> <int value="1257980502" label="disable-accelerated-video-decode"/> <int value="1260186484" label="spurious-power-button-screen-accel"/> + <int value="1266886673" label="delay-reload-stop-button-change"/> <int value="1268470658" label="disable-android-password-link"/> <int value="1269940659" label="EnumerateAudioDevices:enabled"/> <int value="1269952439" label="AndroidAIAFetching:disabled"/> @@ -29240,6 +29257,7 @@ <int value="1099975614" label="PPB_Flash;12.5"/> <int value="1111997633" label="PPB_AudioInput(Dev);0.4"/> <int value="1155638369" label="PPB_WheelInputEvent;1.0"/> + <int value="1158760765" label="PPB_PlatformVerification_Private;0.3"/> <int value="1161845861" label="PPB_NetAddress_Private;1.0"/> <int value="1173327824" label="PPB_OpenGLES2ChromiumEnableFeature;1.0"/> <int value="1188712923" label="PPB_Talk_Private;2.0"/> @@ -33377,8 +33395,14 @@ <int value="3" label="The worker was stopping. Once stopped, the browser started it up"/> <int value="4" label="The worker started up in a new process."/> - <int value="5" label="The worker started up in an existing process."/> + <int value="5" label="The worker started up in an existing process."> + <obsolete> + Deprecated as of 07/2017. Replaced by 7 and 8. + </obsolete> + </int> <int value="6" label="The worker started up during browser startup."/> + <int value="7" label="The worker started up in an existing unready process."/> + <int value="8" label="The worker started up in an existing ready process."/> </enum> <enum name="ServiceWorkerReadResponseResult"> @@ -34380,11 +34404,35 @@ <int value="4" label="Used, relocked"/> </enum> +<enum name="SoftwareReporterCleanerDownloadStatus"> + <int value="0" label="Succeeded"/> + <int value="1" label="Other failure"/> + <int value="2" label="Not found on server"/> + <int value="3" label="Failed to create temporary directory"/> +</enum> + +<enum name="SoftwareReporterCleanupResult"> + <int value="0" label="Succeeded"/> + <int value="1" label="Reboot required"/> + <int value="2" label="Failed"/> +</enum> + +<enum name="SoftwareReporterCleanupStarted"> + <int value="0" label="From prompt dialog"/> + <int value="1" label="From prompt in Settings"/> +</enum> + <enum name="SoftwareReporterExperimentError"> <int value="1" label="Bad tag"/> <int value="2" label="Bad parameters"/> </enum> +<enum name="SoftwareReporterIPCDisconnected"> + <int value="0" label="Success - no longer needed"/> + <int value="1" label="Connection lost while scanning"/> + <int value="2" label="Connection lost while waiting for user response"/> +</enum> + <enum name="SoftwareReporterLogsUploadEnabled"> <int value="0" label="Enabled"/> <int value="1" label="SBER Disabled"/> @@ -34408,6 +34456,24 @@ <int value="3" label="Value out of bounds"/> </enum> +<enum name="SoftwareReporterNoPromptReason"> + <int value="0" label="Behaviour not supported"/> + <int value="1" label="Feature not enabled"/> + <int value="2" label="Nothing found"/> + <int value="3" label="Already prompted"/> + <int value="4" label="Cleaner download failed"/> + <int value="5" label="Browser not available"/> + <int value="6" label="Not on idle state"/> + <int value="7" label="IPC connection broken"/> +</enum> + +<enum name="SoftwareReporterPromptDialogResponse"> + <int value="0" label="Accepted"/> + <int value="2" label="Details"/> + <int value="3" label="Cancelled"/> + <int value="4" label="Dismissed"/> +</enum> + <enum name="SpareWebContentsStatus"> <int value="0" label="Created"/> <int value="1" label="Used"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 5e92fef5..e8f9de4e 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -26681,7 +26681,7 @@ Provides a top-level breakdown of the times a connection to a host has failed. - An "unknown error" is generally caused by the host returning an + An "unknown error" is caused by the host returning an "unknown error" response code. Tethering timing out and client connection error and 3) are both broken down further in InstantTethering.ConnectionToHostResult.Failure.TetheringTimeout and @@ -26696,9 +26696,12 @@ <owner>hansberry@chromium.com</owner> <summary> Breaks down the reasons why the client failed to connect to the hotspot, and - the number of times they occurred. This histogram captures 2 reasons: 1) the - connection attempt to the hotspot timed out, or 2) any stage of the - connection attempt was canceled by a new connection attempt. + the number of times they occurred. + + Note that a client connection can be canceled by a user either via pressing + the Disconnect button or beginning a connection attempt to another host. The + "internal error" case is a general bucket that captures client + errors we don't expect to be significant failure causes. This histogram breaks down the "client connection error" count of InstantTethering.ConnectionToHostResult.Failure. @@ -52372,6 +52375,16 @@ </summary> </histogram> +<histogram name="PasswordManager.IsSyncPasswordHashSaved" + enum="IsSyncPasswordHashSaved"> + <owner>dvadym@chromium.org</owner> + <owner>nparker@chromium.org</owner> + <summary> + This metric reports whether a sync password hash is saved. Recorded shortly + after Chrome startup. + </summary> +</histogram> + <histogram name="PasswordManager.KeychainMigration.NumChromeOwnedInaccessiblePasswords"> <obsolete> @@ -69608,6 +69621,16 @@ </summary> </histogram> +<histogram name="ServiceWorker.StartHintPrecision" enum="BooleanEnabled"> + <owner>horo@chromium.org</owner> + <summary> + The precision of the speculative launch of Service Workers for navigation + hints. Recorded when the worker is stopped. True if a fetch event for a + main/sub frame navigation was fired on the worker before it stopped; + otherwise, false. False means the speculative launch wasn't helpful. + </summary> +</histogram> + <histogram name="ServiceWorker.StartNewWorker.Status" enum="ServiceWorkerStatusCode"> <owner>falken@chromium.org</owner> @@ -73346,6 +73369,24 @@ </summary> </histogram> +<histogram name="SoftwareReporter.Cleaner.CleanupResult" + enum="SoftwareReporterCleanupResult"> + <owner>ftirelo@chromium.org</owner> + <summary> + The final status of the Chrome Cleanup Tool run (e.g. succeeded, failed, + reboot required). + </summary> +</histogram> + +<histogram name="SoftwareReporter.Cleaner.DownloadStatus" + enum="SoftwareReporterCleanerDownloadStatus"> + <owner>ftirelo@chromium.org</owner> + <summary> + An indication if an attempt to download the Chrome Cleanup Tool succeeded + or the reason why it failed. + </summary> +</histogram> + <histogram name="SoftwareReporter.Cleaner.HasCompleted" enum="SRTCompleted"> <owner>mad@chromium.org</owner> <summary> @@ -73363,6 +73404,17 @@ </summary> </histogram> +<histogram name="SoftwareReporter.Cleaner.RebootResponse" enum="Boolean"> + <owner>ftirelo@chromium.org</owner> + <summary> + Indicates that the user accepted to initiate a reboot to complete a run + of the Chrome Cleanup Tool. This is logged the user starts a reboot from + the cleanup card in the Settings page. We can't track when the reboot is + not initiated, because it can happen at any moment in the future (there is + no prompt blocking the user). + </summary> +</histogram> + <histogram name="SoftwareReporter.Cleaner.RunningTime" units="ms"> <owner>mad@chromium.org</owner> <summary>How long it took to run the software reporter cleaner tool.</summary> @@ -73373,6 +73425,31 @@ <summary>The build version of the software reporter cleaner tool.</summary> </histogram> +<histogram name="SoftwareReporter.CleanerLogsAcceptance" enum="Boolean"> + <owner>ftirelo@chromium.org</owner> + <summary> + Whether the user accepted to upload logs from Chrome Cleanup Tool. This is + logged when the user accepts the Chrome prompt to start a cleanup either from + the prompt dialog or from the cleanup card in the Settings page. + </summary> +</histogram> + +<histogram name="SoftwareReporter.CleanupCard" enum="Boolean"> + <owner>ftirelo@chromium.org</owner> + <summary> + Whether the Chrome Cleanup Tool card in the Settings page has been shown. + </summary> +</histogram> + +<histogram name="SoftwareReporter.CleanupStarted" + enum="SoftwareReporterCleanupStarted"> + <owner>ftirelo@chromium.org</owner> + <summary> + Indicates where the user started a cleanup from (e.g. from the prompt + dialog or the settings page). + </summary> +</histogram> + <histogram name="SoftwareReporter.ExperimentErrors" enum="SoftwareReporterExperimentError"> <owner>joenotcharles@chromium.org</owner> @@ -73390,6 +73467,20 @@ </summary> </histogram> +<histogram name="SoftwareReporter.IPCDisconnected" + enum="SoftwareReporterIPCDisconnected"> + <owner>ftirelo@chromium.org</owner> + <summary> + Indicates when the IPC with the Chrome Cleanup Tool process is disconnected + from Chrome. Success is logged when it's disconnected and no longer needed + (the user already responded to the prompt in Chrome or the cleaner process + terminated normally); failures are logged when the IPC is disconnected, but + communication between Chrome and the cleaner process is still required + (e.g. while Chrome is waiting for scanning results or when the cleaner is + waiting for the user's response from Chrome). + </summary> +</histogram> + <histogram name="SoftwareReporter.LastUploadResult" enum="BooleanSuccess"> <owner>mad@chromium.org</owner> <summary>The result of the most recent SRT log upload.</summary> @@ -73450,6 +73541,46 @@ </summary> </histogram> +<histogram name="SoftwareReporter.NoPromptReason" + enum="SoftwareReporterNoPromptReason"> + <owner>ftirelo@chromium.org</owner> + <summary> + The reason why the user has not been prompted to run the Chrome Cleanup + Tool (e.g. no unwanted software found, user recently prompted). + </summary> +</histogram> + +<histogram name="SoftwareReporter.NumberOfFilesToDelete" units="counts"> + <owner>ftirelo@chromium.org</owner> + <summary> + The number of files to be deleted by the Chrome Cleanup Tool. + </summary> +</histogram> + +<histogram name="SoftwareReporter.PostCleanupSettingsReset" units="counts"> + <owner>ftirelo@chromium.org</owner> + <summary> + The number of profiles whose settings will be reset once a successful + cleanup completes. + </summary> +</histogram> + +<histogram name="SoftwareReporter.PromptDialogResponse" + enum="SoftwareReporterPromptDialogResponse"> + <owner>ftirelo@chromium.org</owner> + <summary> + The user response on the modal Chrome Cleanup Tool prompt dialog + (e.g. accepted, cancelled). + </summary> +</histogram> + +<histogram name="SoftwareReporter.PromptShown" enum="Boolean"> + <owner>ftirelo@chromium.org</owner> + <summary> + Whether the user has been prompted to run the Chrome Cleanup Tool. + </summary> +</histogram> + <histogram name="SoftwareReporter.PromptUsage" enum="SRTPromptUsage"> <owner>mad@chromium.org</owner> <summary>Usage of the Software Removal Tool (SRT) Prompt.</summary> @@ -73488,6 +73619,14 @@ </summary> </histogram> +<histogram name="SoftwareReporter.TaggedProfileForResetting" enum="Boolean"> + <owner>ftirelo@chromium.org</owner> + <summary> + Registers when a profile is tagged for settings reset before a run of + the Chrome Cleanup Tool. + </summary> +</histogram> + <histogram name="SoftwareReporter.UploadFailureCount"> <owner>mad@chromium.org</owner> <summary> @@ -88016,6 +88155,9 @@ </histogram> <histogram name="WinJumplist.NotificationTimeInterval" units="ms"> + <obsolete> + Obsolete 07/10/2017 as it's no longer needed. + </obsolete> <owner>chengx@chromium.org</owner> <summary> The time interval between two adjacent update notifications if it's less @@ -88023,6 +88165,14 @@ </summary> </histogram> +<histogram name="WinJumplist.NotificationTimeInterval2" units="ms"> + <owner>chengx@chromium.org</owner> + <summary> + The time interval between two adjacent update notifications. A zero value + indicates the interval is greater than 3500 ms. + </summary> +</histogram> + <histogram name="WinJumplist.OnFaviconDataAvailableDuration" units="ms"> <obsolete> Obsolete 06/22/2017 as it's no longer needed. @@ -88064,6 +88214,9 @@ </histogram> <histogram name="WinJumplistUpdater.AddTasksDuration" units="ms"> + <obsolete> + Obsolete 07/10/2017 as it's no longer needed. + </obsolete> <owner>chengx@chromium.org</owner> <summary>Time spent in JumpListUpdater::AddTasks.</summary> </histogram> @@ -91289,6 +91442,11 @@ <suffix name="IPH_DownloadHome" label="In product help download home."/> <suffix name="IPH_NewTab" label="In product help new tab."/> <suffix name="IPH_IncognitoWindow" label="In product help incognito window."/> + <suffix name="IPH_NewTabTip" label="In product help new tab tip."/> + <suffix name="IPH_NewIncognitoTabTip" + label="In product help new incognito tab tip."/> + <suffix name="IPH_BadgedReadingList" + label="In product help badged reading list."/> </histogram_suffixes> <histogram_suffixes name="IPProtocolType" separator="_"> @@ -96661,7 +96819,10 @@ <affected-histogram name="ServiceWorker.EventDispatchingDelay"/> <affected-histogram name="ServiceWorker.StartWorker.StatusByPurpose"/> <affected-histogram name="ServiceWorker.StartWorker.Time_DuringStartup"/> - <affected-histogram name="ServiceWorker.StartWorker.Time_ExistingProcess"/> + <affected-histogram + name="ServiceWorker.StartWorker.Time_ExistingReadyProcess"/> + <affected-histogram + name="ServiceWorker.StartWorker.Time_ExistingUnreadyProcess"/> <affected-histogram name="ServiceWorker.StartWorker.Time_NewProcess"/> </histogram_suffixes> @@ -96702,11 +96863,17 @@ <histogram_suffixes name="ServiceWorker.StartSituation" separator="_"> <suffix name="DuringStartup" label="The worker started up during browser startup."/> - <suffix name="NewProcess" - label="A new process was created for the worker (or is asyncly being - created, depending on the histogram)."/> - <suffix name="ExistingProcess" - label="An existing process was used for the worker."/> + <suffix name="NewProcess" label="A new process was created for the worker."/> + <suffix name="ExistingProcess"> + <obsolete> + Deprecated as of 07/2017. Replaced by ExistingUnreadyProcess and + ExistingReadyProcess. + </obsolete> + </suffix> + <suffix name="ExistingUnreadyProcess" + label="An existing unready process was used for the worker."/> + <suffix name="ExistingReadyProcess" + label="An existing ready process was used for the worker."/> <affected-histogram name="EmbeddedWorkerInstance.Start.StartMessageLatency"/> <affected-histogram name="EmbeddedWorkerInstance.Start.TimeToEvaluateScript"/> <affected-histogram name="EmbeddedWorkerInstance.Start.TimeToLoad.HttpCache"/> @@ -96725,8 +96892,16 @@ label="Started a worker during browser startup."/> <suffix name="StartWorkerNewProcess" label="Started a worker in a new process."/> - <suffix name="StartWorkerExistingProcess" - label="Started a worker in an existing process."/> + <suffix name="StartWorkerExistingProcess"> + <obsolete> + Deprecated as of 07/2017. Replaced by StartWorkerExistingUnreadyProcess + and StartWorkerExistingReadyProcess. + </obsolete> + </suffix> + <suffix name="StartWorkerExistingUnreadyProcess" + label="Started a worker in an existing unready process."/> + <suffix name="StartWorkerExistingReadyProcess" + label="Started a worker in an existing ready process."/> <suffix name="StartingWorker" label="The activated worker was already starting up."/> <suffix name="RunningWorker"
diff --git a/tools/perf/benchmarks/startup.py b/tools/perf/benchmarks/startup.py index 8a80304..2ae669c3 100644 --- a/tools/perf/benchmarks/startup.py +++ b/tools/perf/benchmarks/startup.py
@@ -91,7 +91,8 @@ def GetExpectations(self): class StoryExpectations(story.expectations.StoryExpectations): def SetExpectations(self): - pass # blank_page.html not disabled. + self.PermanentlyDisableBenchmark( + [story.expectations.ALL_ANDROID], 'Desktop benchmark') return StoryExpectations() @@ -115,5 +116,6 @@ def GetExpectations(self): class StoryExpectations(story.expectations.StoryExpectations): def SetExpectations(self): - pass # blank_page.html not disabled. + self.PermanentlyDisableBenchmark( + [story.expectations.ALL_ANDROID], 'Desktop benchmark') return StoryExpectations()
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index a0e40c2..06b3c16 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -756,11 +756,7 @@ # Devices which are broken right now. Tests will not be scheduled on them. # Please add a comment with a bug for replacing the device. -BLACKLISTED_DEVICES = [ - 'build152-m1', # crbug.com/736593 - # All Linux perf bots (crbug.com/732463) - 'build148-m1', 'build149-m1', 'build150-m1', 'build151-m1', 'build152-m1', -] +BLACKLISTED_DEVICES = [] # List of benchmarks that are to never be run with reference builds.
diff --git a/ui/accessibility/ax_role_properties.cc b/ui/accessibility/ax_role_properties.cc index bf66431..34355fe 100644 --- a/ui/accessibility/ax_role_properties.cc +++ b/ui/accessibility/ax_role_properties.cc
@@ -133,4 +133,8 @@ } } +bool IsEditField(ui::AXRole role) { + return role == ui::AX_ROLE_TEXT_FIELD || role == ui::AX_ROLE_SEARCH_BOX; +} + } // namespace ui
diff --git a/ui/accessibility/ax_role_properties.h b/ui/accessibility/ax_role_properties.h index 22c7c2b..ef6838f 100644 --- a/ui/accessibility/ax_role_properties.h +++ b/ui/accessibility/ax_role_properties.h
@@ -32,6 +32,9 @@ // Returns true if this node is a menu or related role. AX_EXPORT bool IsMenuRelated(ui::AXRole role); +// Returns true if this node is a edit field. +AX_EXPORT bool IsEditField(ui::AXRole role); + } // namespace ui #endif // UI_ACCESSIBILITY_AX_ROLE_PROPERTIES_H_
diff --git a/ui/accessibility/platform/ax_platform_node_base.cc b/ui/accessibility/platform/ax_platform_node_base.cc index 953172e..405375a 100644 --- a/ui/accessibility/platform/ax_platform_node_base.cc +++ b/ui/accessibility/platform/ax_platform_node_base.cc
@@ -7,6 +7,7 @@ #include "base/strings/utf_string_conversions.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/accessibility/ax_role_properties.h" #include "ui/accessibility/platform/ax_platform_node_delegate.h" #include "ui/gfx/geometry/rect_conversions.h" @@ -189,6 +190,22 @@ return GetData().GetString16Attribute(attribute, value); } +bool AXPlatformNodeBase::HasIntListAttribute( + ui::AXIntListAttribute attribute) const { + return GetData().HasIntListAttribute(attribute); +} + +const std::vector<int32_t>& AXPlatformNodeBase::GetIntListAttribute( + ui::AXIntListAttribute attribute) const { + return GetData().GetIntListAttribute(attribute); +} + +bool AXPlatformNodeBase::GetIntListAttribute( + ui::AXIntListAttribute attribute, + std::vector<int32_t>* value) const { + return GetData().GetIntListAttribute(attribute, value); +} + AXPlatformNodeBase::AXPlatformNodeBase() { } @@ -288,4 +305,125 @@ } } +AXPlatformNodeBase* AXPlatformNodeBase::GetTable() const { + AXPlatformNodeBase* table = const_cast<AXPlatformNodeBase*>(this); + while (table && !ui::IsTableLikeRole(table->GetData().role)) { + gfx::NativeViewAccessible parent_accessible = table->GetParent(); + AXPlatformNodeBase* parent = FromNativeViewAccessible(parent_accessible); + + table = parent; + } + return table; +} + +AXPlatformNodeBase* AXPlatformNodeBase::GetTableCell(int index) const { + DCHECK(delegate_); + + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return nullptr; + + AXPlatformNodeBase* table = GetTable(); + if (!table) + return nullptr; + const std::vector<int32_t>& unique_cell_ids = + table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); + if (index < 0 || index >= static_cast<int>(unique_cell_ids.size())) + return nullptr; + + return static_cast<AXPlatformNodeBase*>( + table->delegate_->GetFromNodeID(unique_cell_ids[index])); +} + +AXPlatformNodeBase* AXPlatformNodeBase::GetTableCell(int row, + int column) const { + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return nullptr; + + if (row < 0 || row >= GetTableRowCount() || column < 0 || + column >= GetTableColumnCount()) { + return nullptr; + } + + AXPlatformNodeBase* table = GetTable(); + if (!table) + return nullptr; + + // In contrast to unique cell IDs, these are duplicated whenever a cell spans + // multiple columns or rows. + const std::vector<int32_t>& cell_ids = + table->GetIntListAttribute(ui::AX_ATTR_CELL_IDS); + DCHECK_EQ(GetTableRowCount() * GetTableColumnCount(), + static_cast<int>(cell_ids.size())); + int position = row * GetTableColumnCount() + column; + if (position < 0 || position >= static_cast<int>(cell_ids.size())) + return nullptr; + + return static_cast<AXPlatformNodeBase*>( + table->delegate_->GetFromNodeID(cell_ids[position])); +} + +int AXPlatformNodeBase::GetTableCellIndex() const { + if (!ui::IsCellOrTableHeaderRole(GetData().role)) + return -1; + + AXPlatformNodeBase* table = GetTable(); + if (!table) + return -1; + + const std::vector<int32_t>& unique_cell_ids = + table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); + auto iter = + std::find(unique_cell_ids.begin(), unique_cell_ids.end(), GetData().id); + if (iter == unique_cell_ids.end()) + return -1; + + return std::distance(unique_cell_ids.begin(), iter); +} + +int AXPlatformNodeBase::GetTableColumn() const { + return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX); +} + +int AXPlatformNodeBase::GetTableColumnCount() const { + AXPlatformNodeBase* table = GetTable(); + if (!table) + return 0; + + return table->GetIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT); +} + +int AXPlatformNodeBase::GetTableColumnSpan() const { + if (!ui::IsCellOrTableHeaderRole(GetData().role)) + return 0; + + int column_span; + if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &column_span)) + return column_span; + return 1; +} + +int AXPlatformNodeBase::GetTableRow() const { + return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX); +} + +int AXPlatformNodeBase::GetTableRowCount() const { + AXPlatformNodeBase* table = GetTable(); + if (!table) + return 0; + + return table->GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT); +} + +int AXPlatformNodeBase::GetTableRowSpan() const { + if (!ui::IsCellOrTableHeaderRole(GetData().role)) + return 0; + + int row_span; + if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &row_span)) + return row_span; + return 1; +} + } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_base.h b/ui/accessibility/platform/ax_platform_node_base.h index 17f53c22..fa24c867 100644 --- a/ui/accessibility/platform/ax_platform_node_base.h +++ b/ui/accessibility/platform/ax_platform_node_base.h
@@ -62,7 +62,63 @@ base::string16 GetString16Attribute( ui::AXStringAttribute attribute) const; - AXPlatformNodeDelegate* delegate_; // Weak. Owns this. + bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; + const std::vector<int32_t>& GetIntListAttribute( + ui::AXIntListAttribute attribute) const; + + bool GetIntListAttribute(ui::AXIntListAttribute attribute, + std::vector<int32_t>* value) const; + + // Returns the table or ARIA grid if inside one. + AXPlatformNodeBase* GetTable() const; + + // If inside a table or ARIA grid, returns the cell found at the given index. + // Indices are in row major order and each cell is counted once regardless of + // its span. + AXPlatformNodeBase* GetTableCell(int index) const; + + // If inside a table or ARIA grid, returns the cell at the given row and + // column (0-based). Works correctly with cells that span multiple rows or + // columns. + AXPlatformNodeBase* GetTableCell(int row, int column) const; + + // If inside a table or ARIA grid, returns the zero-based index of the cell. + // Indices are in row major order and each cell is counted once regardless of + // its span. Returns -1 if the cell is not found or if not inside a table. + int GetTableCellIndex() const; + + // If inside a table or ARIA grid, returns the physical column number for the + // current cell. In contrast to logical columns, physical columns always start + // from 0 and have no gaps in their numbering. Logical columns can be set + // using aria-colindex. + int GetTableColumn() const; + + // If inside a table or ARIA grid, returns the number of physical columns, + // otherwise returns 0. + int GetTableColumnCount() const; + + // If inside a table or ARIA grid, returns the number of physical columns that + // this cell spans. If not a cell, returns 0. + int GetTableColumnSpan() const; + + // If inside a table or ARIA grid, returns the physical row number for the + // current cell. In contrast to logical rows, physical rows always start from + // 0 and have no gaps in their numbering. Logical rows can be set using + // aria-rowindex. + int GetTableRow() const; + + // If inside a table or ARIA grid, returns the number of physical rows, + // otherwise returns 0. + int GetTableRowCount() const; + + // If inside a table or ARIA grid, returns the number of physical rows that + // this cell spans. If not a cell, returns 0. + int GetTableRowSpan() const; + + // + // Delegate. This is a weak reference which owns |this|. + // + AXPlatformNodeDelegate* delegate_; protected: AXPlatformNodeBase();
diff --git a/ui/accessibility/platform/ax_platform_node_delegate.h b/ui/accessibility/platform/ax_platform_node_delegate.h index 9ef5a00..052eeb1 100644 --- a/ui/accessibility/platform/ax_platform_node_delegate.h +++ b/ui/accessibility/platform/ax_platform_node_delegate.h
@@ -73,6 +73,8 @@ // has focus. virtual gfx::NativeViewAccessible GetFocus() = 0; + virtual ui::AXPlatformNode* GetFromNodeID(int32_t id) = 0; + // // Events. //
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index 295a404..b597ccf 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -20,6 +20,7 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/accessibility/ax_role_properties.h" #include "ui/accessibility/ax_text_utils.h" #include "ui/accessibility/ax_tree_data.h" #include "ui/accessibility/platform/ax_platform_node_delegate.h" @@ -361,12 +362,6 @@ IAccessible* result = nullptr; switch (nav_dir) { - case NAVDIR_DOWN: - case NAVDIR_UP: - case NAVDIR_LEFT: - case NAVDIR_RIGHT: - // These directions are not implemented except in tables. - return E_NOTIMPL; case NAVDIR_FIRSTCHILD: if (delegate_->GetChildCount() > 0) @@ -391,6 +386,67 @@ result = previous->GetNativeViewAccessible(); break; } + + case NAVDIR_DOWN: { + // This direction is not implemented except in tables. + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return E_NOTIMPL; + + AXPlatformNodeBase* next = target->GetTableCell( + GetTableRow() + GetTableRowSpan(), GetTableColumn()); + if (!next) + return S_OK; + + result = next->GetNativeViewAccessible(); + break; + } + + case NAVDIR_UP: { + // This direction is not implemented except in tables. + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return E_NOTIMPL; + + AXPlatformNodeBase* next = + target->GetTableCell(GetTableRow() - 1, GetTableColumn()); + if (!next) + return S_OK; + + result = next->GetNativeViewAccessible(); + break; + } + + case NAVDIR_LEFT: { + // This direction is not implemented except in tables. + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return E_NOTIMPL; + + AXPlatformNodeBase* next = + target->GetTableCell(GetTableRow(), GetTableColumn() - 1); + if (!next) + return S_OK; + + result = next->GetNativeViewAccessible(); + break; + } + + case NAVDIR_RIGHT: { + // This direction is not implemented except in tables. + + if (!ui::IsTableLikeRole(GetData().role) && + !ui::IsCellOrTableHeaderRole(GetData().role)) + return E_NOTIMPL; + + AXPlatformNodeBase* next = target->GetTableCell( + GetTableRow(), GetTableColumn() + GetTableColumnSpan()); + if (!next) + return S_OK; + + result = next->GetNativeViewAccessible(); + break; + } } if (!result) @@ -741,21 +797,18 @@ STDMETHODIMP AXPlatformNodeWin::role(LONG* role) { COM_OBJECT_VALIDATE_1_ARG(role); - *role = MSAARole(); + + *role = IA2Role(); + // If we didn't explicitly set the IAccessible2 role, make it the same + // as the MSAA role. + if (!*role) + *role = MSAARole(); return S_OK; } STDMETHODIMP AXPlatformNodeWin::get_states(AccessibleStates* states) { COM_OBJECT_VALIDATE_1_ARG(states); - // There are only a couple of states we need to support - // in IAccessible2. If any more are added, we may want to - // add a helper function like MSAAState. - *states = IA2_STATE_OPAQUE; - if (GetData().state & (1 << ui::AX_STATE_EDITABLE)) - *states |= IA2_STATE_EDITABLE; - if (GetData().state & (1 << ui::AX_STATE_VERTICAL)) - *states |= IA2_STATE_VERTICAL; - + *states = IA2State(); return S_OK; } @@ -1189,6 +1242,13 @@ // Private member functions. // int AXPlatformNodeWin::MSAARole() { + // If this is a web area for a presentational iframe, give it a role of + // something other than DOCUMENT so that the fact that it's a separate doc + // is not exposed to AT. + if (IsWebAreaForPresentationalIframe()) { + return ROLE_SYSTEM_GROUPING; + } + switch (GetData().role) { case ui::AX_ROLE_ALERT: return ROLE_SYSTEM_ALERT; @@ -1367,6 +1427,9 @@ case ui::AX_ROLE_MENU_LIST_OPTION: return ROLE_SYSTEM_MENUITEM; + case ui::AX_ROLE_METER: + return ROLE_SYSTEM_PROGRESSBAR; + case ui::AX_ROLE_NAVIGATION: return ROLE_SYSTEM_GROUPING; @@ -1404,16 +1467,7 @@ case ui::AX_ROLE_ROW: { // Role changes depending on whether row is inside a treegrid // https://www.w3.org/TR/core-aam-1.1/#role-map-row - auto* container = FromNativeViewAccessible(GetParent()); - if (container && container->GetData().role == ui::AX_ROLE_GROUP) { - // If parent was a rowgroup, we need to look at the grandparent - container = FromNativeViewAccessible(container->GetParent()); - } - - if (!container) - return ROLE_SYSTEM_ROW; - - return ROLE_SYSTEM_OUTLINEITEM; + return IsInTreeGrid() ? ROLE_SYSTEM_OUTLINEITEM : ROLE_SYSTEM_ROW; } case ui::AX_ROLE_ROW_HEADER: @@ -1513,11 +1567,38 @@ case ui::AX_ROLE_WINDOW: return ROLE_SYSTEM_WINDOW; - // TODO(dmazzoni): figure out the proper MSAA role for roles not called out - // here. - default: + // TODO(dmazzoni): figure out the proper MSAA role for roles listed below. + case AX_ROLE_BLOCKQUOTE: + case AX_ROLE_BUTTON_DROP_DOWN: + case AX_ROLE_CARET: + case AX_ROLE_CLIENT: + case AX_ROLE_DEFINITION: + case AX_ROLE_DESKTOP: + case AX_ROLE_DIRECTORY: + case AX_ROLE_FIGCAPTION: + case AX_ROLE_FOOTER: + case AX_ROLE_FORM: + case AX_ROLE_IGNORED: + case AX_ROLE_IMAGE_MAP: + case AX_ROLE_INLINE_TEXT_BOX: + case AX_ROLE_LOCATION_BAR: + case AX_ROLE_LOG: + case AX_ROLE_NONE: + case AX_ROLE_PANE: + case AX_ROLE_PARAGRAPH: + case AX_ROLE_PRESENTATIONAL: + case AX_ROLE_SEAMLESS_WEB_AREA: + case AX_ROLE_SLIDER_THUMB: + case AX_ROLE_SWITCH: + case AX_ROLE_TAB_GROUP: + case AX_ROLE_TITLE_BAR: + case AX_ROLE_UNKNOWN: + case AX_ROLE_WEB_VIEW: return ROLE_SYSTEM_CLIENT; } + + NOTREACHED(); + return ROLE_SYSTEM_CLIENT; } std::string AXPlatformNodeWin::StringOverrideForMSAARole() { @@ -1564,6 +1645,225 @@ return ""; } +bool AXPlatformNodeWin::IsWebAreaForPresentationalIframe() { + if (GetData().role != ui::AX_ROLE_WEB_AREA && + GetData().role != ui::AX_ROLE_ROOT_WEB_AREA) { + return false; + } + + auto* parent = FromNativeViewAccessible(GetParent()); + if (!parent) + return false; + + return parent->GetData().role == ui::AX_ROLE_IFRAME_PRESENTATIONAL; +} + +int32_t AXPlatformNodeWin::IA2State() { + const AXNodeData& data = GetData(); + + int32_t ia2_state = IA2_STATE_OPAQUE; + + const auto checked_state = static_cast<ui::AXCheckedState>( + GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); + if (checked_state) { + ia2_state |= IA2_STATE_CHECKABLE; + } + + if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && + GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) + ia2_state |= IA2_STATE_INVALID_ENTRY; + if (data.HasState(ui::AX_STATE_REQUIRED)) + ia2_state |= IA2_STATE_REQUIRED; + if (data.HasState(ui::AX_STATE_VERTICAL)) + ia2_state |= IA2_STATE_VERTICAL; + if (data.HasState(ui::AX_STATE_HORIZONTAL)) + ia2_state |= IA2_STATE_HORIZONTAL; + + const bool is_editable = data.HasState(ui::AX_STATE_EDITABLE); + if (is_editable) + ia2_state |= IA2_STATE_EDITABLE; + + if (IsRichTextControl() || ui::IsEditField(data.role)) { + // Support multi/single line states if root editable or appropriate role. + // We support the edit box roles even if the area is not actually editable, + // because it is technically feasible for JS to implement the edit box + // by controlling selection. + if (data.HasState(ui::AX_STATE_MULTILINE)) { + ia2_state |= IA2_STATE_MULTI_LINE; + } else { + ia2_state |= IA2_STATE_SINGLE_LINE; + } + } + + if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) + ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; + + if (GetBoolAttribute(ui::AX_ATTR_MODAL)) + ia2_state |= IA2_STATE_MODAL; + + switch (data.role) { + case ui::AX_ROLE_MENU_LIST_POPUP: + ia2_state &= ~(IA2_STATE_EDITABLE); + break; + case ui::AX_ROLE_MENU_LIST_OPTION: + ia2_state &= ~(IA2_STATE_EDITABLE); + break; + case ui::AX_ROLE_SCROLL_AREA: + ia2_state &= ~(IA2_STATE_EDITABLE); + break; + case ui::AX_ROLE_TEXT_FIELD: + case ui::AX_ROLE_SEARCH_BOX: + if (data.HasState(ui::AX_STATE_MULTILINE)) { + ia2_state |= IA2_STATE_MULTI_LINE; + } else { + ia2_state |= IA2_STATE_SINGLE_LINE; + } + ia2_state |= IA2_STATE_SELECTABLE_TEXT; + break; + default: + break; + } + return ia2_state; +} + +// IA2Role() only returns a role if the MSAA role doesn't suffice, +// otherwise this method returns 0. See AXPlatformNodeWin::role(). +int32_t AXPlatformNodeWin::IA2Role() { + // If this is a web area for a presentational iframe, give it a role of + // something other than DOCUMENT so that the fact that it's a separate doc + // is not exposed to AT. + if (IsWebAreaForPresentationalIframe()) { + return ROLE_SYSTEM_GROUPING; + } + + int32_t ia2_role = 0; + + switch (GetData().role) { + case ui::AX_ROLE_BANNER: + ia2_role = IA2_ROLE_HEADER; + break; + case ui::AX_ROLE_BLOCKQUOTE: + ia2_role = IA2_ROLE_SECTION; + break; + case ui::AX_ROLE_CANVAS: + if (GetBoolAttribute(ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { + ia2_role = IA2_ROLE_CANVAS; + } + break; + case ui::AX_ROLE_CAPTION: + ia2_role = IA2_ROLE_CAPTION; + break; + case ui::AX_ROLE_COLOR_WELL: + ia2_role = IA2_ROLE_COLOR_CHOOSER; + break; + case ui::AX_ROLE_COMPLEMENTARY: + ia2_role = IA2_ROLE_NOTE; + break; + case ui::AX_ROLE_CONTENT_INFO: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_DATE: + case ui::AX_ROLE_DATE_TIME: + ia2_role = IA2_ROLE_DATE_EDITOR; + break; + case ui::AX_ROLE_DEFINITION: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_DESCRIPTION_LIST_DETAIL: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_EMBEDDED_OBJECT: + if (!delegate_->GetChildCount()) { + ia2_role = IA2_ROLE_EMBEDDED_OBJECT; + } + break; + case ui::AX_ROLE_FIGCAPTION: + ia2_role = IA2_ROLE_CAPTION; + break; + case ui::AX_ROLE_FORM: + ia2_role = IA2_ROLE_FORM; + break; + case ui::AX_ROLE_FOOTER: + ia2_role = IA2_ROLE_FOOTER; + break; + case ui::AX_ROLE_GENERIC_CONTAINER: + ia2_role = IA2_ROLE_SECTION; + break; + case ui::AX_ROLE_HEADING: + ia2_role = IA2_ROLE_HEADING; + break; + case ui::AX_ROLE_IFRAME: + ia2_role = IA2_ROLE_INTERNAL_FRAME; + break; + case ui::AX_ROLE_IMAGE_MAP: + ia2_role = IA2_ROLE_IMAGE_MAP; + break; + case ui::AX_ROLE_LABEL_TEXT: + case ui::AX_ROLE_LEGEND: + ia2_role = IA2_ROLE_LABEL; + break; + case ui::AX_ROLE_MAIN: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_MARK: + ia2_role = IA2_ROLE_TEXT_FRAME; + break; + case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: + ia2_role = IA2_ROLE_CHECK_MENU_ITEM; + break; + case ui::AX_ROLE_MENU_ITEM_RADIO: + ia2_role = IA2_ROLE_RADIO_MENU_ITEM; + break; + case ui::AX_ROLE_NAVIGATION: + ia2_role = IA2_ROLE_SECTION; + break; + case ui::AX_ROLE_NOTE: + ia2_role = IA2_ROLE_NOTE; + break; + case ui::AX_ROLE_PARAGRAPH: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_PRE: + ia2_role = IA2_ROLE_PARAGRAPH; + break; + case ui::AX_ROLE_REGION: { + base::string16 html_tag = GetString16Attribute(ui::AX_ATTR_HTML_TAG); + + if (html_tag == L"section") { + ia2_role = IA2_ROLE_SECTION; + } + } break; + case ui::AX_ROLE_RUBY: + ia2_role = IA2_ROLE_TEXT_FRAME; + break; + case ui::AX_ROLE_RULER: + ia2_role = IA2_ROLE_RULER; + break; + case ui::AX_ROLE_SCROLL_AREA: + ia2_role = IA2_ROLE_SCROLL_PANE; + break; + case ui::AX_ROLE_SEARCH: + ia2_role = IA2_ROLE_SECTION; + break; + case ui::AX_ROLE_SWITCH: + ia2_role = IA2_ROLE_TOGGLE_BUTTON; + break; + case ui::AX_ROLE_TABLE_HEADER_CONTAINER: + ia2_role = IA2_ROLE_SECTION; + break; + case ui::AX_ROLE_TOGGLE_BUTTON: + ia2_role = IA2_ROLE_TOGGLE_BUTTON; + break; + case ui::AX_ROLE_ABBR: + case ui::AX_ROLE_TIME: + ia2_role = IA2_ROLE_TEXT_FRAME; + break; + default: + break; + } + return ia2_role; +} + bool AXPlatformNodeWin::ShouldNodeHaveReadonlyState( const AXNodeData& data) const { if (data.GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) @@ -1891,4 +2191,17 @@ return static_cast<AXPlatformNodeWin*>(base); } +bool AXPlatformNodeWin::IsInTreeGrid() { + auto* container = FromNativeViewAccessible(GetParent()); + + // If parent was a rowgroup, we need to look at the grandparent + if (container && container->GetData().role == ui::AX_ROLE_GROUP) + container = FromNativeViewAccessible(container->GetParent()); + + if (!container) + return false; + + return container->GetData().role == ui::AX_ROLE_TREE_GRID; +} + } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_win.h b/ui/accessibility/platform/ax_platform_node_win.h index 3c9cf34a..2ca22ca 100644 --- a/ui/accessibility/platform/ax_platform_node_win.h +++ b/ui/accessibility/platform/ax_platform_node_win.h
@@ -268,16 +268,22 @@ protected: AXPlatformNodeWin(); + int MSAAState(); + int MSAARole(); + std::string StringOverrideForMSAARole(); + + int32_t IA2State(); + + int32_t IA2Role(); + // AXPlatformNodeBase overrides. void Dispose() override; private: - int MSAARole(); - std::string StringOverrideForMSAARole(); - int MSAAEvent(ui::AXEvent event); + bool IsWebAreaForPresentationalIframe(); bool ShouldNodeHaveReadonlyState(const AXNodeData& data) const; bool ShouldNodeHaveFocusableState(const AXNodeData& data) const; @@ -312,6 +318,9 @@ // returns a pointer to the target object if it exists, otherwise nullptr. // Does not return a new reference. AXPlatformNodeWin* GetTargetFromChildID(const VARIANT& var_id); + + // Returns true if this node is in a treegrid. + bool IsInTreeGrid(); }; } // namespace ui
diff --git a/ui/accessibility/platform/ax_system_caret_win.cc b/ui/accessibility/platform/ax_system_caret_win.cc index bd6b7e66..d09bc04 100644 --- a/ui/accessibility/platform/ax_system_caret_win.cc +++ b/ui/accessibility/platform/ax_system_caret_win.cc
@@ -108,6 +108,10 @@ return false; } +AXPlatformNode* AXSystemCaretWin::GetFromNodeID(int32_t id) { + return nullptr; +} + bool AXSystemCaretWin::ShouldIgnoreHoveredStateForTesting() { return false; }
diff --git a/ui/accessibility/platform/ax_system_caret_win.h b/ui/accessibility/platform/ax_system_caret_win.h index e4e2c25..ec093e4 100644 --- a/ui/accessibility/platform/ax_system_caret_win.h +++ b/ui/accessibility/platform/ax_system_caret_win.h
@@ -43,6 +43,7 @@ gfx::Rect GetScreenBoundsRect() const override; gfx::NativeViewAccessible HitTestSync(int x, int y) override; gfx::NativeViewAccessible GetFocus() override; + ui::AXPlatformNode* GetFromNodeID(int32_t id) override; gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; bool AccessibilityPerformAction(const ui::AXActionData& data) override; bool ShouldIgnoreHoveredStateForTesting() override;
diff --git a/ui/accessibility/platform/test_ax_node_wrapper.cc b/ui/accessibility/platform/test_ax_node_wrapper.cc index 18badaa..d1e33c7 100644 --- a/ui/accessibility/platform/test_ax_node_wrapper.cc +++ b/ui/accessibility/platform/test_ax_node_wrapper.cc
@@ -141,6 +141,10 @@ return nullptr; } +AXPlatformNode* TestAXNodeWrapper::GetFromNodeID(int32_t id) { + return nullptr; +} + gfx::AcceleratedWidget TestAXNodeWrapper::GetTargetForNativeAccessibilityEvent() { return gfx::kNullAcceleratedWidget;
diff --git a/ui/accessibility/platform/test_ax_node_wrapper.h b/ui/accessibility/platform/test_ax_node_wrapper.h index ca037f1..1e6da236 100644 --- a/ui/accessibility/platform/test_ax_node_wrapper.h +++ b/ui/accessibility/platform/test_ax_node_wrapper.h
@@ -38,6 +38,7 @@ gfx::Rect GetScreenBoundsRect() const override; gfx::NativeViewAccessible HitTestSync(int x, int y) override; gfx::NativeViewAccessible GetFocus() override; + ui::AXPlatformNode* GetFromNodeID(int32_t id) override; gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; bool AccessibilityPerformAction(const ui::AXActionData& data) override; bool ShouldIgnoreHoveredStateForTesting() override;
diff --git a/ui/android/DEPS b/ui/android/DEPS index f03b9a5..5174f43 100644 --- a/ui/android/DEPS +++ b/ui/android/DEPS
@@ -7,6 +7,7 @@ "+cc/test/stub_layer_tree_host_client.h", "+cc/test/test_task_graph_runner.h", "+cc/trees/layer_tree_host.h", + "+components/viz/common", "+jni", "+skia/ext", "+third_party/skia",
diff --git a/ui/android/delegated_frame_host_android.cc b/ui/android/delegated_frame_host_android.cc index 1423adb2..72fc026b 100644 --- a/ui/android/delegated_frame_host_android.cc +++ b/ui/android/delegated_frame_host_android.cc
@@ -13,7 +13,7 @@ #include "cc/output/copy_output_result.h" #include "cc/surfaces/frame_sink_manager.h" #include "cc/surfaces/surface.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "ui/android/view_android.h" #include "ui/android/window_android_compositor.h" #include "ui/display/display.h" @@ -53,7 +53,7 @@ ui::ViewAndroid* view, cc::FrameSinkManager* frame_sink_manager, Client* client, - const cc::FrameSinkId& frame_sink_id) + const viz::FrameSinkId& frame_sink_id) : frame_sink_id_(frame_sink_id), view_(view), frame_sink_manager_(frame_sink_manager), @@ -74,7 +74,7 @@ } void DelegatedFrameHostAndroid::SubmitCompositorFrame( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { if (local_surface_id != surface_info_.id().local_surface_id()) { DestroyDelegatedContent(); @@ -83,7 +83,7 @@ cc::RenderPass* root_pass = frame.render_pass_list.back().get(); gfx::Size frame_size = root_pass->output_rect.size(); surface_info_ = cc::SurfaceInfo( - cc::SurfaceId(frame_sink_id_, local_surface_id), 1.f, frame_size); + viz::SurfaceId(frame_sink_id_, local_surface_id), 1.f, frame_size); has_transparent_background_ = root_pass->has_transparent_background; bool result = @@ -104,7 +104,7 @@ support_->DidNotProduceFrame(ack); } -cc::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const { +viz::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const { return frame_sink_id_; } @@ -187,7 +187,7 @@ } void DelegatedFrameHostAndroid::WillDrawSurface( - const cc::LocalSurfaceId& local_surface_id, + const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} void DelegatedFrameHostAndroid::OnNeedsBeginFrames(bool needs_begin_frames) { @@ -204,7 +204,7 @@ handles_frame_sink_id_invalidation, needs_sync_points); } -cc::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { +viz::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { return surface_info_.id(); }
diff --git a/ui/android/delegated_frame_host_android.h b/ui/android/delegated_frame_host_android.h index 8ddc3e8..18a0201c 100644 --- a/ui/android/delegated_frame_host_android.h +++ b/ui/android/delegated_frame_host_android.h
@@ -42,11 +42,11 @@ DelegatedFrameHostAndroid(ViewAndroid* view, cc::FrameSinkManager* frame_sink_manager, Client* client, - const cc::FrameSinkId& frame_sink_id); + const viz::FrameSinkId& frame_sink_id); ~DelegatedFrameHostAndroid() override; - void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, + void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame); void DidNotProduceFrame(const cc::BeginFrameAck& ack); @@ -54,7 +54,7 @@ bool HasDelegatedContent() const; - cc::FrameSinkId GetFrameSinkId() const; + viz::FrameSinkId GetFrameSinkId() const; // Should only be called when the host has a content layer. void RequestCopyOfSurface( @@ -70,7 +70,7 @@ void DetachFromCompositor(); // Returns the ID for the current Surface. - cc::SurfaceId SurfaceId() const; + viz::SurfaceId SurfaceId() const; private: // cc::CompositorFrameSinkSupportClient implementation. @@ -79,7 +79,7 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override; // cc::ExternalBeginFrameSourceClient implementation. @@ -87,7 +87,7 @@ void CreateNewCompositorFrameSinkSupport(); - const cc::FrameSinkId frame_sink_id_; + const viz::FrameSinkId frame_sink_id_; ViewAndroid* view_;
diff --git a/ui/android/display_android_manager.cc b/ui/android/display_android_manager.cc index 936e2541d..6c68b47 100644 --- a/ui/android/display_android_manager.cc +++ b/ui/android/display_android_manager.cc
@@ -94,7 +94,7 @@ display.set_device_scale_factor(dipScale); // TODO(ccameron): Know the ideal color profile to use here. // https://crbug.com/735658 - if (!gfx::ICCProfile::HasForcedProfile()) + if (!Display::HasForceColorProfile()) display.set_color_space(gfx::ColorSpace::CreateSRGB()); display.set_size_in_pixels(bounds_in_pixels.size());
diff --git a/ui/android/window_android_compositor.h b/ui/android/window_android_compositor.h index 12cc1dd..3d0205f 100644 --- a/ui/android/window_android_compositor.h +++ b/ui/android/window_android_compositor.h
@@ -8,7 +8,7 @@ #include <memory> #include "cc/output/copy_output_request.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "ui/android/ui_android_export.h" namespace cc { @@ -29,9 +29,9 @@ std::unique_ptr<cc::CopyOutputRequest> request) = 0; virtual void SetNeedsAnimate() = 0; virtual ResourceManager& GetResourceManager() = 0; - virtual cc::FrameSinkId GetFrameSinkId() = 0; - virtual void AddChildFrameSink(const cc::FrameSinkId& frame_sink_id) = 0; - virtual void RemoveChildFrameSink(const cc::FrameSinkId& frame_sink_id) = 0; + virtual viz::FrameSinkId GetFrameSinkId() = 0; + virtual void AddChildFrameSink(const viz::FrameSinkId& frame_sink_id) = 0; + virtual void RemoveChildFrameSink(const viz::FrameSinkId& frame_sink_id) = 0; }; } // namespace ui
diff --git a/ui/app_list/app_list_features.cc b/ui/app_list/app_list_features.cc index 55973ae..8efda32 100644 --- a/ui/app_list/app_list_features.cc +++ b/ui/app_list/app_list_features.cc
@@ -64,5 +64,10 @@ return base::GetFieldTrialParamValueByFeature(kEnableAnswerCard, "ServerUrl"); } +std::string AnswerServerQuerySuffix() { + return base::GetFieldTrialParamValueByFeature(kEnableAnswerCard, + "QuerySuffix"); +} + } // namespace features } // namespace app_list
diff --git a/ui/app_list/app_list_features.h b/ui/app_list/app_list_features.h index 245fe68..8be6a67 100644 --- a/ui/app_list/app_list_features.h +++ b/ui/app_list/app_list_features.h
@@ -36,6 +36,7 @@ int APP_LIST_EXPORT AnswerCardMaxWidth(); int APP_LIST_EXPORT AnswerCardMaxHeight(); std::string APP_LIST_EXPORT AnswerServerUrl(); +std::string APP_LIST_EXPORT AnswerServerQuerySuffix(); } // namespace features } // namespace app_list
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc index 48a26d96..c73cf31 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc
@@ -199,6 +199,7 @@ search_box_widget_(nullptr), search_box_view_(nullptr), is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()), + processing_scroll_event_series_(false), app_list_state_(PEEKING), display_observer_(this), overlay_view_(nullptr), @@ -495,6 +496,25 @@ overlay_view_->SetBoundsRect(GetContentsBounds()); } +void AppListView::HandleClickOrTap() { + switch (app_list_state_) { + case HALF: + case FULLSCREEN_SEARCH: + search_box_view_->ClearSearch(); + SetState(app_list_state_ == HALF ? PEEKING : FULLSCREEN_ALL_APPS); + break; + case PEEKING: + case FULLSCREEN_ALL_APPS: + if (search_box_view_->is_search_box_active()) + search_box_view_->ClearSearch(); + else + SetState(CLOSED); + break; + case CLOSED: + break; + } +} + void AppListView::StartDrag(const gfx::Point& location) { initial_drag_point_ = location; } @@ -516,6 +536,9 @@ } void AppListView::EndDrag(const gfx::Point& location) { + // When the SearchBoxView closes the app list, ignore the final event. + if (app_list_state_ == CLOSED) + return; // Change the app list state based on where the drag ended. If fling velocity // was over the threshold, snap to the next state in the direction of the // fling. @@ -703,16 +726,8 @@ switch (event->type()) { case ui::ET_MOUSE_PRESSED: - StartDrag(event->location()); event->SetHandled(); - break; - case ui::ET_MOUSE_DRAGGED: - UpdateDrag(event->location()); - event->SetHandled(); - break; - case ui::ET_MOUSE_RELEASED: - EndDrag(event->location()); - event->SetHandled(); + HandleClickOrTap(); break; default: break; @@ -724,17 +739,28 @@ return; switch (event->type()) { + case ui::ET_GESTURE_TAP: + processing_scroll_event_series_ = false; + event->SetHandled(); + HandleClickOrTap(); + break; case ui::ET_SCROLL_FLING_START: case ui::ET_GESTURE_SCROLL_BEGIN: + processing_scroll_event_series_ = true; StartDrag(event->location()); event->SetHandled(); break; case ui::ET_GESTURE_SCROLL_UPDATE: + processing_scroll_event_series_ = true; last_fling_velocity_ = event->details().scroll_y(); UpdateDrag(event->location()); event->SetHandled(); break; case ui::ET_GESTURE_END: + if (!processing_scroll_event_series_) + break; + + processing_scroll_event_series_ = false; EndDrag(event->location()); event->SetHandled(); break; @@ -810,8 +836,8 @@ gfx::Rect new_widget_bounds = fullscreen_widget_->GetWindowBoundsInScreen(); int display_height = display::Screen::GetScreen() ->GetDisplayNearestView(parent_window()) - .work_area() - .bottom(); + .size() + .height(); switch (new_state_override) { case PEEKING: {
diff --git a/ui/app_list/views/app_list_view.h b/ui/app_list/views/app_list_view.h index 2cf5740..5b7bf2b 100644 --- a/ui/app_list/views/app_list_view.h +++ b/ui/app_list/views/app_list_view.h
@@ -96,6 +96,8 @@ views::Widget* search_box_widget() const { return search_box_widget_; } + SearchBoxView* search_box_view() { return search_box_view_; } + // Overridden from views::View: gfx::Size CalculatePreferredSize() const override; void OnPaint(gfx::Canvas* canvas) override; @@ -147,6 +149,10 @@ // Initializes the widget as a bubble. void InitializeBubble(gfx::NativeView parent, int initial_apps_page); + // Closes the AppListView when a click or tap event propogates to the + // AppListView. + void HandleClickOrTap(); + // Initializes |initial_drag_point_|. void StartDrag(const gfx::Point& location); @@ -207,14 +213,16 @@ float last_fling_velocity_ = 0; // Whether the fullscreen app list feature is enabled. const bool is_fullscreen_app_list_enabled_; + // Whether a series of scroll events are being processed. + bool processing_scroll_event_series_; // The state of the app list, controlled via SetState(). AppListState app_list_state_; // An observer that notifies AppListView when the display has changed. ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; - // A semi-transparent white overlay that covers the app list while dialogs are - // open. + // A semi-transparent white overlay that covers the app list while dialogs + // are open. views::View* overlay_view_; std::unique_ptr<HideViewAnimationObserver> animation_observer_;
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc index 45f30f1..f7af677 100644 --- a/ui/app_list/views/search_box_view.cc +++ b/ui/app_list/views/search_box_view.cc
@@ -68,6 +68,10 @@ constexpr int kLightVibrantBlendAlpha = 0xB3; +// Color of placeholder text in zero query state. +constexpr SkColor kZeroQuerySearchboxColor = + SkColorSetARGBMacro(0x8A, 0x00, 0x00, 0x00); + // A background that paints a solid white rounded rect with a thin grey border. class SearchBoxBackground : public views::Background { public: @@ -201,6 +205,7 @@ gfx::Canvas::TEXT_ALIGN_CENTER); search_box_->SetFontList(search_box_->GetFontList().DeriveWithSizeDelta(2)); back_button_->SetVisible(false); + search_box_->SetCursorEnabled(is_search_box_active_); } else { search_box_->set_placeholder_text_color(kHintTextColor); } @@ -239,6 +244,8 @@ // does not generate ContentsChanged() notification. UpdateModel(); NotifyQueryChanged(); + if (is_fullscreen_app_list_enabled_) + SetSearchBoxActive(false); } void SearchBoxView::SetShadow(const gfx::ShadowValue& shadow) { @@ -276,20 +283,23 @@ case FOCUS_SEARCH_BOX: if (move_backwards) { focused_view_ = back_button_ && back_button_->visible() - ? FOCUS_BACK_BUTTON : FOCUS_SEARCH_BOX; + ? FOCUS_BACK_BUTTON + : FOCUS_SEARCH_BOX; } else { focused_view_ = speech_button_ && speech_button_->visible() - ? FOCUS_MIC_BUTTON : FOCUS_CONTENTS_VIEW; + ? FOCUS_MIC_BUTTON + : FOCUS_CONTENTS_VIEW; } break; case FOCUS_MIC_BUTTON: focused_view_ = move_backwards ? FOCUS_SEARCH_BOX : FOCUS_CONTENTS_VIEW; break; case FOCUS_CONTENTS_VIEW: - focused_view_ = move_backwards - ? (speech_button_ && speech_button_->visible() ? - FOCUS_MIC_BUTTON : FOCUS_SEARCH_BOX) - : FOCUS_CONTENTS_VIEW; + focused_view_ = + move_backwards + ? (speech_button_ && speech_button_->visible() ? FOCUS_MIC_BUTTON + : FOCUS_SEARCH_BOX) + : FOCUS_CONTENTS_VIEW; break; default: DCHECK(false); @@ -351,6 +361,54 @@ content_container_->Layout(); } +void SearchBoxView::SetSearchBoxActive(bool active) { + if (!is_fullscreen_app_list_enabled_) + return; + + if (active == is_search_box_active_) + return; + + is_search_box_active_ = active; + search_box_->set_placeholder_text_draw_flags( + active ? gfx::Canvas::TEXT_ALIGN_LEFT : gfx::Canvas::TEXT_ALIGN_CENTER); + search_box_->set_placeholder_text_color(active ? kZeroQuerySearchboxColor + : kDefaultSearchboxColor); + search_box_->SetCursorEnabled(active); + search_box_->SchedulePaint(); +} + +void SearchBoxView::HandleSearchBoxEvent(ui::LocatedEvent* located_event) { + if (!is_fullscreen_app_list_enabled_) + return; + + if (located_event->type() != ui::ET_MOUSE_PRESSED && + located_event->type() != ui::ET_GESTURE_TAP) + return; + + bool event_is_in_searchbox_bounds = + GetWidget()->GetWindowBoundsInScreen().Contains( + located_event->root_location()); + + if (!is_search_box_active_ && event_is_in_searchbox_bounds && + search_box_->text().empty()) { + // If the event was within the searchbox bounds and in an inactive empty + // search box, enable the search box. + SetSearchBoxActive(true); + located_event->SetHandled(); + } +} + +bool SearchBoxView::OnTextfieldEvent() { + if (!is_fullscreen_app_list_enabled_) + return false; + + if (is_search_box_active_) + return false; + + SetSearchBoxActive(true); + return true; +} + bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) { if (contents_view_) return contents_view_->OnMouseWheel(event); @@ -368,6 +426,14 @@ return "SearchBoxView"; } +void SearchBoxView::OnGestureEvent(ui::GestureEvent* event) { + HandleSearchBoxEvent(event); +} + +void SearchBoxView::OnMouseEvent(ui::MouseEvent* event) { + HandleSearchBoxEvent(event); +} + void SearchBoxView::UpdateModel() { // Temporarily remove from observer to ignore notifications caused by us. model_->search_box()->RemoveObserver(this); @@ -386,8 +452,11 @@ UpdateModel(); view_delegate_->AutoLaunchCanceled(); NotifyQueryChanged(); - if (is_fullscreen_app_list_enabled_) + if (is_fullscreen_app_list_enabled_) { + if (is_search_box_active_ == search_box_->text().empty()) + SetSearchBoxActive(!search_box_->text().empty()); app_list_view_->SetStateFromSearchBoxView(search_box_->text().empty()); + } } bool SearchBoxView::HandleKeyEvent(views::Textfield* sender, @@ -441,6 +510,16 @@ return false; } +bool SearchBoxView::HandleMouseEvent(views::Textfield* sender, + const ui::MouseEvent& mouse_event) { + return OnTextfieldEvent(); +} + +bool SearchBoxView::HandleGestureEvent(views::Textfield* sender, + const ui::GestureEvent& gesture_event) { + return OnTextfieldEvent(); +} + void SearchBoxView::ButtonPressed(views::Button* sender, const ui::Event& event) { if (back_button_ && sender == back_button_)
diff --git a/ui/app_list/views/search_box_view.h b/ui/app_list/views/search_box_view.h index a8e8486..d48a58a 100644 --- a/ui/app_list/views/search_box_view.h +++ b/ui/app_list/views/search_box_view.h
@@ -72,6 +72,9 @@ contents_view_ = contents_view; } + // Whether the search box is active. + bool is_search_box_active() const { return is_search_box_active_; } + // Moves focus forward/backwards in response to TAB. bool MoveTabFocus(bool move_backwards); @@ -84,10 +87,25 @@ // Swaps the google icon with the back button. void ShowBackOrGoogleIcon(bool show_back_button); + // Setting the search box active left aligns the placeholder text, changes + // the color of the placeholder text, and enables cursor blink. Setting the + // search box inactive center aligns the placeholder text, sets the color, and + // disables cursor blink. + void SetSearchBoxActive(bool active); + + // Detects |ET_MOUSE_PRESSED| and |ET_GESTURE_TAP| events on the white + // background of the search box. + void HandleSearchBoxEvent(ui::LocatedEvent* located_event); + + // Handles Gesture and Mouse Events sent from |search_box_|. + bool OnTextfieldEvent(); + // Overridden from views::View: bool OnMouseWheel(const ui::MouseWheelEvent& event) override; void OnEnabledChanged() override; const char* GetClassName() const override; + void OnGestureEvent(ui::GestureEvent* event) override; + void OnMouseEvent(ui::MouseEvent* event) override; private: // Updates model text and selection model with current Textfield info. @@ -101,6 +119,10 @@ const base::string16& new_contents) override; bool HandleKeyEvent(views::Textfield* sender, const ui::KeyEvent& key_event) override; + bool HandleMouseEvent(views::Textfield* sender, + const ui::MouseEvent& mouse_event) override; + bool HandleGestureEvent(views::Textfield* sender, + const ui::GestureEvent& gesture_event) override; // Overridden from views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override; @@ -116,22 +138,24 @@ void OnSpeechRecognitionStateChanged( SpeechRecognitionState new_state) override; - SearchBoxViewDelegate* delegate_; // Not owned. + SearchBoxViewDelegate* delegate_; // Not owned. AppListViewDelegate* view_delegate_; // Not owned. - AppListModel* model_; // Owned by the profile-keyed service. + AppListModel* model_; // Owned by the profile-keyed service. - views::View* content_container_; // Owned by views hierarchy. - views::ImageView* google_icon_; // Owned by views hierarchy. - SearchBoxImageButton* back_button_; // Owned by views hierarchy. - SearchBoxImageButton* speech_button_; // Owned by views hierarchy. - views::Textfield* search_box_; // Owned by views hierarchy. - views::View* contents_view_; // Owned by views hierarchy. + views::View* content_container_; // Owned by views hierarchy. + views::ImageView* google_icon_; // Owned by views hierarchy. + SearchBoxImageButton* back_button_; // Owned by views hierarchy. + SearchBoxImageButton* speech_button_; // Owned by views hierarchy. + views::Textfield* search_box_; // Owned by views hierarchy. + views::View* contents_view_; // Owned by views hierarchy. app_list::AppListView* app_list_view_; // Owned by views hierarchy. SearchBoxFocus focused_view_; // Which element has TAB'd focus. // Whether the fullscreen app list feature is enabled. const bool is_fullscreen_app_list_enabled_; + // Whether the search box is active. + bool is_search_box_active_ = false; DISALLOW_COPY_AND_ASSIGN(SearchBoxView); };
diff --git a/ui/app_list/views/search_result_page_view.h b/ui/app_list/views/search_result_page_view.h index b26a30e4..66d3e4b 100644 --- a/ui/app_list/views/search_result_page_view.h +++ b/ui/app_list/views/search_result_page_view.h
@@ -53,6 +53,8 @@ // Overridden from SearchResultContainerView::Delegate : void OnSearchResultContainerResultsChanged() override; + views::View* contents_view() { return contents_view_; } + private: // |directional_movement| is true if the navigation was caused by directional // controls (eg, arrow keys), as opposed to linear controls (eg, Tab).
diff --git a/ui/aura/DEPS b/ui/aura/DEPS index d330b932..865926c 100644 --- a/ui/aura/DEPS +++ b/ui/aura/DEPS
@@ -2,6 +2,7 @@ "+cc/base", "+cc/output", "+cc/surfaces", + "+components/viz/common", "+mojo/common", "+mojo/public/cpp/bindings", "+net/base/filename_util.h",
diff --git a/ui/aura/local/layer_tree_frame_sink_local.cc b/ui/aura/local/layer_tree_frame_sink_local.cc index 196a7c4..295ae609b 100644 --- a/ui/aura/local/layer_tree_frame_sink_local.cc +++ b/ui/aura/local/layer_tree_frame_sink_local.cc
@@ -16,7 +16,7 @@ namespace aura { LayerTreeFrameSinkLocal::LayerTreeFrameSinkLocal( - const cc::FrameSinkId& frame_sink_id, + const viz::FrameSinkId& frame_sink_id, cc::FrameSinkManager* frame_sink_manager) : cc::LayerTreeFrameSink(nullptr, nullptr, nullptr, nullptr), frame_sink_id_(frame_sink_id), @@ -64,7 +64,7 @@ DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, frame.metadata.begin_frame_ack.sequence_number); - cc::LocalSurfaceId old_local_surface_id = local_surface_id_; + viz::LocalSurfaceId old_local_surface_id = local_surface_id_; const auto& frame_size = frame.render_pass_list.back()->output_rect.size(); if (frame_size != surface_size_ || frame.metadata.device_scale_factor != device_scale_factor_ || @@ -79,7 +79,7 @@ if (local_surface_id_ != old_local_surface_id) { surface_changed_callback_.Run( - cc::SurfaceId(frame_sink_id_, local_surface_id_), surface_size_); + viz::SurfaceId(frame_sink_id_, local_surface_id_), surface_size_); } }
diff --git a/ui/aura/local/layer_tree_frame_sink_local.h b/ui/aura/local/layer_tree_frame_sink_local.h index 7f8beaa..72daddc 100644 --- a/ui/aura/local/layer_tree_frame_sink_local.h +++ b/ui/aura/local/layer_tree_frame_sink_local.h
@@ -10,8 +10,8 @@ #include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/frame_sink_id.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/frame_sink_id.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "ui/aura/window_port.h" #include "ui/base/property_data.h" @@ -30,12 +30,12 @@ public cc::CompositorFrameSinkSupportClient, public cc::ExternalBeginFrameSourceClient { public: - LayerTreeFrameSinkLocal(const cc::FrameSinkId& frame_sink_id, + LayerTreeFrameSinkLocal(const viz::FrameSinkId& frame_sink_id, cc::FrameSinkManager* frame_sink_manager); ~LayerTreeFrameSinkLocal() override; using SurfaceChangedCallback = - base::Callback<void(const cc::SurfaceId&, const gfx::Size&)>; + base::Callback<void(const viz::SurfaceId&, const gfx::Size&)>; // Set a callback which will be called when the surface is changed. void SetSurfaceChangedCallback(const SurfaceChangedCallback& callback); @@ -51,20 +51,20 @@ void OnBeginFrame(const cc::BeginFrameArgs& args) override; void ReclaimResources( const std::vector<cc::ReturnedResource>& resources) override; - void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, + void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) override {} // cc::ExternalBeginFrameSourceClient: void OnNeedsBeginFrames(bool needs_begin_frames) override; private: - const cc::FrameSinkId frame_sink_id_; + const viz::FrameSinkId frame_sink_id_; cc::FrameSinkManager* const frame_sink_manager_; std::unique_ptr<cc::CompositorFrameSinkSupport> support_; gfx::Size surface_size_; float device_scale_factor_ = 0; - cc::LocalSurfaceIdAllocator id_allocator_; - cc::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceIdAllocator id_allocator_; + viz::LocalSurfaceId local_surface_id_; std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; std::unique_ptr<base::ThreadChecker> thread_checker_; SurfaceChangedCallback surface_changed_callback_;
diff --git a/ui/aura/local/window_port_local.cc b/ui/aura/local/window_port_local.cc index c2b2ad2..be1c207 100644 --- a/ui/aura/local/window_port_local.cc +++ b/ui/aura/local/window_port_local.cc
@@ -111,8 +111,8 @@ return std::move(frame_sink); } -cc::SurfaceId WindowPortLocal::GetSurfaceId() const { - return cc::SurfaceId(frame_sink_id_, local_surface_id_); +viz::SurfaceId WindowPortLocal::GetSurfaceId() const { + return viz::SurfaceId(frame_sink_id_, local_surface_id_); } void WindowPortLocal::OnWindowAddedToRootWindow() { @@ -125,7 +125,7 @@ window_->layer()->GetCompositor()->RemoveFrameSink(frame_sink_id_); } -void WindowPortLocal::OnSurfaceChanged(const cc::SurfaceId& surface_id, +void WindowPortLocal::OnSurfaceChanged(const viz::SurfaceId& surface_id, const gfx::Size& surface_size) { DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_); local_surface_id_ = surface_id.local_surface_id();
diff --git a/ui/aura/local/window_port_local.h b/ui/aura/local/window_port_local.h index 4bcc934..5299af6 100644 --- a/ui/aura/local/window_port_local.h +++ b/ui/aura/local/window_port_local.h
@@ -7,7 +7,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "ui/aura/window_port.h" #include "ui/base/property_data.h" @@ -42,17 +42,17 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; - cc::SurfaceId GetSurfaceId() const override; + viz::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override; void OnWillRemoveWindowFromRootWindow() override; private: - void OnSurfaceChanged(const cc::SurfaceId& surface_id, + void OnSurfaceChanged(const viz::SurfaceId& surface_id, const gfx::Size& surface_size); Window* const window_; - cc::FrameSinkId frame_sink_id_; - cc::LocalSurfaceId local_surface_id_; + viz::FrameSinkId frame_sink_id_; + viz::LocalSurfaceId local_surface_id_; base::WeakPtrFactory<WindowPortLocal> weak_factory_;
diff --git a/ui/aura/mus/in_flight_change.cc b/ui/aura/mus/in_flight_change.cc index 9b7e2987..da96bd4 100644 --- a/ui/aura/mus/in_flight_change.cc +++ b/ui/aura/mus/in_flight_change.cc
@@ -35,7 +35,7 @@ WindowTreeClient* window_tree_client, WindowMus* window, const gfx::Rect& revert_bounds, - const base::Optional<cc::LocalSurfaceId>& revert_local_surface_id) + const base::Optional<viz::LocalSurfaceId>& revert_local_surface_id) : InFlightChange(window, ChangeType::BOUNDS), window_tree_client_(window_tree_client), revert_bounds_(revert_bounds),
diff --git a/ui/aura/mus/in_flight_change.h b/ui/aura/mus/in_flight_change.h index a4b7887..3c4f28e 100644 --- a/ui/aura/mus/in_flight_change.h +++ b/ui/aura/mus/in_flight_change.h
@@ -14,7 +14,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/optional.h" -#include "cc/surfaces/local_surface_id.h" +#include "components/viz/common/local_surface_id.h" #include "ui/aura/window_observer.h" #include "ui/base/cursor/cursor_data.h" #include "ui/base/ui_base_types.h" @@ -148,7 +148,7 @@ WindowTreeClient* window_tree_client, WindowMus* window, const gfx::Rect& revert_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); ~InFlightBoundsChange() override; // InFlightChange: @@ -158,7 +158,7 @@ private: WindowTreeClient* window_tree_client_; gfx::Rect revert_bounds_; - base::Optional<cc::LocalSurfaceId> revert_local_surface_id_; + base::Optional<viz::LocalSurfaceId> revert_local_surface_id_; DISALLOW_COPY_AND_ASSIGN(InFlightBoundsChange); };
diff --git a/ui/aura/mus/window_mus.h b/ui/aura/mus/window_mus.h index 329f71b..5d5d7aa5 100644 --- a/ui/aura/mus/window_mus.h +++ b/ui/aura/mus/window_mus.h
@@ -79,7 +79,7 @@ ui::mojom::OrderDirection) = 0; virtual void SetBoundsFromServer( const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) = 0; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) = 0; virtual void SetTransformFromServer(const gfx::Transform& transform) = 0; virtual void SetVisibleFromServer(bool visible) = 0; virtual void SetOpacityFromServer(float opacity) = 0; @@ -87,8 +87,8 @@ virtual void SetPropertyFromServer(const std::string& property_name, const std::vector<uint8_t>* data) = 0; virtual void SetFrameSinkIdFromServer( - const cc::FrameSinkId& frame_sink_id) = 0; - virtual const cc::LocalSurfaceId& GetOrAllocateLocalSurfaceId( + const viz::FrameSinkId& frame_sink_id) = 0; + virtual const viz::LocalSurfaceId& GetOrAllocateLocalSurfaceId( const gfx::Size& new_size) = 0; virtual void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) = 0; // The window was deleted on the server side. DestroyFromServer() should @@ -100,10 +100,10 @@ virtual ChangeSource OnTransientChildAdded(WindowMus* child) = 0; virtual ChangeSource OnTransientChildRemoved(WindowMus* child) = 0; - // Returns the currently used cc::LocalSurfaceId to embed this Window. Local + // Returns the currently used viz::LocalSurfaceId to embed this Window. Local // windows or windows that have not been embedded yet will have an invalid - // cc::LocalSurfaceId. - virtual const cc::LocalSurfaceId& GetLocalSurfaceId() = 0; + // viz::LocalSurfaceId. + virtual const viz::LocalSurfaceId& GetLocalSurfaceId() = 0; // Called in the rare case when WindowTreeClient needs to change state and // can't go through one of the SetFooFromServer() functions above. Generally
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc index 579cff8b..d654cfe 100644 --- a/ui/aura/mus/window_port_mus.cc +++ b/ui/aura/mus/window_port_mus.cc
@@ -238,7 +238,7 @@ void WindowPortMus::SetBoundsFromServer( const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { ServerChangeData data; data.bounds_in_dip = bounds; ScopedServerChange change(this, ServerChangeType::BOUNDS, data); @@ -248,7 +248,7 @@ if (local_surface_id) local_surface_id_ = *local_surface_id; else - local_surface_id_ = cc::LocalSurfaceId(); + local_surface_id_ = viz::LocalSurfaceId(); window_->SetBounds(bounds); } @@ -290,14 +290,14 @@ } void WindowPortMus::SetFrameSinkIdFromServer( - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { DCHECK(window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || window_mus_type() == WindowMusType::EMBED_IN_OWNER); frame_sink_id_ = frame_sink_id; UpdatePrimarySurfaceInfo(); } -const cc::LocalSurfaceId& WindowPortMus::GetOrAllocateLocalSurfaceId( +const viz::LocalSurfaceId& WindowPortMus::GetOrAllocateLocalSurfaceId( const gfx::Size& surface_size_in_pixels) { if (last_surface_size_in_pixels_ == surface_size_in_pixels && local_surface_id_.is_valid()) { @@ -392,7 +392,7 @@ : ChangeSource::LOCAL; } -const cc::LocalSurfaceId& WindowPortMus::GetLocalSurfaceId() { +const viz::LocalSurfaceId& WindowPortMus::GetLocalSurfaceId() { return local_surface_id_; } @@ -549,9 +549,9 @@ return std::move(frame_sink); } -cc::SurfaceId WindowPortMus::GetSurfaceId() const { +viz::SurfaceId WindowPortMus::GetSurfaceId() const { // This is only used by WindowPortLocal in unit tests. - return cc::SurfaceId(); + return viz::SurfaceId(); } void WindowPortMus::UpdatePrimarySurfaceInfo() { @@ -566,7 +566,7 @@ return; primary_surface_info_ = cc::SurfaceInfo( - cc::SurfaceId(frame_sink_id_, local_surface_id_), + viz::SurfaceId(frame_sink_id_, local_surface_id_), ScaleFactorForDisplay(window_), last_surface_size_in_pixels_); UpdateClientSurfaceEmbedder(); if (window_->delegate())
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h index 57500d95b..8710483 100644 --- a/ui/aura/mus/window_port_mus.h +++ b/ui/aura/mus/window_port_mus.h
@@ -225,7 +225,7 @@ ui::mojom::OrderDirection) override; void SetBoundsFromServer( const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void SetTransformFromServer(const gfx::Transform& transform) override; void SetVisibleFromServer(bool visible) override; void SetOpacityFromServer(float opacity) override; @@ -233,8 +233,8 @@ void SetPropertyFromServer( const std::string& property_name, const std::vector<uint8_t>* property_data) override; - void SetFrameSinkIdFromServer(const cc::FrameSinkId& frame_sink_id) override; - const cc::LocalSurfaceId& GetOrAllocateLocalSurfaceId( + void SetFrameSinkIdFromServer(const viz::FrameSinkId& frame_sink_id) override; + const viz::LocalSurfaceId& GetOrAllocateLocalSurfaceId( const gfx::Size& surface_size_in_pixels) override; void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) override; void DestroyFromServer() override; @@ -242,7 +242,7 @@ void RemoveTransientChildFromServer(WindowMus* child) override; ChangeSource OnTransientChildAdded(WindowMus* child) override; ChangeSource OnTransientChildRemoved(WindowMus* child) override; - const cc::LocalSurfaceId& GetLocalSurfaceId() override; + const viz::LocalSurfaceId& GetLocalSurfaceId() override; std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( const gfx::Rect& bounds) override; std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( @@ -270,7 +270,7 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; - cc::SurfaceId GetSurfaceId() const override; + viz::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override {} void OnWillRemoveWindowFromRootWindow() override {} @@ -287,13 +287,13 @@ ServerChangeIdType next_server_change_id_ = 0; ServerChanges server_changes_; - cc::FrameSinkId frame_sink_id_; + viz::FrameSinkId frame_sink_id_; cc::SurfaceInfo primary_surface_info_; cc::SurfaceInfo fallback_surface_info_; - cc::LocalSurfaceId local_surface_id_; - cc::LocalSurfaceIdAllocator local_surface_id_allocator_; + viz::LocalSurfaceId local_surface_id_; + viz::LocalSurfaceIdAllocator local_surface_id_allocator_; gfx::Size last_surface_size_in_pixels_; ui::CursorData cursor_;
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc index 03ea030b..0a7f563e 100644 --- a/ui/aura/mus/window_tree_client.cc +++ b/ui/aura/mus/window_tree_client.cc
@@ -484,7 +484,7 @@ WindowMusType window_mus_type, const ui::mojom::WindowData& window_data, int64_t display_id, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { std::unique_ptr<WindowPortMus> window_port = CreateWindowPortMus(window_data, window_mus_type); roots_.insert(window_port.get()); @@ -584,7 +584,7 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { // WARNING: this is only called if WindowTreeClient was created as the // result of an embedding. client_id_ = client_id; @@ -602,7 +602,7 @@ void WindowTreeClient::OnSetDisplayRootDone( Id window_id, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { // The only way SetDisplayRoot() should fail is if we've done something wrong. CHECK(local_surface_id.has_value()); WindowMus* window = GetWindowByServerId(window_id); @@ -617,7 +617,7 @@ const display::Display& display, ui::mojom::WindowDataPtr root_data, bool parent_drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { DCHECK(window_manager_delegate_); got_initial_displays_ = true; @@ -650,7 +650,7 @@ void WindowTreeClient::SetWindowBoundsFromServer( WindowMus* window, const gfx::Rect& revert_bounds_in_pixels, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { if (IsRoot(window)) { // WindowTreeHost expects bounds to be in pixels. GetWindowTreeHostMus(window)->SetBoundsFromServer(revert_bounds_in_pixels); @@ -696,7 +696,7 @@ const uint32_t change_id = ScheduleInFlightChange(base::MakeUnique<InFlightBoundsChange>( this, window, old_bounds, window->GetLocalSurfaceId())); - base::Optional<cc::LocalSurfaceId> local_surface_id; + base::Optional<viz::LocalSurfaceId> local_surface_id; if (window->window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || window->window_mus_type() == WindowMusType::EMBED_IN_OWNER || window->window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED || @@ -1013,7 +1013,7 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { DCHECK(!tree_ptr_); tree_ptr_ = std::move(tree); @@ -1061,7 +1061,7 @@ void WindowTreeClient::OnFrameSinkIdAllocated( Id window_id, - const cc::FrameSinkId& frame_sink_id) { + const viz::FrameSinkId& frame_sink_id) { WindowMus* window = GetWindowByServerId(window_id); if (!window) return; @@ -1074,7 +1074,7 @@ ui::mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { // The server ack'd the top level window we created and supplied the state // of the window at the time the server created it. For properties we do not // have changes in flight for we can update them immediately. For properties @@ -1145,7 +1145,7 @@ Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { WindowMus* window = GetWindowByServerId(window_id); if (!window) return; @@ -1547,7 +1547,7 @@ const display::Display& display, ui::mojom::WindowDataPtr root_data, bool parent_drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { WmNewDisplayAddedImpl(display, std::move(root_data), parent_drawn, local_surface_id); }
diff --git a/ui/aura/mus/window_tree_client.h b/ui/aura/mus/window_tree_client.h index baf8d8bf6..2948a069 100644 --- a/ui/aura/mus/window_tree_client.h +++ b/ui/aura/mus/window_tree_client.h
@@ -19,7 +19,7 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/single_thread_task_runner.h" -#include "cc/surfaces/local_surface_id_allocator.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/ui/public/interfaces/window_tree.mojom.h" @@ -241,7 +241,7 @@ WindowMusType window_mus_type, const ui::mojom::WindowData& window_data, int64_t display_id, - const base::Optional<cc::LocalSurfaceId>& local_surface_id = + const base::Optional<viz::LocalSurfaceId>& local_surface_id = base::nullopt); WindowMus* NewWindowFromWindowData(WindowMus* parent, @@ -269,19 +269,19 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); // Called once mus acks the call to SetDisplayRoot(). void OnSetDisplayRootDone( Id window_id, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); // Called by WmNewDisplayAdded(). WindowTreeHostMus* WmNewDisplayAddedImpl( const display::Display& display, ui::mojom::WindowDataPtr root_data, bool parent_drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); std::unique_ptr<EventResultCallback> CreateEventResultCallback( int32_t event_id); @@ -293,7 +293,7 @@ void SetWindowBoundsFromServer( WindowMus* window, const gfx::Rect& revert_bounds_in_pixels, - const base::Optional<cc::LocalSurfaceId>& local_surface_id); + const base::Optional<viz::LocalSurfaceId>& local_surface_id); void SetWindowTransformFromServer(WindowMus* window, const gfx::Transform& transform); void SetWindowVisibleFromServer(WindowMus* window, bool visible); @@ -337,24 +337,24 @@ int64_t display_id, Id focused_window_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnEmbeddedAppDisconnected(Id window_id) override; void OnUnembed(Id window_id) override; void OnCaptureChanged(Id new_capture_window_id, Id old_capture_window_id) override; void OnFrameSinkIdAllocated(Id window_id, - const cc::FrameSinkId& frame_sink_id) override; + const viz::FrameSinkId& frame_sink_id) override; void OnTopLevelCreated( uint32_t change_id, ui::mojom::WindowDataPtr data, int64_t display_id, bool drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnWindowBoundsChanged( Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void OnWindowTransformChanged(Id window_id, const gfx::Transform& old_transform, const gfx::Transform& new_transform) override; @@ -430,7 +430,7 @@ const display::Display& display, ui::mojom::WindowDataPtr root_data, bool parent_drawn, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void WmDisplayRemoved(int64_t display_id) override; void WmDisplayModified(const display::Display& display) override; void WmSetBounds(uint32_t change_id,
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc index 3e8b5d87..2e6c8f0 100644 --- a/ui/aura/mus/window_tree_client_unittest.cc +++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -181,7 +181,7 @@ EXPECT_EQ(original_bounds, window.bounds()); } -// Verifies bounds and the cc::LocalSurfaceId associated with the bounds are +// Verifies bounds and the viz::LocalSurfaceId associated with the bounds are // reverted if the server replied that the change failed. TEST_F(WindowTreeClientWmTest, SetBoundsFailedLocalSurfaceId) { Window window(nullptr); @@ -200,7 +200,7 @@ ASSERT_NE(nullptr, window_mus); EXPECT_TRUE(window_mus->GetLocalSurfaceId().is_valid()); - // Reverting the change should also revert the cc::LocalSurfaceId. + // Reverting the change should also revert the viz::LocalSurfaceId. ASSERT_TRUE(window_tree()->AckSingleChangeOfType(WindowTreeChangeType::BOUNDS, false)); EXPECT_EQ(original_bounds, window.bounds()); @@ -222,7 +222,7 @@ aura::client::WindowEmbedType::EMBED_IN_OWNER); window.Init(ui::LAYER_NOT_DRAWN); - // The window will allocate a cc::LocalSurfaceId once it has a bounds. + // The window will allocate a viz::LocalSurfaceId once it has a bounds. WindowMus* window_mus = WindowMus::Get(&window); ASSERT_NE(nullptr, window_mus); EXPECT_FALSE(window_mus->GetLocalSurfaceId().is_valid()); @@ -241,7 +241,7 @@ // Now that the window has a valid FrameSinkId, it can embed the client in a // CompositorFrame. window_tree_client()->OnFrameSinkIdAllocated(server_id(&window), - cc::FrameSinkId(1, 1)); + viz::FrameSinkId(1, 1)); ClientSurfaceEmbedder* client_surface_embedder = window_port_mus->client_surface_embedder(); ASSERT_NE(nullptr, client_surface_embedder); @@ -286,7 +286,7 @@ } } -// Verifies that the cc::LocalSurfaceId generated by an embedder changes when +// Verifies that the viz::LocalSurfaceId generated by an embedder changes when // the size changes, but not when the position changes. TEST_P(WindowTreeClientWmTestSurfaceSync, SetBoundsLocalSurfaceIdChanges) { ASSERT_EQ(base::nullopt, window_tree()->last_local_surface_id()); @@ -297,32 +297,33 @@ aura::client::WindowEmbedType::EMBED_IN_OWNER); window.Init(ui::LAYER_NOT_DRAWN); - // Resize the window and verify that we've allocated a cc::LocalSurfaceId. + // Resize the window and verify that we've allocated a viz::LocalSurfaceId. const gfx::Rect new_bounds(0, 0, 100, 100); ASSERT_NE(new_bounds, window.bounds()); window.SetBounds(new_bounds); EXPECT_EQ(new_bounds, window.bounds()); - base::Optional<cc::LocalSurfaceId> last_local_surface_id = + base::Optional<viz::LocalSurfaceId> last_local_surface_id = window_tree()->last_local_surface_id(); ASSERT_NE(base::nullopt, last_local_surface_id); - // Resize the window again and verify that the cc::LocalSurfaceId has changed. + // Resize the window again and verify that the viz::LocalSurfaceId has + // changed. const gfx::Rect new_bounds2(0, 0, 100, 102); ASSERT_NE(new_bounds2, window.bounds()); window.SetBounds(new_bounds2); EXPECT_EQ(new_bounds2, window.bounds()); - base::Optional<cc::LocalSurfaceId> last_local_surface_id2 = + base::Optional<viz::LocalSurfaceId> last_local_surface_id2 = window_tree()->last_local_surface_id(); ASSERT_NE(base::nullopt, last_local_surface_id2); EXPECT_NE(last_local_surface_id2, last_local_surface_id); // Moving the window but not changing the size should not allocate a new - // cc::LocalSurfaceId. + // viz::LocalSurfaceId. const gfx::Rect new_bounds3(1337, 7331, 100, 102); ASSERT_NE(new_bounds3, window.bounds()); window.SetBounds(new_bounds3); EXPECT_EQ(new_bounds3, window.bounds()); - base::Optional<cc::LocalSurfaceId> last_local_surface_id3 = + base::Optional<viz::LocalSurfaceId> last_local_surface_id3 = window_tree()->last_local_surface_id(); ASSERT_NE(base::nullopt, last_local_surface_id3); EXPECT_EQ(last_local_surface_id2, last_local_surface_id3); @@ -440,7 +441,7 @@ // Simulates a bounds change, and while the bounds change is in flight the // server replies with a new bounds and the original bounds change fails. // The server bounds change takes hold along with the associated -// cc::LocalSurfaceId. +// viz::LocalSurfaceId. TEST_F(WindowTreeClientWmTest, SetBoundsFailedWithPendingChange) { const gfx::Rect original_bounds(root_window()->bounds()); const gfx::Rect new_bounds(gfx::Rect(0, 0, 100, 100)); @@ -450,7 +451,7 @@ // Simulate the server responding with a bounds change. const gfx::Rect server_changed_bounds(gfx::Rect(0, 0, 101, 102)); - const cc::LocalSurfaceId server_changed_local_surface_id( + const viz::LocalSurfaceId server_changed_local_surface_id( 1, base::UnguessableToken::Create()); window_tree_client()->OnWindowBoundsChanged( server_id(root_window()), original_bounds, server_changed_bounds,
diff --git a/ui/aura/mus/window_tree_host_mus.cc b/ui/aura/mus/window_tree_host_mus.cc index eeecd66..a529a0bc 100644 --- a/ui/aura/mus/window_tree_host_mus.cc +++ b/ui/aura/mus/window_tree_host_mus.cc
@@ -52,7 +52,7 @@ // seems them at the time the window is created. for (auto& pair : init_params.properties) window_mus->SetPropertyFromServer(pair.first, &pair.second); - CreateCompositor(cc::FrameSinkId()); + CreateCompositor(viz::FrameSinkId()); gfx::AcceleratedWidget accelerated_widget; // We need accelerated widget numbers to be different for each // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
diff --git a/ui/aura/mus/window_tree_host_mus_init_params.h b/ui/aura/mus/window_tree_host_mus_init_params.h index c26a8fca..38f9992d 100644 --- a/ui/aura/mus/window_tree_host_mus_init_params.h +++ b/ui/aura/mus/window_tree_host_mus_init_params.h
@@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "ui/aura/aura_export.h" @@ -57,7 +57,7 @@ // Properties to send to the server as well as to set on the Window. std::map<std::string, std::vector<uint8_t>> properties; - cc::FrameSinkId frame_sink_id; + viz::FrameSinkId frame_sink_id; // Id of the display the window should be created on. int64_t display_id = 0;
diff --git a/ui/aura/test/mus/test_window_tree.cc b/ui/aura/test/mus/test_window_tree.cc index 5d8dc3f1..450ca9c 100644 --- a/ui/aura/test/mus/test_window_tree.cc +++ b/ui/aura/test/mus/test_window_tree.cc
@@ -137,7 +137,7 @@ uint32_t change_id, uint32_t window_id, const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) { + const base::Optional<viz::LocalSurfaceId>& local_surface_id) { window_id_ = window_id; last_local_surface_id_ = local_surface_id; OnChangeReceived(change_id, WindowTreeChangeType::BOUNDS);
diff --git a/ui/aura/test/mus/test_window_tree.h b/ui/aura/test/mus/test_window_tree.h index c73cec1..9622dd6a 100644 --- a/ui/aura/test/mus/test_window_tree.h +++ b/ui/aura/test/mus/test_window_tree.h
@@ -95,7 +95,7 @@ return last_hit_test_mask_; } - const base::Optional<cc::LocalSurfaceId>& last_local_surface_id() const { + const base::Optional<viz::LocalSurfaceId>& last_local_surface_id() const { return last_local_surface_id_; } @@ -125,7 +125,7 @@ uint32_t change_id, uint32_t window_id, const gfx::Rect& bounds, - const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; + const base::Optional<viz::LocalSurfaceId>& local_surface_id) override; void SetWindowTransform(uint32_t change_id, uint32_t window_id, const gfx::Transform& transform) override; @@ -236,7 +236,7 @@ base::Optional<gfx::Rect> last_hit_test_mask_; - base::Optional<cc::LocalSurfaceId> last_local_surface_id_; + base::Optional<viz::LocalSurfaceId> last_local_surface_id_; DISALLOW_COPY_AND_ASSIGN(TestWindowTree); };
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index d879c24..5697e03 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc
@@ -986,7 +986,7 @@ return port_->CreateLayerTreeFrameSink(); } -cc::SurfaceId Window::GetSurfaceId() const { +viz::SurfaceId Window::GetSurfaceId() const { return port_->GetSurfaceId(); }
diff --git a/ui/aura/window.h b/ui/aura/window.h index b719842..cd6d841f 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h
@@ -312,8 +312,8 @@ // Create a LayerTreeFrameSink for the aura::Window. std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink(); - // Get the current cc::SurfaceId. - cc::SurfaceId GetSurfaceId() const; + // Get the current viz::SurfaceId. + viz::SurfaceId GetSurfaceId() const; protected: // Deletes (or removes if not owned by parent) all child windows. Intended for
diff --git a/ui/aura/window_port.h b/ui/aura/window_port.h index f33170a..2a52e74 100644 --- a/ui/aura/window_port.h +++ b/ui/aura/window_port.h
@@ -13,7 +13,7 @@ #include "base/callback.h" #include "base/observer_list.h" #include "base/strings/string16.h" -#include "cc/surfaces/surface_id.h" +#include "components/viz/common/surface_id.h" #include "ui/aura/aura_export.h" #include "ui/base/class_property.h" @@ -84,8 +84,8 @@ virtual std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() = 0; - // Get the current cc::SurfaceId. - virtual cc::SurfaceId GetSurfaceId() const = 0; + // Get the current viz::SurfaceId. + virtual viz::SurfaceId GetSurfaceId() const = 0; virtual void OnWindowAddedToRootWindow() = 0; virtual void OnWillRemoveWindowFromRootWindow() = 0;
diff --git a/ui/aura/window_port_for_shutdown.cc b/ui/aura/window_port_for_shutdown.cc index 84c66f7..054342eb 100644 --- a/ui/aura/window_port_for_shutdown.cc +++ b/ui/aura/window_port_for_shutdown.cc
@@ -56,8 +56,8 @@ return nullptr; } -cc::SurfaceId WindowPortForShutdown::GetSurfaceId() const { - return cc::SurfaceId(); +viz::SurfaceId WindowPortForShutdown::GetSurfaceId() const { + return viz::SurfaceId(); } void WindowPortForShutdown::OnWindowAddedToRootWindow() {}
diff --git a/ui/aura/window_port_for_shutdown.h b/ui/aura/window_port_for_shutdown.h index b355141e..2d369f7a 100644 --- a/ui/aura/window_port_for_shutdown.h +++ b/ui/aura/window_port_for_shutdown.h
@@ -36,7 +36,7 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; - cc::SurfaceId GetSurfaceId() const override; + viz::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override; void OnWillRemoveWindowFromRootWindow() override;
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index 25a8505..1844a7de 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc
@@ -250,7 +250,7 @@ //window()->RemoveOrDestroyChildren(); } -void WindowTreeHost::CreateCompositor(const cc::FrameSinkId& frame_sink_id) { +void WindowTreeHost::CreateCompositor(const viz::FrameSinkId& frame_sink_id) { DCHECK(Env::GetInstance()); ui::ContextFactory* context_factory = Env::GetInstance()->context_factory(); DCHECK(context_factory);
diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index 0d5e7d4..fdb52c9 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h
@@ -11,7 +11,7 @@ #include "base/event_types.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" -#include "cc/surfaces/frame_sink_id.h" +#include "components/viz/common/frame_sink_id.h" #include "ui/aura/aura_export.h" #include "ui/base/cursor/cursor.h" #include "ui/base/ime/input_method_delegate.h" @@ -193,7 +193,7 @@ // If frame_sink_id is not passed in, one will be grabbed from // ContextFactoryPrivate. void CreateCompositor( - const cc::FrameSinkId& frame_sink_id = cc::FrameSinkId()); + const viz::FrameSinkId& frame_sink_id = viz::FrameSinkId()); void InitCompositor(); void OnAcceleratedWidgetAvailable();
diff --git a/ui/compositor/DEPS b/ui/compositor/DEPS index 7941025..5fa569a7 100644 --- a/ui/compositor/DEPS +++ b/ui/compositor/DEPS
@@ -1,8 +1,7 @@ include_rules = [ "+cc", "-cc/blink", - "+components/viz/common/quads", - "+components/viz/common/resources", + "+components/viz/common", "+components/viz/host", "+gpu/command_buffer/client/gles2_interface.h", "+services/ui/public/cpp",
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 353b9f9c..5c6367ca 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc
@@ -32,9 +32,9 @@ #include "cc/output/latency_info_swap_promise.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_settings.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/common/quads/resource_format.h" #include "components/viz/common/resources/resource_settings.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -53,7 +53,7 @@ namespace ui { -Compositor::Compositor(const cc::FrameSinkId& frame_sink_id, +Compositor::Compositor(const viz::FrameSinkId& frame_sink_id, ui::ContextFactory* context_factory, ui::ContextFactoryPrivate* context_factory_private, scoped_refptr<base::SingleThreadTaskRunner> task_runner, @@ -225,7 +225,7 @@ return false; } -void Compositor::AddFrameSink(const cc::FrameSinkId& frame_sink_id) { +void Compositor::AddFrameSink(const viz::FrameSinkId& frame_sink_id) { if (!context_factory_private_) return; context_factory_private_->GetFrameSinkManager()->RegisterFrameSinkHierarchy( @@ -233,7 +233,7 @@ child_frame_sinks_.insert(frame_sink_id); } -void Compositor::RemoveFrameSink(const cc::FrameSinkId& frame_sink_id) { +void Compositor::RemoveFrameSink(const viz::FrameSinkId& frame_sink_id) { if (!context_factory_private_) return; auto it = child_frame_sinks_.find(frame_sink_id); @@ -244,7 +244,8 @@ child_frame_sinks_.erase(it); } -void Compositor::SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) { +void Compositor::SetLocalSurfaceId( + const viz::LocalSurfaceId& local_surface_id) { host_->SetLocalSurfaceId(local_surface_id); }
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index ada9570..90bd1b0 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h
@@ -46,7 +46,6 @@ class LayerTreeDebugState; class LayerTreeFrameSink; class LayerTreeHost; -class LocalSurfaceId; class TaskGraphRunner; } @@ -62,6 +61,7 @@ namespace viz { class HostFrameSinkManager; +class LocalSurfaceId; class ResourceSettings; } @@ -103,7 +103,7 @@ virtual void RemoveReflector(Reflector* reflector) = 0; // Allocate a new client ID for the display compositor. - virtual cc::FrameSinkId AllocateFrameSinkId() = 0; + virtual viz::FrameSinkId AllocateFrameSinkId() = 0; // Gets the frame sink manager. // TODO(staraz): Remove GetFrameSinkManager once FrameSinkManager is merged @@ -186,7 +186,7 @@ NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), NON_EXPORTED_BASE(public CompositorLockDelegate) { public: - Compositor(const cc::FrameSinkId& frame_sink_id, + Compositor(const viz::FrameSinkId& frame_sink_id, ui::ContextFactory* context_factory, ui::ContextFactoryPrivate* context_factory_private, scoped_refptr<base::SingleThreadTaskRunner> task_runner, @@ -199,10 +199,10 @@ return context_factory_private_; } - void AddFrameSink(const cc::FrameSinkId& frame_sink_id); - void RemoveFrameSink(const cc::FrameSinkId& frame_sink_id); + void AddFrameSink(const viz::FrameSinkId& frame_sink_id); + void RemoveFrameSink(const viz::FrameSinkId& frame_sink_id); - void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id); + void SetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id); void SetLayerTreeFrameSink(std::unique_ptr<cc::LayerTreeFrameSink> surface); @@ -369,7 +369,7 @@ return &layer_animator_collection_; } - const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } + const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } int activated_frame_count() const { return activated_frame_count_; } float refresh_rate() const { return refresh_rate_; } @@ -408,10 +408,10 @@ double forced_refresh_rate_ = 0.f; // A map from child id to parent id. - std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> child_frame_sinks_; + std::unordered_set<viz::FrameSinkId, viz::FrameSinkIdHash> child_frame_sinks_; bool widget_valid_ = false; bool layer_tree_frame_sink_requested_ = false; - const cc::FrameSinkId frame_sink_id_; + const viz::FrameSinkId frame_sink_id_; scoped_refptr<cc::Layer> root_web_layer_; std::unique_ptr<cc::AnimationHost> animation_host_; std::unique_ptr<cc::LayerTreeHost> host_;
diff --git a/ui/compositor/compositor_unittest.cc b/ui/compositor/compositor_unittest.cc index 9736678a9..17597aeb 100644 --- a/ui/compositor/compositor_unittest.cc +++ b/ui/compositor/compositor_unittest.cc
@@ -10,9 +10,9 @@ #include "base/test/test_mock_time_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/output/begin_frame_args.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface_manager.h" #include "cc/test/begin_frame_args_test.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/compositor/compositor.h"
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index b48c8a3..8244d39 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc
@@ -643,7 +643,7 @@ } void Layer::SetTextureMailbox( - const cc::TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<cc::SingleReleaseCallback> release_callback, gfx::Size texture_size_in_dip) { DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); @@ -734,7 +734,7 @@ SwitchToLayer(new_layer); solid_color_layer_ = new_layer; - mailbox_ = cc::TextureMailbox(); + mailbox_ = viz::TextureMailbox(); if (mailbox_release_callback_) { mailbox_release_callback_->Run(gpu::SyncToken(), false); mailbox_release_callback_.reset(); @@ -940,7 +940,7 @@ } bool Layer::PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) { if (!mailbox_release_callback_) return false;
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 10533a9..58a09922 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h
@@ -21,8 +21,8 @@ #include "cc/layers/layer_client.h" #include "cc/layers/surface_layer.h" #include "cc/layers/texture_layer_client.h" -#include "cc/resources/texture_mailbox.h" #include "cc/surfaces/sequence_surface_reference_factory.h" +#include "components/viz/common/quads/texture_mailbox.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkRegion.h" #include "ui/compositor/compositor.h" @@ -294,7 +294,7 @@ // Set new TextureMailbox for this layer. Note that |mailbox| may hold a // shared memory resource or an actual mailbox for a texture. void SetTextureMailbox( - const cc::TextureMailbox& mailbox, + const viz::TextureMailbox& mailbox, std::unique_ptr<cc::SingleReleaseCallback> release_callback, gfx::Size texture_size_in_dip); void SetTextureSize(gfx::Size texture_size_in_dip); @@ -389,7 +389,7 @@ // TextureLayerClient bool PrepareTextureMailbox( - cc::TextureMailbox* mailbox, + viz::TextureMailbox* mailbox, std::unique_ptr<cc::SingleReleaseCallback>* release_callback) override; float device_scale_factor() const { return device_scale_factor_; } @@ -565,7 +565,7 @@ gfx::Rect nine_patch_layer_aperture_; // The mailbox used by texture_layer_. - cc::TextureMailbox mailbox_; + viz::TextureMailbox mailbox_; // The callback to release the mailbox. This is only set after // SetTextureMailbox is called, before we give it to the TextureLayer.
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index f847d75..19260402 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -27,10 +27,10 @@ #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" #include "cc/surfaces/sequence_surface_reference_factory.h" -#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference_factory.h" #include "cc/surfaces/surface_sequence.h" #include "cc/test/pixel_test_utils.h" +#include "components/viz/common/surface_id.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/khronos/GLES2/gl2.h" #include "ui/compositor/compositor_observer.h" @@ -548,7 +548,7 @@ TEST(LayerStandaloneTest, ReleaseMailboxOnDestruction) { std::unique_ptr<Layer> layer(new Layer(LAYER_TEXTURED)); bool callback_run = false; - cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); + viz::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); layer->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( base::Bind(ReturnMailbox, &callback_run)), @@ -939,7 +939,7 @@ cc::Layer* before_layer = l1->cc_layer_for_testing(); bool callback1_run = false; - cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); + viz::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( base::Bind(ReturnMailbox, &callback1_run)), gfx::Size(10, 10)); @@ -954,7 +954,7 @@ EXPECT_FALSE(callback1_run); bool callback2_run = false; - mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); + mailbox = viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( base::Bind(ReturnMailbox, &callback2_run)), gfx::Size(10, 10)); @@ -974,7 +974,7 @@ // Back to a texture, without changing the bounds of the layer or the texture. bool callback3_run = false; - mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); + mailbox = viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0); l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( base::Bind(ReturnMailbox, &callback3_run)), gfx::Size(10, 10)); @@ -1128,8 +1128,8 @@ base::Unretained(&run_loop)); std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR)); - cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), - GL_TEXTURE_2D); + viz::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D); root->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(callback), gfx::Size(10, 10)); compositor()->SetRootLayer(root.get()); @@ -1743,7 +1743,7 @@ // cc::SequenceSurfaceReferenceFactory implementation: void SatisfySequence(const cc::SurfaceSequence& seq) const override {} - void RequireSequence(const cc::SurfaceId& id, + void RequireSequence(const viz::SurfaceId& id, const cc::SurfaceSequence& seq) const override {} DISALLOW_COPY_AND_ASSIGN(TestSurfaceReferenceFactory); @@ -1770,7 +1770,7 @@ // Showing surface content changes the underlying cc layer. before = child->cc_layer_for_testing(); child->SetShowPrimarySurface( - cc::SurfaceInfo(cc::SurfaceId(), 1.0, gfx::Size(10, 10)), + cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)), new TestSurfaceReferenceFactory()); EXPECT_TRUE(child->cc_layer_for_testing()); EXPECT_NE(before.get(), child->cc_layer_for_testing()); @@ -1787,9 +1787,9 @@ scoped_refptr<cc::SurfaceReferenceFactory> reference_factory( new TestSurfaceReferenceFactory()); - cc::SurfaceId surface_id( - cc::FrameSinkId(0, 1), - cc::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId surface_id( + viz::FrameSinkId(0, 1), + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); cc::SurfaceInfo surface_info(surface_id, 1.0f, gfx::Size(10, 10)); layer->SetShowPrimarySurface(surface_info, reference_factory); @@ -1801,8 +1801,8 @@ EXPECT_EQ(surface_info, surface->primary_surface_info()); surface_id = - cc::SurfaceId(cc::FrameSinkId(1, 2), - cc::LocalSurfaceId(3, base::UnguessableToken::Create())); + viz::SurfaceId(viz::FrameSinkId(1, 2), + viz::LocalSurfaceId(3, base::UnguessableToken::Create())); cc::SurfaceInfo surface_info_2(surface_id, 2.0f, gfx::Size(20, 20)); layer->SetShowPrimarySurface(surface_info_2, reference_factory); @@ -1818,9 +1818,9 @@ TEST_F(LayerWithDelegateTest, FrameSizeInDip) { std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); - cc::SurfaceId surface_id( - cc::FrameSinkId(0, 1), - cc::LocalSurfaceId(2, base::UnguessableToken::Create())); + viz::SurfaceId surface_id( + viz::FrameSinkId(0, 1), + viz::LocalSurfaceId(2, base::UnguessableToken::Create())); layer->SetShowPrimarySurface( cc::SurfaceInfo(surface_id, 2.0f, gfx::Size(30, 40)), @@ -1844,7 +1844,7 @@ // Showing surface content changes the underlying cc layer. scoped_refptr<cc::Layer> before = layer->cc_layer_for_testing(); layer->SetShowPrimarySurface( - cc::SurfaceInfo(cc::SurfaceId(), 1.0, gfx::Size(10, 10)), + cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)), new TestSurfaceReferenceFactory()); EXPECT_EQ(layer->layer_grayscale(), 0.5f); EXPECT_TRUE(layer->cc_layer_for_testing()); @@ -2168,7 +2168,7 @@ FrameDamageCheckingDelegate delegate; layer->set_delegate(&delegate); layer->SetShowPrimarySurface( - cc::SurfaceInfo(cc::SurfaceId(), 1.0, gfx::Size(10, 10)), + cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)), new TestSurfaceReferenceFactory()); EXPECT_FALSE(delegate.delegated_frame_damage_called());
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index fde5a18..77fc0af 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -22,8 +22,8 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/frame_sink_manager.h" -#include "cc/surfaces/local_surface_id_allocator.h" #include "cc/test/pixel_test_output_surface.h" +#include "components/viz/common/local_surface_id_allocator.h" #include "components/viz/host/host_frame_sink_manager.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" @@ -314,7 +314,7 @@ return &task_graph_runner_; } -cc::FrameSinkId InProcessContextFactory::AllocateFrameSinkId() { +viz::FrameSinkId InProcessContextFactory::AllocateFrameSinkId() { return frame_sink_id_allocator_.NextFrameSinkId(); }
diff --git a/ui/compositor/test/in_process_context_factory.h b/ui/compositor/test/in_process_context_factory.h index 9f52271..978d07e 100644 --- a/ui/compositor/test/in_process_context_factory.h +++ b/ui/compositor/test/in_process_context_factory.h
@@ -10,12 +10,12 @@ #include "base/macros.h" #include "cc/surfaces/display.h" -#include "cc/surfaces/frame_sink_id_allocator.h" #include "cc/surfaces/frame_sink_manager.h" #include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_image_factory.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_task_graph_runner.h" +#include "components/viz/common/frame_sink_id_allocator.h" #include "gpu/ipc/common/surface_handle.h" #include "ui/compositor/compositor.h" @@ -68,7 +68,7 @@ double GetRefreshRate() const override; gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; cc::TaskGraphRunner* GetTaskGraphRunner() override; - cc::FrameSinkId AllocateFrameSinkId() override; + viz::FrameSinkId AllocateFrameSinkId() override; viz::HostFrameSinkManager* GetHostFrameSinkManager() override; void SetDisplayVisible(ui::Compositor* compositor, bool visible) override; void ResizeDisplay(ui::Compositor* compositor, @@ -99,7 +99,7 @@ cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_; cc::TestImageFactory image_factory_; cc::TestTaskGraphRunner task_graph_runner_; - cc::FrameSinkIdAllocator frame_sink_id_allocator_; + viz::FrameSinkIdAllocator frame_sink_id_allocator_; bool use_test_surface_; double refresh_rate_ = 60.0; viz::HostFrameSinkManager* const host_frame_sink_manager_;
diff --git a/ui/display/display.cc b/ui/display/display.cc index a86c7203..e5a0414 100644 --- a/ui/display/display.cc +++ b/ui/display/display.cc
@@ -58,12 +58,6 @@ int64_t internal_display_id_ = -1; -gfx::ColorSpace GetForcedColorSpace() { - if (gfx::ICCProfile::HasForcedProfile()) - return gfx::ICCProfile::GetForcedProfile().GetColorSpace(); - return gfx::ColorSpace::CreateSRGB(); -} - } // namespace bool CompareDisplayIds(int64_t id1, int64_t id2) { @@ -106,6 +100,40 @@ switches::kForceDeviceScaleFactor, base::StringPrintf("%.2f", dsf)); } +// static +gfx::ColorSpace Display::GetForcedColorProfile() { + DCHECK(HasForceColorProfile()); + std::string value = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kForceColorProfile); + if (value == "srgb") { + return gfx::ColorSpace::CreateSRGB(); + } else if (value == "generic-rgb") { + return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::APPLE_GENERIC_RGB, + gfx::ColorSpace::TransferID::GAMMA18); + } else if (value == "color-spin-gamma24") { + // Run this color profile through an ICC profile. The resulting color space + // is slightly different from the input color space, and removing the ICC + // profile would require rebaselineing many layout tests. + gfx::ColorSpace color_space( + gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN, + gfx::ColorSpace::TransferID::GAMMA24); + gfx::ICCProfile icc_profile; + color_space.GetICCProfile(&icc_profile); + return icc_profile.GetColorSpace(); + } + LOG(ERROR) << "Invalid forced color profile"; + return gfx::ColorSpace::CreateSRGB(); +} + +// static +bool Display::HasForceColorProfile() { + static bool has_force_color_profile = + base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kForceColorProfile); + return has_force_color_profile; +} + Display::Display() : Display(kInvalidDisplayId) {} Display::Display(int64_t id) : Display(id, gfx::Rect()) {} @@ -115,7 +143,8 @@ bounds_(bounds), work_area_(bounds), device_scale_factor_(GetForcedDeviceScaleFactor()), - color_space_(GetForcedColorSpace()), + color_space_(HasForceColorProfile() ? GetForcedColorProfile() + : gfx::ColorSpace::CreateSRGB()), color_depth_(DEFAULT_BITS_PER_PIXEL), depth_per_component_(DEFAULT_BITS_PER_COMPONENT) { if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR)) {
diff --git a/ui/display/display.h b/ui/display/display.h index f5c92899..d81227a 100644 --- a/ui/display/display.h +++ b/ui/display/display.h
@@ -88,6 +88,14 @@ // command line via "--force-device-scale-factor". static bool HasForceDeviceScaleFactor(); + // Returns the forced display color profile, which is given by + // "--force-color-profile". + static gfx::ColorSpace GetForcedColorProfile(); + + // Indicates if a display color profile is being explicitly enforced from the + // command line via "--force-color-profile". + static bool HasForceColorProfile(); + // Resets the caches used to determine if a device scale factor is being // forced from the command line via "--force-device-scale-factor", and thus // ensures that the command line is reevaluated.
diff --git a/ui/display/display_switches.cc b/ui/display/display_switches.cc index 89171561..d4f897c 100644 --- a/ui/display/display_switches.cc +++ b/ui/display/display_switches.cc
@@ -13,6 +13,11 @@ // Enables software based mirroring. const char kEnableSoftwareMirroring[] = "ash-enable-software-mirroring"; +// Force all monitors to be treated as though they have the specified color +// profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac +// layout tests) and "color-spin-gamma24" (used by layout tests). +const char kForceColorProfile[] = "force-color-profile"; + // Overrides the device scale factor for the browser UI and the contents. const char kForceDeviceScaleFactor[] = "force-device-scale-factor";
diff --git a/ui/display/display_switches.h b/ui/display/display_switches.h index 93b741b..610ba11 100644 --- a/ui/display/display_switches.h +++ b/ui/display/display_switches.h
@@ -13,6 +13,7 @@ // Keep sorted. DISPLAY_EXPORT extern const char kEnableSoftwareMirroring[]; +DISPLAY_EXPORT extern const char kForceColorProfile[]; DISPLAY_EXPORT extern const char kForceDeviceScaleFactor[]; // TODO(kylechar): This overlaps with --screen-config. Unify flags and remove. DISPLAY_EXPORT extern const char kHostWindowBounds[];
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm index 12bcdf0..11eca13 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm
@@ -81,16 +81,15 @@ display.set_device_scale_factor(scale); - // On Sierra, we need to operate in a single screen's color space because - // IOSurfaces do not opt-out of color correction. - // https://crbug.com/654488 - CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace]; - static bool color_correct_rendering_enabled = - base::FeatureList::IsEnabled(features::kColorCorrectRendering); - if (base::mac::IsAtLeastOS10_12() && !color_correct_rendering_enabled) - color_space = base::mac::GetSystemColorSpace(); - - if (!gfx::ICCProfile::HasForcedProfile()) { + if (!Display::HasForceColorProfile()) { + // On Sierra, we need to operate in a single screen's color space because + // IOSurfaces do not opt-out of color correction. + // https://crbug.com/654488 + CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace]; + static bool color_correct_rendering_enabled = + base::FeatureList::IsEnabled(features::kColorCorrectRendering); + if (base::mac::IsAtLeastOS10_12() && !color_correct_rendering_enabled) + color_space = base::mac::GetSystemColorSpace(); display.set_color_space( gfx::ICCProfile::FromCGColorSpace(color_space).GetColorSpace()); }
diff --git a/ui/display/win/screen_win.cc b/ui/display/win/screen_win.cc index 8e121b0..f4e89f2 100644 --- a/ui/display/win/screen_win.cc +++ b/ui/display/win/screen_win.cc
@@ -80,7 +80,8 @@ return touching_display_infos; } -Display CreateDisplayFromDisplayInfo(const DisplayInfo& display_info) { +Display CreateDisplayFromDisplayInfo(const DisplayInfo& display_info, + ColorProfileReader* color_profile_reader) { Display display(display_info.id()); float scale_factor = display_info.device_scale_factor(); display.set_device_scale_factor(scale_factor); @@ -90,11 +91,10 @@ display.set_bounds(gfx::ScaleToEnclosingRect(display_info.screen_rect(), 1.0f / scale_factor)); display.set_rotation(display_info.rotation()); - - // TODO(ccameron): Populate this based on this specific display. - // http://crbug.com/735613 - display.set_color_space(gfx::ICCProfile::FromBestMonitor().GetColorSpace()); - + if (!Display::HasForceColorProfile()) { + display.set_color_space( + color_profile_reader->GetDisplayColorSpace(display_info.id())); + } return display; } @@ -116,7 +116,8 @@ // map to multiple screen points due to overlap. The first discovered screen // will take precedence. std::vector<ScreenWinDisplay> DisplayInfosToScreenWinDisplays( - const std::vector<DisplayInfo>& display_infos) { + const std::vector<DisplayInfo>& display_infos, + ColorProfileReader* color_profile_reader) { // Find and extract the primary display. std::vector<DisplayInfo> display_infos_remaining = display_infos; auto primary_display_iter = std::find_if( @@ -145,7 +146,8 @@ // Layout and create the ScreenWinDisplays. std::vector<Display> displays; for (const auto& display_info : display_infos) - displays.push_back(CreateDisplayFromDisplayInfo(display_info)); + displays.push_back( + CreateDisplayFromDisplayInfo(display_info, color_profile_reader)); std::unique_ptr<DisplayLayout> layout(builder.Build()); layout->ApplyToDisplayList(&displays, nullptr, 0); @@ -163,7 +165,6 @@ std::vector<Display> displays; for (const auto& screen_win_display : screen_win_displays) displays.push_back(screen_win_display.display()); - return displays; } @@ -456,7 +457,8 @@ void ScreenWin::UpdateFromDisplayInfos( const std::vector<DisplayInfo>& display_infos) { - screen_win_displays_ = DisplayInfosToScreenWinDisplays(display_infos); + screen_win_displays_ = DisplayInfosToScreenWinDisplays( + display_infos, color_profile_reader_.get()); displays_ = ScreenWinDisplaysToDisplays(screen_win_displays_); } @@ -511,7 +513,23 @@ } void ScreenWin::OnColorProfilesChanged() { - // TODO(ccameron): Re-build the display list here. + // The color profile reader will often just confirm that our guess that the + // color profile was sRGB was indeed correct. Avoid doing an update in these + // cases. + bool changed = false; + for (const auto& display : displays_) { + if (display.color_space() != + color_profile_reader_->GetDisplayColorSpace(display.id())) { + changed = true; + break; + } + } + if (!changed) + return; + + std::vector<Display> old_displays = std::move(displays_); + UpdateFromDisplayInfos(GetDisplayInfosFromSystem()); + change_notifier_.NotifyDisplaysChanged(old_displays, displays_); } ScreenWinDisplay ScreenWin::GetScreenWinDisplayNearestHWND(HWND hwnd)
diff --git a/ui/file_manager/file_manager/foreground/js/toolbar_controller.js b/ui/file_manager/file_manager/foreground/js/toolbar_controller.js index b3e61f03..9ddab0c1 100644 --- a/ui/file_manager/file_manager/foreground/js/toolbar_controller.js +++ b/ui/file_manager/file_manager/foreground/js/toolbar_controller.js
@@ -153,11 +153,15 @@ // controller which controls whole app window. Or, both toolbar and FileGrid // should listen to the FileSelectionHandler. if (this.directoryModel_.getFileListSelection().multiple) { - this.filesSelectedLabel_.ownerDocument.body.classList.toggle( - 'selecting', selection.totalCount > 0); - this.filesSelectedLabel_.ownerDocument.body.classList.toggle( - 'check-select', - this.directoryModel_.getFileListSelection().getCheckSelectMode()); + var bodyClassList = this.filesSelectedLabel_.ownerDocument.body.classList; + bodyClassList.toggle('selecting', selection.totalCount > 0); + if (bodyClassList.contains('check-select') != + this.directoryModel_.getFileListSelection().getCheckSelectMode()) { + bodyClassList.toggle('check-select'); + // Some custom styles depend on |check-select| class. We need to + // re-evaluate the custom styles when the class value is changed. + Polymer.updateStyles(); + } } }
diff --git a/ui/file_manager/file_manager/main.html b/ui/file_manager/file_manager/main.html index 39a15ee..218dd29f 100644 --- a/ui/file_manager/file_manager/main.html +++ b/ui/file_manager/file_manager/main.html
@@ -60,6 +60,21 @@ paper-progress { --paper-progress-active-color: rgb(26, 194, 34); } + + body.check-select .dialog-header files-toggle-ripple { + --files-toggle-ripple: { + background-color: black; + }; + --files-toggle-ripple-activated: { + opacity: 0.08; + }; + } + + body.check-select .dialog-header files-ripple { + --files-ripple: { + background-color: black; + } + } </style> <script src="foreground/js/elements_importer.js"></script>
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc index 2c0ae682..155d53d7 100644 --- a/ui/gfx/color_space.cc +++ b/ui/gfx/color_space.cc
@@ -70,6 +70,12 @@ } // static +ColorSpace ColorSpace::CreateDisplayP3D65() { + return ColorSpace(PrimaryID::SMPTEST432_1, TransferID::IEC61966_2_1, + MatrixID::RGB, RangeID::FULL); +} + +// static ColorSpace ColorSpace::CreateExtendedSRGB() { return ColorSpace(PrimaryID::BT709, TransferID::IEC61966_2_1_HDR, MatrixID::RGB, RangeID::FULL);
diff --git a/ui/gfx/color_space.h b/ui/gfx/color_space.h index 5819c5fe..4b0d9c4f 100644 --- a/ui/gfx/color_space.h +++ b/ui/gfx/color_space.h
@@ -133,6 +133,7 @@ bool IsValid() const; static ColorSpace CreateSRGB(); + static ColorSpace CreateDisplayP3D65(); static ColorSpace CreateCustom(const SkMatrix44& to_XYZD50, const SkColorSpaceTransferFn& fn); static ColorSpace CreateXYZD50();
diff --git a/ui/gfx/color_space_switches.cc b/ui/gfx/color_space_switches.cc index 2844a8e..f210cdc 100644 --- a/ui/gfx/color_space_switches.cc +++ b/ui/gfx/color_space_switches.cc
@@ -11,12 +11,3 @@ base::FEATURE_ENABLED_BY_DEFAULT}; } // namespace features - -namespace switches { - -// Force all monitors to be treated as though they have the specified color -// profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac -// layout tests) and "color-spin-gamma24" (used by layout tests). -const char kForceColorProfile[] = "force-color-profile"; - -} // namespace switches
diff --git a/ui/gfx/color_space_switches.h b/ui/gfx/color_space_switches.h index 0af262b..1bdd155 100644 --- a/ui/gfx/color_space_switches.h +++ b/ui/gfx/color_space_switches.h
@@ -15,10 +15,4 @@ } // namespace features -namespace switches { - -GFX_SWITCHES_EXPORT extern const char kForceColorProfile[]; - -} // namespace switches - #endif // UI_GFX_COLOR_SPACE_SWITCHES_H_
diff --git a/ui/gfx/icc_profile.cc b/ui/gfx/icc_profile.cc index c57eb526..2b11290 100644 --- a/ui/gfx/icc_profile.cc +++ b/ui/gfx/icc_profile.cc
@@ -108,43 +108,11 @@ defined(OS_IOS) // static ICCProfile ICCProfile::FromBestMonitor() { - if (HasForcedProfile()) - return GetForcedProfile(); return ICCProfile(); } #endif // static -bool ICCProfile::HasForcedProfile() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kForceColorProfile); -} - -// static -ICCProfile ICCProfile::GetForcedProfile() { - DCHECK(HasForcedProfile()); - ICCProfile icc_profile; - std::string value = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kForceColorProfile); - if (value == "srgb") { - ColorSpace::CreateSRGB().GetICCProfile(&icc_profile); - } else if (value == "generic-rgb") { - ColorSpace generic_rgb_color_space(ColorSpace::PrimaryID::APPLE_GENERIC_RGB, - ColorSpace::TransferID::GAMMA18); - generic_rgb_color_space.GetICCProfile(&icc_profile); - } else if (value == "color-spin-gamma24") { - ColorSpace color_spin_color_space( - ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN, - ColorSpace::TransferID::GAMMA24); - color_spin_color_space.GetICCProfile(&icc_profile); - } else { - LOG(ERROR) << "Invalid forced color profile"; - } - return icc_profile; -} - -// static const std::vector<char>& ICCProfile::GetData() const { return data_; }
diff --git a/ui/gfx/icc_profile.h b/ui/gfx/icc_profile.h index 691d2f69..03170ad 100644 --- a/ui/gfx/icc_profile.h +++ b/ui/gfx/icc_profile.h
@@ -57,11 +57,6 @@ // Create directly from profile data. static ICCProfile FromData(const void* icc_profile, size_t size); - // TODO(ccameron): Move this flag to display::Display, like forcing device - // scale factor. - static bool HasForcedProfile(); - static ICCProfile GetForcedProfile(); - // Return a ColorSpace that references this ICCProfile. ColorTransforms // created using this ColorSpace will match this ICCProfile precisely. const ColorSpace& GetColorSpace() const;
diff --git a/ui/gfx/icc_profile_mac.mm b/ui/gfx/icc_profile_mac.mm index 1aa768cc..ec51749 100644 --- a/ui/gfx/icc_profile_mac.mm +++ b/ui/gfx/icc_profile_mac.mm
@@ -16,9 +16,6 @@ // static ICCProfile ICCProfile::FromCGColorSpace(CGColorSpaceRef cg_color_space) { - if (HasForcedProfile()) - return GetForcedProfile(); - base::ScopedCFTypeRef<CFDataRef> cf_icc_profile( CGColorSpaceCopyICCProfile(cg_color_space)); if (!cf_icc_profile)
diff --git a/ui/gfx/icc_profile_win.cc b/ui/gfx/icc_profile_win.cc index 1b29f3c..c4ac9d96 100644 --- a/ui/gfx/icc_profile_win.cc +++ b/ui/gfx/icc_profile_win.cc
@@ -43,9 +43,6 @@ // static ICCProfile ICCProfile::FromBestMonitor() { - if (HasForcedProfile()) - return GetForcedProfile(); - base::AutoLock lock(g_best_monitor_color_space_lock.Get()); return g_best_monitor_color_space.Get(); }
diff --git a/ui/gfx/icc_profile_x11.cc b/ui/gfx/icc_profile_x11.cc index 819c8a6d..5f83e2f 100644 --- a/ui/gfx/icc_profile_x11.cc +++ b/ui/gfx/icc_profile_x11.cc
@@ -19,9 +19,6 @@ // static ICCProfile ICCProfile::FromBestMonitor() { - if (HasForcedProfile()) - return GetForcedProfile(); - ICCProfile icc_profile; if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) return icc_profile;
diff --git a/ui/gfx/test/icc_profiles.cc b/ui/gfx/test/icc_profiles.cc index e7a68e67..3b6ebb0c 100644 --- a/ui/gfx/test/icc_profiles.cc +++ b/ui/gfx/test/icc_profiles.cc
@@ -1935,8 +1935,4 @@ arraysize(overshoot_profile_data), ICCProfile::test_id_overshoot_); } -ICCProfile ICCProfileForLayoutTests() { - return ICCProfile::GetForcedProfile(); -} - } // namespace gfx
diff --git a/ui/gfx/test/icc_profiles.h b/ui/gfx/test/icc_profiles.h index 54b40cb..356beaf 100644 --- a/ui/gfx/test/icc_profiles.h +++ b/ui/gfx/test/icc_profiles.h
@@ -20,7 +20,4 @@ // A profile that with an approxmation that shoots above 1. ICCProfile ICCProfileForTestingOvershoot(); -// The default profile that is being used by layout tests in this process. -ICCProfile ICCProfileForLayoutTests(); - } // namespace gfx
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py index ab9ccede..5dbc228d 100755 --- a/ui/gl/generate_bindings.py +++ b/ui/gl/generate_bindings.py
@@ -1982,6 +1982,24 @@ 'names': ['eglPostSubBufferNV'], 'arguments': 'EGLDisplay dpy, EGLSurface surface, ' 'EGLint x, EGLint y, EGLint width, EGLint height', }, +{ 'return_type': 'EGLint', + 'versions': [{ 'name': 'eglProgramCacheGetAttribANGLE', + 'extensions': ['EGL_ANGLE_program_cache_control'] }], + 'arguments': 'EGLDisplay dpy, EGLenum attrib', }, +{ 'return_type': 'void', + 'versions': [{ 'name': 'eglProgramCachePopulateANGLE', + 'extensions': ['EGL_ANGLE_program_cache_control'] }], + 'arguments': 'EGLDisplay dpy, const void* key, ' + 'EGLint keysize, const void* binary, EGLint binarysize', }, +{ 'return_type': 'void', + 'versions': [{ 'name': 'eglProgramCacheQueryANGLE', + 'extensions': ['EGL_ANGLE_program_cache_control'] }], + 'arguments': 'EGLDisplay dpy, EGLint index, ' + 'void* key, EGLint* keysize, void* binary, EGLint* binarysize', }, +{ 'return_type': 'EGLint', + 'versions': [{ 'name': 'eglProgramCacheResizeANGLE', + 'extensions': ['EGL_ANGLE_program_cache_control'] }], + 'arguments': 'EGLDisplay dpy, EGLint limit, EGLenum mode', }, { 'return_type': 'EGLenum', 'names': ['eglQueryAPI'], 'arguments': 'void', },
diff --git a/ui/gl/gl_bindings_api_autogen_egl.h b/ui/gl/gl_bindings_api_autogen_egl.h index 7f74a32..1b88fb2 100644 --- a/ui/gl/gl_bindings_api_autogen_egl.h +++ b/ui/gl/gl_bindings_api_autogen_egl.h
@@ -107,6 +107,21 @@ EGLint y, EGLint width, EGLint height) override; +EGLint eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, EGLenum attrib) override; +void eglProgramCachePopulateANGLEFn(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) override; +void eglProgramCacheQueryANGLEFn(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) override; +EGLint eglProgramCacheResizeANGLEFn(EGLDisplay dpy, + EGLint limit, + EGLenum mode) override; EGLenum eglQueryAPIFn(void) override; EGLBoolean eglQueryContextFn(EGLDisplay dpy, EGLContext ctx,
diff --git a/ui/gl/gl_bindings_autogen_egl.cc b/ui/gl/gl_bindings_autogen_egl.cc index e6d452ca..637996d7 100644 --- a/ui/gl/gl_bindings_autogen_egl.cc +++ b/ui/gl/gl_bindings_autogen_egl.cc
@@ -83,6 +83,10 @@ fn.eglMakeCurrentFn = reinterpret_cast<eglMakeCurrentProc>(GetGLProcAddress("eglMakeCurrent")); fn.eglPostSubBufferNVFn = 0; + fn.eglProgramCacheGetAttribANGLEFn = 0; + fn.eglProgramCachePopulateANGLEFn = 0; + fn.eglProgramCacheQueryANGLEFn = 0; + fn.eglProgramCacheResizeANGLEFn = 0; fn.eglQueryAPIFn = reinterpret_cast<eglQueryAPIProc>(GetGLProcAddress("eglQueryAPI")); fn.eglQueryContextFn = reinterpret_cast<eglQueryContextProc>( @@ -145,6 +149,8 @@ ext.b_EGL_ANGLE_d3d_share_handle_client_buffer = extensions.find("EGL_ANGLE_d3d_share_handle_client_buffer ") != std::string::npos; + ext.b_EGL_ANGLE_program_cache_control = + extensions.find("EGL_ANGLE_program_cache_control ") != std::string::npos; ext.b_EGL_ANGLE_query_surface_pointer = extensions.find("EGL_ANGLE_query_surface_pointer ") != std::string::npos; ext.b_EGL_ANGLE_stream_producer_d3d_texture_nv12 = @@ -226,6 +232,30 @@ GetGLProcAddress("eglPostSubBufferNV")); } + if (ext.b_EGL_ANGLE_program_cache_control) { + fn.eglProgramCacheGetAttribANGLEFn = + reinterpret_cast<eglProgramCacheGetAttribANGLEProc>( + GetGLProcAddress("eglProgramCacheGetAttribANGLE")); + } + + if (ext.b_EGL_ANGLE_program_cache_control) { + fn.eglProgramCachePopulateANGLEFn = + reinterpret_cast<eglProgramCachePopulateANGLEProc>( + GetGLProcAddress("eglProgramCachePopulateANGLE")); + } + + if (ext.b_EGL_ANGLE_program_cache_control) { + fn.eglProgramCacheQueryANGLEFn = + reinterpret_cast<eglProgramCacheQueryANGLEProc>( + GetGLProcAddress("eglProgramCacheQueryANGLE")); + } + + if (ext.b_EGL_ANGLE_program_cache_control) { + fn.eglProgramCacheResizeANGLEFn = + reinterpret_cast<eglProgramCacheResizeANGLEProc>( + GetGLProcAddress("eglProgramCacheResizeANGLE")); + } + if (ext.b_EGL_KHR_stream) { fn.eglQueryStreamKHRFn = reinterpret_cast<eglQueryStreamKHRProc>( GetGLProcAddress("eglQueryStreamKHR")); @@ -501,6 +531,36 @@ return driver_->fn.eglPostSubBufferNVFn(dpy, surface, x, y, width, height); } +EGLint EGLApiBase::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, + EGLenum attrib) { + return driver_->fn.eglProgramCacheGetAttribANGLEFn(dpy, attrib); +} + +void EGLApiBase::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) { + driver_->fn.eglProgramCachePopulateANGLEFn(dpy, key, keysize, binary, + binarysize); +} + +void EGLApiBase::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) { + driver_->fn.eglProgramCacheQueryANGLEFn(dpy, index, key, keysize, binary, + binarysize); +} + +EGLint EGLApiBase::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, + EGLint limit, + EGLenum mode) { + return driver_->fn.eglProgramCacheResizeANGLEFn(dpy, limit, mode); +} + EGLenum EGLApiBase::eglQueryAPIFn(void) { return driver_->fn.eglQueryAPIFn(); } @@ -885,6 +945,42 @@ return egl_api_->eglPostSubBufferNVFn(dpy, surface, x, y, width, height); } +EGLint TraceEGLApi::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, + EGLenum attrib) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "TraceGLAPI::eglProgramCacheGetAttribANGLE") + return egl_api_->eglProgramCacheGetAttribANGLEFn(dpy, attrib); +} + +void TraceEGLApi::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "TraceGLAPI::eglProgramCachePopulateANGLE") + egl_api_->eglProgramCachePopulateANGLEFn(dpy, key, keysize, binary, + binarysize); +} + +void TraceEGLApi::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglProgramCacheQueryANGLE") + egl_api_->eglProgramCacheQueryANGLEFn(dpy, index, key, keysize, binary, + binarysize); +} + +EGLint TraceEGLApi::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, + EGLint limit, + EGLenum mode) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglProgramCacheResizeANGLE") + return egl_api_->eglProgramCacheResizeANGLEFn(dpy, limit, mode); +} + EGLenum TraceEGLApi::eglQueryAPIFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglQueryAPI") return egl_api_->eglQueryAPIFn(); @@ -1442,6 +1538,54 @@ return result; } +EGLint DebugEGLApi::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, + EGLenum attrib) { + GL_SERVICE_LOG("eglProgramCacheGetAttribANGLE" + << "(" << dpy << ", " << attrib << ")"); + EGLint result = egl_api_->eglProgramCacheGetAttribANGLEFn(dpy, attrib); + GL_SERVICE_LOG("GL_RESULT: " << result); + return result; +} + +void DebugEGLApi::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) { + GL_SERVICE_LOG("eglProgramCachePopulateANGLE" + << "(" << dpy << ", " << static_cast<const void*>(key) << ", " + << keysize << ", " << static_cast<const void*>(binary) << ", " + << binarysize << ")"); + egl_api_->eglProgramCachePopulateANGLEFn(dpy, key, keysize, binary, + binarysize); +} + +void DebugEGLApi::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) { + GL_SERVICE_LOG("eglProgramCacheQueryANGLE" + << "(" << dpy << ", " << index << ", " + << static_cast<const void*>(key) << ", " + << static_cast<const void*>(keysize) << ", " + << static_cast<const void*>(binary) << ", " + << static_cast<const void*>(binarysize) << ")"); + egl_api_->eglProgramCacheQueryANGLEFn(dpy, index, key, keysize, binary, + binarysize); +} + +EGLint DebugEGLApi::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, + EGLint limit, + EGLenum mode) { + GL_SERVICE_LOG("eglProgramCacheResizeANGLE" + << "(" << dpy << ", " << limit << ", " << mode << ")"); + EGLint result = egl_api_->eglProgramCacheResizeANGLEFn(dpy, limit, mode); + GL_SERVICE_LOG("GL_RESULT: " << result); + return result; +} + EGLenum DebugEGLApi::eglQueryAPIFn(void) { GL_SERVICE_LOG("eglQueryAPI" << "("
diff --git a/ui/gl/gl_bindings_autogen_egl.h b/ui/gl/gl_bindings_autogen_egl.h index b8099205..f054e57 100644 --- a/ui/gl/gl_bindings_autogen_egl.h +++ b/ui/gl/gl_bindings_autogen_egl.h
@@ -134,6 +134,25 @@ EGLint y, EGLint width, EGLint height); +typedef EGLint(GL_BINDING_CALL* eglProgramCacheGetAttribANGLEProc)( + EGLDisplay dpy, + EGLenum attrib); +typedef void(GL_BINDING_CALL* eglProgramCachePopulateANGLEProc)( + EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize); +typedef void(GL_BINDING_CALL* eglProgramCacheQueryANGLEProc)( + EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize); +typedef EGLint(GL_BINDING_CALL* eglProgramCacheResizeANGLEProc)(EGLDisplay dpy, + EGLint limit, + EGLenum mode); typedef EGLenum(GL_BINDING_CALL* eglQueryAPIProc)(void); typedef EGLBoolean(GL_BINDING_CALL* eglQueryContextProc)(EGLDisplay dpy, EGLContext ctx, @@ -210,6 +229,7 @@ struct ExtensionsEGL { bool b_EGL_EXT_platform_base; bool b_EGL_ANGLE_d3d_share_handle_client_buffer; + bool b_EGL_ANGLE_program_cache_control; bool b_EGL_ANGLE_query_surface_pointer; bool b_EGL_ANGLE_stream_producer_d3d_texture_nv12; bool b_EGL_ANGLE_surface_d3d_texture_2d_share_handle; @@ -264,6 +284,10 @@ eglInitializeProc eglInitializeFn; eglMakeCurrentProc eglMakeCurrentFn; eglPostSubBufferNVProc eglPostSubBufferNVFn; + eglProgramCacheGetAttribANGLEProc eglProgramCacheGetAttribANGLEFn; + eglProgramCachePopulateANGLEProc eglProgramCachePopulateANGLEFn; + eglProgramCacheQueryANGLEProc eglProgramCacheQueryANGLEFn; + eglProgramCacheResizeANGLEProc eglProgramCacheResizeANGLEFn; eglQueryAPIProc eglQueryAPIFn; eglQueryContextProc eglQueryContextFn; eglQueryStreamKHRProc eglQueryStreamKHRFn; @@ -400,6 +424,22 @@ EGLint y, EGLint width, EGLint height) = 0; + virtual EGLint eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, + EGLenum attrib) = 0; + virtual void eglProgramCachePopulateANGLEFn(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) = 0; + virtual void eglProgramCacheQueryANGLEFn(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) = 0; + virtual EGLint eglProgramCacheResizeANGLEFn(EGLDisplay dpy, + EGLint limit, + EGLenum mode) = 0; virtual EGLenum eglQueryAPIFn(void) = 0; virtual EGLBoolean eglQueryContextFn(EGLDisplay dpy, EGLContext ctx, @@ -509,6 +549,14 @@ #define eglInitialize ::gl::g_current_egl_context->eglInitializeFn #define eglMakeCurrent ::gl::g_current_egl_context->eglMakeCurrentFn #define eglPostSubBufferNV ::gl::g_current_egl_context->eglPostSubBufferNVFn +#define eglProgramCacheGetAttribANGLE \ + ::gl::g_current_egl_context->eglProgramCacheGetAttribANGLEFn +#define eglProgramCachePopulateANGLE \ + ::gl::g_current_egl_context->eglProgramCachePopulateANGLEFn +#define eglProgramCacheQueryANGLE \ + ::gl::g_current_egl_context->eglProgramCacheQueryANGLEFn +#define eglProgramCacheResizeANGLE \ + ::gl::g_current_egl_context->eglProgramCacheResizeANGLEFn #define eglQueryAPI ::gl::g_current_egl_context->eglQueryAPIFn #define eglQueryContext ::gl::g_current_egl_context->eglQueryContextFn #define eglQueryStreamKHR ::gl::g_current_egl_context->eglQueryStreamKHRFn
diff --git a/ui/gl/gl_image_dxgi.cc b/ui/gl/gl_image_dxgi.cc index a7ab19c..750ee867 100644 --- a/ui/gl/gl_image_dxgi.cc +++ b/ui/gl/gl_image_dxgi.cc
@@ -4,66 +4,77 @@ #include "ui/gl/gl_image_dxgi.h" +#include <d3d11_1.h> + #include "third_party/khronos/EGL/egl.h" #include "third_party/khronos/EGL/eglext.h" +#include "ui/gl/gl_angle_util_win.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_image.h" #include "ui/gl/gl_surface_egl.h" namespace gl { -GLImageDXGI::GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream) - : size_(size), stream_(stream) {} +GLImageDXGIBase::GLImageDXGIBase(const gfx::Size& size) : size_(size) {} // static -GLImageDXGI* GLImageDXGI::FromGLImage(GLImage* image) { +GLImageDXGIBase* GLImageDXGIBase::FromGLImage(GLImage* image) { if (!image || image->GetType() != Type::DXGI_IMAGE) return nullptr; - return static_cast<GLImageDXGI*>(image); + return static_cast<GLImageDXGIBase*>(image); } -gfx::Size GLImageDXGI::GetSize() { +gfx::Size GLImageDXGIBase::GetSize() { return size_; } -unsigned GLImageDXGI::GetInternalFormat() { +unsigned GLImageDXGIBase::GetInternalFormat() { return GL_BGRA_EXT; } +bool GLImageDXGIBase::BindTexImage(unsigned target) { + return false; +} + +void GLImageDXGIBase::ReleaseTexImage(unsigned target) {} + +bool GLImageDXGIBase::CopyTexImage(unsigned target) { + return false; +} + +bool GLImageDXGIBase::CopyTexSubImage(unsigned target, + const gfx::Point& offset, + const gfx::Rect& rect) { + return false; +} + +bool GLImageDXGIBase::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, + int z_order, + gfx::OverlayTransform transform, + const gfx::Rect& bounds_rect, + const gfx::RectF& crop_rect) { + return false; +} + +void GLImageDXGIBase::Flush() {} + +void GLImageDXGIBase::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, + uint64_t process_tracing_id, + const std::string& dump_name) {} + +GLImage::Type GLImageDXGIBase::GetType() const { + return Type::DXGI_IMAGE; +} + +GLImageDXGIBase::~GLImageDXGIBase() {} + +GLImageDXGI::GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream) + : GLImageDXGIBase(size), stream_(stream) {} + bool GLImageDXGI::BindTexImage(unsigned target) { return true; } -void GLImageDXGI::ReleaseTexImage(unsigned target) {} - -bool GLImageDXGI::CopyTexImage(unsigned target) { - return false; -} - -bool GLImageDXGI::CopyTexSubImage(unsigned target, - const gfx::Point& offset, - const gfx::Rect& rect) { - return false; -} - -bool GLImageDXGI::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, - int z_order, - gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, - const gfx::RectF& crop_rect) { - return false; -} - -void GLImageDXGI::Flush() {} - -void GLImageDXGI::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, - uint64_t process_tracing_id, - const std::string& dump_name) {} - -GLImage::Type GLImageDXGI::GetType() const { - return Type::DXGI_IMAGE; -} - void GLImageDXGI::SetTexture( const base::win::ScopedComPtr<ID3D11Texture2D>& texture, size_t level) { @@ -192,4 +203,34 @@ CopyingGLImageDXGI::~CopyingGLImageDXGI() {} +GLImageDXGIHandle::GLImageDXGIHandle(const gfx::Size& size, + base::win::ScopedHandle handle, + uint32_t level) + : GLImageDXGIBase(size), handle_(std::move(handle)) { + level_ = level; +} + +bool GLImageDXGIHandle::Initialize() { + base::win::ScopedComPtr<ID3D11Device> d3d11_device = + QueryD3D11DeviceObjectFromANGLE(); + if (!d3d11_device) + return false; + + base::win::ScopedComPtr<ID3D11Device1> d3d11_device1; + if (FAILED(d3d11_device.CopyTo(d3d11_device1.GetAddressOf()))) + return false; + + if (FAILED(d3d11_device1->OpenSharedResource1( + handle_.Get(), IID_PPV_ARGS(texture_.GetAddressOf())))) { + return false; + } + D3D11_TEXTURE2D_DESC desc; + texture_->GetDesc(&desc); + if (desc.Format != DXGI_FORMAT_NV12 || desc.ArraySize <= level_) + return false; + return true; +} + +GLImageDXGIHandle::~GLImageDXGIHandle() {} + } // namespace gl
diff --git a/ui/gl/gl_image_dxgi.h b/ui/gl/gl_image_dxgi.h index c6194610..4ea5d87 100644 --- a/ui/gl/gl_image_dxgi.h +++ b/ui/gl/gl_image_dxgi.h
@@ -5,6 +5,7 @@ #include <d3d11.h> #include "base/win/scoped_comptr.h" +#include "base/win/scoped_handle.h" #include "ui/gl/gl_export.h" #include "ui/gl/gl_image.h" @@ -12,12 +13,12 @@ namespace gl { -class GL_EXPORT GLImageDXGI : public GLImage { +class GL_EXPORT GLImageDXGIBase : public GLImage { public: - GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream); + GLImageDXGIBase(const gfx::Size& size); // Safe downcast. Returns nullptr on failure. - static GLImageDXGI* FromGLImage(GLImage* image); + static GLImageDXGIBase* FromGLImage(GLImage* image); // GLImage implementation. gfx::Size GetSize() override; @@ -39,23 +40,34 @@ const std::string& dump_name) override; Type GetType() const override; - void SetTexture(const base::win::ScopedComPtr<ID3D11Texture2D>& texture, - size_t level); - base::win::ScopedComPtr<ID3D11Texture2D> texture() { return texture_; } size_t level() const { return level_; } protected: - ~GLImageDXGI() override; + ~GLImageDXGIBase() override; gfx::Size size_; - EGLStreamKHR stream_; - base::win::ScopedComPtr<ID3D11Texture2D> texture_; size_t level_ = 0; }; +class GL_EXPORT GLImageDXGI : public GLImageDXGIBase { + public: + GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream); + + // GLImage implementation. + bool BindTexImage(unsigned target) override; + + void SetTexture(const base::win::ScopedComPtr<ID3D11Texture2D>& texture, + size_t level); + + protected: + ~GLImageDXGI() override; + + EGLStreamKHR stream_; +}; + // This copies to a new texture on bind. class GL_EXPORT CopyingGLImageDXGI : public GLImageDXGI { public: @@ -86,4 +98,18 @@ base::win::ScopedComPtr<ID3D11Texture2D> decoder_copy_texture_; base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view_; }; + +class GL_EXPORT GLImageDXGIHandle : public GLImageDXGIBase { + public: + GLImageDXGIHandle(const gfx::Size& size, + base::win::ScopedHandle handle, + uint32_t level); + + bool Initialize(); + + protected: + ~GLImageDXGIHandle() override; + + base::win::ScopedHandle handle_; +}; }
diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index 3c99f3b..435632bb 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc
@@ -194,7 +194,7 @@ // By default, just executing the SwapBuffers is normally enough. } -void GLSurface::SetRelyOnImplicitSync(bool rely_on_implicit_sync) { +void GLSurface::SetRelyOnImplicitSync() { NOTIMPLEMENTED(); } @@ -401,8 +401,8 @@ surface_->WaitForSnapshotRendering(); } -void GLSurfaceAdapter::SetRelyOnImplicitSync(bool rely_on_implicit_sync) { - surface_->SetRelyOnImplicitSync(rely_on_implicit_sync); +void GLSurfaceAdapter::SetRelyOnImplicitSync() { + surface_->SetRelyOnImplicitSync(); } GLSurfaceAdapter::~GLSurfaceAdapter() {}
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index c93a61e..5261d7c 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h
@@ -225,9 +225,8 @@ // calling this. virtual void WaitForSnapshotRendering(); - // Tells the surface to rely on implicit or explicit sync when swapping - // buffers. - virtual void SetRelyOnImplicitSync(bool rely_on_implicit_sync); + // Tells the surface to rely on implicit sync when swapping buffers. + virtual void SetRelyOnImplicitSync(); static GLSurface* GetCurrent(); @@ -302,7 +301,7 @@ bool SetDrawRectangle(const gfx::Rect& rect) override; gfx::Vector2d GetDrawOffset() const override; void WaitForSnapshotRendering() override; - void SetRelyOnImplicitSync(bool rely_on_implicit_sync) override; + void SetRelyOnImplicitSync() override; GLSurface* surface() const { return surface_.get(); }
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 191c729..b8a1ae1 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc
@@ -54,6 +54,13 @@ #define EGL_OPENGL_ES3_BIT 0x00000040 #endif +// Not present egl/eglext.h yet. + +#ifndef EGL_EXT_gl_colorspace_display_p3_linear +#define EGL_EXT_gl_colorspace_display_p3_linear 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ + // From ANGLE's egl/eglext.h. #ifndef EGL_ANGLE_platform_angle @@ -134,6 +141,8 @@ bool g_egl_surfaceless_context_supported = false; bool g_egl_surface_orientation_supported = false; bool g_egl_context_priority_supported = false; +bool g_egl_khr_colorspace = false; +bool g_egl_ext_colorspace_display_p3_linear = false; bool g_use_direct_composition = false; class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider { @@ -543,6 +552,9 @@ HasEGLExtension("EGL_ANGLE_window_fixed_size"); g_egl_surface_orientation_supported = HasEGLExtension("EGL_ANGLE_surface_orientation"); + g_egl_khr_colorspace = HasEGLExtension("EGL_KHR_gl_colorspace"); + g_egl_ext_colorspace_display_p3_linear = + HasEGLExtension("EGL_EXT_gl_colorspace_display_p3_linear"); // According to https://source.android.com/compatibility/android-cdd.html the // EGL_IMG_context_priority extension is mandatory for Virtual Reality High // Performance support, but due to a bug in Android Nougat the extension @@ -818,6 +830,29 @@ egl_window_attributes.push_back(EGL_TRUE); } + switch (format_.GetColorSpace()) { + case GLSurfaceFormat::COLOR_SPACE_UNSPECIFIED: + break; + case GLSurfaceFormat::COLOR_SPACE_SRGB: + // Note that COLORSPACE_LINEAR refers to the sRGB color space, but + // without opting into sRGB blending. It is equivalent to + // COLORSPACE_SRGB with Disable(FRAMEBUFFER_SRGB). + if (g_egl_khr_colorspace) { + egl_window_attributes.push_back(EGL_GL_COLORSPACE_KHR); + egl_window_attributes.push_back(EGL_GL_COLORSPACE_LINEAR_KHR); + } + break; + case GLSurfaceFormat::COLOR_SPACE_DISPLAY_P3: + // As above, COLORSPACE_DISPLAY_P3_LINEAR is equivalent to + // COLORSPACE_DISPLAY_P3 with Disable(FRAMEBUFFER_SRGB). + if (g_egl_khr_colorspace && g_egl_ext_colorspace_display_p3_linear) { + egl_window_attributes.push_back(EGL_GL_COLORSPACE_KHR); + egl_window_attributes.push_back( + EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT); + } + break; + } + egl_window_attributes.push_back(EGL_NONE); // Create a surface for the native window. surface_ = eglCreateWindowSurface(
diff --git a/ui/gl/gl_surface_format.cc b/ui/gl/gl_surface_format.cc index ff7f660..2e99157 100644 --- a/ui/gl/gl_surface_format.cc +++ b/ui/gl/gl_surface_format.cc
@@ -10,16 +10,16 @@ GLSurfaceFormat::GLSurfaceFormat() { } -GLSurfaceFormat::GLSurfaceFormat(SurfacePixelLayout layout) { - pixel_layout_ = layout; -} - GLSurfaceFormat::GLSurfaceFormat(const GLSurfaceFormat& other) = default; GLSurfaceFormat::~GLSurfaceFormat() { } -GLSurfaceFormat::SurfacePixelLayout GLSurfaceFormat::GetPixelLayout() { +GLSurfaceFormat::GLSurfaceFormat(SurfacePixelLayout layout) { + pixel_layout_ = layout; +} + +GLSurfaceFormat::SurfacePixelLayout GLSurfaceFormat::GetPixelLayout() const { return pixel_layout_; } @@ -44,7 +44,7 @@ return GetValue(num, 8); } -bool GLSurfaceFormat::IsCompatible(GLSurfaceFormat other) { +bool GLSurfaceFormat::IsCompatible(GLSurfaceFormat other) const { if (GetBitSize(red_bits_) == GetBitSize(other.red_bits_) && GetBitSize(green_bits_) == GetBitSize(other.green_bits_) && GetBitSize(blue_bits_) == GetBitSize(other.blue_bits_) && @@ -64,31 +64,19 @@ } } -int GLSurfaceFormat::GetDepthBits() { - return depth_bits_; -} - void GLSurfaceFormat::SetStencilBits(int bits) { if (bits != -1) { stencil_bits_ = bits; } } -int GLSurfaceFormat::GetStencilBits() { - return stencil_bits_; -} - void GLSurfaceFormat::SetSamples(int num) { if (num != -1) { samples_ = num; } } -int GLSurfaceFormat::GetSamples() { - return samples_; -} - -int GLSurfaceFormat::GetBufferSize() { +int GLSurfaceFormat::GetBufferSize() const { int bits = GetBitSize(red_bits_) + GetBitSize(green_bits_) + GetBitSize(blue_bits_) + GetBitSize(alpha_bits_); if (bits <= 16) {
diff --git a/ui/gl/gl_surface_format.h b/ui/gl/gl_surface_format.h index 27cda863..ec702fc 100644 --- a/ui/gl/gl_surface_format.h +++ b/ui/gl/gl_surface_format.h
@@ -41,7 +41,7 @@ // otherwise. For example, a pixel layout mismatch would be // considered incompatible. This comparison only makes sense within // the context of a single gl_surface subtype. - bool IsCompatible(GLSurfaceFormat other_format); + bool IsCompatible(GLSurfaceFormat other_format) const; // Default pixel format is RGBA8888. Use this method to select // a preference of RGB565. TODO(klausw): use individual setter @@ -50,25 +50,35 @@ // Other properties for future use. void SetDepthBits(int depth_bits); - int GetDepthBits(); + int GetDepthBits() const { return depth_bits_; } void SetStencilBits(int stencil_bits); - int GetStencilBits(); + int GetStencilBits() const { return stencil_bits_; } void SetSamples(int samples); - int GetSamples(); + int GetSamples() const { return samples_; } void SetDefaultPixelLayout(SurfacePixelLayout layout); + SurfacePixelLayout GetPixelLayout() const; - SurfacePixelLayout GetPixelLayout(); + enum SurfaceColorSpace { + COLOR_SPACE_UNSPECIFIED = -1, + COLOR_SPACE_SRGB, + COLOR_SPACE_DISPLAY_P3, + }; + void SetColorSpace(SurfaceColorSpace color_space) { + color_space_ = color_space; + } + SurfaceColorSpace GetColorSpace() const { return color_space_; } // Compute number of bits needed for storing one pixel, not // including any padding. At this point mainly used to distinguish // RGB565 (16) from RGBA8888 (32). - int GetBufferSize(); + int GetBufferSize() const; private: SurfacePixelLayout pixel_layout_ = PIXEL_LAYOUT_DONT_CARE; + SurfaceColorSpace color_space_ = COLOR_SPACE_UNSPECIFIED; int red_bits_ = -1; int green_bits_ = -1; int blue_bits_ = -1;
diff --git a/ui/gl/init/BUILD.gn b/ui/gl/init/BUILD.gn index dea64ed..bd43b3e 100644 --- a/ui/gl/init/BUILD.gn +++ b/ui/gl/init/BUILD.gn
@@ -49,6 +49,11 @@ ] libs = [ "OpenGL.framework" ] + } else if (is_fuchsia) { + sources += [ + "gl_factory_fuchsia.cc", + "gl_initializer_fuchsia.cc", + ] } else if (use_x11) { sources += [ "gl_factory_x11.cc",
diff --git a/ui/gl/init/gl_factory_fuchsia.cc b/ui/gl/init/gl_factory_fuchsia.cc new file mode 100644 index 0000000..9ec54533 --- /dev/null +++ b/ui/gl/init/gl_factory_fuchsia.cc
@@ -0,0 +1,45 @@ +// 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 "ui/gl/init/gl_factory.h" + +#include "ui/gl/gl_context.h" +#include "ui/gl/gl_surface.h" + +namespace gl { +namespace init { + +// TODO(fuchsia): Implement these functions. + +std::vector<GLImplementation> GetAllowedGLImplementations() { + NOTIMPLEMENTED(); + return std::vector<GLImplementation>(); +} + +bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { + NOTIMPLEMENTED(); + return false; +} + +scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, + GLSurface* compatible_surface, + const GLContextAttribs& attribs) { + NOTIMPLEMENTED(); + return nullptr; +} + +scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { + NOTIMPLEMENTED(); + return nullptr; +} + +scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( + const gfx::Size& size, + GLSurfaceFormat format) { + NOTIMPLEMENTED(); + return nullptr; +} + +} // namespace init +} // namespace gl
diff --git a/ui/gl/init/gl_initializer_fuchsia.cc b/ui/gl/init/gl_initializer_fuchsia.cc new file mode 100644 index 0000000..73d543d5 --- /dev/null +++ b/ui/gl/init/gl_initializer_fuchsia.cc
@@ -0,0 +1,31 @@ +// 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 "ui/gl/init/gl_initializer.h" + +namespace gl { +namespace init { + +// TODO(fuchsia): Implement these functions. + +bool InitializeGLOneOffPlatform() { + NOTIMPLEMENTED(); + return false; +} + +bool InitializeStaticGLBindings(GLImplementation implementation) { + NOTIMPLEMENTED(); + return false; +} + +void InitializeDebugGLBindings() { + NOTIMPLEMENTED(); +} + +void ShutdownGLPlatform() { + NOTIMPLEMENTED(); +} + +} // namespace init +} // namespace gl
diff --git a/ui/keyboard/DEPS b/ui/keyboard/DEPS index 172d08cb..d62e0c4 100644 --- a/ui/keyboard/DEPS +++ b/ui/keyboard/DEPS
@@ -1,14 +1,10 @@ include_rules = [ - "+content/public", - "+media/audio", "+ui/aura", "+ui/base", "+ui/compositor", "+ui/display", "+ui/events", "+ui/gfx", - "+ui/gl/test/gl_surface_test_support.h", # To initialize GL for tests. - "+ui/test", "+ui/ozone/public", "+ui/wm", ]
diff --git a/ui/keyboard/content/DEPS b/ui/keyboard/content/DEPS index e69de29..2bec7eb 100644 --- a/ui/keyboard/content/DEPS +++ b/ui/keyboard/content/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+content/public", + "+media/audio", +]
diff --git a/ui/keyboard/test/DEPS b/ui/keyboard/test/DEPS index c3a6969..8f43aa8 100644 --- a/ui/keyboard/test/DEPS +++ b/ui/keyboard/test/DEPS
@@ -1,5 +1,6 @@ specific_include_rules = { "run_all_unittests\.cc": [ "+mojo/edk/embedder", + "+ui/gl/test/gl_surface_test_support.h", ] -} \ No newline at end of file +}
diff --git a/ui/message_center/notification.cc b/ui/message_center/notification.cc index 4f49cf7..b3387f0 100644 --- a/ui/message_center/notification.cc +++ b/ui/message_center/notification.cc
@@ -68,7 +68,7 @@ const GURL& origin_url, const NotifierId& notifier_id, const RichNotificationData& optional_fields, - NotificationDelegate* delegate) + scoped_refptr<NotificationDelegate> delegate) : type_(type), id_(id), title_(title), @@ -81,7 +81,7 @@ optional_fields_(optional_fields), shown_as_popup_(false), is_read_(false), - delegate_(delegate) {} + delegate_(std::move(delegate)) {} Notification::Notification(const std::string& id, const Notification& other) : type_(other.type_),
diff --git a/ui/message_center/notification.h b/ui/message_center/notification.h index 3e9a1a8..b8277519 100644 --- a/ui/message_center/notification.h +++ b/ui/message_center/notification.h
@@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "base/time/time.h" #include "base/values.h" @@ -165,7 +166,7 @@ // |optional_fields|: Rich data that can be used to assign more elaborate // features to notifications. // |delegate|: Delegate that will influence the behaviour of this notification - // and receives events on its behalf. + // and receives events on its behalf. May be omitted. Notification(NotificationType type, const std::string& id, const base::string16& title, @@ -175,7 +176,7 @@ const GURL& origin_url, const NotifierId& notifier_id, const RichNotificationData& optional_fields, - NotificationDelegate* delegate); + scoped_refptr<NotificationDelegate> delegate); // Creates a copy of the |other| notification. The delegate, if any, will be // identical for both the Notification instances. The |id| of the notification
diff --git a/ui/message_center/views/notification_control_buttons_view.h b/ui/message_center/views/notification_control_buttons_view.h index 2dcf1d20..d1380234 100644 --- a/ui/message_center/views/notification_control_buttons_view.h +++ b/ui/message_center/views/notification_control_buttons_view.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_ +#define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_ + #include "base/macros.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/animation/animation_delegate.h" @@ -80,3 +83,5 @@ }; } // namespace message_center + +#endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc index 8f2b739..d8a440d7 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc
@@ -176,8 +176,8 @@ return config_; } -void GbmSurfaceless::SetRelyOnImplicitSync(bool rely_on_implicit_sync) { - rely_on_implicit_sync_ = rely_on_implicit_sync; +void GbmSurfaceless::SetRelyOnImplicitSync() { + rely_on_implicit_sync_ = true; } GbmSurfaceless::~GbmSurfaceless() {
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h index a12fcfa0..76def71 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
@@ -54,7 +54,7 @@ int height, const SwapCompletionCallback& callback) override; EGLConfig GetConfig() override; - void SetRelyOnImplicitSync(bool rely_on_implicit_sync) override; + void SetRelyOnImplicitSync() override; protected: ~GbmSurfaceless() override;
diff --git a/ui/views/accessibility/native_view_accessibility_auralinux.cc b/ui/views/accessibility/native_view_accessibility_auralinux.cc index a5af202b..e16ba4a9 100644 --- a/ui/views/accessibility/native_view_accessibility_auralinux.cc +++ b/ui/views/accessibility/native_view_accessibility_auralinux.cc
@@ -106,6 +106,8 @@ return nullptr; } + ui::AXPlatformNode* GetFromNodeID(int32_t id) override { return nullptr; } + gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override { return gfx::kNullAcceleratedWidget; }
diff --git a/ui/views/accessibility/native_view_accessibility_base.cc b/ui/views/accessibility/native_view_accessibility_base.cc index 191945f..49d1598 100644 --- a/ui/views/accessibility/native_view_accessibility_base.cc +++ b/ui/views/accessibility/native_view_accessibility_base.cc
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "ui/accessibility/platform/ax_platform_node.h" #include "ui/events/event_utils.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/controls/native/native_view_host.h" @@ -197,6 +198,10 @@ return focused_view ? focused_view->GetNativeViewAccessible() : nullptr; } +ui::AXPlatformNode* NativeViewAccessibilityBase::GetFromNodeID(int32_t id) { + return nullptr; +} + gfx::AcceleratedWidget NativeViewAccessibilityBase::GetTargetForNativeAccessibilityEvent() { return gfx::kNullAcceleratedWidget;
diff --git a/ui/views/accessibility/native_view_accessibility_base.h b/ui/views/accessibility/native_view_accessibility_base.h index 1ab6ea7..30097f4 100644 --- a/ui/views/accessibility/native_view_accessibility_base.h +++ b/ui/views/accessibility/native_view_accessibility_base.h
@@ -47,6 +47,7 @@ gfx::Rect GetScreenBoundsRect() const override; gfx::NativeViewAccessible HitTestSync(int x, int y) override; gfx::NativeViewAccessible GetFocus() override; + ui::AXPlatformNode* GetFromNodeID(int32_t id) override; gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; bool AccessibilityPerformAction(const ui::AXActionData& data) override; bool ShouldIgnoreHoveredStateForTesting() override;
diff --git a/ui/views/controls/animated_icon_view.cc b/ui/views/controls/animated_icon_view.cc index 055b327d..4cfd59b4 100644 --- a/ui/views/controls/animated_icon_view.cc +++ b/ui/views/controls/animated_icon_view.cc
@@ -21,6 +21,13 @@ AnimatedIconView::~AnimatedIconView() {} +void AnimatedIconView::SetColor(SkColor color) { + if (color_ != color) { + color_ = color; + UpdateStaticImage(); + } +} + void AnimatedIconView::Animate(State target) { SetState(target); if (!IsAnimating())
diff --git a/ui/views/controls/animated_icon_view.h b/ui/views/controls/animated_icon_view.h index eb493eacc..c3b5df2 100644 --- a/ui/views/controls/animated_icon_view.h +++ b/ui/views/controls/animated_icon_view.h
@@ -26,7 +26,7 @@ explicit AnimatedIconView(const gfx::VectorIcon& icon); ~AnimatedIconView() override; - void set_color(SkColor color) { color_ = color; } + void SetColor(SkColor color); // Animates to the end or start state. void Animate(State target);
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc index d46f89c2..10d1d04e 100644 --- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
@@ -38,6 +38,7 @@ OverlayScrollBar::Thumb::~Thumb() {} void OverlayScrollBar::Thumb::Init() { + EnableCanvasFlippingForRTLUI(true); SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); // Animate all changes to the layer except the first one. @@ -107,9 +108,10 @@ void OverlayScrollBar::Thumb::OnStateChanged() { if (GetState() == CustomButton::STATE_NORMAL) { gfx::Transform translation; + const int direction = base::i18n::IsRTL() ? -1 : 1; translation.Translate( - gfx::Vector2d(IsHorizontal() ? 0 : kThumbHoverOffset, - IsHorizontal() ? kThumbHoverOffset: 0)); + gfx::Vector2d(IsHorizontal() ? 0 : direction * kThumbHoverOffset, + IsHorizontal() ? kThumbHoverOffset : 0)); layer()->SetTransform(translation); layer()->SetOpacity(ui::kOverlayScrollbarThumbNormalAlpha);
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index ac2599a..ebd9b19 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc
@@ -689,6 +689,10 @@ event->SetHandled(); break; case ui::ET_GESTURE_TAP: + if (controller_ && controller_->HandleGestureEvent(this, *event)) { + event->SetHandled(); + return; + } if (event->details().tap_count() == 1) { // If tap is on the selection and touch handles are not present, handles // should be shown without changing selection. Otherwise, cursor should
diff --git a/ui/views/controls/textfield/textfield_controller.cc b/ui/views/controls/textfield/textfield_controller.cc index 1d90f3c0..bf5f964c 100644 --- a/ui/views/controls/textfield/textfield_controller.cc +++ b/ui/views/controls/textfield/textfield_controller.cc
@@ -19,6 +19,12 @@ return false; } +bool TextfieldController::HandleGestureEvent( + Textfield* sender, + const ui::GestureEvent& gesture_event) { + return false; +} + int TextfieldController::OnDrop(const ui::OSExchangeData& data) { return ui::DragDropTypes::DRAG_NONE; }
diff --git a/ui/views/controls/textfield/textfield_controller.h b/ui/views/controls/textfield/textfield_controller.h index 7dcffb9..f92e712 100644 --- a/ui/views/controls/textfield/textfield_controller.h +++ b/ui/views/controls/textfield/textfield_controller.h
@@ -14,6 +14,7 @@ namespace ui { class KeyEvent; class MouseEvent; +class GestureEvent; class SimpleMenuModel; } // namespace ui @@ -31,18 +32,24 @@ virtual void ContentsChanged(Textfield* sender, const base::string16& new_contents) {} - // This method is called to get notified about keystrokes in the edit. + // Called to get notified about keystrokes in the edit. // Returns true if the message was handled and should not be processed // further. If it returns false the processing continues. virtual bool HandleKeyEvent(Textfield* sender, const ui::KeyEvent& key_event); - // This method is called to get notified about mouse events in the edit. + // Called to get notified about mouse events in the edit. // Returns true if the message was handled and should not be processed // further. Currently, only mouse down events are sent here. virtual bool HandleMouseEvent(Textfield* sender, const ui::MouseEvent& mouse_event); + // Called to get notified about gesture events in the edit. + // Returns true if the message was handled and should not be processed + // further. Currently, only tap events are sent here. + virtual bool HandleGestureEvent(Textfield* sender, + const ui::GestureEvent& gesture_event); + // Called before performing a user action that may change the textfield. // It's currently only supported by Views implementation. virtual void OnBeforeUserAction(Textfield* sender) {}
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc index 1243127..c31728ca 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -376,8 +376,10 @@ // TODO(ccameron): Populate this based on this specific display. // http://crbug.com/735613 - display.set_color_space( - gfx::ICCProfile::FromBestMonitor().GetColorSpace()); + if (!display::Display::HasForceColorProfile()) { + display.set_color_space( + gfx::ICCProfile::FromBestMonitor().GetColorSpace()); + } displays.push_back(display); }
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 93451e7c..ef1fbbf 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
@@ -763,6 +763,13 @@ // would have raised an X error if the window is not mapped. auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp); + // At this point, we know we will receive focus, and some + // webdriver tests depend on a window being IsActive() immediately + // after an Activate(), so just set this state now. + has_pointer_focus_ = false; + has_window_focus_ = true; + // window_mapped_in_client_ == true based on the IsVisible() check above. + window_mapped_in_server_ = true; XSetErrorHandler(old_error_handler); } AfterActivationStateChanged();