Commit c6a7b86c authored by dumi@chromium.org's avatar dumi@chromium.org

Add a file thread to the renderer process.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/3151029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56917 0039d316-1c4b-4281-b951-d872f2087c98
parent cef8f4b2
......@@ -307,6 +307,10 @@ RenderThread::~RenderThread() {
db_message_filter_ = NULL;
RemoveFilter(devtools_agent_filter_.get());
// Shutdown the file thread if it's running.
if (file_thread_.get())
file_thread_->Stop();
if (webkit_client_.get())
WebKit::shutdown();
......@@ -1100,3 +1104,13 @@ std::string RenderThread::GetExtensionIdByBrowseExtent(const GURL& url) {
return std::string();
}
scoped_refptr<base::MessageLoopProxy>
RenderThread::GetFileThreadMessageLoopProxy() {
DCHECK(message_loop() == MessageLoop::current());
if (!file_thread_.get()) {
file_thread_.reset(new base::Thread("Renderer::FILE"));
file_thread_->Start();
}
return file_thread_->message_loop_proxy();
}
......@@ -46,6 +46,11 @@ struct ViewMsg_ExtensionExtentsUpdated_Params;
struct ViewMsg_New_Params;
struct WebPreferences;
namespace base {
class MessageLoopProxy;
class Thread;
}
namespace IPC {
struct ChannelHandle;
}
......@@ -227,6 +232,11 @@ class RenderThread : public RenderThreadBase,
std::string GetExtensionIdByBrowseExtent(const GURL& url);
// Returns a MessageLoopProxy instance corresponding to the message loop
// of the thread on which file operations should be run. Must be called
// on the renderer's main thread.
scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy();
private:
virtual void OnControlMessageReceived(const IPC::Message& msg);
......@@ -365,6 +375,9 @@ class RenderThread : public RenderThreadBase,
struct ExtensionInfo;
std::vector<ExtensionInfo> extension_extents_;
// A lazily initiated thread on which file operations are run.
scoped_ptr<base::Thread> file_thread_;
DISALLOW_COPY_AND_ASSIGN(RenderThread);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment