Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/request_manager.cc

Issue 301873002: [fsp] Show request logs in chrome://provided-file-systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
11 namespace file_system_provider { 11 namespace file_system_provider {
12
13 namespace { 12 namespace {
14 13
15 // Timeout in seconds, before a request is considered as stale and hence 14 // Timeout in seconds, before a request is considered as stale and hence
16 // aborted. 15 // aborted.
17 const int kDefaultTimeout = 10; 16 const int kDefaultTimeout = 10;
18 17
19 } // namespace 18 } // namespace
20 19
20 std::string RequestTypeToString(RequestType type) {
21 switch (type) {
22 case REQUEST_UNMOUNT:
23 return "REQUEST_UNMOUNT";
24 case GET_METADATA:
25 return "GET_METADATA";
26 case READ_DIRECTORY:
27 return "READ_DIRECTORY";
28 case OPEN_FILE:
29 return "OPEN_FILE";
30 case CLOSE_FILE:
31 return "CLOSE_FILE";
32 case READ_FILE:
33 return "READ_FILE";
34 case TESTING:
35 return "TESTING";
36 }
37 NOTREACHED();
38 return "";
39 }
40
21 RequestManager::RequestManager() 41 RequestManager::RequestManager()
22 : next_id_(1), 42 : next_id_(1),
23 timeout_(base::TimeDelta::FromSeconds(kDefaultTimeout)), 43 timeout_(base::TimeDelta::FromSeconds(kDefaultTimeout)),
24 weak_ptr_factory_(this) {} 44 weak_ptr_factory_(this) {}
25 45
26 RequestManager::~RequestManager() { 46 RequestManager::~RequestManager() {
27 // Abort all of the active requests. 47 // Abort all of the active requests.
28 RequestMap::iterator it = requests_.begin(); 48 RequestMap::iterator it = requests_.begin();
29 while (it != requests_.end()) { 49 while (it != requests_.end()) {
30 const int request_id = it->first; 50 const int request_id = it->first;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return; 159 return;
140 160
141 delete request_it->second; 161 delete request_it->second;
142 requests_.erase(request_it); 162 requests_.erase(request_it);
143 163
144 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id)); 164 FOR_EACH_OBSERVER(Observer, observers_, OnRequestDestroyed(request_id));
145 } 165 }
146 166
147 } // namespace file_system_provider 167 } // namespace file_system_provider
148 } // namespace chromeos 168 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698