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

Side by Side Diff: content/renderer/pepper/pepper_platform_context_3d_impl.cc

Issue 9959037: Put the Pepper stuff in the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/pepper/pepper_platform_context_3d_impl.h" 5 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/gpu/client/gpu_channel_host.h" 8 #include "content/common/gpu/client/gpu_channel_host.h"
9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
10 #include "content/renderer/pepper/pepper_parent_context_provider.h" 10 #include "content/renderer/pepper/pepper_parent_context_provider.h"
11 #include "content/renderer/render_thread_impl.h" 11 #include "content/renderer/render_thread_impl.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 13 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
14 #include "gpu/command_buffer/client/gles2_implementation.h" 14 #include "gpu/command_buffer/client/gles2_implementation.h"
15 #include "gpu/ipc/command_buffer_proxy.h" 15 #include "gpu/ipc/command_buffer_proxy.h"
16 #include "ppapi/c/pp_graphics_3d.h" 16 #include "ppapi/c/pp_graphics_3d.h"
17 #include "ui/gfx/gl/gpu_preference.h" 17 #include "ui/gfx/gl/gpu_preference.h"
18 18
19 #ifdef ENABLE_GPU 19 #ifdef ENABLE_GPU
20 20
21 namespace content {
22
21 PlatformContext3DImpl::PlatformContext3DImpl( 23 PlatformContext3DImpl::PlatformContext3DImpl(
22 PepperParentContextProvider* parent_context_provider) 24 PepperParentContextProvider* parent_context_provider)
23 : parent_context_provider_(parent_context_provider), 25 : parent_context_provider_(parent_context_provider),
24 parent_texture_id_(0), 26 parent_texture_id_(0),
25 has_alpha_(false), 27 has_alpha_(false),
26 command_buffer_(NULL), 28 command_buffer_(NULL),
27 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 29 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
28 } 30 }
29 31
30 PlatformContext3DImpl::~PlatformContext3DImpl() { 32 PlatformContext3DImpl::~PlatformContext3DImpl() {
(...skipping 29 matching lines...) Expand all
60 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 62 RenderThreadImpl* render_thread = RenderThreadImpl::current();
61 if (!render_thread) 63 if (!render_thread)
62 return false; 64 return false;
63 65
64 bool retry = false; 66 bool retry = false;
65 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 67 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
66 68
67 // Note similar code in PP_GRAPHICS3DATTRIB_initialize. 69 // Note similar code in PP_GRAPHICS3DATTRIB_initialize.
68 do { 70 do {
69 channel_ = render_thread->EstablishGpuChannelSync( 71 channel_ = render_thread->EstablishGpuChannelSync(
70 content::CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); 72 CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE);
71 if (!channel_.get()) 73 if (!channel_.get())
72 return false; 74 return false;
73 DCHECK(channel_->state() == GpuChannelHost::kConnected); 75 DCHECK(channel_->state() == GpuChannelHost::kConnected);
74 if (!retry) { 76 if (!retry) {
75 // If the creation of this context requires all contexts for this 77 // If the creation of this context requires all contexts for this
76 // renderer to be destroyed on the GPU process side, then drop the 78 // renderer to be destroyed on the GPU process side, then drop the
77 // channel and recreate it. 79 // channel and recreate it.
78 if (channel_->WillGpuSwitchOccur(true, gpu_preference)) { 80 if (channel_->WillGpuSwitchOccur(true, gpu_preference)) {
79 channel_->ForciblyCloseChannel(); 81 channel_->ForciblyCloseChannel();
80 retry = true; 82 retry = true;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 context_lost_callback_.Run(); 196 context_lost_callback_.Run();
195 } 197 }
196 198
197 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { 199 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) {
198 DCHECK(command_buffer_); 200 DCHECK(command_buffer_);
199 201
200 if (!console_message_callback_.is_null()) 202 if (!console_message_callback_.is_null())
201 console_message_callback_.Run(msg, id); 203 console_message_callback_.Run(msg, id);
202 } 204 }
203 205
206 } // namespace content
207
204 #endif // ENABLE_GPU 208 #endif // ENABLE_GPU
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_context_3d_impl.h ('k') | content/renderer/pepper/pepper_platform_image_2d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698