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

Side by Side Diff: Source/modules/indexeddb/IDBTransaction.cpp

Issue 555633002: Make IDBTransaction ctor take ScriptState instead of ExecutionContext (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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 26 matching lines...) Expand all
37 #include "modules/indexeddb/IDBIndex.h" 37 #include "modules/indexeddb/IDBIndex.h"
38 #include "modules/indexeddb/IDBObjectStore.h" 38 #include "modules/indexeddb/IDBObjectStore.h"
39 #include "modules/indexeddb/IDBOpenDBRequest.h" 39 #include "modules/indexeddb/IDBOpenDBRequest.h"
40 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" 40 #include "modules/indexeddb/IDBPendingTransactionMonitor.h"
41 #include "modules/indexeddb/IDBTracing.h" 41 #include "modules/indexeddb/IDBTracing.h"
42 42
43 using blink::WebIDBDatabase; 43 using blink::WebIDBDatabase;
44 44
45 namespace blink { 45 namespace blink {
46 46
47 IDBTransaction* IDBTransaction::create(ExecutionContext* context, int64_t id, co nst Vector<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* d b) 47 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con st Vector<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db )
48 { 48 {
49 IDBOpenDBRequest* openDBRequest = 0; 49 IDBOpenDBRequest* openDBRequest = 0;
50 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new IDBTransaction(context, id, objectStoreNames, mode, db, openDBRequest, IDBDataba seMetadata())); 50 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new IDBTransaction(scriptState, id, objectStoreNames, mode, db, openDBRequest, IDBDa tabaseMetadata()));
51 transaction->suspendIfNeeded(); 51 transaction->suspendIfNeeded();
52 return transaction; 52 return transaction;
53 } 53 }
54 54
55 IDBTransaction* IDBTransaction::create(ExecutionContext* context, int64_t id, ID BDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previ ousMetadata) 55 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDB Database* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previo usMetadata)
56 { 56 {
57 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new IDBTransaction(context, id, Vector<String>(), WebIDBTransactionModeVersionChange , db, openDBRequest, previousMetadata)); 57 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new IDBTransaction(scriptState, id, Vector<String>(), WebIDBTransactionModeVersionCh ange, db, openDBRequest, previousMetadata));
58 transaction->suspendIfNeeded(); 58 transaction->suspendIfNeeded();
59 return transaction; 59 return transaction;
60 } 60 }
61 61
62 IDBTransaction::IDBTransaction(ExecutionContext* context, int64_t id, const Vect or<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db, IDBOp enDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata) 62 IDBTransaction::IDBTransaction(ScriptState* scriptState, int64_t id, const Vecto r<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db, IDBOpe nDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata)
63 : ActiveDOMObject(context) 63 : ActiveDOMObject(scriptState->executionContext())
64 , m_id(id) 64 , m_id(id)
65 , m_database(db) 65 , m_database(db)
66 , m_objectStoreNames(objectStoreNames) 66 , m_objectStoreNames(objectStoreNames)
67 , m_openDBRequest(openDBRequest) 67 , m_openDBRequest(openDBRequest)
68 , m_mode(mode) 68 , m_mode(mode)
69 , m_state(Active) 69 , m_state(Active)
70 , m_hasPendingActivity(true) 70 , m_hasPendingActivity(true)
71 , m_contextStopped(false) 71 , m_contextStopped(false)
72 , m_previousMetadata(previousMetadata) 72 , m_previousMetadata(previousMetadata)
73 { 73 {
74 if (mode == WebIDBTransactionModeVersionChange) { 74 if (mode == WebIDBTransactionModeVersionChange) {
75 // Not active until the callback. 75 // Not active until the callback.
76 m_state = Inactive; 76 m_state = Inactive;
77 } 77 }
78 78
79 if (m_state == Active) 79 if (m_state == Active)
80 IDBPendingTransactionMonitor::from(*context).addNewTransaction(*this); 80 IDBPendingTransactionMonitor::from(*scriptState->executionContext()).add NewTransaction(*this);
81 m_database->transactionCreated(this); 81 m_database->transactionCreated(this);
82 } 82 }
83 83
84 IDBTransaction::~IDBTransaction() 84 IDBTransaction::~IDBTransaction()
85 { 85 {
86 ASSERT(m_state == Finished || m_contextStopped); 86 ASSERT(m_state == Finished || m_contextStopped);
87 ASSERT(m_requestList.isEmpty() || m_contextStopped); 87 ASSERT(m_requestList.isEmpty() || m_contextStopped);
88 } 88 }
89 89
90 void IDBTransaction::trace(Visitor* visitor) 90 void IDBTransaction::trace(Visitor* visitor)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 event->setTarget(this); 372 event->setTarget(this);
373 eventQueue->enqueueEvent(event); 373 eventQueue->enqueueEvent(event);
374 } 374 }
375 375
376 WebIDBDatabase* IDBTransaction::backendDB() const 376 WebIDBDatabase* IDBTransaction::backendDB() const
377 { 377 {
378 return m_database->backend(); 378 return m_database->backend();
379 } 379 }
380 380
381 } // namespace blink 381 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBTransaction.h ('k') | Source/modules/indexeddb/IDBTransactionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698