| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const scoped_refptr<Dispatcher>& dispatcher) | 75 const scoped_refptr<Dispatcher>& dispatcher) |
| 76 : dispatcher(dispatcher), | 76 : dispatcher(dispatcher), |
| 77 busy(false) { | 77 busy(false) { |
| 78 } | 78 } |
| 79 | 79 |
| 80 CoreImpl::HandleTableEntry::~HandleTableEntry() { | 80 CoreImpl::HandleTableEntry::~HandleTableEntry() { |
| 81 DCHECK(!busy); | 81 DCHECK(!busy); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // static | 84 // static |
| 85 CoreImpl* CoreImpl::singleton_ = NULL; | |
| 86 | |
| 87 // static | |
| 88 void CoreImpl::Init() { | 85 void CoreImpl::Init() { |
| 89 CHECK(!singleton_); | 86 Core::Init(new CoreImpl()); |
| 90 singleton_ = new CoreImpl(); | |
| 91 } | 87 } |
| 92 | 88 |
| 93 MojoResult CoreImpl::Close(MojoHandle handle) { | 89 MojoResult CoreImpl::Close(MojoHandle handle) { |
| 94 if (handle == MOJO_HANDLE_INVALID) | 90 if (handle == MOJO_HANDLE_INVALID) |
| 95 return MOJO_RESULT_INVALID_ARGUMENT; | 91 return MOJO_RESULT_INVALID_ARGUMENT; |
| 96 | 92 |
| 97 scoped_refptr<Dispatcher> dispatcher; | 93 scoped_refptr<Dispatcher> dispatcher; |
| 98 { | 94 { |
| 99 base::AutoLock locker(handle_table_lock_); | 95 base::AutoLock locker(handle_table_lock_); |
| 100 HandleTableMap::iterator it = handle_table_.find(handle); | 96 HandleTableMap::iterator it = handle_table_.find(handle); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be | 438 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be |
| 443 // destroyed, but this would still be required if the waiter were in TLS.) | 439 // destroyed, but this would still be required if the waiter were in TLS.) |
| 444 for (i = 0; i < num_added; i++) | 440 for (i = 0; i < num_added; i++) |
| 445 dispatchers[i]->RemoveWaiter(&waiter); | 441 dispatchers[i]->RemoveWaiter(&waiter); |
| 446 | 442 |
| 447 return rv; | 443 return rv; |
| 448 } | 444 } |
| 449 | 445 |
| 450 } // namespace system | 446 } // namespace system |
| 451 } // namespace mojo | 447 } // namespace mojo |
| OLD | NEW |