diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 00:51:42 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 00:51:42 +0000 |
commit | 8c4b4db2734de7836eceeaa8e8d707dcef9c643c (patch) | |
tree | a8358c6c7ed410e2d100e6bd671a1f7ad6230b6b /content/browser/gpu/gpu_process_host.h | |
parent | 180b673452ca327d8d4309a8736d9274f8daec6e (diff) | |
download | chromium_src-8c4b4db2734de7836eceeaa8e8d707dcef9c643c.zip chromium_src-8c4b4db2734de7836eceeaa8e8d707dcef9c643c.tar.gz chromium_src-8c4b4db2734de7836eceeaa8e8d707dcef9c643c.tar.bz2 |
Implement frame subscription on Windows
This change applies RenderWidgetHostViewFrameSubscriber to
GpuProcessHost.
The route of doing this is as follows:
1. RenderWidgetHostViewBase
2. RenderProcessHostImpl
3. GpuMessageFilter
4. GpuProcessHost
Because frame swapping is deep down in GpuProcessHost new APIs are
added in each layer to pass the frame susbcriber. The frame
subscriber is owned by GpuMessageFilter and shared with GpuProcessHost.
GpuMessageFilter will apply the frame susbcriber to GpuProcessHost
again in case of a crash of GPU process and restart.
Added a unit test to verify frame subscription is executed properly.
BUG=174525
Review URL: https://chromiumcodereview.appspot.com/12658008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu/gpu_process_host.h')
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index 2655b36..d0e9b81 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -11,7 +11,9 @@ #include <string> #include "base/callback.h" +#include "base/hash_tables.h" #include "base/memory/linked_ptr.h" +#include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" #include "base/time.h" #include "content/common/content_export.h" @@ -39,6 +41,7 @@ struct ChannelHandle; namespace content { class BrowserChildProcessHostImpl; class GpuMainThread; +class RenderWidgetHostViewFrameSubscriber; class ShaderDiskCache; class GpuProcessHost : public BrowserChildProcessHostDelegate, @@ -123,6 +126,10 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, void ForceShutdown(); + void BeginFrameSubscription( + int surface_id, + base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); + void EndFrameSubscription(int surface_id); void LoadedShader(const std::string& key, const std::string& data); private: @@ -249,6 +256,13 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, bool uma_memory_stats_received_; GPUMemoryUmaStats uma_memory_stats_; + // This map of frame subscribers are listening for frame presentation events. + // The key is the surface id and value is the subscriber. + typedef base::hash_map<int, + base::WeakPtr<RenderWidgetHostViewFrameSubscriber> > + FrameSubscriberMap; + FrameSubscriberMap frame_subscribers_; + typedef std::map<int32, scoped_refptr<ShaderDiskCache> > ClientIdToShaderCacheMap; ClientIdToShaderCacheMap client_id_to_shader_cache_; |