| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/chrome_url_data_manager.h" | 5 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // This scenario occurs with DataSources that make history requests. Such | 133 // This scenario occurs with DataSources that make history requests. Such |
| 134 // DataSources do a history query in |StartDataRequest| and the request is | 134 // DataSources do a history query in |StartDataRequest| and the request is |
| 135 // live until the object is deleted (history requests don't up the ref | 135 // live until the object is deleted (history requests don't up the ref |
| 136 // count). This means it's entirely possible for the DataSource to invoke | 136 // count). This means it's entirely possible for the DataSource to invoke |
| 137 // |SendResponse| between the time when there are no more refs and the time | 137 // |SendResponse| between the time when there are no more refs and the time |
| 138 // when the object is deleted. | 138 // when the object is deleted. |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 BrowserThread::PostTask( | 141 BrowserThread::PostTask( |
| 142 BrowserThread::IO, FROM_HERE, | 142 BrowserThread::IO, FROM_HERE, |
| 143 NewRunnableMethod(this, &DataSource::SendResponseOnIOThread, | 143 base::Bind(&DataSource::SendResponseOnIOThread, this, request_id, |
| 144 request_id, bytes_ptr)); | 144 bytes_ptr)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 MessageLoop* ChromeURLDataManager::DataSource::MessageLoopForRequestPath( | 147 MessageLoop* ChromeURLDataManager::DataSource::MessageLoopForRequestPath( |
| 148 const std::string& path) const { | 148 const std::string& path) const { |
| 149 return message_loop_; | 149 return message_loop_; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool ChromeURLDataManager::DataSource::ShouldReplaceExistingSource() const { | 152 bool ChromeURLDataManager::DataSource::ShouldReplaceExistingSource() const { |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 173 base::i18n::IsRTL() ? "rtl" : "ltr"); | 173 base::i18n::IsRTL() ? "rtl" : "ltr"); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( | 176 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( |
| 177 int request_id, | 177 int request_id, |
| 178 scoped_refptr<RefCountedMemory> bytes) { | 178 scoped_refptr<RefCountedMemory> bytes) { |
| 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 180 if (backend_) | 180 if (backend_) |
| 181 backend_->DataAvailable(request_id, bytes); | 181 backend_->DataAvailable(request_id, bytes); |
| 182 } | 182 } |
| OLD | NEW |