| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 
| 7 | 7 | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "cc/resources/ui_resource_bitmap.h" | 9 #include "cc/resources/ui_resource_bitmap.h" | 
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" | 
|  | 11 #include "gpu/ipc/common/surface_handle.h" | 
| 11 #include "ui/android/resources/ui_resource_provider.h" | 12 #include "ui/android/resources/ui_resource_provider.h" | 
| 12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" | 
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" | 
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" | 
| 15 | 16 | 
| 16 namespace cc { | 17 namespace cc { | 
|  | 18 class ContextProvider; | 
| 17 class Layer; | 19 class Layer; | 
| 18 } | 20 } | 
| 19 | 21 | 
|  | 22 namespace gpu { | 
|  | 23 namespace gles2 { | 
|  | 24 struct ContextCreationAttribHelper; | 
|  | 25 }  // namespace gles2 | 
|  | 26 | 
|  | 27 struct SharedMemoryLimits; | 
|  | 28 } | 
|  | 29 | 
| 20 namespace ui { | 30 namespace ui { | 
| 21 class ResourceManager; | 31 class ResourceManager; | 
| 22 class UIResourceProvider; | 32 class UIResourceProvider; | 
| 23 } | 33 } | 
| 24 | 34 | 
| 25 namespace content { | 35 namespace content { | 
| 26 class CompositorClient; | 36 class CompositorClient; | 
| 27 | 37 | 
| 28 // An interface to the browser-side compositor. | 38 // An interface to the browser-side compositor. | 
| 29 class CONTENT_EXPORT Compositor { | 39 class CONTENT_EXPORT Compositor { | 
| 30  public: | 40  public: | 
| 31   virtual ~Compositor() {} | 41   virtual ~Compositor() {} | 
| 32 | 42 | 
| 33   // Performs the global initialization needed before any compositor | 43   // Performs the global initialization needed before any compositor | 
| 34   // instance can be used. This should be called only once. | 44   // instance can be used. This should be called only once. | 
| 35   static void Initialize(); | 45   static void Initialize(); | 
| 36 | 46 | 
|  | 47   // Creates a GL context for the provided |handle|. If a null handle is passed, | 
|  | 48   // an offscreen context is created. | 
|  | 49   using ContextProviderCallback = | 
|  | 50       base::Callback<void(scoped_refptr<cc::ContextProvider>)>; | 
|  | 51   static void CreateContextProvider( | 
|  | 52       gpu::SurfaceHandle handle, | 
|  | 53       gpu::gles2::ContextCreationAttribHelper attributes, | 
|  | 54       gpu::SharedMemoryLimits shared_memory_limits, | 
|  | 55       ContextProviderCallback callback); | 
|  | 56 | 
| 37   // Creates and returns a compositor instance.  |root_window| needs to outlive | 57   // Creates and returns a compositor instance.  |root_window| needs to outlive | 
| 38   // the compositor as it manages callbacks on the compositor. | 58   // the compositor as it manages callbacks on the compositor. | 
| 39   static Compositor* Create(CompositorClient* client, | 59   static Compositor* Create(CompositorClient* client, | 
| 40                             gfx::NativeWindow root_window); | 60                             gfx::NativeWindow root_window); | 
| 41 | 61 | 
| 42   // Attaches the layer tree. | 62   // Attaches the layer tree. | 
| 43   virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; | 63   virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; | 
| 44 | 64 | 
| 45   // Set the output surface bounds. | 65   // Set the output surface bounds. | 
| 46   virtual void SetWindowBounds(const gfx::Size& size) = 0; | 66   virtual void SetWindowBounds(const gfx::Size& size) = 0; | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 61   // Returns the resource manager associated with the compositor. | 81   // Returns the resource manager associated with the compositor. | 
| 62   virtual ui::ResourceManager& GetResourceManager() = 0; | 82   virtual ui::ResourceManager& GetResourceManager() = 0; | 
| 63 | 83 | 
| 64  protected: | 84  protected: | 
| 65   Compositor() {} | 85   Compositor() {} | 
| 66 }; | 86 }; | 
| 67 | 87 | 
| 68 }  // namespace content | 88 }  // namespace content | 
| 69 | 89 | 
| 70 #endif  // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 90 #endif  // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 
| OLD | NEW | 
|---|