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. 4 5 #ifndef CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 7 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" 12 13 namespace base { class SingleThreadTaskRunner; } 14 15 namespace IPC { class Message; } 16 17 namespace content { 18 class BrowserCompositorOutputSurface; 19 20 // Directs vsync updates to the appropriate BrowserCompositorOutputSurface. 21 class CONTENT_EXPORT BrowserCompositorOutputSurfaceProxy 22 : public base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy> { 23 public: 24 BrowserCompositorOutputSurfaceProxy( 25 IDMap<BrowserCompositorOutputSurface>* surface_map); 26 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); 31 32 private: 33 friend class base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy>; 34 friend class SoftwareBrowserCompositorOutputSurface; 35 ~BrowserCompositorOutputSurfaceProxy(); 36 37 void OnMessageReceivedOnCompositorThread(const IPC::Message& message); 38 39 void OnUpdateVSyncParametersOnCompositorThread(int surface_id, 40 base::TimeTicks timebase, 41 base::TimeDelta interval); 42 43 IDMap<BrowserCompositorOutputSurface>* surface_map_; 44 int connected_to_gpu_process_host_id_; 45 46 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurfaceProxy); 47 }; 48 49 } // namespace content 50 51 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 52