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