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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h

Issue 10823167: Revert "Add an IPC for PNaCl to check if the session is incognito," (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // (4) Load the nexe from "fd". 55 // (4) Load the nexe from "fd".
56 // (5) delete coord. 56 // (5) delete coord.
57 // 57 //
58 // Translation proceeds in two steps: 58 // Translation proceeds in two steps:
59 // (1) llc translates the bitcode in pexe_url_ to an object in obj_file_. 59 // (1) llc translates the bitcode in pexe_url_ to an object in obj_file_.
60 // (2) ld links the object code in obj_file_ and produces a nexe in nexe_file_. 60 // (2) ld links the object code in obj_file_ and produces a nexe in nexe_file_.
61 // 61 //
62 // The coordinator proceeds through several states. They are 62 // The coordinator proceeds through several states. They are
63 // LOAD_TRANSLATOR_BINARIES 63 // LOAD_TRANSLATOR_BINARIES
64 // Complete when ResourcesDidLoad is invoked. 64 // Complete when ResourcesDidLoad is invoked.
65 // 65 // OPEN_LOCAL_FILE_SYSTEM
66 // If cache is enabled: 66 // Complete when FileSystemDidOpen is invoked.
67 // OPEN_LOCAL_FILE_SYSTEM 67 // CREATED_PNACL_TEMP_DIRECTORY
68 // Complete when FileSystemDidOpen is invoked. 68 // Complete when DirectoryWasCreated is invoked.
69 // CREATED_PNACL_TEMP_DIRECTORY 69 // CACHED_FILE_OPEN
70 // Complete when DirectoryWasCreated is invoked. 70 // Complete with success if cached version is available and jump to end.
71 // CACHED_FILE_OPEN 71 // Otherwise, proceed with usual pipeline of translation.
72 // Complete with success if cached version is available and jump to end. 72 // OPEN_TMP_WRITE_FOR_LLC_TO_LD_COMMUNICATION
73 // Otherwise, proceed with usual pipeline of translation. 73 // Complete when ObjectWriteDidOpen is invoked.
74 // 74 // OPEN_TMP_READ_FOR_LLC_TO_LD_COMMUNICATION
75 // OPEN_TMP_FOR_LLC_TO_LD_COMMUNICATION 75 // Complete when ObjectReadDidOpen is invoked.
76 // Complete when ObjectFileDidOpen is invoked.
77 // OPEN_TMP_FOR_LD_WRITING 76 // OPEN_TMP_FOR_LD_WRITING
78 // Complete when NexeWriteDidOpen is invoked. 77 // Complete when NexeWriteDidOpen is invoked.
79 // PREPARE_PEXE_FOR_STREAMING 78 // PREPARE_PEXE_FOR_STREAMING
80 // Complete when RunTranslate is invoked. 79 // Complete when RunTranslate is invoked.
81 // START_LD_AND_LLC_SUBPROCESS_AND_INITIATE_TRANSLATION 80 // START_LD_AND_LLC_SUBPROCESS_AND_INITIATE_TRANSLATION
82 // Complete when RunTranslate returns. 81 // Complete when RunTranslate returns.
83 // TRANSLATION_COMPLETE 82 // TRANSLATION_COMPLETE
84 // Complete when TranslateFinished is invoked. 83 // Complete when TranslateFinished is invoked.
85 // 84 // CLOSE_OBJECT_FILE
86 // If cache is enabled: 85 // Complete when ObjectFileWasClosed is invoked.
87 // OPEN_CACHE_FOR_WRITE 86 // DELETE_OBJECT_FILE
88 // Complete when CachedNexeOpenedForWrite is invoked 87 // Complete when ObjectFileWasDeleted is invoked.
89 // COPY_NEXE_TO_CACHE 88 // CLOSE_NEXE_FILE
90 // Complete when NexeWasCopiedToCache is invoked. 89 // Complete when NexeFileWasClosed is invoked.
91 // RENAME_CACHE_FILE 90 // RENAME_NEXE_FILE
92 // Complete when NexeFileWasRenamed is invoked. 91 // Complete when NexeFileWasRenamed is invoked.
93 //
94 // OPEN_NEXE_FOR_SEL_LDR 92 // OPEN_NEXE_FOR_SEL_LDR
95 // Complete when NexeReadDidOpen is invoked. 93 // Complete when NexeReadDidOpen is invoked.
96 class PnaclCoordinator: public CallbackSource<FileStreamData> { 94 class PnaclCoordinator: public CallbackSource<FileStreamData> {
97 public: 95 public:
98 virtual ~PnaclCoordinator(); 96 virtual ~PnaclCoordinator();
99 97
100 // The factory method for translations. 98 // The factory method for translations.
101 static PnaclCoordinator* BitcodeToNative( 99 static PnaclCoordinator* BitcodeToNative(
102 Plugin* plugin, 100 Plugin* plugin,
103 const nacl::string& pexe_url, 101 const nacl::string& pexe_url,
104 const nacl::string& cache_identity, 102 const nacl::string& cache_identity,
105 const pp::CompletionCallback& translate_notify_callback); 103 const pp::CompletionCallback& translate_notify_callback);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Invoked after we are sure the PNaCl temporary directory exists. 148 // Invoked after we are sure the PNaCl temporary directory exists.
151 void DirectoryWasCreated(int32_t pp_error); 149 void DirectoryWasCreated(int32_t pp_error);
152 // 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.
153 void CachedFileDidOpen(int32_t pp_error); 151 void CachedFileDidOpen(int32_t pp_error);
154 // Invoked when a pexe data chunk arrives (when using streaming translation) 152 // Invoked when a pexe data chunk arrives (when using streaming translation)
155 void BitcodeStreamGotData(int32_t pp_error, FileStreamData data); 153 void BitcodeStreamGotData(int32_t pp_error, FileStreamData data);
156 // Invoked when the pexe download finishes (using streaming translation) 154 // Invoked when the pexe download finishes (using streaming translation)
157 void BitcodeStreamDidFinish(int32_t pp_error); 155 void BitcodeStreamDidFinish(int32_t pp_error);
158 // Invoked when the write descriptor for obj_file_ is created. 156 // Invoked when the write descriptor for obj_file_ is created.
159 void ObjectFileDidOpen(int32_t pp_error); 157 void ObjectFileDidOpen(int32_t pp_error);
158 // Invoked when the descriptors for nexe_file_ have been closed.
159 void NexeFileWasClosed(int32_t pp_error);
160 // Invoked when the nexe_file_ temporary has been renamed to the nexe name.
161 void NexeFileWasRenamed(int32_t pp_error);
162 // Invoked when the read descriptor for nexe_file_ is created.
163 void NexeReadDidOpen(int32_t pp_error);
164 // Invoked if there was an error and we've cleaned up the nexe_file_ temp.
165 void NexeFileWasDeleted(int32_t pp_error);
166
160 // 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
161 // been created, this starts the translation. Translation starts two 168 // been created, this starts the translation. Translation starts two
162 // subprocesses, one for llc and one for ld. 169 // subprocesses, one for llc and one for ld.
163 void RunTranslate(int32_t pp_error); 170 void RunTranslate(int32_t pp_error);
164 171
165 // Invoked when translation is finished.
166 void TranslateFinished(int32_t pp_error); 172 void TranslateFinished(int32_t pp_error);
167
168 // If the cache is enabled, open a cache file for write, then copy
169 // the nexe data from temp_nexe_file_ to> cached_nexe_file_.
170 // Once the copy is done, we commit it to the cache by renaming the
171 // cache file to the final name.
172 void CachedNexeOpenedForWrite(int32_t pp_error);
173 void DidCopyNexeToCachePartial(int32_t pp_error, int32_t num_read_prev,
174 int64_t cur_offset);
175 void NexeWasCopiedToCache(int32_t pp_error);
176 // Invoked when the nexe_file_ temporary has been renamed to the nexe name.
177 void NexeFileWasRenamed(int32_t pp_error);
178 // Invoked when the read descriptor for nexe_file_ is created.
179 void NexeReadDidOpen(int32_t pp_error);
180
181 // Keeps track of the pp_error upon entry to TranslateFinished, 173 // Keeps track of the pp_error upon entry to TranslateFinished,
182 // for inspection after cleanup. 174 // for inspection after cleanup.
183 int32_t translate_finish_error_; 175 int32_t translate_finish_error_;
184 176
185 // The plugin owning the nexe for which we are doing translation. 177 // The plugin owning the nexe for which we are doing translation.
186 Plugin* plugin_; 178 Plugin* plugin_;
187 179
188 pp::CompletionCallback translate_notify_callback_; 180 pp::CompletionCallback translate_notify_callback_;
189 // Threadsafety is required to support file lookups. 181 // Threadsafety is required to support file lookups.
190 pp::CompletionCallbackFactory<PnaclCoordinator, 182 pp::CompletionCallbackFactory<PnaclCoordinator,
(...skipping 19 matching lines...) Expand all
210 202
211 // State used for querying the temporary directory. 203 // State used for querying the temporary directory.
212 nacl::scoped_ptr<pp::FileRef> dir_ref_; 204 nacl::scoped_ptr<pp::FileRef> dir_ref_;
213 205
214 // The URL for the pexe file. 206 // The URL for the pexe file.
215 nacl::string pexe_url_; 207 nacl::string pexe_url_;
216 // Optional cache identity for translation caching. 208 // Optional cache identity for translation caching.
217 nacl::string cache_identity_; 209 nacl::string cache_identity_;
218 // Object file, produced by the translator and consumed by the linker. 210 // Object file, produced by the translator and consumed by the linker.
219 nacl::scoped_ptr<TempFile> obj_file_; 211 nacl::scoped_ptr<TempFile> obj_file_;
220 // Translated nexe file, produced by the linker. 212 // Translated nexe file, produced by the linker and consumed by sel_ldr.
221 nacl::scoped_ptr<TempFile> temp_nexe_file_; 213 nacl::scoped_ptr<LocalTempFile> nexe_file_;
222 // Cached nexe file, consumed by sel_ldr. This will be NULL if we do
223 // not have a writeable cache file. That is currently the case when
224 // off_the_record_ is true.
225 nacl::scoped_ptr<LocalTempFile> cached_nexe_file_;
226 214
227 // Downloader for streaming translation 215 // Downloader for streaming translation
228 nacl::scoped_ptr<FileDownloader> streaming_downloader_; 216 nacl::scoped_ptr<FileDownloader> streaming_downloader_;
229 217
230 // Used to report information when errors (PPAPI or otherwise) are reported. 218 // Used to report information when errors (PPAPI or otherwise) are reported.
231 ErrorInfo error_info_; 219 ErrorInfo error_info_;
232 // True if an error was already reported, and translate_notify_callback_ 220 // True if an error was already reported, and translate_notify_callback_
233 // was already run/consumed. 221 // was already run/consumed.
234 bool error_already_reported_; 222 bool error_already_reported_;
235 223
236 // True if compilation is off_the_record.
237 bool off_the_record_;
238
239 // The helper thread used to do translations via SRPC. 224 // The helper thread used to do translations via SRPC.
240 // Keep this last in declaration order to ensure the other variables 225 // Keep this last in declaration order to ensure the other variables
241 // haven't been destroyed yet when its destructor runs. 226 // haven't been destroyed yet when its destructor runs.
242 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; 227 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_;
243 228
244 }; 229 };
245 230
246 //---------------------------------------------------------------------- 231 //----------------------------------------------------------------------
247 232
248 } // namespace plugin; 233 } // namespace plugin;
249 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 234 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/local_temp_file.h ('k') | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698