Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
3f269db7
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f269db7
编写于
3月 23, 2017
作者:
C
Chinmay Garde
提交者:
GitHub
3月 23, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the interactive mode on the Linux test shell. (#3510)
上级
92c357ed
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
6 addition
and
443 deletion
+6
-443
shell/platform/linux/BUILD.gn
shell/platform/linux/BUILD.gn
+0
-5
shell/platform/linux/main_linux.cc
shell/platform/linux/main_linux.cc
+6
-64
shell/platform/linux/message_pump_glfw.cc
shell/platform/linux/message_pump_glfw.cc
+0
-81
shell/platform/linux/message_pump_glfw.h
shell/platform/linux/message_pump_glfw.h
+0
-41
shell/platform/linux/platform_view_glfw.cc
shell/platform/linux/platform_view_glfw.cc
+0
-191
shell/platform/linux/platform_view_glfw.h
shell/platform/linux/platform_view_glfw.h
+0
-57
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+0
-4
未找到文件。
shell/platform/linux/BUILD.gn
浏览文件 @
3f269db7
...
...
@@ -7,10 +7,6 @@ executable("linux") {
sources = [
"main_linux.cc",
"message_pump_glfw.cc",
"message_pump_glfw.h",
"platform_view_glfw.cc",
"platform_view_glfw.h",
]
deps = [
...
...
@@ -26,7 +22,6 @@ executable("linux") {
# Required by FontCacheLinux. Not Skia. Skia uses a custom font manager
# that delegates to us.
"//third_party:fontconfig",
"//third_party/glfw",
"//third_party/skia",
]
...
...
shell/platform/linux/main_linux.cc
浏览文件 @
3f269db7
...
...
@@ -8,11 +8,9 @@
#include "base/message_loop/message_loop.h"
#include "dart/runtime/bin/embedded_dart_io.h"
#include "flutter/common/threads.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/linux/message_pump_glfw.h"
#include "flutter/shell/platform/linux/platform_view_glfw.h"
#include "flutter/shell/testing/test_runner.h"
#include "flutter/shell/testing/testing.h"
#include "flutter/sky/engine/public/web/Sky.h"
...
...
@@ -113,57 +111,6 @@ void RunNonInteractive(ftl::CommandLine initial_command_line,
exit
(
ConvertErrorTypeToExitCode
(
error
));
}
static
bool
IsDartFile
(
const
std
::
string
&
path
)
{
std
::
string
dart_extension
=
".dart"
;
return
path
.
rfind
(
dart_extension
)
==
(
path
.
size
()
-
dart_extension
.
size
());
}
int
RunInteractive
(
ftl
::
CommandLine
initial_command_line
)
{
base
::
MessageLoop
message_loop
(
shell
::
MessagePumpGLFW
::
Create
());
shell
::
Shell
::
InitStandalone
(
std
::
move
(
initial_command_line
));
const
auto
&
command_line
=
shell
::
Shell
::
Shared
().
GetCommandLine
();
std
::
string
target
=
command_line
.
GetOptionValueWithDefault
(
shell
::
FlagForSwitch
(
shell
::
Switch
::
FLX
),
""
);
if
(
target
.
empty
())
{
// Alternatively, use the first positional argument.
auto
args
=
command_line
.
positional_args
();
if
(
args
.
empty
())
return
1
;
target
=
args
[
0
];
}
if
(
target
.
empty
())
return
1
;
std
::
unique_ptr
<
shell
::
PlatformViewGLFW
>
platform_view
(
new
shell
::
PlatformViewGLFW
());
platform_view
->
NotifyCreated
(
std
::
make_unique
<
shell
::
GPUSurfaceGL
>
(
platform_view
.
get
()));
blink
::
Threads
::
UI
()
->
PostTask
(
[
engine
=
platform_view
->
engine
().
GetWeakPtr
(),
target
]
{
if
(
engine
)
{
if
(
IsDartFile
(
target
))
{
engine
->
RunBundleAndSource
(
std
::
string
(),
target
,
std
::
string
());
}
else
{
engine
->
RunBundle
(
target
);
}
}
});
message_loop
.
Run
();
platform_view
->
NotifyDestroyed
();
return
0
;
}
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -176,16 +123,11 @@ int main(int argc, char* argv[]) {
if
(
command_line
.
HasOption
(
shell
::
FlagForSwitch
(
shell
::
Switch
::
Help
)))
{
shell
::
PrintUsage
(
"sky_shell"
);
return
0
;
}
if
(
command_line
.
HasOption
(
shell
::
FlagForSwitch
(
shell
::
Switch
::
NonInteractive
)))
{
bool
run_forever
=
command_line
.
HasOption
(
shell
::
FlagForSwitch
(
shell
::
Switch
::
RunForever
));
RunNonInteractive
(
std
::
move
(
command_line
),
run_forever
);
return
0
;
return
EXIT_SUCCESS
;
}
return
RunInteractive
(
std
::
move
(
command_line
));
bool
run_forever
=
command_line
.
HasOption
(
shell
::
FlagForSwitch
(
shell
::
Switch
::
RunForever
));
RunNonInteractive
(
std
::
move
(
command_line
),
run_forever
);
return
EXIT_SUCCESS
;
}
shell/platform/linux/message_pump_glfw.cc
已删除
100644 → 0
浏览文件 @
92c357ed
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/platform/linux/message_pump_glfw.h"
#include <GLFW/glfw3.h>
#include "base/auto_reset.h"
#include "base/time/time.h"
namespace
shell
{
MessagePumpGLFW
::
MessagePumpGLFW
()
:
in_run_
(
false
),
should_quit_
(
false
)
{}
MessagePumpGLFW
::~
MessagePumpGLFW
()
=
default
;
scoped_ptr
<
base
::
MessagePump
>
MessagePumpGLFW
::
Create
()
{
return
scoped_ptr
<
MessagePump
>
(
new
MessagePumpGLFW
());
}
void
MessagePumpGLFW
::
Run
(
Delegate
*
delegate
)
{
base
::
AutoReset
<
bool
>
auto_reset_keep_running
(
&
should_quit_
,
false
);
base
::
AutoReset
<
bool
>
auto_reset_in_run
(
&
in_run_
,
true
);
for
(;;)
{
bool
did_work
=
delegate
->
DoWork
();
if
(
should_quit_
)
break
;
did_work
|=
delegate
->
DoDelayedWork
(
&
delayed_work_time_
);
if
(
should_quit_
)
break
;
if
(
did_work
)
continue
;
did_work
=
delegate
->
DoIdleWork
();
if
(
should_quit_
)
break
;
if
(
did_work
)
continue
;
if
(
delayed_work_time_
.
is_null
())
{
glfwWaitEvents
();
}
else
{
base
::
TimeDelta
delay
=
delayed_work_time_
-
base
::
TimeTicks
::
Now
();
if
(
delay
>
base
::
TimeDelta
())
{
glfwWaitEventsTimeout
(
delay
.
InSecondsF
());
}
else
{
// It looks like delayed_work_time_ indicates a time in the past, so we
// need to call DoDelayedWork now.
delayed_work_time_
=
base
::
TimeTicks
();
}
}
if
(
should_quit_
)
break
;
}
}
void
MessagePumpGLFW
::
Quit
()
{
DCHECK
(
in_run_
)
<<
"Quit was called outside of Run!"
;
should_quit_
=
true
;
ScheduleWork
();
}
void
MessagePumpGLFW
::
ScheduleWork
()
{
glfwPostEmptyEvent
();
}
void
MessagePumpGLFW
::
ScheduleDelayedWork
(
const
base
::
TimeTicks
&
delayed_work_time
)
{
// We know that we can't be blocked on Wait right now since this method can
// only be called on the same thread as Run, so we only need to update our
// record of how long to sleep when we do sleep.
delayed_work_time_
=
delayed_work_time
;
}
}
// namespace shell
shell/platform/linux/message_pump_glfw.h
已删除
100644 → 0
浏览文件 @
92c357ed
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_PLATFORM_GLFW_MESSAGE_PUMP_GLFW_H_
#define SHELL_PLATFORM_GLFW_MESSAGE_PUMP_GLFW_H_
#include "lib/ftl/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_pump.h"
#include "base/time/time.h"
namespace
shell
{
class
MessagePumpGLFW
:
public
base
::
MessagePump
{
public:
MessagePumpGLFW
();
~
MessagePumpGLFW
()
override
;
static
scoped_ptr
<
base
::
MessagePump
>
Create
();
void
Run
(
Delegate
*
delegate
)
override
;
void
Quit
()
override
;
void
ScheduleWork
()
override
;
void
ScheduleDelayedWork
(
const
base
::
TimeTicks
&
delayed_work_time
)
override
;
private:
bool
in_run_
;
bool
should_quit_
;
base
::
TimeTicks
delayed_work_time_
;
FTL_DISALLOW_COPY_AND_ASSIGN
(
MessagePumpGLFW
);
};
}
// namespace shell
#endif // SHELL_PLATFORM_GLFW_MESSAGE_PUMP_GLFW_H_
shell/platform/linux/platform_view_glfw.cc
已删除
100644 → 0
浏览文件 @
92c357ed
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/platform/linux/platform_view_glfw.h"
#include <GLFW/glfw3.h>
#include "flutter/common/threads.h"
#include "flutter/shell/gpu/gpu_rasterizer.h"
namespace
shell
{
inline
PlatformViewGLFW
*
ToPlatformView
(
GLFWwindow
*
window
)
{
return
static_cast
<
PlatformViewGLFW
*>
(
glfwGetWindowUserPointer
(
window
));
}
PlatformViewGLFW
::
PlatformViewGLFW
()
:
PlatformView
(
std
::
make_unique
<
GPURasterizer
>
(
nullptr
)),
valid_
(
false
),
glfw_window_
(
nullptr
),
buttons_
(
0
)
{
CreateEngine
();
if
(
!
glfwInit
())
{
return
;
}
glfw_window_
=
glfwCreateWindow
(
640
,
480
,
"Flutter"
,
NULL
,
NULL
);
if
(
glfw_window_
==
nullptr
)
{
return
;
}
glfwSetWindowUserPointer
(
glfw_window_
,
this
);
glfwSetWindowSizeCallback
(
glfw_window_
,
[](
GLFWwindow
*
window
,
int
width
,
int
height
)
{
ToPlatformView
(
window
)
->
OnWindowSizeChanged
(
width
,
height
);
});
glfwSetMouseButtonCallback
(
glfw_window_
,
[](
GLFWwindow
*
window
,
int
button
,
int
action
,
int
mods
)
{
ToPlatformView
(
window
)
->
OnMouseButtonChanged
(
button
,
action
,
mods
);
});
glfwSetKeyCallback
(
glfw_window_
,
[](
GLFWwindow
*
window
,
int
key
,
int
scancode
,
int
action
,
int
mods
)
{
ToPlatformView
(
window
)
->
OnKeyEvent
(
key
,
scancode
,
action
,
mods
);
});
valid_
=
true
;
PostAddToShellTask
();
}
PlatformViewGLFW
::~
PlatformViewGLFW
()
{
if
(
glfw_window_
!=
nullptr
)
{
glfwSetWindowUserPointer
(
glfw_window_
,
nullptr
);
glfwDestroyWindow
(
glfw_window_
);
glfw_window_
=
nullptr
;
}
glfwTerminate
();
}
bool
PlatformViewGLFW
::
IsValid
()
const
{
return
valid_
;
}
intptr_t
PlatformViewGLFW
::
GLContextFBO
()
const
{
// The default window bound FBO.
return
0
;
}
bool
PlatformViewGLFW
::
GLContextMakeCurrent
()
{
glfwMakeContextCurrent
(
glfw_window_
);
return
true
;
}
bool
PlatformViewGLFW
::
GLContextClearCurrent
()
{
glfwMakeContextCurrent
(
nullptr
);
return
true
;
}
bool
PlatformViewGLFW
::
ResourceContextMakeCurrent
()
{
// Resource loading contexts are not supported on this platform.
return
false
;
}
bool
PlatformViewGLFW
::
GLContextPresent
()
{
glfwSwapBuffers
(
glfw_window_
);
return
true
;
}
void
PlatformViewGLFW
::
RunFromSource
(
const
std
::
string
&
assets_directory
,
const
std
::
string
&
main
,
const
std
::
string
&
packages
)
{}
void
PlatformViewGLFW
::
OnWindowSizeChanged
(
int
width
,
int
height
)
{
blink
::
ViewportMetrics
metrics
;
metrics
.
physical_width
=
width
;
metrics
.
physical_height
=
height
;
blink
::
Threads
::
UI
()
->
PostTask
([
engine
=
engine
().
GetWeakPtr
(),
metrics
]
{
if
(
engine
.
get
())
engine
->
SetViewportMetrics
(
metrics
);
});
}
void
PlatformViewGLFW
::
OnMouseButtonChanged
(
int
button
,
int
action
,
int
mods
)
{
blink
::
PointerData
::
Change
change
=
blink
::
PointerData
::
Change
::
kCancel
;
if
(
action
==
GLFW_PRESS
)
{
if
(
!
buttons_
)
{
change
=
blink
::
PointerData
::
Change
::
kDown
;
glfwSetCursorPosCallback
(
glfw_window_
,
[](
GLFWwindow
*
window
,
double
x
,
double
y
)
{
ToPlatformView
(
window
)
->
OnCursorPosChanged
(
x
,
y
);
});
}
else
{
change
=
blink
::
PointerData
::
Change
::
kMove
;
}
// GLFW's button order matches what we want:
// https://github.com/flutter/engine/blob/master/sky/specs/pointer.md
// http://www.glfw.org/docs/3.2/group__buttons.html
buttons_
|=
1
<<
button
;
}
else
if
(
action
==
GLFW_RELEASE
)
{
buttons_
&=
~
(
1
<<
button
);
if
(
!
buttons_
)
{
change
=
blink
::
PointerData
::
Change
::
kUp
;
glfwSetCursorPosCallback
(
glfw_window_
,
nullptr
);
}
else
{
change
=
blink
::
PointerData
::
Change
::
kMove
;
}
}
else
{
FTL_DLOG
(
INFO
)
<<
"Unknown mouse action: "
<<
action
;
return
;
}
double
x
=
0.0
;
double
y
=
0.0
;
glfwGetCursorPos
(
glfw_window_
,
&
x
,
&
y
);
blink
::
PointerData
pointer_data
;
pointer_data
.
Clear
();
pointer_data
.
time_stamp
=
ftl
::
TimePoint
::
Now
().
ToEpochDelta
().
ToMicroseconds
();
pointer_data
.
change
=
change
;
pointer_data
.
kind
=
blink
::
PointerData
::
DeviceKind
::
kMouse
;
pointer_data
.
physical_x
=
x
;
pointer_data
.
physical_y
=
y
;
pointer_data
.
buttons
=
buttons_
;
pointer_data
.
pressure
=
1.0
;
pointer_data
.
pressure_max
=
1.0
;
blink
::
Threads
::
UI
()
->
PostTask
(
[
engine
=
engine
().
GetWeakPtr
(),
pointer_data
]
{
if
(
engine
.
get
())
{
blink
::
PointerDataPacket
packet
(
1
);
packet
.
SetPointerData
(
0
,
pointer_data
);
engine
->
DispatchPointerDataPacket
(
packet
);
}
});
}
void
PlatformViewGLFW
::
OnCursorPosChanged
(
double
x
,
double
y
)
{
blink
::
PointerData
pointer_data
;
pointer_data
.
Clear
();
pointer_data
.
time_stamp
=
ftl
::
TimePoint
::
Now
().
ToEpochDelta
().
ToMicroseconds
();
pointer_data
.
change
=
blink
::
PointerData
::
Change
::
kMove
;
pointer_data
.
kind
=
blink
::
PointerData
::
DeviceKind
::
kMouse
;
pointer_data
.
physical_x
=
x
;
pointer_data
.
physical_y
=
y
;
pointer_data
.
buttons
=
buttons_
;
pointer_data
.
pressure
=
1.0
;
pointer_data
.
pressure_max
=
1.0
;
blink
::
Threads
::
UI
()
->
PostTask
(
[
engine
=
engine
().
GetWeakPtr
(),
pointer_data
]
{
if
(
engine
.
get
())
{
blink
::
PointerDataPacket
packet
(
1
);
packet
.
SetPointerData
(
0
,
pointer_data
);
engine
->
DispatchPointerDataPacket
(
packet
);
}
});
}
void
PlatformViewGLFW
::
OnKeyEvent
(
int
key
,
int
scancode
,
int
action
,
int
mods
)
{
}
}
// namespace shell
shell/platform/linux/platform_view_glfw.h
已删除
100644 → 0
浏览文件 @
92c357ed
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_PLATFORM_GLFW_PLATFORM_VIEW_GLFW_H_
#define SHELL_PLATFORM_GLFW_PLATFORM_VIEW_GLFW_H_
#include <string>
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "lib/ftl/memory/weak_ptr.h"
struct
GLFWwindow
;
namespace
shell
{
class
PlatformViewGLFW
:
public
PlatformView
,
public
GPUSurfaceGLDelegate
{
public:
PlatformViewGLFW
();
~
PlatformViewGLFW
()
override
;
bool
IsValid
()
const
;
bool
ResourceContextMakeCurrent
()
override
;
bool
GLContextMakeCurrent
()
override
;
bool
GLContextClearCurrent
()
override
;
bool
GLContextPresent
()
override
;
intptr_t
GLContextFBO
()
const
override
;
void
RunFromSource
(
const
std
::
string
&
assets_directory
,
const
std
::
string
&
main
,
const
std
::
string
&
packages
)
override
;
private:
bool
valid_
;
GLFWwindow
*
glfw_window_
;
int
buttons_
;
void
OnWindowSizeChanged
(
int
width
,
int
height
);
void
OnMouseButtonChanged
(
int
button
,
int
action
,
int
mods
);
void
OnCursorPosChanged
(
double
x
,
double
y
);
void
OnKeyEvent
(
int
key
,
int
scancode
,
int
action
,
int
mods
);
FTL_DISALLOW_COPY_AND_ASSIGN
(
PlatformViewGLFW
);
};
}
// namespace shell
#endif // SHELL_PLATFORM_GLFW_PLATFORM_VIEW_GLFW_H_
travis/licenses_golden/licenses_flutter
浏览文件 @
3f269db7
...
...
@@ -1814,10 +1814,6 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_messa
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.mm
FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.h
FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm
FILE: ../../../flutter/shell/platform/linux/message_pump_glfw.cc
FILE: ../../../flutter/shell/platform/linux/message_pump_glfw.h
FILE: ../../../flutter/shell/platform/linux/platform_view_glfw.cc
FILE: ../../../flutter/shell/platform/linux/platform_view_glfw.h
FILE: ../../../flutter/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp
FILE: ../../../flutter/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h
FILE: ../../../flutter/sky/engine/platform/text/TextBox.h
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录