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

Unified Diff: content/browser/blob_storage/blob_dispatcher_host.h

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments Created 5 years 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/blob_storage/blob_dispatcher_host.h
diff --git a/content/browser/blob_storage/blob_dispatcher_host.h b/content/browser/blob_storage/blob_dispatcher_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5f14fddecbbbb03fe464e852ab5019efee5b5f5
--- /dev/null
+++ b/content/browser/blob_storage/blob_dispatcher_host.h
@@ -0,0 +1,83 @@
+// Copyright 2015 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_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
+#define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/shared_memory_handle.h"
+#include "content/public/browser/browser_message_filter.h"
+#include "ipc/ipc_platform_file.h"
+#include "storage/common/blob_storage/blob_storage_constants.h"
+
+class GURL;
+
+namespace storage {
+class DataElement;
+class BlobDataBuilder;
+struct BlobItemBytesRequest;
+struct BlobItemBytesResponse;
+}
+
+namespace content {
+class ChromeBlobStorageContext;
+class BlobStorageHost;
+
+// This class's only responsibility is to listen for and dispatch blob storage
+// messages. This lives in the browser process, and there is one per child
+// process.
+class BlobDispatcherHost : public BrowserMessageFilter {
+ public:
+ BlobDispatcherHost(int process_id,
+ ChromeBlobStorageContext* blob_storage_context);
+ // BrowserMessageFilter implementation.
+ void OnChannelConnected(int32 peer_pid) override;
+ void OnChannelClosing() override;
+ bool OnMessageReceived(const IPC::Message& message) override;
+
+ private:
+ friend class base::RefCountedThreadSafe<BlobDispatcherHost>;
+ ~BlobDispatcherHost() override;
+
+ void OnRegisterBlobUUID(const std::string& uuid);
+ void OnStartBuildingBlob(
+ const std::string& uuid,
+ const std::string& type,
+ const std::vector<storage::DataElement>& descriptions);
+ void OnMemoryItemResponse(
+ const std::string& uuid,
+ const std::vector<storage::BlobItemBytesResponse>& response);
+ void OnCancelBuildingBlob(const std::string& uuid,
+ const storage::IPCBlobCreationCancelCode code);
+
+ void OnIncrementBlobRefCount(const std::string& uuid);
+ void OnDecrementBlobRefCount(const std::string& uuid);
+ void OnRegisterPublicBlobURL(const GURL& public_url, const std::string& uuid);
+ void OnRevokePublicBlobURL(const GURL& public_url);
+
+ void SendMemoryRequest(
+ const std::string& uuid,
+ const std::vector<storage::BlobItemBytesRequest>& requests,
+ const std::vector<base::SharedMemoryHandle>& memory_handles,
+ const std::vector<IPC::PlatformFileForTransit>& file_handles);
+
+ void CancelBlob(const std::string& uuid,
+ const storage::IPCBlobCreationCancelCode code);
+ void BlobDoneBuilding(const std::string& uuid);
+
+ int process_id_;
+ scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
+
+ // Keeps track of blobs used in this process and cleans up
+ // when the renderer process dies.
+ scoped_ptr<BlobStorageHost> blob_storage_host_;
+ DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost);
+};
+} // namespace content
+#endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698