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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 160073005: Cache the boolean value in instance variable instead of calling usingDelegatedRenderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove usingdelegatedrenderer function and make code inline. Created 6 years, 10 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 | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 4f1c64d810b30557b4b3434ce3de598a3915c4f4..44d060a63ead8d96cda20647e83152460a04d979 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -104,18 +104,6 @@ void CopyFromCompositingSurfaceFinished(
callback.Run(result, *bitmap);
}
-bool UsingDelegatedRenderer() {
- bool using_delegated_renderer = false;
-
- using_delegated_renderer |= CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableDelegatedRenderer);
-
- using_delegated_renderer &= !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableDelegatedRenderer);
-
- return using_delegated_renderer;
-}
-
ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
ui::LatencyInfo latency_info;
// The latency number should only be added if the timestamp is valid.
@@ -155,8 +143,12 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
using_synchronous_compositor_(SynchronousCompositorImpl::FromID(
widget_host->GetProcess()->GetID(),
widget_host->GetRoutingID()) != NULL),
- frame_evictor_(new DelegatedFrameEvictor(this)) {
- if (!UsingDelegatedRenderer()) {
+ frame_evictor_(new DelegatedFrameEvictor(this)),
+ using_delegated_renderer_(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableDelegatedRenderer) &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableDelegatedRenderer)) {
+ if (!using_delegated_renderer_) {
texture_layer_ = cc::TextureLayer::Create(NULL);
layer_ = texture_layer_;
}
@@ -324,7 +316,7 @@ bool RenderWidgetHostViewAndroid::HasValidFrame() const {
if (texture_size_in_layer_.IsEmpty())
return false;
- if (UsingDelegatedRenderer()) {
+ if (using_delegated_renderer_) {
if (!delegated_renderer_layer_.get())
return false;
} else {
@@ -853,7 +845,7 @@ void RenderWidgetHostViewAndroid::OnSwapCompositorFrame(
}
if (frame->delegated_frame_data) {
- DCHECK(UsingDelegatedRenderer());
+ DCHECK(using_delegated_renderer_);
DCHECK(frame->delegated_frame_data);
DCHECK(!frame->delegated_frame_data->render_pass_list.empty());
@@ -868,7 +860,7 @@ void RenderWidgetHostViewAndroid::OnSwapCompositorFrame(
return;
}
- DCHECK(!UsingDelegatedRenderer());
+ DCHECK(!using_delegated_renderer_);
if (!frame->gl_frame_data || frame->gl_frame_data->mailbox.IsZero())
return;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698