OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 LocalFileSystem* LocalFileSystem::From(ExecutionContext& context) { | 195 LocalFileSystem* LocalFileSystem::From(ExecutionContext& context) { |
196 if (context.IsDocument()) { | 196 if (context.IsDocument()) { |
197 LocalFileSystem* file_system = | 197 LocalFileSystem* file_system = |
198 static_cast<LocalFileSystem*>(Supplement<LocalFrame>::From( | 198 static_cast<LocalFileSystem*>(Supplement<LocalFrame>::From( |
199 ToDocument(context).GetFrame(), SupplementName())); | 199 ToDocument(context).GetFrame(), SupplementName())); |
200 DCHECK(file_system); | 200 DCHECK(file_system); |
201 return file_system; | 201 return file_system; |
202 } | 202 } |
203 | 203 |
204 WorkerClients* clients = ToWorkerGlobalScope(context).Clients(); | 204 WorkerClients* clients = ToWorkerGlobalScope(context).Clients(); |
205 ASSERT(clients); | 205 DCHECK(clients); |
206 LocalFileSystem* file_system = static_cast<LocalFileSystem*>( | 206 LocalFileSystem* file_system = static_cast<LocalFileSystem*>( |
207 Supplement<WorkerClients>::From(clients, SupplementName())); | 207 Supplement<WorkerClients>::From(clients, SupplementName())); |
208 DCHECK(file_system); | 208 DCHECK(file_system); |
209 return file_system; | 209 return file_system; |
210 } | 210 } |
211 | 211 |
212 void ProvideLocalFileSystemTo(LocalFrame& frame, | 212 void ProvideLocalFileSystemTo(LocalFrame& frame, |
213 std::unique_ptr<FileSystemClient> client) { | 213 std::unique_ptr<FileSystemClient> client) { |
214 frame.ProvideSupplement(LocalFileSystem::SupplementName(), | 214 frame.ProvideSupplement(LocalFileSystem::SupplementName(), |
215 new LocalFileSystem(frame, std::move(client))); | 215 new LocalFileSystem(frame, std::move(client))); |
216 } | 216 } |
217 | 217 |
218 void ProvideLocalFileSystemToWorker(WorkerClients* worker_clients, | 218 void ProvideLocalFileSystemToWorker(WorkerClients* worker_clients, |
219 std::unique_ptr<FileSystemClient> client) { | 219 std::unique_ptr<FileSystemClient> client) { |
220 Supplement<WorkerClients>::ProvideTo( | 220 Supplement<WorkerClients>::ProvideTo( |
221 *worker_clients, LocalFileSystem::SupplementName(), | 221 *worker_clients, LocalFileSystem::SupplementName(), |
222 new LocalFileSystem(*worker_clients, std::move(client))); | 222 new LocalFileSystem(*worker_clients, std::move(client))); |
223 } | 223 } |
224 | 224 |
225 } // namespace blink | 225 } // namespace blink |
OLD | NEW |