OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "components/webdata/common/web_data_request_manager.h" | 5 #include "components/webdata/common/web_data_request_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
9 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| 11 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
11 | 13 |
12 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
13 // | 15 // |
14 // WebDataRequest implementation. | 16 // WebDataRequest implementation. |
15 // | 17 // |
16 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
17 | 19 |
18 WebDataRequest::WebDataRequest(WebDataServiceConsumer* consumer, | 20 WebDataRequest::WebDataRequest(WebDataServiceConsumer* consumer, |
19 WebDataRequestManager* manager) | 21 WebDataRequestManager* manager) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 NOTREACHED() << "Canceling a nonexistent web data service request"; | 106 NOTREACHED() << "Canceling a nonexistent web data service request"; |
105 return; | 107 return; |
106 } | 108 } |
107 i->second->Cancel(); | 109 i->second->Cancel(); |
108 pending_requests_.erase(i); | 110 pending_requests_.erase(i); |
109 } | 111 } |
110 | 112 |
111 void WebDataRequestManager::RequestCompleted( | 113 void WebDataRequestManager::RequestCompleted( |
112 scoped_ptr<WebDataRequest> request) { | 114 scoped_ptr<WebDataRequest> request) { |
113 base::MessageLoop* loop = request->GetMessageLoop(); | 115 base::MessageLoop* loop = request->GetMessageLoop(); |
114 loop->PostTask(FROM_HERE, | 116 loop->task_runner()->PostTask( |
115 base::Bind(&WebDataRequestManager::RequestCompletedOnThread, | 117 FROM_HERE, base::Bind(&WebDataRequestManager::RequestCompletedOnThread, |
116 this, | 118 this, base::Passed(&request))); |
117 base::Passed(&request))); | |
118 } | 119 } |
119 | 120 |
120 void WebDataRequestManager::RequestCompletedOnThread( | 121 void WebDataRequestManager::RequestCompletedOnThread( |
121 scoped_ptr<WebDataRequest> request) { | 122 scoped_ptr<WebDataRequest> request) { |
122 if (request->IsCancelled()) | 123 if (request->IsCancelled()) |
123 return; | 124 return; |
124 | 125 |
125 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 126 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
126 // fixed. | 127 // fixed. |
127 tracked_objects::ScopedTracker tracking_profile1( | 128 tracked_objects::ScopedTracker tracking_profile1( |
(...skipping 22 matching lines...) Expand all Loading... |
150 if (!request->IsCancelled()) { | 151 if (!request->IsCancelled()) { |
151 WebDataServiceConsumer* consumer = request->GetConsumer(); | 152 WebDataServiceConsumer* consumer = request->GetConsumer(); |
152 request->OnComplete(); | 153 request->OnComplete(); |
153 if (consumer) { | 154 if (consumer) { |
154 scoped_ptr<WDTypedResult> r = request->GetResult(); | 155 scoped_ptr<WDTypedResult> r = request->GetResult(); |
155 consumer->OnWebDataServiceRequestDone(request->GetHandle(), r.get()); | 156 consumer->OnWebDataServiceRequestDone(request->GetHandle(), r.get()); |
156 } | 157 } |
157 } | 158 } |
158 | 159 |
159 } | 160 } |
OLD | NEW |