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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android build fix Created 4 years, 4 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 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 27 matching lines...) Expand all
38 #include "core/layout/line/EllipsisBox.h" 38 #include "core/layout/line/EllipsisBox.h"
39 #include "core/layout/line/GlyphOverflow.h" 39 #include "core/layout/line/GlyphOverflow.h"
40 #include "core/layout/line/InlineTextBox.h" 40 #include "core/layout/line/InlineTextBox.h"
41 #include "platform/fonts/CharacterRange.h" 41 #include "platform/fonts/CharacterRange.h"
42 #include "platform/geometry/FloatQuad.h" 42 #include "platform/geometry/FloatQuad.h"
43 #include "platform/text/BidiResolver.h" 43 #include "platform/text/BidiResolver.h"
44 #include "platform/text/Character.h" 44 #include "platform/text/Character.h"
45 #include "platform/text/Hyphenation.h" 45 #include "platform/text/Hyphenation.h"
46 #include "platform/text/TextBreakIterator.h" 46 #include "platform/text/TextBreakIterator.h"
47 #include "platform/text/TextRunIterator.h" 47 #include "platform/text/TextRunIterator.h"
48 #include "public/platform/Platform.h"
49 #include "public/platform/WebScheduler.h"
50 #include "public/platform/WebThread.h"
48 #include "wtf/text/StringBuffer.h" 51 #include "wtf/text/StringBuffer.h"
49 #include "wtf/text/StringBuilder.h" 52 #include "wtf/text/StringBuilder.h"
50 53
51 using namespace WTF; 54 using namespace WTF;
52 using namespace Unicode; 55 using namespace Unicode;
53 56
54 namespace blink { 57 namespace blink {
55 58
56 struct SameSizeAsLayoutText : public LayoutObject { 59 struct SameSizeAsLayoutText : public LayoutObject {
57 uint32_t bitfields : 16; 60 uint32_t bitfields : 16;
58 float widths[4]; 61 float widths[4];
59 String text; 62 String text;
60 void* pointers[2]; 63 void* pointers[2];
61 }; 64 };
62 65
63 static_assert(sizeof(LayoutText) == sizeof(SameSizeAsLayoutText), "LayoutText sh ould stay small"); 66 static_assert(sizeof(LayoutText) == sizeof(SameSizeAsLayoutText), "LayoutText sh ould stay small");
64 67
65 class SecureTextTimer; 68 class SecureTextTimer;
66 typedef HashMap<LayoutText*, SecureTextTimer*> SecureTextTimerMap; 69 typedef HashMap<LayoutText*, SecureTextTimer*> SecureTextTimerMap;
67 static SecureTextTimerMap* gSecureTextTimers = nullptr; 70 static SecureTextTimerMap* gSecureTextTimers = nullptr;
68 71
69 class SecureTextTimer final : public TimerBase { 72 class SecureTextTimer final : public TimerBase {
70 public: 73 public:
71 SecureTextTimer(LayoutText* layoutText) 74 SecureTextTimer(LayoutText* layoutText)
72 : m_layoutText(layoutText) 75 : TimerBase(Platform::current()->currentThread()->scheduler()->timerTask Runner())
76 , m_layoutText(layoutText)
73 , m_lastTypedCharacterOffset(-1) 77 , m_lastTypedCharacterOffset(-1)
74 { 78 {
75 } 79 }
76 80
77 void restartWithNewText(unsigned lastTypedCharacterOffset) 81 void restartWithNewText(unsigned lastTypedCharacterOffset)
78 { 82 {
79 m_lastTypedCharacterOffset = lastTypedCharacterOffset; 83 m_lastTypedCharacterOffset = lastTypedCharacterOffset;
80 if (Settings* settings = m_layoutText->document().settings()) 84 if (Settings* settings = m_layoutText->document().settings())
81 startOneShot(settings->passwordEchoDurationInSeconds(), BLINK_FROM_H ERE); 85 startOneShot(settings->passwordEchoDurationInSeconds(), BLINK_FROM_H ERE);
82 } 86 }
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1753 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1750 invalidateDisplayItemClient(*box, invalidationReason); 1754 invalidateDisplayItemClient(*box, invalidationReason);
1751 if (box->truncation() != cNoTruncation) { 1755 if (box->truncation() != cNoTruncation) {
1752 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1756 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1753 invalidateDisplayItemClient(*ellipsisBox, invalidationReason); 1757 invalidateDisplayItemClient(*ellipsisBox, invalidationReason);
1754 } 1758 }
1755 } 1759 }
1756 } 1760 }
1757 1761
1758 } // namespace blink 1762 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698