OLD | NEW |
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 #include "chrome/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #endif | 65 #endif |
66 #endif | 66 #endif |
67 | 67 |
68 namespace { | 68 namespace { |
69 | 69 |
70 class FilePatcherImpl : public chrome::mojom::FilePatcher { | 70 class FilePatcherImpl : public chrome::mojom::FilePatcher { |
71 public: | 71 public: |
72 FilePatcherImpl() = default; | 72 FilePatcherImpl() = default; |
73 ~FilePatcherImpl() override = default; | 73 ~FilePatcherImpl() override = default; |
74 | 74 |
75 static void Create(chrome::mojom::FilePatcherRequest request) { | 75 static void Create(const service_manager::BindSourceInfo& source_info, |
| 76 chrome::mojom::FilePatcherRequest request) { |
76 mojo::MakeStrongBinding(base::MakeUnique<FilePatcherImpl>(), | 77 mojo::MakeStrongBinding(base::MakeUnique<FilePatcherImpl>(), |
77 std::move(request)); | 78 std::move(request)); |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 // chrome::mojom::FilePatcher: | 82 // chrome::mojom::FilePatcher: |
82 void PatchFileBsdiff(base::File input_file, | 83 void PatchFileBsdiff(base::File input_file, |
83 base::File patch_file, | 84 base::File patch_file, |
84 base::File output_file, | 85 base::File output_file, |
85 const PatchFileBsdiffCallback& callback) override { | 86 const PatchFileBsdiffCallback& callback) override { |
(...skipping 21 matching lines...) Expand all Loading... |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(FilePatcherImpl); | 109 DISALLOW_COPY_AND_ASSIGN(FilePatcherImpl); |
109 }; | 110 }; |
110 | 111 |
111 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
112 class ZipFileCreatorImpl : public chrome::mojom::ZipFileCreator { | 113 class ZipFileCreatorImpl : public chrome::mojom::ZipFileCreator { |
113 public: | 114 public: |
114 ZipFileCreatorImpl() = default; | 115 ZipFileCreatorImpl() = default; |
115 ~ZipFileCreatorImpl() override = default; | 116 ~ZipFileCreatorImpl() override = default; |
116 | 117 |
117 static void Create(chrome::mojom::ZipFileCreatorRequest request) { | 118 static void Create(const service_manager::BindSourceInfo& source_info, |
| 119 chrome::mojom::ZipFileCreatorRequest request) { |
118 mojo::MakeStrongBinding(base::MakeUnique<ZipFileCreatorImpl>(), | 120 mojo::MakeStrongBinding(base::MakeUnique<ZipFileCreatorImpl>(), |
119 std::move(request)); | 121 std::move(request)); |
120 } | 122 } |
121 | 123 |
122 private: | 124 private: |
123 // chrome::mojom::ZipFileCreator: | 125 // chrome::mojom::ZipFileCreator: |
124 void CreateZipFile(const base::FilePath& source_dir, | 126 void CreateZipFile(const base::FilePath& source_dir, |
125 const std::vector<base::FilePath>& source_relative_paths, | 127 const std::vector<base::FilePath>& source_relative_paths, |
126 base::File zip_file, | 128 base::File zip_file, |
127 const CreateZipFileCallback& callback) override { | 129 const CreateZipFileCallback& callback) override { |
(...skipping 13 matching lines...) Expand all Loading... |
141 DISALLOW_COPY_AND_ASSIGN(ZipFileCreatorImpl); | 143 DISALLOW_COPY_AND_ASSIGN(ZipFileCreatorImpl); |
142 }; | 144 }; |
143 #endif // defined(OS_CHROMEOS) | 145 #endif // defined(OS_CHROMEOS) |
144 | 146 |
145 #if defined(FULL_SAFE_BROWSING) | 147 #if defined(FULL_SAFE_BROWSING) |
146 class SafeArchiveAnalyzerImpl : public chrome::mojom::SafeArchiveAnalyzer { | 148 class SafeArchiveAnalyzerImpl : public chrome::mojom::SafeArchiveAnalyzer { |
147 public: | 149 public: |
148 SafeArchiveAnalyzerImpl() = default; | 150 SafeArchiveAnalyzerImpl() = default; |
149 ~SafeArchiveAnalyzerImpl() override = default; | 151 ~SafeArchiveAnalyzerImpl() override = default; |
150 | 152 |
151 static void Create(chrome::mojom::SafeArchiveAnalyzerRequest request) { | 153 static void Create(const service_manager::BindSourceInfo& source_info, |
| 154 chrome::mojom::SafeArchiveAnalyzerRequest request) { |
152 mojo::MakeStrongBinding(base::MakeUnique<SafeArchiveAnalyzerImpl>(), | 155 mojo::MakeStrongBinding(base::MakeUnique<SafeArchiveAnalyzerImpl>(), |
153 std::move(request)); | 156 std::move(request)); |
154 } | 157 } |
155 | 158 |
156 private: | 159 private: |
157 // chrome::mojom::SafeArchiveAnalyzer: | 160 // chrome::mojom::SafeArchiveAnalyzer: |
158 void AnalyzeZipFile(base::File zip_file, | 161 void AnalyzeZipFile(base::File zip_file, |
159 base::File temporary_file, | 162 base::File temporary_file, |
160 const AnalyzeZipFileCallback& callback) override { | 163 const AnalyzeZipFileCallback& callback) override { |
161 DCHECK(temporary_file.IsValid()); | 164 DCHECK(temporary_file.IsValid()); |
(...skipping 16 matching lines...) Expand all Loading... |
178 NOTREACHED(); | 181 NOTREACHED(); |
179 #endif | 182 #endif |
180 } | 183 } |
181 | 184 |
182 DISALLOW_COPY_AND_ASSIGN(SafeArchiveAnalyzerImpl); | 185 DISALLOW_COPY_AND_ASSIGN(SafeArchiveAnalyzerImpl); |
183 }; | 186 }; |
184 #endif // defined(FULL_SAFE_BROWSING) | 187 #endif // defined(FULL_SAFE_BROWSING) |
185 | 188 |
186 #if !defined(OS_ANDROID) | 189 #if !defined(OS_ANDROID) |
187 void CreateProxyResolverFactory( | 190 void CreateProxyResolverFactory( |
| 191 const service_manager::BindSourceInfo& source_info, |
188 net::interfaces::ProxyResolverFactoryRequest request) { | 192 net::interfaces::ProxyResolverFactoryRequest request) { |
189 mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(), | 193 mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(), |
190 std::move(request)); | 194 std::move(request)); |
191 } | 195 } |
192 | 196 |
193 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter { | 197 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter { |
194 public: | 198 public: |
195 ResourceUsageReporterImpl() {} | 199 ResourceUsageReporterImpl() {} |
196 ~ResourceUsageReporterImpl() override {} | 200 ~ResourceUsageReporterImpl() override {} |
197 | 201 |
198 private: | 202 private: |
199 void GetUsageData(const GetUsageDataCallback& callback) override { | 203 void GetUsageData(const GetUsageDataCallback& callback) override { |
200 chrome::mojom::ResourceUsageDataPtr data = | 204 chrome::mojom::ResourceUsageDataPtr data = |
201 chrome::mojom::ResourceUsageData::New(); | 205 chrome::mojom::ResourceUsageData::New(); |
202 size_t total_heap_size = net::ProxyResolverV8::GetTotalHeapSize(); | 206 size_t total_heap_size = net::ProxyResolverV8::GetTotalHeapSize(); |
203 if (total_heap_size) { | 207 if (total_heap_size) { |
204 data->reports_v8_stats = true; | 208 data->reports_v8_stats = true; |
205 data->v8_bytes_allocated = total_heap_size; | 209 data->v8_bytes_allocated = total_heap_size; |
206 data->v8_bytes_used = net::ProxyResolverV8::GetUsedHeapSize(); | 210 data->v8_bytes_used = net::ProxyResolverV8::GetUsedHeapSize(); |
207 } | 211 } |
208 callback.Run(std::move(data)); | 212 callback.Run(std::move(data)); |
209 } | 213 } |
210 | 214 |
211 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); | 215 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); |
212 }; | 216 }; |
213 | 217 |
214 void CreateResourceUsageReporter( | 218 void CreateResourceUsageReporter( |
215 mojo::InterfaceRequest<chrome::mojom::ResourceUsageReporter> request) { | 219 const service_manager::BindSourceInfo& source_info, |
| 220 chrome::mojom::ResourceUsageReporterRequest request) { |
216 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), | 221 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), |
217 std::move(request)); | 222 std::move(request)); |
218 } | 223 } |
219 #endif // !defined(OS_ANDROID) | 224 #endif // !defined(OS_ANDROID) |
220 | 225 |
221 } // namespace | 226 } // namespace |
222 | 227 |
223 ChromeContentUtilityClient::ChromeContentUtilityClient() | 228 ChromeContentUtilityClient::ChromeContentUtilityClient() |
224 : utility_process_running_elevated_(false) { | 229 : utility_process_running_elevated_(false) { |
225 #if BUILDFLAG(ENABLE_EXTENSIONS) | 230 #if BUILDFLAG(ENABLE_EXTENSIONS) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 319 |
315 return false; | 320 return false; |
316 } | 321 } |
317 | 322 |
318 // static | 323 // static |
319 void ChromeContentUtilityClient::PreSandboxStartup() { | 324 void ChromeContentUtilityClient::PreSandboxStartup() { |
320 #if BUILDFLAG(ENABLE_EXTENSIONS) | 325 #if BUILDFLAG(ENABLE_EXTENSIONS) |
321 extensions::ExtensionsHandler::PreSandboxStartup(); | 326 extensions::ExtensionsHandler::PreSandboxStartup(); |
322 #endif | 327 #endif |
323 } | 328 } |
OLD | NEW |