clang-format atom files

This commit is contained in:
Shelley Vohr 2018-04-17 21:44:10 -04:00
parent 717f55b012
commit 53bdf22c85
No known key found for this signature in database
GPG key ID: F13993A75599653C
128 changed files with 771 additions and 753 deletions

View file

@ -13,9 +13,10 @@ class Accelerator;
namespace mate {
template<>
template <>
struct Converter<ui::Accelerator> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
ui::Accelerator* out);
};

View file

@ -10,7 +10,6 @@
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
@ -31,99 +30,112 @@ namespace mate {
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
v8::Local<v8::Value> val);
template<>
template <>
struct Converter<blink::WebInputEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebInputEvent* out);
};
template<>
template <>
struct Converter<blink::WebKeyboardEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebKeyboardEvent* out);
};
template<>
template <>
struct Converter<content::NativeWebKeyboardEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::NativeWebKeyboardEvent* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::NativeWebKeyboardEvent& in);
};
template<>
template <>
struct Converter<blink::WebMouseEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebMouseEvent* out);
};
template<>
template <>
struct Converter<blink::WebMouseWheelEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebMouseWheelEvent* out);
};
template<>
template <>
struct Converter<blink::WebFloatPoint> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebFloatPoint* out);
};
template<>
template <>
struct Converter<blink::WebPoint> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebPoint* out);
};
template<>
template <>
struct Converter<blink::WebSize> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebSize* out);
};
template<>
template <>
struct Converter<blink::WebDeviceEmulationParams> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebDeviceEmulationParams* out);
};
template<>
template <>
struct Converter<blink::WebFindOptions> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebFindOptions* out);
};
template<>
template <>
struct Converter<blink::WebContextMenuData::MediaType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::MediaType& in);
};
template<>
template <>
struct Converter<blink::WebContextMenuData::InputFieldType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::InputFieldType& in);
};
template<>
template <>
struct Converter<blink::WebCache::ResourceTypeStat> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStat& stat);
};
template<>
template <>
struct Converter<blink::WebCache::ResourceTypeStats> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStats& stats);
};
template<>
template <>
struct Converter<blink::WebReferrerPolicy> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::WebReferrerPolicy& in);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
const blink::WebReferrerPolicy& in);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebReferrerPolicy* out);
};

View file

@ -20,7 +20,7 @@ namespace mate {
namespace internal {
template<typename T>
template <typename T>
class RefCountedGlobal;
// Manages the V8 function with RAII.
@ -55,7 +55,7 @@ struct V8FunctionInvoker<v8::Local<v8::Value>(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
v8::Local<v8::Value> ret(holder->Call(
holder, args.size(), args.empty() ? nullptr : &args.front()));
return handle_scope.Escape(ret);
@ -76,9 +76,8 @@ struct V8FunctionInvoker<void(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
holder->Call(
holder, args.size(), args.empty() ? nullptr : &args.front());
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
holder->Call(holder, args.size(), args.empty() ? nullptr : &args.front());
}
};
@ -97,10 +96,10 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
v8::Local<v8::Value> result;
auto maybe_result = holder->Call(
context, holder, args.size(), args.empty() ? nullptr : &args.front());
auto maybe_result = holder->Call(context, holder, args.size(),
args.empty() ? nullptr : &args.front());
if (maybe_result.ToLocal(&result))
Converter<ReturnType>::FromV8(isolate, result, &ret);
return ret;
@ -109,8 +108,8 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
// Helper to pass a C++ funtion to JavaScript.
using Translater = base::Callback<void(Arguments* args)>;
v8::Local<v8::Value> CreateFunctionFromTranslater(
v8::Isolate* isolate, const Translater& translater);
v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
const Translater& translater);
v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Context> context,
v8::Local<v8::Function> func,

View file

@ -18,65 +18,70 @@ namespace content {
struct ContextMenuParams;
class ResourceRequestBody;
class WebContents;
}
} // namespace content
using ContextMenuParamsWithWebContents =
std::pair<content::ContextMenuParams, content::WebContents*>;
namespace mate {
template<>
template <>
struct Converter<content::MenuItem::Type> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::MenuItem::Type& val);
};
template<>
template <>
struct Converter<ContextMenuParamsWithWebContents> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const ContextMenuParamsWithWebContents& val);
};
template<>
template <>
struct Converter<blink::mojom::PermissionStatus> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::mojom::PermissionStatus* out);
};
template<>
template <>
struct Converter<content::PermissionType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::PermissionType& val);
};
template<>
template <>
struct Converter<scoped_refptr<content::ResourceRequestBody>> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const scoped_refptr<content::ResourceRequestBody>& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
scoped_refptr<content::ResourceRequestBody>* out);
};
template<>
template <>
struct Converter<content::StopFindAction> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::StopFindAction* out);
};
template<>
template <>
struct Converter<content::WebContents*> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
content::WebContents* val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::WebContents** out);
};
template<>
template <>
struct Converter<content::Referrer> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::Referrer& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::Referrer* out);
};

