Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: content/renderer/render_widget.cc

Issue 1126963006: Move VISUAL_STATE promise to activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Current state (presubmit warnings, cc_unittests tests failing) Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 94d484f72ed7a922a2fe850a9a5bd2611ff70e1c..1f26dc7527bda194dfc998830198db4be3c99681 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -21,6 +21,7 @@
#include "cc/base/switches.h"
#include "cc/debug/benchmark_instrumentation.h"
#include "cc/output/output_surface.h"
+#include "cc/output/promise.h"
#include "cc/trees/layer_tree_host.h"
#include "content/child/npapi/webplugin.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
@@ -38,8 +39,9 @@
#include "content/renderer/gpu/compositor_output_surface.h"
#include "content/renderer/gpu/compositor_software_output_device.h"
#include "content/renderer/gpu/delegated_compositor_output_surface.h"
-#include "content/renderer/gpu/frame_swap_message_queue.h"
+#include "content/renderer/gpu/frame_update_message_queue.h"
#include "content/renderer/gpu/mailbox_output_surface.h"
+#include "content/renderer/gpu/queue_message_activation_promise.h"
#include "content/renderer/gpu/queue_message_swap_promise.h"
#include "content/renderer/gpu/render_widget_compositor.h"
#include "content/renderer/ime_event_guard.h"
@@ -515,7 +517,7 @@ RenderWidget::RenderWidget(blink::WebPopupType popup_type,
body_background_color_(SK_ColorWHITE),
#endif
popup_origin_scale_for_emulation_(0.f),
- frame_swap_message_queue_(new FrameSwapMessageQueue()),
+ frame_update_message_queue_(new FrameUpdateMessageQueue()),
resizing_mode_selector_(new ResizingModeSelector()),
context_menu_source_type_(ui::MENU_SOURCE_MOUSE),
has_host_context_menu_location_(false) {
@@ -999,7 +1001,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
if (SynchronousCompositorFactory* factory =
SynchronousCompositorFactory::GetInstance()) {
return factory->CreateOutputSurface(routing_id(),
- frame_swap_message_queue_);
+ frame_update_message_queue_);
}
#endif
@@ -1032,7 +1034,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner());
return scoped_ptr<cc::OutputSurface>(new DelegatedCompositorOutputSurface(
routing_id(), output_surface_id, context_provider,
- worker_context_provider, frame_swap_message_queue_));
+ worker_context_provider, frame_update_message_queue_));
}
if (!context_provider.get()) {
scoped_ptr<cc::SoftwareOutputDevice> software_device(
@@ -1040,7 +1042,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface(
routing_id(), output_surface_id, nullptr, nullptr,
- software_device.Pass(), frame_swap_message_queue_, true));
+ software_device.Pass(), frame_update_message_queue_, true));
}
if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) {
@@ -1054,13 +1056,13 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
return scoped_ptr<cc::OutputSurface>(new MailboxOutputSurface(
routing_id(), output_surface_id, context_provider,
worker_context_provider, scoped_ptr<cc::SoftwareOutputDevice>(),
- frame_swap_message_queue_, format));
+ frame_update_message_queue_, format));
}
bool use_swap_compositor_frame_message = false;
return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface(
routing_id(), output_surface_id, context_provider,
worker_context_provider, scoped_ptr<cc::SoftwareOutputDevice>(),
- frame_swap_message_queue_, use_swap_compositor_frame_message));
+ frame_update_message_queue_, use_swap_compositor_frame_message));
}
void RenderWidget::OnSwapBuffersAborted() {
@@ -1422,23 +1424,33 @@ void RenderWidget::DidCommitCompositorFrame() {
}
// static
-scoped_ptr<cc::SwapPromise> RenderWidget::QueueMessageImpl(
+scoped_ptr<cc::Promise> RenderWidget::QueueMessageImpl(
IPC::Message* msg,
MessageDeliveryPolicy policy,
- FrameSwapMessageQueue* frame_swap_message_queue,
+ FrameUpdateMessageQueue* frame_update_message_queue,
scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
int source_frame_number) {
bool first_message_for_frame = false;
- frame_swap_message_queue->QueueMessageForFrame(policy,
+ frame_update_message_queue->QueueMessageForFrame(policy,
source_frame_number,
make_scoped_ptr(msg),
&first_message_for_frame);
+ scoped_ptr<cc::Promise> promise;
if (first_message_for_frame) {
- scoped_ptr<cc::SwapPromise> promise(new QueueMessageSwapPromise(
- sync_message_filter, frame_swap_message_queue, source_frame_number));
- return promise;
+ switch (policy) {
+ case MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE:
+ case MESSAGE_DELIVERY_POLICY_WITH_ACTIVATION:
+ promise.reset(new QueueMessageActivationPromise(
+ sync_message_filter, frame_update_message_queue,
+ source_frame_number));
+ case MESSAGE_DELIVERY_POLICY_WITH_NEXT_SWAP:
+ promise.reset(new QueueMessageSwapPromise(sync_message_filter,
+ frame_update_message_queue,
+ source_frame_number));
+ break;
+ }
}
- return nullptr;
+ return promise;
}
void RenderWidget::QueueMessage(IPC::Message* msg,
@@ -1449,15 +1461,15 @@ void RenderWidget::QueueMessage(IPC::Message* msg,
return;
}
- scoped_ptr<cc::SwapPromise> swap_promise =
+ scoped_ptr<cc::Promise> promise =
QueueMessageImpl(msg,
policy,
- frame_swap_message_queue_.get(),
+ frame_update_message_queue_.get(),
RenderThreadImpl::current()->sync_message_filter(),
compositor_->GetSourceFrameNumber());
- if (swap_promise) {
- compositor_->QueueSwapPromise(swap_promise.Pass());
+ if (promise) {
+ compositor_->QueuePromise(promise.Pass());
// Request a commit. This might either A) request a commit ahead of time
// or B) request a commit which is not needed because there are not
// pending updates. If B) then the commit will be skipped and the swap

Powered by Google App Engine
This is Rietveld 408576698