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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 10831016: NULL check before deref, not after (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering. 455 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering.
456 // However, what if new conditions are added and 456 // However, what if new conditions are added and
457 // NeedMatchCompleteDummyForFinalStatus, is not being updated. Not sure 457 // NeedMatchCompleteDummyForFinalStatus, is not being updated. Not sure
458 // what's the best thing to do here. For now, I will just check whether 458 // what's the best thing to do here. For now, I will just check whether
459 // we are actually prerendering. 459 // we are actually prerendering.
460 entry->set_match_complete_status( 460 entry->set_match_complete_status(
461 PrerenderContents::MATCH_COMPLETE_REPLACED); 461 PrerenderContents::MATCH_COMPLETE_REPLACED);
462 PrerenderContents* dummy_replacement_prerender_contents = 462 PrerenderContents* dummy_replacement_prerender_contents =
463 CreatePrerenderContents(entry->prerender_url(), entry->referrer(), 463 CreatePrerenderContents(entry->prerender_url(), entry->referrer(),
464 entry->origin(), entry->experiment_id()); 464 entry->origin(), entry->experiment_id());
465 DCHECK(dummy_replacement_prerender_contents);
465 dummy_replacement_prerender_contents->MakeIntoDummyReplacementOf(entry); 466 dummy_replacement_prerender_contents->MakeIntoDummyReplacementOf(entry);
466 DCHECK(dummy_replacement_prerender_contents);
467 467
468 dummy_replacement_prerender_contents->set_match_complete_status( 468 dummy_replacement_prerender_contents->set_match_complete_status(
469 PrerenderContents::MATCH_COMPLETE_REPLACEMENT_PENDING); 469 PrerenderContents::MATCH_COMPLETE_REPLACEMENT_PENDING);
470 DCHECK(dummy_replacement_prerender_contents->Init()); 470 DCHECK(dummy_replacement_prerender_contents->Init());
471 dummy_replacement_prerender_contents-> 471 dummy_replacement_prerender_contents->
472 AddAliasURLsFromOtherPrerenderContents(entry); 472 AddAliasURLsFromOtherPrerenderContents(entry);
473 dummy_replacement_prerender_contents->set_match_complete_status( 473 dummy_replacement_prerender_contents->set_match_complete_status(
474 PrerenderContents::MATCH_COMPLETE_REPLACEMENT); 474 PrerenderContents::MATCH_COMPLETE_REPLACEMENT);
475 475
476 it->get()->contents_ = dummy_replacement_prerender_contents; 476 it->get()->contents_ = dummy_replacement_prerender_contents;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 if (!render_process_host || !render_process_host->GetBrowserContext()) 1224 if (!render_process_host || !render_process_host->GetBrowserContext())
1225 return NULL; 1225 return NULL;
1226 Profile* profile = Profile::FromBrowserContext( 1226 Profile* profile = Profile::FromBrowserContext(
1227 render_process_host->GetBrowserContext()); 1227 render_process_host->GetBrowserContext());
1228 if (!profile) 1228 if (!profile)
1229 return NULL; 1229 return NULL;
1230 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1230 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1231 } 1231 }
1232 1232
1233 } // namespace prerender 1233 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698