Kouhei Sutou
null+****@clear*****
Tue Jul 11 17:04:54 JST 2017
Kouhei Sutou 2017-07-11 17:04:54 +0900 (Tue, 11 Jul 2017) New Revision: dd46858c9467987249f35ca4a56177e82b7f17bd https://github.com/ranguba/chupa-text-decomposer-webkit/commit/dd46858c9467987249f35ca4a56177e82b7f17bd Message: Reduce using resource Modified files: lib/chupa-text/decomposers/webkit.rb Modified: lib/chupa-text/decomposers/webkit.rb (+3 -2) =================================================================== --- lib/chupa-text/decomposers/webkit.rb 2017-07-11 10:00:23 +0900 (d986885) +++ lib/chupa-text/decomposers/webkit.rb 2017-07-11 17:04:54 +0900 (2d33bfb) @@ -59,8 +59,8 @@ module ChupaText def create_screenshot(data) screenshot = nil - view_context = WebKit2Gtk::WebContext.new(ephemeral: true) - view = WebKit2Gtk::WebView.new(context: view_context) + @@view_context ||= WebKit2Gtk::WebContext.new(ephemeral: true) + view = WebKit2Gtk::WebView.new(context: @@view_context) window = Gtk::OffscreenWindow.new window.set_default_size(800, 600) window.add(view) @@ -104,6 +104,7 @@ module ChupaText until finished main_context.iteration(true) end + window.destroy screenshot end -------------- next part -------------- HTML����������������������������... Descargar