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

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

Issue 8233027: Support dynamic switching between integrated and discrete GPUs on Mac OS X. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_platform_context_3d_impl.h" 5 #include "content/renderer/pepper_platform_context_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/renderer/render_thread_impl.h" 8 #include "content/renderer/render_thread_impl.h"
9 #include "content/renderer/gpu/renderer_gl_context.h" 9 #include "content/renderer/gpu/renderer_gl_context.h"
10 #include "content/renderer/gpu/gpu_channel_host.h" 10 #include "content/renderer/gpu/gpu_channel_host.h"
11 #include "content/renderer/gpu/command_buffer_proxy.h" 11 #include "content/renderer/gpu/command_buffer_proxy.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 "ui/gfx/gl/gpu_preference.h"
15 16
16 #ifdef ENABLE_GPU 17 #ifdef ENABLE_GPU
17 18
18 PlatformContext3DImpl::PlatformContext3DImpl(RendererGLContext* parent_context) 19 PlatformContext3DImpl::PlatformContext3DImpl(RendererGLContext* parent_context)
19 : parent_context_(parent_context->AsWeakPtr()), 20 : parent_context_(parent_context->AsWeakPtr()),
20 parent_texture_id_(0), 21 parent_texture_id_(0),
21 command_buffer_(NULL), 22 command_buffer_(NULL),
22 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 23 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
23 } 24 }
24 25
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 attribs.push_back(RendererGLContext::NONE); 93 attribs.push_back(RendererGLContext::NONE);
93 } 94 }
94 95
95 CommandBufferProxy* parent_command_buffer = 96 CommandBufferProxy* parent_command_buffer =
96 parent_context_->GetCommandBufferProxy(); 97 parent_context_->GetCommandBufferProxy();
97 command_buffer_ = channel_->CreateOffscreenCommandBuffer( 98 command_buffer_ = channel_->CreateOffscreenCommandBuffer(
98 surface_size, 99 surface_size,
99 NULL, 100 NULL,
100 "*", 101 "*",
101 attribs, 102 attribs,
102 GURL::EmptyGURL()); 103 GURL::EmptyGURL(),
104 gfx::PreferDiscreteGpu);
103 if (!command_buffer_) 105 if (!command_buffer_)
104 return false; 106 return false;
105 107
106 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) 108 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_))
107 return false; 109 return false;
108 110
109 command_buffer_->SetChannelErrorCallback( 111 command_buffer_->SetChannelErrorCallback(
110 base::Bind(&PlatformContext3DImpl::OnContextLost, 112 base::Bind(&PlatformContext3DImpl::OnContextLost,
111 weak_ptr_factory_.GetWeakPtr())); 113 weak_ptr_factory_.GetWeakPtr()));
112 114
(...skipping 23 matching lines...) Expand all
136 } 138 }
137 139
138 void PlatformContext3DImpl::OnContextLost() { 140 void PlatformContext3DImpl::OnContextLost() {
139 DCHECK(command_buffer_); 141 DCHECK(command_buffer_);
140 142
141 if (!context_lost_callback_.is_null()) 143 if (!context_lost_callback_.is_null())
142 context_lost_callback_.Run(); 144 context_lost_callback_.Run();
143 } 145 }
144 146
145 #endif // ENABLE_GPU 147 #endif // ENABLE_GPU
OLDNEW
« no previous file with comments | « content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc ('k') | content/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698