Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
openkraken-bot committed May 17, 2022
1 parent 46dccea commit 659212a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
4 changes: 3 additions & 1 deletion bridge/bindings/qjs/atomic_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class AtomicString {

// Return the undefined string value from atom key.
JSValue ToQuickJS(JSContext* ctx) const {
if (ctx_ == nullptr) { return JS_NULL; }
if (ctx_ == nullptr) {
return JS_NULL;
}

assert(ctx_ != nullptr);
return JS_AtomToValue(ctx, atom_);
Expand Down
2 changes: 1 addition & 1 deletion bridge/bindings/qjs/binding_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#include "qjs_html_html_element.h"
#include "qjs_html_template_element.h"
#include "qjs_html_unknown_element.h"
#include "qjs_location.h"
#include "qjs_message_event.h"
#include "qjs_module_manager.h"
#include "qjs_node.h"
#include "qjs_node_list.h"
#include "qjs_text.h"
#include "qjs_window.h"
#include "qjs_window_or_worker_global_scope.h"
#include "qjs_location.h"

namespace kraken {

Expand Down
3 changes: 2 additions & 1 deletion bridge/core/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ HTMLHeadElement* Document::head() const {
return Traversal<HTMLHeadElement>::FirstChild(*de);
}

uint32_t Document::RequestAnimationFrame(const std::shared_ptr<FrameCallback>& callback, ExceptionState& exception_state) {
uint32_t Document::RequestAnimationFrame(const std::shared_ptr<FrameCallback>& callback,
ExceptionState& exception_state) {
return script_animation_controller_.RegisterFrameCallback(callback, exception_state);
}

Expand Down
11 changes: 8 additions & 3 deletions bridge/core/dom/scripted_animation_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ static void handleRAFTransientCallback(void* ptr, int32_t contextId, double high
frame_callback->Fire(highResTimeStamp);
}

uint32_t ScriptAnimationController::RegisterFrameCallback(const std::shared_ptr<FrameCallback>& frame_callback, ExceptionState& exception_state) {
uint32_t ScriptAnimationController::RegisterFrameCallback(const std::shared_ptr<FrameCallback>& frame_callback,
ExceptionState& exception_state) {
auto* context = frame_callback->context();

if (context->dartMethodPtr()->requestAnimationFrame == nullptr) {
exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'requestAnimationFrame': dart method (requestAnimationFrame) is not registered.");
exception_state.ThrowException(
context->ctx(), ErrorType::InternalError,
"Failed to execute 'requestAnimationFrame': dart method (requestAnimationFrame) is not registered.");
return -1;
}

Expand All @@ -45,7 +48,9 @@ void ScriptAnimationController::CancelFrameCallback(ExecutingContext* context,
uint32_t callbackId,
ExceptionState& exception_state) {
if (context->dartMethodPtr()->cancelAnimationFrame == nullptr) {
exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'cancelAnimationFrame': dart method (cancelAnimationFrame) is not registered.");
exception_state.ThrowException(
context->ctx(), ErrorType::InternalError,
"Failed to execute 'cancelAnimationFrame': dart method (cancelAnimationFrame) is not registered.");
return;
}

Expand Down
3 changes: 2 additions & 1 deletion bridge/core/frame/legacy/location.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace kraken {

void Location::__kraken_location_reload__(ExecutingContext* context, ExceptionState& exception_state) {
if (context->dartMethodPtr()->reloadApp == nullptr) {
exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'reload': dart method (reloadApp) is not registered.");
exception_state.ThrowException(context->ctx(), ErrorType::InternalError,
"Failed to execute 'reload': dart method (reloadApp) is not registered.");
return;
}

Expand Down
4 changes: 2 additions & 2 deletions bridge/core/frame/legacy/location.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#ifndef KRAKENBRIDGE_LOCATION_H
#define KRAKENBRIDGE_LOCATION_H

#include "bindings/qjs/script_wrappable.h"
#include "bindings/qjs/exception_state.h"
#include "bindings/qjs/script_wrappable.h"

namespace kraken {

class Location {
class Location {
public:
static void __kraken_location_reload__(ExecutingContext* context, ExceptionState& exception_state);
};
Expand Down
7 changes: 3 additions & 4 deletions bridge/core/frame/window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ void Window::postMessage(const ScriptValue& message,

double Window::requestAnimationFrame(const std::shared_ptr<QJSFunction>& callback, ExceptionState& exceptionState) {
if (GetExecutingContext()->dartMethodPtr()->flushUICommand == nullptr) {
exceptionState.ThrowException(
ctx(), ErrorType::InternalError,
"Failed to execute 'flushUICommand': dart method (flushUICommand) executed "
"with unexpected error.");
exceptionState.ThrowException(ctx(), ErrorType::InternalError,
"Failed to execute 'flushUICommand': dart method (flushUICommand) executed "
"with unexpected error.");
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions bridge/core/frame/window_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ requestAnimationFrame(() => {
EXPECT_EQ(logCalled, true);
}

TEST(Window, cancelAnimationFrame) {
TEST(Window, cancelAnimationFrame) {
auto bridge = TEST_init();

kraken::KrakenPage::consoleMessageHandler = [](void* ctx, const std::string& message, int logLevel) { abort(); };
Expand All @@ -83,7 +83,7 @@ requestAnimationFrame(() => {
TEST_runLoop(bridge->GetExecutingContext());
}

TEST(Window, postMessage) {
TEST(Window, postMessage) {
{
auto bridge = TEST_init();
static bool logCalled = false;
Expand All @@ -107,7 +107,7 @@ requestAnimationFrame(() => {
{ TEST_init(); }
}

TEST(Window, location) {
TEST(Window, location) {
auto bridge = TEST_init();
static bool logCalled = false;
kraken::KrakenPage::consoleMessageHandler = [](void* ctx, const std::string& message, int logLevel) {
Expand Down

0 comments on commit 659212a

Please sign in to comment.