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

Unified Diff: content/browser/webui/url_data_manager_backend.cc

Issue 1273813005: Revert of Fix cancellation of a pair of URLRequestJob subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/webui/url_data_manager_backend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/url_data_manager_backend.cc
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc
index d6434f03707d775510f705c695aa21536a26dd19..ba1f5d4646e05e7298698d9320121da7aa85489b 100644
--- a/content/browser/webui/url_data_manager_backend.cc
+++ b/content/browser/webui/url_data_manager_backend.cc
@@ -111,7 +111,8 @@
// chrome-internal resource requests asynchronously.
// It hands off URL requests to ChromeURLDataManager, which asynchronously
// calls back once the data is available.
-class URLRequestChromeJob : public net::URLRequestJob {
+class URLRequestChromeJob : public net::URLRequestJob,
+ public base::SupportsWeakPtr<URLRequestChromeJob> {
public:
// |is_incognito| set when job is generated from an incognito profile.
URLRequestChromeJob(net::URLRequest* request,
@@ -133,9 +134,6 @@
// Called by ChromeURLDataManager to notify us that the data blob is ready
// for us.
void DataAvailable(base::RefCountedMemory* bytes);
-
- // Returns a weak pointer to the job.
- base::WeakPtr<URLRequestChromeJob> AsWeakPtr();
void set_mime_type(const std::string& mime_type) {
mime_type_ = mime_type;
@@ -269,16 +267,13 @@
BrowserThread::UI,
FROM_HERE,
base::Bind(&URLRequestChromeJob::CheckStoragePartitionMatches,
- render_process_id, request_->url(),
- weak_factory_.GetWeakPtr()));
+ render_process_id, request_->url(), AsWeakPtr()));
TRACE_EVENT_ASYNC_BEGIN1("browser", "DataManager:Request", this, "URL",
request_->url().possibly_invalid_spec());
}
void URLRequestChromeJob::Kill() {
- weak_factory_.InvalidateWeakPtrs();
backend_->RemoveRequest(this);
- URLRequestJob::Kill();
}
bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const {
@@ -352,10 +347,6 @@
NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
net::ERR_FAILED));
}
-}
-
-base::WeakPtr<URLRequestChromeJob> URLRequestChromeJob::AsWeakPtr() {
- return weak_factory_.GetWeakPtr();
}
bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size,
« no previous file with comments | « no previous file | content/browser/webui/url_data_manager_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698