Skip to content

Commit

Permalink
Update to mojo 4fe7bc6c228b3a2939cd3635ebd701f88eeca55d
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons committed Oct 10, 2015
1 parent e6e59e4 commit d3a5b2c
Show file tree
Hide file tree
Showing 116 changed files with 3,892 additions and 3,442 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

vars = {
'chromium_git': 'https://chromium.googlesource.com',
'mojo_sdk_revision': '033ebba671eced78b155862a1484ec1087b111e0',
'mojo_sdk_revision': '56e62e2ecf2052becf04a321fdc80e90600a75bd',
'mojo_devtools_revision': '49879d78ce4486e10c2214a101d9b2e82794b2f4',
'skia_revision': '0d39d37ddcfb3847795639eaef513f1112eba627',

Expand All @@ -29,7 +29,7 @@ vars = {
'dart_observatory_packages_revision': 'a731d3b1caf27b45aecdce9378b87a510240264d',
'dart_root_certificates_revision': 'c3a41df63afacec62fcb8135196177e35fe72f71',

'buildtools_revision': '5215ee866bc3e8eb4a7f124212845abf4029e60b',
'buildtools_revision': '565d04e8741429fb1b4f26d102f2c6c3b849edeb',
}

# Only these hosts are allowed for dependencies in this DEPS file.
Expand Down
1 change: 0 additions & 1 deletion mojo/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ android_library("mojo_javatests") {
"//base:base_java",
"//base:base_java_test_support",
"//mojo/public/interfaces/bindings/tests:test_interfaces_java",
"//mojo/public/interfaces/bindings/tests:test_interfaces_experimental_java",
"//mojo/public/java:bindings",
"//mojo/public/java:system",
]
Expand Down
50 changes: 32 additions & 18 deletions mojo/common/dart/lib/tracing_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const traceEventPhaseBegin = "B";
const traceEventPhaseEnd = "E";
const traceEventPhaseAsyncBegin = "S";
const traceEventPhaseAsyncEnd = "F";
const traceEventDuration = "X";

// TracingHelper is used by Dart code running in the Mojo shell in order
// to perform tracing.
Expand All @@ -36,8 +37,10 @@ class TracingHelper {
// for use in trace messages. If |appName| is longer than 20 characters then
// only the last 20 characters of |appName| will be used.
TracingHelper.fromApplication(Application app, String appName) {
_tid = [appName, Isolate.current].fold(7,
(hash, element) => 31 * hash + element.hashCode);
// Masked because the tid is expected to be a 32-bit int.
_tid = [appName, Isolate.current]
.fold(7, (hash, element) => 31 * hash + element.hashCode) &
0x7fffffff;
_impl = new TraceProviderImpl();
ApplicationConnection connection = app.connectToApplication("mojo:tracing");
connection.provideService(TraceProviderName, (e) {
Expand Down Expand Up @@ -80,33 +83,44 @@ class TracingHelper {
_sendTraceMessage(name, categories, traceEventInstant, 0, args: args);
}

FunctionTrace _beginFunction(String functionName, String categories,
String phase, {Map<String, String> args}) {
void traceDuration(String name, String categories, int start, int end,
{Map<String, String> args}) {
_sendTraceMessage(name, categories, traceEventDuration, 0,
args: args, start: start, duration: end - start);
}

FunctionTrace _beginFunction(
String functionName, String categories, String phase,
{Map<String, String> args}) {
assert(functionName != null);
final trace =
new _FunctionTraceImpl(this, isActive() ? functionName : null,
categories, phase);
final trace = new _FunctionTraceImpl(
this, isActive() ? functionName : null, categories, phase);
_sendTraceMessage(functionName, categories, phase, trace.hashCode,
args: args);
return trace;
}

void _endFunction(String functionName, String categories, String phase,
int traceId) {
void _endFunction(
String functionName, String categories, String phase, int traceId) {
_sendTraceMessage(functionName, categories, phase, traceId);
}

void _sendTraceMessage(String name, String categories, String phase,
int traceId, {Map<String, String> args}) {
void _sendTraceMessage(
String name, String categories, String phase, int traceId,
{Map<String, String> args, int start, int duration}) {
if (isActive()) {
var time = (start != null) ? start : getTimeTicksNow();
var map = {};
map["name"] = name;
map["cat"] = categories;
map["ph"] = phase;
map["ts"] = getTimeTicksNow();
map["ts"] = time;
map["pid"] = pid;
map["tid"] = _tid;
map["id"] = traceId;
if (duration != null) {
map["dur"] = duration;
}
if (args != null) {
map["args"] = args;
}
Expand Down Expand Up @@ -148,8 +162,8 @@ class _FunctionTraceImpl implements FunctionTrace {
String _categories;
String _beginPhase;

_FunctionTraceImpl(this._tracing, this._functionName, this._categories,
this._beginPhase) {
_FunctionTraceImpl(
this._tracing, this._functionName, this._categories, this._beginPhase) {
assert(_beginPhase == traceEventPhaseBegin ||
_beginPhase == traceEventPhaseAsyncBegin);
}
Expand All @@ -158,11 +172,11 @@ class _FunctionTraceImpl implements FunctionTrace {
void end() {
if (_functionName != null) {
if (_beginPhase == traceEventPhaseBegin) {
_tracing._endFunction(_functionName, _categories, traceEventPhaseEnd,
hashCode);
_tracing._endFunction(
_functionName, _categories, traceEventPhaseEnd, hashCode);
} else if (_beginPhase == traceEventPhaseAsyncBegin) {
_tracing._endFunction(_functionName, _categories,
traceEventPhaseAsyncEnd, hashCode);
_tracing._endFunction(
_functionName, _categories, traceEventPhaseAsyncEnd, hashCode);
}
}
}
Expand Down
95 changes: 50 additions & 45 deletions mojo/converters/input_events/input_events_type_converters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ namespace {

ui::EventType MojoMouseEventTypeToUIEvent(const EventPtr& event) {
DCHECK(!event->pointer_data.is_null());
DCHECK_EQ(POINTER_KIND_MOUSE, event->pointer_data->kind);
DCHECK_EQ(PointerKind::MOUSE, event->pointer_data->kind);
switch (event->action) {
case EVENT_TYPE_POINTER_DOWN:
case EventType::POINTER_DOWN:
return ui::ET_MOUSE_PRESSED;

case EVENT_TYPE_POINTER_UP:
case EventType::POINTER_UP:
return ui::ET_MOUSE_RELEASED;

case EVENT_TYPE_POINTER_MOVE:
case EventType::POINTER_MOVE:
DCHECK(event->pointer_data);
if (event->pointer_data->horizontal_wheel != 0 ||
event->pointer_data->vertical_wheel != 0) {
return ui::ET_MOUSEWHEEL;
}
if (event->flags &
(EVENT_FLAGS_LEFT_MOUSE_BUTTON | EVENT_FLAGS_MIDDLE_MOUSE_BUTTON |
EVENT_FLAGS_RIGHT_MOUSE_BUTTON)) {
if (static_cast<uint32_t>(event->flags) &
(static_cast<uint32_t>(EventFlags::LEFT_MOUSE_BUTTON) |
static_cast<uint32_t>(EventFlags::MIDDLE_MOUSE_BUTTON) |
static_cast<uint32_t>(EventFlags::RIGHT_MOUSE_BUTTON))) {
return ui::ET_MOUSE_DRAGGED;
}
return ui::ET_MOUSE_MOVED;
Expand All @@ -51,18 +52,18 @@ ui::EventType MojoMouseEventTypeToUIEvent(const EventPtr& event) {

ui::EventType MojoTouchEventTypeToUIEvent(const EventPtr& event) {
DCHECK(!event->pointer_data.is_null());
DCHECK_EQ(POINTER_KIND_TOUCH, event->pointer_data->kind);
DCHECK_EQ(PointerKind::TOUCH, event->pointer_data->kind);
switch (event->action) {
case EVENT_TYPE_POINTER_DOWN:
case EventType::POINTER_DOWN:
return ui::ET_TOUCH_PRESSED;

case EVENT_TYPE_POINTER_UP:
case EventType::POINTER_UP:
return ui::ET_TOUCH_RELEASED;

case EVENT_TYPE_POINTER_MOVE:
case EventType::POINTER_MOVE:
return ui::ET_TOUCH_MOVED;

case EVENT_TYPE_POINTER_CANCEL:
case EventType::POINTER_CANCEL:
return ui::ET_TOUCH_CANCELLED;

default:
Expand All @@ -82,43 +83,43 @@ void SetPointerDataLocationFromEvent(const ui::LocatedEvent& located_event,

} // namespace

COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_NONE) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::NONE) ==
static_cast<int32>(ui::EF_NONE),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CAPS_LOCK_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::CAPS_LOCK_DOWN) ==
static_cast<int32>(ui::EF_CAPS_LOCK_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_SHIFT_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::SHIFT_DOWN) ==
static_cast<int32>(ui::EF_SHIFT_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CONTROL_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::CONTROL_DOWN) ==
static_cast<int32>(ui::EF_CONTROL_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALT_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::ALT_DOWN) ==
static_cast<int32>(ui::EF_ALT_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_LEFT_MOUSE_BUTTON) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::LEFT_MOUSE_BUTTON) ==
static_cast<int32>(ui::EF_LEFT_MOUSE_BUTTON),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::MIDDLE_MOUSE_BUTTON) ==
static_cast<int32>(ui::EF_MIDDLE_MOUSE_BUTTON),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_RIGHT_MOUSE_BUTTON) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::RIGHT_MOUSE_BUTTON) ==
static_cast<int32>(ui::EF_RIGHT_MOUSE_BUTTON),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_COMMAND_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::COMMAND_DOWN) ==
static_cast<int32>(ui::EF_COMMAND_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_EXTENDED) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::EXTENDED) ==
static_cast<int32>(ui::EF_EXTENDED),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_IS_SYNTHESIZED) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::IS_SYNTHESIZED) ==
static_cast<int32>(ui::EF_IS_SYNTHESIZED),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALTGR_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::ALTGR_DOWN) ==
static_cast<int32>(ui::EF_ALTGR_DOWN),
event_flags_should_match);
COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MOD3_DOWN) ==
COMPILE_ASSERT(static_cast<int32>(EventFlags::MOD3_DOWN) ==
static_cast<int32>(ui::EF_MOD3_DOWN),
event_flags_should_match);

Expand All @@ -128,38 +129,38 @@ EventType TypeConverter<EventType, ui::EventType>::Convert(ui::EventType type) {
switch (type) {
case ui::ET_MOUSE_PRESSED:
case ui::ET_TOUCH_PRESSED:
return EVENT_TYPE_POINTER_DOWN;
return EventType::POINTER_DOWN;

case ui::ET_MOUSE_DRAGGED:
case ui::ET_MOUSE_MOVED:
case ui::ET_MOUSE_ENTERED:
case ui::ET_MOUSE_EXITED:
case ui::ET_TOUCH_MOVED:
case ui::ET_MOUSEWHEEL:
return EVENT_TYPE_POINTER_MOVE;
return EventType::POINTER_MOVE;

case ui::ET_MOUSE_RELEASED:
case ui::ET_TOUCH_RELEASED:
return EVENT_TYPE_POINTER_UP;
return EventType::POINTER_UP;

case ui::ET_TOUCH_CANCELLED:
return EVENT_TYPE_POINTER_CANCEL;
return EventType::POINTER_CANCEL;

case ui::ET_KEY_PRESSED:
return EVENT_TYPE_KEY_PRESSED;
return EventType::KEY_PRESSED;

case ui::ET_KEY_RELEASED:
return EVENT_TYPE_KEY_RELEASED;
return EventType::KEY_RELEASED;

default:
break;
}
return EVENT_TYPE_UNKNOWN;
return EventType::UNKNOWN;
}

EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) {
const EventType type = ConvertTo<EventType>(input.type());
if (type == EVENT_TYPE_UNKNOWN)
if (type == EventType::UNKNOWN)
return nullptr;

EventPtr event = Event::New();
Expand All @@ -174,7 +175,7 @@ EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) {
PointerDataPtr pointer_data(PointerData::New());
// TODO(sky): come up with a better way to handle this.
pointer_data->pointer_id = std::numeric_limits<int32>::max();
pointer_data->kind = POINTER_KIND_MOUSE;
pointer_data->kind = PointerKind::MOUSE;
SetPointerDataLocationFromEvent(*located_event, pointer_data.get());
if (input.IsMouseWheelEvent()) {
const ui::MouseWheelEvent* wheel_event =
Expand All @@ -192,7 +193,7 @@ EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) {
static_cast<const ui::TouchEvent*>(&input);
PointerDataPtr pointer_data(PointerData::New());
pointer_data->pointer_id = touch_event->touch_id();
pointer_data->kind = POINTER_KIND_TOUCH;
pointer_data->kind = PointerKind::TOUCH;
SetPointerDataLocationFromEvent(*touch_event, pointer_data.get());
pointer_data->radius_major = touch_event->radius_x();
pointer_data->radius_minor = touch_event->radius_y();
Expand Down Expand Up @@ -244,22 +245,26 @@ scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert(
}

switch (input->action) {
case EVENT_TYPE_KEY_PRESSED:
case EVENT_TYPE_KEY_RELEASED: {
case EventType::KEY_PRESSED:
case EventType::KEY_RELEASED: {
scoped_ptr<ui::KeyEvent> key_event;
if (input->key_data->is_char) {
// TODO(johngro) : Need to verify that input->flags (a mojom generated
// enum) is a valid set of flags for a ui::KeyEvent
key_event.reset(new ui::KeyEvent(
static_cast<base::char16>(input->key_data->character),
static_cast<ui::KeyboardCode>(
input->key_data->key_code),
input->flags));
static_cast<int32_t>(input->flags)));
} else {
// TODO(johngro) : Need to verify that input->flags (a mojom generated
// enum) is a valid set of flags for a ui::KeyEvent
key_event.reset(new ui::KeyEvent(
input->action == EVENT_TYPE_KEY_PRESSED ? ui::ET_KEY_PRESSED
input->action == EventType::KEY_PRESSED ? ui::ET_KEY_PRESSED
: ui::ET_KEY_RELEASED,

static_cast<ui::KeyboardCode>(input->key_data->key_code),
input->flags));
static_cast<int32_t>(input->flags)));
}
key_event->SetExtendedKeyEventData(scoped_ptr<ui::ExtendedKeyEventData>(
new MojoExtendedKeyEventData(
Expand All @@ -269,11 +274,11 @@ scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert(
key_event->set_platform_keycode(input->key_data->native_key_code);
return key_event.Pass();
}
case EVENT_TYPE_POINTER_DOWN:
case EVENT_TYPE_POINTER_UP:
case EVENT_TYPE_POINTER_MOVE:
case EVENT_TYPE_POINTER_CANCEL: {
if (input->pointer_data->kind == POINTER_KIND_MOUSE) {
case EventType::POINTER_DOWN:
case EventType::POINTER_UP:
case EventType::POINTER_MOVE:
case EventType::POINTER_CANCEL: {
if (input->pointer_data->kind == PointerKind::MOUSE) {
// TODO: last flags isn't right. Need to send changed_flags.
scoped_ptr<ui::MouseEvent> event(new ui::MouseEvent(
MojoMouseEventTypeToUIEvent(input), location, screen_location,
Expand Down
Loading

0 comments on commit d3a5b2c

Please sign in to comment.