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

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

Issue 10843009: Better handling of surfaway/reload in PNaCl translation (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_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"
11 #include "native_client/src/shared/platform/nacl_threads.h" 11 #include "native_client/src/shared/platform/nacl_threads.h"
12 #include "native_client/src/shared/platform/nacl_sync_checked.h" 12 #include "native_client/src/shared/platform/nacl_sync_checked.h"
13 #include "native_client/src/trusted/plugin/plugin_error.h" 13 #include "native_client/src/trusted/plugin/plugin_error.h"
14 #include "native_client/src/trusted/plugin/service_runtime.h"
14 15
15 #include "ppapi/cpp/completion_callback.h" 16 #include "ppapi/cpp/completion_callback.h"
16 17
17 namespace nacl { 18 namespace nacl {
18 class DescWrapper; 19 class DescWrapper;
19 } 20 }
20 21
21 22
22 namespace plugin { 23 namespace plugin {
23 24
24 class LocalTempFile; 25 class LocalTempFile;
25 class Manifest; 26 class Manifest;
26 class NaClSubprocess; 27 class NaClSubprocess;
27 class Plugin; 28 class Plugin;
28 class PnaclResources; 29 class PnaclResources;
29 class TempFile; 30 class TempFile;
30 31
31 class PnaclTranslateThread { 32 class PnaclTranslateThread {
32 public: 33 public:
33 PnaclTranslateThread(); 34 PnaclTranslateThread();
34 virtual ~PnaclTranslateThread(); 35 virtual ~PnaclTranslateThread();
35 // TODO(jvoung/dschuff): handle surfaway issues when coordinator/plugin 36
36 // goes away. This data may have to be refcounted not touched in that case.
37 virtual void RunTranslate(const pp::CompletionCallback& finish_callback, 37 virtual void RunTranslate(const pp::CompletionCallback& finish_callback,
38 const Manifest* manifest, 38 const Manifest* manifest,
39 const Manifest* ld_manifest, 39 const Manifest* ld_manifest,
40 TempFile* obj_file, 40 TempFile* obj_file,
41 LocalTempFile* nexe_file, 41 LocalTempFile* nexe_file,
42 ErrorInfo* error_info, 42 ErrorInfo* error_info,
43 PnaclResources* resources, 43 PnaclResources* resources,
44 Plugin* plugin) = 0; 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();
(...skipping 10 matching lines...) Expand all
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() = 0; 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,
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 // Register a reverse service interface which will be shutdown if the
68 // plugin is shutdown. The reverse service pointer must be available on the
69 // main thread because the translation thread could be blocked on SRPC
70 // waiting for the translator, which could be waiting on a reverse
71 // service call.
72 // (see also the comments in Plugin::~Plugin about ShutdownSubprocesses,
73 // but that only handles the main nexe and not the translator nexes.)
74 void RegisterReverseInterface(PluginReverseInterface *interface);
75
67 // Callback to run when tasks are completed or an error has occurred. 76 // Callback to run when tasks are completed or an error has occurred.
68 pp::CompletionCallback report_translate_finished_; 77 pp::CompletionCallback report_translate_finished_;
69 // True if the translation thread and related subprocesses should exit. 78 // True if the translation thread and related subprocesses should exit.
70 bool subprocesses_should_die_; 79 bool subprocesses_should_die_;
71 // Used to guard and publish subprocesses_should_die_. 80 // Used to guard and publish subprocesses_should_die_.
72 struct NaClMutex subprocess_mu_; 81 struct NaClMutex subprocess_mu_;
73 82
74 nacl::scoped_ptr<NaClThread> translate_thread_; 83 nacl::scoped_ptr<NaClThread> translate_thread_;
75 84
85 // Reverse interface to shutdown on SetSubprocessesShouldDie
86 PluginReverseInterface* current_rev_interface_;
87
76 // Data about the translation files, owned by the coordinator 88 // Data about the translation files, owned by the coordinator
77 const Manifest* manifest_; 89 const Manifest* manifest_;
78 const Manifest* ld_manifest_; 90 const Manifest* ld_manifest_;
79 TempFile* obj_file_; 91 TempFile* obj_file_;
80 LocalTempFile* nexe_file_; 92 LocalTempFile* nexe_file_;
81 ErrorInfo* coordinator_error_info_; 93 ErrorInfo* coordinator_error_info_;
82 PnaclResources* resources_; 94 PnaclResources* resources_;
83 Plugin* plugin_; 95 Plugin* plugin_;
84 private: 96 private:
85 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); 97 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
86 }; 98 };
87 99
88 } 100 }
89 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 101 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698