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

Unified Diff: mojo/public/cpp/bindings/lib/router.h

Issue 1701423002: Mojo C++ bindings: support sync methods - part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « mojo/public/cpp/bindings/lib/message_internal.h ('k') | mojo/public/cpp/bindings/lib/router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/router.h
diff --git a/mojo/public/cpp/bindings/lib/router.h b/mojo/public/cpp/bindings/lib/router.h
index 11912021a72c9377f1be65c39790d236feb0714c..f7ce51315f8ef9e265cc8f6e10083da9271e0253 100644
--- a/mojo/public/cpp/bindings/lib/router.h
+++ b/mojo/public/cpp/bindings/lib/router.h
@@ -10,11 +10,11 @@
#include <map>
#include "base/logging.h"
+#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/callback.h"
#include "mojo/public/cpp/bindings/lib/connector.h"
#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/shared_data.h"
#include "mojo/public/cpp/environment/environment.h"
namespace mojo {
@@ -104,10 +104,12 @@ class Router : public MessageReceiverWithResponder {
// Returns true if this Router has any pending callbacks.
bool has_pending_responders() const {
DCHECK(thread_checker_.CalledOnValidThread());
- return !responders_.empty();
+ return !async_responders_.empty() || !sync_responders_.empty();
}
private:
+ // Maps from the id of a response to the MessageReceiver that handles the
+ // response.
typedef std::map<uint64_t, MessageReceiver*> ResponderMap;
class HandleIncomingMessageThunk : public MessageReceiver {
@@ -127,14 +129,13 @@ class Router : public MessageReceiverWithResponder {
HandleIncomingMessageThunk thunk_;
FilterChain filters_;
Connector connector_;
- SharedData<Router*> weak_self_;
MessageReceiverWithResponderStatus* incoming_receiver_;
- // Maps from the id of a response to the MessageReceiver that handles the
- // response.
- ResponderMap responders_;
+ ResponderMap async_responders_;
+ ResponderMap sync_responders_;
uint64_t next_request_id_;
bool testing_mode_;
base::ThreadChecker thread_checker_;
+ base::WeakPtrFactory<Router> weak_factory_;
};
} // namespace internal
« no previous file with comments | « mojo/public/cpp/bindings/lib/message_internal.h ('k') | mojo/public/cpp/bindings/lib/router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698