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

Unified Diff: extensions/browser/mojo/stash_backend.h

Issue 648853007: Add handle waiting to StashBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: extensions/browser/mojo/stash_backend.h
diff --git a/extensions/browser/mojo/stash_backend.h b/extensions/browser/mojo/stash_backend.h
index 2aff13494ddd2f511c243944fb965097812096d0..07d506d9718d7aec4fe7a46df6b68b965a4c9468 100644
--- a/extensions/browser/mojo/stash_backend.h
+++ b/extensions/browser/mojo/stash_backend.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/callback.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
#include "extensions/common/mojo/stash.mojom.h"
@@ -17,7 +18,7 @@ namespace extensions {
// A backend that provides access to StashService for a single extension.
class StashBackend {
public:
- StashBackend();
+ explicit StashBackend(const base::Closure& on_handle_readable);
~StashBackend();
// Creates a StashService that forwards calls to this StashBackend and bind it
@@ -32,8 +33,19 @@ class StashBackend {
mojo::Array<StashedObjectPtr> RetrieveStash();
private:
+ class StashEntry;
+
+ // Invoked when a handle is readable.
+ void OnHandleReady();
+
// The objects that have been stashed.
- mojo::Array<StashedObjectPtr> stashed_objects_;
+ std::vector<linked_ptr<StashEntry>> stashed_objects_;
+
+ // The callback to call when a handle is readable.
+ const base::Closure on_handle_readable_;
+
+ // Whether a handle has become readable since the last RetrieveStash() call.
+ bool has_notified_;
base::WeakPtrFactory<StashBackend> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698