| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "WebKit.h" | 32 #include "WebKit.h" |
| 33 | 33 |
| 34 #include "WebMediaPlayerClientImpl.h" | 34 #include "WebMediaPlayerClientImpl.h" |
| 35 #include "WebString.h" | 35 #include "WebString.h" |
| 36 | 36 |
| 37 #include "AtomicString.h" | 37 #include "AtomicString.h" |
| 38 #include "DOMTimer.h" | 38 #include "DOMTimer.h" |
| 39 #include "FrameLoader.h" | 39 #include "FrameLoader.h" |
| 40 #include "Page.h" | 40 #include "Page.h" |
| 41 #include "TextEncoding.h" |
| 41 #include "V8Binding.h" | 42 #include "V8Binding.h" |
| 42 #include "V8Proxy.h" | 43 #include "V8Proxy.h" |
| 43 #include "WorkerContextExecutionProxy.h" | 44 #include "WorkerContextExecutionProxy.h" |
| 44 #include <wtf/Assertions.h> | 45 #include <wtf/Assertions.h> |
| 45 #include <wtf/Threading.h> | 46 #include <wtf/Threading.h> |
| 46 | 47 |
| 47 namespace WebKit { | 48 namespace WebKit { |
| 48 | 49 |
| 49 static WebKitClient* s_webKitClient = 0; | 50 static WebKitClient* s_webKitClient = 0; |
| 50 static bool s_layoutTestMode = false; | 51 static bool s_layoutTestMode = false; |
| 51 static bool s_databasesEnabled = false; | 52 static bool s_databasesEnabled = false; |
| 52 | 53 |
| 53 void initialize(WebKitClient* webKitClient) | 54 void initialize(WebKitClient* webKitClient) |
| 54 { | 55 { |
| 55 ASSERT(webKitClient); | 56 ASSERT(webKitClient); |
| 56 ASSERT(!s_webKitClient); | 57 ASSERT(!s_webKitClient); |
| 57 s_webKitClient = webKitClient; | 58 s_webKitClient = webKitClient; |
| 58 | 59 |
| 59 WTF::initializeThreading(); | 60 WTF::initializeThreading(); |
| 60 WebCore::AtomicString::init(); | 61 WebCore::AtomicString::init(); |
| 61 | 62 |
| 62 // Chromium sets the minimum interval timeout to 4ms, overriding the | 63 // Chromium sets the minimum interval timeout to 4ms, overriding the |
| 63 // default of 10ms. We'd like to go lower, however there are poorly | 64 // default of 10ms. We'd like to go lower, however there are poorly |
| 64 // coded websites out there which do create CPU-spinning loops. Using | 65 // coded websites out there which do create CPU-spinning loops. Using |
| 65 // 4ms prevents the CPU from spinning too busily and provides a balance | 66 // 4ms prevents the CPU from spinning too busily and provides a balance |
| 66 // between CPU spinning and the smallest possible interval timer. | 67 // between CPU spinning and the smallest possible interval timer. |
| 67 WebCore::DOMTimer::setMinTimerInterval(0.004); | 68 WebCore::DOMTimer::setMinTimerInterval(0.004); |
| 69 |
| 70 // There are some code paths (for example, running WebKit in the browser |
| 71 // process and calling into LocalStorage before anything else) where the |
| 72 // UTF8 string encoding tables are used on a background thread before |
| 73 // they're set up. This is a problem because their set up routines assert |
| 74 // they're running on the main WebKitThread. It might be possible to make |
| 75 // the initialization thread-safe, but given that so many code paths use |
| 76 // this, initializing this lazily probably doesn't buy us much. |
| 77 WebCore::UTF8Encoding(); |
| 68 } | 78 } |
| 69 | 79 |
| 70 void shutdown() | 80 void shutdown() |
| 71 { | 81 { |
| 72 s_webKitClient = 0; | 82 s_webKitClient = 0; |
| 73 } | 83 } |
| 74 | 84 |
| 75 WebKitClient* webKitClient() | 85 WebKitClient* webKitClient() |
| 76 { | 86 { |
| 77 return s_webKitClient; | 87 return s_webKitClient; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 { | 151 { |
| 142 return s_databasesEnabled; | 152 return s_databasesEnabled; |
| 143 } | 153 } |
| 144 | 154 |
| 145 void enableV8SingleThreadMode() | 155 void enableV8SingleThreadMode() |
| 146 { | 156 { |
| 147 WebCore::enableStringImplCache(); | 157 WebCore::enableStringImplCache(); |
| 148 } | 158 } |
| 149 | 159 |
| 150 } // namespace WebKit | 160 } // namespace WebKit |
| OLD | NEW |