OLD | NEW |
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/system/core_impl.h" | 5 #include "mojo/system/core_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 uint64_t num_bytes, | 490 uint64_t num_bytes, |
491 void** buffer, | 491 void** buffer, |
492 MojoMapBufferFlags flags) { | 492 MojoMapBufferFlags flags) { |
493 scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); | 493 scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); |
494 if (!dispatcher.get()) | 494 if (!dispatcher.get()) |
495 return MOJO_RESULT_INVALID_ARGUMENT; | 495 return MOJO_RESULT_INVALID_ARGUMENT; |
496 | 496 |
497 if (!VerifyUserPointer<void*>(buffer, 1)) | 497 if (!VerifyUserPointer<void*>(buffer, 1)) |
498 return MOJO_RESULT_INVALID_ARGUMENT; | 498 return MOJO_RESULT_INVALID_ARGUMENT; |
499 | 499 |
500 scoped_ptr<RawSharedBuffer::Mapping> mapping; | 500 scoped_ptr<RawSharedBufferMapping> mapping; |
501 MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping); | 501 MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping); |
502 if (result != MOJO_RESULT_OK) | 502 if (result != MOJO_RESULT_OK) |
503 return result; | 503 return result; |
504 | 504 |
505 DCHECK(mapping); | 505 DCHECK(mapping); |
506 *buffer = mapping->base(); | 506 *buffer = mapping->base(); |
507 | 507 |
508 // TODO(vtl): FIXME -- Record the mapping somewhere, so that it can be | 508 // TODO(vtl): FIXME -- Record the mapping somewhere, so that it can be |
509 // unmapped properly. For now, just leak it. | 509 // unmapped properly. For now, just leak it. |
510 ignore_result(mapping.release()); | 510 ignore_result(mapping.release()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be | 569 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be |
570 // destroyed, but this would still be required if the waiter were in TLS.) | 570 // destroyed, but this would still be required if the waiter were in TLS.) |
571 for (i = 0; i < num_added; i++) | 571 for (i = 0; i < num_added; i++) |
572 dispatchers[i]->RemoveWaiter(&waiter); | 572 dispatchers[i]->RemoveWaiter(&waiter); |
573 | 573 |
574 return rv; | 574 return rv; |
575 } | 575 } |
576 | 576 |
577 } // namespace system | 577 } // namespace system |
578 } // namespace mojo | 578 } // namespace mojo |
OLD | NEW |