lint fix
This commit is contained in:
parent
20d2ab29ab
commit
c9fa71bdb3
4 changed files with 61 additions and 60 deletions
|
@ -343,13 +343,13 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
|||
session->browser_context(), site_instance);
|
||||
guest_delegate_.reset(new WebViewGuestDelegate);
|
||||
params.guest_delegate = guest_delegate_.get();
|
||||
|
||||
|
||||
if (embedder_ && embedder_->IsOffScreen()) {
|
||||
auto* view = new OffScreenWebContentsView(false,
|
||||
auto* view = new OffScreenWebContentsView(false,
|
||||
base::Bind(&WebContents::OnPaint, base::Unretained(this)));
|
||||
params.view = view;
|
||||
params.delegate_view = view;
|
||||
|
||||
|
||||
web_contents = content::WebContents::Create(params);
|
||||
view->SetWebContents(web_contents);
|
||||
} else {
|
||||
|
@ -1650,7 +1650,7 @@ gfx::Size WebContents::GetSizeForNewRenderView(
|
|||
if (relay) {
|
||||
return relay->window->GetSize();
|
||||
}
|
||||
|
||||
|
||||
return gfx::Size();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include "ui/compositor/layer.h"
|
||||
#include "ui/compositor/layer_type.h"
|
||||
#include "ui/events/latency_info.h"
|
||||
#include "ui/gfx/skbitmap_operations.h"
|
||||
#include "ui/gfx/geometry/dip_util.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
#include "ui/gfx/skbitmap_operations.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -53,9 +53,9 @@ class AtomResizeLock : public content::ResizeLock {
|
|||
DCHECK(host_);
|
||||
host_->HoldResize();
|
||||
|
||||
content::BrowserThread::PostDelayedTask(content::BrowserThread::UI,
|
||||
content::BrowserThread::PostDelayedTask(content::BrowserThread::UI,
|
||||
FROM_HERE, base::Bind(&AtomResizeLock::CancelLock,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs));
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
|
|||
|
||||
if (copy_frame_generator_.get())
|
||||
copy_frame_generator_.reset(NULL);
|
||||
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
DestroyPlatformWidget();
|
||||
#else
|
||||
|
@ -543,7 +543,7 @@ void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
|
|||
if (parent_host_view_->child_host_view_) {
|
||||
parent_host_view_->child_host_view_->CancelWidget();
|
||||
}
|
||||
|
||||
|
||||
parent_host_view_->set_child_host_view(this);
|
||||
parent_host_view_->Hide();
|
||||
|
||||
|
@ -720,18 +720,18 @@ void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
|
|||
void OffScreenRenderWidgetHostView::InitAsPopup(
|
||||
content::RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
|
||||
DCHECK_EQ(parent_host_view_, parent_host_view);
|
||||
|
||||
|
||||
if (parent_host_view_->popup_host_view_) {
|
||||
parent_host_view_->popup_host_view_->CancelWidget();
|
||||
}
|
||||
|
||||
|
||||
parent_host_view_->set_popup_host_view(this);
|
||||
parent_host_view_->popup_bitmap_.reset(new SkBitmap);
|
||||
parent_callback_ = base::Bind(&OffScreenRenderWidgetHostView::OnPopupPaint,
|
||||
parent_host_view_->weak_ptr_factory_.GetWeakPtr());
|
||||
|
||||
|
||||
popup_position_ = pos;
|
||||
|
||||
|
||||
ResizeRootLayer();
|
||||
Show();
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ void OffScreenRenderWidgetHostView::Destroy() {
|
|||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
@ -813,8 +813,8 @@ void OffScreenRenderWidgetHostView::EndFrameSubscription() {
|
|||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::InitAsGuest(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
content::RenderWidgetHostViewGuest* guest_view) {
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
content::RenderWidgetHostViewGuest* guest_view) {
|
||||
parent_host_view_->AddGuestHostView(this);
|
||||
parent_host_view_->RegisterGuestViewFrameSwappedCallback(guest_view);
|
||||
}
|
||||
|
@ -931,9 +931,9 @@ bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
|
|||
|
||||
void OffScreenRenderWidgetHostView::CancelWidget() {
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->LostCapture();
|
||||
render_widget_host_->LostCapture();
|
||||
Hide();
|
||||
|
||||
|
||||
if (parent_host_view_) {
|
||||
if (parent_host_view_->popup_host_view_ == this) {
|
||||
parent_host_view_->set_popup_host_view(NULL);
|
||||
|
@ -946,7 +946,7 @@ void OffScreenRenderWidgetHostView::CancelWidget() {
|
|||
}
|
||||
parent_host_view_ = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (render_widget_host_ && !is_destroyed_) {
|
||||
is_destroyed_ = true;
|
||||
// Results in a call to Destroy().
|
||||
|
@ -976,7 +976,7 @@ void OffScreenRenderWidgetHostView::OnGuestViewFrameSwapped(
|
|||
content::RenderWidgetHostViewGuest* guest_host_view) {
|
||||
InvalidateBounds(
|
||||
gfx::ConvertRectToPixel(scale_factor_, guest_host_view->GetViewBounds()));
|
||||
|
||||
|
||||
RegisterGuestViewFrameSwappedCallback(guest_host_view);
|
||||
}
|
||||
|
||||
|
@ -1023,16 +1023,16 @@ void OffScreenRenderWidgetHostView::SetNeedsBeginFrames(
|
|||
}
|
||||
|
||||
void CopyBitmapTo(
|
||||
const SkBitmap& destination,
|
||||
const SkBitmap& source,
|
||||
const SkBitmap& destination,
|
||||
const SkBitmap& source,
|
||||
const gfx::Rect& pos) {
|
||||
SkAutoLockPixels source_pixels_lock(source);
|
||||
SkAutoLockPixels destination_pixels_lock(destination);
|
||||
|
||||
|
||||
char* src = static_cast<char*>(source.getPixels());
|
||||
char* dest = static_cast<char*>(destination.getPixels());
|
||||
int pixelsize = source.bytesPerPixel();
|
||||
|
||||
|
||||
if (pos.x() + pos.width() <= destination.width() &&
|
||||
pos.y() + pos.height() <= destination.height()) {
|
||||
for (int i = 0; i < pos.height(); i++) {
|
||||
|
@ -1041,14 +1041,14 @@ void CopyBitmapTo(
|
|||
source.width() * pixelsize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
destination.notifyPixelsChanged();
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::OnPaint(
|
||||
const gfx::Rect& damage_rect, const SkBitmap& bitmap) {
|
||||
TRACE_EVENT0("electron", "OffScreenRenderWidgetHostView::OnPaint");
|
||||
|
||||
|
||||
HoldResize();
|
||||
|
||||
if (parent_callback_)
|
||||
|
@ -1057,14 +1057,14 @@ void OffScreenRenderWidgetHostView::OnPaint(
|
|||
gfx::Rect pos = popup_host_view_->popup_position_;
|
||||
SkBitmap copy = SkBitmapOperations::CreateTiledBitmap(bitmap,
|
||||
pos.x(), pos.y(), pos.width(), pos.height());
|
||||
|
||||
|
||||
CopyBitmapTo(bitmap, *popup_bitmap_, pos);
|
||||
callback_.Run(damage_rect, bitmap);
|
||||
CopyBitmapTo(bitmap, copy, pos);
|
||||
} else {
|
||||
callback_.Run(damage_rect, bitmap);
|
||||
}
|
||||
|
||||
|
||||
ReleaseResize();
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ void OffScreenRenderWidgetHostView::WasResized() {
|
|||
pending_resize_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ResizeRootLayer();
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasResized();
|
||||
|
@ -1184,10 +1184,10 @@ void OffScreenRenderWidgetHostView::SetFrameRate(int frame_rate) {
|
|||
frame_rate = 1;
|
||||
if (frame_rate > 60)
|
||||
frame_rate = 60;
|
||||
|
||||
|
||||
frame_rate_ = frame_rate;
|
||||
}
|
||||
|
||||
|
||||
for (auto guest_host_view : guest_host_views_)
|
||||
guest_host_view->SetFrameRate(frame_rate);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ATOM_BROWSER_OSR_OSR_RENDER_WIDGET_HOST_VIEW_H_
|
||||
#define ATOM_BROWSER_OSR_OSR_RENDER_WIDGET_HOST_VIEW_H_
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -142,7 +143,7 @@ class OffScreenRenderWidgetHostView
|
|||
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
|
||||
void EndFrameSubscription() override;
|
||||
void InitAsGuest(
|
||||
content::RenderWidgetHostView*,
|
||||
content::RenderWidgetHostView*,
|
||||
content::RenderWidgetHostViewGuest*) override;
|
||||
bool HasAcceleratedSurface(const gfx::Size &) override;
|
||||
gfx::Rect GetBoundsInRootWindow(void) override;
|
||||
|
@ -209,15 +210,15 @@ class OffScreenRenderWidgetHostView
|
|||
|
||||
void OnPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
||||
void OnPopupPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
||||
|
||||
|
||||
bool IsPopupWidget() const {
|
||||
return popup_type_ != blink::WebPopupTypeNone;
|
||||
}
|
||||
|
||||
|
||||
void HoldResize();
|
||||
void ReleaseResize();
|
||||
void WasResized();
|
||||
|
||||
|
||||
void ProcessKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void ProcessMouseEvent(const blink::WebMouseEvent& event,
|
||||
|
@ -247,7 +248,7 @@ class OffScreenRenderWidgetHostView
|
|||
void set_popup_host_view(OffScreenRenderWidgetHostView* popup_view) {
|
||||
popup_host_view_ = popup_view;
|
||||
}
|
||||
|
||||
|
||||
void set_child_host_view(OffScreenRenderWidgetHostView* child_view) {
|
||||
child_host_view_ = child_view;
|
||||
}
|
||||
|
@ -260,13 +261,13 @@ class OffScreenRenderWidgetHostView
|
|||
|
||||
// Weak ptrs.
|
||||
content::RenderWidgetHostImpl* render_widget_host_;
|
||||
|
||||
|
||||
OffScreenRenderWidgetHostView* parent_host_view_;
|
||||
OffScreenRenderWidgetHostView* popup_host_view_;
|
||||
std::unique_ptr<SkBitmap> popup_bitmap_;
|
||||
OffScreenRenderWidgetHostView* child_host_view_;
|
||||
std::set<OffScreenRenderWidgetHostView*> guest_host_views_;
|
||||
|
||||
|
||||
NativeWindow* native_window_;
|
||||
OffScreenOutputDevice* software_output_device_;
|
||||
|
||||
|
@ -283,7 +284,7 @@ class OffScreenRenderWidgetHostView
|
|||
gfx::Vector2dF last_scroll_offset_;
|
||||
gfx::Size size_;
|
||||
bool painting_;
|
||||
|
||||
|
||||
bool is_showing_;
|
||||
bool is_destroyed_;
|
||||
gfx::Rect popup_position_;
|
||||
|
|
|
@ -34,7 +34,7 @@ void OffScreenWebContentsView::SetWebContents(
|
|||
#if !defined(OS_MACOSX)
|
||||
gfx::NativeView OffScreenWebContentsView::GetNativeView() const {
|
||||
if (!web_contents_) return gfx::NativeView();
|
||||
|
||||
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
if (!relay) return gfx::NativeView();
|
||||
return relay->window->GetNativeView();
|
||||
|
@ -42,7 +42,7 @@ gfx::NativeView OffScreenWebContentsView::GetNativeView() const {
|
|||
|
||||
gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const {
|
||||
if (!web_contents_) return gfx::NativeView();
|
||||
|
||||
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
if (!relay) return gfx::NativeView();
|
||||
return relay->window->GetNativeView();
|
||||
|
@ -50,7 +50,7 @@ gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const {
|
|||
|
||||
gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const {
|
||||
if (!web_contents_) return gfx::NativeWindow();
|
||||
|
||||
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
if (!relay) return gfx::NativeWindow();
|
||||
return relay->window->GetNativeWindow();
|
||||
|
@ -90,18 +90,18 @@ void OffScreenWebContentsView::CreateView(const gfx::Size& initial_size,
|
|||
|
||||
content::RenderWidgetHostViewBase*
|
||||
OffScreenWebContentsView::CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
|
||||
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
|
||||
if (render_widget_host->GetView()) {
|
||||
return static_cast<content::RenderWidgetHostViewBase*>(
|
||||
render_widget_host->GetView());
|
||||
}
|
||||
|
||||
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
nullptr,
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
nullptr,
|
||||
relay->window.get());
|
||||
}
|
||||
|
||||
|
@ -113,19 +113,19 @@ content::RenderWidgetHostViewBase*
|
|||
return static_cast<content::RenderWidgetHostViewBase*>(
|
||||
render_widget_host->GetView());
|
||||
}
|
||||
|
||||
|
||||
OffScreenRenderWidgetHostView* embedder_host_view = nullptr;
|
||||
if (embedder_render_widget_host) {
|
||||
embedder_host_view = static_cast<OffScreenRenderWidgetHostView*>(
|
||||
embedder_render_widget_host->GetView());
|
||||
}
|
||||
|
||||
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
embedder_host_view,
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
embedder_host_view,
|
||||
relay->window.get());
|
||||
}
|
||||
|
||||
|
@ -134,10 +134,10 @@ content::RenderWidgetHostViewBase*
|
|||
content::RenderWidgetHost* render_widget_host) {
|
||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
GetView(),
|
||||
transparent_,
|
||||
callback_,
|
||||
render_widget_host,
|
||||
GetView(),
|
||||
relay->window.get());
|
||||
}
|
||||
|
||||
|
@ -164,13 +164,13 @@ void OffScreenWebContentsView::GetScreenInfo(
|
|||
screen_info->orientation_angle = 0;
|
||||
screen_info->orientation_type =
|
||||
content::SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY;
|
||||
|
||||
|
||||
if (GetView()) {
|
||||
screen_info->rect = gfx::Rect(GetView()->size());
|
||||
screen_info->available_rect = gfx::Rect(GetView()->size());
|
||||
screen_info->device_scale_factor = GetView()->scale_factor();
|
||||
} else {
|
||||
const display::Display display =
|
||||
const display::Display display =
|
||||
display::Screen::GetScreen()->GetPrimaryDisplay();
|
||||
screen_info->rect = display.bounds();
|
||||
screen_info->available_rect = display.work_area();
|
||||
|
|
Loading…
Reference in a new issue