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

Side by Side Diff: components/nacl/renderer/nexe_load_manager.h

Issue 2514323004: Convert NaCl renderer-browser messages to mojo. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « components/nacl/common/pnacl_types.h ('k') | components/nacl/renderer/nexe_load_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_NEXE_LOAD_MANAGER_H_ 5 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_
6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ 6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/files/file.h" 14 #include "base/files/file.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/shared_memory.h" 16 #include "base/memory/shared_memory.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "components/nacl/common/nacl.mojom.h"
19 #include "components/nacl/renderer/ppb_nacl_private.h" 20 #include "components/nacl/renderer/ppb_nacl_private.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace content { 23 namespace content {
23 class PepperPluginInstance; 24 class PepperPluginInstance;
24 } 25 }
25 26
26 namespace nacl { 27 namespace nacl {
27 28
28 class ManifestServiceChannel; 29 class ManifestServiceChannel;
29 class TrustedPluginChannel; 30 class TrustedPluginChannel;
30 31
31 // NexeLoadManager provides methods for reporting the progress of loading a 32 // NexeLoadManager provides methods for reporting the progress of loading a
32 // nexe. 33 // nexe.
33 class NexeLoadManager { 34 class NexeLoadManager {
34 public: 35 public:
35 explicit NexeLoadManager(PP_Instance instance); 36 // |host| must outlive this object.
37 NexeLoadManager(PP_Instance instance, mojom::NaClHost* host);
36 ~NexeLoadManager(); 38 ~NexeLoadManager();
37 39
38 void NexeFileDidOpen(int32_t pp_error, 40 void NexeFileDidOpen(int32_t pp_error,
39 const base::File& file, 41 const base::File& file,
40 int32_t http_status, 42 int32_t http_status,
41 int64_t nexe_bytes_read, 43 int64_t nexe_bytes_read,
42 const std::string& url, 44 const std::string& url,
43 base::TimeDelta time_since_open); 45 base::TimeDelta time_since_open);
44 void ReportLoadSuccess(const std::string& url, 46 void ReportLoadSuccess(const std::string& url,
45 uint64_t loaded_bytes, 47 uint64_t loaded_bytes,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool DevInterfacesEnabled() const; 113 bool DevInterfacesEnabled() const;
112 114
113 // Returns the time that the work for PNaCl translation began. 115 // Returns the time that the work for PNaCl translation began.
114 base::Time pnacl_start_time() const { return pnacl_start_time_; } 116 base::Time pnacl_start_time() const { return pnacl_start_time_; }
115 void set_pnacl_start_time(base::Time time) { 117 void set_pnacl_start_time(base::Time time) {
116 pnacl_start_time_ = time; 118 pnacl_start_time_ = time;
117 } 119 }
118 120
119 const std::string& program_url() const { return program_url_; } 121 const std::string& program_url() const { return program_url_; }
120 122
121 void set_crash_info_shmem_handle(base::SharedMemoryHandle h) { 123 void set_crash_info_shmem_handle(mojo::ScopedSharedBufferHandle h) {
122 crash_info_shmem_handle_ = h; 124 crash_info_shmem_handle_ = std::move(h);
123 } 125 }
124 126
125 bool nonsfi() const { return nonsfi_; } 127 bool nonsfi() const { return nonsfi_; }
126 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; } 128 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; }
127 129
128 private: 130 private:
129 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); 131 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager);
130 132
131 void ReportDeadNexe(); 133 void ReportDeadNexe();
132 134
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 182
181 // We store mime_type_ outside of args_ explicitly because we change it to be 183 // We store mime_type_ outside of args_ explicitly because we change it to be
182 // lowercase. 184 // lowercase.
183 std::string mime_type_; 185 std::string mime_type_;
184 186
185 base::Time pnacl_start_time_; 187 base::Time pnacl_start_time_;
186 188
187 // A flag that indicates if the plugin is using Non-SFI mode. 189 // A flag that indicates if the plugin is using Non-SFI mode.
188 bool nonsfi_; 190 bool nonsfi_;
189 191
190 base::SharedMemoryHandle crash_info_shmem_handle_; 192 mojo::ScopedSharedBufferHandle crash_info_shmem_handle_;
191 193
192 std::unique_ptr<TrustedPluginChannel> trusted_plugin_channel_; 194 std::unique_ptr<TrustedPluginChannel> trusted_plugin_channel_;
193 std::unique_ptr<ManifestServiceChannel> manifest_service_channel_; 195 std::unique_ptr<ManifestServiceChannel> manifest_service_channel_;
196
197 mojom::NaClHost* const host_;
198
194 base::WeakPtrFactory<NexeLoadManager> weak_factory_; 199 base::WeakPtrFactory<NexeLoadManager> weak_factory_;
195 }; 200 };
196 201
197 } // namespace nacl 202 } // namespace nacl
198 203
199 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ 204 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_
OLDNEW
« no previous file with comments | « components/nacl/common/pnacl_types.h ('k') | components/nacl/renderer/nexe_load_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698