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

Side by Side Diff: chrome/renderer/webplugin_delegate_pepper.h

Issue 367002: Added Pepper 3D render context that instantiates the GPU plugin.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/webplugin_delegate_pepper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ 5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_
6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "app/gfx/native_widget_types.h" 14 #include "app/gfx/native_widget_types.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/linked_ptr.h" 16 #include "base/linked_ptr.h"
17 #include "base/gfx/rect.h" 17 #include "base/gfx/rect.h"
18 #include "base/ref_counted.h" 18 #include "base/ref_counted.h"
19 #include "base/scoped_ptr.h" 19 #include "base/scoped_ptr.h"
20 #include "base/task.h" 20 #include "base/task.h"
21 #include "base/weak_ptr.h"
21 #include "chrome/common/transport_dib.h" 22 #include "chrome/common/transport_dib.h"
23 #include "chrome/renderer/render_view.h"
24 #include "chrome/renderer/command_buffer_proxy.h"
22 #include "skia/ext/platform_canvas.h" 25 #include "skia/ext/platform_canvas.h"
23 #include "third_party/npapi/bindings/npapi.h" 26 #include "third_party/npapi/bindings/npapi.h"
24 #include "third_party/npapi/bindings/npapi_extensions.h" 27 #include "third_party/npapi/bindings/npapi_extensions.h"
25 #include "webkit/glue/webcursor.h" 28 #include "webkit/glue/webcursor.h"
26 #include "webkit/glue/webplugin_delegate.h" 29 #include "webkit/glue/webplugin_delegate.h"
27 30
28 namespace NPAPI { 31 namespace NPAPI {
29 class PluginInstance; 32 class PluginInstance;
30 } 33 }
31 34
32 // An implementation of WebPluginDelegate for Pepper in-process plugins. 35 // An implementation of WebPluginDelegate for Pepper in-process plugins.
33 class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { 36 class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
34 public: 37 public:
35 static WebPluginDelegatePepper* Create(const FilePath& filename, 38 static WebPluginDelegatePepper* Create(
36 const std::string& mime_type, gfx::PluginWindowHandle containing_view); 39 const FilePath& filename,
37 40 const std::string& mime_type,
38 static bool IsPluginDelegateWindow(gfx::NativeWindow window); 41 const base::WeakPtr<RenderView>& render_view,
39 static bool GetPluginNameFromWindow(gfx::NativeWindow window, 42 gfx::PluginWindowHandle containing_view);
40 std::wstring *plugin_name);
41
42 // Returns true if the window handle passed in is that of the dummy
43 // activation window for windowless plugins.
44 static bool IsDummyActivationWindow(gfx::NativeWindow window);
45 43
46 // WebPluginDelegate implementation 44 // WebPluginDelegate implementation
47 virtual bool Initialize(const GURL& url, 45 virtual bool Initialize(const GURL& url,
48 const std::vector<std::string>& arg_names, 46 const std::vector<std::string>& arg_names,
49 const std::vector<std::string>& arg_values, 47 const std::vector<std::string>& arg_values,
50 webkit_glue::WebPlugin* plugin, 48 webkit_glue::WebPlugin* plugin,
51 bool load_manually); 49 bool load_manually);
52 virtual void PluginDestroyed(); 50 virtual void PluginDestroyed();
53 virtual void UpdateGeometry(const gfx::Rect& window_rect, 51 virtual void UpdateGeometry(const gfx::Rect& window_rect,
54 const gfx::Rect& clip_rect); 52 const gfx::Rect& clip_rect);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int32 state, 109 int32 state,
112 int32 value); 110 int32 value);
113 virtual NPError Device3DGetStateContext(NPDeviceContext3D* context, 111 virtual NPError Device3DGetStateContext(NPDeviceContext3D* context,
114 int32 state, 112 int32 state,
115 int32* value); 113 int32* value);
116 virtual NPError Device3DFlushContext(NPP id, 114 virtual NPError Device3DFlushContext(NPP id,
117 NPDeviceContext3D* context, 115 NPDeviceContext3D* context,
118 NPDeviceFlushContextCallbackPtr callback, 116 NPDeviceFlushContextCallbackPtr callback,
119 void* user_data); 117 void* user_data);
120 virtual NPError Device3DDestroyContext(NPDeviceContext3D* context); 118 virtual NPError Device3DDestroyContext(NPDeviceContext3D* context);
119 virtual NPError Device3DCreateBuffer(NPDeviceContext3D* context,
120 size_t size,
121 int32* id);
122 virtual NPError Device3DDestroyBuffer(NPDeviceContext3D* context,
123 int32 id);
124 virtual NPError Device3DMapBuffer(NPDeviceContext3D* context,
125 int32 id,
126 NPDeviceBuffer* buffer);
121 // End of WebPluginDelegate implementation. 127 // End of WebPluginDelegate implementation.
122 128
123 bool IsWindowless() const { return true; }
124 gfx::Rect GetRect() const { return window_rect_; } 129 gfx::Rect GetRect() const { return window_rect_; }
125 gfx::Rect GetClipRect() const { return clip_rect_; } 130 gfx::Rect GetClipRect() const { return clip_rect_; }
126 131
127 // Returns the path for the library implementing this plugin. 132 // Returns the path for the library implementing this plugin.
128 FilePath GetPluginPath(); 133 FilePath GetPluginPath();
129 134
130 private: 135 private:
131 WebPluginDelegatePepper(gfx::PluginWindowHandle containing_view, 136 WebPluginDelegatePepper(
132 NPAPI::PluginInstance *instance); 137 const base::WeakPtr<RenderView>& render_view,
138 gfx::PluginWindowHandle containing_view,
139 NPAPI::PluginInstance *instance);
133 ~WebPluginDelegatePepper(); 140 ~WebPluginDelegatePepper();
134 141
135 // Tells the plugin about the current state of the window. 142 // Tells the plugin about the current state of the window.
136 // See NPAPI NPP_SetWindow for more information. 143 // See NPAPI NPP_SetWindow for more information.
137 void WindowlessSetWindow(bool force_set_window); 144 void WindowlessSetWindow(bool force_set_window);
138 145
139 //----------------------------------------- 146 //-----------------------------------------
140 // used for windowed and windowless plugins 147 // used for windowed and windowless plugins
141 148
142 NPAPI::PluginInstance* instance() { return instance_.get(); } 149 NPAPI::PluginInstance* instance() { return instance_.get(); }
143 150
144 // Closes down and destroys our plugin instance. 151 // Closes down and destroys our plugin instance.
145 void DestroyInstance(); 152 void DestroyInstance();
146 153
154 base::WeakPtr<RenderView> render_view_;
155
147 webkit_glue::WebPlugin* plugin_; 156 webkit_glue::WebPlugin* plugin_;
148 scoped_refptr<NPAPI::PluginInstance> instance_; 157 scoped_refptr<NPAPI::PluginInstance> instance_;
149 158
150 gfx::PluginWindowHandle parent_; 159 gfx::PluginWindowHandle parent_;
151 NPWindow window_; 160 NPWindow window_;
152 gfx::Rect window_rect_; 161 gfx::Rect window_rect_;
153 gfx::Rect clip_rect_; 162 gfx::Rect clip_rect_;
154 std::vector<gfx::Rect> cutout_rects_; 163 std::vector<gfx::Rect> cutout_rects_;
155 164
156 // Plugin graphics context implementation 165 // Plugin graphics context implementation
(...skipping 12 matching lines...) Expand all
169 // The canvas associated with the transport DIB, containing the mapped 178 // The canvas associated with the transport DIB, containing the mapped
170 // memory of the image. 179 // memory of the image.
171 scoped_ptr<skia::PlatformCanvas> canvas; 180 scoped_ptr<skia::PlatformCanvas> canvas;
172 }; 181 };
173 typedef std::map< void*, linked_ptr<OpenPaintContext> > OpenPaintContextMap; 182 typedef std::map< void*, linked_ptr<OpenPaintContext> > OpenPaintContextMap;
174 OpenPaintContextMap open_paint_contexts_; 183 OpenPaintContextMap open_paint_contexts_;
175 184
176 // The url with which the plugin was instantiated. 185 // The url with which the plugin was instantiated.
177 std::string plugin_url_; 186 std::string plugin_url_;
178 187
188 // The nested GPU plugin and its command buffer proxy.
189 WebPluginDelegateProxy* nested_delegate_;
190 #if defined(ENABLE_GPU)
191 scoped_ptr<CommandBufferProxy> command_buffer_;
192 #endif
193
179 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); 194 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper);
180 }; 195 };
181 196
182 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ 197 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/webplugin_delegate_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698