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