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 20 matching lines...) Expand all Loading... |
31 #include "ppapi/cpp/file_ref.h" | 31 #include "ppapi/cpp/file_ref.h" |
32 #include "ppapi/cpp/file_system.h" | 32 #include "ppapi/cpp/file_system.h" |
33 | 33 |
34 | 34 |
35 namespace plugin { | 35 namespace plugin { |
36 | 36 |
37 class Manifest; | 37 class Manifest; |
38 class Plugin; | 38 class Plugin; |
39 class PnaclCoordinator; | 39 class PnaclCoordinator; |
40 class PnaclTranslateThread; | 40 class PnaclTranslateThread; |
| 41 class TempFile; |
41 | 42 |
42 // A class invoked by Plugin to handle PNaCl client-side translation. | 43 // A class invoked by Plugin to handle PNaCl client-side translation. |
43 // Usage: | 44 // Usage: |
44 // (1) Invoke the factory method, e.g., | 45 // (1) Invoke the factory method, e.g., |
45 // PnaclCoordinator* coord = BitcodeToNative(plugin, | 46 // PnaclCoordinator* coord = BitcodeToNative(plugin, |
46 // "http://foo.com/my.pexe", | 47 // "http://foo.com/my.pexe", |
47 // TranslateNotifyCallback); | 48 // TranslateNotifyCallback); |
48 // (2) TranslateNotifyCallback gets invoked when translation is complete. | 49 // (2) TranslateNotifyCallback gets invoked when translation is complete. |
49 // If the translation was successful, the pp_error argument is PP_OK. | 50 // If the translation was successful, the pp_error argument is PP_OK. |
50 // Other values indicate errors. | 51 // Other values indicate errors. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void FileSystemDidOpen(int32_t pp_error); | 147 void FileSystemDidOpen(int32_t pp_error); |
147 // Invoked after we are sure the PNaCl temporary directory exists. | 148 // Invoked after we are sure the PNaCl temporary directory exists. |
148 void DirectoryWasCreated(int32_t pp_error); | 149 void DirectoryWasCreated(int32_t pp_error); |
149 // Invoked after we have checked the PNaCl cache for a translated version. | 150 // Invoked after we have checked the PNaCl cache for a translated version. |
150 void CachedFileDidOpen(int32_t pp_error); | 151 void CachedFileDidOpen(int32_t pp_error); |
151 // Invoked when a pexe data chunk arrives (when using streaming translation) | 152 // Invoked when a pexe data chunk arrives (when using streaming translation) |
152 void BitcodeStreamGotData(int32_t pp_error, FileStreamData data); | 153 void BitcodeStreamGotData(int32_t pp_error, FileStreamData data); |
153 // Invoked when the pexe download finishes (using streaming translation) | 154 // Invoked when the pexe download finishes (using streaming translation) |
154 void BitcodeStreamDidFinish(int32_t pp_error); | 155 void BitcodeStreamDidFinish(int32_t pp_error); |
155 // Invoked when the write descriptor for obj_file_ is created. | 156 // Invoked when the write descriptor for obj_file_ is created. |
156 void ObjectWriteDidOpen(int32_t pp_error); | 157 void ObjectFileDidOpen(int32_t pp_error); |
157 // Invoked when the read descriptor for obj_file_ is created. | |
158 void ObjectReadDidOpen(int32_t pp_error); | |
159 // Invoked when the descriptors for obj_file_ have been closed. | |
160 void ObjectFileWasClosed(int32_t pp_error); | |
161 // Invoked when the obj_file_ temporary has been deleted. | |
162 void ObjectFileWasDeleted(int32_t pp_error); | |
163 // Invoked when the descriptors for nexe_file_ have been closed. | 158 // Invoked when the descriptors for nexe_file_ have been closed. |
164 void NexeFileWasClosed(int32_t pp_error); | 159 void NexeFileWasClosed(int32_t pp_error); |
165 // Invoked when the nexe_file_ temporary has been renamed to the nexe name. | 160 // Invoked when the nexe_file_ temporary has been renamed to the nexe name. |
166 void NexeFileWasRenamed(int32_t pp_error); | 161 void NexeFileWasRenamed(int32_t pp_error); |
167 // Invoked when the read descriptor for nexe_file_ is created. | 162 // Invoked when the read descriptor for nexe_file_ is created. |
168 void NexeReadDidOpen(int32_t pp_error); | 163 void NexeReadDidOpen(int32_t pp_error); |
169 // Invoked if there was an error and we've cleaned up the nexe_file_ temp. | 164 // Invoked if there was an error and we've cleaned up the nexe_file_ temp. |
170 void NexeFileWasDeleted(int32_t pp_error); | 165 void NexeFileWasDeleted(int32_t pp_error); |
171 | 166 |
172 // Once llc and ld nexes have been loaded and the two temporary files have | 167 // Once llc and ld nexes have been loaded and the two temporary files have |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 nacl::scoped_ptr<PnaclResources> resources_; | 201 nacl::scoped_ptr<PnaclResources> resources_; |
207 | 202 |
208 // State used for querying the temporary directory. | 203 // State used for querying the temporary directory. |
209 nacl::scoped_ptr<pp::FileRef> dir_ref_; | 204 nacl::scoped_ptr<pp::FileRef> dir_ref_; |
210 | 205 |
211 // The URL for the pexe file. | 206 // The URL for the pexe file. |
212 nacl::string pexe_url_; | 207 nacl::string pexe_url_; |
213 // Optional cache identity for translation caching. | 208 // Optional cache identity for translation caching. |
214 nacl::string cache_identity_; | 209 nacl::string cache_identity_; |
215 // Object file, produced by the translator and consumed by the linker. | 210 // Object file, produced by the translator and consumed by the linker. |
216 nacl::scoped_ptr<LocalTempFile> obj_file_; | 211 nacl::scoped_ptr<TempFile> obj_file_; |
217 // Translated nexe file, produced by the linker and consumed by sel_ldr. | 212 // Translated nexe file, produced by the linker and consumed by sel_ldr. |
218 nacl::scoped_ptr<LocalTempFile> nexe_file_; | 213 nacl::scoped_ptr<LocalTempFile> nexe_file_; |
219 | 214 |
220 // Downloader for streaming translation | 215 // Downloader for streaming translation |
221 nacl::scoped_ptr<FileDownloader> streaming_downloader_; | 216 nacl::scoped_ptr<FileDownloader> streaming_downloader_; |
222 | 217 |
223 // Used to report information when errors (PPAPI or otherwise) are reported. | 218 // Used to report information when errors (PPAPI or otherwise) are reported. |
224 ErrorInfo error_info_; | 219 ErrorInfo error_info_; |
225 // True if an error was already reported, and translate_notify_callback_ | 220 // True if an error was already reported, and translate_notify_callback_ |
226 // was already run/consumed. | 221 // was already run/consumed. |
227 bool error_already_reported_; | 222 bool error_already_reported_; |
228 | 223 |
229 // The helper thread used to do translations via SRPC. | 224 // The helper thread used to do translations via SRPC. |
230 // Keep this last in declaration order to ensure the other variables | 225 // Keep this last in declaration order to ensure the other variables |
231 // haven't been destroyed yet when its destructor runs. | 226 // haven't been destroyed yet when its destructor runs. |
232 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; | 227 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; |
233 | 228 |
234 }; | 229 }; |
235 | 230 |
236 //---------------------------------------------------------------------- | 231 //---------------------------------------------------------------------- |
237 | 232 |
238 } // namespace plugin; | 233 } // namespace plugin; |
239 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 234 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |