1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_
8 #include "base/id_map.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "content/common/content_export.h"
13 namespace base
{ class SingleThreadTaskRunner
; }
15 namespace IPC
{ class Message
; }
18 class BrowserCompositorOutputSurface
;
20 // Directs vsync updates to the appropriate BrowserCompositorOutputSurface.
21 class CONTENT_EXPORT BrowserCompositorOutputSurfaceProxy
22 : public base::RefCountedThreadSafe
<BrowserCompositorOutputSurfaceProxy
> {
24 BrowserCompositorOutputSurfaceProxy(
25 IDMap
<BrowserCompositorOutputSurface
>* surface_map
);
27 // Call this before each OutputSurface is created to ensure that the
28 // proxy is connected to the current host.
29 void ConnectToGpuProcessHost(
30 base::SingleThreadTaskRunner
* compositor_thread_task_runner
);
33 friend class base::RefCountedThreadSafe
<BrowserCompositorOutputSurfaceProxy
>;
34 friend class SoftwareBrowserCompositorOutputSurface
;
35 ~BrowserCompositorOutputSurfaceProxy();
37 void OnMessageReceivedOnCompositorThread(const IPC::Message
& message
);
39 void OnUpdateVSyncParametersOnCompositorThread(int surface_id
,
40 base::TimeTicks timebase
,
41 base::TimeDelta interval
);
43 IDMap
<BrowserCompositorOutputSurface
>* surface_map_
;
44 int connected_to_gpu_process_host_id_
;
46 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurfaceProxy
);
49 } // namespace content
51 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_