Permalink
Browse files

Add!

  • Loading branch information...
1 parent ef2101a commit 7bfb38f1afdc0491b2fc97616a257d032f756c6a @mainroach committed Apr 26, 2012
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin-port1", "plugin-port1\plugin-port1.vcxproj", "{8F481733-18A7-4299-8ADF-EDD970F73349}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8F481733-18A7-4299-8ADF-EDD970F73349}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8F481733-18A7-4299-8ADF-EDD970F73349}.Debug|Win32.Build.0 = Debug|Win32
+ {8F481733-18A7-4299-8ADF-EDD970F73349}.Release|Win32.ActiveCfg = Release|Win32
+ {8F481733-18A7-4299-8ADF-EDD970F73349}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Binary file not shown.
@@ -0,0 +1,17 @@
+uniform sampler2D testTexture;
+
+void main( void )
+{
+ // NOTE:
+ //
+ // The gl_Color variable used here is not the same one used in the vertex
+ // shader. Each shader gets it own.
+ //
+ // For a fragment shader, the values in gl_Color and gl_SecondaryColor
+ // will be derived automatically by the system from gl_FrontColor,
+ // gl_BackColor, gl_FrontSecondaryColor, and gl_BackSecondaryColor based
+ // on which face is visible.
+
+ //gl_FragColor = texture2D( testTexture, gl_TexCoord[0] ) * gl_Color; // Modulate texel color with vertex color
+ gl_FragColor = texture2D( testTexture, gl_TexCoord[0].xy ) + gl_Color; // Add texel color to vertex color
+}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,113 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2011, The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+
+"""A tiny web server.
+
+This is intended to be used for testing, and only run from within the examples
+directory.
+"""
+
+import BaseHTTPServer
+import logging
+import os
+import SimpleHTTPServer
+import SocketServer
+import sys
+import urlparse
+
+logging.getLogger().setLevel(logging.INFO)
+
+# Using 'localhost' means that we only accept connections
+# via the loop back interface.
+SERVER_PORT = 5103
+SERVER_HOST = ''
+
+# We only run from the examples directory (the one that contains scons-out), so
+# that not too much is exposed via this HTTP server. Everything in the
+# directory is served, so there should never be anything potentially sensitive
+# in the serving directory, especially if the machine might be a
+# multi-user machine and not all users are trusted. We only serve via
+# the loopback interface.
+
+SAFE_DIR_COMPONENTS = ['nacl']
+SAFE_DIR_SUFFIX = apply(os.path.join, SAFE_DIR_COMPONENTS)
+
+def SanityCheckDirectory():
+ return
+ logging.error('httpd.py should only be run from the %s', SAFE_DIR_SUFFIX)
+ logging.error('directory for testing purposes.')
+ logging.error('We are currently in %s', os.getcwd())
+ sys.exit(1)
+
+
+# An HTTP server that will quit when |is_running| is set to False. We also use
+# SocketServer.ThreadingMixIn in order to handle requests asynchronously for
+# faster responses.
+class QuittableHTTPServer(SocketServer.ThreadingMixIn,
+ BaseHTTPServer.HTTPServer):
+ def serve_forever(self, timeout=0.5):
+ self.is_running = True
+ self.timeout = timeout
+ while self.is_running:
+ self.handle_request()
+
+ def shutdown(self):
+ self.is_running = False
+ return 1
+
+
+# "Safely" split a string at |sep| into a [key, value] pair. If |sep| does not
+# exist in |str|, then the entire |str| is the key and the value is set to an
+# empty string.
+def KeyValuePair(str, sep='='):
+ if sep in str:
+ return str.split(sep)
+ else:
+ return [str, '']
+
+
+# A small handler that looks for '?quit=1' query in the path and shuts itself
+# down if it finds that parameter.
+class QuittableHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+ def do_GET(self):
+ (_, _, _, query, _) = urlparse.urlsplit(self.path)
+ url_params = dict([KeyValuePair(key_value)
+ for key_value in query.split('&')])
+ if 'quit' in url_params and '1' in url_params['quit']:
+ self.send_response(200, 'OK')
+ self.send_header('Content-type', 'text/html')
+ self.send_header('Content-length', '0')
+ self.end_headers()
+ self.server.shutdown()
+ return
+
+ SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
+
+
+def Run(server_address,
+ server_class=QuittableHTTPServer,
+ handler_class=QuittableHTTPHandler):
+ httpd = server_class(server_address, handler_class)
+ logging.info("Starting local server on port %d", server_address[1])
+ logging.info("To shut down send http://localhost:%d?quit=1",
+ server_address[1])
+ try:
+ httpd.serve_forever()
+ except KeyboardInterrupt:
+ logging.info("Received keyboard interrupt.")
+ httpd.server_close()
+
+ logging.info("Shutting down local server on port %d", server_address[1])
+
+
+if __name__ == '__main__':
+ SanityCheckDirectory()
+ if len(sys.argv) > 1:
+ Run((SERVER_HOST, int(sys.argv[1])))
+ else:
+ Run((SERVER_HOST, SERVER_PORT))
+ sys.exit(0)
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html>
+ <!--
+ Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+ -->
+<head>
+ <title>Hello, World!</title>
+ <script type="text/javascript">
+ helloWorldModule = null; // Global application object.
+ statusText = 'NO-STATUS';
+
+ // Indicate success when the NaCl module has loaded.
+ function moduleDidLoad()
+ {
+ helloWorldModule = document.getElementById('hello_world');
+ updateStatus('SUCCESS');
+ }
+
+ // Handle a message coming from the NaCl module.
+ function handleMessage(message_event)
+ {
+ alert(message_event.data);
+ }
+
+ // If the page loads before the Native Client module loads, then set the
+ // status message indicating that the module is still loading. Otherwise,
+ // do not change the status message.
+ function pageDidLoad()
+ {
+ if (helloWorldModule == null)
+ {
+ updateStatus('LOADING...');
+ } else
+ {
+ // It's possible that the Native Client module onload event fired
+ // before the page's onload event. In this case, the status message
+ // will reflect 'SUCCESS', but won't be displayed. This call will
+ // display the current message.
+ updateStatus();
+ }
+ }
+
+ // Set the global status message. If the element with id 'statusField'
+ // exists, then set its HTML to the status message as well.
+ // opt_message The message test. If this is null or undefined, then
+ // attempt to set the element with id 'statusField' to the value of
+ // |statusText|.
+ function updateStatus(opt_message)
+ {
+ if (opt_message)
+ statusText = opt_message;
+ var statusField = document.getElementById('statusField');
+ if (statusField)
+ {
+ statusField.innerHTML = statusText;
+ }
+ }
+ </script>
+</head>
+<body onload="pageDidLoad()">
+
+<h1>Native Client Simple Module</h1>
+<h2>Status: <code id="statusField">NO-STATUS</code></h2>
+ <!-- The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
+ and a 'message' event listener attached. This wrapping method is used
+ instead of attaching the event listeners directly to the <EMBED> element to
+ ensure that the listeners are active before the NaCl module 'load' event
+ fires. This also allows you to use PPB_Messaging.PostMessage() (in C) or
+ pp::Instance.PostMessage() (in C++) from within the initialization code in
+ your NaCl module.
+
+ The src points to a manifest file, which provides the Native Client plug-in
+ a mapping between architecture and NaCl Executable (NEXE).
+
+ We use a non-zero sized embed to give Chrome space to place the bad plug-in
+ graphic, if there is a problem.
+ -->
+ <div id="listener">
+ <script type="text/javascript">
+ var listener = document.getElementById('listener')
+ listener.addEventListener('load', moduleDidLoad, true);
+ listener.addEventListener('message', handleMessage, true);
+ </script>
+
+ <embed name="nacl_module"
+ id="hello_world"
+ width=200 height=200
+ src="hello_world.nmf"
+ type="application/x-nacl" />
+ </div>
+</body>
+</html>
Oops, something went wrong.

0 comments on commit 7bfb38f

Please sign in to comment.