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

Unified Diff: net/url_request/url_request_prepackaged_interceptor.h

Issue 508473002: Componentize component_updater: Move URLRequestPrepackagedInterceptor from content/ to net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 6 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
Index: net/url_request/url_request_prepackaged_interceptor.h
diff --git a/content/test/net/url_request_prepackaged_interceptor.h b/net/url_request/url_request_prepackaged_interceptor.h
similarity index 66%
rename from content/test/net/url_request_prepackaged_interceptor.h
rename to net/url_request/url_request_prepackaged_interceptor.h
index cc5736d9e2738cb332bf186c544e0fb555f130da..6adcc440f8e1f3102f64e168b475c7ce8bfab094 100644
--- a/content/test/net/url_request_prepackaged_interceptor.h
+++ b/net/url_request/url_request_prepackaged_interceptor.h
@@ -2,20 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
-#define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
+#ifndef NET_URL_REQUEST_URL_REQUEST_PREPACKAGED_INTERCEPTOR_H_
+#define NET_URL_REQUEST_URL_REQUEST_PREPACKAGED_INTERCEPTOR_H_
#include <string>
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
class GURL;
namespace base {
class FilePath;
+class TaskRunner;
}
-namespace content {
+namespace net {
// Intercepts HTTP requests and gives pre-defined responses to specified URLs.
// The pre-defined responses are loaded from files on disk. The interception
@@ -24,8 +26,11 @@ class URLRequestPrepackagedInterceptor {
public:
// Registers an interceptor for urls using |scheme| and |hostname|. Urls
// passed to "SetResponse" are required to use |scheme| and |hostname|.
- URLRequestPrepackagedInterceptor(const std::string& scheme,
- const std::string& hostname);
+ URLRequestPrepackagedInterceptor(
+ const std::string& scheme,
+ const std::string& hostname,
+ const scoped_refptr<base::TaskRunner>& io_task_runner,
Sorin Jianu 2014/08/26 20:32:52 Any reason we are passing ref counted pointers by
tommycli 2014/08/26 21:06:58 Quote from that page: The one exception is functi
Sorin Jianu 2014/08/26 23:31:50 ok, sg, using CS shows that passing scoped_refptr
+ const scoped_refptr<base::TaskRunner>& worker_task_runner);
virtual ~URLRequestPrepackagedInterceptor();
// When requests for |url| arrive, respond with the contents of |path|. The
@@ -46,8 +51,10 @@ class URLRequestPrepackagedInterceptor {
const std::string scheme_;
const std::string hostname_;
- // After creation, |delegate_| lives on the IO thread, and a task to delete
- // it is posted from ~URLRequestPrepackagedInterceptor().
+ const scoped_refptr<base::TaskRunner> io_task_runner_;
Sorin Jianu 2014/08/26 20:32:52 I wonder what is the meaning of the "const" object
tommycli 2014/08/26 21:06:58 I thought: After we initialize its value, it canno
Sorin Jianu 2014/08/26 23:31:49 I think this is a strange idiom. It is hard to cou
tommycli 2014/08/26 23:45:22 Oh I see. You're saying it gives the false impress
+
+ // After creation, |delegate_| lives on the thread of the |io_task_runner_|,
+ // and a task to delete it is posted from ~URLRequestPrepackagedInterceptor().
Delegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor);
@@ -58,12 +65,14 @@ class URLRequestPrepackagedInterceptor {
class URLLocalHostRequestPrepackagedInterceptor
: public URLRequestPrepackagedInterceptor {
public:
- URLLocalHostRequestPrepackagedInterceptor();
+ URLLocalHostRequestPrepackagedInterceptor(
+ const scoped_refptr<base::TaskRunner>& io_task_runner,
+ const scoped_refptr<base::TaskRunner>& worker_task_runner);
private:
DISALLOW_COPY_AND_ASSIGN(URLLocalHostRequestPrepackagedInterceptor);
};
-} // namespace content
+} // namespace net
-#endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
+#endif // NET_URL_REQUEST_URL_REQUEST_PREPACKAGED_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698