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_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ | |
6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_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/child/blob_storage/blob_transport_temporary_holder.h" | |
16 #include "storage/common/blob_storage/blob_storage_constants.h" | |
17 | |
18 template <typename T> | |
19 struct DefaultSingletonTraits; | |
20 | |
21 namespace IPC { | |
22 class Sender; | |
23 } | |
24 | |
25 namespace content { | |
26 | |
27 // Must be used on the IO thread. | |
28 class BlobTransportController { | |
29 public: | |
30 static BlobTransportController* GetInstance(); | |
31 | |
32 // This kicks off a blob transfer to the browser thread, which involves | |
33 // sending an IPC message and storing the blob consolidation object. | |
34 void InitiateBlobTransfer(const std::string& uuid, | |
35 const std::string& type, | |
36 scoped_ptr<BlobConsolidation> consolidation, | |
37 IPC::Sender* sender); | |
38 | |
39 // This responds to the request using the sender. | |
40 void OnMemoryRequest( | |
41 const std::string& uuid, | |
42 const std::vector<storage::BlobItemBytesRequest>& requests, | |
43 std::vector<base::SharedMemoryHandle>* memory_handles, | |
44 const std::vector<IPC::PlatformFileForTransit>& file_handles, | |
45 IPC::Sender* sender); | |
46 | |
47 void OnCancel(const std::string& uuid, | |
48 storage::IPCBlobCreationCancelCode code); | |
49 | |
50 void OnDone(const std::string& uuid); | |
51 | |
52 // This tells the controller that the channel has been closed, and that all | |
53 // senders previously given to the controller are now invalid. | |
54 void OnChannelClose(); | |
michaeln
2015/08/18 02:50:35
Shutdown() might be a better name. When this happe
dmurph
2015/10/07 00:32:36
I actually don't need this anymore. We just use th
| |
55 | |
56 ~BlobTransportController(); | |
57 | |
58 private: | |
59 friend struct DefaultSingletonTraits<BlobTransportController>; | |
60 | |
61 BlobTransportController(); | |
62 | |
63 // Sends the IPC to cancel the blob transfer, and releases the blob from | |
64 // internal storage. | |
65 void CancelBlobTransfer(const std::string& uuid, | |
66 storage::IPCBlobCreationCancelCode code, | |
67 IPC::Sender* sender); | |
68 | |
69 BlobTransportTemporaryHolder holder_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(BlobTransportController); | |
72 }; | |
73 | |
74 } // namespace content | |
75 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ | |
OLD | NEW |