Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp

Issue 2776523005: Plumbing devtools agent host id and request id between processes (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } // namespace 42 } // namespace
43 43
44 // static 44 // static
45 String IdentifiersFactory::CreateIdentifier() { 45 String IdentifiersFactory::CreateIdentifier() {
46 int identifier = AtomicIncrement(&g_last_used_identifier); 46 int identifier = AtomicIncrement(&g_last_used_identifier);
47 return AddProcessIdPrefixTo(identifier); 47 return AddProcessIdPrefixTo(identifier);
48 } 48 }
49 49
50 // static 50 // static
51 String IdentifiersFactory::RequestId(unsigned long identifier) { 51 String IdentifiersFactory::RequestId(unsigned long identifier) {
52 // Odd request Ids are set by the browser. For those we use a PID of 0
53 // because for browser side navigations the PID may not be known when an event
54 // is sent because the renderer hasn't been created yet.
55 int signed_identifier = static_cast<int>(identifier);
56 if (signed_identifier < 0) {
57 StringBuilder builder;
58 builder.Append("0.");
59 builder.AppendNumber(signed_identifier);
60 return builder.ToString();
61 }
52 return identifier ? AddProcessIdPrefixTo(identifier) : String(); 62 return identifier ? AddProcessIdPrefixTo(identifier) : String();
53 } 63 }
54 64
55 // static 65 // static
56 String IdentifiersFactory::FrameId(LocalFrame* frame) { 66 String IdentifiersFactory::FrameId(LocalFrame* frame) {
57 return AddProcessIdPrefixTo(WeakIdentifierMap<LocalFrame>::Identifier(frame)); 67 return AddProcessIdPrefixTo(WeakIdentifierMap<LocalFrame>::Identifier(frame));
58 } 68 }
59 69
60 // static 70 // static
61 LocalFrame* IdentifiersFactory::FrameById(InspectedFrames* inspected_frames, 71 LocalFrame* IdentifiersFactory::FrameById(InspectedFrames* inspected_frames,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 size_t dot_index = id.Find('.'); 117 size_t dot_index = id.Find('.');
108 118
109 if (dot_index == kNotFound) { 119 if (dot_index == kNotFound) {
110 *ok = false; 120 *ok = false;
111 return 0; 121 return 0;
112 } 122 }
113 return id.Substring(dot_index + 1).ToInt(ok); 123 return id.Substring(dot_index + 1).ToInt(ok);
114 } 124 }
115 125
116 } // namespace blink 126 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698