OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/chrome_plugin_browsing_context.h" | 5 #include "chrome/browser/chrome_plugin_browsing_context.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
11 | 11 |
12 CPBrowsingContextManager* CPBrowsingContextManager::Instance() { | 12 CPBrowsingContextManager* CPBrowsingContextManager::GetInstance() { |
13 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 13 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
14 return Singleton<CPBrowsingContextManager>::get(); | 14 return Singleton<CPBrowsingContextManager>::get(); |
15 } | 15 } |
16 | 16 |
17 CPBrowsingContextManager::CPBrowsingContextManager() { | 17 CPBrowsingContextManager::CPBrowsingContextManager() { |
18 registrar_.Add(this, NotificationType::URL_REQUEST_CONTEXT_RELEASED, | 18 registrar_.Add(this, NotificationType::URL_REQUEST_CONTEXT_RELEASED, |
19 NotificationService::AllSources()); | 19 NotificationService::AllSources()); |
20 } | 20 } |
21 | 21 |
22 CPBrowsingContextManager::~CPBrowsingContextManager() { | 22 CPBrowsingContextManager::~CPBrowsingContextManager() { |
(...skipping 29 matching lines...) Expand all Loading... |
52 URLRequestContext* context = Source<URLRequestContext>(source).ptr(); | 52 URLRequestContext* context = Source<URLRequestContext>(source).ptr(); |
53 | 53 |
54 // Multiple CPBrowsingContexts may refer to the same URLRequestContext. | 54 // Multiple CPBrowsingContexts may refer to the same URLRequestContext. |
55 for (Map::iterator it(&map_); !it.IsAtEnd(); it.Advance()) { | 55 for (Map::iterator it(&map_); !it.IsAtEnd(); it.Advance()) { |
56 if (it.GetCurrentValue() == context) | 56 if (it.GetCurrentValue() == context) |
57 map_.Remove(it.GetCurrentKey()); | 57 map_.Remove(it.GetCurrentKey()); |
58 } | 58 } |
59 | 59 |
60 reverse_map_.erase(context); | 60 reverse_map_.erase(context); |
61 } | 61 } |
OLD | NEW |