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 #include "ppapi/proxy/nacl_message_scanner.h" | 5 #include "ppapi/proxy/nacl_message_scanner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <tuple> |
9 #include <utility> | 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
15 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
17 #include "ppapi/proxy/resource_message_params.h" | 18 #include "ppapi/proxy/resource_message_params.h" |
18 #include "ppapi/proxy/serialized_handle.h" | 19 #include "ppapi/proxy/serialized_handle.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 template <class T> | 158 template <class T> |
158 void ScanParam(const T& param, ScanningResults* results) { | 159 void ScanParam(const T& param, ScanningResults* results) { |
159 if (results->new_msg) | 160 if (results->new_msg) |
160 IPC::WriteParam(results->new_msg.get(), param); | 161 IPC::WriteParam(results->new_msg.get(), param); |
161 } | 162 } |
162 | 163 |
163 // These just break apart the given tuple and run ScanParam over each param. | 164 // These just break apart the given tuple and run ScanParam over each param. |
164 // The idea is to scan elements in the tuple which require special handling, | 165 // The idea is to scan elements in the tuple which require special handling, |
165 // and write them into the |results| struct. | 166 // and write them into the |results| struct. |
166 template <class A> | 167 template <class A> |
167 void ScanTuple(const base::Tuple<A>& t1, ScanningResults* results) { | 168 void ScanTuple(const std::tuple<A>& t1, ScanningResults* results) { |
168 ScanParam(base::get<0>(t1), results); | 169 ScanParam(std::get<0>(t1), results); |
169 } | 170 } |
170 template <class A, class B> | 171 template <class A, class B> |
171 void ScanTuple(const base::Tuple<A, B>& t1, ScanningResults* results) { | 172 void ScanTuple(const std::tuple<A, B>& t1, ScanningResults* results) { |
172 ScanParam(base::get<0>(t1), results); | 173 ScanParam(std::get<0>(t1), results); |
173 ScanParam(base::get<1>(t1), results); | 174 ScanParam(std::get<1>(t1), results); |
174 } | 175 } |
175 template <class A, class B, class C> | 176 template <class A, class B, class C> |
176 void ScanTuple(const base::Tuple<A, B, C>& t1, ScanningResults* results) { | 177 void ScanTuple(const std::tuple<A, B, C>& t1, ScanningResults* results) { |
177 ScanParam(base::get<0>(t1), results); | 178 ScanParam(std::get<0>(t1), results); |
178 ScanParam(base::get<1>(t1), results); | 179 ScanParam(std::get<1>(t1), results); |
179 ScanParam(base::get<2>(t1), results); | 180 ScanParam(std::get<2>(t1), results); |
180 } | 181 } |
181 template <class A, class B, class C, class D> | 182 template <class A, class B, class C, class D> |
182 void ScanTuple(const base::Tuple<A, B, C, D>& t1, ScanningResults* results) { | 183 void ScanTuple(const std::tuple<A, B, C, D>& t1, ScanningResults* results) { |
183 ScanParam(base::get<0>(t1), results); | 184 ScanParam(std::get<0>(t1), results); |
184 ScanParam(base::get<1>(t1), results); | 185 ScanParam(std::get<1>(t1), results); |
185 ScanParam(base::get<2>(t1), results); | 186 ScanParam(std::get<2>(t1), results); |
186 ScanParam(base::get<3>(t1), results); | 187 ScanParam(std::get<3>(t1), results); |
187 } | 188 } |
188 | 189 |
189 template <class MessageType> | 190 template <class MessageType> |
190 class MessageScannerImpl { | 191 class MessageScannerImpl { |
191 public: | 192 public: |
192 explicit MessageScannerImpl(const IPC::Message* msg) | 193 explicit MessageScannerImpl(const IPC::Message* msg) |
193 // The cast below is invalid. See https://crbug.com/520760. | 194 // The cast below is invalid. See https://crbug.com/520760. |
194 : msg_(static_cast<const MessageType*>(msg)) { | 195 : msg_(static_cast<const MessageType*>(msg)) { |
195 } | 196 } |
196 bool ScanMessage(ScanningResults* results) { | 197 bool ScanMessage(ScanningResults* results) { |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 fio_it->second->SetMaxWrittenOffset(offset_it->second); | 562 fio_it->second->SetMaxWrittenOffset(offset_it->second); |
562 } | 563 } |
563 } | 564 } |
564 break; | 565 break; |
565 } | 566 } |
566 } | 567 } |
567 } | 568 } |
568 | 569 |
569 } // namespace proxy | 570 } // namespace proxy |
570 } // namespace ppapi | 571 } // namespace ppapi |
OLD | NEW |