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

Side by Side Diff: Source/modules/webdatabase/DatabaseContext.h

Issue 561093003: Remove worker support of Web SQL Database. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 3 * Copyright (C) 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 28 matching lines...) Expand all
39 class Database; 39 class Database;
40 class DatabaseBackendBase; 40 class DatabaseBackendBase;
41 class DatabaseContext; 41 class DatabaseContext;
42 class TaskSynchronizer; 42 class TaskSynchronizer;
43 class DatabaseThread; 43 class DatabaseThread;
44 class ExecutionContext; 44 class ExecutionContext;
45 class SecurityOrigin; 45 class SecurityOrigin;
46 46
47 class DatabaseContext FINAL 47 class DatabaseContext FINAL
48 : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<DatabaseContext > 48 : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<DatabaseContext >
49 , public ActiveDOMObject 49 , public ActiveDOMObject {
50 , private WorkerGlobalScope::TerminationObserver {
51 public: 50 public:
52 friend class DatabaseManager; 51 friend class DatabaseManager;
53 52
54 static PassRefPtrWillBeRawPtr<DatabaseContext> create(ExecutionContext*); 53 static PassRefPtrWillBeRawPtr<DatabaseContext> create(ExecutionContext*);
55 54
56 virtual ~DatabaseContext(); 55 virtual ~DatabaseContext();
57 void trace(Visitor*); 56 void trace(Visitor*);
58 57
59 // For life-cycle management (inherited from ActiveDOMObject): 58 // For life-cycle management (inherited from ActiveDOMObject):
60 virtual void contextDestroyed() OVERRIDE; 59 virtual void contextDestroyed() OVERRIDE;
61 virtual void stop() OVERRIDE; 60 virtual void stop() OVERRIDE;
62 61
63 DatabaseContext* backend(); 62 DatabaseContext* backend();
64 DatabaseThread* databaseThread(); 63 DatabaseThread* databaseThread();
65 64
66 void setHasOpenDatabases() { m_hasOpenDatabases = true; } 65 void setHasOpenDatabases() { m_hasOpenDatabases = true; }
67 void didOpenDatabase(DatabaseBackendBase&);
68 void didCloseDatabase(DatabaseBackendBase&);
69 // Blocks the caller thread until cleanup tasks are completed. 66 // Blocks the caller thread until cleanup tasks are completed.
70 void stopDatabases(); 67 void stopDatabases();
71 68
72 bool allowDatabaseAccess() const; 69 bool allowDatabaseAccess() const;
73 70
74 SecurityOrigin* securityOrigin() const; 71 SecurityOrigin* securityOrigin() const;
75 bool isContextThread() const; 72 bool isContextThread() const;
76 73
77 private: 74 private:
78 explicit DatabaseContext(ExecutionContext*); 75 explicit DatabaseContext(ExecutionContext*);
79 76
80 virtual void wasRequestedToTerminate() OVERRIDE;
81 void stopSyncDatabases();
82
83 RefPtrWillBeMember<DatabaseThread> m_databaseThread; 77 RefPtrWillBeMember<DatabaseThread> m_databaseThread;
84 #if ENABLE(OILPAN)
85 class DatabaseCloser {
86 public:
87 explicit DatabaseCloser(DatabaseBackendBase& database) : m_database(data base) { }
88 ~DatabaseCloser();
89
90 private:
91 DatabaseBackendBase& m_database;
92 };
93 HeapHashMap<WeakMember<DatabaseBackendBase>, OwnPtr<DatabaseCloser> > m_open SyncDatabases;
94 #else
95 // The contents of m_openSyncDatabases are raw pointers. It's safe because
96 // DatabaseBackendSync is always closed before destruction.
97 HashSet<DatabaseBackendBase*> m_openSyncDatabases;
98 #endif
99 bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed. 78 bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed.
100 bool m_hasRequestedTermination; 79 bool m_hasRequestedTermination;
101 }; 80 };
102 81
103 } // namespace blink 82 } // namespace blink
104 83
105 #endif // DatabaseContext_h 84 #endif // DatabaseContext_h
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/DatabaseCallback.idl ('k') | Source/modules/webdatabase/DatabaseContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698