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

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

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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
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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 channel_->DestroyCommandBuffer(command_buffer_); 44 channel_->DestroyCommandBuffer(command_buffer_);
45 command_buffer_ = NULL; 45 command_buffer_ = NULL;
46 if (channel_->WillGpuSwitchOccur(false, gfx::PreferDiscreteGpu)) { 46 if (channel_->WillGpuSwitchOccur(false, gfx::PreferDiscreteGpu)) {
47 channel_->ForciblyCloseChannel(); 47 channel_->ForciblyCloseChannel();
48 } 48 }
49 } 49 }
50 50
51 channel_ = NULL; 51 channel_ = NULL;
52 } 52 }
53 53
54 bool PlatformContext3DImpl::Init(const int32* attrib_list) { 54 bool PlatformContext3DImpl::Init(const int32* attrib_list,
55 CommandBufferProxy* share_buffer) {
55 // Ignore initializing more than once. 56 // Ignore initializing more than once.
56 if (command_buffer_) 57 if (command_buffer_)
57 return true; 58 return true;
58 59
59 if (!parent_context_provider_) 60 if (!parent_context_provider_)
60 return false; 61 return false;
61 62
62 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 63 RenderThreadImpl* render_thread = RenderThreadImpl::current();
63 if (!render_thread) 64 if (!render_thread)
64 return false; 65 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 attribs.push_back(attr[0]); 110 attribs.push_back(attr[0]);
110 attribs.push_back(attr[1]); 111 attribs.push_back(attr[1]);
111 break; 112 break;
112 } 113 }
113 } 114 }
114 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); 115 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
115 } 116 }
116 117
117 command_buffer_ = channel_->CreateOffscreenCommandBuffer( 118 command_buffer_ = channel_->CreateOffscreenCommandBuffer(
118 surface_size, 119 surface_size,
119 NULL, 120 share_buffer,
120 "*", 121 "*",
121 attribs, 122 attribs,
122 GURL::EmptyGURL(), 123 GURL::EmptyGURL(),
123 gpu_preference); 124 gpu_preference);
124 if (!command_buffer_) 125 if (!command_buffer_)
125 return false; 126 return false;
126 127
127 command_buffer_->SetChannelErrorCallback( 128 command_buffer_->SetChannelErrorCallback(
128 base::Bind(&PlatformContext3DImpl::OnContextLost, 129 base::Bind(&PlatformContext3DImpl::OnContextLost,
129 weak_ptr_factory_.GetWeakPtr())); 130 weak_ptr_factory_.GetWeakPtr()));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { 200 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) {
200 DCHECK(command_buffer_); 201 DCHECK(command_buffer_);
201 202
202 if (!console_message_callback_.is_null()) 203 if (!console_message_callback_.is_null())
203 console_message_callback_.Run(msg, id); 204 console_message_callback_.Run(msg, id);
204 } 205 }
205 206
206 } // namespace content 207 } // namespace content
207 208
208 #endif // ENABLE_GPU 209 #endif // ENABLE_GPU
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698