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

Side by Side Diff: third_party/grpc/src/core/census/aggregation.h

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/grpc/src/core/census/README.md ('k') | third_party/grpc/src/core/census/context.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
3 * 5 *
4 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
6 * met: 8 * met:
7 * 9 *
8 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 12 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 13 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 14 * in the documentation and/or other materials provided with the
13 * distribution. 15 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 16 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 17 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 18 * this software without specific prior written permission.
17 * 19 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
29 */ 32 */
30 33
31 #ifndef CryptoKey_h 34 #include <stddef.h>
32 #define CryptoKey_h
33 35
34 #include "bindings/core/v8/ScriptWrappable.h" 36 #ifndef GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H
35 #include "modules/crypto/NormalizeAlgorithm.h" 37 #define GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H
36 #include "platform/heap/Handle.h"
37 #include "public/platform/WebCryptoKey.h"
38 #include "wtf/Forward.h"
39 #include "wtf/text/WTFString.h"
40 38
41 namespace blink { 39 /** Structure used to describe an aggregation type. */
42 40 struct census_aggregation_ops {
43 class CryptoResult; 41 /* Create a new aggregation. The pointer returned can be used in future calls
44 42 to clone(), free(), record(), data() and reset(). */
45 class CryptoKey final : public GarbageCollectedFinalized<CryptoKey>, public Scri ptWrappable { 43 void *(*create)(const void *create_arg);
46 DEFINE_WRAPPERTYPEINFO(); 44 /* Make a copy of an aggregation created by create() */
47 public: 45 void *(*clone)(const void *aggregation);
48 static CryptoKey* create(const WebCryptoKey& key) 46 /* Destroy an aggregation created by create() */
49 { 47 void (*free)(void *aggregation);
50 return new CryptoKey(key); 48 /* Record a new value against aggregation. */
51 } 49 void (*record)(void *aggregation, double value);
52 50 /* Return current aggregation data. The caller must cast this object into
53 ~CryptoKey(); 51 the correct type for the aggregation result. The object returned can be
54 52 freed by using free_data(). */
55 String type() const; 53 void *(*data)(const void *aggregation);
56 bool extractable() const; 54 /* free data returned by data() */
57 ScriptValue algorithm(ScriptState*); 55 void (*free_data)(void *data);
58 Vector<String> usages() const; 56 /* Reset an aggregation to default (zero) values. */
59 57 void (*reset)(void *aggregation);
60 const WebCryptoKey& key() const { return m_key; } 58 /* Merge 'from' aggregation into 'to'. Both aggregations must be compatible */
61 59 void (*merge)(void *to, const void *from);
62 // If the key cannot be used with the indicated algorithm, returns false 60 /* Fill buffer with printable string version of aggregation contents. For
63 // and completes the CryptoResult with an error. 61 debugging only. Returns the number of bytes added to buffer (a value == n
64 bool canBeUsedForAlgorithm(const WebCryptoAlgorithm&, WebCryptoKeyUsage, Cry ptoResult*) const; 62 implies the buffer was of insufficient size). */
65 63 size_t (*print)(const void *aggregation, char *buffer, size_t n);
66 // On failure, these return false and complete the CryptoResult with an erro r.
67 static bool parseFormat(const String&, WebCryptoKeyFormat&, CryptoResult*);
68 static bool parseUsageMask(const Vector<String>&, WebCryptoKeyUsageMask&, Cr yptoResult*);
69
70 DEFINE_INLINE_TRACE() { }
71
72 protected:
73 explicit CryptoKey(const WebCryptoKey&);
74
75 const WebCryptoKey m_key;
76 }; 64 };
77 65
78 } // namespace blink 66 #endif /* GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H */
79
80 #endif // CryptoKey_h
OLDNEW
« no previous file with comments | « third_party/grpc/src/core/census/README.md ('k') | third_party/grpc/src/core/census/context.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698