aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/db.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-28 11:39:02 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-28 11:39:02 +0000
commit7abe1f422c1a1230ad5b39474101806c438ef452 (patch)
tree2da2a92660b4410e91cb14c0dc3b9bbacdef08ef /crates/ra_ide_api/src/db.rs
parent6e36d3f6537f80071e7ed8ff45ca2271a9ffe7a7 (diff)
parent53e3e82d919e36cc2225d4f7f867a45f0cede53a (diff)
Merge #678
678: WIP: automatically collect garbage r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/db.rs')
-rw-r--r--crates/ra_ide_api/src/db.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index 3da93ec35..6850811d7 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -1,4 +1,7 @@
1use std::sync::Arc; 1use std::{
2 sync::Arc,
3 time,
4};
2 5
3use ra_db::{ 6use ra_db::{
4 CheckCanceled, FileId, Canceled, SourceDatabase, 7 CheckCanceled, FileId, Canceled, SourceDatabase,
@@ -17,6 +20,8 @@ use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}};
17pub(crate) struct RootDatabase { 20pub(crate) struct RootDatabase {
18 runtime: salsa::Runtime<RootDatabase>, 21 runtime: salsa::Runtime<RootDatabase>,
19 interner: Arc<hir::HirInterner>, 22 interner: Arc<hir::HirInterner>,
23 pub(crate) last_gc: time::Instant,
24 pub(crate) last_gc_check: time::Instant,
20} 25}
21 26
22impl salsa::Database for RootDatabase { 27impl salsa::Database for RootDatabase {
@@ -33,6 +38,8 @@ impl Default for RootDatabase {
33 let mut db = RootDatabase { 38 let mut db = RootDatabase {
34 runtime: salsa::Runtime::default(), 39 runtime: salsa::Runtime::default(),
35 interner: Default::default(), 40 interner: Default::default(),
41 last_gc: time::Instant::now(),
42 last_gc_check: time::Instant::now(),
36 }; 43 };
37 db.set_crate_graph(Default::default()); 44 db.set_crate_graph(Default::default());
38 db.set_local_roots(Default::default()); 45 db.set_local_roots(Default::default());
@@ -46,6 +53,8 @@ impl salsa::ParallelDatabase for RootDatabase {
46 salsa::Snapshot::new(RootDatabase { 53 salsa::Snapshot::new(RootDatabase {
47 runtime: self.runtime.snapshot(self), 54 runtime: self.runtime.snapshot(self),
48 interner: Arc::clone(&self.interner), 55 interner: Arc::clone(&self.interner),
56 last_gc: self.last_gc.clone(),
57 last_gc_check: self.last_gc_check.clone(),
49 }) 58 })
50 } 59 }
51} 60}