| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "content/common/child_thread.h" | 6 #include "content/common/child_thread.h" |
| 7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 8 #include "content/common/socket_stream_dispatcher.h" | 8 #include "content/common/socket_stream_dispatcher.h" |
| 9 #include "content/common/webkitplatformsupport_impl.h" | 9 #include "content/common/webkitplatformsupport_impl.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "googleurl/src/gurl.h" |
| 12 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 13 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL; | 18 WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL; |
| 18 } | 19 } |
| 19 | 20 |
| 20 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { | 21 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { |
| 21 } | 22 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const WebGraphicsContext3D::Attributes& attributes) { | 62 const WebGraphicsContext3D::Attributes& attributes) { |
| 62 if (g_context_factory) | 63 if (g_context_factory) |
| 63 return g_context_factory(); | 64 return g_context_factory(); |
| 64 // The WebGraphicsContext3DInProcessImpl code path is used for | 65 // The WebGraphicsContext3DInProcessImpl code path is used for |
| 65 // layout tests (though not through this code) as well as for | 66 // layout tests (though not through this code) as well as for |
| 66 // debugging and bringing up new ports. | 67 // debugging and bringing up new ports. |
| 67 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { | 68 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
| 68 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( | 69 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
| 69 attributes, false); | 70 attributes, false); |
| 70 } else { | 71 } else { |
| 71 // Intentionally blank URL provided for offscreen contexts -- blank URLs are | |
| 72 // ignored in the GPU process for crash reporting. | |
| 73 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 72 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 74 GetGpuChannelHostFactory(), attributes, GURL()); | 73 GetGpuChannelHostFactory(), attributes, |
| 74 GURL(attributes.topDocumentURL)); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( | 79 void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( |
| 80 OffscreenContextFactory factory) { | 80 OffscreenContextFactory factory) { |
| 81 g_context_factory = factory; | 81 g_context_factory = factory; |
| 82 } | 82 } |
| 83 | 83 |
| 84 GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 84 GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
| 85 NOTREACHED(); | 85 NOTREACHED(); |
| 86 return NULL; | 86 return NULL; |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace content | 89 } // namespace content |
| OLD | NEW |