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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 10831349: ProfileImpl fix: Don't access DOMStorageContext too early. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | 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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 prefs_.reset(PrefService::CreatePrefService( 308 prefs_.reset(PrefService::CreatePrefService(
309 GetPrefFilePath(), 309 GetPrefFilePath(),
310 policy_service_.get(), 310 policy_service_.get(),
311 new ExtensionPrefStore( 311 new ExtensionPrefStore(
312 ExtensionPrefValueMapFactory::GetForProfile(this), false), 312 ExtensionPrefValueMapFactory::GetForProfile(this), false),
313 false)); 313 false));
314 OnPrefsLoaded(true); 314 OnPrefsLoaded(true);
315 } else { 315 } else {
316 NOTREACHED(); 316 NOTREACHED();
317 } 317 }
318
319 if (command_line->HasSwitch(switches::kEnableRestoreSessionState)) {
320 content::BrowserContext::GetDefaultDOMStorageContext(this)->
321 SetSaveSessionStorageOnDisk();
322 }
323 } 318 }
324 319
325 void ProfileImpl::DoFinalInit(bool is_new_profile) { 320 void ProfileImpl::DoFinalInit(bool is_new_profile) {
326 PrefService* prefs = GetPrefs(); 321 PrefService* prefs = GetPrefs();
327 pref_change_registrar_.Init(prefs); 322 pref_change_registrar_.Init(prefs);
328 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); 323 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this);
329 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); 324 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this);
330 pref_change_registrar_.Add(prefs::kProfileAvatarIndex, this); 325 pref_change_registrar_.Add(prefs::kProfileAvatarIndex, this);
331 pref_change_registrar_.Add(prefs::kProfileName, this); 326 pref_change_registrar_.Add(prefs::kProfileName, this);
332 327
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 415 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
421 PluginPrefs::GetForProfile(this), 416 PluginPrefs::GetForProfile(this),
422 io_data_.GetResourceContextNoInit()); 417 io_data_.GetResourceContextNoInit());
423 418
424 // Delay README creation to not impact startup performance. 419 // Delay README creation to not impact startup performance.
425 BrowserThread::PostDelayedTask( 420 BrowserThread::PostDelayedTask(
426 BrowserThread::FILE, FROM_HERE, 421 BrowserThread::FILE, FROM_HERE,
427 base::Bind(&EnsureReadmeFile, GetPath()), 422 base::Bind(&EnsureReadmeFile, GetPath()),
428 base::TimeDelta::FromMilliseconds(create_readme_delay_ms)); 423 base::TimeDelta::FromMilliseconds(create_readme_delay_ms));
429 424
425 if (CommandLine::ForCurrentProcess()->HasSwitch(
426 switches::kEnableRestoreSessionState)) {
427 content::BrowserContext::GetDefaultDOMStorageContext(this)->
428 SetSaveSessionStorageOnDisk();
429 }
430
430 // Creation has been finished. 431 // Creation has been finished.
431 if (delegate_) 432 if (delegate_)
432 delegate_->OnProfileCreated(this, true, is_new_profile); 433 delegate_->OnProfileCreated(this, true, is_new_profile);
433 434
434 content::NotificationService::current()->Notify( 435 content::NotificationService::current()->Notify(
435 chrome::NOTIFICATION_PROFILE_CREATED, 436 chrome::NOTIFICATION_PROFILE_CREATED,
436 content::Source<Profile>(this), 437 content::Source<Profile>(this),
437 content::NotificationService::NoDetails()); 438 content::NotificationService::NoDetails());
438 } 439 }
439 440
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 if (!path.empty()) 1075 if (!path.empty())
1075 *cache_path = path; 1076 *cache_path = path;
1076 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1077 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1077 prefs_->GetInteger(prefs::kDiskCacheSize); 1078 prefs_->GetInteger(prefs::kDiskCacheSize);
1078 } 1079 }
1079 1080
1080 base::Callback<ChromeURLDataManagerBackend*(void)> 1081 base::Callback<ChromeURLDataManagerBackend*(void)>
1081 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1082 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1082 return io_data_.GetChromeURLDataManagerBackendGetter(); 1083 return io_data_.GetChromeURLDataManagerBackendGetter();
1083 } 1084 }
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