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

Unified Diff: cc/tiles/decoded_image_tracker.cc

Issue 2631453002: Revert of cc: Add image decode queue functionality to image manager. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/decoded_image_tracker.h ('k') | cc/tiles/decoded_image_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/decoded_image_tracker.cc
diff --git a/cc/tiles/decoded_image_tracker.cc b/cc/tiles/decoded_image_tracker.cc
deleted file mode 100644
index cdfa39bb28e8bd30bf221151a58c96b15ee38be7..0000000000000000000000000000000000000000
--- a/cc/tiles/decoded_image_tracker.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/tiles/decoded_image_tracker.h"
-
-namespace cc {
-namespace {
-const int kNumFramesToLock = 2;
-} // namespace
-
-DecodedImageTracker::DecodedImageTracker() = default;
-DecodedImageTracker::~DecodedImageTracker() {
- for (auto& pair : locked_images_)
- image_controller_->UnlockImageDecode(pair.first);
-}
-
-void DecodedImageTracker::QueueImageDecode(sk_sp<const SkImage> image,
- const base::Closure& callback) {
- DCHECK(image_controller_);
- // Queue the decode in the image controller, but switch out the callback for
- // our own.
- image_controller_->QueueImageDecode(
- std::move(image), base::Bind(&DecodedImageTracker::ImageDecodeFinished,
- base::Unretained(this), callback));
-}
-
-void DecodedImageTracker::NotifyFrameFinished() {
- // Go through the images and if the frame ref count goes to 0, unlock the
- // image in the controller.
- for (auto it = locked_images_.begin(); it != locked_images_.end();) {
- auto id = it->first;
- int& ref_count = it->second;
- if (--ref_count != 0) {
- ++it;
- continue;
- }
- image_controller_->UnlockImageDecode(id);
- it = locked_images_.erase(it);
- }
-}
-
-void DecodedImageTracker::ImageDecodeFinished(
- const base::Closure& callback,
- ImageController::ImageDecodeRequestId id) {
- locked_images_.push_back(std::make_pair(id, kNumFramesToLock));
- callback.Run();
-}
-
-} // namespace cc
« no previous file with comments | « cc/tiles/decoded_image_tracker.h ('k') | cc/tiles/decoded_image_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698