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

Side by Side Diff: content/common/gpu/image_transport_surface_mac.cc

Issue 7890046: Command to mark surface inactive, so gpu process can release resources. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixing mock gles2 cmd decoder Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/common/gpu/image_transport_surface.h" 7 #include "content/common/gpu/image_transport_surface.h"
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 26 matching lines...) Expand all
37 virtual gfx::Size GetSize() OVERRIDE; 37 virtual gfx::Size GetSize() OVERRIDE;
38 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 38 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
39 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 39 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
40 40
41 protected: 41 protected:
42 // ImageTransportSurface implementation 42 // ImageTransportSurface implementation
43 virtual void OnNewSurfaceACK(uint64 surface_id, 43 virtual void OnNewSurfaceACK(uint64 surface_id,
44 TransportDIB::Handle shm_handle) OVERRIDE; 44 TransportDIB::Handle shm_handle) OVERRIDE;
45 virtual void OnBuffersSwappedACK() OVERRIDE; 45 virtual void OnBuffersSwappedACK() OVERRIDE;
46 virtual void OnResize(gfx::Size size) OVERRIDE; 46 virtual void OnResize(gfx::Size size) OVERRIDE;
47 virtual void OnSurfaceVisible(bool visible) OVERRIDE;
47 48
48 private: 49 private:
49 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; 50 virtual ~IOSurfaceImageTransportSurface() OVERRIDE;
50 51
51 uint32 fbo_id_; 52 uint32 fbo_id_;
52 GLuint texture_id_; 53 GLuint texture_id_;
53 54
54 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; 55 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_;
55 56
56 // The id of |io_surface_| or 0 if that's NULL. 57 // The id of |io_surface_| or 0 if that's NULL.
(...skipping 28 matching lines...) Expand all
85 virtual gfx::Size GetSize() OVERRIDE; 86 virtual gfx::Size GetSize() OVERRIDE;
86 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 87 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
87 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 88 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
88 89
89 protected: 90 protected:
90 // ImageTransportSurface implementation 91 // ImageTransportSurface implementation
91 virtual void OnBuffersSwappedACK() OVERRIDE; 92 virtual void OnBuffersSwappedACK() OVERRIDE;
92 virtual void OnNewSurfaceACK(uint64 surface_id, 93 virtual void OnNewSurfaceACK(uint64 surface_id,
93 TransportDIB::Handle shm_handle) OVERRIDE; 94 TransportDIB::Handle shm_handle) OVERRIDE;
94 virtual void OnResize(gfx::Size size) OVERRIDE; 95 virtual void OnResize(gfx::Size size) OVERRIDE;
96 virtual void OnSurfaceVisible(bool visible) OVERRIDE;
95 97
96 private: 98 private:
97 virtual ~TransportDIBImageTransportSurface() OVERRIDE; 99 virtual ~TransportDIBImageTransportSurface() OVERRIDE;
98 100
99 uint32 fbo_id_; 101 uint32 fbo_id_;
100 GLuint render_buffer_id_; 102 GLuint render_buffer_id_;
101 103
102 scoped_ptr<TransportDIB> shared_mem_; 104 scoped_ptr<TransportDIB> shared_mem_;
103 105
104 gfx::Size size_; 106 gfx::Size size_;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 GpuHostMsg_AcceleratedSurfaceNew_Params params; 301 GpuHostMsg_AcceleratedSurfaceNew_Params params;
300 params.width = size_.width(); 302 params.width = size_.width();
301 params.height = size_.height(); 303 params.height = size_.height();
302 params.surface_id = io_surface_id_; 304 params.surface_id = io_surface_id_;
303 params.create_transport_dib = false; 305 params.create_transport_dib = false;
304 helper_->SendAcceleratedSurfaceNew(params); 306 helper_->SendAcceleratedSurfaceNew(params);
305 307
306 helper_->SetScheduled(false); 308 helper_->SetScheduled(false);
307 } 309 }
308 310
311 void IOSurfaceImageTransportSurface::OnSurfaceVisible(bool visible) {
312 }
313
309 TransportDIBImageTransportSurface::TransportDIBImageTransportSurface( 314 TransportDIBImageTransportSurface::TransportDIBImageTransportSurface(
310 GpuChannelManager* manager, 315 GpuChannelManager* manager,
311 int32 render_view_id, 316 int32 render_view_id,
312 int32 renderer_id, 317 int32 renderer_id,
313 int32 command_buffer_id, 318 int32 command_buffer_id,
314 gfx::PluginWindowHandle handle) 319 gfx::PluginWindowHandle handle)
315 : gfx::PbufferGLSurfaceCGL(gfx::Size(1, 1)), 320 : gfx::PbufferGLSurfaceCGL(gfx::Size(1, 1)),
316 fbo_id_(0), 321 fbo_id_(0),
317 render_buffer_id_(0) { 322 render_buffer_id_(0) {
318 helper_.reset(new ImageTransportHelper(this, 323 helper_.reset(new ImageTransportHelper(this,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 GpuHostMsg_AcceleratedSurfaceNew_Params params; 433 GpuHostMsg_AcceleratedSurfaceNew_Params params;
429 params.width = size_.width(); 434 params.width = size_.width();
430 params.height = size_.height(); 435 params.height = size_.height();
431 params.surface_id = next_id_++; 436 params.surface_id = next_id_++;
432 params.create_transport_dib = true; 437 params.create_transport_dib = true;
433 helper_->SendAcceleratedSurfaceNew(params); 438 helper_->SendAcceleratedSurfaceNew(params);
434 439
435 helper_->SetScheduled(false); 440 helper_->SetScheduled(false);
436 } 441 }
437 442
443 void TransportDIBImageTransportSurface::OnSurfaceVisible(bool visible) {
444 }
445
438 } // namespace 446 } // namespace
439 447
440 // static 448 // static
441 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 449 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
442 GpuChannelManager* manager, 450 GpuChannelManager* manager,
443 int32 render_view_id, 451 int32 render_view_id,
444 int32 renderer_id, 452 int32 renderer_id,
445 int32 command_buffer_id, 453 int32 command_buffer_id,
446 gfx::PluginWindowHandle handle) { 454 gfx::PluginWindowHandle handle) {
447 scoped_refptr<gfx::GLSurface> surface; 455 scoped_refptr<gfx::GLSurface> surface;
(...skipping 19 matching lines...) Expand all
467 NOTREACHED(); 475 NOTREACHED();
468 return NULL; 476 return NULL;
469 } 477 }
470 if (surface->Initialize()) 478 if (surface->Initialize())
471 return surface; 479 return surface;
472 else 480 else
473 return NULL; 481 return NULL;
474 } 482 }
475 483
476 #endif // defined(USE_GPU) 484 #endif // defined(USE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698