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

Side by Side Diff: cc/delegating_renderer.cc

Issue 12545018: Move context-related callbacks into OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: works 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/delegating_renderer.h" 5 #include "cc/delegating_renderer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); 63 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D();
64 64
65 if (!context3d) { 65 if (!context3d) {
66 // Software compositing. 66 // Software compositing.
67 return true; 67 return true;
68 } 68 }
69 69
70 if (!context3d->makeContextCurrent()) 70 if (!context3d->makeContextCurrent())
71 return false; 71 return false;
72 72
73 context3d->setContextLostCallback(this);
74 context3d->pushGroupMarkerEXT("CompositorContext"); 73 context3d->pushGroupMarkerEXT("CompositorContext");
75 74
76 std::string extensionsString = 75 std::string extensionsString =
77 UTF16ToASCII(context3d->getString(GL_EXTENSIONS)); 76 UTF16ToASCII(context3d->getString(GL_EXTENSIONS));
78 77
79 std::vector<std::string> extensions; 78 std::vector<std::string> extensions;
80 base::SplitString(extensionsString, ' ', &extensions); 79 base::SplitString(extensionsString, ' ', &extensions);
81 80
82 // TODO(danakj): We need non-GPU-specific paths for these things. This 81 // TODO(danakj): We need non-GPU-specific paths for these things. This
83 // renderer shouldn't need to use context3d extensions directly. 82 // renderer shouldn't need to use context3d extensions directly.
(...skipping 30 matching lines...) Expand all
114 capabilities_.using_set_visibility = hasSetVisibility; 113 capabilities_.using_set_visibility = hasSetVisibility;
115 114
116 // TODO(danakj): Support GpuMemoryManager. 115 // TODO(danakj): Support GpuMemoryManager.
117 capabilities_.using_gpu_memory_manager = false; 116 capabilities_.using_gpu_memory_manager = false;
118 117
119 capabilities_.using_egl_image = hasEGLImage; 118 capabilities_.using_egl_image = hasEGLImage;
120 119
121 return true; 120 return true;
122 } 121 }
123 122
124 DelegatingRenderer::~DelegatingRenderer() { 123 DelegatingRenderer::~DelegatingRenderer() {}
125 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D();
126 if (context3d)
127 context3d->setContextLostCallback(NULL);
128 }
129 124
130 const RendererCapabilities& DelegatingRenderer::Capabilities() const { 125 const RendererCapabilities& DelegatingRenderer::Capabilities() const {
131 return capabilities_; 126 return capabilities_;
132 } 127 }
133 128
134 static ResourceProvider::ResourceId AppendToArray( 129 static ResourceProvider::ResourceId AppendToArray(
135 ResourceProvider::ResourceIdArray* array, 130 ResourceProvider::ResourceIdArray* array,
136 ResourceProvider::ResourceId id) { 131 ResourceProvider::ResourceId id) {
137 array->push_back(id); 132 array->push_back(id);
138 return id; 133 return id;
(...skipping 30 matching lines...) Expand all
169 return true; 164 return true;
170 } 165 }
171 166
172 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { 167 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) {
173 NOTIMPLEMENTED(); 168 NOTIMPLEMENTED();
174 } 169 }
175 170
176 void DelegatingRenderer::ReceiveCompositorFrameAck( 171 void DelegatingRenderer::ReceiveCompositorFrameAck(
177 const CompositorFrameAck& ack) { 172 const CompositorFrameAck& ack) {
178 resource_provider_->ReceiveFromParent(ack.resources); 173 resource_provider_->ReceiveFromParent(ack.resources);
179 if (client_->HasImplThread())
180 client_->OnSwapBuffersComplete();
181 } 174 }
182 175
183 176
184 bool DelegatingRenderer::IsContextLost() { 177 bool DelegatingRenderer::IsContextLost() {
185 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); 178 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D();
186 if (!context3d) 179 if (!context3d)
187 return false; 180 return false;
188 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; 181 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR;
189 } 182 }
190 183
191 void DelegatingRenderer::SetVisible(bool visible) { 184 void DelegatingRenderer::SetVisible(bool visible) {
192 visible_ = visible; 185 visible_ = visible;
193 } 186 }
194 187
195 void DelegatingRenderer::onContextLost() {
196 client_->DidLoseOutputSurface();
197 }
198
199 } // namespace cc 188 } // namespace cc
OLDNEW
« no previous file with comments | « cc/delegating_renderer.h ('k') | cc/gl_renderer.h » ('j') | cc/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698