37998 Commits

Author SHA1 Message Date
Domenic Denicola
17575faefd Don't create redundant promises
Just use promise chaining
2015-01-27 15:43:56 -05:00
Adam Barth
211ffcb881 Make it possible to navigate <iframes>
Also, add support for exposing services to <iframes>. This worked before but
now that [Client=...] is gone we need to create another message pipe.

R=sky@chromium.org

Review URL: https://codereview.chromium.org/882723003
2015-01-27 10:35:52 -08:00
Adam Barth
4de104b325 Rebaseline tests after removing RenderLayerScrollableArea 2015-01-27 10:25:45 -08:00
Adam Barth
23294c892d Add wheel support to sky-scrollable
This CL plumbs wheel events through Sky again and uses them in sky-scrollable.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/876853005
2015-01-27 09:58:22 -08:00
Colin Blundell
eee6b2af78 Revert "Add a close box to flights-app toast."
This reverts commit ffcbc3b2f5417b09328eae4aeb8de2e5eab6324d.

This test broke sky_tests:

Regressions: Unexpected text-only failures (6)
  framework/flights-app.sky [ Failure ]

Example:

http://build.chromium.org/p/client.mojo/builders/Mojo%20Linux%20ASan%20%28dbg%29/builds/173/steps/Sky%20tests/logs/stdio

TBR=ojan

Review URL: https://codereview.chromium.org/880863002
2015-01-27 10:11:41 +01:00
Ojan Vafai
0467502886 Add a close box to flights-app toast.
This is to get a case of having an outline on an
absolutely positioned, overflow:hidden, i.e. a
self-painting layer.

TBR=esprehn@chromium.org

Review URL: https://codereview.chromium.org/878873002
2015-01-26 22:54:39 -08:00
Ojan Vafai
0bbf271f11 Fix border painting on self-painting layers.
Commit efc3afd428bd85fd3d12e0dc941b5eb7248ca30b broke it because
we'd computed an empty foreground layer. Now that background
painting is part of the foreground phase, we need to use the
background rect for clipping. As best I can tell, the
background rect is always >= the size of the foreground
rect, so it should be safe to use.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/876243002
2015-01-26 22:45:30 -08:00
James Robinson
2ff9d2d006 Remove Client relationship between mojo.Shell/mojo.Application
Instead of mojo.Shell and mojo.Application being clients of each other
they are now separate interfaces. An implementation of mojo.Application
receives a handle to the shell in its Initialize call, as described in
this doc:

https://docs.google.com/document/d/1xjt_TPjTu0elix8fNdBgWmnjJdJAtqSr1XDS_C-Ct8E/edit?usp=sharing

An analogous change is made to the content handler definition.

In C++, this is handled by the mojo::ApplicationImpl class which stores
shell handle in its implementation of Initialize. Thus the only change
for most C++ applications is the meaning of the handle in MojoMain is
different, although mains that use the ApplicationRunners do the same
thing with it.  Connecting to other apps is largely the same although
instead of grabbing the ApplicationImpl's client() to talk to the shell
code must now use the ApplicationImpl::shell() getter.

In JavaScript, the initialization sequence is a bit different although
this is hidden mostly in the Application class which calls initialize()
on its subclass with the same set of parameters. Connecting to another
application looks different, especially for sky code using the shell
proxy handle exposed via internals. Hans has some ideas about how to
make this a bit nicer.

Python apps similarly need to change their startup sequence a bit. I
didn't find a common library to take care of this dance, although it's
possible I just missed it.

Other languages probably a bit of reworking - I fixed everything here
that is covered by mojob.py test but some might be missing.

This patch also uses typed handles (i.e. InterfacePtr<> or
InterfaceRequest<> or their type aliases) wherever possible instead of
ScopedMessagePipeHandle for clarity.

R=davemoore@chromium.org

Review URL: https://codereview.chromium.org/868463008
2015-01-26 17:53:08 -08:00
Ojan Vafai
df4b5c5e55 Add a gratuitous outline to flights-app.
This is so we have minimal coverage of outline painting.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/878803002
2015-01-26 16:40:40 -08:00
Elliott Sprehn
69fb511131 Replace createTextNode with new Text().
Sky doesn't have this method (per spec).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/879733002
2015-01-26 15:12:19 -08:00
Adam Barth
150ee5f775 Add a basic sky-scrollable element that scrolls
We still need to polish sky-scrollable, but it basically works.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/875953004
2015-01-26 13:29:38 -08:00
Eric Seidel
590f35b842 Make it possible to pass a default url to sky_debugger
sky_debugger will load the default url in every view that it's
asked to embed.  Think of the default_url as being like the
home-page in a conventional browser.

