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

Side by Side Diff: chrome/browser/image_decoder.h

Issue 1041043008: Catch utility process StartBatchMode failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments in header Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/image_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 static void Cancel(ImageRequest* image_request); 78 static void Cancel(ImageRequest* image_request);
79 79
80 private: 80 private:
81 friend struct base::DefaultLazyInstanceTraits<ImageDecoder>; 81 friend struct base::DefaultLazyInstanceTraits<ImageDecoder>;
82 82
83 ImageDecoder(); 83 ImageDecoder();
84 // It's a reference counted object, so destructor is private. 84 // It's a reference counted object, so destructor is private.
85 ~ImageDecoder() override; 85 ~ImageDecoder() override;
86 86
87 // Sends a request to the sandboxed process to decode the image. Starts 87 // Sends a request to the sandboxed process to decode the image. Starts
88 // batch mode if necessary. 88 // batch mode if necessary. If the utility process fails to start,
89 // an OnDecodeImageFailed task is posted to image_request's |task_runner_|.
89 void DecodeImageInSandbox(ImageRequest* image_request, 90 void DecodeImageInSandbox(ImageRequest* image_request,
90 const std::vector<unsigned char>& image_data, 91 const std::vector<unsigned char>& image_data,
91 ImageCodec image_codec, 92 ImageCodec image_codec,
92 bool shrink_to_fit); 93 bool shrink_to_fit);
93 94
94 void CancelImpl(ImageRequest* image_request); 95 void CancelImpl(ImageRequest* image_request);
95 96
96 using RequestMap = std::map<int, ImageRequest*>; 97 using RequestMap = std::map<int, ImageRequest*>;
97 98
98 // Starts UtilityProcessHost in batch mode and starts |batch_mode_timer_|. 99 // Starts UtilityProcessHost in batch mode and starts |batch_mode_timer_|.
100 // If the utility process fails to start, the method resets
101 // |utility_process_host_| and returns.
99 void StartBatchMode(); 102 void StartBatchMode();
100 103
101 // Stops batch mode if no requests have come in since 104 // Stops batch mode if no requests have come in since
102 // kBatchModeTimeoutSeconds. 105 // kBatchModeTimeoutSeconds.
103 void StopBatchMode(); 106 void StopBatchMode();
104 107
105 // Overidden from UtilityProcessHostClient. 108 // Overidden from UtilityProcessHostClient.
106 bool OnMessageReceived(const IPC::Message& message) override; 109 bool OnMessageReceived(const IPC::Message& message) override;
107 110
108 // IPC message handlers. 111 // IPC message handlers.
(...skipping 15 matching lines...) Expand all
124 // Calls StopBatchMode after kBatchModeTimeoutSeconds have elapsed. 127 // Calls StopBatchMode after kBatchModeTimeoutSeconds have elapsed.
125 base::RepeatingTimer<ImageDecoder> batch_mode_timer_; 128 base::RepeatingTimer<ImageDecoder> batch_mode_timer_;
126 129
127 // The time Start was last called. 130 // The time Start was last called.
128 base::TimeTicks last_request_; 131 base::TimeTicks last_request_;
129 132
130 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); 133 DISALLOW_COPY_AND_ASSIGN(ImageDecoder);
131 }; 134 };
132 135
133 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ 136 #endif // CHROME_BROWSER_IMAGE_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/image_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698