| OLD | NEW |
| 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/output/delegating_renderer.h" | 5 #include "cc/output/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 Loading... |
| 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 extensions_string = | 75 std::string extensions_string = |
| 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(extensions_string, ' ', &extensions); | 79 base::SplitString(extensions_string, ' ', &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 27 matching lines...) Expand all Loading... |
| 111 capabilities_.using_set_visibility = has_set_visibility; | 110 capabilities_.using_set_visibility = has_set_visibility; |
| 112 | 111 |
| 113 // TODO(danakj): Support GpuMemoryManager. | 112 // TODO(danakj): Support GpuMemoryManager. |
| 114 capabilities_.using_gpu_memory_manager = false; | 113 capabilities_.using_gpu_memory_manager = false; |
| 115 | 114 |
| 116 capabilities_.using_egl_image = has_egl_image; | 115 capabilities_.using_egl_image = has_egl_image; |
| 117 | 116 |
| 118 return true; | 117 return true; |
| 119 } | 118 } |
| 120 | 119 |
| 121 DelegatingRenderer::~DelegatingRenderer() { | 120 DelegatingRenderer::~DelegatingRenderer() {} |
| 122 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); | |
| 123 if (context3d) | |
| 124 context3d->setContextLostCallback(NULL); | |
| 125 } | |
| 126 | 121 |
| 127 const RendererCapabilities& DelegatingRenderer::Capabilities() const { | 122 const RendererCapabilities& DelegatingRenderer::Capabilities() const { |
| 128 return capabilities_; | 123 return capabilities_; |
| 129 } | 124 } |
| 130 | 125 |
| 131 static ResourceProvider::ResourceId AppendToArray( | 126 static ResourceProvider::ResourceId AppendToArray( |
| 132 ResourceProvider::ResourceIdArray* array, | 127 ResourceProvider::ResourceIdArray* array, |
| 133 ResourceProvider::ResourceId id) { | 128 ResourceProvider::ResourceId id) { |
| 134 array->push_back(id); | 129 array->push_back(id); |
| 135 return id; | 130 return id; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 166 return true; | 161 return true; |
| 167 } | 162 } |
| 168 | 163 |
| 169 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { | 164 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { |
| 170 NOTIMPLEMENTED(); | 165 NOTIMPLEMENTED(); |
| 171 } | 166 } |
| 172 | 167 |
| 173 void DelegatingRenderer::ReceiveCompositorFrameAck( | 168 void DelegatingRenderer::ReceiveCompositorFrameAck( |
| 174 const CompositorFrameAck& ack) { | 169 const CompositorFrameAck& ack) { |
| 175 resource_provider_->ReceiveFromParent(ack.resources); | 170 resource_provider_->ReceiveFromParent(ack.resources); |
| 176 if (client_->HasImplThread()) | |
| 177 client_->OnSwapBuffersComplete(); | |
| 178 } | 171 } |
| 179 | 172 |
| 180 | 173 |
| 181 bool DelegatingRenderer::IsContextLost() { | 174 bool DelegatingRenderer::IsContextLost() { |
| 182 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); | 175 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); |
| 183 if (!context3d) | 176 if (!context3d) |
| 184 return false; | 177 return false; |
| 185 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; | 178 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; |
| 186 } | 179 } |
| 187 | 180 |
| 188 void DelegatingRenderer::SetVisible(bool visible) { | 181 void DelegatingRenderer::SetVisible(bool visible) { |
| 189 visible_ = visible; | 182 visible_ = visible; |
| 190 } | 183 } |
| 191 | 184 |
| 192 void DelegatingRenderer::onContextLost() { | |
| 193 client_->DidLoseOutputSurface(); | |
| 194 } | |
| 195 | |
| 196 } // namespace cc | 185 } // namespace cc |
| OLD | NEW |