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

Unified Diff: mojo/loader/loader.cc

Issue 27943002: Teach mojo_shell how to load http URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | mojo/loader/url_request_context_getter.h » ('j') | mojo/loader/url_request_context_getter.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/loader/loader.cc
diff --git a/mojo/loader/loader.cc b/mojo/loader/loader.cc
index 1ab1ebf66a964b38e2dc62cd51a775f1a449406c..c78c6d2beebe8954c45dd8bcd3bb99fbd97c755a 100644
--- a/mojo/loader/loader.cc
+++ b/mojo/loader/loader.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
+#include "base/threading/thread.h"
#include "mojo/loader/loader.h"
#include "mojo/loader/url_request_context_getter.h"
#include "net/url_request/url_fetcher.h"
@@ -30,6 +31,14 @@ void FetchDelegate::OnURLFetchComplete(const net::URLFetcher* source) {
delete this;
}
+scoped_ptr<base::Thread> CreateIOThread(const char* name) {
+ scoped_ptr<base::Thread> thread(new base::Thread(name));
+ base::Thread::Options options;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
+ thread->StartWithOptions(options);
+ return thread.Pass();
+}
+
}
class Loader::Data {
@@ -37,11 +46,18 @@ public:
Data();
~Data();
+ scoped_ptr<base::Thread> network_thread_;
+ scoped_ptr<base::Thread> cache_thread_;
scoped_refptr<URLRequestContextGetter> url_request_context_getter;
};
-Loader::Data::Data()
- : url_request_context_getter(new URLRequestContextGetter()) {
+Loader::Data::Data() {
+ network_thread_ = CreateIOThread("network_thread");
+ cache_thread_ = CreateIOThread("cache_thread");
+
+ url_request_context_getter = new URLRequestContextGetter(
+ network_thread_->message_loop_proxy(),
+ cache_thread_->message_loop_proxy());
}
Loader::Data::~Data() {
« no previous file with comments | « no previous file | mojo/loader/url_request_context_getter.h » ('j') | mojo/loader/url_request_context_getter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698