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

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

Issue 1781513002: Implement MojoGetBufferInformation(), part 2. (Closed) Base URL: https://github.com/domokit/mojo.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 | « mojo/edk/system/core.h ('k') | mojo/edk/system/core_test_base.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 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 if (new_handle == MOJO_HANDLE_INVALID) { 511 if (new_handle == MOJO_HANDLE_INVALID) {
512 LOG(ERROR) << "Handle table full"; 512 LOG(ERROR) << "Handle table full";
513 new_dispatcher->Close(); 513 new_dispatcher->Close();
514 return MOJO_RESULT_RESOURCE_EXHAUSTED; 514 return MOJO_RESULT_RESOURCE_EXHAUSTED;
515 } 515 }
516 516
517 new_buffer_handle.Put(new_handle); 517 new_buffer_handle.Put(new_handle);
518 return MOJO_RESULT_OK; 518 return MOJO_RESULT_OK;
519 } 519 }
520 520
521 MojoResult Core::GetBufferInformation(MojoHandle buffer_handle,
522 UserPointer<MojoBufferInformation> info,
523 uint32_t info_num_bytes) {
524 RefPtr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
525 if (!dispatcher)
526 return MOJO_RESULT_INVALID_ARGUMENT;
527
528 return dispatcher->GetBufferInformation(info, info_num_bytes);
529 }
530
521 MojoResult Core::MapBuffer(MojoHandle buffer_handle, 531 MojoResult Core::MapBuffer(MojoHandle buffer_handle,
522 uint64_t offset, 532 uint64_t offset,
523 uint64_t num_bytes, 533 uint64_t num_bytes,
524 UserPointer<void*> buffer, 534 UserPointer<void*> buffer,
525 MojoMapBufferFlags flags) { 535 MojoMapBufferFlags flags) {
526 RefPtr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); 536 RefPtr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
527 if (!dispatcher) 537 if (!dispatcher)
528 return MOJO_RESULT_INVALID_ARGUMENT; 538 return MOJO_RESULT_INVALID_ARGUMENT;
529 539
530 std::unique_ptr<PlatformSharedBufferMapping> mapping; 540 std::unique_ptr<PlatformSharedBufferMapping> mapping;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 if (signals_states) { 615 if (signals_states) {
606 for (; i < num_handles; i++) 616 for (; i < num_handles; i++)
607 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 617 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
608 } 618 }
609 619
610 return rv; 620 return rv;
611 } 621 }
612 622
613 } // namespace system 623 } // namespace system
614 } // namespace mojo 624 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/core_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698