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

Side by Side Diff: third_party/WebKit/Source/core/html/PublicURLManager.cpp

Issue 1808533003: Revert of Reduce ActiveDOMObjects from core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 /* 1 /*
2 * Copyright (C) 2012 Motorola Mobility Inc. 2 * Copyright (C) 2012 Motorola Mobility Inc.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 18 matching lines...) Expand all
29 #include "core/fetch/MemoryCache.h" 29 #include "core/fetch/MemoryCache.h"
30 #include "core/html/URLRegistry.h" 30 #include "core/html/URLRegistry.h"
31 #include "platform/weborigin/KURL.h" 31 #include "platform/weborigin/KURL.h"
32 #include "wtf/Vector.h" 32 #include "wtf/Vector.h"
33 #include "wtf/text/StringHash.h" 33 #include "wtf/text/StringHash.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 PassOwnPtrWillBeRawPtr<PublicURLManager> PublicURLManager::create(ExecutionConte xt* context) 37 PassOwnPtrWillBeRawPtr<PublicURLManager> PublicURLManager::create(ExecutionConte xt* context)
38 { 38 {
39 return adoptPtrWillBeNoop(new PublicURLManager(context)); 39 OwnPtrWillBeRawPtr<PublicURLManager> publicURLManager = adoptPtrWillBeNoop(n ew PublicURLManager(context));
40 publicURLManager->suspendIfNeeded();
41 return publicURLManager.release();
40 } 42 }
41 43
42 PublicURLManager::PublicURLManager(ExecutionContext* context) 44 PublicURLManager::PublicURLManager(ExecutionContext* context)
43 : ContextLifecycleObserver(context) 45 : ActiveDOMObject(context)
46 , m_isStopped(false)
44 { 47 {
45 } 48 }
46 49
47 void PublicURLManager::registerURL(SecurityOrigin* origin, const KURL& url, URLR egistrable* registrable, const String& uuid) 50 void PublicURLManager::registerURL(SecurityOrigin* origin, const KURL& url, URLR egistrable* registrable, const String& uuid)
48 { 51 {
49 if (!executionContext()) 52 if (m_isStopped)
50 return; 53 return;
51 54
52 RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->registr y(), URLMap()).storedValue; 55 RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->registr y(), URLMap()).storedValue;
53 found->key->registerURL(origin, url, registrable); 56 found->key->registerURL(origin, url, registrable);
54 found->value.add(url.string(), uuid); 57 found->value.add(url.string(), uuid);
55 } 58 }
56 59
57 void PublicURLManager::revoke(const KURL& url) 60 void PublicURLManager::revoke(const KURL& url)
58 { 61 {
59 for (auto& registryUrl : m_registryToURL) { 62 for (auto& registryUrl : m_registryToURL) {
(...skipping 19 matching lines...) Expand all
79 registry->unregisterURL(url); 82 registry->unregisterURL(url);
80 urlsToRemove.append(registeredUrl.key); 83 urlsToRemove.append(registeredUrl.key);
81 } 84 }
82 } 85 }
83 for (unsigned j = 0; j < urlsToRemove.size(); j++) 86 for (unsigned j = 0; j < urlsToRemove.size(); j++)
84 registeredURLs.remove(urlsToRemove[j]); 87 registeredURLs.remove(urlsToRemove[j]);
85 urlsToRemove.clear(); 88 urlsToRemove.clear();
86 } 89 }
87 } 90 }
88 91
89 void PublicURLManager::contextDestroyed() 92 void PublicURLManager::stop()
90 { 93 {
91 if (!executionContext()) 94 if (m_isStopped)
92 return; 95 return;
93 96
97 m_isStopped = true;
94 for (auto& registryUrl : m_registryToURL) { 98 for (auto& registryUrl : m_registryToURL) {
95 for (auto& url : registryUrl.value) 99 for (auto& url : registryUrl.value)
96 registryUrl.key->unregisterURL(KURL(ParsedURLString, url.key)); 100 registryUrl.key->unregisterURL(KURL(ParsedURLString, url.key));
97 } 101 }
98 102
99 m_registryToURL.clear(); 103 m_registryToURL.clear();
100 } 104 }
101 105
102 DEFINE_TRACE(PublicURLManager) 106 DEFINE_TRACE(PublicURLManager)
103 { 107 {
104 ContextLifecycleObserver::trace(visitor); 108 ActiveDOMObject::trace(visitor);
105 } 109 }
106 110
107 } // namespace blink 111 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/PublicURLManager.h ('k') | third_party/WebKit/Source/core/page/EventSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698