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

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/content_gl_context.h" 8 #include "content/common/gpu/client/content_gl_context.h"
9 #include "content/common/gpu/client/gpu_channel_host.h" 9 #include "content/common/gpu/client/gpu_channel_host.h"
10 #include "content/common/gpu/client/command_buffer_proxy.h" 10 #include "content/common/gpu/client/command_buffer_proxy.h"
11 #include "content/renderer/pepper/pepper_parent_context_provider.h" 11 #include "content/renderer/pepper/pepper_parent_context_provider.h"
12 #include "content/renderer/render_thread_impl.h" 12 #include "content/renderer/render_thread_impl.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 14 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
15 #include "gpu/command_buffer/client/gles2_implementation.h" 15 #include "gpu/command_buffer/client/gles2_implementation.h"
16 #include "ui/gfx/gl/gpu_preference.h" 16 #include "ui/gfx/gl/gpu_preference.h"
17 17
18 #ifdef ENABLE_GPU 18 #ifdef ENABLE_GPU
19 19
20 namespace content {
21
20 PlatformContext3DImpl::PlatformContext3DImpl( 22 PlatformContext3DImpl::PlatformContext3DImpl(
21 PepperParentContextProvider* parent_context_provider) 23 PepperParentContextProvider* parent_context_provider)
22 : parent_context_provider_(parent_context_provider), 24 : parent_context_provider_(parent_context_provider),
23 parent_texture_id_(0), 25 parent_texture_id_(0),
24 has_alpha_(false), 26 has_alpha_(false),
25 command_buffer_(NULL), 27 command_buffer_(NULL),
26 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 28 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
27 } 29 }
28 30
29 PlatformContext3DImpl::~PlatformContext3DImpl() { 31 PlatformContext3DImpl::~PlatformContext3DImpl() {
(...skipping 29 matching lines...) Expand all
59 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 61 RenderThreadImpl* render_thread = RenderThreadImpl::current();
60 if (!render_thread) 62 if (!render_thread)
61 return false; 63 return false;
62 64
63 bool retry = false; 65 bool retry = false;
64 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 66 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
65 67
66 // Note similar code in WebGraphicsContext3DCommandBufferImpl::initialize. 68 // Note similar code in WebGraphicsContext3DCommandBufferImpl::initialize.
67 do { 69 do {
68 channel_ = render_thread->EstablishGpuChannelSync( 70 channel_ = render_thread->EstablishGpuChannelSync(
69 content::CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); 71 content::CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE);
jam 2012/03/30 21:50:03 nit: get rid of content:: now
70 if (!channel_.get()) 72 if (!channel_.get())
71 return false; 73 return false;
72 DCHECK(channel_->state() == GpuChannelHost::kConnected); 74 DCHECK(channel_->state() == GpuChannelHost::kConnected);
73 if (!retry) { 75 if (!retry) {
74 // If the creation of this context requires all contexts for this 76 // If the creation of this context requires all contexts for this
75 // renderer to be destroyed on the GPU process side, then drop the 77 // renderer to be destroyed on the GPU process side, then drop the
76 // channel and recreate it. 78 // channel and recreate it.
77 if (channel_->WillGpuSwitchOccur(true, gpu_preference)) { 79 if (channel_->WillGpuSwitchOccur(true, gpu_preference)) {
78 channel_->ForciblyCloseChannel(); 80 channel_->ForciblyCloseChannel();
79 retry = true; 81 retry = true;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 context_lost_callback_.Run(); 195 context_lost_callback_.Run();
194 } 196 }
195 197
196 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { 198 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) {
197 DCHECK(command_buffer_); 199 DCHECK(command_buffer_);
198 200
199 if (!console_message_callback_.is_null()) 201 if (!console_message_callback_.is_null())
200 console_message_callback_.Run(msg, id); 202 console_message_callback_.Run(msg, id);
201 } 203 }
202 204
205 } // namespace content
206
203 #endif // ENABLE_GPU 207 #endif // ENABLE_GPU
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698