Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
eec6d099
Commit
eec6d099
authored
Feb 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Service: use DatabaseListener instead of Instance
Don't use the global variable "instance".
parent
c5fa8ed3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
Main.cxx
src/Main.cxx
+1
-1
Service.hxx
src/db/update/Service.hxx
+5
-1
UpdateGlue.cxx
src/db/update/UpdateGlue.cxx
+6
-4
No files found.
src/Main.cxx
View file @
eec6d099
...
@@ -211,7 +211,7 @@ glue_db_init_and_load(void)
...
@@ -211,7 +211,7 @@ glue_db_init_and_load(void)
return
true
;
return
true
;
SimpleDatabase
&
db
=
*
(
SimpleDatabase
*
)
instance
->
database
;
SimpleDatabase
&
db
=
*
(
SimpleDatabase
*
)
instance
->
database
;
instance
->
update
=
new
UpdateService
(
*
main_loop
,
db
);
instance
->
update
=
new
UpdateService
(
*
main_loop
,
db
,
*
instance
);
/* run database update after daemonization? */
/* run database update after daemonization? */
return
db
.
FileExists
();
return
db
.
FileExists
();
...
...
src/db/update/Service.hxx
View file @
eec6d099
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "thread/Thread.hxx"
#include "thread/Thread.hxx"
class
SimpleDatabase
;
class
SimpleDatabase
;
class
DatabaseListener
;
/**
/**
* This class manages the update queue and runs the update thread.
* This class manages the update queue and runs the update thread.
...
@@ -40,6 +41,8 @@ class UpdateService final : DeferredMonitor {
...
@@ -40,6 +41,8 @@ class UpdateService final : DeferredMonitor {
SimpleDatabase
&
db
;
SimpleDatabase
&
db
;
DatabaseListener
&
listener
;
Progress
progress
;
Progress
progress
;
bool
modified
;
bool
modified
;
...
@@ -57,7 +60,8 @@ class UpdateService final : DeferredMonitor {
...
@@ -57,7 +60,8 @@ class UpdateService final : DeferredMonitor {
UpdateWalk
walk
;
UpdateWalk
walk
;
public
:
public
:
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
);
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
DatabaseListener
&
_listener
);
/**
/**
* Returns a non-zero job id when we are currently updating
* Returns a non-zero job id when we are currently updating
...
...
src/db/update/UpdateGlue.cxx
View file @
eec6d099
...
@@ -20,11 +20,11 @@
...
@@ -20,11 +20,11 @@
#include "config.h"
#include "config.h"
#include "Service.hxx"
#include "Service.hxx"
#include "UpdateDomain.hxx"
#include "UpdateDomain.hxx"
#include "db/DatabaseListener.hxx"
#include "db/plugins/SimpleDatabasePlugin.hxx"
#include "db/plugins/SimpleDatabasePlugin.hxx"
#include "Idle.hxx"
#include "Idle.hxx"
#include "util/Error.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
#include "Log.hxx"
#include "Main.hxx"
#include "Instance.hxx"
#include "Instance.hxx"
#include "system/FatalError.hxx"
#include "system/FatalError.hxx"
#include "thread/Id.hxx"
#include "thread/Id.hxx"
...
@@ -139,7 +139,7 @@ UpdateService::RunDeferred()
...
@@ -139,7 +139,7 @@ UpdateService::RunDeferred()
if
(
modified
)
if
(
modified
)
/* send "idle" events */
/* send "idle" events */
instance
->
DatabaseModified
();
listener
.
On
DatabaseModified
();
auto
i
=
queue
.
Pop
();
auto
i
=
queue
.
Pop
();
if
(
i
.
IsDefined
())
{
if
(
i
.
IsDefined
())
{
...
@@ -150,8 +150,10 @@ UpdateService::RunDeferred()
...
@@ -150,8 +150,10 @@ UpdateService::RunDeferred()
}
}
}
}
UpdateService
::
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
)
UpdateService
::
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
:
DeferredMonitor
(
_loop
),
db
(
_db
),
progress
(
UPDATE_PROGRESS_IDLE
),
DatabaseListener
&
_listener
)
:
DeferredMonitor
(
_loop
),
db
(
_db
),
listener
(
_listener
),
progress
(
UPDATE_PROGRESS_IDLE
),
update_task_id
(
0
),
update_task_id
(
0
),
walk
(
_loop
)
walk
(
_loop
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment