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

Side by Side Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 12210030: Linux/ChromeOS Chromium style checker cleanup, content/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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) 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 #include "content/browser/renderer_host/image_transport_factory.h" 5 #include "content/browser/renderer_host/image_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 class CompositorSwapClient 201 class CompositorSwapClient
202 : public base::SupportsWeakPtr<CompositorSwapClient>, 202 : public base::SupportsWeakPtr<CompositorSwapClient>,
203 public WebGraphicsContext3DSwapBuffersClient { 203 public WebGraphicsContext3DSwapBuffersClient {
204 public: 204 public:
205 CompositorSwapClient(ui::Compositor* compositor, 205 CompositorSwapClient(ui::Compositor* compositor,
206 GpuProcessTransportFactory* factory) 206 GpuProcessTransportFactory* factory)
207 : compositor_(compositor), 207 : compositor_(compositor),
208 factory_(factory) { 208 factory_(factory) {
209 } 209 }
210 210
211 ~CompositorSwapClient() { 211 virtual ~CompositorSwapClient() {
212 } 212 }
213 213
214 virtual void OnViewContextSwapBuffersPosted() OVERRIDE { 214 virtual void OnViewContextSwapBuffersPosted() OVERRIDE {
215 compositor_->OnSwapBuffersPosted(); 215 compositor_->OnSwapBuffersPosted();
216 } 216 }
217 217
218 virtual void OnViewContextSwapBuffersComplete() OVERRIDE { 218 virtual void OnViewContextSwapBuffersComplete() OVERRIDE {
219 compositor_->OnSwapBuffersComplete(); 219 compositor_->OnSwapBuffersComplete();
220 } 220 }
221 221
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 handle.parent_client_id = shared_context_->GetChannelID(); 427 handle.parent_client_id = shared_context_->GetChannelID();
428 428
429 return handle; 429 return handle;
430 } 430 }
431 431
432 virtual void DestroySharedSurfaceHandle( 432 virtual void DestroySharedSurfaceHandle(
433 gfx::GLSurfaceHandle surface) OVERRIDE { 433 gfx::GLSurfaceHandle surface) OVERRIDE {
434 } 434 }
435 435
436 virtual scoped_refptr<ui::Texture> CreateTransportClient( 436 virtual scoped_refptr<ui::Texture> CreateTransportClient(
437 float device_scale_factor) { 437 float device_scale_factor) OVERRIDE {
438 if (!shared_context_.get()) 438 if (!shared_context_.get())
439 return NULL; 439 return NULL;
440 scoped_refptr<ImageTransportClientTexture> image( 440 scoped_refptr<ImageTransportClientTexture> image(
441 new ImageTransportClientTexture(shared_context_.get(), 441 new ImageTransportClientTexture(shared_context_.get(),
442 device_scale_factor)); 442 device_scale_factor));
443 return image; 443 return image;
444 } 444 }
445 445
446 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( 446 virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
447 const gfx::Size& size, 447 const gfx::Size& size,
448 float device_scale_factor, 448 float device_scale_factor,
449 unsigned int texture_id) OVERRIDE { 449 unsigned int texture_id) OVERRIDE {
450 if (!shared_context_.get()) 450 if (!shared_context_.get())
451 return NULL; 451 return NULL;
452 scoped_refptr<OwnedTexture> image( 452 scoped_refptr<OwnedTexture> image(
453 new OwnedTexture(shared_context_.get(), size, device_scale_factor, 453 new OwnedTexture(shared_context_.get(), size, device_scale_factor,
454 texture_id)); 454 texture_id));
455 return image; 455 return image;
456 } 456 }
457 457
458 virtual GLHelper* GetGLHelper() { 458 virtual GLHelper* GetGLHelper() OVERRIDE {
459 if (!gl_helper_.get()) { 459 if (!gl_helper_.get()) {
460 CreateSharedContextLazy(); 460 CreateSharedContextLazy();
461 WebKit::WebGraphicsContext3D* context_for_thread = 461 WebKit::WebGraphicsContext3D* context_for_thread =
462 CreateOffscreenContext(); 462 CreateOffscreenContext();
463 if (!context_for_thread) 463 if (!context_for_thread)
464 return NULL; 464 return NULL;
465 gl_helper_.reset(new GLHelper(shared_context_.get(), 465 gl_helper_.reset(new GLHelper(shared_context_.get(),
466 context_for_thread)); 466 context_for_thread));
467 } 467 }
468 return gl_helper_.get(); 468 return gl_helper_.get();
469 } 469 }
470 470
471 virtual uint32 InsertSyncPoint() OVERRIDE { 471 virtual uint32 InsertSyncPoint() OVERRIDE {
472 if (!shared_context_.get()) 472 if (!shared_context_.get())
473 return 0; 473 return 0;
474 return shared_context_->insertSyncPoint(); 474 return shared_context_->insertSyncPoint();
475 } 475 }
476 476
477 virtual void AddObserver(ImageTransportFactoryObserver* observer) { 477 virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE {
478 observer_list_.AddObserver(observer); 478 observer_list_.AddObserver(observer);
479 } 479 }
480 480
481 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) { 481 virtual void RemoveObserver(
482 ImageTransportFactoryObserver* observer) OVERRIDE {
482 observer_list_.RemoveObserver(observer); 483 observer_list_.RemoveObserver(observer);
483 } 484 }
484 485
485 // WebGraphicsContextLostCallback implementation, called for the shared 486 // WebGraphicsContextLostCallback implementation, called for the shared
486 // context. 487 // context.
487 virtual void onContextLost() { 488 virtual void onContextLost() {
488 MessageLoop::current()->PostTask( 489 MessageLoop::current()->PostTask(
489 FROM_HERE, 490 FROM_HERE,
490 base::Bind(&GpuProcessTransportFactory::OnLostSharedContext, 491 base::Bind(&GpuProcessTransportFactory::OnLostSharedContext,
491 callback_factory_.GetWeakPtr())); 492 callback_factory_.GetWeakPtr()));
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 delete g_factory; 638 delete g_factory;
638 g_factory = NULL; 639 g_factory = NULL;
639 } 640 }
640 641
641 // static 642 // static
642 ImageTransportFactory* ImageTransportFactory::GetInstance() { 643 ImageTransportFactory* ImageTransportFactory::GetInstance() {
643 return g_factory; 644 return g_factory;
644 } 645 }
645 646
646 } // namespace content 647 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698