OLD | NEW |
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 }; | 208 }; |
211 | 209 |
212 bool Send(IPC::Message* msg); | 210 bool Send(IPC::Message* msg); |
213 | 211 |
214 // Handler for sending over the paint event to the plugin. | 212 // Handler for sending over the paint event to the plugin. |
215 void OnPaint(const gfx::Rect& damaged_rect); | 213 void OnPaint(const gfx::Rect& damaged_rect); |
216 | 214 |
217 #if defined(OS_WIN) | 215 #if defined(OS_WIN) |
218 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, | 216 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, |
219 const gfx::Rect& window_rect, | 217 const gfx::Rect& window_rect, |
220 SkAutoTUnref<skia::PlatformCanvas>* canvas); | 218 SkAutoTUnref<SkCanvas>* canvas); |
221 #elif defined(OS_MACOSX) | 219 #elif defined(OS_MACOSX) |
222 static void CreateDIBAndCGContextFromHandle( | 220 static void CreateDIBAndCGContextFromHandle( |
223 const TransportDIB::Handle& dib_handle, | 221 const TransportDIB::Handle& dib_handle, |
224 const gfx::Rect& window_rect, | 222 const gfx::Rect& window_rect, |
225 scoped_ptr<TransportDIB>* dib_out, | 223 scoped_ptr<TransportDIB>* dib_out, |
226 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); | 224 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); |
227 #elif defined(USE_X11) | 225 #elif defined(USE_X11) |
228 static void CreateDIBAndCanvasFromHandle( | 226 static void CreateDIBAndCanvasFromHandle( |
229 const TransportDIB::Handle& dib_handle, | 227 const TransportDIB::Handle& dib_handle, |
230 const gfx::Rect& window_rect, | 228 const gfx::Rect& window_rect, |
231 scoped_refptr<SharedTransportDIB>* dib_out, | 229 scoped_refptr<SharedTransportDIB>* dib_out, |
232 SkAutoTUnref<skia::PlatformCanvas>* canvas); | 230 SkAutoTUnref<SkCanvas>* canvas); |
233 | 231 |
234 static void CreateShmPixmapFromDIB( | 232 static void CreateShmPixmapFromDIB( |
235 TransportDIB* dib, | 233 TransportDIB* dib, |
236 const gfx::Rect& window_rect, | 234 const gfx::Rect& window_rect, |
237 XID* pixmap_out); | 235 XID* pixmap_out); |
238 #endif | 236 #endif |
239 | 237 |
240 // Updates the shared memory sections where windowless plugins paint. | 238 // Updates the shared memory sections where windowless plugins paint. |
241 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, | 239 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, |
242 const TransportDIB::Handle& windowless_buffer1, | 240 const TransportDIB::Handle& windowless_buffer1, |
243 const TransportDIB::Handle& background_buffer, | 241 const TransportDIB::Handle& background_buffer, |
244 const gfx::Rect& window_rect); | 242 const gfx::Rect& window_rect); |
245 | 243 |
246 #if defined(OS_MACOSX) | 244 #if defined(OS_MACOSX) |
247 CGContextRef windowless_context() const { | 245 CGContextRef windowless_context() const { |
248 return windowless_contexts_[windowless_buffer_index_].get(); | 246 return windowless_contexts_[windowless_buffer_index_].get(); |
249 } | 247 } |
250 #else | 248 #else |
251 skia::PlatformCanvas* windowless_canvas() const { | 249 SkCanvas* windowless_canvas() const { |
252 return windowless_canvases_[windowless_buffer_index_].get(); | 250 return windowless_canvases_[windowless_buffer_index_].get(); |
253 } | 251 } |
254 | 252 |
255 #if defined(USE_X11) | 253 #if defined(USE_X11) |
256 XID windowless_shm_pixmap() const { | 254 XID windowless_shm_pixmap() const { |
257 return windowless_shm_pixmaps_[windowless_buffer_index_]; | 255 return windowless_shm_pixmaps_[windowless_buffer_index_]; |
258 } | 256 } |
259 #endif | 257 #endif |
260 | 258 |
261 #endif | 259 #endif |
(...skipping 19 matching lines...) Expand all Loading... |
281 // back-buffer at any given time. | 279 // back-buffer at any given time. |
282 bool transparent_; | 280 bool transparent_; |
283 int windowless_buffer_index_; | 281 int windowless_buffer_index_; |
284 #if defined(OS_MACOSX) | 282 #if defined(OS_MACOSX) |
285 scoped_ptr<TransportDIB> windowless_dibs_[2]; | 283 scoped_ptr<TransportDIB> windowless_dibs_[2]; |
286 scoped_ptr<TransportDIB> background_dib_; | 284 scoped_ptr<TransportDIB> background_dib_; |
287 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; | 285 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; |
288 base::mac::ScopedCFTypeRef<CGContextRef> background_context_; | 286 base::mac::ScopedCFTypeRef<CGContextRef> background_context_; |
289 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; | 287 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; |
290 #else | 288 #else |
291 SkAutoTUnref<skia::PlatformCanvas> windowless_canvases_[2]; | 289 SkAutoTUnref<SkCanvas> windowless_canvases_[2]; |
292 SkAutoTUnref<skia::PlatformCanvas> background_canvas_; | 290 SkAutoTUnref<SkCanvas> background_canvas_; |
293 | 291 |
294 #if defined(USE_X11) | 292 #if defined(USE_X11) |
295 scoped_refptr<SharedTransportDIB> windowless_dibs_[2]; | 293 scoped_refptr<SharedTransportDIB> windowless_dibs_[2]; |
296 scoped_refptr<SharedTransportDIB> background_dib_; | 294 scoped_refptr<SharedTransportDIB> background_dib_; |
297 // If we can use SHM pixmaps for windowless plugin painting or not. | 295 // If we can use SHM pixmaps for windowless plugin painting or not. |
298 bool use_shm_pixmap_; | 296 bool use_shm_pixmap_; |
299 // The SHM pixmaps for windowless plugin painting. | 297 // The SHM pixmaps for windowless plugin painting. |
300 XID windowless_shm_pixmaps_[2]; | 298 XID windowless_shm_pixmaps_[2]; |
301 #endif | 299 #endif |
302 | 300 |
303 #endif | 301 #endif |
304 | 302 |
305 // Contains the routing id of the host render view. | 303 // Contains the routing id of the host render view. |
306 int host_render_view_routing_id_; | 304 int host_render_view_routing_id_; |
307 | 305 |
308 base::WeakPtrFactory<WebPluginProxy> weak_factory_; | 306 base::WeakPtrFactory<WebPluginProxy> weak_factory_; |
309 }; | 307 }; |
310 | 308 |
311 } // namespace content | 309 } // namespace content |
312 | 310 |
313 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 311 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
OLD | NEW |