OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_IMAGE_DECODER_H_ | 5 #ifndef CHROME_BROWSER_IMAGE_DECODER_H_ |
6 #define CHROME_BROWSER_IMAGE_DECODER_H_ | 6 #define CHROME_BROWSER_IMAGE_DECODER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Starts UtilityProcessHost in batch mode and starts |batch_mode_timer_|. | 111 // Starts UtilityProcessHost in batch mode and starts |batch_mode_timer_|. |
112 // If the utility process fails to start, the method resets | 112 // If the utility process fails to start, the method resets |
113 // |utility_process_host_| and returns. | 113 // |utility_process_host_| and returns. |
114 void StartBatchMode(); | 114 void StartBatchMode(); |
115 | 115 |
116 // Stops batch mode if no requests have come in since | 116 // Stops batch mode if no requests have come in since |
117 // |kBatchModeTimeoutSeconds|. | 117 // |kBatchModeTimeoutSeconds|. |
118 void StopBatchMode(); | 118 void StopBatchMode(); |
119 | 119 |
| 120 // Fails all outstanding requests. |
| 121 void FailAllRequests(); |
| 122 |
120 // Overidden from UtilityProcessHostClient. | 123 // Overidden from UtilityProcessHostClient. |
| 124 void OnProcessCrashed(int exit_code) override; |
| 125 void OnProcessLaunchFailed() override; |
121 bool OnMessageReceived(const IPC::Message& message) override; | 126 bool OnMessageReceived(const IPC::Message& message) override; |
122 | 127 |
123 // IPC message handlers. | 128 // IPC message handlers. |
124 void OnDecodeImageSucceeded(const SkBitmap& decoded_image, int request_id); | 129 void OnDecodeImageSucceeded(const SkBitmap& decoded_image, int request_id); |
125 void OnDecodeImageFailed(int request_id); | 130 void OnDecodeImageFailed(int request_id); |
126 | 131 |
127 // For the ImageRequest identified by |request_id|, call its OnImageDecoded() | 132 // For the ImageRequest identified by |request_id|, call its OnImageDecoded() |
128 // or OnDecodeImageFailed() method on its task runner thread. | 133 // or OnDecodeImageFailed() method on its task runner thread. |
129 void RunOnImageDecoded(const SkBitmap& decoded_image, int request_id); | 134 void RunOnImageDecoded(const SkBitmap& decoded_image, int request_id); |
130 void RunOnDecodeImageFailed(int request_id); | 135 void RunOnDecodeImageFailed(int request_id); |
(...skipping 13 matching lines...) Expand all Loading... |
144 // Calls StopBatchMode() after |kBatchModeTimeoutSeconds| have elapsed. | 149 // Calls StopBatchMode() after |kBatchModeTimeoutSeconds| have elapsed. |
145 base::RepeatingTimer<ImageDecoder> batch_mode_timer_; | 150 base::RepeatingTimer<ImageDecoder> batch_mode_timer_; |
146 | 151 |
147 // The time Start() was last called. | 152 // The time Start() was last called. |
148 base::TimeTicks last_request_; | 153 base::TimeTicks last_request_; |
149 | 154 |
150 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 155 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
151 }; | 156 }; |
152 | 157 |
153 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ | 158 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ |
OLD | NEW |