From 2956c331e20ecb5d730d17fdf637ee72b6fd3a6c Mon Sep 17 00:00:00 2001 From: xlai Date: Fri, 25 Nov 2016 09:45:37 -0800 Subject: [PATCH] Allow Blink to generate cc::FrameSinkId from RenderThread This CL allows Blink to use generate cc::FrameSinkId, internally implemented using RenderThread's functions. Currently, Mus is working on making FrameSinkId being able to generated on Renderer process, getting rid of the need of IPC to browser just to get a FrameSinkId. By making this generation function available in Blink, this CL prepares for a refactoring effort on the current OffscreenCanvas.commit() workflow--it would facilitate simplification on CanvasSurfaceLayerBridge that will remove the current sync IPC that relies on the browser process to generate FrameSinkId (which is part of SurfaceId) for it. BUG=664547 Review-Url: https://codereview.chromium.org/2514323006 Cr-Commit-Position: refs/heads/master@{#434535} --- content/renderer/renderer_blink_platform_impl.cc | 5 +++++ content/renderer/renderer_blink_platform_impl.h | 1 + third_party/WebKit/public/platform/Platform.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index e3ef3573d521f9..6bdaa6c4e881e5 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -618,6 +618,11 @@ WebString RendererBlinkPlatformImpl::databaseCreateOriginIdentifier( WebSecurityOriginToGURL(origin))); } +cc::FrameSinkId RendererBlinkPlatformImpl::generateFrameSinkId() { + return cc::FrameSinkId(RenderThread::Get()->GetClientId(), + RenderThread::Get()->GenerateRoutingID()); +} + bool RendererBlinkPlatformImpl::isThreadedCompositingEnabled() { RenderThreadImpl* thread = RenderThreadImpl::current(); // thread can be NULL in tests. diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h index 278394646b62fe..15d386c960cdb9 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -114,6 +114,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { long long size) override; blink::WebString databaseCreateOriginIdentifier( const blink::WebSecurityOrigin& origin) override; + cc::FrameSinkId generateFrameSinkId() override; blink::WebString signedPublicKeyAndChallengeString( unsigned key_size_index, diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h index 747885a940b479..e8e786ffcf1456 100644 --- a/third_party/WebKit/public/platform/Platform.h +++ b/third_party/WebKit/public/platform/Platform.h @@ -55,6 +55,7 @@ #include "WebVector.h" #include "base/metrics/user_metrics_action.h" #include "cc/resources/shared_bitmap.h" +#include "cc/surfaces/frame_sink_id.h" class GrContext; @@ -321,6 +322,9 @@ class BLINK_PLATFORM_EXPORT Platform { // the process's process ID. virtual uint32_t getUniqueIdForProcess() { return 0; } + // Returns a unique FrameSinkID for the current renderer process + virtual cc::FrameSinkId generateFrameSinkId() { return cc::FrameSinkId(); } + // Message Ports ------------------------------------------------------- // Creates a Message Port Channel pair. This can be called on any thread.