summaryrefslogtreecommitdiffstats
path: root/gin
Commit message (Collapse)AuthorAgeFilesLines
* Removes MessageLoop::TYPE_XXX where possiblesky@chromium.org2014-01-151-2/+1
| | | | | | | | | | | | This is part of attempting to get rid of MessageLoop::Type enum. BUG=none TEST=none R=darin@chromium.org Review URL: https://codereview.chromium.org/136683004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244996 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce a monotonic_clock module for Mojo.js.aa@chromium.org2014-01-102-3/+9
| | | | | | | | | | Am having trouble coming up with a satisfactory way to test. BUG= Review URL: https://codereview.chromium.org/129633005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244062 0039d316-1c4b-4281-b951-d872f2087c98
* Make the cube spin in the JS mojo app.aa@chromium.org2014-01-082-0/+2
| | | | | | | | R=abarth@chromium.org Review URL: https://codereview.chromium.org/126743002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243637 0039d316-1c4b-4281-b951-d872f2087c98
* Added a test for destroying an isolate while a timer is outstanding.aa@chromium.org2014-01-062-47/+86
| | | | | | | | | | | Cleaned up a few of the existing tests. BUG= R=abarth@chromium.org Review URL: https://codereview.chromium.org/100143006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243185 0039d316-1c4b-4281-b951-d872f2087c98
* Gin: Fix console module to be varargs again.aa@chromium.org2014-01-064-3/+18
| | | | | | | | R=abarth@chromium.org Review URL: https://codereview.chromium.org/108723006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243183 0039d316-1c4b-4281-b951-d872f2087c98
* Remove usage of deprecate v8::Number constructors from ginjochen@chromium.org2014-01-032-3/+4
| | | | | | | | | TBR=dcarney@chromium.org BUG=none Review URL: https://codereview.chromium.org/109563003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242884 0039d316-1c4b-4281-b951-d872f2087c98
* Gin: Spruce the README a bit.aa@chromium.org2013-12-231-5/+21
| | | | | | Review URL: https://codereview.chromium.org/116953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242342 0039d316-1c4b-4281-b951-d872f2087c98
* Add a simple one shot and repeating timer API for Mojo.js.aa@chromium.org2013-12-2117-28/+321
| | | | | | | | Various further rework of bindings stuff to facilitate. Review URL: https://codereview.chromium.org/120043008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242284 0039d316-1c4b-4281-b951-d872f2087c98
* Implement more of the JavaScript GL API.aa@chromium.org2013-12-216-18/+168
| | | | | | | | | | Right now I am just translating as directly as possible from the C spinning cube demo -- once it all works I will circle back through and refine the JavaScript. R=abarth@chromium.org Review URL: https://codereview.chromium.org/114883003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242230 0039d316-1c4b-4281-b951-d872f2087c98
* Do not use (mostly) deprecated FunctionTemplate::New and Object::New functions.svenpanne@chromium.org2013-12-192-1/+2
| | | | | | | | | R=jochen@chromium.org BUG=324225 Review URL: https://codereview.chromium.org/119093004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241869 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] fix casting WrappableBase to a derived classjochen@chromium.org2013-12-192-7/+20
| | | | | | | | | | | | | | | | | | We first need to cast the void pointer to WrappableBase before we can cast it to the derived class: initially a WrappableBase* is stored as holder, so we can't directly cast it to the derived class. To test this, I added a useless base class so the test object this pointers don't align with the WrappableBase this pointer. Also update the comments about how to use WrappableBase. BUG=none R=aa@chromium.org,dcarney@chromium.org Review URL: https://codereview.chromium.org/119173002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241863 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for wrapping classes indirectly inherited from gin::Wrappable<T>aa@chromium.org2013-12-193-39/+70
| | | | | | | | This is needed for: https://codereview.chromium.org/116163008/ Review URL: https://codereview.chromium.org/118423004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241730 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] Introduce Wrappable::GetObjectTemplatejochen@chromium.org2013-12-178-60/+62
| | | | | | | | | | | | | Instead of explicitly registering object templates for all wrapper infos, add a method on wrappable that returns the template when needed. BUG=none R=aa@chromium.org,abarth@chromium.org Review URL: https://codereview.chromium.org/113893005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241370 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] use a UniquePersistent to hold the context in context_holderjochen@chromium.org2013-12-172-4/+1
| | | | | | | | | BUG=none R=dcarney@chromium.org, abarth@chromium.org Review URL: https://codereview.chromium.org/99243005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241200 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] Use ObjectTemplateBuilder instead of ObjectTemplate::Newjochen@chromium.org2013-12-172-11/+8
| | | | | | | | | | | | With https://codereview.chromium.org/113893005/ this will make sure that all ObjectTemplates have the correct number of internal fields. BUG=none R=aa@chromium.org, abarth@chromium.org Review URL: https://codereview.chromium.org/116203004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241197 0039d316-1c4b-4281-b951-d872f2087c98
* Beginning of JS Mojo API to GL.aa@chromium.org2013-12-133-9/+12
| | | | | | | | R=abarth@chromium.org Review URL: https://codereview.chromium.org/111083005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240807 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 240298 "[gin] also install gin function templates on non-...""jochen@chromium.org2013-12-132-7/+11
| | | | | | | | | | | | | | | | | > [gin] also install gin function templates on non-gin managed > isolates > > BUG=321631 > R=dcarney@chromium.org > > Review URL: https://codereview.chromium.org/110443005 BUG=321631 R=aa@chromium.org Review URL: https://codereview.chromium.org/108173009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240651 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] Turn gin into a componentjochen@chromium.org2013-12-1222-50/+115
| | | | | | | | | | | | This will allow for using gin from content and blink at the same time in a component build BUG=321631 R=abarth@chromium.org,aa@chromium.org Review URL: https://codereview.chromium.org/101583004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240425 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 240298 "[gin] also install gin function templates on non-..."jam@chromium.org2013-12-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | Causing failures on debug win and mac. like: # # Fatal error in ..\..\src\api.cc, line 621 # CHECK(!isolate->IsInitialized()) failed # > [gin] also install gin function templates on non-gin managed isolates > > BUG=321631 > R=dcarney@chromium.org > > Review URL: https://codereview.chromium.org/110443005 TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/98863004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240331 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] also install gin function templates on non-gin managed isolatesjochen@chromium.org2013-12-121-0/+1
| | | | | | | | | BUG=321631 R=dcarney@chromium.org Review URL: https://codereview.chromium.org/110443005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240298 0039d316-1c4b-4281-b951-d872f2087c98
* Update function_template.h.pump file after changes in r240271jochen@chromium.org2013-12-121-2/+5
| | | | | | | | | TBR=dcarney@chromium.org BUG=none Review URL: https://codereview.chromium.org/106433005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240293 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] Declare a wrappable's kWrapperInfo on the class deriving from Wrappablejochen@chromium.org2013-12-124-15/+14
| | | | | | | | | | | | | | | Otherwise, we need to put INIT_WRAPPABLE() in namespace gin no matter where the derived class is declared. I pulled this out from https://codereview.chromium.org/111083005/ BUG=none R=dcarney@chromium.org TBR=aa@chromium.org Review URL: https://codereview.chromium.org/113163007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240271 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] WrappableBase's dtor needs to be virtualjochen@chromium.org2013-12-113-10/+13
| | | | | | | | | | | | | | Otherwise, the weak callback won't run the dtor of derived classes. Also clarify that the INIT_WRAPPABLE() macro needs to be called in namespace gin. BUG=none R=aa@chromium.org Review URL: https://codereview.chromium.org/93903003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240154 0039d316-1c4b-4281-b951-d872f2087c98
* Fix gin's ModuleRegistry::Load().viettrungluu@chromium.org2013-12-111-1/+2
| | | | | | | | | | | | | | | Don't call front() on an empty vector. The behavior when doing this is undefined, and causes JSTest.connector to fail under some configurations (for me, clang Debug on Linux). This issue was caused in the conversion from the C++11 data() (crrev.com/239155). R=abarth@chromium.org Review URL: https://codereview.chromium.org/113013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240137 0039d316-1c4b-4281-b951-d872f2087c98
* Don't use (almost) deprecated FunctionTemplate::New version, part 2.svenpanne@chromium.org2013-12-102-2/+2
| | | | | | | | | TBR=jochen@chromium.org,abarth@chromium.org BUG=324225 Review URL: https://codereview.chromium.org/111393003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239761 0039d316-1c4b-4281-b951-d872f2087c98
* Gin: Make it easier to implement Wrappable.aa@chromium.org2013-12-087-140/+129
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/105743007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239387 0039d316-1c4b-4281-b951-d872f2087c98
* Gin: Consolidate all the Converter<Wrappable> subclasses.aa@chromium.org2013-12-066-69/+103
| | | | | | Review URL: https://codereview.chromium.org/107113005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239204 0039d316-1c4b-4281-b951-d872f2087c98
* Remove usage of C++11 std::vector<> APIs from gin's ModuleRegistryjochen@chromium.org2013-12-061-1/+1
| | | | | | | | | BUG=none R=dcarney@chromium.org Review URL: https://codereview.chromium.org/104713007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239155 0039d316-1c4b-4281-b951-d872f2087c98
* Gin: Add support for binding JS methods to C++ instance methods.aa@chromium.org2013-12-0610-238/+306
| | | | | | | | | | | | | Also: - Added support for computed properties to ObjectTemplateBuilder - Realized it was possible for CreateFunctionTemplate to be just one template BUG= R=abarth@chromium.org, jyasskin@chromium.org Review URL: https://codereview.chromium.org/103703002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239126 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] move context_holder to public/jochen@chromium.org2013-12-065-8/+20
| | | | | | | | | | | | Also, define names for the embedder data slots on v8::Context that gin embedders should use. BUG=321631 R=abarth@chromium.org Review URL: https://codereview.chromium.org/104593007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239099 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] when creating an IsolateHolder for an existing Isolate, don't setup v8jochen@chromium.org2013-12-051-0/+2
| | | | | | | | | BUG=321631 R=aa@chromium.org Review URL: https://codereview.chromium.org/106403002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238928 0039d316-1c4b-4281-b951-d872f2087c98
* Add myself to gin ownersjochen@chromium.org2013-12-051-0/+1
| | | | | | | | | R=aa@chromium.org, abarth@chromium.org BUG=none Review URL: https://codereview.chromium.org/105953004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238927 0039d316-1c4b-4281-b951-d872f2087c98
* gin::Wrappable shouldn't inherit from base::RefCountedabarth@chromium.org2013-12-057-28/+97
| | | | | | | | | | | | | | Rather than using reference counting to keep gin::Wrappable objects alive, we use the V8 garbage collector. To retain a reference to a wrappable object on the stack, use a gin::Handle. Currently there is no mechanism for retaining a gin::Wrappable object in the heap, but we'll likely add one in the future. R=aa@chromium.org BUG=none Review URL: https://codereview.chromium.org/105423003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238902 0039d316-1c4b-4281-b951-d872f2087c98
* Implement gin::ObjectTemplateBuilderaa@chromium.org2013-11-298-23/+122
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/93813002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237867 0039d316-1c4b-4281-b951-d872f2087c98
* Remove usage of deprecagted V8 API from gin/jochen@chromium.org2013-11-289-38/+44
| | | | | | | | | | R=mkwst@chromium.org TBR=abarth@chromium.org BUG=324225 Review URL: https://codereview.chromium.org/94413002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237750 0039d316-1c4b-4281-b951-d872f2087c98
* [Mojo] Remove static "bootstrap" state in mojo_jsabarth@chromium.org2013-11-284-10/+56
| | | | | | | | | | | | | | | | | | | This CL removes the static static in boostrap.cc that we used to transfer the initial handle from C++ into JavaScript. Rather that storing the initial handle in static state and evaling some script to kick off the loading process, we now use an API to load a module by name and then pass the initial handle to the function defined by that module. This CL paves the say for adding threading support to mojo_js. The previous static approach didn't scale to multiple threads, but the approach in this CL does. I'll actually add the API to create a thread in the next CL. R=aa@chromium.org BUG=none Review URL: https://codereview.chromium.org/90203002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237647 0039d316-1c4b-4281-b951-d872f2087c98
* Convert the rest of the functions in core.cc to use CreateFunctionTemplate.aa@chromium.org2013-11-2716-102/+211
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/89723002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237492 0039d316-1c4b-4281-b951-d872f2087c98
* [Gin] Add documentation to explain how Gin worksabarth@chromium.org2013-11-2715-11/+127
| | | | | | | | | | | | | This code is likely to evolve over time, but we've reached a stage where the basic structure is mostly in place. This CL documents this structure so that future developers will understand what we have in mind now. R=aa@chromium.org BUG=none Review URL: https://codereview.chromium.org/88913006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237485 0039d316-1c4b-4281-b951-d872f2087c98
* Implement support in function_template.h for return types.aa@chromium.org2013-11-265-86/+250
| | | | | | Review URL: https://codereview.chromium.org/86783002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237408 0039d316-1c4b-4281-b951-d872f2087c98
* Use pump to generate more overloads of CreateFunctionTemplate.aa@chromium.org2013-11-263-16/+237
| | | | | | Review URL: https://codereview.chromium.org/86453002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237241 0039d316-1c4b-4281-b951-d872f2087c98
* [Gin] Add a basic unit testing frameworkabarth@chromium.org2013-11-2511-23/+353
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, we were using JavaScript bindings to gtest to unit test JavaScript code in Gin and Mojo. The gtest bindings were very basic and not very idiomatic. This CL introduces a simple AMD module call "expect" to help us write more idiomatic unit tests. The API for "expect" is based on the popular Jasmine unit testing framework for node.js. I investigated just importing one of Node's many unit testing frameworks, but they all try to do too much (e.g., drive the entire test harness via Node's file system interface). The "expect" modules doesn't try to drive the testing process. We just let gtest handle that. Instead, "expect" just provides a simple language in which to write test assertions. We'll likely evolve our testing strategy over time, but hopefully this CL is an improvement over the primitive gtest bindings. R=jochen@chromium.org TBR=joth@chromium.org BUG=none Review URL: https://codereview.chromium.org/85223002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237145 0039d316-1c4b-4281-b951-d872f2087c98
* [Mojo] Almost connect mojo_js with hello_world_serviceabarth@chromium.org2013-11-2510-40/+75
| | | | | | | | | | | | This CL connects mojo_js with hello_world_service. After this CL, the JavaScript and C++ implementations have reached parity. BUG=317398 Review URL: https://codereview.chromium.org/82953004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237018 0039d316-1c4b-4281-b951-d872f2087c98
* [Mojo] Improve JavaScript API for MojoReadMessageabarth@chromium.org2013-11-243-16/+32
| | | | | | | | | | | | | | | | Originally, I tried to make the JavaScript bindings for the core Mojo APIs a literal translation of the C APIs, but that makes MojoReadMessage a bit awkward because C needs to worry much more about buffer allocation than JavaScript. In building towards using the hello_world_service, I found that it was much easier to push the MojoReadMessage pattern from connector.cc into C++ and make the JavaScript API a bit more idiomatic by just returning an ArrayBuffer for the message and an Array of handles. BUG=317398 Review URL: https://codereview.chromium.org/83143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236999 0039d316-1c4b-4281-b951-d872f2087c98
* First cut at gin::Bind().aa@chromium.org2013-11-236-31/+135
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/76923003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236958 0039d316-1c4b-4281-b951-d872f2087c98
* [gin] add support for non-gin managed isolates in gin.jochen@chromium.org2013-11-2212-55/+87
| | | | | | | | | BUG=317398 R=abarth@chromium.org,aa@chromium.org Review URL: https://codereview.chromium.org/82963002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236766 0039d316-1c4b-4281-b951-d872f2087c98
* Teach mojo_js_bindings_unittests to load generated JS filesabarth@chromium.org2013-11-226-28/+39
| | | | | | | | | | | | | | | | | This CL generalizes gin::FileModuleProvider to be able to load modules from several places in the file system. I've then made use of this facility in mojo_js_bindings_unittests to load generated JavaScript modules created by mojom_js_generator.py, similar to how C++ files can #include from the generated mojom directory. I've deleted sample_service.js now that we can load it from the generated directory. BUG=317398 Review URL: https://codereview.chromium.org/81673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236711 0039d316-1c4b-4281-b951-d872f2087c98
* [Gin] Add a mechanism for wrapping C++ objectabarth@chromium.org2013-11-216-12/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds a mechanism for wrapping C++ objects to Gin. The approach in this CL is similar to Blink's ScriptWrappable class, with a couple of differences: 1) gin::Wrappable has a vtable whereas Blink's ScriptWrappable class does not. Having a vtable in this base class lets us simplify a large number of concerns. We've talked about adding a vtable to ScriptWrappable but have avoided it because Blink creates many thousands of wrapped objects. When we refactor Blink to use Gin, we can still support the non-vtable approach, but most clients of Gin will want the simpler approach. 2) In Gin, we've bound together the notion of being reference counted with the notion of being wrappable from JavaScript. In Blink, those concepts are separate because we don't want to introduce a virtual destructor for ScriptWrappable. However, because gin::Wrappable already has a vtable, adding a virtual destructor is relatively cheap. Actually wrapping a C++ object still takes too much typing, but we can improve that in future CLs. R=jochen@chromium.org BUG=317398 Review URL: https://codereview.chromium.org/79203004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236555 0039d316-1c4b-4281-b951-d872f2087c98
* Add a GinEmbedder enum and use it to identify WrapperInfojochen@chromium.org2013-11-207-5/+34
| | | | | | | | | BUG=317398 R=dcarney@chromium.org,abarth@chromium.org Review URL: https://codereview.chromium.org/77913004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236314 0039d316-1c4b-4281-b951-d872f2087c98
* Mojo's C++ and JavaScript bindings should produce identical messagesabarth@chromium.org2013-11-201-0/+2
| | | | | | | | | | | After this CL, the JavaScript and C++ bindings produce identical binary messages for the test_sample "frobinate" workload. BUG=317398 Review URL: https://codereview.chromium.org/63033010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236147 0039d316-1c4b-4281-b951-d872f2087c98
* Add a gin/public directoryjochen@chromium.org2013-11-208-10/+10
| | | | | | | | | | | | | | | When we start using gin from other projects but mojo, we want to be extra careful what we include. Therefore, we introduce a public/ directories with headers that are ok to be included from gin-embedders. As a start, we move wrapper_info.h into public/. BUG=317398 R=abarth@chromium.org Review URL: https://codereview.chromium.org/69293015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236114 0039d316-1c4b-4281-b951-d872f2087c98