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

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: 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_scoped_ptr.h"
9 #include "native_client/src/include/nacl_string.h"
10 #include "native_client/src/shared/platform/nacl_threads.h"
11 #include "native_client/src/shared/platform/nacl_sync_checked.h"
12
13 #include "ppapi/cpp/completion_callback.h"
14
15 namespace nacl {
16 struct DescWrapper;
17 }
18
19
20 namespace plugin {
21
22 class ErrorInfo;
23 class LocalTempFile;
24 class Manifest;
25 class NaClSubprocess;
26 class Plugin;
27 class PnaclResources;
28
29 class PnaclTranslateThread {
30 public:
31 PnaclTranslateThread();
32 virtual ~PnaclTranslateThread();
33 // Maybe better to encapsulate these into a class/struct?
jvoung - send to chromium... 2012/05/15 23:51:05 Somewhat related to this -- these shared data-stru
Derek Schuff 2012/05/16 16:47:46 OK. so clearly we'll have to do something differen
34 void RunTranslate(pp::CompletionCallback finish_callback,
35 const Manifest* manifest,
36 const Manifest* ld_manifest,
37 LocalTempFile* obj_file,
38 LocalTempFile* nexe_file,
39 nacl::DescWrapper* pexe_wrapper,
40 ErrorInfo* error_info,
41 PnaclResources* resources,
42 Plugin* plugin);
43 bool SubprocessesShouldDie();
44 // Signal the translate thread and subprocesses that they should stop.
45 void SetSubprocessesShouldDie(bool subprocesses_should_die);
46
47 private:
48 // Starts an individual llc or ld subprocess used for translation.
49 NaClSubprocess* StartSubprocess(const nacl::string& url,
50 const Manifest* manifest);
51 // Creates a helper thread to allow translations to be
52 // invoked via SRPC. This is the helper thread function for translation.
53 static void WINAPI DoTranslateThread(void* arg);
54 // Signal that Pnacl translation failed, from the translation thread only.
55 void TranslateFailed(const nacl::string& error_string);
56 // Returns true if a the translate thread and subprocesses should stop.
57
58 // Callback to run when tasks are completed or an error has occurred.
59 pp::CompletionCallback report_translate_finished_;
60 // True if the translation thread and related subprocesses should exit.
61 bool subprocesses_should_die_;
62 // Used to guard and publish subprocesses_should_die_.
63 struct NaClMutex subprocess_mu_;
64
65 nacl::scoped_ptr<NaClThread> translate_thread_;
66
67 // Data about the translation files, owned by the coordinator
68 const Manifest* manifest_;
69 const Manifest* ld_manifest_;
70 LocalTempFile* obj_file_;
71 LocalTempFile* nexe_file_;
72 nacl::DescWrapper* pexe_wrapper_;
73 ErrorInfo *error_info_;
74 PnaclResources* resources_;
75 Plugin* plugin_;
76 };
77
78 }
79 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698