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

Side by Side Diff: content/child/blob_storage/blob_transport_controller.h

Issue 1292523002: [BlobAsync] Patch 3: Renderer Classes & Logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async2
Patch Set: comment and build Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(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 namespace base {
19 template <typename T>
20 struct DefaultLazyInstanceTraits;
21 }
22
23 namespace IPC {
24 class Sender;
25 }
26
27 namespace content {
28
29 // This class is used to manage all the asynchronous transporation of blobs from
30 // the Renderer to the Browser process, where it's handling the Renderer side.
31 // This function of this class is to:
32 // * Be a lazy singleton,
33 // * delegate calls to the BlobTransportTemporaryHolder, and
34 // * send IPC responses.
35 // Must be used on the IO thread.
36 class BlobTransportController {
37 public:
38 static BlobTransportController* GetInstance();
39
40 // This kicks off a blob transfer to the browser thread, which involves
41 // sending an IPC message and storing the blob consolidation object.
42 void InitiateBlobTransfer(const std::string& uuid,
43 const std::string& type,
44 scoped_ptr<BlobConsolidation> consolidation,
45 IPC::Sender* sender);
46
47 // This responds to the request using the sender.
48 void OnMemoryRequest(
49 const std::string& uuid,
50 const std::vector<storage::BlobItemBytesRequest>& requests,
51 std::vector<base::SharedMemoryHandle>* memory_handles,
52 const std::vector<IPC::PlatformFileForTransit>& file_handles,
53 IPC::Sender* sender);
54
55 void OnCancel(const std::string& uuid,
56 storage::IPCBlobCreationCancelCode code);
57
58 void OnDone(const std::string& uuid);
59
60 ~BlobTransportController();
61
62 private:
63 friend struct base::DefaultLazyInstanceTraits<BlobTransportController>;
64
65 BlobTransportController();
66
67 // Sends the IPC to cancel the blob transfer, and releases the blob from
68 // internal storage.
69 void CancelBlobTransfer(const std::string& uuid,
70 storage::IPCBlobCreationCancelCode code,
71 IPC::Sender* sender);
72
73 BlobTransportTemporaryHolder holder_;
74
75 DISALLOW_COPY_AND_ASSIGN(BlobTransportController);
76 };
77
78 } // namespace content
79 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698