Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/common/webkitplatformsupport_impl.cc

Issue 12212100: Provide shared context to Platform API in renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CreateOffscreenContext() Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #include "content/common/socket_stream_dispatcher.h" 7 #include "content/common/socket_stream_dispatcher.h"
9 #include "content/common/webkitplatformsupport_impl.h" 8 #include "content/common/webkitplatformsupport_impl.h"
10 #include "content/public/common/content_client.h" 9 #include "content/public/common/content_client.h"
11 #include "content/public/common/content_switches.h"
12 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
13 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
14 11
15 namespace content { 12 namespace content {
16 13
17 namespace { 14 namespace {
18 WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL; 15 WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL;
19 } 16 }
20 17
21 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { 18 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() {
22 } 19 }
23 20
(...skipping 25 matching lines...) Expand all
49 46
50 webkit_glue::WebSocketStreamHandleBridge* 47 webkit_glue::WebSocketStreamHandleBridge*
51 WebKitPlatformSupportImpl::CreateWebSocketBridge( 48 WebKitPlatformSupportImpl::CreateWebSocketBridge(
52 WebKit::WebSocketStreamHandle* handle, 49 WebKit::WebSocketStreamHandle* handle,
53 webkit_glue::WebSocketStreamHandleDelegate* delegate) { 50 webkit_glue::WebSocketStreamHandleDelegate* delegate) {
54 SocketStreamDispatcher* dispatcher = 51 SocketStreamDispatcher* dispatcher =
55 ChildThread::current()->socket_stream_dispatcher(); 52 ChildThread::current()->socket_stream_dispatcher();
56 return dispatcher->CreateBridge(handle, delegate); 53 return dispatcher->CreateBridge(handle, delegate);
57 } 54 }
58 55
59 WebKit::WebGraphicsContext3D*
60 WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
61 const WebGraphicsContext3D::Attributes& attributes) {
62 if (g_context_factory)
63 return g_context_factory();
64 // The WebGraphicsContext3DInProcessImpl code path is used for
65 // layout tests (though not through this code) as well as for
66 // debugging and bringing up new ports.
67 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
68 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
69 attributes, false);
70 } else {
71 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
72 GetGpuChannelHostFactory(), attributes,
73 GURL(attributes.topDocumentURL));
74 }
75 }
76
77 // static 56 // static
78 void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( 57 void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest(
79 OffscreenContextFactory factory) { 58 OffscreenContextFactory factory) {
80 g_context_factory = factory; 59 g_context_factory = factory;
81 } 60 }
82 61
83 GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() { 62 // static
84 NOTREACHED(); 63 WebKitPlatformSupportImpl::OffscreenContextFactory* WebKitPlatformSupportImpl::
85 return NULL; 64 OffscreenContextFactoryForTest() {
65 return g_context_factory;
86 } 66 }
87 67
88 } // namespace content 68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698