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 "content/renderer/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 SynchronousCompositorFactory::GetInstance()) { | 1008 SynchronousCompositorFactory::GetInstance()) { |
1009 return factory->CreateOffscreenGraphicsContext3D(attributes); | 1009 return factory->CreateOffscreenGraphicsContext3D(attributes); |
1010 } | 1010 } |
1011 #endif | 1011 #endif |
1012 | 1012 |
1013 scoped_refptr<GpuChannelHost> gpu_channel_host( | 1013 scoped_refptr<GpuChannelHost> gpu_channel_host( |
1014 RenderThreadImpl::current()->EstablishGpuChannelSync( | 1014 RenderThreadImpl::current()->EstablishGpuChannelSync( |
1015 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 1015 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
1016 | 1016 |
1017 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 1017 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
1018 | |
1019 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
1020 if (command_line->HasSwitch(switches::kWebGLCommandBufferSizeKb)) { | |
1021 std::string size_string = command_line->GetSwitchValueASCII( | |
1022 switches::kWebGLCommandBufferSizeKb); | |
1023 size_t buffer_size_kb; | |
1024 if (base::StringToSizeT(size_string, &buffer_size_kb)) { | |
1025 limits.command_buffer_size = buffer_size_kb * 1024; | |
1026 } | |
1027 } | |
1028 bool lose_context_when_out_of_memory = false; | 1018 bool lose_context_when_out_of_memory = false; |
1029 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1019 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
1030 gpu_channel_host.get(), | 1020 gpu_channel_host.get(), |
1031 attributes, | 1021 attributes, |
1032 lose_context_when_out_of_memory, | 1022 lose_context_when_out_of_memory, |
1033 GURL(attributes.topDocumentURL), | 1023 GURL(attributes.topDocumentURL), |
1034 limits, | 1024 limits, |
1035 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); | 1025 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); |
1036 } | 1026 } |
1037 | 1027 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( | 1190 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( |
1201 blink::WebBatteryStatusListener* listener) { | 1191 blink::WebBatteryStatusListener* listener) { |
1202 if (!battery_status_dispatcher_) { | 1192 if (!battery_status_dispatcher_) { |
1203 battery_status_dispatcher_.reset( | 1193 battery_status_dispatcher_.reset( |
1204 new BatteryStatusDispatcher(RenderThreadImpl::current())); | 1194 new BatteryStatusDispatcher(RenderThreadImpl::current())); |
1205 } | 1195 } |
1206 battery_status_dispatcher_->SetListener(listener); | 1196 battery_status_dispatcher_->SetListener(listener); |
1207 } | 1197 } |
1208 | 1198 |
1209 } // namespace content | 1199 } // namespace content |
OLD | NEW |