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

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

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return profile->GetPrerenderManager(); 184 return profile->GetPrerenderManager();
185 return NULL; 185 return NULL;
186 } 186 }
187 187
188 } // namespace 188 } // namespace
189 189
190 void ProfileIOData::InitializeProfileParams(Profile* profile) { 190 void ProfileIOData::InitializeProfileParams(Profile* profile) {
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
192 PrefService* pref_service = profile->GetPrefs(); 192 PrefService* pref_service = profile->GetPrefs();
193 193
194 next_download_id_thunk_ = profile->GetDownloadManager()->GetNextIdThunk();
Randy Smith (Not in Mondays) 2011/07/28 21:03:16 Why is this in ProfileIOData as well as ResourceCo
benjhayden 2011/08/03 17:44:46 Yes, next_download_id_thunk_ is used in LazyInitia
195
194 scoped_ptr<ProfileParams> params(new ProfileParams); 196 scoped_ptr<ProfileParams> params(new ProfileParams);
195 params->is_incognito = profile->IsOffTheRecord(); 197 params->is_incognito = profile->IsOffTheRecord();
196 params->clear_local_state_on_exit = 198 params->clear_local_state_on_exit =
197 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); 199 pref_service->GetBoolean(prefs::kClearSiteDataOnExit);
198 200
199 params->appcache_service = profile->GetAppCacheService(); 201 params->appcache_service = profile->GetAppCacheService();
200 202
201 // Set up Accept-Language and Accept-Charset header values 203 // Set up Accept-Language and Accept-Charset header values
202 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( 204 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
203 pref_service->GetString(prefs::kAcceptLanguages)); 205 pref_service->GetString(prefs::kAcceptLanguages));
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 resource_context_.set_database_tracker(database_tracker_); 498 resource_context_.set_database_tracker(database_tracker_);
497 resource_context_.set_appcache_service(appcache_service_); 499 resource_context_.set_appcache_service(appcache_service_);
498 resource_context_.set_blob_storage_context(blob_storage_context_); 500 resource_context_.set_blob_storage_context(blob_storage_context_);
499 resource_context_.set_file_system_context(file_system_context_); 501 resource_context_.set_file_system_context(file_system_context_);
500 resource_context_.set_quota_manager(quota_manager_); 502 resource_context_.set_quota_manager(quota_manager_);
501 resource_context_.set_host_zoom_map(host_zoom_map_); 503 resource_context_.set_host_zoom_map(host_zoom_map_);
502 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); 504 resource_context_.set_prerender_manager_getter(prerender_manager_getter_);
503 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); 505 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this));
504 resource_context_.set_media_observer( 506 resource_context_.set_media_observer(
505 io_thread_globals->media.media_internals.get()); 507 io_thread_globals->media.media_internals.get());
508 resource_context_.SetUserData(reinterpret_cast<void*>(
509 BASE_HASH_NAMESPACE::hash<std::string>()("next_download_id_thunk")),
510 &next_download_id_thunk_);
Randy Smith (Not in Mondays) 2011/07/28 21:03:16 I presume that the whole nasty reinterpret_cast<>
benjhayden 2011/08/03 17:44:46 Done.
506 511
507 LazyInitializeInternal(profile_params_.get()); 512 LazyInitializeInternal(profile_params_.get());
508 513
509 profile_params_.reset(); 514 profile_params_.reset();
510 initialized_ = true; 515 initialized_ = true;
511 } 516 }
512 517
513 void ProfileIOData::ApplyProfileParamsToContext( 518 void ProfileIOData::ApplyProfileParamsToContext(
514 ChromeURLRequestContext* context) const { 519 ChromeURLRequestContext* context) const {
515 context->set_is_incognito(profile_params_->is_incognito); 520 context->set_is_incognito(profile_params_->is_incognito);
(...skipping 14 matching lines...) Expand all
530 BrowserThread::IO, FROM_HERE, 535 BrowserThread::IO, FROM_HERE,
531 base::Bind( 536 base::Bind(
532 &ResourceDispatcherHost::CancelRequestsForContext, 537 &ResourceDispatcherHost::CancelRequestsForContext,
533 base::Unretained(g_browser_process->resource_dispatcher_host()), 538 base::Unretained(g_browser_process->resource_dispatcher_host()),
534 &resource_context_)); 539 &resource_context_));
535 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 540 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
536 new ReleaseTask<ProfileIOData>(this)); 541 new ReleaseTask<ProfileIOData>(this));
537 if (!posted) 542 if (!posted)
538 Release(); 543 Release();
539 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698