1 // Copyright 2013 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. 4 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_HEAP_SNAPSHOT_TAKER_H_ 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_HEAP_SNAPSHOT_TAKER_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "base/compiler_specific.h" 12 #include "base/memory/scoped_ptr.h" 13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" 14 15 namespace base { 16 class DictionaryValue; 17 class Value; 18 } 19 20 class DevToolsClient; 21 class Status; 22 23 // Take the heap snapshot. 24 class HeapSnapshotTaker : public DevToolsEventListener { 25 public: 26 explicit HeapSnapshotTaker(DevToolsClient* client); 27 virtual ~HeapSnapshotTaker(); 28 29 Status TakeSnapshot(scoped_ptr<base::Value>* snapshot); 30 31 // Overridden from DevToolsEventListener: 32 virtual Status OnEvent(DevToolsClient* client, 33 const std::string& method, 34 const base::DictionaryValue& params) OVERRIDE; 35 36 private: 37 Status TakeSnapshotInternal(); 38 39 DevToolsClient* client_; 40 std::string snapshot_; 41 42 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotTaker); 43 }; 44 45 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_HEAP_SNAPSHOT_TAKER_H_ 46