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

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

Issue 12212100: Provide shared context to Platform API in renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 #include "base/string_number_conversions.h" // Temporary 23 #include "base/string_number_conversions.h" // Temporary
24 #include "base/threading/thread_local.h" 24 #include "base/threading/thread_local.h"
25 #include "base/utf_string_conversions.h" 25 #include "base/utf_string_conversions.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "content/common/appcache/appcache_dispatcher.h" 27 #include "content/common/appcache/appcache_dispatcher.h"
28 #include "content/common/child_histogram_message_filter.h" 28 #include "content/common/child_histogram_message_filter.h"
29 #include "content/common/child_process_messages.h" 29 #include "content/common/child_process_messages.h"
30 #include "content/common/database_messages.h" 30 #include "content/common/database_messages.h"
31 #include "content/common/db_message_filter.h" 31 #include "content/common/db_message_filter.h"
32 #include "content/common/dom_storage_messages.h" 32 #include "content/common/dom_storage_messages.h"
33 #include "content/common/gpu/client/context_provider_command_buffer.h"
33 #include "content/common/gpu/client/gpu_channel_host.h" 34 #include "content/common/gpu/client/gpu_channel_host.h"
34 #include "content/common/gpu/gpu_messages.h" 35 #include "content/common/gpu/gpu_messages.h"
35 #include "content/common/indexed_db/indexed_db_dispatcher.h" 36 #include "content/common/indexed_db/indexed_db_dispatcher.h"
36 #include "content/common/indexed_db/indexed_db_message_filter.h" 37 #include "content/common/indexed_db/indexed_db_message_filter.h"
37 #include "content/common/npobject_util.h" 38 #include "content/common/npobject_util.h"
38 #include "content/common/plugin_messages.h" 39 #include "content/common/plugin_messages.h"
39 #include "content/common/resource_dispatcher.h" 40 #include "content/common/resource_dispatcher.h"
40 #include "content/common/resource_messages.h" 41 #include "content/common/resource_messages.h"
41 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
42 #include "content/common/web_database_observer_impl.h" 43 #include "content/common/web_database_observer_impl.h"
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 gpu_vda_context3d_.reset( 899 gpu_vda_context3d_.reset(
899 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 900 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
900 this, WebKit::WebGraphicsContext3D::Attributes(), 901 this, WebKit::WebGraphicsContext3D::Attributes(),
901 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))); 902 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D")));
902 if (gpu_vda_context3d_.get()) 903 if (gpu_vda_context3d_.get())
903 gpu_vda_context3d_->setContextLostCallback(context_lost_cb_.get()); 904 gpu_vda_context3d_->setContextLostCallback(context_lost_cb_.get());
904 } 905 }
905 return gpu_vda_context3d_.get(); 906 return gpu_vda_context3d_.get();
906 } 907 }
907 908
909 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
910 RenderThreadImpl::CreateOffscreenContext3d() {
911 WebKit::WebGraphicsContext3D::Attributes attributes;
912 attributes.shareResources = true;
913 attributes.depth = false;
914 attributes.stencil = false;
915 attributes.antialias = false;
916 attributes.noAutomaticFlushes = true;
917
918 return make_scoped_ptr(
919 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
920 this,
921 attributes,
922 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d")));
923 }
924
925 class RenderThreadImpl::RendererContextProviderCommandBuffer
926 : public content::ContextProviderCommandBuffer {
927 protected:
928 virtual ~RendererContextProviderCommandBuffer() {}
929
930 virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
931 CreateOffscreenContext3d() {
932 RenderThreadImpl* self = RenderThreadImpl::current();
933 DCHECK(self);
934 return self->CreateOffscreenContext3d().Pass();
935 }
936 };
937
938 scoped_refptr<cc::ContextProvider>
939 RenderThreadImpl::OffscreenContextProviderForMainThread() {
940 if (!shared_contexts_main_thread_ ||
941 shared_contexts_main_thread_->DestroyedOnMainThread())
942 shared_contexts_main_thread_ = new RendererContextProviderCommandBuffer;
943 return shared_contexts_main_thread_;
944 }
945
946 scoped_refptr<cc::ContextProvider>
947 RenderThreadImpl::OffscreenContextProviderForCompositorThread() {
948 if (!shared_contexts_compositor_thread_ ||
949 shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
950 shared_contexts_compositor_thread_ =
951 new RendererContextProviderCommandBuffer;
952 }
953 return shared_contexts_compositor_thread_;
954 }
955
908 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { 956 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() {
909 if (!audio_renderer_mixer_manager_.get()) { 957 if (!audio_renderer_mixer_manager_.get()) {
910 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( 958 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager(
911 GetAudioHardwareConfig())); 959 GetAudioHardwareConfig()));
912 } 960 }
913 961
914 return audio_renderer_mixer_manager_.get(); 962 return audio_renderer_mixer_manager_.get();
915 } 963 }
916 964
917 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { 965 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 1249
1202 void RenderThreadImpl::SetFlingCurveParameters( 1250 void RenderThreadImpl::SetFlingCurveParameters(
1203 const std::vector<float>& new_touchpad, 1251 const std::vector<float>& new_touchpad,
1204 const std::vector<float>& new_touchscreen) { 1252 const std::vector<float>& new_touchscreen) {
1205 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1253 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1206 new_touchscreen); 1254 new_touchscreen);
1207 1255
1208 } 1256 }
1209 1257
1210 } // namespace content 1258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698