I also fixed prompt.cc to not terminate the entire mojo
environment when it can't start itself, but rather just
quit its own application.

With this patch I'm able to hack up mojo_shell to be able
to have a sensible default behavior when clicked from
the Android homescreen, but I'll land those hacks in a
separate change.

TBR=abarth@chromium.org
BUG=451620

Review URL: https://codereview.chromium.org/875183002
2015-01-26 13:19:06 -08:00
Elliott Sprehn
2808cfa418 module.exports should default to an empty object.
Per the spec in modules.md the exports property should default to an
empty object. We lazy allocate it so that modules that just replace it
don't create the empty object and then throw it away.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/872043003
2015-01-26 11:38:04 -08:00
Adam Barth
966b475029 Switch KeyboardEvents over to NewEventHandler
This CL moves KeyboardEvents from the old event model to NewEventHandler. This
CL keeps the basic structure of keydown, keypress, keyup events even though
that's a bit wacky. As with pointer and gesture events, this CL removes
PlatformKeyboardEvent in favor of just using WebKeyboardEvent. I've also made
WebKeyboardEvent align more closely with Mojo's keyboard event.

The CL does change one important aspect of key event handling: on the web the
"keyCode" property of KeyboardEvent changes its meaning depending on whether
the event is a keydown or a keypress event. For the former events, keyCode is
the "virtual" (i.e., windows) key code where for the latter events, keyCode is
the character code. To be more precise, I've renamed keyCode to virtualKeyCode
and I've given it a zero (unknown key code) value during keypress events.

R=ojan@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/872233002
2015-01-25 22:46:50 -08:00
Adam Barth
203678a81a Sky shouldn't crash on device rotate
There were two problems (both fixed in this CL):

1) When we were resized by the view manager, we forgot to deflate by the
   device-pixel-ratio when converting to engine types. That caused use to
   allocate a backing texture that was 9x what we needed.

2) When the surfaces system returned textures to us for re-use, we'd put them
   into the cache even if they were the old size. That caused us to thrash the
   texture cache. In this CL, we make the size of the textures in the cache
   explicit.

R=eseidel@chromium.org
BUG=449001

Review URL: https://codereview.chromium.org/868263002
2015-01-23 21:20:14 -08:00
Elliott Sprehn
a43c73c52f Add the <t> element and ignore whitespace outside it.
We now only preserve the whitespace inside a <t> element inside
the parser. This removes the known n^2 from reattaching whitespace
which should make parsing and appending nodes faster. I also
removed the dead WhitespaceMode code from the parser, and made
the dom-seralizer.sky auto indent the markup so the test output
would be readable.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/867963006
2015-01-23 16:50:00 -08:00
Eric Seidel
f51a99fbd8 Teach mojo_cache_linker how to use a cache
Many of the .so files in out/Debug are hundreds
of megabytes in size.  md5sum can take seconds
to churn through them all, so I've added
a small caching layer which makes this script
take no time in the common case.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/865463004
2015-01-23 16:42:18 -08:00
Hixie
5a981c6bb6 Fix help text in skydb
R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/871083002
2015-01-23 16:25:30 -08:00
Eric Seidel
a7a3147fd4 Fix skydb --gdb to always have symbols
This replaces my previous --gdb work:
https://codereview.chromium.org/848013004/

And obsoletes my build-id based attempt:
https://codereview.chromium.org/788903011

Context:
mojo_shell downloads arbitrary binaries from
urls copying them to temp files before calling
dlopen.  Because the names it used were random
this broke gdb, pprof, etc. tools which wanted
to make address -> symbol translations based
on the library load path.

The major thing this change does is move away
from the previous method of watching the logs
of mojo_shell for 'Caching %url as %file...'
messages or the /tmp/mojo_shell.%pid.map
file to having mojo_shell use a priori knowable
names for all of its library loads.  Thus
we can similarly build a directory of correctly
named symboled binaries corresponding to the
expected load names of libraries.

This change does this in 3 pieces:

