Chromium Code Reviews| Index: mojo/edk/system/request_context.cc |
| diff --git a/mojo/edk/system/request_context.cc b/mojo/edk/system/request_context.cc |
| index c30d8bb821c501af2d424baac908ef6130b742d4..731f44248294f0f915c71520154914c8e99a3cb5 100644 |
| --- a/mojo/edk/system/request_context.cc |
| +++ b/mojo/edk/system/request_context.cc |
| @@ -18,7 +18,10 @@ base::LazyInstance<base::ThreadLocalPointer<RequestContext>>::Leaky |
| } // namespace |
| -RequestContext::RequestContext() : tls_context_(g_current_context.Pointer()){ |
| +RequestContext::RequestContext() : RequestContext(Source::LOCAL_API_CALL) {} |
| + |
| +RequestContext::RequestContext(Source source) |
| + : source_(source), tls_context_(g_current_context.Pointer()) { |
| // We allow nested RequestContexts to exist as long as they aren't actually |
| // used for anything. |
| if (!tls_context_->Get()) |
| @@ -29,15 +32,20 @@ RequestContext::~RequestContext() { |
| // NOTE: Callbacks invoked by this destructor are allowed to initiate new |
| // EDK requests on this thread, so we need to reset the thread-local context |
| // pointer before calling them. |
| + RequestContext::Source notification_source = tls_context_->Get()->source(); |
|
Anand Mistry (off Chromium)
2016/03/17 01:53:09
I don't think this is what we want. Consider a sta
Ken Rockot(use gerrit already)
2016/03/17 01:56:36
That was the intent. I thought that's what you wer
Ken Rockot(use gerrit already)
2016/03/17 15:44:29
I've updated the destructor.
Do you agree that al
|
| if (IsCurrent()) |
| tls_context_->Set(nullptr); |
| + MojoWatchNotificationFlags flags = MOJO_WATCH_NOTIFICATION_FLAG_NONE; |
| + if (notification_source == Source::SYSTEM) |
| + flags |= MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM; |
| + |
| for (const WatchNotifyFinalizer& watch : |
| watch_notify_finalizers_.container()) { |
| // Establish a new request context for the extent of each callback to ensure |
| // that they don't themselves invoke callbacks while holding a watcher lock. |
| - RequestContext request_context; |
| - watch.watcher->MaybeInvokeCallback(watch.result, watch.state); |
| + RequestContext request_context(notification_source); |
| + watch.watcher->MaybeInvokeCallback(watch.result, watch.state, flags); |
| } |
| for (const scoped_refptr<Watcher>& watcher : |