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

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

Issue 188503002: Oilpan: add transition types to FileSystem APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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) 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 56 FileSystemType fileSystemType = static_cast<FileSystemType>(type);
57 if (!DOMFileSystemBase::isValidType(fileSystemType)) { 57 if (!DOMFileSystemBase::isValidType(fileSystemType)) {
58 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::INVALID_MODIFICATION_ERR)); 58 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::INVALID_MODIFICATION_ERR));
59 return; 59 return;
60 } 60 }
61 61
62 LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, si ze, FileSystemCallbacks::create(successCallback, errorCallback, &worker, fileSys temType)); 62 LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, si ze, FileSystemCallbacks::create(successCallback, errorCallback, &worker, fileSys temType));
63 } 63 }
64 64
65 PassRefPtr<DOMFileSystemSync> WorkerGlobalScopeFileSystem::webkitRequestFileSyst emSync(WorkerGlobalScope& worker, int type, long long size, ExceptionState& exce ptionState) 65 PassRefPtrWillBeRawPtr<DOMFileSystemSync> WorkerGlobalScopeFileSystem::webkitReq uestFileSystemSync(WorkerGlobalScope& worker, int type, long long size, Exceptio nState& exceptionState)
66 { 66 {
67 ExecutionContext* secureContext = worker.executionContext(); 67 ExecutionContext* secureContext = worker.executionContext();
68 if (!secureContext->securityOrigin()->canAccessFileSystem()) { 68 if (!secureContext->securityOrigin()->canAccessFileSystem()) {
69 exceptionState.throwSecurityError(FileError::securityErrorMessage); 69 exceptionState.throwSecurityError(FileError::securityErrorMessage);
70 return nullptr; 70 return nullptr;
71 } 71 }
72 72
73 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 73 FileSystemType fileSystemType = static_cast<FileSystemType>(type);
74 if (!DOMFileSystemBase::isValidType(fileSystemType)) { 74 if (!DOMFileSystemBase::isValidType(fileSystemType)) {
75 exceptionState.throwDOMException(InvalidModificationError, "the type mus t be TEMPORARY or PERSISTENT."); 75 exceptionState.throwDOMException(InvalidModificationError, "the type mus t be TEMPORARY or PERSISTENT.");
(...skipping 18 matching lines...) Expand all
94 } 94 }
95 95
96 if (!completedURL.isValid()) { 96 if (!completedURL.isValid()) {
97 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::ENCODING_ERR)); 97 DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::creat e(FileError::ENCODING_ERR));
98 return; 98 return;
99 } 99 }
100 100
101 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, ResolveURIC allbacks::create(successCallback, errorCallback, &worker)); 101 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, ResolveURIC allbacks::create(successCallback, errorCallback, &worker));
102 } 102 }
103 103
104 PassRefPtr<EntrySync> WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemS yncURL(WorkerGlobalScope& worker, const String& url, ExceptionState& exceptionSt ate) 104 PassRefPtrWillBeRawPtr<EntrySync> WorkerGlobalScopeFileSystem::webkitResolveLoca lFileSystemSyncURL(WorkerGlobalScope& worker, const String& url, ExceptionState& exceptionState)
105 { 105 {
106 KURL completedURL = worker.completeURL(url); 106 KURL completedURL = worker.completeURL(url);
107 ExecutionContext* secureContext = worker.executionContext(); 107 ExecutionContext* secureContext = worker.executionContext();
108 if (!secureContext->securityOrigin()->canAccessFileSystem() || !secureContex t->securityOrigin()->canRequest(completedURL)) { 108 if (!secureContext->securityOrigin()->canAccessFileSystem() || !secureContex t->securityOrigin()->canRequest(completedURL)) {
109 exceptionState.throwSecurityError(FileError::securityErrorMessage); 109 exceptionState.throwSecurityError(FileError::securityErrorMessage);
110 return nullptr; 110 return nullptr;
111 } 111 }
112 112
113 if (!completedURL.isValid()) { 113 if (!completedURL.isValid()) {
114 exceptionState.throwDOMException(EncodingError, "the URL '" + url + "' i s invalid."); 114 exceptionState.throwDOMException(EncodingError, "the URL '" + url + "' i s invalid.");
115 return nullptr; 115 return nullptr;
116 } 116 }
117 117
118 EntrySyncCallbackHelper resolveURLHelper; 118 EntrySyncCallbackHelper resolveURLHelper;
119 OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(res olveURLHelper.successCallback(), resolveURLHelper.errorCallback(), &worker); 119 OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(res olveURLHelper.successCallback(), resolveURLHelper.errorCallback(), &worker);
120 callbacks->setShouldBlockUntilCompletion(true); 120 callbacks->setShouldBlockUntilCompletion(true);
121 121
122 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, callbacks.r elease()); 122 LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, callbacks.r elease());
123 123
124 RefPtr<EntrySync> entry = resolveURLHelper.getResult(exceptionState); 124 RefPtrWillBeRawPtr<EntrySync> entry = resolveURLHelper.getResult(exceptionSt ate);
125 if (!entry) 125 if (!entry)
126 return nullptr; 126 return nullptr;
127 return entry.release(); 127 return entry.release();
128 } 128 }
129 129
130 COMPILE_ASSERT(static_cast<int>(WorkerGlobalScopeFileSystem::TEMPORARY) == stati c_cast<int>(FileSystemTypeTemporary), enum_mismatch); 130 COMPILE_ASSERT(static_cast<int>(WorkerGlobalScopeFileSystem::TEMPORARY) == stati c_cast<int>(FileSystemTypeTemporary), enum_mismatch);
131 COMPILE_ASSERT(static_cast<int>(WorkerGlobalScopeFileSystem::PERSISTENT) == stat ic_cast<int>(FileSystemTypePersistent), enum_mismatch); 131 COMPILE_ASSERT(static_cast<int>(WorkerGlobalScopeFileSystem::PERSISTENT) == stat ic_cast<int>(FileSystemTypePersistent), enum_mismatch);
132 132
133 } // namespace WebCore 133 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/filesystem/WorkerGlobalScopeFileSystem.h ('k') | Source/web/WebDOMFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698