| 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 CONTENT_EXPORT BrowserPluginCompositingHelper : |
| 27 public base::RefCounted<BrowserPluginCompositingHelper> { |
| 27 public: | 28 public: |
| 28 BrowserPluginCompositingHelper(WebKit::WebPluginContainer* container, | 29 BrowserPluginCompositingHelper(WebKit::WebPluginContainer* container, |
| 29 int host_routing_id); | 30 int host_routing_id); |
| 30 ~BrowserPluginCompositingHelper(); | |
| 31 | |
| 32 void EnableCompositing(bool); | 31 void EnableCompositing(bool); |
| 32 void OnContainerDestroy(); |
| 33 void OnBuffersSwapped(const gfx::Size& size, | 33 void OnBuffersSwapped(const gfx::Size& size, |
| 34 const std::string& mailbox_name, | 34 const std::string& mailbox_name, |
| 35 int gpu_route_id, | 35 int gpu_route_id, |
| 36 int gpu_host_id); | 36 int gpu_host_id); |
| 37 void SetContainerSize(const gfx::Size&); | 37 void SetContainerSize(const gfx::Size&); |
| 38 | 38 protected: |
| 39 // Friend RefCounted so that the dtor can be non-public. |
| 40 friend class base::RefCounted<BrowserPluginCompositingHelper>; |
| 39 private: | 41 private: |
| 42 ~BrowserPluginCompositingHelper(); |
| 43 void FreeMailboxMemory(const std::string& mailbox_name); |
| 44 void MailboxReleased(const std::string& mailbox_name, |
| 45 int gpu_route_id, |
| 46 int gpu_host_id, |
| 47 unsigned sync_point); |
| 40 void UpdateUVRect(); | 48 void UpdateUVRect(); |
| 41 | 49 |
| 42 int host_routing_id_; | 50 int host_routing_id_; |
| 43 bool last_mailbox_valid_; | 51 bool last_mailbox_valid_; |
| 52 bool ack_pending_; |
| 44 | 53 |
| 45 gfx::Size buffer_size_; | 54 gfx::Size buffer_size_; |
| 46 gfx::Size container_size_; | 55 gfx::Size container_size_; |
| 47 | 56 |
| 48 scoped_refptr<cc::TextureLayer> texture_layer_; | 57 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 49 scoped_ptr<WebKit::WebLayer> web_layer_; | 58 scoped_ptr<WebKit::WebLayer> web_layer_; |
| 50 WebKit::WebPluginContainer* container_; | 59 WebKit::WebPluginContainer* container_; |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 } // namespace content | 62 } // namespace content |
| 54 | 63 |
| 55 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ | 64 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_HELPER_H_ |
| OLD | NEW |