Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
6307ee4b
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6307ee4b
编写于
1月 03, 2017
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reformat all code parts
上级
1820c9cd
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
406 addition
and
396 deletion
+406
-396
src/anbox/application_manager.h
src/anbox/application_manager.h
+1
-1
src/anbox/cli.cpp
src/anbox/cli.cpp
+6
-3
src/anbox/cli.h
src/anbox/cli.h
+2
-2
src/anbox/common/message_channel.cpp
src/anbox/common/message_channel.cpp
+29
-30
src/anbox/common/message_channel.h
src/anbox/common/message_channel.h
+54
-54
src/anbox/common/scope_ptr.h
src/anbox/common/scope_ptr.h
+45
-44
src/anbox/container/client.cpp
src/anbox/container/client.cpp
+1
-1
src/anbox/dbus/skeleton/application_manager.cpp
src/anbox/dbus/skeleton/application_manager.cpp
+1
-1
src/anbox/graphics/emugl/RenderControl.cpp
src/anbox/graphics/emugl/RenderControl.cpp
+1
-1
src/anbox/graphics/emugl/RenderThread.h
src/anbox/graphics/emugl/RenderThread.h
+2
-2
src/anbox/graphics/emugl/Renderer.cpp
src/anbox/graphics/emugl/Renderer.cpp
+1
-1
src/anbox/graphics/emugl/WindowSurface.h
src/anbox/graphics/emugl/WindowSurface.h
+3
-1
src/anbox/logger.h
src/anbox/logger.h
+7
-2
src/anbox/testing/gtest_utils.h
src/anbox/testing/gtest_utils.h
+18
-18
src/anbox/ubuntu/keycode_converter.cpp
src/anbox/ubuntu/keycode_converter.cpp
+235
-235
未找到文件。
src/anbox/application_manager.h
浏览文件 @
6307ee4b
...
...
@@ -19,8 +19,8 @@
#define ANBOX_APPLICATION_MANAGER_H_
#include "anbox/android/intent.h"
#include "anbox/graphics/rect.h"
#include "anbox/do_not_copy_or_move.h"
#include "anbox/graphics/rect.h"
#include <string>
...
...
src/anbox/cli.cpp
浏览文件 @
6307ee4b
...
...
@@ -105,14 +105,16 @@ void cli::CommandWithSubcommands::help(std::ostream& out) {
<<
std
::
endl
;
if
(
flags_
.
size
()
>
0
)
{
out
<<
std
::
endl
<<
pattern
::
options
<<
std
::
endl
;
out
<<
std
::
endl
<<
pattern
::
options
<<
std
::
endl
;
for
(
const
auto
&
flag
:
flags_
)
out
<<
boost
::
format
(
pattern
::
option
)
%
flag
->
name
()
%
flag
->
description
()
<<
std
::
endl
;
}
if
(
commands_
.
size
()
>
0
)
{
out
<<
std
::
endl
<<
pattern
::
commands
<<
std
::
endl
;
out
<<
std
::
endl
<<
pattern
::
commands
<<
std
::
endl
;
for
(
const
auto
&
cmd
:
commands_
)
{
if
(
cmd
.
second
)
out
<<
boost
::
format
(
pattern
::
command
)
%
cmd
.
second
->
name
()
%
...
...
@@ -222,7 +224,8 @@ void cli::CommandWithFlagsAndAction::help(std::ostream& out) {
<<
std
::
endl
;
if
(
flags_
.
size
()
>
0
)
{
out
<<
std
::
endl
<<
boost
::
format
(
pattern
::
options
)
<<
std
::
endl
;
out
<<
std
::
endl
<<
boost
::
format
(
pattern
::
options
)
<<
std
::
endl
;
for
(
const
auto
&
flag
:
flags_
)
out
<<
boost
::
format
(
pattern
::
option
)
%
flag
->
name
()
%
flag
->
description
()
<<
std
::
endl
;
...
...
src/anbox/cli.h
浏览文件 @
6307ee4b
...
...
@@ -198,8 +198,8 @@ class Command : public DoNotCopyOrMove {
/// @brief Context bundles information passed to Command::run invocations.
struct
Context
{
std
::
istream
&
cin
;
///< The std::istream that should be used for reading.
std
::
ostream
&
cout
;
///< The std::ostream that should be used for writing.
std
::
istream
&
cin
;
///< The std::istream that should be used for reading.
std
::
ostream
&
cout
;
///< The std::ostream that should be used for writing.
std
::
vector
<
std
::
string
>
args
;
///< The command line args.
};
...
...
src/anbox/common/message_channel.cpp
浏览文件 @
6307ee4b
...
...
@@ -16,50 +16,49 @@
namespace
anbox
{
namespace
common
{
MessageChannelBase
::
MessageChannelBase
(
size_t
capacity
)
:
pos_
(
0U
),
count_
(
0U
),
capacity_
(
capacity
),
lock_
(),
can_read_
(),
can_write_
()
{}
MessageChannelBase
::
MessageChannelBase
(
size_t
capacity
)
:
pos_
(
0U
),
count_
(
0U
),
capacity_
(
capacity
),
lock_
(),
can_read_
(),
can_write_
()
{}
MessageChannelBase
::~
MessageChannelBase
()
{}
size_t
MessageChannelBase
::
before_write
()
{
std
::
unique_lock
<
std
::
mutex
>
l
(
lock_
,
std
::
defer_lock
);
lock_
.
lock
();
std
::
unique_lock
<
std
::
mutex
>
l
(
lock_
,
std
::
defer_lock
);
lock_
.
lock
();
while
(
count_
>=
capacity_
)
can_write_
.
wait
(
l
);
while
(
count_
>=
capacity_
)
can_write_
.
wait
(
l
);
size_t
result
=
pos_
+
count_
;
if
(
result
>=
capacity_
)
result
-=
capacity_
;
size_t
result
=
pos_
+
count_
;
if
(
result
>=
capacity_
)
result
-=
capacity_
;
return
result
;
return
result
;
}
void
MessageChannelBase
::
after_write
()
{
count_
++
;
can_read_
.
notify_one
();
lock_
.
unlock
();
count_
++
;
can_read_
.
notify_one
();
lock_
.
unlock
();
}
size_t
MessageChannelBase
::
before_read
()
{
std
::
unique_lock
<
std
::
mutex
>
l
(
lock_
,
std
::
defer_lock
);
lock_
.
lock
();
while
(
count_
==
0
)
can_read_
.
wait
(
l
);
return
pos_
;
std
::
unique_lock
<
std
::
mutex
>
l
(
lock_
,
std
::
defer_lock
);
lock_
.
lock
();
while
(
count_
==
0
)
can_read_
.
wait
(
l
);
return
pos_
;
}
void
MessageChannelBase
::
after_read
()
{
if
(
++
pos_
==
capacity_
)
pos_
=
0U
;
count_
--
;
can_write_
.
notify_one
();
lock_
.
unlock
();
if
(
++
pos_
==
capacity_
)
pos_
=
0U
;
count_
--
;
can_write_
.
notify_one
();
lock_
.
unlock
();
}
}
// namespace common
}
// namespace anbox
}
// namespace common
}
// namespace anbox
src/anbox/common/message_channel.h
浏览文件 @
6307ee4b
...
...
@@ -17,8 +17,8 @@
#include <stddef.h>
#include <mutex>
#include <condition_variable>
#include <mutex>
namespace
anbox
{
namespace
common
{
...
...
@@ -26,41 +26,41 @@ namespace common {
// Base non-templated class used to reduce the amount of template
// specialization.
class
MessageChannelBase
{
public:
// Constructor. |capacity| is the buffer capacity in messages.
MessageChannelBase
(
size_t
capacity
);
// Destructor.
~
MessageChannelBase
();
protected:
// Call this method in the sender thread before writing a new message.
// This returns the position of the available slot in the message array
// where to copy the new fixed-size message. After the copy, call
// afterWrite().
size_t
before_write
();
// To be called after beforeWrite() and copying a new fixed-size message
// into the array. This signal the receiver thread that there is a new
// incoming message.
void
after_write
();
// Call this method in the receiver thread before reading a new message.
// This returns the position in the message array where the new message
// can be read. Caller must process the message, then call afterRead().
size_t
before_read
();
// To be called in the receiver thread after beforeRead() and processing
// the corresponding message.
void
after_read
();
private:
size_t
pos_
;
size_t
count_
;
size_t
capacity_
;
std
::
mutex
lock_
;
std
::
condition_variable
can_read_
;
std
::
condition_variable
can_write_
;
public:
// Constructor. |capacity| is the buffer capacity in messages.
MessageChannelBase
(
size_t
capacity
);
// Destructor.
~
MessageChannelBase
();
protected:
// Call this method in the sender thread before writing a new message.
// This returns the position of the available slot in the message array
// where to copy the new fixed-size message. After the copy, call
// afterWrite().
size_t
before_write
();
// To be called after beforeWrite() and copying a new fixed-size message
// into the array. This signal the receiver thread that there is a new
// incoming message.
void
after_write
();
// Call this method in the receiver thread before reading a new message.
// This returns the position in the message array where the new message
// can be read. Caller must process the message, then call afterRead().
size_t
before_read
();
// To be called in the receiver thread after beforeRead() and processing
// the corresponding message.
void
after_read
();
private:
size_t
pos_
;
size_t
count_
;
size_t
capacity_
;
std
::
mutex
lock_
;
std
::
condition_variable
can_read_
;
std
::
condition_variable
can_write_
;
};
// Helper class used to implement an uni-directional IPC channel between
...
...
@@ -75,25 +75,25 @@ private:
//
template
<
typename
T
,
size_t
CAPACITY
>
class
MessageChannel
:
public
MessageChannelBase
{
public:
MessageChannel
()
:
MessageChannelBase
(
CAPACITY
)
{}
void
send
(
const
T
&
msg
)
{
size_t
pos
=
before_write
();
mItems
[
pos
]
=
msg
;
after_write
();
}
void
receive
(
T
*
msg
)
{
size_t
pos
=
before_read
();
*
msg
=
mItems
[
pos
];
after_read
();
}
private:
T
mItems
[
CAPACITY
];
public:
MessageChannel
()
:
MessageChannelBase
(
CAPACITY
)
{}
void
send
(
const
T
&
msg
)
{
size_t
pos
=
before_write
();
mItems
[
pos
]
=
msg
;
after_write
();
}
void
receive
(
T
*
msg
)
{
size_t
pos
=
before_read
();
*
msg
=
mItems
[
pos
];
after_read
();
}
private:
T
mItems
[
CAPACITY
];
};
}
// namespace common
}
// namespace anbox
}
// namespace anbox
#endif
src/anbox/common/scope_ptr.h
浏览文件 @
6307ee4b
...
...
@@ -23,48 +23,49 @@ namespace anbox {
namespace
common
{
struct
FreeDelete
{
template
<
class
T
>
void
operator
()(
T
ptr
)
const
{
free
((
void
*
)
ptr
);
}
template
<
class
T
>
void
operator
()(
T
ptr
)
const
{
free
((
void
*
)
ptr
);
}
};
template
<
class
Func
>
struct
FuncDelete
{
explicit
FuncDelete
(
Func
f
=
{})
:
mF
(
f
)
{}
FuncDelete
(
const
FuncDelete
&
other
)
=
default
;
FuncDelete
(
FuncDelete
&&
other
)
=
default
;
FuncDelete
&
operator
=
(
const
FuncDelete
&
other
)
=
default
;
FuncDelete
&
operator
=
(
FuncDelete
&&
other
)
=
default
;
// To be able to copy/move from all compatible template instantiations.
template
<
class
U
>
friend
struct
FuncDelete
;
// Template constructors and move assignment from compatible instantiations.
template
<
class
U
>
FuncDelete
(
const
FuncDelete
<
U
>&
other
)
:
mF
(
other
.
mF
)
{}
template
<
class
U
>
FuncDelete
(
FuncDelete
<
U
>&&
other
)
:
mF
(
std
::
move
(
other
.
mF
))
{}
template
<
class
U
>
FuncDelete
&
operator
=
(
const
FuncDelete
<
U
>&
other
)
{
mF
=
other
.
mF
;
return
*
this
;
}
template
<
class
U
>
FuncDelete
&
operator
=
(
FuncDelete
<
U
>&&
other
)
{
mF
=
std
::
move
(
other
.
mF
);
return
*
this
;
}
// This is the actual deleter call.
template
<
class
T
>
void
operator
()(
T
t
)
const
{
mF
(
t
);
}
private:
Func
mF
;
explicit
FuncDelete
(
Func
f
=
{})
:
mF
(
f
)
{}
FuncDelete
(
const
FuncDelete
&
other
)
=
default
;
FuncDelete
(
FuncDelete
&&
other
)
=
default
;
FuncDelete
&
operator
=
(
const
FuncDelete
&
other
)
=
default
;
FuncDelete
&
operator
=
(
FuncDelete
&&
other
)
=
default
;
// To be able to copy/move from all compatible template instantiations.
template
<
class
U
>
friend
struct
FuncDelete
;
// Template constructors and move assignment from compatible instantiations.
template
<
class
U
>
FuncDelete
(
const
FuncDelete
<
U
>&
other
)
:
mF
(
other
.
mF
)
{}
template
<
class
U
>
FuncDelete
(
FuncDelete
<
U
>&&
other
)
:
mF
(
std
::
move
(
other
.
mF
))
{}
template
<
class
U
>
FuncDelete
&
operator
=
(
const
FuncDelete
<
U
>&
other
)
{
mF
=
other
.
mF
;
return
*
this
;
}
template
<
class
U
>
FuncDelete
&
operator
=
(
FuncDelete
<
U
>&&
other
)
{
mF
=
std
::
move
(
other
.
mF
);
return
*
this
;
}
// This is the actual deleter call.
template
<
class
T
>
void
operator
()(
T
t
)
const
{
mF
(
t
);
}
private:
Func
mF
;
};
template
<
class
T
,
class
Deleter
=
std
::
default_delete
<
T
>
>
...
...
@@ -85,13 +86,13 @@ template <class T,
class
=
enable_if_c
<
std
::
is_same
<
T
,
std
::
nullptr_t
>
::
value
||
std
::
is_pointer
<
T
>::
value
>>
ScopedCustomPtr
<
typename
std
::
decay
<
typename
std
::
remove_pointer
<
T
>::
type
>::
type
,
typename
std
::
decay
<
Func
>::
type
>
typename
std
::
decay
<
typename
std
::
remove_pointer
<
T
>::
type
>::
type
,
typename
std
::
decay
<
Func
>::
type
>
makeCustomScopedPtr
(
T
data
,
Func
deleter
)
{
return
ScopedCustomPtr
<
typename
std
::
decay
<
typename
std
::
remove_pointer
<
T
>::
type
>::
type
,
typename
std
::
decay
<
Func
>::
type
>
(
data
,
FuncDelete
<
typename
std
::
decay
<
Func
>::
type
>
(
deleter
));
return
ScopedCustomPtr
<
typename
std
::
decay
<
typename
std
::
remove_pointer
<
T
>::
type
>::
type
,
typename
std
::
decay
<
Func
>::
type
>
(
data
,
FuncDelete
<
typename
std
::
decay
<
Func
>::
type
>
(
deleter
));
}
}
// namespace common
...
...
src/anbox/container/client.cpp
浏览文件 @
6307ee4b
...
...
@@ -18,11 +18,11 @@
#include "anbox/container/client.h"
#include "anbox/config.h"
#include "anbox/container/management_api_stub.h"
#include "anbox/logger.h"
#include "anbox/network/local_socket_messenger.h"
#include "anbox/rpc/channel.h"
#include "anbox/rpc/message_processor.h"
#include "anbox/rpc/pending_call_cache.h"
#include "anbox/logger.h"
namespace
ba
=
boost
::
asio
;
namespace
bs
=
boost
::
system
;
...
...
src/anbox/dbus/skeleton/application_manager.cpp
浏览文件 @
6307ee4b
...
...
@@ -45,7 +45,7 @@ ApplicationManager::ApplicationManager(
reader
>>
top
;
reader
>>
right
;
reader
>>
bottom
;
graphics
::
Rect
launch_bounds
{
left
,
top
,
right
,
bottom
};
graphics
::
Rect
launch_bounds
{
left
,
top
,
right
,
bottom
};
core
::
dbus
::
Message
::
Ptr
reply
;
...
...
src/anbox/graphics/emugl/RenderControl.cpp
浏览文件 @
6307ee4b
...
...
@@ -141,7 +141,7 @@ static EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size,
return
0
;
return
renderer
->
getConfigs
()
->
chooseConfig
(
attribs
,
(
EGLint
*
)
configs
,
(
EGLint
)
configs_size
);
(
EGLint
)
configs_size
);
}
static
EGLint
rcGetFBParam
(
EGLint
param
)
{
...
...
src/anbox/graphics/emugl/RenderThread.h
浏览文件 @
6307ee4b
...
...
@@ -36,7 +36,7 @@ class RenderThread : public emugl::Thread {
// decoding operations between all threads.
// TODO(digit): Why is this needed here? Shouldn't this be handled
// by the decoders themselves or at a lower-level?
static
RenderThread
*
create
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
,
IOStream
*
stream
,
emugl
::
Mutex
*
mutex
);
static
RenderThread
*
create
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
,
IOStream
*
stream
,
emugl
::
Mutex
*
mutex
);
// Destructor.
virtual
~
RenderThread
();
...
...
@@ -51,7 +51,7 @@ class RenderThread : public emugl::Thread {
private:
RenderThread
();
// No default constructor
RenderThread
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
,
IOStream
*
stream
,
emugl
::
Mutex
*
mutex
);
RenderThread
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
,
IOStream
*
stream
,
emugl
::
Mutex
*
mutex
);
virtual
intptr_t
main
();
...
...
src/anbox/graphics/emugl/Renderer.cpp
浏览文件 @
6307ee4b
...
...
@@ -215,7 +215,7 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
GL_LOG
(
"attempting to create egl context"
);
m_eglContext
=
s_egl
.
eglCreateContext
(
m_eglDisplay
,
m_eglConfig
,
EGL_NO_CONTEXT
,
glContextAttribs
);
EGL_NO_CONTEXT
,
glContextAttribs
);
if
(
m_eglContext
==
EGL_NO_CONTEXT
)
{
ERR
(
"Failed to create context 0x%x
\n
"
,
s_egl
.
eglGetError
());
free
(
gles1Extensions
);
...
...
src/anbox/graphics/emugl/WindowSurface.h
浏览文件 @
6307ee4b
...
...
@@ -56,7 +56,9 @@ class WindowSurface {
bool
flushColorBuffer
();
// Used by bind() below.
enum
BindType
{
BIND_READ
,
BIND_DRAW
,
BIND_READDRAW
};
enum
BindType
{
BIND_READ
,
BIND_DRAW
,
BIND_READDRAW
};
// TODO(digit): What is this used for exactly? For example, the
// mReadContext is never used by this class. The mDrawContext is only
...
...
src/anbox/logger.h
浏览文件 @
6307ee4b
...
...
@@ -33,11 +33,16 @@ class Logger : public DoNotCopyOrMove {
public:
// Severity enumerates all known severity levels
// applicable to log messages.
enum
class
Severity
{
kTrace
,
kDebug
,
kInfo
,
kWarning
,
kError
,
kFatal
};
enum
class
Severity
{
kTrace
,
kDebug
,
kInfo
,
kWarning
,
kError
,
kFatal
};
// A Location describes the origin of a log message.
struct
Location
{
std
::
string
file
;
// The name of the file that contains the log message.
std
::
string
file
;
// The name of the file that contains the log message.
std
::
string
function
;
// The function that contains the log message.
std
::
uint32_t
line
;
// The line in file that resulted in the log message.
};
...
...
src/anbox/testing/gtest_utils.h
浏览文件 @
6307ee4b
...
...
@@ -36,27 +36,27 @@ template <typename Range1,
common
::
is_range
<
Range2
>::
value
>>
inline
::
testing
::
AssertionResult
RangesMatch
(
const
Range1
&
expected
,
const
Range2
&
actual
)
{
const
auto
expectedSize
=
std
::
distance
(
std
::
begin
(
expected
),
std
::
end
(
expected
));
const
auto
actualSize
=
std
::
distance
(
std
::
begin
(
actual
),
std
::
end
(
actual
));
if
(
actualSize
!=
expectedSize
)
{
return
::
testing
::
AssertionFailure
()
<<
"actual range size "
<<
actualSize
<<
" != expected size "
<<
expectedSize
;
}
const
auto
expectedSize
=
std
::
distance
(
std
::
begin
(
expected
),
std
::
end
(
expected
));
const
auto
actualSize
=
std
::
distance
(
std
::
begin
(
actual
),
std
::
end
(
actual
));
if
(
actualSize
!=
expectedSize
)
{
return
::
testing
::
AssertionFailure
()
<<
"actual range size "
<<
actualSize
<<
" != expected size "
<<
expectedSize
;
}
auto
itExp
=
std
::
begin
(
expected
);
for
(
const
auto
&
act
:
actual
)
{
if
(
*
itExp
!=
act
)
{
const
auto
index
=
std
::
distance
(
std
::
begin
(
expected
),
itExp
);
return
::
testing
::
AssertionFailure
()
<<
"range["
<<
index
<<
"] ("
<<
act
<<
") != expected["
<<
index
<<
"] ("
<<
*
itExp
<<
")"
;
}
++
itExp
;
auto
itExp
=
std
::
begin
(
expected
);
for
(
const
auto
&
act
:
actual
)
{
if
(
*
itExp
!=
act
)
{
const
auto
index
=
std
::
distance
(
std
::
begin
(
expected
),
itExp
);
return
::
testing
::
AssertionFailure
()
<<
"range["
<<
index
<<
"] ("
<<
act
<<
") != expected["
<<
index
<<
"] ("
<<
*
itExp
<<
")"
;
}
++
itExp
;
}
return
::
testing
::
AssertionSuccess
();
return
::
testing
::
AssertionSuccess
();
}
}
// namespace testing
}
// namespace anbox
src/anbox/ubuntu/keycode_converter.cpp
浏览文件 @
6307ee4b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录