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

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

Issue 165393003: gpu: Generate mailboxes on client side (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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.h" 5 #include "content/renderer/pepper/pepper_platform_context_3d.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/gpu/client/context_provider_command_buffer.h" 8 #include "content/common/gpu/client/context_provider_command_buffer.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/webgraphicscontext3d_command_buffer_impl.h" 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 command_buffer_ = channel_->CreateOffscreenCommandBuffer( 93 command_buffer_ = channel_->CreateOffscreenCommandBuffer(
94 surface_size, 94 surface_size,
95 share_buffer, 95 share_buffer,
96 attribs, 96 attribs,
97 GURL::EmptyGURL(), 97 GURL::EmptyGURL(),
98 gpu_preference); 98 gpu_preference);
99 if (!command_buffer_) 99 if (!command_buffer_)
100 return false; 100 return false;
101 if (!command_buffer_->Initialize()) 101 if (!command_buffer_->Initialize())
102 return false; 102 return false;
103 std::vector<gpu::Mailbox> names; 103 gpu::Mailbox mailbox = gpu::Mailbox::Generate();
104 if (!command_buffer_->GenerateMailboxNames(1, &names)) 104 if (!command_buffer_->ProduceFrontBuffer(mailbox))
105 return false; 105 return false;
106 DCHECK_EQ(names.size(), 1u); 106 mailbox_ = mailbox;
107 if (!command_buffer_->ProduceFrontBuffer(names[0]))
108 return false;
109 mailbox_ = names[0];
110 107
111 command_buffer_->SetChannelErrorCallback( 108 command_buffer_->SetChannelErrorCallback(
112 base::Bind(&PlatformContext3D::OnContextLost, 109 base::Bind(&PlatformContext3D::OnContextLost,
113 weak_ptr_factory_.GetWeakPtr())); 110 weak_ptr_factory_.GetWeakPtr()));
114 command_buffer_->SetOnConsoleMessageCallback( 111 command_buffer_->SetOnConsoleMessageCallback(
115 base::Bind(&PlatformContext3D::OnConsoleMessage, 112 base::Bind(&PlatformContext3D::OnConsoleMessage,
116 weak_ptr_factory_.GetWeakPtr())); 113 weak_ptr_factory_.GetWeakPtr()));
117 114
118 return true; 115 return true;
119 } 116 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 158 }
162 159
163 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) { 160 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) {
164 DCHECK(command_buffer_); 161 DCHECK(command_buffer_);
165 162
166 if (!console_message_callback_.is_null()) 163 if (!console_message_callback_.is_null())
167 console_message_callback_.Run(msg, id); 164 console_message_callback_.Run(msg, id);
168 } 165 }
169 166
170 } // namespace content 167 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698