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

Unified Diff: content/browser/fileapi/blob_storage_host_impl.h

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make blob_storage_host a content/public interface with a content-private impl Created 6 years, 8 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
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_

Powered by Google App Engine
This is Rietveld 408576698