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

Side by Side 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: Cache the boolean value in usingDelegatedRenderer 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, 98 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
99 bool result) { 99 bool result) {
100 bitmap_pixels_lock.reset(); 100 bitmap_pixels_lock.reset();
101 release_callback->Run(0, false); 101 release_callback->Run(0, false);
102 UMA_HISTOGRAM_TIMES(kAsyncReadBackString, 102 UMA_HISTOGRAM_TIMES(kAsyncReadBackString,
103 base::TimeTicks::Now() - start_time); 103 base::TimeTicks::Now() - start_time);
104 callback.Run(result, *bitmap); 104 callback.Run(result, *bitmap);
105 } 105 }
106 106
107 bool UsingDelegatedRenderer() { 107 bool UsingDelegatedRenderer() {
108 bool using_delegated_renderer = false; 108 static bool g_using_delegated_renderer =
no sievers 2014/02/12 17:37:00 nit: remove 'g_' prefix since the scope of the var
109 109 CommandLine::ForCurrentProcess()->HasSwitch(
110 using_delegated_renderer |= CommandLine::ForCurrentProcess()->HasSwitch( 110 switches::kEnableDelegatedRenderer) &&
no sievers 2014/02/12 17:37:00 nit: indent is wrong in this whole block
111 switches::kEnableDelegatedRenderer); 111 !CommandLine::ForCurrentProcess()->HasSwitch(
112 112 switches::kDisableDelegatedRenderer);
113 using_delegated_renderer &= !CommandLine::ForCurrentProcess()->HasSwitch( 113 return g_using_delegated_renderer;
114 switches::kDisableDelegatedRenderer);
115
116 return using_delegated_renderer;
117 } 114 }
118 115
119 ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) { 116 ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
120 ui::LatencyInfo latency_info; 117 ui::LatencyInfo latency_info;
121 // The latency number should only be added if the timestamp is valid. 118 // The latency number should only be added if the timestamp is valid.
122 if (event.timeStampSeconds) { 119 if (event.timeStampSeconds) {
123 const int64 time_micros = static_cast<int64>( 120 const int64 time_micros = static_cast<int64>(
124 event.timeStampSeconds * base::Time::kMicrosecondsPerSecond); 121 event.timeStampSeconds * base::Time::kMicrosecondsPerSecond);
125 latency_info.AddLatencyNumberWithTimestamp( 122 latency_info.AddLatencyNumberWithTimestamp(
126 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 123 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 // RenderWidgetHostView, public: 1503 // RenderWidgetHostView, public:
1507 1504
1508 // static 1505 // static
1509 RenderWidgetHostView* 1506 RenderWidgetHostView*
1510 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1507 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1511 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1508 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1512 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1509 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1513 } 1510 }
1514 1511
1515 } // namespace content 1512 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698