| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/in_process_webkit/webkit_thread.h" | 5 #include "chrome/browser/in_process_webkit/webkit_thread.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" | 8 #include "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 11 #include "webkit/glue/webkit_glue.h" |
| 11 | 12 |
| 12 WebKitThread::WebKitThread() { | 13 WebKitThread::WebKitThread() { |
| 13 } | 14 } |
| 14 | 15 |
| 15 // This happens on the UI thread after the IO thread has been shut down. | 16 // This happens on the UI thread after the IO thread has been shut down. |
| 16 WebKitThread::~WebKitThread() { | 17 WebKitThread::~WebKitThread() { |
| 17 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests, | 18 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests, |
| 18 // MessageLoop::Current is sometimes NULL and other times valid and there's | 19 // MessageLoop::Current is sometimes NULL and other times valid and there's |
| 19 // no BrowserThread object. Can't check that CurrentlyOn is not IO since | 20 // no BrowserThread object. Can't check that CurrentlyOn is not IO since |
| 20 // some unit tests set that BrowserThread for other checks. | 21 // some unit tests set that BrowserThread for other checks. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 } | 40 } |
| 40 | 41 |
| 41 WebKitThread::InternalWebKitThread::~InternalWebKitThread() { | 42 WebKitThread::InternalWebKitThread::~InternalWebKitThread() { |
| 42 Stop(); | 43 Stop(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void WebKitThread::InternalWebKitThread::Init() { | 46 void WebKitThread::InternalWebKitThread::Init() { |
| 46 DCHECK(!webkit_client_.get()); | 47 DCHECK(!webkit_client_.get()); |
| 47 webkit_client_.reset(new BrowserWebKitClientImpl); | 48 webkit_client_.reset(new BrowserWebKitClientImpl); |
| 48 WebKit::initialize(webkit_client_.get()); | 49 WebKit::initialize(webkit_client_.get()); |
| 50 webkit_glue::EnableWebCoreLogChannels( |
| 51 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 52 switches::kWebCoreLogChannels)); |
| 53 |
| 49 // If possible, post initialization tasks to this thread (rather than doing | 54 // If possible, post initialization tasks to this thread (rather than doing |
| 50 // them now) so we don't block the UI thread any longer than we have to. | 55 // them now) so we don't block the UI thread any longer than we have to. |
| 51 } | 56 } |
| 52 | 57 |
| 53 void WebKitThread::InternalWebKitThread::CleanUp() { | 58 void WebKitThread::InternalWebKitThread::CleanUp() { |
| 54 DCHECK(webkit_client_.get()); | 59 DCHECK(webkit_client_.get()); |
| 55 WebKit::shutdown(); | 60 WebKit::shutdown(); |
| 56 } | 61 } |
| OLD | NEW |