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

Side by Side Diff: chrome/browser/nacl_host/nacl_browser.h

Issue 14750007: NaCl: enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More edits Created 7 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
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 CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_ 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_
6 #define CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_ 6 #define CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/containers/mru_cache.h"
9 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
10 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/platform_file.h" 13 #include "base/platform_file.h"
13 #include "chrome/browser/nacl_host/nacl_validation_cache.h" 14 #include "chrome/browser/nacl_host/nacl_validation_cache.h"
14 15
15 class URLPattern; 16 class URLPattern;
16 class GURL; 17 class GURL;
17 18
19 namespace nacl {
20
21 // Open an immutable executable file that can be mmaped.
Mark Seaborn 2013/05/16 23:01:47 "mmapped"
Nick Bray (chromium) 2013/05/23 16:44:11 Done.
22 // This function should only be called on a tread that can perform file IO.
Mark Seaborn 2013/05/16 23:01:47 "thread"
Nick Bray (chromium) 2013/05/23 16:44:11 Done.
23 void OpenNaClExecutableImpl(const base::FilePath& file_path,
24 base::PlatformFile* file);
25
26 }
27
18 // Represents shared state for all NaClProcessHost objects in the browser. 28 // Represents shared state for all NaClProcessHost objects in the browser.
19 class NaClBrowser { 29 class NaClBrowser {
20 public: 30 public:
21 static NaClBrowser* GetInstance(); 31 static NaClBrowser* GetInstance();
22 32
23 // Will it be possible to launch a NaCl process, eventually? 33 // Will it be possible to launch a NaCl process, eventually?
24 bool IsOk() const; 34 bool IsOk() const;
25 35
26 // Are we ready to launch a NaCl process now? Implies IsOk(). 36 // Are we ready to launch a NaCl process now? Implies IsOk().
27 bool IsReady() const; 37 bool IsReady() const;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void ClearGdbDebugStubPortListener(); 73 void ClearGdbDebugStubPortListener();
64 74
65 bool ValidationCacheIsEnabled() const { 75 bool ValidationCacheIsEnabled() const {
66 return validation_cache_is_enabled_; 76 return validation_cache_is_enabled_;
67 } 77 }
68 78
69 const std::string& GetValidationCacheKey() const { 79 const std::string& GetValidationCacheKey() const {
70 return validation_cache_.GetValidationCacheKey(); 80 return validation_cache_.GetValidationCacheKey();
71 } 81 }
72 82
83 uint64 PutFilePath(const base::FilePath& path);
84 bool GetFilePath(uint64 nonce, base::FilePath *path);
Mark Seaborn 2013/05/16 23:01:47 "* " spacing
Nick Bray (chromium) 2013/05/23 16:44:11 Done.
85
73 bool QueryKnownToValidate(const std::string& signature, bool off_the_record); 86 bool QueryKnownToValidate(const std::string& signature, bool off_the_record);
74 void SetKnownToValidate(const std::string& signature, bool off_the_record); 87 void SetKnownToValidate(const std::string& signature, bool off_the_record);
75 void ClearValidationCache(const base::Closure& callback); 88 void ClearValidationCache(const base::Closure& callback);
76 89
77 private: 90 private:
78 friend struct DefaultSingletonTraits<NaClBrowser>; 91 friend struct DefaultSingletonTraits<NaClBrowser>;
79 92
80 enum NaClResourceState { 93 enum NaClResourceState {
81 NaClResourceUninitialized, 94 NaClResourceUninitialized,
82 NaClResourceRequested, 95 NaClResourceRequested,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 std::vector<URLPattern> debug_patterns_; 129 std::vector<URLPattern> debug_patterns_;
117 bool inverse_debug_patterns_; 130 bool inverse_debug_patterns_;
118 NaClValidationCache validation_cache_; 131 NaClValidationCache validation_cache_;
119 NaClValidationCache off_the_record_validation_cache_; 132 NaClValidationCache off_the_record_validation_cache_;
120 base::FilePath validation_cache_file_path_; 133 base::FilePath validation_cache_file_path_;
121 bool validation_cache_is_enabled_; 134 bool validation_cache_is_enabled_;
122 bool validation_cache_is_modified_; 135 bool validation_cache_is_modified_;
123 NaClResourceState validation_cache_state_; 136 NaClResourceState validation_cache_state_;
124 base::Callback<void(int)> debug_stub_port_listener_; 137 base::Callback<void(int)> debug_stub_port_listener_;
125 138
139 typedef base::HashingMRUCache<uint64, base::FilePath> PathCacheType;
140 PathCacheType path_cache_;
141
126 bool ok_; 142 bool ok_;
127 143
128 // A list of pending tasks to start NaCl processes. 144 // A list of pending tasks to start NaCl processes.
129 std::vector<base::Closure> waiting_; 145 std::vector<base::Closure> waiting_;
130 146
131 DISALLOW_COPY_AND_ASSIGN(NaClBrowser); 147 DISALLOW_COPY_AND_ASSIGN(NaClBrowser);
132 }; 148 };
133 149
134 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_ 150 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROWSER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/nacl_host/nacl_browser.cc » ('j') | chrome/browser/nacl_host/nacl_browser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698