Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: Source/WebCore/bindings/dart/DartClassInfo.cpp

Issue 9188009: Things to unfork. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/bindings/dart/DartClassInfo.h ('k') | Source/WebCore/bindings/dart/DartController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/dart/DartClassInfo.cpp
diff --git a/Source/WebCore/bindings/dart/DartClassInfo.cpp b/Source/WebCore/bindings/dart/DartClassInfo.cpp
deleted file mode 100644
index a026839119bb008d528c5dcd3e347c74d2442239..0000000000000000000000000000000000000000
--- a/Source/WebCore/bindings/dart/DartClassInfo.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2011, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "config.h"
-#include "DartClassInfo.h"
-
-#include "DartController.h"
-#include "DartDOMWindow.h"
-#include "DartDOMWrapper.h"
-#include "DartIsolateState.h"
-#include "DartUtilities.h"
-#include "PlatformString.h"
-#include "npruntime_impl.h"
-
-#include <bindings/npruntime.h>
-#include <dart_api.h>
-#include <wtf/HashMap.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-static void topLevelWindow(Dart_NativeArguments args)
-{
- DartApiScope dartApiScope;
- if (!DartUtilities::isFullDomIsolate(Dart_CurrentIsolate()))
- Dart_ThrowException(DartUtilities::domDisabledException());
-
- // Return full DOMWindow implementation (toDartValue(DOMWindow*) always returns secure wrapper).
- Dart_Handle result = DartDOMWrapper::toDart<DartDOMWindow>(DartUtilities::domWindowForCurrentIsolate());
- if (result)
- Dart_SetReturnValue(args, result);
-}
-
-static void npObjectRetrieve(Dart_NativeArguments args)
-{
- DartApiScope dartApiScope;
- Dart_Handle exception;
- {
- const ParameterAdapter<String> key(Dart_GetNativeArgument(args, 0));
- if (!key.conversionSuccessful()) {
- exception = key.exception();
- goto fail;
- }
-
- DartController* controller = DartController::retrieve(DartUtilities::scriptExecutionContext());
- NPObject* npObject = controller->npObject(key);
- if (npObject)
- Dart_SetReturnValue(args, toDartValue(npObject));
- return;
- }
-
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
-
-static void npObjectProperty(Dart_NativeArguments args)
-{
- DART_UNIMPLEMENTED();
-}
-
-static NPIdentifier getStringIdentifier(Dart_Handle id)
-{
- intptr_t length = 0;
- // FIXME: add return value check.
- Dart_StringLength(id, &length);
- char* buffer = new char[length + 1];
- Dart_StringGet8(id, reinterpret_cast<uint8_t*>(buffer), &length);
- buffer[length] = '\0';
- NPIdentifier result = _NPN_GetStringIdentifier(buffer);
- delete [] buffer;
- return result;
-}
-
-static void npObjectInvoke(Dart_NativeArguments args)
-{
- DartApiScope dartApiScope;
- Dart_Handle exception;
- {
- NPObject* npObject = DartDOMWrapper::receiver< NPObject >(args);
-
- if (!Dart_IsNull(Dart_GetNativeArgument(args, 2))) {
- exception = DartUtilities::notImplementedException();
- goto fail;
- }
-
- // FIXME: proper support for HTMLAppletElement and HTMLEmbedElement, see v8.
-
- // FIXME: support argument conversion.
- int numArgs = 0;
- OwnArrayPtr<NPVariant> npArgs = adoptArrayPtr(new NPVariant[numArgs]);
-
- NPVariant result;
- VOID_TO_NPVARIANT(result);
-
- bool retval = true;
- if (npObject->_class->invoke) {
- NPIdentifier identifier = getStringIdentifier(Dart_GetNativeArgument(args, 1));
- retval = npObject->_class->invoke(npObject, identifier, npArgs.get(), numArgs, &result);
- }
-
- if (!retval) {
- exception = Dart_NewString("Error calling method on NPObject.");
- goto fail;
- }
-
- // FIXME: support return value conversion.
-
- return;
- }
-
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
-
-static void spawnDomIsolate(Dart_NativeArguments args)
-{
- DartApiScope dartApiScope;
- Dart_Handle exception;
- {
- // IMPORTANT NOTE: Runtime type of first argument must be checked
- // by Dart code---we're doing read without any additional checks here!
- intptr_t value;
- Dart_Handle result = Dart_GetNativeInstanceField(Dart_GetNativeArgument(args, 0), 0, &value);
- ASSERT(!Dart_IsError(result));
- UNUSED_PARAM(result);
- RefPtr<DOMWindow> targetWindow(reinterpret_cast<DOMWindow*>(value));
-
- const ParameterAdapter< String > entryPoint(Dart_GetNativeArgument(args, 1));
- if (!entryPoint.conversionSuccessful()) {
- exception = entryPoint.exception();
- goto fail;
- }
-
- ScriptExecutionContext* context = DartUtilities::scriptExecutionContext();
- if (!context) {
- exception = DartUtilities::internalErrorException("[spawnDomIsolate] failed to retrieve ScriptExecutionContext");
- goto fail;
- }
-
- DartController* controller = DartController::retrieve(context);
- if (!controller) {
- exception = DartUtilities::internalErrorException("[spawnDomIsolate] failed to retrieve DartController");
- goto fail;
- }
-
- Dart_Handle sendPort = controller->spawnDomIsolate(targetWindow.get(), entryPoint);
- if (Dart_IsError(sendPort)) {
- exception = DartUtilities::internalErrorException(Dart_GetError(sendPort));
- goto fail;
- }
-
- Dart_SetReturnValue(args, sendPort);
- return;
- }
-
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
-
-namespace DartDOMWindowInternal {
-
-void historyCrossFrameGetter(Dart_NativeArguments);
-
-void locationCrossFrameGetter(Dart_NativeArguments);
-
-}
-
-extern Dart_NativeFunction snapshotResolver(Dart_Handle name, int argumentCount);
-
-Dart_NativeFunction domResolver(Dart_Handle name, int argumentCount)
-{
- // Some utility functions.
- if (Dart_NativeFunction func = snapshotResolver(name, argumentCount))
- return func;
-
- String str = DartUtilities::dartStringToString(name);
- if (argumentCount == 0 && str == "TopLevel_Window")
- return topLevelWindow;
- if (argumentCount == 1 && str == "NPObject_retrieve")
- return npObjectRetrieve;
- if (argumentCount == 2 && str == "NPObject_property")
- return npObjectProperty;
- if (argumentCount == 3 && str == "NPObject_invoke")
- return npObjectInvoke;
- if (argumentCount == 1 && str == "DOMWindow_history_cross_frame_Getter")
- return DartDOMWindowInternal::historyCrossFrameGetter;
- if (argumentCount == 1 && str == "DOMWindow_location_cross_frame_Getter")
- return DartDOMWindowInternal::locationCrossFrameGetter;
- if (argumentCount == 2 && str == "Utils_spawnDomIsolate")
- return spawnDomIsolate;
- return 0;
-}
-
-}
« no previous file with comments | « Source/WebCore/bindings/dart/DartClassInfo.h ('k') | Source/WebCore/bindings/dart/DartController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698