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. 4 5 #ifndef CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ 6 #define CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ 7 8 #include "base/basictypes.h" 9 10 namespace chromecast { 11 namespace media { 12 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 15 // memory ownership. 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 { 20 public: 21 virtual ~MediaMemoryChunk(); 22 23 // Returns the start of the block of memory. 24 virtual void* data() const = 0; 25 26 // Returns the size of the block of memory. 27 virtual size_t size() const = 0; 28 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; 34 }; 35 36 } // namespace media 37 } // namespace chromecast 38 39 #endif // CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ 40