Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 NexeLoadManager(PP_Instance instance, mojom::NaClHost* host); |
|
tibell
2017/01/31 01:24:13
Comment: |host| must outlive this object.
Sam McNally
2017/02/07 00:13:18
Done.
| |
| 36 ~NexeLoadManager(); | 37 ~NexeLoadManager(); |
| 37 | 38 |
| 38 void NexeFileDidOpen(int32_t pp_error, | 39 void NexeFileDidOpen(int32_t pp_error, |
| 39 const base::File& file, | 40 const base::File& file, |
| 40 int32_t http_status, | 41 int32_t http_status, |
| 41 int64_t nexe_bytes_read, | 42 int64_t nexe_bytes_read, |
| 42 const std::string& url, | 43 const std::string& url, |
| 43 base::TimeDelta time_since_open); | 44 base::TimeDelta time_since_open); |
| 44 void ReportLoadSuccess(const std::string& url, | 45 void ReportLoadSuccess(const std::string& url, |
| 45 uint64_t loaded_bytes, | 46 uint64_t loaded_bytes, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 bool DevInterfacesEnabled() const; | 112 bool DevInterfacesEnabled() const; |
| 112 | 113 |
| 113 // Returns the time that the work for PNaCl translation began. | 114 // Returns the time that the work for PNaCl translation began. |
| 114 base::Time pnacl_start_time() const { return pnacl_start_time_; } | 115 base::Time pnacl_start_time() const { return pnacl_start_time_; } |
| 115 void set_pnacl_start_time(base::Time time) { | 116 void set_pnacl_start_time(base::Time time) { |
| 116 pnacl_start_time_ = time; | 117 pnacl_start_time_ = time; |
| 117 } | 118 } |
| 118 | 119 |
| 119 const std::string& program_url() const { return program_url_; } | 120 const std::string& program_url() const { return program_url_; } |
| 120 | 121 |
| 121 void set_crash_info_shmem_handle(base::SharedMemoryHandle h) { | 122 void set_crash_info_shmem_handle(mojo::ScopedSharedBufferHandle h) { |
| 122 crash_info_shmem_handle_ = h; | 123 crash_info_shmem_handle_ = std::move(h); |
| 123 } | 124 } |
| 124 | 125 |
| 125 bool nonsfi() const { return nonsfi_; } | 126 bool nonsfi() const { return nonsfi_; } |
| 126 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; } | 127 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; } |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); | 130 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); |
| 130 | 131 |
| 131 void ReportDeadNexe(); | 132 void ReportDeadNexe(); |
| 132 | 133 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 181 |
| 181 // We store mime_type_ outside of args_ explicitly because we change it to be | 182 // We store mime_type_ outside of args_ explicitly because we change it to be |
| 182 // lowercase. | 183 // lowercase. |
| 183 std::string mime_type_; | 184 std::string mime_type_; |
| 184 | 185 |
| 185 base::Time pnacl_start_time_; | 186 base::Time pnacl_start_time_; |
| 186 | 187 |
| 187 // A flag that indicates if the plugin is using Non-SFI mode. | 188 // A flag that indicates if the plugin is using Non-SFI mode. |
| 188 bool nonsfi_; | 189 bool nonsfi_; |
| 189 | 190 |
| 190 base::SharedMemoryHandle crash_info_shmem_handle_; | 191 mojo::ScopedSharedBufferHandle crash_info_shmem_handle_; |
| 191 | 192 |
| 192 std::unique_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 193 std::unique_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
| 193 std::unique_ptr<ManifestServiceChannel> manifest_service_channel_; | 194 std::unique_ptr<ManifestServiceChannel> manifest_service_channel_; |
| 195 | |
| 196 mojom::NaClHost* const host_; | |
| 197 | |
| 194 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 198 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
| 195 }; | 199 }; |
| 196 | 200 |
| 197 } // namespace nacl | 201 } // namespace nacl |
| 198 | 202 |
| 199 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 203 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
| OLD | NEW |