| OLD | NEW |
| 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 | 10 |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 12 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 class WebThreadSafeData; | 15 class WebThreadSafeData; |
| 15 } // namespace blink | 16 } // namespace blink |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class ThreadSafeSender; | 19 class ThreadSafeSender; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 virtual void registerStreamURL(const blink::WebURL& url, | 37 virtual void registerStreamURL(const blink::WebURL& url, |
| 37 const blink::WebURL& src_url); | 38 const blink::WebURL& src_url); |
| 38 virtual void addDataToStream(const blink::WebURL& url, | 39 virtual void addDataToStream(const blink::WebURL& url, |
| 39 const char* data, size_t length); | 40 const char* data, size_t length); |
| 40 virtual void flushStream(const blink::WebURL& url); | 41 virtual void flushStream(const blink::WebURL& url); |
| 41 virtual void finalizeStream(const blink::WebURL& url); | 42 virtual void finalizeStream(const blink::WebURL& url); |
| 42 virtual void abortStream(const blink::WebURL& url); | 43 virtual void abortStream(const blink::WebURL& url); |
| 43 virtual void unregisterStreamURL(const blink::WebURL& url); | 44 virtual void unregisterStreamURL(const blink::WebURL& url); |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 void SendDataForBlob(const std::string& uuid_str, | 47 // Sends the data in the buffer as a blob item, then resets the buffer size. |
| 47 const blink::WebThreadSafeData& data); | 48 void SendAndClearConsolidatingBuffer( |
| 49 const std::string& uuid_str, |
| 50 std::vector<char>* consolidating_buffer, |
| 51 size_t* consolidating_items_size_bytes) const; |
| 52 // Adds the item to the consolidating buffer. We assume that the buffer can |
| 53 // hold the new item, caller should check this beforehand. |
| 54 void AddItemToBuffer(const blink::WebThreadSafeData& data, |
| 55 std::vector<char>* consolidating_buffer, |
| 56 size_t* consolidating_items_size_bytes) const; |
| 57 // Sends data that is larger than the threshold. |
| 58 void SendOversizedDataForBlob(const std::string& uuid_str, |
| 59 const blink::WebThreadSafeData& data); |
| 48 | 60 |
| 49 scoped_refptr<ThreadSafeSender> sender_; | 61 scoped_refptr<ThreadSafeSender> sender_; |
| 50 }; | 62 }; |
| 51 | 63 |
| 52 } // namespace content | 64 } // namespace content |
| 53 | 65 |
| 54 #endif // CONTENT_CHILD_FILEAPI_WEBBLOBREGISTRY_IMPL_H_ | 66 #endif // CONTENT_CHILD_FILEAPI_WEBBLOBREGISTRY_IMPL_H_ |
| OLD | NEW |