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

Side by Side Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1951813002: Revert of Postpone deletion of (Password)AutofillAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/content/renderer/autofill_agent.h" 5 #include "components/autofill/content/renderer/autofill_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <tuple> 9 #include <tuple>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 return; 305 return;
306 } 306 }
307 307
308 if (!element || !element->isEnabled() || element->isReadOnly() || 308 if (!element || !element->isEnabled() || element->isReadOnly() ||
309 !element->isTextField()) 309 !element->isTextField())
310 return; 310 return;
311 311
312 element_ = *element; 312 element_ = *element;
313 } 313 }
314 314
315 void AutofillAgent::OnDestruct() {
316 // As described in http://crbug.com/608100, there might be an AutofillAgent
317 // method in-progress lower on the stack. Destroying |this| would cause
318 // use-after-free once the lower stack frame becomes active. Instead, a task
319 // needs to be posted to delete this.
320 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
321 }
322
323 void AutofillAgent::FocusChangeComplete() { 315 void AutofillAgent::FocusChangeComplete() {
324 WebDocument doc = render_frame()->GetWebFrame()->document(); 316 WebDocument doc = render_frame()->GetWebFrame()->document();
325 WebElement focused_element; 317 WebElement focused_element;
326 if (!doc.isNull()) 318 if (!doc.isNull())
327 focused_element = doc.focusedElement(); 319 focused_element = doc.focusedElement();
328 320
329 if (!focused_element.isNull() && password_generation_agent_ && 321 if (!focused_element.isNull() && password_generation_agent_ &&
330 password_generation_agent_->FocusedNodeHasChanged(focused_element)) { 322 password_generation_agent_->FocusedNodeHasChanged(focused_element)) {
331 is_generation_popup_possibly_visible_ = true; 323 is_generation_popup_possibly_visible_ = true;
332 is_popup_possibly_visible_ = true; 324 is_popup_possibly_visible_ = true;
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 846
855 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 847 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
856 // No-op. Don't delete |this|. 848 // No-op. Don't delete |this|.
857 } 849 }
858 850
859 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { 851 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
860 agent_->FocusChangeComplete(); 852 agent_->FocusChangeComplete();
861 } 853 }
862 854
863 } // namespace autofill 855 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698