| 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/resource_update_controller.h" | 5 #include "cc/resource_update_controller.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/prioritized_resource.h" | 10 #include "cc/prioritized_resource.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 WebSharedGraphicsContext3D::compositorThreadContext() : | 134 WebSharedGraphicsContext3D::compositorThreadContext() : |
| 135 WebSharedGraphicsContext3D::mainThreadContext(); | 135 WebSharedGraphicsContext3D::mainThreadContext(); |
| 136 GrContext* paintGrContext = m_hasImplThread ? | 136 GrContext* paintGrContext = m_hasImplThread ? |
| 137 WebSharedGraphicsContext3D::compositorThreadGrContext() : | 137 WebSharedGraphicsContext3D::compositorThreadGrContext() : |
| 138 WebSharedGraphicsContext3D::mainThreadGrContext(); | 138 WebSharedGraphicsContext3D::mainThreadGrContext(); |
| 139 | 139 |
| 140 // Flush the context in which the backing texture is created so that it | 140 // Flush the context in which the backing texture is created so that it |
| 141 // is available in other shared contexts. It is important to do here | 141 // is available in other shared contexts. It is important to do here |
| 142 // because the backing texture is created in one context while it is | 142 // because the backing texture is created in one context while it is |
| 143 // being written to in another. | 143 // being written to in another. |
| 144 m_resourceProvider->flush(); | |
| 145 ResourceProvider::ScopedWriteLockGL lock( | 144 ResourceProvider::ScopedWriteLockGL lock( |
| 146 m_resourceProvider, texture->resourceId()); | 145 m_resourceProvider, texture->resourceId()); |
| 146 m_resourceProvider->flush(); |
| 147 | 147 |
| 148 // Make sure ganesh uses the correct GL context. | 148 // Make sure ganesh uses the correct GL context. |
| 149 paintContext->makeContextCurrent(); | 149 paintContext->makeContextCurrent(); |
| 150 | 150 |
| 151 // Create an accelerated canvas to draw on. | 151 // Create an accelerated canvas to draw on. |
| 152 skia::RefPtr<SkCanvas> canvas = createAcceleratedCanvas( | 152 skia::RefPtr<SkCanvas> canvas = createAcceleratedCanvas( |
| 153 paintGrContext, texture->size(), lock.textureId()); | 153 paintGrContext, texture->size(), lock.textureId()); |
| 154 | 154 |
| 155 // The compositor expects the textures to be upside-down so it can flip | 155 // The compositor expects the textures to be upside-down so it can flip |
| 156 // the final composited image. Ganesh renders the image upright so we | 156 // the final composited image. Ganesh renders the image upright so we |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (!uploads) | 283 if (!uploads) |
| 284 return; | 284 return; |
| 285 | 285 |
| 286 while (m_queue->fullUploadSize() && uploads--) | 286 while (m_queue->fullUploadSize() && uploads--) |
| 287 updateTexture(m_queue->takeFirstFullUpload()); | 287 updateTexture(m_queue->takeFirstFullUpload()); |
| 288 | 288 |
| 289 m_resourceProvider->flushUploads(); | 289 m_resourceProvider->flushUploads(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace cc | 292 } // namespace cc |
| OLD | NEW |