blob: bdd334938eba1a12ce6feee98110e2bf53d30a3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_BINDINGS_BUFFER_H_
#define MOJO_PUBLIC_BINDINGS_BUFFER_H_
#include <stddef.h>
namespace mojo {
// Buffer provides a way to allocate memory. Allocations are 8-byte aligned and
// zero-initialized. Allocations remain valid for the lifetime of the Buffer.
class Buffer {
public:
typedef void (*Destructor)(void* address);
Buffer();
virtual ~Buffer();
virtual void* Allocate(size_t num_bytes, Destructor func = NULL) = 0;
static Buffer* current();
private:
Buffer* previous_;
};
} // namespace mojo
#endif // MOJO_PUBLIC_BINDINGS_BUFFER_H_
|