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> |
11 | 11 |
12 #include "native_client/src/include/nacl_macros.h" | 12 #include "native_client/src/include/nacl_macros.h" |
13 #include "native_client/src/include/nacl_string.h" | 13 #include "native_client/src/include/nacl_string.h" |
14 #include "native_client/src/shared/platform/nacl_sync_raii.h" | 14 #include "native_client/src/shared/platform/nacl_sync_raii.h" |
15 | 15 |
16 #include "native_client/src/shared/srpc/nacl_srpc.h" | 16 #include "native_client/src/shared/srpc/nacl_srpc.h" |
17 | 17 |
18 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 18 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
19 #include "native_client/src/trusted/plugin/callback_source.h" | 19 #include "native_client/src/trusted/plugin/callback_source.h" |
20 #include "native_client/src/trusted/plugin/delayed_callback.h" | 20 #include "native_client/src/trusted/plugin/delayed_callback.h" |
21 #include "native_client/src/trusted/plugin/file_downloader.h" | 21 #include "native_client/src/trusted/plugin/file_downloader.h" |
22 #include "native_client/src/trusted/plugin/local_temp_file.h" | 22 #include "native_client/src/trusted/plugin/local_temp_file.h" |
23 #include "native_client/src/trusted/plugin/nacl_subprocess.h" | 23 #include "native_client/src/trusted/plugin/nacl_subprocess.h" |
24 #include "native_client/src/trusted/plugin/plugin_error.h" | 24 #include "native_client/src/trusted/plugin/plugin_error.h" |
25 #include "native_client/src/trusted/plugin/pnacl_options.h" | 25 #include "native_client/src/trusted/plugin/pnacl_options.h" |
26 #include "native_client/src/trusted/plugin/pnacl_resources.h" | 26 #include "native_client/src/trusted/plugin/pnacl_resources.h" |
27 | 27 |
28 #include "ppapi/c/pp_file_info.h" | 28 #include "ppapi/c/pp_file_info.h" |
| 29 #include "ppapi/c/private/ppb_nacl_hash_private.h" |
29 #include "ppapi/c/trusted/ppb_file_io_trusted.h" | 30 #include "ppapi/c/trusted/ppb_file_io_trusted.h" |
30 #include "ppapi/cpp/completion_callback.h" | 31 #include "ppapi/cpp/completion_callback.h" |
31 #include "ppapi/cpp/file_io.h" | 32 #include "ppapi/cpp/file_io.h" |
32 #include "ppapi/cpp/file_ref.h" | 33 #include "ppapi/cpp/file_ref.h" |
33 #include "ppapi/cpp/file_system.h" | 34 #include "ppapi/cpp/file_system.h" |
34 | 35 |
35 | 36 |
36 namespace plugin { | 37 namespace plugin { |
37 | 38 |
38 class Manifest; | 39 class Manifest; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Invoked when the write descriptor for obj_file_ is created. | 175 // Invoked when the write descriptor for obj_file_ is created. |
175 void ObjectFileDidOpen(int32_t pp_error); | 176 void ObjectFileDidOpen(int32_t pp_error); |
176 // Once llc and ld nexes have been loaded and the two temporary files have | 177 // Once llc and ld nexes have been loaded and the two temporary files have |
177 // been created, this starts the translation. Translation starts two | 178 // been created, this starts the translation. Translation starts two |
178 // subprocesses, one for llc and one for ld. | 179 // subprocesses, one for llc and one for ld. |
179 void RunTranslate(int32_t pp_error); | 180 void RunTranslate(int32_t pp_error); |
180 | 181 |
181 // Invoked when translation is finished. | 182 // Invoked when translation is finished. |
182 void TranslateFinished(int32_t pp_error); | 183 void TranslateFinished(int32_t pp_error); |
183 | 184 |
| 185 bool BitcodeHashMatchesContents(); |
| 186 |
184 // If the cache is enabled, open a cache file for write, then copy | 187 // If the cache is enabled, open a cache file for write, then copy |
185 // the nexe data from temp_nexe_file_ to> cached_nexe_file_. | 188 // the nexe data from temp_nexe_file_ to> cached_nexe_file_. |
186 // Once the copy is done, we commit it to the cache by renaming the | 189 // Once the copy is done, we commit it to the cache by renaming the |
187 // cache file to the final name. | 190 // cache file to the final name. |
188 void CachedNexeOpenedForWrite(int32_t pp_error); | 191 void CachedNexeOpenedForWrite(int32_t pp_error); |
189 void DidCopyNexeToCachePartial(int32_t pp_error, int32_t num_read_prev, | 192 void DidCopyNexeToCachePartial(int32_t pp_error, int32_t num_read_prev, |
190 int64_t cur_offset); | 193 int64_t cur_offset); |
191 void NexeWasCopiedToCache(int32_t pp_error); | 194 void NexeWasCopiedToCache(int32_t pp_error); |
192 // If the copy of the nexe to the not-yet-committed-to-cache file | 195 // If the copy of the nexe to the not-yet-committed-to-cache file |
193 // failed after partial writes, we attempt to delete the partially written | 196 // failed after partial writes, we attempt to delete the partially written |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // State for timing and size information for UMA stats. | 265 // State for timing and size information for UMA stats. |
263 int64_t pnacl_init_time_; | 266 int64_t pnacl_init_time_; |
264 int64_t pexe_size_; // Count as we stream -- will converge to pexe size. | 267 int64_t pexe_size_; // Count as we stream -- will converge to pexe size. |
265 int64_t pexe_bytes_compiled_; // Count as we compile. | 268 int64_t pexe_bytes_compiled_; // Count as we compile. |
266 int64_t expected_pexe_size_; // Expected download total (-1 if unknown). | 269 int64_t expected_pexe_size_; // Expected download total (-1 if unknown). |
267 | 270 |
268 // The helper thread used to do translations via SRPC. | 271 // The helper thread used to do translations via SRPC. |
269 // Keep this last in declaration order to ensure the other variables | 272 // Keep this last in declaration order to ensure the other variables |
270 // haven't been destroyed yet when its destructor runs. | 273 // haven't been destroyed yet when its destructor runs. |
271 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; | 274 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; |
| 275 |
| 276 // Interface and state for bitcode hash verification. |
| 277 const PPB_NaCl_Hash_Private* nacl_hash_private_interface_; |
| 278 void* bitcode_hash_verifier_; |
272 }; | 279 }; |
273 | 280 |
274 //---------------------------------------------------------------------- | 281 //---------------------------------------------------------------------- |
275 | 282 |
276 } // namespace plugin; | 283 } // namespace plugin; |
277 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 284 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |