gfx/skia/trunk/include/utils/SkLua.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkLua_DEFINED
michael@0 9 #define SkLua_DEFINED
michael@0 10
michael@0 11 #include "SkClipStack.h"
michael@0 12 #include "SkColor.h"
michael@0 13 #include "SkScalar.h"
michael@0 14 #include "SkString.h"
michael@0 15
michael@0 16 struct lua_State;
michael@0 17
michael@0 18 class SkCanvas;
michael@0 19 class SkMatrix;
michael@0 20 class SkPaint;
michael@0 21 class SkPath;
michael@0 22 struct SkRect;
michael@0 23 class SkRRect;
michael@0 24
michael@0 25 #define SkScalarToLua(x) SkScalarToDouble(x)
michael@0 26 #define SkLuaToScalar(x) SkDoubleToScalar(x)
michael@0 27
michael@0 28 class SkLua {
michael@0 29 public:
michael@0 30 static void Load(lua_State*);
michael@0 31
michael@0 32 SkLua(const char termCode[] = NULL); // creates a new L, will close it
michael@0 33 SkLua(lua_State*); // uses L, will not close it
michael@0 34 ~SkLua();
michael@0 35
michael@0 36 lua_State* get() const { return fL; }
michael@0 37 lua_State* operator*() const { return fL; }
michael@0 38 lua_State* operator->() const { return fL; }
michael@0 39
michael@0 40 bool runCode(const char code[]);
michael@0 41 bool runCode(const void* code, size_t size);
michael@0 42
michael@0 43 void pushBool(bool, const char tableKey[] = NULL);
michael@0 44 void pushString(const char[], const char tableKey[] = NULL);
michael@0 45 void pushString(const char[], size_t len, const char tableKey[] = NULL);
michael@0 46 void pushString(const SkString&, const char tableKey[] = NULL);
michael@0 47 void pushArrayU16(const uint16_t[], int count, const char tableKey[] = NULL);
michael@0 48 void pushColor(SkColor, const char tableKey[] = NULL);
michael@0 49 void pushU32(uint32_t, const char tableKey[] = NULL);
michael@0 50 void pushScalar(SkScalar, const char tableKey[] = NULL);
michael@0 51 void pushRect(const SkRect&, const char tableKey[] = NULL);
michael@0 52 void pushRRect(const SkRRect&, const char tableKey[] = NULL);
michael@0 53 void pushMatrix(const SkMatrix&, const char tableKey[] = NULL);
michael@0 54 void pushPaint(const SkPaint&, const char tableKey[] = NULL);
michael@0 55 void pushPath(const SkPath&, const char tableKey[] = NULL);
michael@0 56 void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
michael@0 57 void pushClipStack(const SkClipStack&, const char tableKey[] = NULL);
michael@0 58 void pushClipStackElement(const SkClipStack::Element& element, const char tableKey[] = NULL);
michael@0 59
michael@0 60 // This SkCanvas lua methods is declared here to benefit from SkLua's friendship with SkCanvas.
michael@0 61 static int lcanvas_getReducedClipStack(lua_State* L);
michael@0 62
michael@0 63 private:
michael@0 64 lua_State* fL;
michael@0 65 SkString fTermCode;
michael@0 66 bool fWeOwnL;
michael@0 67 };
michael@0 68
michael@0 69 #endif

mercurial