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

@ -14,7 +14,7 @@ namespace atom {
namespace api {
template<typename K>
template <typename K>
class KeyWeakMap : public mate::Wrappable<KeyWeakMap<K>> {
public:
static mate::Handle<KeyWeakMap<K>> Create(v8::Isolate* isolate) {
@ -47,13 +47,9 @@ class KeyWeakMap : public mate::Wrappable<KeyWeakMap<K>> {
return key_weak_map_.Get(isolate, key).ToLocalChecked();
}
bool Has(const K& key) {
return key_weak_map_.Has(key);
}
bool Has(const K& key) { return key_weak_map_.Has(key); }
void Remove(const K& key) {
key_weak_map_.Remove(key);
}
void Remove(const K& key) { key_weak_map_.Remove(key); }
atom::KeyWeakMap<K> key_weak_map_;

View file

@ -41,20 +41,24 @@ namespace api {
class NativeImage : public mate::Wrappable<NativeImage> {
public:
static mate::Handle<NativeImage> CreateEmpty(v8::Isolate* isolate);
static mate::Handle<NativeImage> Create(
v8::Isolate* isolate, const gfx::Image& image);
static mate::Handle<NativeImage> CreateFromPNG(
v8::Isolate* isolate, const char* buffer, size_t length);
static mate::Handle<NativeImage> CreateFromJPEG(
v8::Isolate* isolate, const char* buffer, size_t length);
static mate::Handle<NativeImage> CreateFromPath(
v8::Isolate* isolate, const base::FilePath& path);
static mate::Handle<NativeImage> Create(v8::Isolate* isolate,
const gfx::Image& image);
static mate::Handle<NativeImage> CreateFromPNG(v8::Isolate* isolate,
const char* buffer,
size_t length);
static mate::Handle<NativeImage> CreateFromJPEG(v8::Isolate* isolate,
const char* buffer,
size_t length);
static mate::Handle<NativeImage> CreateFromPath(v8::Isolate* isolate,
const base::FilePath& path);
static mate::Handle<NativeImage> CreateFromBuffer(
mate::Arguments* args, v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(
v8::Isolate* isolate, const GURL& url);
mate::Arguments* args,
v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(v8::Isolate* isolate,
const GURL& url);
static mate::Handle<NativeImage> CreateFromNamedImage(
mate::Arguments* args, const std::string& name);
mate::Arguments* args,
const std::string& name);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -77,13 +81,11 @@ class NativeImage : public mate::Wrappable<NativeImage> {
v8::Local<v8::Value> ToJPEG(v8::Isolate* isolate, int quality);
v8::Local<v8::Value> ToBitmap(mate::Arguments* args);
v8::Local<v8::Value> GetBitmap(mate::Arguments* args);
v8::Local<v8::Value> GetNativeHandle(
v8::Isolate* isolate,
mate::Arguments* args);
v8::Local<v8::Value> GetNativeHandle(v8::Isolate* isolate,
mate::Arguments* args);
mate::Handle<NativeImage> Resize(v8::Isolate* isolate,
const base::DictionaryValue& options);
mate::Handle<NativeImage> Crop(v8::Isolate* isolate,
const gfx::Rect& rect);
mate::Handle<NativeImage> Crop(v8::Isolate* isolate, const gfx::Rect& rect);
std::string ToDataURL(mate::Arguments* args);
bool IsEmpty();
gfx::Size GetSize();
@ -112,16 +114,16 @@ class NativeImage : public mate::Wrappable<NativeImage> {
namespace mate {
// A custom converter that allows converting path to NativeImage.
template<>
template <>
struct Converter<mate::Handle<atom::api::NativeImage>> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const mate::Handle<atom::api::NativeImage>& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
mate::Handle<atom::api::NativeImage>* out);
};
} // namespace mate
#endif // ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_

View file

@ -37,7 +37,7 @@ class AtomBindings {
static void Hang();
static v8::Local<v8::Value> GetProcessMemoryInfo(v8::Isolate* isolate);
static v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate,
mate::Arguments* args);
mate::Arguments* args);
v8::Local<v8::Value> GetCPUUsage(v8::Isolate* isolate);
static v8::Local<v8::Value> GetIOCounters(v8::Isolate* isolate);

View file

@ -44,7 +44,8 @@ v8::Local<v8::Value> EmitEvent(v8::Isolate* isolate,
const StringType& name,
const Args&... args) {
internal::ValueVector converted_args = {
StringToV8(isolate, name), ConvertToV8(isolate, args)...,
StringToV8(isolate, name),
ConvertToV8(isolate, args)...,
};
return internal::CallMethodWithArgs(isolate, obj, "emit", &converted_args);
}

View file

@ -11,12 +11,14 @@ namespace atom {
class RemoteObjectFreer : public ObjectLifeMonitor {
public:
static void BindTo(
v8::Isolate* isolate, v8::Local<v8::Object> target, int object_id);
static void BindTo(v8::Isolate* isolate,
v8::Local<v8::Object> target,
int object_id);
protected:
RemoteObjectFreer(
v8::Isolate* isolate, v8::Local<v8::Object> target, int object_id);
RemoteObjectFreer(v8::Isolate* isolate,
v8::Local<v8::Object> target,
int object_id);
~RemoteObjectFreer() override;
void RunDestructor() override;