| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_buffer_dispatcher.h" | 5 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 handles[0] = handle_for_transit_.get(); | 271 handles[0] = handle_for_transit_.get(); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool SharedBufferDispatcher::BeginTransit() { | 275 bool SharedBufferDispatcher::BeginTransit() { |
| 276 base::AutoLock lock(lock_); | 276 base::AutoLock lock(lock_); |
| 277 if (in_transit_) | 277 if (in_transit_) |
| 278 return false; | 278 return false; |
| 279 in_transit_ = shared_buffer_ != nullptr; | 279 in_transit_ = static_cast<bool>(shared_buffer_); |
| 280 return in_transit_; | 280 return in_transit_; |
| 281 } | 281 } |
| 282 | 282 |
| 283 void SharedBufferDispatcher::CompleteTransitAndClose() { | 283 void SharedBufferDispatcher::CompleteTransitAndClose() { |
| 284 base::AutoLock lock(lock_); | 284 base::AutoLock lock(lock_); |
| 285 in_transit_ = false; | 285 in_transit_ = false; |
| 286 shared_buffer_ = nullptr; | 286 shared_buffer_ = nullptr; |
| 287 ignore_result(handle_for_transit_.release()); | 287 ignore_result(handle_for_transit_.release()); |
| 288 } | 288 } |
| 289 | 289 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 // Checks for fields beyond |flags|: | 331 // Checks for fields beyond |flags|: |
| 332 | 332 |
| 333 // (Nothing here yet.) | 333 // (Nothing here yet.) |
| 334 | 334 |
| 335 return MOJO_RESULT_OK; | 335 return MOJO_RESULT_OK; |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace edk | 338 } // namespace edk |
| 339 } // namespace mojo | 339 } // namespace mojo |
| OLD | NEW |