brotli 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7de822751d5b3f546404565d93bc0679b0742545
4
- data.tar.gz: 47aa47a72c5db72815ab325e832bb38e2b37934f
3
+ metadata.gz: cd4d6db73c2704ff5b79264456b8ae9f371beb36
4
+ data.tar.gz: 33b074ac4545d43ed2aeb00713573754e24cb4c0
5
5
  SHA512:
6
- metadata.gz: c33554e3f20e4fa992bb0a0730f283695c6bf83df73fb194db522de443a3b652eae7dd84d2671a2ddb8d3452c32e1f6ffa71332b4732c02094ca0fc2963d6f36
7
- data.tar.gz: 3a07f28a8953211b2d7e6884323e8e48ef568cf1d6242de575d0e12daecb9f002921613f213b5ca6242058528eb1d9a78bcb84a4f22feaa9d197845d3a58ea60
6
+ metadata.gz: 536ba6e984a19db3e78f434f9f1b9b91cb90c5d7d1e0bbf84ee436382c05afee7e4912ae3ee03c37bbf732d9d59bc6be80f55dbf0fc245256c14cae264b87fad
7
+ data.tar.gz: 553ae97d40b5df932133af25c3075194a0754b56e0e2fe233302918b94c2cc0aeaf5373f18e74e3bb798bca68e3bbf30d34c35f04a21319880c6043e1052efe2
data/.travis.yml CHANGED
@@ -1,5 +1,16 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache:
4
+ bundler: true
5
+ directories:
6
+ - $HOME/.ccache
7
+
2
8
  rvm:
3
9
  - 2.2.0
10
+ - 2.3.2
11
+ env:
12
+ global:
13
+ - RANTLY_COUNT=10000
14
+ - PATH="/usr/lib/ccache:$PATH"
4
15
  before_install:
5
16
  - gem install bundler
data/brotli.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rake-compiler"
27
27
  spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "rantly"
28
29
  end
data/ext/brotli/brotli.cc CHANGED
@@ -1,4 +1,5 @@
1
1
  #include "brotli.h"
2
+ #include "ruby/thread.h"
2
3
 
3
4
  #define CSTR2SYM(x) ID2SYM(rb_intern(x))
4
5
 
@@ -121,6 +122,27 @@ brotli_deflate_parse_options(brotli::BrotliParams& params, VALUE opts)
121
122
  }
122
123
  }
123
124
 
125
+ struct brotli_deflate_args_t
126
+ {
127
+ char *str;
128
+ size_t str_length;
129
+ brotli::BrotliParams *params;
130
+ std::string buf;
131
+
132
+ } brotli_deflate_args_t;
133
+
134
+ static void *
135
+ brotli_deflate_no_gvl(void *arg)
136
+ {
137
+ struct brotli_deflate_args_t *args = (struct brotli_deflate_args_t *)arg;
138
+
139
+ brotli::BrotliMemIn in(args->str, args->str_length);
140
+ args->buf.reserve(args->str_length * 2 + 1);
141
+ brotli::BrotliStringOut out(&args->buf, args->buf.capacity());
142
+
143
+ return (void *)(bool)brotli::BrotliCompress(*(args->params), &in, &out);
144
+ }
145
+
124
146
  static VALUE
125
147
  brotli_deflate(int argc, VALUE *argv, VALUE self)
126
148
  {
@@ -134,15 +156,17 @@ brotli_deflate(int argc, VALUE *argv, VALUE self)
134
156
  brotli_deflate_parse_options(params, opts);
135
157
  }
136
158
 
137
- brotli::BrotliMemIn in(RSTRING_PTR(str), RSTRING_LEN(str));
138
- std::string buf;
139
- buf.reserve(RSTRING_LEN(str) * 2 + 1);
140
- brotli::BrotliStringOut out(&buf, buf.capacity());
141
- if (!brotli::BrotliCompress(params, &in, &out)) {
159
+ struct brotli_deflate_args_t args = {
160
+ RSTRING_PTR(str),
161
+ RSTRING_LEN(str),
162
+ &params
163
+ };
164
+ if (!rb_thread_call_without_gvl(brotli_deflate_no_gvl, (void *)&args, NULL, NULL)) {
142
165
  rb_raise(rb_eBrotli, "ERROR");
143
166
  }
144
167
 
145
- return rb_str_new(buf.c_str(), buf.size());
168
+
169
+ return rb_str_new(args.buf.c_str(), args.buf.size());
146
170
  }
147
171
 
148
172
  extern "C" {
@@ -1,3 +1,3 @@
1
1
  module Brotli
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brotli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyucy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rantly
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Brotli compressor/decompressor
70
84
  email:
71
85
  - fistfvck@gmail.com
@@ -173,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
187
  version: '0'
174
188
  requirements: []
175
189
  rubyforge_project:
176
- rubygems_version: 2.6.4
190
+ rubygems_version: 2.6.8
177
191
  signing_key:
178
192
  specification_version: 4
179
193
  summary: Brotli compressor/decompressor