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 #include "ppapi/proxy/serialized_var.h" | 5 #include "ppapi/proxy/serialized_var.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ipc/ipc_message_utils.h" | 8 #include "ipc/ipc_message_utils.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/proxy/dispatcher.h" | 10 #include "ppapi/proxy/dispatcher.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const HandleWriter& handle_writer) const { | 128 const HandleWriter& handle_writer) const { |
129 if (raw_var_data_) { | 129 if (raw_var_data_) { |
130 m->WriteBool(true); // Success. | 130 m->WriteBool(true); // Success. |
131 raw_var_data_->Write(m, handle_writer); | 131 raw_var_data_->Write(m, handle_writer); |
132 } else { | 132 } else { |
133 m->WriteBool(false); // Failure. | 133 m->WriteBool(false); // Failure. |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, | 137 bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, |
138 PickleIterator* iter) { | 138 base::PickleIterator* iter) { |
139 #ifndef NDEBUG | 139 #ifndef NDEBUG |
140 // We should only deserialize something once or will end up with leaked | 140 // We should only deserialize something once or will end up with leaked |
141 // references. | 141 // references. |
142 // | 142 // |
143 // One place this has happened in the past is using | 143 // One place this has happened in the past is using |
144 // std::vector<SerializedVar>.resize(). If you're doing this manually instead | 144 // std::vector<SerializedVar>.resize(). If you're doing this manually instead |
145 // of using the helper classes for handling in/out vectors of vars, be | 145 // of using the helper classes for handling in/out vectors of vars, be |
146 // sure you use the same pattern as the SerializedVarVector classes. | 146 // sure you use the same pattern as the SerializedVarVector classes. |
147 DCHECK(!has_been_deserialized_); | 147 DCHECK(!has_been_deserialized_); |
148 has_been_deserialized_ = true; | 148 has_been_deserialized_ = true; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 const std::string& str) { | 458 const std::string& str) { |
459 inner_->ForceSetVarValueForTest(StringVar::StringToPPVar(str)); | 459 inner_->ForceSetVarValueForTest(StringVar::StringToPPVar(str)); |
460 } | 460 } |
461 | 461 |
462 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var) | 462 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var) |
463 : SerializedVar(var) { | 463 : SerializedVar(var) { |
464 } | 464 } |
465 | 465 |
466 } // namespace proxy | 466 } // namespace proxy |
467 } // namespace ppapi | 467 } // namespace ppapi |
OLD | NEW |