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

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

Issue 11267035: Fix layering violation where content is included by gpu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove NOTIMPLEMENTED entrypoints Created 8 years, 1 month 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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // fall-through 95 // fall-through
96 default: 96 default:
97 attribs.push_back(attr[0]); 97 attribs.push_back(attr[0]);
98 attribs.push_back(attr[1]); 98 attribs.push_back(attr[1]);
99 break; 99 break;
100 } 100 }
101 } 101 }
102 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); 102 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
103 } 103 }
104 104
105 CommandBufferProxy* share_buffer = NULL; 105 CommandBufferProxyImpl* share_buffer = NULL;
106 if (share_context) { 106 if (share_context) {
107 PlatformContext3DImpl* share_impl = 107 PlatformContext3DImpl* share_impl =
108 static_cast<PlatformContext3DImpl*>(share_context); 108 static_cast<PlatformContext3DImpl*>(share_context);
109 share_buffer = share_impl->command_buffer_; 109 share_buffer = share_impl->command_buffer_;
110 } 110 }
111 111
112 command_buffer_ = channel_->CreateOffscreenCommandBuffer( 112 command_buffer_ = channel_->CreateOffscreenCommandBuffer(
113 surface_size, 113 surface_size,
114 share_buffer, 114 share_buffer,
115 "*", 115 "*",
(...skipping 21 matching lines...) Expand all
137 parent_context_provider_ = NULL; 137 parent_context_provider_ = NULL;
138 parent_context_ = parent_context->AsWeakPtr(); 138 parent_context_ = parent_context->AsWeakPtr();
139 139
140 // Flush any remaining commands in the parent context to make sure the 140 // Flush any remaining commands in the parent context to make sure the
141 // texture id accounting stays consistent. 141 // texture id accounting stays consistent.
142 gpu::gles2::GLES2Implementation* parent_gles2 = 142 gpu::gles2::GLES2Implementation* parent_gles2 =
143 parent_context_->GetImplementation(); 143 parent_context_->GetImplementation();
144 parent_gles2->helper()->CommandBufferHelper::Finish(); 144 parent_gles2->helper()->CommandBufferHelper::Finish();
145 parent_texture_id_ = parent_gles2->MakeTextureId(); 145 parent_texture_id_ = parent_gles2->MakeTextureId();
146 146
147 CommandBufferProxy* parent_command_buffer = 147 CommandBufferProxyImpl* parent_command_buffer =
148 parent_context_->GetCommandBufferProxy(); 148 parent_context_->GetCommandBufferProxy();
149 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) 149 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_))
150 return false; 150 return false;
151 151
152 return true; 152 return true;
153 } 153 }
154 154
155 void PlatformContext3DImpl::SetParentContext( 155 void PlatformContext3DImpl::SetParentContext(
156 PepperParentContextProvider* parent_context_provider) { 156 PepperParentContextProvider* parent_context_provider) {
157 if (parent_context_.get() && parent_texture_id_ != 0) { 157 if (parent_context_.get() && parent_texture_id_ != 0) {
(...skipping 13 matching lines...) Expand all
171 return; 171 return;
172 172
173 parent_context_ = parent_context->AsWeakPtr(); 173 parent_context_ = parent_context->AsWeakPtr();
174 // Flush any remaining commands in the parent context to make sure the 174 // Flush any remaining commands in the parent context to make sure the
175 // texture id accounting stays consistent. 175 // texture id accounting stays consistent.
176 gpu::gles2::GLES2Implementation* parent_gles2 = 176 gpu::gles2::GLES2Implementation* parent_gles2 =
177 parent_context_->GetImplementation(); 177 parent_context_->GetImplementation();
178 parent_gles2->helper()->CommandBufferHelper::Flush(); 178 parent_gles2->helper()->CommandBufferHelper::Flush();
179 parent_texture_id_ = parent_gles2->MakeTextureId(); 179 parent_texture_id_ = parent_gles2->MakeTextureId();
180 180
181 CommandBufferProxy* parent_command_buffer = 181 CommandBufferProxyImpl* parent_command_buffer =
182 parent_context_->GetCommandBufferProxy(); 182 parent_context_->GetCommandBufferProxy();
183 command_buffer_->SetParent(parent_command_buffer, parent_texture_id_); 183 command_buffer_->SetParent(parent_command_buffer, parent_texture_id_);
184 } 184 }
185 185
186 unsigned PlatformContext3DImpl::GetBackingTextureId() { 186 unsigned PlatformContext3DImpl::GetBackingTextureId() {
187 DCHECK(command_buffer_); 187 DCHECK(command_buffer_);
188 return parent_texture_id_; 188 return parent_texture_id_;
189 } 189 }
190 190
191 bool PlatformContext3DImpl::IsOpaque() { 191 bool PlatformContext3DImpl::IsOpaque() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { 225 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) {
226 DCHECK(command_buffer_); 226 DCHECK(command_buffer_);
227 227
228 if (!console_message_callback_.is_null()) 228 if (!console_message_callback_.is_null())
229 console_message_callback_.Run(msg, id); 229 console_message_callback_.Run(msg, id);
230 } 230 }
231 231
232 } // namespace content 232 } // namespace content
233 233
234 #endif // ENABLE_GPU 234 #endif // ENABLE_GPU
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_context_3d_impl.h ('k') | gpu/ipc/command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698