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 #include "shell/dynamic_application_loader.h" | 5 #include "shell/dynamic_application_loader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 static void RecordCacheToURLMapping(const base::FilePath& path, | 292 static void RecordCacheToURLMapping(const base::FilePath& path, |
293 const GURL& url) { | 293 const GURL& url) { |
294 // This is used to extract symbols on android. | 294 // This is used to extract symbols on android. |
295 // TODO(eseidel): All users of this log should move to using the map file. | 295 // TODO(eseidel): All users of this log should move to using the map file. |
296 LOG(INFO) << "Caching mojo app " << url << " at " << path.value(); | 296 LOG(INFO) << "Caching mojo app " << url << " at " << path.value(); |
297 | 297 |
298 base::FilePath temp_dir; | 298 base::FilePath temp_dir; |
299 base::GetTempDir(&temp_dir); | 299 base::GetTempDir(&temp_dir); |
300 base::ProcessId pid = base::Process::Current().pid(); | 300 base::ProcessId pid = base::Process::Current().Pid(); |
301 std::string map_name = base::StringPrintf("mojo_shell.%d.maps", pid); | 301 std::string map_name = base::StringPrintf("mojo_shell.%d.maps", pid); |
302 base::FilePath map_path = temp_dir.Append(map_name); | 302 base::FilePath map_path = temp_dir.Append(map_name); |
303 | 303 |
304 // TODO(eseidel): Paths or URLs with spaces will need quoting. | 304 // TODO(eseidel): Paths or URLs with spaces will need quoting. |
305 std::string map_entry = | 305 std::string map_entry = |
306 base::StringPrintf("%s %s\n", path.value().c_str(), url.spec().c_str()); | 306 base::StringPrintf("%s %s\n", path.value().c_str(), url.spec().c_str()); |
307 // TODO(eseidel): AppendToFile is missing O_CREAT, crbug.com/450696 | 307 // TODO(eseidel): AppendToFile is missing O_CREAT, crbug.com/450696 |
308 if (!PathExists(map_path)) | 308 if (!PathExists(map_path)) |
309 base::WriteFile(map_path, map_entry.data(), map_entry.length()); | 309 base::WriteFile(map_path, map_entry.data(), map_entry.length()); |
310 else | 310 else |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // TODO(darin): What should we do about service errors? This implies that | 494 // TODO(darin): What should we do about service errors? This implies that |
495 // the app closed its handle to the service manager. Maybe we don't care? | 495 // the app closed its handle to the service manager. Maybe we don't care? |
496 } | 496 } |
497 | 497 |
498 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 498 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
499 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 499 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
500 } | 500 } |
501 | 501 |
502 } // namespace shell | 502 } // namespace shell |
503 } // namespace mojo | 503 } // namespace mojo |
OLD | NEW |