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

Unified Diff: mojo/edk/system/request_context.h

Issue 1811433002: [mojo-edk] Expose notification source to MojoWatch callbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/edk/system/request_context.h
diff --git a/mojo/edk/system/request_context.h b/mojo/edk/system/request_context.h
index 56b849870e33ba07048d5f450e911880be51b045..394e455327499b56bb3ee0252dd7938a8ff6945a 100644
--- a/mojo/edk/system/request_context.h
+++ b/mojo/edk/system/request_context.h
@@ -8,6 +8,7 @@
#include "base/containers/stack_container.h"
#include "base/macros.h"
#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/system_impl_export.h"
#include "mojo/edk/system/watcher.h"
namespace base {
@@ -27,14 +28,25 @@ namespace edk {
// for any reason. Therefore it is important to always use
// |RequestContext::current()| rather than referring to any local instance
// directly.
-class RequestContext {
+class MOJO_SYSTEM_IMPL_EXPORT RequestContext {
public:
+ // Identifies the source of the current stack frame's RequestContext.
+ enum class Source {
+ LOCAL_API_CALL,
+ SYSTEM,
+ };
+
+ // Constructs a RequestContext with a LOCAL_API_CALL Source.
RequestContext();
+
+ explicit RequestContext(Source source);
~RequestContext();
// Returns the current thread-local RequestContext.
static RequestContext* current();
+ Source source() const { return source_; }
+
// Adds a finalizer to this RequestContext corresponding to a watch callback
// which should be triggered in response to some handle state change. If
// the Watcher hasn't been cancelled by the time this RequestContext is
@@ -74,6 +86,8 @@ class RequestContext {
using WatchCancelFinalizerList =
base::StackVector<scoped_refptr<Watcher>, kStaticWatchFinalizersCapacity>;
+ const Source source_;
+
WatchNotifyFinalizerList watch_notify_finalizers_;
WatchCancelFinalizerList watch_cancel_finalizers_;

Powered by Google App Engine
This is Rietveld 408576698