OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #include "config.h" | |
32 #include "WebKit.h" | |
33 | |
34 #include "AtomicString.h" | |
35 #include "DOMTimer.h" | |
36 #include "Page.h" | |
37 #include "RuntimeEnabledFeatures.h" | |
38 #include "TextEncoding.h" | |
39 #include "WebMediaPlayerClientImpl.h" | |
40 #include "WebSocket.h" | |
41 #include "WorkerContextExecutionProxy.h" | |
42 | |
43 #include <wtf/Assertions.h> | |
44 #include <wtf/Threading.h> | |
45 | |
46 namespace WebKit { | |
47 | |
48 static WebKitClient* s_webKitClient = 0; | |
49 static bool s_layoutTestMode = false; | |
50 | |
51 void initialize(WebKitClient* webKitClient) | |
52 { | |
53 ASSERT(webKitClient); | |
54 ASSERT(!s_webKitClient); | |
55 s_webKitClient = webKitClient; | |
56 | |
57 WTF::initializeThreading(); | |
58 WebCore::AtomicString::init(); | |
59 | |
60 // Chromium sets the minimum interval timeout to 4ms, overriding the | |
61 // default of 10ms. We'd like to go lower, however there are poorly | |
62 // coded websites out there which do create CPU-spinning loops. Using | |
63 // 4ms prevents the CPU from spinning too busily and provides a balance | |
64 // between CPU spinning and the smallest possible interval timer. | |
65 WebCore::DOMTimer::setMinTimerInterval(0.004); | |
66 | |
67 // There are some code paths (for example, running WebKit in the browser | |
68 // process and calling into LocalStorage before anything else) where the | |
69 // UTF8 string encoding tables are used on a background thread before | |
70 // they're set up. This is a problem because their set up routines assert | |
71 // they're running on the main WebKitThread. It might be possible to make | |
72 // the initialization thread-safe, but given that so many code paths use | |
73 // this, initializing this lazily probably doesn't buy us much. | |
74 WebCore::UTF8Encoding(); | |
75 } | |
76 | |
77 void shutdown() | |
78 { | |
79 s_webKitClient = 0; | |
80 } | |
81 | |
82 WebKitClient* webKitClient() | |
83 { | |
84 return s_webKitClient; | |
85 } | |
86 | |
87 void setLayoutTestMode(bool value) | |
88 { | |
89 s_layoutTestMode = value; | |
90 } | |
91 | |
92 bool layoutTestMode() | |
93 { | |
94 return s_layoutTestMode; | |
95 } | |
96 | |
97 void resetPluginCache(bool reloadPages) | |
98 { | |
99 WebCore::Page::refreshPlugins(reloadPages); | |
100 } | |
101 | |
102 } // namespace WebKit | |
OLD | NEW |