summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-04-01 14:46:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-08 14:00:13 +0200
commit798134400a22f878b6cfd186b3792ecedb4d9123 (patch)
tree5ff358f5e894fa60c19c1d29067a4c9618432307 /src/core
parent96425960f9d57387c33e3ba50785aaa81255bc98 (diff)
Get rid of the BackingStore rendering path
Now that the widgets view is also using the delegated renderer, there are no supported configuration that use the BackingStore rendering path, itself on the way of deprecation in Chromium. Change-Id: I4ab889f6a7c65e8447c259faf2c7a98b88c1acf5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/backing_store_qt.cpp187
-rw-r--r--src/core/backing_store_qt.h72
-rw-r--r--src/core/core_gyp_generator.pro2
-rw-r--r--src/core/render_widget_host_view_qt.cpp27
-rw-r--r--src/core/render_widget_host_view_qt.h6
-rw-r--r--src/core/render_widget_host_view_qt_delegate.h5
-rw-r--r--src/core/web_contents_adapter.cpp14
-rw-r--r--src/core/web_contents_adapter.h4
-rw-r--r--src/core/web_contents_adapter_client.h9
-rw-r--r--src/core/web_contents_delegate_qt.cpp2
-rw-r--r--src/core/web_contents_view_qt.cpp4
-rw-r--r--src/core/web_engine_context.cpp33
-rw-r--r--src/core/web_engine_context.h6
13 files changed, 25 insertions, 346 deletions
diff --git a/src/core/backing_store_qt.cpp b/src/core/backing_store_qt.cpp
deleted file mode 100644
index 613dfdbbc..000000000
--- a/src/core/backing_store_qt.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "backing_store_qt.h"
-
-#include "type_conversion.h"
-
-#include "content/public/browser/render_process_host.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/rect_conversions.h"
-#include "ui/gfx/vector2d_conversions.h"
-#include "skia/ext/platform_canvas.h"
-
-#include <QPainter>
-#include <QScreen>
-#include <QSizeF>
-#include <QWindow>
-
-QT_BEGIN_NAMESPACE
-// from qbackingstore.cpp
-extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
-QT_END_NAMESPACE
-
-BackingStoreQt::BackingStoreQt(content::RenderWidgetHost *host, const gfx::Size &size, QWindow* parent)
- : content::BackingStore(host, size)
- , m_deviceScaleFactor((parent && parent->screen()) ? parent->screen()->devicePixelRatio() : 1)
- , m_pixelBuffer(size.width() * m_deviceScaleFactor, size.height() * m_deviceScaleFactor, QImage::Format_ARGB32_Premultiplied)
-{
-}
-
-BackingStoreQt::~BackingStoreQt()
-{
-}
-
-void BackingStoreQt::paintToTarget(QPainter* painter, const QRectF& rect)
-{
- if (m_pixelBuffer.isNull())
- return;
-
- qreal x = rect.x() * m_deviceScaleFactor;
- qreal y = rect.y() * m_deviceScaleFactor;
- qreal w = rect.width() * m_deviceScaleFactor;
- qreal h = rect.height() * m_deviceScaleFactor;
-
- QRectF source(x, y, w, h);
- painter->drawImage(rect, m_pixelBuffer, source);
-}
-
-void BackingStoreQt::PaintToBackingStore(content::RenderProcessHost *process,
- TransportDIB::Id bitmap,
- const gfx::Rect &bitmap_rect,
- const std::vector<gfx::Rect> &copy_rects,
- float scale_factor,
- const base::Closure &completion_callback,
- bool *scheduled_completion_callback)
-{
- if (bitmap_rect.IsEmpty())
- return;
-
- *scheduled_completion_callback = false;
- TransportDIB* dib = process->GetTransportDIB(bitmap);
- if (!dib)
- return;
-
- gfx::Rect pixel_bitmap_rect = gfx::ToEnclosingRect(gfx::ScaleRect(bitmap_rect, scale_factor));
-
- uint8_t* bitmapData = static_cast<uint8_t*>(dib->memory());
- const QImage img(bitmapData, pixel_bitmap_rect.width(), pixel_bitmap_rect.height(), QImage::Format_ARGB32);
-
- QPainter painter(&m_pixelBuffer);
- for (size_t i = 0; i < copy_rects.size(); ++i) {
- gfx::Rect copy_rect = gfx::ToEnclosingRect(gfx::ScaleRect(copy_rects[i], scale_factor));
-
- QRect source = QRect( copy_rect.x() - pixel_bitmap_rect.x()
- , copy_rect.y() - pixel_bitmap_rect.y()
- , copy_rect.width()
- , copy_rect.height());
-
- gfx::Rect copy_rect_dst = gfx::ToEnclosingRect(gfx::ScaleRect(copy_rects[i], m_deviceScaleFactor));
-
- QRect destination = QRect( copy_rect_dst.x()
- , copy_rect_dst.y()
- , copy_rect_dst.width()
- , copy_rect_dst.height());
-
-#if defined(OS_ANDROID)
- // The received image format is BGRA with Android so we have to swizzle the image data.
- painter.drawImage(destination, img.rgbSwapped(), source);
-#else
- painter.drawImage(destination, img, source);
-#endif
- }
-}
-
-void BackingStoreQt::ScrollBackingStore(const gfx::Vector2d &delta, const gfx::Rect &clip_rect, const gfx::Size &view_size)
-{
- DCHECK(delta.x() == 0 || delta.y() == 0);
-
- gfx::Rect pixel_rect = gfx::ToEnclosingRect(gfx::ScaleRect(clip_rect, m_deviceScaleFactor));
- gfx::Vector2d pixel_delta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(delta, m_deviceScaleFactor));
-
- // Logic borrowed from QPixmap::scroll and QRasterPlatformPixmap::scroll.
- QRect dest = toQt(pixel_rect) & m_pixelBuffer.rect();
- QRect src = dest.translated(-pixel_delta.x(), -pixel_delta.y()) & dest;
- qt_scrollRectInImage(m_pixelBuffer, src, QPoint(pixel_delta.x(), pixel_delta.y()));
-}
-
-bool BackingStoreQt::CopyFromBackingStore(const gfx::Rect &rect, skia::PlatformBitmap *output)
-{
- const int width = std::min(m_pixelBuffer.width(), rect.width());
- const int height = std::min(m_pixelBuffer.height(), rect.height());
-
- if (!output->Allocate(width, height, true))
- return false;
-
- // This code assumes a visual mode where a pixel is
- // represented using a 32-bit unsigned int, with a byte per component.
- const SkBitmap& bitmap = output->GetBitmap();
- if (bitmap.rowBytes() != 4)
- return false;
-
- SkAutoLockPixels alp(bitmap);
-
- QImage cpy = m_pixelBuffer.copy(rect.x(), rect.y(), rect.width(), rect.height());
-
- // Convert the format and remove transparency.
- if (cpy.format() != QImage::Format_RGB32)
- cpy = cpy.convertToFormat(QImage::Format_RGB32);
-
- const uint8_t* src = cpy.bits();
- uint8_t* dst = reinterpret_cast<uint8_t*>(bitmap.getAddr32(0,0));
-
- int bytesPerLine = cpy.bytesPerLine();
- int bytesPerPixel = bytesPerLine / cpy.width();
- int copyLineLength = width * bytesPerPixel;
- int lineOffset = rect.y() * cpy.width();
- int rowOffset = rect.x() * bytesPerPixel;
-
- const uint8_t* copyLineBegin = src + rowOffset + lineOffset;
-
- for (int lineNumber = 0; lineNumber < height; ++lineNumber) {
- memcpy(dst, copyLineBegin, copyLineLength);
- dst += copyLineLength;
- copyLineBegin += cpy.width();
- }
-
- return true;
-}
-
diff --git a/src/core/backing_store_qt.h b/src/core/backing_store_qt.h
deleted file mode 100644
index 24f232a02..000000000
--- a/src/core/backing_store_qt.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BACKING_STORE_QT_H
-#define BACKING_STORE_QT_H
-
-#include "content/browser/renderer_host/backing_store.h"
-
-#include <QPainter>
-#include <QImage>
-
-class BackingStoreQt : public content::BackingStore
-{
-public:
- BackingStoreQt(content::RenderWidgetHost *host, const gfx::Size &size, QWindow* parent);
- ~BackingStoreQt();
-
- void paintToTarget(QPainter*, const QRectF& rect);
-
- virtual void PaintToBackingStore(content::RenderProcessHost *process, TransportDIB::Id bitmap, const gfx::Rect &bitmap_rect,
- const std::vector<gfx::Rect> &copy_rects, float scale_factor, const base::Closure &completion_callback,
- bool *scheduled_completion_callback) Q_DECL_OVERRIDE;
-
- virtual void ScrollBackingStore(const gfx::Vector2d &delta, const gfx::Rect &clip_rect, const gfx::Size &view_size) Q_DECL_OVERRIDE;
- virtual bool CopyFromBackingStore(const gfx::Rect &rect, skia::PlatformBitmap *output) Q_DECL_OVERRIDE;
-
-private:
- // Number of physical pixels per view unit. This is 1 or 2 in practice.
- float m_deviceScaleFactor;
-
- QImage m_pixelBuffer;
-};
-
-#endif // BACKING_STORE_QT_H
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index 8b90bc91c..f6b513a21 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -28,7 +28,6 @@ RESOURCES += devtools.qrc
INCLUDEPATH += $$[QT_INSTALL_HEADERS] $$PWD
SOURCES = \
- backing_store_qt.cpp \
browser_context_qt.cpp \
chromium_gpu_helper.cpp \
chromium_overrides.cpp \
@@ -67,7 +66,6 @@ SOURCES = \
HEADERS = \
- backing_store_qt.h \
browser_context_qt.h \
chromium_overrides.h \
clipboard_qt.h \
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 7df9ee46a..7d470e5cf 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -41,7 +41,6 @@
#include "render_widget_host_view_qt.h"
-#include "backing_store_qt.h"
#include "chromium_overrides.h"
#include "delegated_frame_node.h"
#include "render_widget_host_view_qt_delegate.h"
@@ -163,7 +162,6 @@ static bool shouldSendPinchGesture()
RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget)
: m_host(content::RenderWidgetHostImpl::From(widget))
, m_gestureRecognizer(ui::GestureRecognizer::Create())
- , m_backingStore(0)
, m_frameNodeData(new DelegatedFrameNodeData)
, m_needsDelegatedFrameAck(false)
, m_adapterClient(0)
@@ -194,16 +192,9 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC
InitAsChild(0);
}
-BackingStoreQt* RenderWidgetHostViewQt::GetBackingStore()
-{
- bool force_create = !m_host->empty();
- return static_cast<BackingStoreQt*>(m_host->GetBackingStore(force_create));
-}
-
content::BackingStore *RenderWidgetHostViewQt::AllocBackingStore(const gfx::Size &size)
{
- Q_ASSERT(m_delegate);
- return new BackingStoreQt(m_host, size, m_delegate->window());
+ Q_UNREACHABLE();
}
void RenderWidgetHostViewQt::InitAsChild(gfx::NativeView)
@@ -628,8 +619,6 @@ gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow()
gfx::GLSurfaceHandle RenderWidgetHostViewQt::GetCompositingSurface()
{
- if (!m_delegate->supportsHardwareAcceleration())
- return gfx::GLSurfaceHandle();
return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
}
@@ -679,12 +668,6 @@ void RenderWidgetHostViewQt::DispatchCancelTouchEvent(ui::TouchEvent *event)
m_host->ForwardTouchEventWithLatencyInfo(cancelEvent, *event->latency());
}
-void RenderWidgetHostViewQt::paint(QPainter *painter, const QRectF& boundingRect)
-{
- if (m_backingStore)
- m_backingStore->paintToTarget(painter, boundingRect);
-}
-
QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode, QSGRenderContext *sgRenderContext)
{
DelegatedFrameNode *frameNode = static_cast<DelegatedFrameNode *>(oldNode);
@@ -704,11 +687,6 @@ QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode, QSGRenderCont
return frameNode;
}
-void RenderWidgetHostViewQt::fetchBackingStore()
-{
- m_backingStore = GetBackingStore();
-}
-
void RenderWidgetHostViewQt::notifyResize()
{
GetRenderWidgetHost()->WasResized();
@@ -812,8 +790,7 @@ void RenderWidgetHostViewQt::sendDelegatedFrameAck()
void RenderWidgetHostViewQt::Paint(const gfx::Rect& damage_rect)
{
- QRect r(damage_rect.x(), damage_rect.y(), damage_rect.width(), damage_rect.height());
- m_delegate->update(r);
+ Q_UNREACHABLE();
}
void RenderWidgetHostViewQt::ForwardGestureEventToRenderer(ui::GestureEvent* gesture)
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 208336b8b..f91beb6d2 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -56,8 +56,6 @@
#include <QRect>
#include <QtGlobal>
-class BackingStoreQt;
-
QT_BEGIN_NAMESPACE
class QEvent;
class QFocusEvent;
@@ -100,7 +98,6 @@ public:
void setDelegate(RenderWidgetHostViewQtDelegate *delegate);
void setAdapterClient(WebContentsAdapterClient *adapterClient);
- BackingStoreQt* GetBackingStore();
virtual content::BackingStore *AllocBackingStore(const gfx::Size &size) Q_DECL_OVERRIDE;
@@ -167,9 +164,7 @@ public:
virtual void DispatchCancelTouchEvent(ui::TouchEvent*) Q_DECL_OVERRIDE;
// Overridden from RenderWidgetHostViewQtDelegateClient.
- virtual void paint(QPainter *, const QRectF& boundingRect) Q_DECL_OVERRIDE;
virtual QSGNode *updatePaintNode(QSGNode *, QSGRenderContext *) Q_DECL_OVERRIDE;
- virtual void fetchBackingStore() Q_DECL_OVERRIDE;
virtual void notifyResize() Q_DECL_OVERRIDE;
virtual bool forwardEvent(QEvent *) Q_DECL_OVERRIDE;
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
@@ -229,7 +224,6 @@ private:
blink::WebTouchEvent m_accumTouchEvent;
scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
- BackingStoreQt *m_backingStore;
QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_frameNodeData;
cc::ReturnedResourceArray m_resourcesToRelease;
bool m_needsDelegatedFrameAck;
diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h
index ddfa2b3c8..a8515e0e3 100644
--- a/src/core/render_widget_host_view_qt_delegate.h
+++ b/src/core/render_widget_host_view_qt_delegate.h
@@ -63,9 +63,7 @@ class WebContentsAdapterClient;
class QWEBENGINE_EXPORT RenderWidgetHostViewQtDelegateClient {
public:
virtual ~RenderWidgetHostViewQtDelegateClient() { }
- virtual void paint(QPainter *, const QRectF& boundingRect) = 0;
virtual QSGNode *updatePaintNode(QSGNode *, QSGRenderContext *) = 0;
- virtual void fetchBackingStore() = 0;
virtual void notifyResize() = 0;
virtual bool forwardEvent(QEvent *) = 0;
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const = 0;
@@ -84,12 +82,11 @@ public:
virtual void hide() = 0;
virtual bool isVisible() const = 0;
virtual QWindow* window() const = 0;
- virtual void update(const QRect& rect = QRect()) = 0;
+ virtual void update() = 0;
virtual void updateCursor(const QCursor &) = 0;
virtual void resize(int width, int height) = 0;
virtual void move(const QPoint &) = 0;
virtual void inputMethodStateChanged(bool editorVisible) = 0;
- virtual bool supportsHardwareAcceleration() const = 0;
virtual void setTooltip(const QString &) = 0;
};
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 6c3b68b6a..ff0b9a83d 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -292,7 +292,7 @@ void deserializeNavigationHistory(QDataStream &input, int *currentIndex, std::ve
class WebContentsAdapterPrivate {
public:
- WebContentsAdapterPrivate(WebContentsAdapterClient::RenderingMode renderingMode);
+ WebContentsAdapterPrivate();
scoped_refptr<WebEngineContext> engineContext;
scoped_ptr<content::WebContents> webContents;
scoped_ptr<WebContentsDelegateQt> webContentsDelegate;
@@ -302,14 +302,14 @@ public:
QString lastSearchedString;
};
-WebContentsAdapterPrivate::WebContentsAdapterPrivate(WebContentsAdapterClient::RenderingMode renderingMode)
+WebContentsAdapterPrivate::WebContentsAdapterPrivate()
// This has to be the first thing we create, and the last we destroy.
- : engineContext(WebEngineContext::currentOrCreate(renderingMode))
+ : engineContext(WebEngineContext::current())
, lastRequestId(0)
{
}
-QExplicitlySharedDataPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient, WebContentsAdapterClient::RenderingMode renderingMode)
+QExplicitlySharedDataPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient)
{
int currentIndex;
std::vector<content::NavigationEntry*> entries;
@@ -334,11 +334,11 @@ QExplicitlySharedDataPointer<WebContentsAdapter> WebContentsAdapter::createFromS
content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, *file);
}
- return QExplicitlySharedDataPointer<WebContentsAdapter>(new WebContentsAdapter(renderingMode, newWebContents));
+ return QExplicitlySharedDataPointer<WebContentsAdapter>(new WebContentsAdapter(newWebContents));
}
-WebContentsAdapter::WebContentsAdapter(WebContentsAdapterClient::RenderingMode renderingMode, content::WebContents *webContents)
- : d_ptr(new WebContentsAdapterPrivate(renderingMode))
+WebContentsAdapter::WebContentsAdapter(content::WebContents *webContents)
+ : d_ptr(new WebContentsAdapterPrivate)
{
Q_D(WebContentsAdapter);
d->webContents.reset(webContents);
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 6e274f4e3..fc6ea99fb 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -56,9 +56,9 @@ class WebContentsAdapterPrivate;
class QWEBENGINE_EXPORT WebContentsAdapter : public QSharedData {
public:
- static QExplicitlySharedDataPointer<WebContentsAdapter> createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient, WebContentsAdapterClient::RenderingMode renderingMode);
+ static QExplicitlySharedDataPointer<WebContentsAdapter> createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient);
// Takes ownership of the WebContents.
- WebContentsAdapter(WebContentsAdapterClient::RenderingMode renderingMode, content::WebContents *webContents = 0);
+ WebContentsAdapter(content::WebContents *webContents = 0);
~WebContentsAdapter();
void initialize(WebContentsAdapterClient *adapterClient);
void reattachRWHV();
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 3a9d9dd93..2c89de369 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -77,11 +77,6 @@ public:
class QWEBENGINE_EXPORT WebContentsAdapterClient {
public:
- enum RenderingMode {
- SoftwareRenderingMode,
- HardwareAccelerationMode
- };
-
// This must match window_open_disposition_list.h.
enum WindowOpenDisposition {
UnknownDisposition = 0,
@@ -114,8 +109,8 @@ public:
virtual ~WebContentsAdapterClient() { }
- virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client, RenderingMode mode) = 0;
- virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client, RenderingMode mode) = 0;
+ virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client) = 0;
+ virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client) = 0;
virtual void titleChanged(const QString&) = 0;
virtual void urlChanged(const QUrl&) = 0;
virtual void iconChanged(const QUrl&) = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 4ac20825a..80b2330a8 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -71,7 +71,7 @@ void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* s
void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
{
- WebContentsAdapter *newAdapter = new WebContentsAdapter(WebEngineContext::current()->renderingMode(), new_contents);
+ WebContentsAdapter *newAdapter = new WebContentsAdapter(new_contents);
// Do the first ref-count manually to be able to know if the application is handling adoptNewWindow through the public API.
newAdapter->ref.ref();
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index 8a9daeec0..61a17fec3 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -64,7 +64,7 @@ content::RenderWidgetHostView* WebContentsViewQt::CreateViewForWidget(content::R
RenderWidgetHostViewQt *view = new RenderWidgetHostViewQt(render_widget_host);
Q_ASSERT(m_factoryClient);
- view->setDelegate(m_factoryClient->CreateRenderWidgetHostViewQtDelegate(view, WebEngineContext::current()->renderingMode()));
+ view->setDelegate(m_factoryClient->CreateRenderWidgetHostViewQtDelegate(view));
if (m_client)
view->setAdapterClient(m_client);
// Tell the RWHV delegate to attach itself to the native view container.
@@ -78,7 +78,7 @@ content::RenderWidgetHostView* WebContentsViewQt::CreateViewForPopupWidget(conte
RenderWidgetHostViewQt *view = new RenderWidgetHostViewQt(render_widget_host);
Q_ASSERT(m_client);
- view->setDelegate(m_client->CreateRenderWidgetHostViewQtDelegateForPopup(view, WebEngineContext::current()->renderingMode()));
+ view->setDelegate(m_client->CreateRenderWidgetHostViewQtDelegateForPopup(view));
view->setAdapterClient(m_client);
return view;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 1d4067fda..7fd7e577d 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -91,38 +91,22 @@ WebEngineContext::~WebEngineContext()
m_runLoop->AfterRun();
}
-scoped_refptr<WebEngineContext> WebEngineContext::currentOrCreate(WebContentsAdapterClient::RenderingMode renderingMode)
+scoped_refptr<WebEngineContext> WebEngineContext::current()
{
if (!sContext) {
- sContext = new WebEngineContext(renderingMode);
+ sContext = new WebEngineContext();
// Make sure that we ramp down Chromium before QApplication destroys its X connection, etc.
qAddPostRoutine(destroyContext);
- } else if (renderingMode != sContext->renderingMode())
- qFatal("Switching the QtWebEngine rendering mode once initialized in an application is not supported."
- " If you're using both a QQuickWebView and a QtQuick WebEngineView, make sure that the"
- " later is configured to use software rendering by setting:"
- "\nqApp->setProperty(\"QQuickWebEngineView_DisableHardwareAcceleration\", QVariant(true));");
- return sContext;
-}
-
-scoped_refptr<WebEngineContext> WebEngineContext::current()
-{
+ }
return sContext;
}
-WebContentsAdapterClient::RenderingMode WebEngineContext::renderingMode()
-{
- return CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableDelegatedRenderer)
- ? WebContentsAdapterClient::HardwareAccelerationMode
- : WebContentsAdapterClient::SoftwareRenderingMode;
-}
-
#ifndef CHROMIUM_VERSION
#error Chromium version should be defined at gyp-time. Something must have gone wrong
#define CHROMIUM_VERSION // This is solely to keep Qt Creator happy.
#endif
-WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode renderingMode)
+WebEngineContext::WebEngineContext()
: m_mainDelegate(new ContentMainDelegateQt)
, m_contentRunner(content::ContentMainRunner::Create())
, m_browserRunner(content::BrowserMainRunner::Create())
@@ -142,12 +126,9 @@ WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode rende
parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE));
parsedCommandLine->AppendSwitch(switches::kNoSandbox);
parsedCommandLine->AppendSwitch(switches::kDisablePlugins);
-
- if (renderingMode == WebContentsAdapterClient::HardwareAccelerationMode && !parsedCommandLine->HasSwitch(switches::kDisableDelegatedRenderer)) {
- parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer);
- parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing);
- parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
- }
+ parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer);
+ parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing);
+ parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
#if defined(OS_ANDROID)
// Required on Android
diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h
index cdd3e34b2..e0624afa1 100644
--- a/src/core/web_engine_context.h
+++ b/src/core/web_engine_context.h
@@ -42,8 +42,6 @@
#ifndef WEB_ENGINE_CONTEXT_H
#define WEB_ENGINE_CONTEXT_H
-#include "web_contents_adapter_client.h"
-
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -60,13 +58,11 @@ class ContentMainDelegateQt;
class WebEngineContext : public base::RefCounted<WebEngineContext> {
public:
- static scoped_refptr<WebEngineContext> currentOrCreate(WebContentsAdapterClient::RenderingMode renderingMode);
static scoped_refptr<WebEngineContext> current();
- WebContentsAdapterClient::RenderingMode renderingMode();
private:
friend class base::RefCounted<WebEngineContext>;
- WebEngineContext(WebContentsAdapterClient::RenderingMode renderingMode);
+ WebEngineContext();
~WebEngineContext();
scoped_ptr<base::RunLoop> m_runLoop;