| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2014 The Chromium OS 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 "request.h" | 5 #include "request.h" | 
| 6 | 6 | 
| 7 #include <sstream> | 7 #include <sstream> | 
| 8 | 8 | 
| 9 namespace { | 9 namespace { | 
| 10 | 10 | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108 | 108 | 
| 109   std::stringstream ss_length; | 109   std::stringstream ss_length; | 
| 110   ss_length << length; | 110   ss_length << length; | 
| 111   request.Set(request::key::kLength, ss_length.str()); | 111   request.Set(request::key::kLength, ss_length.str()); | 
| 112   return request; | 112   return request; | 
| 113 } | 113 } | 
| 114 | 114 | 
| 115 pp::VarDictionary request::CreateWriteChunkRequest( | 115 pp::VarDictionary request::CreateWriteChunkRequest( | 
| 116     int compressor_id, | 116     int compressor_id, | 
| 117     const pp::VarArrayBuffer& array_buffer, | 117     const pp::VarArrayBuffer& array_buffer, | 
|  | 118     int64_t offset, | 
| 118     int64_t length) { | 119     int64_t length) { | 
| 119   pp::VarDictionary request; | 120   pp::VarDictionary request; | 
| 120   request.Set(request::key::kOperation, WRITE_CHUNK); | 121   request.Set(request::key::kOperation, WRITE_CHUNK); | 
| 121   request.Set(request::key::kCompressorId, compressor_id); | 122   request.Set(request::key::kCompressorId, compressor_id); | 
| 122 | 123 | 
| 123   request.Set(request::key::kChunkBuffer, array_buffer); | 124   request.Set(request::key::kChunkBuffer, array_buffer); | 
|  | 125 | 
|  | 126   std::stringstream ss_offset; | 
|  | 127   ss_offset << offset; | 
|  | 128   request.Set(request::key::kOffset, ss_offset.str()); | 
| 124   std::stringstream ss_length; | 129   std::stringstream ss_length; | 
| 125   ss_length << length; | 130   ss_length << length; | 
| 126   request.Set(request::key::kLength, ss_length.str()); | 131   request.Set(request::key::kLength, ss_length.str()); | 
| 127   return request; | 132   return request; | 
| 128 } | 133 } | 
| 129 | 134 | 
| 130 pp::VarDictionary request::CreateAddToArchiveDoneResponse(int compressor_id) { | 135 pp::VarDictionary request::CreateAddToArchiveDoneResponse(int compressor_id) { | 
| 131   pp::VarDictionary request; | 136   pp::VarDictionary request; | 
| 132   request.Set(request::key::kOperation, ADD_TO_ARCHIVE_DONE); | 137   request.Set(request::key::kOperation, ADD_TO_ARCHIVE_DONE); | 
| 133   request.Set(request::key::kCompressorId, compressor_id); | 138   request.Set(request::key::kCompressorId, compressor_id); | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 177   return request; | 182   return request; | 
| 178 } | 183 } | 
| 179 | 184 | 
| 180 int64_t request::GetInt64FromString(const pp::VarDictionary& dictionary, | 185 int64_t request::GetInt64FromString(const pp::VarDictionary& dictionary, | 
| 181                                     const std::string& request_key) { | 186                                     const std::string& request_key) { | 
| 182   std::stringstream ss_int64(dictionary.Get(request_key).AsString()); | 187   std::stringstream ss_int64(dictionary.Get(request_key).AsString()); | 
| 183   int64_t int64_value; | 188   int64_t int64_value; | 
| 184   ss_int64 >> int64_value; | 189   ss_int64 >> int64_value; | 
| 185   return int64_value; | 190   return int64_value; | 
| 186 } | 191 } | 
| OLD | NEW | 
|---|