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" | |
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 { | |
18 WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL; | |
19 } | |
20 | |
21 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { | 14 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { |
22 } | 15 } |
23 | 16 |
24 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { | 17 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { |
25 } | 18 } |
26 | 19 |
27 string16 WebKitPlatformSupportImpl::GetLocalizedString(int message_id) { | 20 string16 WebKitPlatformSupportImpl::GetLocalizedString(int message_id) { |
28 return GetContentClient()->GetLocalizedString(message_id); | 21 return GetContentClient()->GetLocalizedString(message_id); |
29 } | 22 } |
30 | 23 |
(...skipping 18 matching lines...) Expand all Loading... |
49 | 42 |
50 webkit_glue::WebSocketStreamHandleBridge* | 43 webkit_glue::WebSocketStreamHandleBridge* |
51 WebKitPlatformSupportImpl::CreateWebSocketBridge( | 44 WebKitPlatformSupportImpl::CreateWebSocketBridge( |
52 WebKit::WebSocketStreamHandle* handle, | 45 WebKit::WebSocketStreamHandle* handle, |
53 webkit_glue::WebSocketStreamHandleDelegate* delegate) { | 46 webkit_glue::WebSocketStreamHandleDelegate* delegate) { |
54 SocketStreamDispatcher* dispatcher = | 47 SocketStreamDispatcher* dispatcher = |
55 ChildThread::current()->socket_stream_dispatcher(); | 48 ChildThread::current()->socket_stream_dispatcher(); |
56 return dispatcher->CreateBridge(handle, delegate); | 49 return dispatcher->CreateBridge(handle, delegate); |
57 } | 50 } |
58 | 51 |
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 | |
78 void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( | |
79 OffscreenContextFactory factory) { | |
80 g_context_factory = factory; | |
81 } | |
82 | |
83 GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | |
84 NOTREACHED(); | |
85 return NULL; | |
86 } | |
87 | |
88 } // namespace content | 52 } // namespace content |
OLD | NEW |