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

Side by Side 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, 2 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 # Copyright 2013 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 6
7 from google.appengine.ext import blobstore 7 from google.appengine.ext import blobstore
8 from google.appengine.ext import ndb 8 from google.appengine.ext import ndb
9 9
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if tag == json_obj['default_template']: 63 if tag == json_obj['default_template']:
64 default_key = tmpl_key 64 default_key = tmpl_key
65 if not tmpl_key.get(): 65 if not tmpl_key.get():
66 # Template of the same content does not exist. 66 # Template of the same content does not exist.
67 template = Template(id=content_str, content=content) 67 template = Template(id=content_str, content=content)
68 template.put() 68 template.put()
69 69
70 return default_key 70 return default_key
71 71
72 72
73 def CreateTemplate(content):
74 """Create Template entity for user to share."""
75 content_str = json.dumps(content)
76 tmpl_key = ndb.Key('Template', content_str)
77 if not tmpl_key.get():
78 # Template of the same content does not exist.
79 template = Template(id=content_str, content=content)
80 template.put()
81
82 return tmpl_key
83
84
73 def GetTemplate(tmpl_id): 85 def GetTemplate(tmpl_id):
74 """Get Template entity of given tmpl_id generated by ndb.Key.""" 86 """Get Template entity of given tmpl_id generated by ndb.Key."""
75 # Get entity key. 87 # Get entity key.
76 template = ndb.Key(urlsafe=tmpl_id).get() 88 template = ndb.Key(urlsafe=tmpl_id).get()
77 return json.dumps(template.content) 89 return json.dumps(template.content)
OLDNEW
« 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