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

Side by Side Diff: content/public/browser/url_data_source.h

Issue 2476433002: Replace URLDataSource::MessageLoopForRequestPath() with TaskRunnerForRequestPath(). (Closed)
Patch Set: rebase off local branch Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_
6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ 6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "content/public/browser/resource_request_info.h" 14 #include "content/public/browser/resource_request_info.h"
14 15
15 namespace base { 16 namespace base {
16 class MessageLoop;
17 class RefCountedMemory; 17 class RefCountedMemory;
18 } 18 }
19 19
20 namespace net { 20 namespace net {
21 class URLRequest; 21 class URLRequest;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 class BrowserContext; 25 class BrowserContext;
26 26
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const std::string& path, 61 const std::string& path,
62 const ResourceRequestInfo::WebContentsGetter& wc_getter, 62 const ResourceRequestInfo::WebContentsGetter& wc_getter,
63 const GotDataCallback& callback) = 0; 63 const GotDataCallback& callback) = 0;
64 64
65 // Return the mimetype that should be sent with this response, or empty 65 // Return the mimetype that should be sent with this response, or empty
66 // string to specify no mime type. 66 // string to specify no mime type.
67 virtual std::string GetMimeType(const std::string& path) const = 0; 67 virtual std::string GetMimeType(const std::string& path) const = 0;
68 68
69 // The following methods are all called on the IO thread. 69 // The following methods are all called on the IO thread.
70 70
71 // Returns the MessageLoop on which the delegate wishes to have 71 // Returns the TaskRunner on which the delegate wishes to have
72 // StartDataRequest called to handle the request for |path|. The default 72 // StartDataRequest called to handle the request for |path|. The default
73 // implementation returns BrowserThread::UI. If the delegate does not care 73 // implementation returns BrowserThread::UI. If the delegate does not care
74 // which thread StartDataRequest is called on, this should return nullptr. 74 // which thread StartDataRequest is called on, this should return nullptr.
75 // It may be beneficial to return nullptr for requests that are safe to handle 75 // It may be beneficial to return nullptr for requests that are safe to handle
76 // directly on the IO thread. This can improve performance by satisfying such 76 // directly on the IO thread. This can improve performance by satisfying such
77 // requests more rapidly when there is a large amount of UI thread contention. 77 // requests more rapidly when there is a large amount of UI thread contention.
78 // Or the delegate can return a specific thread's Messageloop if they wish. 78 // Or the delegate can return a specific thread's TaskRunner if they wish.
79 virtual base::MessageLoop* MessageLoopForRequestPath( 79 virtual scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerForRequestPath(
80 const std::string& path) const; 80 const std::string& path) const;
81 81
82 // Returns true if the URLDataSource should replace an existing URLDataSource 82 // Returns true if the URLDataSource should replace an existing URLDataSource
83 // with the same name that has already been registered. The default is true. 83 // with the same name that has already been registered. The default is true.
84 // 84 //
85 // WARNING: this is invoked on the IO thread. 85 // WARNING: this is invoked on the IO thread.
86 // 86 //
87 // TODO: nuke this and convert all callers to not replace. 87 // TODO: nuke this and convert all callers to not replace.
88 virtual bool ShouldReplaceExistingSource() const; 88 virtual bool ShouldReplaceExistingSource() const;
89 89
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const net::URLRequest* request, 152 const net::URLRequest* request,
153 std::string* path) const {} 153 std::string* path) const {}
154 154
155 // Whether |path| is gzipped (and should be transmitted gzipped). 155 // Whether |path| is gzipped (and should be transmitted gzipped).
156 virtual bool IsGzipped(const std::string& path) const; 156 virtual bool IsGzipped(const std::string& path) const;
157 }; 157 };
158 158
159 } // namespace content 159 } // namespace content
160 160
161 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ 161 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_manager_backend.cc ('k') | content/public/browser/url_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698