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 Jan 27, 2022
1 parent c14831b commit 94d4bfe
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 56 deletions.
15 changes: 5 additions & 10 deletions bridge/bindings/qjs/dart_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
*/

#include "dart_methods.h"
#include "foundation/macros.h"
#include <memory>
#include "foundation/macros.h"

namespace kraken {

//std::shared_ptr<DartMethodPointer> methodPointer = std::make_shared<DartMethodPointer>()

// std::shared_ptr<DartMethodPointer> methodPointer = std::make_shared<DartMethodPointer>()

std::shared_ptr<DartMethodPointer> getDartMethod() {
std::thread::id currentThread = std::this_thread::get_id();
Expand All @@ -24,16 +23,12 @@ std::shared_ptr<DartMethodPointer> getDartMethod() {
return std::make_shared<DartMethodPointer>();
}
#endif
// return methodPointer;
// return methodPointer;
}

void registerDartMethods(std::shared_ptr<DartMethodPointer> methodPointer, uint64_t* methodBytes, int32_t length) {
void registerDartMethods(std::shared_ptr<DartMethodPointer> methodPointer, uint64_t* methodBytes, int32_t length) {}

}

void registerTestEnvDartMethods(std::shared_ptr<DartMethodPointer> methodPointer, uint64_t* methodBytes, int32_t length) {

}
void registerTestEnvDartMethods(std::shared_ptr<DartMethodPointer> methodPointer, uint64_t* methodBytes, int32_t length) {}

#if ENABLE_PROFILE
void registerGetPerformanceEntries(GetPerformanceEntries getPerformanceEntries) {
Expand Down
1 change: 0 additions & 1 deletion bridge/bindings/qjs/executing_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ void buildUICommandArgs(JSContext* ctx, JSValue key, NativeString& args_01) {
args_01.length = length;
}


// An lock free context validator.
bool isContextValid(int32_t contextId) {
if (contextId > running_context_list)
Expand Down
4 changes: 2 additions & 2 deletions bridge/bindings/qjs/executing_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#include <memory>
#include <mutex>
#include <unordered_map>
#include "foundation/macros.h"
#include "bindings/qjs/bom/dom_timer_coordinator.h"
#include "dart_methods.h"
#include "executing_context_data.h"
#include "foundation/macros.h"
#include "foundation/ui_command_buffer.h"
#include "garbage_collected.h"
#include "kraken_foundation.h"
#include "qjs_patch.h"
#include "dart_methods.h"
#include "wrapper_type_info.h"

using JSExceptionHandler = std::function<void(int32_t contextId, const char* message)>;
Expand Down
6 changes: 1 addition & 5 deletions bridge/bindings/qjs/native_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace kraken {


NativeString* NativeString::clone() {
auto* newNativeString = new NativeString();
auto* newString = new uint16_t[length];
Expand Down Expand Up @@ -45,7 +44,6 @@ std::unique_ptr<NativeString> jsValueToNativeString(JSContext* ctx, JSValue valu
return ptr;
}


std::unique_ptr<NativeString> stringToNativeString(const std::string& string) {
std::u16string utf16;
fromUTF8(string, utf16);
Expand Down Expand Up @@ -76,6 +74,4 @@ std::string jsAtomToStdString(JSContext* ctx, JSAtom atom) {
return str;
}



}
} // namespace kraken
8 changes: 4 additions & 4 deletions bridge/bindings/qjs/native_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include <quickjs/quickjs.h>
#include <cinttypes>
#include <string>
#include <memory>
#include <locale>
#include <codecvt>
#include <locale>
#include <memory>
#include <string>

namespace kraken {

Expand Down Expand Up @@ -54,7 +54,7 @@ void fromUTF8(const std::string& source, std::basic_string<T, std::char_traits<T
result = convertor.from_bytes(source);
}

}
} // namespace kraken

class native_string {};

Expand Down
6 changes: 3 additions & 3 deletions bridge/foundation/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ constexpr LogSeverity LOG_NUM_SEVERITIES = 5;
constexpr LogSeverity LOG_FATAL = 6;

class LogMessageVoidify {
public:
public:
void operator&(std::ostream&) {}
};

class LogMessage {
public:
public:
LogMessage(LogSeverity severity, const char* file, int line, const char* condition);
~LogMessage();

std::ostream& stream() { return stream_; }

private:
private:
std::ostringstream stream_;
const LogSeverity severity_;
const char* file_;
Expand Down
1 change: 0 additions & 1 deletion bridge/foundation/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@
TypeName() = delete; \
KRAKEN_DISALLOW_COPY_ASSIGN_AND_MOVE(TypeName)


#endif // KRAKENBRIDGE_MACROS_H
4 changes: 2 additions & 2 deletions bridge/foundation/native_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

#include "native_value.h"
#include "bindings/qjs/dom/event_target.h"
#include "bindings/qjs/executing_context.h"
#include "bindings/qjs/qjs_patch.h"
#include "bindings/qjs/dom/event_target.h"

namespace kraken {

Expand Down Expand Up @@ -272,4 +272,4 @@ JSValue nativeValueToJSValue(ExecutionContext* context, NativeValue& value) {
return JS_NULL;
}

} // namespace kraken::binding::qjs
} // namespace kraken
2 changes: 1 addition & 1 deletion bridge/foundation/native_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ NativeValue Native_NewJSON(ExecutionContext* context, JSValue& value);
NativeValue jsValueToNativeValue(JSContext* ctx, JSValue& value);
JSValue nativeValueToJSValue(ExecutionContext* context, NativeValue& value);

} // namespace kraken::binding::qjs
} // namespace kraken

#endif // KRAKENBRIDGE_NATIVE_VALUE_H
2 changes: 1 addition & 1 deletion bridge/foundation/ref_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <utility>

#include "logging.h"
#include "ref_ptr_internal.h"
#include "macros.h"
#include "ref_ptr_internal.h"

namespace fml {

Expand Down
20 changes: 10 additions & 10 deletions bridge/foundation/ui_command_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef KRAKENBRIDGE_FOUNDATION_UI_COMMAND_BUFFER_H_
#define KRAKENBRIDGE_FOUNDATION_UI_COMMAND_BUFFER_H_

#include <vector>
#include <cinttypes>
#include "native_value.h"
#include <vector>
#include "bindings/qjs/native_string.h"
#include "native_value.h"

namespace kraken {

Expand All @@ -31,15 +31,15 @@ enum UICommand {

struct UICommandItem {
UICommandItem(int32_t id, int32_t type, NativeString args_01, NativeString args_02, void* nativePtr)
: type(type),
string_01(reinterpret_cast<int64_t>(args_01.string)),
args_01_length(args_01.length),
string_02(reinterpret_cast<int64_t>(args_02.string)),
args_02_length(args_02.length),
id(id),
nativePtr(reinterpret_cast<int64_t>(nativePtr)){};
: type(type),
string_01(reinterpret_cast<int64_t>(args_01.string)),
args_01_length(args_01.length),
string_02(reinterpret_cast<int64_t>(args_02.string)),
args_02_length(args_02.length),
id(id),
nativePtr(reinterpret_cast<int64_t>(nativePtr)){};
UICommandItem(int32_t id, int32_t type, NativeString args_01, void* nativePtr)
: type(type), string_01(reinterpret_cast<int64_t>(args_01.string)), args_01_length(args_01.length), id(id), nativePtr(reinterpret_cast<int64_t>(nativePtr)){};
: type(type), string_01(reinterpret_cast<int64_t>(args_01.string)), args_01_length(args_01.length), id(id), nativePtr(reinterpret_cast<int64_t>(nativePtr)){};
UICommandItem(int32_t id, int32_t type, void* nativePtr) : type(type), id(id), nativePtr(reinterpret_cast<int64_t>(nativePtr)){};
int32_t type;
int32_t id;
Expand Down
14 changes: 7 additions & 7 deletions bridge/kraken_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
*/

#include <atomic>
#include <thread>
#include <cassert>
#include <thread>

#include "include/kraken_bridge.h"
#include "bindings/qjs/native_string.h"
#include "foundation/inspector_task_queue.h"
#include "foundation/logging.h"
#include "foundation/ui_task_queue.h"
#include "foundation/ui_command_buffer.h"
#include "bindings/qjs/native_string.h"
#include "foundation/ui_task_queue.h"
#include "include/kraken_bridge.h"
#include "page.h"

#if defined(_WIN32)
Expand Down Expand Up @@ -162,9 +162,9 @@ void registerDartMethods(int32_t contextId, uint64_t* methodBytes, int32_t lengt
}

NativeScreen* createScreen(double width, double height) {
// screen.width = width;
// screen.height = height;
// return &screen;
// screen.width = width;
// screen.height = height;
// return &screen;
}

static KrakenInfo* krakenInfo{nullptr};
Expand Down
19 changes: 11 additions & 8 deletions bridge/page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include <atomic>

#include "foundation/logging.h"
#include "polyfill.h"
#include "bindings/qjs/qjs_patch.h"
#include "foundation/logging.h"
#include "page.h"
#include "polyfill.h"

#include "bindings/qjs/bom/blob.h"
#include "bindings/qjs/bom/console.h"
Expand Down Expand Up @@ -57,12 +57,15 @@ KrakenPage::KrakenPage(int32_t contextId, const JSExceptionHandler& handler) : c
#if ENABLE_PROFILE
auto jsContextStartTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
#endif
m_context = new ExecutionContext(contextId, [this](int32_t contextId, const char* message) {
if (m_context->dartMethodPtr()->onJsError != nullptr) {
m_context->dartMethodPtr()->onJsError(contextId, message);
}
KRAKEN_LOG(ERROR) << message << std::endl;
}, this);
m_context = new ExecutionContext(
contextId,
[this](int32_t contextId, const char* message) {
if (m_context->dartMethodPtr()->onJsError != nullptr) {
m_context->dartMethodPtr()->onJsError(contextId, message);
}
KRAKEN_LOG(ERROR) << message << std::endl;
},
this);

#if ENABLE_PROFILE
auto nativePerformance = Performance::instance(m_context)->m_nativePerformance;
Expand Down
2 changes: 1 addition & 1 deletion bridge/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <quickjs/quickjs.h>
#include <atomic>
#include <deque>
#include <vector>
#include <thread>
#include <vector>

#include "bindings/qjs/executing_context.h"
#include "bindings/qjs/html_parser.h"
Expand Down

0 comments on commit 94d4bfe

Please sign in to comment.