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

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

Issue 10800084: Remove non-streaming translation code from pnacl coordinator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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_TRANSLATE_THREAD_H_ 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
7 7
8 #include "native_client/src/include/nacl_macros.h" 8 #include "native_client/src/include/nacl_macros.h"
9 #include "native_client/src/include/nacl_scoped_ptr.h" 9 #include "native_client/src/include/nacl_scoped_ptr.h"
10 #include "native_client/src/include/nacl_string.h" 10 #include "native_client/src/include/nacl_string.h"
(...skipping 23 matching lines...) Expand all
34 // TODO(jvoung/dschuff): handle surfaway issues when coordinator/plugin 34 // TODO(jvoung/dschuff): handle surfaway issues when coordinator/plugin
35 // goes away. This data may have to be refcounted not touched in that case. 35 // goes away. This data may have to be refcounted not touched in that case.
36 virtual void RunTranslate(const pp::CompletionCallback& finish_callback, 36 virtual void RunTranslate(const pp::CompletionCallback& finish_callback,
37 const Manifest* manifest, 37 const Manifest* manifest,
38 const Manifest* ld_manifest, 38 const Manifest* ld_manifest,
39 LocalTempFile* obj_file, 39 LocalTempFile* obj_file,
40 LocalTempFile* nexe_file, 40 LocalTempFile* nexe_file,
41 nacl::DescWrapper* pexe_wrapper, 41 nacl::DescWrapper* pexe_wrapper,
42 ErrorInfo* error_info, 42 ErrorInfo* error_info,
43 PnaclResources* resources, 43 PnaclResources* resources,
44 Plugin* plugin); 44 Plugin* plugin) = 0;
45 // Returns true if the translate thread and subprocesses should stop. 45 // Returns true if the translate thread and subprocesses should stop.
46 bool SubprocessesShouldDie(); 46 bool SubprocessesShouldDie();
47 // Signal the translate thread and subprocesses that they should stop. 47 // Signal the translate thread and subprocesses that they should stop.
48 virtual void SetSubprocessesShouldDie(); 48 virtual void SetSubprocessesShouldDie();
49 49
50 protected: 50 protected:
51 // Starts an individual llc or ld subprocess used for translation. 51 // Starts an individual llc or ld subprocess used for translation.
52 NaClSubprocess* StartSubprocess(const nacl::string& url, 52 NaClSubprocess* StartSubprocess(const nacl::string& url,
53 const Manifest* manifest, 53 const Manifest* manifest,
54 ErrorInfo* error_info); 54 ErrorInfo* error_info);
55 // Helper thread entry point for translation. Takes a pointer to 55 // Helper thread entry point for translation. Takes a pointer to
56 // PnaclTranslateThread and calls DoTranslate(). 56 // PnaclTranslateThread and calls DoTranslate().
57 static void WINAPI DoTranslateThread(void* arg); 57 static void WINAPI DoTranslateThread(void* arg);
58 // Runs the SRPCs that control translation. Called from the helper thread. 58 // Runs the SRPCs that control translation. Called from the helper thread.
59 virtual void DoTranslate(); 59 virtual void DoTranslate() = 0;
60 // Signal that Pnacl translation failed, from the translation thread only. 60 // Signal that Pnacl translation failed, from the translation thread only.
61 void TranslateFailed(const nacl::string& error_string); 61 void TranslateFailed(const nacl::string& error_string);
62 // Run the LD subprocess, returning true on success 62 // Run the LD subprocess, returning true on success
63 bool RunLdSubprocess(int is_shared_library, 63 bool RunLdSubprocess(int is_shared_library,
jvoung - send to chromium... 2012/07/23 21:22:11 nit: Might be more symmetric if this was DoLink()
Derek Schuff 2012/07/23 21:51:57 yeah, the division was more because RunLdSubproces
64 const nacl::string& soname, 64 const nacl::string& soname,
65 const nacl::string& lib_dependencies); 65 const nacl::string& lib_dependencies);
66 66
67 // Callback to run when tasks are completed or an error has occurred. 67 // Callback to run when tasks are completed or an error has occurred.
68 pp::CompletionCallback report_translate_finished_; 68 pp::CompletionCallback report_translate_finished_;
69 // True if the translation thread and related subprocesses should exit. 69 // True if the translation thread and related subprocesses should exit.
70 bool subprocesses_should_die_; 70 bool subprocesses_should_die_;
71 // Used to guard and publish subprocesses_should_die_. 71 // Used to guard and publish subprocesses_should_die_.
72 struct NaClMutex subprocess_mu_; 72 struct NaClMutex subprocess_mu_;
73 73
74 nacl::scoped_ptr<NaClThread> translate_thread_; 74 nacl::scoped_ptr<NaClThread> translate_thread_;
75 75
76 // Data about the translation files, owned by the coordinator 76 // Data about the translation files, owned by the coordinator
77 const Manifest* manifest_; 77 const Manifest* manifest_;
78 const Manifest* ld_manifest_; 78 const Manifest* ld_manifest_;
79 LocalTempFile* obj_file_; 79 LocalTempFile* obj_file_;
80 LocalTempFile* nexe_file_; 80 LocalTempFile* nexe_file_;
81 nacl::DescWrapper* pexe_wrapper_; 81 nacl::DescWrapper* pexe_wrapper_;
82 ErrorInfo* coordinator_error_info_; 82 ErrorInfo* coordinator_error_info_;
83 PnaclResources* resources_; 83 PnaclResources* resources_;
84 Plugin* plugin_; 84 Plugin* plugin_;
85 private: 85 private:
86 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); 86 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
87 }; 87 };
88 88
89 } 89 }
90 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 90 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698