Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / mojo / public / bindings / lib / buffer.cc
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
3 // found in the LICENSE file.
4
5 #include "mojo/public/bindings/buffer.h"
6
7 #include <assert.h>
8
9 #include "mojo/public/environment/buffer_tls.h"
10 #include "mojo/public/system/macros.h"
11
12 namespace mojo {
13
14 Buffer::Buffer() {
15   previous_ = internal::SetCurrentBuffer(this);
16 }
17
18 Buffer::~Buffer() {
19   Buffer* buf MOJO_ALLOW_UNUSED = internal::SetCurrentBuffer(previous_);
20   assert(buf == this);
21 }
22
23 Buffer* Buffer::current() {
24   return internal::GetCurrentBuffer();
25 }
26
27 }  // namespace mojo