OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 421 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
422 GpuProcessTransportFactory::CreateContextCommon(int surface_id) { | 422 GpuProcessTransportFactory::CreateContextCommon(int surface_id) { |
423 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) | 423 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) |
424 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 424 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
425 blink::WebGraphicsContext3D::Attributes attrs; | 425 blink::WebGraphicsContext3D::Attributes attrs; |
426 attrs.shareResources = true; | 426 attrs.shareResources = true; |
427 attrs.depth = false; | 427 attrs.depth = false; |
428 attrs.stencil = false; | 428 attrs.stencil = false; |
429 attrs.antialias = false; | 429 attrs.antialias = false; |
430 attrs.noAutomaticFlushes = true; | 430 attrs.noAutomaticFlushes = true; |
| 431 attrs.loseContextWhenOutOfMemory = true; |
431 CauseForGpuLaunch cause = | 432 CauseForGpuLaunch cause = |
432 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 433 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
433 scoped_refptr<GpuChannelHost> gpu_channel_host( | 434 scoped_refptr<GpuChannelHost> gpu_channel_host( |
434 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); | 435 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); |
435 if (!gpu_channel_host) { | 436 if (!gpu_channel_host) { |
436 LOG(ERROR) << "Failed to establish GPU channel."; | 437 LOG(ERROR) << "Failed to establish GPU channel."; |
437 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 438 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
438 } | 439 } |
439 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); | 440 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); |
440 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 441 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 observer_list_, | 477 observer_list_, |
477 OnLostResources()); | 478 OnLostResources()); |
478 | 479 |
479 // Kill things that use the shared context before killing the shared context. | 480 // Kill things that use the shared context before killing the shared context. |
480 lost_gl_helper.reset(); | 481 lost_gl_helper.reset(); |
481 lost_offscreen_compositor_contexts = NULL; | 482 lost_offscreen_compositor_contexts = NULL; |
482 lost_shared_main_thread_contexts = NULL; | 483 lost_shared_main_thread_contexts = NULL; |
483 } | 484 } |
484 | 485 |
485 } // namespace content | 486 } // namespace content |
OLD | NEW |