View file

@ -12,10 +12,10 @@
namespace mate {
template<>
template <>
struct Converter<base::FilePath> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::FilePath& val) {
const base::FilePath& val) {
return Converter<base::FilePath::StringType>::ToV8(isolate, val.value());
}
static bool FromV8(v8::Isolate* isolate,

View file

@ -15,41 +15,38 @@ namespace gfx {
class Point;
class Size;
class Rect;
}
} // namespace gfx
namespace mate {
template<>
template <>
struct Converter<gfx::Point> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Point& val);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const gfx::Point& val);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
gfx::Point* out);
};
template<>
template <>
struct Converter<gfx::Size> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Size& val);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const gfx::Size& val);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
gfx::Size* out);
};
template<>
template <>
struct Converter<gfx::Rect> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Rect& val);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const gfx::Rect& val);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
gfx::Rect* out);
};
template<>
template <>
struct Converter<display::Display> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const display::Display& val);
const display::Display& val);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
display::Display* out);

View file

@ -12,10 +12,9 @@
namespace mate {
template<>
template <>
struct Converter<GURL> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const GURL& val) {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const GURL& val) {
return ConvertToV8(isolate, val.spec());
}
static bool FromV8(v8::Isolate* isolate,

View file

@ -10,24 +10,23 @@
namespace gfx {
class Image;
class ImageSkia;
}
} // namespace gfx
namespace mate {
template<>
template <>
struct Converter<gfx::ImageSkia> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
gfx::ImageSkia* out);
};
template<>
template <>
struct Converter<gfx::Image> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
gfx::Image* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Image& val);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const gfx::Image& val);
};
} // namespace mate

View file

@ -11,7 +11,7 @@
namespace base {
class DictionaryValue;
class ListValue;
}
} // namespace base
namespace net {
class AuthChallengeInfo;
@ -19,19 +19,20 @@ class URLRequest;
class X509Certificate;
class HttpResponseHeaders;
struct CertPrincipal;
}
} // namespace net
namespace mate {
template<>
template <>
struct Converter<const net::AuthChallengeInfo*> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const net::AuthChallengeInfo* val);
};
template<>
template <>
struct Converter<scoped_refptr<net::X509Certificate>> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const scoped_refptr<net::X509Certificate>& val);
static bool FromV8(v8::Isolate* isolate,
@ -39,7 +40,7 @@ struct Converter<scoped_refptr<net::X509Certificate>> {
scoped_refptr<net::X509Certificate>* out);
};
template<>
template <>
struct Converter<net::CertPrincipal> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const net::CertPrincipal& val);

View file

@ -10,10 +10,10 @@
namespace mate {
template<>
template <>
struct Converter<base::string16> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::string16& val) {
const base::string16& val) {
return MATE_STRING_NEW_FROM_UTF16(
isolate, reinterpret_cast<const uint16_t*>(val.data()), val.size());
}
@ -29,9 +29,8 @@ struct Converter<base::string16> {
}
};
inline v8::Local<v8::String> StringToV8(
v8::Isolate* isolate,
const base::string16& input) {
inline v8::Local<v8::String> StringToV8(v8::Isolate* isolate,
const base::string16& input) {
return ConvertToV8(isolate, input).As<v8::String>();
}

View file

@ -10,7 +10,7 @@
namespace mate {
template<>
template <>
struct Converter<ui::MenuSourceType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const ui::MenuSourceType& in) {

View file

@ -13,7 +13,7 @@ namespace base {
class DictionaryValue;
class ListValue;
class Value;
}
} // namespace base
namespace atom {
@ -41,9 +41,8 @@ class V8ValueConverter {
v8::Local<v8::Value> ToV8Object(
v8::Isolate* isolate,
const base::DictionaryValue* dictionary) const;
v8::Local<v8::Value> ToArrayBuffer(
v8::Isolate* isolate,
const base::Value* value) const;
v8::Local<v8::Value> ToArrayBuffer(v8::Isolate* isolate,
const base::Value* value) const;
base::Value* FromV8ValueImpl(FromV8ValueState* state,
v8::Local<v8::Value> value,

View file

@ -10,11 +10,11 @@
namespace base {
class DictionaryValue;
class ListValue;
}
} // namespace base
namespace mate {
template<>
template <>
struct Converter<base::DictionaryValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
@ -23,7 +23,7 @@ struct Converter<base::DictionaryValue> {
const base::DictionaryValue& val);
};
template<>
template <>
struct Converter<base::ListValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,