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

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

Issue 1350183002: EDK: More scoped_ptr -> std::unique_ptr conversions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: gah Created 5 years, 3 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
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 <vector> 9 #include <vector>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "mojo/edk/embedder/platform_shared_buffer.h" 12 #include "mojo/edk/embedder/platform_shared_buffer.h"
12 #include "mojo/edk/embedder/platform_support.h" 13 #include "mojo/edk/embedder/platform_support.h"
13 #include "mojo/edk/system/async_waiter.h" 14 #include "mojo/edk/system/async_waiter.h"
14 #include "mojo/edk/system/configuration.h" 15 #include "mojo/edk/system/configuration.h"
15 #include "mojo/edk/system/data_pipe.h" 16 #include "mojo/edk/system/data_pipe.h"
16 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 17 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
17 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 18 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 524
524 MojoResult Core::MapBuffer(MojoHandle buffer_handle, 525 MojoResult Core::MapBuffer(MojoHandle buffer_handle,
525 uint64_t offset, 526 uint64_t offset,
526 uint64_t num_bytes, 527 uint64_t num_bytes,
527 UserPointer<void*> buffer, 528 UserPointer<void*> buffer,
528 MojoMapBufferFlags flags) { 529 MojoMapBufferFlags flags) {
529 scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); 530 scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
530 if (!dispatcher) 531 if (!dispatcher)
531 return MOJO_RESULT_INVALID_ARGUMENT; 532 return MOJO_RESULT_INVALID_ARGUMENT;
532 533
533 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping; 534 std::unique_ptr<embedder::PlatformSharedBufferMapping> mapping;
534 MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping); 535 MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping);
535 if (result != MOJO_RESULT_OK) 536 if (result != MOJO_RESULT_OK)
536 return result; 537 return result;
537 538
538 DCHECK(mapping); 539 DCHECK(mapping);
539 void* address = mapping->GetBase(); 540 void* address = mapping->GetBase();
540 { 541 {
541 MutexLocker locker(&mapping_table_mutex_); 542 MutexLocker locker(&mapping_table_mutex_);
542 result = mapping_table_.AddMapping(mapping.Pass()); 543 result = mapping_table_.AddMapping(std::move(mapping));
543 } 544 }
544 if (result != MOJO_RESULT_OK) 545 if (result != MOJO_RESULT_OK)
545 return result; 546 return result;
546 547
547 buffer.Put(address); 548 buffer.Put(address);
548 return MOJO_RESULT_OK; 549 return MOJO_RESULT_OK;
549 } 550 }
550 551
551 MojoResult Core::UnmapBuffer(UserPointer<void> buffer) { 552 MojoResult Core::UnmapBuffer(UserPointer<void> buffer) {
552 MutexLocker locker(&mapping_table_mutex_); 553 MutexLocker locker(&mapping_table_mutex_);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 if (signals_states) { 609 if (signals_states) {
609 for (; i < num_handles; i++) 610 for (; i < num_handles; i++)
610 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 611 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
611 } 612 }
612 613
613 return rv; 614 return rv;
614 } 615 }
615 616
616 } // namespace system 617 } // namespace system
617 } // namespace mojo 618 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc ('k') | mojo/edk/system/data_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698