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

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: re-add CONTENT_EXPORT to InitializeOnCurrentThread to fix android_clang_dbg build 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)
958 if (SynchronousCompositorFactory* factory = 957 if (SynchronousCompositorFactory* factory =
959 SynchronousCompositorFactory::GetInstance()) { 958 SynchronousCompositorFactory::GetInstance()) {
960 context.reset(factory->CreateOffscreenGraphicsContext3D(attributes)); 959 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
961 must_use_synchronous_factory = true; 960 in_process_context;
961 in_process_context.reset(
jamesr 2014/09/29 21:22:31 no need to separate declaration of the variable fr
962 factory->CreateOffscreenGraphicsContext3D(attributes));
963 if (!in_process_context ||
964 !in_process_context->InitializeOnCurrentThread())
965 return NULL;
966 return in_process_context.release();
962 } 967 }
963 #endif 968 #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
969 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 970 scoped_refptr<GpuChannelHost> gpu_channel_host(
970 bool lose_context_when_out_of_memory = false; 971 RenderThreadImpl::current()->EstablishGpuChannelSync(
971 context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 972 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) );
972 gpu_channel_host.get(), 973
973 attributes, 974 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
974 lose_context_when_out_of_memory, 975 bool lose_context_when_out_of_memory = false;
975 GURL(attributes.topDocumentURL), 976 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context;
976 limits, 977 context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
jamesr 2014/09/29 21:22:31 ditto, this can just be scoped_ptr<...> context =
977 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); 978 gpu_channel_host.get(),
978 } 979 attributes,
980 lose_context_when_out_of_memory,
981 GURL(attributes.topDocumentURL),
982 limits,
983 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)));
984
979 // Most likely the GPU process exited and the attempt to reconnect to it 985 // Most likely the GPU process exited and the attempt to reconnect to it
980 // failed. Need to try to restore the context again later. 986 // failed. Need to try to restore the context again later.
981 if (!context || !context->InitializeOnCurrentThread()) 987 if (!context || !context->InitializeOnCurrentThread())
982 return NULL; 988 return NULL;
983 return context.release(); 989 return context.release();
984 } 990 }
985 991
986 //------------------------------------------------------------------------------ 992 //------------------------------------------------------------------------------
987 993
988 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: 994 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
989 createSharedOffscreenGraphicsContext3DProvider() { 995 createSharedOffscreenGraphicsContext3DProvider() {
990 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider = 996 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider =
991 RenderThreadImpl::current()->SharedMainThreadContextProvider(); 997 RenderThreadImpl::current()->SharedMainThreadContextProvider();
992 if (!provider.get()) 998 if (!provider.get())
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( 1188 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(
1183 const blink::WebBatteryStatus& status) { 1189 const blink::WebBatteryStatus& status) {
1184 PlatformEventObserverBase* observer = 1190 PlatformEventObserverBase* observer =
1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); 1191 platform_event_observers_.Lookup(blink::WebPlatformEventBattery);
1186 if (!observer) 1192 if (!observer)
1187 return; 1193 return;
1188 observer->SendFakeDataForTesting((void*)&status); 1194 observer->SendFakeDataForTesting((void*)&status);
1189 } 1195 }
1190 1196
1191 } // namespace content 1197 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_factory.h ('k') | webkit/common/gpu/webgraphicscontext3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698