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); |
31 ~BodyItem(); | |
29 | 32 |
30 // Set if the input is a file, false means the |data| is valid. | 33 // Set if the input is a file, false means the |data| is valid. |
31 bool is_file; | 34 bool is_file; |
32 | 35 |
33 std::string data; | 36 std::string data; |
34 | 37 |
35 // Is is_file is set, these variables are set. Note that the resource | 38 // Is is_file is set, these variables are set. Note that the resource |
36 // may still be NULL in some cases, such as deserialization errors. | 39 // may still be NULL in some cases, such as deserialization errors. |
37 // | 40 // |
38 // This is a bit tricky. In the plugin side of the proxy, both the file ref | 41 // When a BodyItem is created, a ref is taken on file_ref_pp_resource. That |
39 // and the file_ref_host_resource will be set and valid. The scoped_refptr | 42 // ref is releated when BodyItem is destroyed. |
yzshen1
2013/08/08 23:16:21
- releated -> released
- it is more clear to use S
teravest
2013/08/09 02:00:08
I don't use ScopedPPResource here because we send
yzshen1
2013/08/09 17:11:23
It seems wrong if you need to send it over IPC:
th
| |
40 // ensures that the resource is alive for as long as the BodyItem is. | 43 PP_Resource file_ref_pp_resource; |
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 | 44 |
49 int64_t start_offset; | 45 int64_t start_offset; |
50 int64_t number_of_bytes; | 46 int64_t number_of_bytes; |
51 PP_Time expected_last_modified_time; | 47 PP_Time expected_last_modified_time; |
52 | 48 |
53 // If you add more stuff here, be sure to modify the serialization rules in | 49 // If you add more stuff here, be sure to modify the serialization rules in |
54 // ppapi_messages.h | 50 // ppapi_messages.h |
55 }; | 51 }; |
56 | 52 |
57 URLRequestInfoData(); | 53 URLRequestInfoData(); |
(...skipping 30 matching lines...) Expand all Loading... | |
88 | 84 |
89 std::vector<BodyItem> body; | 85 std::vector<BodyItem> body; |
90 | 86 |
91 // If you add more stuff here, be sure to modify the serialization rules in | 87 // If you add more stuff here, be sure to modify the serialization rules in |
92 // ppapi_messages.h | 88 // ppapi_messages.h |
93 }; | 89 }; |
94 | 90 |
95 } // namespace ppapi | 91 } // namespace ppapi |
96 | 92 |
97 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ | 93 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
OLD | NEW |