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

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: fix linux 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
« no previous file with comments | « content/browser/plugin_browsertest.cc ('k') | content/plugin/webplugin_proxy.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) 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 193
193 #if defined(OS_WIN) && !defined(USE_AURA) 194 #if defined(OS_WIN) && !defined(USE_AURA)
194 // Retrieves the IME status from a windowless plug-in and sends it to a 195 // Retrieves the IME status from a windowless plug-in and sends it to a
195 // renderer process. A renderer process will convert the coordinates from 196 // renderer process. A renderer process will convert the coordinates from
196 // local to the window coordinates and send the converted coordinates to a 197 // local to the window coordinates and send the converted coordinates to a
197 // browser process. 198 // browser process.
198 void UpdateIMEStatus(); 199 void UpdateIMEStatus();
199 #endif 200 #endif
200 201
201 private: 202 private:
203 class SharedTransportDIB : public base::RefCounted<SharedTransportDIB> {
204 public:
205 explicit SharedTransportDIB(TransportDIB* dib);
206 TransportDIB* dib() { return dib_.get(); }
207 private:
208 friend class base::RefCounted<SharedTransportDIB>;
209 ~SharedTransportDIB();
210
211 scoped_ptr<TransportDIB> dib_;
212 };
213
202 bool Send(IPC::Message* msg); 214 bool Send(IPC::Message* msg);
203 215
204 // Handler for sending over the paint event to the plugin. 216 // Handler for sending over the paint event to the plugin.
205 void OnPaint(const gfx::Rect& damaged_rect); 217 void OnPaint(const gfx::Rect& damaged_rect);
206 218
207 #if defined(OS_WIN) 219 #if defined(OS_WIN)
208 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, 220 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle,
209 const gfx::Rect& window_rect, 221 const gfx::Rect& window_rect,
210 scoped_ptr<skia::PlatformCanvas>* canvas_out); 222 SkAutoTUnref<skia::PlatformCanvas>* canvas);
211 #elif defined(OS_MACOSX) 223 #elif defined(OS_MACOSX)
212 static void CreateDIBAndCGContextFromHandle( 224 static void CreateDIBAndCGContextFromHandle(
213 const TransportDIB::Handle& dib_handle, 225 const TransportDIB::Handle& dib_handle,
214 const gfx::Rect& window_rect, 226 const gfx::Rect& window_rect,
215 scoped_ptr<TransportDIB>* dib_out, 227 scoped_ptr<TransportDIB>* dib_out,
216 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); 228 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out);
217 #elif defined(USE_X11) 229 #elif defined(USE_X11)
218 static void CreateDIBAndCanvasFromHandle( 230 static void CreateDIBAndCanvasFromHandle(
219 const TransportDIB::Handle& dib_handle, 231 const TransportDIB::Handle& dib_handle,
220 const gfx::Rect& window_rect, 232 const gfx::Rect& window_rect,
221 scoped_ptr<TransportDIB>* dib_out, 233 scoped_refptr<SharedTransportDIB>* dib_out,
222 scoped_ptr<skia::PlatformCanvas>* canvas_out); 234 SkAutoTUnref<skia::PlatformCanvas>* canvas);
223 235
224 static void CreateShmPixmapFromDIB( 236 static void CreateShmPixmapFromDIB(
225 TransportDIB* dib, 237 TransportDIB* dib,
226 const gfx::Rect& window_rect, 238 const gfx::Rect& window_rect,
227 XID* pixmap_out); 239 XID* pixmap_out);
228 #endif 240 #endif
229 241
230 // Updates the shared memory sections where windowless plugins paint. 242 // Updates the shared memory sections where windowless plugins paint.
231 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, 243 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0,
232 const TransportDIB::Handle& windowless_buffer1, 244 const TransportDIB::Handle& windowless_buffer1,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // back-buffer at any given time. 284 // back-buffer at any given time.
273 bool transparent_; 285 bool transparent_;
274 int windowless_buffer_index_; 286 int windowless_buffer_index_;
275 #if defined(OS_MACOSX) 287 #if defined(OS_MACOSX)
276 scoped_ptr<TransportDIB> windowless_dibs_[2]; 288 scoped_ptr<TransportDIB> windowless_dibs_[2];
277 scoped_ptr<TransportDIB> background_dib_; 289 scoped_ptr<TransportDIB> background_dib_;
278 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; 290 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2];
279 base::mac::ScopedCFTypeRef<CGContextRef> background_context_; 291 base::mac::ScopedCFTypeRef<CGContextRef> background_context_;
280 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; 292 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_;
281 #else 293 #else
282 scoped_ptr<skia::PlatformCanvas> windowless_canvases_[2]; 294 SkAutoTUnref<skia::PlatformCanvas> windowless_canvases_[2];
283 scoped_ptr<skia::PlatformCanvas> background_canvas_; 295 SkAutoTUnref<skia::PlatformCanvas> background_canvas_;
284 296
285 #if defined(USE_X11) 297 #if defined(USE_X11)
286 scoped_ptr<TransportDIB> windowless_dibs_[2]; 298 scoped_refptr<SharedTransportDIB> windowless_dibs_[2];
287 scoped_ptr<TransportDIB> background_dib_; 299 scoped_refptr<SharedTransportDIB> background_dib_;
288 // If we can use SHM pixmaps for windowless plugin painting or not. 300 // If we can use SHM pixmaps for windowless plugin painting or not.
289 bool use_shm_pixmap_; 301 bool use_shm_pixmap_;
290 // The SHM pixmaps for windowless plugin painting. 302 // The SHM pixmaps for windowless plugin painting.
291 XID windowless_shm_pixmaps_[2]; 303 XID windowless_shm_pixmaps_[2];
292 #endif 304 #endif
293 305
294 #endif 306 #endif
295 307
296 // Contains the routing id of the host render view. 308 // Contains the routing id of the host render view.
297 int host_render_view_routing_id_; 309 int host_render_view_routing_id_;
298 310
299 base::WeakPtrFactory<WebPluginProxy> weak_factory_; 311 base::WeakPtrFactory<WebPluginProxy> weak_factory_;
300 }; 312 };
301 313
302 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ 314 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
OLDNEW
« no previous file with comments | « content/browser/plugin_browsertest.cc ('k') | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698