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

Side by Side Diff: content/browser/in_process_webkit/webkit_thread.cc

Issue 8879013: Deprecate WEBKIT thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update after rebase Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/browser/in_process_webkit/webkit_thread.h" 5 #include "content/browser/in_process_webkit/webkit_thread.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h " 8 #include "content/browser/in_process_webkit/browser_webkitplatformsupport_impl.h "
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_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 "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
12 #include "webkit/glue/webkit_glue.h" 12 #include "webkit/glue/webkit_glue.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 WebKitThread::WebKitThread() { 16 WebKitThread::WebKitThread() {
17 } 17 }
18 18
19 // This happens on the UI thread after the IO thread has been shut down. 19 // This happens on the UI thread after the IO thread has been shut down.
20 WebKitThread::~WebKitThread() { 20 WebKitThread::~WebKitThread() {
21 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests, 21 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests,
22 // MessageLoop::Current is sometimes NULL and other times valid and there's 22 // MessageLoop::Current is sometimes NULL and other times valid and there's
23 // no BrowserThread object. Can't check that CurrentlyOn is not IO since 23 // no BrowserThread object. Can't check that CurrentlyOn is not IO since
24 // some unit tests set that BrowserThread for other checks. 24 // some unit tests set that BrowserThread for other checks.
25 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 25 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
26 } 26 }
27 27
28 void WebKitThread::Initialize() { 28 void WebKitThread::Initialize() {
29 DCHECK(!webkit_thread_.get()); 29 DCHECK(!webkit_thread_.get());
30 30
31 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) { 31 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) {
32 // TODO(jorlow): We need a better story for single process mode. 32 // TODO(joth): As this cannot work in single process mode use of the
33 // webkit thread is deprecated; see http://crbug.com/106839.
33 return; 34 return;
34 } 35 }
35 36
36 webkit_thread_.reset(new InternalWebKitThread); 37 webkit_thread_.reset(new InternalWebKitThread);
37 bool started = webkit_thread_->Start(); 38 bool started = webkit_thread_->Start();
38 DCHECK(started); 39 DCHECK(started);
39 } 40 }
40 41
41 WebKitThread::InternalWebKitThread::InternalWebKitThread() 42 WebKitThread::InternalWebKitThread::InternalWebKitThread()
42 : content::BrowserThreadImpl(BrowserThread::WEBKIT) { 43 : content::BrowserThreadImpl(BrowserThread::WEBKIT_DEPRECATED) {
43 } 44 }
44 45
45 WebKitThread::InternalWebKitThread::~InternalWebKitThread() { 46 WebKitThread::InternalWebKitThread::~InternalWebKitThread() {
46 Stop(); 47 Stop();
47 } 48 }
48 49
49 void WebKitThread::InternalWebKitThread::Init() { 50 void WebKitThread::InternalWebKitThread::Init() {
50 DCHECK(!webkit_platform_support_.get()); 51 DCHECK(!webkit_platform_support_.get());
51 webkit_platform_support_.reset(new BrowserWebKitPlatformSupportImpl); 52 webkit_platform_support_.reset(new BrowserWebKitPlatformSupportImpl);
52 WebKit::initializeWithoutV8(webkit_platform_support_.get()); 53 WebKit::initializeWithoutV8(webkit_platform_support_.get());
53 webkit_glue::EnableWebCoreLogChannels( 54 webkit_glue::EnableWebCoreLogChannels(
54 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 55 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
55 switches::kWebCoreLogChannels)); 56 switches::kWebCoreLogChannels));
56 // Exercise WebSecurityOrigin to get its underlying statics initialized. 57 // Exercise WebSecurityOrigin to get its underlying statics initialized.
57 // TODO(michaeln): remove this when the following is landed. 58 // TODO(michaeln): remove this when the following is landed.
58 // https://bugs.webkit.org/show_bug.cgi?id=61145 59 // https://bugs.webkit.org/show_bug.cgi?id=61145
59 WebKit::WebSecurityOrigin::create(GURL("http://chromium.org")); 60 WebKit::WebSecurityOrigin::create(GURL("http://chromium.org"));
60 61
61 // If possible, post initialization tasks to this thread (rather than doing 62 // If possible, post initialization tasks to this thread (rather than doing
62 // them now) so we don't block the UI thread any longer than we have to. 63 // them now) so we don't block the UI thread any longer than we have to.
63 } 64 }
64 65
65 void WebKitThread::InternalWebKitThread::CleanUp() { 66 void WebKitThread::InternalWebKitThread::CleanUp() {
66 DCHECK(webkit_platform_support_.get()); 67 DCHECK(webkit_platform_support_.get());
67 WebKit::shutdown(); 68 WebKit::shutdown();
68 } 69 }
69 70
70 } // namespace content 71 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698