Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
536
Issue boards
Milestones
Wiki
Code
Merge requests
16
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
162f0a0b
Commit
162f0a0b
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
We do not need app instance to start jobs
parent
a23c50b4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/VLCApplication.java
+6
-6
6 additions, 6 deletions
vlc-android/src/org/videolan/vlc/VLCApplication.java
with
6 additions
and
6 deletions
vlc-android/src/org/videolan/vlc/VLCApplication.java
+
6
−
6
View file @
162f0a0b
...
...
@@ -71,7 +71,7 @@ public class VLCApplication extends Application {
private
static
SimpleArrayMap
<
String
,
WeakReference
<
Object
>>
sDataMap
=
new
SimpleArrayMap
<>();
/* Up to 2 threads maximum, inactive threads are killed after 2 seconds */
private
final
int
maxThreads
=
Math
.
max
(
AndroidUtil
.
isJellyBeanMR1OrLater
?
Runtime
.
getRuntime
().
availableProcessors
()
:
2
,
1
);
private
static
final
int
maxThreads
=
Math
.
max
(
AndroidUtil
.
isJellyBeanMR1OrLater
?
Runtime
.
getRuntime
().
availableProcessors
()
:
2
,
1
);
public
static
final
ThreadFactory
THREAD_FACTORY
=
new
ThreadFactory
()
{
@Override
public
Thread
newThread
(
Runnable
runnable
)
{
...
...
@@ -80,9 +80,9 @@ public class VLCApplication extends Application {
return
thread
;
}
};
private
final
ThreadPoolExecutor
mT
hreadPool
=
new
ThreadPoolExecutor
(
Math
.
min
(
2
,
maxThreads
),
maxThreads
,
30
,
TimeUnit
.
SECONDS
,
private
static
final
ThreadPoolExecutor
t
hreadPool
=
new
ThreadPoolExecutor
(
Math
.
min
(
2
,
maxThreads
),
maxThreads
,
30
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(),
THREAD_FACTORY
);
private
Handler
mH
andler
=
new
Handler
(
Looper
.
getMainLooper
());
private
static
final
Handler
h
andler
=
new
Handler
(
Looper
.
getMainLooper
());
private
static
int
sDialogCounter
=
0
;
...
...
@@ -167,16 +167,16 @@ public class VLCApplication extends Application {
public
static
void
runBackground
(
Runnable
runnable
)
{
if
(
Looper
.
myLooper
()
!=
Looper
.
getMainLooper
())
runnable
.
run
();
else
instance
.
mT
hreadPool
.
execute
(
runnable
);
else
t
hreadPool
.
execute
(
runnable
);
}
public
static
void
runOnMainThread
(
Runnable
runnable
)
{
if
(
Looper
.
myLooper
()
==
Looper
.
getMainLooper
())
runnable
.
run
();
else
instance
.
mH
andler
.
post
(
runnable
);
else
h
andler
.
post
(
runnable
);
}
public
static
boolean
removeTask
(
Runnable
runnable
)
{
return
instance
.
mT
hreadPool
.
remove
(
runnable
);
return
t
hreadPool
.
remove
(
runnable
);
}
public
static
void
storeData
(
String
key
,
Object
data
)
{
...
...
This diff is collapsed.
Click to expand it.
Geoffrey Métais
@Dekans
mentioned in commit
dcc31d62
·
6 years ago
mentioned in commit
dcc31d62
mentioned in commit dcc31d62a0702151cce4c59a8403fb10fdbe1de5
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment