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

Unified Diff: sky/shell/dart/dart_library_provider_files.cc

Issue 1215953006: Use sky_shell instead of mojo_shell for testing. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Foo Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/services/ns_net/url_loader_impl.h ('k') | sky/shell/linux/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/dart/dart_library_provider_files.cc
diff --git a/sky/shell/dart/dart_library_provider_files.cc b/sky/shell/dart/dart_library_provider_files.cc
index 04a6284f17557d2a7e73aa1c79f2b5b17f675851..d33b05341e68280c4b13a2344c2cf3a9ad661415 100644
--- a/sky/shell/dart/dart_library_provider_files.cc
+++ b/sky/shell/dart/dart_library_provider_files.cc
@@ -5,6 +5,7 @@
#include "sky/shell/dart/dart_library_provider_files.h"
#include "base/bind.h"
+#include "base/files/file_util.h"
#include "base/strings/string_util.h"
#include "base/threading/worker_pool.h"
#include "mojo/common/data_pipe_utils.h"
@@ -14,14 +15,18 @@ namespace sky {
namespace shell {
namespace {
-void Ignored(bool) {
+void CopyComplete(base::FilePath file, bool success) {
+ if (!success)
+ LOG(ERROR) << "Failed to load " << file.AsUTF8Unsafe();
}
base::FilePath SimplifyPath(const base::FilePath& path) {
std::vector<base::FilePath::StringType> components;
path.GetComponents(&components);
- base::FilePath result;
- for (const auto& component : components) {
+ auto it = components.begin();
+ base::FilePath result(*it++);
+ for (;it != components.end(); it++) {
abarth-chromium 2015/07/07 00:36:49 s/;it/; it/
+ auto& component = *it;
if (component == base::FilePath::kCurrentDirectory)
continue;
if (component == base::FilePath::kParentDirectory)
@@ -37,6 +42,8 @@ base::FilePath SimplifyPath(const base::FilePath& path) {
DartLibraryProviderFiles::DartLibraryProviderFiles(
const base::FilePath& package_root)
: package_root_(package_root) {
+ CHECK(base::DirectoryExists(package_root_)) << "Invalid --package-root "
+ << "\"" << package_root_.LossyDisplayName() << "\"";
}
DartLibraryProviderFiles::~DartLibraryProviderFiles() {
@@ -52,7 +59,7 @@ void DartLibraryProviderFiles::GetLibraryAsStream(
scoped_refptr<base::TaskRunner> runner =
base::WorkerPool::GetTaskRunner(true);
mojo::common::CopyFromFile(source, pipe.producer_handle.Pass(), 0,
- runner.get(), base::Bind(&Ignored));
+ runner.get(), base::Bind(&CopyComplete, source));
}
std::string DartLibraryProviderFiles::CanonicalizePackageURL(std::string url) {
« no previous file with comments | « sky/services/ns_net/url_loader_impl.h ('k') | sky/shell/linux/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698