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

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 609973002: Move InitializeOnCurrentThread down from WebGraphicsContext3DImpl to WebGraphicsContext3DCommandBuf… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android Created 6 years, 2 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
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 "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/logging.h" 10 #include "base/logging.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 74 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
75 #include "third_party/WebKit/public/platform/WebURL.h" 75 #include "third_party/WebKit/public/platform/WebURL.h"
76 #include "third_party/WebKit/public/platform/WebVector.h" 76 #include "third_party/WebKit/public/platform/WebVector.h"
77 #include "ui/gfx/color_profile.h" 77 #include "ui/gfx/color_profile.h"
78 #include "url/gurl.h" 78 #include "url/gurl.h"
79 #include "webkit/common/gpu/context_provider_web_context.h" 79 #include "webkit/common/gpu/context_provider_web_context.h"
80 80
81 #if defined(OS_ANDROID) 81 #if defined(OS_ANDROID)
82 #include "content/renderer/android/synchronous_compositor_factory.h" 82 #include "content/renderer/android/synchronous_compositor_factory.h"
83 #include "content/renderer/media/android/audio_decoder_android.h" 83 #include "content/renderer/media/android/audio_decoder_android.h"
84 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
84 #endif 85 #endif
85 86
86 #if defined(OS_MACOSX) 87 #if defined(OS_MACOSX)
87 #include "content/common/mac/font_descriptor.h" 88 #include "content/common/mac/font_descriptor.h"
88 #include "content/common/mac/font_loader.h" 89 #include "content/common/mac/font_loader.h"
89 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 90 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
90 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" 91 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h"
91 #endif 92 #endif
92 93
93 #if defined(OS_POSIX) 94 #if defined(OS_POSIX)
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 return createOffscreenGraphicsContext3D(attributes, NULL); 946 return createOffscreenGraphicsContext3D(attributes, NULL);
946 } 947 }
947 948
948 blink::WebGraphicsContext3D* 949 blink::WebGraphicsContext3D*
949 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( 950 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
950 const blink::WebGraphicsContext3D::Attributes& attributes, 951 const blink::WebGraphicsContext3D::Attributes& attributes,
951 blink::WebGraphicsContext3D* share_context) { 952 blink::WebGraphicsContext3D* share_context) {
952 if (!RenderThreadImpl::current()) 953 if (!RenderThreadImpl::current())
953 return NULL; 954 return NULL;
954 955
955 scoped_ptr<webkit::gpu::WebGraphicsContext3DImpl> context;
956 bool must_use_synchronous_factory = false;
957 #if defined(OS_ANDROID) 956 #if defined(OS_ANDROID)
957 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
958 context;
958 if (SynchronousCompositorFactory* factory = 959 if (SynchronousCompositorFactory* factory =
959 SynchronousCompositorFactory::GetInstance()) { 960 SynchronousCompositorFactory::GetInstance()) {
960 context.reset(factory->CreateOffscreenGraphicsContext3D(attributes)); 961 context.reset(factory->CreateOffscreenGraphicsContext3D(attributes));
961 must_use_synchronous_factory = true;
962 } 962 }
jamesr 2014/09/29 18:00:57 this is not correct. in the previous code on OS_A
963 #else
964 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context;
965 scoped_refptr<GpuChannelHost> gpu_channel_host(
966 RenderThreadImpl::current()->EstablishGpuChannelSync(
967 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) );
968
969 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
970 bool lose_context_when_out_of_memory = false;
971 context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
972 gpu_channel_host.get(),
973 attributes,
974 lose_context_when_out_of_memory,
975 GURL(attributes.topDocumentURL),
976 limits,
977 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)));
963 #endif 978 #endif
964 if (!must_use_synchronous_factory) {
965 scoped_refptr<GpuChannelHost> gpu_channel_host(
966 RenderThreadImpl::current()->EstablishGpuChannelSync(
967 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E));
968
969 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
970 bool lose_context_when_out_of_memory = false;
971 context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
972 gpu_channel_host.get(),
973 attributes,
974 lose_context_when_out_of_memory,
975 GURL(attributes.topDocumentURL),
976 limits,
977 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)));
978 }
979 // Most likely the GPU process exited and the attempt to reconnect to it 979 // Most likely the GPU process exited and the attempt to reconnect to it
980 // failed. Need to try to restore the context again later. 980 // failed. Need to try to restore the context again later.
981 if (!context || !context->InitializeOnCurrentThread()) 981 if (!context || !context->InitializeOnCurrentThread())
982 return NULL; 982 return NULL;
983 return context.release(); 983 return context.release();
984 } 984 }
985 985
986 //------------------------------------------------------------------------------ 986 //------------------------------------------------------------------------------
987 987
988 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: 988 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( 1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(
1183 const blink::WebBatteryStatus& status) { 1183 const blink::WebBatteryStatus& status) {
1184 PlatformEventObserverBase* observer = 1184 PlatformEventObserverBase* observer =
1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); 1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery);
1186 if (!observer) 1186 if (!observer)
1187 return; 1187 return;
1188 observer->SendFakeDataForTesting((void*)&status); 1188 observer->SendFakeDataForTesting((void*)&status);
1189 } 1189 }
1190 1190
1191 } // namespace content 1191 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698