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

Side by Side Diff: third_party/WebKit/Source/core/frame/PlatformEventController.cpp

Issue 2858963002: Replace ASSERT with DCHECK in core/ (Closed)
Patch Set: WorkerBackingThread 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/frame/PlatformEventController.h" 5 #include "core/frame/PlatformEventController.h"
6 6
7 #include "core/page/Page.h" 7 #include "core/page/Page.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 PlatformEventController::PlatformEventController(LocalFrame* frame) 11 PlatformEventController::PlatformEventController(LocalFrame* frame)
12 : PageVisibilityObserver(frame ? frame->GetPage() : nullptr), 12 : PageVisibilityObserver(frame ? frame->GetPage() : nullptr),
13 has_event_listener_(false), 13 has_event_listener_(false),
14 is_active_(false), 14 is_active_(false),
15 timer_(TaskRunnerHelper::Get(TaskType::kUnspecedTimer, frame), 15 timer_(TaskRunnerHelper::Get(TaskType::kUnspecedTimer, frame),
16 this, 16 this,
17 &PlatformEventController::OneShotCallback) {} 17 &PlatformEventController::OneShotCallback) {}
18 18
19 PlatformEventController::~PlatformEventController() {} 19 PlatformEventController::~PlatformEventController() {}
20 20
21 void PlatformEventController::OneShotCallback(TimerBase* timer) { 21 void PlatformEventController::OneShotCallback(TimerBase* timer) {
22 DCHECK_EQ(timer, &timer_); 22 DCHECK_EQ(timer, &timer_);
23 ASSERT(HasLastData()); 23 DCHECK(HasLastData());
24 ASSERT(!timer_.IsActive()); 24 DCHECK(!timer_.IsActive());
25 25
26 DidUpdateData(); 26 DidUpdateData();
27 } 27 }
28 28
29 void PlatformEventController::StartUpdating() { 29 void PlatformEventController::StartUpdating() {
30 if (is_active_) 30 if (is_active_)
31 return; 31 return;
32 32
33 if (HasLastData() && !timer_.IsActive()) { 33 if (HasLastData() && !timer_.IsActive()) {
34 // Make sure to fire the data as soon as possible. 34 // Make sure to fire the data as soon as possible.
(...skipping 17 matching lines...) Expand all
52 if (!has_event_listener_) 52 if (!has_event_listener_)
53 return; 53 return;
54 54
55 if (GetPage()->IsPageVisible()) 55 if (GetPage()->IsPageVisible())
56 StartUpdating(); 56 StartUpdating();
57 else 57 else
58 StopUpdating(); 58 StopUpdating();
59 } 59 }
60 60
61 } // namespace blink 61 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/core/frame/PlatformEventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698