Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/resources/transparency_display_item.cc ('k') | cc/resources/zero_copy_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698