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

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

Issue 2611843004: Implement throttling behavior for LocalStorage mojo messages.
Patch Set: Created 3 years, 11 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/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/interface_ptr_state.h
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
index f4c63d2f022291ec748b1602c0a07fc46354c9bb..bb9113ba3c56fa3b22e94672aea8e4abfb75cdad 100644
--- a/mojo/public/cpp/bindings/lib/interface_ptr_state.h
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
@@ -149,6 +149,10 @@ class InterfacePtrState {
return endpoint_client_ && endpoint_client_->has_pending_responders();
}
+ size_t pending_callback_count() const {
+ return endpoint_client_ ? endpoint_client_->pending_responder_count() : 0;
+ }
+
AssociatedGroup* associated_group() {
ConfigureProxyIfNecessary();
return endpoint_client_->associated_group();
@@ -170,6 +174,11 @@ class InterfacePtrState {
endpoint_client_->AcceptWithResponder(&message, responder.release());
}
+ void set_process_async_during_sync(bool value) {
+ DCHECK(!router_);
+ process_async_during_sync_ = value;
+ }
+
private:
using Proxy = typename Interface::Proxy_;
@@ -190,7 +199,11 @@ class InterfacePtrState {
: (Interface::HasSyncMethods_
? MultiplexRouter::SINGLE_INTERFACE_WITH_SYNC_METHODS
: MultiplexRouter::SINGLE_INTERFACE);
- router_ = new MultiplexRouter(std::move(handle_), config, true, runner_);
+ router_ = new MultiplexRouter(
+ std::move(handle_), config, true, runner_,
+ process_async_during_sync_
+ ? MultiplexRouter::ALLOW_DIRECT_CLIENT_CALLS
+ : MultiplexRouter::ALLOW_DIRECT_CLIENT_CALLS_FOR_SYNC_MESSAGES);
router_->SetMasterInterfaceName(Interface::Name_);
endpoint_client_.reset(new InterfaceEndpointClient(
router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr,
@@ -223,6 +236,8 @@ class InterfacePtrState {
uint32_t version_;
+ bool process_async_during_sync_ = false;
+
DISALLOW_COPY_AND_ASSIGN(InterfacePtrState);
};
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698