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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/platform_file.h" |
| 15 #include "base/time/time.h" |
14 #include "ppapi/c/private/ppb_nacl_private.h" | 16 #include "ppapi/c/private/ppb_nacl_private.h" |
15 #include "url/gurl.h" | 17 #include "url/gurl.h" |
16 | 18 |
17 namespace content { | 19 namespace content { |
18 class PepperPluginInstance; | 20 class PepperPluginInstance; |
19 } | 21 } |
20 | 22 |
21 namespace nacl { | 23 namespace nacl { |
22 | 24 |
23 class ManifestServiceChannel; | 25 class ManifestServiceChannel; |
24 class TrustedPluginChannel; | 26 class TrustedPluginChannel; |
25 | 27 |
26 // NexeLoadManager provides methods for reporting the progress of loading a | 28 // NexeLoadManager provides methods for reporting the progress of loading a |
27 // nexe. | 29 // nexe. |
28 class NexeLoadManager { | 30 class NexeLoadManager { |
29 public: | 31 public: |
30 explicit NexeLoadManager(PP_Instance instance); | 32 explicit NexeLoadManager(PP_Instance instance); |
31 ~NexeLoadManager(); | 33 ~NexeLoadManager(); |
32 | 34 |
33 void NexeFileDidOpen(int32_t pp_error, | 35 void NexeFileDidOpen(int32_t pp_error, |
34 int32_t fd, | 36 base::PlatformFile file, |
35 int32_t http_status, | 37 int32_t http_status, |
36 int64_t nexe_bytes_read, | 38 int64_t nexe_bytes_read, |
37 const std::string& url, | 39 const std::string& url, |
38 int64_t time_since_open); | 40 base::TimeDelta time_since_open); |
39 void ReportLoadSuccess(const std::string& url, | 41 void ReportLoadSuccess(const std::string& url, |
40 uint64_t loaded_bytes, | 42 uint64_t loaded_bytes, |
41 uint64_t total_bytes); | 43 uint64_t total_bytes); |
42 void ReportLoadError(PP_NaClError error, | 44 void ReportLoadError(PP_NaClError error, |
43 const std::string& error_message); | 45 const std::string& error_message); |
44 | 46 |
45 // console_message is a part of the error that is logged to | 47 // console_message is a part of the error that is logged to |
46 // the JavaScript console but is not reported to JavaScript via | 48 // the JavaScript console but is not reported to JavaScript via |
47 // the lastError property. This is used to report internal errors which | 49 // the lastError property. This is used to report internal errors which |
48 // may easily change in new versions of the browser and we don't want apps | 50 // may easily change in new versions of the browser and we don't want apps |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 std::string mime_type_; | 160 std::string mime_type_; |
159 | 161 |
160 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 162 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
161 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; | 163 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; |
162 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 164 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
163 }; | 165 }; |
164 | 166 |
165 } // namespace nacl | 167 } // namespace nacl |
166 | 168 |
167 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 169 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
OLD | NEW |