diff options
author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebKit/chromium/src | |
parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebKit/chromium/src')
81 files changed, 1302 insertions, 1678 deletions
diff --git a/WebKit/chromium/src/APUAgentDelegate.h b/WebKit/chromium/src/APUAgentDelegate.h deleted file mode 100644 index 70be702..0000000 --- a/WebKit/chromium/src/APUAgentDelegate.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2010 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 APUAgentDelegate_h -#define APUAgentDelegate_h - -#include "DevToolsRPC.h" - -namespace WebKit { - -#define APU_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, MEHTOD4, METHOD5) \ - /* Sends a json object to apu. */ \ - METHOD1(dispatchToApu, String /* data */) - -DEFINE_RPC_CLASS(ApuAgentDelegate, APU_AGENT_DELEGATE_STRUCT) - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 093ac11..bcd7931 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -69,6 +69,12 @@ #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) +// These constants are in WTF, bring them into WebCore so the ASSERT still works for them! +namespace WebCore { + using WTF::TextCaseSensitive; + using WTF::TextCaseInsensitive; +}; + COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUnknown, UnknownRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleButton, ButtonRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRadioButton, RadioButtonRole); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 223cf16..a946e34 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -73,11 +73,11 @@ public: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); virtual void selectionChanged(unsigned, bool); virtual void selectionCleared(); - virtual WebCore::String itemText(unsigned listIndex) const; - virtual WebCore::String itemLabel(unsigned listIndex) const; - virtual WebCore::String itemIcon(unsigned listIndex) const; - virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); } - virtual WebCore::String itemAccessibilityText(unsigned lastIndex) const { return WebCore::String(); } + virtual WTF::String itemText(unsigned listIndex) const; + virtual WTF::String itemLabel(unsigned listIndex) const; + virtual WTF::String itemIcon(unsigned listIndex) const; + virtual WTF::String itemToolTip(unsigned lastIndex) const { return WTF::String(); } + virtual WTF::String itemAccessibilityText(unsigned lastIndex) const { return WTF::String(); } virtual bool itemIsEnabled(unsigned listIndex) const { return true; } virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const; virtual WebCore::PopupMenuStyle menuStyle() const; @@ -131,9 +131,9 @@ private: void setSelectedIndex(int index) { m_selectedIndex = index; } // The names, labels and icons that make up the contents of the menu items. - Vector<WebCore::String> m_names; - Vector<WebCore::String> m_labels; - Vector<WebCore::String> m_icons; + Vector<WTF::String> m_names; + Vector<WTF::String> m_labels; + Vector<WTF::String> m_icons; Vector<int> m_uniqueIDs; // The index of the separator. -1 if there is no separator. diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 2a5c32e..405fbf6 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -616,7 +616,7 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh chooserCompletion->didChooseFile(WebVector<WebString>()); } -void ChromeClientImpl::chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*) +void ChromeClientImpl::chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*) { notImplemented(); } diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index 7f3febf..8763def 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -86,18 +86,18 @@ public: virtual void setResizable(bool); virtual void addMessageToConsole( WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, - const WebCore::String& message, unsigned lineNumber, - const WebCore::String& sourceID); + const WTF::String& message, unsigned lineNumber, + const WTF::String& sourceID); virtual bool canRunBeforeUnloadConfirmPanel(); virtual bool runBeforeUnloadConfirmPanel( - const WebCore::String& message, WebCore::Frame*); + const WTF::String& message, WebCore::Frame*); virtual void closeWindowSoon(); - virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&); - virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&); + virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&); + virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&); virtual bool runJavaScriptPrompt( - WebCore::Frame*, const WebCore::String& message, - const WebCore::String& defaultValue, WebCore::String& result); - virtual void setStatusbarText(const WebCore::String& message); + WebCore::Frame*, const WTF::String& message, + const WTF::String& defaultValue, WTF::String& result); + virtual void setStatusbarText(const WTF::String& message); virtual bool shouldInterruptJavaScript(); virtual bool tabsToLinks() const; virtual WebCore::IntRect windowResizerRect() const; @@ -116,10 +116,10 @@ public: virtual void scrollbarsModeDidChange() const; virtual void mouseDidMoveOverElement( const WebCore::HitTestResult& result, unsigned modifierFlags); - virtual void setToolTip(const WebCore::String& tooltipText, WebCore::TextDirection); + virtual void setToolTip(const WTF::String& tooltipText, WebCore::TextDirection); virtual void print(WebCore::Frame*); virtual void exceededDatabaseQuota( - WebCore::Frame*, const WebCore::String& databaseName); + WebCore::Frame*, const WTF::String& databaseName); #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); @@ -130,7 +130,7 @@ public: virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); - virtual void chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*); + virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*); virtual void setCursor(const WebCore::Cursor&) { } virtual void formStateDidChange(const WebCore::Node*); virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; } diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 397ea17..a43109c 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -862,13 +862,6 @@ void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) client->setCursor(WebCursorInfo(cursor)); } -void ChromiumBridge::widgetSetFocus(Widget* widget) -{ - ChromeClientImpl* client = toChromeClientImpl(widget); - if (client) - client->focus(); -} - WorkerContextProxy* WorkerContextProxy::create(Worker* worker) { return WebWorkerClientImpl::createWorkerContextProxy(worker); diff --git a/WebKit/chromium/src/ContextMenuClientImpl.h b/WebKit/chromium/src/ContextMenuClientImpl.h index 4191fad..97ea967 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.h +++ b/WebKit/chromium/src/ContextMenuClientImpl.h @@ -51,7 +51,7 @@ public: virtual void lookUpInDictionary(WebCore::Frame*) {} virtual void searchWithGoogle(const WebCore::Frame*) {} virtual bool shouldIncludeInspectElementItem() { return false; } - virtual void speak(const WebCore::String&) {} + virtual void speak(const WTF::String&) {} virtual void stopSpeaking() {} private: void populateCustomMenuItems(WebCore::ContextMenu*, WebContextMenuData*); diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.h b/WebKit/chromium/src/DOMUtilitiesPrivate.h index 253ab3f..f5d03a5 100644 --- a/WebKit/chromium/src/DOMUtilitiesPrivate.h +++ b/WebKit/chromium/src/DOMUtilitiesPrivate.h @@ -31,6 +31,8 @@ #ifndef DOMUtilitiesPrivate_h #define DOMUtilitiesPrivate_h +#include <wtf/Forward.h> + namespace WebCore { class Element; class HTMLInputElement; @@ -39,7 +41,6 @@ class HTMLMetaElement; class HTMLOptionElement; class Node; class QualifiedName; -class String; } // This file is an aggregate of useful WebCore operations. @@ -53,7 +54,7 @@ WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node*); WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*); // FIXME: Deprecate. Use WebInputElement::nameForAutofill instead. -WebCore::String nameOfInputElement(WebCore::HTMLInputElement*); +WTF::String nameOfInputElement(WebCore::HTMLInputElement*); // For img, script, iframe, frame element, when attribute name is src, // for link, a, area element, when attribute name is href, diff --git a/WebKit/chromium/src/DebuggerAgent.h b/WebKit/chromium/src/DebuggerAgent.h deleted file mode 100644 index 17cde11..0000000 --- a/WebKit/chromium/src/DebuggerAgent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2010 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 DebuggerAgent_h -#define DebuggerAgent_h - -#include "DevToolsRPC.h" - -namespace WebKit { - -#define DEBUGGER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Requests global context id of the inspected tab. */ \ - METHOD0(getContextId) \ - \ - /* Request v8 to process all debug commands in the queue. */ \ - METHOD0(processDebugCommands) - -DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT) - -#define DEBUGGER_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - METHOD1(debuggerOutput, String /* output text */) \ - \ - /* Pushes debugger context id into the client. */ \ - METHOD1(setContextId, int /* context id */) - -DEFINE_RPC_CLASS(DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT) - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp index dde9e1d..46c6e7c 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.cpp +++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp @@ -32,32 +32,21 @@ #include "DebuggerAgentImpl.h" #include "DebuggerAgentManager.h" -#include "Document.h" -#include "Frame.h" -#include "Page.h" -#include "ScriptDebugServer.h" -#include "V8Binding.h" +#include "WebDevToolsAgentClient.h" #include "WebDevToolsAgentImpl.h" #include "WebViewImpl.h" -#include <wtf/HashSet.h> -#include <wtf/RefPtr.h> -#include <wtf/Vector.h> -using WebCore::DOMWindow; -using WebCore::Document; -using WebCore::Frame; -using WebCore::Page; -using WebCore::String; +using WTF::String; namespace WebKit { DebuggerAgentImpl::DebuggerAgentImpl( WebViewImpl* webViewImpl, - DebuggerAgentDelegate* delegate, - WebDevToolsAgentImpl* webdevtoolsAgent) + WebDevToolsAgentImpl* webdevtoolsAgent, + WebDevToolsAgentClient* webdevtoolsAgentClient) : m_webViewImpl(webViewImpl) - , m_delegate(delegate) , m_webdevtoolsAgent(webdevtoolsAgent) + , m_webdevtoolsAgentClient(webdevtoolsAgentClient) , m_autoContinueOnException(false) { DebuggerAgentManager::debugAttach(this); @@ -68,75 +57,12 @@ DebuggerAgentImpl::~DebuggerAgentImpl() DebuggerAgentManager::debugDetach(this); } -void DebuggerAgentImpl::getContextId() -{ - m_delegate->setContextId(m_webdevtoolsAgent->hostId()); -} - -void DebuggerAgentImpl::processDebugCommands() -{ - DebuggerAgentManager::UtilityContextScope utilityScope; - v8::Debug::ProcessDebugMessages(); -} - void DebuggerAgentImpl::debuggerOutput(const String& command) { - m_delegate->debuggerOutput(command); + m_webdevtoolsAgentClient->sendDebuggerOutput(command); m_webdevtoolsAgent->forceRepaint(); } -String DebuggerAgentImpl::executeUtilityFunction( - v8::Handle<v8::Context> context, - int callId, - const char* object, - const String &functionName, - const String& jsonArgs, - bool async, - String* exception) -{ - v8::HandleScope scope; - ASSERT(!context.IsEmpty()); - if (context.IsEmpty()) { - *exception = "No window context."; - return ""; - } - v8::Context::Scope contextScope(context); - - DebuggerAgentManager::UtilityContextScope utilityScope; - - v8::Handle<v8::Object> dispatchObject = v8::Handle<v8::Object>::Cast( - context->Global()->Get(v8::String::New(object))); - - v8::Handle<v8::Value> dispatchFunction = dispatchObject->Get(v8::String::New("dispatch")); - ASSERT(dispatchFunction->IsFunction()); - v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); - - v8::Handle<v8::String> functionNameWrapper = v8::Handle<v8::String>( - v8::String::New(functionName.utf8().data())); - v8::Handle<v8::String> jsonArgsWrapper = v8::Handle<v8::String>( - v8::String::New(jsonArgs.utf8().data())); - v8::Handle<v8::Number> callIdWrapper = v8::Handle<v8::Number>( - v8::Number::New(async ? callId : 0)); - - v8::Handle<v8::Value> args[] = { - functionNameWrapper, - jsonArgsWrapper, - callIdWrapper - }; - - v8::TryCatch tryCatch; - v8::Handle<v8::Value> resObj = function->Call(context->Global(), 3, args); - if (tryCatch.HasCaught()) { - v8::Local<v8::Message> message = tryCatch.Message(); - if (message.IsEmpty()) - *exception = "Unknown exception"; - else - *exception = WebCore::toWebCoreString(message->Get()); - return ""; - } - return WebCore::toWebCoreStringWithNullCheck(resObj); -} - WebCore::Page* DebuggerAgentImpl::page() { return m_webViewImpl->page(); diff --git a/WebKit/chromium/src/DebuggerAgentImpl.h b/WebKit/chromium/src/DebuggerAgentImpl.h index 0e6e6af..a8fcc4e 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.h +++ b/WebKit/chromium/src/DebuggerAgentImpl.h @@ -31,55 +31,31 @@ #ifndef DebuggerAgentImpl_h #define DebuggerAgentImpl_h -#include "DebuggerAgent.h" - -#include <v8.h> -#include <wtf/HashSet.h> -#include <wtf/Noncopyable.h> +#include <wtf/Forward.h> namespace WebCore { -class Document; -class Frame; -class Node; class Page; -class String; } namespace WebKit { +class WebDevToolsAgentClient; class WebDevToolsAgentImpl; class WebViewImpl; -class DebuggerAgentImpl : public DebuggerAgent { +class DebuggerAgentImpl { public: DebuggerAgentImpl(WebKit::WebViewImpl* webViewImpl, - DebuggerAgentDelegate* delegate, - WebDevToolsAgentImpl* webdevtoolsAgent); + WebDevToolsAgentImpl* webdevtoolsAgent, + WebDevToolsAgentClient* webdevtoolsAgentClient); virtual ~DebuggerAgentImpl(); - // DebuggerAgent implementation. - virtual void getContextId(); - virtual void processDebugCommands(); - - void debuggerOutput(const WebCore::String& out); + void debuggerOutput(const WTF::String& out); void setAutoContinueOnException(bool autoContinue) { m_autoContinueOnException = autoContinue; } bool autoContinueOnException() { return m_autoContinueOnException; } - // Executes function with the given name in the utility context. Passes node - // and json args as parameters. Note that the function called must be - // implemented in the inject_dispatch.js file. - WebCore::String executeUtilityFunction( - v8::Handle<v8::Context> context, - int callId, - const char* object, - const WebCore::String& functionName, - const WebCore::String& jsonArgs, - bool async, - WebCore::String* exception); - - WebCore::Page* page(); WebDevToolsAgentImpl* webdevtoolsAgent() { return m_webdevtoolsAgent; } @@ -87,8 +63,8 @@ public: private: WebKit::WebViewImpl* m_webViewImpl; - DebuggerAgentDelegate* m_delegate; WebDevToolsAgentImpl* m_webdevtoolsAgent; + WebDevToolsAgentClient* m_webdevtoolsAgentClient; bool m_autoContinueOnException; }; diff --git a/WebKit/chromium/src/DebuggerAgentManager.cpp b/WebKit/chromium/src/DebuggerAgentManager.cpp index 1cc6740..1df7172 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -157,7 +157,7 @@ void DebuggerAgentManager::debugDetach(DebuggerAgentImpl* debuggerAgent) } } else { // Remove all breakpoints set by the agent. - String clearBreakpointGroupCmd = String::format( + WTF::String clearBreakpointGroupCmd = WTF::String::format( "{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\"," "\"arguments\":{\"groupId\":%d}}", hostId); @@ -176,7 +176,7 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) { v8::HandleScope scope; v8::String::Value value(message.GetJSON()); - String out(reinterpret_cast<const UChar*>(*value), value.length()); + WTF::String out(reinterpret_cast<const UChar*>(*value), value.length()); // If callerData is not 0 the message is a response to a debugger command. if (v8::Debug::ClientData* callerData = message.GetClientData()) { @@ -248,7 +248,7 @@ void DebuggerAgentManager::pauseScript() v8::Debug::DebugBreak(); } -void DebuggerAgentManager::executeDebuggerCommand(const String& command, int callerId) +void DebuggerAgentManager::executeDebuggerCommand(const WTF::String& command, int callerId) { sendCommandToV8(command, new CallerIdWrapper(callerId)); } @@ -286,14 +286,14 @@ void DebuggerAgentManager::onNavigate() DebuggerAgentManager::sendContinueCommandToV8(); } -void DebuggerAgentManager::sendCommandToV8(const String& cmd, v8::Debug::ClientData* data) +void DebuggerAgentManager::sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data) { v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), data); } void DebuggerAgentManager::sendContinueCommandToV8() { - String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); + WTF::String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); sendCommandToV8(continueCmd, new CallerIdWrapper()); } diff --git a/WebKit/chromium/src/DebuggerAgentManager.h b/WebKit/chromium/src/DebuggerAgentManager.h index dbb600a..300cada 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.h +++ b/WebKit/chromium/src/DebuggerAgentManager.h @@ -34,6 +34,7 @@ #include "WebCString.h" #include "WebDevToolsAgent.h" #include <v8-debug.h> +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/Vector.h> @@ -41,7 +42,6 @@ namespace WebCore { class Page; class PageGroupLoadDeferrer; -class String; } namespace WebKit { @@ -68,7 +68,7 @@ public: static void debugAttach(DebuggerAgentImpl* debuggerAgent); static void debugDetach(DebuggerAgentImpl* debuggerAgent); static void pauseScript(); - static void executeDebuggerCommand(const WebCore::String& command, int callerId); + static void executeDebuggerCommand(const WTF::String& command, int callerId); static void setMessageLoopDispatchHandler(WebDevToolsAgent::MessageLoopDispatchHandler handler); static void setExposeV8DebuggerProtocol(bool); @@ -103,7 +103,7 @@ private: static void debugHostDispatchHandler(); static void onV8DebugMessage(const v8::Debug::Message& message); - static void sendCommandToV8(const WebCore::String& cmd, + static void sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data); static void sendContinueCommandToV8(); diff --git a/WebKit/chromium/src/DevToolsRPC.h b/WebKit/chromium/src/DevToolsRPC.h deleted file mode 100644 index 7176821..0000000 --- a/WebKit/chromium/src/DevToolsRPC.h +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -// DevTools RPC subsystem is a simple string serialization-based rpc -// implementation. The client is responsible for defining the Rpc-enabled -// interface in terms of its macros: -// -// #define MYAPI_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) -// METHOD0(Method1) -// METHOD1(Method3, int) -// (snippet above should be multiline macro, add trailing backslashes) -// -// DEFINE_RPC_CLASS(MyApi, MYAPI_STRUCT) -// -// The snippet above will generate three classes: MyApi, MyApiStub and -// MyApiDispatch. -// -// 1. For each method defined in the marco MyApi will have a -// pure virtual function generated, so that MyApi would look like: -// -// class MyApi { -// private: -// MyApi() { } -// ~MyApi() { } -// virtual void method1() = 0; -// virtual void method2( -// int param1, -// const String& param2, -// const Value& param3) = 0; -// virtual void method3(int param1) = 0; -// }; -// -// 2. MyApiStub will implement MyApi interface and would serialize all calls -// into the string-based calls of the underlying transport: -// -// DevToolsRPC::Delegate* transport; -// myApi = new MyApiStub(transport); -// myApi->method1(); -// myApi->method3(2); -// -// 3. MyApiDelegate is capable of dispatching the calls and convert them to the -// calls to the underlying MyApi methods: -// -// MyApi* realObject; -// MyApiDispatch::dispatch(realObject, rawStringCallGeneratedByStub); -// -// will make corresponding calls to the real object. - -#ifndef DevToolsRPC_h -#define DevToolsRPC_h - -#include "PlatformString.h" -#include "Vector.h" -#include "WebDevToolsMessageData.h" - -#include <wtf/Noncopyable.h> - -namespace WebCore { -class String; -} - -using WebCore::String; -using WTF::Vector; - -namespace WebKit { - -/////////////////////////////////////////////////////// -// RPC dispatch macro - -template<typename T> -struct RpcTypeTrait { - typedef T ApiType; -}; - -template<> -struct RpcTypeTrait<bool> { - typedef bool ApiType; - static bool parse(const WebCore::String& t) - { - return t == "true"; - } - static WebCore::String toString(bool b) - { - return b ? "true" : "false"; - } -}; - -template<> -struct RpcTypeTrait<int> { - typedef int ApiType; - static int parse(const WebCore::String& t) - { - bool success; - int i = t.toIntStrict(&success); - ASSERT(success); - return i; - } - static WebCore::String toString(int i) - { - return WebCore::String::number(i); - } -}; - -template<> -struct RpcTypeTrait<String> { - typedef const String& ApiType; - static String parse(const WebCore::String& t) - { - return t; - } - static WebCore::String toString(const String& t) - { - return t; - } -}; - -/////////////////////////////////////////////////////// -// RPC Api method declarations - -#define TOOLS_RPC_API_METHOD0(Method) \ - virtual void Method() = 0; - -#define TOOLS_RPC_API_METHOD1(Method, T1) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1) = 0; - -#define TOOLS_RPC_API_METHOD2(Method, T1, T2) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2) = 0; - -#define TOOLS_RPC_API_METHOD3(Method, T1, T2, T3) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3) = 0; - -#define TOOLS_RPC_API_METHOD4(Method, T1, T2, T3, T4) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4) = 0; - -#define TOOLS_RPC_API_METHOD5(Method, T1, T2, T3, T4, T5) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4, \ - RpcTypeTrait<T5>::ApiType t5) = 0; - -/////////////////////////////////////////////////////// -// RPC stub method implementations - -#define TOOLS_RPC_STUB_METHOD0(Method) \ - virtual void Method() { \ - Vector<String> args; \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD1(Method, T1) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1) { \ - Vector<String> args(1); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD2(Method, T1, T2) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2) { \ - Vector<String> args(2); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD3(Method, T1, T2, T3) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3) { \ - Vector<String> args(3); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD4(Method, T1, T2, T3, T4) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4) { \ - Vector<String> args(4); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - args[3] = RpcTypeTrait<T4>::toString(t4); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -#define TOOLS_RPC_STUB_METHOD5(Method, T1, T2, T3, T4, T5) \ - virtual void Method(RpcTypeTrait<T1>::ApiType t1, \ - RpcTypeTrait<T2>::ApiType t2, \ - RpcTypeTrait<T3>::ApiType t3, \ - RpcTypeTrait<T4>::ApiType t4, \ - RpcTypeTrait<T5>::ApiType t5) { \ - Vector<String> args(5); \ - args[0] = RpcTypeTrait<T1>::toString(t1); \ - args[1] = RpcTypeTrait<T2>::toString(t2); \ - args[2] = RpcTypeTrait<T3>::toString(t3); \ - args[3] = RpcTypeTrait<T4>::toString(t4); \ - args[4] = RpcTypeTrait<T5>::toString(t5); \ - this->sendRpcMessage(m_className, #Method, args); \ - } - -/////////////////////////////////////////////////////// -// RPC dispatch method implementations - -#define TOOLS_RPC_DISPATCH0(Method) \ -if (methodName == #Method) { \ - delegate->Method(); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH1(Method, T1) \ -if (methodName == #Method) { \ - delegate->Method(RpcTypeTrait<T1>::parse(args[0])); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH2(Method, T1, T2) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH3(Method, T1, T2, T3) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH4(Method, T1, T2, T3, T4) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]), \ - RpcTypeTrait<T4>::parse(args[3]) \ - ); \ - return true; \ -} - -#define TOOLS_RPC_DISPATCH5(Method, T1, T2, T3, T4, T5) \ -if (methodName == #Method) { \ - delegate->Method( \ - RpcTypeTrait<T1>::parse(args[0]), \ - RpcTypeTrait<T2>::parse(args[1]), \ - RpcTypeTrait<T3>::parse(args[2]), \ - RpcTypeTrait<T4>::parse(args[3]), \ - RpcTypeTrait<T5>::parse(args[4]) \ - ); \ - return true; \ -} - -#define TOOLS_END_RPC_DISPATCH() \ -} - -// This macro defines three classes: Class with the Api, ClassStub that is -// serializing method calls and ClassDispatch that is capable of dispatching -// the serialized message into its delegate. -#define DEFINE_RPC_CLASS(Class, STRUCT) \ -class Class : public Noncopyable {\ -public: \ - Class() \ - { \ - m_className = #Class; \ - } \ - virtual ~Class() { } \ - \ - STRUCT( \ - TOOLS_RPC_API_METHOD0, \ - TOOLS_RPC_API_METHOD1, \ - TOOLS_RPC_API_METHOD2, \ - TOOLS_RPC_API_METHOD3, \ - TOOLS_RPC_API_METHOD4, \ - TOOLS_RPC_API_METHOD5) \ - WebCore::String m_className; \ -}; \ -\ -class Class##Stub \ - : public Class \ - , public DevToolsRPC { \ -public: \ - explicit Class##Stub(Delegate* delegate) : DevToolsRPC(delegate) { } \ - virtual ~Class##Stub() { } \ - typedef Class CLASS; \ - STRUCT( \ - TOOLS_RPC_STUB_METHOD0, \ - TOOLS_RPC_STUB_METHOD1, \ - TOOLS_RPC_STUB_METHOD2, \ - TOOLS_RPC_STUB_METHOD3, \ - TOOLS_RPC_STUB_METHOD4, \ - TOOLS_RPC_STUB_METHOD5) \ -}; \ -\ -class Class##Dispatch : public Noncopyable { \ -public: \ - Class##Dispatch() { } \ - virtual ~Class##Dispatch() { } \ - \ - static bool dispatch(Class* delegate, \ - const WebKit::WebDevToolsMessageData& data) { \ - String className = data.className; \ - if (className != #Class) \ - return false; \ - String methodName = data.methodName; \ - Vector<String> args; \ - for (size_t i = 0; i < data.arguments.size(); i++) \ - args.append(data.arguments[i]); \ - typedef Class CLASS; \ - STRUCT( \ - TOOLS_RPC_DISPATCH0, \ - TOOLS_RPC_DISPATCH1, \ - TOOLS_RPC_DISPATCH2, \ - TOOLS_RPC_DISPATCH3, \ - TOOLS_RPC_DISPATCH4, \ - TOOLS_RPC_DISPATCH5) \ - return false; \ - } \ -}; - -/////////////////////////////////////////////////////// -// RPC base class -class DevToolsRPC { -public: - class Delegate { - public: - Delegate() { } - virtual ~Delegate() { } - virtual void sendRpcMessage(const WebKit::WebDevToolsMessageData& data) = 0; - }; - - explicit DevToolsRPC(Delegate* delegate) : m_delegate(delegate) { } - virtual ~DevToolsRPC() { }; - -protected: - void sendRpcMessage(const String& className, - const String& methodName, - const Vector<String>& args) { - WebKit::WebVector<WebKit::WebString> webArgs(args.size()); - for (size_t i = 0; i < args.size(); i++) - webArgs[i] = args[i]; - WebKit::WebDevToolsMessageData data; - data.className = className; - data.methodName = methodName; - data.arguments.swap(webArgs); - this->m_delegate->sendRpcMessage(data); - } - - Delegate* m_delegate; -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/DevToolsRPCJS.h b/WebKit/chromium/src/DevToolsRPCJS.h deleted file mode 100644 index 8ae279f..0000000 --- a/WebKit/chromium/src/DevToolsRPCJS.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -// Additional set of macros for the JS RPC. - -#ifndef DevToolsRPCJS_h -#define DevToolsRPCJS_h - -// Do not remove this one although it is not used. -#include "BoundObject.h" -#include "DevToolsRPC.h" -#include "WebFrame.h" -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> - -namespace WebKit { - -/////////////////////////////////////////////////////// -// JS RPC binds and stubs - -#define TOOLS_RPC_JS_BIND_METHOD0(Method) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD1(Method, T1) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD2(Method, T1, T2) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD3(Method, T1, T2, T3) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD4(Method, T1, T2, T3, T4) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_BIND_METHOD5(Method, T1, T2, T3, T4, T5) \ - boundObj.addProtoFunction(#Method, OCLASS::js##Method); - -#define TOOLS_RPC_JS_STUB_METHOD0(Method) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 0); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD1(Method, T1) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 1); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD2(Method, T1, T2) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 2); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD3(Method, T1, T2, T3) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 3); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD4(Method, T1, T2, T3, T4) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 4); \ - return v8::Undefined(); \ - } - -#define TOOLS_RPC_JS_STUB_METHOD5(Method, T1, T2, T3, T4, T5) \ - static v8::Handle<v8::Value> js##Method(const v8::Arguments& args) { \ - sendRpcMessageFromJS(#Method, args, 5); \ - return v8::Undefined(); \ - } - -/////////////////////////////////////////////////////// -// JS RPC main obj macro - -#define DEFINE_RPC_JS_BOUND_OBJ(Class, STRUCT, DClass, DELEGATE_STRUCT) \ -class JS##Class##BoundObj : public Class##Stub { \ -public: \ - JS##Class##BoundObj(Delegate* rpcDelegate, \ - v8::Handle<v8::Context> context, \ - const char* classname) \ - : Class##Stub(rpcDelegate) { \ - BoundObject boundObj(context, this, classname); \ - STRUCT( \ - TOOLS_RPC_JS_BIND_METHOD0, \ - TOOLS_RPC_JS_BIND_METHOD1, \ - TOOLS_RPC_JS_BIND_METHOD2, \ - TOOLS_RPC_JS_BIND_METHOD3, \ - TOOLS_RPC_JS_BIND_METHOD4, \ - TOOLS_RPC_JS_BIND_METHOD5) \ - boundObj.build(); \ - } \ - virtual ~JS##Class##BoundObj() { } \ - typedef JS##Class##BoundObj OCLASS; \ - STRUCT( \ - TOOLS_RPC_JS_STUB_METHOD0, \ - TOOLS_RPC_JS_STUB_METHOD1, \ - TOOLS_RPC_JS_STUB_METHOD2, \ - TOOLS_RPC_JS_STUB_METHOD3, \ - TOOLS_RPC_JS_STUB_METHOD4, \ - TOOLS_RPC_JS_STUB_METHOD5) \ -private: \ - static void sendRpcMessageFromJS(const char* method, \ - const v8::Arguments& jsArguments, \ - size_t argsCount) \ - { \ - Vector<String> args(argsCount); \ - for (size_t i = 0; i < argsCount; i++) \ - args[i] = WebCore::toWebCoreStringWithNullCheck(jsArguments[i]); \ - void* selfPtr = v8::External::Cast(*jsArguments.Data())->Value(); \ - JS##Class##BoundObj* self = static_cast<JS##Class##BoundObj*>(selfPtr); \ - self->sendRpcMessage(#Class, method, args); \ - } \ -}; - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.cpp b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp new file mode 100644 index 0000000..f4a0dd9 --- /dev/null +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "DeviceOrientationClientProxy.h" + +#include "DeviceOrientation.h" +#include "WebDeviceOrientation.h" +#include "WebDeviceOrientationController.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class DeviceOrientationController; +} + +namespace WebKit { + +void DeviceOrientationClientProxy::setController(WebCore::DeviceOrientationController* c) +{ + if (!m_client) // FIXME: Get rid of these null checks once device orientation is enabled by default. + return; + m_client->setController(new WebDeviceOrientationController(c)); +} + +void DeviceOrientationClientProxy::startUpdating() +{ + if (!m_client) + return; + m_client->startUpdating(); +} + +void DeviceOrientationClientProxy::stopUpdating() +{ + if (!m_client) + return; + m_client->stopUpdating(); +} + +WebCore::DeviceOrientation* DeviceOrientationClientProxy::lastOrientation() const +{ + if (!m_client) + return 0; + + // Cache the DeviceOrientation pointer so its reference count does not drop to zero upon return. + m_lastOrientation = m_client->lastOrientation(); + + return m_lastOrientation.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.h b/WebKit/chromium/src/DeviceOrientationClientProxy.h new file mode 100644 index 0000000..2d3a7dc --- /dev/null +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 DeviceOrientationClientProxy_h +#define DeviceOrientationClientProxy_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" +#include "WebDeviceOrientationClient.h" +#include <wtf/RefPtr.h> + +namespace WebCore { +class DeviceOrientationController; +} + +namespace WebKit { + +class DeviceOrientationClientProxy : public WebCore::DeviceOrientationClient { +public: + DeviceOrientationClientProxy(WebDeviceOrientationClient* client) + : m_client(client) + { + } + + void setController(WebCore::DeviceOrientationController*); + void startUpdating(); + void stopUpdating(); + WebCore::DeviceOrientation* lastOrientation() const; + +private: + WebDeviceOrientationClient* m_client; + mutable RefPtr<WebCore::DeviceOrientation> m_lastOrientation; +}; + +} // namespace WebKit + +#endif // DeviceOrientationClientProxy_h diff --git a/WebKit/chromium/src/DragClientImpl.h b/WebKit/chromium/src/DragClientImpl.h index fc4c608..dac7acd 100644 --- a/WebKit/chromium/src/DragClientImpl.h +++ b/WebKit/chromium/src/DragClientImpl.h @@ -63,7 +63,7 @@ public: WebCore::Frame* frame, bool isLinkDrag = false); virtual WebCore::DragImageRef createDragImageForLink( - WebCore::KURL&, const WebCore::String& label, WebCore::Frame*); + WebCore::KURL&, const WTF::String& label, WebCore::Frame*); virtual void dragControllerDestroyed(); private: diff --git a/WebKit/chromium/src/EditorClientImpl.h b/WebKit/chromium/src/EditorClientImpl.h index 549a512..b05a592 100644 --- a/WebKit/chromium/src/EditorClientImpl.h +++ b/WebKit/chromium/src/EditorClientImpl.h @@ -61,7 +61,7 @@ public: virtual bool shouldBeginEditing(WebCore::Range*); virtual bool shouldEndEditing(WebCore::Range*); virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction); - virtual bool shouldInsertText(const WebCore::String&, WebCore::Range*, WebCore::EditorInsertAction); + virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction); virtual bool shouldDeleteRange(WebCore::Range*); virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, @@ -92,8 +92,8 @@ public: virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*); virtual void textWillBeDeletedInTextField(WebCore::Element*); virtual void textDidChangeInTextArea(WebCore::Element*); - virtual void ignoreWordInSpellDocument(const WebCore::String&); - virtual void learnWord(const WebCore::String&); + virtual void ignoreWordInSpellDocument(const WTF::String&); + virtual void learnWord(const WTF::String&); virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); @@ -101,13 +101,13 @@ public: WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); - virtual WebCore::String getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&); - virtual void updateSpellingUIWithGrammarString(const WebCore::String&, const WebCore::GrammarDetail&); - virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&); + virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); + virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&); + virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); - virtual void getGuessesForWord(const WebCore::String& word, - WTF::Vector<WebCore::String>& guesses); + virtual void getGuessesForWord(const WTF::String& word, + WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 25be623..3a8a714 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -99,7 +99,7 @@ public: virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const WebCore::String& title); + virtual void dispatchDidReceiveTitle(const WTF::String& title); virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); @@ -110,8 +110,8 @@ public: virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual WebCore::Frame* dispatchCreatePage(); virtual void dispatchShow(); - virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WebCore::String& mime_type, const WebCore::ResourceRequest&); - virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WebCore::String& frame_name); + virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WTF::String& mime_type, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WTF::String& frame_name); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); @@ -148,9 +148,9 @@ public: virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); virtual bool shouldFallBack(const WebCore::ResourceError&); virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; - virtual bool canShowMIMEType(const WebCore::String& MIMEType) const; - virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const; - virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const; + virtual bool canShowMIMEType(const WTF::String& MIMEType) const; + virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const; + virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const; virtual void frameLoadCompleted(); virtual void saveViewStateToItem(WebCore::HistoryItem*); virtual void restoreViewState(); @@ -159,8 +159,8 @@ public: virtual void prepareForDataSourceReplacement(); virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader( const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); - virtual WebCore::String userAgent(const WebCore::KURL&); + virtual void setTitle(const WTF::String& title, const WebCore::KURL&); + virtual WTF::String userAgent(const WebCore::KURL&); virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); @@ -170,25 +170,25 @@ public: const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&); virtual PassRefPtr<WebCore::Frame> createFrame( - const WebCore::KURL& url, const WebCore::String& name, + const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, - const WebCore::String& referrer, bool allowsScrolling, + const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual void didTransferChildFrameToNewDocument(); virtual PassRefPtr<WebCore::Widget> createPlugin( const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, - const Vector<WebCore::String>&, const Vector<WebCore::String>&, - const WebCore::String&, bool loadManually); + const Vector<WTF::String>&, const Vector<WTF::String>&, + const WTF::String&, bool loadManually); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& /* base_url */, - const Vector<WebCore::String>& paramNames, - const Vector<WebCore::String>& paramValues); + const Vector<WTF::String>& paramNames, + const Vector<WTF::String>& paramValues); virtual WebCore::ObjectContentType objectContentType( - const WebCore::KURL& url, const WebCore::String& mimeType); - virtual WebCore::String overrideMediaType() const; + const WebCore::KURL& url, const WTF::String& mimeType); + virtual WTF::String overrideMediaType() const; virtual void didPerformFirstNavigation() const; virtual void registerForIconNotification(bool listen = true); virtual void didChangeScrollOffset(); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index fec0b20..5b5afef 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -35,24 +35,18 @@ #include "GraphicsContext3D.h" #include "CachedImage.h" +#include "CanvasLayerChromium.h" +#include "CanvasRenderingContext.h" #include "Chrome.h" #include "ChromeClientImpl.h" +#include "Float32Array.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "ImageBuffer.h" #include "ImageData.h" -#include "WebGLBuffer.h" -#include "Int8Array.h" -#include "Float32Array.h" -#include "WebGLFramebuffer.h" #include "Int32Array.h" -#include "WebGLProgram.h" -#include "WebGLRenderbuffer.h" -#include "WebGLRenderingContext.h" -#include "WebGLShader.h" -#include "WebGLTexture.h" +#include "Int8Array.h" #include "Uint8Array.h" -#include "WebGLLayerChromium.h" #include "WebGraphicsContext3D.h" #include "WebGraphicsContext3DDefaultImpl.h" #include "WebKit.h" @@ -94,8 +88,6 @@ namespace WebCore { // Uncomment this to render to a separate window for debugging // #define RENDER_TO_DEBUGGING_WINDOW -#define EXTRACT(val) (!val ? 0 : val->object()) - class GraphicsContext3DInternal { public: GraphicsContext3DInternal(); @@ -112,14 +104,14 @@ public: void reshape(int width, int height); - void paintRenderingResultsToCanvas(WebGLRenderingContext* context); - void beginPaint(WebGLRenderingContext* context); + void paintRenderingResultsToCanvas(CanvasRenderingContext* context); + void beginPaint(CanvasRenderingContext* context); void endPaint(); void prepareTexture(); #if USE(ACCELERATED_COMPOSITING) - WebGLLayerChromium* platformLayer() const; + CanvasLayerChromium* platformLayer() const; #endif bool isGLES2Compliant() const; @@ -127,12 +119,12 @@ public: // Entry points for WebGL. // void activeTexture(unsigned long texture); - void attachShader(WebGLProgram* program, WebGLShader* shader); - void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name); - void bindBuffer(unsigned long target, WebGLBuffer*); - void bindFramebuffer(unsigned long target, WebGLFramebuffer*); - void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*); - void bindTexture(unsigned long target, WebGLTexture* texture); + void attachShader(Platform3DObject program, Platform3DObject shader); + void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); + void bindBuffer(unsigned long target, Platform3DObject); + void bindFramebuffer(unsigned long target, Platform3DObject); + void bindRenderbuffer(unsigned long target, Platform3DObject); + void bindTexture(unsigned long target, Platform3DObject texture); void blendColor(double red, double green, double blue, double alpha); void blendEquation(unsigned long mode); void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); @@ -151,7 +143,7 @@ public: void clearDepth(double depth); void clearStencil(long s); void colorMask(bool red, bool green, bool blue, bool alpha); - void compileShader(WebGLShader*); + void compileShader(Platform3DObject); void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); @@ -159,7 +151,7 @@ public: void depthFunc(unsigned long func); void depthMask(bool flag); void depthRange(double zNear, double zFar); - void detachShader(WebGLProgram*, WebGLShader*); + void detachShader(Platform3DObject, Platform3DObject); void disable(unsigned long cap); void disableVertexAttribArray(unsigned long index); void drawArrays(unsigned long mode, long first, long count); @@ -169,17 +161,17 @@ public: void enableVertexAttribArray(unsigned long index); void finish(); void flush(); - void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*); - void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level); + void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); + void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); void frontFace(unsigned long mode); void generateMipmap(unsigned long target); - bool getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo&); - bool getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo&); + bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); + bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); - void getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders); + void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); - int getAttribLocation(WebGLProgram*, const String& name); + int getAttribLocation(Platform3DObject, const String& name); void getBooleanv(unsigned long pname, unsigned char* value); @@ -195,26 +187,26 @@ public: void getIntegerv(unsigned long pname, int* value); - void getProgramiv(WebGLProgram* program, unsigned long pname, int* value); + void getProgramiv(Platform3DObject program, unsigned long pname, int* value); - String getProgramInfoLog(WebGLProgram*); + String getProgramInfoLog(Platform3DObject); void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); - void getShaderiv(WebGLShader*, unsigned long pname, int* value); + void getShaderiv(Platform3DObject, unsigned long pname, int* value); - String getShaderInfoLog(WebGLShader*); + String getShaderInfoLog(Platform3DObject); - String getShaderSource(WebGLShader*); + String getShaderSource(Platform3DObject); String getString(unsigned long name); void getTexParameterfv(unsigned long target, unsigned long pname, float* value); void getTexParameteriv(unsigned long target, unsigned long pname, int* value); - void getUniformfv(WebGLProgram* program, long location, float* value); - void getUniformiv(WebGLProgram* program, long location, int* value); + void getUniformfv(Platform3DObject program, long location, float* value); + void getUniformiv(Platform3DObject program, long location, int* value); - long getUniformLocation(WebGLProgram*, const String& name); + long getUniformLocation(Platform3DObject, const String& name); void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); void getVertexAttribiv(unsigned long index, unsigned long pname, int* value); @@ -222,15 +214,15 @@ public: long getVertexAttribOffset(unsigned long index, unsigned long pname); void hint(unsigned long target, unsigned long mode); - bool isBuffer(WebGLBuffer*); + bool isBuffer(Platform3DObject); bool isEnabled(unsigned long cap); - bool isFramebuffer(WebGLFramebuffer*); - bool isProgram(WebGLProgram*); - bool isRenderbuffer(WebGLRenderbuffer*); - bool isShader(WebGLShader*); - bool isTexture(WebGLTexture*); + bool isFramebuffer(Platform3DObject); + bool isProgram(Platform3DObject); + bool isRenderbuffer(Platform3DObject); + bool isShader(Platform3DObject); + bool isTexture(Platform3DObject); void lineWidth(double); - void linkProgram(WebGLProgram*); + void linkProgram(Platform3DObject); void pixelStorei(unsigned long pname, long param); void polygonOffset(double factor, double units); @@ -240,7 +232,7 @@ public: void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); void sampleCoverage(double value, bool invert); void scissor(long x, long y, unsigned long width, unsigned long height); - void shaderSource(WebGLShader*, const String& string); + void shaderSource(Platform3DObject, const String& string); void stencilFunc(unsigned long func, long ref, unsigned long mask); void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); void stencilMask(unsigned long mask); @@ -277,8 +269,8 @@ public: void uniformMatrix3fv(long location, bool transpose, float* value, int size); void uniformMatrix4fv(long location, bool transpose, float* value, int size); - void useProgram(WebGLProgram*); - void validateProgram(WebGLProgram*); + void useProgram(Platform3DObject); + void validateProgram(Platform3DObject); void vertexAttrib1f(unsigned long indx, float x); void vertexAttrib1fv(unsigned long indx, float* values); @@ -311,8 +303,9 @@ public: private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; + WebKit::WebViewImpl* m_webViewImpl; #if USE(ACCELERATED_COMPOSITING) - RefPtr<WebGLLayerChromium> m_compositingLayer; + RefPtr<CanvasLayerChromium> m_compositingLayer; #endif #if PLATFORM(SKIA) // If the width and height of the Canvas's backing store don't @@ -329,9 +322,10 @@ private: }; GraphicsContext3DInternal::GraphicsContext3DInternal() + : m_webViewImpl(0) #if PLATFORM(SKIA) #elif PLATFORM(CG) - : m_renderOutput(0) + , m_renderOutput(0) #else #error Must port to your platform #endif @@ -362,18 +356,18 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, Chrome* chrome = static_cast<Chrome*>(hostWindow); WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(chrome->client()); - WebKit::WebViewImpl* webView = chromeClientImpl->webView(); + m_webViewImpl = chromeClientImpl->webView(); - if (!webView) + if (!m_webViewImpl) return false; - if (!webContext->initialize(webAttributes, webView)) { + if (!webContext->initialize(webAttributes, m_webViewImpl)) { delete webContext; return false; } m_impl.set(webContext); #if USE(ACCELERATED_COMPOSITING) - m_compositingLayer = WebGLLayerChromium::create(0); + m_compositingLayer = CanvasLayerChromium::create(0); #endif return true; } @@ -394,13 +388,13 @@ void GraphicsContext3DInternal::prepareTexture() } #if USE(ACCELERATED_COMPOSITING) -WebGLLayerChromium* GraphicsContext3DInternal::platformLayer() const +CanvasLayerChromium* GraphicsContext3DInternal::platformLayer() const { return m_compositingLayer.get(); } #endif -void GraphicsContext3DInternal::paintRenderingResultsToCanvas(WebGLRenderingContext* context) +void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingContext* context) { HTMLCanvasElement* canvas = context->canvas(); ImageBuffer* imageBuffer = canvas->buffer(); @@ -422,9 +416,8 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(WebGLRenderingCont m_resizingBitmap.setConfig(SkBitmap::kARGB_8888_Config, m_impl->width(), m_impl->height()); - if (!m_resizingBitmap.allocPixels()) { + if (!m_resizingBitmap.allocPixels()) return; - } } readbackBitmap = &m_resizingBitmap; } @@ -459,8 +452,12 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(WebGLRenderingCont #endif } -void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context) +void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext* context) { + // If the gpu compositor is on then skip the readback and software rendering path. + if (m_webViewImpl->isAcceleratedCompositingActive()) + return; + paintRenderingResultsToCanvas(context); } @@ -508,42 +505,18 @@ void GraphicsContext3DInternal::name(t1 a1) \ m_impl->name(a1); \ } -#define DELEGATE_TO_IMPL_1_X(name, t1) \ -void GraphicsContext3DInternal::name(t1 a1) \ -{ \ - m_impl->name(EXTRACT(a1)); \ -} - #define DELEGATE_TO_IMPL_1R(name, t1, rt) \ rt GraphicsContext3DInternal::name(t1 a1) \ { \ return m_impl->name(a1); \ } -#define DELEGATE_TO_IMPL_1R_X(name, t1, rt) \ -rt GraphicsContext3DInternal::name(t1 a1) \ -{ \ - return m_impl->name(EXTRACT(a1)); \ -} - #define DELEGATE_TO_IMPL_2(name, t1, t2) \ void GraphicsContext3DInternal::name(t1 a1, t2 a2) \ { \ m_impl->name(a1, a2); \ } -#define DELEGATE_TO_IMPL_2_X12(name, t1, t2) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2) \ -{ \ - m_impl->name(EXTRACT(a1), EXTRACT(a2)); \ -} - -#define DELEGATE_TO_IMPL_2_X2(name, t1, t2) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2) \ -{ \ - m_impl->name(a1, EXTRACT(a2)); \ -} - #define DELEGATE_TO_IMPL_2R(name, t1, t2, rt) \ rt GraphicsContext3DInternal::name(t1 a1, t2 a2) \ { \ @@ -556,12 +529,6 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ m_impl->name(a1, a2, a3); \ } -#define DELEGATE_TO_IMPL_3_X1(name, t1, t2, t3) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ -{ \ - m_impl->name(EXTRACT(a1), a2, a3); \ -} - #define DELEGATE_TO_IMPL_3R(name, t1, t2, t3, rt) \ rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ { \ @@ -574,30 +541,12 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ m_impl->name(a1, a2, a3, a4); \ } -#define DELEGATE_TO_IMPL_4_X1(name, t1, t2, t3, t4) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ -{ \ - m_impl->name(EXTRACT(a1), a2, a3, a4); \ -} - -#define DELEGATE_TO_IMPL_4_X4(name, t1, t2, t3, t4) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ -{ \ - m_impl->name(a1, a2, a3, EXTRACT(a4)); \ -} - #define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ m_impl->name(a1, a2, a3, a4, a5); \ } -#define DELEGATE_TO_IMPL_5_X4(name, t1, t2, t3, t4, t5) \ -void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ -{ \ - m_impl->name(a1, a2, a3, EXTRACT(a4), a5); \ -} - #define DELEGATE_TO_IMPL_5R(name, t1, t2, t3, t4, t5, rt) \ rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ @@ -649,43 +598,17 @@ bool GraphicsContext3DInternal::isGLES2Compliant() const } DELEGATE_TO_IMPL_1(activeTexture, unsigned long) -DELEGATE_TO_IMPL_2_X12(attachShader, WebGLProgram*, WebGLShader*) +DELEGATE_TO_IMPL_2(attachShader, Platform3DObject, Platform3DObject) -void GraphicsContext3DInternal::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name) +void GraphicsContext3DInternal::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name) { - m_impl->bindAttribLocation(EXTRACT(program), index, name.utf8().data()); -} - -DELEGATE_TO_IMPL_2_X2(bindBuffer, unsigned long, WebGLBuffer*) -DELEGATE_TO_IMPL_2_X2(bindFramebuffer, unsigned long, WebGLFramebuffer*) -DELEGATE_TO_IMPL_2_X2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*) - -static const int kTextureWrapR = 0x8072; - -// If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps, -// we could just use: -// DELEGATE_TO_IMPL_2_X2(bindTexture, unsigned long, WebGLTexture*) -void GraphicsContext3DInternal::bindTexture(unsigned long target, - WebGLTexture* texture) -{ - unsigned int textureObject = EXTRACT(texture); - - m_impl->bindTexture(target, textureObject); - - // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0 - // API. On desktop OpenGL implementations it seems necessary to - // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior - // of cube maps. - if (texture) - if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) { - if (!texture->isCubeMapRWrapModeInitialized()) { - m_impl->texParameteri(GraphicsContext3D::TEXTURE_CUBE_MAP, kTextureWrapR, GraphicsContext3D::CLAMP_TO_EDGE); - texture->setCubeMapRWrapModeInitialized(true); - } - } else - texture->setCubeMapRWrapModeInitialized(false); + m_impl->bindAttribLocation(program, index, name.utf8().data()); } +DELEGATE_TO_IMPL_2(bindBuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindFramebuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindRenderbuffer, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_2(bindTexture, unsigned long, Platform3DObject) DELEGATE_TO_IMPL_4(blendColor, double, double, double, double) DELEGATE_TO_IMPL_1(blendEquation, unsigned long) DELEGATE_TO_IMPL_2(blendEquationSeparate, unsigned long, unsigned long) @@ -723,7 +646,7 @@ DELEGATE_TO_IMPL_4(clearColor, double, double, double, double) DELEGATE_TO_IMPL_1(clearDepth, double) DELEGATE_TO_IMPL_1(clearStencil, long) DELEGATE_TO_IMPL_4(colorMask, bool, bool, bool, bool) -DELEGATE_TO_IMPL_1_X(compileShader, WebGLShader*) +DELEGATE_TO_IMPL_1(compileShader, Platform3DObject) DELEGATE_TO_IMPL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) DELEGATE_TO_IMPL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long) @@ -731,7 +654,7 @@ DELEGATE_TO_IMPL_1(cullFace, unsigned long) DELEGATE_TO_IMPL_1(depthFunc, unsigned long) DELEGATE_TO_IMPL_1(depthMask, bool) DELEGATE_TO_IMPL_2(depthRange, double, double) -DELEGATE_TO_IMPL_2_X12(detachShader, WebGLProgram*, WebGLShader*) +DELEGATE_TO_IMPL_2(detachShader, Platform3DObject, Platform3DObject) DELEGATE_TO_IMPL_1(disable, unsigned long) DELEGATE_TO_IMPL_1(disableVertexAttribArray, unsigned long) DELEGATE_TO_IMPL_3(drawArrays, unsigned long, long, long) @@ -741,15 +664,15 @@ DELEGATE_TO_IMPL_1(enable, unsigned long) DELEGATE_TO_IMPL_1(enableVertexAttribArray, unsigned long) DELEGATE_TO_IMPL(finish) DELEGATE_TO_IMPL(flush) -DELEGATE_TO_IMPL_4_X4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*) -DELEGATE_TO_IMPL_5_X4(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long) +DELEGATE_TO_IMPL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) +DELEGATE_TO_IMPL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) DELEGATE_TO_IMPL_1(frontFace, unsigned long) DELEGATE_TO_IMPL_1(generateMipmap, unsigned long) -bool GraphicsContext3DInternal::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info) +bool GraphicsContext3DInternal::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info) { WebKit::WebGraphicsContext3D::ActiveInfo webInfo; - if (!m_impl->getActiveAttrib(EXTRACT(program), index, webInfo)) + if (!m_impl->getActiveAttrib(program, index, webInfo)) return false; info.name = webInfo.name; info.type = webInfo.type; @@ -757,10 +680,10 @@ bool GraphicsContext3DInternal::getActiveAttrib(WebGLProgram* program, unsigned return true; } -bool GraphicsContext3DInternal::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info) +bool GraphicsContext3DInternal::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info) { WebKit::WebGraphicsContext3D::ActiveInfo webInfo; - if (!m_impl->getActiveUniform(EXTRACT(program), index, webInfo)) + if (!m_impl->getActiveUniform(program, index, webInfo)) return false; info.name = webInfo.name; info.type = webInfo.type; @@ -768,11 +691,11 @@ bool GraphicsContext3DInternal::getActiveUniform(WebGLProgram* program, unsigned return true; } -DELEGATE_TO_IMPL_4_X1(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*) +DELEGATE_TO_IMPL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) -int GraphicsContext3DInternal::getAttribLocation(WebGLProgram* program, const String& name) +int GraphicsContext3DInternal::getAttribLocation(Platform3DObject program, const String& name) { - return m_impl->getAttribLocation(EXTRACT(program), name.utf8().data()); + return m_impl->getAttribLocation(program, name.utf8().data()); } DELEGATE_TO_IMPL_2(getBooleanv, unsigned long, unsigned char*) @@ -799,25 +722,25 @@ DELEGATE_TO_IMPL_4(getFramebufferAttachmentParameteriv, unsigned long, unsigned DELEGATE_TO_IMPL_2(getIntegerv, unsigned long, int*) -DELEGATE_TO_IMPL_3_X1(getProgramiv, WebGLProgram*, unsigned long, int*) +DELEGATE_TO_IMPL_3(getProgramiv, Platform3DObject, unsigned long, int*) -String GraphicsContext3DInternal::getProgramInfoLog(WebGLProgram* program) +String GraphicsContext3DInternal::getProgramInfoLog(Platform3DObject program) { - return m_impl->getProgramInfoLog(EXTRACT(program)); + return m_impl->getProgramInfoLog(program); } DELEGATE_TO_IMPL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) -DELEGATE_TO_IMPL_3_X1(getShaderiv, WebGLShader*, unsigned long, int*) +DELEGATE_TO_IMPL_3(getShaderiv, Platform3DObject, unsigned long, int*) -String GraphicsContext3DInternal::getShaderInfoLog(WebGLShader* shader) +String GraphicsContext3DInternal::getShaderInfoLog(Platform3DObject shader) { - return m_impl->getShaderInfoLog(EXTRACT(shader)); + return m_impl->getShaderInfoLog(shader); } -String GraphicsContext3DInternal::getShaderSource(WebGLShader* shader) +String GraphicsContext3DInternal::getShaderSource(Platform3DObject shader) { - return m_impl->getShaderSource(EXTRACT(shader)); + return m_impl->getShaderSource(shader); } String GraphicsContext3DInternal::getString(unsigned long name) @@ -828,12 +751,12 @@ String GraphicsContext3DInternal::getString(unsigned long name) DELEGATE_TO_IMPL_3(getTexParameterfv, unsigned long, unsigned long, float*) DELEGATE_TO_IMPL_3(getTexParameteriv, unsigned long, unsigned long, int*) -DELEGATE_TO_IMPL_3_X1(getUniformfv, WebGLProgram*, long, float*) -DELEGATE_TO_IMPL_3_X1(getUniformiv, WebGLProgram*, long, int*) +DELEGATE_TO_IMPL_3(getUniformfv, Platform3DObject, long, float*) +DELEGATE_TO_IMPL_3(getUniformiv, Platform3DObject, long, int*) -long GraphicsContext3DInternal::getUniformLocation(WebGLProgram* program, const String& name) +long GraphicsContext3DInternal::getUniformLocation(Platform3DObject program, const String& name) { - return m_impl->getUniformLocation(EXTRACT(program), name.utf8().data()); + return m_impl->getUniformLocation(program, name.utf8().data()); } DELEGATE_TO_IMPL_3(getVertexAttribfv, unsigned long, unsigned long, float*) @@ -842,15 +765,15 @@ DELEGATE_TO_IMPL_3(getVertexAttribiv, unsigned long, unsigned long, int*) DELEGATE_TO_IMPL_2R(getVertexAttribOffset, unsigned long, unsigned long, long) DELEGATE_TO_IMPL_2(hint, unsigned long, unsigned long) -DELEGATE_TO_IMPL_1R_X(isBuffer, WebGLBuffer*, bool) +DELEGATE_TO_IMPL_1R(isBuffer, Platform3DObject, bool) DELEGATE_TO_IMPL_1R(isEnabled, unsigned long, bool) -DELEGATE_TO_IMPL_1R_X(isFramebuffer, WebGLFramebuffer*, bool) -DELEGATE_TO_IMPL_1R_X(isProgram, WebGLProgram*, bool) -DELEGATE_TO_IMPL_1R_X(isRenderbuffer, WebGLRenderbuffer*, bool) -DELEGATE_TO_IMPL_1R_X(isShader, WebGLShader*, bool) -DELEGATE_TO_IMPL_1R_X(isTexture, WebGLTexture*, bool) +DELEGATE_TO_IMPL_1R(isFramebuffer, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isProgram, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isRenderbuffer, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isShader, Platform3DObject, bool) +DELEGATE_TO_IMPL_1R(isTexture, Platform3DObject, bool) DELEGATE_TO_IMPL_1(lineWidth, double) -DELEGATE_TO_IMPL_1_X(linkProgram, WebGLProgram*) +DELEGATE_TO_IMPL_1(linkProgram, Platform3DObject) DELEGATE_TO_IMPL_2(pixelStorei, unsigned long, long) DELEGATE_TO_IMPL_2(polygonOffset, double, double) DELEGATE_TO_IMPL_7(readPixels, long, long, unsigned long, unsigned long, unsigned long, unsigned long, void*) @@ -859,9 +782,9 @@ DELEGATE_TO_IMPL_4(renderbufferStorage, unsigned long, unsigned long, unsigned l DELEGATE_TO_IMPL_2(sampleCoverage, double, bool) DELEGATE_TO_IMPL_4(scissor, long, long, unsigned long, unsigned long) -void GraphicsContext3DInternal::shaderSource(WebGLShader* shader, const String& string) +void GraphicsContext3DInternal::shaderSource(Platform3DObject shader, const String& string) { - m_impl->shaderSource(EXTRACT(shader), string.utf8().data()); + m_impl->shaderSource(shader, string.utf8().data()); } DELEGATE_TO_IMPL_3(stencilFunc, unsigned long, long, unsigned long) @@ -957,8 +880,8 @@ void GraphicsContext3DInternal::uniformMatrix4fv(long location, bool transpose, m_impl->uniformMatrix4fv(location, size, transpose, value); } -DELEGATE_TO_IMPL_1_X(useProgram, WebGLProgram*) -DELEGATE_TO_IMPL_1_X(validateProgram, WebGLProgram*) +DELEGATE_TO_IMPL_1(useProgram, Platform3DObject) +DELEGATE_TO_IMPL_1(validateProgram, Platform3DObject) DELEGATE_TO_IMPL_2(vertexAttrib1f, unsigned long, float) DELEGATE_TO_IMPL_2(vertexAttrib1fv, unsigned long, float*) @@ -1129,9 +1052,9 @@ void GraphicsContext3D::prepareTexture() #if USE(ACCELERATED_COMPOSITING) PlatformLayer* GraphicsContext3D::platformLayer() const { - WebGLLayerChromium* webGLLayer = m_internal->platformLayer(); - webGLLayer->setContext(this); - return webGLLayer; + CanvasLayerChromium* canvasLayer = m_internal->platformLayer(); + canvasLayer->setContext(this); + return canvasLayer; } #endif @@ -1140,13 +1063,13 @@ DELEGATE_TO_INTERNAL_1R(sizeInBytes, int, int) DELEGATE_TO_INTERNAL_2(reshape, int, int) DELEGATE_TO_INTERNAL_1(activeTexture, unsigned long) -DELEGATE_TO_INTERNAL_2(attachShader, WebGLProgram*, WebGLShader*) -DELEGATE_TO_INTERNAL_3(bindAttribLocation, WebGLProgram*, unsigned long, const String&) +DELEGATE_TO_INTERNAL_2(attachShader, Platform3DObject, Platform3DObject) +DELEGATE_TO_INTERNAL_3(bindAttribLocation, Platform3DObject, unsigned long, const String&) -DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, WebGLBuffer*) -DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, WebGLFramebuffer*) -DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*) -DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, WebGLTexture*) +DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, Platform3DObject) DELEGATE_TO_INTERNAL_4(blendColor, double, double, double, double) DELEGATE_TO_INTERNAL_1(blendEquation, unsigned long) DELEGATE_TO_INTERNAL_2(blendEquationSeparate, unsigned long, unsigned long) @@ -1165,7 +1088,7 @@ DELEGATE_TO_INTERNAL_4(clearColor, double, double, double, double) DELEGATE_TO_INTERNAL_1(clearDepth, double) DELEGATE_TO_INTERNAL_1(clearStencil, long) DELEGATE_TO_INTERNAL_4(colorMask, bool, bool, bool, bool) -DELEGATE_TO_INTERNAL_1(compileShader, WebGLShader*) +DELEGATE_TO_INTERNAL_1(compileShader, Platform3DObject) DELEGATE_TO_INTERNAL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) DELEGATE_TO_INTERNAL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long) @@ -1173,7 +1096,7 @@ DELEGATE_TO_INTERNAL_1(cullFace, unsigned long) DELEGATE_TO_INTERNAL_1(depthFunc, unsigned long) DELEGATE_TO_INTERNAL_1(depthMask, bool) DELEGATE_TO_INTERNAL_2(depthRange, double, double) -DELEGATE_TO_INTERNAL_2(detachShader, WebGLProgram*, WebGLShader*) +DELEGATE_TO_INTERNAL_2(detachShader, Platform3DObject, Platform3DObject) DELEGATE_TO_INTERNAL_1(disable, unsigned long) DELEGATE_TO_INTERNAL_1(disableVertexAttribArray, unsigned long) DELEGATE_TO_INTERNAL_3(drawArrays, unsigned long, long, long) @@ -1183,17 +1106,17 @@ DELEGATE_TO_INTERNAL_1(enable, unsigned long) DELEGATE_TO_INTERNAL_1(enableVertexAttribArray, unsigned long) DELEGATE_TO_INTERNAL(finish) DELEGATE_TO_INTERNAL(flush) -DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*) -DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long) +DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) +DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) DELEGATE_TO_INTERNAL_1(frontFace, unsigned long) DELEGATE_TO_INTERNAL_1(generateMipmap, unsigned long) -DELEGATE_TO_INTERNAL_3R(getActiveAttrib, WebGLProgram*, unsigned long, ActiveInfo&, bool) -DELEGATE_TO_INTERNAL_3R(getActiveUniform, WebGLProgram*, unsigned long, ActiveInfo&, bool) +DELEGATE_TO_INTERNAL_3R(getActiveAttrib, Platform3DObject, unsigned long, ActiveInfo&, bool) +DELEGATE_TO_INTERNAL_3R(getActiveUniform, Platform3DObject, unsigned long, ActiveInfo&, bool) -DELEGATE_TO_INTERNAL_4(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*) +DELEGATE_TO_INTERNAL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) -DELEGATE_TO_INTERNAL_2R(getAttribLocation, WebGLProgram*, const String&, int) +DELEGATE_TO_INTERNAL_2R(getAttribLocation, Platform3DObject, const String&, int) DELEGATE_TO_INTERNAL_2(getBooleanv, unsigned long, unsigned char*) @@ -1209,26 +1132,26 @@ DELEGATE_TO_INTERNAL_4(getFramebufferAttachmentParameteriv, unsigned long, unsig DELEGATE_TO_INTERNAL_2(getIntegerv, unsigned long, int*) -DELEGATE_TO_INTERNAL_3(getProgramiv, WebGLProgram*, unsigned long, int*) +DELEGATE_TO_INTERNAL_3(getProgramiv, Platform3DObject, unsigned long, int*) -DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, WebGLProgram*, String) +DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, Platform3DObject, String) DELEGATE_TO_INTERNAL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) -DELEGATE_TO_INTERNAL_3(getShaderiv, WebGLShader*, unsigned long, int*) +DELEGATE_TO_INTERNAL_3(getShaderiv, Platform3DObject, unsigned long, int*) -DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, WebGLShader*, String) +DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, Platform3DObject, String) -DELEGATE_TO_INTERNAL_1R(getShaderSource, WebGLShader*, String) +DELEGATE_TO_INTERNAL_1R(getShaderSource, Platform3DObject, String) DELEGATE_TO_INTERNAL_1R(getString, unsigned long, String) DELEGATE_TO_INTERNAL_3(getTexParameterfv, unsigned long, unsigned long, float*) DELEGATE_TO_INTERNAL_3(getTexParameteriv, unsigned long, unsigned long, int*) -DELEGATE_TO_INTERNAL_3(getUniformfv, WebGLProgram*, long, float*) -DELEGATE_TO_INTERNAL_3(getUniformiv, WebGLProgram*, long, int*) +DELEGATE_TO_INTERNAL_3(getUniformfv, Platform3DObject, long, float*) +DELEGATE_TO_INTERNAL_3(getUniformiv, Platform3DObject, long, int*) -DELEGATE_TO_INTERNAL_2R(getUniformLocation, WebGLProgram*, const String&, long) +DELEGATE_TO_INTERNAL_2R(getUniformLocation, Platform3DObject, const String&, long) DELEGATE_TO_INTERNAL_3(getVertexAttribfv, unsigned long, unsigned long, float*) DELEGATE_TO_INTERNAL_3(getVertexAttribiv, unsigned long, unsigned long, int*) @@ -1236,15 +1159,15 @@ DELEGATE_TO_INTERNAL_3(getVertexAttribiv, unsigned long, unsigned long, int*) DELEGATE_TO_INTERNAL_2R(getVertexAttribOffset, unsigned long, unsigned long, long) DELEGATE_TO_INTERNAL_2(hint, unsigned long, unsigned long) -DELEGATE_TO_INTERNAL_1R(isBuffer, WebGLBuffer*, bool) +DELEGATE_TO_INTERNAL_1R(isBuffer, Platform3DObject, bool) DELEGATE_TO_INTERNAL_1R(isEnabled, unsigned long, bool) -DELEGATE_TO_INTERNAL_1R(isFramebuffer, WebGLFramebuffer*, bool) -DELEGATE_TO_INTERNAL_1R(isProgram, WebGLProgram*, bool) -DELEGATE_TO_INTERNAL_1R(isRenderbuffer, WebGLRenderbuffer*, bool) -DELEGATE_TO_INTERNAL_1R(isShader, WebGLShader*, bool) -DELEGATE_TO_INTERNAL_1R(isTexture, WebGLTexture*, bool) +DELEGATE_TO_INTERNAL_1R(isFramebuffer, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isProgram, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isRenderbuffer, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isShader, Platform3DObject, bool) +DELEGATE_TO_INTERNAL_1R(isTexture, Platform3DObject, bool) DELEGATE_TO_INTERNAL_1(lineWidth, double) -DELEGATE_TO_INTERNAL_1(linkProgram, WebGLProgram*) +DELEGATE_TO_INTERNAL_1(linkProgram, Platform3DObject) DELEGATE_TO_INTERNAL_2(pixelStorei, unsigned long, long) DELEGATE_TO_INTERNAL_2(polygonOffset, double, double) @@ -1254,7 +1177,7 @@ DELEGATE_TO_INTERNAL(releaseShaderCompiler) DELEGATE_TO_INTERNAL_4(renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_2(sampleCoverage, double, bool) DELEGATE_TO_INTERNAL_4(scissor, long, long, unsigned long, unsigned long) -DELEGATE_TO_INTERNAL_2(shaderSource, WebGLShader*, const String&) +DELEGATE_TO_INTERNAL_2(shaderSource, Platform3DObject, const String&) DELEGATE_TO_INTERNAL_3(stencilFunc, unsigned long, long, unsigned long) DELEGATE_TO_INTERNAL_4(stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) DELEGATE_TO_INTERNAL_1(stencilMask, unsigned long) @@ -1287,8 +1210,8 @@ DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, long, bool, float*, int) DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, long, bool, float*, int) DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, long, bool, float*, int) -DELEGATE_TO_INTERNAL_1(useProgram, WebGLProgram*) -DELEGATE_TO_INTERNAL_1(validateProgram, WebGLProgram*) +DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject) +DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject) DELEGATE_TO_INTERNAL_2(vertexAttrib1f, unsigned long, float) DELEGATE_TO_INTERNAL_2(vertexAttrib1fv, unsigned long, float*) @@ -1302,8 +1225,8 @@ DELEGATE_TO_INTERNAL_6(vertexAttribPointer, unsigned long, int, int, bool, unsig DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long) -DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, WebGLRenderingContext*) -DELEGATE_TO_INTERNAL_1(beginPaint, WebGLRenderingContext*) +DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*) +DELEGATE_TO_INTERNAL_1(beginPaint, CanvasRenderingContext*) DELEGATE_TO_INTERNAL(endPaint) DELEGATE_TO_INTERNAL_R(createBuffer, unsigned) diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 4489e9b..3eab622 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -32,6 +32,7 @@ #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "WebIDBCallbacks.h" +#include "WebIDBCursorImpl.h" #include "WebIDBDatabaseImpl.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndexImpl.h" @@ -69,9 +70,15 @@ void IDBCallbacksProxy::onSuccess() m_callbacks.clear(); } -void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabase> idbDatabase) +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend) { - m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(idbDatabase)); + m_callbacks->onSuccess(new WebKit::WebIDBCursorImpl(idbCursorBackend)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) +{ + m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(backend)); m_callbacks.clear(); } @@ -87,9 +94,9 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> idbKey) m_callbacks.clear(); } -void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore) +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend) { - m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(idbObjectStore)); + m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(backend)); m_callbacks.clear(); } diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index 10fc31a..506dbb0 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -49,10 +49,11 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(); // For "null". - virtual void onSuccess(PassRefPtr<IDBDatabase>); + virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>); + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>); virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); virtual void onSuccess(PassRefPtr<IDBKey>); - virtual void onSuccess(PassRefPtr<IDBObjectStore>); + virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); private: diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp new file mode 100644 index 0000000..fff00b7 --- /dev/null +++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "IDBCursorBackendProxy.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBAny.h" +#include "IDBCallbacks.h" +#include "SerializedScriptValue.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBKey.h" + +namespace WebCore { + +PassRefPtr<IDBCursorBackendInterface> IDBCursorBackendProxy::create(PassOwnPtr<WebKit::WebIDBCursor> idbCursor) +{ + return adoptRef(new IDBCursorBackendProxy(idbCursor)); +} + +IDBCursorBackendProxy::IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor> idbCursor) + : m_idbCursor(idbCursor) +{ +} + +IDBCursorBackendProxy::~IDBCursorBackendProxy() +{ +} + +unsigned short IDBCursorBackendProxy::direction() const +{ + return m_idbCursor->direction(); +} + +PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const +{ + return m_idbCursor->key(); +} + +PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const +{ + RefPtr<SerializedScriptValue> value = PassRefPtr<SerializedScriptValue>(m_idbCursor->value()); + return IDBAny::create(value.get()); +} + +void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBCursorBackendProxy::remove(PassRefPtr<IDBCallbacks> callbacks) +{ + m_idbCursor->remove(new WebIDBCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h new file mode 100644 index 0000000..d8b621a --- /dev/null +++ b/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 IDBCursorBackendProxy_h +#define IDBCursorBackendProxy_h + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBCursorBackendInterface.h" +#include "WebIDBCursor.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class IDBCursorBackendProxy : public IDBCursorBackendInterface { +public: + static PassRefPtr<IDBCursorBackendInterface> create(PassOwnPtr<WebKit::WebIDBCursor>); + virtual ~IDBCursorBackendProxy(); + + virtual unsigned short direction() const; + virtual PassRefPtr<IDBKey> key() const; + virtual PassRefPtr<IDBAny> value() const; + virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>); + virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); + virtual void remove(PassRefPtr<IDBCallbacks>); + +private: + IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor>); + + OwnPtr<WebKit::WebIDBCursor> m_idbCursor; +}; + +} // namespace WebCore + +#endif + +#endif // IDBCursorBackendProxy_h diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp index 9d009c0..d11d182 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.cpp +++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp @@ -29,6 +29,7 @@ #include "DOMStringList.h" #include "IDBCallbacks.h" #include "IDBObjectStoreProxy.h" +#include "IDBTransactionBackendInterface.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" @@ -39,7 +40,7 @@ namespace WebCore { -PassRefPtr<IDBDatabase> IDBDatabaseProxy::create(PassOwnPtr<WebKit::WebIDBDatabase> database) +PassRefPtr<IDBDatabaseBackendInterface> IDBDatabaseProxy::create(PassOwnPtr<WebKit::WebIDBDatabase> database) { return adoptRef(new IDBDatabaseProxy(database)); } @@ -78,7 +79,7 @@ void IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPa m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, new WebIDBCallbacksImpl(callbacks)); } -PassRefPtr<IDBObjectStore> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode) +PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode) { WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->objectStore(name, mode); if (!objectStore) @@ -91,6 +92,13 @@ void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallb m_webIDBDatabase->removeObjectStore(name, new WebIDBCallbacksImpl(callbacks)); } +PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout) +{ + // FIXME: plumb to the browser process, etc etc. + ASSERT_NOT_REACHED(); + return 0; +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h index 36588f0..ed2016a 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.h +++ b/WebKit/chromium/src/IDBDatabaseProxy.h @@ -26,7 +26,7 @@ #ifndef IDBDatabaseProxy_h #define IDBDatabaseProxy_h -#include "IDBDatabase.h" +#include "IDBDatabaseBackendInterface.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -37,9 +37,9 @@ namespace WebKit { class WebIDBDatabase; } namespace WebCore { -class IDBDatabaseProxy : public IDBDatabase { +class IDBDatabaseProxy : public IDBDatabaseBackendInterface { public: - static PassRefPtr<IDBDatabase> create(PassOwnPtr<WebKit::WebIDBDatabase>); + static PassRefPtr<IDBDatabaseBackendInterface> create(PassOwnPtr<WebKit::WebIDBDatabase>); virtual ~IDBDatabaseProxy(); virtual String name() const; @@ -50,8 +50,9 @@ public: // FIXME: Add transaction and setVersion. virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); - virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode); + virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode); virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout); private: IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase>); diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp index 858ed20..ad27fa3 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -29,7 +29,9 @@ #include "DOMStringList.h" #include "IDBCallbacks.h" #include "IDBIndexBackendProxy.h" +#include "IDBKeyRange.h" #include "WebIDBCallbacksImpl.h" +#include "WebIDBKeyRange.h" #include "WebIDBIndex.h" #include "WebIDBKey.h" #include "WebIDBObjectStore.h" @@ -39,7 +41,7 @@ namespace WebCore { -PassRefPtr<IDBObjectStore> IDBObjectStoreProxy::create(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) +PassRefPtr<IDBObjectStoreBackendInterface> IDBObjectStoreProxy::create(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) { return adoptRef(new IDBObjectStoreProxy(objectStore)); } @@ -101,6 +103,11 @@ void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallback m_webIDBObjectStore->removeIndex(name, new WebIDBCallbacksImpl(callbacks)); } +void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h index b380bdc..a334572 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.h +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -26,7 +26,7 @@ #ifndef IDBObjectStoreProxy_h #define IDBObjectStoreProxy_h -#include "IDBObjectStore.h" +#include "IDBObjectStoreBackendInterface.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -37,9 +37,9 @@ namespace WebKit { class WebIDBObjectStore; } namespace WebCore { -class IDBObjectStoreProxy : public IDBObjectStore { +class IDBObjectStoreProxy : public IDBObjectStoreBackendInterface { public: - static PassRefPtr<IDBObjectStore> create(PassOwnPtr<WebKit::WebIDBObjectStore>); + static PassRefPtr<IDBObjectStoreBackendInterface> create(PassOwnPtr<WebKit::WebIDBObjectStore>); ~IDBObjectStoreProxy(); String name() const; @@ -54,6 +54,8 @@ public: PassRefPtr<IDBIndexBackendInterface> index(const String& name); void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>); + private: IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>); diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index cf491f7..76acbb2 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -36,7 +36,6 @@ #include "NotImplemented.h" #include "Page.h" #include "WebDevToolsAgentImpl.h" -#include "WebDevToolsMessageData.h" #include "WebRect.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -94,7 +93,7 @@ void InspectorClientImpl::storeSetting(const String& key, const String& value) agent->storeSetting(key, value); } -bool InspectorClientImpl::sendMessageToFrontend(const WebCore::String& message) +bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message) { if (WebDevToolsAgentImpl* agent = devToolsAgent()) return agent->sendMessageToFrontend(message); diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index 0605ccd..34fcdc3 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -53,10 +53,10 @@ public: virtual void highlight(WebCore::Node*); virtual void hideHighlight(); - virtual void populateSetting(const WebCore::String& key, WebCore::String* value); - virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + virtual void populateSetting(const WTF::String& key, WTF::String* value); + virtual void storeSetting(const WTF::String& key, const WTF::String& value); - virtual bool sendMessageToFrontend(const WebCore::String&); + virtual bool sendMessageToFrontend(const WTF::String&); virtual void resourceTrackingWasEnabled(); virtual void resourceTrackingWasDisabled(); diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 870bdee..46f2cb6 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -40,6 +40,7 @@ #include "V8Proxy.h" #include "WebDevToolsFrontendClient.h" #include "WebDevToolsFrontendImpl.h" +#include "WebString.h" using namespace WebCore; @@ -126,13 +127,7 @@ void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) { - WebDevToolsMessageData messageData; - messageData.className = "ToolsAgent"; - messageData.methodName = "dispatchOnInspectorController"; - WebVector<WebString> args(static_cast<size_t>(1)); - args[0] = message; - messageData.arguments.swap(args); - m_client->sendMessageToAgent(messageData); + m_client->sendMessageToBackend(message); } } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.h b/WebKit/chromium/src/InspectorFrontendClientImpl.h index f7174ce..1507bf2 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -56,8 +56,8 @@ public: virtual void moveWindowBy(float x, float y); - virtual WebCore::String localizedStringsURL(); - virtual WebCore::String hiddenPanels(); + virtual WTF::String localizedStringsURL(); + virtual WTF::String hiddenPanels(); virtual void bringToFront(); virtual void closeWindow(); @@ -66,9 +66,9 @@ public: virtual void requestDetachWindow(); virtual void changeAttachedWindowHeight(unsigned); - virtual void inspectedURLChanged(const WebCore::String&); + virtual void inspectedURLChanged(const WTF::String&); - virtual void sendMessageToBackend(const WebCore::String&); + virtual void sendMessageToBackend(const WTF::String&); private: WebCore::Page* m_frontendPage; WebDevToolsFrontendClient* m_client; diff --git a/WebKit/chromium/src/ProfilerAgent.h b/WebKit/chromium/src/ProfilerAgent.h deleted file mode 100644 index 52337b8..0000000 --- a/WebKit/chromium/src/ProfilerAgent.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2010 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 ProfilerAgent_h -#define ProfilerAgent_h - -#include "DevToolsRPC.h" - -namespace WebKit { - -// Profiler agent provides API for retrieving profiler data. -// These methods are handled on the IO thread, so profiler can -// operate while a script on a page performs heavy work. -#define PROFILER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Requests current profiler state. */ \ - METHOD0(getActiveProfilerModules) \ - \ - /* Retrieves portion of profiler log. */ \ - METHOD1(getLogLines, int /* position */) - -DEFINE_RPC_CLASS(ProfilerAgent, PROFILER_AGENT_STRUCT) - -#define PROFILER_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Response to getActiveProfilerModules. */ \ - METHOD1(didGetActiveProfilerModules, int /* flags */) \ - \ - /* Response to getLogLines. */ \ - METHOD2(didGetLogLines, int /* position */, String /* log */) - -DEFINE_RPC_CLASS(ProfilerAgentDelegate, PROFILER_AGENT_DELEGATE_STRUCT) - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/ToolsAgent.h b/WebKit/chromium/src/ToolsAgent.h deleted file mode 100644 index 937fcf0..0000000 --- a/WebKit/chromium/src/ToolsAgent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2010 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 ToolsAgent_h -#define ToolsAgent_h - -#include "DevToolsRPC.h" - -namespace WebKit { - -// Tools agent provides API for enabling / disabling other agents as well as -// API for auxiliary UI functions such as dom elements highlighting. -#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Dispatches given function on the InspectorController object */ \ - METHOD1(dispatchOnInspectorController, String /* message */) \ - -DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT) - -#define TOOLS_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Response to the DispatchOn*. */ \ - METHOD3(didDispatchOn, int /* call_id */, String /* result */, String /* exception */) \ - \ - /* Sends InspectorFrontend message to be dispatched on client. */ \ - METHOD1(dispatchOnClient, String /* data */) - -DEFINE_RPC_CLASS(ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT) - -} // namespace WebKit - -#endif diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 1a65bfe..4de5624 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -31,36 +31,23 @@ #include "config.h" #include "WebDevToolsAgentImpl.h" -#include "BoundObject.h" #include "DebuggerAgentImpl.h" #include "DebuggerAgentManager.h" -#include "Document.h" -#include "EventListener.h" #include "InjectedScriptHost.h" -#include "InspectorBackend.h" #include "InspectorBackendDispatcher.h" #include "InspectorController.h" -#include "InspectorFrontend.h" -#include "InspectorResource.h" -#include "Node.h" #include "Page.h" #include "PageGroup.h" #include "PlatformString.h" -#include "ProfilerAgentImpl.h" #include "ResourceError.h" #include "ResourceRequest.h" #include "ResourceResponse.h" #include "ScriptDebugServer.h" -#include "ScriptObject.h" -#include "ScriptState.h" -#include "ScriptValue.h" #include "V8Binding.h" #include "V8Proxy.h" #include "V8Utilities.h" #include "WebDataSource.h" #include "WebDevToolsAgentClient.h" -#include "WebDevToolsMessageData.h" -#include "WebDevToolsMessageTransport.h" #include "WebFrameImpl.h" #include "WebRect.h" #include "WebString.h" @@ -73,24 +60,16 @@ #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> -using WebCore::Document; using WebCore::DocumentLoader; using WebCore::FrameLoader; using WebCore::InjectedScriptHost; -using WebCore::InspectorBackend; using WebCore::InspectorController; -using WebCore::InspectorFrontend; -using WebCore::InspectorResource; using WebCore::Node; using WebCore::Page; using WebCore::ResourceError; using WebCore::ResourceRequest; using WebCore::ResourceResponse; -using WebCore::SafeAllocation; -using WebCore::ScriptObject; -using WebCore::ScriptState; -using WebCore::ScriptValue; -using WebCore::String; +using WTF::String; using WebCore::V8DOMWrapper; using WebCore::V8Proxy; @@ -98,32 +77,11 @@ namespace WebKit { namespace { -void InspectorBackendWeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter) -{ - InspectorBackend* backend = static_cast<InspectorBackend*>(parameter); - backend->deref(); - object.Dispose(); -} - +static const char kFrontendConnectedFeatureName[] = "frontend-connected"; static const char kResourceTrackingFeatureName[] = "resource-tracking"; static const char kTimelineFeatureName[] = "timeline-profiler"; static const char kApuAgentFeatureName[] = "apu-agent"; -class IORPCDelegate : public DevToolsRPC::Delegate, public Noncopyable { -public: - IORPCDelegate() : m_transport(0) { } - explicit IORPCDelegate(WebDevToolsMessageTransport* transport) : m_transport(transport) { } - virtual ~IORPCDelegate() { } - virtual void sendRpcMessage(const WebDevToolsMessageData& data) - { - if (m_transport) - m_transport->sendMessageToFrontendOnIOThread(data); - } - -private: - WebDevToolsMessageTransport* m_transport; -}; - class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop { public: static void ensureClientMessageLoopCreated(WebDevToolsAgentClient* client) @@ -222,24 +180,12 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl( { DebuggerAgentManager::setExposeV8DebuggerProtocol( client->exposeV8DebuggerProtocol()); - m_debuggerAgentDelegateStub.set(new DebuggerAgentDelegateStub(this)); - m_toolsAgentDelegateStub.set(new ToolsAgentDelegateStub(this)); - m_apuAgentDelegateStub.set(new ApuAgentDelegateStub(this)); } WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { DebuggerAgentManager::onWebViewClosed(m_webViewImpl); ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); - disposeUtilityContext(); -} - -void WebDevToolsAgentImpl::disposeUtilityContext() -{ - if (!m_utilityContext.IsEmpty()) { - m_utilityContext.Dispose(); - m_utilityContext.Clear(); - } } void WebDevToolsAgentImpl::attach() @@ -251,42 +197,44 @@ void WebDevToolsAgentImpl::attach() ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); m_debuggerAgentImpl.set( - new DebuggerAgentImpl(m_webViewImpl, - m_debuggerAgentDelegateStub.get(), - this)); - createInspectorFrontendProxy(); - - // Allow controller to send messages to the frontend. - InspectorController* ic = inspectorController(); + new DebuggerAgentImpl(m_webViewImpl, this, m_client)); + WebCString debuggerScriptJs = m_client->debuggerScriptSource(); + WebCore::ScriptDebugServer::shared().setDebuggerScriptSource( + WTF::String(debuggerScriptJs.data(), debuggerScriptJs.length())); - { // TODO(yurys): the source should have already been pushed by the frontend. - v8::HandleScope scope; - v8::Context::Scope contextScope(m_utilityContext); - v8::Handle<v8::Value> constructorValue = m_utilityContext->Global()->Get( - v8::String::New("injectedScriptConstructor")); - if (constructorValue->IsFunction()) { - String source = WebCore::toWebCoreString(constructorValue); - ic->injectedScriptHost()->setInjectedScriptSource("(" + source + ")"); - } + // TODO(yurys): the source should have already been pushed by the frontend. + WebCString injectedScriptJs = m_client->injectedScriptSource(); + String injectedScriptSource = String::fromUTF8(injectedScriptJs.data(), injectedScriptJs.length()); + const char* varDefinition = "var injectedScriptConstructor = "; + int pos = injectedScriptSource.find(varDefinition); + if (pos == -1) { + ASSERT_NOT_REACHED(); + return; } - - setInspectorFrontendProxyToInspectorController(); + pos += String(varDefinition).length(); + injectedScriptSource = injectedScriptSource.substring(pos); + inspectorController()->injectedScriptHost()->setInjectedScriptSource(injectedScriptSource); m_attached = true; } void WebDevToolsAgentImpl::detach() { // Prevent controller from sending messages to the frontend. - InspectorController* ic = m_webViewImpl->page()->inspectorController(); + InspectorController* ic = inspectorController(); ic->disconnectFrontend(); ic->hideHighlight(); ic->close(); - disposeUtilityContext(); m_debuggerAgentImpl.set(0); m_attached = false; m_apuAgentEnabled = false; } +void WebDevToolsAgentImpl::frontendLoaded() +{ + inspectorController()->connectFrontend(); + m_client->runtimeFeatureStateChanged(kFrontendConnectedFeatureName, true); +} + void WebDevToolsAgentImpl::didNavigate() { ClientMessageLoopAdapter::didNavigate(); @@ -296,10 +244,6 @@ void WebDevToolsAgentImpl::didNavigate() void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) { DebuggerAgentManager::setHostId(webframe, m_hostId); - if (m_attached) { - // Push context id into the client if it is already attached. - m_debuggerAgentDelegateStub->setContextId(m_hostId); - } } void WebDevToolsAgentImpl::forceRepaint() @@ -307,23 +251,11 @@ void WebDevToolsAgentImpl::forceRepaint() m_client->forceRepaint(); } -void WebDevToolsAgentImpl::dispatchOnInspectorController(const String& message) +void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) { inspectorController()->inspectorBackendDispatcher()->dispatch(message); } -void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data) -{ - if (ToolsAgentDispatch::dispatch(this, data)) - return; - - if (!m_attached) - return; - - if (m_debuggerAgentImpl.get() && DebuggerAgentDispatch::dispatch(m_debuggerAgentImpl.get(), data)) - return; -} - void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) { m_webViewImpl->inspectElementAt(point); @@ -336,67 +268,19 @@ void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& feature, bo else if (feature == kTimelineFeatureName) setTimelineProfilingEnabled(enabled); else if (feature == kResourceTrackingFeatureName) { - InspectorController* ic = m_webViewImpl->page()->inspectorController(); + InspectorController* ic = inspectorController(); if (enabled) ic->enableResourceTracking(false /* not sticky */, false /* no reload */); else ic->disableResourceTracking(false /* not sticky */); - } -} - -void WebDevToolsAgentImpl::sendRpcMessage(const WebDevToolsMessageData& data) -{ - m_client->sendMessageToFrontend(data); -} - -void WebDevToolsAgentImpl::compileUtilityScripts() -{ - v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_utilityContext); - // Inject javascript into the context. - WebCString injectedScriptJs = m_client->injectedScriptSource(); - v8::Script::Compile(v8::String::New( - injectedScriptJs.data(), - injectedScriptJs.length()))->Run(); - WebCString injectDispatchJs = m_client->injectedScriptDispatcherSource(); - v8::Script::Compile(v8::String::New( - injectDispatchJs.data(), - injectDispatchJs.length()))->Run(); -} - -void WebDevToolsAgentImpl::initDevToolsAgentHost() -{ - BoundObject devtoolsAgentHost(m_utilityContext, this, "DevToolsAgentHost"); - devtoolsAgentHost.addProtoFunction( - "dispatch", - WebDevToolsAgentImpl::jsDispatchOnClient); - devtoolsAgentHost.build(); -} - -void WebDevToolsAgentImpl::createInspectorFrontendProxy() -{ - disposeUtilityContext(); - m_utilityContext = v8::Context::New(); - compileUtilityScripts(); - initDevToolsAgentHost(); - WebCString debuggerScriptJs = m_client->debuggerScriptSource(); - WebCore::ScriptDebugServer::shared().setDebuggerScriptSource( - WebCore::String(debuggerScriptJs.data(), debuggerScriptJs.length())); -} - -void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() -{ - v8::HandleScope scope; - ScriptState* state = ScriptState::forContext( - v8::Local<v8::Context>::New(m_utilityContext)); - InspectorController* ic = inspectorController(); - ic->connectFrontend(ScriptObject(state, m_utilityContext->Global())); + } else if (feature == kFrontendConnectedFeatureName && enabled && !inspectorController()->hasFrontend()) + frontendLoaded(); } void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) { m_apuAgentEnabled = enabled; - InspectorController* ic = m_webViewImpl->page()->inspectorController(); + InspectorController* ic = inspectorController(); if (enabled) { m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); ic->startTimelineProfiler(); @@ -417,32 +301,6 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) enabled); } -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsDispatchOnClient(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String message = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (message.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - - if (!agent->m_apuAgentEnabled) { - agent->m_toolsAgentDelegateStub->dispatchOnClient(message); - return v8::Undefined(); - } - - String method = WebCore::toWebCoreStringWithNullCheck(args[1]); - if (method.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); - - if (method != "addRecordToTimeline" && method != "updateResource" && method != "addResource") - return v8::Undefined(); - - agent->m_apuAgentDelegateStub->dispatchToApu(message); - return v8::Undefined(); -} - WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() { if (Page* page = m_webViewImpl->page()) @@ -537,24 +395,18 @@ void WebDevToolsAgentImpl::storeSetting(const String& key, const String& value) m_webViewImpl->setInspectorSetting(key, value); } -bool WebDevToolsAgentImpl::sendMessageToFrontend(const WebCore::String& message) +bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message) { WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_webViewImpl->devToolsAgent()); if (!devToolsAgent) return false; - if (devToolsAgent->m_apuAgentEnabled && devToolsAgent->m_apuAgentDelegateStub) { - devToolsAgent->m_apuAgentDelegateStub->dispatchToApu(message); + if (devToolsAgent->m_apuAgentEnabled) { + m_client->sendDispatchToAPU(message); return true; } - WebVector<WebString> arguments(size_t(1)); - arguments[0] = message; - WebDevToolsMessageData data; - data.className = "ToolsAgentDelegate"; - data.methodName = "dispatchOnClient"; - data.arguments.swap(arguments); - devToolsAgent->sendRpcMessage(data); + m_client->sendMessageToInspectorFrontend(message); return true; } @@ -608,12 +460,4 @@ void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler DebuggerAgentManager::setMessageLoopDispatchHandler(handler); } -bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(WebDevToolsMessageTransport* transport, const WebDevToolsMessageData& data) -{ - IORPCDelegate delegate(transport); - ProfilerAgentDelegateStub stub(&delegate); - ProfilerAgentImpl agent(&stub); - return ProfilerAgentDispatch::dispatch(&agent, data); -} - } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index c8e22b0..a0d2647 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -33,12 +33,10 @@ #include "InspectorClient.h" -#include "APUAgentDelegate.h" -#include "DevToolsRPC.h" -#include "ToolsAgent.h" #include "WebDevToolsAgentPrivate.h" #include <v8.h> +#include <wtf/Forward.h> #include <wtf/OwnPtr.h> namespace WebCore { @@ -46,12 +44,10 @@ class Document; class InspectorClient; class InspectorController; class Node; -class String; } namespace WebKit { -class DebuggerAgentDelegateStub; class DebuggerAgentImpl; class WebDevToolsAgentClient; class WebFrame; @@ -64,24 +60,20 @@ struct WebURLError; struct WebDevToolsMessageData; class WebDevToolsAgentImpl : public WebDevToolsAgentPrivate, - public ToolsAgent, - public DevToolsRPC::Delegate, public WebCore::InspectorClient { public: WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client); virtual ~WebDevToolsAgentImpl(); - // ToolsAgent implementation. - virtual void dispatchOnInspectorController(const WebCore::String& message); - // WebDevToolsAgentPrivate implementation. virtual void didClearWindowObject(WebFrameImpl* frame); // WebDevToolsAgent implementation. virtual void attach(); virtual void detach(); + virtual void frontendLoaded(); virtual void didNavigate(); - virtual void dispatchMessageFromFrontend(const WebDevToolsMessageData& data); + virtual void dispatchOnInspectorBackend(const WebString& message); virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); virtual void setRuntimeFeatureEnabled(const WebString& feature, bool enabled); @@ -99,30 +91,19 @@ public: virtual void openInspectorFrontend(WebCore::InspectorController*); virtual void highlight(WebCore::Node*); virtual void hideHighlight(); - virtual void populateSetting(const WebCore::String& key, WebCore::String* value); - virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + virtual void populateSetting(const WTF::String& key, WTF::String* value); + virtual void storeSetting(const WTF::String& key, const WTF::String& value); virtual void resourceTrackingWasEnabled(); virtual void resourceTrackingWasDisabled(); virtual void timelineProfilerWasStarted(); virtual void timelineProfilerWasStopped(); - virtual bool sendMessageToFrontend(const WebCore::String&); - - // DevToolsRPC::Delegate implementation. - virtual void sendRpcMessage(const WebDevToolsMessageData& data); + virtual bool sendMessageToFrontend(const WTF::String&); void forceRepaint(); int hostId() { return m_hostId; } private: - static v8::Handle<v8::Value> jsDispatchOnClient(const v8::Arguments& args); - - void disposeUtilityContext(); - - void compileUtilityScripts(); - void initDevToolsAgentHost(); - void createInspectorFrontendProxy(); - void setInspectorFrontendProxyToInspectorController(); void setApuAgentEnabled(bool enabled); WebCore::InspectorController* inspectorController(); @@ -130,16 +111,10 @@ private: int m_hostId; WebDevToolsAgentClient* m_client; WebViewImpl* m_webViewImpl; - OwnPtr<DebuggerAgentDelegateStub> m_debuggerAgentDelegateStub; - OwnPtr<ToolsAgentDelegateStub> m_toolsAgentDelegateStub; OwnPtr<DebuggerAgentImpl> m_debuggerAgentImpl; - OwnPtr<ApuAgentDelegateStub> m_apuAgentDelegateStub; bool m_apuAgentEnabled; bool m_resourceTrackingWasEnabled; bool m_attached; - // TODO(pfeldman): This should not be needed once GC styles issue is fixed - // for matching rules. - v8::Persistent<v8::Context> m_utilityContext; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 592a532..c1b09c4 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -35,8 +35,6 @@ #include "ContextMenuController.h" #include "ContextMenuItem.h" #include "DOMWindow.h" -#include "DebuggerAgent.h" -#include "DevToolsRPCJS.h" #include "Document.h" #include "Event.h" #include "Frame.h" @@ -48,10 +46,8 @@ #include "Page.h" #include "Pasteboard.h" #include "PlatformString.h" -#include "ProfilerAgent.h" #include "SecurityOrigin.h" #include "Settings.h" -#include "ToolsAgent.h" #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8InspectorFrontendHost.h" @@ -78,10 +74,6 @@ static v8::Local<v8::String> ToV8String(const String& s) return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()), s.length()); } -DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT, DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT) -DEFINE_RPC_JS_BOUND_OBJ(ProfilerAgent, PROFILER_AGENT_STRUCT, ProfilerAgentDelegate, PROFILER_AGENT_DELEGATE_STRUCT) -DEFINE_RPC_JS_BOUND_OBJ(ToolsAgent, TOOLS_AGENT_STRUCT, ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT) - WebDevToolsFrontend* WebDevToolsFrontend::create( WebView* view, WebDevToolsFrontendClient* client, @@ -113,16 +105,9 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( v8::HandleScope scope; v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); - m_debuggerAgentObj.set(new JSDebuggerAgentBoundObj(this, frameContext, "RemoteDebuggerAgent")); - m_profilerAgentObj.set(new JSProfilerAgentBoundObj(this, frameContext, "RemoteProfilerAgent")); - m_toolsAgentObj.set(new JSToolsAgentBoundObj(this, frameContext, "RemoteToolsAgent")); - // Debugger commands should be sent using special method. BoundObject debuggerCommandExecutorObj(frameContext, this, "RemoteDebuggerCommandExecutor"); debuggerCommandExecutorObj.addProtoFunction( - "DebuggerCommand", - WebDevToolsFrontendImpl::jsDebuggerCommand); - debuggerCommandExecutorObj.addProtoFunction( "DebuggerPauseScript", WebDevToolsFrontendImpl::jsDebuggerPauseScript); debuggerCommandExecutorObj.build(); @@ -132,33 +117,7 @@ WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() { } -void WebDevToolsFrontendImpl::dispatchMessageFromAgent(const WebDevToolsMessageData& data) -{ - Vector<String> v; - v.append(data.className); - v.append(data.methodName); - for (size_t i = 0; i < data.arguments.size(); i++) - v.append(data.arguments[i]); - if (!m_loaded) { - m_pendingIncomingMessages.append(v); - return; - } - executeScript(v); -} - -void WebDevToolsFrontendImpl::frontendLoaded() -{ - m_loaded = true; - - for (Vector<Vector<String> >::iterator it = m_pendingIncomingMessages.begin(); - it != m_pendingIncomingMessages.end(); - ++it) { - executeScript(*it); - } - m_pendingIncomingMessages.clear(); -} - -void WebDevToolsFrontendImpl::executeScript(const Vector<String>& v) +void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& message) { WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); v8::HandleScope scope; @@ -168,24 +127,15 @@ void WebDevToolsFrontendImpl::executeScript(const Vector<String>& v) ASSERT(dispatchFunction->IsFunction()); v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); Vector< v8::Handle<v8::Value> > args; - for (size_t i = 0; i < v.size(); i++) - args.append(ToV8String(v.at(i))); + args.append(ToV8String(message)); v8::TryCatch tryCatch; tryCatch.SetVerbose(true); function->Call(frameContext->Global(), args.size(), args.data()); } -void WebDevToolsFrontendImpl::sendRpcMessage(const WebDevToolsMessageData& data) -{ - m_client->sendMessageToAgent(data); -} - -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerCommand(const v8::Arguments& args) +void WebDevToolsFrontendImpl::frontendLoaded() { - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - WebString command = WebCore::toWebCoreStringWithNullCheck(args[0]); - frontend->m_client->sendDebuggerCommandToAgent(command); - return v8::Undefined(); + m_client->sendFrontendLoaded(); } v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerPauseScript(const v8::Arguments& args) diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/WebKit/chromium/src/WebDevToolsFrontendImpl.h index fa4707d..e4f22fe 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -31,9 +31,10 @@ #ifndef WebDevToolsFrontendImpl_h #define WebDevToolsFrontendImpl_h -#include "DevToolsRPC.h" +#include "PlatformString.h" #include "WebDevToolsFrontend.h" #include <v8.h> +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -44,20 +45,17 @@ namespace WebCore { class ContextMenuItem; class Node; class Page; -class String; } namespace WebKit { -class JSDebuggerAgentBoundObj; -class JSProfilerAgentBoundObj; -class JSToolsAgentBoundObj; class WebDevToolsClientDelegate; class WebViewImpl; struct WebDevToolsMessageData; +using WTF::String; + class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend - , public DevToolsRPC::Delegate , public Noncopyable { public: WebDevToolsFrontendImpl( @@ -66,28 +64,18 @@ public: const String& applicationLocale); virtual ~WebDevToolsFrontendImpl(); - // DevToolsRPC::Delegate implementation. - virtual void sendRpcMessage(const WebKit::WebDevToolsMessageData& data); - // WebDevToolsFrontend implementation. - virtual void dispatchMessageFromAgent(const WebKit::WebDevToolsMessageData& data); + virtual void dispatchOnInspectorFrontend(const WebString& message); void frontendLoaded(); private: - void executeScript(const Vector<String>& v); - - static v8::Handle<v8::Value> jsDebuggerCommand(const v8::Arguments& args); static v8::Handle<v8::Value> jsDebuggerPauseScript(const v8::Arguments& args); WebKit::WebViewImpl* m_webViewImpl; WebKit::WebDevToolsFrontendClient* m_client; String m_applicationLocale; - OwnPtr<JSDebuggerAgentBoundObj> m_debuggerAgentObj; - OwnPtr<JSProfilerAgentBoundObj> m_profilerAgentObj; - OwnPtr<JSToolsAgentBoundObj> m_toolsAgentObj; bool m_loaded; - Vector<Vector<String> > m_pendingIncomingMessages; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientation.cpp b/WebKit/chromium/src/WebDeviceOrientation.cpp new file mode 100644 index 0000000..47f6bd1 --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientation.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "WebDeviceOrientation.h" + +#include "DeviceOrientation.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrientation>& orientation) +{ + if (!orientation) { + m_isNull = true; + m_canProvideAlpha = false; + m_alpha = 0; + m_canProvideBeta = false; + m_beta = 0; + m_canProvideGamma = false; + m_gamma = 0; + return; + } + + m_isNull = false; + m_canProvideAlpha = orientation->canProvideAlpha(); + m_alpha = orientation->alpha(); + m_canProvideBeta = orientation->canProvideBeta(); + m_beta = orientation->beta(); + m_canProvideGamma = orientation->canProvideGamma(); + m_gamma = orientation->gamma(); +} + +WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore::DeviceOrientation>& orientation) +{ + if (!orientation) { + m_isNull = true; + m_canProvideAlpha = false; + m_alpha = 0; + m_canProvideBeta = false; + m_beta = 0; + m_canProvideGamma = false; + m_gamma = 0; + return *this; + } + + m_isNull = false; + m_canProvideAlpha = orientation->canProvideAlpha(); + m_alpha = orientation->alpha(); + m_canProvideBeta = orientation->canProvideBeta(); + m_beta = orientation->beta(); + m_canProvideGamma = orientation->canProvideGamma(); + m_gamma = orientation->gamma(); + return *this; +} + +WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>() const +{ + if (m_isNull) + return 0; + return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp new file mode 100644 index 0000000..4011d12 --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "WebDeviceOrientationClientMock.h" + +#include "DeviceOrientationClientMock.h" +#include "WebDeviceOrientation.h" +#include "WebDeviceOrientationController.h" + +namespace WebKit { + +void WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller) +{ + m_clientMock->setController(controller->controller()); +} + +void WebDeviceOrientationClientMock::startUpdating() +{ + m_clientMock->startUpdating(); +} + +void WebDeviceOrientationClientMock::stopUpdating() +{ + m_clientMock->stopUpdating(); +} + +WebDeviceOrientation WebDeviceOrientationClientMock::lastOrientation() const +{ + return WebDeviceOrientation(m_clientMock->lastOrientation()); +} + +void WebDeviceOrientationClientMock::setOrientation(WebDeviceOrientation& orientation) +{ + m_clientMock->setOrientation(orientation); +} + +void WebDeviceOrientationClientMock::initialize() +{ + m_clientMock = new WebCore::DeviceOrientationClientMock(); +} + +void WebDeviceOrientationClientMock::reset() +{ + delete m_clientMock; + m_clientMock = 0; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebDeviceOrientationController.cpp b/WebKit/chromium/src/WebDeviceOrientationController.cpp new file mode 100644 index 0000000..aa9249f --- /dev/null +++ b/WebKit/chromium/src/WebDeviceOrientationController.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "WebDeviceOrientationController.h" + +#include "DeviceOrientation.h" +#include "DeviceOrientationController.h" +#include "WebDeviceOrientation.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +void WebDeviceOrientationController::didChangeDeviceOrientation(const WebDeviceOrientation& orientation) +{ + PassRefPtr<WebCore::DeviceOrientation> deviceOrientation(orientation); + m_controller->didChangeDeviceOrientation(deviceOrientation.get()); +} + +WebCore::DeviceOrientationController* WebDeviceOrientationController::controller() const +{ + return m_controller; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index 665d8d9..30b619b 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -52,7 +52,7 @@ namespace { namespace WebKit { -void populateMap(WTF::HashMap<int, WebCore::String>& map, +void populateMap(WTF::HashMap<int, WTF::String>& map, const Entity* entities, size_t entitiesCount, bool standardHTML) diff --git a/WebKit/chromium/src/WebEntities.h b/WebKit/chromium/src/WebEntities.h index ad3c310..a01cc5d 100644 --- a/WebKit/chromium/src/WebEntities.h +++ b/WebKit/chromium/src/WebEntities.h @@ -59,12 +59,12 @@ public: // entity name. If yes, return the entity notation. If not, returns an // empty string. Parameter isHTML indicates check the code in html entity // map or in xml entity map. - WebCore::String entityNameByCode(int code) const; + WTF::String entityNameByCode(int code) const; // Returns a new string with corresponding entity names replaced. - WebCore::String convertEntitiesInString(const WebCore::String&) const; + WTF::String convertEntitiesInString(const WTF::String&) const; private: - typedef HashMap<int, WebCore::String> EntitiesMapType; + typedef HashMap<int, WTF::String> EntitiesMapType; // An internal object that maps the Unicode character to corresponding // entity notation. EntitiesMapType m_entitiesMap; diff --git a/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp b/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp index 4152dc5..ef2409c 100644 --- a/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp +++ b/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp @@ -48,7 +48,7 @@ void WebFileChooserCompletionImpl::didChooseFile(const WebVector<WebString>& fil m_fileChooser->chooseFile(fileNames[0]); else { // This clause handles a case of file_names.size()==0 too. - Vector<WebCore::String> paths; + Vector<WTF::String> paths; for (size_t i = 0; i < fileNames.size(); ++i) paths.append(fileNames[i]); m_fileChooser->chooseFiles(paths); diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index 2511fce..00e8ecb 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -285,7 +285,7 @@ private: // It is not necessary if the frame is invisible, for example, or if this // is a repeat search that already returned nothing last time the same prefix // was searched. - bool shouldScopeMatches(const WebCore::String& searchText); + bool shouldScopeMatches(const WTF::String& searchText); // Queue up a deferred call to scopeStringMatches. void scopeStringMatchesSoon( @@ -336,7 +336,7 @@ private: // short-circuiting searches in the following scenarios: When a frame has // been searched and returned 0 results, we don't need to search that frame // again if the user is just adding to the search (making it more specific). - WebCore::String m_lastSearchString; + WTF::String m_lastSearchString; // Keeps track of how many matches this frame has found so far, so that we // don't loose count between scoping efforts, and is also used (in conjunction diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp index 265ef4f..3c3a1db 100644 --- a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp @@ -58,7 +58,7 @@ using WebCore::GeolocationServiceClient; using WebCore::Geoposition; using WebCore::PositionError; using WebCore::PositionOptions; -using WebCore::String; +using WTF::String; namespace WebKit { diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp index 00d819b..2a10c96 100644 --- a/WebKit/chromium/src/WebGeolocationServiceMock.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp @@ -50,7 +50,7 @@ using WebCore::GeolocationServiceMock; using WebCore::Geoposition; using WebCore::PositionError; using WebCore::PositionOptions; -using WebCore::String; +using WTF::String; namespace WebCore { class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient { diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 47bb5a0..410ac3b 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -32,13 +32,13 @@ #if ENABLE(3D_CANVAS) -#include <stdio.h> -#include <string.h> - #include "WebGraphicsContext3DDefaultImpl.h" #include "NotImplemented.h" +#include <stdio.h> +#include <string.h> + #if OS(LINUX) #include <dlfcn.h> #endif diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index e409bf5..8223a1c 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -325,8 +325,8 @@ private: static bool s_initializedGLEW; #if OS(WINDOWS) - HWND m_canvasWindow; - HDC m_canvasDC; + HWND m_canvasWindow; + HDC m_canvasDC; HGLRC m_contextObj; #elif PLATFORM(CG) CGLPBufferObj m_pbuffer; diff --git a/WebKit/chromium/src/WebHTTPBody.cpp b/WebKit/chromium/src/WebHTTPBody.cpp index d062576..fa75387 100644 --- a/WebKit/chromium/src/WebHTTPBody.cpp +++ b/WebKit/chromium/src/WebHTTPBody.cpp @@ -79,7 +79,7 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const result.type = Element::TypeData; result.data.assign(element.m_data.data(), element.m_data.size()); result.filePath.reset(); -#if ENABLE(BLOB_SLICE) +#if ENABLE(BLOB) result.fileStart = 0; result.fileLength = 0; result.fileInfo.modificationTime = 0.0; @@ -89,7 +89,7 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const result.type = Element::TypeFile; result.data.reset(); result.filePath = element.m_filename; -#if ENABLE(BLOB_SLICE) +#if ENABLE(BLOB) result.fileStart = element.m_fileStart; result.fileLength = element.m_fileLength; result.fileInfo.modificationTime = element.m_expectedFileModificationTime; @@ -123,7 +123,7 @@ void WebHTTPBody::appendFile(const WebString& filePath) void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo) { -#if ENABLE(BLOB_SLICE) +#if ENABLE(BLOB) ensureMutable(); m_private->appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime); #endif diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index dbf7d85..e543123 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -27,6 +27,7 @@ #include "WebIDBCallbacksImpl.h" #include "IDBCallbacks.h" +#include "IDBCursorBackendProxy.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "IDBIndexBackendProxy.h" @@ -65,6 +66,12 @@ void WebIDBCallbacksImpl::onSuccess() m_callbacks.clear(); } +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBCursor* cursor) +{ + m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor)); + m_callbacks.clear(); +} + void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance) { m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h index a4d53b5..1835c60 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -43,6 +43,7 @@ public: virtual void onError(const WebKit::WebIDBDatabaseError&); virtual void onSuccess(); // For "null". + virtual void onSuccess(WebKit::WebIDBCursor*); virtual void onSuccess(WebKit::WebIDBDatabase*); virtual void onSuccess(const WebKit::WebIDBKey&); virtual void onSuccess(WebKit::WebIDBIndex*); diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp new file mode 100644 index 0000000..1ade687 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "WebIDBCursorImpl.h" + +#include "IDBAny.h" +#include "IDBCallbacksProxy.h" +#include "IDBCursorBackendInterface.h" +#include "IDBKey.h" +#include "WebIDBKey.h" + +using namespace WebCore; + +namespace WebKit { + +WebIDBCursorImpl::WebIDBCursorImpl(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend) + : m_idbCursorBackend(idbCursorBackend) +{ +} + +WebIDBCursorImpl::~WebIDBCursorImpl() +{ +} + +unsigned short WebIDBCursorImpl::direction() const +{ + return m_idbCursorBackend->direction(); +} + +WebIDBKey WebIDBCursorImpl::key() const +{ + return WebIDBKey(m_idbCursorBackend->key()); +} + +WebSerializedScriptValue WebIDBCursorImpl::value() const +{ + return m_idbCursorBackend->value()->serializedScriptValue(); +} + +void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->update(value, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBCursorImpl::remove(WebIDBCallbacks* callbacks) +{ + m_idbCursorBackend->remove(IDBCallbacksProxy::create(callbacks)); +} + +} // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h new file mode 100644 index 0000000..565e86a --- /dev/null +++ b/WebKit/chromium/src/WebIDBCursorImpl.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 WebIDBCursorImpl_h +#define WebIDBCursorImpl_h + +#include "WebCommon.h" +#include "WebIDBCursor.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBCursorBackendInterface; } + +namespace WebKit { + +// See comment in WebIndexedObjectStore for a high level overview these classes. +class WebIDBCursorImpl : public WebIDBCursor { +public: + WebIDBCursorImpl(WTF::PassRefPtr<WebCore::IDBCursorBackendInterface>); + virtual ~WebIDBCursorImpl(); + + virtual unsigned short direction() const; + virtual WebIDBKey key() const; + virtual WebSerializedScriptValue value() const; + virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*); + virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*); + virtual void remove(WebIDBCallbacks*); + + private: + WTF::RefPtr<WebCore::IDBCursorBackendInterface> m_idbCursorBackend; +}; + +} // namespace WebKit + +#endif // WebIDBCursorImpl_h diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index e2f771a..8c8e30a 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -28,7 +28,7 @@ #include "DOMStringList.h" #include "IDBCallbacksProxy.h" -#include "IDBDatabase.h" +#include "IDBDatabaseBackendInterface.h" #include "WebIDBCallbacks.h" #include "WebIDBObjectStoreImpl.h" @@ -38,8 +38,8 @@ using namespace WebCore; namespace WebKit { -WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> database) - : m_database(database) +WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabaseBackendInterface> databaseBackend) + : m_databaseBackend(databaseBackend) { } @@ -49,32 +49,32 @@ WebIDBDatabaseImpl::~WebIDBDatabaseImpl() WebString WebIDBDatabaseImpl::name() const { - return m_database->name(); + return m_databaseBackend->name(); } WebString WebIDBDatabaseImpl::description() const { - return m_database->description(); + return m_databaseBackend->description(); } WebString WebIDBDatabaseImpl::version() const { - return m_database->version(); + return m_databaseBackend->version(); } WebDOMStringList WebIDBDatabaseImpl::objectStores() const { - return m_database->objectStores(); + return m_databaseBackend->objectStores(); } void WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks) { - m_database->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks)); + m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks)); } WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode) { - RefPtr<IDBObjectStore> objectStore = m_database->objectStore(name, mode); + RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->objectStore(name, mode); if (!objectStore) return 0; return new WebIDBObjectStoreImpl(objectStore); @@ -82,7 +82,7 @@ WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsign void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) { - m_database->removeObjectStore(name, IDBCallbacksProxy::create(callbacks)); + m_databaseBackend->removeObjectStore(name, IDBCallbacksProxy::create(callbacks)); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h index c83d8d7..46a6609 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -31,7 +31,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -namespace WebCore { class IDBDatabase; } +namespace WebCore { class IDBDatabaseBackendInterface; } namespace WebKit { @@ -40,7 +40,7 @@ class WebIDBObjectStore; // See comment in WebIndexedDatabase for a high level overview these classes. class WebIDBDatabaseImpl : public WebIDBDatabase { public: - WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> database); + WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabaseBackendInterface>); virtual ~WebIDBDatabaseImpl(); virtual WebString name() const; @@ -53,7 +53,7 @@ public: virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks); private: - WTF::RefPtr<WebCore::IDBDatabase> m_database; + WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBKeyRange.cpp b/WebKit/chromium/src/WebIDBKeyRange.cpp new file mode 100644 index 0000000..4ce9452 --- /dev/null +++ b/WebKit/chromium/src/WebIDBKeyRange.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2010 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "WebIDBKeyRange.h" + +#include "IDBKey.h" +#include "IDBKeyRange.h" +#include "WebIDBKey.h" + +using WebCore::IDBKeyRange; + +namespace WebKit { + +void WebIDBKeyRange::assign(const WebIDBKeyRange& other) +{ + m_private = other.m_private; +} + +void WebIDBKeyRange::assign(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags) +{ + m_private = IDBKeyRange::create(left, right, flags); +} + +void WebIDBKeyRange::reset() +{ + m_private.reset(); +} + +WebIDBKey WebIDBKeyRange::left() const +{ + return m_private->left(); +} + +WebIDBKey WebIDBKeyRange::right() const +{ + return m_private->right(); +} + +unsigned short WebIDBKeyRange::flags() const +{ + return m_private->flags(); +} + +WebIDBKeyRange::WebIDBKeyRange(const PassRefPtr<IDBKeyRange>& value) + : m_private(value) +{ +} + +WebIDBKeyRange& WebIDBKeyRange::operator=(const PassRefPtr<IDBKeyRange>& value) +{ + m_private = value; + return *this; +} + +WebIDBKeyRange::operator PassRefPtr<IDBKeyRange>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 7b6a32a..1ad1d9f 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -28,9 +28,11 @@ #include "DOMStringList.h" #include "IDBCallbacksProxy.h" -#include "IDBObjectStore.h" +#include "IDBKeyRange.h" +#include "IDBObjectStoreBackendInterface.h" #include "WebIDBIndexImpl.h" #include "WebIDBKey.h" +#include "WebIDBKeyRange.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -39,7 +41,7 @@ using namespace WebCore; namespace WebKit { -WebIDBObjectStoreImpl::WebIDBObjectStoreImpl(PassRefPtr<IDBObjectStore> objectStore) +WebIDBObjectStoreImpl::WebIDBObjectStoreImpl(PassRefPtr<IDBObjectStoreBackendInterface> objectStore) : m_objectStore(objectStore) { } @@ -96,6 +98,11 @@ void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks* m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks)); } +void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks) +{ + m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 4064b7f..9f31369 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -31,7 +31,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -namespace WebCore { class IDBObjectStore; } +namespace WebCore { class IDBObjectStoreBackendInterface; } namespace WebKit { @@ -40,7 +40,7 @@ class WebIDBIndex; // See comment in WebIndexedObjectStore for a high level overview these classes. class WebIDBObjectStoreImpl : public WebIDBObjectStore { public: - WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStore> objectStore); + WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStoreBackendInterface>); ~WebIDBObjectStoreImpl(); WebString name() const; @@ -55,8 +55,10 @@ public: WebIDBIndex* index(const WebString& name); void removeIndex(const WebString& name, WebIDBCallbacks* callbacks); + void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*); + private: - WTF::RefPtr<WebCore::IDBObjectStore> m_objectStore; + WTF::RefPtr<WebCore::IDBObjectStoreBackendInterface> m_objectStore; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebInputEventConversion.cpp b/WebKit/chromium/src/WebInputEventConversion.cpp index 1c6d59c..f47a4e8 100644 --- a/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/WebKit/chromium/src/WebInputEventConversion.cpp @@ -104,7 +104,7 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo // MakePlatformKeyboardEvent -------------------------------------------------- -static inline const PlatformKeyboardEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) +static inline PlatformKeyboardEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) { switch (type) { case WebInputEvent::KeyUp: diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index 8346ef8..1d717ea 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -57,7 +57,7 @@ void initialize(WebKitClient* webKitClient) WTF::initializeThreading(); WTF::initializeMainThread(); - WebCore::AtomicString::init(); + WTF::AtomicString::init(); // Chromium sets the minimum interval timeout to 4ms, overriding the // default of 10ms. We'd like to go lower, however there are poorly diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 2b0c9a7..8f210a0 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -126,6 +126,10 @@ void WebMediaPlayerClientImpl::timeChanged() void WebMediaPlayerClientImpl::repaint() { ASSERT(m_mediaPlayer); +#if USE(ACCELERATED_COMPOSITING) + if (m_videoLayer.get() && supportsAcceleratedRendering()) + m_videoLayer->setNeedsDisplay(FloatRect(0, 0, m_videoLayer->bounds().width(), m_videoLayer->bounds().height())); +#endif m_mediaPlayer->repaint(); } diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 0faac26..df179a8 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -70,7 +70,7 @@ public: virtual float volume() const; // MediaPlayerPrivateInterface methods: - virtual void load(const WebCore::String& url); + virtual void load(const WTF::String& url); virtual void cancelLoad(); #if USE(ACCELERATED_COMPOSITING) virtual WebCore::PlatformLayer* platformLayer() const; @@ -114,9 +114,9 @@ private: WebMediaPlayerClientImpl(); static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); - static void getSupportedTypes(WTF::HashSet<WebCore::String>&); + static void getSupportedTypes(WTF::HashSet<WTF::String>&); static WebCore::MediaPlayer::SupportsType supportsType( - const WebCore::String& type, const WebCore::String& codecs); + const WTF::String& type, const WTF::String& codecs); WebCore::MediaPlayer* m_mediaPlayer; OwnPtr<WebMediaPlayer> m_webMediaPlayer; diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h index 8f6a99f..03f0a3b 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.h +++ b/WebKit/chromium/src/WebPageSerializerImpl.h @@ -32,10 +32,11 @@ #define WebPageSerializerImpl_h #include "PlatformString.h" -#include "StringBuilder.h" #include "StringHash.h" +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include "StringBuilder.h" #include "WebEntities.h" #include "WebPageSerializer.h" @@ -47,7 +48,6 @@ namespace WebCore { class Document; class Element; class Node; -class String; class TextEncoding; } @@ -93,7 +93,7 @@ private: WebPageSerializerClient* m_client; // This hash map is used to map resource URL of original link to its local // file path. - typedef HashMap<WebCore::String, WebCore::String> LinkLocalPathMap; + typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap; // local_links_ include all pair of local resource path and corresponding // original link. LinkLocalPathMap m_localLinks; @@ -107,7 +107,7 @@ private: // serialized or not; bool m_framesCollected; // Local directory name of all local resource files. - WebCore::String m_localDirectoryName; + WTF::String m_localDirectoryName; // Vector for saving all frames which need to be serialized. Vector<WebFrameImpl*> m_frames; @@ -124,7 +124,7 @@ private: // Document object of current frame. WebCore::Document* doc; // Local directory name of all local resource files. - const WebCore::String& directoryName; + const WTF::String& directoryName; // Flag indicates current doc is html document or not. It's a cache value // of Document.isHTMLDocument(). @@ -151,31 +151,31 @@ private: SerializeDomParam(const WebCore::KURL& currentFrameURL, const WebCore::TextEncoding& textEncoding, WebCore::Document* doc, - const WebCore::String& directoryName); + const WTF::String& directoryName); }; // Collect all target frames which need to be serialized. void collectTargetFrames(); // Before we begin serializing open tag of a element, we give the target // element a chance to do some work prior to add some additional data. - WebCore::String preActionBeforeSerializeOpenTag(const WebCore::Element* element, + WTF::String preActionBeforeSerializeOpenTag(const WebCore::Element* element, SerializeDomParam* param, bool* needSkip); // After we finish serializing open tag of a element, we give the target // element a chance to do some post work to add some additional data. - WebCore::String postActionAfterSerializeOpenTag(const WebCore::Element* element, + WTF::String postActionAfterSerializeOpenTag(const WebCore::Element* element, SerializeDomParam* param); // Before we begin serializing end tag of a element, we give the target // element a chance to do some work prior to add some additional data. - WebCore::String preActionBeforeSerializeEndTag(const WebCore::Element* element, + WTF::String preActionBeforeSerializeEndTag(const WebCore::Element* element, SerializeDomParam* param, bool* needSkip); // After we finish serializing end tag of a element, we give the target // element a chance to do some post work to add some additional data. - WebCore::String postActionAfterSerializeEndTag(const WebCore::Element* element, + WTF::String postActionAfterSerializeEndTag(const WebCore::Element* element, SerializeDomParam* param); // Save generated html content to data buffer. - void saveHTMLContentToBuffer(const WebCore::String& content, + void saveHTMLContentToBuffer(const WTF::String& content, SerializeDomParam* param); // Flushes the content buffer by encoding and sending the content to the // WebPageSerializerClient. Content is not flushed if the buffer is not full diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp index 217553b..9e21d58 100644 --- a/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -226,6 +226,16 @@ bool WebRuntimeFeatures::isTouchEnabled() #endif } +void WebRuntimeFeatures::enableDeviceMotion(bool enable) +{ + RuntimeEnabledFeatures::setDeviceMotionEnabled(enable); +} + +bool WebRuntimeFeatures::isDeviceMotionEnabled() +{ + return RuntimeEnabledFeatures::deviceMotionEnabled(); +} + void WebRuntimeFeatures::enableDeviceOrientation(bool enable) { RuntimeEnabledFeatures::setDeviceOrientationEnabled(enable); diff --git a/WebKit/chromium/src/ProfilerAgentImpl.cpp b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp index 07570df..6b04320 100644 --- a/WebKit/chromium/src/ProfilerAgentImpl.cpp +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -29,24 +29,58 @@ */ #include "config.h" -#include "ProfilerAgentImpl.h" +#include "WebSpeechInputControllerMockImpl.h" -#include <v8.h> +#include "PlatformString.h" +#include "SpeechInputClientMock.h" namespace WebKit { -void ProfilerAgentImpl::getActiveProfilerModules() +WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) { - m_delegate->didGetActiveProfilerModules(v8::V8::GetActiveProfilerModules()); + return new WebSpeechInputControllerMockImpl(listener); } -void ProfilerAgentImpl::getLogLines(int position) +WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( + WebSpeechInputListener* listener) + : m_webcoreMock(new WebCore::SpeechInputClientMock()) + , m_listener(listener) { - static char buffer[65536]; - const int readSize = v8::V8::GetLogLines(position, buffer, sizeof(buffer) - 1); - buffer[readSize] = '\0'; - position += readSize; - m_delegate->didGetLogLines(position, buffer); +} + +void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result) +{ + m_webcoreMock->setRecognitionResult(result); +} + +void WebSpeechInputControllerMockImpl::didCompleteRecording() +{ + m_listener->didCompleteRecording(); +} + +void WebSpeechInputControllerMockImpl::didCompleteRecognition() +{ + m_listener->didCompleteRecognition(); +} + +void WebSpeechInputControllerMockImpl::setRecognitionResult(const WTF::String& result) +{ + m_listener->setRecognitionResult(result); +} + +bool WebSpeechInputControllerMockImpl::startRecognition() +{ + return m_webcoreMock->startRecognition(this); +} + +void WebSpeechInputControllerMockImpl::cancelRecognition() +{ + m_webcoreMock->cancelRecognition(); +} + +void WebSpeechInputControllerMockImpl::stopRecording() +{ + m_webcoreMock->stopRecording(); } } // namespace WebKit diff --git a/WebKit/chromium/src/ProfilerAgentImpl.h b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h index d38f57c..046abf3 100644 --- a/WebKit/chromium/src/ProfilerAgentImpl.h +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h @@ -28,30 +28,45 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ProfilerAgentImpl_h -#define ProfilerAgentImpl_h +#ifndef WebSpeechInputControllerMockImpl_h +#define WebSpeechInputControllerMockImpl_h -#include "ProfilerAgent.h" +#include "SpeechInputListener.h" +#include "WebSpeechInputControllerMock.h" +#include "WebSpeechInputListener.h" +#include "WebString.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { +class SpeechInputClientMock; +} namespace WebKit { -class ProfilerAgentImpl : public ProfilerAgent { +class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener + , public WebSpeechInputControllerMock { public: - ProfilerAgentImpl(ProfilerAgentDelegate* delegate) : m_delegate(delegate) { } - virtual ~ProfilerAgentImpl() { } + WebSpeechInputControllerMockImpl(WebSpeechInputListener*); - // ProfilerAgent implementation. + // WebCore::SpeechInputListener methods. + void didCompleteRecording(); + void didCompleteRecognition(); + void setRecognitionResult(const WTF::String& result); - // This method is called on IO thread. - virtual void getActiveProfilerModules(); + // WebSpeechInputController methods. + bool startRecognition(); + void cancelRecognition(); + void stopRecording(); - // This method is called on IO thread. - virtual void getLogLines(int position); + // WebSpeechInputControllerMock methods. + void setMockRecognitionResult(const WebString& result); private: - ProfilerAgentDelegate* m_delegate; + OwnPtr<WebCore::SpeechInputClientMock> m_webcoreMock; + WebSpeechInputListener* m_listener; }; } // namespace WebKit -#endif +#endif // WebSpeechInputControllerMockImpl_h + diff --git a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp index 5fc6e16..53b4a75 100644 --- a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp +++ b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp @@ -61,7 +61,7 @@ WebStorageNamespaceImpl::~WebStorageNamespaceImpl() WebStorageArea* WebStorageNamespaceImpl::createStorageArea(const WebString& originString) { - WebCore::String originWebCoreString = originString; + WTF::String originWebCoreString = originString; if (originWebCoreString == "file://") { // FIXME: We should really be passing around WebSecurityOrigin objects // to represent security origins instead of strings. One issue diff --git a/WebKit/chromium/src/WebString.cpp b/WebKit/chromium/src/WebString.cpp index a61a059..bbbe9ce 100644 --- a/WebKit/chromium/src/WebString.cpp +++ b/WebKit/chromium/src/WebString.cpp @@ -39,7 +39,7 @@ namespace WebKit { -class WebStringPrivate : public WebCore::StringImpl { +class WebStringPrivate : public WTF::StringImpl { }; void WebString::reset() @@ -58,7 +58,7 @@ void WebString::assign(const WebString& other) void WebString::assign(const WebUChar* data, size_t length) { assign(static_cast<WebStringPrivate*>( - WebCore::StringImpl::create(data, length).get())); + WTF::StringImpl::create(data, length).get())); } size_t WebString::length() const @@ -73,17 +73,17 @@ const WebUChar* WebString::data() const WebCString WebString::utf8() const { - return WebCore::String(m_private).utf8(); + return WTF::String(m_private).utf8(); } WebString WebString::fromUTF8(const char* data, size_t length) { - return WebCore::String::fromUTF8(data, length); + return WTF::String::fromUTF8(data, length); } WebString WebString::fromUTF8(const char* data) { - return WebCore::String::fromUTF8(data); + return WTF::String::fromUTF8(data); } bool WebString::equals(const WebString& s) const @@ -91,39 +91,39 @@ bool WebString::equals(const WebString& s) const return equal(m_private, s.m_private); } -WebString::WebString(const WebCore::String& s) +WebString::WebString(const WTF::String& s) : m_private(static_cast<WebStringPrivate*>(s.impl())) { if (m_private) m_private->ref(); } -WebString& WebString::operator=(const WebCore::String& s) +WebString& WebString::operator=(const WTF::String& s) { assign(static_cast<WebStringPrivate*>(s.impl())); return *this; } -WebString::operator WebCore::String() const +WebString::operator WTF::String() const { return m_private; } -WebString::WebString(const WebCore::AtomicString& s) +WebString::WebString(const WTF::AtomicString& s) : m_private(0) { assign(s.string()); } -WebString& WebString::operator=(const WebCore::AtomicString& s) +WebString& WebString::operator=(const WTF::AtomicString& s) { assign(s.string()); return *this; } -WebString::operator WebCore::AtomicString() const +WebString::operator WTF::AtomicString() const { - return WebCore::AtomicString(static_cast<WebCore::StringImpl *>(m_private)); + return WTF::AtomicString(static_cast<WTF::StringImpl *>(m_private)); } void WebString::assign(WebStringPrivate* p) diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 691f143..8733a2a 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -41,6 +41,7 @@ #include "CSSStyleSelector.h" #include "CSSValueKeywords.h" #include "Cursor.h" +#include "DeviceOrientationClientProxy.h" #include "Document.h" #include "DocumentLoader.h" #include "DOMUtilitiesPrivate.h" @@ -177,8 +178,8 @@ static const PopupContainerSettings autoFillPopupSettings = { WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) { - // Keep runtime flag for device orientation turned off until it's implemented. - WebRuntimeFeatures::enableDeviceOrientation(false); + // Keep runtime flag for device motion turned off until it's implemented. + WebRuntimeFeatures::enableDeviceMotion(false); // Pass the WebViewImpl's self-reference to the caller. return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef(); @@ -266,6 +267,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools , m_speechInputClient(client) #endif , m_gles2Context(0) + , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0)) { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading @@ -288,9 +290,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools #if ENABLE(INPUT_SPEECH) pageClients.speechInputClient = &m_speechInputClient; #endif - m_page.set(new Page(pageClients)); + pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get(); - // the page will take ownership of the various clients + m_page.set(new Page(pageClients)); m_page->backForwardList()->setClient(&m_backForwardListClientImpl); m_page->setGroupName(pageGroupName); @@ -911,6 +913,13 @@ void WebViewImpl::resize(const WebSize& newSize) WebRect damagedRect(0, 0, m_size.width, m_size.height); m_client->didInvalidateRect(damagedRect); } + +#if OS(DARWIN) + if (m_gles2Context) { + m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), + std::max(1, m_size.height))); + } +#endif } void WebViewImpl::layout() @@ -2154,6 +2163,22 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) rootLayerContext->restore(); platformCanvas->restore(); +#elif PLATFORM(CG) + CGContextRef cgContext = rootLayerContext->platformContext(); + + CGContextSaveGState(cgContext); + + // Bring the CoreGraphics context into the coordinate system of the paint rect. + CGContextTranslateCTM(cgContext, -rect.x, -rect.y); + + rootLayerContext->save(); + + webframe->paintWithContext(*rootLayerContext, rect); + rootLayerContext->restore(); + + CGContextRestoreGState(cgContext); +#else +#error Must port to your platform #endif } } @@ -2203,6 +2228,11 @@ WebGLES2Context* WebViewImpl::gles2Context() m_gles2Context.clear(); return 0; } + +#if OS(DARWIN) + m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), + std::max(1, m_size.height))); +#endif } return m_gles2Context.get(); } diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 530fbf5..c296121 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -71,6 +71,7 @@ namespace WebKit { class AutocompletePopupMenuClient; class AutoFillPopupMenuClient; class ContextMenuClientImpl; +class DeviceOrientationClientProxy; class DragScrollTimer; class WebAccessibilityObject; class WebDevToolsAgentClient; @@ -496,7 +497,7 @@ private: // Inspector settings. WebString m_inspectorSettings; - typedef HashMap<WebCore::String, WebCore::String> SettingsMap; + typedef HashMap<WTF::String, WTF::String> SettingsMap; OwnPtr<SettingsMap> m_inspectorSettingsMap; OwnPtr<DragScrollTimer> m_dragScrollTimer; @@ -519,6 +520,8 @@ private: #endif OwnPtr<WebGLES2Context> m_gles2Context; + + OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 9593f5f..42f41d2 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -63,7 +63,7 @@ namespace { // call back to the worker context. class AllowDatabaseMainThreadBridge : public ThreadSafeShared<AllowDatabaseMainThreadBridge> { public: - static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebWorkerBase* worker, const WebCore::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String& name, const WebCore::String& displayName, unsigned long estimatedSize) + static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize) { return adoptRef(new AllowDatabaseMainThreadBridge(worker, mode, commonClient, frame, name, displayName, estimatedSize)); } @@ -89,14 +89,14 @@ public: } private: - AllowDatabaseMainThreadBridge(WebWorkerBase* worker, const WebCore::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String& name, const WebCore::String& displayName, unsigned long estimatedSize) + AllowDatabaseMainThreadBridge(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize) : m_worker(worker) , m_mode(mode) { worker->dispatchTaskToMainThread(createCallbackTask(&allowDatabaseTask, commonClient, frame, String(name), String(displayName), estimatedSize, this)); } - static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String name, const WebCore::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) + static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String name, const WTF::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) { if (!commonClient) bridge->signalCompleted(false); @@ -112,7 +112,7 @@ private: bool m_result; Mutex m_mutex; WebWorkerBase* m_worker; - WebCore::String m_mode; + WTF::String m_mode; }; } diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h index 15e8013..22711f9 100644 --- a/WebKit/chromium/src/WebWorkerBase.h +++ b/WebKit/chromium/src/WebWorkerBase.h @@ -70,10 +70,10 @@ public: PassRefPtr<WebCore::SerializedScriptValue>, PassOwnPtr<WebCore::MessagePortChannelArray>); virtual void postExceptionToWorkerObject( - const WebCore::String&, int, const WebCore::String&); + const WTF::String&, int, const WTF::String&); virtual void postConsoleMessageToWorkerObject( WebCore::MessageSource, WebCore::MessageType, - WebCore::MessageLevel, const WebCore::String&, int, const WebCore::String&); + WebCore::MessageLevel, const WTF::String&, int, const WTF::String&); virtual void confirmMessageFromWorkerObject(bool); virtual void reportPendingActivity(bool); virtual void workerContextClosed(); @@ -82,7 +82,7 @@ public: // WebCore::WorkerLoaderProxy methods: virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); virtual void postTaskForModeToWorkerContext( - PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode); + PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WTF::String& mode); // WebFrameClient methods to support resource loading thru the 'shadow page'. virtual void didCreateDataSource(WebFrame*, WebDataSource*); @@ -115,23 +115,23 @@ private: static void postMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, - WebCore::String message, + WTF::String message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void postExceptionTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void postConsoleMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, int source, int type, int level, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void confirmMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerBase* thisPtr, diff --git a/WebKit/chromium/src/WebWorkerClientImpl.h b/WebKit/chromium/src/WebWorkerClientImpl.h index 758c376..741d606 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/WebKit/chromium/src/WebWorkerClientImpl.h @@ -64,8 +64,8 @@ public: // process, this will be the main WebKit thread. In the worker process, this // will be the thread of the executing worker (not the main WebKit thread). virtual void startWorkerContext(const WebCore::KURL&, - const WebCore::String&, - const WebCore::String&); + const WTF::String&, + const WTF::String&); virtual void terminateWorkerContext(); virtual void postMessageToWorkerContext( PassRefPtr<WebCore::SerializedScriptValue> message, @@ -108,14 +108,14 @@ private: // These tasks are dispatched on the WebKit thread. static void startWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& scriptURL, - const WebCore::String& userAgent, - const WebCore::String& sourceCode); + const WTF::String& scriptURL, + const WTF::String& userAgent, + const WTF::String& sourceCode); static void terminateWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); static void postMessageToWorkerContextTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void workerObjectDestroyedTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); @@ -125,21 +125,21 @@ private: // worker process). static void postMessageToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void postExceptionToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void postConsoleMessageToWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr, int sourceId, int messageType, int messageLevel, - const WebCore::String& message, + const WTF::String& message, int lineNumber, - const WebCore::String& sourceURL); + const WTF::String& sourceURL); static void confirmMessageFromWorkerObjectTask(WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* thisPtr); static void reportPendingActivityTask(WebCore::ScriptExecutionContext* context, diff --git a/WebKit/chromium/src/WebWorkerImpl.h b/WebKit/chromium/src/WebWorkerImpl.h index bec96cd..d2fd016 100644 --- a/WebKit/chromium/src/WebWorkerImpl.h +++ b/WebKit/chromium/src/WebWorkerImpl.h @@ -69,7 +69,7 @@ private: static void postMessageToWorkerContextTask( WebCore::ScriptExecutionContext* context, WebWorkerImpl* thisPtr, - const WebCore::String& message, + const WTF::String& message, PassOwnPtr<WebCore::MessagePortChannelArray> channels); WebWorkerClient* m_client; diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 674f1d7..895c68b 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -41,44 +41,22 @@ * @prama {string} methodName * @param {string} param1, param2, param3 Arguments to dispatch. */ -devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) +devtools$$dispatch = function(message) { - remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8); - var agent = window[remoteName]; - if (!agent) { - debugPrint("No remote agent '" + remoteName + "' found."); - return; - } - var method = agent[methodName]; - if (!method) { - debugPrint("No method '" + remoteName + "." + methodName + "' found."); - return; - } - method.call(this, param1, param2, param3); + var args = typeof message === "string" ? JSON.parse(message) : message; + var methodName = args[0]; + var parameters = args.slice(1); + WebInspector[methodName].apply(WebInspector, parameters); }; devtools.ToolsAgent = function() { - RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; - RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); this.profilerAgent_ = new devtools.ProfilerAgent(); }; /** - * @param {string} script Script exression to be evaluated in the context of the - * inspected page. - * @param {function(Object|string, boolean):undefined} opt_callback Function to - * call with the result. - */ -devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback) -{ - InspectorBackend.evaluate(script, opt_callback || function() {}); -}; - - -/** * @return {devtools.ProfilerAgent} Profiler agent instance. */ devtools.ToolsAgent.prototype.getProfilerAgent = function() @@ -87,38 +65,6 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() }; -/** - * @param {string} message Serialized call to be dispatched on WebInspector. - * @private - */ -devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) -{ - var args = typeof message === "string" ? JSON.parse(message) : message; - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - -/** - * Evaluates js expression. - * @param {string} expr - */ -devtools.ToolsAgent.prototype.evaluate = function(expr) -{ - RemoteToolsAgent.evaluate(expr); -}; - - -/** - * Prints string to the inspector console or shows alert if the console doesn't - * exist. - * @param {string} text - */ -function debugPrint(text) { - WebInspector.log(text); -} - /** * Global instance of the tools agent. @@ -142,13 +88,15 @@ var context = {}; // Used by WebCore's inspector routines. } if ("page" in WebInspector._paramsObject) { WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); - WebInspector.socket.onmessage = function(message) { eval(message.data); } + WebInspector.socket.onmessage = function(message) { devtools$$dispatch(message.data); } WebInspector.socket.onerror = function(error) { console.err(error); } WebInspector.socket.onopen = function() { WebInspector.socketOpened = true; if (WebInspector.loadedDone) WebInspector.doLoadedDone(); }; + InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); + InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); } })(); /////////////////////////////////////////////////////////////////////////////// @@ -165,7 +113,7 @@ WebInspector.loaded = function() Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; - + Preferences.onlineDetectionEnabled = false; if ("page" in WebInspector._paramsObject) { WebInspector.loadedDone = true; if (WebInspector.socketOpened) @@ -177,7 +125,6 @@ WebInspector.loaded = function() WebInspector.doLoadedDone = function() { oldLoaded.call(this); - InspectorFrontendHost.loaded(); } devtools.domContentLoaded = function() diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index 52b28bb..d3333e2 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -35,8 +35,4 @@ if (!window["RemoteDebuggerCommandExecutor"]) { window["RemoteDebuggerCommandExecutor"] = {}; - window["RemoteProfilerAgent"] = {}; - window["RemoteToolsAgent"] = { - dispatchOnInspectorController: function() {} - }; } diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js index 0b65ace..7f74595 100644 --- a/WebKit/chromium/src/js/ProfilerAgent.js +++ b/WebKit/chromium/src/js/ProfilerAgent.js @@ -37,8 +37,6 @@ */ devtools.ProfilerAgent = function() { - RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this); - RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this); /** * Profiler log position. @@ -92,10 +90,17 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately) if (this._lastRequestedLogPosition == this._logPosition) return; var pos = this._lastRequestedLogPosition = this._logPosition; + + var callId = WebInspector.Callback.wrap(this._didGetProfilerLogLines.bind(this)); if (immediately) - RemoteProfilerAgent.getLogLines(pos); - else - setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500); + InspectorBackend.getProfilerLogLines(callId, pos); + else { + function delayedRequest() + { + InspectorBackend.getProfilerLogLines(callId, pos); + } + setTimeout(delayedRequest, 500); + } }; @@ -114,20 +119,11 @@ devtools.ProfilerAgent.prototype.startProfiling = function(modules) /** - * Handles current profiler status. - * @param {number} modules List of active (started) modules. - */ -devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules) -{ -}; - - -/** * Handles a portion of a profiler log retrieved by getLogLines call. * @param {number} pos Current position in log. * @param {string} log A portion of profiler log. */ -devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) +devtools.ProfilerAgent.prototype._didGetProfilerLogLines = function(pos, log) { this._logPosition = pos; if (log.length > 0) { @@ -138,3 +134,5 @@ devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) this._lastRequestedLogPosition = this._logPosition - 1; } }; + +WebInspector.didGetProfilerLogLines = WebInspector.Callback.processCallback; diff --git a/WebKit/chromium/src/js/ProfilerProcessor.js b/WebKit/chromium/src/js/ProfilerProcessor.js index f678d2c..61714e8 100644 --- a/WebKit/chromium/src/js/ProfilerProcessor.js +++ b/WebKit/chromium/src/js/ProfilerProcessor.js @@ -281,7 +281,7 @@ devtools.profiler.Processor.prototype.__proto__ = devtools.profiler.LogReader.pr */ devtools.profiler.Processor.prototype.printError = function(str) { - debugPrint(str); + WebInspector.log(str); }; diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index e2ab3b3..764f624 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -261,10 +261,10 @@ TestSuite.prototype.testEnableResourcesTab = function() var test = this; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { test.assertEquals("simple_page.html", payload.lastPathComponent); WebInspector.panels.resources.refresh(); - WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[identifier]); + WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[payload.id]); test.releaseControl(); }); @@ -289,10 +289,10 @@ TestSuite.prototype.testResourceContentLength = function() var png = false; var html = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { if (!payload.didLengthChange) return; - var resource = WebInspector.resources[identifier]; + var resource = WebInspector.resources[payload.id]; if (!resource || !resource.url) return; if (resource.url.search("image.html") !== -1) { @@ -346,8 +346,8 @@ TestSuite.prototype.testResourceHeaders = function() var timingOk = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -393,8 +393,8 @@ TestSuite.prototype.testCachedResourceMimeType = function() var hasReloaded = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -1845,8 +1845,37 @@ uiTests.runAllTests = function() */ uiTests.runTest = function(name) { - new TestSuite().runTest(name); + if (uiTests._populatedInterface) + new TestSuite().runTest(name); + else + uiTests._pendingTestName = name; }; +(function() { + +function runTests() +{ + uiTests._populatedInterface = true; + var name = uiTests._pendingTestName; + delete uiTests._pendingTestName; + if (name) + new TestSuite().runTest(name); +} + +var oldShowElementsPanel = WebInspector.showElementsPanel; +WebInspector.showElementsPanel = function() +{ + oldShowElementsPanel.call(this); + runTests(); +} + +var oldShowPanel = WebInspector.showPanel; +WebInspector.showPanel = function(name) +{ + oldShowPanel.call(this, name); + runTests(); +} + +})(); } |