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

Unified Diff: mojo/public/cpp/bindings/lib/multiplex_router.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
Index: mojo/public/cpp/bindings/lib/multiplex_router.h
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h
index 0d5899870b829790dbdf356302f09dca4576f87c..fda26f2c7459682c8bb8edb959365884d77763a0 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.h
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.h
@@ -70,12 +70,27 @@ class MOJO_CPP_BINDINGS_EXPORT MultiplexRouter
MULTI_INTERFACE
};
+ // Specifies whether we are allowed to directly call into
+ // InterfaceEndpointClient (given that we are already on the same thread as
+ // the client).
+ enum ClientCallBehavior {
+ // Don't call any InterfaceEndpointClient methods directly.
+ NO_DIRECT_CLIENT_CALLS,
+ // Only call InterfaceEndpointClient::HandleIncomingMessage directly to
+ // handle sync messages.
+ ALLOW_DIRECT_CLIENT_CALLS_FOR_SYNC_MESSAGES,
+ // Allow to call any InterfaceEndpointClient methods directly.
+ ALLOW_DIRECT_CLIENT_CALLS
+ };
+
// If |set_interface_id_namespace_bit| is true, the interface IDs generated by
// this router will have the highest bit set.
MultiplexRouter(ScopedMessagePipeHandle message_pipe,
Config config,
bool set_interface_id_namespace_bit,
- scoped_refptr<base::SingleThreadTaskRunner> runner);
+ scoped_refptr<base::SingleThreadTaskRunner> runner,
+ ClientCallBehavior sync_client_call_behavior =
+ ALLOW_DIRECT_CLIENT_CALLS_FOR_SYNC_MESSAGES);
// Sets the master interface name for this router. Only used when reporting
// message header or control message validation errors.
@@ -163,19 +178,6 @@ class MOJO_CPP_BINDINGS_EXPORT MultiplexRouter
void OnPipeConnectionError();
- // Specifies whether we are allowed to directly call into
- // InterfaceEndpointClient (given that we are already on the same thread as
- // the client).
- enum ClientCallBehavior {
- // Don't call any InterfaceEndpointClient methods directly.
- NO_DIRECT_CLIENT_CALLS,
- // Only call InterfaceEndpointClient::HandleIncomingMessage directly to
- // handle sync messages.
- ALLOW_DIRECT_CLIENT_CALLS_FOR_SYNC_MESSAGES,
- // Allow to call any InterfaceEndpointClient methods directly.
- ALLOW_DIRECT_CLIENT_CALLS
- };
-
// Processes enqueued tasks (incoming messages and error notifications).
// |current_task_runner| is only used when |client_call_behavior| is
// ALLOW_DIRECT_CLIENT_CALLS to determine whether we are on the right task
@@ -260,6 +262,8 @@ class MOJO_CPP_BINDINGS_EXPORT MultiplexRouter
bool testing_mode_;
+ ClientCallBehavior sync_client_call_behavior_;
+
DISALLOW_COPY_AND_ASSIGN(MultiplexRouter);
};
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698