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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Implement FileDownloader's template of the CallbackSource interface. | 109 // Implement FileDownloader's template of the CallbackSource interface. |
110 // This method returns a callback which will be called by the FileDownloader | 110 // This method returns a callback which will be called by the FileDownloader |
111 // to stream the bitcode data as it arrives. The callback | 111 // to stream the bitcode data as it arrives. The callback |
112 // (BitcodeStreamGotData) passes it to llc over SRPC. | 112 // (BitcodeStreamGotData) passes it to llc over SRPC. |
113 StreamCallback GetCallback(); | 113 StreamCallback GetCallback(); |
114 | 114 |
115 // Return a callback that should be notified when |bytes_compiled| bytes | 115 // Return a callback that should be notified when |bytes_compiled| bytes |
116 // have been compiled. | 116 // have been compiled. |
117 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled); | 117 pp::CompletionCallback GetCompileProgressCallback(int64_t bytes_compiled); |
118 | 118 |
| 119 // Return a callback that should be notified when an interesting UMA timing |
| 120 // is ready to be reported. |
| 121 pp::CompletionCallback GetUMATimeCallback(const nacl::string& event_name, |
| 122 int64_t microsecs); |
| 123 |
119 // Get the last known load progress. | 124 // Get the last known load progress. |
120 void GetCurrentProgress(int64_t* bytes_loaded, int64_t* bytes_total); | 125 void GetCurrentProgress(int64_t* bytes_loaded, int64_t* bytes_total); |
121 | 126 |
122 // Return true if the total progress to report (w/ progress events) is known. | 127 // Return true if the total progress to report (w/ progress events) is known. |
123 bool ExpectedProgressKnown() { return expected_pexe_size_ != -1; } | 128 bool ExpectedProgressKnown() { return expected_pexe_size_ != -1; } |
124 | 129 |
125 // Return true if we should delay the progress event reporting. | 130 // Return true if we should delay the progress event reporting. |
126 // This delay approximates: | 131 // This delay approximates: |
127 // - the size of the buffer of bytes sent but not-yet-compiled by LLC. | 132 // - the size of the buffer of bytes sent but not-yet-compiled by LLC. |
128 // - the linking time. | 133 // - the linking time. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // been created, this starts the translation. Translation starts two | 173 // been created, this starts the translation. Translation starts two |
169 // subprocesses, one for llc and one for ld. | 174 // subprocesses, one for llc and one for ld. |
170 void RunTranslate(int32_t pp_error); | 175 void RunTranslate(int32_t pp_error); |
171 | 176 |
172 // Invoked when translation is finished. | 177 // Invoked when translation is finished. |
173 void TranslateFinished(int32_t pp_error); | 178 void TranslateFinished(int32_t pp_error); |
174 | 179 |
175 // Invoked when the read descriptor for nexe_file_ is created. | 180 // Invoked when the read descriptor for nexe_file_ is created. |
176 void NexeReadDidOpen(int32_t pp_error); | 181 void NexeReadDidOpen(int32_t pp_error); |
177 | 182 |
| 183 // Invoked when a UMA timing measurement from the translate thread is ready. |
| 184 void DoUMATimeMeasure( |
| 185 int32_t pp_error, const nacl::string& event_name, int64_t microsecs); |
| 186 |
178 // Keeps track of the pp_error upon entry to TranslateFinished, | 187 // Keeps track of the pp_error upon entry to TranslateFinished, |
179 // for inspection after cleanup. | 188 // for inspection after cleanup. |
180 int32_t translate_finish_error_; | 189 int32_t translate_finish_error_; |
181 | 190 |
182 // The plugin owning the nexe for which we are doing translation. | 191 // The plugin owning the nexe for which we are doing translation. |
183 Plugin* plugin_; | 192 Plugin* plugin_; |
184 | 193 |
185 pp::CompletionCallback translate_notify_callback_; | 194 pp::CompletionCallback translate_notify_callback_; |
186 // Set to true when the translation (if applicable) is finished and the nexe | 195 // Set to true when the translation (if applicable) is finished and the nexe |
187 // file is loaded, (or when there was an error), and the browser has been | 196 // file is loaded, (or when there was an error), and the browser has been |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // The helper thread used to do translations via SRPC. | 245 // The helper thread used to do translations via SRPC. |
237 // It accesses fields of PnaclCoordinator so it must have a | 246 // It accesses fields of PnaclCoordinator so it must have a |
238 // shorter lifetime. | 247 // shorter lifetime. |
239 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; | 248 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; |
240 }; | 249 }; |
241 | 250 |
242 //---------------------------------------------------------------------- | 251 //---------------------------------------------------------------------- |
243 | 252 |
244 } // namespace plugin; | 253 } // namespace plugin; |
245 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 254 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |