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

Side by Side Diff: mojo/edk/system/core.cc

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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe_consumer_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/edk/system/core.h" 5 #include "mojo/edk/system/core.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // This is an unnecessarily large limit that is relatively easy to enforce. 44 // This is an unnecessarily large limit that is relatively easy to enforce.
45 const uint32_t kMaxHandlesPerMessage = 1024 * 1024; 45 const uint32_t kMaxHandlesPerMessage = 1024 * 1024;
46 46
47 // TODO: Maybe we could negotiate a debugging pipe ID for cross-process pipes 47 // TODO: Maybe we could negotiate a debugging pipe ID for cross-process pipes
48 // too; for now we just use a constant. This only affects bootstrap pipes. 48 // too; for now we just use a constant. This only affects bootstrap pipes.
49 const uint64_t kUnknownPipeIdForDebug = 0x7f7f7f7f7f7f7f7fUL; 49 const uint64_t kUnknownPipeIdForDebug = 0x7f7f7f7f7f7f7f7fUL;
50 50
51 void CallWatchCallback(MojoWatchCallback callback, 51 void CallWatchCallback(MojoWatchCallback callback,
52 uintptr_t context, 52 uintptr_t context,
53 MojoResult result, 53 MojoResult result,
54 const HandleSignalsState& signals_state) { 54 const HandleSignalsState& signals_state,
55 callback(context, result, 55 MojoWatchNotificationFlags flags) {
56 static_cast<MojoHandleSignalsState>(signals_state)); 56 callback(context, result, static_cast<MojoHandleSignalsState>(signals_state),
57 flags);
57 } 58 }
58 59
59 } // namespace 60 } // namespace
60 61
61 Core::Core() {} 62 Core::Core() {}
62 63
63 Core::~Core() { 64 Core::~Core() {
64 if (node_controller_ && node_controller_->io_task_runner()) { 65 if (node_controller_ && node_controller_->io_task_runner()) {
65 // If this races with IO thread shutdown the callback will be dropped and 66 // If this races with IO thread shutdown the callback will be dropped and
66 // the NodeController will be shutdown on this thread anyway, which is also 67 // the NodeController will be shutdown on this thread anyway, which is also
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 scoped_ptr<NodeController> node_controller) { 858 scoped_ptr<NodeController> node_controller) {
858 // It's OK to leak this reference. At this point we know the IO loop is still 859 // It's OK to leak this reference. At this point we know the IO loop is still
859 // running, and we know the NodeController will observe its eventual 860 // running, and we know the NodeController will observe its eventual
860 // destruction. This tells the NodeController to delete itself when that 861 // destruction. This tells the NodeController to delete itself when that
861 // happens. 862 // happens.
862 node_controller.release()->DestroyOnIOThreadShutdown(); 863 node_controller.release()->DestroyOnIOThreadShutdown();
863 } 864 }
864 865
865 } // namespace edk 866 } // namespace edk
866 } // namespace mojo 867 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe_consumer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698