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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Abort all of the active requests. | 42 // Abort all of the active requests. |
43 RequestMap::iterator it = requests_.begin(); | 43 RequestMap::iterator it = requests_.begin(); |
44 while (it != requests_.end()) { | 44 while (it != requests_.end()) { |
45 const int request_id = it->first; | 45 const int request_id = it->first; |
46 ++it; | 46 ++it; |
47 RejectRequest(request_id, std::unique_ptr<RequestValue>(new RequestValue()), | 47 RejectRequest(request_id, std::unique_ptr<RequestValue>(new RequestValue()), |
48 base::File::FILE_ERROR_ABORT); | 48 base::File::FILE_ERROR_ABORT); |
49 } | 49 } |
50 | 50 |
51 DCHECK_EQ(0u, requests_.size()); | 51 DCHECK_EQ(0u, requests_.size()); |
52 STLDeleteValues(&requests_); | 52 base::STLDeleteValues(&requests_); |
53 } | 53 } |
54 | 54 |
55 int RequestManager::CreateRequest(RequestType type, | 55 int RequestManager::CreateRequest(RequestType type, |
56 std::unique_ptr<HandlerInterface> handler) { | 56 std::unique_ptr<HandlerInterface> handler) { |
57 // The request id is unique per request manager, so per service, thereof | 57 // The request id is unique per request manager, so per service, thereof |
58 // per profile. | 58 // per profile. |
59 int request_id = next_id_++; | 59 int request_id = next_id_++; |
60 | 60 |
61 // If cycled the int, then signal an error. | 61 // If cycled the int, then signal an error. |
62 if (requests_.find(request_id) != requests_.end()) | 62 if (requests_.find(request_id) != requests_.end()) |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 notification_manager_->HideUnresponsiveNotification(request_id); | 258 notification_manager_->HideUnresponsiveNotification(request_id); |
259 | 259 |
260 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id)); | 260 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id)); |
261 | 261 |
262 TRACE_EVENT_ASYNC_END0( | 262 TRACE_EVENT_ASYNC_END0( |
263 "file_system_provider", "RequestManager::Request", request_id); | 263 "file_system_provider", "RequestManager::Request", request_id); |
264 } | 264 } |
265 | 265 |
266 } // namespace file_system_provider | 266 } // namespace file_system_provider |
267 } // namespace chromeos | 267 } // namespace chromeos |
OLD | NEW |