1.  Introduces the concept of 'app ids' (which
are currently just the md5 of the distributed app
binary) and teaches dynamic_application_loader to
rename all apps to APP_ID.mojo before loading them.
This has the nice side-effect of always loading
an app with a dlopen/library name which is both
unique to the application as well as predictable.

2.  Re-writes the mojo_cache_linker script to
no longer watch stdin/adb logcat for 'caching...'
messages and instead build a links directory
based on pre-determined app_ids (md5s) linking
back to the symboled binaries.

3.  Remove a bunch of the former mojo_cache_linker
calling code which is no longer needed now that
the library_names of loaded application .so's are
predictable before launching mojo_shell

I'm happy to make app_ids fancier, originally I
was going to use ELF's build-id's directly:
https://codereview.chromium.org/788903011
but unfortunately gdbserver does not know
how to do a build-id lookup on the serverside:
https://groups.google.com/a/google.com/forum/#!topic/gdb-discuss/Fd0R-gFaqXk

R=aa@chromium.org, abarth@chromium.org

Review URL: https://codereview.chromium.org/866383004
2015-01-23 15:18:21 -08:00
Adam Barth
e894391579 Remove touch events from Sky
We use pointer events instead.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/868133003
2015-01-23 12:41:56 -08:00
Hixie
fb232d7cfe Docs: Update formatting of skydb help
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/875513002
2015-01-23 09:35:11 -08:00
Elliott Sprehn
efd6fa3229 Remove @keyframe parsing.
We still have the code internally, but the parser won't create
StyleRuleKeyframes anymore.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/871773003
2015-01-22 20:48:22 -08:00
Eric Seidel
dd0f9762e7 Add a note about hacks for building on V8.
TBR=abarth@chromium.org
BUG=v8:3841
2015-01-22 10:55:02 -08:00
James Robinson
4f3537a797 Remove [Client=] annotation from ServiceProvider
This removes the symmetrical nature of ServiceProvider and consistently
passes and uses a ServiceProvider + ServiceProvider& pair in places that
wish to bidirectionally expose services, such as the view manager.

The
view manager library now deals with InterfaceRequest<ServiceProvider>
and ServiceProviderPtr objects (i.e. c++ wrappers for handles) instead
of a concrete implementation of ServiceProvider to make it easier for
callers.

A number of places that were assuming a particular
ServiceProvider would always exist are updated to reflect the nullability
of the parameters in mojom and places that do not wish to ever look up
or provide services now pass nullptr instead of doomed pipe handles.

The JS application startup classes are reworked a bit to accomodate
exposing services on the third ConnectToApplication/AcceptConnection
parameter.

BUG=449432
R=abarth@chromium.org, sky@chromium.org

Review URL: https://codereview.chromium.org/858103002
2015-01-21 18:36:01 -08:00
Elliott Sprehn
31de067e43 Don't store a RuleFeatureSet on ScopedStyleResolver.
Instead lets just iterate the list of sheets and ask each one questions. This
shouldn't be much slower since most widgets only have one sheet anyway.

I also moved the media query matching to the sheet collection. We weren't
correctly matching them since we only guarded the feature set, not the
addition to the list of active sheets.

R=abarth@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/858423002
2015-01-21 17:00:06 -08:00
Adam Barth
7d62702d64 Change background-repeat default to no-repeat
Previously, if you had a generated background image and a translucent (or
rounded) border, we would draw the image nine times because we would inflate
the fill rect to draw behind the border. With no-repeat, we only draw the image
once.

This saves 4.5% of record time on flights-app.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/844193009
2015-01-21 16:42:26 -08:00
Eric Seidel
af4ab75258 Update HACKING.md 2015-01-21 16:37:40 -08:00
Adam Barth
90623b7870 Serialize SkPictures to the file system
This CL teaches the Sky compositor how to serialize SkPictures to the file
system so that we can study them in the Skia picture debugger.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/853863003
2015-01-21 16:27:28 -08:00
Eric Seidel
8be2c7c168 Always use mojo_shell in over-http mode
--origin tells mojo_shell to map all mojo: urls
to to a new base-url instead of the build directory.

This makes skydb's mojo_shell *always* use the network
loading path, which is what Android mojo_shell does
and is more like how mojo_shell will eventually be
used.

I also fixed the disk-space leak in the
dynamic_application_loader's NetworkLoader path
by having it immediately unlink the /tmp copy
of the library after dlopen.

