From c0c9e3ac3d675286550463d82aa2e7352ce43fd6 Mon Sep 17 00:00:00 2001 From: "ali.ibrahim" Date: Fri, 14 Oct 2016 11:51:45 +0200 Subject: [PATCH] Formatting C++ code using ClangFormat. --- atom/browser/api/atom_api_url_request.h | 52 ++++++++++++------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/atom/browser/api/atom_api_url_request.h b/atom/browser/api/atom_api_url_request.h index e7780556bca..3198338a1bf 100644 --- a/atom/browser/api/atom_api_url_request.h +++ b/atom/browser/api/atom_api_url_request.h @@ -94,9 +94,8 @@ class URLRequest : public mate::EventEmitter { public: static mate::WrappableBase* New(mate::Arguments* args); - static void BuildPrototype( - v8::Isolate* isolate, - v8::Local prototype); + static void BuildPrototype(v8::Isolate* isolate, + v8::Local prototype); // Methods for reporting events into JavaScript. void OnAuthenticationRequired( @@ -109,8 +108,7 @@ class URLRequest : public mate::EventEmitter { void OnResponseError(const std::string& error); protected: - explicit URLRequest(v8::Isolate* isolate, - v8::Local wrapper); + explicit URLRequest(v8::Isolate* isolate, v8::Local wrapper); ~URLRequest() override; private: @@ -118,21 +116,23 @@ class URLRequest : public mate::EventEmitter { class StateBase { public: void SetFlag(Flags flag); + protected: explicit StateBase(Flags initialState); bool operator==(Flags flag) const; bool IsFlagSet(Flags flag) const; + private: - Flags state_; + Flags state_; }; enum class RequestStateFlags { - kNotStarted = 0x0, - kStarted = 0x1, - kFinished = 0x2, - kCanceled = 0x4, - kFailed = 0x8, - kClosed = 0x10 + kNotStarted = 0x0, + kStarted = 0x1, + kFinished = 0x2, + kCanceled = 0x4, + kFailed = 0x8, + kClosed = 0x10 }; class RequestState : public StateBase { @@ -168,8 +168,7 @@ class URLRequest : public mate::EventEmitter { bool Finished() const; bool Canceled() const; bool Failed() const; - bool Write(scoped_refptr buffer, - bool is_last); + bool Write(scoped_refptr buffer, bool is_last); void Cancel(); bool SetExtraHeader(const std::string& name, const std::string& value); void RemoveExtraHeader(const std::string& name); @@ -181,14 +180,14 @@ class URLRequest : public mate::EventEmitter { uint32_t ResponseHttpVersionMajor() const; uint32_t ResponseHttpVersionMinor() const; - template - std::array, sizeof...(ArgTypes)> - BuildArgsArray(ArgTypes... args) const; + template + std::array, sizeof...(ArgTypes)> BuildArgsArray( + ArgTypes... args) const; - template + template void EmitRequestEvent(ArgTypes... args); - template + template void EmitResponseEvent(ArgTypes... args); void Close(); @@ -204,35 +203,34 @@ class URLRequest : public mate::EventEmitter { scoped_refptr response_headers_; base::WeakPtrFactory weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(URLRequest); }; -template +template std::array, sizeof...(ArgTypes)> URLRequest::BuildArgsArray(ArgTypes... args) const { - std::array, sizeof...(ArgTypes)> result - = { { mate::ConvertToV8(isolate(), args)... } }; + std::array, sizeof...(ArgTypes)> result = { + {mate::ConvertToV8(isolate(), args)...}}; return result; } -template +template void URLRequest::EmitRequestEvent(ArgTypes... args) { auto arguments = BuildArgsArray(args...); v8::Local _emitRequestEvent; auto wrapper = GetWrapper(); if (mate::Dictionary(isolate(), wrapper) - .Get("_emitRequestEvent", &_emitRequestEvent)) + .Get("_emitRequestEvent", &_emitRequestEvent)) _emitRequestEvent->Call(wrapper, arguments.size(), arguments.data()); } -template +template void URLRequest::EmitResponseEvent(ArgTypes... args) { auto arguments = BuildArgsArray(args...); v8::Local _emitResponseEvent; auto wrapper = GetWrapper(); if (mate::Dictionary(isolate(), wrapper) - .Get("_emitResponseEvent", &_emitResponseEvent)) + .Get("_emitResponseEvent", &_emitResponseEvent)) _emitResponseEvent->Call(wrapper, arguments.size(), arguments.data()); }