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 29, 2022
1 parent 5c1dd1b commit 68777ae
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 85 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
12 changes: 6 additions & 6 deletions bridge/core/html/html_all_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
//
//#include "html_all_collection.h"
//
//namespace kraken {
// namespace kraken {
//
//JSValue AllCollection::item(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// JSValue AllCollection::item(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// if (argc < 1) {
// return JS_NULL;
// }
Expand All @@ -23,7 +23,7 @@
// auto node = collection->m_nodes[index];
// return node->jsObject;
//}
//JSValue AllCollection::add(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// JSValue AllCollection::add(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// if (argc < 1) {
// return JS_ThrowTypeError(ctx, "Failed to execute add() on HTMLAllCollection: 1 arguments required.");
// }
Expand All @@ -50,7 +50,7 @@
//
// return JS_NULL;
//}
//JSValue AllCollection::remove(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// JSValue AllCollection::remove(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// if (argc < 1) {
// return JS_ThrowTypeError(ctx, "Failed to execute remove() on HTMLAllCollection: 1 arguments required.");
// }
Expand All @@ -61,7 +61,7 @@
// collection->m_nodes.erase(collection->m_nodes.begin() + index);
// return JS_NULL;
//}
//void AllCollection::internalAdd(NodeInstance* node, NodeInstance* before) {
// void AllCollection::internalAdd(NodeInstance* node, NodeInstance* before) {
// if (before != nullptr) {
// auto it = std::find(m_nodes.begin(), m_nodes.end(), before);
// m_nodes.erase(it);
Expand All @@ -71,7 +71,7 @@
// }
//}
//
//IMPL_PROPERTY_GETTER(AllCollection, length)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(AllCollection, length)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// auto* collection = static_cast<AllCollection*>(JS_GetOpaque(this_val, ExecutionContext::kHostObjectClassId));
// return JS_NewUint32(ctx, collection->m_nodes.size());
//}
Expand Down
4 changes: 2 additions & 2 deletions bridge/core/html/html_all_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
//
//#include "bindings/qjs/garbage_collected.h"
//
//namespace kraken {
// namespace kraken {
//
//class HTMLAllCollection : public HostObject {
// class HTMLAllCollection : public HostObject {
// public:
// AllCollection(ExecutionContext* context) : HostObject(context, "AllCollection"){};
//
Expand Down
32 changes: 16 additions & 16 deletions bridge/core/html/html_image_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,77 @@
//#include "bindings/qjs/qjs_patch.h"
//#include "page.h"
//
//namespace kraken {
// namespace kraken {
//
//ImageElement::ImageElement(ExecutionContext* context) : Element(context) {
// ImageElement::ImageElement(ExecutionContext* context) : Element(context) {
// JS_SetPrototype(m_ctx, m_prototypeObject, Element::instance(m_context)->prototype());
//}
//
//void bindImageElement(ExecutionContext* context) {
// void bindImageElement(ExecutionContext* context) {
// auto* constructor = ImageElement::instance(context);
// context->defineGlobalProperty("HTMLImageElement", constructor->jsObject);
// context->defineGlobalProperty("Image", JS_DupValue(context->ctx(), constructor->jsObject));
//}
//
//JSValue ImageElement::instanceConstructor(JSContext* ctx, JSValue func_obj, JSValue this_val, int argc, JSValue* argv) {
// JSValue ImageElement::instanceConstructor(JSContext* ctx, JSValue func_obj, JSValue this_val, int argc, JSValue* argv) {
// auto instance = new ImageElementInstance(this);
// return instance->jsObject;
//}
//IMPL_PROPERTY_GETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("width");
//}
//IMPL_PROPERTY_SETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_SETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// std::string key = "width";
// std::unique_ptr<NativeString> args_01 = stringToNativeString(key);
// std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]);
// element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr);
// return JS_NULL;
//}
//IMPL_PROPERTY_GETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("height");
//}
//IMPL_PROPERTY_SETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_SETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// std::string key = "height";
// std::unique_ptr<NativeString> args_01 = stringToNativeString(key);
// std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]);
// element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr);
// return JS_NULL;
//}
//IMPL_PROPERTY_GETTER(ImageElement, naturalWidth)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, naturalWidth)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("naturalWidth");
//}
//IMPL_PROPERTY_GETTER(ImageElement, naturalHeight)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, naturalHeight)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("naturalHeight");
//}
//IMPL_PROPERTY_GETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("src");
//}
//IMPL_PROPERTY_SETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_SETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// std::string key = "src";
// std::unique_ptr<NativeString> args_01 = stringToNativeString(key);
// std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]);
// element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr);
// return JS_NULL;
//}
//IMPL_PROPERTY_GETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_GETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// getDartMethod()->flushUICommand();
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// return element->getNativeProperty("loading");
//}
//IMPL_PROPERTY_SETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// IMPL_PROPERTY_SETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
// auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
// std::string key = "loading";
// std::unique_ptr<NativeString> args_01 = stringToNativeString(key);
Expand All @@ -86,12 +86,12 @@
// return JS_NULL;
//}
//
//ImageElementInstance::ImageElementInstance(ImageElement* element) : ElementInstance(element, "img", true) {
// ImageElementInstance::ImageElementInstance(ImageElement* element) : ElementInstance(element, "img", true) {
// // Protect image instance util load or error event triggered.
// refer();
//}
//
//bool ImageElementInstance::dispatchEvent(EventInstance* event) {
// bool ImageElementInstance::dispatchEvent(EventInstance* event) {
// std::u16string u16EventType = std::u16string(reinterpret_cast<const char16_t*>(event->nativeEvent->type->string), event->nativeEvent->type->length);
// std::string eventType = toUTF8(u16EventType);
// bool result = EventTargetInstance::dispatchEvent(event);
Expand Down
10 changes: 5 additions & 5 deletions bridge/core/html/html_image_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
//
//#include "bindings/qjs/dom/element.h"
//
//namespace kraken {
// namespace kraken {
//
//void bindImageElement(ExecutionContext* context);
// void bindImageElement(ExecutionContext* context);
//
//class ImageElementInstance;
//class ImageElement : public Element {
// class ImageElementInstance;
// class ImageElement : public Element {
// public:
// ImageElement() = delete;
// explicit ImageElement(ExecutionContext* context);
Expand All @@ -32,7 +32,7 @@
// friend ImageElementInstance;
//};
//
//class ImageElementInstance : public ElementInstance {
// class ImageElementInstance : public ElementInstance {
// public:
// ImageElementInstance() = delete;
// explicit ImageElementInstance(ImageElement* element);
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
Loading

0 comments on commit 68777ae

Please sign in to comment.