1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// Copyright 2014 The Chromium Authors. All rights reserved. 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// Use of this source code is governed by a BSD-style license that can be 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// found in the LICENSE file. 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com#ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com#define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com#include "base/id_map.h" 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/memory/ref_counted.h" 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "base/time/time.h" 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "content/common/content_export.h" 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comnamespace base { class SingleThreadTaskRunner; } 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comnamespace IPC { class Message; } 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comnamespace content { 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass BrowserCompositorOutputSurface; 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// Directs vsync updates to the appropriate BrowserCompositorOutputSurface. 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass CONTENT_EXPORT BrowserCompositorOutputSurfaceProxy 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com : public base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy> { 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com public: 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com BrowserCompositorOutputSurfaceProxy( 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com IDMap<BrowserCompositorOutputSurface>* surface_map); 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // Call this before each OutputSurface is created to ensure that the 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // proxy is connected to the current host. 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void ConnectToGpuProcessHost( 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com base::SingleThreadTaskRunner* compositor_thread_task_runner); 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com private: 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com friend class base::RefCountedThreadSafe<BrowserCompositorOutputSurfaceProxy>; 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com friend class SoftwareBrowserCompositorOutputSurface; 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com ~BrowserCompositorOutputSurfaceProxy(); 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void OnMessageReceivedOnCompositorThread(const IPC::Message& message); 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void OnUpdateVSyncParametersOnCompositorThread(int surface_id, 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com base::TimeTicks timebase, 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com base::TimeDelta interval); 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com IDMap<BrowserCompositorOutputSurface>* surface_map_; 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int connected_to_gpu_process_host_id_; 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurfaceProxy); 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} // namespace content 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com