提交 ebb753ae 编写于 作者: A Adam Barth

Merge pull request #2202 from abarth/cleanup_bindings

Remove unused C++ code
...@@ -8,8 +8,6 @@ import("//sky/engine/core/core.gni") ...@@ -8,8 +8,6 @@ import("//sky/engine/core/core.gni")
source_set("bindings") { source_set("bindings") {
sources = [ sources = [
"dart_callback.cc",
"dart_callback.h",
"dart_mojo_internal.cc", "dart_mojo_internal.cc",
"dart_mojo_internal.h", "dart_mojo_internal.h",
"dart_runtime_hooks.cc", "dart_runtime_hooks.cc",
...@@ -22,9 +20,6 @@ source_set("bindings") { ...@@ -22,9 +20,6 @@ source_set("bindings") {
"exception_state_placeholder.h", "exception_state_placeholder.h",
"exception_state.cc", "exception_state.cc",
"exception_state.h", "exception_state.h",
"nullable.h",
"scheduled_action.cc",
"scheduled_action.h",
] ]
defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ] defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/bindings/dart_callback.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_error.h"
#include "sky/engine/tonic/dart_invoke.h"
#include "sky/engine/tonic/dart_state.h"
namespace blink {
DartCallback::DartCallback(DartState* dart_state,
Dart_Handle callback,
Dart_Handle& exception)
: callback_(dart_state, callback) {
if (!Dart_IsClosure(callback)) {
exception = ToDart("Callback must be a function");
callback_.Clear();
}
}
DartCallback::~DartCallback() {
}
bool DartCallback::IsIsolateAlive() const {
return !!callback_.dart_state();
}
Dart_Isolate DartCallback::GetIsolate() const {
return callback_.dart_state()->isolate();
}
bool DartCallback::handleEvent(int argc, Dart_Handle* argv) {
DartInvokeAppClosure(callback_.value(), argc, argv);
return true;
}
} // namespace blink
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_BINDINGS_DART_CALLBACK_H_
#define SKY_ENGINE_BINDINGS_DART_CALLBACK_H_
#include "dart/runtime/include/dart_api.h"
#include "sky/engine/tonic/dart_persistent_value.h"
namespace blink {
class DartCallback {
public:
DartCallback(DartState* dart_state,
Dart_Handle callback,
Dart_Handle& exception);
~DartCallback();
bool handleEvent(int argc, Dart_Handle* argv);
bool IsIsolateAlive() const;
Dart_Isolate GetIsolate() const;
private:
DartPersistentValue callback_;
};
}
#endif // SKY_ENGINE_BINDINGS_DART_CALLBACK_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_BINDINGS_NULLABLE_H_
#define SKY_ENGINE_BINDINGS_NULLABLE_H_
#include "base/logging.h"
namespace blink {
template <typename T>
class Nullable {
public:
Nullable() : value_(), is_null_(true) {}
Nullable(const T& value) : value_(value), is_null_(false) {}
Nullable(const Nullable& other)
: value_(other.value_), is_null_(other.is_null_) {}
Nullable& operator=(const Nullable& other) = default;
void set(const T& value) {
value_ = value;
is_null_ = false;
}
const T& get() const {
DCHECK(!is_null_);
return value_;
}
T& get() {
DCHECK(!is_null_);
return value_;
}
bool is_null() const { return is_null_; }
// See comment in RefPtr.h about what UnspecifiedBoolType is.
typedef const T* UnspecifiedBoolType;
operator UnspecifiedBoolType() const { return is_null_ ? 0 : &value_; }
bool operator==(const Nullable& other) const {
return (is_null_ && other.is_null_) ||
(!is_null_ && !other.is_null_ && value_ == other.value_);
}
private:
T value_;
bool is_null_;
};
} // namespace blink
#endif // SKY_ENGINE_BINDINGS_NULLABLE_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/bindings/scheduled_action.h"
#include "sky/engine/tonic/dart_api_scope.h"
#include "sky/engine/tonic/dart_error.h"
#include "sky/engine/tonic/dart_invoke.h"
#include "sky/engine/tonic/dart_isolate_scope.h"
namespace blink {
ScheduledAction::ScheduledAction(DartState* dart_state, Dart_Handle closure)
: closure_(dart_state, closure) {
DCHECK(Dart_IsClosure(closure));
}
ScheduledAction::~ScheduledAction() {
}
void ScheduledAction::Execute() {
if (!closure_.dart_state())
return;
DartIsolateScope scope(closure_.dart_state()->isolate());
DartApiScope api_scope;
DartInvokeAppClosure(closure_.value(), 0, nullptr);
}
} // namespace blink
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_BINDINGS_SCHEDULED_ACTION_H_
#define SKY_ENGINE_BINDINGS_SCHEDULED_ACTION_H_
#include "dart/runtime/include/dart_api.h"
#include "sky/engine/tonic/dart_persistent_value.h"
#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/wtf/RefPtr.h"
#include "sky/engine/wtf/PassOwnPtr.h"
namespace blink {
class ExecutionContext;
class ScheduledAction {
public:
static PassOwnPtr<ScheduledAction> Create(DartState* dart_state,
Dart_Handle closure) {
return adoptPtr(new ScheduledAction(dart_state, closure));
}
~ScheduledAction();
void Execute();
private:
ScheduledAction(DartState* dart_state, Dart_Handle closure);
DartPersistentValue closure_;
};
} // namespace blink
#endif // SKY_ENGINE_BINDINGS_SCHEDULED_ACTION_H_
...@@ -130,8 +130,7 @@ enum TileMode { ...@@ -130,8 +130,7 @@ enum TileMode {
void _validateColorStops(List<Color> colors, List<double> colorStops) { void _validateColorStops(List<Color> colors, List<double> colorStops) {
if (colorStops != null && (colors == null || colors.length != colorStops.length)) { if (colorStops != null && (colors == null || colors.length != colorStops.length)) {
throw new ArgumentError( throw new ArgumentError("[colors] and [colorStops] parameters must be equal length.");
"[colors] and [colorStops] parameters must be equal length.");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册