OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "ppapi/host/host_message_context.h" | 11 #include "ppapi/host/host_message_context.h" |
12 #include "ppapi/host/resource_host.h" | 12 #include "ppapi/host/resource_host.h" |
13 #include "ppapi/shared_impl/compositor_layer_data.h" | 13 #include "ppapi/shared_impl/compositor_layer_data.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SharedMemory; | 16 class SharedMemory; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class Layer; | 20 class Layer; |
21 class SharedBitmap; | 21 class SharedBitmap; |
22 } // namespace cc | 22 } // namespace cc |
23 | 23 |
| 24 namespace gpu { |
| 25 struct SyncToken; |
| 26 } // namespace gpu |
| 27 |
24 namespace content { | 28 namespace content { |
25 | 29 |
26 class PepperPluginInstanceImpl; | 30 class PepperPluginInstanceImpl; |
27 class RendererPpapiHost; | 31 class RendererPpapiHost; |
28 | 32 |
29 class PepperCompositorHost : public ppapi::host::ResourceHost { | 33 class PepperCompositorHost : public ppapi::host::ResourceHost { |
30 public: | 34 public: |
31 PepperCompositorHost(RendererPpapiHost* host, | 35 PepperCompositorHost(RendererPpapiHost* host, |
32 PP_Instance instance, | 36 PP_Instance instance, |
33 PP_Resource resource); | 37 PP_Resource resource); |
34 // Associates this device with the given plugin instance. You can pass NULL | 38 // Associates this device with the given plugin instance. You can pass NULL |
35 // to clear the existing device. Returns true on success. In this case, a | 39 // to clear the existing device. Returns true on success. In this case, a |
36 // repaint of the page will also be scheduled. Failure means that the device | 40 // repaint of the page will also be scheduled. Failure means that the device |
37 // is already bound to a different instance, and nothing will happen. | 41 // is already bound to a different instance, and nothing will happen. |
38 bool BindToInstance(PepperPluginInstanceImpl* new_instance); | 42 bool BindToInstance(PepperPluginInstanceImpl* new_instance); |
39 | 43 |
40 const scoped_refptr<cc::Layer> layer() { return layer_; }; | 44 const scoped_refptr<cc::Layer> layer() { return layer_; }; |
41 | 45 |
42 void ViewInitiatedPaint(); | 46 void ViewInitiatedPaint(); |
43 | 47 |
44 private: | 48 private: |
45 ~PepperCompositorHost() override; | 49 ~PepperCompositorHost() override; |
46 | 50 |
47 void ImageReleased(int32_t id, | 51 void ImageReleased(int32_t id, |
48 scoped_ptr<base::SharedMemory> shared_memory, | 52 scoped_ptr<base::SharedMemory> shared_memory, |
49 scoped_ptr<cc::SharedBitmap> bitmap, | 53 scoped_ptr<cc::SharedBitmap> bitmap, |
50 uint32_t sync_point, | 54 const gpu::SyncToken& sync_token, |
51 bool is_lost); | 55 bool is_lost); |
52 void ResourceReleased(int32_t id, | 56 void ResourceReleased(int32_t id, |
53 uint32_t sync_point, | 57 const gpu::SyncToken& sync_token, |
54 bool is_lost); | 58 bool is_lost); |
55 void SendCommitLayersReplyIfNecessary(); | 59 void SendCommitLayersReplyIfNecessary(); |
56 void UpdateLayer(const scoped_refptr<cc::Layer>& layer, | 60 void UpdateLayer(const scoped_refptr<cc::Layer>& layer, |
57 const ppapi::CompositorLayerData* old_layer, | 61 const ppapi::CompositorLayerData* old_layer, |
58 const ppapi::CompositorLayerData* new_layer, | 62 const ppapi::CompositorLayerData* new_layer, |
59 scoped_ptr<base::SharedMemory> image_shm); | 63 scoped_ptr<base::SharedMemory> image_shm); |
60 | 64 |
61 // ResourceMessageHandler overrides: | 65 // ResourceMessageHandler overrides: |
62 int32_t OnResourceMessageReceived( | 66 int32_t OnResourceMessageReceived( |
63 const IPC::Message& msg, | 67 const IPC::Message& msg, |
(...skipping 30 matching lines...) Expand all Loading... |
94 ppapi::host::ReplyMessageContext commit_layers_reply_context_; | 98 ppapi::host::ReplyMessageContext commit_layers_reply_context_; |
95 | 99 |
96 base::WeakPtrFactory<PepperCompositorHost> weak_factory_; | 100 base::WeakPtrFactory<PepperCompositorHost> weak_factory_; |
97 | 101 |
98 DISALLOW_COPY_AND_ASSIGN(PepperCompositorHost); | 102 DISALLOW_COPY_AND_ASSIGN(PepperCompositorHost); |
99 }; | 103 }; |
100 | 104 |
101 } // namespace content | 105 } // namespace content |
102 | 106 |
103 #endif // CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ | 107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_HOST_H_ |
OLD | NEW |