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

Side by Side Diff: content/plugin/webplugin_proxy.h

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_PLUGIN_WEBPLUGIN_PROXY_H_ 5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ 6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #include "base/mac/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
14 #endif 14 #endif
15 #include "base/memory/scoped_handle.h" 15 #include "base/memory/scoped_handle.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/shared_memory.h" 18 #include "base/shared_memory.h"
19 #include "base/timer.h" 19 #include "base/timer.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "ipc/ipc_message.h" 21 #include "ipc/ipc_message.h"
22 #include "third_party/skia/include/core/SkRefCnt.h" 22 #include "third_party/skia/include/core/SkRefCnt.h"
23 #if defined(USE_X11) 23 #if defined(USE_X11)
24 #include "ui/base/x/x11_util.h" 24 #include "ui/base/x/x11_util.h"
25 #endif 25 #endif
26 #include "ui/gl/gpu_preference.h" 26 #include "ui/gl/gpu_preference.h"
27 #include "ui/surface/transport_dib.h" 27 #include "ui/surface/transport_dib.h"
28 #include "webkit/plugins/npapi/webplugin.h" 28 #include "webkit/plugins/npapi/webplugin.h"
29 29
30 namespace skia { 30 class SkCanvas;
31 class PlatformCanvas;
32 }
33 31
34 namespace webkit { 32 namespace webkit {
35 namespace npapi { 33 namespace npapi {
36 class WebPluginDelegateImpl; 34 class WebPluginDelegateImpl;
37 } 35 }
38 } 36 }
39 37
40 namespace content { 38 namespace content {
41 class PluginChannel; 39 class PluginChannel;
42 40
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 }; 209 };
212 210
213 bool Send(IPC::Message* msg); 211 bool Send(IPC::Message* msg);
214 212
215 // Handler for sending over the paint event to the plugin. 213 // Handler for sending over the paint event to the plugin.
216 void OnPaint(const gfx::Rect& damaged_rect); 214 void OnPaint(const gfx::Rect& damaged_rect);
217 215
218 #if defined(OS_WIN) 216 #if defined(OS_WIN)
219 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, 217 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle,
220 const gfx::Rect& window_rect, 218 const gfx::Rect& window_rect,
221 SkAutoTUnref<skia::PlatformCanvas>* canvas); 219 SkAutoTUnref<SkCanvas>* canvas);
222 #elif defined(OS_MACOSX) 220 #elif defined(OS_MACOSX)
223 static void CreateDIBAndCGContextFromHandle( 221 static void CreateDIBAndCGContextFromHandle(
224 const TransportDIB::Handle& dib_handle, 222 const TransportDIB::Handle& dib_handle,
225 const gfx::Rect& window_rect, 223 const gfx::Rect& window_rect,
226 scoped_ptr<TransportDIB>* dib_out, 224 scoped_ptr<TransportDIB>* dib_out,
227 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); 225 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out);
228 #elif defined(USE_X11) 226 #elif defined(USE_X11)
229 static void CreateDIBAndCanvasFromHandle( 227 static void CreateDIBAndCanvasFromHandle(
230 const TransportDIB::Handle& dib_handle, 228 const TransportDIB::Handle& dib_handle,
231 const gfx::Rect& window_rect, 229 const gfx::Rect& window_rect,
232 scoped_refptr<SharedTransportDIB>* dib_out, 230 scoped_refptr<SharedTransportDIB>* dib_out,
233 SkAutoTUnref<skia::PlatformCanvas>* canvas); 231 SkAutoTUnref<SkCanvas>* canvas);
234 232
235 static void CreateShmPixmapFromDIB( 233 static void CreateShmPixmapFromDIB(
236 TransportDIB* dib, 234 TransportDIB* dib,
237 const gfx::Rect& window_rect, 235 const gfx::Rect& window_rect,
238 XID* pixmap_out); 236 XID* pixmap_out);
239 #endif 237 #endif
240 238
241 // Updates the shared memory sections where windowless plugins paint. 239 // Updates the shared memory sections where windowless plugins paint.
242 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, 240 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0,
243 const TransportDIB::Handle& windowless_buffer1, 241 const TransportDIB::Handle& windowless_buffer1,
244 const TransportDIB::Handle& background_buffer, 242 const TransportDIB::Handle& background_buffer,
245 const gfx::Rect& window_rect); 243 const gfx::Rect& window_rect);
246 244
247 #if defined(OS_MACOSX) 245 #if defined(OS_MACOSX)
248 CGContextRef windowless_context() const { 246 CGContextRef windowless_context() const {
249 return windowless_contexts_[windowless_buffer_index_].get(); 247 return windowless_contexts_[windowless_buffer_index_].get();
250 } 248 }
251 #else 249 #else
252 skia::PlatformCanvas* windowless_canvas() const { 250 SkCanvas* windowless_canvas() const {
253 return windowless_canvases_[windowless_buffer_index_].get(); 251 return windowless_canvases_[windowless_buffer_index_].get();
254 } 252 }
255 253
256 #if defined(USE_X11) 254 #if defined(USE_X11)
257 XID windowless_shm_pixmap() const { 255 XID windowless_shm_pixmap() const {
258 return windowless_shm_pixmaps_[windowless_buffer_index_]; 256 return windowless_shm_pixmaps_[windowless_buffer_index_];
259 } 257 }
260 #endif 258 #endif
261 259
262 #endif 260 #endif
(...skipping 20 matching lines...) Expand all
283 // back-buffer at any given time. 281 // back-buffer at any given time.
284 bool transparent_; 282 bool transparent_;
285 int windowless_buffer_index_; 283 int windowless_buffer_index_;
286 #if defined(OS_MACOSX) 284 #if defined(OS_MACOSX)
287 scoped_ptr<TransportDIB> windowless_dibs_[2]; 285 scoped_ptr<TransportDIB> windowless_dibs_[2];
288 scoped_ptr<TransportDIB> background_dib_; 286 scoped_ptr<TransportDIB> background_dib_;
289 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; 287 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2];
290 base::mac::ScopedCFTypeRef<CGContextRef> background_context_; 288 base::mac::ScopedCFTypeRef<CGContextRef> background_context_;
291 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; 289 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_;
292 #else 290 #else
293 SkAutoTUnref<skia::PlatformCanvas> windowless_canvases_[2]; 291 SkAutoTUnref<SkCanvas> windowless_canvases_[2];
294 SkAutoTUnref<skia::PlatformCanvas> background_canvas_; 292 SkAutoTUnref<SkCanvas> background_canvas_;
295 293
296 #if defined(USE_X11) 294 #if defined(USE_X11)
297 scoped_refptr<SharedTransportDIB> windowless_dibs_[2]; 295 scoped_refptr<SharedTransportDIB> windowless_dibs_[2];
298 scoped_refptr<SharedTransportDIB> background_dib_; 296 scoped_refptr<SharedTransportDIB> background_dib_;
299 // If we can use SHM pixmaps for windowless plugin painting or not. 297 // If we can use SHM pixmaps for windowless plugin painting or not.
300 bool use_shm_pixmap_; 298 bool use_shm_pixmap_;
301 // The SHM pixmaps for windowless plugin painting. 299 // The SHM pixmaps for windowless plugin painting.
302 XID windowless_shm_pixmaps_[2]; 300 XID windowless_shm_pixmaps_[2];
303 #endif 301 #endif
304 302
305 #endif 303 #endif
306 304
307 // Contains the routing id of the host render view. 305 // Contains the routing id of the host render view.
308 int host_render_view_routing_id_; 306 int host_render_view_routing_id_;
309 307
310 base::WeakPtrFactory<WebPluginProxy> weak_factory_; 308 base::WeakPtrFactory<WebPluginProxy> weak_factory_;
311 }; 309 };
312 310
313 } // namespace content 311 } // namespace content
314 312
315 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ 313 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698