OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/request_manager.h" | 5 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 delete request; | 62 delete request; |
63 requests_.erase(request_id); | 63 requests_.erase(request_id); |
64 return 0; | 64 return 0; |
65 } | 65 } |
66 | 66 |
67 return request_id; | 67 return request_id; |
68 } | 68 } |
69 | 69 |
70 bool RequestManager::FulfillRequest(int request_id, | 70 bool RequestManager::FulfillRequest(int request_id, |
71 scoped_ptr<RequestValue> response, | 71 scoped_ptr<RequestValue> response, |
72 bool has_next) { | 72 bool has_more) { |
73 RequestMap::iterator request_it = requests_.find(request_id); | 73 RequestMap::iterator request_it = requests_.find(request_id); |
74 | 74 |
75 if (request_it == requests_.end()) | 75 if (request_it == requests_.end()) |
76 return false; | 76 return false; |
77 | 77 |
78 request_it->second->handler->OnSuccess(request_id, response.Pass(), has_next); | 78 request_it->second->handler->OnSuccess(request_id, response.Pass(), has_more); |
79 if (!has_next) { | 79 if (!has_more) { |
80 delete request_it->second; | 80 delete request_it->second; |
81 requests_.erase(request_it); | 81 requests_.erase(request_it); |
82 } else { | 82 } else { |
83 request_it->second->timeout_timer.Reset(); | 83 request_it->second->timeout_timer.Reset(); |
84 } | 84 } |
85 | 85 |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 bool RequestManager::RejectRequest(int request_id, base::File::Error error) { | 89 bool RequestManager::RejectRequest(int request_id, base::File::Error error) { |
(...skipping 20 matching lines...) Expand all Loading... |
110 size_t RequestManager::GetActiveRequestsForLogging() const { | 110 size_t RequestManager::GetActiveRequestsForLogging() const { |
111 return requests_.size(); | 111 return requests_.size(); |
112 } | 112 } |
113 | 113 |
114 RequestManager::Request::Request() {} | 114 RequestManager::Request::Request() {} |
115 | 115 |
116 RequestManager::Request::~Request() {} | 116 RequestManager::Request::~Request() {} |
117 | 117 |
118 } // namespace file_system_provider | 118 } // namespace file_system_provider |
119 } // namespace chromeos | 119 } // namespace chromeos |
OLD | NEW |