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 EXTENSIONS_COMMON_STACK_FRAME_H_
6#define EXTENSIONS_COMMON_STACK_FRAME_H_
7
8#include <vector>
9
10#include "base/memory/scoped_ptr.h"
11#include "base/strings/string16.h"
12
13namespace extensions {
14
15struct StackFrame {
16  StackFrame();
17  StackFrame(const StackFrame& frame);
18  StackFrame(size_t line_number,
19             size_t column_number,
20             const base::string16& source,
21             const base::string16& function);
22  ~StackFrame();
23
24  // Construct a stack frame from a reported plain-text frame.
25  static scoped_ptr<StackFrame> CreateFromText(
26      const base::string16& frame_text);
27
28  bool operator==(const StackFrame& rhs) const;
29
30  size_t line_number;
31  size_t column_number;
32  base::string16 source;
33  base::string16 function;  // optional
34};
35
36typedef std::vector<StackFrame> StackTrace;
37
38}  // namespace extensions
39
40#endif  // EXTENSIONS_COMMON_STACK_FRAME_H_
41
42