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

Side by Side Diff: webkit/glue/resource_request_body.h

Issue 11410019: ********** Chromium Blob hacking (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/glue_serialize.cc ('k') | webkit/glue/resource_request_body.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ 5 #ifndef WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
6 #define WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ 6 #define WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
7 7
8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/supports_user_data.h" 13 #include "base/supports_user_data.h"
13 #include "webkit/base/data_element.h" 14 #include "webkit/base/data_element.h"
14 #include "webkit/glue/webkit_glue_export.h" 15 #include "webkit/glue/webkit_glue_export.h"
15 16
16 namespace base { 17 namespace base {
17 class FilePath; 18 class FilePath;
18 class TaskRunner; 19 class TaskRunner;
19 } 20 }
20 21
21 namespace fileapi { 22 namespace fileapi {
22 class FileSystemContext; 23 class FileSystemContext;
23 } 24 }
24 25
25 namespace net { 26 namespace net {
26 class UploadDataStream; 27 class UploadDataStream;
27 } 28 }
28 29
29 namespace webkit_blob { 30 namespace webkit_blob {
30 class BlobStorageController; 31 class BlobStorageContext;
31 } 32 }
32 33
33 namespace webkit_glue { 34 namespace webkit_glue {
34 35
35 // A struct used to represent upload data. The data field is populated by 36 // A struct used to represent upload data. The data field is populated by
36 // WebURLLoader from the data given as WebHTTPBody. 37 // WebURLLoader from the data given as WebHTTPBody.
37 class WEBKIT_GLUE_EXPORT ResourceRequestBody 38 class WEBKIT_GLUE_EXPORT ResourceRequestBody
38 : public base::RefCounted<ResourceRequestBody>, 39 : public base::RefCounted<ResourceRequestBody>,
39 public base::SupportsUserData { 40 public base::SupportsUserData {
40 public: 41 public:
41 typedef webkit_base::DataElement Element; 42 typedef webkit_base::DataElement Element;
42 43
43 ResourceRequestBody(); 44 ResourceRequestBody();
44 45
45 void AppendBytes(const char* bytes, int bytes_len); 46 void AppendBytes(const char* bytes, int bytes_len);
46 void AppendFileRange(const base::FilePath& file_path, 47 void AppendFileRange(const base::FilePath& file_path,
47 uint64 offset, uint64 length, 48 uint64 offset, uint64 length,
48 const base::Time& expected_modification_time); 49 const base::Time& expected_modification_time);
49 void AppendBlob(const GURL& blob_url); 50 void AppendBlob(const std::string& uuid);
50 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length, 51 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length,
51 const base::Time& expected_modification_time); 52 const base::Time& expected_modification_time);
52 53
53 // Creates a new UploadDataStream from this request body. This also resolves 54 // Creates a new UploadDataStream from this request body. This also resolves
54 // any blob references using given |blob_controller|. |file_system_context| is 55 // any blob references using given |blob_controller|. |file_system_context| is
55 // used to create FileStreamReader for files with filesystem URLs. 56 // used to create FileStreamReader for files with filesystem URLs.
56 // |file_task_runner| is used to perform file operations when the data gets 57 // |file_task_runner| is used to perform file operations when the data gets
57 // uploaded. 58 // uploaded.
58 net::UploadDataStream* ResolveElementsAndCreateUploadDataStream( 59 net::UploadDataStream* ResolveElementsAndCreateUploadDataStream(
59 webkit_blob::BlobStorageController* blob_controller, 60 webkit_blob::BlobStorageContext* blob_context,
60 fileapi::FileSystemContext* file_system_context, 61 fileapi::FileSystemContext* file_system_context,
61 base::TaskRunner* file_task_runner); 62 base::TaskRunner* file_task_runner);
62 63
63 const std::vector<Element>* elements() const { return &elements_; } 64 const std::vector<Element>* elements() const { return &elements_; }
64 std::vector<Element>* elements_mutable() { return &elements_; } 65 std::vector<Element>* elements_mutable() { return &elements_; }
65 void swap_elements(std::vector<Element>* elements) { 66 void swap_elements(std::vector<Element>* elements) {
66 elements_.swap(*elements); 67 elements_.swap(*elements);
67 } 68 }
68 69
69 // Identifies a particular upload instance, which is used by the cache to 70 // Identifies a particular upload instance, which is used by the cache to
70 // formulate a cache key. This value should be unique across browser 71 // formulate a cache key. This value should be unique across browser
71 // sessions. A value of 0 is used to indicate an unspecified identifier. 72 // sessions. A value of 0 is used to indicate an unspecified identifier.
72 void set_identifier(int64 id) { identifier_ = id; } 73 void set_identifier(int64 id) { identifier_ = id; }
73 int64 identifier() const { return identifier_; } 74 int64 identifier() const { return identifier_; }
74 75
75 private: 76 private:
76 friend class base::RefCounted<ResourceRequestBody>; 77 friend class base::RefCounted<ResourceRequestBody>;
77 virtual ~ResourceRequestBody(); 78 virtual ~ResourceRequestBody();
78 79
79 // Resolves the |blob_url| using |blob_controller| and appends resolved 80 // Resolves the |blob_url| using |blob_controller| and appends resolved
80 // items to |resolved_elements|. 81 // items to |resolved_elements|.
81 void ResolveBlobReference(webkit_blob::BlobStorageController* blob_controller, 82 void ResolveBlobReference(webkit_blob::BlobStorageContext* blob_context,
82 const GURL& blob_url, 83 const std::string& uuid,
83 std::vector<const Element*>* resolved_elements); 84 std::vector<const Element*>* resolved_elements);
84 85
85 std::vector<Element> elements_; 86 std::vector<Element> elements_;
86 int64 identifier_; 87 int64 identifier_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody); 89 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody);
89 }; 90 };
90 91
91 } // namespace webkit_glue 92 } // namespace webkit_glue
92 93
93 #endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ 94 #endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
OLDNEW
« no previous file with comments | « webkit/glue/glue_serialize.cc ('k') | webkit/glue/resource_request_body.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698