diff options
author | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 00:03:15 +0000 |
---|---|---|
committer | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 00:03:15 +0000 |
commit | 426e871872cc12212843c3e2b457e86e2c7915b2 (patch) | |
tree | 958fdb08e292e3d4695b381f21575397fabbe2ef | |
parent | a08ac1bdab868bf55b71a9f246e4dcbf4deb11ff (diff) | |
download | chromium_src-426e871872cc12212843c3e2b457e86e2c7915b2.zip chromium_src-426e871872cc12212843c3e2b457e86e2c7915b2.tar.gz chromium_src-426e871872cc12212843c3e2b457e86e2c7915b2.tar.bz2 |
Move scripting / v8 related methods out of WebKit.h
BUG=24602
TEST=Compiled Webkit/Chromium
Review URL: http://codereview.chromium.org/275026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29218 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_thread.cc | 1 | ||||
-rw-r--r-- | chrome/test/render_view_test.cc | 1 | ||||
-rw-r--r-- | webkit/api/public/WebKit.h | 26 | ||||
-rw-r--r-- | webkit/api/public/WebScriptController.h | 67 | ||||
-rw-r--r-- | webkit/api/src/WebKit.cpp | 28 | ||||
-rw-r--r-- | webkit/api/src/WebScriptController.cpp | 67 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_webkit_init.h | 1 |
9 files changed, 139 insertions, 54 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 268d0b4..bf6e3ac 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -51,6 +51,7 @@ #include "webkit/api/public/WebFontCache.h" #include "webkit/api/public/WebColor.h" #include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptController.h" #include "webkit/api/public/WebStorageEventDispatcher.h" #include "webkit/api/public/WebString.h" #include "webkit/extensions/v8/benchmarking_extension.h" diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 54fde06..8dac8c0 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -17,6 +17,7 @@ #include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebInputEvent.h" #include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptController.h" #include "webkit/api/public/WebScriptSource.h" #include "webkit/api/public/WebURLRequest.h" #include "webkit/glue/webview.h" diff --git a/webkit/api/public/WebKit.h b/webkit/api/public/WebKit.h index 93c8625..d6d3e11 100644 --- a/webkit/api/public/WebKit.h +++ b/webkit/api/public/WebKit.h @@ -34,10 +34,6 @@ #include "WebCommon.h" #include "WebURL.h" -namespace v8 { - class Extension; -} - namespace WebKit { class WebKitClient; class WebString; @@ -70,28 +66,6 @@ namespace WebKit { // any other URL scheme. WEBKIT_API void registerURLSchemeAsNoAccess(const WebString&); - // Registers a v8 extension to be available on webpages. The three forms - // offer various restrictions on what types of contexts the extension is - // loaded into. If a scheme is provided, only pages whose URL has the given - // scheme will match. If extensionGroup is provided, the extension will only - // be loaded into scripts run via WebFrame::ExecuteInNewWorld with the - // matching group. - // Will only affect v8 contexts initialized after this call. Takes ownership - // of the v8::Extension object passed. - WEBKIT_API void registerExtension(v8::Extension*); - WEBKIT_API void registerExtension(v8::Extension*, - const WebString& schemeRestriction); - WEBKIT_API void registerExtension(v8::Extension*, int extensionGroup); - - // Enables special settings which are only applicable if V8 is executed - // in the single thread which must be the main thread. - // FIXME: make a try to dynamically detect when this condition is broken - // and automatically switch off single thread mode. - WEBKIT_API void enableV8SingleThreadMode(); - - // Process any pending JavaScript console messages. - WEBKIT_API void flushConsoleMessages(); - // Enables HTML5 media support. WEBKIT_API void enableMediaPlayer(); diff --git a/webkit/api/public/WebScriptController.h b/webkit/api/public/WebScriptController.h new file mode 100644 index 0000000..afed9be --- /dev/null +++ b/webkit/api/public/WebScriptController.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScriptController_h +#define WebScriptController_h + +#include "WebCommon.h" + +namespace v8 { + class Extension; +} + +namespace WebKit { + class WebString; + + // Registers a v8 extension to be available on webpages. The three forms + // offer various restrictions on what types of contexts the extension is + // loaded into. If a scheme is provided, only pages whose URL has the given + // scheme will match. If extensionGroup is provided, the extension will only + // be loaded into scripts run via WebFrame::ExecuteInNewWorld with the + // matching group. + // Will only affect v8 contexts initialized after this call. Takes ownership + // of the v8::Extension object passed. + WEBKIT_API void registerExtension(v8::Extension*); + WEBKIT_API void registerExtension(v8::Extension*, + const WebString& schemeRestriction); + WEBKIT_API void registerExtension(v8::Extension*, int extensionGroup); + + // Enables special settings which are only applicable if V8 is executed + // in the single thread which must be the main thread. + // FIXME: make a try to dynamically detect when this condition is broken + // and automatically switch off single thread mode. + WEBKIT_API void enableV8SingleThreadMode(); + + // Process any pending JavaScript console messages. + WEBKIT_API void flushConsoleMessages(); + +} // namespace WebKit + +#endif diff --git a/webkit/api/src/WebKit.cpp b/webkit/api/src/WebKit.cpp index 877e5c9..43937e5 100644 --- a/webkit/api/src/WebKit.cpp +++ b/webkit/api/src/WebKit.cpp @@ -39,8 +39,6 @@ #include "FrameLoader.h" #include "Page.h" #include "TextEncoding.h" -#include "V8Binding.h" -#include "V8Proxy.h" #include "WorkerContextExecutionProxy.h" #include <wtf/Assertions.h> #include <wtf/Threading.h> @@ -107,27 +105,6 @@ void registerURLSchemeAsNoAccess(const WebString& scheme) WebCore::SecurityOrigin::registerURLSchemeAsNoAccess(scheme); } -void registerExtension(v8::Extension* extension) -{ - WebCore::V8Proxy::registerExtension(extension, WebString()); -} - -void registerExtension(v8::Extension* extension, - const WebString& schemeRestriction) -{ - WebCore::V8Proxy::registerExtension(extension, schemeRestriction); -} - -void registerExtension(v8::Extension* extension, int extensionGroup) -{ - WebCore::V8Proxy::registerExtension(extension, extensionGroup); -} - -void flushConsoleMessages() -{ - WebCore::V8Proxy::processConsoleMessages(); -} - void enableMediaPlayer() { #if ENABLE(VIDEO) @@ -152,11 +129,6 @@ bool databasesEnabled() return s_databasesEnabled; } -void enableV8SingleThreadMode() -{ - WebCore::enableStringImplCache(); -} - void whiteListAccessFromOrigin(const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, diff --git a/webkit/api/src/WebScriptController.cpp b/webkit/api/src/WebScriptController.cpp new file mode 100644 index 0000000..4282030 --- /dev/null +++ b/webkit/api/src/WebScriptController.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebScriptController.h" + +#include "WebString.h" + +#include "V8Binding.h" +#include "V8Proxy.h" + +namespace WebKit { + +void registerExtension(v8::Extension* extension) +{ + WebCore::V8Proxy::registerExtension(extension, WebString()); +} + +void registerExtension(v8::Extension* extension, + const WebString& schemeRestriction) +{ + WebCore::V8Proxy::registerExtension(extension, schemeRestriction); +} + +void registerExtension(v8::Extension* extension, int extensionGroup) +{ + WebCore::V8Proxy::registerExtension(extension, extensionGroup); +} + +void enableV8SingleThreadMode() +{ + WebCore::enableStringImplCache(); +} + +void flushConsoleMessages() +{ + WebCore::V8Proxy::processConsoleMessages(); +} + +} // namespace WebKit diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index d18d2e2..e6dad8a 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -34,6 +34,7 @@ #include "webkit/api/public/WebAccessibilityObject.h" #include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptController.h" #include "webkit/api/public/WebRect.h" #include "webkit/api/public/WebSize.h" #include "webkit/api/public/WebString.h" diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index b00a348..8b716b1 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -25,6 +25,7 @@ #include "net/socket/ssl_test_util.h" #include "net/url_request/url_request_context.h" #include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptController.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" #include "webkit/extensions/v8/gc_extension.h" diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h index a2b20a6..4bcc74b 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -13,6 +13,7 @@ #include "media/base/media.h" #include "webkit/api/public/WebData.h" #include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptController.h" #include "webkit/api/public/WebStorageArea.h" #include "webkit/api/public/WebStorageEventDispatcher.h" #include "webkit/api/public/WebStorageNamespace.h" |