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

Side by Side Diff: extensions/renderer/id_generator_custom_bindings.cc

Issue 1543053002: Switch to standard integer types in extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-extensions-browser
Patch Set: Created 5 years 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
« no previous file with comments | « extensions/renderer/i18n_custom_bindings.cc ('k') | extensions/renderer/injection_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "extensions/renderer/id_generator_custom_bindings.h" 5 #include "extensions/renderer/id_generator_custom_bindings.h"
6 6
7 #include <stdint.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 10
9 namespace extensions { 11 namespace extensions {
10 12
11 IdGeneratorCustomBindings::IdGeneratorCustomBindings(ScriptContext* context) 13 IdGeneratorCustomBindings::IdGeneratorCustomBindings(ScriptContext* context)
12 : ObjectBackedNativeHandler(context) { 14 : ObjectBackedNativeHandler(context) {
13 RouteFunction("GetNextId", 15 RouteFunction("GetNextId",
14 base::Bind(&IdGeneratorCustomBindings::GetNextId, 16 base::Bind(&IdGeneratorCustomBindings::GetNextId,
15 base::Unretained(this))); 17 base::Unretained(this)));
16 } 18 }
17 19
18 void IdGeneratorCustomBindings::GetNextId( 20 void IdGeneratorCustomBindings::GetNextId(
19 const v8::FunctionCallbackInfo<v8::Value>& args) { 21 const v8::FunctionCallbackInfo<v8::Value>& args) {
20 static int32_t next_id = 0; 22 static int32_t next_id = 0;
21 ++next_id; 23 ++next_id;
22 // Make sure 0 is never returned because some APIs (particularly WebRequest) 24 // Make sure 0 is never returned because some APIs (particularly WebRequest)
23 // have special meaning for 0 IDs. 25 // have special meaning for 0 IDs.
24 if (next_id == 0) 26 if (next_id == 0)
25 next_id = 1; 27 next_id = 1;
26 args.GetReturnValue().Set(next_id); 28 args.GetReturnValue().Set(next_id);
27 } 29 }
28 30
29 } // namespace extensions 31 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/i18n_custom_bindings.cc ('k') | extensions/renderer/injection_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698