Popular sites on the NTP: add the option to provide the server filename through a...
[chromium-blink-merge.git] / gin / run_microtasks_observer.h
blob7f1431fb2ec253f579e1f487aa9ffc2759d9c6d6
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GIN_RUN_MICROTASKS_OBSERVER_H_
6 #define GIN_RUN_MICROTASKS_OBSERVER_H_
8 #include "base/message_loop/message_loop.h"
9 #include "v8/include/v8.h"
11 namespace gin {
13 // Runs any pending v8 Microtasks each time a task is completed.
14 // TODO(hansmuller); At some point perhaps this can be replaced with
15 // the (currently experimental) Isolate::SetAutorunMicrotasks() method.
17 class RunMicrotasksObserver : public base::MessageLoop::TaskObserver {
18 public:
19 RunMicrotasksObserver(v8::Isolate* isolate);
21 void WillProcessTask(const base::PendingTask& pending_task) override;
22 void DidProcessTask(const base::PendingTask& pending_task) override;
24 private:
25 v8::Isolate* isolate_;
28 } // namespace gin
30 #endif // GIN_RUN_MICROTASKS_OBSERVER_H_