| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 DCHECK(plane_resource.mailbox.IsZero()); | 289 DCHECK(plane_resource.mailbox.IsZero()); |
| 290 | 290 |
| 291 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) { | 291 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) { |
| 292 // We need to transfer data from |video_frame| to the plane resource. | 292 // We need to transfer data from |video_frame| to the plane resource. |
| 293 if (!video_renderer_) | 293 if (!video_renderer_) |
| 294 video_renderer_.reset(new media::SkCanvasVideoRenderer); | 294 video_renderer_.reset(new media::SkCanvasVideoRenderer); |
| 295 | 295 |
| 296 ResourceProvider::ScopedWriteLockSoftware lock( | 296 ResourceProvider::ScopedWriteLockSoftware lock( |
| 297 resource_provider_, plane_resource.resource_id); | 297 resource_provider_, plane_resource.resource_id); |
| 298 SkCanvas canvas(lock.sk_bitmap()); | 298 SkCanvas canvas(lock.sk_bitmap()); |
| 299 video_renderer_->Copy(video_frame, &canvas); | 299 // This is software path, so canvas and video_frame are always backed |
| 300 // by software. |
| 301 video_renderer_->Copy(video_frame, &canvas, media::Context3D()); |
| 300 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); | 302 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); |
| 301 } | 303 } |
| 302 | 304 |
| 303 external_resources.software_resources.push_back(plane_resource.resource_id); | 305 external_resources.software_resources.push_back(plane_resource.resource_id); |
| 304 external_resources.software_release_callback = | 306 external_resources.software_release_callback = |
| 305 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id); | 307 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id); |
| 306 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE; | 308 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE; |
| 307 return external_resources; | 309 return external_resources; |
| 308 } | 310 } |
| 309 | 311 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 resource_it->ref_count = 0; | 427 resource_it->ref_count = 0; |
| 426 updater->DeleteResource(resource_it); | 428 updater->DeleteResource(resource_it); |
| 427 return; | 429 return; |
| 428 } | 430 } |
| 429 | 431 |
| 430 --resource_it->ref_count; | 432 --resource_it->ref_count; |
| 431 DCHECK_GE(resource_it->ref_count, 0); | 433 DCHECK_GE(resource_it->ref_count, 0); |
| 432 } | 434 } |
| 433 | 435 |
| 434 } // namespace cc | 436 } // namespace cc |
| OLD | NEW |