OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_NACL_BROWSER_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
6 #define COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class FileProxy; | 23 class FileProxy; |
24 } | 24 } |
25 | 25 |
26 namespace nacl { | 26 namespace nacl { |
27 | 27 |
28 static const int kGdbDebugStubPortUnknown = -1; | 28 static const int kGdbDebugStubPortUnknown = -1; |
29 static const int kGdbDebugStubPortUnused = 0; | 29 static const int kGdbDebugStubPortUnused = 0; |
30 | 30 |
| 31 class OpenNaClFileReadExecImplResult { |
| 32 MOVE_ONLY_TYPE_FOR_CPP_03(OpenNaClFileReadExecImplResult, RValue); |
| 33 |
| 34 public: |
| 35 OpenNaClFileReadExecImplResult(); |
| 36 OpenNaClFileReadExecImplResult(base::File file, base::FilePath file_path); |
| 37 ~OpenNaClFileReadExecImplResult(); |
| 38 |
| 39 OpenNaClFileReadExecImplResult(RValue other); |
| 40 OpenNaClFileReadExecImplResult& operator=(RValue other); |
| 41 |
| 42 bool IsValid() const; |
| 43 |
| 44 base::File file() { return file_.Pass(); } |
| 45 base::FilePath file_path() { return file_path_; } |
| 46 |
| 47 private: |
| 48 base::File file_; |
| 49 base::FilePath file_path_; |
| 50 }; |
| 51 |
31 // Open an immutable executable file that can be mmapped (or a read-only file). | 52 // Open an immutable executable file that can be mmapped (or a read-only file). |
32 // This function should only be called on a thread that can perform file IO. | 53 // This function should only be called on a thread that can perform file IO. |
33 base::File OpenNaClReadExecImpl(const base::FilePath& file_path, | 54 base::File OpenNaClReadExecImpl(const base::FilePath& file_path, |
34 bool is_executable); | 55 bool is_executable); |
35 | 56 |
| 57 // The same as OpenNaClReadExecImpl except that this one opens all files in |
| 58 // the vector at once. Returns an array of length |file_paths.length()|. The |
| 59 // returned array may contain invalid base::File object(s) when one or more |
| 60 // files in |file_paths| are not found. |
| 61 scoped_ptr<OpenNaClFileReadExecImplResult[]> OpenNaClFilesReadExecImpl( |
| 62 const std::vector<base::FilePath>& file_paths, bool is_executable); |
| 63 |
36 // Represents shared state for all NaClProcessHost objects in the browser. | 64 // Represents shared state for all NaClProcessHost objects in the browser. |
37 class NaClBrowser { | 65 class NaClBrowser { |
38 public: | 66 public: |
39 static NaClBrowser* GetInstance(); | 67 static NaClBrowser* GetInstance(); |
40 | 68 |
41 // Will it be possible to launch a NaCl process, eventually? | 69 // Will it be possible to launch a NaCl process, eventually? |
42 bool IsOk() const; | 70 bool IsOk() const; |
43 | 71 |
44 // Are we ready to launch a NaCl process now? Implies IsOk(). | 72 // Are we ready to launch a NaCl process now? Implies IsOk(). |
45 bool IsReady() const; | 73 bool IsReady() const; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 228 |
201 // Singletons get destroyed at shutdown. | 229 // Singletons get destroyed at shutdown. |
202 base::WeakPtrFactory<NaClBrowser> weak_factory_; | 230 base::WeakPtrFactory<NaClBrowser> weak_factory_; |
203 | 231 |
204 DISALLOW_COPY_AND_ASSIGN(NaClBrowser); | 232 DISALLOW_COPY_AND_ASSIGN(NaClBrowser); |
205 }; | 233 }; |
206 | 234 |
207 } // namespace nacl | 235 } // namespace nacl |
208 | 236 |
209 #endif // COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ | 237 #endif // COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
OLD | NEW |