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

Unified Diff: android_webview/browser/surfaces_instance.cc

Issue 2856913002: Don't submit empty frames in android webview (Closed)
Patch Set: c Created 3 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
« no previous file with comments | « android_webview/browser/surfaces_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/surfaces_instance.cc
diff --git a/android_webview/browser/surfaces_instance.cc b/android_webview/browser/surfaces_instance.cc
index c09e9a606a40e7ba6b58e7fc0cb85493660dd18f..9454df92a85557134cc50ba1adb0b7765cdf9b33 100644
--- a/android_webview/browser/surfaces_instance.cc
+++ b/android_webview/browser/surfaces_instance.cc
@@ -14,6 +14,7 @@
#include "base/memory/ptr_util.h"
#include "cc/output/renderer_settings.h"
#include "cc/output/texture_mailbox_deleter.h"
+#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/surface_draw_quad.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/compositor_frame_sink_support.h"
@@ -140,8 +141,9 @@ void SurfacesInstance::DrawAndSwap(const gfx::Size& viewport,
frame.render_pass_list.push_back(std::move(render_pass));
frame.metadata.referenced_surfaces = child_ids_;
- if (!root_id_.is_valid()) {
+ if (!root_id_.is_valid() || frame_size != surface_size_) {
root_id_ = local_surface_id_allocator_->GenerateId();
+ surface_size_ = frame_size;
display_->SetLocalSurfaceId(root_id_, 1.f);
}
support_->SubmitCompositorFrame(root_id_, std::move(frame));
@@ -167,7 +169,17 @@ void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) {
}
void SurfacesInstance::SetEmptyRootFrame() {
boliu 2017/05/04 17:08:00 rename the method name and variable names please,
Saman Sami 2017/05/04 21:38:46 Done.
+ if (!root_id_.is_valid())
boliu 2017/05/04 17:08:00 this should be a DCHECK it looks like? every call
Saman Sami 2017/05/04 21:38:46 Done.
+ return;
+ std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
+ cc::SharedQuadState* quad_state =
+ render_pass->CreateAndAppendSharedQuadState();
+ gfx::Rect rect(surface_size_);
+ cc::SolidColorDrawQuad* solid_quad =
+ render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
+ solid_quad->SetNew(quad_state, rect, rect, SK_ColorBLACK, false);
cc::CompositorFrame empty_frame;
+ empty_frame.render_pass_list.push_back(std::move(render_pass));
// We draw synchronously, so acknowledge a manual BeginFrame.
empty_frame.metadata.begin_frame_ack =
cc::BeginFrameAck::CreateManualAckWithDamage();
« no previous file with comments | « android_webview/browser/surfaces_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698