| Index: content/browser/fileapi/blob_storage_host_impl.h
|
| diff --git a/content/browser/fileapi/blob_storage_host_impl.h b/content/browser/fileapi/blob_storage_host_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..293d51254d41f178e498c37021b3463022f48f13
|
| --- /dev/null
|
| +++ b/content/browser/fileapi/blob_storage_host_impl.h
|
| @@ -0,0 +1,77 @@
|
| +// Copyright 2014 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 CONTENT_BROWSER_FILEAPI_BLOB_STORAGE_HOST_IMPL_H_
|
| +#define CONTENT_BROWSER_FILEAPI_BLOB_STORAGE_HOST_IMPL_H_
|
| +
|
| +#include <map>
|
| +#include <set>
|
| +#include <string>
|
| +
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "content/common/content_export.h"
|
| +#include "content/public/browser/fileapi/blob_storage_host.h"
|
| +
|
| +class GURL;
|
| +
|
| +namespace webkit_blob {
|
| +class BlobDataHandle;
|
| +class BlobStorageContext;
|
| +}
|
| +
|
| +using webkit_blob::BlobStorageContext;
|
| +using webkit_blob::BlobData;
|
| +
|
| +namespace content {
|
| +
|
| +// This is the implementation of BlobStorageHost.
|
| +class CONTENT_EXPORT BlobStorageHostImpl : public BlobStorageHost {
|
| + public:
|
| + explicit BlobStorageHostImpl(BlobStorageContext* context);
|
| + virtual ~BlobStorageHostImpl();
|
| +
|
| + // BlobStorageHost implementation:
|
| + virtual bool StartBuildingBlob(
|
| + const std::string& uuid) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool AppendBlobDataItem(
|
| + const std::string& uuid,
|
| + const BlobData::Item& data_item) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool CancelBuildingBlob(
|
| + const std::string& uuid) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool FinishBuildingBlob(
|
| + const std::string& uuid,
|
| + const std::string& type) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool IncrementBlobRefCount(
|
| + const std::string& uuid) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool DecrementBlobRefCount(
|
| + const std::string& uuid) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool RegisterPublicBlobURL(
|
| + const GURL& blob_url,
|
| + const std::string& uuid) OVERRIDE WARN_UNUSED_RESULT;
|
| + virtual bool RevokePublicBlobURL(
|
| + const GURL& blob_url) OVERRIDE WARN_UNUSED_RESULT;
|
| +
|
| + private:
|
| + typedef std::map<std::string, int> BlobReferenceMap;
|
| +
|
| + bool IsInUseInHost(const std::string& uuid);
|
| + bool IsBeingBuiltInHost(const std::string& uuid);
|
| + bool IsUrlRegisteredInHost(const GURL& blob_url);
|
| +
|
| + // Collection of blob ids and a count of how many usages
|
| + // of that id are attributable to this consumer.
|
| + BlobReferenceMap blobs_inuse_map_;
|
| +
|
| + // The set of public blob urls coined by this consumer.
|
| + std::set<GURL> public_blob_urls_;
|
| +
|
| + base::WeakPtr<BlobStorageContext> context_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BlobStorageHostImpl);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_FILEAPI_BLOB_STORAGE_HOST_IMPL_H_
|
|
|