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..558d163748948ca1d2a91d4b713d5ffdde145e89 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,22 @@ 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: |
- RequestContext(); |
+ // Identifies the source of the current stack frame's RequestContext. |
+ enum class Source { |
+ LOCAL_API_CALL, |
+ EXTERNAL_PROCESS, |
+ }; |
+ |
+ explicit RequestContext(Source source); |
Anand Mistry (off Chromium)
2016/03/16 23:04:14
If local is the default and "external process" is
Ken Rockot(use gerrit already)
2016/03/17 00:15:34
Done
|
~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 |
@@ -48,6 +57,7 @@ class RequestContext { |
void AddWatchCancelFinalizer(scoped_refptr<Watcher> watcher); |
private: |
+ // |
Anand Mistry (off Chromium)
2016/03/16 23:04:14
nit: blank comment line.
Ken Rockot(use gerrit already)
2016/03/17 00:15:34
done
|
// Is this request context the current one? |
bool IsCurrent() const; |
@@ -74,6 +84,12 @@ class RequestContext { |
using WatchCancelFinalizerList = |
base::StackVector<scoped_refptr<Watcher>, kStaticWatchFinalizersCapacity>; |
+ Source source_; |
+ |
+ // A nested RequestContext may override the Source of the thread-local |
+ // RequestContext for the duration of the nested context's lifetime. |
+ Source outer_source_; |
+ |
WatchNotifyFinalizerList watch_notify_finalizers_; |
WatchCancelFinalizerList watch_cancel_finalizers_; |