OLD | NEW |
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_webkitclient_impl.h" | 8 #include "content/browser/in_process_webkit/browser_webkitclient_impl.h" |
9 #include "content/common/content_switches.h" | 9 #include "content/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 "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
12 | 13 |
13 WebKitThread::WebKitThread() { | 14 WebKitThread::WebKitThread() { |
14 } | 15 } |
15 | 16 |
16 // This happens on the UI thread after the IO thread has been shut down. | 17 // This happens on the UI thread after the IO thread has been shut down. |
17 WebKitThread::~WebKitThread() { | 18 WebKitThread::~WebKitThread() { |
18 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests, | 19 // We can't just check CurrentlyOn(BrowserThread::UI) because in unit tests, |
19 // MessageLoop::Current is sometimes NULL and other times valid and there's | 20 // MessageLoop::Current is sometimes NULL and other times valid and there's |
20 // no BrowserThread object. Can't check that CurrentlyOn is not IO since | 21 // no BrowserThread object. Can't check that CurrentlyOn is not IO since |
(...skipping 22 matching lines...) Expand all Loading... |
43 Stop(); | 44 Stop(); |
44 } | 45 } |
45 | 46 |
46 void WebKitThread::InternalWebKitThread::Init() { | 47 void WebKitThread::InternalWebKitThread::Init() { |
47 DCHECK(!webkit_client_.get()); | 48 DCHECK(!webkit_client_.get()); |
48 webkit_client_.reset(new BrowserWebKitClientImpl); | 49 webkit_client_.reset(new BrowserWebKitClientImpl); |
49 WebKit::initialize(webkit_client_.get()); | 50 WebKit::initialize(webkit_client_.get()); |
50 webkit_glue::EnableWebCoreLogChannels( | 51 webkit_glue::EnableWebCoreLogChannels( |
51 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 52 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
52 switches::kWebCoreLogChannels)); | 53 switches::kWebCoreLogChannels)); |
| 54 // Exercise WebSecurityOrigin to get its underlying statics initialized. |
| 55 // TODO(michaeln): remove this when the following is landed. |
| 56 // https://bugs.webkit.org/show_bug.cgi?id=61145 |
| 57 WebKit::WebSecurityOrigin::create(GURL("http://chromium.org")); |
53 | 58 |
54 // If possible, post initialization tasks to this thread (rather than doing | 59 // If possible, post initialization tasks to this thread (rather than doing |
55 // them now) so we don't block the UI thread any longer than we have to. | 60 // them now) so we don't block the UI thread any longer than we have to. |
56 } | 61 } |
57 | 62 |
58 void WebKitThread::InternalWebKitThread::CleanUp() { | 63 void WebKitThread::InternalWebKitThread::CleanUp() { |
59 DCHECK(webkit_client_.get()); | 64 DCHECK(webkit_client_.get()); |
60 WebKit::shutdown(); | 65 WebKit::shutdown(); |
61 } | 66 } |
OLD | NEW |