Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H | |
| 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/trace_event/blame_context.h" | |
| 10 | |
| 11 namespace base { | |
| 12 namespace trace_event { | |
| 13 class TracedValue; | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class FrameTreeNode; | |
| 20 | |
| 21 class FrameTreeNodeBlameContext : public base::trace_event::BlameContext { | |
|
Charlie Reis
2016/04/20 16:58:58
This class needs comments explaining the context f
Xiaocheng
2016/04/21 08:01:32
Done.
| |
| 22 public: | |
| 23 FrameTreeNodeBlameContext(FrameTreeNode* node); | |
| 24 ~FrameTreeNodeBlameContext() override; | |
| 25 | |
| 26 // There are two patterns for getting argument values of a snapshot, both of | |
| 27 // which have potential threading issues: | |
| 28 // 1. When taking a snapshot, copy the arguments from the FrameTreeNode; | |
| 29 // 2. When a FrameTreeNode navigates, copy the arguments to BlameContext. | |
| 30 // We adopt the second approach which looks less troublesome with threading. | |
| 31 void UpdateArguments(FrameTreeNode* node); | |
| 32 void ClearArguments(); | |
| 33 | |
| 34 private: | |
| 35 // FIXME: A data race can occur if tracing starts when the main thread is in | |
| 36 // the middle of UpdateArguments() or ClearArguments(). AsValueInto() may | |
| 37 // generate undefined result in this case. | |
| 38 void AsValueInto(base::trace_event::TracedValue* value) override; | |
| 39 | |
| 40 int process_id_; | |
| 41 int routing_id_; | |
| 42 std::string url_; | |
|
Charlie Reis
2016/04/20 16:58:58
Why is a URL being stored in a string? I would re
benjhayden
2016/04/20 17:29:45
That's my fault. You're right, there should be a c
Xiaocheng
2016/04/21 08:01:32
I agree that a URL shouldn't be stored as a string
| |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(FrameTreeNodeBlameContext); | |
| 45 }; | |
| 46 | |
| 47 } // content | |
| 48 | |
| 49 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_BLAME_CONTEXT_H | |
| OLD | NEW |