clang-format atom files
This commit is contained in:
parent
717f55b012
commit
53bdf22c85
128 changed files with 771 additions and 753 deletions
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -76,7 +76,8 @@ class Archive {
|
|||
|
||||
// Cached external temporary files.
|
||||
std::unordered_map<base::FilePath::StringType,
|
||||
std::unique_ptr<ScopedTemporaryFile>> external_files_;
|
||||
std::unique_ptr<ScopedTemporaryFile>>
|
||||
external_files_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Archive);
|
||||
};
|
||||
|
|
|
@ -28,7 +28,8 @@ class ScopedTemporaryFile {
|
|||
// Init an temporary file and fill it with content of |path|.
|
||||
bool InitFromFile(base::File* src,
|
||||
const base::FilePath::StringType& ext,
|
||||
uint64_t offset, uint64_t size);
|
||||
uint64_t offset,
|
||||
uint64_t size);
|
||||
|
||||
base::FilePath path() const { return path_; }
|
||||
|
||||
|
|
|
@ -16,24 +16,23 @@
|
|||
#endif
|
||||
|
||||
#ifndef ATOM_PRE_RELEASE_VERSION
|
||||
#define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
|
||||
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
|
||||
ATOM_STRINGIFY(ATOM_PATCH_VERSION)
|
||||
#define ATOM_VERSION_STRING \
|
||||
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
|
||||
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY( \
|
||||
ATOM_PATCH_VERSION)
|
||||
#else
|
||||
#define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
|
||||
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
|
||||
ATOM_STRINGIFY(ATOM_PATCH_VERSION) \
|
||||
ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
|
||||
#define ATOM_VERSION_STRING \
|
||||
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
|
||||
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY( \
|
||||
ATOM_PATCH_VERSION) ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
|
||||
#endif
|
||||
|
||||
|
||||
#define ATOM_VERSION "v" ATOM_VERSION_STRING
|
||||
|
||||
|
||||
#define ATOM_VERSION_AT_LEAST(major, minor, patch) \
|
||||
(( (major) < ATOM_MAJOR_VERSION) \
|
||||
|| ((major) == ATOM_MAJOR_VERSION && (minor) < ATOM_MINOR_VERSION) \
|
||||
|| ((major) == ATOM_MAJOR_VERSION && (minor) == ATOM_MINOR_VERSION \
|
||||
&& (patch) <= ATOM_PATCH_VERSION))
|
||||
#define ATOM_VERSION_AT_LEAST(major, minor, patch) \
|
||||
(((major) < ATOM_MAJOR_VERSION) || \
|
||||
((major) == ATOM_MAJOR_VERSION && (minor) < ATOM_MINOR_VERSION) || \
|
||||
((major) == ATOM_MAJOR_VERSION && (minor) == ATOM_MINOR_VERSION && \
|
||||
(patch) <= ATOM_PATCH_VERSION))
|
||||
|
||||
#endif // ATOM_COMMON_ATOM_VERSION_H_
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Multiply-included file, no traditional include guard.
|
||||
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "chrome/common/chrome_utility_printing_messages.h"
|
||||
#include "chrome/common/print_messages.h"
|
||||
#include "chrome/common/tts_messages.h"
|
||||
#include "chrome/common/widevine_cdm_messages.h"
|
||||
#include "chrome/common/chrome_utility_printing_messages.h"
|
||||
|
|
|
@ -13,13 +13,14 @@
|
|||
#include "base/compiler_specific.h"
|
||||
|
||||
namespace base {
|
||||
template <typename T> struct DefaultSingletonTraits;
|
||||
template <typename T>
|
||||
struct DefaultSingletonTraits;
|
||||
}
|
||||
|
||||
namespace google_breakpad {
|
||||
class ExceptionHandler;
|
||||
class MinidumpDescriptor;
|
||||
}
|
||||
} // namespace google_breakpad
|
||||
|
||||
namespace crash_reporter {
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#include "vendor/crashpad/client/simple_string_dictionary.h"
|
||||
|
||||
namespace base {
|
||||
template <typename T> struct DefaultSingletonTraits;
|
||||
template <typename T>
|
||||
struct DefaultSingletonTraits;
|
||||
}
|
||||
|
||||
namespace crash_reporter {
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
#include "vendor/breakpad/src/client/windows/handler/exception_handler.h"
|
||||
|
||||
namespace base {
|
||||
template <typename T> struct DefaultSingletonTraits;
|
||||
template <typename T>
|
||||
struct DefaultSingletonTraits;
|
||||
}
|
||||
|
||||
namespace crash_reporter {
|
||||
|
|
|
@ -21,15 +21,15 @@ typedef google_breakpad::NonAllocatingMap<256, 256, 64> CrashKeyStorage;
|
|||
// The minidump information can either be contained in a file descriptor (fd) or
|
||||
// in a file (whose path is in filename).
|
||||
struct BreakpadInfo {
|
||||
int fd; // File descriptor to the Breakpad dump data.
|
||||
const char* filename; // Path to the Breakpad dump data.
|
||||
const char* distro; // Linux distro string.
|
||||
unsigned distro_length; // Length of |distro|.
|
||||
bool upload; // Whether to upload or save crash dump.
|
||||
uint64_t process_start_time; // Uptime of the crashing process.
|
||||
size_t oom_size; // Amount of memory requested if OOM.
|
||||
uint64_t pid; // PID where applicable.
|
||||
const char* upload_url; // URL to upload the minidump.
|
||||
int fd; // File descriptor to the Breakpad dump data.
|
||||
const char* filename; // Path to the Breakpad dump data.
|
||||
const char* distro; // Linux distro string.
|
||||
unsigned distro_length; // Length of |distro|.
|
||||
bool upload; // Whether to upload or save crash dump.
|
||||
uint64_t process_start_time; // Uptime of the crashing process.
|
||||
size_t oom_size; // Amount of memory requested if OOM.
|
||||
uint64_t pid; // PID where applicable.
|
||||
const char* upload_url; // URL to upload the minidump.
|
||||
CrashKeyStorage* crash_keys;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class CrashReportSender;
|
|||
class CrashGenerationServer;
|
||||
class ClientInfo;
|
||||
|
||||
}
|
||||
} // namespace google_breakpad
|
||||
|
||||
namespace breakpad {
|
||||
|
||||
|
@ -70,17 +70,11 @@ class CrashService {
|
|||
static const char kReporterURL[];
|
||||
|
||||
// Returns number of crash dumps handled.
|
||||
int requests_handled() const {
|
||||
return requests_handled_;
|
||||
}
|
||||
int requests_handled() const { return requests_handled_; }
|
||||
// Returns number of crash clients registered.
|
||||
int clients_connected() const {
|
||||
return clients_connected_;
|
||||
}
|
||||
int clients_connected() const { return clients_connected_; }
|
||||
// Returns number of crash clients terminated.
|
||||
int clients_terminated() const {
|
||||
return clients_terminated_;
|
||||
}
|
||||
int clients_terminated() const { return clients_terminated_; }
|
||||
|
||||
// Starts the processing loop. This function does not return unless the
|
||||
// user is logging off or the user closes the crash service window. The
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#ifndef GOOGLEAPIS_ENDPOINT
|
||||
#define GOOGLEAPIS_ENDPOINT \
|
||||
"https://www.googleapis.com/geolocation/v1/geolocate?key="
|
||||
"https://www.googleapis.com/geolocation/v1/geolocate?key="
|
||||
#endif
|
||||
|
||||
#ifndef GOOGLEAPIS_API_KEY
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace atom {
|
||||
|
||||
// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
|
||||
template<typename K>
|
||||
template <typename K>
|
||||
class KeyWeakMap {
|
||||
public:
|
||||
// Records the key and self, used by SetWeak.
|
||||
|
@ -48,9 +48,7 @@ class KeyWeakMap {
|
|||
}
|
||||
|
||||
// Whethere there is an object with |key| in this WeakMap.
|
||||
bool Has(const K& key) const {
|
||||
return map_.find(key) != map_.end();
|
||||
}
|
||||
bool Has(const K& key) const { return map_.find(key) != map_.end(); }
|
||||
|
||||
// Returns all objects.
|
||||
std::vector<v8::Local<v8::Object>> Values(v8::Isolate* isolate) const {
|
||||
|
@ -79,8 +77,7 @@ class KeyWeakMap {
|
|||
}
|
||||
|
||||
// Map of stored objects.
|
||||
std::unordered_map<
|
||||
K, std::pair<KeyObject, v8::Global<v8::Object>>> map_;
|
||||
std::unordered_map<K, std::pair<KeyObject, v8::Global<v8::Object>>> map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KeyWeakMap);
|
||||
};
|
||||
|
|
|
@ -12,18 +12,17 @@
|
|||
// IPC macros similar to the already existing ones in the chromium source.
|
||||
// We need these to listen to the cursor change IPC message while still
|
||||
// letting chromium handle the actual cursor change by setting handled = false.
|
||||
#define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
|
||||
IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
|
||||
_IpcMessageHandlerClass::member_func, code)
|
||||
#define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
|
||||
IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
|
||||
_IpcMessageHandlerClass::member_func, code)
|
||||
|
||||
#define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
|
||||
case msg_class::ID: { \
|
||||
if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
|
||||
&member_func)) \
|
||||
ipc_message__.set_dispatch_error(); \
|
||||
code; \
|
||||
} \
|
||||
break;
|
||||
#define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
|
||||
case msg_class::ID: { \
|
||||
if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
|
||||
&member_func)) \
|
||||
ipc_message__.set_dispatch_error(); \
|
||||
code; \
|
||||
} break;
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -18,7 +18,7 @@ class MessageLoop;
|
|||
namespace node {
|
||||
class Environment;
|
||||
class MultiIsolatePlatform;
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -84,7 +84,7 @@ class NodeBindings {
|
|||
|
||||
private:
|
||||
// Thread to poll uv events.
|
||||
static void EmbedThreadRunner(void *arg);
|
||||
static void EmbedThreadRunner(void* arg);
|
||||
|
||||
// Whether the libuv loop has ended.
|
||||
bool embed_closed_;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#undef LIKELY
|
||||
#undef arraysize
|
||||
#undef debug_string // This is defined in macOS 10.9 SDK in AssertMacros.h.
|
||||
#include "vendor/node/src/env.h"
|
||||
#include "vendor/node/src/env-inl.h"
|
||||
#include "vendor/node/src/env.h"
|
||||
#include "vendor/node/src/node.h"
|
||||
#include "vendor/node/src/node_buffer.h"
|
||||
#include "vendor/node/src/node_debug_options.h"
|
||||
|
|
|
@ -70,8 +70,7 @@ extern const char kNodeIntegrationInWorker[];
|
|||
extern const char kWebviewTag[];
|
||||
extern const char kCustomArgs[];
|
||||
|
||||
} // namespace options
|
||||
|
||||
} // namespace options
|
||||
|
||||
// Following are actually command line switches, should be moved to other files.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue