summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:59:24 +0000
committerskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:59:24 +0000
commit2847b22b21830714bc978afef67af63e37abb115 (patch)
treebfdfde6d7a0f27e7d767bcda5486b10ccb6b8330 /content
parent915388f3587dc98c54d90796752735d154b28de5 (diff)
downloadchromium_src-2847b22b21830714bc978afef67af63e37abb115.zip
chromium_src-2847b22b21830714bc978afef67af63e37abb115.tar.gz
chromium_src-2847b22b21830714bc978afef67af63e37abb115.tar.bz2
Browser side changes for software compositing.
BUG=124671, 161008 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/13042012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc181
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h25
-rw-r--r--content/renderer/gpu/compositor_software_output_device.cc65
-rw-r--r--content/renderer/gpu/compositor_software_output_device.h1
-rw-r--r--content/renderer/render_widget.cc37
6 files changed, 226 insertions, 85 deletions
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 67ba418..eaabc71 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1619,6 +1619,8 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
ack.gl_frame_data->sync_point = 0;
} else if (frame->delegated_frame_data) {
ack.resources.swap(frame->delegated_frame_data->resource_list);
+ } else if (frame->software_frame_data) {
+ ack.last_dib_id = frame->software_frame_data->dib_id;
}
SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack);
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index adc258a..6c2339f 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -927,7 +927,7 @@ bool RenderWidgetHostViewAura::HasFocus() const {
}
bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const {
- return current_surface_ || !!host_->GetBackingStore(false);
+ return current_surface_ || current_dib_ || !!host_->GetBackingStore(false);
}
void RenderWidgetHostViewAura::Show() {
@@ -1228,13 +1228,13 @@ void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() {
accelerated_compositing_state_changed_ = true;
}
-bool RenderWidgetHostViewAura::ShouldSkipFrame(gfx::Size size_in_dip) {
+bool RenderWidgetHostViewAura::ShouldSkipFrame(gfx::Size size_in_dip) const {
if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME ||
can_lock_compositor_ == NO_PENDING_COMMIT ||
resize_locks_.empty())
return false;
- ResizeLockList::iterator it = resize_locks_.begin();
+ ResizeLockList::const_iterator it = resize_locks_.begin();
while (it != resize_locks_.end()) {
if ((*it)->expected_size() == size_in_dip)
break;
@@ -1282,10 +1282,15 @@ void RenderWidgetHostViewAura::UpdateExternalTexture() {
if (accelerated_compositing_state_changed_)
accelerated_compositing_state_changed_ = false;
- if (current_surface_ && host_->is_accelerated_compositing_active()) {
+ bool is_compositing_active = host_->is_accelerated_compositing_active();
+ if (is_compositing_active && current_surface_) {
window_->SetExternalTexture(current_surface_.get());
gfx::Size container_size = ConvertSizeToDIP(this, current_surface_->size());
CheckResizeLocks(container_size);
+ } else if (is_compositing_active && current_dib_) {
+ window_->SetExternalTexture(NULL);
+ gfx::Size frame_size = ConvertSizeToDIP(this, last_swapped_surface_size_);
+ CheckResizeLocks(frame_size);
} else {
window_->SetExternalTexture(NULL);
resize_locks_.clear();
@@ -1335,12 +1340,8 @@ void RenderWidgetHostViewAura::SwapBuffersCompleted(
if (!compositor) {
ack_callback.Run(false, texture_to_return);
} else {
- // Add sending an ACK to the list of things to do OnCompositingDidCommit
- can_lock_compositor_ = NO_PENDING_COMMIT;
- on_compositing_did_commit_callbacks_.push_back(
+ AddOnCommitCallbackAndDisableLocks(
base::Bind(ack_callback, false, texture_to_return));
- if (!compositor->HasObserver(this))
- compositor->AddObserver(this);
}
}
@@ -1409,12 +1410,9 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame(
if (!compositor) {
SendDelegatedFrameAck();
} else {
- can_lock_compositor_ = NO_PENDING_COMMIT;
- on_compositing_did_commit_callbacks_.push_back(
+ AddOnCommitCallbackAndDisableLocks(
base::Bind(&RenderWidgetHostViewAura::SendDelegatedFrameAck,
- base::Unretained(this)));
- if (!compositor->HasObserver(this))
- compositor->AddObserver(this);
+ AsWeakPtr()));
}
}
@@ -1425,6 +1423,78 @@ void RenderWidgetHostViewAura::SendDelegatedFrameAck() {
host_->GetRoutingID(), host_->GetProcess()->GetID(), ack);
}
+void RenderWidgetHostViewAura::SwapSoftwareFrame(
+ scoped_ptr<cc::SoftwareFrameData> frame_data,
+ float frame_device_scale_factor) {
+ const gfx::Size& frame_size = frame_data->size;
+ const gfx::Rect& damage_rect = frame_data->damage_rect;
+ const TransportDIB::Id& dib_id = frame_data->dib_id;
+
+ scoped_ptr<TransportDIB> dib;
+#if defined(OS_WIN)
+ TransportDIB::Handle my_handle = TransportDIB::DefaultHandleValue();
+ ::DuplicateHandle(host_->GetProcess()->GetHandle(), dib_id.handle,
+ ::GetCurrentProcess(), &my_handle,
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
+ dib.reset(TransportDIB::Map(my_handle));
+#elif defined(USE_X11)
+ dib.reset(TransportDIB::Map(dib_id.shmkey));
+#else
+ NOTIMPLEMENTED();
+#endif
+
+ // Validate the received DIB.
+ size_t expected_size = 4 * frame_size.GetArea();
+ if (!dib || dib->size() < expected_size) {
+ host_->GetProcess()->ReceivedBadMessage();
+ return;
+ }
+
+ if (last_swapped_surface_size_ != frame_size) {
+ DLOG_IF(ERROR, damage_rect != gfx::Rect(frame_size))
+ << "Expected full damage rect";
+ }
+
+ TransportDIB::Id last_dib_id = current_dib_id_;
+ current_dib_.reset(dib.release());
+ current_dib_id_ = dib_id;
+ last_swapped_surface_size_ = frame_size;
+ previous_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op);
+
+ ui::Compositor* compositor = GetCompositor();
+ if (!compositor) {
+ SendSoftwareFrameAck(last_dib_id);
+ return;
+ }
+
+ gfx::Size frame_size_in_dip = gfx::ToFlooredSize(
+ gfx::ScaleSize(frame_size, 1.0f / frame_device_scale_factor));
+ if (ShouldSkipFrame(frame_size_in_dip)) {
+ can_lock_compositor_ = NO_PENDING_COMMIT;
+ SendSoftwareFrameAck(last_dib_id);
+ } else {
+ AddOnCommitCallbackAndDisableLocks(
+ base::Bind(&RenderWidgetHostViewAura::SendSoftwareFrameAck,
+ AsWeakPtr(), last_dib_id));
+ }
+
+ CheckResizeLocks(frame_size_in_dip);
+ released_front_lock_ = NULL;
+ window_->SetExternalTexture(NULL);
+ window_->SchedulePaintInRect(ConvertRectToDIP(this, damage_rect));
+
+ if (paint_observer_)
+ paint_observer_->OnUpdateCompositorContent();
+}
+
+void RenderWidgetHostViewAura::SendSoftwareFrameAck(
+ const TransportDIB::Id& id) {
+ cc::CompositorFrameAck ack;
+ ack.last_dib_id = id;
+ RenderWidgetHostImpl::SendSwapCompositorFrameAck(
+ host_->GetRoutingID(), host_->GetProcess()->GetID(), ack);
+}
+
void RenderWidgetHostViewAura::OnSwapCompositorFrame(
scoped_ptr<cc::CompositorFrame> frame) {
if (frame->delegated_frame_data) {
@@ -1432,6 +1502,13 @@ void RenderWidgetHostViewAura::OnSwapCompositorFrame(
frame->metadata.device_scale_factor);
return;
}
+
+ if (frame->software_frame_data) {
+ SwapSoftwareFrame(frame->software_frame_data.Pass(),
+ frame->metadata.device_scale_factor);
+ return;
+ }
+
if (!frame->gl_frame_data || frame->gl_frame_data->mailbox.IsZero())
return;
@@ -1461,7 +1538,7 @@ void RenderWidgetHostViewAura::BuffersSwapped(
const std::string& mailbox_name,
const BufferPresentedCallback& ack_callback) {
scoped_refptr<ui::Texture> texture_to_return(current_surface_);
- const gfx::Rect surface_rect = gfx::Rect(gfx::Point(), size);
+ const gfx::Rect surface_rect = gfx::Rect(size);
if (!SwapBuffersPrepare(
surface_rect, surface_rect, mailbox_name, ack_callback)) {
return;
@@ -1487,7 +1564,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
int gpu_host_id) {
scoped_refptr<ui::Texture> previous_texture(current_surface_);
const gfx::Rect surface_rect =
- gfx::Rect(gfx::Point(), params_in_pixel.surface_size);
+ gfx::Rect(params_in_pixel.surface_size);
gfx::Rect damage_rect(params_in_pixel.x,
params_in_pixel.y,
params_in_pixel.width,
@@ -1561,15 +1638,12 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceRelease() {
if (compositor) {
// We need to wait for a commit to clear to guarantee that all we
// will not issue any more GL referencing the previous surface.
- can_lock_compositor_ = NO_PENDING_COMMIT;
- on_compositing_did_commit_callbacks_.push_back(
+ AddOnCommitCallbackAndDisableLocks(
base::Bind(&RenderWidgetHostViewAura::
SetSurfaceNotInUseByCompositor,
AsWeakPtr(),
current_surface_)); // Hold a ref so the texture will not
// get deleted until after commit.
- if (!compositor->HasObserver(this))
- compositor->AddObserver(this);
}
current_surface_ = NULL;
UpdateExternalTexture();
@@ -1952,12 +2026,47 @@ void RenderWidgetHostViewAura::OnCaptureLost() {
}
void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
- paint_canvas_ = canvas;
- BackingStore* backing_store = host_->GetBackingStore(true);
- paint_canvas_ = NULL;
- if (backing_store) {
- static_cast<BackingStoreAura*>(backing_store)->SkiaShowRect(gfx::Point(),
- canvas);
+ bool is_compositing_active = host_->is_accelerated_compositing_active();
+ bool has_backing_store = !!host_->GetBackingStore(false);
+ if (is_compositing_active && current_dib_) {
+ const gfx::Size window_size = window_->bounds().size();
+ const gfx::Size& frame_size = last_swapped_surface_size_;
+
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ frame_size.width(),
+ frame_size.height());
+ bitmap.setPixels(current_dib_->memory());
+
+ SkCanvas* sk_canvas = canvas->sk_canvas();
+ for (SkRegion::Iterator it(previous_damage_); !it.done(); it.next()) {
+ const SkIRect& src_rect = it.rect();
+ SkRect dst_rect = SkRect::Make(src_rect);
+ sk_canvas->drawBitmapRect(bitmap, &src_rect, dst_rect, NULL);
+ }
+ previous_damage_.setEmpty();
+
+ if (frame_size != window_size) {
+ SkRegion region;
+ region.op(0, 0, window_size.width(), window_size.height(),
+ SkRegion::kUnion_Op);
+ region.op(0, 0, frame_size.width(), frame_size.height(),
+ SkRegion::kDifference_Op);
+ SkPaint paint;
+ paint.setColor(SK_ColorWHITE);
+ for (SkRegion::Iterator it(region); !it.done(); it.next())
+ sk_canvas->drawIRect(it.rect(), paint);
+ }
+
+ if (paint_observer_)
+ paint_observer_->OnPaintComplete();
+ } else if (!is_compositing_active && has_backing_store) {
+ paint_canvas_ = canvas;
+ BackingStoreAura* backing_store = static_cast<BackingStoreAura*>(
+ host_->GetBackingStore(true));
+ paint_canvas_ = NULL;
+ backing_store->SkiaShowRect(gfx::Point(), canvas);
+
if (paint_observer_)
paint_observer_->OnPaintComplete();
} else if (aura::Env::GetInstance()->render_white_bg()) {
@@ -2375,7 +2484,7 @@ void RenderWidgetHostViewAura::OnCompositingDidCommit(
if ((*it)->GrabDeferredLock())
can_lock_compositor_ = YES_DID_LOCK;
}
- RunCompositingDidCommitCallbacks();
+ RunOnCommitCallbacks();
locks_pending_commit_.clear();
}
@@ -2474,7 +2583,7 @@ void RenderWidgetHostViewAura::OnLostResources() {
// Make sure all ImageTransportClients are deleted now that the context those
// are using is becoming invalid. This sends pending ACKs and needs to happen
// after calling UpdateExternalTexture() which syncs with the impl thread.
- RunCompositingDidCommitCallbacks();
+ RunOnCommitCallbacks();
DCHECK(!shared_surface_handle_.is_null());
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
@@ -2630,7 +2739,7 @@ bool RenderWidgetHostViewAura::ShouldMoveToCenter() {
global_mouse_position_.y() > rect.bottom() - border_y;
}
-void RenderWidgetHostViewAura::RunCompositingDidCommitCallbacks() {
+void RenderWidgetHostViewAura::RunOnCommitCallbacks() {
for (std::vector<base::Closure>::const_iterator
it = on_compositing_did_commit_callbacks_.begin();
it != on_compositing_did_commit_callbacks_.end(); ++it) {
@@ -2639,6 +2748,18 @@ void RenderWidgetHostViewAura::RunCompositingDidCommitCallbacks() {
on_compositing_did_commit_callbacks_.clear();
}
+void RenderWidgetHostViewAura::AddOnCommitCallbackAndDisableLocks(
+ const base::Closure& callback) {
+ ui::Compositor* compositor = GetCompositor();
+ DCHECK(compositor);
+
+ if (!compositor->HasObserver(this))
+ compositor->AddObserver(this);
+
+ can_lock_compositor_ = NO_PENDING_COMMIT;
+ on_compositing_did_commit_callbacks_.push_back(callback);
+}
+
void RenderWidgetHostViewAura::AddedToRootWindow() {
window_->GetRootWindow()->AddRootWindowObserver(this);
host_->ParentChanged(GetNativeViewId());
@@ -2658,7 +2779,7 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() {
// frame though, because we will reissue a new frame right away without that
// composited data.
ui::Compositor* compositor = GetCompositor();
- RunCompositingDidCommitCallbacks();
+ RunOnCommitCallbacks();
locks_pending_commit_.clear();
if (compositor && compositor->HasObserver(this))
compositor->RemoveObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 52c6376..8464d88 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -316,7 +316,7 @@ class RenderWidgetHostViewAura
virtual ~RenderWidgetHostViewAura();
void UpdateCursorIfOverSelf();
- bool ShouldSkipFrame(gfx::Size size_in_dip);
+ bool ShouldSkipFrame(gfx::Size size_in_dip) const;
void CheckResizeLocks(gfx::Size size_in_dip);
void UpdateExternalTexture();
ui::InputMethod* GetInputMethod() const;
@@ -340,8 +340,11 @@ class RenderWidgetHostViewAura
// moved to center.
bool ShouldMoveToCenter();
- // Run the compositing callbacks.
- void RunCompositingDidCommitCallbacks();
+ // Run all on compositing commit callbacks.
+ void RunOnCommitCallbacks();
+
+ // Add on compositing commit callback.
+ void AddOnCommitCallbackAndDisableLocks(const base::Closure& callback);
// Called after |window_| is parented to a RootWindow.
void AddedToRootWindow();
@@ -391,10 +394,15 @@ class RenderWidgetHostViewAura
const scoped_refptr<ui::Texture>& texture_to_return);
void SwapDelegatedFrame(
- scoped_ptr<cc::DelegatedFrameData> frame,
- float device_scale_factor);
+ scoped_ptr<cc::DelegatedFrameData> frame_data,
+ float frame_device_scale_factor);
void SendDelegatedFrameAck();
+ void SwapSoftwareFrame(
+ scoped_ptr<cc::SoftwareFrameData> frame_data,
+ float frame_device_scale_factor);
+ void SendSoftwareFrameAck(const TransportDIB::Id& id);
+
BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager();
#if defined(OS_WIN)
@@ -471,6 +479,13 @@ class RenderWidgetHostViewAura
// The current frontbuffer texture.
scoped_refptr<ui::Texture> current_surface_;
+ // The current frontbuffer DIB.
+ scoped_ptr<TransportDIB> current_dib_;
+
+ // The current DIB id as it was received from the renderer. Note that on
+ // some platforms (e.g. Windows) this is different from current_dib_->id().
+ TransportDIB::Id current_dib_id_;
+
// The damage in the previously presented buffer.
SkRegion previous_damage_;
diff --git a/content/renderer/gpu/compositor_software_output_device.cc b/content/renderer/gpu/compositor_software_output_device.cc
index 77fbdb3..3fdf807 100644
--- a/content/renderer/gpu/compositor_software_output_device.cc
+++ b/content/renderer/gpu/compositor_software_output_device.cc
@@ -32,8 +32,7 @@ class CompareById {
} // namespace
CompositorSoftwareOutputDevice::CompositorSoftwareOutputDevice()
- : front_buffer_(0),
- last_buffer_(-1),
+ : front_buffer_(-1),
num_free_buffers_(0),
sequence_num_(0) {
DetachFromThread();
@@ -55,38 +54,44 @@ TransportDIB* CompositorSoftwareOutputDevice::CreateDIB() {
void CompositorSoftwareOutputDevice::Resize(gfx::Size viewport_size) {
DCHECK(CalledOnValidThread());
- // Reset last_buffer_ so that we don't copy over old damage.
- last_buffer_ = -1;
-
if (viewport_size_ == viewport_size)
return;
- viewport_size_ = viewport_size;
- // Keep non-acked dibs open.
- for (size_t i = 0; i < dibs_.size() - num_free_buffers_; ++i) {
- size_t index = (front_buffer_ + num_free_buffers_ + i) % dibs_.size();
+ // Keep non-ACKed dibs open.
+ int first_non_free = front_buffer_ + num_free_buffers_ + 1;
+ int num_non_free = dibs_.size() - num_free_buffers_;
+ for (int i = 0; i < num_non_free; ++i) {
+ int index = (first_non_free + i) % dibs_.size();
awaiting_ack_.push_back(dibs_[index]);
dibs_[index] = NULL;
}
dibs_.clear();
- front_buffer_ = 0;
+ front_buffer_ = -1;
num_free_buffers_ = 0;
+ viewport_size_ = viewport_size;
}
SkCanvas* CompositorSoftwareOutputDevice::BeginPaint(gfx::Rect damage_rect) {
DCHECK(CalledOnValidThread());
+ gfx::Rect last_damage_rect = damage_rect_;
+ damage_rect_ = damage_rect;
+
+ int last_buffer = front_buffer_;
if (num_free_buffers_ == 0) {
- dibs_.insert(dibs_.begin() + front_buffer_, CreateDIB());
- num_free_buffers_++;
+ dibs_.insert(dibs_.begin() + (front_buffer_ + 1), CreateDIB());
+ last_damage_rect = gfx::Rect(viewport_size_);
+ } else {
+ --num_free_buffers_;
}
+ front_buffer_ = (front_buffer_ + 1) % dibs_.size();
TransportDIB* front_dib = dibs_[front_buffer_];
DCHECK(front_dib);
DCHECK(front_dib->memory());
- // Set up a canvas for the front_dib.
+ // Set up a canvas for the current front buffer.
bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
viewport_size_.width(),
viewport_size_.height());
@@ -94,19 +99,23 @@ SkCanvas* CompositorSoftwareOutputDevice::BeginPaint(gfx::Rect damage_rect) {
device_ = skia::AdoptRef(new SkDevice(bitmap_));
canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
- // Copy damage_rect_ from last_buffer_ to front_buffer_.
- if (last_buffer_ != -1 && !damage_rect.Contains(damage_rect_)) {
- TransportDIB* last_dib = dibs_[last_buffer_];
+ // Copy over previous damage.
+ if (last_buffer != -1) {
+ TransportDIB* last_dib = dibs_[last_buffer];
SkBitmap back_bitmap;
back_bitmap.setConfig(SkBitmap::kARGB_8888_Config,
viewport_size_.width(),
viewport_size_.height());
back_bitmap.setPixels(last_dib->memory());
- SkRect last_damage = gfx::RectToSkRect(damage_rect_);
- canvas_->drawBitmapRectToRect(back_bitmap, &last_damage, last_damage, NULL);
+ SkRegion region(RectToSkIRect(last_damage_rect));
+ region.op(RectToSkIRect(damage_rect), SkRegion::kDifference_Op);
+ for (SkRegion::Iterator it(region); !it.done(); it.next()) {
+ const SkIRect& src_rect = it.rect();
+ SkRect dst_rect = SkRect::Make(src_rect);
+ canvas_->drawBitmapRect(back_bitmap, &src_rect, dst_rect, NULL);
+ }
}
- damage_rect_ = damage_rect;
return canvas_.get();
}
@@ -120,30 +129,28 @@ void CompositorSoftwareOutputDevice::EndPaint(
frame_data->damage_rect = damage_rect_;
frame_data->dib_id = dibs_[front_buffer_]->id();
}
-
- last_buffer_ = front_buffer_;
- front_buffer_ = (front_buffer_ + 1) % dibs_.size();
- --num_free_buffers_;
- DCHECK_GE(num_free_buffers_, 0);
}
void CompositorSoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) {
DCHECK(CalledOnValidThread());
- // The reclaimed handle might not be among the currently
+ if (!TransportDIB::is_valid_id(id))
+ return;
+
+ // The reclaimed dib id might not be among the currently
// active dibs if we got a resize event in the mean time.
ScopedVector<TransportDIB>::iterator it =
std::find_if(dibs_.begin(), dibs_.end(), CompareById(id));
if (it != dibs_.end()) {
++num_free_buffers_;
+ DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size());
+ return;
} else {
- it = std::find_if(awaiting_ack_.begin(),
- awaiting_ack_.end(),
+ it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(),
CompareById(id));
+ DCHECK(it != awaiting_ack_.end());
awaiting_ack_.erase(it);
}
-
- DCHECK_LE(static_cast<size_t>(num_free_buffers_), dibs_.size());
}
} // namespace content
diff --git a/content/renderer/gpu/compositor_software_output_device.h b/content/renderer/gpu/compositor_software_output_device.h
index a639347..dba05d9 100644
--- a/content/renderer/gpu/compositor_software_output_device.h
+++ b/content/renderer/gpu/compositor_software_output_device.h
@@ -33,7 +33,6 @@ private:
TransportDIB* CreateDIB();
int front_buffer_;
- int last_buffer_;
int num_free_buffers_;
ScopedVector<TransportDIB> dibs_;
ScopedVector<TransportDIB> awaiting_ack_;
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 16872d8..b32b327 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -24,7 +24,7 @@
#include "content/common/view_messages.h"
#include "content/public/common/content_switches.h"
#include "content/renderer/gpu/compositor_output_surface.h"
-#include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h"
+#include "content/renderer/gpu/compositor_software_output_device.h"
#include "content/renderer/gpu/input_handler_manager.h"
#include "content/renderer/gpu/mailbox_output_surface.h"
#include "content/renderer/gpu/render_widget_compositor.h"
@@ -555,6 +555,13 @@ bool RenderWidget::ForceCompositingModeEnabled() {
}
scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
+ return scoped_ptr<cc::OutputSurface>(
+ new CompositorOutputSurface(routing_id(), NULL,
+ new CompositorSoftwareOutputDevice()));
+ }
+
// Explicitly disable antialiasing for the compositor. As of the time of
// this writing, the only platform that supported antialiasing for the
// compositor was Mac OS X, because the on-screen OpenGL context creation
@@ -573,25 +580,15 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
if (!context)
return scoped_ptr<cc::OutputSurface>();
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
- // In the absence of a software-based delegating renderer, use this
- // stopgap adapter class to present the software renderer output using a
- // 3d context.
- return scoped_ptr<cc::OutputSurface>(
- new CompositorOutputSurface(routing_id(), NULL,
- new CompositorSoftwareOutputDeviceGLAdapter(context)));
- } else {
- bool composite_to_mailbox =
- command_line.HasSwitch(cc::switches::kCompositeToMailbox);
- DCHECK(!composite_to_mailbox || command_line.HasSwitch(
- cc::switches::kEnableCompositorFrameMessage));
- // No swap throttling yet when compositing on the main thread.
- DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
- return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
- new MailboxOutputSurface(routing_id(), context, NULL) :
- new CompositorOutputSurface(routing_id(), context, NULL));
- }
+ bool composite_to_mailbox =
+ command_line.HasSwitch(cc::switches::kCompositeToMailbox);
+ DCHECK(!composite_to_mailbox || command_line.HasSwitch(
+ cc::switches::kEnableCompositorFrameMessage));
+ // No swap throttling yet when compositing on the main thread.
+ DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
+ return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
+ new MailboxOutputSurface(routing_id(), context, NULL) :
+ new CompositorOutputSurface(routing_id(), context, NULL));
}
void RenderWidget::OnViewContextSwapBuffersAborted() {