From 232eb4238d89fe5d310c343c23ed2424d5ef9822 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 28 Aug 2013 10:43:39 +0300 Subject: Enable use of profiler without debug window (#12465) This change also corrects a typo in the name of the internal method setProfilerResultConsumer() Change-Id: I877858d992611512ee681022312de7a9bfa4cd39 --- client/src/com/vaadin/client/Profiler.java | 18 +++++++++--------- .../vaadin/client/debug/internal/ProfilerSection.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/src/com/vaadin/client/Profiler.java b/client/src/com/vaadin/client/Profiler.java index bcbf8279f3..083f2559b1 100644 --- a/client/src/com/vaadin/client/Profiler.java +++ b/client/src/com/vaadin/client/Profiler.java @@ -273,7 +273,9 @@ public class Profiler { } }); - getConsumer().addProfilerData(stack.getFirst(), totalList); + if (getConsumer() != null) { + getConsumer().addProfilerData(stack.getFirst(), totalList); + } } /** @@ -325,7 +327,9 @@ public class Profiler { return; } - getConsumer().addBootstrapData(timings); + if (getConsumer() != null) { + getConsumer().addBootstrapData(timings); + } } } @@ -386,11 +390,11 @@ public class Profiler { * Warning! This is internal API and should not be used by * applications or add-ons. * - * @since 7.1 + * @since 7.1.4 * @param profilerResultConsumer * the consumer that gets profiler data */ - public static void setProfilerResultConsuer( + public static void setProfilerResultConsumer( ProfilerResultConsumer profilerResultConsumer) { if (consumer != null) { throw new IllegalStateException("The consumer has already been set"); @@ -399,11 +403,7 @@ public class Profiler { } private static ProfilerResultConsumer getConsumer() { - if (consumer == null) { - throw new IllegalStateException("No consumer has been registered"); - } else { - return consumer; - } + return consumer; } private static Logger getLogger() { diff --git a/client/src/com/vaadin/client/debug/internal/ProfilerSection.java b/client/src/com/vaadin/client/debug/internal/ProfilerSection.java index 91f626b9a5..4a2a3a1c38 100644 --- a/client/src/com/vaadin/client/debug/internal/ProfilerSection.java +++ b/client/src/com/vaadin/client/debug/internal/ProfilerSection.java @@ -283,7 +283,7 @@ public class ProfilerSection implements Section { private final FlowPanel content = new FlowPanel(); public ProfilerSection() { - Profiler.setProfilerResultConsuer(new ProfilerResultConsumer() { + Profiler.setProfilerResultConsumer(new ProfilerResultConsumer() { @Override public void addProfilerData(Node rootNode, List totals) { double totalTime = 0; -- cgit v1.2.3