| OLD | NEW |
| 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 "ppapi/proxy/compositor_layer_resource.h" | 5 #include "ppapi/proxy/compositor_layer_resource.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // passed to SetSourceRect(). | 171 // passed to SetSourceRect(). |
| 172 source_size_ = PP_MakeFloatSize(1.0f, 1.0f); | 172 source_size_ = PP_MakeFloatSize(1.0f, 1.0f); |
| 173 | 173 |
| 174 data_.common.size = *size; | 174 data_.common.size = *size; |
| 175 data_.common.resource_id = compositor_->GenerateResourceId(); | 175 data_.common.resource_id = compositor_->GenerateResourceId(); |
| 176 data_.texture->target = target; | 176 data_.texture->target = target; |
| 177 data_.texture->source_rect.point = PP_MakeFloatPoint(0.0f, 0.0f); | 177 data_.texture->source_rect.point = PP_MakeFloatPoint(0.0f, 0.0f); |
| 178 data_.texture->source_rect.size = source_size_; | 178 data_.texture->source_rect.size = source_size_; |
| 179 | 179 |
| 180 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 180 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 181 gl->OrderingBarrierCHROMIUM(); | 181 gl->ShallowFlushCHROMIUM(); |
| 182 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, | 182 gl->GenSyncTokenCHROMIUM(fence_sync, data_.texture->sync_token.GetData()); |
| 183 data_.texture->sync_token.GetData()); | |
| 184 | 183 |
| 185 // If the PP_Resource of this layer is released by the plugin, the | 184 // If the PP_Resource of this layer is released by the plugin, the |
| 186 // release_callback will be aborted immediately, but the texture or image | 185 // release_callback will be aborted immediately, but the texture or image |
| 187 // in this layer may still being used by chromium compositor. So we have to | 186 // in this layer may still being used by chromium compositor. So we have to |
| 188 // use ScopedPPResource to keep this resource alive until the texture or image | 187 // use ScopedPPResource to keep this resource alive until the texture or image |
| 189 // is released by the chromium compositor. | 188 // is released by the chromium compositor. |
| 190 release_callback_ = base::Bind( | 189 release_callback_ = base::Bind( |
| 191 &OnTextureReleased, | 190 &OnTextureReleased, |
| 192 ScopedPPResource(pp_resource()), // Keep layer alive. | 191 ScopedPPResource(pp_resource()), // Keep layer alive. |
| 193 ScopedPPResource(context), // Keep context alive | 192 ScopedPPResource(context), // Keep context alive |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 381 |
| 383 // Do not allow using a block callback as a release callback. | 382 // Do not allow using a block callback as a release callback. |
| 384 if (release_callback->is_blocking()) | 383 if (release_callback->is_blocking()) |
| 385 return PP_ERROR_BADARGUMENT; | 384 return PP_ERROR_BADARGUMENT; |
| 386 | 385 |
| 387 return PP_OK; | 386 return PP_OK; |
| 388 } | 387 } |
| 389 | 388 |
| 390 } // namespace proxy | 389 } // namespace proxy |
| 391 } // namespace ppapi | 390 } // namespace ppapi |
| OLD | NEW |