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

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

Issue 11428099: Use skia::RefPtr in place of manual ref-counting for Skia types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « no previous file | 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 #include "skia/ext/refptr.h"
23 #include "third_party/skia/include/core/SkCanvas.h"
23 #if defined(USE_X11) 24 #if defined(USE_X11)
24 #include "ui/base/x/x11_util.h" 25 #include "ui/base/x/x11_util.h"
25 #endif 26 #endif
26 #include "ui/gl/gpu_preference.h" 27 #include "ui/gl/gpu_preference.h"
27 #include "ui/surface/transport_dib.h" 28 #include "ui/surface/transport_dib.h"
28 #include "webkit/plugins/npapi/webplugin.h" 29 #include "webkit/plugins/npapi/webplugin.h"
29 30
30 class SkCanvas;
31
32 namespace webkit { 31 namespace webkit {
33 namespace npapi { 32 namespace npapi {
34 class WebPluginDelegateImpl; 33 class WebPluginDelegateImpl;
35 } 34 }
36 } 35 }
37 36
38 namespace content { 37 namespace content {
39 class PluginChannel; 38 class PluginChannel;
40 39
41 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 }; 205 };
207 206
208 bool Send(IPC::Message* msg); 207 bool Send(IPC::Message* msg);
209 208
210 // Handler for sending over the paint event to the plugin. 209 // Handler for sending over the paint event to the plugin.
211 void OnPaint(const gfx::Rect& damaged_rect); 210 void OnPaint(const gfx::Rect& damaged_rect);
212 211
213 #if defined(OS_WIN) 212 #if defined(OS_WIN)
214 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, 213 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle,
215 const gfx::Rect& window_rect, 214 const gfx::Rect& window_rect,
216 SkAutoTUnref<SkCanvas>* canvas); 215 skia::RefPtr<SkCanvas>* canvas);
217 #elif defined(OS_MACOSX) 216 #elif defined(OS_MACOSX)
218 static void CreateDIBAndCGContextFromHandle( 217 static void CreateDIBAndCGContextFromHandle(
219 const TransportDIB::Handle& dib_handle, 218 const TransportDIB::Handle& dib_handle,
220 const gfx::Rect& window_rect, 219 const gfx::Rect& window_rect,
221 scoped_ptr<TransportDIB>* dib_out, 220 scoped_ptr<TransportDIB>* dib_out,
222 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); 221 base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out);
223 #elif defined(USE_X11) 222 #elif defined(USE_X11)
224 static void CreateDIBAndCanvasFromHandle( 223 static void CreateDIBAndCanvasFromHandle(
225 const TransportDIB::Handle& dib_handle, 224 const TransportDIB::Handle& dib_handle,
226 const gfx::Rect& window_rect, 225 const gfx::Rect& window_rect,
227 scoped_refptr<SharedTransportDIB>* dib_out, 226 scoped_refptr<SharedTransportDIB>* dib_out,
228 SkAutoTUnref<SkCanvas>* canvas); 227 skia::RefPtr<SkCanvas>* canvas);
229 228
230 static void CreateShmPixmapFromDIB( 229 static void CreateShmPixmapFromDIB(
231 TransportDIB* dib, 230 TransportDIB* dib,
232 const gfx::Rect& window_rect, 231 const gfx::Rect& window_rect,
233 XID* pixmap_out); 232 XID* pixmap_out);
234 #endif 233 #endif
235 234
236 // Updates the shared memory sections where windowless plugins paint. 235 // Updates the shared memory sections where windowless plugins paint.
237 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0, 236 void SetWindowlessBuffers(const TransportDIB::Handle& windowless_buffer0,
238 const TransportDIB::Handle& windowless_buffer1, 237 const TransportDIB::Handle& windowless_buffer1,
239 const gfx::Rect& window_rect); 238 const gfx::Rect& window_rect);
240 239
241 #if defined(OS_MACOSX) 240 #if defined(OS_MACOSX)
242 CGContextRef windowless_context() const { 241 CGContextRef windowless_context() const {
243 return windowless_contexts_[windowless_buffer_index_].get(); 242 return windowless_contexts_[windowless_buffer_index_].get();
244 } 243 }
245 #else 244 #else
246 SkCanvas* windowless_canvas() const { 245 skia::RefPtr<SkCanvas> windowless_canvas() const {
247 return windowless_canvases_[windowless_buffer_index_].get(); 246 return windowless_canvases_[windowless_buffer_index_];
248 } 247 }
249 248
250 #if defined(USE_X11) 249 #if defined(USE_X11)
251 XID windowless_shm_pixmap() const { 250 XID windowless_shm_pixmap() const {
252 return windowless_shm_pixmaps_[windowless_buffer_index_]; 251 return windowless_shm_pixmaps_[windowless_buffer_index_];
253 } 252 }
254 #endif 253 #endif
255 254
256 #endif 255 #endif
257 256
(...skipping 15 matching lines...) Expand all
273 // webplugin_delegate_proxy.h for how this works. The two sets of windowless_* 272 // webplugin_delegate_proxy.h for how this works. The two sets of windowless_*
274 // fields are for the front-buffer and back-buffer of a buffer flipping system 273 // fields are for the front-buffer and back-buffer of a buffer flipping system
275 // and windowless_buffer_index_ identifies which set we are using as the 274 // and windowless_buffer_index_ identifies which set we are using as the
276 // back-buffer at any given time. 275 // back-buffer at any given time.
277 int windowless_buffer_index_; 276 int windowless_buffer_index_;
278 #if defined(OS_MACOSX) 277 #if defined(OS_MACOSX)
279 scoped_ptr<TransportDIB> windowless_dibs_[2]; 278 scoped_ptr<TransportDIB> windowless_dibs_[2];
280 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; 279 base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2];
281 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; 280 scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_;
282 #else 281 #else
283 SkAutoTUnref<SkCanvas> windowless_canvases_[2]; 282 skia::RefPtr<SkCanvas> windowless_canvases_[2];
284 SkAutoTUnref<SkCanvas> background_canvas_; 283 skia::RefPtr<SkCanvas> background_canvas_;
285 284
286 #if defined(USE_X11) 285 #if defined(USE_X11)
287 scoped_refptr<SharedTransportDIB> windowless_dibs_[2]; 286 scoped_refptr<SharedTransportDIB> windowless_dibs_[2];
288 // If we can use SHM pixmaps for windowless plugin painting or not. 287 // If we can use SHM pixmaps for windowless plugin painting or not.
289 bool use_shm_pixmap_; 288 bool use_shm_pixmap_;
290 // The SHM pixmaps for windowless plugin painting. 289 // The SHM pixmaps for windowless plugin painting.
291 XID windowless_shm_pixmaps_[2]; 290 XID windowless_shm_pixmaps_[2];
292 #endif 291 #endif
293 292
294 #endif 293 #endif
295 294
296 // Contains the routing id of the host render view. 295 // Contains the routing id of the host render view.
297 int host_render_view_routing_id_; 296 int host_render_view_routing_id_;
298 297
299 base::WeakPtrFactory<WebPluginProxy> weak_factory_; 298 base::WeakPtrFactory<WebPluginProxy> weak_factory_;
300 }; 299 };
301 300
302 } // namespace content 301 } // namespace content
303 302
304 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ 303 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698