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