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

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 20 matching lines...) Expand all
31 public: 31 public:
32 PnaclTranslateThread(); 32 PnaclTranslateThread();
33 virtual ~PnaclTranslateThread(); 33 virtual ~PnaclTranslateThread();
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,
42 ErrorInfo* error_info, 41 ErrorInfo* error_info,
43 PnaclResources* resources, 42 PnaclResources* resources,
44 Plugin* plugin); 43 Plugin* plugin) = 0;
45 // Returns true if the translate thread and subprocesses should stop. 44 // Returns true if the translate thread and subprocesses should stop.
46 bool SubprocessesShouldDie(); 45 bool SubprocessesShouldDie();
47 // Signal the translate thread and subprocesses that they should stop. 46 // Signal the translate thread and subprocesses that they should stop.
48 virtual void SetSubprocessesShouldDie(); 47 virtual void SetSubprocessesShouldDie();
49 48
50 protected: 49 protected:
51 // Starts an individual llc or ld subprocess used for translation. 50 // Starts an individual llc or ld subprocess used for translation.
52 NaClSubprocess* StartSubprocess(const nacl::string& url, 51 NaClSubprocess* StartSubprocess(const nacl::string& url,
53 const Manifest* manifest, 52 const Manifest* manifest,
54 ErrorInfo* error_info); 53 ErrorInfo* error_info);
55 // Helper thread entry point for translation. Takes a pointer to 54 // Helper thread entry point for translation. Takes a pointer to
56 // PnaclTranslateThread and calls DoTranslate(). 55 // PnaclTranslateThread and calls DoTranslate().
57 static void WINAPI DoTranslateThread(void* arg); 56 static void WINAPI DoTranslateThread(void* arg);
58 // Runs the SRPCs that control translation. Called from the helper thread. 57 // Runs the SRPCs that control translation. Called from the helper thread.
59 virtual void DoTranslate(); 58 virtual void DoTranslate() = 0;
60 // Signal that Pnacl translation failed, from the translation thread only. 59 // Signal that Pnacl translation failed, from the translation thread only.
61 void TranslateFailed(const nacl::string& error_string); 60 void TranslateFailed(const nacl::string& error_string);
62 // Run the LD subprocess, returning true on success 61 // Run the LD subprocess, returning true on success
63 bool RunLdSubprocess(int is_shared_library, 62 bool RunLdSubprocess(int is_shared_library,
64 const nacl::string& soname, 63 const nacl::string& soname,
65 const nacl::string& lib_dependencies); 64 const nacl::string& lib_dependencies);
66 65
67 // Callback to run when tasks are completed or an error has occurred. 66 // Callback to run when tasks are completed or an error has occurred.
68 pp::CompletionCallback report_translate_finished_; 67 pp::CompletionCallback report_translate_finished_;
69 // True if the translation thread and related subprocesses should exit. 68 // True if the translation thread and related subprocesses should exit.
70 bool subprocesses_should_die_; 69 bool subprocesses_should_die_;
71 // Used to guard and publish subprocesses_should_die_. 70 // Used to guard and publish subprocesses_should_die_.
72 struct NaClMutex subprocess_mu_; 71 struct NaClMutex subprocess_mu_;
73 72
74 nacl::scoped_ptr<NaClThread> translate_thread_; 73 nacl::scoped_ptr<NaClThread> translate_thread_;
75 74
76 // Data about the translation files, owned by the coordinator 75 // Data about the translation files, owned by the coordinator
77 const Manifest* manifest_; 76 const Manifest* manifest_;
78 const Manifest* ld_manifest_; 77 const Manifest* ld_manifest_;
79 LocalTempFile* obj_file_; 78 LocalTempFile* obj_file_;
80 LocalTempFile* nexe_file_; 79 LocalTempFile* nexe_file_;
81 nacl::DescWrapper* pexe_wrapper_;
82 ErrorInfo* coordinator_error_info_; 80 ErrorInfo* coordinator_error_info_;
83 PnaclResources* resources_; 81 PnaclResources* resources_;
84 Plugin* plugin_; 82 Plugin* plugin_;
85 private: 83 private:
86 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); 84 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
87 }; 85 };
88 86
89 } 87 }
90 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 88 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698