In order to keep pprof working I had to teach the
dynamic_application_loader to write out a map of
/tmp/file -> url mappings so that we can fix
the pprof file afterwords.

This will "break" skydb --gdb on linux in exactly
as much as it is already broken on Android, but
I'm working on a build-id based solution for both
so that gdb knows how to find symbols for
non-existant randomly named /tmp libraries.

R=abarth@chromium.org, viettrungluu@chromium.org
BUG=450696

Review URL: https://codereview.chromium.org/829183005
2015-01-21 15:53:17 -08:00
Eric Seidel
5c827f59c0 Fix skydb gdb_attach for non-android configs
I dumped a bunch of android-specific goop into
gdb_attach in my previous commit.  This fixes that.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/859103002
2015-01-20 14:55:37 -08:00
Adam Barth
c08797471f Sky should symbolize pprof traces
In order for pprof to find the symbols in the profile, we need to rename the
binaries from foo.mojo to libfoo_library.so. This CL adds that step to the
stop_profiling command in skydb.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/812573006
2015-01-20 14:27:25 -08:00
Adam Barth
6bd6833506 Sky should use an SkPicture when drawing
This CL teaches the Sky compositor to record an SkPicture instead of just
drawing in immediate mode. Using an SkPicture will let us experiment with
various optimizations in Skia that preprocess the SkPicture before translating
the Skia commands to GL commands.

This CL also refactors the "display delegate" system now that we can hand off
an SkPicture to a rasterization backend. The new design requires fewer
backpointers and removes the static display delegate factory.

R=eseidel@google.com

Review URL: https://codereview.chromium.org/854303002
2015-01-19 18:47:53 -08:00
Elliott Sprehn
75f62f9a49 Don't queue mutation records when attributes don't change value.
There's no reason to queue records when an attribute didn't really
change value.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/840223006
2015-01-16 19:21:28 -08:00
Adam Barth
100c4ae196 Add support for GestureEvents to Sky
We'll likely change the API over time, but this is a start.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/857533002
2015-01-16 15:42:01 -08:00
Adam Barth
51b30e16fa Add PointerEvent interface to Sky
Currently this interface is constructable from script but isn't used internally
by the engine.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/846783003
2015-01-16 15:35:59 -08:00
Eric Seidel
1cbce3d266 Add very basic support for symboled debugging on android
This only barely works.  We pull down system libraries
once before we attach.  The libraries we pull from
the device do not have debug symbols, but have enough
that we have decent callstacks.  We launch a background
process to repeatedly update a cache directory with
symlinks into our build directory corresponding to the cache
names used on the device, however gdb doesn't watch
the solib-search-path directories to notice the links
as we add them.

Better solutions would be to add support for pulling
down full android symboled system images and using those
instead of pulling libraries off the device as well as
figure out how to get android binaries to support
build-id so that we can present a directory of build-id
associated libraries to gdb on boot and have it to build-id
based lookups of libraries instead of our current broken
watch-logs-and-add-symlinks approach.

If you know what you're doing with this you can actually
make debugging work on the device.  It's not particularly
user friendly yet, but we'll work on it.

I added a build_dir member to skypy.paths.Paths
as a temporary measure before we move off of skypy's
paths and onto mopy's paths.  This helped eliminate
problems with using a relative path in args.build_dir
as is common.

R=abarth@chromium.org, ojan@chromium.org, qsr@chromium.org
BUG=

Review URL: https://codereview.chromium.org/855663003
2015-01-16 13:39:20 -08:00
Eric Seidel
6e00644be3 Make --gdb work for android
This mostly works.  I haven't yet set up pulling down the
system binaries from the device to the host so that symbols
appear correctly, but I'll do that in the next patch.

One of the crazy things this patch adds it a script
to watch for loads on adb logcat and set up mappings
from the cache library names to the symboled binaries
in the out directory.  Presumably other scripts may
want to share this functionality so I've made it its
own script.

Better would be to have mojo_shell spit out a file
including the cache mapping information and we could
watch that file instead of logcat, but this works
for now.

R=qsr@chromium.org
BUG=

