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

Side by Side Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 12440005: Use gpu::Mailbox in IPCs instead of std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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/browser/renderer_host/image_transport_factory.h" 5 #include "content/browser/renderer_host/image_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 public: 160 public:
161 ImageTransportClientTexture( 161 ImageTransportClientTexture(
162 WebKit::WebGraphicsContext3D* host_context, 162 WebKit::WebGraphicsContext3D* host_context,
163 float device_scale_factor) 163 float device_scale_factor)
164 : OwnedTexture(host_context, 164 : OwnedTexture(host_context,
165 gfx::Size(0, 0), 165 gfx::Size(0, 0),
166 device_scale_factor, 166 device_scale_factor,
167 host_context->createTexture()) { 167 host_context->createTexture()) {
168 } 168 }
169 169
170 virtual void Consume(const std::string& mailbox_name, 170 virtual void Consume(const gpu::Mailbox& mailbox_name,
171 const gfx::Size& new_size) OVERRIDE { 171 const gfx::Size& new_size) OVERRIDE {
172 DCHECK(mailbox_name.size() == GL_MAILBOX_SIZE_CHROMIUM); 172 DCHECK(host_context_ && texture_id_);
173 mailbox_name_ = mailbox_name; 173 mailbox_name_ = mailbox_name;
174 if (mailbox_name.empty())
175 return;
176
177 DCHECK(host_context_ && texture_id_);
178 host_context_->bindTexture(GL_TEXTURE_2D, texture_id_); 174 host_context_->bindTexture(GL_TEXTURE_2D, texture_id_);
179 host_context_->consumeTextureCHROMIUM( 175 host_context_->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name.name);
180 GL_TEXTURE_2D,
181 reinterpret_cast<const signed char*>(mailbox_name.c_str()));
182 size_ = new_size; 176 size_ = new_size;
183 host_context_->shallowFlushCHROMIUM(); 177 host_context_->shallowFlushCHROMIUM();
184 } 178 }
185 179
186 virtual std::string Produce() OVERRIDE { 180 virtual gpu::Mailbox Produce() OVERRIDE {
187 std::string name; 181 DCHECK(!mailbox_name_.IsZero());
188 if (!mailbox_name_.empty()) { 182 DCHECK(host_context_ && texture_id_);
189 DCHECK(host_context_ && texture_id_); 183 host_context_->bindTexture(GL_TEXTURE_2D, texture_id_);
190 host_context_->bindTexture(GL_TEXTURE_2D, texture_id_); 184 host_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name_.name);
191 host_context_->produceTextureCHROMIUM( 185 gpu::Mailbox name;
192 GL_TEXTURE_2D, 186 std::swap(mailbox_name_, name);
193 reinterpret_cast<const signed char*>(mailbox_name_.c_str()));
194 mailbox_name_.swap(name);
195 }
196 return name; 187 return name;
197 } 188 }
198 189
199 protected: 190 protected:
200 virtual ~ImageTransportClientTexture() {} 191 virtual ~ImageTransportClientTexture() {}
201 192
202 private: 193 private:
203 std::string mailbox_name_; 194 gpu::Mailbox mailbox_name_;
204 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); 195 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
205 }; 196 };
206 197
207 class GpuProcessTransportFactory; 198 class GpuProcessTransportFactory;
208 199
209 class CompositorSwapClient 200 class CompositorSwapClient
210 : public base::SupportsWeakPtr<CompositorSwapClient>, 201 : public base::SupportsWeakPtr<CompositorSwapClient>,
211 public WebGraphicsContext3DSwapBuffersClient { 202 public WebGraphicsContext3DSwapBuffersClient {
212 public: 203 public:
213 CompositorSwapClient(ui::Compositor* compositor, 204 CompositorSwapClient(ui::Compositor* compositor,
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 delete g_factory; 770 delete g_factory;
780 g_factory = NULL; 771 g_factory = NULL;
781 } 772 }
782 773
783 // static 774 // static
784 ImageTransportFactory* ImageTransportFactory::GetInstance() { 775 ImageTransportFactory* ImageTransportFactory::GetInstance() {
785 return g_factory; 776 return g_factory;
786 } 777 }
787 778
788 } // namespace content 779 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.cc ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698