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

Unified Diff: Source/bindings/core/dart/DartCallback.cpp

Issue 1532413002: Added Dartium changes onto 45.0.2454.104 (Closed) Base URL: http://src.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years 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/bindings/core/dart/DartCallback.h ('k') | Source/bindings/core/dart/DartController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/dart/DartCallback.cpp
diff --git a/Source/web/DatabaseClientImpl.cpp b/Source/bindings/core/dart/DartCallback.cpp
similarity index 57%
copy from Source/web/DatabaseClientImpl.cpp
copy to Source/bindings/core/dart/DartCallback.cpp
index c53821321d294dc939f450faf90e71862ee59bfa..ef8058a26c401fa5756abad21b402c01f6c40d66 100644
--- a/Source/web/DatabaseClientImpl.cpp
+++ b/Source/bindings/core/dart/DartCallback.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2006-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
@@ -29,43 +29,48 @@
*/
#include "config.h"
-#include "web/DatabaseClientImpl.h"
+#include "bindings/core/dart/DartCallback.h"
-#include "core/dom/Document.h"
-#include "core/dom/ExecutionContext.h"
-#include "public/web/WebContentSettingsClient.h"
-#include "web/WebLocalFrameImpl.h"
+#include "bindings/core/dart/DartController.h"
+#include "bindings/core/dart/DartDOMData.h"
+#include "bindings/core/dart/DartUtilities.h"
namespace blink {
-PassOwnPtrWillBeRawPtr<DatabaseClientImpl> DatabaseClientImpl::create()
+DartCallback::DartCallback(Dart_Handle object, Dart_Handle& exception)
{
- return adoptPtrWillBeNoop(new DatabaseClientImpl());
+ if (!Dart_IsClosure(object)) {
+ exception = Dart_NewStringFromCString("Callback must be a function");
+ m_callback = 0;
+ return;
+ }
+ m_callback = Dart_NewPersistentHandle(object);
}
-DatabaseClientImpl::~DatabaseClientImpl()
+DartCallback::~DartCallback()
{
-}
+ if (!m_callback || !isIsolateAlive())
+ return;
-DEFINE_TRACE(DatabaseClientImpl)
-{
- DatabaseClient::trace(visitor);
+ DartIsolateScope scope(isolate());
+ Dart_DeletePersistentHandle(m_callback);
}
-bool DatabaseClientImpl::allowDatabase(ExecutionContext* executionContext, const String& name, const String& displayName, unsigned long estimatedSize)
+bool DartCallback::handleEvent(int argc, Dart_Handle* argv)
{
- ASSERT(executionContext->isContextThread());
- Document* document = toDocument(executionContext);
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame());
- if (!webFrame)
+ ASSERT(isolate() == Dart_CurrentIsolate());
+ ASSERT(m_callback);
+
+ ExecutionContext* context = DartDOMData::current()->scriptExecutionContext();
+ DartController* dartController = DartController::retrieve(context);
+
+ Dart_Handle result = dartController->callFunction(Dart_HandleFromPersistent(m_callback), argc, argv);
+ if (Dart_IsError(result)) {
+ DartUtilities::reportProblem(context, result);
return false;
- if (webFrame->contentSettingsClient())
- return webFrame->contentSettingsClient()->allowDatabase(name, displayName, estimatedSize);
+ }
+
return true;
}
-DatabaseClientImpl::DatabaseClientImpl()
-{
}
-
-} // namespace blink
« no previous file with comments | « Source/bindings/core/dart/DartCallback.h ('k') | Source/bindings/core/dart/DartController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698