OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 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 15 matching lines...) Expand all Loading... |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 | 29 |
30 #if ENABLE(WORKERS) | 30 #if ENABLE(WORKERS) |
31 | 31 |
32 #include "WorkerContext.h" | 32 #include "WorkerContext.h" |
33 | 33 |
34 #include "ActiveDOMObject.h" | 34 #include "ActiveDOMObject.h" |
35 #include "Database.h" | 35 #include "Database.h" |
| 36 #include "DatabaseTracker.h" |
36 #include "DOMTimer.h" | 37 #include "DOMTimer.h" |
37 #include "DOMWindow.h" | 38 #include "DOMWindow.h" |
38 #include "Event.h" | 39 #include "Event.h" |
39 #include "EventException.h" | 40 #include "EventException.h" |
40 #include "MessagePort.h" | 41 #include "MessagePort.h" |
41 #include "NotImplemented.h" | 42 #include "NotImplemented.h" |
42 #include "ScriptSourceCode.h" | 43 #include "ScriptSourceCode.h" |
43 #include "ScriptValue.h" | 44 #include "ScriptValue.h" |
44 #include "SecurityOrigin.h" | 45 #include "SecurityOrigin.h" |
45 #include "WorkerLocation.h" | 46 #include "WorkerLocation.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 #endif | 257 #endif |
257 | 258 |
258 #if ENABLE(DATABASE) | 259 #if ENABLE(DATABASE) |
259 PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const Strin
g& version, const String& displayName, unsigned long estimatedSize, ExceptionCod
e& ec) | 260 PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const Strin
g& version, const String& displayName, unsigned long estimatedSize, ExceptionCod
e& ec) |
260 { | 261 { |
261 if (!securityOrigin()->canAccessDatabase()) { | 262 if (!securityOrigin()->canAccessDatabase()) { |
262 ec = SECURITY_ERR; | 263 ec = SECURITY_ERR; |
263 return 0; | 264 return 0; |
264 } | 265 } |
265 | 266 |
266 ASSERT(Database::isAvailable()); | |
267 if (!Database::isAvailable()) | 267 if (!Database::isAvailable()) |
268 return 0; | 268 return 0; |
269 | 269 |
270 return Database::openDatabase(this, name, version, displayName, estimatedSiz
e, ec); | 270 return Database::openDatabase(this, name, version, displayName, estimatedSiz
e, ec); |
271 } | 271 } |
| 272 |
| 273 void WorkerContext::databaseExceededQuota(const String&) |
| 274 { |
| 275 #if !PLATFORM(CHROMIUM) |
| 276 // FIXME: This needs a real implementation; this is a temporary solution for
testing. |
| 277 const unsigned long long defaultQuota = 5 * 1024 * 1024; |
| 278 DatabaseTracker::tracker().setQuota(securityOrigin(), defaultQuota); |
| 279 #endif |
| 280 } |
272 #endif | 281 #endif |
273 | 282 |
274 bool WorkerContext::isContextThread() const | 283 bool WorkerContext::isContextThread() const |
275 { | 284 { |
276 return currentThread() == thread()->threadID(); | 285 return currentThread() == thread()->threadID(); |
277 } | 286 } |
278 | 287 |
279 EventTargetData* WorkerContext::eventTargetData() | 288 EventTargetData* WorkerContext::eventTargetData() |
280 { | 289 { |
281 return &m_eventTargetData; | 290 return &m_eventTargetData; |
282 } | 291 } |
283 | 292 |
284 EventTargetData* WorkerContext::ensureEventTargetData() | 293 EventTargetData* WorkerContext::ensureEventTargetData() |
285 { | 294 { |
286 return &m_eventTargetData; | 295 return &m_eventTargetData; |
287 } | 296 } |
288 | 297 |
289 } // namespace WebCore | 298 } // namespace WebCore |
290 | 299 |
291 #endif // ENABLE(WORKERS) | 300 #endif // ENABLE(WORKERS) |
OLD | NEW |