| 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/public/cpp/bindings/buffer.h" | 5 #include "mojo/public/cpp/bindings/buffer.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 | 8 |
| 9 #include "mojo/public/cpp/environment/buffer_tls.h" | 9 #include "mojo/public/cpp/environment/buffer_tls.h" |
| 10 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 | 13 |
| 14 Buffer::Buffer() { | 14 Buffer::Buffer() { |
| 15 previous_ = internal::SetCurrentBuffer(this); | 15 previous_ = internal::SetCurrentBuffer(this); |
| 16 } | 16 } |
| 17 | 17 |
| 18 Buffer::~Buffer() { | 18 Buffer::~Buffer() { |
| 19 Buffer* buf MOJO_ALLOW_UNUSED = internal::SetCurrentBuffer(previous_); | 19 Buffer* buf MOJO_ALLOW_UNUSED = internal::SetCurrentBuffer(previous_); |
| 20 assert(buf == this); | 20 assert(buf == this); |
| 21 } | 21 } |
| 22 | 22 |
| 23 Buffer* Buffer::current() { | 23 Buffer* Buffer::current() { |
| 24 return internal::GetCurrentBuffer(); | 24 return internal::GetCurrentBuffer(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace mojo | 27 } // namespace mojo |
| OLD | NEW |