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

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

Issue 10377157: Refactor Pnacl coordinator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sehr comments Created 8 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
7
8 #include "native_client/src/include/nacl_macros.h"
9 #include "native_client/src/include/nacl_scoped_ptr.h"
10 #include "native_client/src/include/nacl_string.h"
11 #include "native_client/src/shared/platform/nacl_threads.h"
12 #include "native_client/src/shared/platform/nacl_sync_checked.h"
13
14 #include "ppapi/cpp/completion_callback.h"
15
16 namespace nacl {
17 class DescWrapper;
18 }
19
20
21 namespace plugin {
22
23 class ErrorInfo;
24 class LocalTempFile;
25 class Manifest;
26 class NaClSubprocess;
27 class Plugin;
28 class PnaclResources;
29
30 class PnaclTranslateThread {
31 public:
32 PnaclTranslateThread();
33 virtual ~PnaclTranslateThread();
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.
36 void RunTranslate(pp::CompletionCallback finish_callback,
37 const Manifest* manifest,
38 const Manifest* ld_manifest,
39 LocalTempFile* obj_file,
40 LocalTempFile* nexe_file,
41 nacl::DescWrapper* pexe_wrapper,
42 ErrorInfo* error_info,
43 PnaclResources* resources,
44 Plugin* plugin);
45 bool SubprocessesShouldDie();
46 // Signal the translate thread and subprocesses that they should stop.
47 void SetSubprocessesShouldDie(bool subprocesses_should_die);
48
49 private:
50 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
51
52 // Starts an individual llc or ld subprocess used for translation.
53 NaClSubprocess* StartSubprocess(const nacl::string& url,
54 const Manifest* manifest);
55 // Creates a helper thread to allow translations to be
56 // invoked via SRPC. This is the helper thread function for translation.
57 static void WINAPI DoTranslateThread(void* arg);
58 // Signal that Pnacl translation failed, from the translation thread only.
59 void TranslateFailed(const nacl::string& error_string);
60 // Returns true if a the translate thread and subprocesses should stop.
61
62 // Callback to run when tasks are completed or an error has occurred.
63 pp::CompletionCallback report_translate_finished_;
64 // True if the translation thread and related subprocesses should exit.
65 bool subprocesses_should_die_;
66 // Used to guard and publish subprocesses_should_die_.
67 struct NaClMutex subprocess_mu_;
68
69 nacl::scoped_ptr<NaClThread> translate_thread_;
70
71 // Data about the translation files, owned by the coordinator
72 const Manifest* manifest_;
73 const Manifest* ld_manifest_;
74 LocalTempFile* obj_file_;
75 LocalTempFile* nexe_file_;
76 nacl::DescWrapper* pexe_wrapper_;
77 ErrorInfo *error_info_;
78 PnaclResources* resources_;
79 Plugin* plugin_;
80 };
81
82 }
83 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698