Skip to content

Commit 878202d

Browse files
author
Eric Lange
committed
Merged in changes to work on individual node threads (just just the main thread)
Added iOS LiquidCore support
1 parent a9dc5a3 commit 878202d

11 files changed

Lines changed: 280 additions & 95 deletions

File tree

liquidcore/ios/register.mm

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#import <LiquidCore/LiquidCore.h>
2+
#import "node_sqlite3.h"
3+
4+
@interface SQLite3 : NSObject<LCAddOn>
5+
6+
@end
7+
8+
@implementation SQLite3
9+
10+
- (id) init
11+
{
12+
self = [super init];
13+
if (self != nil) {
14+
15+
}
16+
return self;
17+
}
18+
19+
- (void) register:(NSString*) module
20+
{
21+
assert([@"node_sqlite3" isEqualToString:module]);
22+
register_node_sqlite3();
23+
}
24+
25+
- (void) require:(JSValue*) binding service:(LCMicroService *)service
26+
{
27+
assert(binding != nil);
28+
assert([binding isObject]);
29+
}
30+
31+
@end
32+
33+
@interface SQLite3Factory : LCAddOnFactory
34+
35+
@end
36+
37+
@implementation SQLite3Factory
38+
39+
- (id) init
40+
{
41+
self = [super init];
42+
if (self) {
43+
44+
}
45+
return self;
46+
}
47+
48+
- (id<LCAddOn>)createInstance
49+
{
50+
return [[SQLite3 alloc] init];
51+
}
52+
53+
@end
54+
55+
__attribute__((constructor))
56+
static void coreJSRegistration()
57+
{
58+
[LCAddOnFactory registerAddOnFactory:@"sqlite3" factory:[[SQLite3Factory alloc] init]];
59+
}

node-sqlite3.podspec

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Pod::Spec.new do |s|
2+
s.name = "node-sqlite3"
3+
s.version = "0.6.0"
4+
s.summary = "Asynchronous, non-blocking SQLite3 bindings for LiqudCore"
5+
6+
s.description = <<-DESC
7+
Asynchronous, non-blocking SQLite3 bindings for Node.js and LiquidCore.
8+
DESC
9+
10+
s.homepage = "https://github.com/LiquidPlayer/node-sqlite3"
11+
s.license = {:type => "BSD-3", :file => "LICENSE"}
12+
13+
s.author = { "Eric Lange" => "eric@flicket.tv" }
14+
15+
s.platform = :ios, '10.0'
16+
17+
s.source = { :git => "https://github.com/LiquidPlayer/node-sqlit3.git", :tag => "#{s.version}" }
18+
19+
s.source_files =
20+
"src/*.{cc,h}",
21+
"liquidcore/ios/*.{h,m,mm}",
22+
"node_modules/nan/*.h"
23+
24+
# s.public_header_files =
25+
# "caraml-core/caraml-core/LCCaramlJS.h",
26+
# "caraml-core/caraml-core/LCCaramlSurface.h",
27+
# "caraml-core/caraml-core/CaramlView.h",
28+
# "caraml-core/caraml-core/caraml_core.h"
29+
30+
s.libraries = [
31+
'sqlite3', # libsqlite3.tbd
32+
]
33+
34+
s.xcconfig = {
35+
:CLANG_WARN_DOCUMENTATION_COMMENTS => 'NO',
36+
:GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS => 'NO',
37+
:GCC_WARN_64_TO_32_BIT_CONVERSION => 'NO',
38+
39+
:OTHER_CPLUSPLUSFLAGS => [
40+
'-DNODE_WANT_INTERNALS=1',
41+
].join(' '),
42+
43+
}
44+
45+
s.dependency "LiquidCore"
46+
end

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
],
3535
"repository": {
3636
"type": "git",
37-
"url": "git://github.com/mapbox/node-sqlite3.git"
37+
"url": "git://github.com/LiquidCore/node-sqlite3.git"
3838
},
3939
"dependencies": {
4040
"nan": "^2.12.1",

src/async.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define NODE_SQLITE3_SRC_ASYNC_H
33

44
#include "threading.h"
5-
#include <node_version.h>
5+
#include "node_version.h"
66

77
#if defined(NODE_SQLITE3_BOOST_THREADING)
88
#include <boost/thread/mutex.hpp>
@@ -22,11 +22,11 @@ template <class Item, class Parent> class Async {
2222
Parent* parent;
2323

2424
public:
25-
Async(Parent* parent_, Callback cb_)
25+
Async(Parent* parent_, Callback cb_, uv_loop_t *loop_)
2626
: callback(cb_), parent(parent_) {
2727
watcher.data = this;
2828
NODE_SQLITE3_MUTEX_INIT
29-
uv_async_init(uv_default_loop(), &watcher, reinterpret_cast<uv_async_cb>(listener));
29+
uv_async_init(loop_, &watcher, reinterpret_cast<uv_async_cb>(listener));
3030
}
3131

3232
static void listener(uv_async_t* handle, int status) {

0 commit comments

Comments
 (0)