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

Side by Side Diff: Source/core/workers/WorkerScriptLoader.cpp

Issue 204983007: Make ThreadableLoader class to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes per review commets Created 6 years, 8 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) 2009 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 , m_identifier(0) 46 , m_identifier(0)
47 , m_finishing(false) 47 , m_finishing(false)
48 , m_targetType(ResourceRequest::TargetIsWorker) 48 , m_targetType(ResourceRequest::TargetIsWorker)
49 { 49 {
50 } 50 }
51 51
52 WorkerScriptLoader::~WorkerScriptLoader() 52 WorkerScriptLoader::~WorkerScriptLoader()
53 { 53 {
54 } 54 }
55 55
56 void WorkerScriptLoader::loadSynchronously(ExecutionContext* executionContext, c onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) 56 void WorkerScriptLoader::loadSynchronously(ExecutionContext& executionContext, c onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy)
57 { 57 {
58 m_url = url; 58 m_url = url;
59 59
60 OwnPtr<ResourceRequest> request(createResourceRequest()); 60 OwnPtr<ResourceRequest> request(createResourceRequest());
61 if (!request) 61 if (!request)
62 return; 62 return;
63 63
64 ASSERT_WITH_SECURITY_IMPLICATION(executionContext->isWorkerGlobalScope()); 64 ASSERT_WITH_SECURITY_IMPLICATION(executionContext.isWorkerGlobalScope());
65 65
66 ThreadableLoaderOptions options; 66 ThreadableLoaderOptions options;
67 options.allowCredentials = AllowStoredCredentials; 67 options.allowCredentials = AllowStoredCredentials;
68 options.crossOriginRequestPolicy = crossOriginRequestPolicy; 68 options.crossOriginRequestPolicy = crossOriginRequestPolicy;
69 // FIXME: Should we add EnforceScriptSrcDirective here? 69 // FIXME: Should we add EnforceScriptSrcDirective here?
70 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy ; 70 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy ;
71 71
72 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(execut ionContext), *request, *this, options); 72 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(execut ionContext), *request, *this, options);
73 } 73 }
74 74
75 void WorkerScriptLoader::loadAsynchronously(ExecutionContext* executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript LoaderClient* client) 75 void WorkerScriptLoader::loadAsynchronously(ExecutionContext& executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript LoaderClient* client)
76 { 76 {
77 ASSERT(client); 77 ASSERT(client);
78 m_client = client; 78 m_client = client;
79 m_url = url; 79 m_url = url;
80 80
81 OwnPtr<ResourceRequest> request(createResourceRequest()); 81 OwnPtr<ResourceRequest> request(createResourceRequest());
82 if (!request) 82 if (!request)
83 return; 83 return;
84 84
85 ThreadableLoaderOptions options; 85 ThreadableLoaderOptions options;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void WorkerScriptLoader::notifyFinished() 182 void WorkerScriptLoader::notifyFinished()
183 { 183 {
184 if (!m_client || m_finishing) 184 if (!m_client || m_finishing)
185 return; 185 return;
186 186
187 m_finishing = true; 187 m_finishing = true;
188 m_client->notifyFinished(); 188 m_client->notifyFinished();
189 } 189 }
190 190
191 } // namespace WebCore 191 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698