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

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

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 25 matching lines...) Expand all
36 virtual bool SwapBuffers() OVERRIDE; 36 virtual bool SwapBuffers() OVERRIDE;
37 virtual gfx::Size GetSize() OVERRIDE; 37 virtual gfx::Size GetSize() OVERRIDE;
38 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 38 virtual bool 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 OnResizeViewACK() OVERRIDE;
46 virtual void OnResize(gfx::Size size) OVERRIDE; 47 virtual void OnResize(gfx::Size size) 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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 virtual bool SwapBuffers() OVERRIDE; 88 virtual bool SwapBuffers() OVERRIDE;
88 virtual gfx::Size GetSize() OVERRIDE; 89 virtual gfx::Size GetSize() OVERRIDE;
89 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 90 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
90 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 91 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
91 92
92 protected: 93 protected:
93 // ImageTransportSurface implementation 94 // ImageTransportSurface implementation
94 virtual void OnBuffersSwappedACK() OVERRIDE; 95 virtual void OnBuffersSwappedACK() OVERRIDE;
95 virtual void OnNewSurfaceACK(uint64 surface_id, 96 virtual void OnNewSurfaceACK(uint64 surface_id,
96 TransportDIB::Handle shm_handle) OVERRIDE; 97 TransportDIB::Handle shm_handle) OVERRIDE;
98 virtual void OnResizeViewACK() OVERRIDE;
97 virtual void OnResize(gfx::Size size) OVERRIDE; 99 virtual void OnResize(gfx::Size size) OVERRIDE;
98 100
99 private: 101 private:
100 virtual ~TransportDIBImageTransportSurface() OVERRIDE; 102 virtual ~TransportDIBImageTransportSurface() OVERRIDE;
101 103
102 uint32 fbo_id_; 104 uint32 fbo_id_;
103 GLuint render_buffer_id_; 105 GLuint render_buffer_id_;
104 106
105 scoped_ptr<TransportDIB> shared_mem_; 107 scoped_ptr<TransportDIB> shared_mem_;
106 108
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 helper_->SetScheduled(true); 234 helper_->SetScheduled(true);
233 } 235 }
234 236
235 void IOSurfaceImageTransportSurface::OnNewSurfaceACK( 237 void IOSurfaceImageTransportSurface::OnNewSurfaceACK(
236 uint64 surface_id, 238 uint64 surface_id,
237 TransportDIB::Handle /* shm_handle */) { 239 TransportDIB::Handle /* shm_handle */) {
238 DCHECK_EQ(io_surface_id_, surface_id); 240 DCHECK_EQ(io_surface_id_, surface_id);
239 helper_->SetScheduled(true); 241 helper_->SetScheduled(true);
240 } 242 }
241 243
244 void IOSurfaceImageTransportSurface::OnResizeViewACK() {
245 }
jonathan.backer 2011/11/03 23:09:07 NOTREACHED()
246
242 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { 247 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) {
243 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); 248 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
244 249
245 // Caching |context_| from OnMakeCurrent. It should still be current. 250 // Caching |context_| from OnMakeCurrent. It should still be current.
246 DCHECK(context_->IsCurrent(this)); 251 DCHECK(context_->IsCurrent(this));
247 252
248 size_ = size; 253 size_ = size;
249 254
250 if (texture_id_) { 255 if (texture_id_) {
251 glDeleteTextures(1, &texture_id_); 256 glDeleteTextures(1, &texture_id_);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 441
437 void TransportDIBImageTransportSurface::OnNewSurfaceACK( 442 void TransportDIBImageTransportSurface::OnNewSurfaceACK(
438 uint64 surface_id, 443 uint64 surface_id,
439 TransportDIB::Handle shm_handle) { 444 TransportDIB::Handle shm_handle) {
440 helper_->SetScheduled(true); 445 helper_->SetScheduled(true);
441 446
442 shared_mem_.reset(TransportDIB::Map(shm_handle)); 447 shared_mem_.reset(TransportDIB::Map(shm_handle));
443 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL)); 448 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL));
444 } 449 }
445 450
451 void TransportDIBImageTransportSurface::OnResizeViewACK() {
452 }
jonathan.backer 2011/11/03 23:09:07 NOTREACHED()
453
446 void TransportDIBImageTransportSurface::OnResize(gfx::Size size) { 454 void TransportDIBImageTransportSurface::OnResize(gfx::Size size) {
447 size_ = size; 455 size_ = size;
448 456
449 if (!render_buffer_id_) 457 if (!render_buffer_id_)
450 glGenRenderbuffersEXT(1, &render_buffer_id_); 458 glGenRenderbuffersEXT(1, &render_buffer_id_);
451 459
452 GLint previous_fbo_id = 0; 460 GLint previous_fbo_id = 0;
453 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &previous_fbo_id); 461 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &previous_fbo_id);
454 462
455 GLint previous_renderbuffer_id = 0; 463 GLint previous_renderbuffer_id = 0;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 NOTREACHED(); 519 NOTREACHED();
512 return NULL; 520 return NULL;
513 } 521 }
514 if (surface->Initialize()) 522 if (surface->Initialize())
515 return surface; 523 return surface;
516 else 524 else
517 return NULL; 525 return NULL;
518 } 526 }
519 527
520 #endif // defined(USE_GPU) 528 #endif // defined(USE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698