| OLD | NEW |
| 1 // Copyright (c) 2009 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client 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 <limits> | 5 #include <limits> |
| 6 #include <new> | 6 #include <new> |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/sync_socket.h" | 8 #include "base/sync_socket.h" |
| 9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/include/portability_string.h" | 10 #include "native_client/src/include/portability_string.h" |
| 11 #include "native_client/src/shared/imc/nacl_imc.h" | 11 #include "native_client/src/shared/imc/nacl_imc.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 --ref_count_; | 76 --ref_count_; |
| 77 bool destroy = (0 == ref_count_); | 77 bool destroy = (0 == ref_count_); |
| 78 NaClXMutexUnlock(&ref_count_mu_); | 78 NaClXMutexUnlock(&ref_count_mu_); |
| 79 if (destroy) { | 79 if (destroy) { |
| 80 delete this; | 80 delete this; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 DescWrapperCommon() : is_initialized_(false), ref_count_(1) { | 85 DescWrapperCommon() : is_initialized_(false), ref_count_(1) { |
| 86 NaClMutexCtor(&ref_count_mu_); | 86 NaClXMutexCtor(&ref_count_mu_); |
| 87 } | 87 } |
| 88 ~DescWrapperCommon() { | 88 ~DescWrapperCommon() { |
| 89 if (is_initialized_) { | 89 if (is_initialized_) { |
| 90 effp()->vtbl->Dtor(effp()); | 90 effp()->vtbl->Dtor(effp()); |
| 91 } | 91 } |
| 92 NaClMutexDtor(&ref_count_mu_); | 92 NaClMutexDtor(&ref_count_mu_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Set up the state. Returns true on success. | 95 // Set up the state. Returns true on success. |
| 96 bool Init(); | 96 bool Init(); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 658 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 659 SemWait(desc_); | 659 SemWait(desc_); |
| 660 } | 660 } |
| 661 | 661 |
| 662 int DescWrapper::GetValue() { | 662 int DescWrapper::GetValue() { |
| 663 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 663 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 664 GetValue(desc_); | 664 GetValue(desc_); |
| 665 } | 665 } |
| 666 | 666 |
| 667 } // namespace nacl | 667 } // namespace nacl |
| OLD | NEW |