From 9e7de78231e753ceda212c24224dda1ca4d7b689 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 18 Sep 2015 14:12:48 +0800 Subject: [PATCH] Fix cpplint warnings --- atom/browser/api/atom_api_window.cc | 1 - atom/browser/native_window.cc | 12 ++++-------- atom/browser/native_window.h | 17 +++++++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index a285141..db7b1d5 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -8,7 +8,6 @@ #include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/browser.h" #include "atom/browser/native_window.h" -#include "atom/common/node_includes.h" #include "atom/common/native_mate_converters/blink_converter.h" #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/gfx_converter.h" diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 55fe206..8095452 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -107,9 +107,8 @@ NativeWindow* NativeWindow::FromWebContents( content::WebContents* web_contents) { WindowList& window_list = *WindowList::GetInstance(); for (NativeWindow* window : window_list) { - if (window->web_contents() == web_contents){ + if (window->web_contents() == web_contents) return window; - } } return nullptr; } @@ -290,16 +289,12 @@ void NativeWindow::SetAspectRatio(double aspect_ratio, void NativeWindow::SetFrameSubscription(bool isOffscreen) { const auto view = web_contents()->GetRenderWidgetHostView(); - if (view) { if (isOffscreen) { scoped_ptr subscriber( new RenderSubscriber( view->GetVisibleViewportSize(), - base::Bind(&NativeWindow::OnFrameReceived, base::Unretained(this)) - ) - ); - + base::Bind(&NativeWindow::OnFrameReceived, base::Unretained(this)))); view->BeginFrameSubscription(subscriber.Pass()); } else { view->EndFrameSubscription(); @@ -593,7 +588,8 @@ bool RenderSubscriber::ShouldCaptureFrame( gfx::Rect(size_), size_, base::TimeDelta()); - *callback = base::Bind(&RenderSubscriber::CallbackMethod, callback_, *storage); + *callback = + base::Bind(&RenderSubscriber::CallbackMethod, callback_, *storage); return true; } diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 1eabd5e..3344cfb 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -313,10 +313,14 @@ class NativeWindow : public content::WebContentsObserver, DISALLOW_COPY_AND_ASSIGN(NativeWindow); }; -//This class provides a way to listen to frame renders and to use the rendered frames for offscreen rendering +// This class provides a way to listen to frame renders and to use the rendered +// frames for offscreen rendering class RenderSubscriber : public content::RenderWidgetHostViewFrameSubscriber { public: - RenderSubscriber(gfx::Size size, base::Callback)> callback) : size_(size), callback_(callback) {} + RenderSubscriber( + gfx::Size size, + base::Callback)> callback) + : size_(size), callback_(callback) {} bool ShouldCaptureFrame(const gfx::Rect& damage_rect, base::TimeTicks present_time, @@ -325,10 +329,11 @@ class RenderSubscriber : public content::RenderWidgetHostViewFrameSubscriber { base::TimeTicks last_present_time() const { return last_present_time_; } - static void CallbackMethod(base::Callback)> callback, - scoped_refptr frame, - base::TimeTicks present_time, - bool success) { + static void CallbackMethod( + base::Callback)> callback, + scoped_refptr frame, + base::TimeTicks present_time, + bool success) { callback.Run(success, frame); } -- 2.7.4