Changeset 156751 in webkit
- Timestamp:
- Oct 1, 2013 5:03:12 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r156749 r156751 1 2013-10-01 Sam Weinig <sam@webkit.org> 2 3 Convert PageGroup to using std::unique_ptr 4 https://bugs.webkit.org/show_bug.cgi?id=122184 5 6 Reviewed by Anders Carlsson. 7 8 * page/CaptionUserPreferences.cpp: 9 * page/CaptionUserPreferences.h: 10 * page/CaptionUserPreferencesMediaAF.cpp: 11 * page/CaptionUserPreferencesMediaAF.h: 12 * page/Frame.cpp: 13 * page/GroupSettings.h: 14 * page/Page.cpp: 15 * page/PageGroup.cpp: 16 * page/PageGroup.h: 17 * page/UserScriptTypes.h: 18 * page/UserStyleSheetTypes.h: 19 * workers/DedicatedWorkerGlobalScope.h: 20 * workers/DedicatedWorkerThread.cpp: 21 * workers/DedicatedWorkerThread.h: 22 * workers/SharedWorkerGlobalScope.cpp: 23 * workers/SharedWorkerGlobalScope.h: 24 * workers/SharedWorkerThread.cpp: 25 * workers/SharedWorkerThread.h: 26 * workers/WorkerGlobalScope.cpp: 27 * workers/WorkerGlobalScope.h: 28 * workers/WorkerThread.cpp: 29 * workers/WorkerThread.h: 30 1 31 2013-10-01 Tim Horton <timothy_horton@apple.com> 2 32 -
trunk/Source/WebCore/page/CaptionUserPreferences.cpp
r156550 r156751 38 38 namespace WebCore { 39 39 40 CaptionUserPreferences::CaptionUserPreferences(PageGroup *group)40 CaptionUserPreferences::CaptionUserPreferences(PageGroup& group) 41 41 : m_pageGroup(group) 42 42 , m_displayMode(ForcedOnly) … … 80 80 bool CaptionUserPreferences::userPrefersCaptions() const 81 81 { 82 Page* page = *( pageGroup()->pages().begin());82 Page* page = *(m_pageGroup.pages().begin()); 83 83 if (!page) 84 84 return false; … … 89 89 void CaptionUserPreferences::setUserPrefersCaptions(bool preference) 90 90 { 91 Page* page = *( pageGroup()->pages().begin());91 Page* page = *(m_pageGroup.pages().begin()); 92 92 if (!page) 93 93 return; … … 99 99 bool CaptionUserPreferences::userPrefersSubtitles() const 100 100 { 101 Page* page = *(pageGroup() ->pages().begin());101 Page* page = *(pageGroup().pages().begin()); 102 102 if (!page) 103 103 return false; … … 108 108 void CaptionUserPreferences::setUserPrefersSubtitles(bool preference) 109 109 { 110 Page* page = *( pageGroup()->pages().begin());110 Page* page = *(m_pageGroup.pages().begin()); 111 111 if (!page) 112 112 return; … … 118 118 bool CaptionUserPreferences::userPrefersTextDescriptions() const 119 119 { 120 Page* page = *( pageGroup()->pages().begin());120 Page* page = *(m_pageGroup.pages().begin()); 121 121 if (!page) 122 122 return false; … … 127 127 void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference) 128 128 { 129 Page* page = *( pageGroup()->pages().begin());129 Page* page = *(m_pageGroup.pages().begin()); 130 130 if (!page) 131 131 return; … … 137 137 void CaptionUserPreferences::captionPreferencesChanged() 138 138 { 139 m_pageGroup ->captionPreferencesChanged();139 m_pageGroup.captionPreferencesChanged(); 140 140 } 141 141 … … 239 239 DEFINE_STATIC_LOCAL(URL, captionsStyleSheetURL, (ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23")); 240 240 241 pageGroup()->removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL);241 m_pageGroup.removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL); 242 242 243 243 String captionsOverrideStyleSheet = captionsStyleSheetOverride(); … … 245 245 return; 246 246 247 pageGroup()->addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(),247 m_pageGroup.addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(), 248 248 Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel, InjectInExistingDocuments); 249 249 } -
trunk/Source/WebCore/page/CaptionUserPreferences.h
r155277 r156751 44 44 class CaptionUserPreferences { 45 45 public: 46 static PassOwnPtr<CaptionUserPreferences> create(PageGroup* group) { return adoptPtr(new CaptionUserPreferences(group)); }46 CaptionUserPreferences(PageGroup&); 47 47 virtual ~CaptionUserPreferences(); 48 48 … … 88 88 virtual void setTestingMode(bool override) { m_testingMode = override; } 89 89 90 PageGroup *pageGroup() const { return m_pageGroup; }90 PageGroup& pageGroup() const { return m_pageGroup; } 91 91 92 92 protected: 93 CaptionUserPreferences(PageGroup*);94 93 void updateCaptionStyleSheetOveride(); 95 94 … … 98 97 void notify(); 99 98 100 PageGroup *m_pageGroup;99 PageGroup& m_pageGroup; 101 100 CaptionDisplayMode m_displayMode; 102 101 Timer<CaptionUserPreferences> m_timer; -
trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
r156550 r156751 41 41 #include "Logging.h" 42 42 #include "MediaControlElements.h" 43 #include "PageGroup.h"44 43 #include "SoftLinking.h" 45 44 #include "TextTrackCue.h" … … 142 141 #endif 143 142 144 CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup *group)143 CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group) 145 144 : CaptionUserPreferences(group) 146 145 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) -
trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h
r152004 r156751 38 38 class CaptionUserPreferencesMediaAF : public CaptionUserPreferences { 39 39 public: 40 static PassOwnPtr<CaptionUserPreferencesMediaAF> create(PageGroup* group) { return adoptPtr(new CaptionUserPreferencesMediaAF(group)); }40 CaptionUserPreferencesMediaAF(PageGroup&); 41 41 virtual ~CaptionUserPreferencesMediaAF(); 42 42 … … 68 68 69 69 private: 70 CaptionUserPreferencesMediaAF(PageGroup*);71 72 70 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) 73 71 String captionsWindowCSS() const; -
trunk/Source/WebCore/page/Frame.cpp
r156622 r156751 536 536 if (!userScripts) 537 537 return; 538 UserScriptMap::const_iterator end = userScripts->end(); 539 for ( UserScriptMap::const_iterator it = userScripts->begin(); it != end; ++it)538 539 for (auto it = userScripts->begin(), end = userScripts->end(); it != end; ++it) 540 540 injectUserScriptsForWorld(it->key.get(), *it->value, injectionTime); 541 541 } -
trunk/Source/WebCore/page/GroupSettings.h
r127757 r156751 27 27 #define GroupSettings_h 28 28 29 #include <wtf/PassOwnPtr.h>30 29 #include <wtf/text/WTFString.h> 31 30 … … 37 36 WTF_MAKE_NONCOPYABLE(GroupSettings); WTF_MAKE_FAST_ALLOCATED; 38 37 public: 39 static PassOwnPtr<GroupSettings> create() 40 { 41 return adoptPtr(new GroupSettings()); 42 } 38 GroupSettings(); 43 39 44 40 void setLocalStorageQuotaBytes(unsigned); … … 52 48 53 49 private: 54 GroupSettings();55 56 50 unsigned m_localStorageQuotaBytes; 57 51 String m_indexedDBDatabasePath; -
trunk/Source/WebCore/page/Page.cpp
r156660 r156751 435 435 ASSERT(m_group != m_singlePageGroup.get()); 436 436 ASSERT(!m_singlePageGroup); 437 m_group->removePage( this);437 m_group->removePage(*this); 438 438 } 439 439 … … 443 443 m_singlePageGroup = nullptr; 444 444 m_group = PageGroup::pageGroup(name); 445 m_group->addPage( this);445 m_group->addPage(*this); 446 446 } 447 447 } -
trunk/Source/WebCore/page/PageGroup.cpp
r156660 r156751 39 39 #include "Settings.h" 40 40 #include "StorageNamespace.h" 41 #include <wtf/StdLibExtras.h> 41 42 42 43 #if ENABLE(VIDEO_TRACK) … … 64 65 , m_visitedLinksPopulated(false) 65 66 , m_identifier(getUniqueIdentifier()) 66 , m_groupSettings( GroupSettings::create())67 , m_groupSettings(std::make_unique<GroupSettings>()) 67 68 { 68 69 } … … 71 72 : m_visitedLinksPopulated(false) 72 73 , m_identifier(getUniqueIdentifier()) 73 , m_groupSettings( GroupSettings::create())74 { 75 addPage( &page);74 , m_groupSettings(std::make_unique<GroupSettings>()) 75 { 76 addPage(page); 76 77 } 77 78 … … 107 108 return; 108 109 109 PageGroupMap::iterator end = pageGroups->end(); 110 111 for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { 110 for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) { 112 111 if (it->value->hasLocalStorage()) 113 112 it->value->localStorage()->close(); … … 120 119 return; 121 120 122 PageGroupMap::iterator end = pageGroups->end(); 123 for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { 121 for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) { 124 122 if (it->value->hasLocalStorage()) 125 123 it->value->localStorage()->clearAllOriginsForDeletion(); … … 132 130 return; 133 131 134 PageGroupMap::iterator end = pageGroups->end(); 135 for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { 132 for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) { 136 133 if (it->value->hasLocalStorage()) 137 134 it->value->localStorage()->clearOriginForDeletion(origin); … … 144 141 return; 145 142 146 PageGroupMap::iterator end = pageGroups->end(); 147 for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { 143 for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) { 148 144 if (it->value->hasLocalStorage()) 149 145 it->value->localStorage()->closeIdleLocalStorageDatabases(); … … 156 152 return; 157 153 158 PageGroupMap::iterator end = pageGroups->end(); 159 for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { 154 for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) { 160 155 if (it->value->hasLocalStorage()) 161 156 it->value->localStorage()->sync(); … … 171 166 } 172 167 173 void PageGroup::addPage(Page* page) 174 { 175 ASSERT(page); 176 ASSERT(!m_pages.contains(page)); 177 m_pages.add(page); 178 } 179 180 void PageGroup::removePage(Page* page) 181 { 182 ASSERT(page); 183 ASSERT(m_pages.contains(page)); 184 m_pages.remove(page); 168 void PageGroup::addPage(Page& page) 169 { 170 ASSERT(!m_pages.contains(&page)); 171 m_pages.add(&page); 172 } 173 174 void PageGroup::removePage(Page& page) 175 { 176 ASSERT(m_pages.contains(&page)); 177 m_pages.remove(&page); 185 178 } 186 179 … … 274 267 ASSERT_ARG(world, world); 275 268 276 OwnPtr<UserScript> userScript = adoptPtr(new UserScript(source, url, whitelist, blacklist, injectionTime, injectedFrames));269 auto userScript = std::make_unique<UserScript>(source, url, whitelist, blacklist, injectionTime, injectedFrames); 277 270 if (!m_userScripts) 278 m_userScripts = adoptPtr(new UserScriptMap);279 OwnPtr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->value;271 m_userScripts = std::make_unique<UserScriptMap>(); 272 std::unique_ptr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->value; 280 273 if (!scriptsInWorld) 281 scriptsInWorld = adoptPtr(new UserScriptVector);282 scriptsInWorld->append( userScript.release());274 scriptsInWorld = std::make_unique<UserScriptVector>(); 275 scriptsInWorld->append(std::move(userScript)); 283 276 } 284 277 … … 291 284 ASSERT_ARG(world, world); 292 285 293 OwnPtr<UserStyleSheet> userStyleSheet = adoptPtr(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level));286 auto userStyleSheet = std::make_unique<UserStyleSheet>(source, url, whitelist, blacklist, injectedFrames, level); 294 287 if (!m_userStyleSheets) 295 m_userStyleSheets = adoptPtr(new UserStyleSheetMap);296 OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->value;288 m_userStyleSheets = std::make_unique<UserStyleSheetMap>(); 289 std::unique_ptr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->value; 297 290 if (!styleSheetsInWorld) 298 styleSheetsInWorld = adoptPtr(new UserStyleSheetVector);299 styleSheetsInWorld->append( userStyleSheet.release());291 styleSheetsInWorld = std::make_unique<UserStyleSheetVector>(); 292 styleSheetsInWorld->append(std::move(userStyleSheet)); 300 293 301 294 if (injectionTime == InjectInExistingDocuments) … … 310 303 return; 311 304 312 UserScriptMap::iteratorit = m_userScripts->find(world);305 auto it = m_userScripts->find(world); 313 306 if (it == m_userScripts->end()) 314 307 return; 315 308 316 UserScriptVector*scripts = it->value.get();309 auto scripts = it->value.get(); 317 310 for (int i = scripts->size() - 1; i >= 0; --i) { 318 311 if (scripts->at(i)->url() == url) … … 331 324 return; 332 325 333 UserStyleSheetMap::iteratorit = m_userStyleSheets->find(world);326 auto it = m_userStyleSheets->find(world); 334 327 bool sheetsChanged = false; 335 328 if (it == m_userStyleSheets->end()) 336 329 return; 337 330 338 UserStyleSheetVector*stylesheets = it->value.get();331 auto stylesheets = it->value.get(); 339 332 for (int i = stylesheets->size() - 1; i >= 0; --i) { 340 333 if (stylesheets->at(i)->url() == url) { … … 378 371 void PageGroup::removeAllUserContent() 379 372 { 380 m_userScripts .clear();373 m_userScripts = nullptr; 381 374 382 375 if (m_userStyleSheets) { 383 m_userStyleSheets .clear();376 m_userStyleSheets = nullptr; 384 377 invalidateInjectedStyleSheetCacheInAllFrames(); 385 378 } … … 389 382 { 390 383 // Clear our cached sheets and have them just reparse. 391 HashSet<Page*>::const_iterator end = m_pages.end(); 392 for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) { 384 for (auto it = m_pages.begin(), end = m_pages.end(); it != end; ++it) { 393 385 for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) { 394 386 frame->document()->styleSheetCollection().invalidateInjectedStyleSheetCache(); … … 401 393 void PageGroup::captionPreferencesChanged() 402 394 { 403 for ( HashSet<Page*>::iterator i = m_pages.begin(); i != m_pages.end(); ++i)404 (*i )->captionPreferencesChanged();395 for (auto it = m_pages.begin(), end = m_pages.end(); it != end; ++it) 396 (*it)->captionPreferencesChanged(); 405 397 pageCache()->markPagesForCaptionPreferencesChanged(); 406 398 } … … 408 400 CaptionUserPreferences* PageGroup::captionPreferences() 409 401 { 410 if (!m_captionPreferences) 402 if (!m_captionPreferences) { 411 403 #if (PLATFORM(MAC) && !PLATFORM(IOS)) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) 412 m_captionPreferences = CaptionUserPreferencesMediaAF::create(this);404 m_captionPreferences = std::make_unique<CaptionUserPreferencesMediaAF>(*this); 413 405 #else 414 m_captionPreferences = CaptionUserPreferences::create(this);406 m_captionPreferences = std::make_unique<CaptionUserPreferences>(*this); 415 407 #endif 408 } 416 409 417 410 return m_captionPreferences.get(); 418 411 } 419 420 412 #endif 421 413 -
trunk/Source/WebCore/page/PageGroup.h
r156660 r156751 37 37 namespace WebCore { 38 38 39 #if ENABLE(VIDEO_TRACK)40 class CaptionPreferencesChangedListener;41 class CaptionUserPreferences;42 #endif43 39 class URL; 44 40 class GroupSettings; … … 47 43 class SecurityOrigin; 48 44 class StorageNamespace; 45 46 #if ENABLE(VIDEO_TRACK) 47 class CaptionPreferencesChangedListener; 48 class CaptionUserPreferences; 49 #endif 49 50 50 51 class PageGroup : public Supplementable<PageGroup> { … … 69 70 const HashSet<Page*>& pages() const { return m_pages; } 70 71 71 void addPage(Page *);72 void removePage(Page *);72 void addPage(Page&); 73 void removePage(Page&); 73 74 74 75 bool isLinkVisited(LinkHash); … … 130 131 HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageNamespace> > m_transientLocalStorageMap; 131 132 132 OwnPtr<UserScriptMap> m_userScripts;133 OwnPtr<UserStyleSheetMap> m_userStyleSheets;133 std::unique_ptr<UserScriptMap> m_userScripts; 134 std::unique_ptr<UserStyleSheetMap> m_userStyleSheets; 134 135 135 const OwnPtr<GroupSettings> m_groupSettings;136 const std::unique_ptr<GroupSettings> m_groupSettings; 136 137 137 138 #if ENABLE(VIDEO_TRACK) 138 OwnPtr<CaptionUserPreferences> m_captionPreferences;139 std::unique_ptr<CaptionUserPreferences> m_captionPreferences; 139 140 #endif 140 141 }; -
trunk/Source/WebCore/page/UserScriptTypes.h
r103793 r156751 37 37 class UserScript; 38 38 39 typedef Vector< OwnPtr<UserScript>> UserScriptVector;40 typedef HashMap<RefPtr<DOMWrapperWorld>, OwnPtr<UserScriptVector>> UserScriptMap;39 typedef Vector<std::unique_ptr<UserScript>> UserScriptVector; 40 typedef HashMap<RefPtr<DOMWrapperWorld>, std::unique_ptr<UserScriptVector>> UserScriptMap; 41 41 42 42 } // namespace WebCore -
trunk/Source/WebCore/page/UserStyleSheetTypes.h
r103793 r156751 38 38 class UserStyleSheet; 39 39 40 typedef Vector< OwnPtr<UserStyleSheet>> UserStyleSheetVector;41 typedef HashMap<RefPtr<DOMWrapperWorld>, OwnPtr<UserStyleSheetVector>> UserStyleSheetMap;40 typedef Vector<std::unique_ptr<UserStyleSheet>> UserStyleSheetVector; 41 typedef HashMap<RefPtr<DOMWrapperWorld>, std::unique_ptr<UserStyleSheetVector>> UserStyleSheetMap; 42 42 43 43 } // namespace WebCore -
trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
r156550 r156751 41 41 namespace WebCore { 42 42 43 PassRefPtr<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)43 PassRefPtr<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin) 44 44 { 45 RefPtr<DedicatedWorkerGlobalScope> context = adoptRef(new DedicatedWorkerGlobalScope(url, userAgent, s ettings, thread, topOrigin));45 RefPtr<DedicatedWorkerGlobalScope> context = adoptRef(new DedicatedWorkerGlobalScope(url, userAgent, std::move(settings), thread, topOrigin)); 46 46 context->applyContentSecurityPolicyFromString(contentSecurityPolicy, contentSecurityPolicyType); 47 47 return context.release(); 48 48 } 49 49 50 DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)51 : WorkerGlobalScope(url, userAgent, s ettings, thread, topOrigin)50 DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, DedicatedWorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin) 51 : WorkerGlobalScope(url, userAgent, std::move(settings), thread, topOrigin) 52 52 { 53 53 } -
trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h
r156550 r156751 45 45 public: 46 46 typedef WorkerGlobalScope Base; 47 static PassRefPtr<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin);47 static PassRefPtr<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin); 48 48 virtual ~DedicatedWorkerGlobalScope(); 49 49 … … 65 65 66 66 private: 67 DedicatedWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);67 DedicatedWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, DedicatedWorkerThread*, PassRefPtr<SecurityOrigin> topOrigin); 68 68 }; 69 69 -
trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp
r156550 r156751 56 56 } 57 57 58 PassRefPtr<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)58 PassRefPtr<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin) 59 59 { 60 return DedicatedWorkerGlobalScope::create(url, userAgent, s ettings, this, contentSecurityPolicy, contentSecurityPolicyType, topOrigin);60 return DedicatedWorkerGlobalScope::create(url, userAgent, std::move(settings), this, contentSecurityPolicy, contentSecurityPolicyType, topOrigin); 61 61 } 62 62 -
trunk/Source/WebCore/workers/DedicatedWorkerThread.h
r156550 r156751 47 47 48 48 protected: 49 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;49 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE; 50 50 virtual void runEventLoop() OVERRIDE; 51 51 -
trunk/Source/WebCore/workers/SharedWorkerGlobalScope.cpp
r156550 r156751 54 54 55 55 // static 56 PassRefPtr<SharedWorkerGlobalScope> SharedWorkerGlobalScope::create(const String& name, const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)56 PassRefPtr<SharedWorkerGlobalScope> SharedWorkerGlobalScope::create(const String& name, const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) 57 57 { 58 RefPtr<SharedWorkerGlobalScope> context = adoptRef(new SharedWorkerGlobalScope(name, url, userAgent, s ettings, thread));58 RefPtr<SharedWorkerGlobalScope> context = adoptRef(new SharedWorkerGlobalScope(name, url, userAgent, std::move(settings), thread)); 59 59 context->applyContentSecurityPolicyFromString(contentSecurityPolicy, contentSecurityPolicyType); 60 60 return context.release(); 61 61 } 62 62 63 SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread)64 : WorkerGlobalScope(url, userAgent, s ettings, thread, 0)63 SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, SharedWorkerThread* thread) 64 : WorkerGlobalScope(url, userAgent, std::move(settings), thread, 0) 65 65 , m_name(name) 66 66 { -
trunk/Source/WebCore/workers/SharedWorkerGlobalScope.h
r156550 r156751 45 45 public: 46 46 typedef WorkerGlobalScope Base; 47 static PassRefPtr<SharedWorkerGlobalScope> create(const String& name, const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType);47 static PassRefPtr<SharedWorkerGlobalScope> create(const String& name, const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType); 48 48 virtual ~SharedWorkerGlobalScope(); 49 49 … … 60 60 61 61 private: 62 SharedWorkerGlobalScope(const String& name, const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*);62 SharedWorkerGlobalScope(const String& name, const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, SharedWorkerThread*); 63 63 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERRIDE; 64 64 -
trunk/Source/WebCore/workers/SharedWorkerThread.cpp
r156550 r156751 54 54 } 55 55 56 PassRefPtr<WorkerGlobalScope> SharedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin>)56 PassRefPtr<WorkerGlobalScope> SharedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin>) 57 57 { 58 return SharedWorkerGlobalScope::create(m_name, url, userAgent, s ettings, this, contentSecurityPolicy, contentSecurityPolicyType);58 return SharedWorkerGlobalScope::create(m_name, url, userAgent, std::move(settings), this, contentSecurityPolicy, contentSecurityPolicyType); 59 59 } 60 60 -
trunk/Source/WebCore/workers/SharedWorkerThread.h
r156550 r156751 44 44 45 45 protected: 46 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;46 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE; 47 47 48 48 private: -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r156550 r156751 85 85 }; 86 86 87 WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)87 WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, WorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin) 88 88 : m_url(url) 89 89 , m_userAgent(userAgent) 90 , m_groupSettings(s ettings)90 , m_groupSettings(std::move(settings)) 91 91 , m_script(adoptPtr(new WorkerScriptController(this))) 92 92 , m_thread(thread) -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r156550 r156751 140 140 141 141 protected: 142 WorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, WorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);142 WorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, WorkerThread*, PassRefPtr<SecurityOrigin> topOrigin); 143 143 void applyContentSecurityPolicyFromString(const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); 144 144 … … 162 162 URL m_url; 163 163 String m_userAgent; 164 OwnPtr<GroupSettings> m_groupSettings;164 std::unique_ptr<GroupSettings> m_groupSettings; 165 165 166 166 mutable RefPtr<WorkerLocation> m_location; -
trunk/Source/WebCore/workers/WorkerThread.cpp
r156550 r156751 77 77 URL m_scriptURL; 78 78 String m_userAgent; 79 OwnPtr<GroupSettings> m_groupSettings;79 std::unique_ptr<GroupSettings> m_groupSettings; 80 80 String m_sourceCode; 81 81 WorkerThreadStartMode m_startMode; … … 99 99 return; 100 100 101 m_groupSettings = GroupSettings::create();101 m_groupSettings = std::make_unique<GroupSettings>(); 102 102 m_groupSettings->setLocalStorageQuotaBytes(settings->localStorageQuotaBytes()); 103 103 m_groupSettings->setIndexedDBQuotaBytes(settings->indexedDBQuotaBytes()); … … 147 147 { 148 148 MutexLocker lock(m_threadCreationMutex); 149 m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_groupSettings.release(), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release());149 m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, m_startupData->m_userAgent, std::move(m_startupData->m_groupSettings), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release()); 150 150 151 151 if (m_runLoop.terminated()) { -
trunk/Source/WebCore/workers/WorkerThread.h
r156550 r156751 75 75 76 76 // Factory method for creating a new worker context for the thread. 77 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) = 0;77 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) = 0; 78 78 79 79 // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
Note: See TracChangeset
for help on using the changeset viewer.