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

Unified Diff: gin/modules/file_module_provider.h

Issue 401723002: Mojo: Log an error when we fail to find a JS module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | gin/modules/file_module_provider.cc » ('j') | gin/modules/file_module_provider.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/modules/file_module_provider.h
diff --git a/gin/modules/file_module_provider.h b/gin/modules/file_module_provider.h
index dd75a0feaf1ef2d7e0031533c15ae3e7cd0928a1..f3110dbe6cdb9c5e3905594d1cf7dea9b52c90e1 100644
--- a/gin/modules/file_module_provider.h
+++ b/gin/modules/file_module_provider.h
@@ -9,7 +9,9 @@
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/files/file_path.h"
+#include "base/memory/weak_ptr.h"
#include "gin/gin_export.h"
#include "gin/runner.h"
@@ -27,15 +29,33 @@ class GIN_EXPORT FileModuleProvider {
// Searches for modules with |ids| in the file system. If found, the modules
// will be executed asynchronously by |runner|.
- void AttempToLoadModules(Runner* runner, const std::set<std::string>& ids);
+ void AttemptToLoadModules(Runner* runner, const std::set<std::string>& ids);
+
+ void set_completion_callback(
+ base::Callback<void(const std::set<std::string>&)> callback) {
+ completion_callback_ = callback;
+ }
+ void reset_completion_callback() {
+ completion_callback_.Reset();
+ }
private:
+ void OnReadCompleted(const std::string& id, bool success);
+
+ base::WeakPtrFactory<FileModuleProvider> weak_factory_;
+
std::vector<base::FilePath> search_paths_;
// We'll only search for a given module once. We remember the set of modules
// we've already looked for in |attempted_ids_|.
std::set<std::string> attempted_ids_;
+ // The set of modules that have succeeded or failed to load.
+ std::set<std::string> successful_ids_;
+ std::set<std::string> failed_ids_;
+
+ base::Callback<void(const std::set<std::string>&)> completion_callback_;
+
DISALLOW_COPY_AND_ASSIGN(FileModuleProvider);
};
« no previous file with comments | « no previous file | gin/modules/file_module_provider.cc » ('j') | gin/modules/file_module_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698