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

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

Issue 10855141: Fix race condition with windowless plugin buffers. The problem, which is already fixed for Mac, is … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 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 #if defined(USE_X11) 23 #if defined(USE_X11)
23 #include "ui/base/x/x11_util.h" 24 #include "ui/base/x/x11_util.h"
24 #endif 25 #endif
25 #include "ui/gl/gpu_preference.h" 26 #include "ui/gl/gpu_preference.h"
26 #include "ui/surface/transport_dib.h" 27 #include "ui/surface/transport_dib.h"
27 #include "webkit/plugins/npapi/webplugin.h" 28 #include "webkit/plugins/npapi/webplugin.h"
28 29
29 class PluginChannel; 30 class PluginChannel;
30 31
31 namespace skia { 32 namespace skia {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 201
201 private: 202 private:
202 bool Send(IPC::Message* msg); 203 bool Send(IPC::Message* msg);
203 204
204 // Handler for sending over the paint event to the plugin. 205 // Handler for sending over the paint event to the plugin.
205 void OnPaint(const gfx::Rect& damaged_rect); 206 void OnPaint(const gfx::Rect& damaged_rect);
206 207
207 #if defined(OS_WIN) 208 #if defined(OS_WIN)
208 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, 209 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle,
209 const gfx::Rect& window_rect, 210 const gfx::Rect& window_rect,
210 scoped_ptr<skia::PlatformCanvas>* canvas_out); 211 SkAutoTUnref<skia::PlatformCanvas>* canvas);
211 #elif defined(OS_MACOSX) 212 #elif defined(OS_MACOSX)
212 static void CreateDIBAndCGContextFromHandle( 213 static void CreateDIBAndCGContextFromHandle(
213 const TransportDIB::Handle& dib_handle, 214 const TransportDIB::Handle& dib_handle,
214 const gfx::Rect& window_rect, 215 const gfx::Rect& window_rect,
215 scoped_ptr<TransportDIB>* dib_out, 216 scoped_ptr<TransportDIB>* dib_out,
216 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); 217 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out);
217 #elif defined(USE_X11) 218 #elif defined(USE_X11)
218 static void CreateDIBAndCanvasFromHandle( 219 static void CreateDIBAndCanvasFromHandle(
219 const TransportDIB::Handle& dib_handle, 220 const TransportDIB::Handle& dib_handle,
220 const gfx::Rect& window_rect, 221 const gfx::Rect& window_rect,
221 scoped_ptr<TransportDIB>* dib_out, 222 scoped_ptr<TransportDIB>* dib_out,
222 scoped_ptr<skia::PlatformCanvas>* canvas_out); 223 SkAutoTUnref<skia::PlatformCanvas>* canvas);
223 224
224 static void CreateShmPixmapFromDIB( 225 static void CreateShmPixmapFromDIB(
225 TransportDIB* dib, 226 TransportDIB* dib,
226 const gfx::Rect& window_rect, 227 const gfx::Rect& window_rect,
227 XID* pixmap_out); 228 XID* pixmap_out);
228 #endif 229 #endif
229 230
230 // Updates the shared memory sections where windowless plugins paint. 231 // Updates the shared memory sections where windowless plugins paint.
231 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, 232 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0,
232 const TransportDIB::Handle& windowless_buffer1, 233 const TransportDIB::Handle& windowless_buffer1,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // back-buffer at any given time. 273 // back-buffer at any given time.
273 bool transparent_; 274 bool transparent_;
274 int windowless_buffer_index_; 275 int windowless_buffer_index_;
275 #if defined(OS_MACOSX) 276 #if defined(OS_MACOSX)
276 scoped_ptr<TransportDIB> windowless_dibs_[2]; 277 scoped_ptr<TransportDIB> windowless_dibs_[2];
277 scoped_ptr<TransportDIB> background_dib_; 278 scoped_ptr<TransportDIB> background_dib_;
278 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; 279 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2];
279 base::mac::ScopedCFTypeRef<CGContextRef> background_context_; 280 base::mac::ScopedCFTypeRef<CGContextRef> background_context_;
280 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; 281 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_;
281 #else 282 #else
282 scoped_ptr<skia::PlatformCanvas> windowless_canvases_[2]; 283 SkAutoTUnref<skia::PlatformCanvas> windowless_canvases_[2];
283 scoped_ptr<skia::PlatformCanvas> background_canvas_; 284 SkAutoTUnref<skia::PlatformCanvas> background_canvas_;
284 285
285 #if defined(USE_X11) 286 #if defined(USE_X11)
286 scoped_ptr<TransportDIB> windowless_dibs_[2]; 287 scoped_ptr<TransportDIB> windowless_dibs_[2];
287 scoped_ptr<TransportDIB> background_dib_; 288 scoped_ptr<TransportDIB> background_dib_;
288 // If we can use SHM pixmaps for windowless plugin painting or not. 289 // If we can use SHM pixmaps for windowless plugin painting or not.
289 bool use_shm_pixmap_; 290 bool use_shm_pixmap_;
290 // The SHM pixmaps for windowless plugin painting. 291 // The SHM pixmaps for windowless plugin painting.
291 XID windowless_shm_pixmaps_[2]; 292 XID windowless_shm_pixmaps_[2];
292 #endif 293 #endif
293 294
294 #endif 295 #endif
295 296
296 // Contains the routing id of the host render view. 297 // Contains the routing id of the host render view.
297 int host_render_view_routing_id_; 298 int host_render_view_routing_id_;
298 299
299 base::WeakPtrFactory<WebPluginProxy> weak_factory_; 300 base::WeakPtrFactory<WebPluginProxy> weak_factory_;
300 }; 301 };
301 302
302 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ 303 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698