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

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

Issue 10828262: Partial revert of 146621 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura bot Created 8 years, 4 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ui::Compositor* compositor) OVERRIDE { 50 ui::Compositor* compositor) OVERRIDE {
51 return gfx::GLSurfaceHandle(); 51 return gfx::GLSurfaceHandle();
52 } 52 }
53 53
54 virtual void DestroySharedSurfaceHandle( 54 virtual void DestroySharedSurfaceHandle(
55 gfx::GLSurfaceHandle surface) OVERRIDE { 55 gfx::GLSurfaceHandle surface) OVERRIDE {
56 } 56 }
57 57
58 virtual scoped_refptr<ui::Texture> CreateTransportClient( 58 virtual scoped_refptr<ui::Texture> CreateTransportClient(
59 const gfx::Size& size, 59 const gfx::Size& size,
60 uint64 transport_handle, 60 uint64 transport_handle) OVERRIDE {
61 ui::Compositor* compositor) OVERRIDE {
62 return NULL; 61 return NULL;
63 } 62 }
64 63
65 virtual GLHelper* GetGLHelper(ui::Compositor* compositor) OVERRIDE { 64 virtual GLHelper* GetGLHelper(ui::Compositor* compositor) OVERRIDE {
66 return NULL; 65 return NULL;
67 } 66 }
68 67
69 virtual uint32 InsertSyncPoint(ui::Compositor* compositor) OVERRIDE { 68 virtual uint32 InsertSyncPoint(ui::Compositor* compositor) OVERRIDE {
70 return 0; 69 return 0;
71 } 70 }
72 71
73 // We don't generate lost context events, so we don't need to keep track of 72 // We don't generate lost context events, so we don't need to keep track of
74 // observers 73 // observers
75 virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE { 74 virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE {
76 } 75 }
77 76
78 virtual void RemoveObserver( 77 virtual void RemoveObserver(
79 ImageTransportFactoryObserver* observer) OVERRIDE { 78 ImageTransportFactoryObserver* observer) OVERRIDE {
80 } 79 }
81 80
82 private: 81 private:
83 DISALLOW_COPY_AND_ASSIGN(DefaultTransportFactory); 82 DISALLOW_COPY_AND_ASSIGN(DefaultTransportFactory);
84 }; 83 };
85 84
86 class ImageTransportClientTexture : public ui::Texture { 85 class ImageTransportClientTexture : public ui::Texture {
87 public: 86 public:
88 ImageTransportClientTexture( 87 ImageTransportClientTexture(
89 WebKit::WebGraphicsContext3D* host_context,
90 const gfx::Size& size, 88 const gfx::Size& size,
91 uint64 surface_id) 89 uint64 surface_id)
92 : ui::Texture(true, size), 90 : ui::Texture(true, size) {
93 host_context_(host_context) {
94 set_texture_id(surface_id); 91 set_texture_id(surface_id);
95 } 92 }
96 93
97 virtual WebKit::WebGraphicsContext3D* HostContext3D() {
98 return host_context_;
99 }
100
101 protected: 94 protected:
102 virtual ~ImageTransportClientTexture() {} 95 virtual ~ImageTransportClientTexture() {}
103 96
104 private: 97 private:
105 // A raw pointer. This |ImageTransportClientTexture| will be destroyed
106 // before the |host_context_| via
107 // |ImageTransportFactoryObserver::OnLostContext()| handlers.
108 WebKit::WebGraphicsContext3D* host_context_;
109
110 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); 98 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
111 }; 99 };
112 100
113 class GpuProcessTransportFactory; 101 class GpuProcessTransportFactory;
114 102
115 class CompositorSwapClient 103 class CompositorSwapClient
116 : public base::SupportsWeakPtr<CompositorSwapClient>, 104 : public base::SupportsWeakPtr<CompositorSwapClient>,
117 public WebGraphicsContext3DSwapBuffersClient { 105 public WebGraphicsContext3DSwapBuffersClient {
118 public: 106 public:
119 CompositorSwapClient(ui::Compositor* compositor, 107 CompositorSwapClient(ui::Compositor* compositor,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 data->shared_context->deleteTexture(surface.parent_texture_id[0]); 202 data->shared_context->deleteTexture(surface.parent_texture_id[0]);
215 data->shared_context->deleteTexture(surface.parent_texture_id[1]); 203 data->shared_context->deleteTexture(surface.parent_texture_id[1]);
216 data->shared_context->flush(); 204 data->shared_context->flush();
217 break; 205 break;
218 } 206 }
219 } 207 }
220 } 208 }
221 209
222 virtual scoped_refptr<ui::Texture> CreateTransportClient( 210 virtual scoped_refptr<ui::Texture> CreateTransportClient(
223 const gfx::Size& size, 211 const gfx::Size& size,
224 uint64 transport_handle, 212 uint64 transport_handle) {
225 ui::Compositor* compositor) {
226 PerCompositorData* data = per_compositor_data_[compositor];
227 DCHECK(data);
228 scoped_refptr<ImageTransportClientTexture> image( 213 scoped_refptr<ImageTransportClientTexture> image(
229 new ImageTransportClientTexture(data->shared_context.get(), 214 new ImageTransportClientTexture(size, transport_handle));
230 size, transport_handle));
231 return image; 215 return image;
232 } 216 }
233 217
234 virtual GLHelper* GetGLHelper(ui::Compositor* compositor) { 218 virtual GLHelper* GetGLHelper(ui::Compositor* compositor) {
235 PerCompositorData* data = per_compositor_data_[compositor]; 219 PerCompositorData* data = per_compositor_data_[compositor];
236 if (!data) 220 if (!data)
237 data = CreatePerCompositorData(compositor); 221 data = CreatePerCompositorData(compositor);
238 if (!data->gl_helper.get()) { 222 if (!data->gl_helper.get()) {
239 WebKit::WebGraphicsContext3D* context_for_thread = 223 WebKit::WebGraphicsContext3D* context_for_thread =
240 CreateContextCommon(compositor, true); 224 CreateContextCommon(compositor, true);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 void ImageTransportFactory::Terminate() { 393 void ImageTransportFactory::Terminate() {
410 ui::ContextFactory::SetInstance(NULL); 394 ui::ContextFactory::SetInstance(NULL);
411 delete g_factory; 395 delete g_factory;
412 g_factory = NULL; 396 g_factory = NULL;
413 } 397 }
414 398
415 // static 399 // static
416 ImageTransportFactory* ImageTransportFactory::GetInstance() { 400 ImageTransportFactory* ImageTransportFactory::GetInstance() {
417 return g_factory; 401 return g_factory;
418 } 402 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698