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

Side by Side Diff: mojo/system/handle_table.cc

Issue 262093003: Mojo: Add/use |typedef std::vector<scoped_refptr<Dispatcher> > DispatcherVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « mojo/system/handle_table.h ('k') | mojo/system/local_message_pipe_endpoint.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system/handle_table.h" 5 #include "mojo/system/handle_table.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/system/constants.h" 9 #include "mojo/system/constants.h"
10 #include "mojo/system/dispatcher.h" 10 #include "mojo/system/dispatcher.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 std::pair<MojoHandle, MojoHandle> HandleTable::AddDispatcherPair( 70 std::pair<MojoHandle, MojoHandle> HandleTable::AddDispatcherPair(
71 const scoped_refptr<Dispatcher>& dispatcher0, 71 const scoped_refptr<Dispatcher>& dispatcher0,
72 const scoped_refptr<Dispatcher>& dispatcher1) { 72 const scoped_refptr<Dispatcher>& dispatcher1) {
73 if (handle_to_entry_map_.size() + 1 >= kMaxHandleTableSize) 73 if (handle_to_entry_map_.size() + 1 >= kMaxHandleTableSize)
74 return std::make_pair(MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID); 74 return std::make_pair(MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID);
75 return std::make_pair(AddDispatcherNoSizeCheck(dispatcher0), 75 return std::make_pair(AddDispatcherNoSizeCheck(dispatcher0),
76 AddDispatcherNoSizeCheck(dispatcher1)); 76 AddDispatcherNoSizeCheck(dispatcher1));
77 } 77 }
78 78
79 bool HandleTable::AddDispatcherVector( 79 bool HandleTable::AddDispatcherVector(const DispatcherVector& dispatchers,
80 const std::vector<scoped_refptr<Dispatcher> >& dispatchers, 80 MojoHandle* handles) {
81 MojoHandle* handles) {
82 DCHECK_LE(dispatchers.size(), kMaxMessageNumHandles); 81 DCHECK_LE(dispatchers.size(), kMaxMessageNumHandles);
83 DCHECK(handles); 82 DCHECK(handles);
84 // TODO(vtl): |std::numeric_limits<size_t>::max()| isn't a compile-time 83 // TODO(vtl): |std::numeric_limits<size_t>::max()| isn't a compile-time
85 // expression in C++03. 84 // expression in C++03.
86 COMPILE_ASSERT( 85 COMPILE_ASSERT(
87 static_cast<uint64_t>(kMaxHandleTableSize) + kMaxMessageNumHandles < 86 static_cast<uint64_t>(kMaxHandleTableSize) + kMaxMessageNumHandles <
88 (sizeof(size_t) == 8 ? kuint64max : 87 (sizeof(size_t) == 8 ? kuint64max :
89 static_cast<uint64_t>(kuint32max)), 88 static_cast<uint64_t>(kuint32max)),
90 addition_may_overflow); 89 addition_may_overflow);
91 90
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 for (uint32_t i = 0; i < num_handles; i++) { 227 for (uint32_t i = 0; i < num_handles; i++) {
229 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]); 228 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]);
230 DCHECK(it != handle_to_entry_map_.end()); 229 DCHECK(it != handle_to_entry_map_.end());
231 DCHECK(it->second.busy); 230 DCHECK(it->second.busy);
232 it->second.busy = false; 231 it->second.busy = false;
233 } 232 }
234 } 233 }
235 234
236 } // namespace system 235 } // namespace system
237 } // namespace mojo 236 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/handle_table.h ('k') | mojo/system/local_message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698