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

Side by Side Diff: content/child/webblobregistry_impl.h

Issue 1183713003: Blob Consolidation & Registry Hookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: file path fix Created 5 years, 5 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_ 5 #ifndef CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
6 #define CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_ 6 #define CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "content/child/blob_storage/blob_consolidation.h"
13 #include "storage/common/data_element.h"
12 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 14 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
13 15
14 namespace blink { 16 namespace blink {
15 class WebThreadSafeData; 17 class WebThreadSafeData;
16 } // namespace blink 18 } // namespace blink
17 19
18 namespace storage { 20 namespace storage {
19 class DataElement; 21 class DataElement;
20 } 22 }
21 23
22 namespace content { 24 namespace content {
23 class ThreadSafeSender; 25 class ThreadSafeSender;
24 26
25 class WebBlobRegistryImpl : public blink::WebBlobRegistry { 27 class WebBlobRegistryImpl : public blink::WebBlobRegistry {
26 public: 28 public:
27 explicit WebBlobRegistryImpl(ThreadSafeSender* sender); 29 explicit WebBlobRegistryImpl(ThreadSafeSender* sender);
28 virtual ~WebBlobRegistryImpl(); 30 virtual ~WebBlobRegistryImpl();
29 31
32 // TODO(dmurph): remove this after moving to createBuilder. crbug.com/504583
30 virtual void registerBlobData(const blink::WebString& uuid, 33 virtual void registerBlobData(const blink::WebString& uuid,
31 const blink::WebBlobData& data); 34 const blink::WebBlobData& data);
35
36 virtual blink::WebBlobRegistry::Builder* createBuilder(
37 const blink::WebString& uuid,
38 const blink::WebString& content_type);
39
32 virtual void addBlobDataRef(const blink::WebString& uuid); 40 virtual void addBlobDataRef(const blink::WebString& uuid);
33 virtual void removeBlobDataRef(const blink::WebString& uuid); 41 virtual void removeBlobDataRef(const blink::WebString& uuid);
34 virtual void registerPublicBlobURL(const blink::WebURL&, 42 virtual void registerPublicBlobURL(const blink::WebURL&,
35 const blink::WebString& uuid); 43 const blink::WebString& uuid);
36 virtual void revokePublicBlobURL(const blink::WebURL&); 44 virtual void revokePublicBlobURL(const blink::WebURL&);
37 45
38 // Additional support for Streams. 46 // Additional support for Streams.
39 virtual void registerStreamURL(const blink::WebURL& url, 47 virtual void registerStreamURL(const blink::WebURL& url,
40 const blink::WebString& content_type); 48 const blink::WebString& content_type);
41 virtual void registerStreamURL(const blink::WebURL& url, 49 virtual void registerStreamURL(const blink::WebURL& url,
42 const blink::WebURL& src_url); 50 const blink::WebURL& src_url);
43 virtual void addDataToStream(const blink::WebURL& url, 51 virtual void addDataToStream(const blink::WebURL& url,
44 const char* data, size_t length); 52 const char* data, size_t length);
45 virtual void flushStream(const blink::WebURL& url); 53 virtual void flushStream(const blink::WebURL& url);
46 virtual void finalizeStream(const blink::WebURL& url); 54 virtual void finalizeStream(const blink::WebURL& url);
47 virtual void abortStream(const blink::WebURL& url); 55 virtual void abortStream(const blink::WebURL& url);
48 virtual void unregisterStreamURL(const blink::WebURL& url); 56 virtual void unregisterStreamURL(const blink::WebURL& url);
49 57
50 private: 58 private:
51 // Sends the data in the buffer as a blob item, then resets the buffer size. 59 // Handles all of the IPCs sent for building a blob.
52 void FlushBlobItemBuffer(const std::string& uuid_str, 60 class BuilderImpl : public blink::WebBlobRegistry::Builder {
53 storage::DataElement* data_buffer) const; 61 public:
62 BuilderImpl(const blink::WebString& uuid,
63 const blink::WebString& contentType,
64 ThreadSafeSender* sender);
65 virtual ~BuilderImpl();
54 66
55 // Adds the item to the consolidating buffer, flushing the buffer if needed. 67 virtual void appendData(const blink::WebThreadSafeData&);
56 // If the item is too big for the buffer, it is sent as Sync messages in 68 virtual void appendFile(const blink::WebString& path,
57 // shared memory instead. 69 uint64_t offset,
58 void BufferBlobData(const std::string& uuid_str, 70 uint64_t length,
59 const blink::WebThreadSafeData& data, 71 double expected_modification_time);
60 storage::DataElement* data_buffer); 72 virtual void appendBlob(const blink::WebString& uuid,
61 // Sends data that is larger than the threshold. 73 uint64_t offset,
62 void SendOversizedDataForBlob(const std::string& uuid_str, 74 uint64_t length) override;
63 const blink::WebThreadSafeData& data); 75 virtual void appendFileSystemURL(const blink::WebURL&,
76 uint64_t offset,
77 uint64_t length,
78 double expected_modification_time);
79
80 void build() override;
81
82 private:
83 // Sends data that is larger than the threshold.
84 void SendOversizedDataForBlob(size_t consolidated_item_index);
85
86 const std::string uuid_;
87 const std::string content_type_;
88 BlobConsolidation consolidation_;
89 scoped_refptr<ThreadSafeSender> sender_;
90 };
64 91
65 scoped_refptr<ThreadSafeSender> sender_; 92 scoped_refptr<ThreadSafeSender> sender_;
66 }; 93 };
67 94
68 } // namespace content 95 } // namespace content
69 96
70 #endif // CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_ 97 #endif // CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/blob_storage/blob_consolidation_unittest.cc ('k') | content/child/webblobregistry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698