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

Side by Side Diff: cc/tiles/image_controller.h

Issue 2904743002: cc: Add UMA for tracking decode duration for out of raster decodes. (Closed)
Patch Set: .. Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CC_TILES_IMAGE_CONTROLLER_H_ 5 #ifndef CC_TILES_IMAGE_CONTROLLER_H_
6 #define CC_TILES_IMAGE_CONTROLLER_H_ 6 #define CC_TILES_IMAGE_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Virtual for testing. 49 // Virtual for testing.
50 virtual void UnlockImageDecode(ImageDecodeRequestId id); 50 virtual void UnlockImageDecode(ImageDecodeRequestId id);
51 51
52 // This function requests that the given image be decoded and locked. Once the 52 // This function requests that the given image be decoded and locked. Once the
53 // callback has been issued, it is passed an ID, which should be used to 53 // callback has been issued, it is passed an ID, which should be used to
54 // unlock this image. It is up to the caller to ensure that the image is later 54 // unlock this image. It is up to the caller to ensure that the image is later
55 // unlocked using UnlockImageDecode. 55 // unlocked using UnlockImageDecode.
56 // Virtual for testing. 56 // Virtual for testing.
57 virtual ImageDecodeRequestId QueueImageDecode( 57 virtual ImageDecodeRequestId QueueImageDecode(
58 sk_sp<const SkImage> image, 58 sk_sp<const SkImage> image,
59 const ImageDecodedCallback& callback); 59 const ImageDecodedCallback& callback,
60 ImageDecodeCache::ImageDecodeType type);
60 size_t image_cache_max_limit_bytes() const { 61 size_t image_cache_max_limit_bytes() const {
61 return image_cache_max_limit_bytes_; 62 return image_cache_max_limit_bytes_;
62 } 63 }
63 64
64 void SetMaxImageCacheLimitBytesForTesting(size_t bytes) { 65 void SetMaxImageCacheLimitBytesForTesting(size_t bytes) {
65 image_cache_max_limit_bytes_ = bytes; 66 image_cache_max_limit_bytes_ = bytes;
66 } 67 }
67 68
68 protected: 69 protected:
69 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; 70 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
70 71
71 private: 72 private:
72 struct ImageDecodeRequest { 73 struct ImageDecodeRequest {
73 ImageDecodeRequest(); 74 ImageDecodeRequest();
74 ImageDecodeRequest(ImageDecodeRequestId id, 75 ImageDecodeRequest(ImageDecodeRequestId id,
75 const DrawImage& draw_image, 76 const DrawImage& draw_image,
76 const ImageDecodedCallback& callback, 77 const ImageDecodedCallback& callback,
77 scoped_refptr<TileTask> task, 78 scoped_refptr<TileTask> task,
78 bool need_unref); 79 bool need_unref,
80 ImageDecodeCache::ImageDecodeType decode_type);
79 ImageDecodeRequest(ImageDecodeRequest&& other); 81 ImageDecodeRequest(ImageDecodeRequest&& other);
80 ImageDecodeRequest(const ImageDecodeRequest& other); 82 ImageDecodeRequest(const ImageDecodeRequest& other);
81 ~ImageDecodeRequest(); 83 ~ImageDecodeRequest();
82 84
83 ImageDecodeRequest& operator=(ImageDecodeRequest&& other); 85 ImageDecodeRequest& operator=(ImageDecodeRequest&& other);
84 ImageDecodeRequest& operator=(const ImageDecodeRequest& other); 86 ImageDecodeRequest& operator=(const ImageDecodeRequest& other);
85 87
86 ImageDecodeRequestId id; 88 ImageDecodeRequestId id;
87 DrawImage draw_image; 89 DrawImage draw_image;
88 ImageDecodedCallback callback; 90 ImageDecodedCallback callback;
89 scoped_refptr<TileTask> task; 91 scoped_refptr<TileTask> task;
90 bool need_unref; 92 bool need_unref;
93 ImageDecodeCache::ImageDecodeType decode_type;
91 }; 94 };
92 95
93 void StopWorkerTasks(); 96 void StopWorkerTasks();
94 97
95 // Called from the worker thread. 98 // Called from the worker thread.
96 void ProcessNextImageDecodeOnWorkerThread(); 99 void ProcessNextImageDecodeOnWorkerThread();
97 100
98 void ImageDecodeCompleted(ImageDecodeRequestId id); 101 void ImageDecodeCompleted(ImageDecodeRequestId id);
99 void GenerateTasksForOrphanedRequests(); 102 void GenerateTasksForOrphanedRequests();
100 103
(...skipping 21 matching lines...) Expand all
122 std::vector<ImageDecodeRequest> orphaned_decode_requests_; 125 std::vector<ImageDecodeRequest> orphaned_decode_requests_;
123 126
124 base::WeakPtrFactory<ImageController> weak_ptr_factory_; 127 base::WeakPtrFactory<ImageController> weak_ptr_factory_;
125 128
126 DISALLOW_COPY_AND_ASSIGN(ImageController); 129 DISALLOW_COPY_AND_ASSIGN(ImageController);
127 }; 130 };
128 131
129 } // namespace cc 132 } // namespace cc
130 133
131 #endif // CC_TILES_IMAGE_CONTROLLER_H_ 134 #endif // CC_TILES_IMAGE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698