Review URL: https://codereview.chromium.org/848013004
2015-01-16 11:28:31 -08:00
Elliott Sprehn
f1a1f78d1a Reuse the DOM in the <fps-counter>.
Instead of storing primitive values which makes the data
binding system throw away DOM each time we update each slot
lets just use objects and shift + pop. This means very little
data binding churn.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/802153004
2015-01-15 22:02:35 -08:00
Elliott Sprehn
0a4e9eac94 Turn on harmony arrays and regexp.
adamk@ says these are pretty stable.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/845403009
2015-01-15 17:12:17 -08:00
Adam Barth
ffa677551e Add pprof support to skydb
After this CL, we're able to capture pprof profiles, but we're not quite able
to symbolize them properly.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/854833004
2015-01-15 16:34:16 -08:00
Adam Barth
656c44bafb Make tracing work on Android
Previously, the trace coordinator would try to write a trace to the file
system, but it is awkward to write to the file system on Android. Instead, we
now stream the trace data to a data pipe. The Sky debugger consumes that data
pipe and sends it to the host via the command HTTP server.

R=eseidel@chromium.org, jamesr@chromium.org

Review URL: https://codereview.chromium.org/853943005
2015-01-15 16:32:16 -08:00
Adam Barth
de266a6ba7 Fix fips-counter in touch-demo.sky
TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/813133010
2015-01-15 11:11:38 -08:00
Adam Barth
2219ef50b9 The Sky compositor should recycle textures
Previously, we were creating a new texture for every frame. Using tracing on a
Nexus 5, that appears to cost about 6ms per frame on the GPU thread. After this
CL, we keep a cache of recently used textures and only allocate a new one when
either (1) we don't have one free or (2) our size requirements have changed.

If our size requirements change, we dump the whole texture cache. In the
future, we'll probably need something fancier if we ever need more than one
size texture per frame.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/845963006
2015-01-15 11:09:56 -08:00
Eric Seidel
44bf8e332d Make skydb stop actually clear the pid file
TBR=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/849053006
2015-01-14 16:29:09 -08:00
Adam Barth
c83b4591b6 Add a fps-counter widget to some Sky demos
This CL makes some Sky demos more interesting and adds an fps-widget to see how
fast they run.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/803283006
2015-01-14 15:50:59 -08:00
Ojan Vafai
1f0ea173f3 Unprefix -webkit-filter and add a pixel test for it.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/850103003
2015-01-14 15:14:46 -08:00
James Robinson
6179aceb5e Pass ServiceProvider and ServiceProvider& params in Connect
In preperation for removing the Client annotation from ServiceProvider
this passes a second parameter of type ServiceProvider in the shell and
application Connect calls. In this patch the type signatures are updated
but the second parameter is basically unused. The intention is that the
first parameter |services| will be used for the connecting application to
request services from the connected application (as it does currently)
and the second parameter |exported_services| be used for the connecting
application to provide services to the connected application. We have
very few services exported in the second direction today - I'll update
them to use the second parameter in a follow-up patch.

R=darin@chromium.org

Review URL: https://codereview.chromium.org/845593003
2015-01-14 14:33:07 -08:00
James Robinson
3ab6eab14c Use local ids for Surfaces APIs that can only apply to local surfaces
Surfaces identifiers have a local and a namespace component. The
namespace is particular to a connection. The local component is up to
the endpoint of the connection to manage. In contexts where a surface
that may be from anywhere is referenced, a fully qualified ID with both
the local and namespace component is needed in order to be unambiguous.
In contexts that can only apply to local surfaces only the local id is
needed.

This updates the mojo.Surface APIs that can only refer to local IDs to
only take the local component. In particular creating, destroying, or
submitting a frame can only refer to surfaces created on that connection.
References to surfaces within a frame may refer to local or foreign
surfaces so they use fully qualified IDs.

This also skips the SurfacesService indirection since many applications
can perform useful operations on a mojo.Surface interface such as create
surfaces and submit frames without knowing their ID namespace. The
namespace component is needed only to pass fully qualified IDs to other
actors that may wish to reference the produced frame.

R=sky@chromium.org

Review URL: https://codereview.chromium.org/826423008
2015-01-14 10:25:31 -08:00
Tony Gentilcore
f77fe8f15b Fix running skydb under chromoting.
Looks like a variable rename was missed.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/815143004
2015-01-13 18:50:52 -08:00
Adam Barth
8abd40ead9 Remove outdated hack from flights-app
We don't need this hack anymore.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/853593002
2015-01-13 16:41:20 -08:00