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
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_
6 #define CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_
8 #include "base/basictypes.h"
10 namespace chromecast
{
13 // MediaMemoryChunk represents a block of memory without doing any assumption
14 // about the type of memory (e.g. shared memory) nor about the underlying
16 // The block of memory can be invalidated under the cover (e.g. if the derived
17 // class does not own the underlying memory),
18 // in that case, MediaMemoryChunk::valid() will return false.
19 class MediaMemoryChunk
{
21 virtual ~MediaMemoryChunk();
23 // Returns the start of the block of memory.
24 virtual void* data() const = 0;
26 // Returns the size of the block of memory.
27 virtual size_t size() const = 0;
29 // Returns whether the underlying block of memory is valid.
30 // Since MediaMemoryChunk does not specify a memory ownership model,
31 // the underlying block of memory might be invalidated by a third party.
32 // In that case, valid() will return false.
33 virtual bool valid() const = 0;
37 } // namespace chromecast
39 #endif // CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_