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 <vector> | 7 #include <vector> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 template <class T> | 142 template <class T> |
143 void ScanParam(const T& param, ScanningResults* results) { | 143 void ScanParam(const T& param, ScanningResults* results) { |
144 if (results->new_msg) | 144 if (results->new_msg) |
145 IPC::WriteParam(results->new_msg.get(), param); | 145 IPC::WriteParam(results->new_msg.get(), param); |
146 } | 146 } |
147 | 147 |
148 // These just break apart the given tuple and run ScanParam over each param. | 148 // These just break apart the given tuple and run ScanParam over each param. |
149 // The idea is to scan elements in the tuple which require special handling, | 149 // The idea is to scan elements in the tuple which require special handling, |
150 // and write them into the |results| struct. | 150 // and write them into the |results| struct. |
151 template <class A> | 151 template <class A> |
152 void ScanTuple(const Tuple1<A>& t1, ScanningResults* results) { | 152 void ScanTuple(const Tuple<A>& t1, ScanningResults* results) { |
153 ScanParam(t1.a, results); | 153 ScanParam(get<0>(t1), results); |
154 } | 154 } |
155 template <class A, class B> | 155 template <class A, class B> |
156 void ScanTuple(const Tuple2<A, B>& t1, ScanningResults* results) { | 156 void ScanTuple(const Tuple<A, B>& t1, ScanningResults* results) { |
157 ScanParam(t1.a, results); | 157 ScanParam(get<0>(t1), results); |
158 ScanParam(t1.b, results); | 158 ScanParam(get<1>(t1), results); |
159 } | 159 } |
160 template <class A, class B, class C> | 160 template <class A, class B, class C> |
161 void ScanTuple(const Tuple3<A, B, C>& t1, ScanningResults* results) { | 161 void ScanTuple(const Tuple<A, B, C>& t1, ScanningResults* results) { |
162 ScanParam(t1.a, results); | 162 ScanParam(get<0>(t1), results); |
163 ScanParam(t1.b, results); | 163 ScanParam(get<1>(t1), results); |
164 ScanParam(t1.c, results); | 164 ScanParam(get<2>(t1), results); |
165 } | 165 } |
166 template <class A, class B, class C, class D> | 166 template <class A, class B, class C, class D> |
167 void ScanTuple(const Tuple4<A, B, C, D>& t1, ScanningResults* results) { | 167 void ScanTuple(const Tuple<A, B, C, D>& t1, ScanningResults* results) { |
168 ScanParam(t1.a, results); | 168 ScanParam(get<0>(t1), results); |
169 ScanParam(t1.b, results); | 169 ScanParam(get<1>(t1), results); |
170 ScanParam(t1.c, results); | 170 ScanParam(get<2>(t1), results); |
171 ScanParam(t1.d, results); | 171 ScanParam(get<3>(t1), results); |
172 } | 172 } |
173 | 173 |
174 template <class MessageType> | 174 template <class MessageType> |
175 class MessageScannerImpl { | 175 class MessageScannerImpl { |
176 public: | 176 public: |
177 explicit MessageScannerImpl(const IPC::Message* msg) | 177 explicit MessageScannerImpl(const IPC::Message* msg) |
178 : msg_(static_cast<const MessageType*>(msg)) { | 178 : msg_(static_cast<const MessageType*>(msg)) { |
179 } | 179 } |
180 bool ScanMessage(ScanningResults* results) { | 180 bool ScanMessage(ScanningResults* results) { |
181 typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params; | 181 typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 fio_it->second->SetMaxWrittenOffset(offset_it->second); | 514 fio_it->second->SetMaxWrittenOffset(offset_it->second); |
515 } | 515 } |
516 } | 516 } |
517 break; | 517 break; |
518 } | 518 } |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 } // namespace proxy | 522 } // namespace proxy |
523 } // namespace ppapi | 523 } // namespace ppapi |
OLD | NEW |