Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H_ | |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/synchronization/lock.h" | |
| 10 #include "content/common/browser_plugin_info.h" | |
| 11 #include "ipc/ipc_forwarding_message_filter.h" | |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureP rovider.h" | |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | |
| 14 #include "ui/gfx/size.h" | |
| 15 | |
| 16 struct BrowserPluginMsg_UpdateRect_Params; | |
| 17 | |
| 18 class RenderViewImpl; | |
| 19 | |
| 20 namespace base { | |
| 21 | |
| 22 class MessageLoopProxy; | |
| 23 | |
| 24 } | |
| 25 | |
| 26 namespace content { | |
| 27 | |
| 28 class BrowserPluginManager; | |
| 29 | |
| 30 class BrowserPluginTextureProvider : public WebKit::WebExternalTextureProvider { | |
| 31 public: | |
| 32 BrowserPluginTextureProvider(int instance_id, RenderViewImpl* render_view); | |
| 33 void Destroy(); | |
| 34 | |
| 35 virtual void setTextureProviderClient(Client*); | |
| 36 | |
| 37 virtual unsigned textureId() const OVERRIDE; | |
| 38 virtual bool premultipliedAlpha() const OVERRIDE; | |
| 39 virtual bool flipped() const OVERRIDE; | |
| 40 virtual WebKit::WebFloatRect uvRect() const OVERRIDE; | |
| 41 | |
| 42 void OnMessageReceived(const IPC::Message& message); | |
| 43 void OnBuffersSwapped( | |
| 44 int instance_id, | |
| 45 uint64 surface_id, | |
| 46 const BrowserPlugin_SwapInfo& info); | |
| 47 void OnSurfaceResize(int instance_id, const gfx::Size& size); | |
| 48 | |
| 49 void Resize(const gfx::Size& size); | |
| 50 void SurfaceResize(const gfx::Size& size); | |
| 51 void SetDelayedSwap( | |
| 52 uint64 surface_id, | |
| 53 const BrowserPlugin_SwapInfo& delayed_swap_info); | |
| 54 | |
| 55 private: | |
| 56 virtual ~BrowserPluginTextureProvider(); | |
| 57 void DestroyImpl(); | |
| 58 | |
| 59 void ResizeImpl(const gfx::Size& size); | |
| 60 | |
| 61 static void SignalReady(int instance_id); | |
| 62 | |
| 63 WebExternalTextureProvider::Client* client_; | |
| 64 unsigned texture_id_; | |
| 65 scoped_refptr<IPC::ForwardingMessageFilter> filter_; | |
| 66 int instance_id_; | |
| 67 // If impl_loop_ is 0, we are working only on the main thread. | |
| 68 scoped_refptr<base::MessageLoopProxy> main_loop_, impl_loop_; | |
| 69 IPC::ChannelProxy* channel_proxy_; | |
| 70 RenderViewImpl* render_view_; | |
| 71 gfx::Size texture_size_, size_; | |
| 72 bool has_delayed_swap_; | |
| 73 BrowserPlugin_SwapInfo delayed_swap_info_; | |
| 74 // This lock is for when we may be updating the impl_loop_ member, which | |
| 75 // could trigger a switch between threaded and non-threaded. It is also | |
| 76 // used for setting a delayed swap. | |
| 77 base::Lock lock_; | |
|
scshunt
2012/08/12 01:42:45
Some whitespace here would be nice.
scshunt
2012/08/17 17:30:28
Done.
| |
| 78 }; | |
| 79 | |
| 80 } // namespace content | |
| 81 | |
| 82 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H _ | |
| OLD | NEW |