blob: 26c87bc95235300b92c01c32f2c3abc2bfee4db0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "content/common/child_thread.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/socket_stream_dispatcher.h"
#include "content/common/webkitplatformsupport_impl.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
namespace content {
WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() {
}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
}
string16 WebKitPlatformSupportImpl::GetLocalizedString(int message_id) {
return content::GetContentClient()->GetLocalizedString(message_id);
}
base::StringPiece WebKitPlatformSupportImpl::GetDataResource(
int resource_id) {
return content::GetContentClient()->GetDataResource(resource_id);
}
void WebKitPlatformSupportImpl::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
// This should not be called except in the renderer.
// RendererWebKitPlatformSupportImpl overrides this.
NOTREACHED();
}
webkit_glue::ResourceLoaderBridge*
WebKitPlatformSupportImpl::CreateResourceLoader(
const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
return ChildThread::current()->CreateBridge(request_info);
}
webkit_glue::WebSocketStreamHandleBridge*
WebKitPlatformSupportImpl::CreateWebSocketBridge(
WebKit::WebSocketStreamHandle* handle,
webkit_glue::WebSocketStreamHandleDelegate* delegate) {
SocketStreamDispatcher* dispatcher =
ChildThread::current()->socket_stream_dispatcher();
return dispatcher->CreateBridge(handle, delegate);
}
WebKit::WebGraphicsContext3D*
WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
const WebGraphicsContext3D::Attributes& attributes) {
// The WebGraphicsContext3DInProcessImpl code path is used for
// layout tests (though not through this code) as well as for
// debugging and bringing up new ports.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
attributes, false);
} else {
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> null_client;
GpuChannelHostFactory* factory = GetGpuChannelHostFactory();
if (!factory)
return NULL;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
new WebGraphicsContext3DCommandBufferImpl(
0, GURL(), factory, null_client));
if (!context->Initialize(
attributes,
false,
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE))
return NULL;
return context.release();
}
}
GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
NOTREACHED();
return NULL;
}
} // namespace content
|