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 11 matching lines...) Expand all Loading... |
142 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 147 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
143 | 148 |
144 // Calls StopBatchMode() after |kBatchModeTimeoutSeconds| have elapsed, | 149 // Calls StopBatchMode() after |kBatchModeTimeoutSeconds| have elapsed, |
145 // unless a new decoding request resets the timer. | 150 // unless a new decoding request resets the timer. |
146 scoped_ptr<base::DelayTimer<ImageDecoder>> batch_mode_timer_; | 151 scoped_ptr<base::DelayTimer<ImageDecoder>> batch_mode_timer_; |
147 | 152 |
148 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 153 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
149 }; | 154 }; |
150 | 155 |
151 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ | 156 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ |
OLD | NEW |