1 // Copyright (c) 2013 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_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_
6 #define CONTENT_BROWSER_AURA_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"
12 namespace base { class SingleThreadTaskRunner; }
14 namespace IPC { class Message; }
17 class BrowserCompositorOutputSurface;
19 // Directs vsync updates to the appropriate BrowserCompositorOutputSurface.
20 class BrowserCompositorOutputSurfaceProxy
21 : public base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy> {
23 BrowserCompositorOutputSurfaceProxy(
24 IDMap<BrowserCompositorOutputSurface>* surface_map);
26 // Call this before each OutputSurface is created to ensure that the
27 // proxy is connected to the current host.
28 void ConnectToGpuProcessHost(
29 base::SingleThreadTaskRunner* compositor_thread_task_runner);
32 friend class base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy>;
33 ~BrowserCompositorOutputSurfaceProxy();
35 void OnMessageReceivedOnCompositorThread(const IPC::Message& message);
37 void OnUpdateVSyncParametersOnCompositorThread(int surface_id,
38 base::TimeTicks timebase,
39 base::TimeDelta interval);
41 IDMap<BrowserCompositorOutputSurface>* surface_map_;
42 int connected_to_gpu_process_host_id_;
44 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurfaceProxy);
47 } // namespace content
49 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_