OLD | NEW |
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 COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ | 5 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ |
6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ | 6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/files/file.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "components/nacl/renderer/plugin/nacl_subprocess.h" | 16 #include "components/nacl/renderer/plugin/nacl_subprocess.h" |
16 #include "components/nacl/renderer/plugin/plugin_error.h" | 17 #include "components/nacl/renderer/plugin/plugin_error.h" |
17 #include "components/nacl/renderer/plugin/pnacl_resources.h" | 18 #include "components/nacl/renderer/plugin/pnacl_resources.h" |
18 #include "ppapi/cpp/completion_callback.h" | 19 #include "ppapi/cpp/completion_callback.h" |
19 #include "ppapi/utility/completion_callback_factory.h" | 20 #include "ppapi/utility/completion_callback_factory.h" |
20 | 21 |
21 struct PP_PNaClOptions; | 22 struct PP_PNaClOptions; |
22 | 23 |
23 namespace plugin { | 24 namespace plugin { |
24 | 25 |
25 class Plugin; | 26 class Plugin; |
26 class PnaclCoordinator; | 27 class PnaclCoordinator; |
27 class PnaclTranslateThread; | 28 class PnaclTranslateThread; |
28 class TempFile; | |
29 | 29 |
30 // A class invoked by Plugin to handle PNaCl client-side translation. | 30 // A class invoked by Plugin to handle PNaCl client-side translation. |
31 // Usage: | 31 // Usage: |
32 // (1) Invoke the factory method, e.g., | 32 // (1) Invoke the factory method, e.g., |
33 // PnaclCoordinator* coord = BitcodeToNative(plugin, | 33 // PnaclCoordinator* coord = BitcodeToNative(plugin, |
34 // "http://foo.com/my.pexe", | 34 // "http://foo.com/my.pexe", |
35 // pnacl_options, | 35 // pnacl_options, |
36 // translate_notify_callback); | 36 // translate_notify_callback); |
37 // (2) translate_notify_callback gets invoked when translation is complete. | 37 // (2) translate_notify_callback gets invoked when translation is complete. |
38 // If the translation was successful, the pp_error argument is PP_OK. | 38 // If the translation was successful, the pp_error argument is PP_OK. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // The URL for the pexe file. | 147 // The URL for the pexe file. |
148 std::string pexe_url_; | 148 std::string pexe_url_; |
149 // Options for translation. | 149 // Options for translation. |
150 PP_PNaClOptions pnacl_options_; | 150 PP_PNaClOptions pnacl_options_; |
151 // Architecture-specific attributes used for translation. These are | 151 // Architecture-specific attributes used for translation. These are |
152 // supplied by Chrome, not the developer, and are therefore different | 152 // supplied by Chrome, not the developer, and are therefore different |
153 // from PNaCl options. | 153 // from PNaCl options. |
154 std::string architecture_attributes_; | 154 std::string architecture_attributes_; |
155 | 155 |
156 // Object file, produced by the translator and consumed by the linker. | 156 // Object file, produced by the translator and consumed by the linker. |
157 std::vector<TempFile*> obj_files_; | 157 std::vector<base::File> obj_files_; |
158 // Number of split modules for llc. | 158 // Number of split modules for llc. |
159 int split_module_count_; | 159 int split_module_count_; |
160 // Number of threads for llc / subzero. | 160 // Number of threads for llc / subzero. |
161 int num_threads_; | 161 int num_threads_; |
162 | 162 |
163 // Translated nexe file, produced by the linker. | 163 // Translated nexe file, produced by the linker. |
164 scoped_ptr<TempFile> temp_nexe_file_; | 164 base::File temp_nexe_file_; |
165 | 165 |
166 // Used to report information when errors (PPAPI or otherwise) are reported. | 166 // Used to report information when errors (PPAPI or otherwise) are reported. |
167 ErrorInfo error_info_; | 167 ErrorInfo error_info_; |
168 | 168 |
169 // True if an error was already reported, and translate_notify_callback_ | 169 // True if an error was already reported, and translate_notify_callback_ |
170 // was already run/consumed. | 170 // was already run/consumed. |
171 bool error_already_reported_; | 171 bool error_already_reported_; |
172 | 172 |
173 // State for timing and size information for UMA stats. | 173 // State for timing and size information for UMA stats. |
174 int64_t pexe_size_; // Count as we stream -- will converge to pexe size. | 174 int64_t pexe_size_; // Count as we stream -- will converge to pexe size. |
175 int64_t pexe_bytes_compiled_; // Count as we compile. | 175 int64_t pexe_bytes_compiled_; // Count as we compile. |
176 int64_t expected_pexe_size_; // Expected download total (-1 if unknown). | 176 int64_t expected_pexe_size_; // Expected download total (-1 if unknown). |
177 | 177 |
178 // The helper thread used to do translations via SRPC. | 178 // The helper thread used to do translations via SRPC. |
179 // It accesses fields of PnaclCoordinator so it must have a | 179 // It accesses fields of PnaclCoordinator so it must have a |
180 // shorter lifetime. | 180 // shorter lifetime. |
181 scoped_ptr<PnaclTranslateThread> translate_thread_; | 181 scoped_ptr<PnaclTranslateThread> translate_thread_; |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(PnaclCoordinator); | 183 DISALLOW_COPY_AND_ASSIGN(PnaclCoordinator); |
184 }; | 184 }; |
185 | 185 |
186 //---------------------------------------------------------------------- | 186 //---------------------------------------------------------------------- |
187 | 187 |
188 } // namespace plugin; | 188 } // namespace plugin; |
189 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ | 189 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |