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" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void CreateSharedContext(ui::Compositor* compositor) { | 400 void CreateSharedContext(ui::Compositor* compositor) { |
401 PerCompositorData* data = per_compositor_data_[compositor]; | 401 PerCompositorData* data = per_compositor_data_[compositor]; |
402 DCHECK(data); | 402 DCHECK(data); |
403 | 403 |
404 data->swap_client.reset(new CompositorSwapClient(compositor, this)); | 404 data->swap_client.reset(new CompositorSwapClient(compositor, this)); |
405 | 405 |
406 GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); | 406 GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); |
407 WebKit::WebGraphicsContext3D::Attributes attrs; | 407 WebKit::WebGraphicsContext3D::Attributes attrs; |
408 attrs.shareResources = true; | 408 attrs.shareResources = true; |
409 data->shared_context.reset(new WebGraphicsContext3DCommandBufferImpl( | 409 data->shared_context.reset(new WebGraphicsContext3DCommandBufferImpl( |
410 0, | 410 data->surface_id, |
411 GURL(), | 411 GURL(), |
412 factory, | 412 factory, |
413 data->swap_client->AsWeakPtr())); | 413 data->swap_client->AsWeakPtr())); |
414 if (!data->shared_context->Initialize( | 414 if (!data->shared_context->Initialize( |
415 attrs, | 415 attrs, |
416 false, | 416 false, |
417 content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INIT
IALIZE)) { | 417 content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INIT
IALIZE)) { |
418 // If we can't recreate contexts, we won't be able to show the UI. Better | 418 // If we can't recreate contexts, we won't be able to show the UI. Better |
419 // crash at this point. | 419 // crash at this point. |
420 LOG(FATAL) << "Failed to initialize compositor shared context."; | 420 LOG(FATAL) << "Failed to initialize compositor shared context."; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 void ImageTransportFactory::Terminate() { | 464 void ImageTransportFactory::Terminate() { |
465 ui::ContextFactory::SetInstance(NULL); | 465 ui::ContextFactory::SetInstance(NULL); |
466 delete g_factory; | 466 delete g_factory; |
467 g_factory = NULL; | 467 g_factory = NULL; |
468 } | 468 } |
469 | 469 |
470 // static | 470 // static |
471 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 471 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
472 return g_factory; | 472 return g_factory; |
473 } | 473 } |
OLD | NEW |