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

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

Issue 1776033002: Implement MojoGetBufferInformation(), part 1. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh 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 | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/dispatcher_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/dispatcher.h" 5 #include "mojo/edk/system/dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/system/configuration.h" 8 #include "mojo/edk/system/configuration.h"
9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 MojoResult Dispatcher::DuplicateBufferHandle( 199 MojoResult Dispatcher::DuplicateBufferHandle(
200 UserPointer<const MojoDuplicateBufferHandleOptions> options, 200 UserPointer<const MojoDuplicateBufferHandleOptions> options,
201 RefPtr<Dispatcher>* new_dispatcher) { 201 RefPtr<Dispatcher>* new_dispatcher) {
202 MutexLocker locker(&mutex_); 202 MutexLocker locker(&mutex_);
203 if (is_closed_) 203 if (is_closed_)
204 return MOJO_RESULT_INVALID_ARGUMENT; 204 return MOJO_RESULT_INVALID_ARGUMENT;
205 205
206 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); 206 return DuplicateBufferHandleImplNoLock(options, new_dispatcher);
207 } 207 }
208 208
209 MojoResult Dispatcher::GetBufferInformation(
210 UserPointer<MojoBufferInformation> info,
211 uint32_t info_num_bytes) {
212 MutexLocker locker(&mutex_);
213 if (is_closed_)
214 return MOJO_RESULT_INVALID_ARGUMENT;
215
216 return GetBufferInformationImplNoLock(info, info_num_bytes);
217 }
218
209 MojoResult Dispatcher::MapBuffer( 219 MojoResult Dispatcher::MapBuffer(
210 uint64_t offset, 220 uint64_t offset,
211 uint64_t num_bytes, 221 uint64_t num_bytes,
212 MojoMapBufferFlags flags, 222 MojoMapBufferFlags flags,
213 std::unique_ptr<PlatformSharedBufferMapping>* mapping) { 223 std::unique_ptr<PlatformSharedBufferMapping>* mapping) {
214 MutexLocker locker(&mutex_); 224 MutexLocker locker(&mutex_);
215 if (is_closed_) 225 if (is_closed_)
216 return MOJO_RESULT_INVALID_ARGUMENT; 226 return MOJO_RESULT_INVALID_ARGUMENT;
217 227
218 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); 228 return MapBufferImplNoLock(offset, num_bytes, flags, mapping);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 361
352 MojoResult Dispatcher::DuplicateBufferHandleImplNoLock( 362 MojoResult Dispatcher::DuplicateBufferHandleImplNoLock(
353 UserPointer<const MojoDuplicateBufferHandleOptions> /*options*/, 363 UserPointer<const MojoDuplicateBufferHandleOptions> /*options*/,
354 RefPtr<Dispatcher>* /*new_dispatcher*/) { 364 RefPtr<Dispatcher>* /*new_dispatcher*/) {
355 mutex_.AssertHeld(); 365 mutex_.AssertHeld();
356 DCHECK(!is_closed_); 366 DCHECK(!is_closed_);
357 // By default, not supported. Only needed for buffer dispatchers. 367 // By default, not supported. Only needed for buffer dispatchers.
358 return MOJO_RESULT_INVALID_ARGUMENT; 368 return MOJO_RESULT_INVALID_ARGUMENT;
359 } 369 }
360 370
371 MojoResult Dispatcher::GetBufferInformationImplNoLock(
372 UserPointer<MojoBufferInformation> /*info*/,
373 uint32_t /*info_num_bytes*/) {
374 mutex_.AssertHeld();
375 DCHECK(!is_closed_);
376 // By default, not supported. Only needed for buffer dispatchers.
377 return MOJO_RESULT_INVALID_ARGUMENT;
378 }
379
361 MojoResult Dispatcher::MapBufferImplNoLock( 380 MojoResult Dispatcher::MapBufferImplNoLock(
362 uint64_t /*offset*/, 381 uint64_t /*offset*/,
363 uint64_t /*num_bytes*/, 382 uint64_t /*num_bytes*/,
364 MojoMapBufferFlags /*flags*/, 383 MojoMapBufferFlags /*flags*/,
365 std::unique_ptr<PlatformSharedBufferMapping>* /*mapping*/) { 384 std::unique_ptr<PlatformSharedBufferMapping>* /*mapping*/) {
366 mutex_.AssertHeld(); 385 mutex_.AssertHeld();
367 DCHECK(!is_closed_); 386 DCHECK(!is_closed_);
368 // By default, not supported. Only needed for buffer dispatchers. 387 // By default, not supported. Only needed for buffer dispatchers.
369 return MOJO_RESULT_INVALID_ARGUMENT; 388 return MOJO_RESULT_INVALID_ARGUMENT;
370 } 389 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // DispatcherTransport --------------------------------------------------------- 507 // DispatcherTransport ---------------------------------------------------------
489 508
490 void DispatcherTransport::End() { 509 void DispatcherTransport::End() {
491 DCHECK(dispatcher_); 510 DCHECK(dispatcher_);
492 dispatcher_->mutex_.Unlock(); 511 dispatcher_->mutex_.Unlock();
493 dispatcher_ = nullptr; 512 dispatcher_ = nullptr;
494 } 513 }
495 514
496 } // namespace system 515 } // namespace system
497 } // namespace mojo 516 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698