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

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
« no previous file with comments | « extensions/BUILD.gn ('k') | extensions/browser/mojo/stash_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..abd0e269fc69b87289847368d758f1d4e4a0a007 100644
--- a/extensions/browser/mojo/stash_backend.h
+++ b/extensions/browser/mojo/stash_backend.h
@@ -5,9 +5,8 @@
#ifndef EXTENSIONS_BROWSER_MOJO_STASH_BACKEND_H_
#define EXTENSIONS_BROWSER_MOJO_STASH_BACKEND_H_
-#include <vector>
-
-#include "base/memory/linked_ptr.h"
+#include "base/callback.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "extensions/common/mojo/stash.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
@@ -17,7 +16,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 +31,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_;
+ ScopedVector<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_;
« no previous file with comments | « extensions/BUILD.gn ('k') | extensions/browser/mojo/stash_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698