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

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

Issue 2596373002: [mojo] Fix some lint errors (Closed)
Patch Set: Created 3 years, 12 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 | « mojo/edk/system/core.h ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.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 27 matching lines...) Expand all
38 #include "mojo/edk/system/waiter.h" 38 #include "mojo/edk/system/waiter.h"
39 39
40 namespace mojo { 40 namespace mojo {
41 namespace edk { 41 namespace edk {
42 42
43 namespace { 43 namespace {
44 44
45 // This is an unnecessarily large limit that is relatively easy to enforce. 45 // This is an unnecessarily large limit that is relatively easy to enforce.
46 const uint32_t kMaxHandlesPerMessage = 1024 * 1024; 46 const uint32_t kMaxHandlesPerMessage = 1024 * 1024;
47 47
48 // TODO: Maybe we could negotiate a debugging pipe ID for cross-process pipes 48 // TODO(rockot): Maybe we could negotiate a debugging pipe ID for cross-process
49 // too; for now we just use a constant. This only affects bootstrap pipes. 49 // pipes too; for now we just use a constant. This only affects bootstrap pipes.
50 const uint64_t kUnknownPipeIdForDebug = 0x7f7f7f7f7f7f7f7fUL; 50 const uint64_t kUnknownPipeIdForDebug = 0x7f7f7f7f7f7f7f7fUL;
51 51
52 void CallWatchCallback(MojoWatchCallback callback, 52 void CallWatchCallback(MojoWatchCallback callback,
53 uintptr_t context, 53 uintptr_t context,
54 MojoResult result, 54 MojoResult result,
55 const HandleSignalsState& signals_state, 55 const HandleSignalsState& signals_state,
56 MojoWatchNotificationFlags flags) { 56 MojoWatchNotificationFlags flags) {
57 callback(context, result, static_cast<MojoHandleSignalsState>(signals_state), 57 callback(context, result, static_cast<MojoHandleSignalsState>(signals_state),
58 flags); 58 flags);
59 } 59 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 MojoHandle* data_pipe_producer_handle, 808 MojoHandle* data_pipe_producer_handle,
809 MojoHandle* data_pipe_consumer_handle) { 809 MojoHandle* data_pipe_consumer_handle) {
810 RequestContext request_context; 810 RequestContext request_context;
811 if (options && options->struct_size != sizeof(MojoCreateDataPipeOptions)) 811 if (options && options->struct_size != sizeof(MojoCreateDataPipeOptions))
812 return MOJO_RESULT_INVALID_ARGUMENT; 812 return MOJO_RESULT_INVALID_ARGUMENT;
813 813
814 MojoCreateDataPipeOptions create_options; 814 MojoCreateDataPipeOptions create_options;
815 create_options.struct_size = sizeof(MojoCreateDataPipeOptions); 815 create_options.struct_size = sizeof(MojoCreateDataPipeOptions);
816 create_options.flags = options ? options->flags : 0; 816 create_options.flags = options ? options->flags : 0;
817 create_options.element_num_bytes = options ? options->element_num_bytes : 1; 817 create_options.element_num_bytes = options ? options->element_num_bytes : 1;
818 // TODO: Use Configuration to get default data pipe capacity. 818 // TODO(rockot): Use Configuration to get default data pipe capacity.
819 create_options.capacity_num_bytes = 819 create_options.capacity_num_bytes =
820 options && options->capacity_num_bytes ? options->capacity_num_bytes 820 options && options->capacity_num_bytes ? options->capacity_num_bytes
821 : 64 * 1024; 821 : 64 * 1024;
822 822
823 // TODO: Broker through the parent when necessary. 823 // TODO(rockot): Broker through the parent when necessary.
824 scoped_refptr<PlatformSharedBuffer> ring_buffer = 824 scoped_refptr<PlatformSharedBuffer> ring_buffer =
825 GetNodeController()->CreateSharedBuffer( 825 GetNodeController()->CreateSharedBuffer(
826 create_options.capacity_num_bytes); 826 create_options.capacity_num_bytes);
827 if (!ring_buffer) 827 if (!ring_buffer)
828 return MOJO_RESULT_RESOURCE_EXHAUSTED; 828 return MOJO_RESULT_RESOURCE_EXHAUSTED;
829 829
830 ports::PortRef port0, port1; 830 ports::PortRef port0, port1;
831 GetNodeController()->node()->CreatePortPair(&port0, &port1); 831 GetNodeController()->node()->CreatePortPair(&port0, &port1);
832 832
833 CHECK(data_pipe_producer_handle); 833 CHECK(data_pipe_producer_handle);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1119
1120 void Core::GetActiveHandlesForTest(std::vector<MojoHandle>* handles) { 1120 void Core::GetActiveHandlesForTest(std::vector<MojoHandle>* handles) {
1121 base::AutoLock lock(handles_lock_); 1121 base::AutoLock lock(handles_lock_);
1122 handles_.GetActiveHandlesForTest(handles); 1122 handles_.GetActiveHandlesForTest(handles);
1123 } 1123 }
1124 1124
1125 MojoResult Core::WaitManyInternal(const MojoHandle* handles, 1125 MojoResult Core::WaitManyInternal(const MojoHandle* handles,
1126 const MojoHandleSignals* signals, 1126 const MojoHandleSignals* signals,
1127 uint32_t num_handles, 1127 uint32_t num_handles,
1128 MojoDeadline deadline, 1128 MojoDeadline deadline,
1129 uint32_t *result_index, 1129 uint32_t* result_index,
1130 HandleSignalsState* signals_states) { 1130 HandleSignalsState* signals_states) {
1131 CHECK(handles); 1131 CHECK(handles);
1132 CHECK(signals); 1132 CHECK(signals);
1133 DCHECK_GT(num_handles, 0u); 1133 DCHECK_GT(num_handles, 0u);
1134 if (result_index) { 1134 if (result_index) {
1135 DCHECK_EQ(*result_index, static_cast<uint32_t>(-1)); 1135 DCHECK_EQ(*result_index, static_cast<uint32_t>(-1));
1136 } 1136 }
1137 1137
1138 // The primary caller of |WaitManyInternal()| is |Wait()|, which only waits on 1138 // The primary caller of |WaitManyInternal()| is |Wait()|, which only waits on
1139 // a single handle. In the common case of a single handle, this avoid a heap 1139 // a single handle. In the common case of a single handle, this avoid a heap
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 std::unique_ptr<NodeController> node_controller) { 1195 std::unique_ptr<NodeController> node_controller) {
1196 // It's OK to leak this reference. At this point we know the IO loop is still 1196 // It's OK to leak this reference. At this point we know the IO loop is still
1197 // running, and we know the NodeController will observe its eventual 1197 // running, and we know the NodeController will observe its eventual
1198 // destruction. This tells the NodeController to delete itself when that 1198 // destruction. This tells the NodeController to delete itself when that
1199 // happens. 1199 // happens.
1200 node_controller.release()->DestroyOnIOThreadShutdown(); 1200 node_controller.release()->DestroyOnIOThreadShutdown();
1201 } 1201 }
1202 1202
1203 } // namespace edk 1203 } // namespace edk
1204 } // namespace mojo 1204 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698