diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-25 23:37:16 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-12-26 14:11:04 +0100 |
commit | c86424a72d229c519179a6cdf1d37e93b46e1e38 (patch) | |
tree | a871abfe4d8064f48744ce75e59e3fc7eebbcb52 /actionpack/lib/action_view/render/rendering.rb | |
parent | 48273a44c6176b72e432f365c7905fd8c4d4b754 (diff) | |
download | rails-c86424a72d229c519179a6cdf1d37e93b46e1e38.tar.gz rails-c86424a72d229c519179a6cdf1d37e93b46e1e38.tar.bz2 rails-c86424a72d229c519179a6cdf1d37e93b46e1e38.zip |
Break instrumentation into several end-points so rendering of partials can be optimized.
Diffstat (limited to 'actionpack/lib/action_view/render/rendering.rb')
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index c4033fad9e..5e7dd3e2df 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -77,16 +77,19 @@ module ActionView end def _render_inline(inline, layout, options) - handler = Template.handler_class_for_extension(options[:type] || "erb") - template = Template.new(options[:inline], "inline template", handler, {}) + locals = options[:locals] - locals = options[:locals] - content = template.render(self, locals) + content = ActiveSupport::Notifications.instrument(:render_inline) do + handler = Template.handler_class_for_extension(options[:type] || "erb") + template = Template.new(options[:inline], "inline template", handler, {}) + template.render(self, locals) + end _render_text(content, layout, locals) end def _render_text(content, layout, locals) + ActiveSupport::Notifications.instrument(:render_text) content = _render_layout(layout, locals){ content } if layout content end @@ -110,8 +113,13 @@ module ActionView msg end - locals = options[:locals] || {} - content = partial ? _render_partial_object(template, options) : template.render(self, locals) + locals = options[:locals] || {} + + content = ActiveSupport::Notifications.instrument(:render_template, + :identifier => template.identifier, :layout => (layout ? layout.identifier : nil)) do + partial ? _render_partial_object(template, options) : template.render(self, locals) + end + @_content_for[:layout] = content if layout @@ -124,7 +132,9 @@ module ActionView end def _render_layout(layout, locals, &block) - layout.render(self, locals){ |*name| _layout_for(*name, &block) } + ActiveSupport::Notifications.instrument(:render_layout, :identifier => layout.identifier) do + layout.render(self, locals){ |*name| _layout_for(*name, &block) } + end end end end |