| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/common_param_traits.h" | 5 #include "content/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "content/common/content_constants.h" | 7 #include "content/common/content_constants.h" |
| 8 #include "net/base/host_port_pair.h" | 8 #include "net/base/host_port_pair.h" |
| 9 #include "net/base/upload_data.h" | 9 #include "net/base/upload_data.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 type = "UNKNOWN"; | 134 type = "UNKNOWN"; |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 | 137 |
| 138 LogParam(type, l); | 138 LogParam(type, l); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void ParamTraits<net::URLRequestStatus>::Write(Message* m, | 141 void ParamTraits<net::URLRequestStatus>::Write(Message* m, |
| 142 const param_type& p) { | 142 const param_type& p) { |
| 143 WriteParam(m, static_cast<int>(p.status())); | 143 WriteParam(m, static_cast<int>(p.status())); |
| 144 WriteParam(m, p.os_error()); | 144 WriteParam(m, p.error()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool ParamTraits<net::URLRequestStatus>::Read(const Message* m, void** iter, | 147 bool ParamTraits<net::URLRequestStatus>::Read(const Message* m, void** iter, |
| 148 param_type* r) { | 148 param_type* r) { |
| 149 int status, os_error; | 149 int status, error; |
| 150 if (!ReadParam(m, iter, &status) || | 150 if (!ReadParam(m, iter, &status) || !ReadParam(m, iter, &error)) |
| 151 !ReadParam(m, iter, &os_error)) | |
| 152 return false; | 151 return false; |
| 153 r->set_status(static_cast<net::URLRequestStatus::Status>(status)); | 152 r->set_status(static_cast<net::URLRequestStatus::Status>(status)); |
| 154 r->set_os_error(os_error); | 153 r->set_error(error); |
| 155 return true; | 154 return true; |
| 156 } | 155 } |
| 157 | 156 |
| 158 void ParamTraits<net::URLRequestStatus>::Log(const param_type& p, | 157 void ParamTraits<net::URLRequestStatus>::Log(const param_type& p, |
| 159 std::string* l) { | 158 std::string* l) { |
| 160 std::string status; | 159 std::string status; |
| 161 switch (p.status()) { | 160 switch (p.status()) { |
| 162 case net::URLRequestStatus::SUCCESS: | 161 case net::URLRequestStatus::SUCCESS: |
| 163 status = "SUCCESS"; | 162 status = "SUCCESS"; |
| 164 break; | 163 break; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 178 status = "UNKNOWN"; | 177 status = "UNKNOWN"; |
| 179 break; | 178 break; |
| 180 } | 179 } |
| 181 if (p.status() == net::URLRequestStatus::FAILED) | 180 if (p.status() == net::URLRequestStatus::FAILED) |
| 182 l->append("("); | 181 l->append("("); |
| 183 | 182 |
| 184 LogParam(status, l); | 183 LogParam(status, l); |
| 185 | 184 |
| 186 if (p.status() == net::URLRequestStatus::FAILED) { | 185 if (p.status() == net::URLRequestStatus::FAILED) { |
| 187 l->append(", "); | 186 l->append(", "); |
| 188 LogParam(p.os_error(), l); | 187 LogParam(p.error(), l); |
| 189 l->append(")"); | 188 l->append(")"); |
| 190 } | 189 } |
| 191 } | 190 } |
| 192 | 191 |
| 193 // Only the net::UploadData ParamTraits<> definition needs this definition, so | 192 // Only the net::UploadData ParamTraits<> definition needs this definition, so |
| 194 // keep this in the implementation file so we can forward declare UploadData in | 193 // keep this in the implementation file so we can forward declare UploadData in |
| 195 // the header. | 194 // the header. |
| 196 template <> | 195 template <> |
| 197 struct ParamTraits<net::UploadData::Element> { | 196 struct ParamTraits<net::UploadData::Element> { |
| 198 typedef net::UploadData::Element param_type; | 197 typedef net::UploadData::Element param_type; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 const SkBitmap_Data* bmp_data = | 558 const SkBitmap_Data* bmp_data = |
| 560 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 559 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
| 561 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 560 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
| 562 } | 561 } |
| 563 | 562 |
| 564 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 563 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
| 565 l->append("<SkBitmap>"); | 564 l->append("<SkBitmap>"); |
| 566 } | 565 } |
| 567 | 566 |
| 568 } // namespace IPC | 567 } // namespace IPC |
| OLD | NEW |