OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 class TextureLayer; | 16 class TextureLayer; |
17 } | 17 } |
18 | 18 |
19 namespace WebKit { | 19 namespace WebKit { |
20 class WebPluginContainer; | 20 class WebPluginContainer; |
21 class WebLayer; | 21 class WebLayer; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class CONTENT_EXPORT BrowserPluginCompositingHelper { | 26 class BrowserPluginManager; |
| 27 |
| 28 class CONTENT_EXPORT BrowserPluginCompositingHelper : |
| 29 public base::RefCounted<BrowserPluginCompositingHelper> { |
27 public: | 30 public: |
28 BrowserPluginCompositingHelper(WebKit::WebPluginContainer* container, | 31 BrowserPluginCompositingHelper(WebKit::WebPluginContainer* container, |
| 32 BrowserPluginManager* manager, |
29 int host_routing_id); | 33 int host_routing_id); |
30 ~BrowserPluginCompositingHelper(); | |
31 | |
32 void EnableCompositing(bool); | 34 void EnableCompositing(bool); |
| 35 void OnContainerDestroy(); |
33 void OnBuffersSwapped(const gfx::Size& size, | 36 void OnBuffersSwapped(const gfx::Size& size, |
34 const std::string& mailbox_name, | 37 const std::string& mailbox_name, |
35 int gpu_route_id, | 38 int gpu_route_id, |
36 int gpu_host_id); | 39 int gpu_host_id); |
37 void SetContainerSize(const gfx::Size&); | 40 void SetContainerSize(const gfx::Size&); |
38 | 41 protected: |
| 42 // Friend RefCounted so that the dtor can be non-public. |
| 43 friend class base::RefCounted<BrowserPluginCompositingHelper>; |
39 private: | 44 private: |
| 45 ~BrowserPluginCompositingHelper(); |
| 46 void FreeMailboxMemory(const std::string& mailbox_name); |
| 47 void MailboxReleased(const std::string& mailbox_name, |
| 48 int gpu_route_id, |
| 49 int gpu_host_id, |
| 50 unsigned sync_point); |
40 void UpdateUVRect(); | 51 void UpdateUVRect(); |
41 | 52 |
42 int host_routing_id_; | 53 int host_routing_id_; |
43 bool last_mailbox_valid_; | 54 bool last_mailbox_valid_; |
| 55 bool ack_pending_; |
44 | 56 |
45 gfx::Size buffer_size_; | 57 gfx::Size buffer_size_; |
46 gfx::Size container_size_; | 58 gfx::Size container_size_; |
47 | 59 |
48 scoped_refptr<cc::TextureLayer> texture_layer_; | 60 scoped_refptr<cc::TextureLayer> texture_layer_; |
49 scoped_ptr<WebKit::WebLayer> web_layer_; | 61 scoped_ptr<WebKit::WebLayer> web_layer_; |
50 WebKit::WebPluginContainer* container_; | 62 WebKit::WebPluginContainer* container_; |
| 63 |
| 64 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
51 }; | 65 }; |
52 | 66 |
53 } // namespace content | 67 } // namespace content |
54 | 68 |
55 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ | 69 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ |
OLD | NEW |