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

Unified Diff: src/trusted/plugin/srpc/browser_interface.cc

Issue 2981011: Move plugin/srpc contents to the more appropriately named plugin/common.... (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/plugin/srpc/browser_interface.h ('k') | src/trusted/plugin/srpc/connected_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/plugin/srpc/browser_interface.cc
===================================================================
--- src/trusted/plugin/srpc/browser_interface.cc (revision 2716)
+++ src/trusted/plugin/srpc/browser_interface.cc (working copy)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2008 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.
- */
-
-
-// Portable interface for browser interaction - API invariant portions.
-
-#include "native_client/src/trusted/plugin/npapi/browser_impl_npapi.h"
-
-#include <setjmp.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "native_client/src/include/nacl_string.h"
-#include "native_client/src/include/nacl_elf.h"
-#include "native_client/src/include/portability_io.h"
-#include "native_client/src/shared/npruntime/nacl_npapi.h"
-
-namespace plugin {
-
-const char* BrowserInterface::kNoError = "";
-
-// TODO(polina,sehr): move elf checking code to service_runtime.
-bool BrowserInterface::MightBeElfExecutable(const nacl::string& filename,
- nacl::string* error) {
- FILE* fp = fopen(filename.c_str(), "rb");
- if (fp == NULL) {
- *error = "Load failed: cannot open local file for reading.";
- return false;
- }
- char buf[EI_NIDENT];
- size_t read_amount = fread(buf, sizeof buf, 1, fp);
- fclose(fp);
- if (read_amount != 1) {
- *error = "Load failed: fread should not fail.";
- return false;
- }
- return MightBeElfExecutable(buf, sizeof buf, error);
-}
-
-bool BrowserInterface::MightBeElfExecutable(const char* e_ident_bytes,
- size_t size,
- nacl::string* error) {
- if (size < EI_NIDENT) {
- *error = "Load failed: file too short to be an ELF executable.";
- return false;
- }
- if (strncmp(e_ident_bytes, EI_MAG0123, strlen(EI_MAG0123)) != 0) {
- // This can happen if we read a 404 error page, for example.
- *error = "Load failed: bad magic number; not an ELF executable.";
- return false;
- }
- if (e_ident_bytes[EI_ABIVERSION] != EF_NACL_ABIVERSION) {
- nacl::stringstream ss;
- ss << "Load failed: ABI version mismatch: expected " << EF_NACL_ABIVERSION
- << ", found " << (unsigned) e_ident_bytes[EI_ABIVERSION] << ".";
- *error = ss.str();
- return false;
- }
- *error = kNoError;
- return true;
-}
-
-} // namespace plugin
« no previous file with comments | « src/trusted/plugin/srpc/browser_interface.h ('k') | src/trusted/plugin/srpc/connected_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698