[tracing] Move logic to defer task posting into the scheduler

The current implementation of DISALLOW_POSTTASK sometimes leads to
losing data from traces. Move it inside the scheduler and make it more
precise.

Also remove DISALLOW_POSTTASK from tracing queue size: there we can
compute the value under the lock and emit trace event outside of the
lock scope.

R=skyostil@chromium.org,gab@chromium.org
CC=eseckler@chromium.org,oysteine@chromium.org,nuskos@chromium.org

Change-Id: I8d7302dbe3ca4ac5543cf3dfcc79202cf8b4ca49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594756
Commit-Queue: Alexander Timin <altimin@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: oysteine <oysteine@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#657886}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 93b4813518647de4dd50159ae123ed82f1bef9db
diff --git a/trace_event_common.h b/trace_event_common.h
index c6fed99..f1878a1 100644
--- a/trace_event_common.h
+++ b/trace_event_common.h
@@ -1072,7 +1072,6 @@
 #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11))
 #define TRACE_EVENT_FLAG_HAS_LOCAL_ID (static_cast<unsigned int>(1 << 12))
 #define TRACE_EVENT_FLAG_HAS_GLOBAL_ID (static_cast<unsigned int>(1 << 13))
-#define TRACE_EVENT_FLAG_DISALLOW_POSTTASK (static_cast<unsigned int>(1 << 14))
 // TODO(eseckler): Remove once we have native support for typed proto events in
 // TRACE_EVENT macros.
 #define TRACE_EVENT_FLAG_TYPED_PROTO_ARGS (static_cast<unsigned int>(1 << 15))