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

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: rebaseforreals 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 gpu_vda_context3d_.reset( 900 gpu_vda_context3d_.reset(
900 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 901 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
901 this, WebKit::WebGraphicsContext3D::Attributes(), 902 this, WebKit::WebGraphicsContext3D::Attributes(),
902 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))); 903 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D")));
903 if (gpu_vda_context3d_.get()) 904 if (gpu_vda_context3d_.get())
904 gpu_vda_context3d_->setContextLostCallback(context_lost_cb_.get()); 905 gpu_vda_context3d_->setContextLostCallback(context_lost_cb_.get());
905 } 906 }
906 return gpu_vda_context3d_.get(); 907 return gpu_vda_context3d_.get();
907 } 908 }
908 909
910 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
911 RenderThreadImpl::CreateOffscreenContext3d() {
912 WebKit::WebGraphicsContext3D::Attributes attributes;
913 attributes.shareResources = true;
914 attributes.depth = false;
915 attributes.stencil = false;
916 attributes.antialias = false;
917 attributes.noAutomaticFlushes = true;
918
919 return make_scoped_ptr(
920 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
921 this,
922 attributes,
923 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d")));
924 }
925
926 class RenderThreadImpl::RendererContextProviderCommandBuffer
927 : public content::ContextProviderCommandBuffer {
928 protected:
929 virtual ~RendererContextProviderCommandBuffer() {}
930
931 virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
932 CreateOffscreenContext3d() {
933 RenderThreadImpl* self = RenderThreadImpl::current();
934 DCHECK(self);
935 return self->CreateOffscreenContext3d().Pass();
936 }
937 };
938
939 scoped_refptr<cc::ContextProvider>
940 RenderThreadImpl::OffscreenContextProviderForMainThread() {
941 if (!shared_contexts_main_thread_ ||
942 shared_contexts_main_thread_->DestroyedOnMainThread())
943 shared_contexts_main_thread_ = new RendererContextProviderCommandBuffer;
944 return shared_contexts_main_thread_;
945 }
946
947 scoped_refptr<cc::ContextProvider>
948 RenderThreadImpl::OffscreenContextProviderForCompositorThread() {
949 if (!shared_contexts_compositor_thread_ ||
950 shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
951 shared_contexts_compositor_thread_ =
952 new RendererContextProviderCommandBuffer;
953 }
954 return shared_contexts_compositor_thread_;
955 }
956
909 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { 957 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() {
910 if (!audio_renderer_mixer_manager_.get()) { 958 if (!audio_renderer_mixer_manager_.get()) {
911 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( 959 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager(
912 GetAudioHardwareConfig())); 960 GetAudioHardwareConfig()));
913 } 961 }
914 962
915 return audio_renderer_mixer_manager_.get(); 963 return audio_renderer_mixer_manager_.get();
916 } 964 }
917 965
918 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { 966 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 1250
1203 void RenderThreadImpl::SetFlingCurveParameters( 1251 void RenderThreadImpl::SetFlingCurveParameters(
1204 const std::vector<float>& new_touchpad, 1252 const std::vector<float>& new_touchpad,
1205 const std::vector<float>& new_touchscreen) { 1253 const std::vector<float>& new_touchscreen) {
1206 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1254 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1207 new_touchscreen); 1255 new_touchscreen);
1208 1256
1209 } 1257 }
1210 1258
1211 } // namespace content 1259 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/renderer_webkitplatformsupport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698