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

Unified Diff: tools/deep_memory_profiler/visualizer/services.py

Issue 24534002: Add share button to generate public url for dmprof visualizer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review problems Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/deep_memory_profiler/visualizer/services.py
diff --git a/tools/deep_memory_profiler/visualizer/services.py b/tools/deep_memory_profiler/visualizer/services.py
index ac146fbca6f72dd9639dc124b87488540f4e3a09..8f7c8c7df8bbb599f70ceb3f9c31cdb18453af0d 100644
--- a/tools/deep_memory_profiler/visualizer/services.py
+++ b/tools/deep_memory_profiler/visualizer/services.py
@@ -70,6 +70,18 @@ def CreateTemplates(blob_info):
return default_key
+def CreateTemplate(content):
+ """Create Template entity for user to share."""
+ content_str = json.dumps(content)
+ tmpl_key = ndb.Key('Template', content_str)
+ if not tmpl_key.get():
+ # Template of the same content does not exist.
+ template = Template(id=content_str, content=content)
+ template.put()
+
+ return tmpl_key
+
+
def GetTemplate(tmpl_id):
"""Get Template entity of given tmpl_id generated by ndb.Key."""
# Get entity key.
« no previous file with comments | « tools/deep_memory_profiler/visualizer/index.html ('k') | tools/deep_memory_profiler/visualizer/static/index.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698