| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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 CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/shared_memory_handle.h" |
| 15 #include "content/public/browser/browser_message_filter.h" |
| 16 #include "ipc/ipc_platform_file.h" |
| 17 #include "storage/common/blob_storage/blob_storage_constants.h" |
| 18 |
| 19 class GURL; |
| 20 |
| 21 namespace storage { |
| 22 class DataElement; |
| 23 class BlobDataBuilder; |
| 24 struct BlobItemBytesRequest; |
| 25 struct BlobItemBytesResponse; |
| 26 } |
| 27 |
| 28 namespace content { |
| 29 class ChromeBlobStorageContext; |
| 30 class BlobStorageHost; |
| 31 |
| 32 // This class's only responsibility is to listen for and dispatch blob storage |
| 33 // messages. This lives in the browser process, and there is one per child |
| 34 // process. |
| 35 class BlobDispatcherHost : public BrowserMessageFilter { |
| 36 public: |
| 37 BlobDispatcherHost(int process_id, |
| 38 ChromeBlobStorageContext* blob_storage_context); |
| 39 // BrowserMessageFilter implementation. |
| 40 void OnChannelConnected(int32 peer_pid) override; |
| 41 void OnChannelClosing() override; |
| 42 bool OnMessageReceived(const IPC::Message& message) override; |
| 43 |
| 44 private: |
| 45 friend class base::RefCountedThreadSafe<BlobDispatcherHost>; |
| 46 ~BlobDispatcherHost() override; |
| 47 |
| 48 void OnRegisterBlobUUID(const std::string& uuid); |
| 49 void OnStartBuildingBlob( |
| 50 const std::string& uuid, |
| 51 const std::string& type, |
| 52 const std::vector<storage::DataElement>& descriptions); |
| 53 void OnMemoryItemResponse( |
| 54 const std::string& uuid, |
| 55 const std::vector<storage::BlobItemBytesResponse>& response); |
| 56 void OnCancelBuildingBlob(const std::string& uuid, |
| 57 const storage::IPCBlobCreationCancelCode code); |
| 58 |
| 59 void OnIncrementBlobRefCount(const std::string& uuid); |
| 60 void OnDecrementBlobRefCount(const std::string& uuid); |
| 61 void OnRegisterPublicBlobURL(const GURL& public_url, const std::string& uuid); |
| 62 void OnRevokePublicBlobURL(const GURL& public_url); |
| 63 |
| 64 void SendMemoryRequest( |
| 65 const std::string& uuid, |
| 66 const std::vector<storage::BlobItemBytesRequest>& requests, |
| 67 const std::vector<base::SharedMemoryHandle>& memory_handles, |
| 68 const std::vector<IPC::PlatformFileForTransit>& file_handles); |
| 69 |
| 70 void CancelBlob(const std::string& uuid, |
| 71 const storage::IPCBlobCreationCancelCode code); |
| 72 void BlobDoneBuilding(const std::string& uuid); |
| 73 |
| 74 int process_id_; |
| 75 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| 76 |
| 77 // Keeps track of blobs used in this process and cleans up |
| 78 // when the renderer process dies. |
| 79 scoped_ptr<BlobStorageHost> blob_storage_host_; |
| 80 DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost); |
| 81 }; |
| 82 } // namespace content |
| 83 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ |
| OLD | NEW |