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

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

Issue 1943873002: 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
« no previous file with comments | « components/autofill/content/renderer/password_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 // 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/password_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_autofill_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 // RenderView to be instantiated (such as redirects to the WebStore) 1230 // RenderView to be instantiated (such as redirects to the WebStore)
1231 // we will never get to finish the load. 1231 // we will never get to finish the load.
1232 Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(), 1232 Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(),
1233 *submitted_form)); 1233 *submitted_form));
1234 provisionally_saved_form_.reset(); 1234 provisionally_saved_form_.reset();
1235 } else if (logger) { 1235 } else if (logger) {
1236 logger->LogMessage(Logger::STRING_FORM_IS_NOT_PASSWORD); 1236 logger->LogMessage(Logger::STRING_FORM_IS_NOT_PASSWORD);
1237 } 1237 }
1238 } 1238 }
1239 1239
1240 void PasswordAutofillAgent::OnDestruct() {
1241 // As described in http://crbug.com/608100, there might be an AutofillAgent
1242 // method in-progress lower on the stack. Destroying |this| would cause
1243 // use-after-free once the lower stack frame becomes active. Instead, a task
1244 // needs to be posted to delete this.
1245 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
1246 }
1247
1240 void PasswordAutofillAgent::DidStartProvisionalLoad() { 1248 void PasswordAutofillAgent::DidStartProvisionalLoad() {
1241 std::unique_ptr<RendererSavePasswordProgressLogger> logger; 1249 std::unique_ptr<RendererSavePasswordProgressLogger> logger;
1242 if (logging_state_active_) { 1250 if (logging_state_active_) {
1243 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); 1251 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id()));
1244 logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD); 1252 logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD);
1245 } 1253 }
1246 1254
1247 const blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame(); 1255 const blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame();
1248 if (navigated_frame->parent()) { 1256 if (navigated_frame->parent()) {
1249 if (logger) 1257 if (logger)
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 } 1543 }
1536 1544
1537 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { 1545 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() {
1538 return provisionally_saved_form_ && 1546 return provisionally_saved_form_ &&
1539 !provisionally_saved_form_->username_value.empty() && 1547 !provisionally_saved_form_->username_value.empty() &&
1540 !(provisionally_saved_form_->password_value.empty() && 1548 !(provisionally_saved_form_->password_value.empty() &&
1541 provisionally_saved_form_->new_password_value.empty()); 1549 provisionally_saved_form_->new_password_value.empty());
1542 } 1550 }
1543 1551
1544 } // namespace autofill 1552 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698