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

Side by Side Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2942273002: Avoid some static initializers in Windows builds (Closed)
Patch Set: Use constexpr [] instead of constexpr const * Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/renderer/input/main_thread_event_queue.h" 5 #include "content/renderer/input/main_thread_event_queue.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/common/input/event_with_latency_info.h" 10 #include "content/common/input/event_with_latency_info.h"
11 #include "content/common/input_messages.h" 11 #include "content/common/input_messages.h"
12 #include "content/renderer/render_widget.h" 12 #include "content/renderer/render_widget.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 const size_t kTenSeconds = 10 * 1000 * 1000; 18 const size_t kTenSeconds = 10 * 1000 * 1000;
19 const base::TimeDelta kMaxRafDelay = 19 constexpr base::TimeDelta kMaxRafDelay =
20 base::TimeDelta::FromMilliseconds(5 * 1000); 20 base::TimeDelta::FromMilliseconds(5 * 1000);
21 21
22 class QueuedClosure : public MainThreadEventQueueTask { 22 class QueuedClosure : public MainThreadEventQueueTask {
23 public: 23 public:
24 QueuedClosure(base::OnceClosure closure) : closure_(std::move(closure)) {} 24 QueuedClosure(base::OnceClosure closure) : closure_(std::move(closure)) {}
25 25
26 ~QueuedClosure() override {} 26 ~QueuedClosure() override {}
27 27
28 FilterResult FilterNewEvent(MainThreadEventQueueTask* other_task) override { 28 FilterResult FilterNewEvent(MainThreadEventQueueTask* other_task) override {
29 return other_task->IsWebInputEvent() ? FilterResult::KeepIterating 29 return other_task->IsWebInputEvent() ? FilterResult::KeepIterating
30 : FilterResult::StopIterating; 30 : FilterResult::StopIterating;
31 } 31 }
32 32
33 bool IsWebInputEvent() const override { return false; } 33 bool IsWebInputEvent() const override { return false; }
34 34
35 void Dispatch(MainThreadEventQueue*) override { std::move(closure_).Run(); } 35 void Dispatch(MainThreadEventQueue*) override { std::move(closure_).Run(); }
36 36
37 private: 37 private:
38 base::OnceClosure closure_; 38 base::OnceClosure closure_;
39 }; 39 };
40 40
41 // Time interval at which touchmove events during scroll will be skipped 41 // Time interval at which touchmove events during scroll will be skipped
42 // during rAF signal. 42 // during rAF signal.
43 const base::TimeDelta kAsyncTouchMoveInterval = 43 constexpr base::TimeDelta kAsyncTouchMoveInterval =
44 base::TimeDelta::FromMilliseconds(200); 44 base::TimeDelta::FromMilliseconds(200);
45 45
46 } // namespace 46 } // namespace
47 47
48 class QueuedWebInputEvent : public ScopedWebInputEventWithLatencyInfo, 48 class QueuedWebInputEvent : public ScopedWebInputEventWithLatencyInfo,
49 public MainThreadEventQueueTask { 49 public MainThreadEventQueueTask {
50 public: 50 public:
51 QueuedWebInputEvent(ui::WebScopedInputEvent event, 51 QueuedWebInputEvent(ui::WebScopedInputEvent event,
52 const ui::LatencyInfo& latency, 52 const ui::LatencyInfo& latency,
53 bool originally_cancelable, 53 bool originally_cancelable,
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 void MainThreadEventQueue::ClearClient() { 561 void MainThreadEventQueue::ClearClient() {
562 DCHECK(main_task_runner_->BelongsToCurrentThread()); 562 DCHECK(main_task_runner_->BelongsToCurrentThread());
563 client_ = nullptr; 563 client_ = nullptr;
564 } 564 }
565 565
566 void MainThreadEventQueue::SetNeedsLowLatency(bool low_latency) { 566 void MainThreadEventQueue::SetNeedsLowLatency(bool low_latency) {
567 needs_low_latency_ = low_latency; 567 needs_low_latency_ = low_latency;
568 } 568 }
569 569
570 } // namespace content 570 } // namespace content
OLDNEW
« no previous file with comments | « chrome/install_static/policy_path_parser.cc ('k') | third_party/WebKit/Source/core/html/forms/TypeAhead.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698