Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: net/disk_cache/blockfile/storage_block.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/blockfile/stats.cc ('k') | net/disk_cache/blockfile/storage_block-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/storage_block.h
diff --git a/net/disk_cache/blockfile/storage_block.h b/net/disk_cache/blockfile/storage_block.h
deleted file mode 100644
index 6db4a3101dea6248b9e0c9b2a6200ef9db5743e1..0000000000000000000000000000000000000000
--- a/net/disk_cache/blockfile/storage_block.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2012 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.
-
-// See net/disk_cache/disk_cache.h for the public interface.
-
-#ifndef NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_
-#define NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_
-
-#include "net/disk_cache/blockfile/addr.h"
-#include "net/disk_cache/blockfile/mapped_file.h"
-
-namespace disk_cache {
-
-// This class encapsulates common behavior of a single "block" of data that is
-// stored on a block-file. It implements the FileBlock interface, so it can be
-// serialized directly to the backing file.
-// This object provides a memory buffer for the related data, and it can be used
-// to actually share that memory with another instance of the class.
-//
-// The following example shows how to share storage with another object:
-// StorageBlock<TypeA> a(file, address);
-// StorageBlock<TypeB> b(file, address);
-// a.Load();
-// DoSomething(a.Data());
-// b.SetData(a.Data());
-// ModifySomething(b.Data());
-// // Data modified on the previous call will be saved by b's destructor.
-// b.set_modified();
-template<typename T>
-class StorageBlock : public FileBlock {
- public:
- StorageBlock(MappedFile* file, Addr address);
- virtual ~StorageBlock();
-
- // FileBlock interface.
- void* buffer() const override;
- size_t size() const override;
- int offset() const override;
-
- // Allows the overide of dummy values passed on the constructor.
- bool LazyInit(MappedFile* file, Addr address);
-
- // Sets the internal storage to share the memory provided by other instance.
- void SetData(T* other);
-
- // Deletes the data, even if it was modified and not saved. This object must
- // own the memory buffer (it cannot be shared).
- void Discard();
-
- // Stops sharing the data with another object.
- void StopSharingData();
-
- // Sets the object to lazily save the in-memory data on destruction.
- void set_modified();
-
- // Forgets that the data was modified, so it's not lazily saved.
- void clear_modified();
-
- // Gets a pointer to the internal storage (allocates storage if needed).
- T* Data();
-
- // Returns true if there is data associated with this object.
- bool HasData() const;
-
- // Returns true if the internal hash is correct.
- bool VerifyHash() const;
-
- // Returns true if this object owns the data buffer, false if it is shared.
- bool own_data() const;
-
- const Addr address() const;
-
- // Loads and store the data.
- bool Load();
- bool Store();
- bool Load(FileIOCallback* callback, bool* completed);
- bool Store(FileIOCallback* callback, bool* completed);
-
- private:
- void AllocateData();
- void DeleteData();
- uint32 CalculateHash() const;
-
- T* data_;
- MappedFile* file_;
- Addr address_;
- bool modified_;
- bool own_data_; // Is data_ owned by this object or shared with someone else.
- bool extended_; // Used to store an entry of more than one block.
-
- DISALLOW_COPY_AND_ASSIGN(StorageBlock);
-};
-
-} // namespace disk_cache
-
-#endif // NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_
« no previous file with comments | « net/disk_cache/blockfile/stats.cc ('k') | net/disk_cache/blockfile/storage_block-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698