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

Side by Side Diff: content/browser/browser_context.cc

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stray mark. Created 4 years, 9 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 (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 "content/public/browser/browser_context.h" 5 #include "content/public/browser/browser_context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/guid.h" 13 #include "base/guid.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/rand_util.h" 15 #include "base/rand_util.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 17
18 #if !defined(OS_IOS) 18 #if !defined(OS_IOS)
19 #include "components/profile_service/profile_app.h" 19 #include "components/profile_service/user_id_map.h"
20 #include "content/browser/download/download_manager_impl.h" 20 #include "content/browser/download/download_manager_impl.h"
21 #include "content/browser/fileapi/chrome_blob_storage_context.h" 21 #include "content/browser/fileapi/chrome_blob_storage_context.h"
22 #include "content/browser/indexed_db/indexed_db_context_impl.h" 22 #include "content/browser/indexed_db/indexed_db_context_impl.h"
23 #include "content/browser/loader/resource_dispatcher_host_impl.h" 23 #include "content/browser/loader/resource_dispatcher_host_impl.h"
24 #include "content/browser/push_messaging/push_messaging_router.h" 24 #include "content/browser/push_messaging/push_messaging_router.h"
25 #include "content/browser/storage_partition_impl_map.h" 25 #include "content/browser/storage_partition_impl_map.h"
26 #include "content/common/child_process_host_impl.h" 26 #include "content/common/child_process_host_impl.h"
27 #include "content/public/browser/blob_handle.h" 27 #include "content/public/browser/blob_handle.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 BrowserContext* browser_context, 332 BrowserContext* browser_context,
333 DownloadManager* download_manager) { 333 DownloadManager* download_manager) {
334 SetDownloadManager(browser_context, download_manager); 334 SetDownloadManager(browser_context, download_manager);
335 } 335 }
336 336
337 void BrowserContext::Initialize( 337 void BrowserContext::Initialize(
338 BrowserContext* browser_context, 338 BrowserContext* browser_context,
339 const base::FilePath& path) { 339 const base::FilePath& path) {
340 // Generate a GUID for |browser_context| to use as the Mojo user id. 340 // Generate a GUID for |browser_context| to use as the Mojo user id.
341 std::string new_id = base::GenerateGUID(); 341 std::string new_id = base::GenerateGUID();
342 while (g_used_user_ids.Get().find(new_id) != g_used_user_ids.Get().end()) 342 while (g_used_user_ids.Get().find(new_id) != g_used_user_ids.Get().end())
michaeln 2016/03/17 22:35:41 just curious, is this really needed or would a CHE
Elliot Glaysher 2016/03/18 19:41:12 It is extraordinarily improbable, but in case Gene
343 new_id = base::GenerateGUID(); 343 new_id = base::GenerateGUID();
344 344
345 g_used_user_ids.Get().insert(new_id); 345 g_used_user_ids.Get().insert(new_id);
346 g_context_to_user_id.Get().push_back(std::make_pair(browser_context, new_id)); 346 g_context_to_user_id.Get().push_back(std::make_pair(browser_context, new_id));
347 347
348 profile::ProfileApp::AssociateMojoUserIDWithProfileDir(new_id, path); 348 profile::AssociateMojoUserIDWithProfileDir(new_id, path);
michaeln 2016/03/17 22:35:41 can come later but... i think path is not-empty fo
349 browser_context->SetUserData(kMojoWasInitialized, 349 browser_context->SetUserData(kMojoWasInitialized,
350 new base::SupportsUserData::Data); 350 new base::SupportsUserData::Data);
351 } 351 }
352 352
353 const std::string& BrowserContext::GetMojoUserIdFor( 353 const std::string& BrowserContext::GetMojoUserIdFor(
354 BrowserContext* browser_context) { 354 BrowserContext* browser_context) {
355 CHECK(browser_context->GetUserData(kMojoWasInitialized)) 355 CHECK(browser_context->GetUserData(kMojoWasInitialized))
356 << "Attempting to get the mojo user id for a BrowserContext that was " 356 << "Attempting to get the mojo user id for a BrowserContext that was "
357 << "never Initialize()ed."; 357 << "never Initialize()ed.";
358 358
(...skipping 13 matching lines...) Expand all
372 << "Attempting to destroy a BrowserContext that never called " 372 << "Attempting to destroy a BrowserContext that never called "
373 << "Initialize()"; 373 << "Initialize()";
374 374
375 #if !defined(OS_IOS) 375 #if !defined(OS_IOS)
376 if (GetUserData(kDownloadManagerKeyName)) 376 if (GetUserData(kDownloadManagerKeyName))
377 GetDownloadManager(this)->Shutdown(); 377 GetDownloadManager(this)->Shutdown();
378 #endif 378 #endif
379 } 379 }
380 380
381 } // namespace content 381 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698