Shaka Player Embedded
shaka
src
core
network_thread.h
Go to the documentation of this file.
1
// Copyright 2018 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_CORE_NETWORK_THREAD_H_
16
#define SHAKA_EMBEDDED_CORE_NETWORK_THREAD_H_
17
18
#include <atomic>
19
#include <vector>
20
21
#include "
src/core/ref_ptr.h
"
22
#include "
src/debug/mutex.h
"
23
#include "
src/debug/thread.h
"
24
#include "
src/debug/thread_event.h
"
25
26
typedef
void
CURLM
;
27
28
namespace
shaka
{
29
30
namespace
js {
31
class
XMLHttpRequest;
32
}
// namespace js
33
41
class
NetworkThread
{
42
public
:
43
NetworkThread
();
44
~
NetworkThread
();
45
47
void
Stop();
48
50
bool
ContainsRequest(
RefPtr<js::XMLHttpRequest>
request)
const
;
51
58
void
AddRequest(
RefPtr<js::XMLHttpRequest>
request);
59
65
void
AbortRequest(
RefPtr<js::XMLHttpRequest>
request);
66
67
private
:
68
void
ThreadMain();
69
70
mutable
Mutex
mutex_;
71
ThreadEvent<void>
cond_;
72
std::vector<RefPtr<js::XMLHttpRequest>> requests_;
73
CURLM
* multi_handle_;
74
std::atomic<bool> shutdown_;
75
76
Thread
thread_;
77
};
78
79
}
// namespace shaka
80
81
#endif // SHAKA_EMBEDDED_CORE_NETWORK_THREAD_H_
shaka::Thread
Definition:
thread.h:24
ref_ptr.h
shaka
Definition:
async_results.h:25
CURLM
void CURLM
Definition:
network_thread.h:26
shaka::Mutex
Definition:
mutex.h:155
thread.h
shaka::ThreadEvent< void >
shaka::RefPtr
Definition:
ref_ptr.h:43
shaka::NetworkThread
Definition:
network_thread.h:41
mutex.h
thread_event.h
Generated by
1.8.13