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

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 148003006: Use gpu::Mailbox instead of std:string in IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed typo 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/browser/gpu/gpu_data_manager_impl.h" 22 #include "content/browser/gpu/gpu_data_manager_impl.h"
23 #include "content/browser/gpu/gpu_surface_tracker.h" 23 #include "content/browser/gpu/gpu_surface_tracker.h"
24 #include "content/browser/renderer_host/render_widget_host_impl.h" 24 #include "content/browser/renderer_host/render_widget_host_impl.h"
25 #include "content/common/gpu/client/context_provider_command_buffer.h" 25 #include "content/common/gpu/client/context_provider_command_buffer.h"
26 #include "content/common/gpu/client/gl_helper.h" 26 #include "content/common/gpu/client/gl_helper.h"
27 #include "content/common/gpu/client/gpu_channel_host.h" 27 #include "content/common/gpu/client/gpu_channel_host.h"
28 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 28 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
29 #include "content/common/gpu/gpu_process_launch_causes.h" 29 #include "content/common/gpu/gpu_process_launch_causes.h"
30 #include "gpu/GLES2/gl2extchromium.h" 30 #include "gpu/GLES2/gl2extchromium.h"
31 #include "gpu/command_buffer/client/gles2_interface.h" 31 #include "gpu/command_buffer/client/gles2_interface.h"
32 #include "gpu/command_buffer/common/mailbox.h"
32 #include "third_party/khronos/GLES2/gl2.h" 33 #include "third_party/khronos/GLES2/gl2.h"
33 #include "ui/compositor/compositor.h" 34 #include "ui/compositor/compositor.h"
34 #include "ui/compositor/compositor_constants.h" 35 #include "ui/compositor/compositor_constants.h"
35 #include "ui/compositor/compositor_switches.h" 36 #include "ui/compositor/compositor_switches.h"
36 #include "ui/gfx/native_widget_types.h" 37 #include "ui/gfx/native_widget_types.h"
37 #include "ui/gfx/size.h" 38 #include "ui/gfx/size.h"
38 39
39 #if defined(OS_WIN) 40 #if defined(OS_WIN)
40 #include "content/browser/compositor/software_output_device_win.h" 41 #include "content/browser/compositor/software_output_device_win.h"
41 #elif defined(USE_OZONE) 42 #elif defined(USE_OZONE)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 class ImageTransportClientTexture : public OwnedTexture { 107 class ImageTransportClientTexture : public OwnedTexture {
107 public: 108 public:
108 ImageTransportClientTexture(const scoped_refptr<ContextProvider>& provider, 109 ImageTransportClientTexture(const scoped_refptr<ContextProvider>& provider,
109 float device_scale_factor, 110 float device_scale_factor,
110 GLuint texture_id) 111 GLuint texture_id)
111 : OwnedTexture(provider, 112 : OwnedTexture(provider,
112 gfx::Size(0, 0), 113 gfx::Size(0, 0),
113 device_scale_factor, 114 device_scale_factor,
114 texture_id) {} 115 texture_id) {}
115 116
116 virtual void Consume(const std::string& mailbox_name, 117 virtual void Consume(const gpu::Mailbox& mailbox,
117 const gfx::Size& new_size) OVERRIDE { 118 const gfx::Size& new_size) OVERRIDE {
118 DCHECK(mailbox_name.size() == GL_MAILBOX_SIZE_CHROMIUM); 119 mailbox_ = mailbox;
119 mailbox_name_ = mailbox_name; 120 if (mailbox.IsZero())
120 if (mailbox_name.empty())
121 return; 121 return;
122 122
123 DCHECK(provider_ && texture_id_); 123 DCHECK(provider_ && texture_id_);
124 GLES2Interface* gl = provider_->ContextGL(); 124 GLES2Interface* gl = provider_->ContextGL();
125 gl->BindTexture(GL_TEXTURE_2D, texture_id_); 125 gl->BindTexture(GL_TEXTURE_2D, texture_id_);
126 gl->ConsumeTextureCHROMIUM( 126 gl->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
127 GL_TEXTURE_2D, reinterpret_cast<const GLbyte*>(mailbox_name.c_str()));
128 size_ = new_size; 127 size_ = new_size;
129 gl->ShallowFlushCHROMIUM(); 128 gl->ShallowFlushCHROMIUM();
130 } 129 }
131 130
132 virtual std::string Produce() OVERRIDE { return mailbox_name_; } 131 virtual gpu::Mailbox Produce() OVERRIDE { return mailbox_; }
133 132
134 protected: 133 protected:
135 virtual ~ImageTransportClientTexture() {} 134 virtual ~ImageTransportClientTexture() {}
136 135
137 private: 136 private:
138 std::string mailbox_name_; 137 gpu::Mailbox mailbox_;
139 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); 138 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
140 }; 139 };
141 140
142 GpuProcessTransportFactory::GpuProcessTransportFactory() 141 GpuProcessTransportFactory::GpuProcessTransportFactory()
143 : callback_factory_(this) { 142 : callback_factory_(this) {
144 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy( 143 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy(
145 &output_surface_map_); 144 &output_surface_map_);
146 } 145 }
147 146
148 GpuProcessTransportFactory::~GpuProcessTransportFactory() { 147 GpuProcessTransportFactory::~GpuProcessTransportFactory() {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 observer_list_, 471 observer_list_,
473 OnLostResources()); 472 OnLostResources());
474 473
475 // Kill things that use the shared context before killing the shared context. 474 // Kill things that use the shared context before killing the shared context.
476 lost_gl_helper.reset(); 475 lost_gl_helper.reset();
477 lost_offscreen_compositor_contexts = NULL; 476 lost_offscreen_compositor_contexts = NULL;
478 lost_shared_main_thread_contexts = NULL; 477 lost_shared_main_thread_contexts = NULL;
479 } 478 }
480 479
481 } // namespace content 480 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698