OLD | NEW |
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 PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ | 5 #ifndef PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
6 #define PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ | 6 #define PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_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 "ppapi/c/pp_resource.h" | |
13 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
14 #include "ppapi/c/pp_time.h" | 13 #include "ppapi/c/pp_time.h" |
15 #include "ppapi/shared_impl/ppapi_globals.h" | 14 #include "ppapi/shared_impl/host_resource.h" |
16 #include "ppapi/shared_impl/ppapi_shared_export.h" | 15 #include "ppapi/shared_impl/ppapi_shared_export.h" |
17 #include "ppapi/shared_impl/resource_tracker.h" | |
18 | 16 |
19 namespace ppapi { | 17 namespace ppapi { |
20 | 18 |
21 class Resource; | 19 class Resource; |
22 | 20 |
23 struct PPAPI_SHARED_EXPORT URLRequestInfoData { | 21 struct PPAPI_SHARED_EXPORT URLRequestInfoData { |
24 struct PPAPI_SHARED_EXPORT BodyItem { | 22 struct PPAPI_SHARED_EXPORT BodyItem { |
25 BodyItem(); | 23 BodyItem(); |
26 explicit BodyItem(const std::string& data); | 24 explicit BodyItem(const std::string& data); |
27 BodyItem(Resource* file_ref, | 25 BodyItem(Resource* file_ref, |
28 int64_t start_offset, | 26 int64_t start_offset, |
29 int64_t number_of_bytes, | 27 int64_t number_of_bytes, |
30 PP_Time expected_last_modified_time); | 28 PP_Time expected_last_modified_time); |
31 | 29 |
32 // Set if the input is a file, false means the |data| is valid. | 30 // Set if the input is a file, false means the |data| is valid. |
33 bool is_file; | 31 bool is_file; |
34 | 32 |
35 std::string data; | 33 std::string data; |
36 | 34 |
37 // Only set on the plugin-side, for refcounting purposes. Only valid when | 35 // Is is_file is set, these variables are set. Note that the resource |
38 // |is_file| is set. | 36 // may still be NULL in some cases, such as deserialization errors. |
39 scoped_refptr<Resource> file_ref_resource; | 37 // |
40 // This struct holds no ref to this resource. Only valid when |is_file| is | 38 // This is a bit tricky. In the plugin side of the proxy, both the file ref |
41 // set. | 39 // and the file_ref_host_resource will be set and valid. The scoped_refptr |
42 PP_Resource file_ref_pp_resource; | 40 // ensures that the resource is alive for as long as the BodyItem is. |
| 41 // |
| 42 // When we deserialize this in the renderer, only the |
| 43 // file_ref_host_resource's are serialized over IPC. The file_refs won't be |
| 44 // valid until the host resources are converted to Resource pointers in the |
| 45 // PPB_URLRequestInfo_Impl. |
| 46 scoped_refptr<Resource> file_ref; |
| 47 HostResource file_ref_host_resource; |
43 | 48 |
44 int64_t start_offset; | 49 int64_t start_offset; |
45 int64_t number_of_bytes; | 50 int64_t number_of_bytes; |
46 PP_Time expected_last_modified_time; | 51 PP_Time expected_last_modified_time; |
47 | 52 |
48 // If you add more stuff here, be sure to modify the serialization rules in | 53 // If you add more stuff here, be sure to modify the serialization rules in |
49 // ppapi_messages.h | 54 // ppapi_messages.h |
50 }; | 55 }; |
51 | 56 |
52 URLRequestInfoData(); | 57 URLRequestInfoData(); |
(...skipping 30 matching lines...) Expand all Loading... |
83 | 88 |
84 std::vector<BodyItem> body; | 89 std::vector<BodyItem> body; |
85 | 90 |
86 // If you add more stuff here, be sure to modify the serialization rules in | 91 // If you add more stuff here, be sure to modify the serialization rules in |
87 // ppapi_messages.h | 92 // ppapi_messages.h |
88 }; | 93 }; |
89 | 94 |
90 } // namespace ppapi | 95 } // namespace ppapi |
91 | 96 |
92 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ | 97 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
OLD | NEW |