| 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 "nacl_io/httpfs/http_fs_node.h" | 5 #include "nacl_io/httpfs/http_fs_node.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 : Node(filesystem), | 214 : Node(filesystem), |
| 215 url_(url), | 215 url_(url), |
| 216 buffer_(NULL), | 216 buffer_(NULL), |
| 217 buffer_len_(0), | 217 buffer_len_(0), |
| 218 cache_content_(cache_content), | 218 cache_content_(cache_content), |
| 219 has_cached_size_(false) { | 219 has_cached_size_(false) { |
| 220 // http nodes are read-only by default | 220 // http nodes are read-only by default |
| 221 SetMode(S_IRALL); | 221 SetMode(S_IRALL); |
| 222 } | 222 } |
| 223 | 223 |
| 224 HttpFsNode::~HttpFsNode() { |
| 225 free(buffer_); |
| 226 } |
| 227 |
| 224 Error HttpFsNode::GetStat_Locked(struct stat* stat) { | 228 Error HttpFsNode::GetStat_Locked(struct stat* stat) { |
| 225 // Assume we need to 'HEAD' if we do not know the size, otherwise, assume | 229 // Assume we need to 'HEAD' if we do not know the size, otherwise, assume |
| 226 // that the information is constant. We can add a timeout if needed. | 230 // that the information is constant. We can add a timeout if needed. |
| 227 HttpFs* filesystem = static_cast<HttpFs*>(filesystem_); | 231 HttpFs* filesystem = static_cast<HttpFs*>(filesystem_); |
| 228 if (!has_cached_size_ || !filesystem->cache_stat_) { | 232 if (!has_cached_size_ || !filesystem->cache_stat_) { |
| 229 StringMap_t headers; | 233 StringMap_t headers; |
| 230 ScopedResource loader(filesystem_->ppapi()); | 234 ScopedResource loader(filesystem_->ppapi()); |
| 231 ScopedResource request(filesystem_->ppapi()); | 235 ScopedResource request(filesystem_->ppapi()); |
| 232 ScopedResource response(filesystem_->ppapi()); | 236 ScopedResource response(filesystem_->ppapi()); |
| 233 int32_t statuscode; | 237 int32_t statuscode; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 assert(bytes_read <= bytes_to_read); | 660 assert(bytes_read <= bytes_to_read); |
| 657 bytes_to_read -= bytes_read; | 661 bytes_to_read -= bytes_read; |
| 658 out_buffer += bytes_read; | 662 out_buffer += bytes_read; |
| 659 } | 663 } |
| 660 | 664 |
| 661 *out_bytes = count; | 665 *out_bytes = count; |
| 662 return 0; | 666 return 0; |
| 663 } | 667 } |
| 664 | 668 |
| 665 } // namespace nacl_io | 669 } // namespace nacl_io |
| OLD | NEW |