Shaka Player Embedded
request_impls.h
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_JS_IDB_REQUEST_IMPLS_H_
16 #define SHAKA_EMBEDDED_JS_IDB_REQUEST_IMPLS_H_
17 
18 #include "shaka/optional.h"
19 #include "src/core/member.h"
20 #include "src/core/ref_ptr.h"
21 #include "src/js/idb/database.pb.h"
22 #include "src/js/idb/idb_utils.h"
23 #include "src/js/idb/request.h"
24 
25 namespace shaka {
26 namespace js {
27 namespace idb {
28 
29 class IDBCursor;
30 
31 class IDBGetRequest : public IDBRequest {
32  public:
36  ~IDBGetRequest() override;
37 
38  void PerformOperation(SqliteTransaction* transaction) override;
39 
40  private:
41  const IdbKeyType key_;
42 };
43 
44 class IDBStoreRequest : public IDBRequest {
45  public:
49  optional<IdbKeyType> key, bool no_override);
50  ~IDBStoreRequest() override;
51 
52  void PerformOperation(SqliteTransaction* transaction) override;
53 
54  private:
55  const proto::Value value_;
56  const optional<IdbKeyType> key_;
57  const bool no_override_;
58 };
59 
60 class IDBDeleteRequest : public IDBRequest {
61  public:
65  ~IDBDeleteRequest() override;
66 
67  void PerformOperation(SqliteTransaction* transaction) override;
68 
69  private:
70  const IdbKeyType key_;
71 };
72 
74  public:
78  uint32_t count);
79  ~IDBIterateCursorRequest() override;
80 
81  void Trace(memory::HeapTracer* tracer) const override;
82  void PerformOperation(SqliteTransaction* transaction) override;
83 
84  uint32_t count;
85 
86  private:
87  const Member<IDBCursor> cursor_;
88 };
89 
90 } // namespace idb
91 } // namespace js
92 } // namespace shaka
93 
94 #endif // SHAKA_EMBEDDED_JS_IDB_REQUEST_IMPLS_H_
void Trace(memory::HeapTracer *tracer) const override
Definition: request.cc:40
optional< variant< Member< IDBObjectStore >, Member< IDBCursor > > > source
Definition: request.h:72
int64_t IdbKeyType
Definition: idb_utils.h:29
void PerformOperation(SqliteTransaction *transaction) override
Member< IDBTransaction > transaction
Definition: request.h:73
IDBGetRequest(optional< variant< Member< IDBObjectStore >, Member< IDBCursor >>> source, RefPtr< IDBTransaction > transaction, IdbKeyType key)