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