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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 DCHECK(plane_resource.mailbox.IsZero()); | 287 DCHECK(plane_resource.mailbox.IsZero()); |
| 288 | 288 |
| 289 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) { | 289 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) { |
| 290 // We need to transfer data from |video_frame| to the plane resource. | 290 // We need to transfer data from |video_frame| to the plane resource. |
| 291 if (!video_renderer_) | 291 if (!video_renderer_) |
| 292 video_renderer_.reset(new media::SkCanvasVideoRenderer); | 292 video_renderer_.reset(new media::SkCanvasVideoRenderer); |
| 293 | 293 |
| 294 ResourceProvider::ScopedWriteLockSoftware lock( | 294 ResourceProvider::ScopedWriteLockSoftware lock( |
| 295 resource_provider_, plane_resource.resource_id); | 295 resource_provider_, plane_resource.resource_id); |
| 296 SkCanvas canvas(lock.sk_bitmap()); | 296 SkCanvas canvas(lock.sk_bitmap()); |
| 297 video_renderer_->Copy(video_frame, &canvas); | 297 video_renderer_->Copy(video_frame, &canvas, media::Context3D()); |
|
dshwang
2015/01/21 13:40:32
this is software path, so canvas and video_frame a
danakj
2015/02/10 17:48:12
how about making this a comment in the code?
| |
| 298 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); | 298 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); |
| 299 } | 299 } |
| 300 | 300 |
| 301 external_resources.software_resources.push_back(plane_resource.resource_id); | 301 external_resources.software_resources.push_back(plane_resource.resource_id); |
| 302 external_resources.software_release_callback = | 302 external_resources.software_release_callback = |
| 303 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id); | 303 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id); |
| 304 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE; | 304 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE; |
| 305 return external_resources; | 305 return external_resources; |
| 306 } | 306 } |
| 307 | 307 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 resource_it->ref_count = 0; | 421 resource_it->ref_count = 0; |
| 422 updater->DeleteResource(resource_it); | 422 updater->DeleteResource(resource_it); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 | 425 |
| 426 --resource_it->ref_count; | 426 --resource_it->ref_count; |
| 427 DCHECK_GE(resource_it->ref_count, 0); | 427 DCHECK_GE(resource_it->ref_count, 0); |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace cc | 430 } // namespace cc |
| OLD | NEW |