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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp

Issue 1978173002: Remove OwnPtr::release() calls in modules/ (part 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 72 FileSystemType fileSystemType = static_cast<FileSystemType>(type);
73 if (!DOMFileSystemBase::isValidType(fileSystemType)) { 73 if (!DOMFileSystemBase::isValidType(fileSystemType)) {
74 exceptionState.throwDOMException(InvalidModificationError, "the type mus t be TEMPORARY or PERSISTENT."); 74 exceptionState.throwDOMException(InvalidModificationError, "the type mus t be TEMPORARY or PERSISTENT.");
75 return 0; 75 return 0;
76 } 76 }
77 77
78 FileSystemSyncCallbackHelper* helper = FileSystemSyncCallbackHelper::create( ); 78 FileSystemSyncCallbackHelper* helper = FileSystemSyncCallbackHelper::create( );
79 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(hel per->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType); 79 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(hel per->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType);
80 callbacks->setShouldBlockUntilCompletion(true); 80 callbacks->setShouldBlockUntilCompletion(true);
81 81
82 LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, si ze, callbacks.release()); 82 LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, si ze, std::move(callbacks));
83 return helper->getResult(exceptionState); 83 return helper->getResult(exceptionState);
84 } 84 }
85 85
86 void WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemURL(WorkerGlobalSc ope& worker, const String& url, EntryCallback* successCallback, ErrorCallback* e rrorCallback) 86 void WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemURL(WorkerGlobalSc ope& worker, const String& url, EntryCallback* successCallback, ErrorCallback* e rrorCallback)
87 { 87 {
88 KURL completedURL = worker.completeURL(url); 88 KURL completedURL = worker.completeURL(url);
89 ExecutionContext* secureContext = worker.getExecutionContext(); 89 ExecutionContext* secureContext = worker.getExecutionContext();
90 if (!secureContext->getSecurityOrigin()->canAccessFileSystem() || !secureCon text->getSecurityOrigin()->canRequest(completedURL)) { 90 if (!secureContext->getSecurityOrigin()->canAccessFileSystem() || !secureCon text->getSecurityOrigin()->canRequest(completedURL)) {
91 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::SECURITY_ERR)); 91 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::SECURITY_ERR));
92 return; 92 return;
(...skipping 18 matching lines...) Expand all
111 111
112 if (!completedURL.isValid()) { 112 if (!completedURL.isValid()) {
113 exceptionState.throwDOMException(EncodingError, "the URL '" + url + "' i s invalid."); 113 exceptionState.throwDOMException(EncodingError, "the URL '" + url + "' i s invalid.");
114 return 0; 114 return 0;
115 } 115 }
116 116
117 EntrySyncCallbackHelper* resolveURLHelper = EntrySyncCallbackHelper::create( ); 117 EntrySyncCallbackHelper* resolveURLHelper = EntrySyncCallbackHelper::create( );
118 OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(res olveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &work er); 118 OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(res olveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &work er);
119 callbacks->setShouldBlockUntilCompletion(true); 119 callbacks->setShouldBlockUntilCompletion(true);
120 120
121 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, callbacks.r elease()); 121 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, std::move(c allbacks));
122 122
123 return resolveURLHelper->getResult(exceptionState); 123 return resolveURLHelper->getResult(exceptionState);
124 } 124 }
125 125
126 static_assert(static_cast<int>(WorkerGlobalScopeFileSystem::TEMPORARY) == static _cast<int>(FileSystemTypeTemporary), "WorkerGlobalScopeFileSystem::TEMPORARY sho uld match FileSystemTypeTemporary"); 126 static_assert(static_cast<int>(WorkerGlobalScopeFileSystem::TEMPORARY) == static _cast<int>(FileSystemTypeTemporary), "WorkerGlobalScopeFileSystem::TEMPORARY sho uld match FileSystemTypeTemporary");
127 static_assert(static_cast<int>(WorkerGlobalScopeFileSystem::PERSISTENT) == stati c_cast<int>(FileSystemTypePersistent), "WorkerGlobalScopeFileSystem::PERSISTENT should match FileSystemTypePersistent"); 127 static_assert(static_cast<int>(WorkerGlobalScopeFileSystem::PERSISTENT) == stati c_cast<int>(FileSystemTypePersistent), "WorkerGlobalScopeFileSystem::PERSISTENT should match FileSystemTypePersistent");
128 128
129 } // namespace blink 129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698