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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 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 21 matching lines...) Expand all
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/events/EventQueue.h" 34 #include "core/events/EventQueue.h"
35 #include "modules/IndexedDBNames.h" 35 #include "modules/IndexedDBNames.h"
36 #include "modules/indexeddb/IDBDatabase.h" 36 #include "modules/indexeddb/IDBDatabase.h"
37 #include "modules/indexeddb/IDBEventDispatcher.h" 37 #include "modules/indexeddb/IDBEventDispatcher.h"
38 #include "modules/indexeddb/IDBIndex.h" 38 #include "modules/indexeddb/IDBIndex.h"
39 #include "modules/indexeddb/IDBObjectStore.h" 39 #include "modules/indexeddb/IDBObjectStore.h"
40 #include "modules/indexeddb/IDBOpenDBRequest.h" 40 #include "modules/indexeddb/IDBOpenDBRequest.h"
41 #include "modules/indexeddb/IDBTracing.h" 41 #include "modules/indexeddb/IDBTracing.h"
42 #include "wtf/PtrUtil.h"
43 #include <memory>
44 42
45 using blink::WebIDBDatabase; 43 using blink::WebIDBDatabase;
46 44
47 namespace blink { 45 namespace blink {
48 46
49 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con st HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* d b) 47 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con st HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* d b)
50 { 48 {
51 IDBOpenDBRequest* openDBRequest = nullptr; 49 IDBOpenDBRequest* openDBRequest = nullptr;
52 IDBTransaction* transaction = new IDBTransaction(scriptState, id, objectStor eNames, mode, db, openDBRequest, IDBDatabaseMetadata()); 50 IDBTransaction* transaction = new IDBTransaction(scriptState, id, objectStor eNames, mode, db, openDBRequest, IDBDatabaseMetadata());
53 transaction->suspendIfNeeded(); 51 transaction->suspendIfNeeded();
54 return transaction; 52 return transaction;
55 } 53 }
56 54
57 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDB Database* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previo usMetadata) 55 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDB Database* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previo usMetadata)
58 { 56 {
59 IDBTransaction* transaction = new IDBTransaction(scriptState, id, HashSet<St ring>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata ); 57 IDBTransaction* transaction = new IDBTransaction(scriptState, id, HashSet<St ring>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata );
60 transaction->suspendIfNeeded(); 58 transaction->suspendIfNeeded();
61 return transaction; 59 return transaction;
62 } 60 }
63 61
64 namespace { 62 namespace {
65 63
66 class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask { 64 class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask {
67 public: 65 public:
68 static std::unique_ptr<DeactivateTransactionTask> create(IDBTransaction* tra nsaction) 66 static PassOwnPtr<DeactivateTransactionTask> create(IDBTransaction* transact ion)
69 { 67 {
70 return wrapUnique(new DeactivateTransactionTask(transaction)); 68 return adoptPtr(new DeactivateTransactionTask(transaction));
71 } 69 }
72 70
73 void run() override 71 void run() override
74 { 72 {
75 m_transaction->setActive(false); 73 m_transaction->setActive(false);
76 m_transaction.clear(); 74 m_transaction.clear();
77 } 75 }
78 76
79 private: 77 private:
80 explicit DeactivateTransactionTask(IDBTransaction* transaction) 78 explicit DeactivateTransactionTask(IDBTransaction* transaction)
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 event->setTarget(this); 421 event->setTarget(this);
424 eventQueue->enqueueEvent(event); 422 eventQueue->enqueueEvent(event);
425 } 423 }
426 424
427 WebIDBDatabase* IDBTransaction::backendDB() const 425 WebIDBDatabase* IDBTransaction::backendDB() const
428 { 426 {
429 return m_database->backend(); 427 return m_database->backend();
430 } 428 }
431 429
432 } // namespace blink 430 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698