Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
| 9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 external_resources.hardware_release_callback = callback_to_return_resource; | 358 external_resources.hardware_release_callback = callback_to_return_resource; |
| 359 return external_resources; | 359 return external_resources; |
| 360 } | 360 } |
| 361 | 361 |
| 362 // static | 362 // static |
| 363 void VideoResourceUpdater::ReturnTexture( | 363 void VideoResourceUpdater::ReturnTexture( |
| 364 base::WeakPtr<VideoResourceUpdater> updater, | 364 base::WeakPtr<VideoResourceUpdater> updater, |
| 365 unsigned resource_id, | 365 unsigned resource_id, |
| 366 unsigned sync_point, | 366 unsigned sync_point, |
| 367 bool lost_resource) { | 367 bool lost_resource) { |
| 368 if (!updater) { | 368 if (!updater.get()) { |
|
danakj
2013/06/04 14:01:14
Have you considered adding an operator bool() to r
akalin
2013/06/04 15:45:15
Yes, that will be done in a future CL, and a secon
danakj
2013/06/04 17:04:52
Great, thanks!
| |
| 369 // Resource was already deleted. | 369 // Resource was already deleted. |
| 370 return; | 370 return; |
| 371 } | 371 } |
| 372 | 372 |
| 373 updater->DeleteResource(resource_id); | 373 updater->DeleteResource(resource_id); |
| 374 } | 374 } |
| 375 | 375 |
| 376 // static | 376 // static |
| 377 void VideoResourceUpdater::RecycleResource( | 377 void VideoResourceUpdater::RecycleResource( |
| 378 base::WeakPtr<VideoResourceUpdater> updater, | 378 base::WeakPtr<VideoResourceUpdater> updater, |
| 379 RecycleResourceData data, | 379 RecycleResourceData data, |
| 380 unsigned sync_point, | 380 unsigned sync_point, |
| 381 bool lost_resource) { | 381 bool lost_resource) { |
| 382 if (!updater) { | 382 if (!updater.get()) { |
| 383 // Resource was already deleted. | 383 // Resource was already deleted. |
| 384 return; | 384 return; |
| 385 } | 385 } |
| 386 | 386 |
| 387 WebKit::WebGraphicsContext3D* context = | 387 WebKit::WebGraphicsContext3D* context = |
| 388 updater->resource_provider_->GraphicsContext3D(); | 388 updater->resource_provider_->GraphicsContext3D(); |
| 389 if (context && sync_point) | 389 if (context && sync_point) |
| 390 GLC(context, context->waitSyncPoint(sync_point)); | 390 GLC(context, context->waitSyncPoint(sync_point)); |
| 391 if (context && !lost_resource) { | 391 if (context && !lost_resource) { |
| 392 ResourceProvider::ScopedWriteLockGL lock(updater->resource_provider_, | 392 ResourceProvider::ScopedWriteLockGL lock(updater->resource_provider_, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 411 } | 411 } |
| 412 | 412 |
| 413 PlaneResource recycled_resource(data.resource_id, | 413 PlaneResource recycled_resource(data.resource_id, |
| 414 data.resource_size, | 414 data.resource_size, |
| 415 data.resource_format, | 415 data.resource_format, |
| 416 sync_point); | 416 sync_point); |
| 417 updater->recycled_resources_.push_back(recycled_resource); | 417 updater->recycled_resources_.push_back(recycled_resource); |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace cc | 420 } // namespace cc |
| OLD | NEW |