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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_mac.h

Issue 334173006: Clean up GLSurfaceCGL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 6 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
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_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <vector> 10 #include <vector>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // RenderWidgetHostViewCocoa for blitting the IOSurface. 45 // RenderWidgetHostViewCocoa for blitting the IOSurface.
46 class CompositingIOSurfaceMac 46 class CompositingIOSurfaceMac
47 : public base::RefCounted<CompositingIOSurfaceMac> { 47 : public base::RefCounted<CompositingIOSurfaceMac> {
48 public: 48 public:
49 // Returns NULL if IOSurface or GL API calls fail. 49 // Returns NULL if IOSurface or GL API calls fail.
50 static scoped_refptr<CompositingIOSurfaceMac> Create(); 50 static scoped_refptr<CompositingIOSurfaceMac> Create();
51 51
52 // Set IOSurface that will be drawn on the next NSView drawRect. 52 // Set IOSurface that will be drawn on the next NSView drawRect.
53 bool SetIOSurfaceWithContextCurrent( 53 bool SetIOSurfaceWithContextCurrent(
54 scoped_refptr<CompositingIOSurfaceContext> current_context, 54 scoped_refptr<CompositingIOSurfaceContext> current_context,
55 uint64 io_surface_handle, 55 IOSurfaceID io_surface_handle,
56 const gfx::Size& size, 56 const gfx::Size& size,
57 float scale_factor) WARN_UNUSED_RESULT; 57 float scale_factor) WARN_UNUSED_RESULT;
58 58
59 // Get the CGL renderer ID currently associated with this context. 59 // Get the CGL renderer ID currently associated with this context.
60 int GetRendererID(); 60 int GetRendererID();
61 61
62 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs, 62 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs,
63 // with the origin in the lower left corner. If the window rect's size is 63 // with the origin in the lower left corner. If the window rect's size is
64 // larger than the IOSurface, the remaining right and bottom edges will be 64 // larger than the IOSurface, the remaining right and bottom edges will be
65 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. 65 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // GL context (if multiple visible windows are using the same GL context 210 // GL context (if multiple visible windows are using the same GL context
211 // then call to setView call can stall and prevent reaching 60fps). 211 // then call to setView call can stall and prevent reaching 60fps).
212 void SwitchToContextOnNewWindow(NSView* view, 212 void SwitchToContextOnNewWindow(NSView* view,
213 int window_number); 213 int window_number);
214 214
215 // Returns true if IOSurface is ready to render. False otherwise. 215 // Returns true if IOSurface is ready to render. False otherwise.
216 bool MapIOSurfaceToTextureWithContextCurrent( 216 bool MapIOSurfaceToTextureWithContextCurrent(
217 const scoped_refptr<CompositingIOSurfaceContext>& current_context, 217 const scoped_refptr<CompositingIOSurfaceContext>& current_context,
218 const gfx::Size pixel_size, 218 const gfx::Size pixel_size,
219 float scale_factor, 219 float scale_factor,
220 uint64 io_surface_handle) WARN_UNUSED_RESULT; 220 IOSurfaceID io_surface_handle) WARN_UNUSED_RESULT;
221 221
222 void UnrefIOSurfaceWithContextCurrent(); 222 void UnrefIOSurfaceWithContextCurrent();
223 223
224 void DrawQuad(const SurfaceQuad& quad); 224 void DrawQuad(const SurfaceQuad& quad);
225 225
226 // Copy current frame to |target| video frame. This method must be called 226 // Copy current frame to |target| video frame. This method must be called
227 // within a CGL context. Returns a callback that should be called outside 227 // within a CGL context. Returns a callback that should be called outside
228 // of the CGL context. 228 // of the CGL context.
229 // If |called_within_draw| is true this method is called within a drawing 229 // If |called_within_draw| is true this method is called within a drawing
230 // operations. This allow certain optimizations. 230 // operations. This allow certain optimizations.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 GLenum GetAndSaveGLError(); 270 GLenum GetAndSaveGLError();
271 271
272 gfx::Rect IntersectWithIOSurface(const gfx::Rect& rect) const; 272 gfx::Rect IntersectWithIOSurface(const gfx::Rect& rect) const;
273 273
274 // Offscreen context used for all operations other than drawing to the 274 // Offscreen context used for all operations other than drawing to the
275 // screen. This is in the same share group as the contexts used for 275 // screen. This is in the same share group as the contexts used for
276 // drawing, and is the same for all IOSurfaces in all windows. 276 // drawing, and is the same for all IOSurfaces in all windows.
277 scoped_refptr<CompositingIOSurfaceContext> offscreen_context_; 277 scoped_refptr<CompositingIOSurfaceContext> offscreen_context_;
278 278
279 // IOSurface data. 279 // IOSurface data.
280 uint64 io_surface_handle_; 280 IOSurfaceID io_surface_handle_;
281 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; 281 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_;
282 282
283 // The width and height of the io surface. 283 // The width and height of the io surface.
284 gfx::Size pixel_io_surface_size_; // In pixels. 284 gfx::Size pixel_io_surface_size_; // In pixels.
285 gfx::Size dip_io_surface_size_; // In view / density independent pixels. 285 gfx::Size dip_io_surface_size_; // In view / density independent pixels.
286 float scale_factor_; 286 float scale_factor_;
287 287
288 // The "live" OpenGL texture referring to this IOSurfaceRef. Note 288 // The "live" OpenGL texture referring to this IOSurfaceRef. Note
289 // that per the CGLTexImageIOSurface2D API we do not need to 289 // that per the CGLTexImageIOSurface2D API we do not need to
290 // explicitly update this texture's contents once created. All we 290 // explicitly update this texture's contents once created. All we
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 static void EvictionScheduleDoEvict(); 323 static void EvictionScheduleDoEvict();
324 static void EvictionDoEvict(); 324 static void EvictionDoEvict();
325 static base::LazyInstance<EvictionQueue> eviction_queue_; 325 static base::LazyInstance<EvictionQueue> eviction_queue_;
326 static bool eviction_scheduled_; 326 static bool eviction_scheduled_;
327 }; 327 };
328 328
329 } // namespace content 329 } // namespace content
330 330
331 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ 331 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/browser_compositor_view_mac.mm ('k') | content/browser/renderer_host/compositing_iosurface_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698