OLD | NEW |
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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "cc/output_surface.h" | 16 #include "cc/output_surface.h" |
17 #include "cc/output_surface_client.h" | 17 #include "cc/output_surface_client.h" |
18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
19 #include "content/browser/gpu/gpu_data_manager_impl.h" | 19 #include "content/browser/gpu/gpu_data_manager_impl.h" |
20 #include "content/browser/gpu/gpu_process_host.h" | 20 #include "content/browser/gpu/gpu_process_host.h" |
21 #include "content/browser/gpu/gpu_surface_tracker.h" | 21 #include "content/browser/gpu/gpu_surface_tracker.h" |
22 #include "content/common/gpu/client/gl_helper.h" | 22 #include "content/common/gpu/client/gl_helper.h" |
23 #include "content/common/gpu/client/gpu_channel_host.h" | 23 #include "content/common/gpu/client/gpu_channel_host.h" |
| 24 #include "content/common/gpu/client/offscreen_context_command_buffer.h" |
24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
25 #include "content/common/gpu/gpu_messages.h" | 26 #include "content/common/gpu/gpu_messages.h" |
26 #include "content/common/gpu/gpu_process_launch_causes.h" | 27 #include "content/common/gpu/gpu_process_launch_causes.h" |
27 #include "content/common/webkitplatformsupport_impl.h" | 28 #include "content/common/webkitplatformsupport_impl.h" |
28 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
29 #include "gpu/GLES2/gl2extchromium.h" | 30 #include "gpu/GLES2/gl2extchromium.h" |
30 #include "gpu/ipc/command_buffer_proxy.h" | 31 #include "gpu/ipc/command_buffer_proxy.h" |
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
32 #include "third_party/khronos/GLES2/gl2.h" | 33 #include "third_party/khronos/GLES2/gl2.h" |
33 #include "third_party/khronos/GLES2/gl2ext.h" | 34 #include "third_party/khronos/GLES2/gl2ext.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 218 |
218 virtual void OnViewContextSwapBuffersComplete() OVERRIDE { | 219 virtual void OnViewContextSwapBuffersComplete() OVERRIDE { |
219 compositor_->OnSwapBuffersComplete(); | 220 compositor_->OnSwapBuffersComplete(); |
220 } | 221 } |
221 | 222 |
222 virtual void OnViewContextSwapBuffersAborted() OVERRIDE { | 223 virtual void OnViewContextSwapBuffersAborted() OVERRIDE { |
223 // Recreating contexts directly from here causes issues, so post a task | 224 // Recreating contexts directly from here causes issues, so post a task |
224 // instead. | 225 // instead. |
225 // TODO(piman): Fix the underlying issues. | 226 // TODO(piman): Fix the underlying issues. |
226 MessageLoop::current()->PostTask(FROM_HERE, | 227 MessageLoop::current()->PostTask(FROM_HERE, |
227 base::Bind(&CompositorSwapClient::OnLostContext, this->AsWeakPtr())); | 228 base::Bind(&CompositorSwapClient::OnLostSwapContext, |
| 229 this->AsWeakPtr())); |
228 } | 230 } |
229 | 231 |
230 private: | 232 private: |
231 void OnLostContext(); | 233 void OnLostSwapContext(); |
232 ui::Compositor* compositor_; | 234 ui::Compositor* compositor_; |
233 GpuProcessTransportFactory* factory_; | 235 GpuProcessTransportFactory* factory_; |
234 | 236 |
235 DISALLOW_COPY_AND_ASSIGN(CompositorSwapClient); | 237 DISALLOW_COPY_AND_ASSIGN(CompositorSwapClient); |
236 }; | 238 }; |
237 | 239 |
238 class BrowserCompositorOutputSurface; | 240 class BrowserCompositorOutputSurface; |
239 | 241 |
240 // Directs vsync updates to the appropriate BrowserCompositorOutputSurface. | 242 // Directs vsync updates to the appropriate BrowserCompositorOutputSurface. |
241 class BrowserCompositorOutputSurfaceProxy | 243 class BrowserCompositorOutputSurfaceProxy |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 363 |
362 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( | 364 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( |
363 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { | 365 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { |
364 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id); | 366 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id); |
365 if (surface) | 367 if (surface) |
366 surface->OnUpdateVSyncParameters(timebase, interval); | 368 surface->OnUpdateVSyncParameters(timebase, interval); |
367 } | 369 } |
368 | 370 |
369 class GpuProcessTransportFactory | 371 class GpuProcessTransportFactory |
370 : public ui::ContextFactory, | 372 : public ui::ContextFactory, |
371 public ImageTransportFactory, | 373 public OffscreenContextCommandBufferClient, |
372 public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 374 public ImageTransportFactory { |
373 public: | 375 public: |
374 GpuProcessTransportFactory() | 376 GpuProcessTransportFactory() |
375 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { | 377 : shared_context_main_thread_(this), |
| 378 shared_context_compositor_thread_(this), |
| 379 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { |
376 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy(); | 380 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy(); |
377 } | 381 } |
378 | 382 |
379 virtual ~GpuProcessTransportFactory() { | 383 virtual ~GpuProcessTransportFactory() { |
380 DCHECK(per_compositor_data_.empty()); | 384 DCHECK(per_compositor_data_.empty()); |
381 } | 385 } |
382 | 386 |
383 virtual WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext() | 387 virtual WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext() |
384 OVERRIDE { | 388 OVERRIDE { |
385 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; | 389 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; |
386 return CreateContextCommon(swap_client, 0); | 390 return CreateContextCommon(swap_client, 0); |
387 } | 391 } |
388 | 392 |
389 virtual cc::OutputSurface* CreateOutputSurface( | 393 virtual cc::OutputSurface* CreateOutputSurface( |
390 ui::Compositor* compositor) OVERRIDE { | 394 ui::Compositor* compositor) OVERRIDE { |
391 PerCompositorData* data = per_compositor_data_[compositor]; | 395 PerCompositorData* data = per_compositor_data_[compositor]; |
392 if (!data) | 396 if (!data) |
393 data = CreatePerCompositorData(compositor); | 397 data = CreatePerCompositorData(compositor); |
394 WebGraphicsContext3DCommandBufferImpl* context = | 398 WebGraphicsContext3DCommandBufferImpl* context = |
395 CreateContextCommon(data->swap_client->AsWeakPtr(), | 399 CreateContextCommon(data->swap_client->AsWeakPtr(), |
396 data->surface_id); | 400 data->surface_id); |
397 return new BrowserCompositorOutputSurface( | 401 return new BrowserCompositorOutputSurface( |
398 context, | 402 context, |
399 per_compositor_data_[compositor]->surface_id, | 403 per_compositor_data_[compositor]->surface_id, |
400 output_surface_proxy_); | 404 output_surface_proxy_); |
401 } | 405 } |
402 | 406 |
| 407 virtual WebKit::WebGraphicsContext3D* OffscreenContextForMainThread() |
| 408 OVERRIDE { |
| 409 return shared_context_main_thread_.Context3d(); |
| 410 } |
| 411 |
| 412 virtual WebKit::WebGraphicsContext3D* |
| 413 OffscreenContextForCompositorThread() OVERRIDE { |
| 414 return shared_context_compositor_thread_.Context3d(); |
| 415 } |
| 416 |
| 417 virtual GrContext* OffscreenGrContextForMainThread() OVERRIDE { |
| 418 return shared_context_main_thread_.GrContext(); |
| 419 } |
| 420 |
| 421 virtual GrContext* OffscreenGrContextForCompositorThread() OVERRIDE { |
| 422 return shared_context_compositor_thread_.GrContext(); |
| 423 } |
| 424 |
403 virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE { | 425 virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE { |
404 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 426 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
405 if (it == per_compositor_data_.end()) | 427 if (it == per_compositor_data_.end()) |
406 return; | 428 return; |
407 PerCompositorData* data = it->second; | 429 PerCompositorData* data = it->second; |
408 DCHECK(data); | 430 DCHECK(data); |
409 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_id); | 431 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_id); |
410 delete data; | 432 delete data; |
411 per_compositor_data_.erase(it); | 433 per_compositor_data_.erase(it); |
412 if (per_compositor_data_.empty()) { | 434 if (per_compositor_data_.empty()) { |
413 gl_helper_.reset(); | 435 gl_helper_.reset(); |
414 callback_factory_.InvalidateWeakPtrs(); | 436 callback_factory_.InvalidateWeakPtrs(); |
415 } | 437 } |
416 } | 438 } |
417 | 439 |
418 virtual ui::ContextFactory* AsContextFactory() OVERRIDE { | 440 virtual ui::ContextFactory* AsContextFactory() OVERRIDE { |
419 return this; | 441 return this; |
420 } | 442 } |
421 | 443 |
422 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE { | 444 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE { |
423 CreateSharedContextLazy(); | |
424 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( | 445 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( |
425 gfx::kNullPluginWindow, true); | 446 gfx::kNullPluginWindow, true); |
426 handle.parent_gpu_process_id = shared_context_->GetGPUProcessID(); | 447 handle.parent_gpu_process_id = |
427 handle.parent_client_id = shared_context_->GetChannelID(); | 448 shared_context_main_thread_.Context3d()->GetGPUProcessID(); |
428 | 449 handle.parent_client_id = |
| 450 shared_context_main_thread_.Context3d()->GetChannelID(); |
429 return handle; | 451 return handle; |
430 } | 452 } |
431 | 453 |
432 virtual void DestroySharedSurfaceHandle( | 454 virtual void DestroySharedSurfaceHandle( |
433 gfx::GLSurfaceHandle surface) OVERRIDE { | 455 gfx::GLSurfaceHandle surface) OVERRIDE { |
434 } | 456 } |
435 | 457 |
436 virtual scoped_refptr<ui::Texture> CreateTransportClient( | 458 virtual scoped_refptr<ui::Texture> CreateTransportClient( |
437 float device_scale_factor) { | 459 float device_scale_factor) { |
438 if (!shared_context_.get()) | 460 if (!shared_context_main_thread_.Context3d()) |
439 return NULL; | 461 return NULL; |
440 scoped_refptr<ImageTransportClientTexture> image( | 462 scoped_refptr<ImageTransportClientTexture> image( |
441 new ImageTransportClientTexture(shared_context_.get(), | 463 new ImageTransportClientTexture( |
442 device_scale_factor)); | 464 shared_context_main_thread_.Context3d(), |
| 465 device_scale_factor)); |
443 return image; | 466 return image; |
444 } | 467 } |
445 | 468 |
446 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( | 469 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( |
447 const gfx::Size& size, | 470 const gfx::Size& size, |
448 float device_scale_factor, | 471 float device_scale_factor, |
449 unsigned int texture_id) OVERRIDE { | 472 unsigned int texture_id) OVERRIDE { |
450 if (!shared_context_.get()) | 473 if (!shared_context_main_thread_.Context3d()) |
451 return NULL; | 474 return NULL; |
452 scoped_refptr<OwnedTexture> image( | 475 scoped_refptr<OwnedTexture> image(new OwnedTexture( |
453 new OwnedTexture(shared_context_.get(), size, device_scale_factor, | 476 shared_context_main_thread_.Context3d(), |
454 texture_id)); | 477 size, |
| 478 device_scale_factor, |
| 479 texture_id)); |
455 return image; | 480 return image; |
456 } | 481 } |
457 | 482 |
458 virtual GLHelper* GetGLHelper() { | 483 virtual GLHelper* GetGLHelper() { |
459 if (!gl_helper_.get()) { | 484 if (!gl_helper_.get()) { |
460 CreateSharedContextLazy(); | 485 WebGraphicsContext3DCommandBufferImpl* main_thread_context = |
461 WebKit::WebGraphicsContext3D* context_for_thread = | 486 shared_context_main_thread_.Context3d(); |
| 487 if (!main_thread_context) |
| 488 return NULL; |
| 489 WebGraphicsContext3DCommandBufferImpl* helper_thread_context = |
462 CreateOffscreenContext(); | 490 CreateOffscreenContext(); |
463 if (!context_for_thread) | 491 if (!helper_thread_context) |
464 return NULL; | 492 return NULL; |
465 gl_helper_.reset(new GLHelper(shared_context_.get(), | 493 gl_helper_.reset(new GLHelper(main_thread_context, |
466 context_for_thread)); | 494 helper_thread_context)); |
467 } | 495 } |
468 return gl_helper_.get(); | 496 return gl_helper_.get(); |
469 } | 497 } |
470 | 498 |
471 virtual uint32 InsertSyncPoint() OVERRIDE { | 499 virtual uint32 InsertSyncPoint() OVERRIDE { |
472 if (!shared_context_.get()) | 500 if (!shared_context_main_thread_.Context3d()) |
473 return 0; | 501 return 0; |
474 return shared_context_->insertSyncPoint(); | 502 return shared_context_main_thread_.Context3d()-> |
| 503 insertSyncPoint(); |
475 } | 504 } |
476 | 505 |
477 virtual void AddObserver(ImageTransportFactoryObserver* observer) { | 506 virtual void AddObserver(ImageTransportFactoryObserver* observer) { |
478 observer_list_.AddObserver(observer); | 507 observer_list_.AddObserver(observer); |
479 } | 508 } |
480 | 509 |
481 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) { | 510 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) { |
482 observer_list_.RemoveObserver(observer); | 511 observer_list_.RemoveObserver(observer); |
483 } | 512 } |
484 | 513 |
485 // WebGraphicsContextLostCallback implementation, called for the shared | 514 // OffscreenContextCommandBufferClient implementation. |
486 // context. | 515 virtual void DidCreateContext( |
487 virtual void onContextLost() { | 516 OffscreenContextCommandBuffer* offscreen_context, |
488 MessageLoop::current()->PostTask( | 517 bool success) OVERRIDE { |
489 FROM_HERE, | 518 if (success) |
490 base::Bind(&GpuProcessTransportFactory::OnLostSharedContext, | 519 return; |
491 callback_factory_.GetWeakPtr())); | 520 if (offscreen_context == &shared_context_main_thread_) { |
| 521 // If we can't recreate contexts, we won't be able to show the UI. Better |
| 522 // crash at this point. |
| 523 LOG(FATAL) << "Failed to initialize UI shared main thread context."; |
| 524 } |
492 } | 525 } |
493 | 526 |
494 void OnLostContext(ui::Compositor* compositor) { | 527 // OffscreenContextCommandBufferClient implementation. |
| 528 virtual void DidLoseContext(OffscreenContextCommandBuffer* offscreen_context) |
| 529 OVERRIDE { |
| 530 if (offscreen_context == &shared_context_main_thread_) { |
| 531 MessageLoop::current()->PostTask( |
| 532 FROM_HERE, |
| 533 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext, |
| 534 callback_factory_.GetWeakPtr(), |
| 535 base::Unretained(offscreen_context))); |
| 536 } |
| 537 } |
| 538 |
| 539 void OnLostSwapContext(ui::Compositor* compositor) { |
495 LOG(ERROR) << "Lost UI compositor context."; | 540 LOG(ERROR) << "Lost UI compositor context."; |
496 PerCompositorData* data = per_compositor_data_[compositor]; | 541 PerCompositorData* data = per_compositor_data_[compositor]; |
497 DCHECK(data); | 542 DCHECK(data); |
498 | 543 |
499 // Prevent callbacks from other contexts in the same share group from | 544 // Prevent callbacks from other contexts in the same share group from |
500 // calling us again. | 545 // calling us again. |
501 data->swap_client.reset(new CompositorSwapClient(compositor, this)); | 546 data->swap_client.reset(new CompositorSwapClient(compositor, this)); |
502 compositor->OnSwapBuffersAborted(); | 547 compositor->OnSwapBuffersAborted(); |
503 } | 548 } |
504 | 549 |
505 private: | 550 private: |
506 struct PerCompositorData { | 551 struct PerCompositorData { |
507 int surface_id; | 552 int surface_id; |
508 scoped_ptr<CompositorSwapClient> swap_client; | 553 scoped_ptr<CompositorSwapClient> swap_client; |
509 #if defined(OS_WIN) | 554 #if defined(OS_WIN) |
510 scoped_ptr<AcceleratedSurface> accelerated_surface; | 555 scoped_ptr<AcceleratedSurface> accelerated_surface; |
511 #endif | 556 #endif |
512 }; | 557 }; |
513 | 558 |
514 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor) { | 559 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor) { |
515 DCHECK(!per_compositor_data_[compositor]); | 560 DCHECK(!per_compositor_data_[compositor]); |
516 | 561 |
517 CreateSharedContextLazy(); | |
518 | |
519 gfx::AcceleratedWidget widget = compositor->widget(); | 562 gfx::AcceleratedWidget widget = compositor->widget(); |
520 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); | 563 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); |
521 | 564 |
522 PerCompositorData* data = new PerCompositorData; | 565 PerCompositorData* data = new PerCompositorData; |
523 data->surface_id = tracker->AddSurfaceForNativeWidget(widget); | 566 data->surface_id = tracker->AddSurfaceForNativeWidget(widget); |
524 data->swap_client.reset(new CompositorSwapClient(compositor, this)); | 567 data->swap_client.reset(new CompositorSwapClient(compositor, this)); |
525 #if defined(OS_WIN) | 568 #if defined(OS_WIN) |
526 if (GpuDataManagerImpl::GetInstance()->IsUsingAcceleratedSurface()) | 569 if (GpuDataManagerImpl::GetInstance()->IsUsingAcceleratedSurface()) |
527 data->accelerated_surface.reset(new AcceleratedSurface(widget)); | 570 data->accelerated_surface.reset(new AcceleratedSurface(widget)); |
528 #endif | 571 #endif |
(...skipping 24 matching lines...) Expand all Loading... |
553 factory, | 596 factory, |
554 swap_client)); | 597 swap_client)); |
555 if (!context->Initialize( | 598 if (!context->Initialize( |
556 attrs, | 599 attrs, |
557 false, | 600 false, |
558 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) | 601 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) |
559 return NULL; | 602 return NULL; |
560 return context.release(); | 603 return context.release(); |
561 } | 604 } |
562 | 605 |
563 void CreateSharedContextLazy() { | 606 void OnLostMainThreadSharedContext( |
564 if (shared_context_.get()) | 607 OffscreenContextCommandBuffer* offscreen_contxt) { |
565 return; | |
566 | |
567 shared_context_.reset(CreateOffscreenContext()); | |
568 if (!shared_context_.get()) { | |
569 // If we can't recreate contexts, we won't be able to show the UI. Better | |
570 // crash at this point. | |
571 LOG(FATAL) << "Failed to initialize UI shared context."; | |
572 } | |
573 if (!shared_context_->makeContextCurrent()) { | |
574 // If we can't recreate contexts, we won't be able to show the UI. Better | |
575 // crash at this point. | |
576 LOG(FATAL) << "Failed to make UI shared context current."; | |
577 } | |
578 shared_context_->setContextLostCallback(this); | |
579 } | |
580 | |
581 void OnLostSharedContext() { | |
582 // Keep old resources around while we call the observers, but ensure that | |
583 // new resources are created if needed. | |
584 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> old_shared_context( | |
585 shared_context_.release()); | |
586 scoped_ptr<GLHelper> old_helper(gl_helper_.release()); | |
587 | |
588 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 608 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
589 observer_list_, | 609 observer_list_, |
590 OnLostResources()); | 610 OnLostResources()); |
591 } | 611 } |
592 | 612 |
593 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; | 613 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; |
594 PerCompositorDataMap per_compositor_data_; | 614 PerCompositorDataMap per_compositor_data_; |
595 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> shared_context_; | 615 OffscreenContextCommandBuffer shared_context_main_thread_; |
| 616 OffscreenContextCommandBuffer shared_context_compositor_thread_; |
596 scoped_ptr<GLHelper> gl_helper_; | 617 scoped_ptr<GLHelper> gl_helper_; |
597 ObserverList<ImageTransportFactoryObserver> observer_list_; | 618 ObserverList<ImageTransportFactoryObserver> observer_list_; |
598 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; | 619 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; |
599 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; | 620 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; |
600 | 621 |
601 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); | 622 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); |
602 }; | 623 }; |
603 | 624 |
604 void CompositorSwapClient::OnLostContext() { | 625 void CompositorSwapClient::OnLostSwapContext() { |
605 factory_->OnLostContext(compositor_); | 626 factory_->OnLostSwapContext(compositor_); |
606 // Note: previous line destroyed this. Don't access members from now on. | 627 // Note: previous line destroyed this. Don't access members from now on. |
607 } | 628 } |
608 | 629 |
609 WebKit::WebGraphicsContext3D* CreateTestContext() { | 630 WebKit::WebGraphicsContext3D* CreateTestContext() { |
610 ui::TestWebGraphicsContext3D* test_context = | 631 ui::TestWebGraphicsContext3D* test_context = |
611 new ui::TestWebGraphicsContext3D(); | 632 new ui::TestWebGraphicsContext3D(); |
612 test_context->Initialize(); | 633 test_context->Initialize(); |
613 return test_context; | 634 return test_context; |
614 } | 635 } |
615 | 636 |
(...skipping 21 matching lines...) Expand all Loading... |
637 delete g_factory; | 658 delete g_factory; |
638 g_factory = NULL; | 659 g_factory = NULL; |
639 } | 660 } |
640 | 661 |
641 // static | 662 // static |
642 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 663 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
643 return g_factory; | 664 return g_factory; |
644 } | 665 } |
645 | 666 |
646 } // namespace content | 667 } // namespace content |
OLD | NEW |