Browse Source

does linting

gellert 8 years ago
parent
commit
5525ac36b8

+ 3 - 5
atom/browser/api/atom_api_web_contents.cc

@@ -313,7 +313,7 @@ WebContents::WebContents(v8::Isolate* isolate,
     guest_delegate_.reset(new WebViewGuestDelegate);
     params.guest_delegate = guest_delegate_.get();
     web_contents = content::WebContents::Create(params);
-  } else if(IsOffScreen()) {
+  } else if (IsOffScreen()) {
     content::WebContents::CreateParams params(session->browser_context());
 
     auto view = new OffScreenWebContentsView();
@@ -1322,8 +1322,6 @@ void WebContents::OnCursorChange(const content::WebCursor& cursor) {
   if (cursor.IsCustom()) {
     Emit("cursor-changed", CursorTypeToString(info),
       gfx::Image::CreateFrom1xBitmap(info.custom_image),
-      gfx::Rect(info.custom_image.width(), info.custom_image.height()),
-      info.hotspot,
       info.image_scale_factor);
   } else {
     Emit("cursor-changed", CursorTypeToString(info));
@@ -1395,8 +1393,8 @@ void WebContents::OnPaint(
     int bitmap_width,
     int bitmap_height,
     void* bitmap_pixels) {
-  v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate
-    , (char *)bitmap_pixels, sizeof(bitmap_pixels));
+  v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate,
+    reinterpret_cast<char *>(bitmap_pixels), sizeof(bitmap_pixels));
 
   const gfx::Size bitmap_size = gfx::Size(bitmap_width, bitmap_height);
   Emit("paint", damage_rect, buffer.ToLocalChecked(), bitmap_size);

+ 2 - 2
atom/browser/api/atom_api_web_contents.h

@@ -50,7 +50,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
     BROWSER_WINDOW,  // Used by BrowserWindow.
     REMOTE,  // Thin wrap around an existing WebContents.
     WEB_VIEW,  // Used by <webview>.
-    OFF_SCREEN, // Used for offscreen rendering
+    OFF_SCREEN,  // Used for offscreen rendering
   };
 
   // For node.js callback function type: function(error, buffer)
@@ -163,7 +163,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
   void StartPainting();
   void StopPainting();
   bool IsPainting() const;
-  void SetFrameRate(int);
+  void SetFrameRate(int frame_rate);
   int GetFrameRate() const;
 
   // Callback triggered on permission response.

+ 1 - 1
atom/browser/api/atom_api_window.cc

@@ -73,7 +73,7 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
   // Use options.webPreferences to create WebContents.
   mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
   options.Get(options::kWebPreferences, &web_preferences);
-  
+
   // Copy the backgroundColor to webContents.
   v8::Local<v8::Value> value;
   if (options.Get(options::kBackgroundColor, &value))

+ 0 - 9
atom/browser/api/frame_subscriber.cc

@@ -9,7 +9,6 @@
 #include "atom/common/node_includes.h"
 #include "content/public/browser/render_widget_host.h"
 
-#include <iostream>
 #include "content/browser/compositor/image_transport_factory.h"
 #include "cc/surfaces/surface_manager.h"
 #include "cc/surfaces/surface.h"
@@ -19,14 +18,6 @@ namespace atom {
 
 namespace api {
 
-FrameSubscriberRenderWidgetHostView::FrameSubscriberRenderWidgetHostView() {
-  std::cout << "FrameSubscriberRenderWidgetHostView" << std::endl;
-}
-
-FrameSubscriberRenderWidgetHostView::~FrameSubscriberRenderWidgetHostView() {
-  std::cout << "~FrameSubscriberRenderWidgetHostView" << std::endl;
-}
-
 FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
                                  content::RenderWidgetHostView* view,
                                  const FrameCaptureCallback& callback,

+ 0 - 10
atom/browser/api/frame_subscriber.h

@@ -22,16 +22,6 @@ namespace atom {
 
 namespace api {
 
-class FrameSubscriberRenderWidgetHostView
- : public content::RenderWidgetHostViewBase {
- public:
-
-  FrameSubscriberRenderWidgetHostView();
-  ~FrameSubscriberRenderWidgetHostView();
-
-  cc::SurfaceId SurfaceId();
-};
-
 class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
  public:
   using FrameCaptureCallback =

+ 1 - 1
atom/browser/atom_browser_context.cc

@@ -87,7 +87,7 @@ AtomBrowserContext::AtomBrowserContext(
   // Read options.
   use_cache_ = true;
   options.GetBoolean("cache", &use_cache_);
-  
+
   InitPrefs();
 }
 

+ 3 - 4
atom/browser/osr_output_device.h

@@ -12,11 +12,10 @@
 
 namespace atom {
 
-typedef base::Callback<void(const gfx::Rect&,int,int,void*)> OnPaintCallback;
+typedef base::Callback<void(const gfx::Rect&, int, int, void*)> OnPaintCallback;
 
 class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
-public:
-
+ public:
   OffScreenOutputDevice(bool transparent, const OnPaintCallback& callback);
   ~OffScreenOutputDevice();
 
@@ -30,7 +29,7 @@ public:
 
   void OnPaint(const gfx::Rect& damage_rect);
 
-private:
+ private:
   const bool transparent_;
   const OnPaintCallback callback_;
 

+ 31 - 17
atom/browser/osr_render_widget_host_view.cc

@@ -4,6 +4,8 @@
 
 #include "atom/browser/osr_render_widget_host_view.h"
 
+#include <vector>
+
 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
 #include "components/display_compositor/gl_helper.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -303,7 +305,8 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
       : callback_(callback) {
     time_source_ = cc::DelayBasedTimeSource::Create(
         base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms),
-        content::BrowserThread::GetMessageLoopProxyForThread(content::BrowserThread::UI).get());
+        content::BrowserThread::GetMessageLoopProxyForThread(
+          content::BrowserThread::UI).get());
     time_source_->SetClient(this);
   }
 
@@ -333,7 +336,8 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
 };
 
 OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
-  content::RenderWidgetHost* host, NativeWindow* native_window): render_widget_host_(content::RenderWidgetHostImpl::From(host)),
+  content::RenderWidgetHost* host, NativeWindow* native_window):
+    render_widget_host_(content::RenderWidgetHostImpl::From(host)),
     native_window_(native_window),
     software_output_device_(NULL),
     callback_(nullptr),
@@ -610,7 +614,8 @@ void OffScreenRenderWidgetHostView::TextInputStateChanged(
 void OffScreenRenderWidgetHostView::ImeCancelComposition() {
 }
 
-void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,int) {
+void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,
+    int) {
   Destroy();
 }
 
@@ -625,18 +630,19 @@ void OffScreenRenderWidgetHostView::SelectionBoundsChanged(
   const ViewHostMsg_SelectionBounds_Params &) {
 }
 
-void OffScreenRenderWidgetHostView::CopyFromCompositingSurface(const gfx::Rect& src_subrect,
-  const gfx::Size& dst_size,
-  const content::ReadbackRequestCallback& callback,
-  const SkColorType preferred_color_type) {
+void OffScreenRenderWidgetHostView::CopyFromCompositingSurface(
+    const gfx::Rect& src_subrect,
+    const gfx::Size& dst_size,
+    const content::ReadbackRequestCallback& callback,
+    const SkColorType preferred_color_type) {
   delegated_frame_host_->CopyFromCompositingSurface(
     src_subrect, dst_size, callback, preferred_color_type);
 }
 
 void OffScreenRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame(
-  const gfx::Rect& src_subrect,
-  const scoped_refptr<media::VideoFrame>& target,
-  const base::Callback<void (const gfx::Rect&, bool)>& callback) {
+    const gfx::Rect& src_subrect,
+    const scoped_refptr<media::VideoFrame>& target,
+    const base::Callback<void(const gfx::Rect&, bool)>& callback) {
   delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame(
     src_subrect, target, callback);
 }
@@ -658,7 +664,8 @@ bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) {
   return false;
 }
 
-void OffScreenRenderWidgetHostView::GetScreenInfo(blink::WebScreenInfo* results) {
+void OffScreenRenderWidgetHostView::GetScreenInfo(
+    blink::WebScreenInfo* results) {
   results->rect = gfx::Rect(size_);
   results->availableRect = gfx::Rect(size_);
   results->depth = 24;
@@ -668,7 +675,8 @@ void OffScreenRenderWidgetHostView::GetScreenInfo(blink::WebScreenInfo* results)
   results->orientationType = blink::WebScreenOrientationLandscapePrimary;
 }
 
-bool OffScreenRenderWidgetHostView::GetScreenColorProfile(blink::WebVector<char>*) {
+bool OffScreenRenderWidgetHostView::GetScreenColorProfile(
+    blink::WebVector<char>*) {
   return false;
 }
 
@@ -694,7 +702,9 @@ gfx::Size OffScreenRenderWidgetHostView::GetRequestedRendererSize() const {
   return size_;
 }
 
-int OffScreenRenderWidgetHostView::DelegatedFrameHostGetGpuMemoryBufferClientId() const {
+int OffScreenRenderWidgetHostView::
+  DelegatedFrameHostGetGpuMemoryBufferClientId()
+    const {
   return render_widget_host_->GetProcess()->GetID();
 }
 
@@ -721,7 +731,8 @@ bool OffScreenRenderWidgetHostView::DelegatedFrameCanCreateResizeLock() const {
 }
 
 std::unique_ptr<content::ResizeLock>
-  OffScreenRenderWidgetHostView::DelegatedFrameHostCreateResizeLock(bool) {
+  OffScreenRenderWidgetHostView::DelegatedFrameHostCreateResizeLock(
+      bool defer_compositor_lock) {
   return nullptr;
 }
 
@@ -736,14 +747,16 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostSendCompositorSwapAck(
     output_surface_id, ack));
 }
 
-void OffScreenRenderWidgetHostView::DelegatedFrameHostSendReclaimCompositorResources(
+void OffScreenRenderWidgetHostView::
+  DelegatedFrameHostSendReclaimCompositorResources(
     int output_surface_id, const cc::CompositorFrameAck& ack) {
   render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources(
     render_widget_host_->GetRoutingID(),
     output_surface_id, ack));
 }
 
-void OffScreenRenderWidgetHostView::DelegatedFrameHostOnLostCompositorResources() {
+void OffScreenRenderWidgetHostView::
+  DelegatedFrameHostOnLostCompositorResources() {
   render_widget_host_->ScheduleComposite();
 }
 
@@ -753,7 +766,8 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostUpdateVSyncParameters(
 }
 
 std::unique_ptr<cc::SoftwareOutputDevice>
-    OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(ui::Compositor* compositor) {
+  OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
+    ui::Compositor* compositor) {
   DCHECK_EQ(compositor_.get(), compositor);
   DCHECK(!copy_frame_generator_);
   DCHECK(!software_output_device_);

+ 81 - 74
atom/browser/osr_render_widget_host_view.h

@@ -5,6 +5,9 @@
 #ifndef ATOM_BROWSER_OSR_RENDER_WIDGET_HOST_VIEW_H_
 #define ATOM_BROWSER_OSR_RENDER_WIDGET_HOST_VIEW_H_
 
+#include <string>
+#include <vector>
+
 #include "atom/browser/native_window.h"
 
 #include "content/browser/renderer_host/render_widget_host_view_base.h"
@@ -59,82 +62,85 @@ class OffScreenRenderWidgetHostView:
 #endif
   public ui::CompositorDelegate,
   public content::DelegatedFrameHostClient {
-public:
+ public:
   OffScreenRenderWidgetHostView(content::RenderWidgetHost*, NativeWindow*);
   ~OffScreenRenderWidgetHostView();
 
   // content::RenderWidgetHostView
   bool OnMessageReceived(const IPC::Message&) override;
-  void InitAsChild(gfx::NativeView) override;
-  content::RenderWidgetHost* GetRenderWidgetHost(void) const override;
-  void SetSize(const gfx::Size &) override;
-  void SetBounds(const gfx::Rect &) override;
-  gfx::Vector2dF GetLastScrollOffset(void) const override;
-  gfx::NativeView GetNativeView(void) const override;
-  gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
-  ui::TextInputClient* GetTextInputClient() override;
-  void Focus(void) override;
-  bool HasFocus(void) const override;
-  bool IsSurfaceAvailableForCopy(void) const override;
-  void Show(void) override;
-  void Hide(void) override;
-  bool IsShowing(void) override;
-  gfx::Rect GetViewBounds(void) const override;
-  gfx::Size GetVisibleViewportSize() const override;
-  void SetInsets(const gfx::Insets&) override;
-  bool LockMouse(void) override;
-  void UnlockMouse(void) override;
-  bool GetScreenColorProfile(std::vector<char>*) override;
-
+  void InitAsChild(gfx::NativeView) override;
+  content::RenderWidgetHost* GetRenderWidgetHost(void) const override;
+  void SetSize(const gfx::Size &) override;
+  void SetBounds(const gfx::Rect &) override;
+  gfx::Vector2dF GetLastScrollOffset(void) const override;
+  gfx::NativeView GetNativeView(void) const override;
+  gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
+  ui::TextInputClient* GetTextInputClient() override;
+  void Focus(void) override;
+  bool HasFocus(void) const override;
+  bool IsSurfaceAvailableForCopy(void) const override;
+  void Show(void) override;
+  void Hide(void) override;
+  bool IsShowing(void) override;
+  gfx::Rect GetViewBounds(void) const override;
+  gfx::Size GetVisibleViewportSize() const override;
+  void SetInsets(const gfx::Insets&) override;
+  bool LockMouse(void) override;
+  void UnlockMouse(void) override;
+  bool GetScreenColorProfile(std::vector<char>*) override;
+
+#if defined(OS_MACOSX)
+  ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
+  void SetActive(bool active) override;
+  void ShowDefinitionForSelection() override;
+  bool SupportsSpeech() const override;
+  void SpeakSelection() override;
+  bool IsSpeaking() const override;
+  void StopSpeaking() override;
+#endif  // defined(OS_MACOSX)
+
+  // content::RenderWidgetHostViewBase
+  void OnSwapCompositorFrame(uint32_t, std::unique_ptr<cc::CompositorFrame>)
+    override;
+  void ClearCompositorFrame(void) override;
+  void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect)
+    override;
+  void InitAsFullscreen(content::RenderWidgetHostView *) override;
+  void UpdateCursor(const content::WebCursor &) override;
+  void SetIsLoading(bool is_loading) override;
+  void TextInputStateChanged(const content::TextInputState& params) override;
+  void ImeCancelComposition(void) override;
+  void RenderProcessGone(base::TerminationStatus, int) override;
+  void Destroy(void) override;
+  void SetTooltipText(const base::string16 &) override;
+
 #if defined(OS_MACOSX)
-  ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
-  void SetActive(bool active) override;
-  void ShowDefinitionForSelection() override;
-  bool SupportsSpeech() const override;
-  void SpeakSelection() override;
-  bool IsSpeaking() const override;
-  void StopSpeaking() override;
-#endif  // defined(OS_MACOSX)
-
-  // content::RenderWidgetHostViewBase
-  void OnSwapCompositorFrame(uint32_t, std::unique_ptr<cc::CompositorFrame>) override;
-  void ClearCompositorFrame(void) override;
-  void InitAsPopup(content::RenderWidgetHostView *, const gfx::Rect &) override;
-  void InitAsFullscreen(content::RenderWidgetHostView *) override;
-  void UpdateCursor(const content::WebCursor &) override;
-  void SetIsLoading(bool) override;
-  void TextInputStateChanged(const content::TextInputState& params) override;
-  void ImeCancelComposition(void) override;
-  void RenderProcessGone(base::TerminationStatus,int) override;
-  void Destroy(void) override;
-  void SetTooltipText(const base::string16 &) override;
-
-#if defined(OS_MACOSX)
-  void SelectionChanged(const base::string16& text,
-                        size_t offset,
-                        const gfx::Range& range) override;
-#endif
-
-  void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params &) override;
-  void CopyFromCompositingSurface(const gfx::Rect &,
-    const gfx::Size &,
-    const content::ReadbackRequestCallback &,
-    const SkColorType) override;
-  void CopyFromCompositingSurfaceToVideoFrame(
-    const gfx::Rect &,
-    const scoped_refptr<media::VideoFrame> &,
-    const base::Callback<void (const gfx::Rect &, bool),
-    base::internal::CopyMode::Copyable> &) override;
-  bool CanCopyToVideoFrame(void) const override;
-  void BeginFrameSubscription(
-    std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
-  void EndFrameSubscription() override;
-  bool HasAcceleratedSurface(const gfx::Size &) override;
-  void GetScreenInfo(blink::WebScreenInfo *) override;
-  bool GetScreenColorProfile(blink::WebVector<char>*);
-  gfx::Rect GetBoundsInRootWindow(void) override;
-  void LockCompositingSurface(void) override;
-  void UnlockCompositingSurface(void) override;
+  void SelectionChanged(const base::string16& text,
+                        size_t offset,
+                        const gfx::Range& range) override;
+#endif
+
+  void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params &)
+    override;
+  void CopyFromCompositingSurface(const gfx::Rect &,
+    const gfx::Size &,
+    const content::ReadbackRequestCallback &,
+    const SkColorType) override;
+  void CopyFromCompositingSurfaceToVideoFrame(
+    const gfx::Rect &,
+    const scoped_refptr<media::VideoFrame> &,
+    const base::Callback<void(const gfx::Rect &, bool),
+    base::internal::CopyMode::Copyable> &) override;
+  bool CanCopyToVideoFrame(void) const override;
+  void BeginFrameSubscription(
+    std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
+  void EndFrameSubscription() override;
+  bool HasAcceleratedSurface(const gfx::Size &) override;
+  void GetScreenInfo(blink::WebScreenInfo *) override;
+  bool GetScreenColorProfile(blink::WebVector<char>*);
+  gfx::Rect GetBoundsInRootWindow(void) override;
+  void LockCompositingSurface(void) override;
+  void UnlockCompositingSurface(void) override;
   void ImeCompositionRangeChanged(
     const gfx::Range &, const std::vector<gfx::Rect>&) override;
   gfx::Size GetPhysicalBackingSize() const override;
@@ -147,7 +153,8 @@ public:
   SkColor DelegatedFrameHostGetGutterColor(SkColor) const override;
   gfx::Size DelegatedFrameHostDesiredSizeInDIP(void) const override;
   bool DelegatedFrameCanCreateResizeLock(void) const override;
-  std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(bool) override;
+  std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
+    bool defer_compositor_lock) override;
   void DelegatedFrameHostResizeLockWasReleased(void) override;
   void DelegatedFrameHostSendCompositorSwapAck(
     int, const cc::CompositorFrameAck &) override;
@@ -190,13 +197,13 @@ public:
                int bitmap_height,
                void* bitmap_pixels);
 
-  void SetPainting(bool);
+  void SetPainting(bool painting);
   bool IsPainting() const;
 
-  void SetFrameRate(int);
+  void SetFrameRate(int frame_rate);
   int GetFrameRate() const;
 private:
-  void SetupFrameRate(bool);
+  void SetupFrameRate(bool force);
   void ResizeRootLayer();
 
   content::RenderWidgetHostImpl* render_widget_host_;

+ 2 - 2
atom/browser/osr_render_widget_host_view_win.cc

@@ -9,7 +9,7 @@
 namespace atom {
 
 class DummyWindowWin : public gfx::WindowImpl {
-public:
+ public:
   DummyWindowWin() {
     // Create a hidden 1x1 borderless window.
     set_window_style(WS_POPUP | WS_SYSMENU);
@@ -20,7 +20,7 @@ public:
     DestroyWindow(hwnd());
   }
 
-private:
+ private:
   CR_BEGIN_MSG_MAP_EX(DummyWindowWin)
     CR_MSG_WM_PAINT(OnPaint)
   CR_END_MSG_MAP()

+ 2 - 3
atom/browser/osr_web_contents_view.h

@@ -13,8 +13,7 @@ namespace atom {
 
 class OffScreenWebContentsView : public content::WebContentsView,
                                  public content::RenderViewHostDelegateView {
-public:
-
+ public:
   OffScreenWebContentsView();
   ~OffScreenWebContentsView();
 
@@ -60,7 +59,7 @@ public:
       const content::DragEventSourceInfo& event_info) override;
   void UpdateDragCursor(blink::WebDragOperation operation) override;
 
-private:
+ private:
   content::RenderWidgetHostViewBase* view_;
   content::WebContents* web_contents_;
 };