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

Side by Side Diff: Source/WebKit/chromium/src/SharedWorkerRepository.cpp

Issue 17885002: Use toDocument instead of static_cast<Document*>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr <MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& e c) 220 void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr <MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& e c)
221 { 221 {
222 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito ry(); 222 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito ry();
223 223
224 // This should not be callable unless there's a SharedWorkerRepository for 224 // This should not be callable unless there's a SharedWorkerRepository for
225 // this context (since isAvailable() should have returned null). 225 // this context (since isAvailable() should have returned null).
226 ASSERT(repository); 226 ASSERT(repository);
227 227
228 // No nested workers (for now) - connect() should only be called from docume nt context. 228 // No nested workers (for now) - connect() should only be called from docume nt context.
229 ASSERT(worker->scriptExecutionContext()->isDocument()); 229 ASSERT(worker->scriptExecutionContext()->isDocument());
230 Document* document = static_cast<Document*>(worker->scriptExecutionContext() ); 230 Document* document = toDocument(worker->scriptExecutionContext());
231 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 231 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
232 OwnPtr<WebSharedWorker> webWorker; 232 OwnPtr<WebSharedWorker> webWorker;
233 webWorker = adoptPtr(webFrame->client()->createSharedWorker(webFrame, url, n ame, getId(document))); 233 webWorker = adoptPtr(webFrame->client()->createSharedWorker(webFrame, url, n ame, getId(document)));
234 234
235 if (!webWorker) { 235 if (!webWorker) {
236 // Existing worker does not match this url, so return an error back to t he caller. 236 // Existing worker does not match this url, so return an error back to t he caller.
237 ec = URL_MISMATCH_ERR; 237 ec = URL_MISMATCH_ERR;
238 return; 238 return;
239 } 239 }
240 240
(...skipping 18 matching lines...) Expand all
259 } 259 }
260 260
261 bool SharedWorkerRepository::hasSharedWorkers(Document* document) 261 bool SharedWorkerRepository::hasSharedWorkers(Document* document)
262 { 262 {
263 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito ry(); 263 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito ry();
264 264
265 return repository && repository->hasSharedWorkers(getId(document)); 265 return repository && repository->hasSharedWorkers(getId(document));
266 } 266 }
267 267
268 } // namespace WebCore 268 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/LocalFileSystemChromium.cpp ('k') | Source/WebKit/chromium/src/StorageQuotaChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698