mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
net: Avoid all-encompassing synchronous IPC return type for IndexedDB operations (#37576)
This is finishing some incomplete cleanup from #33044. Kitchen sink enum types like IndexedDBThreadReturnType make code harder to read and require ignoring variants that will never be sent in many cases. Testing: No behaviour change; existing WPT tests suffice. Fixes: part of #6963 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
3774ef00d4
commit
30ad91b595
3 changed files with 11 additions and 27 deletions
|
@ -11,7 +11,7 @@ use std::thread;
|
|||
use ipc_channel::ipc::{self, IpcError, IpcReceiver, IpcSender};
|
||||
use log::{debug, warn};
|
||||
use net_traits::indexeddb_thread::{
|
||||
AsyncOperation, IndexedDBThreadMsg, IndexedDBThreadReturnType, IndexedDBTxnMode, SyncOperation,
|
||||
AsyncOperation, IndexedDBThreadMsg, IndexedDBTxnMode, SyncOperation,
|
||||
};
|
||||
use servo_config::pref;
|
||||
use servo_url::origin::ImmutableOrigin;
|
||||
|
@ -315,9 +315,7 @@ impl IndexedDBManager {
|
|||
},
|
||||
SyncOperation::Commit(sender, _origin, _db_name, _txn) => {
|
||||
// FIXME:(arihant2math) This does nothing at the moment
|
||||
sender
|
||||
.send(IndexedDBThreadReturnType::Commit(Err(())))
|
||||
.expect("Could not send commit status");
|
||||
sender.send(Err(())).expect("Could not send commit status");
|
||||
},
|
||||
SyncOperation::UpgradeVersion(sender, origin, db_name, _txn, version) => {
|
||||
if let Some(db) = self.get_database_mut(origin, db_name) {
|
||||
|
@ -327,9 +325,7 @@ impl IndexedDBManager {
|
|||
// FIXME:(arihant2math) Get the version from the database instead
|
||||
// We never fail as of now, so we can just return it like this
|
||||
// for now...
|
||||
sender
|
||||
.send(IndexedDBThreadReturnType::UpgradeVersion(Ok(version)))
|
||||
.expect("Could not upgrade version");
|
||||
sender.send(Ok(version)).expect("Could not upgrade version");
|
||||
},
|
||||
SyncOperation::CreateObjectStore(
|
||||
sender,
|
||||
|
@ -367,7 +363,7 @@ impl IndexedDBManager {
|
|||
},
|
||||
SyncOperation::Exit(sender) => {
|
||||
// FIXME:(rasviitanen) Nothing to do?
|
||||
let _ = sender.send(IndexedDBThreadReturnType::Exit);
|
||||
let _ = sender.send(());
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue