Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: content/renderer/browser_plugin/browser_plugin_texture_provider.h

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use the correct baseline Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin_texture_provider.h
diff --git a/content/renderer/browser_plugin/browser_plugin_texture_provider.h b/content/renderer/browser_plugin/browser_plugin_texture_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d75fbc16dbcd751299fb0763bb7bde7f01302fc
--- /dev/null
+++ b/content/renderer/browser_plugin/browser_plugin_texture_provider.h
@@ -0,0 +1,117 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H_
+#define CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "content/common/browser_plugin_info.h"
+#include "content/common/content_export.h"
+#include "ipc/ipc_forwarding_message_filter.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureProvider.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
+#include "ui/gfx/size.h"
+
+struct BrowserPluginMsg_UpdateRect_Params;
+
+class RenderViewImpl;
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace content {
+
+class BrowserPluginManager;
+
+class CONTENT_EXPORT BrowserPluginTextureProvider
+ : public WebKit::WebExternalTextureProvider,
+ public IPC::Sender {
+ public:
+ BrowserPluginTextureProvider(int instance_id,
+ int routing_id,
+ IPC::ChannelProxy* channel_proxy);
+
+ void Destroy();
+
+ void OnMessageReceived(const IPC::Message& message);
+ void OnBuffersSwapped(
+ int instance_id,
+ uint64 surface_id,
+ const BrowserPlugin_SwapInfo& info);
+ void OnSurfaceResize(int instance_id, const gfx::Size& size);
+
+ // virtual to allow for mocking
+ virtual void Resize(const gfx::Size& size);
+ virtual void SurfaceResize(const gfx::Size& size);
+ virtual void SetDelayedSwap(
+ uint64 surface_id,
+ const BrowserPlugin_SwapInfo& delayed_swap_info);
+
+ // WebExternalTextureProvider implementation
+ virtual void setTextureProviderClient(Client*);
+
+ virtual unsigned textureId() const OVERRIDE;
+ virtual bool premultipliedAlpha() const OVERRIDE;
+ virtual bool flipped() const OVERRIDE;
+ virtual WebKit::WebFloatRect uvRect() const OVERRIDE;
+
+ // IPC::Sender implementation
+ virtual bool Send(IPC::Message* message) OVERRIDE;
+
+ private:
+ friend class MockBrowserPluginTextureProvider;
+
+ virtual ~BrowserPluginTextureProvider();
+
+ void DestroyImpl();
+ void ResizeImpl(const gfx::Size& size);
+
+ void SetUpFilter();
+ void RemoveFilter();
+
+ // Used as the main thread callback to signal that we are attached to a
+ // client
+ static void SignalReady(int instance_id);
+
+ WebExternalTextureProvider::Client* client_;
+
+ // The texture ID we are currently providing
+ unsigned texture_id_;
+
+ scoped_refptr<IPC::ForwardingMessageFilter> filter_;
+
+ int instance_id_;
+
+ // If impl_loop_ is 0, we are working only on the main thread
+ scoped_refptr<base::MessageLoopProxy> main_loop_, impl_loop_;
+
+ // The IPC channel used by the renderer to communicate with the host.
+ // This is allowed to be 0 only in testing, when a derived class should
+ // override SetUpFilter, RemoveFilter, and Send, which are the only members
+ // allowed to use channel_proxy.
+ IPC::ChannelProxy* channel_proxy_;
+
+ int host_routing_id_;
+
+ // The size of the next texture update we will receive
+ gfx::Size texture_size_;
+
+ // The size of the container
+ gfx::Size container_size_;
+
+ // Information for performing a delayed buffer swap during startup
+ bool has_delayed_swap_;
+ BrowserPlugin_SwapInfo delayed_swap_info_;
+
+ // This lock is for when we may be updating the impl_loop_ member, which
+ // could trigger a switch between threaded and non-threaded. It is also
+ // used for setting a delayed swap, as that relies on shared state.
+ base::Lock lock_;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_WEB_BROWSER_PLUGIN_TEXTURE_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698