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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2134653002: Add delay to didAssociateFormControlsTimer so it doesn't fire too frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 | « components/autofill/content/renderer/autofill_agent.h ('k') | 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 5706 matching lines...) Expand 10 before | Expand all | Expand 10 after
5717 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. 5717 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor.
5718 5718
5719 return *m_templateDocument.get(); 5719 return *m_templateDocument.get();
5720 } 5720 }
5721 5721
5722 void Document::didAssociateFormControl(Element* element) 5722 void Document::didAssociateFormControl(Element* element)
5723 { 5723 {
5724 if (!frame() || !frame()->page()) 5724 if (!frame() || !frame()->page())
5725 return; 5725 return;
5726 m_associatedFormControls.add(element); 5726 m_associatedFormControls.add(element);
5727 // We add a slight delay because this could be called rapidly.
5727 if (!m_didAssociateFormControlsTimer.isActive()) 5728 if (!m_didAssociateFormControlsTimer.isActive())
5728 m_didAssociateFormControlsTimer.startOneShot(0, BLINK_FROM_HERE); 5729 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE);
5729 } 5730 }
5730 5731
5731 void Document::removeFormAssociation(Element* element) 5732 void Document::removeFormAssociation(Element* element)
5732 { 5733 {
5733 auto it = m_associatedFormControls.find(element); 5734 auto it = m_associatedFormControls.find(element);
5734 if (it == m_associatedFormControls.end()) 5735 if (it == m_associatedFormControls.end())
5735 return; 5736 return;
5736 m_associatedFormControls.remove(it); 5737 m_associatedFormControls.remove(it);
5737 if (m_associatedFormControls.isEmpty()) 5738 if (m_associatedFormControls.isEmpty())
5738 m_didAssociateFormControlsTimer.stop(); 5739 m_didAssociateFormControlsTimer.stop();
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
6015 #ifndef NDEBUG 6016 #ifndef NDEBUG
6016 using namespace blink; 6017 using namespace blink;
6017 void showLiveDocumentInstances() 6018 void showLiveDocumentInstances()
6018 { 6019 {
6019 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 6020 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6020 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6021 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6021 for (Document* document : set) 6022 for (Document* document : set)
6022 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6023 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6023 } 6024 }
6024 #endif 6025 #endif
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698